Merge branch 'master' of git.dcc.fc.up.pt:yap-6.3

This commit is contained in:
Vitor Santos Costa 2014-03-15 22:48:12 +00:00
commit 5a73c525e9
32 changed files with 202 additions and 159 deletions

View File

@ -851,7 +851,7 @@ interrupt_call( USES_REGS1 )
return v;
PP = P->u.Osbpp.p0;
if (Yap_only_has_signal(YAP_CREEP_SIGNAL) &&
PP->ExtraPredFlags & (NoDebugPredFlag|HiddenPredFlag) )
(PP->ExtraPredFlags & (NoDebugPredFlag|HiddenPredFlag)) )
return 2;
S = (CELL *) P->u.Osbpp.p;
SET_ASP(YENV, P->u.Osbpp.s);
@ -4442,7 +4442,7 @@ Yap_absmi(int inp)
FAIL();
}
BEGP(pt1);
pt1 = RepAppl(PREG->u.xu.u);
pt1 = RepAppl(PREG->u.xu.ut);
PREG = NEXTOP(PREG, xu);
if (
pt1[1] != pt0[1] ||
@ -4460,7 +4460,7 @@ Yap_absmi(int inp)
/* set d1 to be the new structure we are going to create */
START_PREFETCH(xc);
BEGD(d1);
d1 = PREG->u.xu.u;
d1 = PREG->u.xu.ut;
PREG = NEXTOP(PREG, xu);
Bind(pt0, d1);
GONext();
@ -6154,7 +6154,7 @@ Yap_absmi(int inp)
}
ENDD(d0);
BEGP(pt1);
pt1 = RepAppl(PREG->u.ou.u);
pt1 = RepAppl(PREG->u.ou.ut);
PREG = NEXTOP(PREG, ou);
if (
pt1[1] != pt0[1]
@ -6166,7 +6166,7 @@ Yap_absmi(int inp)
derefa_body(d0, pt0, ustring_unk, ustring_nonvar);
BEGD(d1);
d1 = PREG->u.ou.u;
d1 = PREG->u.ou.ut;
PREG = NEXTOP(PREG, ou);
Bind_Global(pt0, d1);
GONext();
@ -6194,7 +6194,7 @@ Yap_absmi(int inp)
}
ENDD(d0);
BEGP(pt1);
pt1 = RepAppl(PREG->u.ou.u);
pt1 = RepAppl(PREG->u.ou.ut);
PREG = NEXTOP(PREG, ou);
if (
pt1[1] != pt0[1]
@ -6206,7 +6206,7 @@ Yap_absmi(int inp)
derefa_body(d0, S_SREG, ulstring_unk, ulstring_nonvar);
BEGD(d1);
d1 = PREG->u.ou.u;
d1 = PREG->u.ou.ut;
PREG = NEXTOP(PREG, ou);
Bind_Global(S_SREG, d1);
GONext();
@ -9196,9 +9196,11 @@ Yap_absmi(int inp)
GONext();
}
}
break;
case (CELL)FunctorLongInt:
PREG = NEXTOP(PREG, xl);
GONext();
break;
default:
PREG = PREG->u.xl.F;
GONext();

View File

@ -1149,7 +1149,7 @@ a_ustring(CELL rnd1, op_numbers opcode, op_numbers opcode_w, int *clause_has_blo
if (pass_no) {
code_p->opc = emit_op(opcode);
code_p->u.ou.opcw = emit_op(opcode_w);
code_p->u.ou.u =
code_p->u.ou.ut =
AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[rnd1]));
}
*clause_has_blobsp = TRUE;
@ -1403,7 +1403,7 @@ a_rstring(op_numbers opcode, int *clause_has_blobsp, yamop *code_p, int pass_no,
if (pass_no) {
code_p->opc = emit_op(opcode);
code_p->u.xu.x = emit_x(cip->cpc->rnd2);
code_p->u.xu.u = AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1]));
code_p->u.xu.ut = AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1]));
}
*clause_has_blobsp = TRUE;
GONEXT(xu);

View File

