SWI flags compat
This commit is contained in:
parent
35b7f040d5
commit
1cbe82da1e
@ -29,8 +29,8 @@ static char SccsId[] = "%W% %G%.2";
|
||||
#include "Foreign.h"
|
||||
|
||||
#if _WIN32 || defined(__CYGWIN__)
|
||||
#ifndef YAP_SHLIB_SUFFIX
|
||||
#define YAP_SHLIB_SUFFIX ".dll"
|
||||
#ifndef SO_EXT
|
||||
#define SO_EXT ".dll"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -210,12 +210,12 @@ p_call_shared_object_function( USES_REGS1 ) {
|
||||
|
||||
static Int
|
||||
p_obj_suffix( USES_REGS1 ) {
|
||||
return Yap_unify(Yap_StringToList(YAP_SHLIB_SUFFIX),ARG1);
|
||||
return Yap_unify(Yap_StringToList(SO_EXT),ARG1);
|
||||
}
|
||||
|
||||
static Int
|
||||
p_open_shared_objects( USES_REGS1 ) {
|
||||
#ifdef YAP_SHLIB_SUFFIX
|
||||
#ifdef SO_EXT
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
|
@ -131,10 +131,10 @@ add_end_dot(char arg[])
|
||||
static int
|
||||
dump_runtime_variables(void)
|
||||
{
|
||||
fprintf(stdout,"CC=\"%s\"\n",YAP_CC);
|
||||
fprintf(stdout,"CC=\"%s\"\n",C_CC);
|
||||
fprintf(stdout,"YAP_ROOTDIR=\"%s\"\n",YAP_ROOTDIR);
|
||||
fprintf(stdout,"YAP_LIBS=\"%s\"\n",YAP_LIBS);
|
||||
fprintf(stdout,"YAP_SHLIB_SUFFIX=\"%s\"\n",YAP_SHLIB_SUFFIX);
|
||||
fprintf(stdout,"YAP_LIBS=\"%s\"\n",C_LIBS);
|
||||
fprintf(stdout,"YAP_SHLIB_SUFFIX=\"%s\"\n",SO_EXT);
|
||||
fprintf(stdout,"YAP_VERSION=%d\n",YAP_VERSION);
|
||||
exit(0);
|
||||
return 1;
|
||||
|
22
Makefile.in
22
Makefile.in
@ -74,6 +74,7 @@ AWK=@AWK@
|
||||
CPP=@CPP@
|
||||
DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1
|
||||
LIBS=@LIBS@
|
||||
DLL_LIBS=@LIBS@ @EXTRA_LIBS_FOR_DLLS@
|
||||
LDFLAGS=@LDFLAGS@
|
||||
LN_S=@LN_S@
|
||||
M4=@M4@
|
||||
@ -276,8 +277,8 @@ C_SOURCES= \
|
||||
$(srcdir)/OPTYap/or.thread_engine.c \
|
||||
$(srcdir)/OPTYap/or.scheduler.c $(srcdir)/OPTYap/or.cut.c \
|
||||
$(srcdir)/OPTYap/tab.tries.c $(srcdir)/OPTYap/tab.completion.c \
|
||||
$(srcdir)/library/mpi/mpi.c $(srcdir)/library/mpi/mpe.c \
|
||||
$(srcdir)/library/lammpi/yap_mpi.c $(srcdir)/library/lammpi/hash.c $(srcdir)/library/lammpi/prologterms2c.c \
|
||||
# $(srcdir)/library/mpi/mpi.c $(srcdir)/library/mpi/mpe.c \
|
||||
# $(srcdir)/library/lammpi/yap_mpi.c $(srcdir)/library/lammpi/hash.c $(srcdir)/library/lammpi/prologterms2c.c \
|
||||
$(srcdir)/C/cut_c.c \
|
||||
$(srcdir)/library/dialect/swi/fli/swi.c \
|
||||
$(srcdir)/library/dialect/swi/fli/blobs.c \
|
||||
@ -431,12 +432,13 @@ parms.h: Makefile
|
||||
@echo $(VERSION) | $(AWK) -F. '{ printf("#define YAP_VERSION %d\n", $$1 * 10000 + $$2 * 100 + $$3); }' >> $@%
|
||||
@echo "#define MYDDAS_VERSION \"$(MYDDAS_VERSION)\"" >> $@%
|
||||
@echo "#define YAP_ARCH \"$(ARCH)\"" >> $@%
|
||||
@echo "#define YAP_LIBS \"$(LIBS)\"" >> $@%
|
||||
@echo "#define C_LIBS \"$(LIBS)\"" >> $@%
|
||||
@echo "#define C_LIBPLSO \"$(DLL_LIBS)\"" >> $@%
|
||||
@echo "#define YAP_YAPLIB \"$(YAPLIB)\"" >> $@%
|
||||
@echo "#define YAP_CC \"$(CC)\"" >> $@%
|
||||
@echo "#define YAP_CFLAGS \"$(CFLAGS)\"" >> $@%
|
||||
@echo "#define YAP_LDFLAGS \"$(LDFLAGS)\"" >> $@%
|
||||
@echo "#define YAP_SHLIB_SUFFIX \".\" \"$(SO)\"" >> $@%
|
||||
@echo "#define C_CC \"$(CC)\"" >> $@%
|
||||
@echo "#define C_CFLAGS \"$(CFLAGS)\"" >> $@%
|
||||
@echo "#define C_LDFLAGS \"$(LDFLAGS)\"" >> $@%
|
||||
@echo "#define SO_EXT \".\" \"$(SO)\"" >> $@%
|
||||
@echo "#define YAP_TIMESTAMP \"`date +%s`\"" >> $@%
|
||||
@echo "#define YAP_SVERSION \"YAP $(VERSION) ($(ARCH)): `date`\"" >> $@%
|
||||
@if cmp -s $@% $@; then rm $@%; else mv $@% $@; fi
|
||||
@ -696,7 +698,7 @@ mycb: $(srcdir)/mycb.c
|
||||
|
||||
all: startup.yss
|
||||
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd library/gecode; $(MAKE))
|
||||
@INSTALL_DLLS@ (cd library/lammpi; $(MAKE))
|
||||
@INSTALL_MPI@ (cd library/lammpi; $(MAKE))
|
||||
@INSTALL_MATLAB@ (cd library/matlab; $(MAKE))
|
||||
@INSTALL_DLLS@ (cd library/matrix; $(MAKE))
|
||||
@INSTALL_DLLS@ (cd library/random; $(MAKE))
|
||||
@ -772,7 +774,7 @@ install_unix: startup.yss libYap.a
|
||||
$(INSTALL) $(srcdir)/README $(DESTDIR)$(DOCSDIR)
|
||||
$(INSTALL) $(srcdir)/COPYING $(DESTDIR)$(DOCSDIR)
|
||||
for f in $(PL_SOURCES); do $(INSTALL) $$f $(DESTDIR)$(SHAREDIR)/Yap/pl; done
|
||||
@INSTALL_DLLS@ (cd library/lammpi; $(MAKE) install)
|
||||
@INSTALL_MPI@ (cd library/lammpi; $(MAKE) install)
|
||||
@INSTALL_DLLS@ (cd library/matrix; $(MAKE) install)
|
||||
@INSTALL_DLLS@ (cd library/random; $(MAKE) install)
|
||||
@INSTALL_DLLS@ (cd library/regex; $(MAKE) install)
|
||||
@ -915,7 +917,7 @@ depend: $(HEADERS) $(C_SOURCES)
|
||||
clean: clean_docs
|
||||
rm -f *.o *~ *.BAK *.a
|
||||
@ENABLE_GECODE@ @INSTALL_DLLS@ (cd library/gecode; $(MAKE) clean)
|
||||
@INSTALL_DLLS@ (cd library/lammpi; $(MAKE) clean)
|
||||
@INSTALL_MPI@ (cd library/lammpi; $(MAKE) clean)
|
||||
@INSTALL_MATLAB@ (cd library/matlab; $(MAKE) clean)
|
||||
@INSTALL_DLLS@ (cd library/matrix; $(MAKE) clean)
|
||||
@INSTALL_DLLS@ (cd library/random; $(MAKE) clean)
|
||||
|
@ -198,6 +198,7 @@
|
||||
#undef HAVE_GETHOSTNAME
|
||||
#undef HAVE_GETHRTIME
|
||||
#undef HAVE_GETPAGESIZE
|
||||
#undef HAVE_GETPID
|
||||
#undef HAVE_GETPWNAM
|
||||
#undef HAVE_GETRUSAGE
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "pl-incl.h"
|
||||
#ifdef __YAP_PROLOG__
|
||||
#include "pl-ctype.h"
|
||||
#include "eval.h"
|
||||
#else
|
||||
#include "os/pl-ctype.h"
|
||||
#endif
|
||||
@ -1049,32 +1050,48 @@ initPrologFlagTable(void)
|
||||
void
|
||||
initPrologFlags(void)
|
||||
{ GET_LD
|
||||
#ifndef __YAP_PROLOG__
|
||||
setPrologFlag("iso", FT_BOOL, FALSE, PLFLAG_ISO);
|
||||
#ifdef __YAP_PROLOG__
|
||||
setPrologFlag("arch", FT_ATOM|FF_READONLY, YAP_ARCH);
|
||||
#else
|
||||
setPrologFlag("arch", FT_ATOM|FF_READONLY, PLARCH);
|
||||
#endif
|
||||
#if __WINDOWS__
|
||||
setPrologFlag("windows", FT_BOOL|FF_READONLY, TRUE, 0);
|
||||
#endif
|
||||
#ifndef __YAP_PROLOG__
|
||||
setPrologFlag("version", FT_INTEGER|FF_READONLY, PLVERSION);
|
||||
setPrologFlag("dialect", FT_ATOM|FF_READONLY, "swi");
|
||||
if ( systemDefaults.home )
|
||||
setPrologFlag("home", FT_ATOM|FF_READONLY, systemDefaults.home);
|
||||
if ( GD->paths.executable )
|
||||
setPrologFlag("executable", FT_ATOM|FF_READONLY, GD->paths.executable);
|
||||
#else
|
||||
setPrologFlag("dialect", FT_ATOM|FF_READONLY, "yap");
|
||||
setPrologFlag("home", FT_ATOM|FF_READONLY, YAP_ROOTDIR);
|
||||
if (GLOBAL_argv && GLOBAL_argv[0]) {
|
||||
Yap_TrueFileName (GLOBAL_argv[0], LOCAL_FileNameBuf, FALSE);
|
||||
setPrologFlag("executable", FT_ATOM|FF_READONLY, LOCAL_FileNameBuf);
|
||||
} else
|
||||
setPrologFlag("executable", FT_ATOM|FF_READONLY, Yap_FindExecutable());
|
||||
#endif
|
||||
#if defined(HAVE_GETPID) || defined(EMULATE_GETPID)
|
||||
setPrologFlag("pid", FT_INTEGER|FF_READONLY, getpid());
|
||||
#endif
|
||||
setPrologFlag("optimise", FT_BOOL, GD->cmdline.optimise, PLFLAG_OPTIMISE);
|
||||
setPrologFlag("generate_debug_info", FT_BOOL,
|
||||
truePrologFlag(PLFLAG_DEBUGINFO), PLFLAG_DEBUGINFO);
|
||||
#ifndef __YAP_PROLOG__
|
||||
setPrologFlag("last_call_optimisation", FT_BOOL, TRUE, PLFLAG_LASTCALL);
|
||||
setPrologFlag("warn_override_implicit_import", FT_BOOL, TRUE,
|
||||
PLFLAG_WARN_OVERRIDE_IMPLICIT_IMPORT);
|
||||
#endif
|
||||
setPrologFlag("c_cc", FT_ATOM, C_CC);
|
||||
setPrologFlag("c_libs", FT_ATOM, C_LIBS);
|
||||
setPrologFlag("c_libplso", FT_ATOM, C_LIBPLSO);
|
||||
setPrologFlag("c_ldflags", FT_ATOM, C_LDFLAGS);
|
||||
setPrologFlag("c_cflags", FT_ATOM, C_CFLAGS);
|
||||
#ifndef __YAP_PROLOG__
|
||||
#if defined(O_LARGEFILES) || SIZEOF_LONG == 8
|
||||
setPrologFlag("large_files", FT_BOOL|FF_READONLY, TRUE, 0);
|
||||
#endif
|
||||
@ -1083,6 +1100,7 @@ initPrologFlags(void)
|
||||
#ifdef O_ATOMGC
|
||||
setPrologFlag("agc_margin",FT_INTEGER, GD->atoms.margin);
|
||||
#endif
|
||||
#endif
|
||||
#if defined(HAVE_DLOPEN) || defined(HAVE_SHL_LOAD) || defined(EMULATE_DLOPEN)
|
||||
setPrologFlag("open_shared_object", FT_BOOL|FF_READONLY, TRUE, 0);
|
||||
setPrologFlag("shared_object_extension", FT_ATOM|FF_READONLY, SO_EXT);
|
||||
@ -1123,8 +1141,13 @@ initPrologFlags(void)
|
||||
setPrologFlag("max_integer", FT_INT64|FF_READONLY, PLMAXINT);
|
||||
setPrologFlag("min_integer", FT_INT64|FF_READONLY, PLMININT);
|
||||
#endif
|
||||
#ifndef __YAP_PROLOG__
|
||||
setPrologFlag("max_tagged_integer", FT_INTEGER|FF_READONLY, PLMAXTAGGEDINT);
|
||||
setPrologFlag("min_tagged_integer", FT_INTEGER|FF_READONLY, PLMINTAGGEDINT);
|
||||
#else
|
||||
setPrologFlag("max_tagged_integer", FT_INTEGER|FF_READONLY, Int_MAX);
|
||||
setPrologFlag("min_tagged_integer", FT_INTEGER|FF_READONLY, Int_MIN);
|
||||
#endif
|
||||
#ifdef O_GMP
|
||||
setPrologFlag("bounded", FT_BOOL|FF_READONLY, FALSE, 0);
|
||||
#ifdef __GNU_MP__
|
||||
@ -1148,6 +1171,7 @@ initPrologFlags(void)
|
||||
setPrologFlag("occurs_check", FT_ATOM, "false");
|
||||
setPrologFlag("access_level", FT_ATOM, "user");
|
||||
setPrologFlag("double_quotes", FT_ATOM, "codes");
|
||||
#ifndef __YAP_PROLOG__
|
||||
setPrologFlag("unknown", FT_ATOM, "error");
|
||||
setPrologFlag("debug", FT_BOOL, FALSE, 0);
|
||||
setPrologFlag("verbose", FT_ATOM|FF_KEEP, GD->options.silent ? "silent" : "normal");
|
||||
@ -1161,6 +1185,7 @@ initPrologFlags(void)
|
||||
setPrologFlag("toplevel_prompt", FT_ATOM, "~m~d~l~! ?- ");
|
||||
setPrologFlag("file_name_variables", FT_BOOL, FALSE, PLFLAG_FILEVARS);
|
||||
setPrologFlag("fileerrors", FT_BOOL, TRUE, PLFLAG_FILEERRORS);
|
||||
#endif
|
||||
#ifdef __unix__
|
||||
setPrologFlag("unix", FT_BOOL|FF_READONLY, TRUE, 0);
|
||||
#endif
|
||||
@ -1184,7 +1209,6 @@ initPrologFlags(void)
|
||||
setPrologFlag("compiled_at", FT_ATOM|FF_READONLY, buf);
|
||||
}
|
||||
#endif
|
||||
#endif /* YAP_PROLOG */
|
||||
/* Flags copied by YAP */
|
||||
setPrologFlag("optimise", FT_BOOL, GD->cmdline.optimise, PLFLAG_OPTIMISE);
|
||||
/* FLAGS used by PLStream */
|
||||
|
@ -997,6 +997,9 @@ atom_to_term(term_t atom, term_t term, term_t bindings)
|
||||
{ GET_LD
|
||||
PL_chars_t txt;
|
||||
|
||||
{ FILE *f=fopen("/home/vsc/coutput.txt", "append");
|
||||
fprintf(f, "IN: %ld\n", bindings);
|
||||
fclose(f); }
|
||||
if ( !bindings && PL_is_variable(atom) ) /* term_to_atom(+, -) */
|
||||
{ char buf[1024];
|
||||
size_t bufsize = sizeof(buf);
|
||||
@ -1015,6 +1018,9 @@ atom_to_term(term_t atom, term_t term, term_t bindings)
|
||||
txt.storage = PL_CHARS_HEAP;
|
||||
txt.encoding = ENC_UTF8;
|
||||
txt.canonical = FALSE;
|
||||
{ FILE *f=fopen("/home/vsc/coutput.txt", "append");
|
||||
fprintf(f, "SUCCESS: %s\n", buf);
|
||||
fclose(f); }
|
||||
rval = PL_unify_text(atom, 0, &txt, PL_ATOM);
|
||||
|
||||
Sclose(stream);
|
||||
|
@ -2255,9 +2255,11 @@ Svsprintf(char *buf, const char *fm, va_list args)
|
||||
int
|
||||
Svdprintf(const char *fm, va_list args)
|
||||
{ int rval;
|
||||
IOSTREAM *s = Serror;
|
||||
IOSTREAM *s = Serror;
|
||||
//IOSTREAM *s = Sopen_file("/home/vsc/cout.txt", "append");
|
||||
|
||||
Slock(s);
|
||||
|
||||
//Slock(s);
|
||||
rval = Svfprintf(s, fm, args);
|
||||
#if defined(_DEBUG) && defined(__WINDOWS__)
|
||||
Sputc('\0', s);
|
||||
@ -2266,7 +2268,8 @@ Svdprintf(const char *fm, va_list args)
|
||||
#endif
|
||||
if ( Sflush(s) != 0 )
|
||||
rval = -1;
|
||||
Sunlock(s);
|
||||
//Sunlock(s);
|
||||
//Sclose(s);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
@ -107,8 +107,25 @@ compile-time
|
||||
simpleMutexUnlock(&(cm)->mutex); \
|
||||
} while(0)
|
||||
|
||||
//#define O_DEBUG_MT
|
||||
#ifdef O_DEBUG_MT
|
||||
#define PL_LOCK(id) \
|
||||
do { Sdprintf("[%d] %s:%d: LOCK(%s)\n", \
|
||||
pthread_self(), \
|
||||
__BASE_FILE__, __LINE__, #id); \
|
||||
countingMutexLock(&_PL_mutexes[id]); \
|
||||
} while(0)
|
||||
#define PL_UNLOCK(id) \
|
||||
do { Sdprintf("[%d] %s:%d: UNLOCK(%s)\n", \
|
||||
pthread_self(), \
|
||||
__BASE_FILE__, __LINE__, #id); \
|
||||
countingMutexUnlock(&_PL_mutexes[id]); \
|
||||
} while(0)
|
||||
#else
|
||||
#define PL_LOCK(id) IF_MT(id, countingMutexLock(&_PL_mutexes[id]))
|
||||
#define PL_UNLOCK(id) IF_MT(id, countingMutexUnlock(&_PL_mutexes[id]))
|
||||
#endif
|
||||
#undef O_DEBUG_MT
|
||||
|
||||
#define IOLOCK recursiveMutex
|
||||
|
||||
|
17
pl/boot.yap
17
pl/boot.yap
@ -94,22 +94,15 @@ true :- true.
|
||||
|
||||
'$init_globals' :-
|
||||
'$init_consult',
|
||||
nb_setval('$chr_toplevel_show_store',false),
|
||||
nb_setval('$break',0),
|
||||
% '$set_read_error_handler'(error), let the user do that
|
||||
nb_setval('$open_expands_filename',true),
|
||||
nb_setval('$trace',off),
|
||||
% '$set_read_error_handler'(error), let the user do that
|
||||
nb_setval('$system_mode',off),
|
||||
nb_setval('$chr_toplevel_show_store',false),
|
||||
nb_setval('$assert_all',off),
|
||||
nb_setval('$if_skip_mode',no_skip),
|
||||
b_setval('$spy_glist',[]),
|
||||
nb_setval('$spy_gn',1),
|
||||
nb_setval('$debug_run',off),
|
||||
nb_setval('$debug_jump',off).
|
||||
nb_setval('$chr_toplevel_show_store',false).
|
||||
|
||||
'$init_consult' :-
|
||||
set_value('$open_expands_filename',true),
|
||||
set_value('$lf_verbose',informational),
|
||||
nb_setval('$assert_all',off),
|
||||
nb_setval('$if_level',0),
|
||||
nb_setval('$endif',off),
|
||||
nb_setval('$consulting_file',[]),
|
||||
@ -1263,7 +1256,7 @@ catch_ball(C, C).
|
||||
'$execute_outside_system_mode'(G2, M, CP)
|
||||
).
|
||||
'$execute_outside_system_mode'(G, M, CP) :-
|
||||
nb_getval('$trace', on), !,
|
||||
'$nb_getval'('$trace', on, fail), !,
|
||||
(
|
||||
'$$save_by'(CP1),
|
||||
'$do_spy'(G, M, CP, meta_creep),
|
||||
|
@ -923,20 +923,20 @@ absolute_file_name(File,Opts,TrueFileName) :-
|
||||
'$get_if'(Level0),
|
||||
Level is Level0 + 1,
|
||||
nb_setval('$if_level',Level),
|
||||
nb_getval('$endif',OldEndif),
|
||||
nb_getval('$if_skip_mode',Mode),
|
||||
'$nb_getval'('$endif', OldEndif, OldEndif=top),
|
||||
'$nb_getval'('$if_skip_mode', Mode, Mode=run),
|
||||
nb_setval('$endif',elif(Level,OldEndif,Mode)),
|
||||
fail.
|
||||
% we are in skip mode, ignore....
|
||||
'$if'(Goal,_) :-
|
||||
nb_getval('$endif',elif(Level, OldEndif, skip)), !,
|
||||
'$nb_getval'('$endif',elif(Level, OldEndif, skip), fail), !,
|
||||
nb_setval('$endif',endif(Level, OldEndif, skip)).
|
||||
% we are in non skip mode, check....
|
||||
'$if'(Goal,_) :-
|
||||
('$if_call'(Goal)
|
||||
->
|
||||
% we will execute this branch, and later enter skip
|
||||
nb_getval('$endif',elif(Level,OldEndif,Mode)),
|
||||
'$nb_getval'('$endif', elif(Level,OldEndif,Mode), fail),
|
||||
nb_setval('$endif',endif(Level,OldEndif,Mode))
|
||||
;
|
||||
% we are now in skip, but can start an elif.
|
||||
|
@ -320,6 +320,7 @@ b_getval(GlobalVariable, Val) :-
|
||||
debugger state */
|
||||
|
||||
break :-
|
||||
'$init_debugger',
|
||||
nb_getval('$system_mode',SystemMode),
|
||||
nb_getval('$trace',Trace),
|
||||
nb_setval('$trace',off),
|
||||
|
25
pl/debug.yap
25
pl/debug.yap
@ -11,7 +11,7 @@
|
||||
* File: debug.pl *
|
||||
* Last rev: *
|
||||
* mods: *
|
||||
* comments: YAP's debugger *
|
||||
* comments: YAP debugger *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
@ -23,6 +23,16 @@
|
||||
|
||||
:- op(900,fx,[spy,nospy]).
|
||||
|
||||
'$init_debugger' :-
|
||||
nb_getval('$trace', _, fail), !.
|
||||
'$init_debugger' :-
|
||||
nb_setval('$trace',off),
|
||||
nb_setval('$if_skip_mode',no_skip),
|
||||
b_setval('$spy_glist',[]),
|
||||
nb_setval('$spy_gn',1),
|
||||
nb_setval('$debug_run',off),
|
||||
nb_setval('$debug_jump',off).
|
||||
|
||||
|
||||
% First part : setting and reseting spy points
|
||||
|
||||
@ -123,6 +133,7 @@
|
||||
recorded('$spy','$spy'(G,M),_), !.
|
||||
|
||||
spy Spec :-
|
||||
'$init_debugger',
|
||||
prolog:debug_action_hook(spy(Spec)), !.
|
||||
spy L :-
|
||||
'$current_module'(M),
|
||||
@ -130,6 +141,7 @@ spy L :-
|
||||
spy _ :- debug.
|
||||
|
||||
nospy Spec :-
|
||||
'$init_debugger',
|
||||
prolog:debug_action_hook(nospy(Spec)), !.
|
||||
nospy L :-
|
||||
'$current_module'(M),
|
||||
@ -137,6 +149,7 @@ nospy L :-
|
||||
nospy _.
|
||||
|
||||
nospyall :-
|
||||
'$init_debugger',
|
||||
prolog:debug_action_hook(nospyall), !.
|
||||
nospyall :-
|
||||
recorded('$spy','$spy'(T,M),_), functor(T,F,N), '$suspy'(F/N,nospy,M), fail.
|
||||
@ -145,6 +158,7 @@ nospyall.
|
||||
% debug mode -> debug flag = 1
|
||||
|
||||
debug :-
|
||||
'$init_debugger',
|
||||
( nb_getval('$spy_gn',L) -> true ; nb_setval('$spy_gn',1) ),
|
||||
'$start_debugging'(on),
|
||||
print_message(informational,debug(debug)).
|
||||
@ -159,6 +173,7 @@ debug :-
|
||||
nb_setval('$debug_jump',false).
|
||||
|
||||
nodebug :-
|
||||
'$init_debugger',
|
||||
'$debug_on'(false),
|
||||
nb_setval('$trace',off),
|
||||
print_message(informational,debug(off)).
|
||||
@ -168,7 +183,8 @@ nodebug :-
|
||||
%
|
||||
|
||||
trace :-
|
||||
nb_getval('$trace',on), !.
|
||||
'$init_debugger',
|
||||
'$nb_getval'('$trace', on, fail), !.
|
||||
trace :-
|
||||
nb_setval('$trace',on),
|
||||
'$start_debugging'(on),
|
||||
@ -176,7 +192,7 @@ trace :-
|
||||
'$meta_creep'.
|
||||
|
||||
'$do_trace' :-
|
||||
nb_getval('$trace',on), !.
|
||||
'$nb_getval'('$trace', on, fail), !.
|
||||
'$do_trace' :-
|
||||
nb_setval('$trace',on),
|
||||
'$start_debugging'(on),
|
||||
@ -184,6 +200,7 @@ trace :-
|
||||
'$creep'.
|
||||
|
||||
notrace :-
|
||||
'$init_debugger',
|
||||
nodebug.
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
@ -196,6 +213,7 @@ notrace :-
|
||||
leash(X) :- var(X),
|
||||
'$do_error'(instantiation_error,leash(X)).
|
||||
leash(X) :-
|
||||
'$init_debugger',
|
||||
'$leashcode'(X,Code),
|
||||
set_value('$leash',Code),
|
||||
'$show_leash'(informational,Code), !.
|
||||
@ -243,6 +261,7 @@ leash(X) :-
|
||||
|
||||
|
||||
debugging :-
|
||||
'$init_debugger',
|
||||
prolog:debug_action_hook(nospyall), !.
|
||||
debugging :-
|
||||
( '$debug_on'(true) ->
|
||||
|
120
pl/flags.yap
120
pl/flags.yap
@ -58,9 +58,6 @@ yap_flag(autoload,false) :-
|
||||
% do or do not machine code
|
||||
yap_flag(argv,L) :- '$argv'(L).
|
||||
|
||||
% do or do not machine code
|
||||
yap_flag(executable,L) :- '$executable'(L).
|
||||
|
||||
% hide/unhide atoms
|
||||
yap_flag(hide,Atom) :- !, hide(Atom).
|
||||
yap_flag(unhide,Atom) :- !, unhide(Atom).
|
||||
@ -212,16 +209,6 @@ yap_flag(associate,X) :-
|
||||
yap_flag(associate,X) :-
|
||||
'$do_error'(type_error(atom,X),associate(X)).
|
||||
|
||||
yap_flag(bounded,X) :-
|
||||
var(X), !,
|
||||
'$access_yap_flags'(0, X1),
|
||||
'$transl_to_true_false'(X1,X).
|
||||
yap_flag(bounded,X) :-
|
||||
(X = true ; X = false), !,
|
||||
'$do_error'(permission_error(modify,flag,bounded),yap_flag(bounded,X)).
|
||||
yap_flag(bounded,X) :-
|
||||
'$do_error'(domain_error(flag_value,bounded+X),yap_flag(bounded,X)).
|
||||
|
||||
% do or do not indexation
|
||||
yap_flag(index,X) :- var(X),
|
||||
'$access_yap_flags'(19, X1),
|
||||
@ -244,9 +231,6 @@ yap_flag(index_sub_term_search_depth,X,X) :-
|
||||
yap_flag(index_sub_term_search_depth,X,X) :-
|
||||
'$do_error'(domain_error(out_of_range,index_sub_term_search_depth+X),yap_flag(index_sub_term_search_depth,X)).
|
||||
|
||||
yap_flag(home,X) :-
|
||||
'$yap_home'(X).
|
||||
|
||||
% should match definitions in Yap.h
|
||||
'$transl_to_index_mode'(0, off).
|
||||
'$transl_to_index_mode'(1, single).
|
||||
@ -312,58 +296,12 @@ yap_flag(integer_rounding_function,X) :-
|
||||
yap_flag(integer_rounding_function,X) :-
|
||||
'$do_error'(domain_error(flag_value,integer_rounding_function+X),yap_flag(integer_rounding_function,X)).
|
||||
|
||||
yap_flag(max_arity,X) :-
|
||||
var(X), !,
|
||||
'$access_yap_flags'(1, X1),
|
||||
'$transl_to_arity'(X1,X).
|
||||
yap_flag(max_arity,X) :-
|
||||
integer(X), X > 0, !,
|
||||
'$do_error'(permission_error(modify,flag,max_arity),yap_flag(max_arity,X)).
|
||||
yap_flag(max_arity,X) :-
|
||||
'$do_error'(domain_error(flag_value,max_arity+X),yap_flag(max_arity,X)).
|
||||
|
||||
yap_flag(version,X) :-
|
||||
var(X), !,
|
||||
get_value('$version_name',X).
|
||||
yap_flag(version,X) :-
|
||||
'$do_error'(permission_error(modify,flag,version),yap_flag(version,X)).
|
||||
|
||||
yap_flag(max_integer,X) :-
|
||||
var(X), !,
|
||||
'$access_yap_flags'(0, 1),
|
||||
'$access_yap_flags'(3, X).
|
||||
yap_flag(max_integer,X) :-
|
||||
integer(X), X > 0, !,
|
||||
'$do_error'(permission_error(modify,flag,max_integer),yap_flag(max_integer,X)).
|
||||
yap_flag(max_integer,X) :-
|
||||
'$do_error'(domain_error(flag_value,max_integer+X),yap_flag(max_integer,X)).
|
||||
|
||||
yap_flag(max_tagged_integer,X) :-
|
||||
'$max_tagged_integer'(X), !.
|
||||
yap_flag(max_tagged_integer,X) :-
|
||||
integer(X), X > 0, !,
|
||||
'$do_error'(permission_error(modify,flag,max_tagged_integer),yap_flag(max_tagged_integer,X)).
|
||||
yap_flag(max_tagged_integer,X) :-
|
||||
'$do_error'(domain_error(flag_value,max_tagged_integer+X),yap_flag(max_tagged_integer,X)).
|
||||
|
||||
yap_flag(min_integer,X) :-
|
||||
var(X), !,
|
||||
'$access_yap_flags'(0, 1),
|
||||
'$access_yap_flags'(4, X).
|
||||
yap_flag(min_integer,X) :-
|
||||
integer(X), X < 0, !,
|
||||
'$do_error'(permission_error(modify,flag,min_integer),yap_flag(min_integer,X)).
|
||||
yap_flag(min_integer,X) :-
|
||||
'$do_error'(domain_error(flag_value,min_integer+X),yap_flag(min_integer,X)).
|
||||
|
||||
yap_flag(min_tagged_integer,X) :-
|
||||
'$min_tagged_integer'( X), !.
|
||||
yap_flag(min_tagged_integer,X) :-
|
||||
integer(X), X > 0, !,
|
||||
'$do_error'(permission_error(modify,flag,min_tagged_integer),yap_flag(min_tagged_integer,X)).
|
||||
yap_flag(min_tagged_integer,X) :-
|
||||
'$do_error'(domain_error(flag_value,min_tagged_integer+X),yap_flag(min_tagged_integer,X)).
|
||||
|
||||
/* ISO Core Revision DTR: new float flags
|
||||
|
||||
yap_flag(float_mantissa_digits,X) :-
|
||||
@ -419,16 +357,6 @@ yap_flag(char_conversion,X) :-
|
||||
yap_flag(char_conversion,X) :-
|
||||
'$do_error'(domain_error(flag_value,char_conversion+X),yap_flag(char_conversion,X)).
|
||||
|
||||
yap_flag(double_quotes,X) :-
|
||||
var(X), !,
|
||||
'$access_yap_flags'(6, X1),
|
||||
'$transl_to_trl_types'(X1,X).
|
||||
yap_flag(double_quotes,X) :-
|
||||
'$transl_to_trl_types'(X1,X), !,
|
||||
'$set_yap_flags'(6,X1).
|
||||
yap_flag(double_quotes,X) :-
|
||||
'$do_error'(domain_error(flag_value,double_quotes+X),yap_flag(double_quotes,X)).
|
||||
|
||||
yap_flag(n_of_integer_keys_in_db,X) :-
|
||||
var(X), !,
|
||||
'$resize_int_keys'(X).
|
||||
@ -514,13 +442,6 @@ yap_flag(discontiguous_warnings,X) :-
|
||||
yap_flag(discontiguous_warnings,X) :-
|
||||
'$do_error'(domain_error(flag_value,discontiguous_warnings+X),yap_flag(discontiguous_warnings,X)).
|
||||
|
||||
yap_flag(occurs_check,X) :-
|
||||
X = false, !.
|
||||
yap_flag(occurs_check,true) :- !,
|
||||
fail.
|
||||
yap_flag(occurs_check,X) :-
|
||||
'$do_error'(domain_error(flag_value,occurs_check+X),yap_flag(occurs_check,X)).
|
||||
|
||||
yap_flag(redefine_warnings,X) :-
|
||||
var(X), !,
|
||||
'$syntax_check_multiple'(X,X).
|
||||
@ -536,7 +457,7 @@ yap_flag(redefine_warnings,X) :-
|
||||
|
||||
yap_flag(chr_toplevel_show_store,X) :-
|
||||
var(X), !,
|
||||
nb_getval('$chr_toplevel_show_store',X).
|
||||
'$nb_getval'('$chr_toplevel_show_store', X, fail).
|
||||
yap_flag(chr_toplevel_show_store,X) :-
|
||||
(X = true ; X = false), !,
|
||||
nb_setval('$chr_toplevel_show_store',X).
|
||||
@ -581,8 +502,6 @@ yap_flag(system_options,X) :-
|
||||
'$swi_current_prolog_flag'(readline, true).
|
||||
'$system_options'(tabling) :-
|
||||
\+ '$undefined'('$c_table'(_,_,_), prolog).
|
||||
'$system_options'(threads) :-
|
||||
\+ '$no_threads'.
|
||||
'$system_options'(wam_profiler) :-
|
||||
\+ '$undefined'(reset_op_counters, prolog).
|
||||
|
||||
@ -630,14 +549,6 @@ yap_flag(toplevel_hook,G) :-
|
||||
yap_flag(toplevel_hook,G) :- !,
|
||||
'$set_toplevel_hook'(G).
|
||||
|
||||
yap_flag(unix,true) :-
|
||||
'$unix', !.
|
||||
yap_flag(unix,false).
|
||||
|
||||
yap_flag(windows,true) :-
|
||||
'$win32', !.
|
||||
yap_flag(windows,false).
|
||||
|
||||
yap_flag(shared_object_search_path,P) :-
|
||||
'$ld_path'(P).
|
||||
|
||||
@ -788,35 +699,19 @@ yap_flag(max_threads,X) :-
|
||||
yap_flag(max_threads,X) :-
|
||||
'$do_error'(domain_error(flag_value,max_threads+X),yap_flag(max_threads,X)).
|
||||
|
||||
yap_flag(address_bits,X) :-
|
||||
var(X), !,
|
||||
'$address_bits'(X).
|
||||
yap_flag(address_bits,X) :-
|
||||
integer(X), X > 0, !,
|
||||
'$do_error'(permission_error(modify,flag,address_bits),yap_flag(address_bits,X)).
|
||||
yap_flag(address_bits,X) :-
|
||||
'$do_error'(domain_error(flag_value,address_bits+X),yap_flag(address_bits,X)).
|
||||
|
||||
yap_flag(dialect,yap).
|
||||
|
||||
'$yap_system_flag'(address_bits).
|
||||
'$yap_system_flag'(agc_margin).
|
||||
'$yap_system_flag'(answer_format).
|
||||
'$yap_system_flag'(argv).
|
||||
'$yap_system_flag'(autoload).
|
||||
'$yap_system_flag'(bounded).
|
||||
'$yap_system_flag'(char_conversion).
|
||||
'$yap_system_flag'(character_escapes).
|
||||
'$yap_system_flag'(chr_toplevel_show_store).
|
||||
'$yap_system_flag'(debug).
|
||||
'$yap_system_flag'(debug_on_error ).
|
||||
'$yap_system_flag'(debugger_print_options).
|
||||
'$yap_system_flag'(dialect).
|
||||
'$yap_system_flag'(discontiguous_warnings).
|
||||
'$yap_system_flag'(dollar_as_lower_case).
|
||||
'$yap_system_flag'(double_quotes).
|
||||
% '$yap_system_flag'(encoding).
|
||||
'$yap_system_flag'(executable).
|
||||
% V = fast ;
|
||||
% '$yap_system_flag'(file_name_variables).
|
||||
% '$yap_system_flag'(fileerrors ).
|
||||
@ -830,7 +725,6 @@ yap_flag(dialect,yap).
|
||||
'$yap_system_flag'(gc_trace ).
|
||||
'$yap_system_flag'(generate_debug_info ).
|
||||
% V = hide ;
|
||||
'$yap_system_flag'(home ).
|
||||
'$yap_system_flag'(host_type ).
|
||||
'$yap_system_flag'(index).
|
||||
'$yap_system_flag'(index_sub_term_search_depth).
|
||||
@ -838,15 +732,9 @@ yap_flag(dialect,yap).
|
||||
'$yap_system_flag'(informational_messages).
|
||||
'$yap_system_flag'(integer_rounding_function).
|
||||
'$yap_system_flag'(language).
|
||||
'$yap_system_flag'(max_arity).
|
||||
'$yap_system_flag'(max_integer).
|
||||
'$yap_system_flag'(max_tagged_integer).
|
||||
'$yap_system_flag'(max_workers).
|
||||
'$yap_system_flag'(max_threads).
|
||||
'$yap_system_flag'(min_integer).
|
||||
'$yap_system_flag'(min_tagged_integer).
|
||||
'$yap_system_flag'(n_of_integer_keys_in_db).
|
||||
'$yap_system_flag'(occurs_check).
|
||||
'$yap_system_flag'(open_expands_filename).
|
||||
'$yap_system_flag'(open_shared_object).
|
||||
% '$yap_system_flag'(optimise).
|
||||
@ -866,7 +754,6 @@ yap_flag(dialect,yap).
|
||||
'$yap_system_flag'(toplevel_hook).
|
||||
'$yap_system_flag'(toplevel_print_options).
|
||||
'$yap_system_flag'(typein_module).
|
||||
'$yap_system_flag'(unix).
|
||||
'$yap_system_flag'(unknown).
|
||||
'$yap_system_flag'(update_semantics).
|
||||
'$yap_system_flag'(user_error).
|
||||
@ -878,7 +765,6 @@ yap_flag(dialect,yap).
|
||||
'$yap_system_flag'(verbose_load).
|
||||
'$yap_system_flag'(verbose_auto_load).
|
||||
'$yap_system_flag'(version).
|
||||
'$yap_system_flag'(windows).
|
||||
'$yap_system_flag'(write_strings).
|
||||
|
||||
'$show_yap_flag_opts'(V,Out) :-
|
||||
@ -957,10 +843,6 @@ yap_flag(dialect,yap).
|
||||
'$transl_to_rounding_function'(0,toward_zero).
|
||||
'$transl_to_rounding_function'(1,down).
|
||||
|
||||
'$transl_to_trl_types'(0,chars).
|
||||
'$transl_to_trl_types'(1,codes).
|
||||
'$transl_to_trl_types'(2,atom).
|
||||
|
||||
'$yap_flag_show_gc_tracing'(true, _, _, on) :- !.
|
||||
'$yap_flag_show_gc_tracing'(_, true, _, verbose) :- !.
|
||||
'$yap_flag_show_gc_tracing'(_, _, on, very_verbose) :- !.
|
||||
|
@ -364,6 +364,7 @@ thread_exit(Term) :-
|
||||
fail.
|
||||
'$run_at_thread_exit'(Id0) :-
|
||||
recorded('$thread_exit_hook',[Id0|Hook],R), erase(R),
|
||||
open('/home/vsc/coutput.txt', append, W), writeln(hook:Hook), close(W),
|
||||
catch(once(Hook),_,fail),
|
||||
fail.
|
||||
'$run_at_thread_exit'(_).
|
||||
@ -374,7 +375,8 @@ thread_at_exit(Goal) :-
|
||||
recordz('$thread_exit_hook',[Id0|Goal],_).
|
||||
|
||||
current_thread(Id, Status) :-
|
||||
thread_property(Id, status(Status)).
|
||||
catch(thread_property(Id, status(Status)),
|
||||
error(existence_error(_,_),_), fail).
|
||||
|
||||
|
||||
'$thread_id_alias'(Id, Alias) :-
|
||||
|
@ -368,12 +368,12 @@ stream_position_data(Prop, Term, Value) :-
|
||||
|
||||
|
||||
'$default_expand'(Expand) :-
|
||||
nb_getval('$open_expands_filename',Expand).
|
||||
get_value('$open_expands_filename',Expand).
|
||||
|
||||
'$set_default_expand'(true) :- !,
|
||||
nb_setval('$open_expands_filename',true).
|
||||
set_value('$open_expands_filename',true).
|
||||
'$set_default_expand'(false) :- !,
|
||||
nb_setval('$open_expands_filename',false).
|
||||
set_value('$open_expands_filename',false).
|
||||
'$set_default_expand'(V) :- !,
|
||||
'$do_error'(domain_error(flag_value,V),yap_flag(open_expands_file_name,X)).
|
||||
|
||||
|
Reference in New Issue
Block a user