publish peek
This commit is contained in:
parent
aaca416b93
commit
1408237215
1
C/text.c
1
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
|
// this is a term, extract the UTF8 representation
|
||||||
if ( IsStringTerm(inp->val.t)) {
|
if ( IsStringTerm(inp->val.t)) {
|
||||||
|
const char *s = inp->val.t;
|
||||||
*enc = ENC_ISO_UTF8;
|
*enc = ENC_ISO_UTF8;
|
||||||
*minimal = FALSE;
|
*minimal = FALSE;
|
||||||
if (lengp)
|
if (lengp)
|
||||||
|
16
os/charsio.c
16
os/charsio.c
@ -102,7 +102,7 @@ plUnGetc( int sno, int ch )
|
|||||||
return ungetc(ch, GLOBAL_Stream[sno].file);
|
return ungetc(ch, GLOBAL_Stream[sno].file);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int dopeek( int sno )
|
Int Yap_peek( int sno )
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Int ocharcount, olinecount, olinepos;
|
Int ocharcount, olinecount, olinepos;
|
||||||
@ -163,7 +163,7 @@ at_end_of_stream ( USES_REGS1 )
|
|||||||
if (GLOBAL_Stream[sno].status & Binary_Stream_f) {
|
if (GLOBAL_Stream[sno].status & Binary_Stream_f) {
|
||||||
out = ( dopeek_byte(sno) < 0 );
|
out = ( dopeek_byte(sno) < 0 );
|
||||||
} else {
|
} else {
|
||||||
out = ( dopeek(sno) < 0 );
|
out = ( Yap_peek(sno) < 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
@ -179,7 +179,7 @@ at_end_of_stream_0 ( USES_REGS1 )
|
|||||||
int sno = LOCAL_c_input_stream;
|
int sno = LOCAL_c_input_stream;
|
||||||
out = GLOBAL_Stream[sno].status & Eof_Stream_f;
|
out = GLOBAL_Stream[sno].status & Eof_Stream_f;
|
||||||
if (!out) {
|
if (!out) {
|
||||||
out = ( dopeek(sno) < 0 );
|
out = ( Yap_peek(sno) < 0 );
|
||||||
}
|
}
|
||||||
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
return out;
|
return out;
|
||||||
@ -793,10 +793,10 @@ peek_code ( USES_REGS1 )
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
if (GLOBAL_Stream[sno].status & Binary_Stream_f) {
|
if (GLOBAL_Stream[sno].status & Binary_Stream_f) {
|
||||||
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if ((ch = dopeek( sno )) < 0) {
|
if ((ch = Yap_peek( sno )) < 0) {
|
||||||
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -827,7 +827,7 @@ peek_code_1 ( USES_REGS1 )
|
|||||||
Yap_Error(PERMISSION_ERROR_INPUT_BINARY_STREAM, ARG1, "peek_code/2");
|
Yap_Error(PERMISSION_ERROR_INPUT_BINARY_STREAM, ARG1, "peek_code/2");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if ((ch = dopeek( sno )) < 0) {
|
if ((ch = Yap_peek( sno )) < 0) {
|
||||||
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -919,7 +919,7 @@ peek_char ( USES_REGS1 )
|
|||||||
Yap_Error(PERMISSION_ERROR_INPUT_TEXT_STREAM, ARG1, "peek_byte/2");
|
Yap_Error(PERMISSION_ERROR_INPUT_TEXT_STREAM, ARG1, "peek_byte/2");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
if ((ch = dopeek( sno )) < 0) {
|
if ((ch = Yap_peek( sno )) < 0) {
|
||||||
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -945,7 +945,7 @@ peek_char_1 ( USES_REGS1 )
|
|||||||
Int ch;
|
Int ch;
|
||||||
|
|
||||||
LOCK(GLOBAL_Stream[sno].streamlock);
|
LOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
if ((ch = dopeek( sno )) < 0) {
|
if ((ch = Yap_peek( sno )) < 0) {
|
||||||
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -300,6 +300,8 @@ void Yap_ReadlineFlush( int sno );
|
|||||||
int Yap_ReadlineForSIGINT(void);
|
int Yap_ReadlineForSIGINT(void);
|
||||||
bool Yap_ReadlinePrompt( StreamDesc * s );
|
bool Yap_ReadlinePrompt( StreamDesc * s );
|
||||||
|
|
||||||
|
Int Yap_peek( int sno );
|
||||||
|
|
||||||
Term Yap_syntax_error (TokEntry * tokptr, int sno);
|
Term Yap_syntax_error (TokEntry * tokptr, int sno);
|
||||||
|
|
||||||
int console_post_process_read_char( int, StreamDesc *);
|
int console_post_process_read_char( int, StreamDesc *);
|
||||||
|
Reference in New Issue
Block a user