Simplify Input/Output

get rid of string I/O, did not add much
getc is never actually used by Prolog
try to use system I/O, even if it may be slower, at least for now.
extend IO C-interface to allow reading clauses
This commit is contained in:
Vítor Santos Costa
2016-02-21 19:06:25 +00:00
parent 19cedad41d
commit f7d23f9deb
11 changed files with 346 additions and 334 deletions

View File

@@ -140,7 +140,6 @@ int GetFreeStreamD(void) {
LOCK(GLOBAL_Stream[sno].streamlock);
UNLOCK(GLOBAL_StreamDescLock);
GLOBAL_Stream[sno].encoding = LOCAL_encoding;
GLOBAL_Stream[sno].och = '\0';
return sno;
}
@@ -648,7 +647,8 @@ static Int cont_stream_property(USES_REGS1) { /* current_stream */
if (p == STREAM_PROPERTY_END ) {
// move to next existing stream
LOCK(GLOBAL_StreamDescLock);
while (++i < MaxStreams && GLOBAL_Stream[i].status & Free_Stream_f) ;
while (++i < MaxStreams && GLOBAL_Stream[i].status & Free_Stream_f)
{}
UNLOCK(GLOBAL_StreamDescLock);
if (i < MaxStreams) {
EXTRA_CBACK_ARG(2, 1) = MkIntTerm(i);
@@ -1221,7 +1221,6 @@ static Int
return (FALSE);
}
GLOBAL_Stream[sno].stream_getc = PlGetc;
GLOBAL_Stream[sno].stream_gets = PlGetsFunc();
} else if (FunctorOfTerm(tin) == FunctorStreamEOS) {
if (IsVarTerm(tp = ArgOfTerm(1, tin))) {
UNLOCK(GLOBAL_Stream[sno].streamlock);
@@ -1245,8 +1244,7 @@ static Int
return (FALSE);
}
GLOBAL_Stream[sno].stream_getc = PlGetc;
GLOBAL_Stream[sno].stream_gets = PlGetsFunc();
/* reset the counters */
/* reset the counters */
GLOBAL_Stream[sno].linepos = 0;
GLOBAL_Stream[sno].linecount = 1;
GLOBAL_Stream[sno].charcount = 0;