fix reinitialization of streams at Restore.
This commit is contained in:
parent
889e146f0d
commit
598452c069
6
C/save.c
6
C/save.c
@ -573,6 +573,7 @@ save_crc(void)
|
|||||||
|
|
||||||
static Int
|
static Int
|
||||||
do_save(int mode USES_REGS) {
|
do_save(int mode USES_REGS) {
|
||||||
|
extern void Scleanup(void);
|
||||||
Term t1 = Deref(ARG1);
|
Term t1 = Deref(ARG1);
|
||||||
|
|
||||||
if (Yap_HoleSize) {
|
if (Yap_HoleSize) {
|
||||||
@ -584,6 +585,7 @@ do_save(int mode USES_REGS) {
|
|||||||
Yap_Error(TYPE_ERROR_LIST,t1,"save/1");
|
Yap_Error(TYPE_ERROR_LIST,t1,"save/1");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
Scleanup();
|
||||||
Yap_CloseStreams(TRUE);
|
Yap_CloseStreams(TRUE);
|
||||||
if ((splfild = open_file(Yap_FileNameBuf, O_WRONLY | O_CREAT)) < 0) {
|
if ((splfild = open_file(Yap_FileNameBuf, O_WRONLY | O_CREAT)) < 0) {
|
||||||
Yap_Error(SYSTEM_ERROR,MkAtomTerm(Yap_LookupAtom(Yap_FileNameBuf)),
|
Yap_Error(SYSTEM_ERROR,MkAtomTerm(Yap_LookupAtom(Yap_FileNameBuf)),
|
||||||
@ -1382,10 +1384,12 @@ commit_to_saved_state(char *s, CELL *Astate, CELL *ATrail, CELL *AStack, CELL *A
|
|||||||
return(FAIL_RESTORE);
|
return(FAIL_RESTORE);
|
||||||
Yap_PrologMode = BootMode;
|
Yap_PrologMode = BootMode;
|
||||||
if (Yap_HeapBase) {
|
if (Yap_HeapBase) {
|
||||||
|
extern void Scleanup(void);
|
||||||
if (!yap_flags[HALT_AFTER_CONSULT_FLAG] && !yap_flags[QUIET_MODE_FLAG]) {
|
if (!yap_flags[HALT_AFTER_CONSULT_FLAG] && !yap_flags[QUIET_MODE_FLAG]) {
|
||||||
Yap_TrueFileName(s,Yap_FileNameBuf2, YAP_FILENAME_MAX);
|
Yap_TrueFileName(s,Yap_FileNameBuf2, YAP_FILENAME_MAX);
|
||||||
fprintf(stderr, "%% Restoring file %s\n", Yap_FileNameBuf2);
|
fprintf(stderr, "%% Restoring file %s\n", Yap_FileNameBuf2);
|
||||||
}
|
}
|
||||||
|
Scleanup();
|
||||||
Yap_CloseStreams(TRUE);
|
Yap_CloseStreams(TRUE);
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_RESTORE4
|
#ifdef DEBUG_RESTORE4
|
||||||
@ -1758,8 +1762,6 @@ Restore(char *s, char *lib_dir USES_REGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Yap_ReOpenLoadForeign();
|
Yap_ReOpenLoadForeign();
|
||||||
/* restore SWI IO */
|
|
||||||
initIO ();
|
|
||||||
Yap_InitPlIO();
|
Yap_InitPlIO();
|
||||||
/* reset time */
|
/* reset time */
|
||||||
Yap_ReInitWallTime();
|
Yap_ReInitWallTime();
|
||||||
|
@ -328,6 +328,10 @@ initIO()
|
|||||||
const atom_t *np;
|
const atom_t *np;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
#ifdef __YAP_PROLOG__
|
||||||
|
memset(GD, 0, sizeof(gds_t));
|
||||||
|
memset(LD, 0, sizeof(PL_local_data_t));
|
||||||
|
#endif
|
||||||
streamAliases = newHTable(16);
|
streamAliases = newHTable(16);
|
||||||
streamContext = newHTable(16);
|
streamContext = newHTable(16);
|
||||||
PL_register_blob_type(&stream_blob);
|
PL_register_blob_type(&stream_blob);
|
||||||
|
@ -3330,7 +3330,7 @@ static const IOSTREAM S__iob0[] =
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SinitStreams()
|
SinitStreams(void)
|
||||||
{ static int done;
|
{ static int done;
|
||||||
|
|
||||||
if ( !done++ )
|
if ( !done++ )
|
||||||
|
Reference in New Issue
Block a user