@ -104,7 +104,13 @@ Eval(Term t USES_REGS)
return Yap_eval_atom(p->FOfEE);
} else if (IsApplTerm(t)) {
Functor fun = FunctorOfTerm(t);
if ((Atom)fun == AtomFoundVar) {
if (fun == FunctorString) {
const char *s = StringOfTerm(t);
if (s[1] == '\0')
return MkIntegerTerm(s[0]);
return Yap_ArithError(TYPE_ERROR_EVALUABLE, t,
"string in arithmetic expression");
} else if ((Atom)fun == AtomFoundVar) {
return Yap_ArithError(TYPE_ERROR_EVALUABLE, TermNil,
"cyclic term in arithmetic expression");
} else {

View File

@ -1205,7 +1205,7 @@ add_arg_info(ClauseDef *clause, PredEntry *ap, UInt argno)
case _unify_l_string:
if (argno == 1) {
clause->Tag = AbsAppl((CELL *)FunctorString);
clause->ucd.t_ptr = cl->u.ou.u;
clause->ucd.t_ptr = cl->u.ou.ut;
return;
}
cl = NEXTOP(cl,ou);

View File

@ -561,7 +561,7 @@ typedef struct yami {
} os;
struct {
OPCODE opcw;
Term u;
Term ut;
CELL next;
} ou;
struct {
@ -791,7 +791,7 @@ typedef struct yami {
} xx;
struct {
wamreg x;
Term u;
Term ut;
CELL next;
} xu;
struct {

View File

@ -389,7 +389,7 @@ restore_opcodes(yamop *pc, yamop *max USES_REGS)
case _unify_l_string:
case _unify_string:
pc->u.ou.opcw = OpcodeAdjust(pc->u.ou.opcw);
pc->u.ou.u = BlobTermInCodeAdjust(pc->u.ou.u);
pc->u.ou.ut = BlobTermInCodeAdjust(pc->u.ou.ut);
pc = NEXTOP(pc,ou);
break;
/* instructions type ox */
@ -643,7 +643,7 @@ restore_opcodes(yamop *pc, yamop *max USES_REGS)
/* instructions type xu */
case _get_string:
pc->u.xu.x = XAdjust(pc->u.xu.x);
pc->u.xu.u = BlobTermInCodeAdjust(pc->u.xu.u);
pc->u.xu.ut = BlobTermInCodeAdjust(pc->u.xu.ut);
pc = NEXTOP(pc,xu);
break;
/* instructions type xx */

View File

@ -406,7 +406,7 @@
case _unify_l_string:
case _unify_string:
CHECK(save_Opcode(stream, pc->u.ou.opcw));
CHECK(save_BlobTermInCode(stream, pc->u.ou.u));
CHECK(save_BlobTermInCode(stream, pc->u.ou.ut));
pc = NEXTOP(pc,ou);
break;
/* instructions type ox */
@ -659,7 +659,7 @@
/* instructions type xu */
case _get_string:
CHECK(save_X(stream, pc->u.xu.x));
CHECK(save_BlobTermInCode(stream, pc->u.xu.u));
CHECK(save_BlobTermInCode(stream, pc->u.xu.ut));
pc = NEXTOP(pc,xu);
break;
/* instructions type xx */

View File

@ -596,7 +596,7 @@ install_unix: startup.yss @YAPLIB@
$(LN_S) -f $(DESTDIR)$(LIBDIR)/@YAPLIB@ $(DESTDIR)$(LIBDIR)/$$p; \
done
$(INSTALL) $(srcdir)/Artistic $(DESTDIR)$(DOCSDIR)
$(INSTALL) $(srcdir)/README $(DESTDIR)$(DOCSDIR)
$(INSTALL) $(srcdir)/README.TXT $(DESTDIR)$(DOCSDIR)
$(INSTALL) $(srcdir)/COPYING $(DESTDIR)$(DOCSDIR)
for f in $(PL_SOURCES); do $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(SHAREDIR)/Yap/pl; done
for h in $(INTERFACE_HEADERS); do $(INSTALL) $(srcdir)/$$h $(DESTDIR)$(INCLUDEDIR); done
@ -697,7 +697,7 @@ install_docs:
$(MAKE) html
$(INSTALL_DATA) yap.html* $(DESTDIR)$(DOCSDIR)
$(INSTALL_DATA) yap.pdf $(DESTDIR)$(DOCSDIR)
$(INSTALL_DATA) README $(DESTDIR)$(DOCSDIR)
$(INSTALL_DATA) README.TXT $(DESTDIR)$(DOCSDIR)
$(INSTALL_DATA) Artistic $(DESTDIR)$(DOCSDIR)
$(INSTALL_DATA) COPYING $(DESTDIR)$(DOCSDIR)
$(INSTALL_DATA) changes4.3.html $(DESTDIR)$(DOCSDIR)

View File

@ -3,29 +3,30 @@
README for YAP6
This directory contains a release of the YAP 6.0.* Prolog system,
This directory contains a release of the YAP 6.3.* Prolog system,
originally developed at the Universidade do Porto by Luis Damas and
Vitor Santos Costa, with contributions from the Edinburgh Prolog
Vitor Santos Costa. YAP contains the SWI-Prolog I/O library anad a
number of SWI-Prolog packages, originally developed by Jan Wielemaker
and other. It includes contributions from the Edinburgh Prolog
library, the C-Prolog manual authors, Ricardo Lopes, Ricardo Rocha,
M. Hermenegildo, D. Cabeza, Eric Alphonse, Paulo Moura, Nuno Fonseca,
Jan Wielemaker, Paul Singleton, Fred Dushin, Jan Wielemaker, Markus
Triska, and many others. You should read the rest of this file for
information on what YAP is and for instructions on how to build it.
Jan Wielemaker, Paul Singleton, Fred Dushin, Markus Triska, and many
others. You should read the rest of this file for information on what
YAP is and for instructions on how to build it.
YAP 6 has been built with several versions on GCC on a variety of
Linux, MacOSX. It has been built on Windows XP and VISTA using the
mingw toolkit and cygwin from Cygnus Solutions.
Linux, BDS, and MacOSX configurations. It has been built on Windows7
using the mingw toolkit and cygwin from Cygnus Solutions.
The main core of the YAP distribution is distributed under a dual
license: the Perl Artistic license 2 and the FSF's LGPL. The YAP
distribution also contains files distributed under the LGPL
exclusively, and under the GPL.
The YAP distribution includes several packages ported to YAP, such as
Pillow, JPL, CLP(R) and CHR. We would like to take the opportunity to
thank the developers of these packages for their generosity in
allowing YAP to distribute these packages. Any bugs in these packages
are probably our fault.
The YAP distribution includes several packages ported to YAP. We would
like to take the opportunity to thank the developers of these packages
for their generosity in allowing YAP to distribute these packages. Any
bugs in these packages are probably our fault.
If you have a question about this software, desire to add code, found
a bug, want to request a feature, or wonder how to get further
@ -71,11 +72,11 @@ with SICStus Prolog.
YAP is now being maintained using the git source management system. A
public repository is available at
http://gitorious.org/projects/yap-git
http://sourceforge.net/p/yap/yap-6.3/ci/master/tree/
Please use
git clone git://gitorious.org/yap-git/mainline.git
git clone git://git.code.sf.net/p/yap/yap-6.3
to obtain a copy of the current YAP tree.
@ -116,8 +117,7 @@ the --exec-prefix option to set the EROOTDIR macro (for
architecture-dependent files). EROOTDIR defaults to ROOTDIR.
o The main executable is placed at BINDIR, which defaults at
$(EROOTDIR)/bin. This executable is actually a script that calls the
Prolog engine, stored at YAPLIBDIR.
$(EROOTDIR)/bin.
o SHAREDIR is the directory where the Prolog libraries are stored.
Its default value is $(ROOTDIR)/share. The Prolog libraries are
@ -144,13 +144,14 @@ following options to configure:
Compilation options:
o --enable-tablingt=yes allows tabled evaluation (default option)
o --enable-depth-limit=yes allows depth limited evaluation, say for
implementing iterative deepening. It is required by the ILP system
Aleph.
Aleph. (default option)
o --enable-use-malloc=yes makes YAP use the system's C-library
allocation routines for all memory allocation. It is not compatible
with save and restore.
allocation routines for all memory allocation (default).
o --enable-threads=yes enables POSIX thread support.
@ -167,59 +168,52 @@ useful for normal users.
o --enable-or-parallelism={env-copy,sba,a-cow} allows or-parallelism
supported by one of these three forms. This is still experimental.
o --enable-tabling=yes allows tabling support.
o --enable-dynamic-loading compile YAP as as a shared library.
o --enable-win64 compile YAP as a WIN64 application (still experimental).
o --enable-cygwin compile YAP as a CYGWIN environment application, and not as stand-alone application.
o --with-cudd=CUDD_PATH enable support of the CUDD library, used by
packages such as ProbLog. Usually CUDD has to compiled from source
(http://vlsi.colorado.edu/~fabio/CUDD/), but Fedora and MacPorts have
cudd packages. In the case of Fedora, install cudd-dev and use
--with-cud=/usr, in the case of MacPorts install cudd-dev and use
--with-cud=/opt/local.
o --with-gmp=GMP_PATH provide a path for GMP, in case GMP is not
o --with-gmp[=GMP_PATH] provide a path for GMP, in case GMP is not
installed in the system. In a Linux machine, make sure you have
installed the gmp-dev package. Binary versions of GMP are available
for WIN32.
Functionality options:
o --enable-condor compile YAP as a static program that can be run by
condor. condor_compile must be in the system path.
o --with-java=JAVA_PATH activates the Java Interface Library JPL. In
Linux and WIN32 you have to provide a path to the Java library, in
OSX it is sufficient to say yes.
Packages and Interface Libraries
o --enable-condor compile YAP as a static program that can be run by condor
o --with-cudd[=CUDD_PATH] enables compilation of the CUDD library,
used by packages such as PFL/CLP(BN) and ProbLog. The source of the
CUDD package is availablr from:
o --enable-chr install CHR (enabled by default, if CHR is available)
http://vlsi.colorado.edu/~fabio/CUDD
o --enable-clpqr install CLPQR (enabled by default, if CLPQR is available)
Fedora Linux and MacPorts have cudd packages. In the case of Fedora,
install cudd-devel. Ask vsc@dcc.fc.up.pt for a WIN32/WIN64 port
o --enable-myddas install the MYDDAS MYSQL and/or ODBC interface
package. YAP tries to compile this by default, if the odbc or MySql
development files can be found.
o --with-java[=JAVA_PATH] enables the Java Interface Library JPL.
o --with-matlab install the MATLAB interface (not default). You need
to provide the full path of the MATLAB install.
o --enable-chr installs the Leuven CHR language implementation
(enabled by default, if package/chr exists)
o --with-mpi install the MPICH based MPI interface. This is default,
o --enable-clpqr installs the Leuven CLPQR port, originally developed
for SWI-Prolog (enabled by default, if Cpackage/clpqe exists)
o --enable-myddas[=PATH] installs the MYDDAS MYSQL and/or ODBC interface
package (enabled by default, if ODBC and/or MySql
development files can be found). It also enables support for the
SWI-Prolog ODBC package.
o --with-matlab[=PATH] installs the MATLAB interface (not
default). You need to provide the full path of the MATLAB libraries.
o --with-mpi[=PATH] installs the MPI interface. This is default,
if the development libraries can be found.
o --with-mpe install the MPE interface.
o --with-lam install the MPI LAM-based interface.
3.3 Porting YAP
The system has been mainly tested with GCC, but we have been able to
compile older versions of YAP under lcc in Linux, Sun's cc compiler,
IBM's xlc, SGI's cc, HP's cc, and Microsoft's Visual C++ 6.0. Recent
versions of YAP have also been compiled using Intel's lcc.
o --with-gecode[=PATH] installs the GeCode Solver interface. This is default,
if gecode libraries can be found.
o --with-R[=PATH] installs the Real interface to the R language.
o --with-python[=PATH] installs a Python interface

View File

@ -12,8 +12,8 @@ typedef YAP_Int BPLONG;
typedef YAP_UInt BPULONG;
typedef BPLONG *BPLONG_PTR;
#define BP_TRUE TRUE
#define BP_FALSE FALSE
#define BP_TRUE 1
#define BP_FALSE 0
//extern TERM bp_get_call_arg(int i, int arity);
#define bp_get_call_arg( i, arity) YAP_A(i)
@ -169,7 +169,7 @@ INLINE_ONLY extern inline int
bp_mount_query_term(TERM goal)
{
curr_toam_status = goal;
return TRUE;
return BP_TRUE;
}
#endif /* BPROLOG_H */

View File

@ -95,7 +95,7 @@ extern X_API Int YAP_PLArityOfSWIFunctor(functor_t at);
/* This is silly, but let's keep it like that for now */
X_API Int
YAP_PLArityOfSWIFunctor(functor_t f) {
if ((CELL)(f) & 2 && ((CELL)f) < N_SWI_FUNCTORS*4+2)
if (((CELL)(f) & 2) && ((CELL)f) < N_SWI_FUNCTORS*4+2)
return ArityOfFunctor(SWI_Functors[(CELL)f/4]);
if (IsAtomTerm(f))
return 0;
@ -1001,7 +1001,7 @@ X_API int PL_throw(term_t exception)
{
CACHE_REGS
YAP_Throw(Yap_GetFromSlot(exception PASS_REGS));
longjmp(LOCAL_execution->env, 0);
longjmp(LOCAL_execution->q_env, 0);
return 0;
}
@ -1315,6 +1315,7 @@ X_API int PL_unify_wchars(term_t t, int type, size_t len, const pl_wchar_t *char
if (LOCAL_Error_TYPE && !Yap_SWIHandleError( "PL_unify_wchars" ))
return FALSE;
}
return FALSE;
}
typedef struct {
@ -2233,43 +2234,43 @@ X_API qid_t PL_open_query(module_t ctx, int flags, predicate_t p, term_t t0)
t = Yap_AddressFromSlot(t0 PASS_REGS);
/* ignore flags and module for now */
open_query *new = (open_query *)Yap_AllocCodeSpace(sizeof(open_query));
qid_t new = (qid_t)Yap_AllocCodeSpace(sizeof(struct open_query_struct));
LOCAL_execution = new;
new->open=1;
new->state=0;
new->flags = flags;
new->pe = (PredEntry *)p;
new->g = t;
return LOCAL_execution;
new->q_open=1;
new->q_state=0;
new->q_flags = flags;
new->q_pe = (PredEntry *)p;
new->q_g = t;
return new;
}
X_API int PL_next_solution(qid_t qi)
{
CACHE_REGS
int result;
if (qi->open != 1) return 0;
if (setjmp(LOCAL_execution->env))
if (qi->q_open != 1) return 0;
if (setjmp(LOCAL_execution->q_env))
return 0;
// don't forget, on success these guys must create slots
if (qi->state == 0) {
result = YAP_EnterGoal((YAP_PredEntryPtr)qi->pe, qi->g, &qi->h);
if (qi->q_state == 0) {
result = YAP_EnterGoal((YAP_PredEntryPtr)qi->q_pe, qi->q_g, &qi->q_h);
} else {
LOCAL_AllowRestart = qi->open;
result = YAP_RetryGoal(&qi->h);
LOCAL_AllowRestart = qi->q_open;
result = YAP_RetryGoal(&qi->q_h);
}
qi->state = 1;
qi->q_state = 1;
if (result == 0) {
YAP_LeaveGoal(FALSE, &qi->h);
qi->open = 0;
YAP_LeaveGoal(FALSE, &qi->q_h);
qi->q_open = 0;
}
return result;
}
X_API void PL_cut_query(qid_t qi)
{
if (qi->open != 1 || qi->state == 0) return;
YAP_LeaveGoal(FALSE, &qi->h);
qi->open = 0;
if (qi->q_open != 1 || qi->q_state == 0) return;
YAP_LeaveGoal(FALSE, &qi->q_h);
qi->q_open = 0;
Yap_FreeCodeSpace( (char *)qi );
}
@ -2277,15 +2278,15 @@ X_API void PL_close_query(qid_t qi)
{
CACHE_REGS
if (EX && !(qi->flags & (PL_Q_CATCH_EXCEPTION))) {
if (EX && !(qi->q_flags & (PL_Q_CATCH_EXCEPTION))) {
EX = NULL;
}
/* need to implement backtracking here */
if (qi->open != 1 || qi->state == 0) {
if (qi->q_open != 1 || qi->q_state == 0) {
return;
}
YAP_LeaveGoal(FALSE, &qi->h);
qi->open = 0;
YAP_LeaveGoal(FALSE, &qi->q_h);
qi->q_open = 0;
Yap_FreeCodeSpace( (char *)qi );
}
@ -2306,6 +2307,7 @@ X_API int PL_toplevel(void)
return TRUE;
}
}
return TRUE;
}
X_API int PL_call(term_t tp, module_t m)

View File

@ -2,14 +2,14 @@ void Yap_swi_install(void);
void Yap_install_blobs(void);
typedef struct open_query_struct {
int open;
int state;
YAP_Term *g;
PredEntry *pe;
yamop *p, *cp;
jmp_buf env;
int flags;
YAP_dogoalinfo h;
int q_open;
int q_state;
YAP_Term *q_g;
PredEntry *q_pe;
yamop *q_p, *q_cp;
jmp_buf q_env;
int q_flags;
YAP_dogoalinfo q_h;
} open_query;
#define addr_hash(V) (((CELL) (V)) >> 4 & (N_SWI_HASH-1))

View File

@ -54,7 +54,7 @@ rm -rf $RPM_BUILD_ROOT $RPM_BUILD_DIR/file.list.%{name}
%files
%defattr(-,root,root,-)
%doc README*
%doc README.TXT
%doc INSTALL
%doc changes-6.0.html
%doc changes-5.1.html

View File

@ -76,7 +76,7 @@ Section "Base system (required)"
File c:\${ROOTDIR}\share\doc\Yap\yap.pdf
; File c:\${ROOTDIR}\share\doc\Yap\yap.info
File c:\${ROOTDIR}\share\doc\Yap\Artistic
File c:\${ROOTDIR}\share\doc\Yap\README
File c:\${ROOTDIR}\share\doc\Yap\README.TXT
File c:\${ROOTDIR}\share\doc\Yap\COPYING
WriteRegStr HKLM ${REGKEY} "home" "$INSTDIR"
@ -116,8 +116,8 @@ Section "Start Menu shortcuts"
"$INSTDIR\bin\yap.exe" \
0
CreateShortCut "$SMPROGRAMS\${GRP}\Readme.lnk" \
"$INSTDIR\share\doc\Yap\README" "" \
"$INSTDIR\share\doc\Yap\README" 0 \
"$INSTDIR\share\doc\Yap\README.TXT" "" \
"$INSTDIR\share\doc\Yap\README.TXT" 0 \
"SW_SHOWNORMAL" "" "View readme"
CreateShortCut "$SMPROGRAMS\${GRP}\Manual Html.lnk" \
"$INSTDIR\share\doc\Yap\yap.html" "" \
@ -318,7 +318,7 @@ FunctionEnd
Function .onInstSuccess
MessageBox MB_YESNO "Installation complete. View readme?" IDNO NoReadme
ExecShell "open" "$INSTDIR\share\doc\Yap\README"
ExecShell "open" "$INSTDIR\share\doc\Yap\README.TXT"
NoReadme:
FunctionEnd

View File

@ -230,9 +230,13 @@ PL_EXPORT_DATA(IOSTREAM) S__iob[3]; /* Libs standard streams */
#define Sgetchar() Sgetc(Sinput)
#define Sputchar(c) Sputc((c), Soutput)
#define S__checkpasteeof(s,c) \
if ( (c)==-1 && (s)->flags & (SIO_FEOF|SIO_FERR) ) \
((s)->flags |= SIO_FEOF2)
static inline void
S__checkpasteeof(IOSTREAM *s, int c)
{
if ( (c)==-1 && ((s)->flags & (SIO_FEOF|SIO_FERR)) )
((s)->flags |= SIO_FEOF2);
}
#define S__updatefilepos_getc(s, c) \
((s)->position ? S__fupdatefilepos_getc((s), (c)) \
: S__fcheckpasteeof((s), (c)))

View File

@ -671,7 +671,7 @@ PRED_IMPL("normalize_space", 2, normalize_space, 0)
* LOCALE *
*******************************/
#if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE)
#if O_LOCALE
#include <locale.h>
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -843,15 +843,20 @@ static const enc_map map[] =
IOENC
initEncoding(void)
{ GET_LD
#if HAVE_SETLOCALE
char *enc;
#endif
if ( LD )
{ if ( !LD->encoding )
{ char *enc, *encp;
{
if ( !init_locale() )
{ LD->encoding = ENC_ISO_LATIN_1;
#if HAVE_SETLOCALE
} else if ( (enc = setlocale(LC_CTYPE, NULL)) )
{ LD->encoding = ENC_ANSI; /* text encoding */
{ char *encp;
LD->encoding = ENC_ANSI; /* text encoding */
if ( (encp = strchr(enc, '.')) )
{ const enc_map *m;
@ -874,8 +879,8 @@ initEncoding(void)
}
}
}
} else
{ LD->encoding = ENC_ISO_LATIN_1;
#endif
} else { LD->encoding = ENC_ISO_LATIN_1;
}
}

View File

@ -1579,12 +1579,14 @@ readLine(IOSTREAM *in, IOSTREAM *out, char *buffer)
buf--;
continue;
}
/*FALLTHROUGH*/
default:
if ( truePrologFlag(PLFLAG_TTY_CONTROL) )
Sputcode(c, out);
*buf++ = c;
}
}
return FALSE; /* make eclipse happy */
}
@ -1898,9 +1900,9 @@ set_stream(IOSTREAM *s, term_t stream, atom_t aname, term_t a ARG_LD)
clear(s, SIO_REPXML|SIO_REPPL);
if ( val == ATOM_error )
if ( val == ATOM_error ) {
;
else if ( val == ATOM_xml )
} else if ( val == ATOM_xml )
set(s, SIO_REPXML);
else if ( val == ATOM_prolog )
set(s, SIO_REPPL);
@ -2006,7 +2008,7 @@ found:
ref = PL_blob_data(sblob, NULL, &type);
if ( type == &stream_blob ) /* got a stream handle */
{ if ( ref->read && ref->write && /* stream pair */
info->flags & SS_NOPAIR )
(info->flags & SS_NOPAIR) )
return PL_error("set_stream", 2, NULL, ERR_PERMISSION,
aname, ATOM_stream_pair, stream);
@ -3419,7 +3421,7 @@ pl_seen(void)
pop_input_context();
if ( s && s->flags & SIO_NOFEOF )
if ( s && (s->flags & SIO_NOFEOF) )
return TRUE;
if ( s )
@ -3521,7 +3523,7 @@ PRED_IMPL("told", 0, told, 0)
popOutputContext();
if ( s && s->flags & SIO_NOFEOF )
if ( s && (s->flags & SIO_NOFEOF) )
return TRUE;
if ( s )
@ -4270,6 +4272,7 @@ PRED_IMPL("stream_property", 2, stream_property,
return FALSE;
}
}
return FALSE;
}

View File

@ -511,13 +511,13 @@ get_file_name(term_t n, char **namep, char *tmp, int flags)
PL_put_term(av+0, n);
if ( rc && flags & PL_FILE_EXIST )
if ( rc && (flags & PL_FILE_EXIST) )
rc = add_option(options, FUNCTOR_access1, ATOM_exist);
if ( rc && flags & PL_FILE_READ )
if ( rc && (flags & PL_FILE_READ) )
rc = add_option(options, FUNCTOR_access1, ATOM_read);
if ( rc && flags & PL_FILE_WRITE )
if ( rc && (flags & PL_FILE_WRITE) )
rc = add_option(options, FUNCTOR_access1, ATOM_write);
if ( rc && flags & PL_FILE_EXECUTE )
if ( rc && (flags & PL_FILE_EXECUTE) )
rc = add_option(options, FUNCTOR_access1, ATOM_execute);
if ( rc ) rc = PL_unify_nil(options);

View File

@ -1115,6 +1115,7 @@ formatInteger(PL_locale *locale, int div, int radix, bool smll, Number i,
}
}
#if O_LOCALE
static int
countGroups(const char *grouping, int len)
@ -1141,7 +1142,6 @@ countGroups(const char *grouping, int len)
return groups;
}
static int
ths_to_utf8(char *u8, const wchar_t *s, size_t len)
{ char *e = u8+len-7;
@ -1153,7 +1153,6 @@ ths_to_utf8(char *u8, const wchar_t *s, size_t len)
return *s == 0;
}
static int
same_decimal_point(PL_locale *l1, PL_locale *l2)
{ if ( l1->decimal_point && l2->decimal_point &&
@ -1165,7 +1164,6 @@ same_decimal_point(PL_locale *l1, PL_locale *l2)
return FALSE;
}
static int
utf8_dp(PL_locale *l, char *s, int *len)
{ if ( l->decimal_point )
@ -1227,7 +1225,6 @@ localizeDecimalPoint(PL_locale *locale, Buffer b)
return TRUE;
}
static int
groupDigits(PL_locale *locale, Buffer b)
{ if ( locale->thousands_sep && locale->thousands_sep[0] &&
@ -1278,6 +1275,7 @@ groupDigits(PL_locale *locale, Buffer b)
return TRUE;
}
#endif
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1477,11 +1475,13 @@ formatFloat(PL_locale *locale, int how, int arg, Number f, Buffer out)
return NULL;
}
#if O_LOCALE
if ( locale )
{ if ( !localizeDecimalPoint(locale, out) ||
!groupDigits(locale, out) )
return NULL;
}
#endif
return baseBuffer(out, char);
}

