diff options
| author | Philipp Stephani | 2015-11-16 00:31:56 +0100 |
|---|---|---|
| committer | Ted Zlatanov | 2015-11-18 14:23:41 -0500 |
| commit | 7cdc5d628a737e2153c38d0d285c9879071beaa7 (patch) | |
| tree | 58d21223b8d1b7de7230449dfb24d85efcab86f5 /src/lisp.h | |
| parent | 133ad3e2006d136a6153a75140a880f8ff16ea65 (diff) | |
| download | emacs-7cdc5d628a737e2153c38d0d285c9879071beaa7.tar.gz emacs-7cdc5d628a737e2153c38d0d285c9879071beaa7.zip | |
Add catch-all & no-signal version of PUSH_HANDLER
Ground work for modules. Add a non-signaling version of PUSH_HANDLER and
a new "catch-all" handler type.
* src/eval.c (init_handler, push_handler, push_handler_nosignal): New
functions.
* src/fns.c (hash_remove_from_table): Expose function public.
* src/lisp.h: New handler type, define macro to push_handler call.
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/lisp.h b/src/lisp.h index 3efa492e0e8..cab912e7401 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3104,7 +3104,9 @@ SPECPDL_INDEX (void) | |||
| 3104 | A call like (throw TAG VAL) searches for a catchtag whose `tag_or_ch' | 3104 | A call like (throw TAG VAL) searches for a catchtag whose `tag_or_ch' |
| 3105 | member is TAG, and then unbinds to it. The `val' member is used to | 3105 | member is TAG, and then unbinds to it. The `val' member is used to |
| 3106 | hold VAL while the stack is unwound; `val' is returned as the value | 3106 | hold VAL while the stack is unwound; `val' is returned as the value |
| 3107 | of the catch form. | 3107 | of the catch form. If there is a handler of type CATCHER_ALL, it will |
| 3108 | be treated as a handler for all invocations of `throw'; in this case | ||
| 3109 | `val' will be set to (TAG . VAL). | ||
| 3108 | 3110 | ||
| 3109 | All the other members are concerned with restoring the interpreter | 3111 | All the other members are concerned with restoring the interpreter |
| 3110 | state. | 3112 | state. |
| @@ -3112,7 +3114,7 @@ SPECPDL_INDEX (void) | |||
| 3112 | Members are volatile if their values need to survive _longjmp when | 3114 | Members are volatile if their values need to survive _longjmp when |
| 3113 | a 'struct handler' is a local variable. */ | 3115 | a 'struct handler' is a local variable. */ |
| 3114 | 3116 | ||
| 3115 | enum handlertype { CATCHER, CONDITION_CASE }; | 3117 | enum handlertype { CATCHER, CONDITION_CASE, CATCHER_ALL }; |
| 3116 | 3118 | ||
| 3117 | struct handler | 3119 | struct handler |
| 3118 | { | 3120 | { |
| @@ -3142,25 +3144,15 @@ struct handler | |||
| 3142 | 3144 | ||
| 3143 | /* Fill in the components of c, and put it on the list. */ | 3145 | /* Fill in the components of c, and put it on the list. */ |
| 3144 | #define PUSH_HANDLER(c, tag_ch_val, handlertype) \ | 3146 | #define PUSH_HANDLER(c, tag_ch_val, handlertype) \ |
| 3145 | if (handlerlist->nextfree) \ | 3147 | push_handler(&(c), (tag_ch_val), (handlertype)) |
| 3146 | (c) = handlerlist->nextfree; \ | ||
| 3147 | else \ | ||
| 3148 | { \ | ||
| 3149 | (c) = xmalloc (sizeof (struct handler)); \ | ||
| 3150 | (c)->nextfree = NULL; \ | ||
| 3151 | handlerlist->nextfree = (c); \ | ||
| 3152 | } \ | ||
| 3153 | (c)->type = (handlertype); \ | ||
| 3154 | (c)->tag_or_ch = (tag_ch_val); \ | ||
| 3155 | (c)->val = Qnil; \ | ||
| 3156 | (c)->next = handlerlist; \ | ||
| 3157 | (c)->lisp_eval_depth = lisp_eval_depth; \ | ||
| 3158 | (c)->pdlcount = SPECPDL_INDEX (); \ | ||
| 3159 | (c)->poll_suppress_count = poll_suppress_count; \ | ||
| 3160 | (c)->interrupt_input_blocked = interrupt_input_blocked;\ | ||
| 3161 | (c)->byte_stack = byte_stack_list; \ | ||
| 3162 | handlerlist = (c); | ||
| 3163 | 3148 | ||
| 3149 | extern void push_handler (struct handler **c, Lisp_Object tag_ch_val, | ||
| 3150 | enum handlertype handlertype); | ||
| 3151 | |||
| 3152 | /* Like push_handler, but don't signal if the handler could not be | ||
| 3153 | allocated. Instead return false in that case. */ | ||
| 3154 | extern bool push_handler_nosignal (struct handler **c, Lisp_Object tag_ch_val, | ||
| 3155 | enum handlertype handlertype); | ||
| 3164 | 3156 | ||
| 3165 | extern Lisp_Object memory_signal_data; | 3157 | extern Lisp_Object memory_signal_data; |
| 3166 | 3158 | ||
| @@ -3407,7 +3399,8 @@ Lisp_Object make_hash_table (struct hash_table_test, Lisp_Object, Lisp_Object, | |||
| 3407 | ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *); | 3399 | ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *); |
| 3408 | ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, | 3400 | ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, |
| 3409 | EMACS_UINT); | 3401 | EMACS_UINT); |
| 3410 | extern struct hash_table_test hashtest_eql, hashtest_equal; | 3402 | void hash_remove_from_table (struct Lisp_Hash_Table *, Lisp_Object); |
| 3403 | extern struct hash_table_test hashtest_eq, hashtest_eql, hashtest_equal; | ||
| 3411 | extern void validate_subarray (Lisp_Object, Lisp_Object, Lisp_Object, | 3404 | extern void validate_subarray (Lisp_Object, Lisp_Object, Lisp_Object, |
| 3412 | ptrdiff_t, ptrdiff_t *, ptrdiff_t *); | 3405 | ptrdiff_t, ptrdiff_t *, ptrdiff_t *); |
| 3413 | extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t, | 3406 | extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t, |