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:
@@ -2153,6 +2153,7 @@ X_API Term YAP_Read(FILE *f) {
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
X_API Term YAP_ReadFromStream(int sno) {
|
||||
Term o;
|
||||
|
||||
@@ -2162,6 +2163,15 @@ X_API Term YAP_ReadFromStream(int sno) {
|
||||
return o;
|
||||
}
|
||||
|
||||
X_API Term YAP_ReadClauseFromStream(int sno) {
|
||||
Term o;
|
||||
|
||||
BACKUP_MACHINE_REGS();
|
||||
o = Yap_read_term(sno, TermNil, -1);
|
||||
RECOVER_MACHINE_REGS();
|
||||
return o;
|
||||
}
|
||||
|
||||
X_API void YAP_Write(Term t, FILE *f, int flags) {
|
||||
BACKUP_MACHINE_REGS();
|
||||
int sno = Yap_OpenStream(f, NULL, TermNil, Output_Stream_f);
|
||||
@@ -2271,7 +2281,7 @@ static void do_bootfile(char *bootfilename USES_REGS) {
|
||||
CACHE_REGS
|
||||
YAP_Reset(YAP_FULL_RESET);
|
||||
Yap_StartSlots();
|
||||
t = YAP_ReadFromStream(bootfile);
|
||||
t = YAP_ReadClauseFromStream(bootfile);
|
||||
// Yap_DebugPlWrite(t);fprintf(stderr, "\n");
|
||||
if (t == 0) {
|
||||
fprintf(stderr,
|
||||
|
Reference in New Issue
Block a user