From c3d0504a5477b5712f2fda6cbea0cdf5e25bfd49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Wed, 12 Mar 2014 15:47:53 +0000 Subject: [PATCH] Avoid using repeated fiels names ( u -> ut ). --- C/absmi.c | 12 ++++++------ C/amasm.c | 4 ++-- C/eval.c | 8 +++++++- C/index.c | 2 +- H/amidefs.h | 4 ++-- H/rclause.h | 4 ++-- H/saveclause.h | 4 ++-- 7 files changed, 22 insertions(+), 16 deletions(-) diff --git a/C/absmi.c b/C/absmi.c index 919bb9eaf..1207f8ad5 100755 --- a/C/absmi.c +++ b/C/absmi.c @@ -4447,7 +4447,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] || @@ -4465,7 +4465,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(); @@ -6159,7 +6159,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] @@ -6171,7 +6171,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(); @@ -6199,7 +6199,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] @@ -6211,7 +6211,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(); diff --git a/C/amasm.c b/C/amasm.c index c6833946f..308bbcb4e 100755 --- a/C/amasm.c +++ b/C/amasm.c @@ -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); diff --git a/C/eval.c b/C/eval.c index cd3257b98..cb1a46143 100644 --- a/C/eval.c +++ b/C/eval.c @@ -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 { diff --git a/C/index.c b/C/index.c index de45c18f6..997187270 100755 --- a/C/index.c +++ b/C/index.c @@ -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); diff --git a/H/amidefs.h b/H/amidefs.h index 7f8395385..eac8956ec 100644 --- a/H/amidefs.h +++ b/H/amidefs.h @@ -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 { diff --git a/H/rclause.h b/H/rclause.h index c77963639..4cf3a05fd 100644 --- a/H/rclause.h +++ b/H/rclause.h @@ -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 */ diff --git a/H/saveclause.h b/H/saveclause.h index 6e1d27fcb..619062b65 100644 --- a/H/saveclause.h +++ b/H/saveclause.h @@ -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 */