diff --git a/C/init.c b/C/init.c index 4061d940f..080c03c90 100644 --- a/C/init.c +++ b/C/init.c @@ -1030,6 +1030,7 @@ InitCodes(void) heap_regs->foreign_code_loaded = NULL; heap_regs->yap_lib_dir = NULL; heap_regs->agc_hook = NULL; + heap_regs->parser_error_style = EXCEPTION_ON_PARSER_ERROR; heap_regs->size_of_overflow = 0; /* make sure no one else can use these two atoms */ CurrentModule = 0; diff --git a/C/iopreds.c b/C/iopreds.c index 9d9d747e0..45ea98ffd 100644 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -170,8 +170,6 @@ STATIC_PROTO (Int GetArgSizeFromChar, (Term *)); -static int parser_error_style = EXCEPTION_ON_PARSER_ERROR; - #if EMACS static int first_char; #endif @@ -2794,13 +2792,13 @@ p_set_read_error_handler(void) } s = RepAtom(AtomOfTerm(t))->StrOfAE; if (!strcmp(s, "fail")) { - parser_error_style = FAIL_ON_PARSER_ERROR; + ParserErrorStyle = FAIL_ON_PARSER_ERROR; } else if (!strcmp(s, "error")) { - parser_error_style = EXCEPTION_ON_PARSER_ERROR; + ParserErrorStyle = EXCEPTION_ON_PARSER_ERROR; } else if (!strcmp(s, "quiet")) { - parser_error_style = QUIET_ON_PARSER_ERROR; + ParserErrorStyle = QUIET_ON_PARSER_ERROR; } else if (!strcmp(s, "dec10")) { - parser_error_style = CONTINUE_ON_PARSER_ERROR; + ParserErrorStyle = CONTINUE_ON_PARSER_ERROR; } else { Error(DOMAIN_ERROR_SYNTAX_ERROR_HANDLER,t,"bad syntax_error handler"); return(FALSE); @@ -2814,7 +2812,7 @@ p_get_read_error_handler(void) { Term t; - switch (parser_error_style) { + switch (ParserErrorStyle) { case FAIL_ON_PARSER_ERROR: t = MkAtomTerm(LookupAtom("fail")); break; @@ -2893,10 +2891,10 @@ p_read (void) } } TR = old_TR; - if (parser_error_style == QUIET_ON_PARSER_ERROR) { + if (ParserErrorStyle == QUIET_ON_PARSER_ERROR) { /* just fail */ return(FALSE); - } else if (parser_error_style == CONTINUE_ON_PARSER_ERROR) { + } else if (ParserErrorStyle == CONTINUE_ON_PARSER_ERROR) { ErrorMessage = NULL; /* try again */ goto repeat_cycle; @@ -2905,7 +2903,7 @@ p_read (void) if (ErrorMessage == NULL) ErrorMessage = "SYNTAX ERROR"; - if (parser_error_style == EXCEPTION_ON_PARSER_ERROR) { + if (ParserErrorStyle == EXCEPTION_ON_PARSER_ERROR) { Error(SYNTAX_ERROR,terr,ErrorMessage); return(FALSE); } else /* FAIL ON PARSER ERROR */ { diff --git a/H/Heap.h b/H/Heap.h index 7a87c6f74..7631820f6 100644 --- a/H/Heap.h +++ b/H/Heap.h @@ -10,7 +10,7 @@ * File: Heap.h * * mods: * * comments: Heap Init Structure * -* version: $Id: Heap.h,v 1.28 2002-06-04 18:21:54 vsc Exp $ * +* version: $Id: Heap.h,v 1.29 2002-06-05 01:34:06 vsc Exp $ * *************************************************************************/ /* information that can be stored in Code Space */ @@ -291,6 +291,7 @@ typedef struct various_codes { void *foreign_code_loaded; char *yap_lib_dir; Agc_hook agc_hook; + int parser_error_style; #if defined(YAPOR) || defined(TABLING) struct global_data global; struct local_data remote[MAX_WORKERS]; @@ -485,6 +486,7 @@ typedef struct various_codes { #define ForeignCodeLoaded heap_regs->foreign_code_loaded #define Yap_LibDir heap_regs->yap_lib_dir #define AGCHook heap_regs->agc_hook +#define ParserErrorStyle heap_regs->parser_error_style #define DeadClauses heap_regs->dead_clauses #define SizeOfOverflow heap_regs->size_of_overflow #define LastWtimePtr heap_regs->last_wtime diff --git a/H/iopreds.h b/H/iopreds.h index f2a924c5e..1f6ddd527 100644 --- a/H/iopreds.h +++ b/H/iopreds.h @@ -102,11 +102,6 @@ StreamDesc Stream[MaxStreams]; #define Pipe_Stream_f 0x040000 #define Popen_Stream_f 0x080000 -#define FAIL_ON_PARSER_ERROR 0 -#define QUIET_ON_PARSER_ERROR 1 -#define CONTINUE_ON_PARSER_ERROR 2 -#define EXCEPTION_ON_PARSER_ERROR 3 - #define StdInStream 0 #define StdOutStream 1 #define StdErrStream 2 diff --git a/H/yapio.h b/H/yapio.h index 8f5662384..05971b15c 100644 --- a/H/yapio.h +++ b/H/yapio.h @@ -314,6 +314,11 @@ extern int Portray_delays; #define HashFunction(CHP,OUT) { (OUT)=0; while(*(CHP) != '\0') (OUT) += *(CHP)++; (OUT) %= MaxHash; } +#define FAIL_ON_PARSER_ERROR 0 +#define QUIET_ON_PARSER_ERROR 1 +#define CONTINUE_ON_PARSER_ERROR 2 +#define EXCEPTION_ON_PARSER_ERROR 3 + extern jmp_buf IOBotch; extern int in_getc; diff --git a/pl/boot.yap b/pl/boot.yap index 9f426e2a9..1ad399e43 100644 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -79,7 +79,7 @@ read_sig. ( '$get_value'('$break',0) -> - '$set_read_error_handler'(error), + % '$set_read_error_handler'(error), let the user do that % after an abort, make sure all spy points are gone. '$clean_debugging_info', % simple trick to find out if this is we are booting from Prolog.