utf-8 in text
This commit is contained in:
parent
b2a30b0a53
commit
22c0cbeca3
|
@ -138,7 +138,8 @@ int Yap_open_buf_read_stream(const char *buf, size_t nchars, encoding_t *encp,
|
||||||
|
|
||||||
sno = GetFreeStreamD();
|
sno = GetFreeStreamD();
|
||||||
if (sno < 0)
|
if (sno < 0)
|
||||||
return (PlIOError(RESOURCE_ERROR_MAX_STREAMS, TermNil,
|
return (PlIOError(RESOURCE_ERROR_MAX_STREAMS,
|
||||||
|
TermNil,
|
||||||
"new stream not available for open_mem_read_stream/1"));
|
"new stream not available for open_mem_read_stream/1"));
|
||||||
st = GLOBAL_Stream + sno;
|
st = GLOBAL_Stream + sno;
|
||||||
if (encp)
|
if (encp)
|
||||||
|
|
|
@ -254,7 +254,10 @@ void Yap_DefaultStreamOps(StreamDesc *st) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
st->stream_wputc = put_wchar;
|
st->stream_wputc = put_wchar;
|
||||||
st->stream_wgetc = get_wchar_UTF8;
|
if (st->encoding == ENC_ISO_UTF8)
|
||||||
|
st->stream_wgetc = get_wchar_UTF8;
|
||||||
|
else
|
||||||
|
st->stream_wgetc = get_wchar;
|
||||||
st->stream_putc = FilePutc;
|
st->stream_putc = FilePutc;
|
||||||
st->stream_getc = PlGetc;
|
st->stream_getc = PlGetc;
|
||||||
if (st->status & (Promptable_Stream_f)) {
|
if (st->status & (Promptable_Stream_f)) {
|
||||||
|
|
|
@ -1353,8 +1353,8 @@ static Int style_checker(USES_REGS1) {
|
||||||
Term Yap_BufferToTerm(const unsigned char *s, size_t len, Term opts) {
|
Term Yap_BufferToTerm(const unsigned char *s, size_t len, Term opts) {
|
||||||
Term rval;
|
Term rval;
|
||||||
int sno;
|
int sno;
|
||||||
encoding_t L;
|
encoding_t l = ENC_ISO_UTF8;
|
||||||
sno = Yap_open_buf_read_stream((char *)s, len, &L, MEM_BUF_USER);
|
sno = Yap_open_buf_read_stream((char *)s, len, &l, MEM_BUF_USER);
|
||||||
|
|
||||||
rval = Yap_read_term(sno, opts, false);
|
rval = Yap_read_term(sno, opts, false);
|
||||||
Yap_CloseStream(sno);
|
Yap_CloseStream(sno);
|
||||||
|
|
Reference in New Issue