fix handling of repeated calls to YAP_Init.

This commit is contained in:
Vítor Santos Costa 2012-04-12 23:25:04 +01:00
parent 5a8cc421d2
commit af7510a67b
2 changed files with 8 additions and 1 deletions

View File

@ -2937,7 +2937,13 @@ YAP_Init(YAP_init_args *yap_init)
int restore_result;
int do_bootstrap = (yap_init->YapPrologBootFile != NULL);
CELL Trail = 0, Stack = 0, Heap = 0, Atts = 0;
static char boot_file[256];
char boot_file[256];
static int initialised = FALSE;
/* ignore repeated calls to YAP_Init */
if (initialised)
return YAP_BOOT_DONE_BEFOREHAND;
initialised = TRUE;
Yap_InitPageSize(); /* init memory page size, required by later functions */
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)

View File

@ -115,6 +115,7 @@ typedef enum {
#define YAP_BOOT_FROM_SAVED_CODE 1
#define YAP_BOOT_FROM_SAVED_STACKS 2
#define YAP_FULL_BOOT_FROM_PROLOG 4
#define YAP_BOOT_DONE_BEFOREHAND 8
#define YAP_BOOT_ERROR -1
#define YAP_WRITE_QUOTED 1