aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-08-07 17:37:21 +0400
committerDmitry Antipov2012-08-07 17:37:21 +0400
commitc644523bd8a23e518c91b61a1b8520e866b715b9 (patch)
tree60fae47e02ad6c87b5e657110606255e849ecf77 /src
parent6a3d20cc46da1e59f230923056b6b351acb097b9 (diff)
downloademacs-c644523bd8a23e518c91b61a1b8520e866b715b9.tar.gz
emacs-c644523bd8a23e518c91b61a1b8520e866b715b9.zip
Revert and cleanup Lisp_Cons, Lisp_Misc and Lisp_Symbol things.
* src/lisp.h (struct Lisp_Symbol): Change xname to meaningful name since all xname users are fixed long time ago. Do not use INTERNAL_FIELD. (set_symbol_name, set_symbol_function, set_symbol_plist): (set_symbol_next, set_overlay_plist): New function. (struct Lisp_Cons): Do not use INTERNAL_FIELD. (struct Lisp_Overlay): Likewise. (CVAR, MVAR, SVAR): Remove. * src/alloc.c, src/buffer.c, src/buffer.h, src/bytecode.c: * src/cmds.c, src/data.c, src/doc.c, src/eval.c, src/fns.c: * src/keyboard.c, src/lread.c, src/nsselect.m, src/xterm.c: Adjust users. * src/.gdbinit: Change to use name field of struct Lisp_Symbol where appropriate. * admin/coccinelle/overlay.cocci, admin/coccinelle/symbol.cocci: Remove.
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit6
-rw-r--r--src/ChangeLog17
-rw-r--r--src/alloc.c56
-rw-r--r--src/buffer.c30
-rw-r--r--src/buffer.h6
-rw-r--r--src/bytecode.c2
-rw-r--r--src/cmds.c7
-rw-r--r--src/data.c34
-rw-r--r--src/doc.c2
-rw-r--r--src/eval.c14
-rw-r--r--src/fns.c10
-rw-r--r--src/keyboard.c8
-rw-r--r--src/lisp.h116
-rw-r--r--src/lread.c18
-rw-r--r--src/nsselect.m2
-rw-r--r--src/xterm.c2
16 files changed, 180 insertions, 150 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index ef534d45918..48d15e89e2f 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1047,7 +1047,7 @@ end
1047define xprintsym 1047define xprintsym
1048 xgetptr $arg0 1048 xgetptr $arg0
1049 set $sym = (struct Lisp_Symbol *) $ptr 1049 set $sym = (struct Lisp_Symbol *) $ptr
1050 xgetptr $sym->xname_ 1050 xgetptr $sym->name
1051 set $sym_name = (struct Lisp_String *) $ptr 1051 set $sym_name = (struct Lisp_String *) $ptr
1052 xprintstr $sym_name 1052 xprintstr $sym_name
1053end 1053end
@@ -1218,7 +1218,7 @@ xgetptr globals.f_Vsystem_type
1218# $ptr is NULL in temacs 1218# $ptr is NULL in temacs
1219if ($ptr != 0) 1219if ($ptr != 0)
1220 set $tem = (struct Lisp_Symbol *) $ptr 1220 set $tem = (struct Lisp_Symbol *) $ptr
1221 xgetptr $tem->xname_ 1221 xgetptr $tem->name
1222 set $tem = (struct Lisp_String *) $ptr 1222 set $tem = (struct Lisp_String *) $ptr
1223 set $tem = (char *) $tem->data 1223 set $tem = (char *) $tem->data
1224 1224
@@ -1241,7 +1241,7 @@ commands
1241 silent 1241 silent
1242 xgetptr globals.f_Vinitial_window_system 1242 xgetptr globals.f_Vinitial_window_system
1243 set $tem = (struct Lisp_Symbol *) $ptr 1243 set $tem = (struct Lisp_Symbol *) $ptr
1244 xgetptr $tem->xname_ 1244 xgetptr $tem->name
1245 set $tem = (struct Lisp_String *) $ptr 1245 set $tem = (struct Lisp_String *) $ptr
1246 set $tem = (char *) $tem->data 1246 set $tem = (char *) $tem->data
1247 # If we are running in synchronous mode, we want a chance to look 1247 # If we are running in synchronous mode, we want a chance to look
diff --git a/src/ChangeLog b/src/ChangeLog
index c363b258f46..61eae166704 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,22 @@
12012-08-07 Dmitry Antipov <dmantipov@yandex.ru> 12012-08-07 Dmitry Antipov <dmantipov@yandex.ru>
2 2
3 Revert and cleanup Lisp_Cons, Lisp_Misc and Lisp_Symbol things.
4 * lisp.h (struct Lisp_Symbol): Change xname to meaningful
5 name since all xname users are fixed long time ago. Do not
6 use INTERNAL_FIELD.
7 (set_symbol_name, set_symbol_function, set_symbol_plist):
8 (set_symbol_next, set_overlay_plist): New function.
9 (struct Lisp_Cons): Do not use INTERNAL_FIELD.
10 (struct Lisp_Overlay): Likewise.
11 (CVAR, MVAR, SVAR): Remove.
12 * alloc.c, buffer.c, buffer.h, bytecode.c, cmds.c, data.c:
13 * doc.c, eval.c, fns.c, keyboard.c, lread.c, nsselect.m:
14 * xterm.c: Adjust users.
15 * .gdbinit: Change to use name field of struct Lisp_Symbol
16 where appropriate.
17
182012-08-07 Dmitry Antipov <dmantipov@yandex.ru>
19
3 Basic functions to set Lisp_Object and pointer slots of intervals. 20 Basic functions to set Lisp_Object and pointer slots of intervals.
4 * intervals.h (interval_set_parent, interval_set_object): 21 * intervals.h (interval_set_parent, interval_set_object):
5 (interval_set_left, interval_set_right, interval_set_plist): 22 (interval_set_left, interval_set_right, interval_set_plist):
diff --git a/src/alloc.c b/src/alloc.c
index a9ce48172ab..b6fe6fa2eb3 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2691,7 +2691,7 @@ free_cons (struct Lisp_Cons *ptr)
2691{ 2691{
2692 ptr->u.chain = cons_free_list; 2692 ptr->u.chain = cons_free_list;
2693#if GC_MARK_STACK 2693#if GC_MARK_STACK
2694 CVAR (ptr, car) = Vdead; 2694 ptr->car = Vdead;
2695#endif 2695#endif
2696 cons_free_list = ptr; 2696 cons_free_list = ptr;
2697 consing_since_gc -= sizeof *ptr; 2697 consing_since_gc -= sizeof *ptr;
@@ -3522,12 +3522,12 @@ Its value and function definition are void, and its property list is nil. */)
3522 MALLOC_UNBLOCK_INPUT; 3522 MALLOC_UNBLOCK_INPUT;
3523 3523
3524 p = XSYMBOL (val); 3524 p = XSYMBOL (val);
3525 SVAR (p, xname) = name; 3525 set_symbol_name (val, name);
3526 SVAR (p, plist) = Qnil; 3526 set_symbol_plist (val, Qnil);
3527 p->redirect = SYMBOL_PLAINVAL; 3527 p->redirect = SYMBOL_PLAINVAL;
3528 SET_SYMBOL_VAL (p, Qunbound); 3528 SET_SYMBOL_VAL (p, Qunbound);
3529 SVAR (p, function) = Qunbound; 3529 set_symbol_function (val, Qunbound);
3530 p->next = NULL; 3530 set_symbol_next (val, NULL);
3531 p->gcmarkbit = 0; 3531 p->gcmarkbit = 0;
3532 p->interned = SYMBOL_UNINTERNED; 3532 p->interned = SYMBOL_UNINTERNED;
3533 p->constant = 0; 3533 p->constant = 0;
@@ -3654,7 +3654,7 @@ build_overlay (Lisp_Object start, Lisp_Object end, Lisp_Object plist)
3654 overlay = allocate_misc (Lisp_Misc_Overlay); 3654 overlay = allocate_misc (Lisp_Misc_Overlay);
3655 OVERLAY_START (overlay) = start; 3655 OVERLAY_START (overlay) = start;
3656 OVERLAY_END (overlay) = end; 3656 OVERLAY_END (overlay) = end;
3657 OVERLAY_PLIST (overlay) = plist; 3657 set_overlay_plist (overlay, plist);
3658 XOVERLAY (overlay)->next = NULL; 3658 XOVERLAY (overlay)->next = NULL;
3659 return overlay; 3659 return overlay;
3660} 3660}
@@ -4299,7 +4299,7 @@ live_cons_p (struct mem_node *m, void *p)
4299 && offset < (CONS_BLOCK_SIZE * sizeof b->conses[0]) 4299 && offset < (CONS_BLOCK_SIZE * sizeof b->conses[0])
4300 && (b != cons_block 4300 && (b != cons_block
4301 || offset / sizeof b->conses[0] < cons_block_index) 4301 || offset / sizeof b->conses[0] < cons_block_index)
4302 && !EQ (CVAR ((struct Lisp_Cons *) p, car), Vdead)); 4302 && !EQ (((struct Lisp_Cons *) p)->car, Vdead));
4303 } 4303 }
4304 else 4304 else
4305 return 0; 4305 return 0;
@@ -4325,7 +4325,7 @@ live_symbol_p (struct mem_node *m, void *p)
4325 && offset < (SYMBOL_BLOCK_SIZE * sizeof b->symbols[0]) 4325 && offset < (SYMBOL_BLOCK_SIZE * sizeof b->symbols[0])
4326 && (b != symbol_block 4326 && (b != symbol_block
4327 || offset / sizeof b->symbols[0] < symbol_block_index) 4327 || offset / sizeof b->symbols[0] < symbol_block_index)
4328 && !EQ (SVAR (((struct Lisp_Symbol *)p), function), Vdead)); 4328 && !EQ (((struct Lisp_Symbol *)p)->function, Vdead));
4329 } 4329 }
4330 else 4330 else
4331 return 0; 4331 return 0;
@@ -5831,9 +5831,9 @@ mark_overlay (struct Lisp_Overlay *ptr)
5831 for (; ptr && !ptr->gcmarkbit; ptr = ptr->next) 5831 for (; ptr && !ptr->gcmarkbit; ptr = ptr->next)
5832 { 5832 {
5833 ptr->gcmarkbit = 1; 5833 ptr->gcmarkbit = 1;
5834 mark_object (MVAR (ptr, start)); 5834 mark_object (ptr->start);
5835 mark_object (MVAR (ptr, end)); 5835 mark_object (ptr->end);
5836 mark_object (MVAR (ptr, plist)); 5836 mark_object (ptr->plist);
5837 } 5837 }
5838} 5838}
5839 5839
@@ -6067,8 +6067,8 @@ mark_object (Lisp_Object arg)
6067 break; 6067 break;
6068 CHECK_ALLOCATED_AND_LIVE (live_symbol_p); 6068 CHECK_ALLOCATED_AND_LIVE (live_symbol_p);
6069 ptr->gcmarkbit = 1; 6069 ptr->gcmarkbit = 1;
6070 mark_object (SVAR (ptr, function)); 6070 mark_object (ptr->function);
6071 mark_object (SVAR (ptr, plist)); 6071 mark_object (ptr->plist);
6072 switch (ptr->redirect) 6072 switch (ptr->redirect)
6073 { 6073 {
6074 case SYMBOL_PLAINVAL: mark_object (SYMBOL_VAL (ptr)); break; 6074 case SYMBOL_PLAINVAL: mark_object (SYMBOL_VAL (ptr)); break;
@@ -6099,9 +6099,9 @@ mark_object (Lisp_Object arg)
6099 break; 6099 break;
6100 default: abort (); 6100 default: abort ();
6101 } 6101 }
6102 if (!PURE_POINTER_P (XSTRING (SVAR (ptr, xname)))) 6102 if (!PURE_POINTER_P (XSTRING (ptr->name)))
6103 MARK_STRING (XSTRING (SVAR (ptr, xname))); 6103 MARK_STRING (XSTRING (ptr->name));
6104 MARK_INTERVAL_TREE (STRING_INTERVALS (SVAR (ptr, xname))); 6104 MARK_INTERVAL_TREE (STRING_INTERVALS (ptr->name));
6105 6105
6106 ptr = ptr->next; 6106 ptr = ptr->next;
6107 if (ptr) 6107 if (ptr)
@@ -6163,14 +6163,14 @@ mark_object (Lisp_Object arg)
6163 CHECK_ALLOCATED_AND_LIVE (live_cons_p); 6163 CHECK_ALLOCATED_AND_LIVE (live_cons_p);
6164 CONS_MARK (ptr); 6164 CONS_MARK (ptr);
6165 /* If the cdr is nil, avoid recursion for the car. */ 6165 /* If the cdr is nil, avoid recursion for the car. */
6166 if (EQ (CVAR (ptr, u.cdr), Qnil)) 6166 if (EQ (ptr->u.cdr, Qnil))
6167 { 6167 {
6168 obj = CVAR (ptr, car); 6168 obj = ptr->car;
6169 cdr_count = 0; 6169 cdr_count = 0;
6170 goto loop; 6170 goto loop;
6171 } 6171 }
6172 mark_object (CVAR (ptr, car)); 6172 mark_object (ptr->car);
6173 obj = CVAR (ptr, u.cdr); 6173 obj = ptr->u.cdr;
6174 cdr_count++; 6174 cdr_count++;
6175 if (cdr_count == mark_object_loop_halt) 6175 if (cdr_count == mark_object_loop_halt)
6176 abort (); 6176 abort ();
@@ -6319,7 +6319,7 @@ gc_sweep (void)
6319 cblk->conses[pos].u.chain = cons_free_list; 6319 cblk->conses[pos].u.chain = cons_free_list;
6320 cons_free_list = &cblk->conses[pos]; 6320 cons_free_list = &cblk->conses[pos];
6321#if GC_MARK_STACK 6321#if GC_MARK_STACK
6322 CVAR (cons_free_list, car) = Vdead; 6322 cons_free_list->car = Vdead;
6323#endif 6323#endif
6324 } 6324 }
6325 else 6325 else
@@ -6467,7 +6467,7 @@ gc_sweep (void)
6467 /* Check if the symbol was created during loadup. In such a case 6467 /* Check if the symbol was created during loadup. In such a case
6468 it might be pointed to by pure bytecode which we don't trace, 6468 it might be pointed to by pure bytecode which we don't trace,
6469 so we conservatively assume that it is live. */ 6469 so we conservatively assume that it is live. */
6470 int pure_p = PURE_POINTER_P (XSTRING (sym->s.INTERNAL_FIELD (xname))); 6470 int pure_p = PURE_POINTER_P (XSTRING (sym->s.name));
6471 6471
6472 if (!sym->s.gcmarkbit && !pure_p) 6472 if (!sym->s.gcmarkbit && !pure_p)
6473 { 6473 {
@@ -6476,7 +6476,7 @@ gc_sweep (void)
6476 sym->s.next = symbol_free_list; 6476 sym->s.next = symbol_free_list;
6477 symbol_free_list = &sym->s; 6477 symbol_free_list = &sym->s;
6478#if GC_MARK_STACK 6478#if GC_MARK_STACK
6479 SVAR (symbol_free_list, function) = Vdead; 6479 symbol_free_list->function = Vdead;
6480#endif 6480#endif
6481 ++this_free; 6481 ++this_free;
6482 } 6482 }
@@ -6484,7 +6484,7 @@ gc_sweep (void)
6484 { 6484 {
6485 ++num_used; 6485 ++num_used;
6486 if (!pure_p) 6486 if (!pure_p)
6487 UNMARK_STRING (XSTRING (sym->s.INTERNAL_FIELD (xname))); 6487 UNMARK_STRING (XSTRING (sym->s.name));
6488 sym->s.gcmarkbit = 0; 6488 sym->s.gcmarkbit = 0;
6489 } 6489 }
6490 } 6490 }
@@ -6669,10 +6669,10 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max)
6669 XSETSYMBOL (tem, sym); 6669 XSETSYMBOL (tem, sym);
6670 val = find_symbol_value (tem); 6670 val = find_symbol_value (tem);
6671 if (EQ (val, obj) 6671 if (EQ (val, obj)
6672 || EQ (SVAR (sym, function), obj) 6672 || EQ (sym->function, obj)
6673 || (!NILP (SVAR (sym, function)) 6673 || (!NILP (sym->function)
6674 && COMPILEDP (SVAR (sym, function)) 6674 && COMPILEDP (sym->function)
6675 && EQ (AREF (SVAR (sym, function), COMPILED_BYTECODE), obj)) 6675 && EQ (AREF (sym->function, COMPILED_BYTECODE), obj))
6676 || (!NILP (val) 6676 || (!NILP (val)
6677 && COMPILEDP (val) 6677 && COMPILEDP (val)
6678 && EQ (AREF (val, COMPILED_BYTECODE), obj))) 6678 && EQ (AREF (val, COMPILED_BYTECODE), obj)))
diff --git a/src/buffer.c b/src/buffer.c
index df1b2328394..7d0e1b641a2 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -419,17 +419,17 @@ copy_overlays (struct buffer *b, struct Lisp_Overlay *list)
419 Lisp_Object overlay, start, end; 419 Lisp_Object overlay, start, end;
420 struct Lisp_Marker *m; 420 struct Lisp_Marker *m;
421 421
422 eassert (MARKERP (MVAR (list, start))); 422 eassert (MARKERP (list->start));
423 m = XMARKER (MVAR (list, start)); 423 m = XMARKER (list->start);
424 start = build_marker (b, m->charpos, m->bytepos); 424 start = build_marker (b, m->charpos, m->bytepos);
425 XMARKER (start)->insertion_type = m->insertion_type; 425 XMARKER (start)->insertion_type = m->insertion_type;
426 426
427 eassert (MARKERP (MVAR (list, end))); 427 eassert (MARKERP (list->end));
428 m = XMARKER (MVAR (list, end)); 428 m = XMARKER (list->end);
429 end = build_marker (b, m->charpos, m->bytepos); 429 end = build_marker (b, m->charpos, m->bytepos);
430 XMARKER (end)->insertion_type = m->insertion_type; 430 XMARKER (end)->insertion_type = m->insertion_type;
431 431
432 overlay = build_overlay (start, end, Fcopy_sequence (MVAR (list, plist))); 432 overlay = build_overlay (start, end, Fcopy_sequence (list->plist));
433 if (tail) 433 if (tail)
434 tail = tail->next = XOVERLAY (overlay); 434 tail = tail->next = XOVERLAY (overlay);
435 else 435 else
@@ -659,11 +659,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
659static void 659static void
660drop_overlay (struct buffer *b, struct Lisp_Overlay *ov) 660drop_overlay (struct buffer *b, struct Lisp_Overlay *ov)
661{ 661{
662 eassert (b == XBUFFER (Fmarker_buffer (MVAR (ov, start)))); 662 eassert (b == XBUFFER (Fmarker_buffer (ov->start)));
663 modify_overlay (b, marker_position (MVAR (ov, start)), 663 modify_overlay (b, marker_position (ov->start),
664 marker_position (MVAR (ov, end))); 664 marker_position (ov->end));
665 Fset_marker (MVAR (ov, start), Qnil, Qnil); 665 Fset_marker (ov->start, Qnil, Qnil);
666 Fset_marker (MVAR (ov, end), Qnil, Qnil); 666 Fset_marker (ov->end, Qnil, Qnil);
667 667
668} 668}
669 669
@@ -3889,7 +3889,7 @@ OVERLAY. */)
3889{ 3889{
3890 CHECK_OVERLAY (overlay); 3890 CHECK_OVERLAY (overlay);
3891 3891
3892 return Fcopy_sequence (MVAR (XOVERLAY (overlay), plist)); 3892 return Fcopy_sequence (XOVERLAY (overlay)->plist);
3893} 3893}
3894 3894
3895 3895
@@ -4065,7 +4065,7 @@ DEFUN ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0,
4065 (Lisp_Object overlay, Lisp_Object prop) 4065 (Lisp_Object overlay, Lisp_Object prop)
4066{ 4066{
4067 CHECK_OVERLAY (overlay); 4067 CHECK_OVERLAY (overlay);
4068 return lookup_char_property (MVAR (XOVERLAY (overlay), plist), prop, 0); 4068 return lookup_char_property (XOVERLAY (overlay)->plist, prop, 0);
4069} 4069}
4070 4070
4071DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0, 4071DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0,
@@ -4080,7 +4080,7 @@ VALUE will be returned.*/)
4080 4080
4081 buffer = Fmarker_buffer (OVERLAY_START (overlay)); 4081 buffer = Fmarker_buffer (OVERLAY_START (overlay));
4082 4082
4083 for (tail = MVAR (XOVERLAY (overlay), plist); 4083 for (tail = XOVERLAY (overlay)->plist;
4084 CONSP (tail) && CONSP (XCDR (tail)); 4084 CONSP (tail) && CONSP (XCDR (tail));
4085 tail = XCDR (XCDR (tail))) 4085 tail = XCDR (XCDR (tail)))
4086 if (EQ (XCAR (tail), prop)) 4086 if (EQ (XCAR (tail), prop))
@@ -4091,8 +4091,8 @@ VALUE will be returned.*/)
4091 } 4091 }
4092 /* It wasn't in the list, so add it to the front. */ 4092 /* It wasn't in the list, so add it to the front. */
4093 changed = !NILP (value); 4093 changed = !NILP (value);
4094 MVAR (XOVERLAY (overlay), plist) 4094 set_overlay_plist
4095 = Fcons (prop, Fcons (value, MVAR (XOVERLAY (overlay), plist))); 4095 (overlay, Fcons (prop, Fcons (value, XOVERLAY (overlay)->plist)));
4096 found: 4096 found:
4097 if (! NILP (buffer)) 4097 if (! NILP (buffer))
4098 { 4098 {
diff --git a/src/buffer.h b/src/buffer.h
index 54e7ef288ed..9618fc6ded1 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -991,15 +991,15 @@ BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos)
991 991
992/* Return the marker that stands for where OV starts in the buffer. */ 992/* Return the marker that stands for where OV starts in the buffer. */
993 993
994#define OVERLAY_START(OV) MVAR (XOVERLAY (OV), start) 994#define OVERLAY_START(OV) XOVERLAY (OV)->start
995 995
996/* Return the marker that stands for where OV ends in the buffer. */ 996/* Return the marker that stands for where OV ends in the buffer. */
997 997
998#define OVERLAY_END(OV) MVAR (XOVERLAY (OV), end) 998#define OVERLAY_END(OV) XOVERLAY (OV)->end
999 999
1000/* Return the plist of overlay OV. */ 1000/* Return the plist of overlay OV. */
1001 1001
1002#define OVERLAY_PLIST(OV) MVAR (XOVERLAY (OV), plist) 1002#define OVERLAY_PLIST(OV) XOVERLAY (OV)->plist
1003 1003
1004/* Return the actual buffer position for the marker P. 1004/* Return the actual buffer position for the marker P.
1005 We assume you know which buffer it's pointing into. */ 1005 We assume you know which buffer it's pointing into. */
diff --git a/src/bytecode.c b/src/bytecode.c
index 49369de33e9..5ac8b4fa2bd 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -818,7 +818,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
818 && !EQ (val, Qunbound) 818 && !EQ (val, Qunbound)
819 && !XSYMBOL (sym)->redirect 819 && !XSYMBOL (sym)->redirect
820 && !SYMBOL_CONSTANT_P (sym)) 820 && !SYMBOL_CONSTANT_P (sym))
821 SVAR (XSYMBOL (sym), val.value) = val; 821 SET_SYMBOL_VAL (XSYMBOL (sym), val);
822 else 822 else
823 { 823 {
824 BEFORE_POTENTIAL_GC (); 824 BEFORE_POTENTIAL_GC ();
diff --git a/src/cmds.c b/src/cmds.c
index 4512f562064..c06a9edd160 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -447,12 +447,11 @@ internal_self_insert (int c, EMACS_INT n)
447 and the hook has a non-nil `no-self-insert' property, 447 and the hook has a non-nil `no-self-insert' property,
448 return right away--don't really self-insert. */ 448 return right away--don't really self-insert. */
449 if (SYMBOLP (sym) && ! NILP (sym) 449 if (SYMBOLP (sym) && ! NILP (sym)
450 && ! NILP (SVAR (XSYMBOL (sym), function)) 450 && ! NILP (XSYMBOL (sym)->function)
451 && SYMBOLP (SVAR (XSYMBOL (sym), function))) 451 && SYMBOLP (XSYMBOL (sym)->function))
452 { 452 {
453 Lisp_Object prop; 453 Lisp_Object prop;
454 prop = Fget (SVAR (XSYMBOL (sym), function), 454 prop = Fget (XSYMBOL (sym)->function, intern ("no-self-insert"));
455 intern ("no-self-insert"));
456 if (! NILP (prop)) 455 if (! NILP (prop))
457 return 1; 456 return 1;
458 } 457 }
diff --git a/src/data.c b/src/data.c
index 3a8e0b11d6a..c4519fc5e02 100644
--- a/src/data.c
+++ b/src/data.c
@@ -562,7 +562,7 @@ DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0,
562 (register Lisp_Object symbol) 562 (register Lisp_Object symbol)
563{ 563{
564 CHECK_SYMBOL (symbol); 564 CHECK_SYMBOL (symbol);
565 return (EQ (SVAR (XSYMBOL (symbol), function), Qunbound) ? Qnil : Qt); 565 return EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt;
566} 566}
567 567
568DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, 568DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0,
@@ -585,7 +585,7 @@ Return SYMBOL. */)
585 CHECK_SYMBOL (symbol); 585 CHECK_SYMBOL (symbol);
586 if (NILP (symbol) || EQ (symbol, Qt)) 586 if (NILP (symbol) || EQ (symbol, Qt))
587 xsignal1 (Qsetting_constant, symbol); 587 xsignal1 (Qsetting_constant, symbol);
588 SVAR (XSYMBOL (symbol), function) = Qunbound; 588 set_symbol_function (symbol, Qunbound);
589 return symbol; 589 return symbol;
590} 590}
591 591
@@ -594,8 +594,8 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0,
594 (register Lisp_Object symbol) 594 (register Lisp_Object symbol)
595{ 595{
596 CHECK_SYMBOL (symbol); 596 CHECK_SYMBOL (symbol);
597 if (!EQ (SVAR (XSYMBOL (symbol), function), Qunbound)) 597 if (!EQ (XSYMBOL (symbol)->function, Qunbound))
598 return SVAR (XSYMBOL (symbol), function); 598 return XSYMBOL (symbol)->function;
599 xsignal1 (Qvoid_function, symbol); 599 xsignal1 (Qvoid_function, symbol);
600} 600}
601 601
@@ -604,7 +604,7 @@ DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
604 (register Lisp_Object symbol) 604 (register Lisp_Object symbol)
605{ 605{
606 CHECK_SYMBOL (symbol); 606 CHECK_SYMBOL (symbol);
607 return SVAR (XSYMBOL (symbol), plist); 607 return XSYMBOL (symbol)->plist;
608} 608}
609 609
610DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0, 610DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0,
@@ -628,7 +628,7 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
628 if (NILP (symbol) || EQ (symbol, Qt)) 628 if (NILP (symbol) || EQ (symbol, Qt))
629 xsignal1 (Qsetting_constant, symbol); 629 xsignal1 (Qsetting_constant, symbol);
630 630
631 function = SVAR (XSYMBOL (symbol), function); 631 function = XSYMBOL (symbol)->function;
632 632
633 if (!NILP (Vautoload_queue) && !EQ (function, Qunbound)) 633 if (!NILP (Vautoload_queue) && !EQ (function, Qunbound))
634 Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue); 634 Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue);
@@ -636,13 +636,13 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
636 if (CONSP (function) && EQ (XCAR (function), Qautoload)) 636 if (CONSP (function) && EQ (XCAR (function), Qautoload))
637 Fput (symbol, Qautoload, XCDR (function)); 637 Fput (symbol, Qautoload, XCDR (function));
638 638
639 SVAR (XSYMBOL (symbol), function) = definition; 639 set_symbol_function (symbol, definition);
640 /* Handle automatic advice activation. */ 640 /* Handle automatic advice activation. */
641 if (CONSP (SVAR (XSYMBOL (symbol), plist)) 641 if (CONSP (XSYMBOL (symbol)->plist)
642 && !NILP (Fget (symbol, Qad_advice_info))) 642 && !NILP (Fget (symbol, Qad_advice_info)))
643 { 643 {
644 call2 (Qad_activate_internal, symbol, Qnil); 644 call2 (Qad_activate_internal, symbol, Qnil);
645 definition = SVAR (XSYMBOL (symbol), function); 645 definition = XSYMBOL (symbol)->function;
646 } 646 }
647 return definition; 647 return definition;
648} 648}
@@ -657,8 +657,8 @@ The return value is undefined. */)
657 (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring) 657 (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring)
658{ 658{
659 CHECK_SYMBOL (symbol); 659 CHECK_SYMBOL (symbol);
660 if (CONSP (SVAR (XSYMBOL (symbol), function)) 660 if (CONSP (XSYMBOL (symbol)->function)
661 && EQ (XCAR (SVAR (XSYMBOL (symbol), function)), Qautoload)) 661 && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload))
662 LOADHIST_ATTACH (Fcons (Qt, symbol)); 662 LOADHIST_ATTACH (Fcons (Qt, symbol));
663 if (!NILP (Vpurify_flag) 663 if (!NILP (Vpurify_flag)
664 /* If `definition' is a keymap, immutable (and copying) is wrong. */ 664 /* If `definition' is a keymap, immutable (and copying) is wrong. */
@@ -679,7 +679,7 @@ DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0,
679 (register Lisp_Object symbol, Lisp_Object newplist) 679 (register Lisp_Object symbol, Lisp_Object newplist)
680{ 680{
681 CHECK_SYMBOL (symbol); 681 CHECK_SYMBOL (symbol);
682 SVAR (XSYMBOL (symbol), plist) = newplist; 682 set_symbol_plist (symbol, newplist);
683 return newplist; 683 return newplist;
684} 684}
685 685
@@ -2019,12 +2019,12 @@ indirect_function (register Lisp_Object object)
2019 { 2019 {
2020 if (!SYMBOLP (hare) || EQ (hare, Qunbound)) 2020 if (!SYMBOLP (hare) || EQ (hare, Qunbound))
2021 break; 2021 break;
2022 hare = SVAR (XSYMBOL (hare), function); 2022 hare = XSYMBOL (hare)->function;
2023 if (!SYMBOLP (hare) || EQ (hare, Qunbound)) 2023 if (!SYMBOLP (hare) || EQ (hare, Qunbound))
2024 break; 2024 break;
2025 hare = SVAR (XSYMBOL (hare), function); 2025 hare = XSYMBOL (hare)->function;
2026 2026
2027 tortoise = SVAR (XSYMBOL (tortoise), function); 2027 tortoise = XSYMBOL (tortoise)->function;
2028 2028
2029 if (EQ (hare, tortoise)) 2029 if (EQ (hare, tortoise))
2030 xsignal1 (Qcyclic_function_indirection, object); 2030 xsignal1 (Qcyclic_function_indirection, object);
@@ -2048,7 +2048,7 @@ function chain of symbols. */)
2048 /* Optimize for no indirection. */ 2048 /* Optimize for no indirection. */
2049 result = object; 2049 result = object;
2050 if (SYMBOLP (result) && !EQ (result, Qunbound) 2050 if (SYMBOLP (result) && !EQ (result, Qunbound)
2051 && (result = SVAR (XSYMBOL (result), function), SYMBOLP (result))) 2051 && (result = XSYMBOL (result)->function, SYMBOLP (result)))
2052 result = indirect_function (result); 2052 result = indirect_function (result);
2053 if (!EQ (result, Qunbound)) 2053 if (!EQ (result, Qunbound))
2054 return result; 2054 return result;
@@ -3196,7 +3196,7 @@ syms_of_data (void)
3196 defsubr (&Ssubr_arity); 3196 defsubr (&Ssubr_arity);
3197 defsubr (&Ssubr_name); 3197 defsubr (&Ssubr_name);
3198 3198
3199 SVAR (XSYMBOL (Qwholenump), function) = SVAR (XSYMBOL (Qnatnump), function); 3199 set_symbol_function (Qwholenump, XSYMBOL (Qnatnump)->function);
3200 3200
3201 DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum, 3201 DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum,
3202 doc: /* The largest value that is representable in a Lisp integer. */); 3202 doc: /* The largest value that is representable in a Lisp integer. */);
diff --git a/src/doc.c b/src/doc.c
index 9445ff745be..d17e90f11c0 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -508,7 +508,7 @@ store_function_docstring (Lisp_Object obj, ptrdiff_t offset)
508{ 508{
509 /* Don't use indirect_function here, or defaliases will apply their 509 /* Don't use indirect_function here, or defaliases will apply their
510 docstrings to the base functions (Bug#2603). */ 510 docstrings to the base functions (Bug#2603). */
511 Lisp_Object fun = SYMBOLP (obj) ? SVAR (XSYMBOL (obj), function) : obj; 511 Lisp_Object fun = SYMBOLP (obj) ? XSYMBOL (obj)->function : obj;
512 512
513 /* The type determines where the docstring is stored. */ 513 /* The type determines where the docstring is stored. */
514 514
diff --git a/src/eval.c b/src/eval.c
index 63700f36d0a..d648be81b8d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -976,7 +976,7 @@ definitions to shadow the loaded ones for use in file byte-compilation. */)
976 tem = Fassq (sym, environment); 976 tem = Fassq (sym, environment);
977 if (NILP (tem)) 977 if (NILP (tem))
978 { 978 {
979 def = SVAR (XSYMBOL (sym), function); 979 def = XSYMBOL (sym)->function;
980 if (!EQ (def, Qunbound)) 980 if (!EQ (def, Qunbound))
981 continue; 981 continue;
982 } 982 }
@@ -1893,9 +1893,9 @@ this does nothing and returns nil. */)
1893 CHECK_STRING (file); 1893 CHECK_STRING (file);
1894 1894
1895 /* If function is defined and not as an autoload, don't override. */ 1895 /* If function is defined and not as an autoload, don't override. */
1896 if (!EQ (SVAR (XSYMBOL (function), function), Qunbound) 1896 if (!EQ (XSYMBOL (function)->function, Qunbound)
1897 && !(CONSP (SVAR (XSYMBOL (function), function)) 1897 && !(CONSP (XSYMBOL (function)->function)
1898 && EQ (XCAR (SVAR (XSYMBOL (function), function)), Qautoload))) 1898 && EQ (XCAR (XSYMBOL (function)->function), Qautoload)))
1899 return Qnil; 1899 return Qnil;
1900 1900
1901 if (NILP (Vpurify_flag)) 1901 if (NILP (Vpurify_flag))
@@ -2081,7 +2081,7 @@ eval_sub (Lisp_Object form)
2081 /* Optimize for no indirection. */ 2081 /* Optimize for no indirection. */
2082 fun = original_fun; 2082 fun = original_fun;
2083 if (SYMBOLP (fun) && !EQ (fun, Qunbound) 2083 if (SYMBOLP (fun) && !EQ (fun, Qunbound)
2084 && (fun = SVAR (XSYMBOL (fun), function), SYMBOLP (fun))) 2084 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2085 fun = indirect_function (fun); 2085 fun = indirect_function (fun);
2086 2086
2087 if (SUBRP (fun)) 2087 if (SUBRP (fun))
@@ -2266,7 +2266,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2266 2266
2267 /* Optimize for no indirection. */ 2267 /* Optimize for no indirection. */
2268 if (SYMBOLP (fun) && !EQ (fun, Qunbound) 2268 if (SYMBOLP (fun) && !EQ (fun, Qunbound)
2269 && (fun = SVAR (XSYMBOL (fun), function), SYMBOLP (fun))) 2269 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2270 fun = indirect_function (fun); 2270 fun = indirect_function (fun);
2271 if (EQ (fun, Qunbound)) 2271 if (EQ (fun, Qunbound))
2272 { 2272 {
@@ -2771,7 +2771,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2771 /* Optimize for no indirection. */ 2771 /* Optimize for no indirection. */
2772 fun = original_fun; 2772 fun = original_fun;
2773 if (SYMBOLP (fun) && !EQ (fun, Qunbound) 2773 if (SYMBOLP (fun) && !EQ (fun, Qunbound)
2774 && (fun = SVAR (XSYMBOL (fun), function), SYMBOLP (fun))) 2774 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2775 fun = indirect_function (fun); 2775 fun = indirect_function (fun);
2776 2776
2777 if (SUBRP (fun)) 2777 if (SUBRP (fun))
diff --git a/src/fns.c b/src/fns.c
index 739ffcaea22..8496d2de937 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1868,7 +1868,7 @@ This is the last value stored with `(put SYMBOL PROPNAME VALUE)'. */)
1868 (Lisp_Object symbol, Lisp_Object propname) 1868 (Lisp_Object symbol, Lisp_Object propname)
1869{ 1869{
1870 CHECK_SYMBOL (symbol); 1870 CHECK_SYMBOL (symbol);
1871 return Fplist_get (SVAR (XSYMBOL (symbol), plist), propname); 1871 return Fplist_get (XSYMBOL (symbol)->plist, propname);
1872} 1872}
1873 1873
1874DEFUN ("plist-put", Fplist_put, Splist_put, 3, 3, 0, 1874DEFUN ("plist-put", Fplist_put, Splist_put, 3, 3, 0,
@@ -1910,8 +1910,8 @@ It can be retrieved with `(get SYMBOL PROPNAME)'. */)
1910 (Lisp_Object symbol, Lisp_Object propname, Lisp_Object value) 1910 (Lisp_Object symbol, Lisp_Object propname, Lisp_Object value)
1911{ 1911{
1912 CHECK_SYMBOL (symbol); 1912 CHECK_SYMBOL (symbol);
1913 SVAR (XSYMBOL (symbol), plist) 1913 set_symbol_plist
1914 = Fplist_put (SVAR (XSYMBOL (symbol), plist), propname, value); 1914 (symbol, Fplist_put (XSYMBOL (symbol)->plist, propname, value));
1915 return value; 1915 return value;
1916} 1916}
1917 1917
@@ -2053,8 +2053,8 @@ internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int
2053 || !internal_equal (OVERLAY_END (o1), OVERLAY_END (o2), 2053 || !internal_equal (OVERLAY_END (o1), OVERLAY_END (o2),
2054 depth + 1, props)) 2054 depth + 1, props))
2055 return 0; 2055 return 0;
2056 o1 = MVAR (XOVERLAY (o1), plist); 2056 o1 = XOVERLAY (o1)->plist;
2057 o2 = MVAR (XOVERLAY (o2), plist); 2057 o2 = XOVERLAY (o2)->plist;
2058 goto tail_recurse; 2058 goto tail_recurse;
2059 } 2059 }
2060 if (MARKERP (o1)) 2060 if (MARKERP (o1))
diff --git a/src/keyboard.c b/src/keyboard.c
index ce14dfdafe2..633cf4c4a37 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -7896,7 +7896,7 @@ parse_menu_item (Lisp_Object item, int inmenubar)
7896 (such as lmenu.el set it up), check if the 7896 (such as lmenu.el set it up), check if the
7897 original command matches the cached command. */ 7897 original command matches the cached command. */
7898 && !(SYMBOLP (def) 7898 && !(SYMBOLP (def)
7899 && EQ (tem, SVAR (XSYMBOL (def), function))))) 7899 && EQ (tem, XSYMBOL (def)->function))))
7900 keys = Qnil; 7900 keys = Qnil;
7901 } 7901 }
7902 7902
@@ -8830,9 +8830,9 @@ access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt,
8830 /* Handle a symbol whose function definition is a keymap 8830 /* Handle a symbol whose function definition is a keymap
8831 or an array. */ 8831 or an array. */
8832 if (SYMBOLP (next) && !NILP (Ffboundp (next)) 8832 if (SYMBOLP (next) && !NILP (Ffboundp (next))
8833 && (ARRAYP (SVAR (XSYMBOL (next), function)) 8833 && (ARRAYP (XSYMBOL (next)->function)
8834 || KEYMAPP (SVAR (XSYMBOL (next), function)))) 8834 || KEYMAPP (XSYMBOL (next)->function)))
8835 next = Fautoload_do_load (SVAR (XSYMBOL (next), function), next, Qnil); 8835 next = Fautoload_do_load (XSYMBOL (next)->function, next, Qnil);
8836 8836
8837 /* If the keymap gives a function, not an 8837 /* If the keymap gives a function, not an
8838 array, then call the function with one arg and use 8838 array, then call the function with one arg and use
diff --git a/src/lisp.h b/src/lisp.h
index b6a36444043..873264af4ab 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -633,10 +633,7 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper)
633#define CHECK_TYPE(ok, Qxxxp, x) \ 633#define CHECK_TYPE(ok, Qxxxp, x) \
634 do { if (!(ok)) wrong_type_argument (Qxxxp, (x)); } while (0) 634 do { if (!(ok)) wrong_type_argument (Qxxxp, (x)); } while (0)
635 635
636/* Lisp fields are usually hidden from most code and accessed 636/* Deprecated and will be removed soon. */
637 via special macros. Only select pieces of code, like the GC,
638 are allowed to use INTERNAL_FIELD directly. Objects which
639 aren't using this convention should be fixed. */
640 637
641#define INTERNAL_FIELD(field) field ## _ 638#define INTERNAL_FIELD(field) field ## _
642 639
@@ -648,20 +645,15 @@ typedef struct interval *INTERVAL;
648#define CHECK_STRING_OR_BUFFER(x) \ 645#define CHECK_STRING_OR_BUFFER(x) \
649 CHECK_TYPE (STRINGP (x) || BUFFERP (x), Qbuffer_or_string_p, x) 646 CHECK_TYPE (STRINGP (x) || BUFFERP (x), Qbuffer_or_string_p, x)
650 647
651/* Most code should use this macro to
652 access Lisp fields in struct Lisp_Cons. */
653
654#define CVAR(cons, field) ((cons)->INTERNAL_FIELD (field))
655
656struct Lisp_Cons 648struct Lisp_Cons
657 { 649 {
658 /* Car of this cons cell. */ 650 /* Car of this cons cell. */
659 Lisp_Object INTERNAL_FIELD (car); 651 Lisp_Object car;
660 652
661 union 653 union
662 { 654 {
663 /* Cdr of this cons cell. */ 655 /* Cdr of this cons cell. */
664 Lisp_Object INTERNAL_FIELD (cdr); 656 Lisp_Object cdr;
665 657
666 /* Used to chain conses on a free list. */ 658 /* Used to chain conses on a free list. */
667 struct Lisp_Cons *chain; 659 struct Lisp_Cons *chain;
@@ -675,8 +667,8 @@ struct Lisp_Cons
675 fields are not accessible as lvalues. (What if we want to switch to 667 fields are not accessible as lvalues. (What if we want to switch to
676 a copying collector someday? Cached cons cell field addresses may be 668 a copying collector someday? Cached cons cell field addresses may be
677 invalidated at arbitrary points.) */ 669 invalidated at arbitrary points.) */
678#define XCAR_AS_LVALUE(c) (CVAR (XCONS (c), car)) 670#define XCAR_AS_LVALUE(c) (XCONS (c)->car)
679#define XCDR_AS_LVALUE(c) (CVAR (XCONS (c), u.cdr)) 671#define XCDR_AS_LVALUE(c) (XCONS (c)->u.cdr)
680 672
681/* Use these from normal code. */ 673/* Use these from normal code. */
682#define XCAR(c) LISP_MAKE_RVALUE (XCAR_AS_LVALUE (c)) 674#define XCAR(c) LISP_MAKE_RVALUE (XCAR_AS_LVALUE (c))
@@ -1067,11 +1059,6 @@ enum symbol_redirect
1067 SYMBOL_FORWARDED = 3 1059 SYMBOL_FORWARDED = 3
1068}; 1060};
1069 1061
1070/* Most code should use this macro to access
1071 Lisp fields in struct Lisp_Symbol. */
1072
1073#define SVAR(sym, field) ((sym)->INTERNAL_FIELD (field))
1074
1075struct Lisp_Symbol 1062struct Lisp_Symbol
1076{ 1063{
1077 unsigned gcmarkbit : 1; 1064 unsigned gcmarkbit : 1;
@@ -1096,25 +1083,23 @@ struct Lisp_Symbol
1096 special (with `defvar' etc), and shouldn't be lexically bound. */ 1083 special (with `defvar' etc), and shouldn't be lexically bound. */
1097 unsigned declared_special : 1; 1084 unsigned declared_special : 1;
1098 1085
1099 /* The symbol's name, as a Lisp string. 1086 /* The symbol's name, as a Lisp string. */
1100 The name "xname" is used to intentionally break code referring to 1087 Lisp_Object name;
1101 the old field "name" of type pointer to struct Lisp_String. */
1102 Lisp_Object INTERNAL_FIELD (xname);
1103 1088
1104 /* Value of the symbol or Qunbound if unbound. Which alternative of the 1089 /* Value of the symbol or Qunbound if unbound. Which alternative of the
1105 union is used depends on the `redirect' field above. */ 1090 union is used depends on the `redirect' field above. */
1106 union { 1091 union {
1107 Lisp_Object INTERNAL_FIELD (value); 1092 Lisp_Object value;
1108 struct Lisp_Symbol *alias; 1093 struct Lisp_Symbol *alias;
1109 struct Lisp_Buffer_Local_Value *blv; 1094 struct Lisp_Buffer_Local_Value *blv;
1110 union Lisp_Fwd *fwd; 1095 union Lisp_Fwd *fwd;
1111 } val; 1096 } val;
1112 1097
1113 /* Function value of the symbol or Qunbound if not fboundp. */ 1098 /* Function value of the symbol or Qunbound if not fboundp. */
1114 Lisp_Object INTERNAL_FIELD (function); 1099 Lisp_Object function;
1115 1100
1116 /* The symbol's property list. */ 1101 /* The symbol's property list. */
1117 Lisp_Object INTERNAL_FIELD (plist); 1102 Lisp_Object plist;
1118 1103
1119 /* Next symbol in obarray bucket, if the symbol is interned. */ 1104 /* Next symbol in obarray bucket, if the symbol is interned. */
1120 struct Lisp_Symbol *next; 1105 struct Lisp_Symbol *next;
@@ -1122,43 +1107,42 @@ struct Lisp_Symbol
1122 1107
1123/* Value is name of symbol. */ 1108/* Value is name of symbol. */
1124 1109
1125#define SYMBOL_VAL(sym) \ 1110#define SYMBOL_VAL(sym) \
1126 (eassert ((sym)->redirect == SYMBOL_PLAINVAL), SVAR (sym, val.value)) 1111 (eassert ((sym)->redirect == SYMBOL_PLAINVAL), sym->val.value)
1127#define SYMBOL_ALIAS(sym) \ 1112#define SYMBOL_ALIAS(sym) \
1128 (eassert ((sym)->redirect == SYMBOL_VARALIAS), (sym)->val.alias) 1113 (eassert ((sym)->redirect == SYMBOL_VARALIAS), (sym)->val.alias)
1129#define SYMBOL_BLV(sym) \ 1114#define SYMBOL_BLV(sym) \
1130 (eassert ((sym)->redirect == SYMBOL_LOCALIZED), (sym)->val.blv) 1115 (eassert ((sym)->redirect == SYMBOL_LOCALIZED), (sym)->val.blv)
1131#define SYMBOL_FWD(sym) \ 1116#define SYMBOL_FWD(sym) \
1132 (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd) 1117 (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd)
1133#define SET_SYMBOL_VAL(sym, v) \ 1118#define SET_SYMBOL_VAL(sym, v) \
1134 (eassert ((sym)->redirect == SYMBOL_PLAINVAL), SVAR (sym, val.value) = (v)) 1119 (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value = (v))
1135#define SET_SYMBOL_ALIAS(sym, v) \ 1120#define SET_SYMBOL_ALIAS(sym, v) \
1136 (eassert ((sym)->redirect == SYMBOL_VARALIAS), (sym)->val.alias = (v)) 1121 (eassert ((sym)->redirect == SYMBOL_VARALIAS), (sym)->val.alias = (v))
1137#define SET_SYMBOL_BLV(sym, v) \ 1122#define SET_SYMBOL_BLV(sym, v) \
1138 (eassert ((sym)->redirect == SYMBOL_LOCALIZED), (sym)->val.blv = (v)) 1123 (eassert ((sym)->redirect == SYMBOL_LOCALIZED), (sym)->val.blv = (v))
1139#define SET_SYMBOL_FWD(sym, v) \ 1124#define SET_SYMBOL_FWD(sym, v) \
1140 (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd = (v)) 1125 (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd = (v))
1141 1126
1142#define SYMBOL_NAME(sym) \ 1127#define SYMBOL_NAME(sym) XSYMBOL (sym)->name
1143 LISP_MAKE_RVALUE (SVAR (XSYMBOL (sym), xname))
1144 1128
1145/* Value is non-zero if SYM is an interned symbol. */ 1129/* Value is non-zero if SYM is an interned symbol. */
1146 1130
1147#define SYMBOL_INTERNED_P(sym) \ 1131#define SYMBOL_INTERNED_P(sym) \
1148 (XSYMBOL (sym)->interned != SYMBOL_UNINTERNED) 1132 (XSYMBOL (sym)->interned != SYMBOL_UNINTERNED)
1149 1133
1150/* Value is non-zero if SYM is interned in initial_obarray. */ 1134/* Value is non-zero if SYM is interned in initial_obarray. */
1151 1135
1152#define SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P(sym) \ 1136#define SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P(sym) \
1153 (XSYMBOL (sym)->interned == SYMBOL_INTERNED_IN_INITIAL_OBARRAY) 1137 (XSYMBOL (sym)->interned == SYMBOL_INTERNED_IN_INITIAL_OBARRAY)
1154 1138
1155/* Value is non-zero if symbol is considered a constant, i.e. its 1139/* Value is non-zero if symbol is considered a constant, i.e. its
1156 value cannot be changed (there is an exception for keyword symbols, 1140 value cannot be changed (there is an exception for keyword symbols,
1157 whose value can be set to the keyword symbol itself). */ 1141 whose value can be set to the keyword symbol itself). */
1158 1142
1159#define SYMBOL_CONSTANT_P(sym) XSYMBOL (sym)->constant 1143#define SYMBOL_CONSTANT_P(sym) XSYMBOL (sym)->constant
1160 1144
1161#define DEFSYM(sym, name) \ 1145#define DEFSYM(sym, name) \
1162 do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0) 1146 do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0)
1163 1147
1164 1148
@@ -1289,11 +1273,6 @@ static double const DEFAULT_REHASH_THRESHOLD = 0.8;
1289 1273
1290static double const DEFAULT_REHASH_SIZE = 1.5; 1274static double const DEFAULT_REHASH_SIZE = 1.5;
1291 1275
1292/* Most code should use this macro to access
1293 Lisp fields in a different misc objects. */
1294
1295#define MVAR(misc, field) ((misc)->INTERNAL_FIELD (field))
1296
1297/* These structures are used for various misc types. */ 1276/* These structures are used for various misc types. */
1298 1277
1299struct Lisp_Misc_Any /* Supertype of all Misc types. */ 1278struct Lisp_Misc_Any /* Supertype of all Misc types. */
@@ -1363,9 +1342,9 @@ struct Lisp_Overlay
1363 unsigned gcmarkbit : 1; 1342 unsigned gcmarkbit : 1;
1364 int spacer : 15; 1343 int spacer : 15;
1365 struct Lisp_Overlay *next; 1344 struct Lisp_Overlay *next;
1366 Lisp_Object INTERNAL_FIELD (start); 1345 Lisp_Object start;
1367 Lisp_Object INTERNAL_FIELD (end); 1346 Lisp_Object end;
1368 Lisp_Object INTERNAL_FIELD (plist); 1347 Lisp_Object plist;
1369 }; 1348 };
1370 1349
1371/* Hold a C pointer for later use. 1350/* Hold a C pointer for later use.
@@ -2406,6 +2385,41 @@ set_hash_index (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
2406 gc_aset (h->index, idx, val); 2385 gc_aset (h->index, idx, val);
2407} 2386}
2408 2387
2388/* Use these functions to set Lisp_Object
2389 or pointer slots of struct Lisp_Symbol. */
2390
2391LISP_INLINE void
2392set_symbol_name (Lisp_Object sym, Lisp_Object name)
2393{
2394 XSYMBOL (sym)->name = name;
2395}
2396
2397LISP_INLINE void
2398set_symbol_function (Lisp_Object sym, Lisp_Object function)
2399{
2400 XSYMBOL (sym)->function = function;
2401}
2402
2403LISP_INLINE void
2404set_symbol_plist (Lisp_Object sym, Lisp_Object plist)
2405{
2406 XSYMBOL (sym)->plist = plist;
2407}
2408
2409LISP_INLINE void
2410set_symbol_next (Lisp_Object sym, struct Lisp_Symbol *next)
2411{
2412 XSYMBOL (sym)->next = next;
2413}
2414
2415/* Set overlay's property list. */
2416
2417LISP_INLINE void
2418set_overlay_plist (Lisp_Object overlay, Lisp_Object plist)
2419{
2420 XOVERLAY (overlay)->plist = plist;
2421}
2422
2409/* Defined in data.c. */ 2423/* Defined in data.c. */
2410extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound; 2424extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound;
2411extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; 2425extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
diff --git a/src/lread.c b/src/lread.c
index 4763f82e457..5d26b7f6b2f 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3717,9 +3717,9 @@ it defaults to the value of `obarray'. */)
3717 3717
3718 ptr = aref_addr (obarray, XINT(tem)); 3718 ptr = aref_addr (obarray, XINT(tem));
3719 if (SYMBOLP (*ptr)) 3719 if (SYMBOLP (*ptr))
3720 XSYMBOL (sym)->next = XSYMBOL (*ptr); 3720 set_symbol_next (sym, XSYMBOL (*ptr));
3721 else 3721 else
3722 XSYMBOL (sym)->next = 0; 3722 set_symbol_next (sym, NULL);
3723 *ptr = sym; 3723 *ptr = sym;
3724 return sym; 3724 return sym;
3725} 3725}
@@ -3816,7 +3816,7 @@ OBARRAY defaults to the value of the variable `obarray'. */)
3816 XSETSYMBOL (following, XSYMBOL (tail)->next); 3816 XSETSYMBOL (following, XSYMBOL (tail)->next);
3817 if (EQ (following, tem)) 3817 if (EQ (following, tem))
3818 { 3818 {
3819 XSYMBOL (tail)->next = XSYMBOL (following)->next; 3819 set_symbol_next (tail, XSYMBOL (following)->next);
3820 break; 3820 break;
3821 } 3821 }
3822 } 3822 }
@@ -3926,13 +3926,12 @@ init_obarray (void)
3926 /* Fmake_symbol inits fields of new symbols with Qunbound and Qnil, 3926 /* Fmake_symbol inits fields of new symbols with Qunbound and Qnil,
3927 so those two need to be fixed manually. */ 3927 so those two need to be fixed manually. */
3928 SET_SYMBOL_VAL (XSYMBOL (Qunbound), Qunbound); 3928 SET_SYMBOL_VAL (XSYMBOL (Qunbound), Qunbound);
3929 SVAR (XSYMBOL (Qunbound), function) = Qunbound; 3929 set_symbol_function (Qunbound, Qunbound);
3930 SVAR (XSYMBOL (Qunbound), plist) = Qnil; 3930 set_symbol_plist (Qunbound, Qnil);
3931 /* XSYMBOL (Qnil)->function = Qunbound; */
3932 SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil); 3931 SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil);
3933 XSYMBOL (Qnil)->constant = 1; 3932 XSYMBOL (Qnil)->constant = 1;
3934 XSYMBOL (Qnil)->declared_special = 1; 3933 XSYMBOL (Qnil)->declared_special = 1;
3935 SVAR (XSYMBOL (Qnil), plist) = Qnil; 3934 set_symbol_plist (Qnil, Qnil);
3936 3935
3937 Qt = intern_c_string ("t"); 3936 Qt = intern_c_string ("t");
3938 SET_SYMBOL_VAL (XSYMBOL (Qt), Qt); 3937 SET_SYMBOL_VAL (XSYMBOL (Qt), Qt);
@@ -3951,10 +3950,11 @@ init_obarray (void)
3951void 3950void
3952defsubr (struct Lisp_Subr *sname) 3951defsubr (struct Lisp_Subr *sname)
3953{ 3952{
3954 Lisp_Object sym; 3953 Lisp_Object sym, tem;
3955 sym = intern_c_string (sname->symbol_name); 3954 sym = intern_c_string (sname->symbol_name);
3956 XSETTYPED_PVECTYPE (sname, size, PVEC_SUBR); 3955 XSETTYPED_PVECTYPE (sname, size, PVEC_SUBR);
3957 XSETSUBR (SVAR (XSYMBOL (sym), function), sname); 3956 XSETSUBR (tem, sname);
3957 set_symbol_function (sym, tem);
3958} 3958}
3959 3959
3960#ifdef NOTDEF /* Use fset in subr.el now! */ 3960#ifdef NOTDEF /* Use fset in subr.el now! */
diff --git a/src/nsselect.m b/src/nsselect.m
index e8c3f85011b..e0bbfe58636 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -62,7 +62,7 @@ symbol_to_nsstring (Lisp_Object sym)
62 if (EQ (sym, QPRIMARY)) return NXPrimaryPboard; 62 if (EQ (sym, QPRIMARY)) return NXPrimaryPboard;
63 if (EQ (sym, QSECONDARY)) return NXSecondaryPboard; 63 if (EQ (sym, QSECONDARY)) return NXSecondaryPboard;
64 if (EQ (sym, QTEXT)) return NSStringPboardType; 64 if (EQ (sym, QTEXT)) return NSStringPboardType;
65 return [NSString stringWithUTF8String: SSDATA (SVAR (XSYMBOL (sym), xname))]; 65 return [NSString stringWithUTF8String: SSDATA (SYMBOL_NAME (sym))];
66} 66}
67 67
68static NSPasteboard * 68static NSPasteboard *
diff --git a/src/xterm.c b/src/xterm.c
index 85b9cc8dfba..e56c19e03e7 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10123,7 +10123,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10123 terminal->kboard->next_kboard = all_kboards; 10123 terminal->kboard->next_kboard = all_kboards;
10124 all_kboards = terminal->kboard; 10124 all_kboards = terminal->kboard;
10125 10125
10126 if (!EQ (SVAR (XSYMBOL (Qvendor_specific_keysyms), function), Qunbound)) 10126 if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound))
10127 { 10127 {
10128 char *vendor = ServerVendor (dpy); 10128 char *vendor = ServerVendor (dpy);
10129 10129