diff --git a/C/text.c b/C/text.c index 0eb879955..12f19f81d 100644 --- a/C/text.c +++ b/C/text.c @@ -378,6 +378,7 @@ Yap_readText( void *buf, seq_tv_t *inp, encoding_t *enc, int *minimal, size_t *l // this is a term, extract the UTF8 representation if ( IsStringTerm(inp->val.t)) { + const char *s = inp->val.t; *enc = ENC_ISO_UTF8; *minimal = FALSE; if (lengp) diff --git a/os/charsio.c b/os/charsio.c index 6409e9ef3..5360040c0 100644 --- a/os/charsio.c +++ b/os/charsio.c @@ -102,7 +102,7 @@ plUnGetc( int sno, int ch ) return ungetc(ch, GLOBAL_Stream[sno].file); } -static Int dopeek( int sno ) +Int Yap_peek( int sno ) { CACHE_REGS Int ocharcount, olinecount, olinepos; @@ -163,7 +163,7 @@ at_end_of_stream ( USES_REGS1 ) if (GLOBAL_Stream[sno].status & Binary_Stream_f) { out = ( dopeek_byte(sno) < 0 ); } else { - out = ( dopeek(sno) < 0 ); + out = ( Yap_peek(sno) < 0 ); } } UNLOCK(GLOBAL_Stream[sno].streamlock); @@ -179,7 +179,7 @@ at_end_of_stream_0 ( USES_REGS1 ) int sno = LOCAL_c_input_stream; out = GLOBAL_Stream[sno].status & Eof_Stream_f; if (!out) { - out = ( dopeek(sno) < 0 ); + out = ( Yap_peek(sno) < 0 ); } UNLOCK(GLOBAL_Stream[sno].streamlock); return out; @@ -793,10 +793,10 @@ peek_code ( USES_REGS1 ) return FALSE; if (GLOBAL_Stream[sno].status & Binary_Stream_f) { UNLOCK(GLOBAL_Stream[sno].streamlock); - PlIOError(PERMISSION_ERROR_INPUT_BINARY_STREAM, ARG1, "peek_code/2"); + Yap_Error(PERMISSION_ERROR_INPUT_BINARY_STREAM, ARG1, "peek_code/2"); return FALSE; } - if ((ch = dopeek( sno )) < 0) { + if ((ch = Yap_peek( sno )) < 0) { UNLOCK(GLOBAL_Stream[sno].streamlock); return false; } @@ -827,7 +827,7 @@ peek_code_1 ( USES_REGS1 ) Yap_Error(PERMISSION_ERROR_INPUT_BINARY_STREAM, ARG1, "peek_code/2"); return FALSE; } - if ((ch = dopeek( sno )) < 0) { + if ((ch = Yap_peek( sno )) < 0) { UNLOCK(GLOBAL_Stream[sno].streamlock); return false; } @@ -919,7 +919,7 @@ peek_char ( USES_REGS1 ) Yap_Error(PERMISSION_ERROR_INPUT_TEXT_STREAM, ARG1, "peek_byte/2"); return(FALSE); } - if ((ch = dopeek( sno )) < 0) { + if ((ch = Yap_peek( sno )) < 0) { UNLOCK(GLOBAL_Stream[sno].streamlock); return false; } @@ -945,7 +945,7 @@ peek_char_1 ( USES_REGS1 ) Int ch; LOCK(GLOBAL_Stream[sno].streamlock); - if ((ch = dopeek( sno )) < 0) { + if ((ch = Yap_peek( sno )) < 0) { UNLOCK(GLOBAL_Stream[sno].streamlock); return false; } diff --git a/os/iopreds.h b/os/iopreds.h index a11e1d6c3..6f96e1833 100644 --- a/os/iopreds.h +++ b/os/iopreds.h @@ -300,6 +300,8 @@ void Yap_ReadlineFlush( int sno ); int Yap_ReadlineForSIGINT(void); bool Yap_ReadlinePrompt( StreamDesc * s ); +Int Yap_peek( int sno ); + Term Yap_syntax_error (TokEntry * tokptr, int sno); int console_post_process_read_char( int, StreamDesc *);