atom_concat and empty atoms

This commit is contained in:
Vitor Santos Costa 2017-10-18 17:03:23 +01:00
parent 8baaa70cec
commit 861f185ec6
3 changed files with 826 additions and 823 deletions

View File

@ -1333,7 +1333,7 @@ restart_aux:
} }
while (t1 != TermNil) { while (t1 != TermNil) {
inpv[i].type = YAP_STRING_ATOM; inpv[i].type = YAP_STRING_ATOM,
inpv[i].val.t = HeadOfTerm(t1); inpv[i].val.t = HeadOfTerm(t1);
i++; i++;
t1 = TailOfTerm(t1); t1 = TailOfTerm(t1);

View File

@ -949,8 +949,8 @@ bool write_Text(unsigned char *inp, seq_tv_t *out USES_REGS) {
if (!nbuf) { if (!nbuf) {
return NULL; return NULL;
} }
if (!nbuf[0]) // if (!nbuf[0])
continue; // continue;
bufv[j++] = nbuf; bufv[j++] = nbuf;
} }
if (j == 0) { if (j == 0) {
@ -1062,7 +1062,8 @@ bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
seq_tv_t inp, out; seq_tv_t inp, out;
inp.val.t = t; inp.val.t = t;
inp.type = Yap_TextType(t); inp.type = Yap_TextType(t);
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_ATOMS_CODES| YAP_STRING_TERM; inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_ATOMS_CODES |
YAP_STRING_TERM;
inp.enc = ENC_ISO_UTF8; inp.enc = ENC_ISO_UTF8;
out.enc = ENC_ISO_UTF8; out.enc = ENC_ISO_UTF8;
out.type = YAP_STRING_CHARS; out.type = YAP_STRING_CHARS;

View File

@ -1104,7 +1104,8 @@ static Int peek_char(USES_REGS1) {
if (sno < 0) if (sno < 0)
return false; return false;
if ((ch = Yap_peek(sno)) < 0) { Int ch = Yap_peek(sno);
if (ch < 0) {
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
return Yap_unify_constant(ARG2, MkAtomTerm(AtomEof)); return Yap_unify_constant(ARG2, MkAtomTerm(AtomEof));
} }
@ -1114,7 +1115,8 @@ if (sno < 0)
return false; return false;
} }
sinp[off] = '\0'; sinp[off] = '\0';
return Yap_unify_constant(ARG2, MkAtomTerm(Yap_ULookupAtom(sinp))); printf("%s\n", simp) return Yap_unify_constant(
ARG2, MkAtomTerm(Yap_ULookupAtom(sinp)));
} }
/** @pred peek_char( - _C_) is iso /** @pred peek_char( - _C_) is iso