atom_concat and empty atoms
This commit is contained in:
parent
8baaa70cec
commit
861f185ec6
@ -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);
|
||||||
|
115
C/text.c
115
C/text.c
@ -83,9 +83,9 @@ void *pop_output_text_stack__(int i, void *export) {
|
|||||||
struct mblock *p = LOCAL_TextBuffer->first[lvl];
|
struct mblock *p = LOCAL_TextBuffer->first[lvl];
|
||||||
while (p) {
|
while (p) {
|
||||||
struct mblock *np = p->next;
|
struct mblock *np = p->next;
|
||||||
if (p+1 == export) {
|
if (p + 1 == export) {
|
||||||
size_t sz = p->sz;
|
size_t sz = p->sz;
|
||||||
memcpy(p, p+1, sz);
|
memcpy(p, p + 1, sz);
|
||||||
export = p;
|
export = p;
|
||||||
} else {
|
} else {
|
||||||
free(p);
|
free(p);
|
||||||
@ -309,9 +309,9 @@ static unsigned char *latin2utf8(seq_tv_t *inp) {
|
|||||||
}
|
}
|
||||||
*pt++ = '\0';
|
*pt++ = '\0';
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char *wchar2utf8(seq_tv_t *inp) {
|
static unsigned char *wchar2utf8(seq_tv_t *inp) {
|
||||||
size_t sz = wcslen(inp->val.w) * 4;
|
size_t sz = wcslen(inp->val.w) * 4;
|
||||||
wchar_t *b0 = inp->val.w;
|
wchar_t *b0 = inp->val.w;
|
||||||
unsigned char *buf = Malloc(sz + 1), *pt = buf;
|
unsigned char *buf = Malloc(sz + 1), *pt = buf;
|
||||||
@ -322,36 +322,36 @@ static unsigned char *latin2utf8(seq_tv_t *inp) {
|
|||||||
pt += put_utf8(pt, ch);
|
pt += put_utf8(pt, ch);
|
||||||
*pt++ = '\0';
|
*pt++ = '\0';
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *slice(size_t min, size_t max, const unsigned char *buf USES_REGS);
|
static void *slice(size_t min, size_t max, const unsigned char *buf USES_REGS);
|
||||||
|
|
||||||
static unsigned char *Yap_ListOfCodesToBuffer(unsigned char *buf, Term t,
|
static unsigned char *Yap_ListOfCodesToBuffer(unsigned char *buf, Term t,
|
||||||
seq_tv_t *inp USES_REGS) {
|
seq_tv_t *inp USES_REGS) {
|
||||||
bool codes;
|
bool codes;
|
||||||
unsigned char *nbuf = codes2buf(t, buf, &codes PASS_REGS);
|
unsigned char *nbuf = codes2buf(t, buf, &codes PASS_REGS);
|
||||||
if (!codes)
|
if (!codes)
|
||||||
return NULL;
|
return NULL;
|
||||||
return nbuf;
|
return nbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char *Yap_ListOfAtomsToBuffer(unsigned char *buf, Term t,
|
static unsigned char *Yap_ListOfAtomsToBuffer(unsigned char *buf, Term t,
|
||||||
seq_tv_t *inp USES_REGS) {
|
seq_tv_t *inp USES_REGS) {
|
||||||
bool codes;
|
bool codes;
|
||||||
unsigned char *nbuf = codes2buf(t, buf, &codes PASS_REGS);
|
unsigned char *nbuf = codes2buf(t, buf, &codes PASS_REGS);
|
||||||
if (codes)
|
if (codes)
|
||||||
return NULL;
|
return NULL;
|
||||||
return nbuf;
|
return nbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char *Yap_ListToBuffer(unsigned char *buf, Term t,
|
static unsigned char *Yap_ListToBuffer(unsigned char *buf, Term t,
|
||||||
seq_tv_t *inp USES_REGS) {
|
seq_tv_t *inp USES_REGS) {
|
||||||
unsigned char *nbuf = codes2buf(t, buf, NULL PASS_REGS);
|
unsigned char *nbuf = codes2buf(t, buf, NULL PASS_REGS);
|
||||||
return nbuf;
|
return nbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_GEN_TYPE_ERROR
|
#if USE_GEN_TYPE_ERROR
|
||||||
static yap_error_number gen_type_error(int flags) {
|
static yap_error_number gen_type_error(int flags) {
|
||||||
if ((flags & (YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
if ((flags & (YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
||||||
YAP_STRING_FLOAT | YAP_STRING_ATOMS_CODES | YAP_STRING_BIG)) ==
|
YAP_STRING_FLOAT | YAP_STRING_ATOMS_CODES | YAP_STRING_BIG)) ==
|
||||||
(YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
(YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
||||||
@ -372,12 +372,12 @@ static unsigned char *Yap_ListToBuffer(unsigned char *buf, Term t,
|
|||||||
if (flags & (YAP_STRING_CODES | YAP_STRING_ATOMS))
|
if (flags & (YAP_STRING_CODES | YAP_STRING_ATOMS))
|
||||||
return TYPE_ERROR_LIST;
|
return TYPE_ERROR_LIST;
|
||||||
return TYPE_ERROR_NUMBER;
|
return TYPE_ERROR_NUMBER;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// static int cnt;
|
// static int cnt;
|
||||||
|
|
||||||
unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) {
|
unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) {
|
||||||
|
|
||||||
/* we know what the term is */
|
/* we know what the term is */
|
||||||
if (!(inp->type & (YAP_STRING_CHARS | YAP_STRING_WCHARS))) {
|
if (!(inp->type & (YAP_STRING_CHARS | YAP_STRING_WCHARS))) {
|
||||||
@ -499,9 +499,9 @@ static unsigned char *Yap_ListToBuffer(unsigned char *buf, Term t,
|
|||||||
return wchar2utf8(inp);
|
return wchar2utf8(inp);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Term write_strings(unsigned char *s0, seq_tv_t *out USES_REGS) {
|
static Term write_strings(unsigned char *s0, seq_tv_t *out USES_REGS) {
|
||||||
size_t min = 0, max = strlen((char *)s0);
|
size_t min = 0, max = strlen((char *)s0);
|
||||||
|
|
||||||
if (out->type & (YAP_STRING_NCHARS | YAP_STRING_TRUNC)) {
|
if (out->type & (YAP_STRING_NCHARS | YAP_STRING_TRUNC)) {
|
||||||
@ -529,9 +529,9 @@ static unsigned char *Yap_ListToBuffer(unsigned char *buf, Term t,
|
|||||||
out->val.t = t;
|
out->val.t = t;
|
||||||
|
|
||||||
return out->val.t;
|
return out->val.t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Term write_atoms(void *s0, seq_tv_t *out USES_REGS) {
|
static Term write_atoms(void *s0, seq_tv_t *out USES_REGS) {
|
||||||
Term t = AbsPair(HR);
|
Term t = AbsPair(HR);
|
||||||
char *s1 = (char *)s0;
|
char *s1 = (char *)s0;
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
@ -581,9 +581,9 @@ static unsigned char *Yap_ListToBuffer(unsigned char *buf, Term t,
|
|||||||
}
|
}
|
||||||
out->val.t = t;
|
out->val.t = t;
|
||||||
return (t);
|
return (t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Term write_codes(void *s0, seq_tv_t *out USES_REGS) {
|
static Term write_codes(void *s0, seq_tv_t *out USES_REGS) {
|
||||||
Term t;
|
Term t;
|
||||||
size_t sz = strlen(s0);
|
size_t sz = strlen(s0);
|
||||||
if (sz == 0) {
|
if (sz == 0) {
|
||||||
@ -618,9 +618,9 @@ static unsigned char *Yap_ListToBuffer(unsigned char *buf, Term t,
|
|||||||
}
|
}
|
||||||
out->val.t = t;
|
out->val.t = t;
|
||||||
return (t);
|
return (t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Atom write_atom(void *s0, seq_tv_t *out USES_REGS) {
|
static Atom write_atom(void *s0, seq_tv_t *out USES_REGS) {
|
||||||
unsigned char *s = s0;
|
unsigned char *s = s0;
|
||||||
int32_t ch;
|
int32_t ch;
|
||||||
size_t leng = strlen(s0);
|
size_t leng = strlen(s0);
|
||||||
@ -635,9 +635,9 @@ static unsigned char *Yap_ListToBuffer(unsigned char *buf, Term t,
|
|||||||
memcpy(buf, s0, n + 1);
|
memcpy(buf, s0, n + 1);
|
||||||
return Yap_ULookupAtom(buf);
|
return Yap_ULookupAtom(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *write_buffer(unsigned char *s0, seq_tv_t *out USES_REGS) {
|
void *write_buffer(unsigned char *s0, seq_tv_t *out USES_REGS) {
|
||||||
size_t leng = strlen((char *)s0);
|
size_t leng = strlen((char *)s0);
|
||||||
size_t min = 0, max = leng;
|
size_t min = 0, max = leng;
|
||||||
if (out->enc == ENC_ISO_UTF8) {
|
if (out->enc == ENC_ISO_UTF8) {
|
||||||
@ -702,7 +702,7 @@ static unsigned char *Yap_ListToBuffer(unsigned char *buf, Term t,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return out->val.c;
|
return out->val.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t write_length(const unsigned char *s0, seq_tv_t *out USES_REGS) {
|
static size_t write_length(const unsigned char *s0, seq_tv_t *out USES_REGS) {
|
||||||
return strlen_utf8(s0);
|
return strlen_utf8(s0);
|
||||||
@ -797,9 +797,9 @@ bool write_Text(unsigned char *inp, seq_tv_t *out USES_REGS) {
|
|||||||
default: { return true; }
|
default: { return true; }
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t upcase(void *s0, seq_tv_t *out USES_REGS) {
|
static size_t upcase(void *s0, seq_tv_t *out USES_REGS) {
|
||||||
|
|
||||||
unsigned char *s = s0;
|
unsigned char *s = s0;
|
||||||
while (*s) {
|
while (*s) {
|
||||||
@ -810,9 +810,9 @@ bool write_Text(unsigned char *inp, seq_tv_t *out USES_REGS) {
|
|||||||
s += put_utf8(s, chr);
|
s += put_utf8(s, chr);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t downcase(void *s0, seq_tv_t *out USES_REGS) {
|
static size_t downcase(void *s0, seq_tv_t *out USES_REGS) {
|
||||||
|
|
||||||
unsigned char *s = s0;
|
unsigned char *s = s0;
|
||||||
while (*s) {
|
while (*s) {
|
||||||
@ -823,9 +823,9 @@ bool write_Text(unsigned char *inp, seq_tv_t *out USES_REGS) {
|
|||||||
s += put_utf8(s, chr);
|
s += put_utf8(s, chr);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Yap_CVT_Text(seq_tv_t *inp, seq_tv_t *out USES_REGS) {
|
bool Yap_CVT_Text(seq_tv_t *inp, seq_tv_t *out USES_REGS) {
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
bool rc;
|
bool rc;
|
||||||
/*
|
/*
|
||||||
@ -888,9 +888,9 @@ bool write_Text(unsigned char *inp, seq_tv_t *out USES_REGS) {
|
|||||||
fprintf(stderr, "\n]\n"); */
|
fprintf(stderr, "\n]\n"); */
|
||||||
pop_text_stack(l);
|
pop_text_stack(l);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char *concat(int n, void *sv[] USES_REGS) {
|
static unsigned char *concat(int n, void *sv[] USES_REGS) {
|
||||||
void *buf;
|
void *buf;
|
||||||
unsigned char *buf0;
|
unsigned char *buf0;
|
||||||
size_t room = 0;
|
size_t room = 0;
|
||||||
@ -915,9 +915,9 @@ bool write_Text(unsigned char *inp, seq_tv_t *out USES_REGS) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return buf0;
|
return buf0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *slice(size_t min, size_t max, const unsigned char *buf USES_REGS) {
|
static void *slice(size_t min, size_t max, const unsigned char *buf USES_REGS) {
|
||||||
unsigned char *nbuf = BaseMalloc((max - min) * 4 + 1);
|
unsigned char *nbuf = BaseMalloc((max - min) * 4 + 1);
|
||||||
const unsigned char *ptr = skip_utf8(buf, min);
|
const unsigned char *ptr = skip_utf8(buf, min);
|
||||||
unsigned char *nptr = nbuf;
|
unsigned char *nptr = nbuf;
|
||||||
@ -929,11 +929,11 @@ bool write_Text(unsigned char *inp, seq_tv_t *out USES_REGS) {
|
|||||||
}
|
}
|
||||||
nptr[0] = '\0';
|
nptr[0] = '\0';
|
||||||
return nbuf;
|
return nbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Out must be an atom or a string
|
// Out must be an atom or a string
|
||||||
bool Yap_Concat_Text(int tot, seq_tv_t inp[], seq_tv_t *out USES_REGS) {
|
bool Yap_Concat_Text(int tot, seq_tv_t inp[], seq_tv_t *out USES_REGS) {
|
||||||
void **bufv;
|
void **bufv;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
int i, j;
|
int i, j;
|
||||||
@ -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) {
|
||||||
@ -964,7 +964,7 @@ bool write_Text(unsigned char *inp, seq_tv_t *out USES_REGS) {
|
|||||||
bool rc = write_Text(buf, out PASS_REGS);
|
bool rc = write_Text(buf, out PASS_REGS);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
||||||
@ -1041,9 +1041,9 @@ bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to convert a generic text term (string, atom, list of codes, list
|
* Function to convert a generic text term (string, atom, list of codes, list
|
||||||
of<
|
of<
|
||||||
atoms) into a buff
|
atoms) into a buff
|
||||||
@ -1057,12 +1057,13 @@ bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
|||||||
*
|
*
|
||||||
* @return the buffer, or NULL in case of failure. If so, Yap_Error may be
|
* @return the buffer, or NULL in case of failure. If so, Yap_Error may be
|
||||||
called.
|
called.
|
||||||
*/
|
*/
|
||||||
const char *Yap_TextTermToText(Term t USES_REGS) {
|
const char *Yap_TextTermToText(Term t USES_REGS) {
|
||||||
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;
|
||||||
@ -1070,9 +1071,9 @@ bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
|||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return NULL;
|
return NULL;
|
||||||
return out.val.c;
|
return out.val.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert from a predicate structure to an UTF-8 string of the form
|
* Convert from a predicate structure to an UTF-8 string of the form
|
||||||
*
|
*
|
||||||
* module:name/arity.
|
* module:name/arity.
|
||||||
@ -1083,7 +1084,7 @@ bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
|||||||
*
|
*
|
||||||
* @return the temporary string
|
* @return the temporary string
|
||||||
*/
|
*/
|
||||||
const char *Yap_PredIndicatorToUTF8String(PredEntry *ap) {
|
const char *Yap_PredIndicatorToUTF8String(PredEntry *ap) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Atom at;
|
Atom at;
|
||||||
arity_t arity = 0;
|
arity_t arity = 0;
|
||||||
@ -1131,15 +1132,15 @@ bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
|||||||
at = (Atom)(ap->FunctorOfPred);
|
at = (Atom)(ap->FunctorOfPred);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!stpcpy(s,Yap_AtomToUTF8Text(at))) {
|
if (!stpcpy(s, Yap_AtomToUTF8Text(at))) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
s += strlen(s);
|
s += strlen(s);
|
||||||
snprintf(s, smax - s, "/%" PRIdPTR, arity);
|
snprintf(s, smax - s, "/%" PRIdPTR, arity);
|
||||||
return s0;
|
return s0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert from a text buffer (8-bit) to a term that has the same type as
|
* Convert from a text buffer (8-bit) to a term that has the same type as
|
||||||
* _Tguide_
|
* _Tguide_
|
||||||
*
|
*
|
||||||
@ -1147,8 +1148,8 @@ bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
|||||||
≈ * @param tguide the guide
|
≈ * @param tguide the guide
|
||||||
*
|
*
|
||||||
≈ * @return the term
|
≈ * @return the term
|
||||||
*/
|
*/
|
||||||
Term Yap_MkTextTerm(const char *s, int guide USES_REGS) {
|
Term Yap_MkTextTerm(const char *s, int guide USES_REGS) {
|
||||||
if (guide == YAP_STRING_ATOM) {
|
if (guide == YAP_STRING_ATOM) {
|
||||||
return MkAtomTerm(Yap_LookupAtom(s));
|
return MkAtomTerm(Yap_LookupAtom(s));
|
||||||
} else if (guide == YAP_STRING_STRING) {
|
} else if (guide == YAP_STRING_STRING) {
|
||||||
@ -1158,4 +1159,4 @@ bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
|||||||
} else {
|
} else {
|
||||||
return Yap_CharsToListOfCodes(s, ENC_ISO_UTF8 PASS_REGS);
|
return Yap_CharsToListOfCodes(s, ENC_ISO_UTF8 PASS_REGS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
38
os/charsio.c
38
os/charsio.c
@ -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
|
||||||
@ -1102,9 +1102,10 @@ 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);
|
||||||
|
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
|
||||||
|
Reference in New Issue
Block a user