improve error handling for qload
This commit is contained in:
parent
fa470556f2
commit
7e3db0f75c
18
C/qlyr.c
18
C/qlyr.c
@ -47,6 +47,20 @@ typedef enum {
|
||||
BAD_READ = 11
|
||||
} qlfr_err_t;
|
||||
|
||||
static char *
|
||||
qlyr_error[] = { "out of temporary space",
|
||||
"out of temporary space",
|
||||
"out of code space",
|
||||
"unknown atom in saved space",
|
||||
"unknown functor in saved space",
|
||||
"unknown predicate in saved space",
|
||||
"unknown YAAM opcode in saved space",
|
||||
"unknown data-base reference in saved space",
|
||||
"corrupted atom in saved space",
|
||||
"formatting mismatch in saved space",
|
||||
"foreign predicate has different definition in saved space",
|
||||
"bad read" };
|
||||
|
||||
static char *
|
||||
Yap_AlwaysAllocCodeSpace(UInt size)
|
||||
{
|
||||
@ -62,7 +76,7 @@ Yap_AlwaysAllocCodeSpace(UInt size)
|
||||
static void
|
||||
QLYR_ERROR(qlfr_err_t my_err)
|
||||
{
|
||||
fprintf(stderr,"Error %d\n", my_err);
|
||||
Yap_Error(SAVED_STATE_ERROR,TermNil,"error %s in saved state %s",GLOBAL_RestoreFile, qlyr_error[my_err]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -1056,8 +1070,10 @@ Yap_Restore(char *s, char *lib_dir)
|
||||
IOSTREAM *stream = Yap_OpenRestore(s, lib_dir);
|
||||
if (!stream)
|
||||
return -1;
|
||||
GLOBAL_RestoreFile = s;
|
||||
read_module(stream);
|
||||
Sclose( stream );
|
||||
GLOBAL_RestoreFile = NULL;
|
||||
return DO_ONLY_CODE;
|
||||
}
|
||||
|
||||
|
1
H/Yap.h
1
H/Yap.h
@ -411,6 +411,7 @@ typedef enum
|
||||
RESOURCE_ERROR_MEMORY,
|
||||
RESOURCE_ERROR_STACK,
|
||||
RETRY_COUNTER_UNDERFLOW,
|
||||
SAVED_STATE_ERROR,
|
||||
SYNTAX_ERROR,
|
||||
SYSTEM_ERROR,
|
||||
TYPE_ERROR_ARRAY,
|
||||
|
@ -98,4 +98,5 @@
|
||||
#endif
|
||||
|
||||
|
||||
#define GLOBAL_RestoreFile Yap_global->RestoreFile_
|
||||
|
||||
|
@ -98,4 +98,5 @@ typedef struct global_data {
|
||||
#endif
|
||||
|
||||
|
||||
char* RestoreFile_;
|
||||
} w_shared;
|
||||
|
@ -98,4 +98,5 @@ static void InitGlobal(void) {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -98,4 +98,5 @@ static void RestoreGlobal(void) {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -118,6 +118,8 @@ char pwd[YAP_FILENAME_MAX] void
|
||||
//udi.c
|
||||
//struct udi_control_block RtreeCmd void
|
||||
|
||||
char* RestoreFile void
|
||||
|
||||
|
||||
|
||||
END_GLOBAL_DATA
|
||||
|
Reference in New Issue
Block a user