diff options
| author | Tom Tromey | 2012-08-15 12:56:38 -0600 |
|---|---|---|
| committer | Tom Tromey | 2012-08-15 12:56:38 -0600 |
| commit | 68b32482437e05f0994c4dd0ab5b0c27d39f0f6d (patch) | |
| tree | fe01584b00d03559210438ebc608a1d170ee00b3 /src | |
| parent | 5190da91e6ca41287190693a8999a6919a9cd8e6 (diff) | |
| download | emacs-68b32482437e05f0994c4dd0ab5b0c27d39f0f6d.tar.gz emacs-68b32482437e05f0994c4dd0ab5b0c27d39f0f6d.zip | |
This introduces a thread-state object and moves various C globals
there. It also introduces #defines for these globals to avoid a
monster patch.
The #defines mean that this patch also has to rename a few fields
whose names clash with the defines.
There is currently just a single "thread"; so this patch does not
impact Emacs behavior in any significant way.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.in | 2 | ||||
| -rw-r--r-- | src/alloc.c | 12 | ||||
| -rw-r--r-- | src/buffer.c | 2 | ||||
| -rw-r--r-- | src/buffer.h | 4 | ||||
| -rw-r--r-- | src/bytecode.c | 2 | ||||
| -rw-r--r-- | src/emacs.c | 15 | ||||
| -rw-r--r-- | src/eval.c | 54 | ||||
| -rw-r--r-- | src/lisp.h | 23 | ||||
| -rw-r--r-- | src/regex.c | 10 | ||||
| -rw-r--r-- | src/regex.h | 4 | ||||
| -rw-r--r-- | src/search.c | 22 | ||||
| -rw-r--r-- | src/thread.c | 26 | ||||
| -rw-r--r-- | src/thread.h | 140 | ||||
| -rw-r--r-- | src/window.c | 8 |
14 files changed, 223 insertions, 101 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index 4b1520ada62..2d1bdd097ef 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -336,7 +336,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ | |||
| 336 | eval.o floatfns.o fns.o font.o print.o lread.o \ | 336 | eval.o floatfns.o fns.o font.o print.o lread.o \ |
| 337 | syntax.o $(UNEXEC_OBJ) bytecode.o \ | 337 | syntax.o $(UNEXEC_OBJ) bytecode.o \ |
| 338 | process.o gnutls.o callproc.o \ | 338 | process.o gnutls.o callproc.o \ |
| 339 | region-cache.o sound.o atimer.o \ | 339 | region-cache.o sound.o atimer.o thread.o \ |
| 340 | doprnt.o intervals.o textprop.o composite.o xml.o \ | 340 | doprnt.o intervals.o textprop.o composite.o xml.o \ |
| 341 | $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) | 341 | $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) |
| 342 | obj = $(base_obj) $(NS_OBJC_OBJ) | 342 | obj = $(base_obj) $(NS_OBJC_OBJ) |
diff --git a/src/alloc.c b/src/alloc.c index 1d484d4a322..bdf7b24af04 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -372,10 +372,6 @@ struct mem_node | |||
| 372 | enum mem_type type; | 372 | enum mem_type type; |
| 373 | }; | 373 | }; |
| 374 | 374 | ||
| 375 | /* Base address of stack. Set in main. */ | ||
| 376 | |||
| 377 | Lisp_Object *stack_base; | ||
| 378 | |||
| 379 | /* Root of the tree describing allocated Lisp memory. */ | 375 | /* Root of the tree describing allocated Lisp memory. */ |
| 380 | 376 | ||
| 381 | static struct mem_node *mem_root; | 377 | static struct mem_node *mem_root; |
| @@ -423,10 +419,6 @@ static void check_gcpros (void); | |||
| 423 | # define DEADP(x) 0 | 419 | # define DEADP(x) 0 |
| 424 | #endif | 420 | #endif |
| 425 | 421 | ||
| 426 | /* Recording what needs to be marked for gc. */ | ||
| 427 | |||
| 428 | struct gcpro *gcprolist; | ||
| 429 | |||
| 430 | /* Addresses of staticpro'd variables. Initialize it to a nonzero | 422 | /* Addresses of staticpro'd variables. Initialize it to a nonzero |
| 431 | value; otherwise some compilers put it into BSS. */ | 423 | value; otherwise some compilers put it into BSS. */ |
| 432 | 424 | ||
| @@ -4891,7 +4883,7 @@ mark_stack (void) | |||
| 4891 | Lisp_Object o; | 4883 | Lisp_Object o; |
| 4892 | jmp_buf j; | 4884 | jmp_buf j; |
| 4893 | } j; | 4885 | } j; |
| 4894 | volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; | 4886 | volatile int stack_grows_down_p = (char *) &j > (char *) stack_bottom; |
| 4895 | #endif | 4887 | #endif |
| 4896 | /* This trick flushes the register windows so that all the state of | 4888 | /* This trick flushes the register windows so that all the state of |
| 4897 | the process is contained in the stack. */ | 4889 | the process is contained in the stack. */ |
| @@ -4933,7 +4925,7 @@ mark_stack (void) | |||
| 4933 | /* This assumes that the stack is a contiguous region in memory. If | 4925 | /* This assumes that the stack is a contiguous region in memory. If |
| 4934 | that's not the case, something has to be done here to iterate | 4926 | that's not the case, something has to be done here to iterate |
| 4935 | over the stack segments. */ | 4927 | over the stack segments. */ |
| 4936 | mark_memory (stack_base, end); | 4928 | mark_memory (stack_bottom, end); |
| 4937 | 4929 | ||
| 4938 | /* Allow for marking a secondary stack, like the register stack on the | 4930 | /* Allow for marking a secondary stack, like the register stack on the |
| 4939 | ia64. */ | 4931 | ia64. */ |
diff --git a/src/buffer.c b/src/buffer.c index 56d6231f5f8..7fb1029a314 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -44,8 +44,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 44 | #include "keymap.h" | 44 | #include "keymap.h" |
| 45 | #include "frame.h" | 45 | #include "frame.h" |
| 46 | 46 | ||
| 47 | struct buffer *current_buffer; /* the current buffer */ | ||
| 48 | |||
| 49 | /* First buffer in chain of all buffers (in reverse order of creation). | 47 | /* First buffer in chain of all buffers (in reverse order of creation). |
| 50 | Threaded through ->header.next.buffer. */ | 48 | Threaded through ->header.next.buffer. */ |
| 51 | 49 | ||
diff --git a/src/buffer.h b/src/buffer.h index 7a6bddee5ec..1c9f5d972a9 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -872,10 +872,6 @@ extern struct buffer *all_buffers; | |||
| 872 | #define FOR_EACH_BUFFER(b) \ | 872 | #define FOR_EACH_BUFFER(b) \ |
| 873 | for ((b) = all_buffers; (b); (b) = (b)->header.next.buffer) | 873 | for ((b) = all_buffers; (b); (b) = (b)->header.next.buffer) |
| 874 | 874 | ||
| 875 | /* This points to the current buffer. */ | ||
| 876 | |||
| 877 | extern struct buffer *current_buffer; | ||
| 878 | |||
| 879 | /* This structure holds the default values of the buffer-local variables | 875 | /* This structure holds the default values of the buffer-local variables |
| 880 | that have special slots in each buffer. | 876 | that have special slots in each buffer. |
| 881 | The default value occupies the same slot in this structure | 877 | The default value occupies the same slot in this structure |
diff --git a/src/bytecode.c b/src/bytecode.c index 5ac8b4fa2bd..019459491e9 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -328,7 +328,7 @@ struct byte_stack | |||
| 328 | done. Signaling an error truncates the list analogous to | 328 | done. Signaling an error truncates the list analogous to |
| 329 | gcprolist. */ | 329 | gcprolist. */ |
| 330 | 330 | ||
| 331 | struct byte_stack *byte_stack_list; | 331 | /* struct byte_stack *byte_stack_list; */ |
| 332 | 332 | ||
| 333 | 333 | ||
| 334 | /* Mark objects on byte_stack_list. Called during GC. */ | 334 | /* Mark objects on byte_stack_list. Called during GC. */ |
diff --git a/src/emacs.c b/src/emacs.c index 8d458c612cc..e1acd365e29 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -140,10 +140,6 @@ int running_asynch_code; | |||
| 140 | int display_arg; | 140 | int display_arg; |
| 141 | #endif | 141 | #endif |
| 142 | 142 | ||
| 143 | /* An address near the bottom of the stack. | ||
| 144 | Tells GC how to save a copy of the stack. */ | ||
| 145 | char *stack_bottom; | ||
| 146 | |||
| 147 | #if defined (DOUG_LEA_MALLOC) || defined (GNU_LINUX) | 143 | #if defined (DOUG_LEA_MALLOC) || defined (GNU_LINUX) |
| 148 | /* The address where the heap starts (from the first sbrk (0) call). */ | 144 | /* The address where the heap starts (from the first sbrk (0) call). */ |
| 149 | static void *my_heap_start; | 145 | static void *my_heap_start; |
| @@ -687,9 +683,6 @@ void (*__malloc_initialize_hook) (void) EXTERNALLY_VISIBLE = malloc_initialize_h | |||
| 687 | int | 683 | int |
| 688 | main (int argc, char **argv) | 684 | main (int argc, char **argv) |
| 689 | { | 685 | { |
| 690 | #if GC_MARK_STACK | ||
| 691 | Lisp_Object dummy; | ||
| 692 | #endif | ||
| 693 | char stack_bottom_variable; | 686 | char stack_bottom_variable; |
| 694 | int do_initial_setlocale; | 687 | int do_initial_setlocale; |
| 695 | int skip_args = 0; | 688 | int skip_args = 0; |
| @@ -704,9 +697,8 @@ main (int argc, char **argv) | |||
| 704 | #endif | 697 | #endif |
| 705 | char *ch_to_dir; | 698 | char *ch_to_dir; |
| 706 | 699 | ||
| 707 | #if GC_MARK_STACK | 700 | /* Record (approximately) where the stack begins. */ |
| 708 | stack_base = &dummy; | 701 | stack_bottom = &stack_bottom_variable; |
| 709 | #endif | ||
| 710 | 702 | ||
| 711 | #if defined (USE_GTK) && defined (G_SLICE_ALWAYS_MALLOC) | 703 | #if defined (USE_GTK) && defined (G_SLICE_ALWAYS_MALLOC) |
| 712 | /* This is used by the Cygwin build. */ | 704 | /* This is used by the Cygwin build. */ |
| @@ -852,9 +844,6 @@ main (int argc, char **argv) | |||
| 852 | } | 844 | } |
| 853 | #endif /* HAVE_SETRLIMIT and RLIMIT_STACK */ | 845 | #endif /* HAVE_SETRLIMIT and RLIMIT_STACK */ |
| 854 | 846 | ||
| 855 | /* Record (approximately) where the stack begins. */ | ||
| 856 | stack_bottom = &stack_bottom_variable; | ||
| 857 | |||
| 858 | clearerr (stdin); | 847 | clearerr (stdin); |
| 859 | 848 | ||
| 860 | #ifndef SYSTEM_MALLOC | 849 | #ifndef SYSTEM_MALLOC |
diff --git a/src/eval.c b/src/eval.c index b531f790cc5..768cdc1a8f8 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -42,12 +42,12 @@ struct backtrace | |||
| 42 | unsigned int debug_on_exit : 1; | 42 | unsigned int debug_on_exit : 1; |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | static struct backtrace *backtrace_list; | 45 | /* static struct backtrace *backtrace_list; */ |
| 46 | 46 | ||
| 47 | #if !BYTE_MARK_STACK | 47 | /* #if !BYTE_MARK_STACK */ |
| 48 | static | 48 | /* static */ |
| 49 | #endif | 49 | /* #endif */ |
| 50 | struct catchtag *catchlist; | 50 | /* struct catchtag *catchlist; */ |
| 51 | 51 | ||
| 52 | /* Chain of condition handlers currently in effect. | 52 | /* Chain of condition handlers currently in effect. |
| 53 | The elements of this chain are contained in the stack frames | 53 | The elements of this chain are contained in the stack frames |
| @@ -55,10 +55,10 @@ struct catchtag *catchlist; | |||
| 55 | When an error is signaled (by calling Fsignal, below), | 55 | When an error is signaled (by calling Fsignal, below), |
| 56 | this chain is searched for an element that applies. */ | 56 | this chain is searched for an element that applies. */ |
| 57 | 57 | ||
| 58 | #if !BYTE_MARK_STACK | 58 | /* #if !BYTE_MARK_STACK */ |
| 59 | static | 59 | /* static */ |
| 60 | #endif | 60 | /* #endif */ |
| 61 | struct handler *handlerlist; | 61 | /* struct handler *handlerlist; */ |
| 62 | 62 | ||
| 63 | #ifdef DEBUG_GCPRO | 63 | #ifdef DEBUG_GCPRO |
| 64 | /* Count levels of GCPRO to detect failure to UNGCPRO. */ | 64 | /* Count levels of GCPRO to detect failure to UNGCPRO. */ |
| @@ -90,19 +90,19 @@ Lisp_Object Vautoload_queue; | |||
| 90 | 90 | ||
| 91 | /* Current number of specbindings allocated in specpdl. */ | 91 | /* Current number of specbindings allocated in specpdl. */ |
| 92 | 92 | ||
| 93 | ptrdiff_t specpdl_size; | 93 | /* ptrdiff_t specpdl_size; */ |
| 94 | 94 | ||
| 95 | /* Pointer to beginning of specpdl. */ | 95 | /* Pointer to beginning of specpdl. */ |
| 96 | 96 | ||
| 97 | struct specbinding *specpdl; | 97 | /* struct specbinding *specpdl; */ |
| 98 | 98 | ||
| 99 | /* Pointer to first unused element in specpdl. */ | 99 | /* Pointer to first unused element in specpdl. */ |
| 100 | 100 | ||
| 101 | struct specbinding *specpdl_ptr; | 101 | /* struct specbinding *specpdl_ptr; */ |
| 102 | 102 | ||
| 103 | /* Depth in Lisp evaluations and function calls. */ | 103 | /* Depth in Lisp evaluations and function calls. */ |
| 104 | 104 | ||
| 105 | static EMACS_INT lisp_eval_depth; | 105 | /* static EMACS_INT lisp_eval_depth; */ |
| 106 | 106 | ||
| 107 | /* The value of num_nonmacro_input_events as of the last time we | 107 | /* The value of num_nonmacro_input_events as of the last time we |
| 108 | started to enter the debugger. If we decide to enter the debugger | 108 | started to enter the debugger. If we decide to enter the debugger |
| @@ -1051,8 +1051,8 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object | |||
| 1051 | c.tag = tag; | 1051 | c.tag = tag; |
| 1052 | c.val = Qnil; | 1052 | c.val = Qnil; |
| 1053 | c.backlist = backtrace_list; | 1053 | c.backlist = backtrace_list; |
| 1054 | c.handlerlist = handlerlist; | 1054 | c.f_handlerlist = handlerlist; |
| 1055 | c.lisp_eval_depth = lisp_eval_depth; | 1055 | c.f_lisp_eval_depth = lisp_eval_depth; |
| 1056 | c.pdlcount = SPECPDL_INDEX (); | 1056 | c.pdlcount = SPECPDL_INDEX (); |
| 1057 | c.poll_suppress_count = poll_suppress_count; | 1057 | c.poll_suppress_count = poll_suppress_count; |
| 1058 | c.interrupt_input_blocked = interrupt_input_blocked; | 1058 | c.interrupt_input_blocked = interrupt_input_blocked; |
| @@ -1106,7 +1106,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value) | |||
| 1106 | /* Unwind the specpdl stack, and then restore the proper set of | 1106 | /* Unwind the specpdl stack, and then restore the proper set of |
| 1107 | handlers. */ | 1107 | handlers. */ |
| 1108 | unbind_to (catchlist->pdlcount, Qnil); | 1108 | unbind_to (catchlist->pdlcount, Qnil); |
| 1109 | handlerlist = catchlist->handlerlist; | 1109 | handlerlist = catchlist->f_handlerlist; |
| 1110 | catchlist = catchlist->next; | 1110 | catchlist = catchlist->next; |
| 1111 | } | 1111 | } |
| 1112 | while (! last_time); | 1112 | while (! last_time); |
| @@ -1127,7 +1127,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value) | |||
| 1127 | gcpro_level = gcprolist ? gcprolist->level + 1 : 0; | 1127 | gcpro_level = gcprolist ? gcprolist->level + 1 : 0; |
| 1128 | #endif | 1128 | #endif |
| 1129 | backtrace_list = catch->backlist; | 1129 | backtrace_list = catch->backlist; |
| 1130 | lisp_eval_depth = catch->lisp_eval_depth; | 1130 | lisp_eval_depth = catch->f_lisp_eval_depth; |
| 1131 | 1131 | ||
| 1132 | _longjmp (catch->jmp, 1); | 1132 | _longjmp (catch->jmp, 1); |
| 1133 | } | 1133 | } |
| @@ -1231,8 +1231,8 @@ internal_lisp_condition_case (volatile Lisp_Object var, Lisp_Object bodyform, | |||
| 1231 | c.tag = Qnil; | 1231 | c.tag = Qnil; |
| 1232 | c.val = Qnil; | 1232 | c.val = Qnil; |
| 1233 | c.backlist = backtrace_list; | 1233 | c.backlist = backtrace_list; |
| 1234 | c.handlerlist = handlerlist; | 1234 | c.f_handlerlist = handlerlist; |
| 1235 | c.lisp_eval_depth = lisp_eval_depth; | 1235 | c.f_lisp_eval_depth = lisp_eval_depth; |
| 1236 | c.pdlcount = SPECPDL_INDEX (); | 1236 | c.pdlcount = SPECPDL_INDEX (); |
| 1237 | c.poll_suppress_count = poll_suppress_count; | 1237 | c.poll_suppress_count = poll_suppress_count; |
| 1238 | c.interrupt_input_blocked = interrupt_input_blocked; | 1238 | c.interrupt_input_blocked = interrupt_input_blocked; |
| @@ -1286,8 +1286,8 @@ internal_condition_case (Lisp_Object (*bfun) (void), Lisp_Object handlers, | |||
| 1286 | c.tag = Qnil; | 1286 | c.tag = Qnil; |
| 1287 | c.val = Qnil; | 1287 | c.val = Qnil; |
| 1288 | c.backlist = backtrace_list; | 1288 | c.backlist = backtrace_list; |
| 1289 | c.handlerlist = handlerlist; | 1289 | c.f_handlerlist = handlerlist; |
| 1290 | c.lisp_eval_depth = lisp_eval_depth; | 1290 | c.f_lisp_eval_depth = lisp_eval_depth; |
| 1291 | c.pdlcount = SPECPDL_INDEX (); | 1291 | c.pdlcount = SPECPDL_INDEX (); |
| 1292 | c.poll_suppress_count = poll_suppress_count; | 1292 | c.poll_suppress_count = poll_suppress_count; |
| 1293 | c.interrupt_input_blocked = interrupt_input_blocked; | 1293 | c.interrupt_input_blocked = interrupt_input_blocked; |
| @@ -1324,8 +1324,8 @@ internal_condition_case_1 (Lisp_Object (*bfun) (Lisp_Object), Lisp_Object arg, | |||
| 1324 | c.tag = Qnil; | 1324 | c.tag = Qnil; |
| 1325 | c.val = Qnil; | 1325 | c.val = Qnil; |
| 1326 | c.backlist = backtrace_list; | 1326 | c.backlist = backtrace_list; |
| 1327 | c.handlerlist = handlerlist; | 1327 | c.f_handlerlist = handlerlist; |
| 1328 | c.lisp_eval_depth = lisp_eval_depth; | 1328 | c.f_lisp_eval_depth = lisp_eval_depth; |
| 1329 | c.pdlcount = SPECPDL_INDEX (); | 1329 | c.pdlcount = SPECPDL_INDEX (); |
| 1330 | c.poll_suppress_count = poll_suppress_count; | 1330 | c.poll_suppress_count = poll_suppress_count; |
| 1331 | c.interrupt_input_blocked = interrupt_input_blocked; | 1331 | c.interrupt_input_blocked = interrupt_input_blocked; |
| @@ -1366,8 +1366,8 @@ internal_condition_case_2 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object), | |||
| 1366 | c.tag = Qnil; | 1366 | c.tag = Qnil; |
| 1367 | c.val = Qnil; | 1367 | c.val = Qnil; |
| 1368 | c.backlist = backtrace_list; | 1368 | c.backlist = backtrace_list; |
| 1369 | c.handlerlist = handlerlist; | 1369 | c.f_handlerlist = handlerlist; |
| 1370 | c.lisp_eval_depth = lisp_eval_depth; | 1370 | c.f_lisp_eval_depth = lisp_eval_depth; |
| 1371 | c.pdlcount = SPECPDL_INDEX (); | 1371 | c.pdlcount = SPECPDL_INDEX (); |
| 1372 | c.poll_suppress_count = poll_suppress_count; | 1372 | c.poll_suppress_count = poll_suppress_count; |
| 1373 | c.interrupt_input_blocked = interrupt_input_blocked; | 1373 | c.interrupt_input_blocked = interrupt_input_blocked; |
| @@ -1410,8 +1410,8 @@ internal_condition_case_n (Lisp_Object (*bfun) (ptrdiff_t, Lisp_Object *), | |||
| 1410 | c.tag = Qnil; | 1410 | c.tag = Qnil; |
| 1411 | c.val = Qnil; | 1411 | c.val = Qnil; |
| 1412 | c.backlist = backtrace_list; | 1412 | c.backlist = backtrace_list; |
| 1413 | c.handlerlist = handlerlist; | 1413 | c.f_handlerlist = handlerlist; |
| 1414 | c.lisp_eval_depth = lisp_eval_depth; | 1414 | c.f_lisp_eval_depth = lisp_eval_depth; |
| 1415 | c.pdlcount = SPECPDL_INDEX (); | 1415 | c.pdlcount = SPECPDL_INDEX (); |
| 1416 | c.poll_suppress_count = poll_suppress_count; | 1416 | c.poll_suppress_count = poll_suppress_count; |
| 1417 | c.interrupt_input_blocked = interrupt_input_blocked; | 1417 | c.interrupt_input_blocked = interrupt_input_blocked; |
diff --git a/src/lisp.h b/src/lisp.h index a0d47b3895e..0367d9938b7 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2015,10 +2015,6 @@ struct specbinding | |||
| 2015 | Lisp_Object unused; /* Dividing by 16 is faster than by 12 */ | 2015 | Lisp_Object unused; /* Dividing by 16 is faster than by 12 */ |
| 2016 | }; | 2016 | }; |
| 2017 | 2017 | ||
| 2018 | extern struct specbinding *specpdl; | ||
| 2019 | extern struct specbinding *specpdl_ptr; | ||
| 2020 | extern ptrdiff_t specpdl_size; | ||
| 2021 | |||
| 2022 | #define SPECPDL_INDEX() (specpdl_ptr - specpdl) | 2018 | #define SPECPDL_INDEX() (specpdl_ptr - specpdl) |
| 2023 | 2019 | ||
| 2024 | /* Everything needed to describe an active condition case. */ | 2020 | /* Everything needed to describe an active condition case. */ |
| @@ -2071,8 +2067,8 @@ struct catchtag | |||
| 2071 | struct gcpro *gcpro; | 2067 | struct gcpro *gcpro; |
| 2072 | jmp_buf jmp; | 2068 | jmp_buf jmp; |
| 2073 | struct backtrace *backlist; | 2069 | struct backtrace *backlist; |
| 2074 | struct handler *handlerlist; | 2070 | struct handler *f_handlerlist; |
| 2075 | EMACS_INT lisp_eval_depth; | 2071 | EMACS_INT f_lisp_eval_depth; |
| 2076 | ptrdiff_t pdlcount; | 2072 | ptrdiff_t pdlcount; |
| 2077 | int poll_suppress_count; | 2073 | int poll_suppress_count; |
| 2078 | int interrupt_input_blocked; | 2074 | int interrupt_input_blocked; |
| @@ -2081,10 +2077,6 @@ struct catchtag | |||
| 2081 | 2077 | ||
| 2082 | extern Lisp_Object memory_signal_data; | 2078 | extern Lisp_Object memory_signal_data; |
| 2083 | 2079 | ||
| 2084 | /* An address near the bottom of the stack. | ||
| 2085 | Tells GC how to save a copy of the stack. */ | ||
| 2086 | extern char *stack_bottom; | ||
| 2087 | |||
| 2088 | /* Check quit-flag and quit if it is non-nil. | 2080 | /* Check quit-flag and quit if it is non-nil. |
| 2089 | Typing C-g does not directly cause a quit; it only sets Vquit_flag. | 2081 | Typing C-g does not directly cause a quit; it only sets Vquit_flag. |
| 2090 | So the program needs to do QUIT at times when it is safe to quit. | 2082 | So the program needs to do QUIT at times when it is safe to quit. |
| @@ -2140,8 +2132,6 @@ extern Lisp_Object Vascii_canon_table; | |||
| 2140 | Every function that can call Feval must protect in this fashion all | 2132 | Every function that can call Feval must protect in this fashion all |
| 2141 | Lisp_Object variables whose contents will be used again. */ | 2133 | Lisp_Object variables whose contents will be used again. */ |
| 2142 | 2134 | ||
| 2143 | extern struct gcpro *gcprolist; | ||
| 2144 | |||
| 2145 | struct gcpro | 2135 | struct gcpro |
| 2146 | { | 2136 | { |
| 2147 | struct gcpro *next; | 2137 | struct gcpro *next; |
| @@ -2246,8 +2236,6 @@ struct gcpro | |||
| 2246 | 2236 | ||
| 2247 | #else | 2237 | #else |
| 2248 | 2238 | ||
| 2249 | extern int gcpro_level; | ||
| 2250 | |||
| 2251 | #define GCPRO1(varname) \ | 2239 | #define GCPRO1(varname) \ |
| 2252 | {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \ | 2240 | {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \ |
| 2253 | gcpro1.level = gcpro_level++; \ | 2241 | gcpro1.level = gcpro_level++; \ |
| @@ -2729,7 +2717,6 @@ extern void refill_memory_reserve (void); | |||
| 2729 | #endif | 2717 | #endif |
| 2730 | extern const char *pending_malloc_warning; | 2718 | extern const char *pending_malloc_warning; |
| 2731 | extern Lisp_Object zero_vector; | 2719 | extern Lisp_Object zero_vector; |
| 2732 | extern Lisp_Object *stack_base; | ||
| 2733 | extern EMACS_INT consing_since_gc; | 2720 | extern EMACS_INT consing_since_gc; |
| 2734 | extern EMACS_INT gc_relative_threshold; | 2721 | extern EMACS_INT gc_relative_threshold; |
| 2735 | extern EMACS_INT memory_full_cons_threshold; | 2722 | extern EMACS_INT memory_full_cons_threshold; |
| @@ -2915,10 +2902,6 @@ extern Lisp_Object Vautoload_queue; | |||
| 2915 | extern Lisp_Object Vsignaling_function; | 2902 | extern Lisp_Object Vsignaling_function; |
| 2916 | extern Lisp_Object inhibit_lisp_code; | 2903 | extern Lisp_Object inhibit_lisp_code; |
| 2917 | extern int handling_signal; | 2904 | extern int handling_signal; |
| 2918 | #if BYTE_MARK_STACK | ||
| 2919 | extern struct catchtag *catchlist; | ||
| 2920 | extern struct handler *handlerlist; | ||
| 2921 | #endif | ||
| 2922 | /* To run a normal hook, use the appropriate function from the list below. | 2905 | /* To run a normal hook, use the appropriate function from the list below. |
| 2923 | The calling convention: | 2906 | The calling convention: |
| 2924 | 2907 | ||
| @@ -3227,7 +3210,6 @@ extern int read_bytecode_char (int); | |||
| 3227 | /* Defined in bytecode.c */ | 3210 | /* Defined in bytecode.c */ |
| 3228 | extern Lisp_Object Qbytecode; | 3211 | extern Lisp_Object Qbytecode; |
| 3229 | extern void syms_of_bytecode (void); | 3212 | extern void syms_of_bytecode (void); |
| 3230 | extern struct byte_stack *byte_stack_list; | ||
| 3231 | #if BYTE_MARK_STACK | 3213 | #if BYTE_MARK_STACK |
| 3232 | extern void mark_byte_stack (void); | 3214 | extern void mark_byte_stack (void); |
| 3233 | #endif | 3215 | #endif |
| @@ -3524,6 +3506,7 @@ extern void *record_xmalloc (size_t); | |||
| 3524 | 3506 | ||
| 3525 | 3507 | ||
| 3526 | #include "globals.h" | 3508 | #include "globals.h" |
| 3509 | #include "thread.h" | ||
| 3527 | 3510 | ||
| 3528 | /* Check whether it's time for GC, and run it if so. */ | 3511 | /* Check whether it's time for GC, and run it if so. */ |
| 3529 | 3512 | ||
diff --git a/src/regex.c b/src/regex.c index 472ef727979..b995538e30d 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -1235,12 +1235,14 @@ print_double_string (where, string1, size1, string2, size2) | |||
| 1235 | # define IF_LINT(Code) /* empty */ | 1235 | # define IF_LINT(Code) /* empty */ |
| 1236 | #endif | 1236 | #endif |
| 1237 | 1237 | ||
| 1238 | #ifndef emacs | ||
| 1238 | /* Set by `re_set_syntax' to the current regexp syntax to recognize. Can | 1239 | /* Set by `re_set_syntax' to the current regexp syntax to recognize. Can |
| 1239 | also be assigned to arbitrarily: each pattern buffer stores its own | 1240 | also be assigned to arbitrarily: each pattern buffer stores its own |
| 1240 | syntax, so it can be changed between regex compilations. */ | 1241 | syntax, so it can be changed between regex compilations. */ |
| 1241 | /* This has no initializer because initialized variables in Emacs | 1242 | /* This has no initializer because initialized variables in Emacs |
| 1242 | become read-only after dumping. */ | 1243 | become read-only after dumping. */ |
| 1243 | reg_syntax_t re_syntax_options; | 1244 | reg_syntax_t re_syntax_options; |
| 1245 | #endif | ||
| 1244 | 1246 | ||
| 1245 | 1247 | ||
| 1246 | /* Specify the precise syntax of regexps for compilation. This provides | 1248 | /* Specify the precise syntax of regexps for compilation. This provides |
| @@ -1260,8 +1262,10 @@ re_set_syntax (reg_syntax_t syntax) | |||
| 1260 | } | 1262 | } |
| 1261 | WEAK_ALIAS (__re_set_syntax, re_set_syntax) | 1263 | WEAK_ALIAS (__re_set_syntax, re_set_syntax) |
| 1262 | 1264 | ||
| 1265 | #ifndef emacs | ||
| 1263 | /* Regexp to use to replace spaces, or NULL meaning don't. */ | 1266 | /* Regexp to use to replace spaces, or NULL meaning don't. */ |
| 1264 | static re_char *whitespace_regexp; | 1267 | static re_char *whitespace_regexp; |
| 1268 | #endif | ||
| 1265 | 1269 | ||
| 1266 | void | 1270 | void |
| 1267 | re_set_whitespace_regexp (const char *regexp) | 1271 | re_set_whitespace_regexp (const char *regexp) |
| @@ -4900,12 +4904,6 @@ re_match (struct re_pattern_buffer *bufp, const char *string, | |||
| 4900 | WEAK_ALIAS (__re_match, re_match) | 4904 | WEAK_ALIAS (__re_match, re_match) |
| 4901 | #endif /* not emacs */ | 4905 | #endif /* not emacs */ |
| 4902 | 4906 | ||
| 4903 | #ifdef emacs | ||
| 4904 | /* In Emacs, this is the string or buffer in which we | ||
| 4905 | are matching. It is used for looking up syntax properties. */ | ||
| 4906 | Lisp_Object re_match_object; | ||
| 4907 | #endif | ||
| 4908 | |||
| 4909 | /* re_match_2 matches the compiled pattern in BUFP against the | 4907 | /* re_match_2 matches the compiled pattern in BUFP against the |
| 4910 | the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 | 4908 | the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 |
| 4911 | and SIZE2, respectively). We start matching at POS, and stop | 4909 | and SIZE2, respectively). We start matching at POS, and stop |
diff --git a/src/regex.h b/src/regex.h index e0ede012b20..91886a80549 100644 --- a/src/regex.h +++ b/src/regex.h | |||
| @@ -166,12 +166,12 @@ typedef unsigned long int reg_syntax_t; | |||
| 166 | some interfaces). When a regexp is compiled, the syntax used is | 166 | some interfaces). When a regexp is compiled, the syntax used is |
| 167 | stored in the pattern buffer, so changing this does not affect | 167 | stored in the pattern buffer, so changing this does not affect |
| 168 | already-compiled regexps. */ | 168 | already-compiled regexps. */ |
| 169 | extern reg_syntax_t re_syntax_options; | 169 | /* extern reg_syntax_t re_syntax_options; */ |
| 170 | 170 | ||
| 171 | #ifdef emacs | 171 | #ifdef emacs |
| 172 | /* In Emacs, this is the string or buffer in which we | 172 | /* In Emacs, this is the string or buffer in which we |
| 173 | are matching. It is used for looking up syntax properties. */ | 173 | are matching. It is used for looking up syntax properties. */ |
| 174 | extern Lisp_Object re_match_object; | 174 | /* extern Lisp_Object re_match_object; */ |
| 175 | #endif | 175 | #endif |
| 176 | 176 | ||
| 177 | 177 | ||
diff --git a/src/search.c b/src/search.c index 004e599be9c..5df01f664f7 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -42,7 +42,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 42 | struct regexp_cache | 42 | struct regexp_cache |
| 43 | { | 43 | { |
| 44 | struct regexp_cache *next; | 44 | struct regexp_cache *next; |
| 45 | Lisp_Object regexp, whitespace_regexp; | 45 | Lisp_Object regexp, f_whitespace_regexp; |
| 46 | /* Syntax table for which the regexp applies. We need this because | 46 | /* Syntax table for which the regexp applies. We need this because |
| 47 | of character classes. If this is t, then the compiled pattern is valid | 47 | of character classes. If this is t, then the compiled pattern is valid |
| 48 | for any syntax-table. */ | 48 | for any syntax-table. */ |
| @@ -77,12 +77,12 @@ static struct regexp_cache *searchbuf_head; | |||
| 77 | to call re_set_registers after compiling a new pattern or after | 77 | to call re_set_registers after compiling a new pattern or after |
| 78 | setting the match registers, so that the regex functions will be | 78 | setting the match registers, so that the regex functions will be |
| 79 | able to free or re-allocate it properly. */ | 79 | able to free or re-allocate it properly. */ |
| 80 | static struct re_registers search_regs; | 80 | /* static struct re_registers search_regs; */ |
| 81 | 81 | ||
| 82 | /* The buffer in which the last search was performed, or | 82 | /* The buffer in which the last search was performed, or |
| 83 | Qt if the last search was done in a string; | 83 | Qt if the last search was done in a string; |
| 84 | Qnil if no searching has been done yet. */ | 84 | Qnil if no searching has been done yet. */ |
| 85 | static Lisp_Object last_thing_searched; | 85 | /* static Lisp_Object last_thing_searched; */ |
| 86 | 86 | ||
| 87 | /* Error condition signaled when regexp compile_pattern fails. */ | 87 | /* Error condition signaled when regexp compile_pattern fails. */ |
| 88 | static Lisp_Object Qinvalid_regexp; | 88 | static Lisp_Object Qinvalid_regexp; |
| @@ -129,9 +129,9 @@ compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object tra | |||
| 129 | cp->buf.multibyte = STRING_MULTIBYTE (pattern); | 129 | cp->buf.multibyte = STRING_MULTIBYTE (pattern); |
| 130 | cp->buf.charset_unibyte = charset_unibyte; | 130 | cp->buf.charset_unibyte = charset_unibyte; |
| 131 | if (STRINGP (Vsearch_spaces_regexp)) | 131 | if (STRINGP (Vsearch_spaces_regexp)) |
| 132 | cp->whitespace_regexp = Vsearch_spaces_regexp; | 132 | cp->f_whitespace_regexp = Vsearch_spaces_regexp; |
| 133 | else | 133 | else |
| 134 | cp->whitespace_regexp = Qnil; | 134 | cp->f_whitespace_regexp = Qnil; |
| 135 | 135 | ||
| 136 | /* rms: I think BLOCK_INPUT is not needed here any more, | 136 | /* rms: I think BLOCK_INPUT is not needed here any more, |
| 137 | because regex.c defines malloc to call xmalloc. | 137 | because regex.c defines malloc to call xmalloc. |
| @@ -230,7 +230,7 @@ compile_pattern (Lisp_Object pattern, struct re_registers *regp, Lisp_Object tra | |||
| 230 | && cp->posix == posix | 230 | && cp->posix == posix |
| 231 | && (EQ (cp->syntax_table, Qt) | 231 | && (EQ (cp->syntax_table, Qt) |
| 232 | || EQ (cp->syntax_table, BVAR (current_buffer, syntax_table))) | 232 | || EQ (cp->syntax_table, BVAR (current_buffer, syntax_table))) |
| 233 | && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp)) | 233 | && !NILP (Fequal (cp->f_whitespace_regexp, Vsearch_spaces_regexp)) |
| 234 | && cp->buf.charset_unibyte == charset_unibyte) | 234 | && cp->buf.charset_unibyte == charset_unibyte) |
| 235 | break; | 235 | break; |
| 236 | 236 | ||
| @@ -2938,9 +2938,9 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere. */) | |||
| 2938 | 2938 | ||
| 2939 | /* If non-zero the match data have been saved in saved_search_regs | 2939 | /* If non-zero the match data have been saved in saved_search_regs |
| 2940 | during the execution of a sentinel or filter. */ | 2940 | during the execution of a sentinel or filter. */ |
| 2941 | static int search_regs_saved; | 2941 | /* static int search_regs_saved; */ |
| 2942 | static struct re_registers saved_search_regs; | 2942 | /* static struct re_registers saved_search_regs; */ |
| 2943 | static Lisp_Object saved_last_thing_searched; | 2943 | /* static Lisp_Object saved_last_thing_searched; */ |
| 2944 | 2944 | ||
| 2945 | /* Called from Flooking_at, Fstring_match, search_buffer, Fstore_match_data | 2945 | /* Called from Flooking_at, Fstring_match, search_buffer, Fstore_match_data |
| 2946 | if asynchronous code (filter or sentinel) is running. */ | 2946 | if asynchronous code (filter or sentinel) is running. */ |
| @@ -3044,10 +3044,10 @@ syms_of_search (void) | |||
| 3044 | searchbufs[i].buf.buffer = xmalloc (100); | 3044 | searchbufs[i].buf.buffer = xmalloc (100); |
| 3045 | searchbufs[i].buf.fastmap = searchbufs[i].fastmap; | 3045 | searchbufs[i].buf.fastmap = searchbufs[i].fastmap; |
| 3046 | searchbufs[i].regexp = Qnil; | 3046 | searchbufs[i].regexp = Qnil; |
| 3047 | searchbufs[i].whitespace_regexp = Qnil; | 3047 | searchbufs[i].f_whitespace_regexp = Qnil; |
| 3048 | searchbufs[i].syntax_table = Qnil; | 3048 | searchbufs[i].syntax_table = Qnil; |
| 3049 | staticpro (&searchbufs[i].regexp); | 3049 | staticpro (&searchbufs[i].regexp); |
| 3050 | staticpro (&searchbufs[i].whitespace_regexp); | 3050 | staticpro (&searchbufs[i].f_whitespace_regexp); |
| 3051 | staticpro (&searchbufs[i].syntax_table); | 3051 | staticpro (&searchbufs[i].syntax_table); |
| 3052 | searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]); | 3052 | searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]); |
| 3053 | } | 3053 | } |
diff --git a/src/thread.c b/src/thread.c new file mode 100644 index 00000000000..0bd97b4fd8e --- /dev/null +++ b/src/thread.c | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | /* Threading code. | ||
| 2 | Copyright (C) 2012 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This file is part of GNU Emacs. | ||
| 5 | |||
| 6 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation, either version 3 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 18 | |||
| 19 | |||
| 20 | #include <config.h> | ||
| 21 | #include <setjmp.h> | ||
| 22 | #include "lisp.h" | ||
| 23 | |||
| 24 | struct thread_state the_only_thread; | ||
| 25 | |||
| 26 | struct thread_state *current_thread = &the_only_thread; | ||
diff --git a/src/thread.h b/src/thread.h new file mode 100644 index 00000000000..b2eb04d42e8 --- /dev/null +++ b/src/thread.h | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | /* Thread definitions | ||
| 2 | Copyright (C) 2012 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This file is part of GNU Emacs. | ||
| 5 | |||
| 6 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation, either version 3 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 18 | |||
| 19 | #ifndef THREAD_H | ||
| 20 | #define THREAD_H | ||
| 21 | |||
| 22 | #include "regex.h" | ||
| 23 | |||
| 24 | struct thread_state | ||
| 25 | { | ||
| 26 | /* The buffer in which the last search was performed, or | ||
| 27 | Qt if the last search was done in a string; | ||
| 28 | Qnil if no searching has been done yet. */ | ||
| 29 | Lisp_Object m_last_thing_searched; | ||
| 30 | #define last_thing_searched (current_thread->m_last_thing_searched) | ||
| 31 | |||
| 32 | Lisp_Object m_saved_last_thing_searched; | ||
| 33 | #define saved_last_thing_searched (current_thread->m_saved_last_thing_searched) | ||
| 34 | |||
| 35 | /* m_gcprolist must be the first non-lisp field. */ | ||
| 36 | /* Recording what needs to be marked for gc. */ | ||
| 37 | struct gcpro *m_gcprolist; | ||
| 38 | #define gcprolist (current_thread->m_gcprolist) | ||
| 39 | |||
| 40 | /* A list of currently active byte-code execution value stacks. | ||
| 41 | Fbyte_code adds an entry to the head of this list before it starts | ||
| 42 | processing byte-code, and it removed the entry again when it is | ||
| 43 | done. Signalling an error truncates the list analoguous to | ||
| 44 | gcprolist. */ | ||
| 45 | struct byte_stack *m_byte_stack_list; | ||
| 46 | #define byte_stack_list (current_thread->m_byte_stack_list) | ||
| 47 | |||
| 48 | /* An address near the bottom of the stack. | ||
| 49 | Tells GC how to save a copy of the stack. */ | ||
| 50 | char *m_stack_bottom; | ||
| 51 | #define stack_bottom (current_thread->m_stack_bottom) | ||
| 52 | |||
| 53 | /* An address near the top of the stack. */ | ||
| 54 | char *stack_top; | ||
| 55 | |||
| 56 | struct backtrace *m_backtrace_list; | ||
| 57 | #define backtrace_list (current_thread->m_backtrace_list) | ||
| 58 | |||
| 59 | struct catchtag *m_catchlist; | ||
| 60 | #define catchlist (current_thread->m_catchlist) | ||
| 61 | |||
| 62 | /* Chain of condition handlers currently in effect. | ||
| 63 | The elements of this chain are contained in the stack frames | ||
| 64 | of Fcondition_case and internal_condition_case. | ||
| 65 | When an error is signaled (by calling Fsignal, below), | ||
| 66 | this chain is searched for an element that applies. */ | ||
| 67 | struct handler *m_handlerlist; | ||
| 68 | #define handlerlist (current_thread->m_handlerlist) | ||
| 69 | |||
| 70 | /* Count levels of GCPRO to detect failure to UNGCPRO. */ | ||
| 71 | int m_gcpro_level; | ||
| 72 | #define gcpro_level (current_thread->m_gcpro_level) | ||
| 73 | |||
| 74 | /* Current number of specbindings allocated in specpdl. */ | ||
| 75 | ptrdiff_t m_specpdl_size; | ||
| 76 | #define specpdl_size (current_thread->m_specpdl_size) | ||
| 77 | |||
| 78 | /* Pointer to beginning of specpdl. */ | ||
| 79 | struct specbinding *m_specpdl; | ||
| 80 | #define specpdl (current_thread->m_specpdl) | ||
| 81 | |||
| 82 | /* Pointer to first unused element in specpdl. */ | ||
| 83 | struct specbinding *m_specpdl_ptr; | ||
| 84 | #define specpdl_ptr (current_thread->m_specpdl_ptr) | ||
| 85 | |||
| 86 | /* Depth in Lisp evaluations and function calls. */ | ||
| 87 | EMACS_INT m_lisp_eval_depth; | ||
| 88 | #define lisp_eval_depth (current_thread->m_lisp_eval_depth) | ||
| 89 | |||
| 90 | /* This points to the current buffer. */ | ||
| 91 | struct buffer *m_current_buffer; | ||
| 92 | #define current_buffer (current_thread->m_current_buffer) | ||
| 93 | |||
| 94 | /* Every call to re_match, etc., must pass &search_regs as the regs | ||
| 95 | argument unless you can show it is unnecessary (i.e., if re_match | ||
| 96 | is certainly going to be called again before region-around-match | ||
| 97 | can be called). | ||
| 98 | |||
| 99 | Since the registers are now dynamically allocated, we need to make | ||
| 100 | sure not to refer to the Nth register before checking that it has | ||
| 101 | been allocated by checking search_regs.num_regs. | ||
| 102 | |||
| 103 | The regex code keeps track of whether it has allocated the search | ||
| 104 | buffer using bits in the re_pattern_buffer. This means that whenever | ||
| 105 | you compile a new pattern, it completely forgets whether it has | ||
| 106 | allocated any registers, and will allocate new registers the next | ||
| 107 | time you call a searching or matching function. Therefore, we need | ||
| 108 | to call re_set_registers after compiling a new pattern or after | ||
| 109 | setting the match registers, so that the regex functions will be | ||
| 110 | able to free or re-allocate it properly. */ | ||
| 111 | struct re_registers m_search_regs; | ||
| 112 | #define search_regs (current_thread->m_search_regs) | ||
| 113 | |||
| 114 | /* If non-zero the match data have been saved in saved_search_regs | ||
| 115 | during the execution of a sentinel or filter. */ | ||
| 116 | int m_search_regs_saved; | ||
| 117 | #define search_regs_saved (current_thread->m_search_regs_saved) | ||
| 118 | |||
| 119 | struct re_registers m_saved_search_regs; | ||
| 120 | #define saved_search_regs (current_thread->m_saved_search_regs) | ||
| 121 | |||
| 122 | /* This is the string or buffer in which we | ||
| 123 | are matching. It is used for looking up syntax properties. */ | ||
| 124 | Lisp_Object m_re_match_object; | ||
| 125 | #define re_match_object (current_thread->m_re_match_object) | ||
| 126 | |||
| 127 | /* Set by `re_set_syntax' to the current regexp syntax to recognize. Can | ||
| 128 | also be assigned to arbitrarily: each pattern buffer stores its own | ||
| 129 | syntax, so it can be changed between regex compilations. */ | ||
| 130 | reg_syntax_t m_re_syntax_options; | ||
| 131 | #define re_syntax_options (current_thread->m_re_syntax_options) | ||
| 132 | |||
| 133 | /* Regexp to use to replace spaces, or NULL meaning don't. */ | ||
| 134 | /*re_char*/ unsigned char *m_whitespace_regexp; | ||
| 135 | #define whitespace_regexp (current_thread->m_whitespace_regexp) | ||
| 136 | }; | ||
| 137 | |||
| 138 | extern struct thread_state *current_thread; | ||
| 139 | |||
| 140 | #endif /* THREAD_H */ | ||
diff --git a/src/window.c b/src/window.c index f5622b217d7..e404b332516 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -5296,7 +5296,7 @@ struct save_window_data | |||
| 5296 | struct vectorlike_header header; | 5296 | struct vectorlike_header header; |
| 5297 | Lisp_Object selected_frame; | 5297 | Lisp_Object selected_frame; |
| 5298 | Lisp_Object current_window; | 5298 | Lisp_Object current_window; |
| 5299 | Lisp_Object current_buffer; | 5299 | Lisp_Object f_current_buffer; |
| 5300 | Lisp_Object minibuf_scroll_window; | 5300 | Lisp_Object minibuf_scroll_window; |
| 5301 | Lisp_Object minibuf_selected_window; | 5301 | Lisp_Object minibuf_selected_window; |
| 5302 | Lisp_Object root_window; | 5302 | Lisp_Object root_window; |
| @@ -5377,7 +5377,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5377 | data = (struct save_window_data *) XVECTOR (configuration); | 5377 | data = (struct save_window_data *) XVECTOR (configuration); |
| 5378 | saved_windows = XVECTOR (data->saved_windows); | 5378 | saved_windows = XVECTOR (data->saved_windows); |
| 5379 | 5379 | ||
| 5380 | new_current_buffer = data->current_buffer; | 5380 | new_current_buffer = data->f_current_buffer; |
| 5381 | if (NILP (BVAR (XBUFFER (new_current_buffer), name))) | 5381 | if (NILP (BVAR (XBUFFER (new_current_buffer), name))) |
| 5382 | new_current_buffer = Qnil; | 5382 | new_current_buffer = Qnil; |
| 5383 | else | 5383 | else |
| @@ -6012,7 +6012,7 @@ saved by this function. */) | |||
| 6012 | data->frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f); | 6012 | data->frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f); |
| 6013 | data->selected_frame = selected_frame; | 6013 | data->selected_frame = selected_frame; |
| 6014 | data->current_window = FRAME_SELECTED_WINDOW (f); | 6014 | data->current_window = FRAME_SELECTED_WINDOW (f); |
| 6015 | XSETBUFFER (data->current_buffer, current_buffer); | 6015 | XSETBUFFER (data->f_current_buffer, current_buffer); |
| 6016 | data->minibuf_scroll_window = minibuf_level > 0 ? Vminibuf_scroll_window : Qnil; | 6016 | data->minibuf_scroll_window = minibuf_level > 0 ? Vminibuf_scroll_window : Qnil; |
| 6017 | data->minibuf_selected_window = minibuf_level > 0 ? minibuf_selected_window : Qnil; | 6017 | data->minibuf_selected_window = minibuf_level > 0 ? minibuf_selected_window : Qnil; |
| 6018 | data->root_window = FRAME_ROOT_WINDOW (f); | 6018 | data->root_window = FRAME_ROOT_WINDOW (f); |
| @@ -6416,7 +6416,7 @@ compare_window_configurations (Lisp_Object configuration1, Lisp_Object configura | |||
| 6416 | || d1->frame_lines != d2->frame_lines | 6416 | || d1->frame_lines != d2->frame_lines |
| 6417 | || d1->frame_menu_bar_lines != d2->frame_menu_bar_lines | 6417 | || d1->frame_menu_bar_lines != d2->frame_menu_bar_lines |
| 6418 | || !EQ (d1->selected_frame, d2->selected_frame) | 6418 | || !EQ (d1->selected_frame, d2->selected_frame) |
| 6419 | || !EQ (d1->current_buffer, d2->current_buffer) | 6419 | || !EQ (d1->f_current_buffer, d2->f_current_buffer) |
| 6420 | || (!ignore_positions | 6420 | || (!ignore_positions |
| 6421 | && (!EQ (d1->minibuf_scroll_window, d2->minibuf_scroll_window) | 6421 | && (!EQ (d1->minibuf_scroll_window, d2->minibuf_scroll_window) |
| 6422 | || !EQ (d1->minibuf_selected_window, d2->minibuf_selected_window))) | 6422 | || !EQ (d1->minibuf_selected_window, d2->minibuf_selected_window))) |