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