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);

1585
C/text.c

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,19 @@
/************************************************************************* /*************************************************************************
* * * *
* YAP Prolog * * YAP Prolog *
* * * *
* Yap Prolog was developed at NCCUP - Universidade do Porto * * Yap Prolog was developed at NCCUP - Universidade do Porto *
* * * *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * * Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
* * * *
************************************************************************** **************************************************************************
* * * *
* File: charcodes.c * * File: charcodes.c *
* Last rev: 5/2/88 * * Last rev: 5/2/88 *
* mods: * * mods: *
* comments: Character codes and character conversion * * comments: Character codes and character conversion *
* * * *
*************************************************************************/ *************************************************************************/
#ifdef SCCS #ifdef SCCS
static char SccsId[] = "%W% %G%"; static char SccsId[] = "%W% %G%";
#endif #endif
@ -504,7 +504,7 @@ static Int get_byte_1(USES_REGS1) { /* '$get_byte'(Stream,-N) */
status = GLOBAL_Stream[sno].status; status = GLOBAL_Stream[sno].status;
if (!(status & Binary_Stream_f) if (!(status & Binary_Stream_f)
// &&strictISOFlag() // &&strictISOFlag()
) { ) {
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
Yap_Error(PERMISSION_ERROR_INPUT_TEXT_STREAM, ARG1, "get_byte/1"); Yap_Error(PERMISSION_ERROR_INPUT_TEXT_STREAM, ARG1, "get_byte/1");
return (FALSE); return (FALSE);
@ -843,7 +843,7 @@ static Int put_byte_1(USES_REGS1) { /* '$put_byte'(Stream,N) */
LOCK(GLOBAL_Stream[sno].streamlock); LOCK(GLOBAL_Stream[sno].streamlock);
if (!(GLOBAL_Stream[sno].status & Binary_Stream_f) if (!(GLOBAL_Stream[sno].status & Binary_Stream_f)
//&& strictISOFlag() //&& strictISOFlag()
) { ) {
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
Yap_Error(PERMISSION_ERROR_OUTPUT_BINARY_STREAM, ARG1, "get0/2"); Yap_Error(PERMISSION_ERROR_OUTPUT_BINARY_STREAM, ARG1, "get0/2");
return (FALSE); return (FALSE);
@ -1102,19 +1102,21 @@ static Int peek_char(USES_REGS1) {
unsigned char sinp[16]; unsigned char sinp[16];
Int ch; Int ch;
if (sno < 0) if (sno < 0)
return false; return false;
if ((ch = Yap_peek(sno)) < 0) { Int ch = Yap_peek(sno);
UNLOCK(GLOBAL_Stream[sno].streamlock); if (ch < 0) {
return Yap_unify_constant(ARG2, MkAtomTerm(AtomEof)); UNLOCK(GLOBAL_Stream[sno].streamlock);
} return Yap_unify_constant(ARG2, MkAtomTerm(AtomEof));
UNLOCK(GLOBAL_Stream[sno].streamlock); }
int off = put_utf8(sinp, ch); UNLOCK(GLOBAL_Stream[sno].streamlock);
if (off < 0) { int off = put_utf8(sinp, ch);
return false; if (off < 0) {
} return false;
sinp[off] = '\0'; }
return Yap_unify_constant(ARG2, MkAtomTerm(Yap_ULookupAtom(sinp))); sinp[off] = '\0';
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