Merge branch 'master' of ssh://git.code.sf.net/p/yap/yap-6.3
Conflicts: C/write.c
This commit is contained in:
commit
b532fbd0b9
94
C/amasm.c
94
C/amasm.c
@ -327,16 +327,6 @@ Var_Ref(Ventry *ve, int is_y_var)
|
||||
#define no_ref_var() (((Ventry *) (cip->cpc->rnd1))->NoOfVE == 1)
|
||||
#define no_ref(X) (((Ventry *) (X))->NoOfVE == 1)
|
||||
|
||||
inline static yamop *
|
||||
fill_small(CELL w, yamop *code_p, int pass_no)
|
||||
{
|
||||
SMALLUNSGN *ptr = ((SMALLUNSGN *) (code_p));
|
||||
|
||||
if (pass_no)
|
||||
*ptr = (SMALLUNSGN) w;
|
||||
return (yamop *) (++ptr);
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
fill_a(CELL a, yamop *code_p, int pass_no)
|
||||
{
|
||||
@ -589,78 +579,6 @@ a_v(op_numbers opcodex, op_numbers opcodey, yamop *code_p, int pass_no, struct P
|
||||
return code_p;
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
a_fi(op_numbers opcodex, op_numbers opcodey, yamop *code_p, int pass_no, struct PSEUDO *cpc, UInt lab, struct intermediates *cip)
|
||||
{
|
||||
Ventry *ve = (Ventry *) cpc->rnd1;
|
||||
OPREG var_offset;
|
||||
int is_y_var = (ve->KindOfVE == PermVar);
|
||||
|
||||
var_offset = Var_Ref(ve, is_y_var);
|
||||
if (is_y_var) {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcodey);
|
||||
code_p->u.syl.y = emit_yreg(var_offset);
|
||||
code_p->u.syl.l = emit_a(Unsigned(cip->code_addr) + cip->label_offset[lab]);
|
||||
code_p->u.syl.s = cpc->rnd2;
|
||||
}
|
||||
GONEXT(syl);
|
||||
}
|
||||
else {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcodex);
|
||||
code_p->u.sxl.x = emit_xreg(var_offset);
|
||||
code_p->u.sxl.l = emit_a(Unsigned(cip->code_addr) + cip->label_offset[lab]);
|
||||
code_p->u.sxl.s = cpc->rnd2;
|
||||
}
|
||||
GONEXT(sxl);
|
||||
}
|
||||
return code_p;
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
a_fil(op_numbers opcodex, op_numbers opcodey, yamop *code_p, int pass_no, struct PSEUDO *cpc, UInt lab1, UInt lab2, struct intermediates *cip)
|
||||
{
|
||||
Ventry *ve = (Ventry *) cpc->rnd1;
|
||||
OPREG var_offset;
|
||||
int is_y_var = (ve->KindOfVE == PermVar);
|
||||
|
||||
var_offset = Var_Ref(ve, is_y_var);
|
||||
if (is_y_var) {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcodey);
|
||||
code_p->u.syll.s = cpc->rnd2;
|
||||
code_p->u.syll.y = emit_yreg(var_offset);
|
||||
if (lab1)
|
||||
code_p->u.syll.T = emit_a(Unsigned(cip->code_addr) + cip->label_offset[lab1]);
|
||||
else
|
||||
code_p->u.syll.T = emit_a(Unsigned(NEXTOP(code_p,syll)));
|
||||
if (lab2)
|
||||
code_p->u.syll.F = emit_a(Unsigned(cip->code_addr) + cip->label_offset[lab2]);
|
||||
else
|
||||
code_p->u.syll.F = FAILCODE;
|
||||
}
|
||||
GONEXT(syll);
|
||||
}
|
||||
else {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcodex);
|
||||
code_p->u.sxll.s = cpc->rnd2;
|
||||
code_p->u.sxll.x = emit_xreg(var_offset);
|
||||
if (lab1)
|
||||
code_p->u.sxll.T = emit_a(Unsigned(cip->code_addr) + cip->label_offset[lab1]);
|
||||
else
|
||||
code_p->u.sxll.T = emit_a(Unsigned(NEXTOP(code_p,sxll)));
|
||||
if (lab2)
|
||||
code_p->u.sxll.F = emit_a(Unsigned(cip->code_addr) + cip->label_offset[lab2]);
|
||||
else
|
||||
code_p->u.sxll.F = FAILCODE;
|
||||
}
|
||||
GONEXT(sxll);
|
||||
}
|
||||
return code_p;
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
a_vp(op_numbers opcodex, op_numbers opcodey, yamop *code_p, int pass_no, struct PSEUDO *cpc, clause_info *clinfo)
|
||||
{
|
||||
@ -1424,18 +1342,6 @@ a_dbt(op_numbers opcode, int *clause_has_dbtermp, yamop *code_p, int pass_no, st
|
||||
return code_p;
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
a_rli(op_numbers opcode, int *clause_has_blobsp, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.xc.x = emit_x(cip->cpc->rnd2);
|
||||
code_p->u.xc.c = AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1]));
|
||||
}
|
||||
GONEXT(xc);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
a_r(CELL arnd2, op_numbers opcode, yamop *code_p, int pass_no)
|
||||
{
|
||||
|
@ -683,6 +683,7 @@ p_acomp( USES_REGS1 )
|
||||
}
|
||||
|
||||
/**
|
||||
@[
|
||||
@class arith_eq_2
|
||||
@brief =:=/2: Equality of arithmetic expressions
|
||||
|
||||
@ -726,6 +727,8 @@ a_eq(Term t1, Term t2)
|
||||
}
|
||||
|
||||
/**
|
||||
@}
|
||||
|
||||
@class arith_dif_2
|
||||
@brief =\\=/2: Difference of arithmetic expressions
|
||||
|
||||
|
65
C/eval.c
65
C/eval.c
@ -191,11 +191,7 @@ BEAM_is(void)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@class is_2
|
||||
@anchor is_2
|
||||
@brief evaluation of arithmetic expressions
|
||||
|
||||
<b>? _X_:number is + _Y_:ground is det</b>
|
||||
@pred is( X:number, + Y:ground) is det
|
||||
|
||||
This predicate succeeds iff the result of evaluating the expression
|
||||
_Y_ unifies with _X_. This is the predicate normally used to
|
||||
@ -228,11 +224,7 @@ p_is( USES_REGS1 )
|
||||
}
|
||||
|
||||
/**
|
||||
@class isnan_1
|
||||
@anchor isnan_1
|
||||
@brief True if _X_ is not a number
|
||||
|
||||
<b> isnan(? _X_:float) is det</b>
|
||||
@pred isnan(? X:float) is det
|
||||
|
||||
Interface to the IEE754 `isnan` test.
|
||||
*/
|
||||
@ -266,11 +258,7 @@ p_isnan( USES_REGS1 )
|
||||
}
|
||||
|
||||
/**
|
||||
@class isinf_1
|
||||
@anchor isinf_1
|
||||
@brief True if _X_ is infinity
|
||||
|
||||
<b> isnan(? _X_:float) is det</b>
|
||||
@pred isinf(? X:float) is det</b>
|
||||
|
||||
Interface to the IEE754 `isinf` test.
|
||||
*/
|
||||
@ -305,11 +293,7 @@ p_isinf( USES_REGS1 )
|
||||
}
|
||||
|
||||
/**
|
||||
@class logsum_3
|
||||
@anchor logsum_3
|
||||
@brief sum of two logarithms
|
||||
|
||||
<b> logsum(+ _Log1_, + _Log2_, - _Out_ ) is det </b>
|
||||
@pred logsum(+ Log1:float, + Log2:float, - Out:float ) is det
|
||||
|
||||
True if _Log1_ is the logarithm of the positive number _A1_,
|
||||
_Log2_ is the logarithm of the positive number _A2_, and
|
||||
@ -413,6 +397,22 @@ Yap_ArithError(yap_error_number type, Term where, char *format,...)
|
||||
return 0L;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@{
|
||||
|
||||
@pred between(+ Low:int, + High:int, ? Value:int) is nondet
|
||||
|
||||
_Low_ and _High_ are integers, _High_ \>= _Low_. If
|
||||
_Value_ is an integer, _Low_ =\< _Value_
|
||||
=\< _High_. When _Value_ is a variable it is successively
|
||||
bound to all integers between _Low_ and _High_. If
|
||||
_High_ is inf or infinite between/3 is true iff
|
||||
_Value_ \>= _Low_, a feature that is particularly interesting
|
||||
for generating integers from a certain value.
|
||||
|
||||
*/
|
||||
|
||||
static Int cont_between( USES_REGS1 )
|
||||
{
|
||||
Term t1 = EXTRA_CBACK_ARG(3,1);
|
||||
@ -447,25 +447,6 @@ static Int cont_between( USES_REGS1 )
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@class between_3
|
||||
@anchor between_3
|
||||
@brief sequence of numbers
|
||||
|
||||
between(+ _Low_:int, + _High_:int, ? _Value_:int) is nondet
|
||||
|
||||
_Low_ and _High_ are integers, _High_ \>= _Low_. If
|
||||
_Value_ is an integer, _Low_ =\< _Value_
|
||||
=\< _High_. When _Value_ is a variable it is successively
|
||||
bound to all integers between _Low_ and _High_. If
|
||||
_High_ is inf or infinite [between/3](@ref between_3) is true iff
|
||||
_Value_ \>= _Low_, a feature that is particularly interesting
|
||||
for generating integers from a certain value.
|
||||
|
||||
@}
|
||||
|
||||
*/
|
||||
|
||||
static Int
|
||||
init_between( USES_REGS1 )
|
||||
{
|
||||
@ -561,6 +542,12 @@ init_between( USES_REGS1 )
|
||||
return cont_between( PASS_REGS1 );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @}
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
void
|
||||
Yap_InitEval(void)
|
||||
{
|
||||
|
@ -913,7 +913,10 @@ p_style_checker( USES_REGS1 )
|
||||
Term h = HeadOfTerm( t );
|
||||
t = TailOfTerm( t );
|
||||
|
||||
if (IsAtomTerm(h)) {
|
||||
if (IsVarTerm(h)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, t, "style_check/1");
|
||||
return (FALSE);
|
||||
} if (IsAtomTerm(h)) {
|
||||
Atom at = AtomOfTerm( h );
|
||||
if (at == AtomAtom) debugstatus.styleCheck |= LONGATOM_CHECK;
|
||||
else if (at == AtomSingleton) debugstatus.styleCheck |= SINGLETON_CHECK;
|
||||
|
336
C/write.c
336
C/write.c
@ -1,19 +1,19 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* YAP Prolog *
|
||||
* *
|
||||
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
||||
* *
|
||||
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
||||
* *
|
||||
**************************************************************************
|
||||
* *
|
||||
* File: write.c *
|
||||
* Last rev: *
|
||||
* mods: *
|
||||
* comments: Writing a Prolog Term *
|
||||
* *
|
||||
*************************************************************************/
|
||||
* *
|
||||
* YAP Prolog *
|
||||
* *
|
||||
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
||||
* *
|
||||
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
||||
* *
|
||||
**************************************************************************
|
||||
* *
|
||||
* File: write.c *
|
||||
* Last rev: *
|
||||
* mods: *
|
||||
* comments: Writing a Prolog Term *
|
||||
* *
|
||||
*************************************************************************/
|
||||
#ifdef SCCS
|
||||
static char SccsId[] = "%W% %G%";
|
||||
#endif
|
||||
@ -98,7 +98,7 @@ static void writeTerm(Term, int, int, int, struct write_globs *, struct rewind_t
|
||||
/*
|
||||
protect bracket from merging with previoous character.
|
||||
avoid stuff like not (2,3) -> not(2,3) or
|
||||
*/
|
||||
*/
|
||||
static void
|
||||
wropen_bracket(struct write_globs *wglb, int protect)
|
||||
{
|
||||
@ -237,7 +237,7 @@ write_mpint(MP_INT *big, struct write_globs *wglb) {
|
||||
}
|
||||
#endif
|
||||
|
||||
/* writes a bignum */
|
||||
/* writes a bignum */
|
||||
static void
|
||||
writebig(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, struct rewind_term *rwt)
|
||||
{
|
||||
@ -865,7 +865,7 @@ write_list(Term t, int direction, int depth, struct write_globs *wglb, struct re
|
||||
writeTerm(from_pointer(RepPair(t)+1, &nrwt, wglb), 999, depth, FALSE, wglb, &nrwt);
|
||||
restore_from_write(&nrwt, wglb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
@ -874,6 +874,7 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
||||
/* context priority */
|
||||
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
CACHE_REGS
|
||||
struct rewind_term nrwt;
|
||||
nrwt.parent = rwt;
|
||||
@ -936,6 +937,108 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
||||
Atom atom;
|
||||
int op, lp, rp;
|
||||
|
||||
if (IsExtensionFunctor(functor)) {
|
||||
switch((CELL)functor) {
|
||||
case (CELL)FunctorDouble:
|
||||
wrputf(FloatOfTerm(t),wglb);
|
||||
return;
|
||||
case (CELL)FunctorString:
|
||||
write_string(StringOfTerm(t),wglb);
|
||||
return;
|
||||
case (CELL)FunctorAttVar:
|
||||
write_var(RepAppl(t)+1, wglb, &nrwt);
|
||||
return;
|
||||
case (CELL)FunctorDBRef:
|
||||
wrputref(RefOfTerm(t), wglb->Quote_illegal, wglb);
|
||||
return;
|
||||
case (CELL)FunctorLongInt:
|
||||
wrputn(LongIntOfTerm(t),wglb);
|
||||
return;
|
||||
/* case (CELL)FunctorBigInt: */
|
||||
default:
|
||||
writebig(t, p, depth, rinfixarg, wglb, rwt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Arity = ArityOfFunctor(functor);
|
||||
atom = NameOfFunctor(functor);
|
||||
#ifdef SFUNC
|
||||
if (Arity == SFArity) {
|
||||
int argno = 1;
|
||||
CELL *p = ArgsOfSFTerm(t);
|
||||
putAtom(atom, wglb->Quote_illegal, wglb);
|
||||
wropen_bracket(wglb, FALSE);
|
||||
lastw = separator;
|
||||
while (*p) {
|
||||
Int sl = 0;
|
||||
|
||||
while (argno < *p) {
|
||||
wrputc('_', wglb->stream), wrputc(',', wglb->stream);
|
||||
++argno;
|
||||
=======
|
||||
CACHE_REGS
|
||||
struct rewind_term nrwt;
|
||||
nrwt.parent = rwt;
|
||||
nrwt.u_sd.s.ptr = 0;
|
||||
|
||||
if (wglb->MaxDepth != 0 && depth > wglb->MaxDepth) {
|
||||
putAtom(Atom3Dots, wglb->Quote_illegal, wglb);
|
||||
return;
|
||||
>>>>>>> 596768a56b69ad4170d5ca0f18dcc7a0f55316e9
|
||||
}
|
||||
if (EX)
|
||||
return;
|
||||
t = Deref(t);
|
||||
if (IsVarTerm(t)) {
|
||||
write_var((CELL *)t, wglb, &nrwt);
|
||||
} else if (IsIntTerm(t)) {
|
||||
wrputn((Int) IntOfTerm(t),wglb);
|
||||
} else if (IsAtomTerm(t)) {
|
||||
putAtom(AtomOfTerm(t), wglb->Quote_illegal, wglb);
|
||||
} else if (IsPairTerm(t)) {
|
||||
if (wglb->Ignore_ops) {
|
||||
wrputs("'.'(",wglb->stream);
|
||||
lastw = separator;
|
||||
writeTerm(from_pointer(RepPair(t), &nrwt, wglb), 999, depth + 1, FALSE, wglb, &nrwt);
|
||||
t = AbsPair(restore_from_write(&nrwt, wglb));
|
||||
wrputs(",",wglb->stream);
|
||||
writeTerm(from_pointer(RepPair(t)+1, &nrwt, wglb), 999, depth + 1, FALSE, wglb, &nrwt);
|
||||
restore_from_write(&nrwt, wglb);
|
||||
wrclose_bracket(wglb, TRUE);
|
||||
return;
|
||||
}
|
||||
if (wglb->Use_portray) {
|
||||
Term targs[1];
|
||||
struct DB_TERM *old_EX = NULL;
|
||||
Int sl = 0;
|
||||
|
||||
targs[0] = t;
|
||||
Yap_PutValue(AtomPortray, MkAtomTerm(AtomNil));
|
||||
if (EX) old_EX = EX;
|
||||
sl = Yap_InitSlot(t PASS_REGS);
|
||||
Yap_execute_goal(Yap_MkApplTerm(FunctorPortray, 1, targs), 0, 1);
|
||||
t = Yap_GetFromSlot(sl PASS_REGS);
|
||||
Yap_RecoverSlots(1 PASS_REGS);
|
||||
if (old_EX != NULL) EX = old_EX;
|
||||
if (Yap_GetValue(AtomPortray) == MkAtomTerm(AtomTrue))
|
||||
return;
|
||||
}
|
||||
if (yap_flags[WRITE_QUOTED_STRING_FLAG] && IsCodesTerm(t)) {
|
||||
putString(t, wglb);
|
||||
} else {
|
||||
wrputc('[', wglb->stream);
|
||||
lastw = separator;
|
||||
/* we assume t was already saved in the stack */
|
||||
write_list(t, 0, depth, wglb, rwt);
|
||||
wrputc(']', wglb->stream);
|
||||
lastw = separator;
|
||||
}
|
||||
} else { /* compound term */
|
||||
Functor functor = FunctorOfTerm(t);
|
||||
int Arity;
|
||||
Atom atom;
|
||||
int op, lp, rp;
|
||||
|
||||
if (IsExtensionFunctor(functor)) {
|
||||
switch((CELL)functor) {
|
||||
case (CELL)FunctorDouble:
|
||||
@ -988,6 +1091,7 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
<<<<<<< HEAD
|
||||
if (wglb->Use_portray) {
|
||||
Term targs[1];
|
||||
struct DB_TERM *old_EX = NULL;
|
||||
@ -1096,6 +1200,195 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
||||
!IsVarTerm(tright) && IsAtomTerm(tright) &&
|
||||
Yap_IsOp(AtomOfTerm(tright));
|
||||
|
||||
if (op > p) {
|
||||
/* avoid stuff such as \+ (a,b) being written as \+(a,b) */
|
||||
wropen_bracket(wglb, TRUE);
|
||||
lastw = separator;
|
||||
}
|
||||
if (bracket_left) {
|
||||
wropen_bracket(wglb, TRUE);
|
||||
}
|
||||
writeTerm(from_pointer(RepAppl(t)+1, &nrwt, wglb), lp, depth + 1, rinfixarg, wglb, &nrwt);
|
||||
t = AbsAppl(restore_from_write(&nrwt, wglb)-1);
|
||||
if (bracket_left) {
|
||||
wrclose_bracket(wglb, TRUE);
|
||||
}
|
||||
/* avoid quoting commas and bars */
|
||||
if (!strcmp(RepAtom(atom)->StrOfAE,",")) {
|
||||
wrputc(',', wglb->stream);
|
||||
lastw = separator;
|
||||
} else if (!strcmp(RepAtom(atom)->StrOfAE,"|")) {
|
||||
wrputc('|', wglb->stream);
|
||||
lastw = separator;
|
||||
} else
|
||||
putAtom(atom, wglb->Quote_illegal, wglb);
|
||||
if (bracket_right) {
|
||||
wropen_bracket(wglb, TRUE);
|
||||
}
|
||||
writeTerm(from_pointer(RepAppl(t)+2, &nrwt, wglb), rp, depth + 1, TRUE, wglb, &nrwt);
|
||||
restore_from_write(&nrwt, wglb);
|
||||
if (bracket_right) {
|
||||
wrclose_bracket(wglb, TRUE);
|
||||
}
|
||||
if (op > p) {
|
||||
wrclose_bracket(wglb, TRUE);
|
||||
}
|
||||
} else if (wglb->Handle_vars && functor == LOCAL_FunctorVar) {
|
||||
Term ti = ArgOfTerm(1, t);
|
||||
if (lastw == alphanum) {
|
||||
wrputc(' ', wglb->stream);
|
||||
}
|
||||
if (!IsVarTerm(ti) && (IsIntTerm(ti) || IsCodesTerm(ti) || IsAtomTerm(ti))) {
|
||||
if (IsIntTerm(ti)) {
|
||||
Int k = IntOfTerm(ti);
|
||||
if (k == -1) {
|
||||
wrputc('_', wglb->stream);
|
||||
lastw = alphanum;
|
||||
return;
|
||||
} else {
|
||||
wrputc((k % 26) + 'A', wglb->stream);
|
||||
if (k >= 26) {
|
||||
/* make sure we don't get confused about our context */
|
||||
lastw = separator;
|
||||
wrputn( k / 26 ,wglb);
|
||||
} else
|
||||
lastw = alphanum;
|
||||
}
|
||||
} else if (IsAtomTerm(ti)) {
|
||||
putAtom(AtomOfTerm(ti), FALSE, wglb);
|
||||
} else {
|
||||
putUnquotedString(ti, wglb);
|
||||
}
|
||||
} else {
|
||||
wrputs("'$VAR'(",wglb->stream);
|
||||
lastw = separator;
|
||||
writeTerm(from_pointer(RepAppl(t)+1, &nrwt, wglb), 999, depth + 1, FALSE, wglb, &nrwt);
|
||||
restore_from_write(&nrwt, wglb);
|
||||
wrclose_bracket(wglb, TRUE);
|
||||
}
|
||||
} else if (!wglb->Ignore_ops && functor == FunctorBraces) {
|
||||
wrputc('{', wglb->stream);
|
||||
lastw = separator;
|
||||
writeTerm(from_pointer(RepAppl(t)+1, &nrwt, wglb), 1200, depth + 1, FALSE, wglb, &nrwt);
|
||||
restore_from_write(&nrwt, wglb);
|
||||
wrputc('}', wglb->stream);
|
||||
lastw = separator;
|
||||
} else if (atom == AtomArray) {
|
||||
wrputc('{', wglb->stream);
|
||||
lastw = separator;
|
||||
for (op = 1; op <= Arity; ++op) {
|
||||
if (op == wglb->MaxArgs) {
|
||||
wrputs("...", wglb->stream);
|
||||
break;
|
||||
=======
|
||||
if (wglb->Use_portray) {
|
||||
Term targs[1];
|
||||
struct DB_TERM *old_EX = NULL;
|
||||
Int sl = 0;
|
||||
|
||||
targs[0] = t;
|
||||
Yap_PutValue(AtomPortray, MkAtomTerm(AtomNil));
|
||||
if (EX) old_EX = EX;
|
||||
sl = Yap_InitSlot(t PASS_REGS);
|
||||
Yap_execute_goal(Yap_MkApplTerm(FunctorPortray, 1, targs),0, 1);
|
||||
t = Yap_GetFromSlot(sl PASS_REGS);
|
||||
Yap_RecoverSlots(1 PASS_REGS);
|
||||
if (old_EX) EX = old_EX;
|
||||
if (Yap_GetValue(AtomPortray) == MkAtomTerm(AtomTrue) || EX)
|
||||
return;
|
||||
}
|
||||
if (!wglb->Ignore_ops &&
|
||||
Arity == 1 &&
|
||||
Yap_IsPrefixOp(atom, &op, &rp)
|
||||
) {
|
||||
Term tright = ArgOfTerm(1, t);
|
||||
int bracket_right =
|
||||
!IsVarTerm(tright) && IsAtomTerm(tright) &&
|
||||
Yap_IsOp(AtomOfTerm(tright));
|
||||
if (op > p) {
|
||||
wropen_bracket(wglb, TRUE);
|
||||
}
|
||||
putAtom(atom, wglb->Quote_illegal, wglb);
|
||||
if (bracket_right) {
|
||||
/* avoid stuff such as \+ (a,b) being written as \+(a,b) */
|
||||
wropen_bracket(wglb, TRUE);
|
||||
} else if (atom == AtomMinus) {
|
||||
last_minus = TRUE;
|
||||
}
|
||||
writeTerm(from_pointer(RepAppl(t)+1, &nrwt, wglb), rp, depth + 1, TRUE, wglb, &nrwt);
|
||||
restore_from_write(&nrwt, wglb);
|
||||
if (bracket_right) {
|
||||
wrclose_bracket(wglb, TRUE);
|
||||
}
|
||||
if (op > p) {
|
||||
wrclose_bracket(wglb, TRUE);
|
||||
}
|
||||
} else if (!wglb->Ignore_ops &&
|
||||
( Arity == 1 || ((atom == AtomEmptyBrackets || atom == AtomEmptyCurlyBrackets || atom == AtomEmptySquareBrackets) && !IsVarTerm(ArgOfTerm(1, t)))) &&
|
||||
Yap_IsPosfixOp(atom, &op, &lp)) {
|
||||
Term tleft = ArgOfTerm(1, t);
|
||||
|
||||
int bracket_left, offset;
|
||||
|
||||
if (Arity != 1) {
|
||||
tleft = ArgOfTerm(1, t);
|
||||
offset = 2;
|
||||
} else {
|
||||
tleft = ArgOfTerm(1, t);
|
||||
offset = 1;
|
||||
}
|
||||
bracket_left =
|
||||
!IsVarTerm(tleft) &&
|
||||
IsAtomTerm(tleft) &&
|
||||
Yap_IsOp(AtomOfTerm(tleft));
|
||||
if (op > p) {
|
||||
/* avoid stuff such as \+ (a,b) being written as \+(a,b) */
|
||||
wropen_bracket(wglb, TRUE);
|
||||
}
|
||||
if (bracket_left) {
|
||||
wropen_bracket(wglb, TRUE);
|
||||
}
|
||||
writeTerm(from_pointer(RepAppl(t)+offset, &nrwt, wglb), lp, depth + 1, rinfixarg, wglb, &nrwt);
|
||||
restore_from_write(&nrwt, wglb);
|
||||
if (bracket_left) {
|
||||
wrclose_bracket(wglb, TRUE);
|
||||
}
|
||||
if (Arity > 1) {
|
||||
if (atom == AtomEmptyBrackets) {
|
||||
wrputc('(', wglb->stream);
|
||||
} else if (atom == AtomEmptySquareBrackets) {
|
||||
wrputc('[', wglb->stream);
|
||||
} else if (atom == AtomEmptyCurlyBrackets) {
|
||||
wrputc('{', wglb->stream);
|
||||
}
|
||||
lastw = separator;
|
||||
write_list(ArgOfTerm(1,t), 0, depth, wglb, rwt);
|
||||
if (atom == AtomEmptyBrackets) {
|
||||
wrputc(')', wglb->stream);
|
||||
} else if (atom == AtomEmptySquareBrackets) {
|
||||
wrputc(']', wglb->stream);
|
||||
} else if (atom == AtomEmptyCurlyBrackets) {
|
||||
wrputc('}', wglb->stream);
|
||||
}
|
||||
lastw = separator;
|
||||
} else {
|
||||
putAtom(atom, wglb->Quote_illegal, wglb);
|
||||
}
|
||||
if (op > p) {
|
||||
wrclose_bracket(wglb, TRUE);
|
||||
}
|
||||
} else if (!wglb->Ignore_ops &&
|
||||
Arity == 2 && Yap_IsInfixOp(atom, &op, &lp,
|
||||
&rp) ) {
|
||||
Term tleft = ArgOfTerm(1, t);
|
||||
Term tright = ArgOfTerm(2, t);
|
||||
int bracket_left =
|
||||
!IsVarTerm(tleft) && IsAtomTerm(tleft) &&
|
||||
Yap_IsOp(AtomOfTerm(tleft));
|
||||
int bracket_right =
|
||||
!IsVarTerm(tright) && IsAtomTerm(tright) &&
|
||||
Yap_IsOp(AtomOfTerm(tright));
|
||||
|
||||
if (op > p) {
|
||||
/* avoid stuff such as \+ (a,b) being written as \+(a,b) */
|
||||
wropen_bracket(wglb, TRUE);
|
||||
@ -1206,14 +1499,15 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
||||
}
|
||||
wrclose_bracket(wglb, TRUE);
|
||||
}
|
||||
>>>>>>> 596768a56b69ad4170d5ca0f18dcc7a0f55316e9
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Yap_plwrite(Term t, void *mywrite, int max_depth, int flags, int priority)
|
||||
/* term to be written */
|
||||
/* consumer */
|
||||
/* write options */
|
||||
/* term to be written */
|
||||
/* consumer */
|
||||
/* write options */
|
||||
{
|
||||
struct write_globs wglb;
|
||||
struct rewind_term rwt;
|
||||
|
@ -367,7 +367,8 @@ class YAPParams;
|
||||
*/
|
||||
class YAPEngine {
|
||||
public:
|
||||
YAPEngine(YAPParams const& params);
|
||||
YAPEngine(YAPParams const& params); /// construct a new engine
|
||||
YAPQuery *query( char *s ) { return new YAPQuery( s ); } /// build a query on the engine
|
||||
};
|
||||
|
||||
/**
|
||||
|
2
H/eval.h
2
H/eval.h
@ -235,7 +235,7 @@ typedef enum {
|
||||
* 0 == 2.22e-16
|
||||
* 0 == 0
|
||||
* false.
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
op_log10,
|
||||
op_sqrt,
|
||||
|
2
configure
vendored
2
configure
vendored
@ -15419,7 +15419,7 @@ if test "$yap_cv_swig" = "no"; then
|
||||
PKG_SWIG=""
|
||||
elif test -e "$srcdir"/packages/swig/Makefile.in ; then
|
||||
SWIG_TARGET="all"
|
||||
PKG_SWIG="swig"
|
||||
PKG_SWIG="packages/swig"
|
||||
fi
|
||||
|
||||
if test "$PKG_SWIG" != ""; then
|
||||
|
180
docs/doxygen.rc
180
docs/doxygen.rc
@ -1,4 +1,4 @@
|
||||
# Doxyfile 1.8.6
|
||||
# Doxyfile 1.8.7
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# doxygen (www.doxygen.org) for a project.
|
||||
@ -70,6 +70,14 @@ OUTPUT_DIRECTORY = doxout
|
||||
|
||||
CREATE_SUBDIRS = YES
|
||||
|
||||
# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
|
||||
# characters to appear in the names of generated files. If set to NO, non-ASCII
|
||||
# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
|
||||
# U+3044.
|
||||
# The default value is: NO.
|
||||
|
||||
ALLOW_UNICODE_NAMES = NO
|
||||
|
||||
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
|
||||
# documentation generated by doxygen is written. Doxygen will use this
|
||||
# information to generate all constant output in the proper language.
|
||||
@ -110,7 +118,17 @@ REPEAT_BRIEF = YES
|
||||
# the entity):The $name class, The $name widget, The $name file, is, provides,
|
||||
# specifies, contains, represents, a, an and the.
|
||||
|
||||
ABBREVIATE_BRIEF = "The $name class" "The $name widget" "The $name file" is provides specifies contains represents a an the
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
|
||||
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
|
||||
# doxygen will generate a detailed section even if there is only a brief
|
||||
@ -220,8 +238,11 @@ TAB_SIZE = 4
|
||||
# "Side Effects:". You can put \n's in the value part of an alias to insert
|
||||
# newlines.
|
||||
|
||||
ALIASES = "predicate=@brief" "doxygen=\if english" "endenglish=\endif" "dutch=\if dutch" "enddutch=\endif"
|
||||
|
||||
ALIASES = "predicate=@brief" \
|
||||
"doxygen=\if english" \
|
||||
"endenglish=\endif" \
|
||||
"dutch=\if dutch" \
|
||||
"enddutch=\endif"
|
||||
|
||||
# This tag can be used to specify a number of word-keyword mappings (TCL only).
|
||||
# A mapping has the form "name=value". For example adding "class=itcl::class"
|
||||
@ -237,8 +258,6 @@ TCL_SUBST =
|
||||
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
|
||||
OPTIMIZE_OUTPUT_FOR_PROLOG = YES
|
||||
|
||||
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
|
||||
# Python sources only. Doxygen will then generate output that is more tailored
|
||||
# for that language. For instance, namespaces will be presented as packages,
|
||||
@ -259,21 +278,31 @@ OPTIMIZE_FOR_FORTRAN = NO
|
||||
|
||||
OPTIMIZE_OUTPUT_VHDL = NO
|
||||
|
||||
# Set the OPTIMIZE_OUTPUT_PROLOG tag to YES if your project consists of Prolog
|
||||
# sources. Doxygen will then generate output that is tailored for Prolog.
|
||||
# The default value is: NO.
|
||||
|
||||
OPTIMIZE_OUTPUT_FOR_PROLOG = YES
|
||||
|
||||
# Doxygen selects the parser to use depending on the extension of the files it
|
||||
# parses. With this tag you can assign which parser to use for a given
|
||||
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
||||
# using this tag. The format is ext=language, where ext is a file extension, and
|
||||
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
|
||||
# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
|
||||
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
|
||||
# (default is Fortran), use: inc=Fortran f=C.
|
||||
# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
|
||||
# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
|
||||
# Fortran. In the later case the parser tries to guess whether the code is fixed
|
||||
# or free formatted code, this is the default for Fortran type files), VHDL. For
|
||||
# instance to make doxygen treat .inc files as Fortran files (default is PHP),
|
||||
# and .f files as C (default is Fortran), use: inc=Fortran f=C.
|
||||
#
|
||||
# Note For files without extension you can use no_extension as a placeholder.
|
||||
#
|
||||
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
|
||||
# the files are not read by doxygen.
|
||||
|
||||
EXTENSION_MAPPING = md pl=Prolog
|
||||
EXTENSION_MAPPING = md \
|
||||
pl=Prolog
|
||||
|
||||
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
|
||||
# according to the Markdown format, which allows for more readable
|
||||
@ -603,7 +632,7 @@ GENERATE_BUGLIST = YES
|
||||
# the documentation.
|
||||
# The default value is: YES.
|
||||
|
||||
GENERATE_DEPRECATEDLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
|
||||
# The ENABLED_SECTIONS tag can be used to enable conditional documentation
|
||||
# sections, marked by \if <section_label> ... \endif and \cond <section_label>
|
||||
@ -746,7 +775,15 @@ WARN_LOGFILE =
|
||||
# spaces.
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = docs/yap.md pl/absf.yap C/cmppreds.c C/eval.c H/eval.h C/arith0.c C/arith1.c C/arith2.c pl/arithpreds.yap CXX
|
||||
INPUT = docs/yap.md \
|
||||
pl \
|
||||
C \
|
||||
H \
|
||||
include \
|
||||
os \
|
||||
packages \
|
||||
library \
|
||||
CXX
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
@ -766,7 +803,51 @@ INPUT_ENCODING = UTF-8
|
||||
# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
|
||||
# *.qsf, *.as and *.js.
|
||||
|
||||
FILE_PATTERNS = *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.idl *.ddl *.odl *.h *.h.in *.hh *.hxx *.hpp *.h++ *.cs *.d *.php *.php4 *.php5 *.phtml *.inc *.m *.markdown *.md *.mm *.dox *.py *.f90 *.f *.for *.tcl *.vhd *.vhdl *.ucf *.qsf *.as *.js *.pl *.yap
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cc \
|
||||
*.cxx \
|
||||
*.cpp \
|
||||
*.c++ \
|
||||
*.java \
|
||||
*.ii \
|
||||
*.ixx \
|
||||
*.ipp \
|
||||
*.i++ \
|
||||
*.inl \
|
||||
*.idl \
|
||||
*.ddl \
|
||||
*.odl \
|
||||
*.h \
|
||||
*.h.in \
|
||||
*.hh \
|
||||
*.hxx \
|
||||
*.hpp \
|
||||
*.h++ \
|
||||
*.cs \
|
||||
*.d \
|
||||
*.php \
|
||||
*.php4 \
|
||||
*.php5 \
|
||||
*.phtml \
|
||||
*.inc \
|
||||
*.m \
|
||||
*.markdown \
|
||||
*.md \
|
||||
*.mm \
|
||||
*.dox \
|
||||
*.py \
|
||||
*.f90 \
|
||||
*.f \
|
||||
*.for \
|
||||
*.tcl \
|
||||
*.vhd \
|
||||
*.vhdl \
|
||||
*.ucf \
|
||||
*.qsf \
|
||||
*.as \
|
||||
*.js \
|
||||
*.pl \
|
||||
*.yap
|
||||
|
||||
# The RECURSIVE tag can be used to specify whether or not subdirectories should
|
||||
# be searched for input files as well.
|
||||
@ -970,25 +1051,6 @@ USE_HTAGS = NO
|
||||
|
||||
VERBATIM_HEADERS = YES
|
||||
|
||||
# If the CLANG_ASSISTED_PARSING tag is set to YES, then doxygen will use the
|
||||
# clang parser (see: http://clang.llvm.org/) for more acurate parsing at the
|
||||
# cost of reduced performance. This can be particularly helpful with template
|
||||
# rich C++ code for which doxygen's built-in parser lacks the necessary type
|
||||
# information.
|
||||
# Note: The availability of this option depends on whether or not doxygen was
|
||||
# compiled with the --with-libclang option.
|
||||
# The default value is: NO.
|
||||
|
||||
CLANG_ASSISTED_PARSING = NO
|
||||
|
||||
# If clang assisted parsing is enabled you can provide the compiler with command
|
||||
# line options that you would normally use when invoking the compiler. Note that
|
||||
# the include paths will already be set by doxygen for the files and directories
|
||||
# specified with INPUT and INCLUDE_PATH.
|
||||
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
|
||||
|
||||
CLANG_OPTIONS =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
@ -1252,7 +1314,8 @@ GENERATE_CHI = NO
|
||||
CHM_INDEX_ENCODING =
|
||||
|
||||
# The BINARY_TOC flag controls whether a binary table of contents is generated (
|
||||
# YES) or a normal table of contents ( NO) in the .chm file.
|
||||
# YES) or a normal table of contents ( NO) in the .chm file. Furthermore it
|
||||
# enables the Previous and Next buttons.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
@ -1492,11 +1555,11 @@ SEARCHENGINE = YES
|
||||
|
||||
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
||||
# implemented using a web server instead of a web client using Javascript. There
|
||||
# are two flavours of web server based searching depending on the
|
||||
# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
|
||||
# searching and an index file used by the script. When EXTERNAL_SEARCH is
|
||||
# enabled the indexing and searching needs to be provided by external tools. See
|
||||
# the section "External Indexing and Searching" for details.
|
||||
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
|
||||
# setting. When disabled, doxygen will generate a PHP script for searching and
|
||||
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
|
||||
# and searching needs to be provided by external tools. See the section
|
||||
# "External Indexing and Searching" for details.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||
|
||||
@ -1624,17 +1687,19 @@ EXTRA_PACKAGES =
|
||||
#
|
||||
# Note: Only use a user-defined header if you know what you are doing! The
|
||||
# following commands have a special meaning inside the header: $title,
|
||||
# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
|
||||
# replace them by respectively the title of the page, the current date and time,
|
||||
# only the current date, the version number of doxygen, the project name (see
|
||||
# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
|
||||
# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
|
||||
# $projectbrief, $projectlogo. Doxygen will replace $title with the empy string,
|
||||
# for the replacement values of the other commands the user is refered to
|
||||
# HTML_HEADER.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_HEADER =
|
||||
|
||||
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
|
||||
# generated LaTeX document. The footer should contain everything after the last
|
||||
# chapter. If it is left blank doxygen will generate a standard footer.
|
||||
# chapter. If it is left blank doxygen will generate a standard footer. See
|
||||
# LATEX_HEADER for more information on how to generate a default footer and what
|
||||
# special commands can be used inside the footer.
|
||||
#
|
||||
# Note: Only use a user-defined footer if you know what you are doing!
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
@ -1784,6 +1849,13 @@ MAN_OUTPUT = man
|
||||
|
||||
MAN_EXTENSION = .3
|
||||
|
||||
# The MAN_SUBDIR tag determines the name of the directory created within
|
||||
# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
|
||||
# MAN_EXTENSION with the initial . removed.
|
||||
# This tag requires that the tag GENERATE_MAN is set to YES.
|
||||
|
||||
MAN_SUBDIR =
|
||||
|
||||
# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
|
||||
# will generate one additional man file for each entity documented in the real
|
||||
# man page(s). These additional files only source the real man page, but without
|
||||
@ -1811,18 +1883,6 @@ GENERATE_XML = YES
|
||||
|
||||
XML_OUTPUT = xml
|
||||
|
||||
# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
|
||||
# validating XML parser to check the syntax of the XML files.
|
||||
# This tag requires that the tag GENERATE_XML is set to YES.
|
||||
|
||||
XML_SCHEMA =
|
||||
|
||||
# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
|
||||
# validating XML parser to check the syntax of the XML files.
|
||||
# This tag requires that the tag GENERATE_XML is set to YES.
|
||||
|
||||
XML_DTD =
|
||||
|
||||
# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
|
||||
# listings (including syntax highlighting and cross-referencing information) to
|
||||
# the XML output. Note that enabling this will significantly increase the size
|
||||
@ -1969,9 +2029,9 @@ PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
|
||||
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
|
||||
# remove all refrences to function-like macros that are alone on a line, have an
|
||||
# all uppercase name, and do not end with a semicolon. Such function macros are
|
||||
# typically used for boiler-plate code, and will confuse the parser if not
|
||||
# remove all references to function-like macros that are alone on a line, have
|
||||
# an all uppercase name, and do not end with a semicolon. Such function macros
|
||||
# are typically used for boiler-plate code, and will confuse the parser if not
|
||||
# removed.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
@ -1991,7 +2051,7 @@ SKIP_FUNCTION_MACROS = YES
|
||||
# where loc1 and loc2 can be relative or absolute paths or URLs. See the
|
||||
# section "Linking to external documentation" for more information about the use
|
||||
# of tag files.
|
||||
# Note: Each tag file must have an unique name (where the name does NOT include
|
||||
# Note: Each tag file must have a unique name (where the name does NOT include
|
||||
# the path). If a tag file is not located in the directory in which doxygen is
|
||||
# run, you must also specify the path to the tagfile here.
|
||||
|
||||
@ -2071,7 +2131,7 @@ HIDE_UNDOC_RELATIONS = YES
|
||||
# set to NO
|
||||
# The default value is: NO.
|
||||
|
||||
HAVE_DOT = YES
|
||||
HAVE_DOT = NO
|
||||
|
||||
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
|
||||
# to run in parallel. When set to 0 doxygen will base this on the number of
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
:- initialization(main).
|
||||
|
||||
:- dynamic val/2, item/2, last_node/2, indent/1.
|
||||
:- dynamic val/2, item/2, last_node/2, indent/1, pred/4.
|
||||
|
||||
get_arg( Inp, Out ) :-
|
||||
unix( argv( [Inp, Out] ) ), !.
|
||||
@ -69,7 +69,8 @@ scan_file( Inp ) :-
|
||||
item( Item0 , ItLines ),
|
||||
atom_string(A2, Item0),
|
||||
cvt_slash( Pred, Key ),
|
||||
assert_static( pred( A1, Key, A2, Inp:ItLines ) ),
|
||||
\+ pred(_, Key, _, _ ),
|
||||
assert( pred( A1, Key, A2, Inp:ItLines ) ),
|
||||
fail
|
||||
;
|
||||
% look for predicates
|
||||
@ -281,12 +282,12 @@ process("@item", Line, Rest, NewLine , FilePos) :-
|
||||
(
|
||||
Env = "@table",
|
||||
atom_string( A, Line ),
|
||||
pred( _Pred, Key, A, FilePos )
|
||||
pred( _Pred, _Key, A, FilePos )
|
||||
->
|
||||
push( list, it(Env, Item, Pos, NNumb) ),
|
||||
(
|
||||
% sendout the comand
|
||||
format(string(NewLine), '~t~s ~*+<li>~s @anchor ~a', [Marker, Pos1, First, Key]),
|
||||
format(string(NewLine), '~t~s ~*+<li>~s @anchor ~a', [Marker, Pos1, First, _Key]),
|
||||
push( indent, done )
|
||||
;
|
||||
NewLine = force
|
||||
@ -601,8 +602,8 @@ simplify( [0'q,0'Q|L]) --> "=", !,
|
||||
simplify(L).
|
||||
simplify( [0'q,0'U|L]) --> "?", !,
|
||||
simplify(L).
|
||||
simplify( [0'_|L]) --> "/", !,
|
||||
simplify(L).
|
||||
simplify( [] ) --> "/",
|
||||
number, !.
|
||||
simplify( [0's,0'S|L]) --> "<", !,
|
||||
simplify(L).
|
||||
simplify( [0'u,0'U|L]) --> "\v", !,
|
||||
@ -627,6 +628,11 @@ simplify( L) --> [_], !,
|
||||
simplify(L).
|
||||
simplify( []) --> [].
|
||||
|
||||
number --> [].
|
||||
number --> [C],
|
||||
{ C >= "0" , C =< "9" },
|
||||
number.
|
||||
|
||||
|
||||
first_word(Line, Word, Rest) :-
|
||||
jmp_blanks( Line, Line2 ),
|
||||
|
21
docs/yap.tex
21
docs/yap.tex
@ -6830,6 +6830,7 @@ attributes from other known solvers/modules via the module prefix in
|
||||
* CLPR Non-linear Constraints::
|
||||
@end menu
|
||||
|
||||
|
||||
@include clpr.tex
|
||||
|
||||
@node CHR, Logtalk, CLPR, Top
|
||||
@ -6856,7 +6857,7 @@ systems or by using the @code{Logtalk - YAP} shortcut in the Logtalk
|
||||
program group in the Start Menu on Windows systems. For more information
|
||||
please see the URL @url{http://logtalk.org/}.
|
||||
|
||||
@node MYDDAS, Threads, Logtalk, Extensions
|
||||
@node MYDDAS, Real, Logtalk, Extensions
|
||||
@section MYDDAS
|
||||
@cindex MYDDAS
|
||||
|
||||
@ -7608,8 +7609,18 @@ action, report an error, we could use the following SQL mode.
|
||||
You can see the available SQL Modes at the MySQL homepage at
|
||||
@url{http://www.mysql.org}.
|
||||
|
||||
@node Threads, Parallelism, MYDDAS, Extensions
|
||||
@section Threads
|
||||
@node Real, Threads, MYDDAS, Extensions
|
||||
|
||||
@chapter Real:: Talking to the R language
|
||||
|
||||
@ifplaintext
|
||||
|
||||
@copydoc real
|
||||
|
||||
@end ifplaintext
|
||||
|
||||
@node Threads, Parallelism, Real, Extensions
|
||||
@chapter Threads
|
||||
|
||||
YAP implements a SWI-Prolog compatible multithreading
|
||||
library. Like in SWI-Prolog, Prolog threads have their own stacks and
|
||||
@ -9006,9 +9017,9 @@ being designed to work with the swig (@url(www.swig.org}) interface compiler.
|
||||
<ul>
|
||||
<li> The original YAP C-interface exports the YAP engine.
|
||||
</li>
|
||||
<li>The @subpage swi-c-interface emulates Jan Wielemaker's SWI foreign language interface.
|
||||
<li>The @ref swi-c-interface emulates Jan Wielemaker's SWI foreign language interface.
|
||||
</li>
|
||||
<li>The @subpage yap-cplus-interface is desiged to interface with Object-Oriented systems.
|
||||
<li>The @ref yap-cplus-interface is desiged to interface with Object-Oriented systems.
|
||||
</li>
|
||||
</ul>
|
||||
@end ifplaintext
|
||||
|
@ -14,6 +14,14 @@
|
||||
* *
|
||||
* *
|
||||
*************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file blobs.c
|
||||
*
|
||||
* @addtogroup swi-c-interface
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <Yap.h>
|
||||
#include <Yatom.h>
|
||||
@ -248,3 +256,7 @@ Yap_install_blobs(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -5,29 +5,17 @@
|
||||
* Email: steve.moyle@comlab.ox.ac.uk
|
||||
* Date: 21 January 2002
|
||||
|
||||
* Copyright (c) 2002 Steve Moyle. All rights reserved.
|
||||
* Copyright (c) 2002-2014 Vitor Santos Costa from an original version by Steve Moyle. All rights reserved.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @defgroup swi-c-interface SWI-Prolog Foreign Language Interface.
|
||||
* @file swi.c
|
||||
*
|
||||
* @addtogroup swi-c-interface
|
||||
*
|
||||
* @tableofcontents
|
||||
*
|
||||
* A reimplementation of Jan Wielemaker's SWI-Prolog C-language interface, it supports
|
||||
* most of the functionality in the original implementation. It allows for:
|
||||
*
|
||||
* - Term Construction, Access, and Unification
|
||||
* - Manipulation of Atoms, Strings, Lists of Codes and Lists of Atoms
|
||||
* - Query evaluation
|
||||
* - Thread and Prolog engine management
|
||||
* - Data-Base Access
|
||||
*
|
||||
* In this interface, all Prolog data known by C is referenced through term references (term_t), hence
|
||||
* Prolog has all the information necessary to perform its memory management without special precautions
|
||||
* from the C programmer.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define PL_KERNEL 1
|
||||
@ -3267,3 +3255,8 @@ int WINAPI win_yap2swi(HANDLE hinst, DWORD reason, LPVOID reserved)
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
@ -1,3 +1,37 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* YAP Prolog *
|
||||
* *
|
||||
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
||||
* *
|
||||
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-2014 *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
/**
|
||||
@file swi.h
|
||||
|
||||
@defgroup swi-c-interface SWI-Prolog Foreign Language Interface
|
||||
|
||||
*
|
||||
* @tableofcontents
|
||||
*
|
||||
* A reimplementation of Jan Wielemaker's SWI-Prolog C-language interface, it supports
|
||||
* most of the functionality in the original implementation. It allows for:
|
||||
*
|
||||
* - Term Construction, Access, and Unification
|
||||
* - Manipulation of Atoms, Strings, Lists of Codes and Lists of Atoms
|
||||
* - Query evaluation
|
||||
* - Thread and Prolog engine management
|
||||
* - Data-Base Access
|
||||
*
|
||||
* In this interface, all Prolog data known by C is referenced through term references (term_t), hence
|
||||
* Prolog has all the information necessary to perform its memory management without special precautions
|
||||
* from the C programmer.
|
||||
|
||||
@{
|
||||
|
||||
*/
|
||||
void Yap_swi_install(void);
|
||||
void Yap_install_blobs(void);
|
||||
|
||||
@ -61,3 +95,7 @@ FunctorToSWIFunctor(Functor at)
|
||||
}
|
||||
|
||||
#define isDefinedProcedure(pred) TRUE // TBD
|
||||
|
||||
/**
|
||||
@}
|
||||
*/
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 10fd754c6561313835d4e1ff557d654b3225365e
|
||||
Subproject commit ed5039a28f03b2a8ceb4182c269fa2ca324b6ce4
|
@ -28,16 +28,16 @@ python/yap_wrap.c: $(srcdir)/yap.i
|
||||
python/yap_wrap.o: python/yap_wrap.c
|
||||
$(CXX) -c $(CXXFLAGS) @PYTHON_INCLUDES@ $< -o $@
|
||||
|
||||
java: java/libyap.@SO@ java/yap.java
|
||||
java: jni/libyap.@SO@ java/yap.java
|
||||
cd java ; $(JAVAC) *.java; $(JAR) cvf yap.jar *.class
|
||||
|
||||
java/libyap.@SO@: jni/yap_wrap.o
|
||||
$(CXX) -shared $(LDSOFLAGS) -L ../.. -lYap -o java/libyap.@SO@ ../../yapi.o java/yap_wrap.o $(LIBS) @JPLLDFLAGS@ -L ../.. -lYap -lpthread
|
||||
jni/libyap.@SO@: jni/yap_wrap.o
|
||||
$(CXX) -shared $(LDSOFLAGS) -L ../.. -lYap -o $@ ../../yapi.o $< $(LIBS) @JPLLDFLAGS@ -L ../.. -lYap -lpthread
|
||||
|
||||
jni/yap_wrap.c: $(srcdir)/yap.i
|
||||
$(SWIG) -c++ -java -package pt.up.fc.dcc.yap -outdir src/pt/up/fc/dcc/yap -o $@ $(DEFS) $(CPPFLAGS) -Wall $<
|
||||
$(SWIG) -c++ -java -package pt.up.fc.dcc.yap -outdir java -o $@ $(DEFS) $(CPPFLAGS) -Wall $<
|
||||
|
||||
java/yap_wrap.o: java/yap_wrap.c
|
||||
jni/yap_wrap.o: jni/yap_wrap.c
|
||||
$(CXX) -c $(CXXFLAGS) @JPLCFLAGS@ $< -o $@
|
||||
|
||||
R:
|
||||
|
@ -16,7 +16,7 @@ if test "$yap_cv_swig" = "no"; then
|
||||
PKG_SWIG=""
|
||||
elif test -e "$srcdir"/packages/swig/Makefile.in ; then
|
||||
SWIG_TARGET="all"
|
||||
PKG_SWIG="swig"
|
||||
PKG_SWIG="packages/swig"
|
||||
fi
|
||||
|
||||
if test "$PKG_SWIG" != ""; then
|
||||
|
@ -137,7 +137,6 @@ style_check_(+charset) :-
|
||||
style_check_(-charset) :-
|
||||
'$style_checker'( [ -charset ] ).
|
||||
style_check_('?'(Info) ) :-
|
||||
'$style_checker '( [ L ] ),
|
||||
lists:member( Style, [ singleton, discontiguous, multiple ] ),
|
||||
( lists:member(Style, L ) -> Info = +Style ; Info = -Style ).
|
||||
style_check_([]).
|
||||
|
@ -378,17 +378,26 @@ use_module(M,F,Is) :-
|
||||
'$use_module'(M,F,Is) :-
|
||||
var(Is), !,
|
||||
'$use_module'(M,F,all).
|
||||
'$use_module'(M,F,Is) :- nonvar(M), !,
|
||||
'$use_module'(M,F,Is) :-
|
||||
nonvar(F), !,
|
||||
strip_module(F, M0, F0),
|
||||
'$load_files'(M0:F0, [if(not_loaded),must_be_module(true),imports(Is)], use_module(M,F,Is)),
|
||||
( var(M) -> true
|
||||
;
|
||||
absolute_file_name( F0, F1, [expand(true),file_type(prolog)] ),
|
||||
recorded('$module','$module'(F1,M,_,_),_)
|
||||
).
|
||||
'$use_module'(M,F,Is) :-
|
||||
nonvar(M), !,
|
||||
strip_module(F, M0, F0),
|
||||
(
|
||||
recorded('$module','$module'(F1,M,_,_),_)
|
||||
->
|
||||
'$load_files'(F1, [if(not_loaded),must_be_module(true),imports(Is)], use_module(M,F,Is))
|
||||
'$load_files'(M0:F1, [if(not_loaded),must_be_module(true),imports(Is)], use_module(M,F,Is))
|
||||
),
|
||||
strip_module(F, _, F0),
|
||||
(var(F0) -> F0 = F1 ; absolute_file_name( F1, F0, [file_type(prolog)] ) ).
|
||||
(var(F0) -> F0 = F1 ; absolute_file_name( F1, F2, [expand(true),file_type(prolog)] ) -> F2 = F0 ).
|
||||
'$use_module'(M,F,Is) :-
|
||||
strip_module(F, M0, F0),
|
||||
'$load_files'(F0, [if(not_loaded),'$context_module'(M0),must_be_module(true),imports(Is)], use_module(M,F,Is)).
|
||||
'$do_error'(instantiation_error,use_module(M,F,Is)).
|
||||
|
||||
'$csult'(Fs, M) :-
|
||||
'$extract_minus'(Fs, MFs), !,
|
||||
|
12
pl/flags.yap
12
pl/flags.yap
@ -320,10 +320,10 @@ yap_flag(discontiguous_warnings,X) :-
|
||||
var(X), !,
|
||||
style_check(?(Disc)),
|
||||
( Disc = +discontiguous,
|
||||
`X = on
|
||||
X = on
|
||||
;
|
||||
Disc = -discontiguous,
|
||||
`X = off
|
||||
X = off
|
||||
), !.
|
||||
yap_flag(discontiguous_warnings,X) :-
|
||||
'$transl_to_on_off'(_,X), !,
|
||||
@ -339,10 +339,10 @@ yap_flag(redefine_warnings,X) :-
|
||||
var(X), !,
|
||||
style_check(?(Disc)),
|
||||
( Disc = +multiple,
|
||||
`X = on
|
||||
X = on
|
||||
;
|
||||
Disc = -multiple,
|
||||
`X = off
|
||||
X = off
|
||||
), !.
|
||||
yap_flag(redefine_warnings,X) :-
|
||||
'$transl_to_on_off'(_,X), !,
|
||||
@ -382,10 +382,10 @@ yap_flag(single_var_warnings,X) :-
|
||||
var(X), !,
|
||||
style_check(?(Disc)),
|
||||
( Disc = +singletons,
|
||||
`X = on
|
||||
X = on
|
||||
;
|
||||
Disc = -singletons,
|
||||
`X = off
|
||||
X = off
|
||||
), !.
|
||||
yap_flag(single_var_warnings,X) :-
|
||||
'$transl_to_on_off'(_,X), !,
|
||||
|
Reference in New Issue
Block a user