This commit is contained in:
Vitor Santos Costa
2017-02-20 15:48:22 +00:00
15 changed files with 84 additions and 201 deletions

View File

@@ -385,15 +385,16 @@ int Yap_FormatFloat(Float f, char **s, size_t sz) {
sno = Yap_open_buf_write_stream(GLOBAL_Stream[LOCAL_c_output_stream].encoding,
0);
if (sno < 0)
return FALSE;
return false;
wglb.lw = separator;
wglb.stream = GLOBAL_Stream + sno;
wrputf(f, &wglb);
wrputc('\0', wglb.stream);
so = Yap_MemExportStreamPtr(sno);
*s = Malloc( strlen(so) )+1;
strcpy(*s, so );
Yap_CloseStream(sno);
*s = so;
return TRUE;
return true;
}
/* writes a data base reference */
@@ -567,8 +568,8 @@ static void write_string(const unsigned char *s,
do {
int delta;
ptr += (delta = get_utf8(ptr, -1, &chr) );
if (chr == '\0')
if (chr == '\0') {
break;
if (delta == 0) {chr = *ptr++; }
write_quoted(chr, qt, stream);
@@ -1259,7 +1260,7 @@ char *Yap_TermToString(Term t, size_t *lengthp, encoding_t enc, int flags) {
int sno = Yap_open_buf_write_stream(enc, flags);
const char *sf;
DBTerm *e = LOCAL_BallTerm;
if (sno < 0)
return NULL;
LOCAL_c_output_stream = sno;