View File

@ -968,7 +968,7 @@ static unsigned char *
backSkipUTF8(unsigned const char *start, unsigned const char *end, int *chr)
{ const unsigned char *s;
for(s=end-1 ; s>start && *s&0x80; s--)
for(s=end-1 ; s>start && ( *s&0x80 ); s--)
;
utf8_get_char((char*)s, chr);

View File

@ -591,6 +591,9 @@ PL_install_readline(void)
#ifndef __WINDOWS__
if ( !truePrologFlag(PLFLAG_TTY_CONTROL) || !isatty(0) )
return;
// don't allow YAP to run readline under an Eclipse Console
if (getenv("EclipseVersion"))
return;
#endif
alevel = setAccessLevel(ACCESS_LEVEL_SYSTEM);

View File

@ -57,7 +57,9 @@ locking is required.
#endif
#define PL_KERNEL 1
#if HAVE_LOCALE_H && HAVE_SETLOCALE
#define O_LOCALE 1
#endif
#include <wchar.h>
#define NEEDS_SWINSOCK
#include "SWI-Stream.h"
@ -633,6 +635,7 @@ update_linepos(IOSTREAM *s, int c)
break;
case '\t':
p->linepos |= 7;
/*FALLTHROUGH*/
default:
p->linepos++;
}
@ -1342,6 +1345,7 @@ ScheckBOM(IOSTREAM *s)
return 0; /* empty stream */
s->bufp--;
}
return 0;
}
@ -1799,8 +1803,10 @@ Sclose(IOSTREAM *s)
if ( s->message )
free(s->message);
#if O_LOCALE
if ( s->locale )
releaseLocale(s->locale);
#endif
if ( s->references == 0 )
unallocStream(s);
else
@ -2647,6 +2653,7 @@ Sread_file(void *handle, char *buf, size_t size)
return bytes;
}
return -1;
}

