From 73053088aa1a33486a1bfb9637bf37f8bf984a18 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Tue, 23 Jan 2001 04:34:33 +0000 Subject: Setup error return and return error on parse error. (parse_list): Fail if 2001-01-23 Not Zed * e-sexp.c (e_sexp_parse): Setup error return and return error on parse error. (parse_list): Fail if we have a problem. (parse_value): Here too. (fatal_error): Fatal error handling function, jumps back to the top caller. (term_eval_and): (e_sexp_term_eval): (term_eval_sub): (term_eval_plus): (term_eval_gt): (term_eval_lt): (term_eval_or): Fail on error. (e_sexp_term_eval): Added a comment about where this can be called, which is only from inside e_sexp_eval(). (e_sexp_eval): Setup setjmp error handler. (e_sexp_error): Error accessor function. * e-sexp.h: Added a longjmp environment to the structure, and an error return to parse. svn path=/trunk/; revision=7738 --- e-util/e-sexp.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'e-util/e-sexp.h') diff --git a/e-util/e-sexp.h b/e-util/e-sexp.h index 5cf2740fc1..cfedaea98b 100644 --- a/e-util/e-sexp.h +++ b/e-util/e-sexp.h @@ -5,6 +5,7 @@ #define _E_SEXP_H #include +#include #ifdef E_SEXP_IS_GTK_OBJECT #include @@ -98,6 +99,10 @@ struct _ESExp { #endif GScanner *scanner; /* for parsing text version */ ESExpTerm *tree; /* root of expression tree */ + + /* private stuff */ + jmp_buf failenv; + char *error; }; struct _ESExpClass { @@ -124,7 +129,7 @@ void e_sexp_input_text (ESExp *f, const char *text, int len); void e_sexp_input_file (ESExp *f, int fd); -void e_sexp_parse (ESExp *f); +int e_sexp_parse (ESExp *f); ESExpResult *e_sexp_eval (ESExp *f); ESExpResult *e_sexp_term_eval (struct _ESExp *f, struct _ESExpTerm *t); @@ -135,4 +140,8 @@ void e_sexp_result_free (struct _ESExpResult *t); void e_sexp_encode_bool(GString *s, gboolean state); void e_sexp_encode_string(GString *s, const char *string); +/* only to be called from inside a callback to signal a fatal execution error */ +void e_sexp_fatal_error(struct _ESExp *f, char *why, ...); +const char *e_sexp_error(struct _ESExp *f); + #endif /* _E_SEXP_H */ -- cgit