Merge ../../yap-6.3
This commit is contained in:
commit
1b2aa6417c
@ -2121,7 +2121,7 @@ X_API int YAP_InitConsult(int mode, const char *fname, char *full, int *osnop) {
|
||||
}
|
||||
}
|
||||
bool consulted = (mode == YAP_CONSULT_MODE);
|
||||
sno = Yap_OpenStream(fl, "r", MkAtomTerm(Yap_LookupAtom(fl)));
|
||||
sno = Yap_OpenStream(fl, "r", MkAtomTerm(Yap_LookupAtom(fl)), LOCAL_encoding);
|
||||
if (sno < 0)
|
||||
return sno;
|
||||
if (!Yap_ChDir(dirname((char *)fl))) return -1;
|
||||
|
@ -4913,11 +4913,15 @@ static Int cont_current_key_integer(USES_REGS1) {
|
||||
|
||||
Term Yap_FetchTermFromDB(void *ref) {
|
||||
CACHE_REGS
|
||||
if (ref == NULL)
|
||||
return 0;
|
||||
return GetDBTerm(ref, FALSE PASS_REGS);
|
||||
}
|
||||
|
||||
Term Yap_FetchClauseTermFromDB(void *ref) {
|
||||
CACHE_REGS
|
||||
if (ref == NULL)
|
||||
return 0;
|
||||
return GetDBTerm(ref, TRUE PASS_REGS);
|
||||
}
|
||||
|
||||
|
86
C/flags.c
86
C/flags.c
@ -51,7 +51,9 @@ static Term indexer(Term inp);
|
||||
static Term stream(Term inp);
|
||||
static bool getenc(Term inp);
|
||||
static bool typein(Term inp);
|
||||
static bool dqf(Term t2);
|
||||
static bool dqs(Term t2);
|
||||
static bool bqs(Term t2);
|
||||
static bool sqf(Term t2);
|
||||
static bool set_error_stream(Term inp);
|
||||
static bool set_input_stream(Term inp);
|
||||
static bool set_output_stream(Term inp);
|
||||
@ -125,7 +127,7 @@ static bool dqf1(ModEntry *new, Term t2 USES_REGS) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool dqf(Term t2) {
|
||||
static bool dqs(Term t2) {
|
||||
CACHE_REGS
|
||||
ModEntry *new = Yap_GetModuleEntry(CurrentModule);
|
||||
return dqf1(new, t2 PASS_REGS);
|
||||
@ -159,6 +161,48 @@ static bool bqf1(ModEntry *new, Term t2 USES_REGS) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool bqs(Term t2) {
|
||||
CACHE_REGS
|
||||
ModEntry *new = Yap_GetModuleEntry(CurrentModule);
|
||||
return bqf1(new, t2 PASS_REGS);
|
||||
}
|
||||
|
||||
|
||||
static bool sqf1(ModEntry *new, Term t2 USES_REGS) {
|
||||
new->flags &= ~(SNGQ_CHARS | SNGQ_CODES | SNGQ_ATOM | SNGQ_STRING);
|
||||
if (IsAtomTerm(t2)) {
|
||||
if (t2 == TermString) {
|
||||
new->flags |= SNGQ_STRING;
|
||||
return true;
|
||||
} else if (t2 == TermAtom) {
|
||||
new->flags |= SNGQ_ATOM;
|
||||
return true;
|
||||
} else if (t2 == TermCodes) {
|
||||
new->flags |= SNGQ_CODES;
|
||||
return true;
|
||||
} else if (t2 == TermChars) {
|
||||
new->flags |= SNGQ_CHARS;
|
||||
return true;
|
||||
}
|
||||
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, t2, "bad option %s for backquoted "
|
||||
"string flag, use one string, "
|
||||
"atom, codes or chars",
|
||||
RepAtom(AtomOfTerm(t2))->StrOfAE);
|
||||
return false;
|
||||
} else {
|
||||
Yap_Error(TYPE_ERROR_ATOM, t2, "flag %s is not module-scoped",
|
||||
RepAtom(AtomOfTerm(t2))->StrOfAE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool sqf(Term t2) {
|
||||
CACHE_REGS
|
||||
ModEntry *new = Yap_GetModuleEntry(CurrentModule);
|
||||
return sqf1(new, t2 PASS_REGS);
|
||||
}
|
||||
|
||||
static Term isaccess(Term inp) {
|
||||
if (inp == TermReadWrite || inp == TermReadOnly)
|
||||
return inp;
|
||||
@ -715,9 +759,11 @@ static bool setYapFlagInModule(Term tflag, Term t2, Term mod) {
|
||||
"bad option %s for character_escapes flag, use true or false",
|
||||
RepAtom(AtomOfTerm(tflag))->StrOfAE);
|
||||
return false;
|
||||
} else if (fv->FlagOfVE == BACKQUOTED_STRING_FLAG) {
|
||||
} else if (fv->FlagOfVE == BACK_QUOTES_FLAG) {
|
||||
return bqf1(me, t2 PASS_REGS);
|
||||
;
|
||||
} else if (fv->FlagOfVE == SINGLE_QUOTES_FLAG) {
|
||||
return sqf1(me, t2 PASS_REGS);
|
||||
|
||||
}
|
||||
// bad key?
|
||||
return false;
|
||||
@ -744,7 +790,7 @@ static Term getYapFlagInModule(Term tflag, Term mod) {
|
||||
} else if (fv->FlagOfVE == CHARACTER_ESCAPES_FLAG) {
|
||||
if (me->flags & M_CHARESCAPE)
|
||||
return TermTrue;
|
||||
} else if (fv->FlagOfVE == BACKQUOTED_STRING_FLAG) {
|
||||
} else if (fv->FlagOfVE == BACK_QUOTES_FLAG) {
|
||||
if (me->flags & BCKQ_CHARS)
|
||||
return TermChars;
|
||||
if (me->flags & BCKQ_CODES)
|
||||
@ -752,6 +798,14 @@ static Term getYapFlagInModule(Term tflag, Term mod) {
|
||||
if (me->flags & BCKQ_ATOM)
|
||||
return TermAtom;
|
||||
return TermString;
|
||||
} else if (fv->FlagOfVE == SINGLE_QUOTES_FLAG) {
|
||||
if (me->flags & SNGQ_CHARS)
|
||||
return TermChars;
|
||||
if (me->flags & SNGQ_CODES)
|
||||
return TermCodes;
|
||||
if (me->flags & SNGQ_ATOM)
|
||||
return TermAtom;
|
||||
return TermString;
|
||||
} else if (fv->FlagOfVE == DOUBLE_QUOTES_FLAG) {
|
||||
if (me->flags & DBLQ_CHARS)
|
||||
return TermChars;
|
||||
@ -777,7 +831,9 @@ static Int cont_yap_flag(USES_REGS1) {
|
||||
Term modt = CurrentModule;
|
||||
tflag = Yap_StripModule(tflag, &modt);
|
||||
while (i != gmax && i != UNKNOWN_FLAG && i != CHARACTER_ESCAPES_FLAG &&
|
||||
i != BACKQUOTED_STRING_FLAG)
|
||||
i != BACK_QUOTES_FLAG &&
|
||||
i != SINGLE_QUOTES_FLAG &&
|
||||
i != DOUBLE_QUOTES_FLAG)
|
||||
i++;
|
||||
if (i == gmax)
|
||||
cut_fail();
|
||||
@ -982,13 +1038,13 @@ void Yap_setModuleFlags(ModEntry *new, ModEntry *cme) {
|
||||
Atom at = new->AtomOfME;
|
||||
if (at == AtomProlog || CurrentModule == PROLOG_MODULE) {
|
||||
new->flags =
|
||||
M_SYSTEM | UNKNOWN_ERROR | M_CHARESCAPE | DBLQ_CODES | BCKQ_STRING;
|
||||
M_SYSTEM | UNKNOWN_ERROR | M_CHARESCAPE | DBLQ_CODES | BCKQ_STRING |SNGQ_ATOM;
|
||||
if (at == AtomUser)
|
||||
new->flags = UNKNOWN_ERROR | M_CHARESCAPE | DBLQ_CODES | BCKQ_STRING;
|
||||
new->flags = UNKNOWN_ERROR | M_CHARESCAPE | DBLQ_CODES | BCKQ_STRING |SNGQ_ATOM;
|
||||
} else if (cme && cme->flags && cme != new) {
|
||||
new->flags = cme->flags;
|
||||
} else {
|
||||
new->flags = (UNKNOWN_ERROR | M_CHARESCAPE | DBLQ_CODES | BCKQ_STRING);
|
||||
new->flags = (UNKNOWN_ERROR | M_CHARESCAPE | DBLQ_CODES | BCKQ_STRING |SNGQ_ATOM);
|
||||
}
|
||||
// printf("cme=%s new=%s flags=%x\n",cme,at->StrOfAE,new->flags);
|
||||
}
|
||||
@ -1034,7 +1090,9 @@ bool setYapFlag(Term tflag, Term t2) {
|
||||
switch (fv->FlagOfVE) {
|
||||
case UNKNOWN_FLAG:
|
||||
case CHARACTER_ESCAPES_FLAG:
|
||||
case BACKQUOTED_STRING_FLAG:
|
||||
case BACK_QUOTES_FLAG:
|
||||
case DOUBLE_QUOTES_FLAG:
|
||||
case SINGLE_QUOTES_FLAG:
|
||||
return setYapFlagInModule(tflag, t2, CurrentModule);
|
||||
default:
|
||||
tarr = GLOBAL_Flags;
|
||||
@ -1419,7 +1477,9 @@ do_prolog_flag_property(Term tflag,
|
||||
if (fv->global) {
|
||||
if (fv->FlagOfVE == UNKNOWN_FLAG ||
|
||||
fv->FlagOfVE == CHARACTER_ESCAPES_FLAG ||
|
||||
fv->FlagOfVE == BACKQUOTED_STRING_FLAG)
|
||||
fv->FlagOfVE == SINGLE_QUOTES_FLAG ||
|
||||
fv->FlagOfVE == DOUBLE_QUOTES_FLAG ||
|
||||
fv->FlagOfVE == BACK_QUOTES_FLAG)
|
||||
Yap_unify(TermModule, args[PROLOG_FLAG_PROPERTY_SCOPE].tvalue);
|
||||
rc = rc &&
|
||||
Yap_unify(TermGlobal, args[PROLOG_FLAG_PROPERTY_SCOPE].tvalue);
|
||||
@ -1452,7 +1512,9 @@ static Int cont_prolog_flag_property(USES_REGS1) { /* current_prolog_flag */
|
||||
lab = MkAtomTerm(Yap_LookupAtom(local_flags_setup[i - gmax].name));
|
||||
} else {
|
||||
if (i == UNKNOWN_FLAG || i == CHARACTER_ESCAPES_FLAG ||
|
||||
i == BACKQUOTED_STRING_FLAG) {
|
||||
i == SINGLE_QUOTES_FLAG ||
|
||||
i == DOUBLE_QUOTES_FLAG ||
|
||||
i == BACK_QUOTES_FLAG) {
|
||||
Term labs[2];
|
||||
labs[0] = MkVarTerm();
|
||||
labs[1] = MkAtomTerm(Yap_LookupAtom(global_flags_setup[i].name));
|
||||
|
@ -2954,7 +2954,7 @@ yamop *Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc) {
|
||||
if (!Yap_growheap(FALSE, LOCAL_Error_Size, NULL)) {
|
||||
CleanCls(&cint);
|
||||
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
|
||||
return FAILCODE;
|
||||
return NULL;
|
||||
}
|
||||
} else if (setjres == 4) {
|
||||
restore_machine_regs();
|
||||
@ -2962,7 +2962,7 @@ yamop *Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc) {
|
||||
if (!Yap_growtrail(LOCAL_Error_Size, FALSE)) {
|
||||
CleanCls(&cint);
|
||||
Yap_Error(RESOURCE_ERROR_TRAIL, TermNil, LOCAL_ErrorMessage);
|
||||
return FAILCODE;
|
||||
return NULL;
|
||||
}
|
||||
} else if (setjres != 0) {
|
||||
restore_machine_regs();
|
||||
@ -2970,7 +2970,7 @@ yamop *Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc) {
|
||||
if (!Yap_growheap(FALSE, LOCAL_Error_Size, NULL)) {
|
||||
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
|
||||
CleanCls(&cint);
|
||||
return FAILCODE;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
restart_index:
|
||||
@ -2983,7 +2983,7 @@ restart_index:
|
||||
if (compile_index(&cint) == (UInt)FAILCODE) {
|
||||
Yap_ReleaseCMem(&cint);
|
||||
CleanCls(&cint);
|
||||
return FAILCODE;
|
||||
return NULL;
|
||||
}
|
||||
#if DEBUG
|
||||
if (GLOBAL_Option['i' - 'a' + 1]) {
|
||||
|
69
C/yap-args.c
69
C/yap-args.c
@ -125,7 +125,7 @@ static void init_globals(YAP_init_args *yap_init) {
|
||||
has been overwritten ....
|
||||
*/
|
||||
setBooleanGlobalPrologFlag(HALT_AFTER_CONSULT_FLAG,
|
||||
yap_init->HaltAfterConsult);
|
||||
yap_init->HaltAfterBoot);
|
||||
}
|
||||
if (yap_init->PrologTopLevelGoal) {
|
||||
Yap_PutValue(AtomTopLevelGoal,
|
||||
@ -149,7 +149,10 @@ const char *Yap_BINDIR, *Yap_ROOTDIR, *Yap_SHAREDIR, *Yap_LIBDIR, *Yap_DLLDIR,
|
||||
*Yap_PLDIR, *Yap_BOOTSTRAP, *Yap_COMMONSDIR,
|
||||
*Yap_INPUT_STARTUP, *Yap_OUTPUT_STARTUP, *Yap_BOOTFILE, *Yap_INCLUDEDIR;
|
||||
|
||||
/* do initial boot by consulting the file boot.yap */
|
||||
/**
|
||||
* consult loop in C: used to boot the system, butt supports goal execution and recursive consulting.
|
||||
*
|
||||
* */
|
||||
static void consult(const char *b_file USES_REGS) {
|
||||
Term t;
|
||||
int c_stream, osno, oactive;
|
||||
@ -157,7 +160,7 @@ static void consult(const char *b_file USES_REGS) {
|
||||
Functor functor_command1 = Yap_MkFunctor(Yap_LookupAtom(":-"), 1);
|
||||
Functor functor_compile2 = Yap_MkFunctor(Yap_LookupAtom("c_compile"), 1);
|
||||
|
||||
/* consult boot.pl */
|
||||
/* consult in C */
|
||||
int lvl = push_text_stack();
|
||||
char *full = Malloc(YAP_FILENAME_MAX + 1);
|
||||
full[0] = '\0';
|
||||
@ -699,7 +702,7 @@ X_API YAP_file_type_t YAP_parse_yap_arguments(int argc, char *argv[],
|
||||
goto GetSize;
|
||||
}
|
||||
iap->QuietMode = TRUE;
|
||||
iap->HaltAfterConsult = TRUE;
|
||||
iap->HaltAfterBoot = true;
|
||||
case 'l':
|
||||
p++;
|
||||
if (!*++argv) {
|
||||
@ -759,6 +762,7 @@ X_API YAP_file_type_t YAP_parse_yap_arguments(int argc, char *argv[],
|
||||
argv++;
|
||||
iap->PrologTopLevelGoal = add_end_dot(*argv);
|
||||
}
|
||||
iap->HaltAfterBoot = true;
|
||||
break;
|
||||
case 'n':
|
||||
if (!strcmp("nosignals", p)) {
|
||||
@ -967,11 +971,10 @@ static void init_hw(YAP_init_args *yap_init, struct ssz_t *spt) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static YAP_file_type_t end_init(YAP_init_args *yap_init, YAP_file_type_t rc) {
|
||||
static void end_init(YAP_init_args *iap) {
|
||||
YAP_initialized = true;
|
||||
if (iap->HaltAfterBoot) Yap_exit(0);
|
||||
LOCAL_PrologMode &= ~BootMode;
|
||||
CurrentModule = USER_MODULE;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void start_modules(void) {
|
||||
@ -987,14 +990,14 @@ static void start_modules(void) {
|
||||
/* this routine is supposed to be called from an external program
|
||||
that wants to control Yap */
|
||||
|
||||
X_API YAP_file_type_t YAP_Init(YAP_init_args *yap_init) {
|
||||
YAP_file_type_t restore_result = yap_init->boot_file_type;
|
||||
bool do_bootstrap = (restore_result & YAP_CONSULT_MODE);
|
||||
X_API void YAP_Init(YAP_init_args *yap_init) {
|
||||
bool try_restore = yap_init->boot_file_type == YAP_QLY;
|
||||
bool do_bootstrap = yap_init->boot_file_type == YAP_BOOT_PL;
|
||||
struct ssz_t minfo;
|
||||
|
||||
if (YAP_initialized)
|
||||
/* ignore repeated calls to YAP_Init */
|
||||
return YAP_FOUND_BOOT_ERROR;
|
||||
return;
|
||||
if (!LOCAL_TextBuffer)
|
||||
LOCAL_TextBuffer = Yap_InitTextAllocator();
|
||||
|
||||
@ -1008,7 +1011,7 @@ X_API YAP_file_type_t YAP_Init(YAP_init_args *yap_init) {
|
||||
//
|
||||
|
||||
CACHE_REGS
|
||||
if (Yap_embedded)
|
||||
|
||||
if (yap_init->QuietMode) {
|
||||
setVerbosity(TermSilent);
|
||||
}
|
||||
@ -1018,41 +1021,42 @@ X_API YAP_file_type_t YAP_Init(YAP_init_args *yap_init) {
|
||||
restore will print out messages ....
|
||||
*/
|
||||
setBooleanGlobalPrologFlag(HALT_AFTER_CONSULT_FLAG,
|
||||
yap_init->HaltAfterConsult);
|
||||
yap_init->HaltAfterBoot);
|
||||
}
|
||||
/* tell the system who should cope with interrupts */
|
||||
Yap_ExecutionMode = yap_init->ExecutionMode;
|
||||
Yap_set_locations(yap_init);
|
||||
|
||||
if (!do_bootstrap && Yap_INPUT_STARTUP &&
|
||||
yap_init->boot_file_type != YAP_BOOT_PL &&
|
||||
Yap_SavedInfo(Yap_INPUT_STARTUP, &minfo.Trail, &minfo.Stack,
|
||||
&minfo.Heap) &&
|
||||
Yap_Restore(Yap_INPUT_STARTUP)) {
|
||||
setBooleanGlobalPrologFlag(SAVED_PROGRAM_FLAG, true);
|
||||
CurrentModule = LOCAL_SourceModule = USER_MODULE;
|
||||
if (do_bootstrap ||
|
||||
!try_restore ||
|
||||
!Yap_SavedInfo(Yap_INPUT_STARTUP, &minfo.Trail, &minfo.Stack,
|
||||
&minfo.Heap) ) {
|
||||
init_globals(yap_init);
|
||||
YAP_RunGoalOnce(TermInitProlog);
|
||||
|
||||
start_modules();
|
||||
return end_init(yap_init, YAP_QLY);
|
||||
consult(Yap_BOOTSTRAP PASS_REGS);
|
||||
setAtomicGlobalPrologFlag(RESOURCE_DATABASE_FLAG,
|
||||
MkAtomTerm(Yap_LookupAtom(Yap_BOOTFILE)));
|
||||
setBooleanGlobalPrologFlag(SAVED_PROGRAM_FLAG, false);
|
||||
} else {
|
||||
Yap_Restore(Yap_INPUT_STARTUP);
|
||||
init_globals(yap_init);
|
||||
|
||||
start_modules();
|
||||
consult(Yap_BOOTFILE PASS_REGS);
|
||||
if (yap_init->install && Yap_OUTPUT_STARTUP) {
|
||||
setAtomicGlobalPrologFlag(RESOURCE_DATABASE_FLAG,
|
||||
MkAtomTerm(Yap_LookupAtom(Yap_INPUT_STARTUP)));
|
||||
setBooleanGlobalPrologFlag(SAVED_PROGRAM_FLAG, true);
|
||||
}
|
||||
YAP_RunGoalOnce(TermInitProlog);
|
||||
|
||||
if (yap_init->install && Yap_OUTPUT_STARTUP) {
|
||||
Term t = MkAtomTerm(Yap_LookupAtom(Yap_OUTPUT_STARTUP));
|
||||
Term g = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("qsave_program"), 1),
|
||||
1, &t);
|
||||
|
||||
YAP_RunGoalOnce(g);
|
||||
}
|
||||
setAtomicGlobalPrologFlag(RESOURCE_DATABASE_FLAG,
|
||||
MkAtomTerm(Yap_LookupAtom(Yap_BOOTFILE)));
|
||||
setBooleanGlobalPrologFlag(SAVED_PROGRAM_FLAG, false);
|
||||
return end_init(yap_init, YAP_BOOT_PL);
|
||||
}
|
||||
}
|
||||
end_init(yap_init);
|
||||
}
|
||||
|
||||
#if (DefTrailSpace < MinTrailSpace)
|
||||
@ -1074,15 +1078,14 @@ X_API YAP_file_type_t YAP_Init(YAP_init_args *yap_init) {
|
||||
#define DEFAULT_SCHEDULERLOOP 10
|
||||
#define DEFAULT_DELAYEDRELEASELOAD 3
|
||||
|
||||
X_API YAP_file_type_t YAP_FastInit(char *saved_state, int argc, char *argv[]) {
|
||||
X_API void YAP_FastInit(char *saved_state, int argc, char *argv[]) {
|
||||
YAP_init_args init_args;
|
||||
YAP_file_type_t out;
|
||||
|
||||
if ((out = Yap_InitDefaults(&init_args, saved_state, argc, argv)) !=
|
||||
YAP_FOUND_BOOT_ERROR)
|
||||
out = YAP_Init(&init_args);
|
||||
YAP_Init(&init_args);
|
||||
if (out == YAP_FOUND_BOOT_ERROR) {
|
||||
Yap_Error(init_args.ErrorNo, TermNil, init_args.ErrorCause);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
@ -689,10 +689,10 @@ if (PYTHONLIBS_FOUND AND SWIG_FOUND)
|
||||
find_python_module(wheel)
|
||||
find_python_module(setuptools)
|
||||
find_python_module(backcall)
|
||||
|
||||
if (PY_JUPYTER AND PY_WHEEL AND PY_SETUPTOOLS AND PY_BACKCALL)
|
||||
add_subdirectory(packages/python/yap_kernel)
|
||||
ENDIF ()
|
||||
|
||||
endif ()
|
||||
|
||||
|
||||
@ -900,7 +900,7 @@ endif(NOT ANDROID)
|
||||
|
||||
#
|
||||
|
||||
install(FILES ${INCLUDE_HEADERS} ${CONFIGURATION_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Yap )
|
||||
install(FILES ${INCLUDE_HEADERS} ${CONFIGURATION_HEADERS} DESTINATION ${includedir}/Yap )
|
||||
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@ set(SO_MINOR 0)
|
||||
set(SO_PATCH 0)
|
||||
|
||||
set (CXX_SOURCES
|
||||
yapi.cpp
|
||||
yapi.cpp
|
||||
)
|
||||
list(APPEND LIBYAP_SOURCES ${CXX_SOURCES} PARENT_SCOPE)
|
||||
|
||||
@ -15,7 +15,11 @@ if ( WIN32 OR ANDROID)
|
||||
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "_YAP_NOT_INSTALLED_=1;HAVE_CONFIG_H=1;_GNU_SOURCE;YAP_KERNEL=1" )
|
||||
else()
|
||||
add_lib(YAP++ ${CXX_SOURCES} )
|
||||
target_link_libraries(YAP++ ${CMAKE_DL_LIBS} libYap)
|
||||
if (WITH_PYTHON)
|
||||
target_link_libraries(YAP++ Py4YAP )
|
||||
endif()
|
||||
target_link_libraries(YAP++ ${CMAKE_DL_LIBS} libYap)
|
||||
|
||||
|
||||
MY_install(TARGETS YAP++
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
|
70
CXX/yapi.cpp
70
CXX/yapi.cpp
@ -10,6 +10,10 @@ extern "C" {
|
||||
#include "android/log.h"
|
||||
#endif
|
||||
|
||||
#if YAP_PYTHON
|
||||
#include "Python.h"
|
||||
#endif
|
||||
|
||||
#include "YapInterface.h"
|
||||
#include "YapBlobs.h"
|
||||
#include "iopreds.h"
|
||||
@ -238,11 +242,11 @@ Term &YAPTerm::operator[](arity_t i) {
|
||||
else if (i == 1)
|
||||
tf = TailOfTerm(t0);
|
||||
RECOVER_MACHINE_REGS();
|
||||
tf = RepPair(tf)[i];
|
||||
}
|
||||
RECOVER_MACHINE_REGS();
|
||||
Yap_Error(TYPE_ERROR_COMPOUND, tf, "");
|
||||
throw YAPError();
|
||||
} else {
|
||||
Yap_Error(TYPE_ERROR_COMPOUND, t0, "");
|
||||
}
|
||||
RECOVER_MACHINE_REGS();
|
||||
return (tf);
|
||||
}
|
||||
|
||||
Term &YAPListTerm::operator[](arity_t i) {
|
||||
@ -251,6 +255,7 @@ Term &YAPListTerm::operator[](arity_t i) {
|
||||
Term tf = 0;
|
||||
while (IsPairTerm(t0)) {
|
||||
if (i == 0) {
|
||||
|
||||
tf = HeadOfTerm(t0);
|
||||
break;
|
||||
} else {
|
||||
@ -377,8 +382,7 @@ Term YAPListTerm::car() {
|
||||
return (HeadOfTerm(to));
|
||||
else {
|
||||
Yap_Error(TYPE_ERROR_LIST, to, "");
|
||||
return 0;
|
||||
throw YAPError();
|
||||
return TermUnique;
|
||||
}
|
||||
}
|
||||
|
||||
@ -432,8 +436,8 @@ bool YAPEngine::call(YAPPredicate ap, YAPTerm ts[]) {
|
||||
// allow Prolog style exceotion handling
|
||||
LOCAL_RestartEnv = &buf;
|
||||
if (sigsetjmp(*LOCAL_RestartEnv, false)) {
|
||||
return 0;
|
||||
throw YAPError();
|
||||
std::cerr << "Restart\n";
|
||||
//q.e = new YAPError();
|
||||
}
|
||||
// don't forget, on success these bindings will still be there);
|
||||
result = YAP_LeaveGoal(false, &q);
|
||||
@ -447,13 +451,17 @@ bool YAPEngine::call(YAPPredicate ap, YAPTerm ts[]) {
|
||||
std::cerr << "Exception received by "
|
||||
<< YAPApplTerm(ap.functor(), ts).text() << ".\n Forwarded...\n\n";
|
||||
LOCAL_RestartEnv = oj;
|
||||
return 0;
|
||||
throw e;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool YAPEngine::mgoal(Term t, Term tmod) {
|
||||
sigjmp_buf buf, *oldp = LOCAL_RestartEnv;
|
||||
#if YAP_PYTHON
|
||||
//PyThreadState *_save;
|
||||
|
||||
// _save = PyEval_SaveThread();
|
||||
#endif
|
||||
try {
|
||||
CACHE_REGS
|
||||
BACKUP_MACHINE_REGS();
|
||||
@ -480,15 +488,16 @@ bool YAPEngine::mgoal(Term t, Term tmod) {
|
||||
// allow Prolog style exception handling
|
||||
LOCAL_RestartEnv = &buf;
|
||||
if (sigsetjmp(*LOCAL_RestartEnv, false)) {
|
||||
return false;
|
||||
//throw YAPError();
|
||||
// PyEval_RestoreThread(_save);
|
||||
std::cerr << "Restart\n";
|
||||
//throw new YAPError();
|
||||
}
|
||||
// don't forget, on success these guys may create slots
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
|
||||
|
||||
result = (bool)YAP_EnterGoal(ap, nullptr, &q);
|
||||
{
|
||||
YAP_LeaveGoal(false, &q);
|
||||
// PyEval_RestoreThread(_save);
|
||||
LOCAL_RestartEnv = oldp;
|
||||
RECOVER_MACHINE_REGS();
|
||||
return result;
|
||||
@ -496,7 +505,8 @@ bool YAPEngine::mgoal(Term t, Term tmod) {
|
||||
} catch (YAPError e) {
|
||||
YAP_LeaveGoal(false, &q);
|
||||
Yap_CloseHandles(q.CurSlot);
|
||||
LOCAL_RestartEnv = oldp;
|
||||
// PyEval_RestoreThread(_save);
|
||||
LOCAL_RestartEnv = oldp;
|
||||
return 0;
|
||||
//throw e;
|
||||
}
|
||||
@ -557,7 +567,7 @@ Term YAPEngine::fun(Term t) {
|
||||
sigjmp_buf buf, *oldp = LOCAL_RestartEnv;
|
||||
LOCAL_RestartEnv = &buf;
|
||||
if (sigsetjmp(*LOCAL_RestartEnv, false)) {
|
||||
// throw YAPError();
|
||||
// throw new YAPError();
|
||||
LOCAL_RestartEnv = oldp;
|
||||
RECOVER_MACHINE_REGS();
|
||||
return 0;
|
||||
@ -676,14 +686,14 @@ bool YAPQuery::next() {
|
||||
bool result = false;
|
||||
sigjmp_buf buf, *oldp = LOCAL_RestartEnv;
|
||||
Term terr;
|
||||
e = nullptr;
|
||||
try {
|
||||
BACKUP_MACHINE_REGS();
|
||||
if (!q_open)
|
||||
return false;
|
||||
LOCAL_RestartEnv = &buf;
|
||||
if (sigsetjmp(*LOCAL_RestartEnv, false)) {
|
||||
// throw YAPError();
|
||||
return false;
|
||||
//e = new YAPError();
|
||||
}
|
||||
// don't forget, on success these guys may create slots
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
|
||||
@ -701,11 +711,10 @@ bool YAPQuery::next() {
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "fail");
|
||||
}
|
||||
q_state = 1;
|
||||
if ((terr = Yap_GetException())) {
|
||||
if ((terr = Yap_GetException())) {
|
||||
if ((terr = Yap_PeekException())) {
|
||||
LOCAL_RestartEnv = &buf;
|
||||
throw YAPError();
|
||||
}
|
||||
|
||||
result = false;
|
||||
}
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "out %d", result);
|
||||
|
||||
@ -747,8 +756,8 @@ PredEntry *YAPEngine::rewriteUndefEngineQuery(PredEntry *a, Term &tgoal,
|
||||
ARG1 = tgoal = Yap_MkApplTerm(FunctorModule, 2, ts);
|
||||
//goal = YAPTerm(Yap_MkApplTerm(FunctorMetaCall, 1, &ARG1));
|
||||
return PredCall;
|
||||
|
||||
|
||||
|
||||
|
||||
// return YAPApplTerm(FunctorUndefinedQuery, ts);
|
||||
}
|
||||
|
||||
@ -845,10 +854,12 @@ void Yap_displayWithJava(int c) {
|
||||
#endif
|
||||
|
||||
void YAPEngine::doInit(YAP_file_type_t BootMode, YAPEngineArgs *engineArgs) {
|
||||
if ((BootMode = YAP_Init(engineArgs)) == YAP_FOUND_BOOT_ERROR) {
|
||||
return;
|
||||
throw YAPError();
|
||||
if (BootMode == YAP_FOUND_BOOT_ERROR) {
|
||||
std::cerr << "Exception received by " << __func__ << "( "
|
||||
<< "while booting" << ").\n Forwarded...\n\n";
|
||||
return;
|
||||
}
|
||||
YAP_Init(engineArgs);
|
||||
/* Begin preprocessor code */
|
||||
/* live */
|
||||
// yerror = YAPError();
|
||||
@ -903,7 +914,8 @@ PredEntry *YAPPredicate::getPred(YAPTerm &tt, CELL *&outp) {
|
||||
Yap_ThrowError(INSTANTIATION_ERROR, tt.term(), 0);
|
||||
else if (IsNumTerm(t))
|
||||
Yap_ThrowError(TYPE_ERROR_CALLABLE, tt.term(), 0);
|
||||
throw YAPError();
|
||||
std::cerr << "Exception received by " << __func__ << "( "
|
||||
<< YAPTerm(tt).text() << ").\n Forwarded...\n\n";
|
||||
}
|
||||
tt.put(t);
|
||||
if (IsAtomTerm(t)) {
|
||||
@ -1062,7 +1074,7 @@ Term YAPEngine::top_level(std::string s) {
|
||||
ARG2 = tp;
|
||||
ARG3 = MkVarTerm();
|
||||
if (ARG1 == 0)
|
||||
YAPError(SYNTAX_ERROR);
|
||||
Yap_Error(SYNTAX_ERROR, ARG1, "in input query");
|
||||
YAPPredicate p = YAPPredicate(YAP_TopGoal());
|
||||
YAPQuery *Q = new YAPQuery(p, 0);
|
||||
Term ts[2];
|
||||
|
@ -34,7 +34,11 @@ class X_API YAPError {
|
||||
|
||||
public:
|
||||
YAPError(){
|
||||
//ID = LOCAL_ActiveError->errorNo;
|
||||
if (LOCAL_ActiveError == nullptr)
|
||||
return;
|
||||
ID = LOCAL_ActiveError->errorNo;
|
||||
if (ID != YAP_NO_ERROR) {};
|
||||
std::cerr << "Error detected" << ID << "\n";
|
||||
}
|
||||
/// error handler object with initial data when receiving the error term
|
||||
YAPError(yap_error_number id, YAPTerm culprit, std::string txt);
|
||||
|
@ -46,6 +46,7 @@ class X_API YAPQuery : public YAPPredicate {
|
||||
YAPTerm goal;
|
||||
// temporaries
|
||||
Term tnames, tgoal;
|
||||
YAPError *e;
|
||||
|
||||
inline void setNext() { // oq = LOCAL_execution;
|
||||
// LOCAL_execution = this;
|
||||
@ -262,9 +263,9 @@ public:
|
||||
|
||||
inline const char *getPrologTopLevelGoal() { return PrologTopLevelGoal; };
|
||||
|
||||
inline void setHaltAfterConsult(bool fl) { HaltAfterConsult = fl; };
|
||||
inline void setHaltAfterBoot(bool fl) { HaltAfterBoot = fl; };
|
||||
|
||||
inline bool getHaltAfterConsult() { return HaltAfterConsult; };
|
||||
inline bool getHaltAfterBoot() { return HaltAfterBoot; };
|
||||
|
||||
inline void setFastBoot(bool fl) { FastBoot = fl; };
|
||||
|
||||
@ -292,7 +293,8 @@ private:
|
||||
YAPError yerror;
|
||||
void doInit(YAP_file_type_t BootMode, YAPEngineArgs *cargs);
|
||||
YAP_dogoalinfo q;
|
||||
PredEntry *rewriteUndefEngineQuery(PredEntry *ap, Term &t, Term tmod);
|
||||
YAPError e;
|
||||
PredEntry *rewriteUndefEngineQuery(PredEntry *ap, Term &t, Term tmod);
|
||||
|
||||
public:
|
||||
/// construct a new engine; may use a variable number of arguments
|
||||
|
38
H/YapFlags.h
38
H/YapFlags.h
@ -162,19 +162,6 @@ static inline Term list_filler(Term inp) {
|
||||
return TermZERO;
|
||||
}
|
||||
|
||||
static Term bqs(Term inp) {
|
||||
if (inp == TermCodes || inp == TermString || inp == TermSymbolChar)
|
||||
return inp;
|
||||
|
||||
if (IsAtomTerm(inp)) {
|
||||
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, inp,
|
||||
"set_prolog_flag in {codes,string}");
|
||||
return TermZERO;
|
||||
}
|
||||
Yap_Error(TYPE_ERROR_ATOM, inp, "set_prolog_flag in {codes,string}");
|
||||
return TermZERO;
|
||||
}
|
||||
|
||||
// INLINE_ONLY inline EXTERN Term isatom( Term inp );
|
||||
|
||||
static inline Term isatom(Term inp) {
|
||||
@ -342,17 +329,26 @@ static inline Term getSyntaxErrorsFlag(void) {
|
||||
return LOCAL_Flags[SYNTAX_ERRORS_FLAG].at;
|
||||
}
|
||||
|
||||
static inline bool setBackQuotesFlag(Term val) {
|
||||
if (!bqs(val))
|
||||
return false;
|
||||
if (val == TermSymbolChar)
|
||||
val = TermString;
|
||||
GLOBAL_Flags[BACKQUOTED_STRING_FLAG].at = val;
|
||||
// used to overwrite singletons quoteFunc flag
|
||||
static inline bool setReadTermBackQuotesFlag(Term val) {
|
||||
|
||||
GLOBAL_Flags[BACK_QUOTES_FLAG].at = val;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline Term getBackQuotesFlag(void) {
|
||||
return GLOBAL_Flags[BACKQUOTED_STRING_FLAG].at;
|
||||
static inline Term getReadTermBackQuotesFlag(void) {
|
||||
Term val;
|
||||
unsigned int flags = Yap_GetModuleEntry(CurrentModule)->flags;
|
||||
if (flags & BCKQ_ATOM) {
|
||||
val = TermAtom;
|
||||
} else if (flags & BCKQ_STRING) {
|
||||
val = TermString;
|
||||
} else if (flags & BCKQ_CHARS) {
|
||||
val = TermChars;
|
||||
} else {
|
||||
val = TermCodes;
|
||||
}
|
||||
return GLOBAL_Flags[BACK_QUOTES_FLAG].at = val;
|
||||
}
|
||||
|
||||
static inline Term indexingMode(void) { return GLOBAL_Flags[INDEX_FLAG].at; }
|
||||
|
@ -90,9 +90,9 @@ running on an Apple machine.
|
||||
YAP_FLAG(ARGV_FLAG, "argv", false, argv, "@boot", NULL),
|
||||
YAP_FLAG(ARITHMETIC_EXCEPTIONS_FLAG, "arithmetic_exceptions", true,
|
||||
booleanFlag, "true", NULL),
|
||||
YAP_FLAG(BACKQUOTED_STRING_FLAG, "backquoted_string", true, isatom,
|
||||
"string", ), /**>
|
||||
If _Value_ is unbound, tell whether a double quoted list of characters
|
||||
YAP_FLAG(BACK_QUOTES_FLAG, "back_quotes", true, isatom,
|
||||
"string", bqs), /**>
|
||||
If _Value_ is unbound, tell whether a back quoted list of characters
|
||||
token is converted to a list of atoms, `chars`, to a list of integers,
|
||||
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
|
||||
the corresponding behavior. The default value is `string`
|
||||
@ -174,7 +174,7 @@ If `off` (default) consider the character `$` a control character, if
|
||||
`on` consider `$` a lower case character.
|
||||
*/
|
||||
YAP_FLAG(DOUBLE_QUOTES_FLAG, "double_quotes", true, isatom, "codes",
|
||||
dqf), /**< `double_quotes is iso `
|
||||
dqs), /**< `double_quotes is iso `
|
||||
|
||||
If _Value_ is unbound, tell whether a double quoted list of characters
|
||||
token is converted to a list of atoms, `chars`, to a list of integers,
|
||||
@ -383,6 +383,9 @@ Name of the environment variable used by the system to search for shared
|
||||
objects.
|
||||
|
||||
*/
|
||||
YAP_FLAG(SINGLE_QUOTES_FLAG, "single_quotes", true, isatom, "atom",
|
||||
sqf), /**< `single_quoted text is usuallly interpreted as atoms. This flagTerm allows other inerpretations such as strings_contains_strings */
|
||||
|
||||
YAP_FLAG(SIGNALS_FLAG, "signals", true, booleanFlag, "true",
|
||||
NULL), /**< `signals`
|
||||
|
||||
|
42
H/YapText.h
42
H/YapText.h
@ -440,8 +440,33 @@ static inline seq_type_t mod_to_type(Term mod USES_REGS) {
|
||||
}
|
||||
|
||||
// string type depends on current module
|
||||
static inline seq_type_t mod_to_bqtype(Term mod USES_REGS) {
|
||||
static inline seq_type_t mod_to_atype(Term mod USES_REGS) {
|
||||
|
||||
// see pl-incl.h
|
||||
unsigned int flags = Yap_GetModuleEntry(mod)->flags;
|
||||
if (flags & SNGQ_ATOM) {
|
||||
return YAP_STRING_ATOM | YAP_STRING_OUTPUT_TERM;
|
||||
} else if (flags & SNGQ_STRING) {
|
||||
return YAP_STRING_STRING;
|
||||
} else if (flags & SNGQ_CHARS) {
|
||||
return YAP_STRING_ATOMS;
|
||||
}
|
||||
return YAP_STRING_CODES;
|
||||
}
|
||||
|
||||
// string type depends on current module
|
||||
static inline seq_type_t mod_to_bqtype(Term mod USES_REGS) {
|
||||
Term t2;
|
||||
if ((t2 = GLOBAL_Flags[BACK_QUOTES_FLAG].at)) {
|
||||
if (t2 == TermString) {
|
||||
return YAP_STRING_STRING;
|
||||
} else if (t2 == TermAtom) {
|
||||
return YAP_STRING_ATOM | YAP_STRING_OUTPUT_TERM;
|
||||
} else if (t2 == TermCodes) {
|
||||
return YAP_STRING_CODES;
|
||||
}
|
||||
return YAP_STRING_ATOMS;
|
||||
}
|
||||
// see pl-incl.h
|
||||
unsigned int flags = Yap_GetModuleEntry(mod)->flags;
|
||||
if (flags & BCKQ_ATOM) {
|
||||
@ -906,6 +931,21 @@ static inline char *Yap_AtomToUTF8Text(Atom at USES_REGS) {
|
||||
return RepAtom(at)->StrOfAE;
|
||||
}
|
||||
|
||||
static inline Term Yap_CharsToTAQ(const char *s, Term mod,
|
||||
encoding_t enc USES_REGS) {
|
||||
seq_tv_t inp, out;
|
||||
|
||||
inp.val.c0 = s;
|
||||
inp.type = YAP_STRING_CHARS;
|
||||
inp.mod = mod;
|
||||
inp.enc = enc;
|
||||
out.type = mod_to_atype(mod PASS_REGS);
|
||||
out.val.uc = NULL;
|
||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||
return 0L;
|
||||
return out.val.t;
|
||||
}
|
||||
|
||||
static inline Term Yap_CharsToTDQ(const char *s, Term mod,
|
||||
encoding_t enc USES_REGS) {
|
||||
seq_tv_t inp, out;
|
||||
|
@ -279,6 +279,11 @@ INLINE_ONLY inline EXTERN bool IsModProperty(int flags) {
|
||||
#define UNKNOWN_MASK \
|
||||
(UNKNOWN_ERROR | UNKNOWN_WARNING | UNKNOWN_FAIL | UNKNOWN_FAST_FAIL | \
|
||||
UNKNOWN_ABORT | UNKNOWN_HALT)
|
||||
#define SNGQ_CHARS (0x10000) /* 'ab' --> [a, b] */
|
||||
#define SNGQ_ATOM (0x20000) /* 'ab' --> ab */
|
||||
#define SNGQ_STRING (0x40000) /* 'ab' --> "ab" */
|
||||
#define SNGQ_CODES (0x80000) /* 'ab' --> [0'a, 0'b] */
|
||||
#define SNGQ_MASK (BCKQ_CHARS | BCKQ_ATOM | BCKQ_STRING | BCKQ_CODES)
|
||||
|
||||
Term Yap_getUnknownModule(ModEntry *m);
|
||||
void Yap_setModuleFlags(ModEntry *n, ModEntry *o);
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Stuff that must be considered local to a thread or worker
|
||||
/// Thread Local Variables. This file now follows C syntax.
|
||||
|
||||
// Streams
|
||||
// Macro support
|
||||
#ifndef LOCAL
|
||||
#include "Yap.h"
|
||||
#include "heap.h"
|
||||
@ -17,6 +17,7 @@
|
||||
#define LOCAL_INIT_RESTORE(A,B,C,D) A B; C; D;
|
||||
#endif
|
||||
|
||||
/// Current bindings for std streams, includes default s
|
||||
LOCAL_INIT(int, c_input_stream, 0);
|
||||
LOCAL_INIT(int, c_output_stream, 1);
|
||||
LOCAL_INIT(int, c_error_stream, 2);
|
||||
|
73
cmake/anaconda.cmake
Normal file
73
cmake/anaconda.cmake
Normal file
@ -0,0 +1,73 @@
|
||||
set (PYTHONLIBS_FOUND YES CACHE BOOL "MINGW/MSYS2" FORCE )
|
||||
set (PYTHON_LIBRARY $ENV{PREFIX}/lib/libpython$ENV{PY_VER}m.$ENV{SHLIB_EXT} CACHE FILEPATH "MINGW/MSYS2" FORCE )
|
||||
set (PYTHON_LIBRARIES ${PYTHON_LIBRARY} CACHE FILEPATH "MINGW/MSYS2" FORCE )
|
||||
set (PYTHON_INCLUDE_PATH $ENV{PREFIX}/include/python$ENV{PY_VER}m CACHE PATH "MINGW/MSYS2" FORCE )
|
||||
set (PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH} CACHE PATH "MINGW/MSYS2" FORCE )
|
||||
set (PYTHON_EXECUTABLE $ENV{PREFIX}/bin/python CACHE FILEPATH "MINGW/MSYS2" FORCE )
|
||||
set (PYTHONLIBS_VERSION_STRING $ENV{PY_VER} CACHE STRING "MINGW/MSYS2" FORCE )
|
||||
|
||||
|
||||
# # try to extract R from readline to avoid collision
|
||||
set(READLINE_INCLUDE_DIR $ENV{PREFIX}/include CACHE PATH "readline" FORCE)
|
||||
|
||||
|
||||
# Apple readline does not support readline hooks
|
||||
# So we look for another one by default
|
||||
set(READLINE_readline_LIBRARY $ENV{PREFIX}/lib/libreadline.$ENV{SHLIB_EXT} CACHE PATH "readline")
|
||||
|
||||
# Sometimes readline really needs ncurses
|
||||
set(READLINE_ncurses_LIBRARY $ENV{PREFIX}/lib/libncurses.$ENV{SHLIB_EXT} CACHE PATH "readline")
|
||||
|
||||
set(READLINE_ncursesw_LIBRARY $ENV{PREFIX}/lib/libncursesw.$ENV{SHLIB_EXT} CACHE PATH "readline")
|
||||
|
||||
# Sometimes ncurses really needs terminfo
|
||||
set(READLINE_tinfo_LIBRARY $ENV{PREFIX}/lib/libntinfo.$ENV{SHLIB_EXT} CACHE PATH "readline")
|
||||
|
||||
set(READLINE_tinfow_LIBRARY $ENV{PREFIX}/lib/libntinfow.$ENV{SHLIB_EXT} CACHE PATH "readline")
|
||||
|
||||
SET( READLINE_FOUND "YES" CACHE BOOL "Readline ACCESS.")
|
||||
|
||||
|
||||
# Apple readline does not support readline hooks
|
||||
# So we look for another one by default
|
||||
if ( READLINE_readline_LIBRARY)
|
||||
set (HAVE_LIBREADLINE YES CACHE BOOL "ibReadline ACCESS")
|
||||
endif()
|
||||
|
||||
IF(READLINE_readline_LIBRARY)
|
||||
set(HAVE_LIBREADLINE CACHE YES BOOL "Readline works." )
|
||||
SET( READLINE_LIBRARIES
|
||||
${READLINE_readline_LIBRARY}
|
||||
)
|
||||
|
||||
# some readline libraries depend on ncurses
|
||||
IF(READLINE_ncurses_LIBRARY)
|
||||
list(APPEND READLINE_LIBRARIES ${READLINE_ncurses_LIBRARY})
|
||||
endif ()
|
||||
|
||||
# some readline libraries depend on ncurses
|
||||
IF(READLINE_ncursesw_LIBRARY)
|
||||
list(APPEND READLINE_LIBRARIES ${READLINE_ncursesw_LIBRARY})
|
||||
endif ()
|
||||
|
||||
# some readline libraries depend on tinfo
|
||||
IF(READLINE_tinfo_LIBRARY)
|
||||
list(APPEND READLINE_LIBRARIES ${READLINE_tinfo_LIBRARY})
|
||||
endif ()
|
||||
|
||||
|
||||
# some readline libraries depend on tinfo
|
||||
IF(READLINE_tinfow_LIBRARY)
|
||||
list(APPEND READLINE_LIBRARIES ${READLINE_tinfow_LIBRARY})
|
||||
endif ()
|
||||
|
||||
IF(READLINE_INCLUDE_DIR)
|
||||
SET( READLINE_FOUND "YES" CACHE BOOL "Readline ACCESS.")
|
||||
ENDIF(READLINE_INCLUDE_DIR)
|
||||
ENDIF(READLINE_readline_LIBRARY)
|
||||
|
||||
|
||||
set (GMP_INCLUDE_DIRS $ENV{PREFIX}/include)
|
||||
set (GMP_LIBRARIES $ENV{PREFIX}/lib/libgmp.${SHLIB_EXT})
|
||||
set (GMP_FOUND ON)
|
||||
set (GMP_LIBRARIES_DIR $ENV{PREFIX}/lib)
|
@ -4,7 +4,7 @@ option(WITH_JAVA "Try to use Java (currently Java 6,7,8)" ON)
|
||||
if (WITH_JAVA)
|
||||
#detect java setup, as it is shared between different installations.
|
||||
|
||||
find_package(Java 8 COMPONENTS Runtime Development)
|
||||
find_package(Java 1.8 COMPONENTS Runtime Development)
|
||||
# find_package(Java COMPONENTS Development)
|
||||
# find_package(Java COMPONENTS Runtime)
|
||||
#find_package(JavaLibs)
|
||||
|
@ -78,7 +78,8 @@ static int init_standard_system(int argc, char *argv[], YAP_init_args *iap) {
|
||||
BootMode = YAP_parse_yap_arguments(argc, argv, iap);
|
||||
iap->Embedded = false;
|
||||
/* init memory */
|
||||
iap->boot_file_type = BootMode = YAP_Init(iap);
|
||||
iap->boot_file_type = BootMode;
|
||||
YAP_Init(iap);
|
||||
if (iap->ErrorNo) {
|
||||
/* boot failed */
|
||||
YAP_Error(iap->ErrorNo, 0L, iap->ErrorCause);
|
||||
|
File diff suppressed because one or more lines are too long
@ -44,7 +44,6 @@ extern "C" {
|
||||
#include <config.h>
|
||||
#else
|
||||
#include <Yap/YapInterface.h>
|
||||
#include <Yap/pl/config.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
|
@ -79,8 +79,9 @@ typedef struct vfs {
|
||||
const char *suffix;
|
||||
bool (*chDir)(struct vfs *me, const char *s);
|
||||
/** operations */
|
||||
void *(*open)(struct vfs *, int sno, const char *fname,
|
||||
const char *io_mode); /// open an object
|
||||
void *(*open)(struct vfs *, const char *fname,
|
||||
const char *io_mode,
|
||||
int sno); /// open an object
|
||||
/// in this space, usual w,r,a,b flags plus B (store in a buffer)
|
||||
bool (*close)(int sno); /// close the object
|
||||
int (*get_char)(int sno); /// get an octet from the stream
|
||||
|
@ -234,7 +234,7 @@ typedef struct yap_boot_params {
|
||||
//> if NON-NULL, a path to extend file-search-path
|
||||
const char *PrologAddPath;
|
||||
//> if previous NON-NULL and TRUE, halt after consulting that file
|
||||
bool HaltAfterConsult;
|
||||
bool HaltAfterBoot;
|
||||
//> ignore .yaprc, .prolog.ini, etc. files.
|
||||
bool FastBoot;
|
||||
//> the next field only interest YAPTAB
|
||||
|
@ -378,10 +378,10 @@ extern X_API int YAP_AssertTuples(YAP_PredEntryPtr pred, const YAP_Term *ts,
|
||||
size_t offset, size_t sz);
|
||||
|
||||
/* int YAP_Init(YAP_init_args *) */
|
||||
extern X_API YAP_file_type_t YAP_Init(YAP_init_args *);
|
||||
extern X_API void YAP_Init(YAP_init_args *);
|
||||
|
||||
/* int YAP_FastInit(const char *) */
|
||||
extern X_API YAP_file_type_t YAP_FastInit(char saved_state[], int argc,
|
||||
extern X_API void YAP_FastInit(char saved_state[], int argc,
|
||||
char *argv[]);
|
||||
|
||||
#ifndef _PL_STREAM_H
|
||||
|
@ -2200,7 +2200,7 @@ X_API int PL_initialise(int myargc, char **myargv) {
|
||||
#endif
|
||||
init_args.LIBDIR = NULL;
|
||||
init_args.BOOTFILE = NULL;
|
||||
init_args.HaltAfterConsult = FALSE;
|
||||
init_args.HaltAfterBoot = true;
|
||||
init_args.FastBoot = FALSE;
|
||||
init_args.MaxTableSpaceSize = 0;
|
||||
init_args.NumberWorkers = 1;
|
||||
@ -2212,9 +2212,9 @@ X_API int PL_initialise(int myargc, char **myargv) {
|
||||
GLOBAL_PL_Argc = myargc;
|
||||
GLOBAL_PL_Argv = myargv;
|
||||
GLOBAL_InitialisedFromPL = true;
|
||||
YAP_file_type_t rc = YAP_Init(&init_args) != YAP_FOUND_BOOT_ERROR;
|
||||
ATOM_nil = YAP_SWIAtomFromAtom(AtomNil);
|
||||
return rc;
|
||||
YAP_Init(&init_args);
|
||||
return true;
|
||||
}
|
||||
|
||||
X_API int PL_is_initialised(int *argcp, char ***argvp) {
|
||||
|
@ -1,10 +1,11 @@
|
||||
|
||||
set (MPI_SOURCES
|
||||
set (MPI_YAP_SOURCES
|
||||
hash.c prologterms2c.c yap_mpi.c)
|
||||
|
||||
macro_optional_find_package(MPI ON)
|
||||
|
||||
if (MPI_C_FOUND)
|
||||
|
||||
if (MPI_FOUND)
|
||||
if (MPI_C_FOUND)
|
||||
# === Variables ===
|
||||
#
|
||||
# This module will set the following variables per language in your
|
||||
@ -67,8 +68,7 @@ if (MPI_C_FOUND)
|
||||
# pass to the MPI program.
|
||||
#
|
||||
|
||||
add_lib (yap_mpi ${MPI_SOURCES})
|
||||
|
||||
add_executable (yap_mpi ${MPI_YAP_SOURCES} ../../console/yap.c)
|
||||
target_link_libraries(yap_mpi libYap ${MPI_C_LIBRARIES})
|
||||
|
||||
set_target_properties (yap_mpi PROPERTIES PREFIX "")
|
||||
@ -76,11 +76,12 @@ if (MPI_C_FOUND)
|
||||
include_directories (${MPI_C_INCLUDE_PATH})
|
||||
|
||||
add_definitions (-DHAVE_MPI_H=1)
|
||||
target_compile_definitions(yap_mpi
|
||||
PRIVATE ${MPI_C_COMPILE_FLAGS})
|
||||
|
||||
install(TARGETS yap_mpi
|
||||
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
|
||||
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
|
||||
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
|
||||
RUNTIME DESTINATION ${bindir}
|
||||
)
|
||||
|
||||
endif (MPI_C_FOUND)
|
||||
endif (MPI_C_FOUND)
|
||||
endif (MPI_FOUND)
|
||||
|
@ -152,7 +152,7 @@ int Yap_open_buf_read_stream(const char *buf, size_t nchars, encoding_t *encp,
|
||||
// like any file stream.
|
||||
f = st->file = fmemopen((void *)buf, nchars, "r");
|
||||
flags = Input_Stream_f | InMemory_Stream_f | Seekable_Stream_f;
|
||||
Yap_initStream(sno, f, NULL, TermNil, encoding, flags, AtomRead, NULL);
|
||||
Yap_initStream(sno, f, "memStream", "r", TermNone, encoding, flags, NULL);
|
||||
// like any file stream.
|
||||
Yap_DefaultStreamOps(st);
|
||||
UNLOCK(st->streamlock);
|
||||
|
172
os/iopreds.c
172
os/iopreds.c
@ -406,16 +406,8 @@ static void InitStdStream(int sno, SMALLUNSGN flags, FILE *file, VFS_t *vfsp) {
|
||||
s->buf.on = false;
|
||||
s->encoding = ENC_ISO_UTF8;
|
||||
INIT_LOCK(s->streamlock);
|
||||
if (vfsp != NULL) {
|
||||
s->u.private_data = vfsp->open(vfsp, sno, vfsp->name,
|
||||
(sno == StdInStream ? "read" : "write"));
|
||||
if (s->u.private_data == NULL) {
|
||||
(PlIOError(EXISTENCE_ERROR_SOURCE_SINK, MkIntTerm(sno), "%s",
|
||||
vfsp->name));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
unix_upd_stream_info(s);
|
||||
if (vfsp == NULL) {
|
||||
unix_upd_stream_info(s);
|
||||
}
|
||||
/* Getting streams to prompt is a mess because we need for cooperation
|
||||
between readers and writers to the stream :-(
|
||||
@ -1133,11 +1125,23 @@ static void check_bom(int sno, StreamDesc *st) {
|
||||
}
|
||||
}
|
||||
|
||||
bool Yap_initStream(int sno, FILE *fd, const char *name, Term file_name,
|
||||
encoding_t encoding, stream_flags_t flags, Atom open_mode,
|
||||
void *vfs) {
|
||||
bool Yap_initStream(int sno, FILE *fd, const char *name, const char *io_mode, Term file_name, encoding_t encoding,
|
||||
stream_flags_t flags, void *vfs) {
|
||||
StreamDesc *st = &GLOBAL_Stream[sno];
|
||||
st->status = flags;
|
||||
if (io_mode == NULL)
|
||||
Yap_Error(PERMISSION_ERROR_NEW_ALIAS_FOR_STREAM, MkIntegerTerm(sno), "File opened with NULL Permissions");
|
||||
if (strchr(io_mode, 'a')) {
|
||||
st->status = Append_Stream_f|Output_Stream_f|flags;
|
||||
} else
|
||||
if (strchr(io_mode, 'w')) {
|
||||
st->status = Output_Stream_f | flags;
|
||||
}
|
||||
if (strchr(io_mode, 'r')) {
|
||||
st->status = Input_Stream_f|flags;
|
||||
}
|
||||
if (strchr(io_mode, 'b')) {
|
||||
st->status = Binary_Stream_f|flags;
|
||||
}
|
||||
|
||||
st->vfs = vfs;
|
||||
st->buf.on = false;
|
||||
@ -1150,12 +1154,13 @@ bool Yap_initStream(int sno, FILE *fd, const char *name, Term file_name,
|
||||
}
|
||||
|
||||
if (name == NULL) {
|
||||
char buf[YAP_FILENAME_MAX + 1];
|
||||
memset(buf, 0, YAP_FILENAME_MAX + 1);
|
||||
name = Yap_guessFileName(fd, sno, buf, YAP_FILENAME_MAX);
|
||||
if (name)
|
||||
st->name = Yap_LookupAtom(name);
|
||||
char buf[YAP_FILENAME_MAX + 1];
|
||||
memset(buf, 0, YAP_FILENAME_MAX + 1);
|
||||
name = Yap_guessFileName(fd, sno, buf, YAP_FILENAME_MAX);
|
||||
}
|
||||
if (!name)
|
||||
Yap_Error(SYSTEM_ERROR_INTERNAL,file_name,"Yap_guessFileName failed: opening a file without a name");
|
||||
st->name = Yap_LookupAtom(name);
|
||||
st->user_name = file_name;
|
||||
st->file = fd;
|
||||
st->linepos = 0;
|
||||
@ -1221,7 +1226,7 @@ static const param_t open_defs[] = {OPEN_DEFS()};
|
||||
|
||||
static Int
|
||||
do_open(Term file_name, Term t2,
|
||||
Term tlist USES_REGS) { /* '$open'(+File,+Mode,?Stream,-ReturnCode) */
|
||||
Term tlist USES_REGS) {
|
||||
Atom open_mode;
|
||||
int sno;
|
||||
StreamDesc *st;
|
||||
@ -1232,6 +1237,7 @@ do_open(Term file_name, Term t2,
|
||||
encoding_t encoding;
|
||||
Term tenc;
|
||||
char io_mode[8];
|
||||
|
||||
// original file name
|
||||
if (IsVarTerm(file_name)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, file_name, "open/3");
|
||||
@ -1287,6 +1293,7 @@ do_open(Term file_name, Term t2,
|
||||
? args[OPEN_EXPAND_FILENAME].tvalue == TermTrue
|
||||
: false) ||
|
||||
trueGlobalPrologFlag(OPEN_EXPANDS_FILENAME_FLAG);
|
||||
|
||||
// expand file name?
|
||||
int lvl = push_text_stack();
|
||||
const char *fname = Yap_AbsoluteFile(fname0, ok);
|
||||
@ -1298,9 +1305,18 @@ do_open(Term file_name, Term t2,
|
||||
|
||||
// Skip scripts that start with !#/.. or similar
|
||||
pop_text_stack(lvl);
|
||||
bool script =
|
||||
(args[OPEN_SCRIPT].used ? args[OPEN_SCRIPT].tvalue == TermTrue : false);
|
||||
// binary type
|
||||
|
||||
if (open_mode == AtomRead) {
|
||||
strncpy(io_mode, "r", 8);
|
||||
} else if (open_mode == AtomWrite) {
|
||||
strncpy(io_mode, "w", 8);
|
||||
} else if (open_mode == AtomAppend) {
|
||||
strncpy(io_mode, "a", 8);
|
||||
} else {
|
||||
pop_text_stack(lvl);
|
||||
return false;
|
||||
}
|
||||
// binary type
|
||||
if (args[OPEN_TYPE].used) {
|
||||
Term t = args[OPEN_TYPE].tvalue;
|
||||
bool bin = (t == TermBinary);
|
||||
@ -1323,39 +1339,37 @@ do_open(Term file_name, Term t2,
|
||||
"type is ~a, must be one of binary or text", t);
|
||||
}
|
||||
}
|
||||
// BOM mess
|
||||
if (encoding == ENC_UTF16_BE || encoding == ENC_UTF16_LE ||
|
||||
encoding == ENC_UCS2_BE || encoding == ENC_UCS2_LE ||
|
||||
encoding == ENC_ISO_UTF32_BE || encoding == ENC_ISO_UTF32_LE) {
|
||||
needs_bom = true;
|
||||
}
|
||||
if (args[OPEN_BOM].used) {
|
||||
if (args[OPEN_BOM].tvalue == TermTrue) {
|
||||
avoid_bom = false;
|
||||
needs_bom = true;
|
||||
} else if (args[OPEN_BOM].tvalue == TermFalse) {
|
||||
avoid_bom = true;
|
||||
needs_bom = false;
|
||||
}
|
||||
}
|
||||
if (open_mode == AtomRead) {
|
||||
strncpy(io_mode, "r", 8);
|
||||
} else if (open_mode == AtomWrite) {
|
||||
strncpy(io_mode, "w", 8);
|
||||
} else if (open_mode == AtomAppend) {
|
||||
strncpy(io_mode, "a", 8);
|
||||
} else {
|
||||
pop_text_stack(lvl);
|
||||
return false;
|
||||
}
|
||||
if ((sno = Yap_OpenStream(fname, io_mode, file_name)) < 0) {
|
||||
if ((sno = Yap_OpenStream(fname, io_mode, file_name, encoding)) < 0)
|
||||
{
|
||||
pop_text_stack(lvl);
|
||||
return false;
|
||||
}
|
||||
|
||||
st = &GLOBAL_Stream[sno];
|
||||
st->user_name = file_name;
|
||||
// user requested encoding?
|
||||
// BOM mess
|
||||
if (encoding == ENC_UTF16_BE || encoding == ENC_UTF16_LE ||
|
||||
encoding == ENC_UCS2_BE || encoding == ENC_UCS2_LE ||
|
||||
encoding == ENC_ISO_UTF32_BE || encoding == ENC_ISO_UTF32_LE)
|
||||
{
|
||||
needs_bom = true;
|
||||
}
|
||||
if (args[OPEN_BOM].used)
|
||||
{
|
||||
if (args[OPEN_BOM].tvalue == TermTrue)
|
||||
{
|
||||
avoid_bom = false;
|
||||
needs_bom = true;
|
||||
}
|
||||
else if (args[OPEN_BOM].tvalue == TermFalse)
|
||||
{
|
||||
avoid_bom = true;
|
||||
needs_bom = false;
|
||||
}
|
||||
}
|
||||
bool script =
|
||||
(args[OPEN_SCRIPT].used ? args[OPEN_SCRIPT].tvalue == TermTrue : false);
|
||||
|
||||
if (args[OPEN_ALIAS].used) {
|
||||
Atom al = AtomOfTerm(args[OPEN_ALIAS].tvalue);
|
||||
if (!Yap_AddAlias(al, sno)) {
|
||||
@ -1363,7 +1377,6 @@ do_open(Term file_name, Term t2,
|
||||
return false;
|
||||
}
|
||||
}
|
||||
st->name = Yap_LookupAtom(fname);
|
||||
if (st - GLOBAL_Stream < 3) {
|
||||
flags |= RepError_Prolog_f;
|
||||
}
|
||||
@ -1557,14 +1570,13 @@ static Int p_open_null_stream(USES_REGS1) {
|
||||
return (Yap_unify(ARG1, t));
|
||||
}
|
||||
|
||||
int Yap_OpenStream(const char *fname, const char *io_mode, Term user_name) {
|
||||
int Yap_OpenStream(const char *fname, const char* io_mode, Term user_name, encoding_t enc) {
|
||||
CACHE_REGS
|
||||
int sno;
|
||||
StreamDesc *st;
|
||||
Atom at;
|
||||
struct vfs *vfsp;
|
||||
FILE *fd;
|
||||
int flags;
|
||||
struct vfs *vfsp = NULL;
|
||||
FILE *fd = NULL;
|
||||
int flags;
|
||||
|
||||
sno = GetFreeStreamD();
|
||||
if (sno < 0) {
|
||||
@ -1573,20 +1585,20 @@ int Yap_OpenStream(const char *fname, const char *io_mode, Term user_name) {
|
||||
return -1;
|
||||
}
|
||||
st = GLOBAL_Stream + sno;
|
||||
// read, write, append
|
||||
st->file = NULL;
|
||||
st->status = 0;
|
||||
// fname = Yap_VF(fname);
|
||||
// fname = Yap_VF(fname);
|
||||
flags = 0;
|
||||
if ((vfsp = vfs_owner(fname)) != NULL) {
|
||||
if (!vfsp->open(vfsp, sno, fname, "r")) {
|
||||
if (!vfsp->open(vfsp, fname, io_mode, sno)) {
|
||||
UNLOCK(st->streamlock);
|
||||
PlIOError(EXISTENCE_ERROR_SOURCE_SINK, MkAtomTerm(Yap_LookupAtom(fname)),
|
||||
"%s", fname);
|
||||
/* extract BACK info passed through the stream descriptor */
|
||||
return -1;
|
||||
}
|
||||
vfsp = GLOBAL_Stream[sno].vfs;
|
||||
// read, write, append
|
||||
user_name = st->user_name;
|
||||
} else {
|
||||
fd = st->file = fopen(fname, io_mode);
|
||||
fd = fopen(fname, io_mode);
|
||||
if (fd == NULL) {
|
||||
if (!strchr(io_mode, 'b') && binary_file(fname)) {
|
||||
UNLOCK(st->streamlock);
|
||||
@ -1603,25 +1615,7 @@ int Yap_OpenStream(const char *fname, const char *io_mode, Term user_name) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
flags = st->status;
|
||||
if (strchr(io_mode, 'w')) {
|
||||
if (strchr(io_mode, 'a')) {
|
||||
at = AtomAppend;
|
||||
flags |= Append_Stream_f | Output_Stream_f;
|
||||
} else {
|
||||
at = AtomWrite;
|
||||
flags |= Output_Stream_f;
|
||||
}
|
||||
}
|
||||
if (strchr(io_mode, 'r')) {
|
||||
at = AtomRead;
|
||||
flags |= Input_Stream_f;
|
||||
}
|
||||
if (strchr(io_mode, 'b')) {
|
||||
flags |= Binary_Stream_f;
|
||||
}
|
||||
Yap_initStream(sno, st->file, fname, user_name, LOCAL_encoding, flags, at,
|
||||
vfsp);
|
||||
Yap_initStream(sno, fd, fname, io_mode, user_name, LOCAL_encoding, flags, vfsp);
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exists %s <%d>", fname,
|
||||
sno);
|
||||
return sno;
|
||||
@ -1631,7 +1625,7 @@ int Yap_FileStream(FILE *fd, char *name, Term file_name, int flags,
|
||||
VFS_t *vfsp) {
|
||||
CACHE_REGS
|
||||
int sno;
|
||||
Atom at;
|
||||
const char *mode;
|
||||
|
||||
sno = GetFreeStreamD();
|
||||
if (sno < 0)
|
||||
@ -1639,12 +1633,13 @@ int Yap_FileStream(FILE *fd, char *name, Term file_name, int flags,
|
||||
"new stream not available for opening"));
|
||||
if (flags & Output_Stream_f) {
|
||||
if (flags & Append_Stream_f)
|
||||
at = AtomAppend;
|
||||
mode = "a";
|
||||
else
|
||||
at = AtomWrite;
|
||||
} else
|
||||
at = AtomRead;
|
||||
Yap_initStream(sno, fd, name, file_name, LOCAL_encoding, flags, at, vfsp);
|
||||
mode = "w";
|
||||
} else {
|
||||
mode = "r";
|
||||
}
|
||||
Yap_initStream(sno, fd, name, mode, file_name, LOCAL_encoding, flags, vfsp);
|
||||
return sno;
|
||||
}
|
||||
|
||||
@ -1848,7 +1843,6 @@ static Int close2(USES_REGS1) { /* '$close'(+GLOBAL_Stream) */
|
||||
Yap_Error(LOCAL_Error_TYPE, tlist, NULL);
|
||||
}
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
// if (args[CLOSE_FORCE].used) {
|
||||
// }
|
||||
|
@ -31,9 +31,8 @@ INLINE_ONLY EXTERN inline bool IsStreamTerm(Term t) {
|
||||
(IsApplTerm(t) && (FunctorOfTerm(t) == FunctorStream)));
|
||||
}
|
||||
|
||||
extern bool Yap_initStream(int sno, FILE *fd, const char *name, Term file_name,
|
||||
encoding_t encoding, stream_flags_t flags,
|
||||
Atom open_mode, void *vfs);
|
||||
extern bool Yap_initStream(int sno, FILE *fd, const char *name, const char *io_mode, Term file_name, encoding_t encoding,
|
||||
stream_flags_t flags, void *vfs);
|
||||
|
||||
#define Yap_CheckStream(arg, kind, msg) \
|
||||
Yap_CheckStream__(__FILE__, __FUNCTION__, __LINE__, arg, kind, msg)
|
||||
|
4
os/mem.c
4
os/mem.c
@ -193,7 +193,7 @@ bool Yap_set_stream_to_buf(StreamDesc *st, const char *buf,
|
||||
st->file = f = NULL;
|
||||
flags = Input_Stream_f | InMemory_Stream_f;
|
||||
st->vfs = NULL;
|
||||
Yap_initStream(st - GLOBAL_Stream, f, NULL, TermNil, LOCAL_encoding, flags,
|
||||
Yap_initStream(st - GLOBAL_Stream, f, "r", TermNil, LOCAL_encoding, flags,
|
||||
AtomRead, NULL);
|
||||
// like any file stream.
|
||||
/* currently these streams are not seekable */
|
||||
@ -228,7 +228,7 @@ int Yap_open_buf_read_stream(const char *buf, size_t nchars, encoding_t *encp,
|
||||
st->file = f = NULL;
|
||||
flags = Input_Stream_f | InMemory_Stream_f;
|
||||
st->vfs = NULL;
|
||||
Yap_initStream(sno, f, NULL, TermNil, encoding, flags, AtomRead, NULL);
|
||||
Yap_initStream(sno, f, "wa", TermNil, encoding, flags, AtomRead, NULL);
|
||||
// like any file stream.
|
||||
/* currently these streams are not seekable */
|
||||
st->status = Input_Stream_f | InMemory_Stream_f;
|
||||
|
@ -268,7 +268,8 @@ static Term scanToList(TokEntry *tok, TokEntry *errtok) {
|
||||
}
|
||||
tok = tok->TokNext;
|
||||
}
|
||||
Yap_DebugPlWriteln(ts[0]);
|
||||
if (ts[0])
|
||||
Yap_DebugPlWriteln(ts[0]);
|
||||
return ts[0];
|
||||
}
|
||||
|
||||
@ -307,7 +308,7 @@ static Int scan_to_list(USES_REGS1) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Syntax Error Handler
|
||||
* Syntaax Error Handler
|
||||
*
|
||||
* @par tokptr: the sequence of tokens
|
||||
* @par sno: the stream numbet
|
||||
@ -465,7 +466,7 @@ static xarg *setReadEnv(Term opts, FEnv *fe, struct renv *re, int inp_stream) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
re->bq = getBackQuotesFlag();
|
||||
re->bq = getReadTermBackQuotesFlag();
|
||||
if (args[READ_OUTPUT].used) {
|
||||
fe->t0 = args[READ_OUTPUT].tvalue;
|
||||
} else {
|
||||
@ -479,7 +480,7 @@ static xarg *setReadEnv(Term opts, FEnv *fe, struct renv *re, int inp_stream) {
|
||||
fe->cmod = PROLOG_MODULE;
|
||||
}
|
||||
if (args[READ_BACKQUOTED_STRING].used) {
|
||||
if (!setBackQuotesFlag(args[READ_BACKQUOTED_STRING].tvalue)) {
|
||||
if (!setReadTermBackQuotesFlag(args[READ_BACKQUOTED_STRING].tvalue)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1108,7 +1109,7 @@ static xarg *setClauseReadEnv(Term opts, FEnv *fe, struct renv *re, int sno) {
|
||||
if (fe->cmod == TermProlog)
|
||||
fe->cmod = PROLOG_MODULE;
|
||||
}
|
||||
re->bq = getBackQuotesFlag();
|
||||
re->bq = getReadTermBackQuotesFlag();
|
||||
fe->enc = GLOBAL_Stream[sno].encoding;
|
||||
fe->sp = 0;
|
||||
fe->qq = 0;
|
||||
|
1
os/sig.c
1
os/sig.c
@ -860,5 +860,6 @@ void Yap_InitSignalPreds(void) {
|
||||
Yap_InitCPred("virtual_alarm", 4, virtual_alarm, SafePredFlag | SyncPredFlag);
|
||||
Yap_InitCPred("enable_interrupts", 0, enable_interrupts, SafePredFlag);
|
||||
Yap_InitCPred("disable_interrupts", 0, disable_interrupts, SafePredFlag);
|
||||
my_signal_info(SIGSEGV, HandleSIGSEGV);
|
||||
CurrentModule = cm;
|
||||
}
|
||||
|
27
os/streams.c
27
os/streams.c
@ -445,19 +445,19 @@ found_eof(int sno,
|
||||
|
||||
static bool
|
||||
stream_mode(int sno,
|
||||
Term t2 USES_REGS) { /* '$set_output'(+Stream,-ErrorMessage) */
|
||||
stream_flags_t flags = GLOBAL_Stream[sno].status &
|
||||
(Input_Stream_f | Output_Stream_f | Append_Stream_f);
|
||||
Term t2 USES_REGS) {
|
||||
/* '$set_output'(+Stream,-ErrorMessage) */
|
||||
stream_flags_t flags = GLOBAL_Stream[sno].status;
|
||||
if (!IsVarTerm(t2) && !(isatom(t2))) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if (flags & Input_Stream_f)
|
||||
return Yap_unify(t2, TermRead);
|
||||
if (flags & Output_Stream_f)
|
||||
return Yap_unify(t2, TermWrite);
|
||||
if (flags & Append_Stream_f)
|
||||
return Yap_unify(t2, TermAppend);
|
||||
return false;
|
||||
return Yap_unify(t2, TermWrite);
|
||||
if (flags & Output_Stream_f)
|
||||
return Yap_unify(t2, TermWrite);
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -1005,11 +1005,7 @@ static void CloseStream(int sno) {
|
||||
} else if (GLOBAL_Stream[sno].status & (InMemory_Stream_f)) {
|
||||
Yap_CloseMemoryStream(sno);
|
||||
}
|
||||
GLOBAL_Stream[sno].status = Free_Stream_f;
|
||||
GLOBAL_Stream[sno].vfs = NULL;
|
||||
GLOBAL_Stream[sno].file = NULL;
|
||||
Yap_DeleteAliases(sno);
|
||||
if (LOCAL_c_input_stream == sno) {
|
||||
if (LOCAL_c_input_stream == sno) {
|
||||
LOCAL_c_input_stream = StdInStream;
|
||||
}
|
||||
if (LOCAL_c_output_stream == sno) {
|
||||
@ -1018,6 +1014,11 @@ static void CloseStream(int sno) {
|
||||
if (LOCAL_c_error_stream == sno) {
|
||||
LOCAL_c_error_stream = StdErrStream;
|
||||
}
|
||||
Yap_DeleteAliases(sno);
|
||||
GLOBAL_Stream[sno].vfs = NULL;
|
||||
GLOBAL_Stream[sno].file = NULL;
|
||||
GLOBAL_Stream[sno].status = Free_Stream_f;
|
||||
|
||||
/* if (st->status == Socket_Stream_f|Input_Stream_f|Output_Stream_f) {
|
||||
Yap_CloseSocket();
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ extern int Yap_PlGetWchar(void);
|
||||
extern int Yap_PlFGetchar(void);
|
||||
extern int Yap_GetCharForSIGINT(void);
|
||||
extern Int Yap_StreamToFileNo(Term);
|
||||
extern int Yap_OpenStream(const char*, const char*, Term);
|
||||
extern int Yap_OpenStream(const char *fname, const char* io_mode, Term user_name, encoding_t enc);
|
||||
extern int Yap_FileStream(FILE*, char *, Term, int, VFS_t *);
|
||||
extern char *Yap_TermToBuffer(Term t, encoding_t encoding, int flags);
|
||||
extern char *Yap_HandleToString(yhandle_t l, size_t sz, size_t *length,
|
||||
|
@ -350,7 +350,6 @@ with _S_.
|
||||
|
||||
*/
|
||||
current_stream(File, Mode, Stream) :-
|
||||
|
||||
stream_property(Stream, mode(Mode)),
|
||||
'$stream_name'(Stream, File).
|
||||
|
||||
|
1
packages/gecode/6.0.0/gecode-version.txt
vendored
Normal file
1
packages/gecode/6.0.0/gecode-version.txt
vendored
Normal file
@ -0,0 +1 @@
|
||||
6.0.0
|
3613
packages/gecode/6.0.0/gecode_yap_auto_generated.yap
vendored
Normal file
3613
packages/gecode/6.0.0/gecode_yap_auto_generated.yap
vendored
Normal file
File diff suppressed because it is too large
Load Diff
28
packages/gecode/6.0.0/gecode_yap_cc_forward_auto_generated.icc
vendored
Normal file
28
packages/gecode/6.0.0/gecode_yap_cc_forward_auto_generated.icc
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
// -*- c++ -*-
|
||||
//=============================================================================
|
||||
// Copyright (C) 2011 by Denys Duchier
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation, either version 3 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
// more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//=============================================================================
|
||||
|
||||
static RestartMode gecode_RestartMode_from_term(YAP_Term);
|
||||
static FloatRelType gecode_FloatRelType_from_term(YAP_Term);
|
||||
static ReifyMode gecode_ReifyMode_from_term(YAP_Term);
|
||||
static IntRelType gecode_IntRelType_from_term(YAP_Term);
|
||||
static BoolOpType gecode_BoolOpType_from_term(YAP_Term);
|
||||
static IntPropLevel gecode_IntPropLevel_from_term(YAP_Term);
|
||||
static TaskType gecode_TaskType_from_term(YAP_Term);
|
||||
static TraceEvent gecode_TraceEvent_from_term(YAP_Term);
|
||||
static SetRelType gecode_SetRelType_from_term(YAP_Term);
|
||||
static SetOpType gecode_SetOpType_from_term(YAP_Term);
|
5412
packages/gecode/6.0.0/gecode_yap_cc_impl_auto_generated.icc
vendored
Normal file
5412
packages/gecode/6.0.0/gecode_yap_cc_impl_auto_generated.icc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
681
packages/gecode/6.0.0/gecode_yap_cc_init_auto_generated.icc
vendored
Normal file
681
packages/gecode/6.0.0/gecode_yap_cc_init_auto_generated.icc
vendored
Normal file
@ -0,0 +1,681 @@
|
||||
// -*- c++ -*-
|
||||
//=============================================================================
|
||||
// Copyright (C) 2011 by Denys Duchier
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation, either version 3 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
// more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//=============================================================================
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_NONE");
|
||||
gecode_RM_NONE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_CONSTANT");
|
||||
gecode_RM_CONSTANT = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_LINEAR");
|
||||
gecode_RM_LINEAR = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_LUBY");
|
||||
gecode_RM_LUBY = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_GEOMETRIC");
|
||||
gecode_RM_GEOMETRIC = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("FRT_EQ");
|
||||
gecode_FRT_EQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("FRT_NQ");
|
||||
gecode_FRT_NQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("FRT_LQ");
|
||||
gecode_FRT_LQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("FRT_LE");
|
||||
gecode_FRT_LE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("FRT_GQ");
|
||||
gecode_FRT_GQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("FRT_GR");
|
||||
gecode_FRT_GR = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_EQV");
|
||||
gecode_RM_EQV = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_IMP");
|
||||
gecode_RM_IMP = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_PMI");
|
||||
gecode_RM_PMI = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("IRT_EQ");
|
||||
gecode_IRT_EQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IRT_NQ");
|
||||
gecode_IRT_NQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IRT_LQ");
|
||||
gecode_IRT_LQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IRT_LE");
|
||||
gecode_IRT_LE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IRT_GQ");
|
||||
gecode_IRT_GQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IRT_GR");
|
||||
gecode_IRT_GR = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("BOT_AND");
|
||||
gecode_BOT_AND = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("BOT_OR");
|
||||
gecode_BOT_OR = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("BOT_IMP");
|
||||
gecode_BOT_IMP = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("BOT_EQV");
|
||||
gecode_BOT_EQV = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("BOT_XOR");
|
||||
gecode_BOT_XOR = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_DEF");
|
||||
gecode_IPL_DEF = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_VAL");
|
||||
gecode_IPL_VAL = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_BND");
|
||||
gecode_IPL_BND = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_DOM");
|
||||
gecode_IPL_DOM = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_SPEED");
|
||||
gecode_IPL_SPEED = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_MEMORY");
|
||||
gecode_IPL_MEMORY = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_BASIC");
|
||||
gecode_IPL_BASIC = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_ADVANCED");
|
||||
gecode_IPL_ADVANCED = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_BASIC_ADVANCED");
|
||||
gecode_IPL_BASIC_ADVANCED = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("TT_FIXP");
|
||||
gecode_TT_FIXP = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TT_FIXS");
|
||||
gecode_TT_FIXS = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TT_FIXE");
|
||||
gecode_TT_FIXE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("TE_INIT");
|
||||
gecode_TE_INIT = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TE_PRUNE");
|
||||
gecode_TE_PRUNE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TE_FIX");
|
||||
gecode_TE_FIX = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TE_FAIL");
|
||||
gecode_TE_FAIL = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TE_DONE");
|
||||
gecode_TE_DONE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TE_PROPAGATE");
|
||||
gecode_TE_PROPAGATE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TE_COMMIT");
|
||||
gecode_TE_COMMIT = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_EQ");
|
||||
gecode_SRT_EQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_NQ");
|
||||
gecode_SRT_NQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_SUB");
|
||||
gecode_SRT_SUB = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_SUP");
|
||||
gecode_SRT_SUP = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_DISJ");
|
||||
gecode_SRT_DISJ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_CMPL");
|
||||
gecode_SRT_CMPL = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_LQ");
|
||||
gecode_SRT_LQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_LE");
|
||||
gecode_SRT_LE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_GQ");
|
||||
gecode_SRT_GQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_GR");
|
||||
gecode_SRT_GR = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("SOT_UNION");
|
||||
gecode_SOT_UNION = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SOT_DUNION");
|
||||
gecode_SOT_DUNION = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SOT_INTER");
|
||||
gecode_SOT_INTER = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SOT_MINUS");
|
||||
gecode_SOT_MINUS = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
YAP_UserCPredicate("gecode_constraint_branch_1", gecode_constraint_branch_1, 2);
|
||||
YAP_UserCPredicate("gecode_constraint_convex_2", gecode_constraint_convex_2, 2);
|
||||
YAP_UserCPredicate("gecode_constraint_convex_3", gecode_constraint_convex_3, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_abs_4", gecode_constraint_abs_4, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_abs_5", gecode_constraint_abs_5, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_abs_6", gecode_constraint_abs_6, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_argmax_7", gecode_constraint_argmax_7, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_argmax_8", gecode_constraint_argmax_8, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_argmax_10", gecode_constraint_argmax_10, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_argmax_9", gecode_constraint_argmax_9, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_argmax_11", gecode_constraint_argmax_11, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_argmax_12", gecode_constraint_argmax_12, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_argmin_13", gecode_constraint_argmin_13, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_argmin_14", gecode_constraint_argmin_14, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_argmin_16", gecode_constraint_argmin_16, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_argmin_15", gecode_constraint_argmin_15, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_argmin_17", gecode_constraint_argmin_17, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_argmin_18", gecode_constraint_argmin_18, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_19", gecode_constraint_assign_19, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_21", gecode_constraint_assign_21, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_23", gecode_constraint_assign_23, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_25", gecode_constraint_assign_25, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_27", gecode_constraint_assign_27, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_30", gecode_constraint_assign_30, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_33", gecode_constraint_assign_33, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_36", gecode_constraint_assign_36, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_20", gecode_constraint_assign_20, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_22", gecode_constraint_assign_22, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_24", gecode_constraint_assign_24, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_26", gecode_constraint_assign_26, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_28", gecode_constraint_assign_28, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_31", gecode_constraint_assign_31, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_34", gecode_constraint_assign_34, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_37", gecode_constraint_assign_37, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_29", gecode_constraint_assign_29, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_32", gecode_constraint_assign_32, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_35", gecode_constraint_assign_35, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_38", gecode_constraint_assign_38, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_binpacking_39", gecode_constraint_binpacking_39, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_binpacking_40", gecode_constraint_binpacking_40, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_41", gecode_constraint_branch_41, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_43", gecode_constraint_branch_43, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_45", gecode_constraint_branch_45, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_47", gecode_constraint_branch_47, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_42", gecode_constraint_branch_42, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_44", gecode_constraint_branch_44, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_46", gecode_constraint_branch_46, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_48", gecode_constraint_branch_48, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_49", gecode_constraint_branch_49, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_55", gecode_constraint_branch_55, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_61", gecode_constraint_branch_61, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_64", gecode_constraint_branch_64, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_67", gecode_constraint_branch_67, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_73", gecode_constraint_branch_73, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_79", gecode_constraint_branch_79, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_85", gecode_constraint_branch_85, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_50", gecode_constraint_branch_50, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_52", gecode_constraint_branch_52, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_56", gecode_constraint_branch_56, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_58", gecode_constraint_branch_58, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_62", gecode_constraint_branch_62, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_65", gecode_constraint_branch_65, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_68", gecode_constraint_branch_68, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_70", gecode_constraint_branch_70, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_74", gecode_constraint_branch_74, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_76", gecode_constraint_branch_76, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_80", gecode_constraint_branch_80, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_82", gecode_constraint_branch_82, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_86", gecode_constraint_branch_86, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_88", gecode_constraint_branch_88, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_51", gecode_constraint_branch_51, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_53", gecode_constraint_branch_53, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_57", gecode_constraint_branch_57, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_59", gecode_constraint_branch_59, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_63", gecode_constraint_branch_63, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_66", gecode_constraint_branch_66, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_69", gecode_constraint_branch_69, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_71", gecode_constraint_branch_71, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_75", gecode_constraint_branch_75, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_77", gecode_constraint_branch_77, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_81", gecode_constraint_branch_81, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_83", gecode_constraint_branch_83, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_87", gecode_constraint_branch_87, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_89", gecode_constraint_branch_89, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_54", gecode_constraint_branch_54, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_60", gecode_constraint_branch_60, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_72", gecode_constraint_branch_72, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_78", gecode_constraint_branch_78, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_84", gecode_constraint_branch_84, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_90", gecode_constraint_branch_90, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cardinality_91", gecode_constraint_cardinality_91, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_cardinality_92", gecode_constraint_cardinality_92, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_93", gecode_constraint_channel_93, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_95", gecode_constraint_channel_95, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_96", gecode_constraint_channel_96, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_97", gecode_constraint_channel_97, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_100", gecode_constraint_channel_100, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_94", gecode_constraint_channel_94, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_98", gecode_constraint_channel_98, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_101", gecode_constraint_channel_101, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_99", gecode_constraint_channel_99, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_102", gecode_constraint_channel_102, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_103", gecode_constraint_channel_103, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_104", gecode_constraint_circuit_104, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_115", gecode_constraint_circuit_115, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_105", gecode_constraint_circuit_105, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_106", gecode_constraint_circuit_106, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_108", gecode_constraint_circuit_108, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_107", gecode_constraint_circuit_107, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_109", gecode_constraint_circuit_109, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_110", gecode_constraint_circuit_110, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_111", gecode_constraint_circuit_111, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_112", gecode_constraint_circuit_112, 2);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_113", gecode_constraint_circuit_113, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_114", gecode_constraint_circuit_114, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_clause_116", gecode_constraint_clause_116, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_clause_118", gecode_constraint_clause_118, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_clause_117", gecode_constraint_clause_117, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_clause_119", gecode_constraint_clause_119, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_120", gecode_constraint_count_120, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_122", gecode_constraint_count_122, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_124", gecode_constraint_count_124, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_126", gecode_constraint_count_126, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_128", gecode_constraint_count_128, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_130", gecode_constraint_count_130, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_133", gecode_constraint_count_133, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_137", gecode_constraint_count_137, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_141", gecode_constraint_count_141, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_142", gecode_constraint_count_142, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_144", gecode_constraint_count_144, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_121", gecode_constraint_count_121, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_123", gecode_constraint_count_123, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_125", gecode_constraint_count_125, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_127", gecode_constraint_count_127, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_129", gecode_constraint_count_129, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_131", gecode_constraint_count_131, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_143", gecode_constraint_count_143, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_145", gecode_constraint_count_145, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_132", gecode_constraint_count_132, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_count_135", gecode_constraint_count_135, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_count_136", gecode_constraint_count_136, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_count_139", gecode_constraint_count_139, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_count_140", gecode_constraint_count_140, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_count_134", gecode_constraint_count_134, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_count_138", gecode_constraint_count_138, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_146", gecode_constraint_cumulative_146, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_158", gecode_constraint_cumulative_158, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_147", gecode_constraint_cumulative_147, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_148", gecode_constraint_cumulative_148, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_150", gecode_constraint_cumulative_150, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_154", gecode_constraint_cumulative_154, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_159", gecode_constraint_cumulative_159, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_160", gecode_constraint_cumulative_160, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_162", gecode_constraint_cumulative_162, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_166", gecode_constraint_cumulative_166, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_149", gecode_constraint_cumulative_149, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_151", gecode_constraint_cumulative_151, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_152", gecode_constraint_cumulative_152, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_155", gecode_constraint_cumulative_155, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_156", gecode_constraint_cumulative_156, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_161", gecode_constraint_cumulative_161, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_163", gecode_constraint_cumulative_163, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_164", gecode_constraint_cumulative_164, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_167", gecode_constraint_cumulative_167, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_168", gecode_constraint_cumulative_168, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_153", gecode_constraint_cumulative_153, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_157", gecode_constraint_cumulative_157, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_165", gecode_constraint_cumulative_165, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_169", gecode_constraint_cumulative_169, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_170", gecode_constraint_cumulatives_170, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_172", gecode_constraint_cumulatives_172, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_174", gecode_constraint_cumulatives_174, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_176", gecode_constraint_cumulatives_176, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_178", gecode_constraint_cumulatives_178, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_180", gecode_constraint_cumulatives_180, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_182", gecode_constraint_cumulatives_182, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_184", gecode_constraint_cumulatives_184, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_171", gecode_constraint_cumulatives_171, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_173", gecode_constraint_cumulatives_173, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_175", gecode_constraint_cumulatives_175, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_177", gecode_constraint_cumulatives_177, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_179", gecode_constraint_cumulatives_179, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_181", gecode_constraint_cumulatives_181, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_183", gecode_constraint_cumulatives_183, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_185", gecode_constraint_cumulatives_185, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_186", gecode_constraint_distinct_186, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_188", gecode_constraint_distinct_188, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_191", gecode_constraint_distinct_191, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_192", gecode_constraint_distinct_192, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_187", gecode_constraint_distinct_187, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_189", gecode_constraint_distinct_189, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_193", gecode_constraint_distinct_193, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_190", gecode_constraint_distinct_190, 2);
|
||||
YAP_UserCPredicate("gecode_constraint_div_194", gecode_constraint_div_194, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_div_195", gecode_constraint_div_195, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_div_196", gecode_constraint_div_196, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_divmod_197", gecode_constraint_divmod_197, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_divmod_198", gecode_constraint_divmod_198, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_199", gecode_constraint_dom_199, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_203", gecode_constraint_dom_203, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_205", gecode_constraint_dom_205, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_206", gecode_constraint_dom_206, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_208", gecode_constraint_dom_208, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_212", gecode_constraint_dom_212, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_226", gecode_constraint_dom_226, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_227", gecode_constraint_dom_227, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_230", gecode_constraint_dom_230, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_231", gecode_constraint_dom_231, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_232", gecode_constraint_dom_232, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_234", gecode_constraint_dom_234, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_236", gecode_constraint_dom_236, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_243", gecode_constraint_dom_243, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_200", gecode_constraint_dom_200, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_201", gecode_constraint_dom_201, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_204", gecode_constraint_dom_204, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_207", gecode_constraint_dom_207, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_209", gecode_constraint_dom_209, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_210", gecode_constraint_dom_210, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_213", gecode_constraint_dom_213, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_214", gecode_constraint_dom_214, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_216", gecode_constraint_dom_216, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_220", gecode_constraint_dom_220, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_222", gecode_constraint_dom_222, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_228", gecode_constraint_dom_228, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_229", gecode_constraint_dom_229, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_233", gecode_constraint_dom_233, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_235", gecode_constraint_dom_235, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_237", gecode_constraint_dom_237, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_238", gecode_constraint_dom_238, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_240", gecode_constraint_dom_240, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_241", gecode_constraint_dom_241, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_202", gecode_constraint_dom_202, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_211", gecode_constraint_dom_211, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_215", gecode_constraint_dom_215, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_217", gecode_constraint_dom_217, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_218", gecode_constraint_dom_218, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_221", gecode_constraint_dom_221, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_223", gecode_constraint_dom_223, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_224", gecode_constraint_dom_224, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_239", gecode_constraint_dom_239, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_242", gecode_constraint_dom_242, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_219", gecode_constraint_dom_219, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_225", gecode_constraint_dom_225, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_element_244", gecode_constraint_element_244, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_element_246", gecode_constraint_element_246, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_element_248", gecode_constraint_element_248, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_element_254", gecode_constraint_element_254, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_element_256", gecode_constraint_element_256, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_element_260", gecode_constraint_element_260, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_element_262", gecode_constraint_element_262, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_element_245", gecode_constraint_element_245, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_element_247", gecode_constraint_element_247, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_element_249", gecode_constraint_element_249, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_element_255", gecode_constraint_element_255, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_element_257", gecode_constraint_element_257, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_element_261", gecode_constraint_element_261, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_element_263", gecode_constraint_element_263, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_element_250", gecode_constraint_element_250, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_element_252", gecode_constraint_element_252, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_element_258", gecode_constraint_element_258, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_element_264", gecode_constraint_element_264, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_element_251", gecode_constraint_element_251, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_element_253", gecode_constraint_element_253, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_element_259", gecode_constraint_element_259, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_element_265", gecode_constraint_element_265, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_266", gecode_constraint_extensional_266, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_268", gecode_constraint_extensional_268, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_270", gecode_constraint_extensional_270, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_272", gecode_constraint_extensional_272, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_267", gecode_constraint_extensional_267, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_269", gecode_constraint_extensional_269, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_271", gecode_constraint_extensional_271, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_273", gecode_constraint_extensional_273, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_ite_274", gecode_constraint_ite_274, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_ite_276", gecode_constraint_ite_276, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_ite_277", gecode_constraint_ite_277, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_ite_279", gecode_constraint_ite_279, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_ite_275", gecode_constraint_ite_275, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_ite_278", gecode_constraint_ite_278, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_280", gecode_constraint_linear_280, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_284", gecode_constraint_linear_284, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_292", gecode_constraint_linear_292, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_294", gecode_constraint_linear_294, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_312", gecode_constraint_linear_312, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_316", gecode_constraint_linear_316, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_281", gecode_constraint_linear_281, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_282", gecode_constraint_linear_282, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_285", gecode_constraint_linear_285, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_286", gecode_constraint_linear_286, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_288", gecode_constraint_linear_288, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_290", gecode_constraint_linear_290, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_293", gecode_constraint_linear_293, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_295", gecode_constraint_linear_295, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_296", gecode_constraint_linear_296, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_300", gecode_constraint_linear_300, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_304", gecode_constraint_linear_304, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_308", gecode_constraint_linear_308, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_313", gecode_constraint_linear_313, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_314", gecode_constraint_linear_314, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_317", gecode_constraint_linear_317, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_318", gecode_constraint_linear_318, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_283", gecode_constraint_linear_283, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_287", gecode_constraint_linear_287, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_289", gecode_constraint_linear_289, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_291", gecode_constraint_linear_291, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_297", gecode_constraint_linear_297, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_298", gecode_constraint_linear_298, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_301", gecode_constraint_linear_301, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_302", gecode_constraint_linear_302, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_305", gecode_constraint_linear_305, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_306", gecode_constraint_linear_306, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_309", gecode_constraint_linear_309, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_310", gecode_constraint_linear_310, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_315", gecode_constraint_linear_315, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_319", gecode_constraint_linear_319, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_299", gecode_constraint_linear_299, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_303", gecode_constraint_linear_303, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_307", gecode_constraint_linear_307, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_311", gecode_constraint_linear_311, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_max_320", gecode_constraint_max_320, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_max_321", gecode_constraint_max_321, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_max_325", gecode_constraint_max_325, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_max_322", gecode_constraint_max_322, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_max_323", gecode_constraint_max_323, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_max_324", gecode_constraint_max_324, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_member_326", gecode_constraint_member_326, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_member_330", gecode_constraint_member_330, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_member_327", gecode_constraint_member_327, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_member_328", gecode_constraint_member_328, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_member_331", gecode_constraint_member_331, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_member_332", gecode_constraint_member_332, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_member_329", gecode_constraint_member_329, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_member_333", gecode_constraint_member_333, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_min_334", gecode_constraint_min_334, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_min_335", gecode_constraint_min_335, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_min_339", gecode_constraint_min_339, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_min_336", gecode_constraint_min_336, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_min_337", gecode_constraint_min_337, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_min_338", gecode_constraint_min_338, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_mod_340", gecode_constraint_mod_340, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_mod_341", gecode_constraint_mod_341, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_mult_342", gecode_constraint_mult_342, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_mult_343", gecode_constraint_mult_343, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_mult_344", gecode_constraint_mult_344, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_345", gecode_constraint_nooverlap_345, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_346", gecode_constraint_nooverlap_346, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_347", gecode_constraint_nooverlap_347, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_348", gecode_constraint_nooverlap_348, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_349", gecode_constraint_nooverlap_349, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_350", gecode_constraint_nooverlap_350, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_351", gecode_constraint_nooverlap_351, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_352", gecode_constraint_nooverlap_352, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_nroot_353", gecode_constraint_nroot_353, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_nroot_354", gecode_constraint_nroot_354, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_nroot_355", gecode_constraint_nroot_355, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_356", gecode_constraint_nvalues_356, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_358", gecode_constraint_nvalues_358, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_360", gecode_constraint_nvalues_360, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_362", gecode_constraint_nvalues_362, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_357", gecode_constraint_nvalues_357, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_359", gecode_constraint_nvalues_359, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_361", gecode_constraint_nvalues_361, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_363", gecode_constraint_nvalues_363, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_path_364", gecode_constraint_path_364, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_path_375", gecode_constraint_path_375, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_path_365", gecode_constraint_path_365, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_path_366", gecode_constraint_path_366, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_path_368", gecode_constraint_path_368, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_path_367", gecode_constraint_path_367, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_path_369", gecode_constraint_path_369, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_path_370", gecode_constraint_path_370, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_path_371", gecode_constraint_path_371, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_path_372", gecode_constraint_path_372, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_path_373", gecode_constraint_path_373, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_path_374", gecode_constraint_path_374, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_pow_376", gecode_constraint_pow_376, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_pow_377", gecode_constraint_pow_377, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_pow_378", gecode_constraint_pow_378, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_precede_379", gecode_constraint_precede_379, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_precede_380", gecode_constraint_precede_380, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_precede_381", gecode_constraint_precede_381, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_precede_382", gecode_constraint_precede_382, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_383", gecode_constraint_rel_383, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_385", gecode_constraint_rel_385, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_391", gecode_constraint_rel_391, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_395", gecode_constraint_rel_395, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_399", gecode_constraint_rel_399, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_401", gecode_constraint_rel_401, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_403", gecode_constraint_rel_403, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_407", gecode_constraint_rel_407, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_411", gecode_constraint_rel_411, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_413", gecode_constraint_rel_413, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_415", gecode_constraint_rel_415, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_417", gecode_constraint_rel_417, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_419", gecode_constraint_rel_419, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_422", gecode_constraint_rel_422, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_423", gecode_constraint_rel_423, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_425", gecode_constraint_rel_425, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_427", gecode_constraint_rel_427, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_429", gecode_constraint_rel_429, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_430", gecode_constraint_rel_430, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_431", gecode_constraint_rel_431, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_433", gecode_constraint_rel_433, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_436", gecode_constraint_rel_436, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_437", gecode_constraint_rel_437, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_439", gecode_constraint_rel_439, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_441", gecode_constraint_rel_441, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_443", gecode_constraint_rel_443, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_384", gecode_constraint_rel_384, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_386", gecode_constraint_rel_386, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_387", gecode_constraint_rel_387, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_389", gecode_constraint_rel_389, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_392", gecode_constraint_rel_392, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_393", gecode_constraint_rel_393, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_396", gecode_constraint_rel_396, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_397", gecode_constraint_rel_397, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_400", gecode_constraint_rel_400, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_402", gecode_constraint_rel_402, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_404", gecode_constraint_rel_404, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_405", gecode_constraint_rel_405, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_408", gecode_constraint_rel_408, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_409", gecode_constraint_rel_409, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_412", gecode_constraint_rel_412, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_414", gecode_constraint_rel_414, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_416", gecode_constraint_rel_416, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_418", gecode_constraint_rel_418, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_420", gecode_constraint_rel_420, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_424", gecode_constraint_rel_424, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_426", gecode_constraint_rel_426, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_428", gecode_constraint_rel_428, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_432", gecode_constraint_rel_432, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_434", gecode_constraint_rel_434, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_438", gecode_constraint_rel_438, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_440", gecode_constraint_rel_440, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_442", gecode_constraint_rel_442, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_444", gecode_constraint_rel_444, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_388", gecode_constraint_rel_388, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_390", gecode_constraint_rel_390, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_394", gecode_constraint_rel_394, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_398", gecode_constraint_rel_398, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_406", gecode_constraint_rel_406, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_410", gecode_constraint_rel_410, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_421", gecode_constraint_rel_421, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_435", gecode_constraint_rel_435, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_relax_445", gecode_constraint_relax_445, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_sequence_446", gecode_constraint_sequence_446, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_sequence_448", gecode_constraint_sequence_448, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_sequence_447", gecode_constraint_sequence_447, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_sequence_449", gecode_constraint_sequence_449, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_sorted_450", gecode_constraint_sorted_450, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_sorted_451", gecode_constraint_sorted_451, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_sorted_452", gecode_constraint_sorted_452, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_sorted_453", gecode_constraint_sorted_453, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_sqr_454", gecode_constraint_sqr_454, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_sqr_455", gecode_constraint_sqr_455, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_sqr_456", gecode_constraint_sqr_456, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_sqrt_457", gecode_constraint_sqrt_457, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_sqrt_458", gecode_constraint_sqrt_458, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_sqrt_459", gecode_constraint_sqrt_459, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_460", gecode_constraint_unary_460, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_461", gecode_constraint_unary_461, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_462", gecode_constraint_unary_462, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_464", gecode_constraint_unary_464, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_468", gecode_constraint_unary_468, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_463", gecode_constraint_unary_463, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_465", gecode_constraint_unary_465, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_466", gecode_constraint_unary_466, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_469", gecode_constraint_unary_469, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_470", gecode_constraint_unary_470, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_467", gecode_constraint_unary_467, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_471", gecode_constraint_unary_471, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_unshare_472", gecode_constraint_unshare_472, 2);
|
||||
YAP_UserCPredicate("gecode_constraint_unshare_474", gecode_constraint_unshare_474, 2);
|
||||
YAP_UserCPredicate("gecode_constraint_unshare_473", gecode_constraint_unshare_473, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_unshare_475", gecode_constraint_unshare_475, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_when_476", gecode_constraint_when_476, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_when_477", gecode_constraint_when_477, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_when_478", gecode_constraint_when_478, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_when_479", gecode_constraint_when_479, 5);
|
@ -728,7 +728,7 @@ def gecode_version():
|
||||
os.remove(file_hh)
|
||||
os.remove(file_txt)
|
||||
else:
|
||||
version = "5.0.0"
|
||||
version = "6.0.0"
|
||||
GECODE_VERSION = version
|
||||
return version
|
||||
|
||||
|
433
packages/gecode/gecode6-common.icc
Normal file
433
packages/gecode/gecode6-common.icc
Normal file
@ -0,0 +1,433 @@
|
||||
// -*- c++ -*-
|
||||
//=============================================================================
|
||||
// Copyright (C) 2011 by Denys Duchier
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation, either version 3 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
// more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//=============================================================================
|
||||
|
||||
#ifndef GECODE_COMMON
|
||||
#define GECODE_COMMON
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#define __i386__ 1
|
||||
#if __x86_64__
|
||||
#define _WIN64 1
|
||||
#define _AMD64_ 1
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "gecode/driver.hh"
|
||||
#include "gecode/int.hh"
|
||||
#include "gecode/set.hh"
|
||||
#include "gecode/search.hh"
|
||||
#include <vector>
|
||||
|
||||
namespace generic_gecode
|
||||
{
|
||||
using namespace std;
|
||||
using namespace Gecode;
|
||||
|
||||
// description of the optimization criterion
|
||||
struct Optimizing
|
||||
{
|
||||
enum What { OPT_NONE, OPT_INT, OPT_RATIO };
|
||||
enum How { OPT_MIN, OPT_MAX };
|
||||
int num;
|
||||
int den;
|
||||
What what;
|
||||
How how;
|
||||
Optimizing(): num(-1), den(-1), what(OPT_NONE), how(OPT_MAX) {}
|
||||
Optimizing(Optimizing& o)
|
||||
: num(o.num), den(o.den), what(o.what), how(o.how) {}
|
||||
void check_ok() const
|
||||
{ if (what!=OPT_NONE)
|
||||
throw Exception("gecode-python","too many optimization criteria"); }
|
||||
void maximize(int i)
|
||||
{ check_ok(); what = OPT_INT; how = OPT_MAX; num = i; };
|
||||
void maximize(int i,int j)
|
||||
{ check_ok(); what = OPT_RATIO; how = OPT_MAX; num = i; den = j; };
|
||||
void minimize(int i)
|
||||
{ check_ok(); what = OPT_INT; how = OPT_MIN; num = i; };
|
||||
void minimize(int i,int j)
|
||||
{ check_ok(); what = OPT_RATIO; how = OPT_MIN; num = i; den = j; };
|
||||
};
|
||||
|
||||
class GenericSpace;
|
||||
|
||||
struct GenericEngine
|
||||
{
|
||||
virtual GenericSpace* next(void)=0;
|
||||
virtual ~GenericEngine() {};
|
||||
};
|
||||
|
||||
struct GenericDFS: GenericEngine
|
||||
{
|
||||
DFS<GenericSpace> engine;
|
||||
GenericDFS(GenericSpace* s,Search::Options& opt) : engine(s,opt) {}
|
||||
virtual GenericSpace* next(void) { return engine.next(); }
|
||||
};
|
||||
|
||||
struct GenericRestartDFS: GenericEngine
|
||||
{
|
||||
RBS<GenericSpace,DFS> engine;
|
||||
GenericRestartDFS(GenericSpace* s,Search::Options& opt) : engine(s,opt) {}
|
||||
virtual GenericSpace* next(void) { return engine.next(); }
|
||||
};
|
||||
|
||||
struct GenericBAB: GenericEngine
|
||||
{
|
||||
BAB<GenericSpace> engine;
|
||||
GenericBAB(GenericSpace* s,Search::Options& opt) : engine(s,opt) {}
|
||||
virtual GenericSpace* next(void) { return engine.next(); }
|
||||
};
|
||||
|
||||
struct GenericRestartBAB: GenericEngine
|
||||
{
|
||||
RBS<GenericSpace,BAB> engine;
|
||||
GenericRestartBAB(GenericSpace* s,Search::Options& opt) : engine(s,opt) {}
|
||||
virtual GenericSpace* next(void) { return engine.next(); }
|
||||
};
|
||||
|
||||
#ifdef OLD
|
||||
struct GenericRestart: GenericEngine
|
||||
{
|
||||
Restart<GenericSpace> engine;
|
||||
GenericRestart(GenericSpace* s,Search::Options& opt): engine(s,opt) {}
|
||||
virtual GenericSpace* next(void) { return engine.next(); }
|
||||
};
|
||||
#endif
|
||||
|
||||
struct LoadingDock
|
||||
{
|
||||
vector<IntVar> ivars;
|
||||
vector<BoolVar> bvars;
|
||||
vector<FloatVar> fvars;
|
||||
vector<SetVar> svars;
|
||||
vector<int> ikeep;
|
||||
vector<int> bkeep;
|
||||
vector<int> fkeep;
|
||||
vector<int> skeep;
|
||||
|
||||
bool keeping_some() const
|
||||
{
|
||||
return (ikeep.size() != 0)
|
||||
|| (bkeep.size() != 0)
|
||||
|| (fkeep.size() != 0)
|
||||
|| (skeep.size() != 0);
|
||||
}
|
||||
|
||||
IntVar get_ivar(int i) const { return ivars[i]; }
|
||||
BoolVar get_bvar(int i) const { return bvars[i]; }
|
||||
FloatVar get_fvar(int i) const { return fvars[i]; }
|
||||
SetVar get_svar(int i) const { return svars[i]; }
|
||||
|
||||
int enter_ivar(const IntVar& v)
|
||||
{ ivars.push_back(v); return static_cast<int>(ivars.size()-1); }
|
||||
|
||||
int enter_bvar(const BoolVar& v)
|
||||
{ bvars.push_back(v); return static_cast<int>(bvars.size()-1); }
|
||||
|
||||
int enter_fvar(const FloatVar& v)
|
||||
{ fvars.push_back(v); return static_cast<int>(fvars.size()-1); }
|
||||
|
||||
int enter_svar(const SetVar& v)
|
||||
{ svars.push_back(v); return static_cast<int>(svars.size()-1); }
|
||||
|
||||
int keep_ivar(int i) { ikeep.push_back(i); return static_cast<int>(ikeep.size()-1); }
|
||||
int keep_bvar(int i) { bkeep.push_back(i); return static_cast<int>(bkeep.size()-1); }
|
||||
int keep_fvar(int i) { fkeep.push_back(i); return static_cast<int>(fkeep.size()-1); }
|
||||
int keep_svar(int i) { skeep.push_back(i); return static_cast<int>(skeep.size()-1); }
|
||||
|
||||
void freeze(Space& home,
|
||||
IntVarArray& iarr, BoolVarArray& barr, SetVarArray& sarr, FloatVarArray& farr,
|
||||
int& num, int& den)
|
||||
{
|
||||
if (keeping_some())
|
||||
{
|
||||
// make sure that optimization vars (if any) are kept
|
||||
if (num != -1)
|
||||
{
|
||||
const int _num(num);
|
||||
const int _den(den);
|
||||
int n = static_cast<int>(ikeep.size());
|
||||
bool num_found(false);
|
||||
bool den_found(false);
|
||||
for (;n--;)
|
||||
{
|
||||
const int idx(ikeep[n]);
|
||||
if (idx==_num)
|
||||
{ num_found=true; if (den_found) break; }
|
||||
if (idx==_den)
|
||||
{ den_found=true; if (num_found) break; }
|
||||
}
|
||||
if (!num_found)
|
||||
{ ikeep.push_back(_num);
|
||||
num=static_cast<int>(ikeep.size()-1); }
|
||||
if (_den != -1 && !den_found)
|
||||
{ ikeep.push_back(_den);
|
||||
den=static_cast<int>(ikeep.size()-1); }
|
||||
}
|
||||
{ int n = static_cast<int>(ikeep.size());
|
||||
iarr = IntVarArray(home, n);
|
||||
for (;n--;) iarr[n]=ivars[ikeep[n]]; }
|
||||
{ int n = static_cast<int>(bkeep.size());
|
||||
barr = BoolVarArray(home, n);
|
||||
for (;n--;) barr[n]=bvars[bkeep[n]]; }
|
||||
{ int n = static_cast<int>(skeep.size());
|
||||
sarr = SetVarArray(home, n);
|
||||
for (;n--;) sarr[n]=svars[skeep[n]]; }
|
||||
{ int n = static_cast<int>(fkeep.size());
|
||||
farr = FloatVarArray(home, n);
|
||||
for (;n--;) farr[n]=fvars[skeep[n]]; }
|
||||
}
|
||||
else
|
||||
{
|
||||
{ int n = static_cast<int>(ivars.size());
|
||||
iarr = IntVarArray(home, n);
|
||||
for (;n--;) iarr[n]=ivars[n]; }
|
||||
{ int n = static_cast<int>(bvars.size());
|
||||
barr = BoolVarArray(home, n);
|
||||
for (;n--;) barr[n]=bvars[n]; }
|
||||
{ int n = static_cast<int>(svars.size());
|
||||
sarr = SetVarArray(home, n);
|
||||
for (;n--;) sarr[n]=svars[n]; }
|
||||
{ int n = static_cast<int>(fvars.size());
|
||||
farr = FloatVarArray(home, n);
|
||||
for (;n--;) farr[n]=fvars[n]; }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class GenericSpace: public Space
|
||||
{
|
||||
Optimizing optim;
|
||||
IntVarArray ivars;
|
||||
BoolVarArray bvars;
|
||||
FloatVarArray fvars;
|
||||
SetVarArray svars;
|
||||
LoadingDock* dock;
|
||||
bool keeping_some; // iff only SOME of the vars are kept
|
||||
public:
|
||||
Space* space() { return this; }
|
||||
|
||||
Space* copy(bool share)
|
||||
{ freeze(); return new GenericSpace(share, *this); }
|
||||
|
||||
Space* copy(void) {return copy(false);}
|
||||
GenericSpace(bool share, GenericSpace& s)
|
||||
: Space( s), optim(s.optim), dock(NULL), keeping_some(s.keeping_some)
|
||||
{
|
||||
ivars.update(*this, s.ivars);
|
||||
bvars.update(*this, s.bvars);
|
||||
svars.update(*this, s.svars);
|
||||
fvars.update(*this, s.fvars);
|
||||
}
|
||||
|
||||
|
||||
GenericSpace() : dock(new LoadingDock()), keeping_some(false) {}
|
||||
~GenericSpace() { delete dock; }
|
||||
|
||||
// throw some C++ exception on behalf of glue code
|
||||
void kaboom(const char* s)
|
||||
{ throw Exception("gecode-python", s); }
|
||||
int ikaboom(const char* s)
|
||||
{ kaboom(s); return 0; }
|
||||
|
||||
// freeze the space before handing it off to a search engine
|
||||
void freeze()
|
||||
{
|
||||
if (dock)
|
||||
{
|
||||
keeping_some = dock->keeping_some();
|
||||
dock->freeze(*this, ivars, bvars, svars, fvars, optim.num, optim.den);
|
||||
delete dock;
|
||||
dock = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
IntVar get_ivar(int i) const { return (dock)?dock->get_ivar(i):ivars[i]; }
|
||||
BoolVar get_bvar(int i) const { return (dock)?dock->get_bvar(i):bvars[i]; }
|
||||
SetVar get_svar(int i) const { return (dock)?dock->get_svar(i):svars[i]; }
|
||||
FloatVar get_fvar(int i) const { return (dock)?dock->get_fvar(i):fvars[i]; }
|
||||
|
||||
int keep_ivar(int i)
|
||||
{
|
||||
if (dock) return dock->keep_ivar(i);
|
||||
else return ikaboom("too late to keep");
|
||||
}
|
||||
|
||||
int keep_bvar(int i)
|
||||
{
|
||||
if (dock) return dock->keep_bvar(i);
|
||||
else return ikaboom("too late to keep");
|
||||
}
|
||||
|
||||
int keep_svar(int i)
|
||||
{
|
||||
if (dock) return dock->keep_svar(i);
|
||||
else return ikaboom("too late to keep");
|
||||
}
|
||||
|
||||
int keep_fvar(int i)
|
||||
{
|
||||
if (dock) return dock->keep_fvar(i);
|
||||
else return ikaboom("too late to keep");
|
||||
}
|
||||
|
||||
bool frozen() const { return dock==NULL; }
|
||||
bool has_keepers() const { return keeping_some; }
|
||||
// when frozen and has_keepers: which is just has_keepers actually
|
||||
bool use_keep_index() const { return has_keepers(); }
|
||||
|
||||
GenericEngine* new_engine(bool restart, Search::Options& opt)
|
||||
{
|
||||
freeze();
|
||||
return (optim.what == Optimizing::OPT_NONE)
|
||||
? ( restart
|
||||
? static_cast<GenericEngine*>(new GenericRestartDFS(this,opt))
|
||||
: static_cast<GenericEngine*>(new GenericDFS(this,opt)) )
|
||||
: (restart
|
||||
? static_cast<GenericEngine*>(new GenericRestartBAB(this,opt))
|
||||
:
|
||||
static_cast<GenericEngine*>(new GenericBAB(this,opt)) );
|
||||
}
|
||||
|
||||
int _new_ivar(IntVar& v)
|
||||
{
|
||||
if (dock) return dock->enter_ivar(v);
|
||||
else return ikaboom("too late to create vars");
|
||||
}
|
||||
|
||||
int new_ivar(int lo, int hi)
|
||||
{
|
||||
IntVar v(*this, lo, hi);
|
||||
return _new_ivar(v);
|
||||
}
|
||||
|
||||
int new_ivar(IntSet& s)
|
||||
{
|
||||
IntVar v(*this, s);
|
||||
return _new_ivar(v);
|
||||
}
|
||||
|
||||
int _new_fvar(FloatVar& v)
|
||||
{
|
||||
if (dock) return dock->enter_fvar(v);
|
||||
else return ikaboom("too late to create vars");
|
||||
}
|
||||
|
||||
int new_fvar(double lo, double hi)
|
||||
{
|
||||
FloatVar v(*this, lo, hi);
|
||||
return _new_fvar(v);
|
||||
}
|
||||
|
||||
int _new_bvar(BoolVar& v)
|
||||
{
|
||||
if (dock) return dock->enter_bvar(v);
|
||||
else return ikaboom("too late to create vars");
|
||||
}
|
||||
|
||||
int new_bvar()
|
||||
{
|
||||
BoolVar v(*this, 0, 1);
|
||||
return _new_bvar(v);
|
||||
}
|
||||
|
||||
int _new_svar(SetVar& v)
|
||||
{
|
||||
if (dock) return dock->enter_svar(v);
|
||||
else return ikaboom("too late to create vars");
|
||||
}
|
||||
|
||||
int new_svar(int glbMin, int glbMax, int lubMin, int lubMax,
|
||||
unsigned int cardMin=0,
|
||||
unsigned int cardMax=Set::Limits::card)
|
||||
{
|
||||
SetVar v(*this, glbMin, glbMax, lubMin, lubMax, cardMin, cardMax);
|
||||
return _new_svar(v);
|
||||
}
|
||||
|
||||
int new_ssvar(int glbMin, int glbMax, IntSet lubMin, IntSet lubMax,
|
||||
unsigned int cardMin=0,
|
||||
unsigned int cardMax=Set::Limits::card)
|
||||
{
|
||||
SetVar v(*this, glbMin, glbMax, lubMin, lubMax, cardMin, cardMax);
|
||||
return _new_svar(v);
|
||||
}
|
||||
|
||||
int new_ssvar(IntSet glb, int lubMin, int lubMax,
|
||||
unsigned int cardMin=0,
|
||||
unsigned int cardMax=Set::Limits::card)
|
||||
{
|
||||
SetVar v(*this, glb, lubMin, lubMax, cardMin, cardMax);
|
||||
return _new_svar(v);
|
||||
}
|
||||
|
||||
int new_svar(int glbMin, int glbMax, IntSet lub,
|
||||
unsigned int cardMin=0,
|
||||
unsigned int cardMax=Set::Limits::card)
|
||||
{
|
||||
SetVar v(*this, glbMin, glbMax, lub, cardMin, cardMax);
|
||||
return _new_svar(v);
|
||||
}
|
||||
|
||||
int new_sssvar(IntSet glb, IntSet lub,
|
||||
unsigned int cardMin=0,
|
||||
unsigned int cardMax=Set::Limits::card)
|
||||
{
|
||||
SetVar v(*this, glb, lub, cardMin, cardMax);
|
||||
return _new_svar(v);
|
||||
}
|
||||
|
||||
void minimize(int i) { optim.minimize(i); }
|
||||
void minimize(int i, int j) { optim.minimize(i,j); }
|
||||
void maximize(int i) { optim.maximize(i); }
|
||||
void maximize(int i, int j) { optim.maximize(i,j); }
|
||||
|
||||
void constrain(const Space& s)
|
||||
{
|
||||
const GenericSpace& sol = static_cast<const GenericSpace&>(s);
|
||||
switch (optim.what)
|
||||
{
|
||||
case Optimizing::OPT_NONE:
|
||||
break;
|
||||
case Optimizing::OPT_INT:
|
||||
rel(*this, ivars[optim.num],
|
||||
((optim.how==Optimizing::OPT_MIN) ? IRT_LE : IRT_GR),
|
||||
sol.ivars[optim.num].val());
|
||||
break;
|
||||
case Optimizing::OPT_RATIO:
|
||||
{
|
||||
IntArgs c(2, sol.ivars[optim.den].val(),
|
||||
- sol.ivars[optim.num].val());
|
||||
IntVarArgs v(2);
|
||||
v[0] = ivars[optim.num];
|
||||
v[1] = ivars[optim.den];
|
||||
linear(*this, c, v,
|
||||
((optim.how==Optimizing::OPT_MIN) ? IRT_LE : IRT_GR), 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#ifdef DISJUNCTOR
|
||||
#include "disjunctor.icc"
|
||||
#endif
|
||||
|
||||
#endif
|
7
packages/gecode/gecode6.yap
Normal file
7
packages/gecode/gecode6.yap
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
/* just for program analysis */
|
||||
|
||||
|
||||
|
||||
:- include(gecode6_yap_hand_written).
|
||||
:- include('6.0.0/gecode_yap_auto_generated').
|
2111
packages/gecode/gecode6_yap.cc
Normal file
2111
packages/gecode/gecode6_yap.cc
Normal file
File diff suppressed because it is too large
Load Diff
1343
packages/gecode/gecode6_yap_hand_written.yap
Normal file
1343
packages/gecode/gecode6_yap_hand_written.yap
Normal file
File diff suppressed because it is too large
Load Diff
@ -713,11 +713,8 @@ static void Yap_InitBackMYDDAS_SQLITE3Preds(void) {
|
||||
}
|
||||
|
||||
X_API void init_sqlite3(void) {
|
||||
Term cm = CurrentModule;
|
||||
CurrentModule = PROLOG_MODULE;
|
||||
Yap_InitMYDDAS_SQLITE3Preds();
|
||||
Yap_InitBackMYDDAS_SQLITE3Preds();
|
||||
CurrentModule = cm;
|
||||
}
|
||||
|
||||
#if _ANDROID_
|
||||
|
@ -119,17 +119,17 @@ static foreign_t prolog_list_to_python_list(term_t plist, term_t pyt, term_t tle
|
||||
term_t targ = PL_new_term_ref();
|
||||
|
||||
if (PL_skip_list(plist, targ, &sz) <0 || ! PL_get_nil(targ)) {
|
||||
pyErrorAndReturn( false, false);
|
||||
pyErrorAndReturn( false);
|
||||
}
|
||||
if (!PyList_Check(pyl))
|
||||
{
|
||||
pyErrorAndReturn( false, false);
|
||||
pyErrorAndReturn( false);
|
||||
}
|
||||
if (sz > PyList_GET_SIZE(pyl))
|
||||
pyErrorAndReturn( false, false);
|
||||
pyErrorAndReturn( false);
|
||||
for (i=0; i < sz; i++) {
|
||||
if (!PL_get_list(plist, targ, plist)) {
|
||||
pyErrorAndReturn( false, false);
|
||||
pyErrorAndReturn( false);
|
||||
}
|
||||
PyObject *t = term_to_python(targ, true, NULL, true);
|
||||
PyList_SET_ITEM(pyl, i, t);
|
||||
@ -139,7 +139,7 @@ static foreign_t prolog_list_to_python_list(term_t plist, term_t pyt, term_t tle
|
||||
} else {
|
||||
python_assign(tlen, PyLong_FromUnsignedLong(sz), NULL);
|
||||
}
|
||||
pyErrorAndReturn( true, false);
|
||||
pyErrorAndReturn( true);
|
||||
}
|
||||
|
||||
install_t install_pl2pl(void) {
|
||||
|
@ -35,6 +35,7 @@ static PyObject *s_to_python(const char *s, bool eval, PyObject *p0) {
|
||||
// char *ns = Py_Malloc(strlen(s)+1);
|
||||
/// strcpy(ns,s);
|
||||
PyObject *pobj = PyUnicode_FromString(s);
|
||||
Py_INCREF(pobj);
|
||||
return pobj;
|
||||
}
|
||||
}
|
||||
@ -48,6 +49,8 @@ static PyObject *s_to_python(const char *s, bool eval, PyObject *p0) {
|
||||
* @return a Python object descriptor or NULL if failed
|
||||
*/
|
||||
X_API PyObject *string_to_python(const char *s, bool eval, PyObject *p0) {
|
||||
|
||||
|
||||
char *buf = malloc(strlen(s) + 1), *child;
|
||||
while ((child = strchr(s, '.')) != NULL) {
|
||||
size_t len = child - s;
|
||||
@ -260,7 +263,7 @@ PyObject *term_to_python(term_t t, bool eval, PyObject *o, bool cvt) {
|
||||
PyObject *ip = term_to_python(trhs, eval, o, cvt);
|
||||
if (PySequence_Check(v)) {
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
if (PyLong_Check(ip) {
|
||||
if (PyLong_Check(ip)) {
|
||||
min = PyLong_AsLong(ip);
|
||||
} else if (PyInt_Check(ip) {
|
||||
min = PyInt_asInt(ip);
|
||||
@ -341,6 +344,7 @@ PyObject *term_to_python(term_t t, bool eval, PyObject *o, bool cvt) {
|
||||
AOK(PL_get_arg(1, t, t), NULL);
|
||||
if (!(dict = PyDict_New()))
|
||||
return NULL;
|
||||
Py_INCREF(dict);
|
||||
DebugPrintf("Dict %p\n", dict);
|
||||
|
||||
while (PL_is_functor(t, FUNCTOR_comma2)) {
|
||||
|
@ -46,6 +46,7 @@ foreign_t assign_to_symbol(term_t t, PyObject *e) {
|
||||
PyObject *dic;
|
||||
if (!lookupPySymbol(s, NULL, &dic))
|
||||
dic = py_Main;
|
||||
Py_INCREF(e);
|
||||
return PyObject_SetAttrString(dic, s, e) == 0;
|
||||
}
|
||||
|
||||
@ -206,6 +207,7 @@ foreign_t python_to_term(PyObject *pVal, term_t t) {
|
||||
}
|
||||
|
||||
X_API YAP_Term pythonToYAP(PyObject *pVal) {
|
||||
|
||||
term_t t = PL_new_term_ref();
|
||||
if (pVal == NULL || !python_to_term(pVal, t)) {
|
||||
PL_reset_term_refs(t);
|
||||
@ -213,7 +215,7 @@ X_API YAP_Term pythonToYAP(PyObject *pVal) {
|
||||
}
|
||||
YAP_Term tt = YAP_GetFromSlot(t);
|
||||
PL_reset_term_refs(t);
|
||||
Py_DECREF(pVal);
|
||||
//Py_DECREF(pVal);
|
||||
return tt;
|
||||
}
|
||||
|
||||
@ -315,12 +317,13 @@ bool python_assign(term_t t, PyObject *exp, PyObject *context) {
|
||||
if (PySequence_Check(o) && PyInt_Check(i)) {
|
||||
long int j;
|
||||
j = PyInt_AsLong(i);
|
||||
return PySequence_SetItem(o, i, exp) == 0;
|
||||
return PySequence_SetItem(o, i, exp) == 0;
|
||||
}
|
||||
#endif
|
||||
if (PyDict_Check(o)) {
|
||||
if (PyDict_SetItem(o, i, exp) == 0)
|
||||
if (PyDict_SetItem(o, i, exp) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (PyObject_SetAttr(o, i, exp) == 0) {
|
||||
return true;
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
PyObject *find_obj(PyObject *ob, term_t lhs, bool eval);
|
||||
|
||||
#if DEBUG_MEMORY
|
||||
#if DEBUG_MEMORY||1
|
||||
#define DebugPrintf(s, op) fprintf(stderr, "%s:%d: " s, __FILE__, __LINE__, op)
|
||||
#else
|
||||
#define DebugPrintf(s, op)
|
||||
@ -63,7 +63,7 @@ extern bool init_python_vfs(void);
|
||||
ATOM_comma, ATOM_builtin, ATOM_V, ATOM_A, ATOM_self, ATOM_nil,
|
||||
ATOM_brackets, ATOM_curly_brackets;
|
||||
|
||||
extern functor_t FUNCTOR_dollar1, FUNCTOR_abs1, FUNCTOR_all1, FUNCTOR_any1,
|
||||
extern functor_t FUNCTOR_dollar1, FUNCTOR_abs1, FUNCTOR_all1, FUNCTOR_any1, FUNCTOR_as2,
|
||||
FUNCTOR_bin1, FUNCTOR_brackets1, FUNCTOR_comma2, FUNCTOR_dir1,
|
||||
FUNCTOR_float1, FUNCTOR_int1, FUNCTOR_iter1, FUNCTOR_iter2, FUNCTOR_long1,
|
||||
FUNCTOR_len1, FUNCTOR_curly1, FUNCTOR_ord1, FUNCTOR_range1, FUNCTOR_range2,
|
||||
@ -85,7 +85,7 @@ extern PyObject *py_ModDict;
|
||||
|
||||
extern X_API bool python_in_python;
|
||||
|
||||
extern bool python_release_GIL(term_t state);
|
||||
extern bool python_release_GIL(term_t gstate);
|
||||
extern term_t python_acquire_GIL(void);
|
||||
|
||||
static inline Py_ssize_t get_p_int(PyObject *o, Py_ssize_t def) {
|
||||
@ -168,21 +168,19 @@ extern void pyErrorHandler__(int line, const char *file, const char *code);
|
||||
} \
|
||||
}
|
||||
|
||||
#define pyErrorAndReturn(x, y) \
|
||||
#define pyErrorAndReturn(x) \
|
||||
{ \
|
||||
if (PyErr_Occurred()) { \
|
||||
pyErrorHandler__(__LINE__, __FILE__, __FUNCTION__); \
|
||||
return (x); \
|
||||
} else { \
|
||||
return (x); \
|
||||
} \
|
||||
return (x); \
|
||||
}
|
||||
// #define pyErrorAndReturn( x, y ) return x
|
||||
|
||||
extern PyObject *compound_to_pyeval(term_t t, PyObject *context, bool cvt);
|
||||
extern PyObject *compound_to_pytree(term_t t, PyObject *context, bool cvt);
|
||||
|
||||
extern PyObject *term_to_python(term_t t, bool eval, PyObject *contextxs,
|
||||
extern PyObject *term_to_python(term_t t, bool eval, PyObject *context,
|
||||
bool eval_atom);
|
||||
|
||||
extern PyObject *term_to_nametuple(const char *s, arity_t arity, PyObject *);
|
||||
|
@ -1014,7 +1014,6 @@ PyObject *compound_to_pyeval(term_t t, PyObject *context, bool cvt) {
|
||||
} else {
|
||||
char *s = PL_atom_chars(name);
|
||||
PyObject *ys = lookupPySymbol(s, o, NULL), *pArgs;
|
||||
DebugPrintf("Tuple %p\n", pArgs);
|
||||
int i;
|
||||
term_t tleft = PL_new_term_ref();
|
||||
bool indict = true;
|
||||
@ -1037,6 +1036,7 @@ PyObject *compound_to_pyeval(term_t t, PyObject *context, bool cvt) {
|
||||
pArgs = PyTuple_New(i);
|
||||
}
|
||||
}
|
||||
DebugPrintf("Tuple %p\n", pyDict);
|
||||
if (!indict) {
|
||||
if (PL_is_variable(tleft)) {
|
||||
pArg = Py_None;
|
||||
|
@ -5,47 +5,36 @@
|
||||
|
||||
#include "YapStreams.h"
|
||||
|
||||
VFS_t pystream;
|
||||
YAP_Term TermErrStream, TermOutStream;
|
||||
|
||||
static void *py_open(VFS_t *me, int sno, const char *name,
|
||||
const char *io_mode) {
|
||||
#if HAVE_STRCASESTR
|
||||
if (strcasestr(name, "/python/") == name)
|
||||
name += strlen("/python/");
|
||||
#else
|
||||
if (strstr(name, "/python/") == name)
|
||||
name += strlen("/python/");
|
||||
#endif
|
||||
StreamDesc *st = YAP_RepStreamFromId(sno);
|
||||
// we assume object is already open, so there is no need to open it.
|
||||
PyObject *stream = string_to_python(name, true, NULL);
|
||||
if (stream == Py_None)
|
||||
return NULL;
|
||||
Py_INCREF(stream);
|
||||
st->u.private_data = stream;
|
||||
st->vfs = me;
|
||||
st->name = YAP_LookupAtom(name);
|
||||
st->user_name = YAP_MkAtomTerm(st->name);
|
||||
return stream;
|
||||
}
|
||||
|
||||
static bool py_close(int sno) { return true; }
|
||||
|
||||
static int py_put(int sno, int ch) {
|
||||
static int py_put(int sno, int ch)
|
||||
{
|
||||
// PyObject *pyw; // buffer
|
||||
// int pyw_kind;
|
||||
// PyObject *pyw_data;
|
||||
// PySys_WriteStdout("%C", ch);
|
||||
// return ch;
|
||||
char s[2];
|
||||
StreamDesc *st = YAP_GetStreamFromId(sno);
|
||||
// PyUnicode_WRITE(pyw_kind, pyw_data, 0, ch);
|
||||
PyObject *err, *fput = PyObject_GetAttrString(st->u.private_data, "write");
|
||||
if (st->user_name == TermOutStream) {
|
||||
term_t tg = python_acquire_GIL();
|
||||
PySys_WriteStdout("%C", ch);
|
||||
python_release_GIL(tg);
|
||||
return ch;
|
||||
}
|
||||
if (st->user_name == TermErrStream) {
|
||||
term_t tg = python_acquire_GIL();
|
||||
PySys_WriteStderr("%C", ch);
|
||||
python_release_GIL(tg);
|
||||
return ch;
|
||||
}
|
||||
char s[2];
|
||||
PyObject *err;
|
||||
s[0] = ch;
|
||||
s[1] = '\0';
|
||||
term_t g0 = python_acquire_GIL();
|
||||
PyObject_CallMethodObjArgs(st->u.private_data, PyUnicode_FromString("write"),
|
||||
PyUnicode_FromString(s), NULL);
|
||||
if ((err = PyErr_Occurred())) {
|
||||
python_release_GIL(g0);
|
||||
if ((err = PyErr_Occurred()))
|
||||
{
|
||||
PyErr_SetString(
|
||||
err,
|
||||
"Error in put\n"); // %s:%s:%d!\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
@ -53,32 +42,131 @@ static int py_put(int sno, int ch) {
|
||||
return ch;
|
||||
}
|
||||
|
||||
static int py_get(int sno) {
|
||||
StreamDesc *s = YAP_GetStreamFromId(sno);
|
||||
PyObject *fget = PyObject_GetAttrString(s->u.private_data, "read");
|
||||
PyObject *pyr = PyObject_CallFunctionObjArgs(fget, PyLong_FromLong(1), NULL);
|
||||
return PyUnicode_READ_CHAR(pyr, 0);
|
||||
VFS_t pystream;
|
||||
static void *py_open(VFS_t *me, const char *name, const char *io_mode, int sno) {
|
||||
#if HAVE_STRCASESTR
|
||||
if (strcasestr(name, "/python/") == name)
|
||||
name += strlen("/python/");
|
||||
#else
|
||||
if (strstr(name, "/python/") == name)
|
||||
name += strlen("/python/");
|
||||
#endif
|
||||
term_t ctk = python_acquire_GIL();
|
||||
PyObject *pystream = string_to_python(name, true, NULL);
|
||||
if (pystream == NULL || pystream == Py_None) {
|
||||
python_release_GIL(ctk);
|
||||
return NULL;
|
||||
}
|
||||
StreamDesc *st = YAP_RepStreamFromId(sno);
|
||||
st->name = YAP_LookupAtom(name);
|
||||
if (strcmp(name,"sys.stdout") == 0) {
|
||||
st->user_name = TermOutStream;
|
||||
} else if(strcmp(name,"sys.stderr") == 0) {
|
||||
st->user_name = TermErrStream;
|
||||
} else {
|
||||
st->user_name = YAP_MkAtomTerm(st->name);
|
||||
}
|
||||
// we assume object is already open, so there is no need to open it.
|
||||
st->u.private_data = pystream;
|
||||
st->vfs = me;
|
||||
python_release_GIL(ctk);
|
||||
return st;
|
||||
}
|
||||
|
||||
static int py_peek(int sno) {
|
||||
StreamDesc *s = YAP_GetStreamFromId(sno);
|
||||
PyObject *fget = PyObject_GetAttrString(s->u.private_data, "peek");
|
||||
PyObject *pyr = PyObject_CallFunctionObjArgs(fget, PyLong_FromLong(1), NULL);
|
||||
return PyUnicode_READ_CHAR(pyr, 0);
|
||||
static bool py_close(int sno) {
|
||||
StreamDesc *st = YAP_RepStreamFromId(sno);
|
||||
if (strcmp(st->name,"sys.stdout") &&
|
||||
strcmp(st->name,"sys.stderr")) {
|
||||
Py_XDECREF(st->u.private_data);
|
||||
}
|
||||
st->u.private_data = NULL;
|
||||
st->vfs = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool getLine(int inp) {
|
||||
char *myrl_line = NULL;
|
||||
StreamDesc *rl_instream = YAP_RepStreamFromId(inp);
|
||||
term_t ctk = python_acquire_GIL();
|
||||
PyObject*prompt = PyUnicode_FromString( "?- "),
|
||||
*msg = PyUnicode_FromString("");
|
||||
/* window of vulnerability opened */
|
||||
myrl_line = PyUnicode_AsUTF8(PyObject_CallFunctionObjArgs(rl_instream->u.private_data,msg,prompt,NULL));
|
||||
python_release_GIL(ctk);
|
||||
rl_instream->u.irl.ptr = rl_instream->u.irl.buf = (const unsigned char*)myrl_line;
|
||||
myrl_line = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static int py_getc(int sno) {
|
||||
StreamDesc *s = YAP_RepStreamFromId(sno);
|
||||
int ch;
|
||||
bool fetch = (s->u.irl.buf == NULL);
|
||||
|
||||
if (!fetch || getLine(sno)) {
|
||||
const unsigned char *ttyptr = s->u.irl.ptr++, *myrl_line = s->u.irl.buf;
|
||||
ch = *ttyptr;
|
||||
if (ch == '\0') {
|
||||
ch = '\n';
|
||||
free((void *)myrl_line);
|
||||
s->u.irl.ptr = s->u.irl.buf = NULL;
|
||||
}
|
||||
} else {
|
||||
return EOF;
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Yap_ReadlinePeekChar peeks the next char from the
|
||||
readline buffer, but does not actually grab it.
|
||||
|
||||
The idea is to take advantage of the buffering. Special care must be taken
|
||||
with EOF, though.
|
||||
|
||||
*/
|
||||
static int py_peek(int sno) {
|
||||
StreamDesc *s = YAP_RepStreamFromId(sno);
|
||||
int ch;
|
||||
|
||||
if (s->u.irl.buf) {
|
||||
const unsigned char *ttyptr = s->u.irl.ptr;
|
||||
ch = *ttyptr;
|
||||
if (ch == '\0') {
|
||||
ch = '\n';
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
if (getLine(sno)) {
|
||||
ch = s->u.irl.ptr[0];
|
||||
if (ch == '\0') {
|
||||
ch = '\n';
|
||||
}
|
||||
} else {
|
||||
return EOF;
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
|
||||
static int64_t py_seek(int sno, int64_t where, int how) {
|
||||
StreamDesc *s = YAP_GetStreamFromId(sno);
|
||||
PyObject *fseek = PyObject_GetAttrString(s->u.private_data, "seek");
|
||||
StreamDesc *g0 = YAP_RepStreamFromId(sno);
|
||||
term_t s0 = python_acquire_GIL();
|
||||
PyObject *fseek = PyObject_GetAttrString(g0->u.private_data, "seek");
|
||||
PyObject *pyr = PyObject_CallFunctionObjArgs(fseek, PyLong_FromLong(where),
|
||||
PyLong_FromLong(how), NULL);
|
||||
return PyLong_AsLong(pyr);
|
||||
python_release_GIL(s0);
|
||||
return PyLong_AsLong(pyr);
|
||||
}
|
||||
|
||||
static void py_flush(int sno) {
|
||||
StreamDesc *s = YAP_GetStreamFromId(sno);
|
||||
term_t tg = python_acquire_GIL();
|
||||
PyObject *flush = PyObject_GetAttrString(s->u.private_data, "flush");
|
||||
PyObject_CallFunction(flush, NULL);
|
||||
python_release_GIL(tg);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -110,13 +198,15 @@ bool init_python_vfs(void) {
|
||||
pystream.suffix = NULL;
|
||||
pystream.open = py_open;
|
||||
pystream.close = py_close;
|
||||
pystream.get_char = py_get;
|
||||
pystream.get_char = py_getc;
|
||||
pystream.peek_char = py_peek;
|
||||
pystream.put_char = py_put;
|
||||
pystream.flush = py_flush;
|
||||
pystream.seek = py_seek;
|
||||
pystream.next = GLOBAL_VFS;
|
||||
GLOBAL_VFS = &pystream;
|
||||
TermOutStream = YAP_MkAtomTerm(YAP_LookupAtom("std.output"));
|
||||
TermErrStream = YAP_MkAtomTerm(YAP_LookupAtom("std.error"));
|
||||
// NULL;
|
||||
return true;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@ atom_t ATOM_true, ATOM_false, ATOM_colon, ATOM_dot, ATOM_none, ATOM_t,
|
||||
ATOM_comma, ATOM_builtin, ATOM_A, ATOM_V, ATOM_self, ATOM_nil,
|
||||
ATOM_brackets, ATOM_curly_brackets;
|
||||
|
||||
functor_t FUNCTOR_dollar1, FUNCTOR_abs1, FUNCTOR_all1, FUNCTOR_any1,
|
||||
functor_t FUNCTOR_dollar1, FUNCTOR_abs1, FUNCTOR_all1, FUNCTOR_any1, FUNCTOR_as2,
|
||||
FUNCTOR_bin1, FUNCTOR_brackets1, FUNCTOR_comma2, FUNCTOR_dir1,
|
||||
FUNCTOR_float1, FUNCTOR_int1, FUNCTOR_iter1, FUNCTOR_iter2, FUNCTOR_long1,
|
||||
FUNCTOR_len1, FUNCTOR_curly1, FUNCTOR_ord1, FUNCTOR_range1, FUNCTOR_range2,
|
||||
@ -68,6 +68,7 @@ static void install_py_constants(void) {
|
||||
FUNCTOR_abs1 = PL_new_functor(PL_new_atom("abs"), 1);
|
||||
FUNCTOR_all1 = PL_new_functor(PL_new_atom("all"), 1);
|
||||
FUNCTOR_any1 = PL_new_functor(PL_new_atom("any"), 1);
|
||||
FUNCTOR_as2 = PL_new_functor(PL_new_atom("as"), 2);
|
||||
FUNCTOR_bin1 = PL_new_functor(PL_new_atom("bin"), 1);
|
||||
FUNCTOR_ord1 = PL_new_functor(PL_new_atom("ord"), 1);
|
||||
FUNCTOR_int1 = PL_new_functor(PL_new_atom("int"), 1);
|
||||
|
@ -34,8 +34,8 @@
|
||||
op(100,fy,$),
|
||||
op(950,fy,:=),
|
||||
op(950,yfx,:=),
|
||||
op(950,fx,<-),
|
||||
op(950,yfx,<-),
|
||||
% op(950,fx,<-),
|
||||
% op(950,yfx,<-),
|
||||
op(50, yf, []),
|
||||
op(50, yf, '()'),
|
||||
op(100, xfy, '.'),
|
||||
@ -112,8 +112,9 @@ Data types are
|
||||
|
||||
:- multifile user:(:=)/2,
|
||||
user:(:=)/1,
|
||||
user:(<-)/1,
|
||||
user:(<-)/2, user:'()'/1, user:'{}'/1, user:dot_qualified_goal/2, user:import_arg/1.
|
||||
% user:(<-)/1,
|
||||
% user:(<-)/2,
|
||||
user:'()'/1, user:'{}'/1, user:dot_qualified_goal/2, user:import_arg/1.
|
||||
|
||||
|
||||
import( F ) :- catch( python:python_import(F), _, fail ).
|
||||
@ -134,16 +135,18 @@ user(P1,P2) :- !,
|
||||
:= P1,
|
||||
:= P2.
|
||||
|
||||
user:(:= ) :- catch( python:python_proc(F), _, fail ).
|
||||
user:(:= F) :- catch( python:python_proc(F), _, fail ).
|
||||
|
||||
user:( V := F ) :-
|
||||
python:python_assign(F, V).
|
||||
|
||||
/*
|
||||
user:(<- F) :-
|
||||
catch( python:python_proc(F), _, fail ).
|
||||
|
||||
user:(V <- F) :-
|
||||
V := F.
|
||||
*/
|
||||
|
||||
python:python_import(Module) :-
|
||||
python:python_import(Module, _).
|
||||
|
@ -11,13 +11,13 @@ set (PYTHON_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/yap4py/yapi.py ${CMAKE_CURRENT_S
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(../../swig/yap.i PROPERTIES CPLUSPLUS ON)
|
||||
SET_SOURCE_FILES_PROPERTIES(../../swig/yap.i PROPERTIES SWIG_FLAGS "-O;-py3")
|
||||
SET_SOURCE_FILES_PROPERTIES(../../swiyap.i PROPERTIES SWIG_MODULE_NAME yap4py.yap)
|
||||
SET_SOURCE_FILES_PROPERTIES(../../swig/yap.i PROPERTIES SWIG_MODULE_NAME yap4py.yap)
|
||||
#SET_SOURCE_FILES_PROPERTIES(../../swi/yap.i PROPERTIES OUTPUT_NAME yap)
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/yap4py)
|
||||
|
||||
set(YAP4PY_PL prolog/yapi.yap)
|
||||
set(YAP4PY_PY yap4py/__init__.py yap4py/__main__.py yap4py/yapi.py)
|
||||
set(YAP4PY_PY yap4py/__main__.py yap4py/yapi.py)
|
||||
|
||||
configure_file("setup.py.in" setup.py)
|
||||
configure_file("MANIFEST.in" ${CMAKE_CURRENT_BINARY_DIR}/MANIFEST.in)
|
||||
@ -51,7 +51,7 @@ else()
|
||||
endif()
|
||||
|
||||
add_custom_target( YAP4PY ALL
|
||||
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
|
||||
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}
|
||||
|
@ -1,5 +1,6 @@
|
||||
# include CONTRIBUTING.md
|
||||
include README.md
|
||||
include *.py
|
||||
|
||||
recursive-include yap4py/prolog *.*
|
||||
recursive-include html *.*
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
%% @file yapi.yap
|
||||
%% @brief support yap shell
|
||||
%%
|
||||
@ -10,9 +11,8 @@
|
||||
python_query/2,
|
||||
yapi_query/2
|
||||
]).
|
||||
:- stop_low_level_trace.
|
||||
|
||||
:- yap_flag(verbose, verbose).
|
||||
:- yap_flag(verbose, silent).
|
||||
|
||||
|
||||
:- use_module( library(lists) ).
|
||||
@ -22,6 +22,9 @@
|
||||
:- reexport( library(python) ).
|
||||
|
||||
:- python_import(yap4py.yapi).
|
||||
%:- python_import(gc).
|
||||
|
||||
:- meta_predicate( yapi_query(:,+) ).
|
||||
|
||||
%:- start_low_level_trace.
|
||||
|
||||
@ -38,6 +41,7 @@
|
||||
%:- initialization set_preds.
|
||||
|
||||
set_preds :-
|
||||
fail,
|
||||
current_predicate(P, Q),
|
||||
functor(Q,P,A),
|
||||
atom_string(P,S),
|
||||
@ -47,6 +51,7 @@ set_preds :-
|
||||
fail),
|
||||
fail.
|
||||
set_preds :-
|
||||
fail,
|
||||
system_predicate(P/A),
|
||||
atom_string(P,S),
|
||||
catch(
|
||||
@ -61,14 +66,15 @@ argi(N,I,I1) :-
|
||||
I1 is I+1.
|
||||
|
||||
python_query( Caller, String ) :-
|
||||
Self := Caller.it,
|
||||
atomic_to_term( String, Goal, VarNames ),
|
||||
query_to_answer( Goal, VarNames, Status, Bindings),
|
||||
Self.port := Status,
|
||||
Caller.port := Status,
|
||||
% := print( gc.get_referrers(Caller.port)),
|
||||
write_query_answer( Bindings ),
|
||||
nl(user_error),
|
||||
Self.bindings := {},
|
||||
maplist(in_dict(Self.bindings), Bindings).
|
||||
Caller.answer := {},
|
||||
maplist(in_dict(Caller.answer), Bindings).
|
||||
% := print( "b", gc.get_referrers(Caller.answer)).
|
||||
|
||||
in_dict(Dict, var([V0,V|Vs])) :- !,
|
||||
Dict[V] := V0,
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python
|
||||
# coding: utf-8
|
||||
|
||||
# Copyright (c) IPython Development Team.
|
||||
@ -51,24 +51,25 @@ from distutils.core import setup
|
||||
|
||||
here = abspath(dirname(__file__))
|
||||
libpydir = abspath(sysconfig.get_path('platlib'))
|
||||
libpyauxdir = abspath(os.path.dirname('stdlib'))
|
||||
#libpyauxdir = abspath(os.path.dirname('stdlib'))
|
||||
#pkg_root = join(here, name)
|
||||
|
||||
here = path.abspath(path.dirname(__file__))
|
||||
|
||||
sys.path.insert(0, "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
python_libdir = path.abspath(path.dirname("${PYTHON_LIBRARIES}"))
|
||||
|
||||
if platform.system() == 'Windows':
|
||||
local_libs = []
|
||||
win_libs = ['wsock32','ws2_32']
|
||||
my_extra_link_args = ['-Wl,-export-all-symbols']
|
||||
elif platform.system() == 'Darwin':
|
||||
my_extra_link_args = ['-L','..','-Wl,-rpath','-Wl,${CMAKE_INSTALL_FULL_LIBDIR}']
|
||||
my_extra_link_args = ['-L','..','-Wl,-rpath,'+abspath(join(sysconfig.get_path('platlib'),'yap4py')),'-Wl,-rpath,${CMAKE_INSTALL_FULL_LIBDIR}','-Wl,-rpath,../yap4py']
|
||||
win_libs = []
|
||||
local_libs = ['Py4YAP']
|
||||
elif platform.system() == 'Linux':
|
||||
my_extra_link_args = ['-L','..','-Wl,-rpath','-Wl,${CMAKE_INSTALL_FULL_LIBDIR}']
|
||||
my_extra_link_args = ['-L','..','-Wl,-rpath,'+abspath(join(sysconfig.get_path('platlib'),'yap4py')),'-Wl,-rpath,${CMAKE_INSTALL_FULL_LIBDIR}','-Wl,-rpath,../yap4py']
|
||||
win_libs = []
|
||||
local_libs = ['Py4YAP']
|
||||
|
||||
@ -78,22 +79,21 @@ elif platform.system() == 'Linux':
|
||||
native_sources = ["yap4py/yap_wrap.cxx","yap4py/yapi.cpp"]
|
||||
|
||||
#gmp_dir = path.abspath(path.dirname("${GMP_LIBRARIES}"))
|
||||
#python_libdir = path.abspath(path.dirname("${PYTHON_LIBRARIES}")
|
||||
# Get the long description from the README file
|
||||
|
||||
|
||||
|
||||
extensions = [Extension('yap4py._yap', native_sources,
|
||||
extensions = [Extension('_yap', native_sources,
|
||||
define_macros=[('MAJOR_VERSION', '1'),
|
||||
('MINOR_VERSION', '0'),
|
||||
('_YAP_NOT_INSTALLED_', '1'),
|
||||
('YAP_PYTHON', '1'),
|
||||
('_GNU_SOURCE', '1')],
|
||||
runtime_library_dirs=[abspath(sysconfig.get_path('platlib')),
|
||||
abspath(sysconfig.get_path('platlib'))],
|
||||
runtime_library_dirs=[
|
||||
abspath(join(sysconfig.get_path('platlib'),'yap4py')), abspath(sysconfig.get_path('platlib')),'${CMAKE_INSTALL_FULL_LIBDIR}'],
|
||||
swig_opts=['-modern', '-c++', '-py3',
|
||||
'-DX_API', '-Iyap4py/include' ],
|
||||
library_dirs=[".",'../../..'],
|
||||
library_dirs=[".",'../../..','${CMAKE_INSTALL_FULL_LIBDIR}'],
|
||||
extra_link_args=my_extra_link_args,
|
||||
libraries=['Yap','gmp']+win_libs+local_libs,
|
||||
include_dirs=['${CMAKE_SOURCE_DIR}/H',
|
||||
@ -122,7 +122,7 @@ setup_args = dict(
|
||||
scripts=glob(join('scripts', '*')),
|
||||
packages=['yap4py'],
|
||||
ext_modules=extensions,
|
||||
py_modules=[],
|
||||
sources=['yap4py/yapi.py','yap4py/yap.py','yap4py/__main__.py','yap4py/__init_.py'],
|
||||
# package_data=package_data,
|
||||
include_package_data=True,
|
||||
data_files = data_files,
|
||||
|
@ -16,15 +16,18 @@ if platform.system() == 'Windows':
|
||||
ctypes.WinDLL(dll)
|
||||
elif platform.system() == 'Darwin':
|
||||
def load( dll ):
|
||||
dll = glob.glob(os.path.join(os.path.realpath(__file__),dll))[0]
|
||||
dll = glob.glob(os.path.join(os.path.dirname(__file__),dll))[0]
|
||||
dll = os.path.abspath(dll)
|
||||
ctypes.CDLL(dll)
|
||||
# load('libYap.dylib')
|
||||
# load('libPy4YAP.dylib')
|
||||
#load( '_yap*.dylib' )
|
||||
print('loaded ',dll)
|
||||
|
||||
# try:
|
||||
# load( '_yap*.so' )
|
||||
# except:
|
||||
# load( '_yap*.dylib' )
|
||||
else:
|
||||
def load( dll ):
|
||||
dll = glob.glob(os.path.join(os.path.realpath(__file__),dll))[0]
|
||||
dll = glob.glob(os.path.join(os.path.dirname(__file__),dll))[0]
|
||||
dll = os.path.abspath(dll)
|
||||
ctypes.CDLL(dll)
|
||||
# \`load('_yap*.so')
|
||||
#load('_yap*.so')
|
||||
|
@ -1,12 +1,21 @@
|
||||
|
||||
import os.path
|
||||
import sys
|
||||
import keyword
|
||||
# debugging support.
|
||||
# import pdb
|
||||
from collections import namedtuple
|
||||
import readline
|
||||
from .yap import *
|
||||
from yap4py.yap import *
|
||||
from os.path import join, dirname
|
||||
from collections import namedtuple
|
||||
import sys
|
||||
|
||||
yap_lib_path = dirname(__file__)
|
||||
|
||||
compile = namedtuple('compile', 'file')
|
||||
bindvars = namedtuple('bindvars', 'list')
|
||||
library = namedtuple('library', 'list')
|
||||
v0 = namedtuple('v', 'slot')
|
||||
yap_query = namedtuple('yap_query', 'query owner')
|
||||
jupyter_query = namedtuple('jupyter_query', 'vars dict')
|
||||
python_query = namedtuple('python_query', 'vars dict')
|
||||
yapi_query = namedtuple('yapi_query', 'vars dict')
|
||||
show_answer = namedtuple('show_answer', 'vars dict')
|
||||
set_prolog_flag = namedtuple('set_prolog_flag', 'flag new_value')
|
||||
|
||||
|
||||
class Engine( YAPEngine ):
|
||||
@ -16,10 +25,10 @@ class Engine( YAPEngine ):
|
||||
if not args:
|
||||
args = EngineArgs(**kwargs)
|
||||
if self_contained:
|
||||
yap_lib_path = os.path.dirname(__file__)
|
||||
args.setYapShareDir(os.path.join(yap_lib_path, "prolog"))
|
||||
yap_lib_path = dirname(__file__)
|
||||
args.setYapShareDir(join(yap_lib_path, "prolog"))
|
||||
args.setYapPLDIR(yap_lib_path)
|
||||
args.setSavedState(os.path.join(yap_lib_path, "startup.yss"))
|
||||
args.setSavedState(join(yap_lib_path, "startup.yss"))
|
||||
YAPEngine.__init__(self, args)
|
||||
self.goal(set_prolog_flag('verbose', 'silent'))
|
||||
self.goal(compile(library('yapi')))
|
||||
@ -31,9 +40,6 @@ class Engine( YAPEngine ):
|
||||
else:
|
||||
self.goal(g)
|
||||
|
||||
def f(self, g):
|
||||
self.E.fun(g)
|
||||
|
||||
|
||||
class EngineArgs( YAPEngineArgs ):
|
||||
""" Interface to Engine Options class"""
|
||||
@ -47,115 +53,79 @@ class Predicate( YAPPredicate ):
|
||||
def __init__(self, t, module=None):
|
||||
super().__init__(t)
|
||||
|
||||
class Goal(object):
|
||||
class Query:
|
||||
"""Goal is a predicate instantiated under a specific environment """
|
||||
def __init__(self, engine, g):
|
||||
self.q = engine.query(g)
|
||||
self.e = engine
|
||||
self.port = "call"
|
||||
self.bindings = None
|
||||
if self.q:
|
||||
self.port = "call"
|
||||
self.bindings = None
|
||||
self.engine = engine
|
||||
self.answer = {}
|
||||
|
||||
def __iter__(self):
|
||||
return PrologTableIter( self.e, self )
|
||||
|
||||
class PrologTableIter:
|
||||
|
||||
def __init__(self, e, g):
|
||||
try:
|
||||
self.e = e
|
||||
self.g = g
|
||||
self.q = g.q
|
||||
except:
|
||||
print('Error')
|
||||
|
||||
def __iter__(self):
|
||||
# Iterators are iterables too.
|
||||
# - # Adding this functions to make them so.
|
||||
return self
|
||||
|
||||
def __next__(self):
|
||||
print(self)
|
||||
if not self.q:
|
||||
raise StopIteration()
|
||||
if self.q.next():
|
||||
rc = self.g.bindings
|
||||
if self.g.port == "exit":
|
||||
rc = self.answer
|
||||
if self.port == "exit":
|
||||
self.close()
|
||||
return rc
|
||||
else:
|
||||
if self.q:
|
||||
if self:
|
||||
self.close()
|
||||
raise StopIteration()
|
||||
|
||||
def close(self):
|
||||
def close( self ):
|
||||
self.q.close()
|
||||
self.q = None
|
||||
|
||||
f2p = {"fails":{}}
|
||||
for i in range(16):
|
||||
f2p[i] ={}
|
||||
|
||||
|
||||
|
||||
|
||||
global engine, handler
|
||||
|
||||
yap_lib_path = os.path.dirname(__file__)
|
||||
|
||||
compile = namedtuple('compile', 'file')
|
||||
bindvars = namedtuple('bindvars', 'list')
|
||||
library = namedtuple('library', 'list')
|
||||
v = namedtuple( 'v', 'slot')
|
||||
yap_query = namedtuple( 'yap_query', 'query owner')
|
||||
jupyter_query = namedtuple( 'jupyter_query', 'vars dict')
|
||||
python_query = namedtuple( 'python_query', 'vars dict')
|
||||
yapi_query = namedtuple( 'yapi_query', 'vars dict')
|
||||
show_answer = namedtuple( 'show_answer', 'vars dict')
|
||||
set_prolog_flag = namedtuple('set_prolog_flag', 'flag new_value')
|
||||
|
||||
|
||||
def named( name, arity):
|
||||
def name( name, arity):
|
||||
try:
|
||||
if arity > 0 and name.isidentifier() and not keyword.iskeyword(name):
|
||||
if arity > 0 and name.isidentifier(): # and not keyword.iskeyword(name):
|
||||
s = []
|
||||
for i in range(arity):
|
||||
s += ["A" + str(i)]
|
||||
f2p[arity][name] = namedtuple(name, s)
|
||||
return namedtuple(name, s)
|
||||
except:
|
||||
f2p[fails][name] = True
|
||||
return None
|
||||
|
||||
class PrologPredicate( YAPPrologPredicate ):
|
||||
""" Interface to Prolog Predicate"""
|
||||
|
||||
class v(YAPVarTerm):
|
||||
class v(YAPVarTerm,v0):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
YAPVarTerm.__init__()
|
||||
|
||||
def binding(self):
|
||||
return self.term()
|
||||
|
||||
def numbervars( q ):
|
||||
Dict = {}
|
||||
if True:
|
||||
engine.goal(show_answer( q.namedVars(), Dict))
|
||||
return Dict
|
||||
rc = q.namedVarsVector()
|
||||
q.r = q.goal().numbervars()
|
||||
o = []
|
||||
for i in rc:
|
||||
if len(i) == 2:
|
||||
do = str(i[0]) + " = " + str( i[1] ) + "\n"
|
||||
o += do
|
||||
else:
|
||||
do = str(i[0]) + " = " + str( i[1] ) + "\n"
|
||||
o += do
|
||||
return o
|
||||
|
||||
class YAPShell:
|
||||
|
||||
def numbervars( self ):
|
||||
Dict = {}
|
||||
self.engine.goal(show_answer( self, Dict))
|
||||
return Dict
|
||||
# rc = self.q.namedVarsVector()
|
||||
# self.q.r = self.q.goal().numbervars()
|
||||
# o = []
|
||||
# for i in rc:
|
||||
# if len(i) == 2:
|
||||
# do = str(i[0]) + " = " + str( i[1] ) + "\n"
|
||||
# o += do
|
||||
# else:
|
||||
# do = str(i[0]) + " = " + str( i[1] ) + "\n"
|
||||
# o += do
|
||||
# return o
|
||||
|
||||
|
||||
|
||||
def query_prolog(self, engine, query):
|
||||
def query_prolog(self, query):
|
||||
#import pdb; pdb.set_trace()
|
||||
#
|
||||
# construct a query from a one-line string
|
||||
@ -174,15 +144,15 @@ class YAPShell:
|
||||
# if not isinstance(eq[0],str):
|
||||
# print( "Error: Variable Name matches a Python Symbol")
|
||||
# return
|
||||
do_ask = True
|
||||
self.e = engine
|
||||
self.do_ask = True
|
||||
engine = self.engine
|
||||
bindings = []
|
||||
g = python_query(self, query)
|
||||
if not self.q:
|
||||
self.it = Goal( engine, g )
|
||||
for bind in self.it:
|
||||
self.q = Query( engine, g )
|
||||
for bind in self.q:
|
||||
bindings += [bind]
|
||||
if do_ask:
|
||||
if self.do_ask:
|
||||
print(bindings)
|
||||
bindings = []
|
||||
s = input("more(;), all(*), no(\\n), python(#) ?").lstrip()
|
||||
@ -196,7 +166,7 @@ class YAPShell:
|
||||
except:
|
||||
raise
|
||||
elif s.startswith('*') or s.startswith('a'):
|
||||
do_ask = False
|
||||
self.do_ask = False
|
||||
continue
|
||||
else:
|
||||
break
|
||||
@ -217,7 +187,7 @@ class YAPShell:
|
||||
if not s:
|
||||
loop = False
|
||||
else:
|
||||
self.query_prolog(engine, s)
|
||||
self.query_prolog(s)
|
||||
except SyntaxError as err:
|
||||
print("Syntax Error error: {0}".format(err))
|
||||
except EOFError:
|
||||
@ -236,13 +206,13 @@ class YAPShell:
|
||||
# engine = yap.YAPEngine(yap.YAPParams());
|
||||
#
|
||||
def __init__(self, engine, **kwargs):
|
||||
self.live(engine)
|
||||
self.engine = engine
|
||||
self.live(engine)
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
engine = Engine()
|
||||
handler = numbervars
|
||||
YAPShell(engine)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -2,360 +2,388 @@
|
||||
set (PYTHON_SOURCES
|
||||
yap_kernel_launcher.py
|
||||
docs/conf.py
|
||||
yap_kernel/serialize.py
|
||||
yap_kernel/_eventloop_macos.py
|
||||
yap_kernel/jsonutil.py
|
||||
yap_kernel/pickleutil.py
|
||||
yap_kernel/pylab/backend_inline.py
|
||||
yap_kernel/pylab/config.py
|
||||
yap_kernel/pylab/__init__.py
|
||||
yap_kernel/displayhook.py
|
||||
yap_kernel/__main__.py
|
||||
yap_kernel/gui/gtk3embed.py
|
||||
yap_kernel/gui/gtkembed.py
|
||||
yap_kernel/gui/__init__.py
|
||||
yap_kernel/parentpoller.py
|
||||
yap_kernel/_version.py
|
||||
yap_kernel/eventloops.py
|
||||
yap_kernel/connect.py
|
||||
yap_kernel/comm/comm.py
|
||||
yap_kernel/comm/__init__.py
|
||||
yap_kernel/comm/manager.py
|
||||
yap_kernel/kernelspec.py
|
||||
yap_kernel/iostream.py
|
||||
yap_kernel/zmqshell.py
|
||||
yap_kernel/kernelbase.py
|
||||
yap_kernel/heartbeat.py
|
||||
yap_kernel/log.py
|
||||
yap_kernel/datapub.py
|
||||
yap_kernel/codeutil.py
|
||||
yap_kernel/kernelapp.py
|
||||
yap_kernel/embed.py
|
||||
yap_kernel/tests/test_embed_kernel.py
|
||||
yap_kernel/tests/test_kernelspec.py
|
||||
yap_kernel/tests/_asyncio.py
|
||||
yap_kernel/tests/test_serialize.py
|
||||
yap_kernel/tests/test_pickleutil.py
|
||||
yap_kernel/tests/test_eventloop.py
|
||||
yap_kernel/tests/utils.py
|
||||
yap_kernel/tests/test_kernel.py
|
||||
yap_kernel/tests/test_io.py
|
||||
yap_kernel/tests/test_jsonutil.py
|
||||
yap_kernel/tests/test_connect.py
|
||||
yap_kernel/tests/test_message_spec.py
|
||||
yap_kernel/tests/__init__.py
|
||||
yap_kernel/tests/test_start_kernel.py
|
||||
yap_kernel/tests/test_zmq_shell.py
|
||||
yap_kernel/__init__.py
|
||||
yap_kernel/inprocess/blocking.py
|
||||
yap_kernel/inprocess/socket.py
|
||||
yap_kernel/inprocess/constants.py
|
||||
yap_kernel/inprocess/channels.py
|
||||
yap_kernel/inprocess/tests/test_kernelmanager.py
|
||||
yap_kernel/inprocess/tests/test_kernel.py
|
||||
yap_kernel/inprocess/tests/__init__.py
|
||||
yap_kernel/inprocess/__init__.py
|
||||
yap_kernel/inprocess/manager.py
|
||||
yap_kernel/inprocess/client.py
|
||||
yap_kernel/inprocess/ipkernel.py
|
||||
yap_kernel/ipkernel.py
|
||||
yap_ipython/display.py
|
||||
yap_ipython/frontend.py
|
||||
yap_ipython/parallel.py
|
||||
yap_ipython/html.py
|
||||
yap_ipython/__main__.py
|
||||
yap_ipython/testing/iptest.py
|
||||
yap_ipython/testing/skipdoctest.py
|
||||
yap_ipython/testing/tools.py
|
||||
yap_ipython/testing/iptestcontroller.py
|
||||
yap_ipython/testing/__main__.py
|
||||
yap_ipython/testing/decorators.py
|
||||
yap_ipython/testing/ipunittest.py
|
||||
yap_ipython/testing/tests/test_tools.py
|
||||
yap_ipython/testing/tests/test_ipunittest.py
|
||||
yap_ipython/testing/tests/test_decorators.py
|
||||
yap_ipython/testing/tests/__init__.py
|
||||
yap_ipython/testing/__init__.py
|
||||
yap_ipython/testing/globalipapp.py
|
||||
yap_ipython/testing/plugin/iptest.py
|
||||
yap_ipython/testing/plugin/show_refs.py
|
||||
yap_ipython/testing/plugin/simplevars.py
|
||||
yap_ipython/testing/plugin/simple.py
|
||||
yap_ipython/testing/plugin/ipdoctest.py
|
||||
yap_ipython/testing/plugin/test_ipdoctest.py
|
||||
yap_ipython/testing/plugin/setup.py
|
||||
yap_ipython/testing/plugin/__init__.py
|
||||
yap_ipython/testing/plugin/dtexample.py
|
||||
yap_ipython/testing/plugin/test_refs.py
|
||||
yap_ipython/terminal/ptutils.py
|
||||
yap_ipython/terminal/shortcuts.py
|
||||
yap_ipython/terminal/ipapp.py
|
||||
yap_ipython/terminal/pt_inputhooks/wx.py
|
||||
yap_ipython/terminal/pt_inputhooks/pyglet.py
|
||||
yap_ipython/terminal/pt_inputhooks/osx.py
|
||||
yap_ipython/terminal/pt_inputhooks/gtk.py
|
||||
yap_ipython/terminal/pt_inputhooks/tk.py
|
||||
yap_ipython/terminal/pt_inputhooks/glut.py
|
||||
yap_ipython/terminal/pt_inputhooks/gtk3.py
|
||||
yap_ipython/terminal/pt_inputhooks/__init__.py
|
||||
yap_ipython/terminal/pt_inputhooks/qt.py
|
||||
yap_ipython/terminal/console.py
|
||||
yap_ipython/terminal/prompts.py
|
||||
yap_ipython/terminal/ptshell.py
|
||||
yap_ipython/terminal/embed.py
|
||||
yap_ipython/terminal/tests/test_help.py
|
||||
yap_ipython/terminal/tests/test_embed.py
|
||||
yap_ipython/terminal/tests/test_interactivshell.py
|
||||
yap_ipython/terminal/tests/__init__.py
|
||||
yap_ipython/terminal/__init__.py
|
||||
yap_ipython/terminal/interactiveshell.py
|
||||
yap_ipython/terminal/debugger.py
|
||||
yap_ipython/terminal/magics.py
|
||||
yap_ipython/consoleapp.py
|
||||
yap_ipython/core/display.py
|
||||
yap_ipython/core/application.py
|
||||
yap_ipython/core/builtin_trap.py
|
||||
yap_ipython/core/formatters.py
|
||||
yap_ipython/core/prefilter.py
|
||||
yap_ipython/core/getipython.py
|
||||
yap_ipython/core/usage.py
|
||||
yap_ipython/core/oinspect.py
|
||||
yap_ipython/core/displayhook.py
|
||||
yap_ipython/core/hooks.py
|
||||
yap_ipython/core/splitinput.py
|
||||
yap_ipython/core/page.py
|
||||
yap_ipython/core/history.py
|
||||
yap_ipython/core/displaypub.py
|
||||
yap_ipython/core/profiledir.py
|
||||
yap_ipython/core/shellapp.py
|
||||
yap_ipython/core/extensions.py
|
||||
yap_ipython/core/compilerop.py
|
||||
yap_ipython/core/events.py
|
||||
yap_ipython/core/pylabtools.py
|
||||
yap_ipython/core/completer.py
|
||||
yap_ipython/core/prompts.py
|
||||
yap_ipython/core/latex_symbols.py
|
||||
yap_ipython/core/macro.py
|
||||
yap_ipython/core/inputsplitter.py
|
||||
yap_ipython/core/error.py
|
||||
yap_ipython/core/profileapp.py
|
||||
yap_ipython/core/magic_arguments.py
|
||||
yap_ipython/core/logger.py
|
||||
yap_ipython/core/inputtransformer.py
|
||||
yap_ipython/core/payloadpage.py
|
||||
yap_ipython/core/crashhandler.py
|
||||
yap_ipython/core/magics/display.py
|
||||
yap_ipython/core/magics/execution.py
|
||||
yap_ipython/core/magics/namespace.py
|
||||
yap_ipython/core/magics/basic.py
|
||||
yap_ipython/core/magics/extension.py
|
||||
yap_ipython/core/magics/history.py
|
||||
yap_ipython/core/magics/pylab.py
|
||||
yap_ipython/core/magics/config.py
|
||||
yap_ipython/core/magics/osm.py
|
||||
yap_ipython/core/magics/script.py
|
||||
yap_ipython/core/magics/__init__.py
|
||||
yap_ipython/core/magics/auto.py
|
||||
yap_ipython/core/magics/logging.py
|
||||
yap_ipython/core/magics/code.py
|
||||
yap_ipython/core/ultratb.py
|
||||
yap_ipython/core/tests/test_application.py
|
||||
yap_ipython/core/tests/simpleerr.py
|
||||
yap_ipython/core/tests/test_paths.py
|
||||
yap_ipython/core/tests/bad_all.py
|
||||
yap_ipython/core/tests/test_prefilter.py
|
||||
yap_ipython/core/tests/test_logger.py
|
||||
yap_ipython/core/tests/test_interactiveshell.py
|
||||
yap_ipython/core/tests/test_events.py
|
||||
yap_ipython/core/tests/test_display.py
|
||||
yap_ipython/core/tests/test_autocall.py
|
||||
yap_ipython/core/tests/test_formatters.py
|
||||
yap_ipython/core/tests/test_alias.py
|
||||
yap_ipython/core/tests/nonascii.py
|
||||
yap_ipython/core/tests/test_displayhook.py
|
||||
yap_ipython/core/tests/test_profile.py
|
||||
yap_ipython/core/tests/test_imports.py
|
||||
yap_ipython/core/tests/test_oinspect.py
|
||||
yap_ipython/core/tests/test_inputtransformer.py
|
||||
yap_ipython/core/tests/test_magic_arguments.py
|
||||
yap_ipython/core/tests/test_debugger.py
|
||||
yap_ipython/core/tests/test_hooks.py
|
||||
yap_ipython/core/tests/test_run.py
|
||||
yap_ipython/core/tests/test_pylabtools.py
|
||||
yap_ipython/core/tests/print_argv.py
|
||||
yap_ipython/core/tests/test_page.py
|
||||
yap_ipython/core/tests/test_compilerop.py
|
||||
yap_ipython/core/tests/test_prompts.py
|
||||
yap_ipython/core/tests/test_magic_terminal.py
|
||||
yap_ipython/core/tests/__init__.py
|
||||
yap_ipython/core/tests/test_ultratb.py
|
||||
yap_ipython/core/tests/test_magic.py
|
||||
yap_ipython/core/tests/test_iplib.py
|
||||
yap_ipython/core/tests/test_completer.py
|
||||
yap_ipython/core/tests/test_shellapp.py
|
||||
yap_ipython/core/tests/daft_extension/daft_extension.py
|
||||
yap_ipython/core/tests/refbug.py
|
||||
yap_ipython/core/tests/tclass.py
|
||||
yap_ipython/core/tests/test_extension.py
|
||||
yap_ipython/core/tests/test_splitinput.py
|
||||
yap_ipython/core/tests/test_completerlib.py
|
||||
yap_ipython/core/tests/nonascii2.py
|
||||
yap_ipython/core/tests/test_inputsplitter.py
|
||||
yap_ipython/core/tests/test_handlers.py
|
||||
yap_ipython/core/tests/test_history.py
|
||||
yap_ipython/core/__init__.py
|
||||
yap_ipython/core/autocall.py
|
||||
yap_ipython/core/alias.py
|
||||
yap_ipython/core/completerlib.py
|
||||
yap_ipython/core/magic.py
|
||||
yap_ipython/core/interactiveshell.py
|
||||
yap_ipython/core/excolors.py
|
||||
yap_ipython/core/release.py
|
||||
yap_ipython/core/display_trap.py
|
||||
yap_ipython/core/debugger.py
|
||||
yap_ipython/core/historyapp.py
|
||||
yap_ipython/core/payload.py
|
||||
yap_ipython/config.py
|
||||
yap_ipython/utils/frame.py
|
||||
yap_ipython/utils/ipstruct.py
|
||||
yap_ipython/utils/module_paths.py
|
||||
yap_ipython/utils/jsonutil.py
|
||||
yap_ipython/utils/PyColorize.py
|
||||
yap_ipython/utils/pickleutil.py
|
||||
yap_ipython/utils/eventful.py
|
||||
yap_ipython/utils/ulinecache.py
|
||||
yap_ipython/utils/generics.py
|
||||
yap_ipython/utils/version.py
|
||||
yap_ipython/utils/tz.py
|
||||
yap_ipython/utils/_process_cli.py
|
||||
yap_ipython/utils/wildcard.py
|
||||
yap_ipython/utils/dir2.py
|
||||
yap_ipython/utils/strdispatch.py
|
||||
yap_ipython/utils/sysinfo.py
|
||||
yap_ipython/utils/io.py
|
||||
yap_ipython/utils/decorators.py
|
||||
yap_ipython/utils/contexts.py
|
||||
yap_ipython/utils/data.py
|
||||
yap_ipython/utils/terminal.py
|
||||
yap_ipython/utils/syspathcontext.py
|
||||
yap_ipython/utils/tokenize2.py
|
||||
yap_ipython/utils/localinterfaces.py
|
||||
yap_ipython/utils/_process_win32_controller.py
|
||||
yap_ipython/utils/py3compat.py
|
||||
yap_ipython/utils/sentinel.py
|
||||
yap_ipython/utils/colorable.py
|
||||
yap_ipython/utils/_sysinfo.py
|
||||
yap_ipython/utils/importstring.py
|
||||
yap_ipython/utils/tokenutil.py
|
||||
yap_ipython/utils/traitlets.py
|
||||
yap_ipython/utils/path.py
|
||||
yap_ipython/utils/daemonize.py
|
||||
yap_ipython/utils/log.py
|
||||
yap_ipython/utils/openpy.py
|
||||
yap_ipython/utils/tempdir.py
|
||||
yap_ipython/utils/_process_common.py
|
||||
yap_ipython/utils/tests/test_openpy.py
|
||||
yap_ipython/utils/tests/test_path.py
|
||||
yap_ipython/utils/tests/test_shimmodule.py
|
||||
yap_ipython/utils/tests/test_sysinfo.py
|
||||
yap_ipython/utils/tests/test_pycolorize.py
|
||||
yap_ipython/utils/tests/test_wildcard.py
|
||||
yap_ipython/utils/tests/test_imports.py
|
||||
yap_ipython/utils/tests/test_importstring.py
|
||||
yap_ipython/utils/tests/test_module_paths.py
|
||||
yap_ipython/utils/tests/test_io.py
|
||||
yap_ipython/utils/tests/test_text.py
|
||||
yap_ipython/utils/tests/test_decorators.py
|
||||
yap_ipython/utils/tests/test_tokenutil.py
|
||||
yap_ipython/utils/tests/test_process.py
|
||||
yap_ipython/utils/tests/test_dir2.py
|
||||
yap_ipython/utils/tests/__init__.py
|
||||
yap_ipython/utils/tests/test_capture.py
|
||||
yap_ipython/utils/tests/test_tempdir.py
|
||||
yap_ipython/utils/encoding.py
|
||||
yap_ipython/utils/__init__.py
|
||||
yap_ipython/utils/signatures.py
|
||||
yap_ipython/utils/_process_win32.py
|
||||
yap_ipython/utils/coloransi.py
|
||||
yap_ipython/utils/_process_posix.py
|
||||
yap_ipython/utils/shimmodule.py
|
||||
yap_ipython/utils/timing.py
|
||||
yap_ipython/utils/text.py
|
||||
yap_ipython/utils/process.py
|
||||
yap_ipython/utils/capture.py
|
||||
yap_ipython/paths.py
|
||||
yap_ipython/nbconvert.py
|
||||
yap_ipython/external/mathjax.py
|
||||
yap_ipython/external/qt_for_kernel.py
|
||||
yap_ipython/external/decorators/_numpy_testing_noseclasses.py
|
||||
yap_ipython/external/decorators/_decorators.py
|
||||
yap_ipython/external/decorators/__init__.py
|
||||
yap_ipython/external/__init__.py
|
||||
yap_ipython/external/qt_loaders.py
|
||||
yap_ipython/__init__.py
|
||||
yap_ipython/sphinxext/ipython_console_highlighting.py
|
||||
yap_ipython/sphinxext/ipython_directive.py
|
||||
yap_ipython/sphinxext/custom_doctests.py
|
||||
yap_ipython/sphinxext/__init__.py
|
||||
yap_ipython/kernel/adapter.py
|
||||
yap_ipython/kernel/channelsabc.py
|
||||
yap_ipython/kernel/__main__.py
|
||||
yap_ipython/kernel/launcher.py
|
||||
yap_ipython/kernel/multikernelmanager.py
|
||||
yap_ipython/kernel/restarter.py
|
||||
yap_ipython/kernel/managerabc.py
|
||||
yap_ipython/kernel/threaded.py
|
||||
yap_ipython/kernel/clientabc.py
|
||||
yap_ipython/kernel/connect.py
|
||||
yap_ipython/kernel/kernelspecapp.py
|
||||
yap_ipython/kernel/kernelspec.py
|
||||
yap_ipython/kernel/channels.py
|
||||
yap_ipython/kernel/__init__.py
|
||||
yap_ipython/kernel/manager.py
|
||||
yap_ipython/kernel/client.py
|
||||
yap_ipython/nbformat.py
|
||||
yap_ipython/extensions/cythonmagic.py
|
||||
yap_ipython/extensions/storemagic.py
|
||||
yap_ipython/extensions/tests/test_autoreload.py
|
||||
yap_ipython/extensions/tests/test_storemagic.py
|
||||
yap_ipython/extensions/tests/__init__.py
|
||||
yap_ipython/extensions/__init__.py
|
||||
yap_ipython/extensions/rmagic.py
|
||||
yap_ipython/extensions/sympyprinting.py
|
||||
yap_ipython/extensions/autoreload.py
|
||||
yap_ipython/yapi.py
|
||||
yap_ipython/qt.py
|
||||
yap_ipython/lib/display.py
|
||||
yap_ipython/lib/pretty.py
|
||||
yap_ipython/lib/inputhookgtk.py
|
||||
yap_ipython/lib/inputhookwx.py
|
||||
yap_ipython/lib/lexers.py
|
||||
yap_ipython/lib/demo.py
|
||||
yap_ipython/lib/inputhookgtk3.py
|
||||
yap_ipython/lib/kernel.py
|
||||
yap_ipython/lib/inputhookpyglet.py
|
||||
yap_ipython/lib/editorhooks.py
|
||||
yap_ipython/lib/inputhook.py
|
||||
yap_ipython/lib/backgroundjobs.py
|
||||
yap_ipython/lib/latextools.py
|
||||
yap_ipython/lib/deepreload.py
|
||||
yap_ipython/lib/tests/test_editorhooks.py
|
||||
yap_ipython/lib/tests/test_backgroundjobs.py
|
||||
yap_ipython/lib/tests/test_display.py
|
||||
yap_ipython/lib/tests/test_pretty.py
|
||||
yap_ipython/lib/tests/test_imports.py
|
||||
yap_ipython/lib/tests/test_clipboard.py
|
||||
yap_ipython/lib/tests/test_lexers.py
|
||||
yap_ipython/lib/tests/test_deepreload.py
|
||||
yap_ipython/lib/tests/test_security.py
|
||||
yap_ipython/lib/tests/__init__.py
|
||||
yap_ipython/lib/tests/test_latextools.py
|
||||
yap_ipython/lib/__init__.py
|
||||
yap_ipython/lib/guisupport.py
|
||||
yap_ipython/lib/security.py
|
||||
yap_ipython/lib/inputhookglut.py
|
||||
yap_ipython/lib/clipboard.py
|
||||
yap_ipython/lib/inputhookqt4.py
|
||||
yap_kernel/codeutil.py
|
||||
yap_kernel/comm
|
||||
yap_kernel/connect.py
|
||||
yap_kernel/datapub.py
|
||||
yap_kernel/displayhook.py
|
||||
yap_kernel/embed.py
|
||||
yap_kernel/_eventloop_macos.py
|
||||
yap_kernel/eventloops.py
|
||||
yap_kernel/gui
|
||||
yap_kernel/heartbeat.py
|
||||
yap_kernel/__init__.py
|
||||
yap_kernel/inprocess
|
||||
yap_kernel/iostream.py
|
||||
yap_kernel/ipkernel.py
|
||||
yap_kernel/jsonutil.py
|
||||
yap_kernel/kernelapp.py
|
||||
yap_kernel/kernelbase.py
|
||||
yap_kernel/kernelspec.py
|
||||
yap_kernel/log.py
|
||||
yap_kernel/__main__.py
|
||||
yap_kernel/parentpoller.py
|
||||
yap_kernel/pickleutil.py
|
||||
yap_kernel/pylab
|
||||
yap_kernel/serialize.py
|
||||
yap_kernel/tests
|
||||
yap_kernel/_version.py
|
||||
yap_kernel/zmqshell.py
|
||||
yap_ipython/config.py
|
||||
yap_ipython/consoleapp.py
|
||||
yap_ipython/core
|
||||
yap_ipython/display.py
|
||||
yap_ipython/extensions
|
||||
yap_ipython/external
|
||||
yap_ipython/frontend.py
|
||||
yap_ipython/html.py
|
||||
yap_ipython/__init__.py
|
||||
yap_ipython/kernel
|
||||
yap_ipython/lib
|
||||
yap_ipython/__main__.py
|
||||
yap_ipython/nbconvert.py
|
||||
yap_ipython/nbformat.py
|
||||
yap_ipython/parallel.py
|
||||
yap_ipython/paths.py
|
||||
yap_ipython/prolog
|
||||
yap_ipython/qt.py
|
||||
yap_ipython/sphinxext
|
||||
yap_ipython/terminal
|
||||
yap_ipython/testing
|
||||
yap_ipython/utils
|
||||
yap_ipython/yapi.py
|
||||
yap_kernel/comm/comm.py
|
||||
yap_kernel/comm/__init__.py
|
||||
yap_kernel/comm/manager.py
|
||||
yap_kernel/gui/gtk3embed.py
|
||||
yap_kernel/gui/gtkembed.py
|
||||
yap_kernel/gui/__init__.py
|
||||
yap_kernel/inprocess/blocking.py
|
||||
yap_kernel/inprocess/channels.py
|
||||
yap_kernel/inprocess/client.py
|
||||
yap_kernel/inprocess/constants.py
|
||||
yap_kernel/inprocess/__init__.py
|
||||
yap_kernel/inprocess/ipkernel.py
|
||||
yap_kernel/inprocess/manager.py
|
||||
yap_kernel/inprocess/socket.py
|
||||
yap_kernel/inprocess/tests
|
||||
yap_kernel/pylab/backend_inline.py
|
||||
yap_kernel/pylab/config.py
|
||||
yap_kernel/pylab/__init__.py
|
||||
yap_kernel/tests/_asyncio.py
|
||||
yap_kernel/tests/__init__.py
|
||||
yap_kernel/tests/test_connect.py
|
||||
yap_kernel/tests/test_embed_kernel.py
|
||||
yap_kernel/tests/test_eventloop.py
|
||||
yap_kernel/tests/test_io.py
|
||||
yap_kernel/tests/test_jsonutil.py
|
||||
yap_kernel/tests/test_kernel.py
|
||||
yap_kernel/tests/test_kernelspec.py
|
||||
yap_kernel/tests/test_message_spec.py
|
||||
yap_kernel/tests/test_pickleutil.py
|
||||
yap_kernel/tests/test_serialize.py
|
||||
yap_kernel/tests/test_start_kernel.py
|
||||
yap_kernel/tests/test_zmq_shell.py
|
||||
yap_kernel/tests/utils.py
|
||||
yap_ipython/core/alias.py
|
||||
yap_ipython/core/application.py
|
||||
yap_ipython/core/autocall.py
|
||||
yap_ipython/core/builtin_trap.py
|
||||
yap_ipython/core/compilerop.py
|
||||
yap_ipython/core/completerlib.py
|
||||
yap_ipython/core/completer.py
|
||||
yap_ipython/core/crashhandler.py
|
||||
yap_ipython/core/debugger.py
|
||||
yap_ipython/core/displayhook.py
|
||||
yap_ipython/core/displaypub.py
|
||||
yap_ipython/core/display.py
|
||||
yap_ipython/core/display_trap.py
|
||||
yap_ipython/core/error.py
|
||||
yap_ipython/core/events.py
|
||||
yap_ipython/core/excolors.py
|
||||
yap_ipython/core/extensions.py
|
||||
yap_ipython/core/formatters.py
|
||||
yap_ipython/core/getipython.py
|
||||
yap_ipython/core/historyapp.py
|
||||
yap_ipython/core/history.py
|
||||
yap_ipython/core/hooks.py
|
||||
yap_ipython/core/__init__.py
|
||||
yap_ipython/core/inputsplitter.py
|
||||
yap_ipython/core/inputtransformer.py
|
||||
yap_ipython/core/interactiveshell.py
|
||||
yap_ipython/core/latex_symbols.py
|
||||
yap_ipython/core/logger.py
|
||||
yap_ipython/core/macro.py
|
||||
yap_ipython/core/magic_arguments.py
|
||||
yap_ipython/core/magic.py
|
||||
yap_ipython/core/magics
|
||||
yap_ipython/core/oinspect.py
|
||||
yap_ipython/core/page.py
|
||||
yap_ipython/core/payloadpage.py
|
||||
yap_ipython/core/payload.py
|
||||
yap_ipython/core/prefilter.py
|
||||
yap_ipython/core/profileapp.py
|
||||
yap_ipython/core/profiledir.py
|
||||
yap_ipython/core/prompts.py
|
||||
yap_ipython/core/pylabtools.py
|
||||
yap_ipython/core/release.py
|
||||
yap_ipython/core/shellapp.py
|
||||
yap_ipython/core/splitinput.py
|
||||
yap_ipython/core/tests
|
||||
yap_ipython/core/ultratb.py
|
||||
yap_ipython/core/usage.py
|
||||
yap_ipython/extensions/autoreload.py
|
||||
yap_ipython/extensions/cythonmagic.py
|
||||
yap_ipython/extensions/__init__.py
|
||||
yap_ipython/extensions/rmagic.py
|
||||
yap_ipython/extensions/storemagic.py
|
||||
yap_ipython/extensions/sympyprinting.py
|
||||
yap_ipython/extensions/tests
|
||||
yap_ipython/external/decorators
|
||||
yap_ipython/external/__init__.py
|
||||
yap_ipython/external/mathjax.py
|
||||
yap_ipython/external/qt_for_kernel.py
|
||||
yap_ipython/external/qt_loaders.py
|
||||
yap_ipython/kernel/adapter.py
|
||||
yap_ipython/kernel/channelsabc.py
|
||||
yap_ipython/kernel/channels.py
|
||||
yap_ipython/kernel/clientabc.py
|
||||
yap_ipython/kernel/client.py
|
||||
yap_ipython/kernel/connect.py
|
||||
yap_ipython/kernel/__init__.py
|
||||
yap_ipython/kernel/kernelspecapp.py
|
||||
yap_ipython/kernel/kernelspec.py
|
||||
yap_ipython/kernel/launcher.py
|
||||
yap_ipython/kernel/__main__.py
|
||||
yap_ipython/kernel/managerabc.py
|
||||
yap_ipython/kernel/manager.py
|
||||
yap_ipython/kernel/multikernelmanager.py
|
||||
yap_ipython/kernel/restarter.py
|
||||
yap_ipython/kernel/threaded.py
|
||||
yap_ipython/lib/backgroundjobs.py
|
||||
yap_ipython/lib/clipboard.py
|
||||
yap_ipython/lib/deepreload.py
|
||||
yap_ipython/lib/demo.py
|
||||
yap_ipython/lib/display.py
|
||||
yap_ipython/lib/editorhooks.py
|
||||
yap_ipython/lib/guisupport.py
|
||||
yap_ipython/lib/__init__.py
|
||||
yap_ipython/lib/inputhookglut.py
|
||||
yap_ipython/lib/inputhookgtk3.py
|
||||
yap_ipython/lib/inputhookgtk.py
|
||||
yap_ipython/lib/inputhook.py
|
||||
yap_ipython/lib/inputhookpyglet.py
|
||||
yap_ipython/lib/inputhookqt4.py
|
||||
yap_ipython/lib/inputhookwx.py
|
||||
yap_ipython/lib/kernel.py
|
||||
yap_ipython/lib/latextools.py
|
||||
yap_ipython/lib/lexers.py
|
||||
yap_ipython/lib/pretty.py
|
||||
yap_ipython/lib/security.py
|
||||
yap_ipython/lib/tests
|
||||
yap_ipython/prolog/jupyter.yap
|
||||
yap_ipython/sphinxext/custom_doctests.py
|
||||
yap_ipython/sphinxext/__init__.py
|
||||
yap_ipython/sphinxext/ipython_console_highlighting.py
|
||||
yap_ipython/sphinxext/ipython_directive.py
|
||||
yap_ipython/terminal/console.py
|
||||
yap_ipython/terminal/debugger.py
|
||||
yap_ipython/terminal/embed.py
|
||||
yap_ipython/terminal/__init__.py
|
||||
yap_ipython/terminal/interactiveshell.py
|
||||
yap_ipython/terminal/ipapp.py
|
||||
yap_ipython/terminal/magics.py
|
||||
yap_ipython/terminal/prompts.py
|
||||
yap_ipython/terminal/pt_inputhooks
|
||||
yap_ipython/terminal/ptshell.py
|
||||
yap_ipython/terminal/ptutils.py
|
||||
yap_ipython/terminal/shortcuts.py
|
||||
yap_ipython/terminal/tests
|
||||
yap_ipython/testing/decorators.py
|
||||
yap_ipython/testing/globalipapp.py
|
||||
yap_ipython/testing/__init__.py
|
||||
yap_ipython/testing/iptestcontroller.py
|
||||
yap_ipython/testing/iptest.py
|
||||
yap_ipython/testing/ipunittest.py
|
||||
yap_ipython/testing/__main__.py
|
||||
yap_ipython/testing/plugin
|
||||
yap_ipython/testing/skipdoctest.py
|
||||
yap_ipython/testing/tests
|
||||
yap_ipython/testing/tools.py
|
||||
yap_ipython/utils/capture.py
|
||||
yap_ipython/utils/colorable.py
|
||||
yap_ipython/utils/coloransi.py
|
||||
yap_ipython/utils/contexts.py
|
||||
yap_ipython/utils/daemonize.py
|
||||
yap_ipython/utils/data.py
|
||||
yap_ipython/utils/decorators.py
|
||||
yap_ipython/utils/dir2.py
|
||||
yap_ipython/utils/encoding.py
|
||||
yap_ipython/utils/eventful.py
|
||||
yap_ipython/utils/frame.py
|
||||
yap_ipython/utils/generics.py
|
||||
yap_ipython/utils/importstring.py
|
||||
yap_ipython/utils/__init__.py
|
||||
yap_ipython/utils/io.py
|
||||
yap_ipython/utils/ipstruct.py
|
||||
yap_ipython/utils/jsonutil.py
|
||||
yap_ipython/utils/localinterfaces.py
|
||||
yap_ipython/utils/log.py
|
||||
yap_ipython/utils/module_paths.py
|
||||
yap_ipython/utils/openpy.py
|
||||
yap_ipython/utils/path.py
|
||||
yap_ipython/utils/pickleutil.py
|
||||
yap_ipython/utils/_process_cli.py
|
||||
yap_ipython/utils/_process_common.py
|
||||
yap_ipython/utils/_process_posix.py
|
||||
yap_ipython/utils/process.py
|
||||
yap_ipython/utils/_process_win32_controller.py
|
||||
yap_ipython/utils/_process_win32.py
|
||||
yap_ipython/utils/py3compat.py
|
||||
yap_ipython/utils/PyColorize.py
|
||||
yap_ipython/utils/sentinel.py
|
||||
yap_ipython/utils/shimmodule.py
|
||||
yap_ipython/utils/signatures.py
|
||||
yap_ipython/utils/strdispatch.py
|
||||
yap_ipython/utils/_sysinfo.py
|
||||
yap_ipython/utils/sysinfo.py
|
||||
yap_ipython/utils/syspathcontext.py
|
||||
yap_ipython/utils/tempdir.py
|
||||
yap_ipython/utils/terminal.py
|
||||
yap_ipython/utils/tests
|
||||
yap_ipython/utils/text.py
|
||||
yap_ipython/utils/timing.py
|
||||
yap_ipython/utils/tokenize2.py
|
||||
yap_ipython/utils/tokenutil.py
|
||||
yap_ipython/utils/traitlets.py
|
||||
yap_ipython/utils/tz.py
|
||||
yap_ipython/utils/ulinecache.py
|
||||
yap_ipython/utils/version.py
|
||||
yap_ipython/utils/wildcard.py
|
||||
yap_kernel/inprocess/tests/__init__.py
|
||||
yap_kernel/inprocess/tests/test_kernelmanager.py
|
||||
yap_kernel/inprocess/tests/test_kernel.py
|
||||
yap_ipython/core/magics/auto.py
|
||||
yap_ipython/core/magics/basic.py
|
||||
yap_ipython/core/magics/code.py
|
||||
yap_ipython/core/magics/config.py
|
||||
yap_ipython/core/magics/display.py
|
||||
yap_ipython/core/magics/execution.py
|
||||
yap_ipython/core/magics/extension.py
|
||||
yap_ipython/core/magics/history.py
|
||||
yap_ipython/core/magics/__init__.py
|
||||
yap_ipython/core/magics/logging.py
|
||||
yap_ipython/core/magics/namespace.py
|
||||
yap_ipython/core/magics/osm.py
|
||||
yap_ipython/core/magics/pylab.py
|
||||
yap_ipython/core/magics/script.py
|
||||
yap_ipython/core/tests/bad_all.py
|
||||
yap_ipython/core/tests/daft_extension
|
||||
yap_ipython/core/tests/__init__.py
|
||||
yap_ipython/core/tests/nonascii2.py
|
||||
yap_ipython/core/tests/nonascii.py
|
||||
yap_ipython/core/tests/print_argv.py
|
||||
yap_ipython/core/tests/refbug.py
|
||||
yap_ipython/core/tests/simpleerr.py
|
||||
yap_ipython/core/tests/tclass.py
|
||||
yap_ipython/core/tests/test_alias.py
|
||||
yap_ipython/core/tests/test_application.py
|
||||
yap_ipython/core/tests/test_autocall.py
|
||||
yap_ipython/core/tests/test_compilerop.py
|
||||
yap_ipython/core/tests/test_completerlib.py
|
||||
yap_ipython/core/tests/test_completer.py
|
||||
yap_ipython/core/tests/test_debugger.py
|
||||
yap_ipython/core/tests/test_displayhook.py
|
||||
yap_ipython/core/tests/test_display.py
|
||||
yap_ipython/core/tests/test_events.py
|
||||
yap_ipython/core/tests/test_extension.py
|
||||
yap_ipython/core/tests/test_formatters.py
|
||||
yap_ipython/core/tests/test_handlers.py
|
||||
yap_ipython/core/tests/test_history.py
|
||||
yap_ipython/core/tests/test_hooks.py
|
||||
yap_ipython/core/tests/test_imports.py
|
||||
yap_ipython/core/tests/test_inputsplitter.py
|
||||
yap_ipython/core/tests/test_inputtransformer.py
|
||||
yap_ipython/core/tests/test_interactiveshell.py
|
||||
yap_ipython/core/tests/test_iplib.py
|
||||
yap_ipython/core/tests/test_logger.py
|
||||
yap_ipython/core/tests/test_magic_arguments.py
|
||||
yap_ipython/core/tests/test_magic.py
|
||||
yap_ipython/core/tests/test_magic_terminal.py
|
||||
yap_ipython/core/tests/test_oinspect.py
|
||||
yap_ipython/core/tests/test_page.py
|
||||
yap_ipython/core/tests/test_paths.py
|
||||
yap_ipython/core/tests/test_prefilter.py
|
||||
yap_ipython/core/tests/test_profile.py
|
||||
yap_ipython/core/tests/test_prompts.py
|
||||
yap_ipython/core/tests/test_pylabtools.py
|
||||
yap_ipython/core/tests/test_run.py
|
||||
yap_ipython/core/tests/test_shellapp.py
|
||||
yap_ipython/core/tests/test_splitinput.py
|
||||
yap_ipython/core/tests/test_ultratb.py
|
||||
yap_ipython/extensions/tests/__init__.py
|
||||
yap_ipython/extensions/tests/test_autoreload.py
|
||||
yap_ipython/extensions/tests/test_storemagic.py
|
||||
yap_ipython/external/decorators/_decorators.py
|
||||
yap_ipython/external/decorators/__init__.py
|
||||
yap_ipython/external/decorators/_numpy_testing_noseclasses.py
|
||||
yap_ipython/lib/tests/__init__.py
|
||||
yap_ipython/lib/tests/test_backgroundjobs.py
|
||||
yap_ipython/lib/tests/test_clipboard.py
|
||||
yap_ipython/lib/tests/test_deepreload.py
|
||||
yap_ipython/lib/tests/test_display.py
|
||||
yap_ipython/lib/tests/test_editorhooks.py
|
||||
yap_ipython/lib/tests/test_imports.py
|
||||
yap_ipython/lib/tests/test_latextools.py
|
||||
yap_ipython/lib/tests/test_lexers.py
|
||||
yap_ipython/lib/tests/test_pretty.py
|
||||
yap_ipython/lib/tests/test_security.py
|
||||
yap_ipython/terminal/pt_inputhooks/glut.py
|
||||
yap_ipython/terminal/pt_inputhooks/gtk3.py
|
||||
yap_ipython/terminal/pt_inputhooks/gtk.py
|
||||
yap_ipython/terminal/pt_inputhooks/__init__.py
|
||||
yap_ipython/terminal/pt_inputhooks/osx.py
|
||||
yap_ipython/terminal/pt_inputhooks/pyglet.py
|
||||
yap_ipython/terminal/pt_inputhooks/qt.py
|
||||
yap_ipython/terminal/pt_inputhooks/tk.py
|
||||
yap_ipython/terminal/pt_inputhooks/wx.py
|
||||
yap_ipython/terminal/tests/__init__.py
|
||||
yap_ipython/terminal/tests/test_embed.py
|
||||
yap_ipython/terminal/tests/test_help.py
|
||||
yap_ipython/terminal/tests/test_interactivshell.py
|
||||
yap_ipython/testing/plugin/dtexample.py
|
||||
yap_ipython/testing/plugin/__init__.py
|
||||
yap_ipython/testing/plugin/ipdoctest.py
|
||||
yap_ipython/testing/plugin/iptest.py
|
||||
yap_ipython/testing/plugin/setup.py
|
||||
yap_ipython/testing/plugin/show_refs.py
|
||||
yap_ipython/testing/plugin/simple.py
|
||||
yap_ipython/testing/plugin/simplevars.py
|
||||
yap_ipython/testing/plugin/test_ipdoctest.py
|
||||
yap_ipython/testing/plugin/test_refs.py
|
||||
yap_ipython/testing/tests/__init__.py
|
||||
yap_ipython/testing/tests/test_decorators.py
|
||||
yap_ipython/testing/tests/test_ipunittest.py
|
||||
yap_ipython/testing/tests/test_tools.py
|
||||
yap_ipython/utils/tests/__init__.py
|
||||
yap_ipython/utils/tests/test_capture.py
|
||||
yap_ipython/utils/tests/test_decorators.py
|
||||
yap_ipython/utils/tests/test_dir2.py
|
||||
yap_ipython/utils/tests/test_imports.py
|
||||
yap_ipython/utils/tests/test_importstring.py
|
||||
yap_ipython/utils/tests/test_io.py
|
||||
yap_ipython/utils/tests/test_module_paths.py
|
||||
yap_ipython/utils/tests/test_openpy.py
|
||||
yap_ipython/utils/tests/test_path.py
|
||||
yap_ipython/utils/tests/test_process.py
|
||||
yap_ipython/utils/tests/test_pycolorize.py
|
||||
yap_ipython/utils/tests/test_shimmodule.py
|
||||
yap_ipython/utils/tests/test_sysinfo.py
|
||||
yap_ipython/utils/tests/test_tempdir.py
|
||||
yap_ipython/utils/tests/test_text.py
|
||||
yap_ipython/utils/tests/test_tokenutil.py
|
||||
yap_ipython/utils/tests/test_wildcard.py
|
||||
yap_ipython/core/tests/daft_extension/daft_extension.py
|
||||
__init__.py
|
||||
|
||||
)
|
||||
@ -373,13 +401,17 @@ __init__.py
|
||||
#yap_kernel/resourcess/logo-64x64.png
|
||||
)
|
||||
set (RENAMED_RESOURCES
|
||||
yap_kernel/resources/logo-32x32.png
|
||||
yap_kernel/resources/logo-64x64.png
|
||||
# yap_kernel/resources/codemirror/mode/prolog/prolog.js
|
||||
|
||||
yap_kernel/resources/logo-32x32.png
|
||||
|
||||
yap_kernel/resources/logo-64x64.png
|
||||
#
|
||||
yap_kernel/resources/codemirror/mode/prolog/prolog.js
|
||||
)
|
||||
|
||||
set (PL_SOURCES
|
||||
yap_ipython/prolog/jupyter.yap
|
||||
|
||||
yap_ipython/prolog/jupyter.yap
|
||||
)
|
||||
|
||||
set(FILES ${PYTHON_SOURCES} ${PL_SOURCES} ${EXTRAS} ${RESOURCES})
|
||||
@ -387,7 +419,7 @@ set(FILES ${PYTHON_SOURCES} ${PL_SOURCES} ${EXTRAS} ${RESOURCES})
|
||||
set(SETUP_PY ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap.tgz
|
||||
COMMAND ${CMAKE_COMMAND} -E tar cf ${CMAKE_CURRENT_BINARY_DIR}/yap.tgz ${FILES}
|
||||
COMMAND ${CMAKE_COMMAND} -E tar cf ${CMAKE_CURRENT_BINARY_DIR}/yap.tgz ${FILES}
|
||||
|
||||
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
@ -396,7 +428,8 @@ set(FILES ${PYTHON_SOURCES} ${PL_SOURCES} ${EXTRAS} ${RESOURCES})
|
||||
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-32x32.png
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory yap_kernel/resources
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory
|
||||
yap_kernel/resources
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/docs/icons/yap_32x32x32.png ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-32x32.png
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/docs/icons/yap_32x32x32.png
|
||||
)
|
||||
@ -420,14 +453,17 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-
|
||||
)
|
||||
|
||||
add_custom_target(YAP_KERNEL ALL
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf yap.tgz
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} build sdist bdist
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf
|
||||
yap.tgz
|
||||
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 yap.tgz ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/kernel.js ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/prolog.js
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-32x32.png ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/logo-64x64.png
|
||||
yap.tgz ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/kernel.js ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources/prolog.js
|
||||
)
|
||||
|
||||
|
||||
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install --ignore-installed --no-deps .
|
||||
install(CODE "execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} build sdist bdist
|
||||
COMMAND ${PYTHON_EXECUTABLE} -m pip install --ignore-installed --no-deps .
|
||||
COMMAND ${PYTHON_EXECUTABLE} -m yap_kernel.kernelspec
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
|
||||
|
||||
|
@ -40,14 +40,15 @@ here = os.path.abspath(os.path.dirname(__file__))
|
||||
packages = ['yap_kernel','yap_ipython']
|
||||
# pkg_root = pjoin(here, name)
|
||||
|
||||
# for d, _, _ in os.walk(pjoin(here, 'yap_kernel')):
|
||||
# if os.path.exists(pjoin(d, '__init__.py')):
|
||||
# packages.append(d[len(here)+1:].replace(os.path.sep, '.'))
|
||||
# for d, _, _ in os.walk(pjoin(here, 'yap_ipython')):
|
||||
# if os.path.exists(pjoin(d, '__init__.py')):
|
||||
# packages.append(d[len(here)+1:].replace(os.path.sep, '.'))
|
||||
for d, _, _ in os.walk(pjoin(here, 'yap_kernel')):
|
||||
if os.path.exists(pjoin(d, '__init__.py')):
|
||||
packages.append(d[len(here)+1:].replace(os.path.sep, '.'))
|
||||
for d, _, _ in os.walk(pjoin(here, 'yap_ipython')):
|
||||
if os.path.exists(pjoin(d, '__init__.py')):
|
||||
packages.append(d[len(here)+1:].replace(os.path.sep, '.'))
|
||||
|
||||
sys.path.insert(0, here)
|
||||
sys.path.insert(0, pjoin(here,'..','swig'))
|
||||
package_data = {
|
||||
'yap_ipython': ['prolog/*.*'],
|
||||
'yap_kernel': ['resources/*.*']
|
||||
|
@ -32,15 +32,15 @@ This is an handy alias to `ipython history trim --keep=0`
|
||||
|
||||
class HistoryTrim(BaseYAPApplication):
|
||||
description = trim_hist_help
|
||||
|
||||
|
||||
backup = Bool(False,
|
||||
help="Keep the old history file as history.sqlite.<N>"
|
||||
).tag(config=True)
|
||||
|
||||
|
||||
keep = Int(1000,
|
||||
help="Number of recent lines to keep in the database."
|
||||
).tag(config=True)
|
||||
|
||||
|
||||
flags = Dict(dict(
|
||||
backup = ({'HistoryTrim' : {'backup' : True}},
|
||||
backup.help
|
||||
@ -50,7 +50,7 @@ class HistoryTrim(BaseYAPApplication):
|
||||
aliases=Dict(dict(
|
||||
keep = 'HistoryTrim.keep'
|
||||
))
|
||||
|
||||
|
||||
def start(self):
|
||||
profile_dir = self.profile_dir.location
|
||||
hist_file = os.path.join(profile_dir, 'history.sqlite')
|
||||
@ -63,9 +63,9 @@ class HistoryTrim(BaseYAPApplication):
|
||||
print("There are already at most %d entries in the history database." % self.keep)
|
||||
print("Not doing anything. Use --keep= argument to keep fewer entries")
|
||||
return
|
||||
|
||||
|
||||
print("Trimming history to the most recent %d entries." % self.keep)
|
||||
|
||||
|
||||
inputs.pop() # Remove the extra element we got to check the length.
|
||||
inputs.reverse()
|
||||
if inputs:
|
||||
@ -75,7 +75,7 @@ class HistoryTrim(BaseYAPApplication):
|
||||
sessions = list(con.execute('SELECT session, start, end, num_cmds, remark FROM '
|
||||
'sessions WHERE session >= ?', (first_session,)))
|
||||
con.close()
|
||||
|
||||
|
||||
# Create the new history database.
|
||||
new_hist_file = os.path.join(profile_dir, 'history.sqlite.new')
|
||||
i = 0
|
||||
@ -114,18 +114,18 @@ class HistoryTrim(BaseYAPApplication):
|
||||
print("Backed up longer history file to", backup_hist_file)
|
||||
else:
|
||||
os.remove(hist_file)
|
||||
|
||||
|
||||
os.rename(new_hist_file, hist_file)
|
||||
|
||||
class HistoryClear(HistoryTrim):
|
||||
description = clear_hist_help
|
||||
keep = Int(0,
|
||||
help="Number of recent lines to keep in the database.")
|
||||
|
||||
|
||||
force = Bool(False,
|
||||
help="Don't prompt user for confirmation"
|
||||
).tag(config=True)
|
||||
|
||||
|
||||
flags = Dict(dict(
|
||||
force = ({'HistoryClear' : {'force' : True}},
|
||||
force.help),
|
||||
|
@ -219,9 +219,9 @@ class ExecutionResult(object):
|
||||
|
||||
def raise_error(self):
|
||||
"""Reraises error if `success` is `False`, otherwise does nothing"""
|
||||
if self.error_before_exec is not None:
|
||||
if self.error_before_exec:
|
||||
raise self.error_before_exec
|
||||
if self.error_in_exec is not None:
|
||||
if self.error_in_exec:
|
||||
raise self.error_in_exec
|
||||
|
||||
def __repr__(self):
|
||||
@ -522,8 +522,7 @@ class InteractiveShell(SingletonConfigurable):
|
||||
# The following was in post_config_initialization
|
||||
self.init_inspector()
|
||||
self.raw_input_original = input
|
||||
self.input_splitter.engine(self.yapeng)
|
||||
self.input_transformer_manager.engine(self.yapeng)
|
||||
#self.input_transformer_manager.engine(self.yapeng)
|
||||
self.init_completer()
|
||||
# TODO: init_io() needs to happen before init_traceback handlers
|
||||
# because the traceback handlers hardcode the stdout/stderr streams.
|
||||
@ -2598,7 +2597,7 @@ class InteractiveShell(SingletonConfigurable):
|
||||
with prepended_to_syspath(dname):
|
||||
try:
|
||||
for cell in get_cells():
|
||||
result = self.run_cell(cell, silent=False , shell_futures=shell_futures)
|
||||
result = self.run_cell(cell, silent=False, shell_futures=shell_futures)
|
||||
if raise_exceptions:
|
||||
result.raise_error()
|
||||
elif not result.success:
|
||||
@ -2661,7 +2660,21 @@ class InteractiveShell(SingletonConfigurable):
|
||||
-------
|
||||
result : :class:`ExecutionResult`
|
||||
"""
|
||||
|
||||
result = None
|
||||
try:
|
||||
# import trace
|
||||
# tracer = trace.Trace(
|
||||
# #ignoredirs=[sys.prefix, sys.exec_prefix],
|
||||
# trace=1,
|
||||
# count=0)
|
||||
|
||||
# # run the new command using the given tracer
|
||||
# #
|
||||
# result =tracer.runfunc(self._yrun_cell,
|
||||
# raw_cell, store_history,
|
||||
# silent, shell_futures)
|
||||
|
||||
result = self._yrun_cell(
|
||||
raw_cell, store_history, silent, shell_futures)
|
||||
finally:
|
||||
|
@ -11,15 +11,15 @@
|
||||
* -
|
||||
*/
|
||||
|
||||
%% :- module( jupyter,
|
||||
%% [jupyter_query/3,
|
||||
%% errors/2,
|
||||
%% ready/2,
|
||||
%% completion/2,
|
||||
|
||||
%% ]
|
||||
%% ).
|
||||
% :- module( jupyter,
|
||||
% [jupyter_query/3,
|
||||
% errors/2,
|
||||
% ready/2,
|
||||
% completion/2,
|
||||
|
||||
% ]
|
||||
%% ).
|
||||
:- [library(hacks)].
|
||||
|
||||
:- reexport(library(yapi)).
|
||||
:- use_module(library(lists)).
|
||||
@ -32,26 +32,24 @@ jupyter_query(Caller, Cell, Line ) :-
|
||||
jupyter_cell(Caller, Cell, Line).
|
||||
|
||||
jupyter_cell(_Caller, Cell, _) :-
|
||||
jupyter_consult(Cell),
|
||||
jupyter_consult(Cell), %stack_dump,
|
||||
fail.
|
||||
jupyter_cell( _Caller, _, Line ) :-
|
||||
blank( Line ),
|
||||
!.
|
||||
jupyter_cell( _Caller, _, [] ) :- !.
|
||||
jupyter_cell( Caller, _, Line ) :-
|
||||
gated_call(
|
||||
enter_cell(call),
|
||||
python_query( Caller, Line ),
|
||||
Port,
|
||||
enter_cell(Port)
|
||||
).
|
||||
Self := Caller.query,
|
||||
python_query( Self, Line ).
|
||||
|
||||
jupyter_consult(Text) :-
|
||||
blank( Text ),
|
||||
!.
|
||||
jupyter_consult(Cell) :-
|
||||
open_mem_read_stream( Cell, Stream),
|
||||
load_files(user:'jupyter cell',[stream(Stream)]).
|
||||
% Name = 'Inp',
|
||||
% stream_property(Stream, file_name(Name) ),
|
||||
load_files(user:'jupyter cell',[stream(Stream)]), !.
|
||||
%should load_files close?
|
||||
|
||||
blank(Text) :-
|
||||
@ -62,31 +60,22 @@ blankc(' ').
|
||||
blankc('\n').
|
||||
blankc('\t').
|
||||
|
||||
enter_cell(retry) :-
|
||||
enter_cell(call).
|
||||
enter_cell(call) :-
|
||||
into_cell.
|
||||
enter_cell(fail) :-
|
||||
enter_cell(exit).
|
||||
enter_cell(answer) :-
|
||||
enter_cell(exit).
|
||||
enter_cell(exception(_)) :-
|
||||
enter_cell(exit).
|
||||
enter_cell(external_exception(_)).
|
||||
enter_cell(!).
|
||||
enter_cell(exit) :-
|
||||
nb_setval(jupyter_cell, off),
|
||||
close( user_output).
|
||||
|
||||
|
||||
into_cell :-
|
||||
nb_setval(jupyter_cell, on),
|
||||
open('/python/sys.input', read, _Input, [bom(false)]),
|
||||
open('/python/sys.stdout', append, _Output, []),
|
||||
open('/python/sys.stderr', append, _Error, []),
|
||||
set_prolog_flag(user_input,_Output),
|
||||
streams(false) :-
|
||||
nb_setval(jupyter_cell, false),
|
||||
flush_output,
|
||||
forall(
|
||||
stream_property( S, mode(_) ),
|
||||
close(S)
|
||||
).
|
||||
streams(true) :-
|
||||
nb_setval(jupyter_cell, true),
|
||||
open('/python/input', read, _Input, [alias(user_input),bom(false)]),
|
||||
open('/python/sys.stdout', append, _Output, [alias(user_output)]),
|
||||
open('/python/sys.stderr', append, _Error, [alias(user_error)]),
|
||||
set_prolog_flag(user_input,_Input),
|
||||
set_prolog_flag(user_output,_Output),
|
||||
set_prolog_flag(user_error,_Error).
|
||||
set_prolog_flag(user_error,_Error).
|
||||
|
||||
|
||||
completions(S, Self) :-
|
||||
@ -185,7 +174,7 @@ predicate(N,P,A) :-
|
||||
cont(0, F, P, P0) :-
|
||||
atom_concat( F, P, P0 ).
|
||||
cont( _, F, P, PB ):-
|
||||
atom_concat( [F, P, '('], PB ).
|
||||
atom_concat( [F, P, '( )'], PB ).
|
||||
|
||||
|
||||
ready(_Self, Line ) :-
|
||||
|
@ -3,15 +3,14 @@ import sys
|
||||
import abc
|
||||
import math
|
||||
import itertools
|
||||
import trace
|
||||
|
||||
|
||||
from typing import Iterator, List, Tuple, Iterable, Union
|
||||
from traitlets import Bool, Enum, observe, Int
|
||||
|
||||
try:
|
||||
from yap4py.yapi import Engine, Goal, EngineArgs, PrologTableIter
|
||||
except:
|
||||
print("Could not load _yap dll.")
|
||||
|
||||
from yap4py.yapi import *
|
||||
from yap_ipython.core.completer import Completer, Completion
|
||||
from yap_ipython.utils.strdispatch import StrDispatch
|
||||
# import yap_ipython.core
|
||||
@ -32,13 +31,15 @@ bindvars = namedtuple('bindvars', 'list')
|
||||
library = namedtuple('library', 'list')
|
||||
v = namedtuple('_', 'slot')
|
||||
load_files = namedtuple('load_files', 'file ofile args')
|
||||
python_query= namedtuple('python_query', 'query_mgr string')
|
||||
python_query = namedtuple('python_query', 'query_mgr string')
|
||||
jupyter_query = namedtuple('jupyter_query', 'self text query')
|
||||
enter_cell = namedtuple('enter_cell', 'self' )
|
||||
exit_cell = namedtuple('exit_cell', 'self' )
|
||||
completions = namedtuple('completions', 'txt self' )
|
||||
errors = namedtuple('errors', 'self text' )
|
||||
streams = namedtuple('streams', ' text' )
|
||||
|
||||
global engine
|
||||
|
||||
class YAPInputSplitter(InputSplitter):
|
||||
"""An input splitter that recognizes all of iyap's special syntax."""
|
||||
@ -59,11 +60,12 @@ class YAPInputSplitter(InputSplitter):
|
||||
# List with lines of raw input accumulated so far.
|
||||
_buffer_raw = None
|
||||
|
||||
def __init__(self, line_input_checker=True, physical_line_transforms=None,
|
||||
def __init__(self, engine=None, shell=None, line_input_checker=True, physical_line_transforms=None,
|
||||
logical_line_transforms=None):
|
||||
self._buffer_raw = []
|
||||
self._validate = True
|
||||
self.yapeng = None
|
||||
self.yapeng = engine
|
||||
self.shell = shell
|
||||
|
||||
if physical_line_transforms is not None:
|
||||
self.physical_line_transforms = physical_line_transforms
|
||||
@ -100,20 +102,17 @@ class YAPInputSplitter(InputSplitter):
|
||||
Python line."""
|
||||
t = self.physical_line_transforms + \
|
||||
[self.assemble_logical_lines] + self.logical_line_transforms
|
||||
return t
|
||||
|
||||
def engine(self, engine):
|
||||
self.yapeng = engine
|
||||
|
||||
def validQuery(self, text, line=None):
|
||||
def validQuery(self, text, engine, shell, line=None):
|
||||
"""Return whether a legal query
|
||||
"""
|
||||
if shell and text == shell.os:
|
||||
return True
|
||||
if not line:
|
||||
(_,line,_) = self.shell.prolog_cell(text)
|
||||
line = line.strip().rstrip()
|
||||
if not line:
|
||||
return False
|
||||
line = text.rstrip()
|
||||
self.errors = []
|
||||
self.yapeng.mgoal(errors(self, line),"user")
|
||||
engine.mgoal(errors(self, line),"user")
|
||||
return self.errors != []
|
||||
|
||||
|
||||
@ -182,7 +181,7 @@ class YAPInputSplitter(InputSplitter):
|
||||
if self.transformer_accumulating:
|
||||
return True
|
||||
else:
|
||||
return self,validQuery(self.source)
|
||||
return self.validQuery(self.source, engine, self.shell)
|
||||
|
||||
def transform_cell(self, cell):
|
||||
"""Process and translate a cell of input.
|
||||
@ -496,9 +495,11 @@ class YAPCompleter(Completer):
|
||||
"""
|
||||
self.matches = []
|
||||
prolog_res = self.shell.yapeng.mgoal(completions(text, self), "user")
|
||||
if self.matches:
|
||||
return text, self.matches
|
||||
magic_res = self.magic_matches(text)
|
||||
return text, magic_res
|
||||
|
||||
return text, self.matches+magic_res
|
||||
|
||||
|
||||
|
||||
@ -508,9 +509,10 @@ class YAPRun:
|
||||
def __init__(self, shell):
|
||||
self.shell = shell
|
||||
self.yapeng = Engine()
|
||||
global engine
|
||||
engine = self.yapeng
|
||||
self.yapeng.goal(use_module(library("jupyter")))
|
||||
self.q = None
|
||||
self.port = "call"
|
||||
self.query = None
|
||||
self.os = None
|
||||
self.it = None
|
||||
self.shell.yapeng = self.yapeng
|
||||
@ -521,41 +523,56 @@ class YAPRun:
|
||||
"""
|
||||
if not text:
|
||||
return []
|
||||
if text == self.os:
|
||||
return self.errors
|
||||
self.errors=[]
|
||||
(text,_,_,_) = self.clean_end(text)
|
||||
self.yapeng.mgoal(errors(self,text),"user")
|
||||
return self.errors
|
||||
|
||||
def jupyter_query(self, s):
|
||||
#
|
||||
# construct a self.query from a one-line string
|
||||
# self.q is opaque to Python
|
||||
program,query,mx = self.prolog_cell(s)
|
||||
Found = False
|
||||
|
||||
if query != self.os:
|
||||
self.os = None
|
||||
self.iterations = 0
|
||||
pg = jupyter_query( self, program, query)
|
||||
self.it = Goal( self.yapeng, pg)
|
||||
else:
|
||||
mx += self.iterations
|
||||
self.os = s
|
||||
for answ in self.it:
|
||||
found = True
|
||||
self.bindings += [answ]
|
||||
self.iterations += 1
|
||||
if mx == self.iterations:
|
||||
return True, self.bindings
|
||||
port = self.it.port
|
||||
if port == "exit":
|
||||
self.q = None
|
||||
self.os = None
|
||||
return True,self.bindings
|
||||
if port == "fail":
|
||||
self.q = none
|
||||
self.os = None
|
||||
if self.bindings_message:
|
||||
return True,self.bindings
|
||||
# construct a self.queryuery from a one-line string
|
||||
# self.query is opaque to Python
|
||||
try:
|
||||
program,query,stop,howmany = self.prolog_cell(s)
|
||||
found = False
|
||||
if s != self.os:
|
||||
self.os = s
|
||||
self.iterations = 0
|
||||
self.bindings = []
|
||||
pg = jupyter_query( self, program, query)
|
||||
self.query = self.yapeng.query( pg)
|
||||
self.query.port = "call"
|
||||
self.query.answer = {}
|
||||
else:
|
||||
self.query.port = "retry"
|
||||
self.os = s
|
||||
howmany += self.iterations
|
||||
while self.query.next():
|
||||
answer = self.query.answer
|
||||
found = True
|
||||
self.bindings += [answer]
|
||||
self.iterations += 1
|
||||
if stop and howmany == self.iterations:
|
||||
return True, self.bindings
|
||||
if self.query.port == "exit":
|
||||
self.query.close()
|
||||
self.query = None
|
||||
self.os = None
|
||||
sys.stderr.writeln('Done, with', self.bindings)
|
||||
return True,self.bindings
|
||||
if self.bindings:
|
||||
sys.stderr.write('Done, with', self.bindings, '\n')
|
||||
else:
|
||||
self.query.close()
|
||||
self.query = None
|
||||
self.os = None
|
||||
sys.stderr.write('Fail\n')
|
||||
return True,{}
|
||||
except Exception as e:
|
||||
has_raised = True
|
||||
self.result.result = False
|
||||
|
||||
|
||||
def _yrun_cell(self, raw_cell, store_history=True, silent=False,
|
||||
@ -573,7 +590,7 @@ class YAPRun:
|
||||
IPython's machinery, this
|
||||
should be set to False.
|
||||
silent : bool
|
||||
v If True, avoid side-effects, such as implicit displayhooks and
|
||||
If True, avoid side-effects, such as implicit displayhooks and
|
||||
and logging. silent=True forces store_history=False.
|
||||
shell_futures : bool
|
||||
If True, the code will share future statements with the interactive
|
||||
@ -594,7 +611,7 @@ v If True, avoid side-effects, such as implicit displayhooks and
|
||||
# vs is the list of variables
|
||||
# you can print it out, the left-side is the variable name,
|
||||
# the right side wraps a handle to a variable
|
||||
# pdb.set_trace()
|
||||
#import pdb; pdb.set_trace()
|
||||
# #pdb.set_trace()
|
||||
# atom match either symbols, or if no symbol exists, strings, In this case
|
||||
# variable names should match strings
|
||||
@ -635,19 +652,6 @@ v If True, avoid side-effects, such as implicit displayhooks and
|
||||
# except SyntaxError:
|
||||
# preprocessing_exc_tuple = self.shell.syntax_error() # sys.exc_info()
|
||||
cell = raw_cell # cell has to exist so it can be stored/logged
|
||||
# else:
|
||||
# if False and len(cell.splitlines()) == 1:
|
||||
# # Dynamic transformations - only applied for single line commands
|
||||
# with self.shell.builtin_trap:
|
||||
# try:
|
||||
# # use prefilter_lines to handle trailing newlines
|
||||
# # restore trailing newline for ast.parse
|
||||
# cell = self.shell.prefilter_manager.prefilter_lines(cell) + '\n'
|
||||
# except Exception:
|
||||
# # don't allow prefilter errors to crash IPython
|
||||
# preprocessing_exc_tuple = sys.exc_info()
|
||||
|
||||
|
||||
for i in self.syntaxErrors(raw_cell):
|
||||
try:
|
||||
(what,lin,_,text) = i
|
||||
@ -663,18 +667,17 @@ v If True, avoid side-effects, such as implicit displayhooks and
|
||||
if not silent:
|
||||
self.shell.logger.log(cell, raw_cell)
|
||||
# # Display the exception if input processing failed.
|
||||
# if preprocessing_exc_tuple is not None:
|
||||
# self.showtraceback(preprocessing_exc_tuple)
|
||||
# if store_history:
|
||||
# self.shell.execution_count += 1
|
||||
# return error_before_exec(preprocessing_exc_tuple[2])
|
||||
if preprocessing_exc_tuple is not None:
|
||||
self.showtraceback(preprocessing_exc_tuple)
|
||||
if store_history:
|
||||
self.shell.execution_count += 1
|
||||
return error_before_exec(preprocessing_exc_tuple[2])
|
||||
|
||||
# Our own compiler remembers the __future__ environment. If we want to
|
||||
# run code with a separate __future__ environment, use the default
|
||||
# compiler
|
||||
# compiler = self.shell.compile if shell_futures else CachingCompiler()
|
||||
cell_name = str( self.shell.execution_count)
|
||||
|
||||
if cell[0] == '%':
|
||||
if cell[1] == '%':
|
||||
linec = False
|
||||
@ -689,14 +692,15 @@ v If True, avoid side-effects, such as implicit displayhooks and
|
||||
line = txt[1]
|
||||
else:
|
||||
line = ""
|
||||
if len(txt0) == 2:
|
||||
cell = txt0[1]
|
||||
else:
|
||||
cell = ""
|
||||
if linec:
|
||||
self.shell.run_line_magic(magic, line)
|
||||
else:
|
||||
self.shell.run_cell_magic(magic, line, cell)
|
||||
print("txt0: ",txt0,"\n")
|
||||
if len(txt0) == 1:
|
||||
cell = ""
|
||||
else:
|
||||
body = txt0[1]+'\n'+txt0[2]
|
||||
self.shell.run_cell_magic(magic, line, body)
|
||||
cell = ""
|
||||
# Give the displayhook a reference to our ExecutionResult so it
|
||||
# can fill in the output value.
|
||||
@ -704,12 +708,31 @@ v If True, avoid side-effects, such as implicit displayhooks and
|
||||
has_raised = False
|
||||
try:
|
||||
state = None
|
||||
self.shell.bindings = dict = {}
|
||||
if cell.strip():
|
||||
state = self.jupyter_query( cell )
|
||||
self.bindings = dicts = []
|
||||
if cell.strip('\n \t'):
|
||||
#create a Trace object, telling it what to ignore, and whether to
|
||||
# do tracing or line-counting or both.
|
||||
# tracer = trace.Trace(
|
||||
# #ignoredirs=[sys.prefix, sys.exec_prefix],
|
||||
# trace=1,
|
||||
# count=0)
|
||||
#
|
||||
# def f(self, cell):
|
||||
# self.jupyter_query( cell )
|
||||
|
||||
# run the new command using the given tracer
|
||||
#
|
||||
try:
|
||||
self.yapeng.mgoal(streams(True),"user")
|
||||
#state = tracer.runfunc(f,self,cell)
|
||||
state = self.jupyter_query( cell )
|
||||
self.yapeng.mgoal(streams(False),"user")
|
||||
except Exception as e:
|
||||
has_raised = True
|
||||
self.yapeng.mgoal(streams("off"),"user")
|
||||
if state:
|
||||
self.shell.last_execution_succeeded = True
|
||||
self.result.result = (True, dict)
|
||||
self.result.result = (True, dicts)
|
||||
else:
|
||||
self.shell.last_execution_succeeded = True
|
||||
self.result.result = (True, {})
|
||||
@ -735,50 +758,49 @@ v If True, avoid side-effects, such as implicit displayhooks and
|
||||
|
||||
return self.result
|
||||
|
||||
def clean_end(self,s):
|
||||
"""
|
||||
Look at the query suffix and return
|
||||
- whatever is left
|
||||
- how much was taken
|
||||
- whether to stop
|
||||
- when to stop
|
||||
"""
|
||||
i = -1
|
||||
try:
|
||||
its = 0
|
||||
j = 1
|
||||
while s[i].isdigit():
|
||||
ch = s[i]
|
||||
its += j * (ord(ch) - ord('0'))
|
||||
i-=1
|
||||
j *= 10;
|
||||
if s[i] == ';':
|
||||
if j > 1 or its != 0:
|
||||
return s[:i], 0 - i, True, its
|
||||
return s[:i], 0 - i, False, 0
|
||||
# one solution, stop
|
||||
return s, 0, True, 1
|
||||
except:
|
||||
return s,0, False, 0
|
||||
|
||||
|
||||
|
||||
def prolog_cell(self,s):
|
||||
"""
|
||||
Trasform a text into program+query. A query is the
|
||||
last line if the last line is non-empty and does not terminate
|
||||
on a dot. You can also finish with
|
||||
|
||||
- `*`: you request all solutions
|
||||
- '^': you want to check if there is an answer
|
||||
- '?'[N]: you want an answer; optionally you want N answers
|
||||
- `;`: you request all solutions
|
||||
- ';'[N]: you want an answer; optionally you want N answers
|
||||
|
||||
If the line terminates on a `*/` or starts on a `%` we assume the line
|
||||
is a comment.
|
||||
"""
|
||||
s = s.rstrip()
|
||||
take = 0
|
||||
its = 0
|
||||
s0 = ''
|
||||
for c in s:
|
||||
if c == '\n' or c.isspace():
|
||||
s0 += c
|
||||
break
|
||||
sf = ''
|
||||
for c in reversed(s):
|
||||
if c == '\n' or c.isspace():
|
||||
sf += c
|
||||
break
|
||||
[program,x,query] = s.rpartition('\n')
|
||||
if query == '':
|
||||
query = program
|
||||
while take < len(query):
|
||||
take += 1
|
||||
ch = query[-take]
|
||||
if ch.isdigit():
|
||||
its = its*10 + ord(ch) - ord('0')
|
||||
elif ch == '*' and take == 1:
|
||||
return program, query[:-take], -1
|
||||
elif ch == '.' and take == 1:
|
||||
return s, '', 1
|
||||
elif ch == '/' and query[-2] == '*' and take == 1:
|
||||
return program, query[:-take], 1
|
||||
elif ch == '^' and take == 1:
|
||||
return program, query[:-take], 1
|
||||
elif ch == '?':
|
||||
return program, query[:-take], its+1
|
||||
else:
|
||||
return program, query, 1
|
||||
return s, '', 1
|
||||
s0 = s.rstrip(' \n\t\i')
|
||||
[program,x,query] = s0.rpartition('\n')
|
||||
if query[-1] == '.':
|
||||
return s,'',False,0
|
||||
(query, _,loop, sols) = self.clean_end(query)
|
||||
return (program, query, loop, sols)
|
||||
|
@ -472,7 +472,18 @@ class YAPKernelApp(BaseYAPApplication, InteractiveShellApp,
|
||||
return self.subapp.start()
|
||||
if self.poller is not None:
|
||||
self.poller.start()
|
||||
self.kernel.start()
|
||||
|
||||
import trace
|
||||
#create a Trace object, telling it what to ignore, and whether to
|
||||
# do tracing or line-counting or both.
|
||||
tracer = trace.Trace(
|
||||
#ignoredirs=[sys.prefix, sys.exec_prefix],
|
||||
trace=1,
|
||||
count=0)
|
||||
|
||||
tracer.runfunc(self.kernel.start)
|
||||
|
||||
#self.kernel.start()
|
||||
self.io_loop = ioloop.IOLoop.current()
|
||||
try:
|
||||
self.io_loop.start()
|
||||
@ -485,6 +496,7 @@ def main():
|
||||
"""Run an IPKernel as an application"""
|
||||
app = YAPKernelApp.instance()
|
||||
app.initialize()
|
||||
|
||||
app.start()
|
||||
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#define CSTACK_DEFNS
|
||||
#include "rconfig.h"
|
||||
#if HAVE_R_H || !defined(_YAP_NOT_INSTALLED_)
|
||||
@ -480,7 +479,7 @@ static int term_to_S_el(term_t t, int objtype, size_t index, SEXP ans) {
|
||||
switch (objtype) {
|
||||
case PL_R_CHARS:
|
||||
case PL_R_PLUS: {
|
||||
char *s;
|
||||
char *s = NULL;
|
||||
|
||||
if (PL_get_chars(t, &s, CVT_ATOM | CVT_STRING | CVT_LIST | BUF_DISCARDABLE |
|
||||
REP_UTF8)) {
|
||||
@ -782,7 +781,7 @@ static SEXP list_to_sexp(term_t t, int objtype) {
|
||||
|
||||
static int slot_to_sexp(term_t t, SEXP *ansP) {
|
||||
term_t tslot = PL_new_term_ref();
|
||||
char *s;
|
||||
char *s = NULL;
|
||||
SEXP tmp_R, name_R;
|
||||
int nprotect = 0;
|
||||
|
||||
@ -814,7 +813,7 @@ static int slot_to_sexp(term_t t, SEXP *ansP) {
|
||||
|
||||
static int set_slot_to_sexp(term_t t, SEXP sexp) {
|
||||
term_t tslot = PL_new_term_ref();
|
||||
char *s;
|
||||
char *s = NULL;
|
||||
SEXP tmp_R, name_R;
|
||||
int nprotect = 0;
|
||||
|
||||
@ -845,7 +844,7 @@ static int set_slot_to_sexp(term_t t, SEXP sexp) {
|
||||
|
||||
static int listEl_to_sexp(term_t t, SEXP *ansP) {
|
||||
term_t tslot = PL_new_term_ref();
|
||||
char *s;
|
||||
char *s = NULL;
|
||||
SEXP tmp_R;
|
||||
int nprotect = 0;
|
||||
|
||||
@ -876,7 +875,7 @@ static SEXP pl_to_func(term_t t, bool eval) {
|
||||
term_t a1 = PL_new_term_ref(), a;
|
||||
int i, ierror;
|
||||
SEXP c_R, call_R, res_R;
|
||||
char *sf;
|
||||
char *sf = NULL;
|
||||
int nprotect = 0;
|
||||
|
||||
if (!PL_get_name_arity(t, &name, &arity)) {
|
||||
@ -2028,7 +2027,7 @@ static foreign_t send_c_vector(term_t tvec, term_t tout) {
|
||||
}
|
||||
|
||||
static foreign_t rexpr_to_pl_term(term_t in, term_t out) {
|
||||
char *s;
|
||||
char *s = NULL;
|
||||
|
||||
if (PL_get_chars(in, &s, CVT_ALL | BUF_MALLOC | REP_UTF8)) {
|
||||
SEXP sexp;
|
||||
@ -2050,7 +2049,7 @@ static foreign_t rexpr_to_pl_term(term_t in, term_t out) {
|
||||
}
|
||||
|
||||
static foreign_t robj_to_pl_term(term_t name, term_t out) {
|
||||
char *plname;
|
||||
char *plname = NULL;
|
||||
int nprotect = 0;
|
||||
|
||||
if (PL_get_chars(name, &plname, CVT_ALL | BUF_DISCARDABLE | REP_UTF8)) {
|
||||
@ -2141,7 +2140,7 @@ static foreign_t execute_R(term_t rvar, term_t value) {
|
||||
|
||||
static foreign_t is_R_variable(term_t t) {
|
||||
SEXP name, o;
|
||||
char *s;
|
||||
char *s = NULL;
|
||||
int nprotect = 0;
|
||||
|
||||
/* is this variable defined in R?. */
|
||||
|
@ -40,7 +40,7 @@ static VFS_t *andstream;
|
||||
static std::string buff0;
|
||||
|
||||
static void *
|
||||
and_open(struct vfs *me, int sno, const char *name, const char *io_mode) {
|
||||
and_open(struct vfs *me, const char *name, const char *io_mode, int sno) {
|
||||
// we assume object is already open, so there is no need to open it.
|
||||
GLOBAL_Stream[sno].vfs_handle = streamerInstance;
|
||||
GLOBAL_Stream[sno].vfs = me;
|
||||
|
@ -226,7 +226,7 @@ absolute_file_name(File0,File) :-
|
||||
'$find_in_path'(user_output,_,user_ouput, _, _) :- !.
|
||||
'$find_in_path'(user_error,_,user_error, _, _) :- !.
|
||||
'$find_in_path'(Name, Opts, File, _, First) :-
|
||||
% ( atom(Name) -> true ; start_low_level_trace ),
|
||||
% ( atom(Name) -> true ; start_low_level_trace ),
|
||||
get_abs_file_parameter( file_type, Opts, Type ),
|
||||
get_abs_file_parameter( access, Opts, Access ),
|
||||
get_abs_file_parameter( expand, Opts, Expand ),
|
||||
|
10
pl/boot.yap
10
pl/boot.yap
@ -202,6 +202,7 @@ print_message(L,E) :-
|
||||
|
||||
|
||||
:- c_compile('directives.yap').
|
||||
:- c_compile('init.yap').
|
||||
|
||||
'$command'(C,VL,Pos,Con) :-
|
||||
current_prolog_flag(strict_iso, true), !, /* strict_iso on */
|
||||
@ -223,8 +224,6 @@ print_message(L,E) :-
|
||||
:- c_compile('arith.yap').
|
||||
%:- stop_low_level_trace.
|
||||
|
||||
:- '$init_prolog'.
|
||||
|
||||
:- compile_expressions.
|
||||
|
||||
|
||||
@ -251,9 +250,8 @@ initialize_prolog :-
|
||||
:- c_compile( 'preds.yap' ).
|
||||
:- c_compile( 'modules.yap' ).
|
||||
:- c_compile( 'grammar.yap' ).
|
||||
:- ['absf.yap'].
|
||||
|
||||
%:- start_low_level_trace.
|
||||
:- ['absf.yap'].
|
||||
|
||||
:- use_module('error.yap').
|
||||
|
||||
@ -306,6 +304,8 @@ initialize_prolog :-
|
||||
|
||||
:- ['protect.yap'].
|
||||
|
||||
:- stop_low_level_trace.
|
||||
|
||||
version(yap,[6,3]).
|
||||
|
||||
:- op(1150,fx,(mode)).
|
||||
@ -445,7 +445,7 @@ modules defining clauses for it too.
|
||||
|
||||
|
||||
Dynamic predicate, normally not defined. Called by the Prolog system on run-time exceptions that can be repaired `just-in-time`. The values for _Exception_ are described below. See also catch/3 and throw/1.
|
||||
If this hook predicate succeeds it must instantiate the _Action_ argument to the atom `fail` to make the operation fail silently, `retry` to tell Prolog to retry the operation or `error` to make the system generate an exception. The action `retry` only makes sense if this hook modified the environment such that the operation can now succeed without error.
|
||||
If this hook preodicate succeeds it must instantiate the _Action_ argument to the atom `fail` to make the operation fail silently, `retry` to tell Prolog to retry the operation or `error` to make the system generate an exception. The action `retry` only makes sense if this hook modified the environment such that the operation can now succeed without error.
|
||||
|
||||
+ `undefined_predicate`
|
||||
_Context_ is instantiated to a predicate-indicator ( _Module:Name/Arity_). If the predicate fails Prolog will generate an existence_error exception. The hook is intended to implement alternatives to the SWI built-in autoloader, such as autoloading code from a database. Do not use this hook to suppress existence errors on predicates. See also `unknown`.
|
||||
|
@ -428,12 +428,18 @@ load_files(Files,Opts) :-
|
||||
'$lf'(Fs, Mod, Call, TOpts), fail;
|
||||
true
|
||||
).
|
||||
'$lf'(user, Mod, _, TOpts) :- !,
|
||||
b_setval('$user_source_file', user),
|
||||
'$do_lf'(Mod, user_input, user_input, user_input, TOpts).
|
||||
'$lf'(user_input, Mod, _, TOpts) :- !,
|
||||
b_setval('$user_source_file', user_input),
|
||||
'$do_lf'(Mod, user_input, user_input, user_input, TOpts).
|
||||
'$lf'(user, Mod, Call, TOpts) :-
|
||||
!,
|
||||
stream_property( S, alias( user_input )),
|
||||
'$set_lf_opt'('$from_stream', TOpts, true),
|
||||
'$set_lf_opt'( stream , TOpts, S),
|
||||
'$lf'(S, Mod, Call, TOpts).
|
||||
'$lf'(user_input, Mod, Call, TOpts ) :-
|
||||
!,
|
||||
stream_property( S, alias( user_input )),
|
||||
'$set_lf_opt'('$from_stream', TOpts, true),
|
||||
'$set_lf_opt'( stream , TOpts, S),
|
||||
'$lf'(S, Mod, Call, TOpts).
|
||||
'$lf'(File, Mod, Call, TOpts) :-
|
||||
'$lf_opt'(stream, TOpts, Stream),
|
||||
b_setval('$user_source_file', File),
|
||||
@ -453,7 +459,7 @@ load_files(Files,Opts) :-
|
||||
'$start_lf'(If, Mod, Stream, TOpts, File, Y, Reexport, Imports),
|
||||
close(Stream).
|
||||
|
||||
% consulting from a stre
|
||||
% consulting from a stream
|
||||
'$start_lf'(_not_loaded, Mod, Stream, TOpts, UserFile, File, _Reexport, _Imports) :-
|
||||
'$lf_opt'('$from_stream', TOpts, true ),
|
||||
!,
|
||||
@ -650,7 +656,7 @@ db_files(Fs) :-
|
||||
'$load_files'(Fs, [consult(db), if(not_loaded)], exo_files(Fs)).
|
||||
|
||||
|
||||
'$csult'(Fs, M) :-
|
||||
'$csult'(Fs, _M) :-
|
||||
'$skip_list'(_, Fs ,L),
|
||||
L \== [],
|
||||
user:dot_qualified_goal(Fs),
|
||||
@ -660,7 +666,7 @@ db_files(Fs) :-
|
||||
'$load_files'(M:MFs,[],[M:Fs]).
|
||||
'$csult'(Fs, M) :-
|
||||
'$load_files'(M:Fs,[consult(consult)],[M:Fs]).
|
||||
|
||||
|
||||
'$extract_minus'([], []).
|
||||
'$extract_minus'([-F|Fs], [F|MFs]) :-
|
||||
'$extract_minus'(Fs, MFs).
|
||||
@ -1632,7 +1638,7 @@ End of conditional compilation.
|
||||
|
||||
consult_depth(LV) :- '$show_consult_level'(LV).
|
||||
|
||||
:- '$add_multifile'(Name,Arity,Module).
|
||||
:- '$add_multifile'(dot_qualified_goal,2,user).
|
||||
|
||||
/**
|
||||
@}
|
||||
|
185
pl/init.yap
185
pl/init.yap
@ -15,3 +15,188 @@
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
|
||||
'$init_globals' :-
|
||||
% set_prolog_flag(break_level, 0),
|
||||
% '$set_read_error_handler'(error), let the user do that
|
||||
nb_setval('$chr_toplevel_show_store',false).
|
||||
|
||||
'$init_consult' :-
|
||||
set_value('$open_expands_filename',true),
|
||||
nb_setval('$assert_all',off),
|
||||
nb_setval('$if_level',0),
|
||||
nb_setval('$endif',off),
|
||||
nb_setval('$initialization_goals',off),
|
||||
nb_setval('$included_file',[]),
|
||||
nb_setval('$loop_streams',[]),
|
||||
\+ '$undefined'('$init_preds',prolog),
|
||||
'$init_preds',
|
||||
fail.
|
||||
'$init_consult'.
|
||||
|
||||
'$init_win_graphics' :-
|
||||
'$undefined'(window_title(_,_), system), !.
|
||||
'$init_win_graphics' :-
|
||||
load_files([library(win_menu)], [silent(true),if(not_loaded)]),
|
||||
fail.
|
||||
'$init_win_graphics'.
|
||||
|
||||
'$init_or_threads' :-
|
||||
'$c_yapor_workers'(W), !,
|
||||
'$start_orp_threads'(W).
|
||||
'$init_or_threads'.
|
||||
|
||||
'$start_orp_threads'(1) :- !.
|
||||
'$start_orp_threads'(W) :-
|
||||
thread_create('$c_worker',_,[detached(true)]),
|
||||
W1 is W-1,
|
||||
'$start_orp_threads'(W1).
|
||||
|
||||
'$version' :-
|
||||
current_prolog_flag(verbose, normal), !,
|
||||
current_prolog_flag(version_git,VersionGit),
|
||||
current_prolog_flag(compiled_at,AT),
|
||||
current_prolog_flag(version_data, yap(Mj, Mi, Patch, _) ),
|
||||
sub_atom( VersionGit, 0, 8, _, VERSIONGIT ),
|
||||
current_prolog_flag(version_data, yap(Mj, Mi, Patch, _) ),
|
||||
current_prolog_flag(resource_database, Saved ),
|
||||
format(user_error, '% YAP ~d.~d.~d-~a (compiled ~a)~n', [Mj,Mi, Patch, VERSIONGIT, AT]),
|
||||
format(user_error, '% database loaded from ~a~n', [Saved]).
|
||||
'$version'.
|
||||
|
||||
/**
|
||||
* Initialise a Prolog engine.
|
||||
*
|
||||
* Must be called after restoring.
|
||||
*/
|
||||
'$init_prolog' :-
|
||||
% do catch as early as possible
|
||||
'$version',
|
||||
yap_flag(file_name_variables, _OldF, true),
|
||||
'$init_consult',
|
||||
%set_prolog_flag(file_name_variables, OldF),
|
||||
'$init_globals',
|
||||
set_prolog_flag(fileerrors, true),
|
||||
set_value('$gc',on),
|
||||
('$exit_undefp' -> true ; true),
|
||||
prompt1(' ?- '),
|
||||
set_prolog_flag(debug, false),
|
||||
% simple trick to find out if this is we are booting from Prolog.
|
||||
% boot from a saved state
|
||||
'$init_from_saved_state_and_args', %start_low_level_trace,
|
||||
|
||||
'$db_clean_queues'(0),
|
||||
% this must be executed from C-code.
|
||||
% '$startup_saved_state',
|
||||
set_input(user_input),
|
||||
set_output(user_output),
|
||||
'$init_or_threads',
|
||||
'$run_at_thread_start'.
|
||||
|
||||
|
||||
% then we can execute the programs.
|
||||
'$startup_goals' :-
|
||||
module(user),
|
||||
fail.
|
||||
'$startup_goals' :-
|
||||
recorded('$startup_goal',G,_),
|
||||
catch(once(user:G),Error,user:'$Error'(Error)),
|
||||
fail.
|
||||
'$startup_goals' :-
|
||||
get_value('$init_goal',GA),
|
||||
GA \= [],
|
||||
set_value('$init_goal',[]),
|
||||
'$run_atom_goal'(GA),
|
||||
fail.
|
||||
'$startup_goals' :-
|
||||
recorded('$restore_flag', goal(Module:GA), R),
|
||||
erase(R),
|
||||
catch(once(Module:GA),Error,user:'$Error'(Error)),
|
||||
fail.
|
||||
'$startup_goals' :-
|
||||
get_value('$myddas_goal',GA), GA \= [],
|
||||
set_value('$myddas_goal',[]),
|
||||
get_value('$myddas_user',User), User \= [],
|
||||
set_value('$myddas_user',[]),
|
||||
get_value('$myddas_db',Db), Db \= [],
|
||||
set_value('$myddas_db',[]),
|
||||
get_value('$myddas_host',HostT),
|
||||
( HostT \= [] ->
|
||||
Host = HostT,
|
||||
set_value('$myddas_host',[])
|
||||
;
|
||||
Host = localhost
|
||||
),
|
||||
get_value('$myddas_pass',PassT),
|
||||
( PassT \= [] ->
|
||||
Pass = PassT,
|
||||
set_value('$myddas_pass',[])
|
||||
;
|
||||
Pass = ''
|
||||
),
|
||||
use_module(library(myddas)),
|
||||
call(db_open(mysql,myddas,Host/Db,User,Pass)),
|
||||
'$myddas_import_all',
|
||||
fail.
|
||||
'$startup_goals'.
|
||||
|
||||
%
|
||||
% MYDDAS: Import all the tables from one database
|
||||
%
|
||||
|
||||
'$myddas_import_all':-
|
||||
call(db_my_show_tables(myddas,table(Table))),
|
||||
call(db_import(myddas,Table,Table)),
|
||||
fail.
|
||||
'$myddas_import_all'.
|
||||
|
||||
% use if we come from a save_program and we have SWI's shlib
|
||||
'$init_from_saved_state_and_args' :-
|
||||
current_prolog_flag(hwnd, _HWND),
|
||||
load_files(library(win_menu), [silent(true)]),
|
||||
fail.
|
||||
'$init_from_saved_state_and_args' :-
|
||||
recorded('$reload_foreign_libraries',_G,R),
|
||||
erase(R),
|
||||
shlib:reload_foreign_libraries,
|
||||
fail.
|
||||
% this should be done before -l kicks in.
|
||||
'$init_from_saved_state_and_args' :-
|
||||
current_prolog_flag(fast_boot, false),
|
||||
( exists('~/.yaprc') -> load_files('~/.yaprc', []) ; true ),
|
||||
( exists('~/.prologrc') -> load_files('~/.prologrc', []) ; true ),
|
||||
( exists('~/prolog.ini') -> load_files('~/prolog.ini', []) ; true ),
|
||||
fail.
|
||||
% use if we come from a save_program and we have a goal to execute
|
||||
'$init_from_saved_state_and_args' :-
|
||||
get_value('$consult_on_boot',X), X \= [],
|
||||
set_value('$consult_on_boot',[]),
|
||||
'$do_startup_reconsult'(X),
|
||||
fail.
|
||||
'$init_from_saved_state_and_args' :-
|
||||
recorded('$restore_flag', init_file(M:B), R),
|
||||
erase(R),
|
||||
'$do_startup_reconsult'(M:B),
|
||||
fail.
|
||||
'$init_from_saved_state_and_args' :-
|
||||
recorded('$restore_flag', unknown(M:B), R),
|
||||
erase(R),
|
||||
yap_flag(M:unknown,B),
|
||||
fail.
|
||||
'$init_from_saved_state_and_args' :-
|
||||
'$startup_goals',
|
||||
fail.
|
||||
'$init_from_saved_state_and_args' :-
|
||||
recorded('$restore_goal',G,R),
|
||||
erase(R),
|
||||
prompt(_,'| '),
|
||||
catch(once(user:G),Error,user:'$Error'(Error)),
|
||||
fail.
|
||||
|
||||
'$init_path_extensions' :-
|
||||
get_value('$extend_file_search_path',P), !,
|
||||
P \= [],
|
||||
set_value('$extend_file_search_path',[]),
|
||||
'$extend_file_search_path'(P).
|
||||
'$init_path_extensions'.
|
||||
|
||||
|
154
pl/qly.yap
154
pl/qly.yap
@ -241,161 +241,7 @@ qend_program :-
|
||||
X \= os_argv,
|
||||
X \= language,
|
||||
X \= encoding.
|
||||
|
||||
'$init_state' :-
|
||||
(
|
||||
recorded('$program_state', _P, R)
|
||||
->
|
||||
erase(R),
|
||||
'$do_init_state'
|
||||
;
|
||||
true
|
||||
).
|
||||
|
||||
'$do_init_state' :-
|
||||
'$undefp_handler'('$undefp'(_,_), prolog),
|
||||
fail.
|
||||
'$do_init_state' :-
|
||||
set_value('$user_module',user),
|
||||
'$protect',
|
||||
fail.
|
||||
'$do_init_state' :-
|
||||
compile_expressions,
|
||||
'$init_preds',
|
||||
fail.
|
||||
'$do_init_state' :-
|
||||
recorded('$program_state',L,R),
|
||||
erase(R),
|
||||
lists:member(F-V,L),
|
||||
catch(yap_flag(F,V),Error,user:'$Error'(Error)),
|
||||
fail.
|
||||
'$do_init_state' :-
|
||||
'$reinit_thread0',
|
||||
fail.
|
||||
'$do_init_state' :-
|
||||
'$current_module'(prolog),
|
||||
module(user),
|
||||
fail.
|
||||
'$do_init_state' :-
|
||||
'$init_from_saved_state_and_args',
|
||||
fail.
|
||||
'$do_init_state' :-
|
||||
stream_property(user_input, tty(true)),
|
||||
set_prolog_flag(readline, true).
|
||||
'$do_init_state'.
|
||||
|
||||
%
|
||||
% first, recover what we need from the saved state...
|
||||
%'
|
||||
'$init_from_saved_state_and_args' :-
|
||||
'$init_path_extensions',
|
||||
fail.
|
||||
% use if we come from a save_program and we have SWI's shlib
|
||||
'$init_from_saved_state_and_args' :-
|
||||
current_prolog_flag(hwnd, _HWND),
|
||||
load_files(library(win_menu), [silent(true)]),
|
||||
fail.
|
||||
'$init_from_saved_state_and_args' :-
|
||||
recorded('$reload_foreign_libraries',_G,R),
|
||||
erase(R),
|
||||
shlib:reload_foreign_libraries,
|
||||
fail.
|
||||
% this should be done before -l kicks in.
|
||||
'$init_from_saved_state_and_args' :-
|
||||
current_prolog_flag(fast_boot, false),
|
||||
( exists('~/.yaprc') -> load_files('~/.yaprc', []) ; true ),
|
||||
( exists('~/.prologrc') -> load_files('~/.prologrc', []) ; true ),
|
||||
( exists('~/prolog.ini') -> load_files('~/prolog.ini', []) ; true ),
|
||||
fail.
|
||||
% use if we come from a save_program and we have a goal to execute
|
||||
'$init_from_saved_state_and_args' :-
|
||||
get_value('$consult_on_boot',X), X \= [],
|
||||
set_value('$consult_on_boot',[]),
|
||||
'$do_startup_reconsult'(X),
|
||||
fail.
|
||||
'$init_from_saved_state_and_args' :-
|
||||
recorded('$restore_flag', init_file(M:B), R),
|
||||
erase(R),
|
||||
'$do_startup_reconsult'(M:B),
|
||||
fail.
|
||||
'$init_from_saved_state_and_args' :-
|
||||
recorded('$restore_flag', unknown(M:B), R),
|
||||
erase(R),
|
||||
yap_flag(M:unknown,B),
|
||||
fail.
|
||||
'$init_from_saved_state_and_args' :-
|
||||
'$startup_goals',
|
||||
fail.
|
||||
'$init_from_saved_state_and_args' :-
|
||||
recorded('$restore_goal',G,R),
|
||||
erase(R),
|
||||
prompt(_,'| '),
|
||||
catch(once(user:G),Error,user:'$Error'(Error)),
|
||||
fail.
|
||||
'$init_from_saved_state_and_args'.
|
||||
|
||||
'$init_path_extensions' :-
|
||||
get_value('$extend_file_search_path',P), !,
|
||||
P \= [],
|
||||
set_value('$extend_file_search_path',[]),
|
||||
'$extend_file_search_path'(P).
|
||||
'$init_path_extensions'.
|
||||
|
||||
% then we can execute the programs.
|
||||
'$startup_goals' :-
|
||||
module(user),
|
||||
fail.
|
||||
'$startup_goals' :-
|
||||
recorded('$startup_goal',G,_),
|
||||
catch(once(user:G),Error,user:'$Error'(Error)),
|
||||
fail.
|
||||
'$startup_goals' :-
|
||||
get_value('$init_goal',GA),
|
||||
GA \= [],
|
||||
set_value('$init_goal',[]),
|
||||
'$run_atom_goal'(GA),
|
||||
fail.
|
||||
'$startup_goals' :-
|
||||
recorded('$restore_flag', goal(Module:GA), R),
|
||||
erase(R),
|
||||
catch(once(Module:GA),Error,user:'$Error'(Error)),
|
||||
fail.
|
||||
'$startup_goals' :-
|
||||
get_value('$myddas_goal',GA), GA \= [],
|
||||
set_value('$myddas_goal',[]),
|
||||
get_value('$myddas_user',User), User \= [],
|
||||
set_value('$myddas_user',[]),
|
||||
get_value('$myddas_db',Db), Db \= [],
|
||||
set_value('$myddas_db',[]),
|
||||
get_value('$myddas_host',HostT),
|
||||
( HostT \= [] ->
|
||||
Host = HostT,
|
||||
set_value('$myddas_host',[])
|
||||
;
|
||||
Host = localhost
|
||||
),
|
||||
get_value('$myddas_pass',PassT),
|
||||
( PassT \= [] ->
|
||||
Pass = PassT,
|
||||
set_value('$myddas_pass',[])
|
||||
;
|
||||
Pass = ''
|
||||
),
|
||||
use_module(library(myddas)),
|
||||
call(db_open(mysql,myddas,Host/Db,User,Pass)),
|
||||
'$myddas_import_all',
|
||||
fail.
|
||||
'$startup_goals'.
|
||||
|
||||
%
|
||||
% MYDDAS: Import all the tables from one database
|
||||
%
|
||||
|
||||
'$myddas_import_all':-
|
||||
call(db_my_show_tables(myddas,table(Table))),
|
||||
call(db_import(myddas,Table,Table)),
|
||||
fail.
|
||||
'$myddas_import_all'.
|
||||
|
||||
qsave_file(F0) :-
|
||||
ensure_loaded( F0 ),
|
||||
|
92
pl/top.yap
92
pl/top.yap
@ -11,84 +11,6 @@ live :- '$live'.
|
||||
),
|
||||
'$system_catch'('$enter_top_level',Module,Error,'$Error'(Error)).
|
||||
|
||||
'$init_globals' :-
|
||||
% set_prolog_flag(break_level, 0),
|
||||
% '$set_read_error_handler'(error), let the user do that
|
||||
nb_setval('$chr_toplevel_show_store',false).
|
||||
|
||||
'$init_consult' :-
|
||||
set_value('$open_expands_filename',true),
|
||||
nb_setval('$assert_all',off),
|
||||
nb_setval('$if_level',0),
|
||||
nb_setval('$endif',off),
|
||||
nb_setval('$initialization_goals',off),
|
||||
nb_setval('$included_file',[]),
|
||||
nb_setval('$loop_streams',[]),
|
||||
\+ '$undefined'('$init_preds',prolog),
|
||||
'$init_preds',
|
||||
fail.
|
||||
'$init_consult'.
|
||||
|
||||
'$init_win_graphics' :-
|
||||
'$undefined'(window_title(_,_), system), !.
|
||||
'$init_win_graphics' :-
|
||||
load_files([library(win_menu)], [silent(true),if(not_loaded)]),
|
||||
fail.
|
||||
'$init_win_graphics'.
|
||||
|
||||
'$init_or_threads' :-
|
||||
'$c_yapor_workers'(W), !,
|
||||
'$start_orp_threads'(W).
|
||||
'$init_or_threads'.
|
||||
|
||||
'$start_orp_threads'(1) :- !.
|
||||
'$start_orp_threads'(W) :-
|
||||
thread_create('$c_worker',_,[detached(true)]),
|
||||
W1 is W-1,
|
||||
'$start_orp_threads'(W1).
|
||||
|
||||
'$version' :-
|
||||
current_prolog_flag(halt_after_consult, false),
|
||||
current_prolog_flag(verbose, normal), !,
|
||||
current_prolog_flag(version_git,VersionGit),
|
||||
current_prolog_flag(compiled_at,AT),
|
||||
current_prolog_flag(version_data, yap(Mj, Mi, Patch, _) ),
|
||||
sub_atom( VersionGit, 0, 8, _, VERSIONGIT ),
|
||||
current_prolog_flag(version_data, yap(Mj, Mi, Patch, _) ),
|
||||
current_prolog_flag(resource_database, Saved ),
|
||||
format(user_error, '% YAP ~d.~d.~d-~a (compiled ~a)~n', [Mj,Mi, Patch, VERSIONGIT, AT]),
|
||||
format(user_error, '% database loaded from ~a~n', [Saved]).
|
||||
|
||||
'$init_prolog' :-
|
||||
% do catch as early as possible
|
||||
'$version',
|
||||
yap_flag(file_name_variables, _OldF, true),
|
||||
'$init_consult',
|
||||
%set_prolog_flag(file_name_variables, OldF),
|
||||
'$init_globals',
|
||||
set_prolog_flag(fileerrors, true),
|
||||
set_value('$gc',on),
|
||||
('$exit_undefp' -> true ; true),
|
||||
prompt1(' ?- '),
|
||||
set_prolog_flag(debug, false),
|
||||
% simple trick to find out if this is we are booting from Prolog.
|
||||
% boot from a saved state
|
||||
(
|
||||
current_prolog_flag(saved_program, true)
|
||||
% use saved state
|
||||
->
|
||||
'$init_state'
|
||||
;
|
||||
true
|
||||
),
|
||||
'$db_clean_queues'(0),
|
||||
% this must be executed from C-code.
|
||||
% '$startup_saved_state',
|
||||
set_input(user_input),
|
||||
set_output(user_output),
|
||||
'$init_or_threads',
|
||||
'$run_at_thread_start'.
|
||||
|
||||
% Start file for yap
|
||||
|
||||
/* I/O predicates */
|
||||
@ -135,13 +57,13 @@ live :- '$live'.
|
||||
fail.
|
||||
'$enter_top_level' :-
|
||||
flush_output,
|
||||
'$run_toplevel_hooks',
|
||||
prompt1(' ?- '),
|
||||
'$read_toplevel'(Command,Varnames,Pos),
|
||||
nb_setval('$spy_gn',1),
|
||||
% stop at spy-points if debugging is on.
|
||||
nb_setval('$debug_run',off),
|
||||
nb_setval('$debug_jump',off),
|
||||
'$run_toplevel_hooks',
|
||||
prompt1(' ?- '),
|
||||
'$read_toplevel'(Command,Varnames,Pos),
|
||||
nb_setval('$spy_gn',1),
|
||||
% stop at spy-points if debugging is on.
|
||||
nb_setval('$debug_run',off),
|
||||
nb_setval('$debug_jump',off),
|
||||
'$command'(Command,Varnames,Pos,top),
|
||||
current_prolog_flag(break_level, BreakLevel),
|
||||
(
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
:- use_module(library(lists)).
|
||||
|
||||
|
||||
@ -13,4 +13,3 @@ given user:goal_expansion(a(X,Y), m, Y is X*X ))
|
||||
|
||||
test m:a(3,X) returns X =@= 9
|
||||
given user:goal_expansion(a(X,Y), m, Y is X*X ), user:goal_expansion(a(X), X is 3*5)
|
||||
|
||||
|
Reference in New Issue
Block a user