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

@@ -1866,8 +1866,14 @@ extern X_API YAP_Int YAP_FastInit(char saved_state[]);
#define IOSTREAM void
#endif /* FPL_STREAM_H */
/// read a Prolog term from an operating system stream $s$.
extern X_API YAP_Term YAP_Read(FILE *s);
/// read a Prolog term from a Prolog opened stream $s$. Check YAP_OpenStream() for how to open
/// Prolog streams in `C`.
extern X_API YAP_Term YAP_ReadFromStream(int s);
/// read a Prolog clause from a Prolog opened stream $s$. Similar to YAP_ReadFromStream() but takes /// default options from read_clause/3.
extern X_API YAP_Term YAP_ReadFromStream(int s);
extern X_API void YAP_Write(YAP_Term t,FILE *s,int);
@@ -1878,12 +1884,6 @@ extern X_API int YAP_InitConsult(int mode, const char *filename, int *previous_s
extern X_API void YAP_EndConsult(int s, int *previous_sno);
#ifndef _PL_STREAM_H
// if we don't know what a stream is, just don't assume nothing about the pointer
#undef IOSTREAM
#endif /* FPL_STREAM_H */
extern X_API void YAP_Exit(int);
/* void YAP_PutValue(YAP_Atom, YAP_Term) */