View File

@ -21,6 +21,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if defined(_WIN32) || defined(__MINGW32__)
#define UNICODE 1
#define _UNICODE 1
@ -781,6 +783,8 @@ out:
simple:
retval = _waccess(buf, mode);
goto out;
return FALSE;
}
@ -943,6 +947,7 @@ readdir(DIR *dp)
if ( (de = translate_data(dp)) )
return de;
}
return FALSE;
}
@ -1070,3 +1075,6 @@ _xos_setenv(const char *name, char *value, int overwrite)
return -1; /* TBD: convert error */
}
#endif

View File

@ -131,7 +131,7 @@ readQueryAndEvidence (
}
Horus::VarId vid = Horus::Util::stringToUnsigned (arg);
Horus::VarNode* queryVar = fg.getVarNode (vid);
if (queryVar == false) {
if (queryVar == nullptr) {
std::cerr << "Error: unknow variable with id " ;
std::cerr << "`" << vid << "'." << std::endl;
exit (EXIT_FAILURE);
@ -153,7 +153,7 @@ readQueryAndEvidence (
}
Horus::VarId vid = Horus::Util::stringToUnsigned (leftArg);
Horus::VarNode* observedVar = fg.getVarNode (vid);
if (observedVar == false) {
if (observedVar == nullptr) {
std::cerr << "Error: unknow variable with id " ;
std::cerr << "`" << vid << "'." << std::endl;
exit (EXIT_FAILURE);

View File

@ -59,7 +59,7 @@ clean:
rm -f *.o problogbdd
install: default
$(INSTALL_PROGRAM) problogbdd $(DESTDIR)$(BINDIR)/Yap
$(INSTALL_PROGRAM) problogbdd $(DESTDIR)$(BINDIR)
install-examples:

View File

@ -1201,7 +1201,7 @@ char* getFileName(const char *function) {
DdNode* LineParser(DdManager *manager, namedvars varmap, DdNode **inter, int maxinter, char *function, int iline) {
int istart, iend, ilength, i, symbol, ivar, inegvar, inegoper, iconst;
long startAt, endAt;
double secs;
//double secs;
DdNode *bdd;//, *temp;
char *term, curoper;
bdd = HIGH(manager);
@ -1269,7 +1269,7 @@ DdNode* LineParser(DdManager *manager, namedvars varmap, DdNode **inter, int max
} else {
switch(curoper) {
case '+':
if (inegvar ^ inegoper) ; else {
if (!(inegvar ^ inegoper)) {
bdd = HIGH(manager);
Cudd_Ref(bdd);
}
@ -1281,12 +1281,12 @@ DdNode* LineParser(DdManager *manager, namedvars varmap, DdNode **inter, int max
}
break;
case '#':
if (inegvar ^ inegoper) ; else bdd = NOT(bdd);
if (!(inegvar ^ inegoper)) bdd = NOT(bdd);
break;
}
}
endAt = clock();
secs = ((double) (endAt - startAt)) / ((double) CLOCKS_PER_SEC);
//secs = ((double) (endAt - startAt)) / ((double) CLOCKS_PER_SEC);
if (_debug) fprintf(stderr, "term: %s of line: %i took: %ld\n", term, iline, endAt - startAt);
//if ((endAt - startAt) > 10000000) Cudd_AutodynDisable(manager);
if (bdd == NULL) {
@ -1318,7 +1318,7 @@ DdNode* LineParser(DdManager *manager, namedvars varmap, DdNode **inter, int max
if (inegvar) bdd = BDD_Operator(manager, NOT(inter[ivar]), bdd, curoper, inegoper);
else bdd = BDD_Operator(manager, inter[ivar], bdd, curoper, inegoper);
endAt = clock();
secs = ((double) (endAt - startAt)) / ((double) CLOCKS_PER_SEC);
//secs = ((double) (endAt - startAt)) / ((double) CLOCKS_PER_SEC);
if (_debug) fprintf(stderr, "term: %s of line: %i took: %ld\n", term, iline, endAt - startAt);
//if ((endAt - startAt) > 10000000) Cudd_AutodynDisable(manager);
if (bdd == NULL) {
@ -1513,7 +1513,7 @@ DdNode* OnlineGenerateBDD(DdManager *manager, namedvars *varmap) {
DdNode* OnlineLineParser(DdManager *manager, namedvars *varmap, DdNode **inter, int maxinter, char *function, int iline) {
int istart, iend, ilength, i, symbol, ivar, inegvar, inegoper, iconst;
long startAt, endAt;
double secs;
//double secs;
DdNode *bdd;
char *term, curoper;
bdd = HIGH(manager);
@ -1581,7 +1581,7 @@ DdNode* OnlineLineParser(DdManager *manager, namedvars *varmap, DdNode **inter,
} else {
switch(curoper) {
case '+':
if (inegvar ^ inegoper) ; else {
if (!(inegvar ^ inegoper)) {
bdd = HIGH(manager);
Cudd_Ref(bdd);
}
@ -1593,12 +1593,12 @@ DdNode* OnlineLineParser(DdManager *manager, namedvars *varmap, DdNode **inter,
}
break;
case '#':
if (inegvar ^ inegoper) ; else bdd = NOT(bdd);
if (!(inegvar ^ inegoper)) bdd = NOT(bdd);
break;
}
}
endAt = clock();
secs = ((double) (endAt - startAt)) / ((double) CLOCKS_PER_SEC);
//secs = ((double) (endAt - startAt)) / ((double) CLOCKS_PER_SEC);
if (_debug) fprintf(stderr, "term: %s of line: %i took: %ld\n", term, iline, endAt - startAt);
//if ((endAt - startAt) > 10000000) Cudd_AutodynDisable(manager);
if (bdd == NULL) {
@ -1630,7 +1630,7 @@ DdNode* OnlineLineParser(DdManager *manager, namedvars *varmap, DdNode **inter,
if (inegvar) bdd = BDD_Operator(manager, NOT(inter[ivar]), bdd, curoper, inegoper);
else bdd = BDD_Operator(manager, inter[ivar], bdd, curoper, inegoper);
endAt = clock();
secs = ((double) (endAt - startAt)) / ((double) CLOCKS_PER_SEC);
//secs = ((double) (endAt - startAt)) / ((double) CLOCKS_PER_SEC);
if (_debug) fprintf(stderr, "term: %s of line: %i took: %ld\n", term, iline, endAt - startAt);
//if ((endAt - startAt) > 10000000) Cudd_AutodynDisable(manager);
if (bdd == NULL) {

View File

@ -761,7 +761,7 @@ double CalcExpectedCounts(extmanager * MyManager, DdNode *Current, char *query_i
// fprintf(stderr,"%%calcing down\n");
if (calcdown_needed != 0) {
double retd=CalcExpectedCountsDown(MyManager,Current, query_id);
// double retd=CalcExpectedCountsDown(MyManager,Current, query_id);
}
/* if(1 != retd){ */
/* fprintf(stderr,"down %e != up %e/%e\n",ret,retd,ret); */
@ -807,7 +807,7 @@ double CalcExpectedCounts(extmanager * MyManager, DdNode *Current, char *query_i
#define LOG_EXPECTED 0
static
void PrintNodeQueue(Queue q , extmanager MyManager){
QueueIterator qiter = QueueIteratorNew(q, 1);
@ -824,6 +824,8 @@ void PrintNodeQueue(Queue q , extmanager MyManager){
/** also nesting in CalcExpected seems to not work (must be here nested only valid within function frame)*/
/* will be changed at later stage */
static extmanager * ineedtostorethatsomehow;
static
int comparator(void *av, void *bv){
int ret = 0;
DdNode* a = (DdNode*)av;
@ -852,7 +854,11 @@ int comparator(void *av, void *bv){
return ret;
}
static void
skip_nodes_cnt(extmanager * MyManager, double (*counts)[] , int skipcnt, DdNode* l,double dprob, char *query_id);
/** output information for skipped nodes **/
static void
skip_nodes(extmanager * MyManager, double (*counts)[] , DdNode* node, DdNode* l,double dprob, char *query_id){
int skipcnt;
skipcnt = Cudd_ReadPerm(MyManager->manager,GetIndex(node))+1;
@ -866,9 +872,10 @@ skip_nodes(extmanager * MyManager, double (*counts)[] , DdNode* node, DdNode* l,
Cudd_IsConstant(l)
);
}
return skip_nodes_cnt( MyManager, counts, skipcnt, l, dprob, query_id);
skip_nodes_cnt( MyManager, counts, skipcnt, l, dprob, query_id);
}
static void
skip_nodes_cnt(extmanager * MyManager, double (*counts)[] , int skipcnt, DdNode* l,double dprob, char *query_id){
if(LOG_EXPECTED) fprintf(stderr,"====================\n");
double p;
@ -954,7 +961,7 @@ double CalcExpectedCountsDown(extmanager * MyManager, DdNode *Current, char *que
if(LOG_EXPECTED){PrintNodeQueue(q,*MyManager);}
node=QueueGet(q);
curnode = GetNodeVarNameDisp(MyManager->manager, MyManager->varmap, node);
int level = Cudd_ReadPerm(MyManager->manager,GetIndex(node));
// int level = Cudd_ReadPerm(MyManager->manager,GetIndex(node));
if(!Cudd_IsConstant(node)){
tvalue = MyManager->varmap.dvalue[GetIndex(node) - MyManager->varmap.varstart];
ivalue = MyManager->varmap.ivalue[GetIndex(node) - MyManager->varmap.varstart];

@ -1 +1 @@
Subproject commit 77759f84962a5f77a970d0cdcc9647fdc8e7bbfb
Subproject commit e4ecf86fb3422538b107a35372e1888e75ae1f8b

View File

@ -48,6 +48,7 @@ int check_smooth(int *smooth)
case 1: /* p.counts = (none), with 0-valued params */
emit_internal_error("unexpected case in check_smooth()");
RET_ERR(ierr_unmatched_branches);
break;
case 2: /* p.counts = 0 only, w/o 0-valued params */
case 3: /* p.counts = 0 only, with 0-valued params */
*smooth = 0;
@ -58,6 +59,7 @@ int check_smooth(int *smooth)
case 5: /* p.counts = + only, with 0-valued params */
emit_error("parameters fixed to zero in MAP estimation");
RET_ERR(err_invalid_numeric_value);
break;
case 6: /* p.counts = (both), w/o 0-valued params */
case 7: /* p.counts = (both), with 0-valued params */
emit_error("mixture of zero and non-zero pseudo counts");

View File

@ -60,7 +60,7 @@ int get_term_depth(TERM t)
XDEREF(t);
SWITCH_OP(t, l_term_depth, { return 0; }, { return 0; }, {
SWITCH_OP(t, l_term_depth, { return 0; }, { return (0); }, {
if (IsNumberedVar(t)) return 0;
d = 0;

@ -1 +1 @@
Subproject commit 34cac46db62cad37386ea3321de37c0349eb9852
Subproject commit 10fd754c6561313835d4e1ff557d654b3225365e

View File

@ -119,7 +119,7 @@ public:
// -- use this function instead:
template<class V>
friend Clause* Clause_new(const V& ps, bool learnt = false);
friend Clause* Clause_new(const V& ps, bool learnt);
int size () const { return size_etc >> 3; }
void shrink (int i) { assert(i <= size()); size_etc = (((size_etc >> 3) - i) << 3) | (size_etc & 7); }