Ulrich Neumerkel's patch so that variables are declared in front of a block.
This commit is contained in:
parent
a8e3af4c33
commit
2016e118b3
@ -610,7 +610,6 @@ char *Yap_op_names[_std_top + 1] =
|
|||||||
Int
|
Int
|
||||||
Yap_absmi(int inp)
|
Yap_absmi(int inp)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if BP_FREE
|
#if BP_FREE
|
||||||
/* some function might be using bp for an internal variable, it is the
|
/* some function might be using bp for an internal variable, it is the
|
||||||
callee's responsability to save it */
|
callee's responsability to save it */
|
||||||
@ -7422,6 +7421,7 @@ Yap_absmi(int inp)
|
|||||||
BOp(execute_cpred, pp);
|
BOp(execute_cpred, pp);
|
||||||
{
|
{
|
||||||
PredEntry *pt0;
|
PredEntry *pt0;
|
||||||
|
|
||||||
BEGD(d0);
|
BEGD(d0);
|
||||||
CACHE_Y_AS_ENV(YREG);
|
CACHE_Y_AS_ENV(YREG);
|
||||||
#ifdef FROZEN_STACKS
|
#ifdef FROZEN_STACKS
|
||||||
@ -7466,10 +7466,12 @@ Yap_absmi(int inp)
|
|||||||
FAIL();
|
FAIL();
|
||||||
else DEPTH = RESET_DEPTH();
|
else DEPTH = RESET_DEPTH();
|
||||||
}
|
}
|
||||||
} else if (pt0->ModuleOfPred)
|
} else if (pt0->ModuleOfPred) {
|
||||||
DEPTH -= MkIntConstant(2);
|
DEPTH -= MkIntConstant(2);
|
||||||
|
}
|
||||||
#endif /* DEPTH_LIMIT */
|
#endif /* DEPTH_LIMIT */
|
||||||
/* now call C-Code */
|
/* now call C-Code */
|
||||||
|
{
|
||||||
CPredicate f = PREG->u.pp.p->cs.f_code;
|
CPredicate f = PREG->u.pp.p->cs.f_code;
|
||||||
yamop *oldPREG = PREG;
|
yamop *oldPREG = PREG;
|
||||||
saveregs();
|
saveregs();
|
||||||
@ -7494,6 +7496,7 @@ Yap_absmi(int inp)
|
|||||||
/* call the new code */
|
/* call the new code */
|
||||||
CACHE_A1();
|
CACHE_A1();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
JMPNext();
|
JMPNext();
|
||||||
ENDCACHE_Y_AS_ENV();
|
ENDCACHE_Y_AS_ENV();
|
||||||
ENDD(d0);
|
ENDD(d0);
|
||||||
|
@ -594,12 +594,14 @@ p_power(Term t1, Term t2)
|
|||||||
static inline Int
|
static inline Int
|
||||||
ipow(Int x, Int p)
|
ipow(Int x, Int p)
|
||||||
{
|
{
|
||||||
|
Int r;
|
||||||
|
|
||||||
if (p == 0) return 1L;
|
if (p == 0) return 1L;
|
||||||
if (x == 0 && p > 0) return 0L;
|
if (x == 0 && p > 0) return 0L;
|
||||||
if(p < 0)
|
if(p < 0)
|
||||||
return (-p % 2) ? x : 1L;
|
return (-p % 2) ? x : 1L;
|
||||||
|
|
||||||
Int r = 1L;
|
r = 1L;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if(p & 1) {
|
if(p & 1) {
|
||||||
if (mul_overflow((r*x), r, x)) {
|
if (mul_overflow((r*x), r, x)) {
|
||||||
|
@ -547,8 +547,8 @@ a_cmp(Term t1, Term t2)
|
|||||||
}
|
}
|
||||||
t1 = Yap_Eval(t1);
|
t1 = Yap_Eval(t1);
|
||||||
if (IsIntegerTerm(t1)) {
|
if (IsIntegerTerm(t1)) {
|
||||||
t2 = Yap_Eval(t2);
|
|
||||||
Int i1 = IntegerOfTerm(t1);
|
Int i1 = IntegerOfTerm(t1);
|
||||||
|
t2 = Yap_Eval(t2);
|
||||||
|
|
||||||
if (IsIntegerTerm(t2)) {
|
if (IsIntegerTerm(t2)) {
|
||||||
Int i2 = IntegerOfTerm(t2);
|
Int i2 = IntegerOfTerm(t2);
|
||||||
@ -565,8 +565,8 @@ a_cmp(Term t1, Term t2)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else if (IsFloatTerm(t1)) {
|
} else if (IsFloatTerm(t1)) {
|
||||||
t2 = Yap_Eval(t2);
|
|
||||||
Float f1 = FloatOfTerm(t1);
|
Float f1 = FloatOfTerm(t1);
|
||||||
|
t2 = Yap_Eval(t2);
|
||||||
|
|
||||||
if (IsIntegerTerm(t2)) {
|
if (IsIntegerTerm(t2)) {
|
||||||
Int i2 = IntegerOfTerm(t2);
|
Int i2 = IntegerOfTerm(t2);
|
||||||
|
@ -2354,6 +2354,8 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR)
|
|||||||
/* next, clean trail */
|
/* next, clean trail */
|
||||||
source = dest = (tr_fr_ptr)Yap_TrailBase;
|
source = dest = (tr_fr_ptr)Yap_TrailBase;
|
||||||
while (source < old_TR) {
|
while (source < old_TR) {
|
||||||
|
CELL trail_cell;
|
||||||
|
|
||||||
while (next && source == next->cp_tr) {
|
while (next && source == next->cp_tr) {
|
||||||
choiceptr b = next;
|
choiceptr b = next;
|
||||||
b->cp_tr = dest;
|
b->cp_tr = dest;
|
||||||
@ -2361,7 +2363,7 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR)
|
|||||||
b->cp_b = current;
|
b->cp_b = current;
|
||||||
current = b;
|
current = b;
|
||||||
}
|
}
|
||||||
CELL trail_cell = TrailTerm(source);
|
trail_cell = TrailTerm(source);
|
||||||
if (trail_cell != (CELL)source) {
|
if (trail_cell != (CELL)source) {
|
||||||
dest++;
|
dest++;
|
||||||
}
|
}
|
||||||
|
@ -6744,6 +6744,10 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
|
|||||||
}
|
}
|
||||||
update_clause_choice_point(ipc->u.OtILl.n,ap_pc);
|
update_clause_choice_point(ipc->u.OtILl.n,ap_pc);
|
||||||
return ipc->u.OtILl.d;
|
return ipc->u.OtILl.d;
|
||||||
|
#if TABLING
|
||||||
|
case _table_try_single:
|
||||||
|
return (LogUpdClause *)ClauseCodeToStaticClause(ipc);
|
||||||
|
#endif
|
||||||
case _trust_logical:
|
case _trust_logical:
|
||||||
case _count_trust_logical:
|
case _count_trust_logical:
|
||||||
case _profiled_trust_logical:
|
case _profiled_trust_logical:
|
||||||
|
14
C/iopreds.c
14
C/iopreds.c
@ -184,10 +184,12 @@ static encoding_t
|
|||||||
DefaultEncoding(void)
|
DefaultEncoding(void)
|
||||||
{
|
{
|
||||||
char *s = getenv("LANG");
|
char *s = getenv("LANG");
|
||||||
|
size_t sz;
|
||||||
|
|
||||||
/* if we don't have a LNAG then just use ISO_LATIN1 */
|
/* if we don't have a LNAG then just use ISO_LATIN1 */
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
return ENC_ISO_LATIN1;
|
return ENC_ISO_LATIN1;
|
||||||
int sz = strlen(s);
|
sz = strlen(s);
|
||||||
if (sz > 5) {
|
if (sz > 5) {
|
||||||
if (s[sz-5] == 'U' &&
|
if (s[sz-5] == 'U' &&
|
||||||
s[sz-4] == 'T' &&
|
s[sz-4] == 'T' &&
|
||||||
@ -3490,11 +3492,13 @@ p_has_bom (void)
|
|||||||
|
|
||||||
static Int
|
static Int
|
||||||
p_representation_error (void)
|
p_representation_error (void)
|
||||||
{ /* '$representation_error'(+Stream,-ErrorMessage) */
|
{
|
||||||
|
/* '$representation_error'(+Stream,-ErrorMessage) */
|
||||||
|
Term t;
|
||||||
Int sno = CheckStream (ARG1, Input_Stream_f|Output_Stream_f, "representation_errors/1");
|
Int sno = CheckStream (ARG1, Input_Stream_f|Output_Stream_f, "representation_errors/1");
|
||||||
if (sno < 0)
|
if (sno < 0)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
Term t = Deref(ARG2);
|
t = Deref(ARG2);
|
||||||
|
|
||||||
if (IsVarTerm(t)) {
|
if (IsVarTerm(t)) {
|
||||||
UNLOCK(Stream[sno].streamlock);
|
UNLOCK(Stream[sno].streamlock);
|
||||||
@ -5883,6 +5887,8 @@ static Int
|
|||||||
p_same_file(void) {
|
p_same_file(void) {
|
||||||
char *f1 = RepAtom(AtomOfTerm(Deref(ARG1)))->StrOfAE;
|
char *f1 = RepAtom(AtomOfTerm(Deref(ARG1)))->StrOfAE;
|
||||||
char *f2 = RepAtom(AtomOfTerm(Deref(ARG2)))->StrOfAE;
|
char *f2 = RepAtom(AtomOfTerm(Deref(ARG2)))->StrOfAE;
|
||||||
|
int out;
|
||||||
|
|
||||||
if (strcmp(f1,f2) == 0)
|
if (strcmp(f1,f2) == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#if HAVE_LSTAT
|
#if HAVE_LSTAT
|
||||||
@ -5934,7 +5940,7 @@ p_same_file(void) {
|
|||||||
/* file does not exist, but was opened? Return -1 */
|
/* file does not exist, but was opened? Return -1 */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
int out = (b1->st_ino == b2->st_ino
|
out = (b1->st_ino == b2->st_ino
|
||||||
#ifdef __LCC__
|
#ifdef __LCC__
|
||||||
&& memcmp((const void *)&(b1->st_dev),(const void *)&(b2->st_dev),sizeof(buf1.st_dev)) == 0
|
&& memcmp((const void *)&(b1->st_dev),(const void *)&(b2->st_dev),sizeof(buf1.st_dev)) == 0
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user