small fixes for compaibility

This commit is contained in:
Vítor Santos Costa 2015-10-18 11:48:14 +01:00
parent f4eee4782e
commit 684e733c8b

View File

@ -67,9 +67,7 @@ INLINE_ONLY inline EXTERN Term MkCharTerm (Int c);
* *
* @return the term. * @return the term.
*/ */
INLINE_ONLY inline EXTERN Term INLINE_ONLY inline EXTERN Term MkCharTerm(Int c) {
MkCharTerm (Int c)
{
wchar_t cs[2]; wchar_t cs[2];
if (c < 0) if (c < 0)
return MkAtomTerm(AtomEof); return MkAtomTerm(AtomEof);
@ -78,7 +76,6 @@ MkCharTerm (Int c)
return MkAtomTerm(Yap_LookupMaybeWideAtom(cs)); return MkAtomTerm(Yap_LookupMaybeWideAtom(cs));
} }
/** /**
* CharOfAtom: convert an atom into a single character. * CharOfAtom: convert an atom into a single character.
* *
@ -86,9 +83,7 @@ MkCharTerm (Int c)
* *
* @return the char . * @return the char .
*/ */
INLINE_ONLY inline EXTERN Int INLINE_ONLY inline EXTERN Int CharOfAtom(Atom at) {
CharOfAtom (Atom at)
{
if (IsWideAtom(at)) { if (IsWideAtom(at)) {
return at->WStrOfAE[0]; return at->WStrOfAE[0];
} else { } else {
@ -96,14 +91,11 @@ CharOfAtom (Atom at)
} }
} }
static int static int plUnGetc(int sno, int ch) {
plUnGetc( int sno, int ch )
{
return ungetc(ch, GLOBAL_Stream[sno].file); return ungetc(ch, GLOBAL_Stream[sno].file);
} }
Int Yap_peek( int sno ) Int Yap_peek(int sno) {
{
CACHE_REGS CACHE_REGS
Int ocharcount, olinecount, olinepos; Int ocharcount, olinecount, olinepos;
StreamDesc *s; StreamDesc *s;
@ -130,8 +122,7 @@ Int Yap_peek( int sno )
return ch; return ch;
} }
static Int dopeek_byte( int sno ) static Int dopeek_byte(int sno) {
{
Int ocharcount, olinecount, olinepos; Int ocharcount, olinecount, olinepos;
StreamDesc *s; StreamDesc *s;
Int ch; Int ch;
@ -149,9 +140,7 @@ static Int dopeek_byte( int sno )
return ch; return ch;
} }
static Int static Int at_end_of_stream(USES_REGS1) { /* at_end_of_stream */
at_end_of_stream ( USES_REGS1 )
{ /* at_end_of_stream */
/* the next character is a EOF */ /* the next character is a EOF */
int sno = Yap_CheckStream(ARG1, Input_Stream_f, NULL); int sno = Yap_CheckStream(ARG1, Input_Stream_f, NULL);
Int out; Int out;
@ -170,9 +159,7 @@ at_end_of_stream ( USES_REGS1 )
return out; return out;
} }
static Int static Int at_end_of_stream_0(USES_REGS1) { /* at_end_of_stream */
at_end_of_stream_0 ( USES_REGS1 )
{ /* at_end_of_stream */
/* the next character is a EOF */ /* the next character is a EOF */
Int out; Int out;
@ -185,27 +172,18 @@ at_end_of_stream_0 ( USES_REGS1 )
return out; return out;
} }
static int yap_fflush(sno) {
static int
yap_fflush( sno)
{
Yap_ReadlineFlush(sno); Yap_ReadlineFlush(sno);
if ((GLOBAL_Stream[sno].status & Output_Stream_f) && if ((GLOBAL_Stream[sno].status & Output_Stream_f) &&
!(GLOBAL_Stream[sno].status & !(GLOBAL_Stream[sno].status &
(Null_Stream_f| (Null_Stream_f | InMemory_Stream_f | Socket_Stream_f | Pipe_Stream_f |
InMemory_Stream_f|
Socket_Stream_f|
Pipe_Stream_f|
Free_Stream_f))) { Free_Stream_f))) {
return (fflush(GLOBAL_Stream[sno].file)); return (fflush(GLOBAL_Stream[sno].file));
} else } else
return (0); return (0);
} }
static Int get(USES_REGS1) { /* '$get'(Stream,-N) */
static Int
get ( USES_REGS1 )
{ /* '$get'(Stream,-N) */
int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "get/2"); int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "get/2");
int ch; int ch;
Int status; Int status;
@ -219,9 +197,7 @@ get ( USES_REGS1 )
return (Yap_unify_constant(ARG2, MkIntegerTerm(ch))); return (Yap_unify_constant(ARG2, MkIntegerTerm(ch)));
} }
static Int static Int get_char(USES_REGS1) { /* '$get'(Stream,-N) */
get_char ( USES_REGS1 )
{ /* '$get'(Stream,-N) */
int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "get/2"); int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "get/2");
int ch; int ch;
Int status; Int status;
@ -234,9 +210,7 @@ get_char ( USES_REGS1 )
return (Yap_unify_constant(ARG2, MkCharTerm(ch))); return (Yap_unify_constant(ARG2, MkCharTerm(ch)));
} }
static Int static Int get_code(USES_REGS1) { /* get0(Stream,-N) */
get_code ( USES_REGS1 )
{ /* get0(Stream,-N) */
int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "get0/2"); int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "get0/2");
Int status; Int status;
Int out; Int out;
@ -249,10 +223,7 @@ get_code ( USES_REGS1 )
return (Yap_unify_constant(ARG2, MkIntegerTerm(out))); return (Yap_unify_constant(ARG2, MkIntegerTerm(out)));
} }
static Int get_1(USES_REGS1) { /* get_code1(Stream,-N) */
static Int
get_1 ( USES_REGS1 )
{ /* get_code1(Stream,-N) */
int sno = LOCAL_c_input_stream; int sno = LOCAL_c_input_stream;
int ch; int ch;
Int status; Int status;
@ -265,9 +236,7 @@ get_1 ( USES_REGS1 )
return (Yap_unify_constant(ARG2, MkIntegerTerm(ch))); return (Yap_unify_constant(ARG2, MkIntegerTerm(ch)));
} }
static Int static Int getcode_1(USES_REGS1) { /* get0(Stream,-N) */
getcode_1 ( USES_REGS1 )
{ /* get0(Stream,-N) */
int sno = LOCAL_c_input_stream; int sno = LOCAL_c_input_stream;
Int status; Int status;
Int out; Int out;
@ -279,9 +248,7 @@ getcode_1 ( USES_REGS1 )
return (Yap_unify_constant(ARG1, MkIntegerTerm(out))); return (Yap_unify_constant(ARG1, MkIntegerTerm(out)));
} }
static Int static Int getchar_1(USES_REGS1) { /* get0(Stream,-N) */
getchar_1 ( USES_REGS1 )
{ /* get0(Stream,-N) */
int sno = LOCAL_c_input_stream; int sno = LOCAL_c_input_stream;
Int status; Int status;
Int out; Int out;
@ -293,10 +260,7 @@ getchar_1 ( USES_REGS1 )
return (Yap_unify_constant(ARG1, MkCharTerm(out))); return (Yap_unify_constant(ARG1, MkCharTerm(out)));
} }
static Int get0_line_codes(USES_REGS1) { /* '$get0'(Stream,-N) */
static Int
get0_line_codes ( USES_REGS1 )
{ /* '$get0'(Stream,-N) */
int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "get0/2"); int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "get0/2");
Int status; Int status;
Term out; Term out;
@ -315,9 +279,7 @@ get0_line_codes ( USES_REGS1 )
return Yap_unify(out, ARG2); return Yap_unify(out, ARG2);
} }
static Int static Int get_byte(USES_REGS1) { /* '$get_byte'(Stream,-N) */
get_byte ( USES_REGS1 )
{ /* '$get_byte'(Stream,-N) */
int sno = Yap_CheckStream(ARG1, Input_Stream_f, "get_byte/2"); int sno = Yap_CheckStream(ARG1, Input_Stream_f, "get_byte/2");
Int status; Int status;
Term out; Term out;
@ -337,9 +299,7 @@ get_byte ( USES_REGS1 )
return Yap_unify_constant(ARG2, out); return Yap_unify_constant(ARG2, out);
} }
static Int static Int get_byte_1(USES_REGS1) { /* '$get_byte'(Stream,-N) */
get_byte_1 ( USES_REGS1 )
{ /* '$get_byte'(Stream,-N) */
int sno = LOCAL_c_input_stream; int sno = LOCAL_c_input_stream;
Int status; Int status;
Term out; Term out;
@ -358,9 +318,7 @@ get_byte_1 ( USES_REGS1 )
return Yap_unify_constant(ARG1, out); return Yap_unify_constant(ARG1, out);
} }
static Int static Int put_code_1(USES_REGS1) { /* '$put'(,N) */
put_code_1 ( USES_REGS1 )
{ /* '$put'(,N) */
int sno = LOCAL_c_output_stream, ch; int sno = LOCAL_c_output_stream, ch;
Term t2; Term t2;
@ -384,9 +342,7 @@ put_code_1 ( USES_REGS1 )
return (TRUE); return (TRUE);
} }
static Int static Int put_code(USES_REGS1) { /* '$put'(Stream,N) */
put_code ( USES_REGS1 )
{ /* '$put'(Stream,N) */
int ch; int ch;
Term t2; Term t2;
int sno; int sno;
@ -419,9 +375,7 @@ put_code ( USES_REGS1 )
return (TRUE); return (TRUE);
} }
static Int static Int put_char_1(USES_REGS1) { /* '$put'(,N) */
put_char_1 ( USES_REGS1 )
{ /* '$put'(,N) */
int sno = LOCAL_c_output_stream; int sno = LOCAL_c_output_stream;
Term t2; Term t2;
int ch; int ch;
@ -451,9 +405,7 @@ put_char_1 ( USES_REGS1 )
return (TRUE); return (TRUE);
} }
static Int static Int put_char(USES_REGS1) { /* '$put'(Stream,N) */
put_char ( USES_REGS1 )
{ /* '$put'(Stream,N) */
Term t2; Term t2;
int ch; int ch;
int sno; int sno;
@ -485,9 +437,7 @@ put_char ( USES_REGS1 )
return (TRUE); return (TRUE);
} }
static Int static Int tab_1(USES_REGS1) { /* nl */
tab_1 ( USES_REGS1 )
{ /* nl */
int sno = LOCAL_c_output_stream; int sno = LOCAL_c_output_stream;
Term t2; Term t2;
Int tabs, i; Int tabs, i;
@ -519,9 +469,7 @@ tab_1 ( USES_REGS1 )
return (TRUE); return (TRUE);
} }
static Int static Int tab(USES_REGS1) { /* nl(Stream) */
tab ( USES_REGS1 )
{ /* nl(Stream) */
int sno = LOCAL_c_output_stream; int sno = LOCAL_c_output_stream;
Term t2; Term t2;
Int tabs, i; Int tabs, i;
@ -555,9 +503,7 @@ tab ( USES_REGS1 )
return (TRUE); return (TRUE);
} }
static Int static Int nl_1(USES_REGS1) { /* nl */
nl_1 ( USES_REGS1 )
{ /* nl */
int sno = LOCAL_c_output_stream; int sno = LOCAL_c_output_stream;
LOCK(GLOBAL_Stream[sno].streamlock); LOCK(GLOBAL_Stream[sno].streamlock);
if (GLOBAL_Stream[sno].status & Binary_Stream_f) { if (GLOBAL_Stream[sno].status & Binary_Stream_f) {
@ -574,9 +520,7 @@ nl_1 ( USES_REGS1 )
return (TRUE); return (TRUE);
} }
static Int static Int nl(USES_REGS1) { /* nl(Stream) */
nl ( USES_REGS1 )
{ /* nl(Stream) */
int sno = Yap_CheckTextStream(ARG1, Output_Stream_f, "nl/1"); int sno = Yap_CheckTextStream(ARG1, Output_Stream_f, "nl/1");
if (sno < 0) if (sno < 0)
return (FALSE); return (FALSE);
@ -594,9 +538,7 @@ nl ( USES_REGS1 )
return (TRUE); return (TRUE);
} }
static Int static Int put_byte(USES_REGS1) { /* '$put_byte'(Stream,N) */
put_byte ( USES_REGS1 )
{ /* '$put_byte'(Stream,N) */
Term t2; Term t2;
Int ch; Int ch;
if (IsVarTerm(t2 = Deref(ARG2))) { if (IsVarTerm(t2 = Deref(ARG2))) {
@ -628,9 +570,7 @@ put_byte ( USES_REGS1 )
return (TRUE); return (TRUE);
} }
static Int static Int put_byte_1(USES_REGS1) { /* '$put_byte'(Stream,N) */
put_byte_1 ( USES_REGS1 )
{ /* '$put_byte'(Stream,N) */
Term t2; Term t2;
Int ch; Int ch;
int sno = LOCAL_c_output_stream; int sno = LOCAL_c_output_stream;
@ -657,10 +597,7 @@ put_byte_1 ( USES_REGS1 )
return (TRUE); return (TRUE);
} }
static Int skip_1(USES_REGS1) { /* '$skip'(Stream,N) */
static Int
skip_1 ( USES_REGS1 )
{ /* '$skip'(Stream,N) */
Int n; Int n;
Term t2; Term t2;
int sno; int sno;
@ -685,9 +622,7 @@ skip_1 ( USES_REGS1 )
return (TRUE); return (TRUE);
} }
static Int static Int skip(USES_REGS1) { /* '$skip'(Stream,N) */
skip ( USES_REGS1 )
{ /* '$skip'(Stream,N) */
Int n; Int n;
Term t2; Term t2;
int sno; int sno;
@ -720,9 +655,7 @@ skip ( USES_REGS1 )
* @param +_Stream_ * @param +_Stream_
* *
*/ */
static Int static Int flush_output(USES_REGS1) { /* flush_output(Stream) */
flush_output ( USES_REGS1 )
{ /* flush_output(Stream) */
int sno = Yap_CheckStream(ARG1, Output_Stream_f, "flush_output/1"); int sno = Yap_CheckStream(ARG1, Output_Stream_f, "flush_output/1");
if (sno < 0) if (sno < 0)
return (FALSE); return (FALSE);
@ -734,21 +667,18 @@ flush_output ( USES_REGS1 )
/** /**
* @pred flush_output * @pred flush_output
* *
* Flush the current output stream, that is, make sure all pending output is committed * Flush the current output stream, that is, make sure all pending output is
*committed
* before any further execution. By default this is user_output, but it may be * before any further execution. By default this is user_output, but it may be
* changed by current_output/1. * changed by current_output/1.
* *
*/ */
static Int static Int flush_output0(USES_REGS1) { /* flush_output */
flush_output0 ( USES_REGS1 )
{ /* flush_output */
yap_fflush(LOCAL_c_output_stream); yap_fflush(LOCAL_c_output_stream);
return (TRUE); return (TRUE);
} }
static Int static Int flush_all_streams(USES_REGS1) { /* $flush_all_streams */
flush_all_streams ( USES_REGS1 )
{ /* $flush_all_streams */
#if BROKEN_FFLUSH_NULL #if BROKEN_FFLUSH_NULL
int i; int i;
for (i = 0; i < MaxStreams; ++i) { for (i = 0; i < MaxStreams; ++i) {
@ -782,9 +712,7 @@ current stream and unify its code with _C_, while
leaving the current stream position unaltered. leaving the current stream position unaltered.
*/ */
static Int static Int peek_code(USES_REGS1) { /* at_end_of_stream */
peek_code ( USES_REGS1 )
{ /* at_end_of_stream */
/* the next character is a EOF */ /* the next character is a EOF */
int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "peek/2"); int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "peek/2");
Int ch; Int ch;
@ -797,14 +725,15 @@ peek_code ( USES_REGS1 )
return FALSE; return FALSE;
} }
if ((ch = Yap_peek(sno)) < 0) { if ((ch = Yap_peek(sno)) < 0) {
#ifdef PEEK_EOF
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
return false; return false;
#endif
} }
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
return (Yap_unify_constant(ARG2, MkIntTerm(ch))); return (Yap_unify_constant(ARG2, MkIntTerm(ch)));
} }
/** @pred peek_code( - _C_) is iso /** @pred peek_code( - _C_) is iso
@ -814,9 +743,7 @@ current stream and unify its code with _C_, while
leaving the current stream position unaltered. leaving the current stream position unaltered.
*/ */
static Int static Int peek_code_1(USES_REGS1) { /* at_end_of_stream */
peek_code_1 ( USES_REGS1 )
{ /* at_end_of_stream */
/* the next character is a EOF */ /* the next character is a EOF */
int sno = LOCAL_c_input_stream; int sno = LOCAL_c_input_stream;
Int ch; Int ch;
@ -828,14 +755,15 @@ peek_code_1 ( USES_REGS1 )
return FALSE; return FALSE;
} }
if ((ch = Yap_peek(sno)) < 0) { if ((ch = Yap_peek(sno)) < 0) {
#ifdef PEEK_EOF
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
return false; return false;
#endif
} }
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
return (Yap_unify_constant(ARG1, MkIntTerm(ch))); return (Yap_unify_constant(ARG1, MkIntTerm(ch)));
} }
/** @pred peek_byte(+Stream, - _C_) is iso /** @pred peek_byte(+Stream, - _C_) is iso
@ -843,9 +771,7 @@ If _C_ is unbound, or is a character code, and _Stream_ is a
binary stream, read the next byte from the current stream and unify its binary stream, read the next byte from the current stream and unify its
code with _C_, while leaving the current stream position unaltered. code with _C_, while leaving the current stream position unaltered.
*/ */
static Int static Int peek_byte(USES_REGS1) { /* at_end_of_stream */
peek_byte ( USES_REGS1 )
{ /* at_end_of_stream */
/* the next character is a EOF */ /* the next character is a EOF */
int sno = Yap_CheckStream(ARG1, Input_Stream_f, "peek_byte/2"); int sno = Yap_CheckStream(ARG1, Input_Stream_f, "peek_byte/2");
Int ch; Int ch;
@ -858,14 +784,15 @@ peek_byte ( USES_REGS1 )
return (FALSE); return (FALSE);
} }
if ((ch = dopeek_byte(sno)) < 0) { if ((ch = dopeek_byte(sno)) < 0) {
#ifdef PEEK_EOF
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
return false; return false;
#endif
} }
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
return (Yap_unify_constant(ARG2, MkIntTerm(ch))); return (Yap_unify_constant(ARG2, MkIntTerm(ch)));
} }
/** @pred peek_byte( - _C_) is iso /** @pred peek_byte( - _C_) is iso
@ -873,9 +800,7 @@ If _C_ is unbound, or is a character code, and _Stream_ is a
binary stream, read the next byte from the current stream and unify its binary stream, read the next byte from the current stream and unify its
code with _C_, while leaving the current stream position unaltered. code with _C_, while leaving the current stream position unaltered.
*/ */
static Int static Int peek_byte_1(USES_REGS1) { /* at_end_of_stream */
peek_byte_1 ( USES_REGS1 )
{ /* at_end_of_stream */
/* the next character is a EOF */ /* the next character is a EOF */
int sno = LOCAL_c_input_stream; int sno = LOCAL_c_input_stream;
Int ch; Int ch;
@ -889,14 +814,15 @@ peek_byte_1 ( USES_REGS1 )
return (FALSE); return (FALSE);
} }
if ((ch = dopeek_byte(sno)) < 0) { if ((ch = dopeek_byte(sno)) < 0) {
#ifdef PEEK_EOF
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
return false; return false;
#endif
} }
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
return (Yap_unify_constant(ARG2, MkIntTerm(ch))); return (Yap_unify_constant(ARG2, MkIntTerm(ch)));
} }
/** @pred peek_char(+_S_, - _C_) is iso /** @pred peek_char(+_S_, - _C_) is iso
@ -904,16 +830,14 @@ If _C_ is unbound, or is a character code, and the stream _S_ is a
binary stream, read the next byte from the current stream and unify the binary stream, read the next byte from the current stream and unify the
atom with _C_, while leaving the stream position unaltered. atom with _C_, while leaving the stream position unaltered.
*/ */
static Int static Int peek_char(USES_REGS1) {
peek_char ( USES_REGS1 )
{
/* the next character is a EOF */ /* the next character is a EOF */
int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "peek/2"); int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "peek/2");
wchar_t wsinp[2]; wchar_t wsinp[2];
Int ch; Int ch;
if (sno < 0) if (sno < 0)
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);
Yap_Error(PERMISSION_ERROR_INPUT_TEXT_STREAM, ARG1, "peek_byte/2"); Yap_Error(PERMISSION_ERROR_INPUT_TEXT_STREAM, ARG1, "peek_byte/2");
@ -921,7 +845,7 @@ peek_char ( USES_REGS1 )
} }
if ((ch = Yap_peek(sno)) < 0) { if ((ch = Yap_peek(sno)) < 0) {
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
return false; return Yap_unify_constant(ARG2, MkAtomTerm(AtomEof));
} }
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
wsinp[1] = '\0'; wsinp[1] = '\0';
@ -936,9 +860,7 @@ If _C_ is unbound, or is a character code, and the current input stream is a
binary stream, read the next byte from the current stream and unify the binary stream, read the next byte from the current stream and unify the
atom with _C_, while leaving the stream position unaltered. atom with _C_, while leaving the stream position unaltered.
*/ */
static Int static Int peek_char_1(USES_REGS1) {
peek_char_1 ( USES_REGS1 )
{
/* the next character is a EOF */ /* the next character is a EOF */
int sno = LOCAL_c_input_stream; int sno = LOCAL_c_input_stream;
wchar_t wsinp[2]; wchar_t wsinp[2];
@ -947,7 +869,8 @@ peek_char_1 ( USES_REGS1 )
LOCK(GLOBAL_Stream[sno].streamlock); LOCK(GLOBAL_Stream[sno].streamlock);
if ((ch = Yap_peek(sno)) < 0) { if ((ch = Yap_peek(sno)) < 0) {
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
return false; return Yap_unify_constant(ARG2, MkAtomTerm(AtomEof));
// return false;
} }
UNLOCK(GLOBAL_Stream[sno].streamlock); UNLOCK(GLOBAL_Stream[sno].streamlock);
wsinp[1] = '\0'; wsinp[1] = '\0';
@ -955,7 +878,6 @@ peek_char_1 ( USES_REGS1 )
return Yap_unify_constant(ARG2, MkAtomTerm(Yap_LookupMaybeWideAtom(wsinp))); return Yap_unify_constant(ARG2, MkAtomTerm(Yap_LookupMaybeWideAtom(wsinp)));
} }
/** @pred peek(+ _S_, - _C_) is deprecated /** @pred peek(+ _S_, - _C_) is deprecated
@ -977,23 +899,11 @@ leaving the current stream position unaltered.
*/ */
void Yap_flush(void) { CACHE_REGS(void)flush_all_streams(PASS_REGS1); }
void Yap_FlushStreams(void) { CACHE_REGS(void)flush_all_streams(PASS_REGS1); }
void Yap_flush(void) void Yap_InitCharsio(void) {
{
CACHE_REGS
(void)flush_all_streams(PASS_REGS1);
}
void Yap_FlushStreams(void)
{
CACHE_REGS
(void)flush_all_streams(PASS_REGS1);
}
void
Yap_InitCharsio( void )
{
Yap_InitCPred("get", 2, get, SafePredFlag | SyncPredFlag); Yap_InitCPred("get", 2, get, SafePredFlag | SyncPredFlag);
Yap_InitCPred("get_code", 2, get_code, SafePredFlag | SyncPredFlag); Yap_InitCPred("get_code", 2, get_code, SafePredFlag | SyncPredFlag);
Yap_InitCPred("get_char", 2, get_char, SafePredFlag | SyncPredFlag); Yap_InitCPred("get_char", 2, get_char, SafePredFlag | SyncPredFlag);
@ -1002,7 +912,8 @@ Yap_InitCharsio( void )
Yap_InitCPred("get_code", 1, getcode_1, SafePredFlag | SyncPredFlag); Yap_InitCPred("get_code", 1, getcode_1, SafePredFlag | SyncPredFlag);
Yap_InitCPred("get_char", 1, getchar_1, SafePredFlag | SyncPredFlag); Yap_InitCPred("get_char", 1, getchar_1, SafePredFlag | SyncPredFlag);
Yap_InitCPred("get0", 1, getcode_1, SafePredFlag | SyncPredFlag); Yap_InitCPred("get0", 1, getcode_1, SafePredFlag | SyncPredFlag);
Yap_InitCPred ("$get0_line_codes", 2, get0_line_codes, SafePredFlag|SyncPredFlag|HiddenPredFlag); Yap_InitCPred("$get0_line_codes", 2, get0_line_codes,
SafePredFlag | SyncPredFlag | HiddenPredFlag);
Yap_InitCPred("get_byte", 2, get_byte, SafePredFlag | SyncPredFlag); Yap_InitCPred("get_byte", 2, get_byte, SafePredFlag | SyncPredFlag);
Yap_InitCPred("get_byte", 1, get_byte_1, SafePredFlag | SyncPredFlag); Yap_InitCPred("get_byte", 1, get_byte_1, SafePredFlag | SyncPredFlag);
Yap_InitCPred("put", 1, put_code_1, SafePredFlag | SyncPredFlag); Yap_InitCPred("put", 1, put_code_1, SafePredFlag | SyncPredFlag);
@ -1020,12 +931,15 @@ Yap_InitCharsio( void )
Yap_InitCPred("nl", 0, nl_1, SafePredFlag | SyncPredFlag); Yap_InitCPred("nl", 0, nl_1, SafePredFlag | SyncPredFlag);
Yap_InitCPred("nl", 1, nl, SafePredFlag | SyncPredFlag); Yap_InitCPred("nl", 1, nl, SafePredFlag | SyncPredFlag);
Yap_InitCPred ("$flush_all_streams", 0, flush_all_streams, SafePredFlag|SyncPredFlag|HiddenPredFlag); Yap_InitCPred("$flush_all_streams", 0, flush_all_streams,
SafePredFlag | SyncPredFlag | HiddenPredFlag);
Yap_InitCPred("flush_output", 1, flush_output, SafePredFlag | SyncPredFlag); Yap_InitCPred("flush_output", 1, flush_output, SafePredFlag | SyncPredFlag);
Yap_InitCPred("flush_output", 0, flush_output0, SafePredFlag | SyncPredFlag); Yap_InitCPred("flush_output", 0, flush_output0, SafePredFlag | SyncPredFlag);
Yap_InitCPred ("at_end_of_stream", 1, at_end_of_stream, SafePredFlag|SyncPredFlag); Yap_InitCPred("at_end_of_stream", 1, at_end_of_stream,
Yap_InitCPred ("at_end_of_stream_0", 0, at_end_of_stream_0, SafePredFlag|SyncPredFlag); SafePredFlag | SyncPredFlag);
Yap_InitCPred("at_end_of_stream_0", 0, at_end_of_stream_0,
SafePredFlag | SyncPredFlag);
// Yap_InitCPred ("$past_eof", 1, past_eof, SafePredFlag|SyncPredFlag); // Yap_InitCPred ("$past_eof", 1, past_eof, SafePredFlag|SyncPredFlag);
Yap_InitCPred("peek", 2, peek_code, SafePredFlag | SyncPredFlag); Yap_InitCPred("peek", 2, peek_code, SafePredFlag | SyncPredFlag);
Yap_InitCPred("peek_code", 2, peek_code, SafePredFlag | SyncPredFlag); Yap_InitCPred("peek_code", 2, peek_code, SafePredFlag | SyncPredFlag);
@ -1039,6 +953,4 @@ Yap_InitCharsio( void )
Yap_InitCPred("skip1", 1, skip_1, SafePredFlag | SyncPredFlag); Yap_InitCPred("skip1", 1, skip_1, SafePredFlag | SyncPredFlag);
Yap_InitCPred("tab", 2, tab, SafePredFlag | SyncPredFlag); Yap_InitCPred("tab", 2, tab, SafePredFlag | SyncPredFlag);
Yap_InitCPred("tab1", 1, tab_1, SafePredFlag | SyncPredFlag); Yap_InitCPred("tab1", 1, tab_1, SafePredFlag | SyncPredFlag);
} }