diff options
| author | Dmitry Antipov | 2012-08-01 11:57:09 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-08-01 11:57:09 +0400 |
| commit | 8271d59040b3d83fb3fc8cb23723538183b12ad4 (patch) | |
| tree | 909df79d98251334a8e2dc393d54ec47cc441756 /src | |
| parent | 0d26d7c4dc79554439ad96fb7d9f75aa2085e0ca (diff) | |
| download | emacs-8271d59040b3d83fb3fc8cb23723538183b12ad4.tar.gz emacs-8271d59040b3d83fb3fc8cb23723538183b12ad4.zip | |
Use INTERNAL_FIELD for symbols.
* src/lisp.h (SVAR): New macro. Adjust users.
* src/alloc.c, 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/xterm.c: Users changed.
* admin/coccinelle/symbol.cocci: Semantic patch to replace direct
access to Lisp_Object members of struct Lisp_Symbol to SVAR.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/alloc.c | 32 | ||||
| -rw-r--r-- | src/bytecode.c | 2 | ||||
| -rw-r--r-- | src/cmds.c | 8 | ||||
| -rw-r--r-- | src/data.c | 34 | ||||
| -rw-r--r-- | src/doc.c | 2 | ||||
| -rw-r--r-- | src/eval.c | 14 | ||||
| -rw-r--r-- | src/fns.c | 6 | ||||
| -rw-r--r-- | src/keyboard.c | 9 | ||||
| -rw-r--r-- | src/lisp.h | 19 | ||||
| -rw-r--r-- | src/lread.c | 8 | ||||
| -rw-r--r-- | src/xterm.c | 2 |
12 files changed, 79 insertions, 64 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e6b8051458f..3bb9c2b4eef 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,12 @@ | |||
| 1 | 2012-08-01 Dmitry Antipov <dmantipov@yandex.ru> | 1 | 2012-08-01 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 2 | ||
| 3 | Use INTERNAL_FIELD for symbols. | ||
| 4 | * lisp.h (SVAR): New macro. Adjust users. | ||
| 5 | * alloc.c, bytecode.c, cmds.c, data.c, doc.c, eval.c: | ||
| 6 | * fns.c, keyboard.c, lread.c, xterm.c: Users changed. | ||
| 7 | |||
| 8 | 2012-08-01 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 9 | |||
| 3 | Use INTERNAL_FIELD for processes. | 10 | Use INTERNAL_FIELD for processes. |
| 4 | * process.h (PVAR): New macro. Adjust style. | 11 | * process.h (PVAR): New macro. Adjust style. |
| 5 | (struct Lisp_Process): Change Lisp_Object members to INTERNAL_FIELD. | 12 | (struct Lisp_Process): Change Lisp_Object members to INTERNAL_FIELD. |
diff --git a/src/alloc.c b/src/alloc.c index d824a6a491e..8207f022a12 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3518,11 +3518,11 @@ Its value and function definition are void, and its property list is nil. */) | |||
| 3518 | MALLOC_UNBLOCK_INPUT; | 3518 | MALLOC_UNBLOCK_INPUT; |
| 3519 | 3519 | ||
| 3520 | p = XSYMBOL (val); | 3520 | p = XSYMBOL (val); |
| 3521 | p->xname = name; | 3521 | SVAR (p, xname) = name; |
| 3522 | p->plist = Qnil; | 3522 | SVAR (p, plist) = Qnil; |
| 3523 | p->redirect = SYMBOL_PLAINVAL; | 3523 | p->redirect = SYMBOL_PLAINVAL; |
| 3524 | SET_SYMBOL_VAL (p, Qunbound); | 3524 | SET_SYMBOL_VAL (p, Qunbound); |
| 3525 | p->function = Qunbound; | 3525 | SVAR (p, function) = Qunbound; |
| 3526 | p->next = NULL; | 3526 | p->next = NULL; |
| 3527 | p->gcmarkbit = 0; | 3527 | p->gcmarkbit = 0; |
| 3528 | p->interned = SYMBOL_UNINTERNED; | 3528 | p->interned = SYMBOL_UNINTERNED; |
| @@ -4321,7 +4321,7 @@ live_symbol_p (struct mem_node *m, void *p) | |||
| 4321 | && offset < (SYMBOL_BLOCK_SIZE * sizeof b->symbols[0]) | 4321 | && offset < (SYMBOL_BLOCK_SIZE * sizeof b->symbols[0]) |
| 4322 | && (b != symbol_block | 4322 | && (b != symbol_block |
| 4323 | || offset / sizeof b->symbols[0] < symbol_block_index) | 4323 | || offset / sizeof b->symbols[0] < symbol_block_index) |
| 4324 | && !EQ (((struct Lisp_Symbol *) p)->function, Vdead)); | 4324 | && !EQ (SVAR (((struct Lisp_Symbol *)p), function), Vdead)); |
| 4325 | } | 4325 | } |
| 4326 | else | 4326 | else |
| 4327 | return 0; | 4327 | return 0; |
| @@ -6073,8 +6073,8 @@ mark_object (Lisp_Object arg) | |||
| 6073 | break; | 6073 | break; |
| 6074 | CHECK_ALLOCATED_AND_LIVE (live_symbol_p); | 6074 | CHECK_ALLOCATED_AND_LIVE (live_symbol_p); |
| 6075 | ptr->gcmarkbit = 1; | 6075 | ptr->gcmarkbit = 1; |
| 6076 | mark_object (ptr->function); | 6076 | mark_object (SVAR (ptr, function)); |
| 6077 | mark_object (ptr->plist); | 6077 | mark_object (SVAR (ptr, plist)); |
| 6078 | switch (ptr->redirect) | 6078 | switch (ptr->redirect) |
| 6079 | { | 6079 | { |
| 6080 | case SYMBOL_PLAINVAL: mark_object (SYMBOL_VAL (ptr)); break; | 6080 | case SYMBOL_PLAINVAL: mark_object (SYMBOL_VAL (ptr)); break; |
| @@ -6105,9 +6105,9 @@ mark_object (Lisp_Object arg) | |||
| 6105 | break; | 6105 | break; |
| 6106 | default: abort (); | 6106 | default: abort (); |
| 6107 | } | 6107 | } |
| 6108 | if (!PURE_POINTER_P (XSTRING (ptr->xname))) | 6108 | if (!PURE_POINTER_P (XSTRING (SVAR (ptr, xname)))) |
| 6109 | MARK_STRING (XSTRING (ptr->xname)); | 6109 | MARK_STRING (XSTRING (SVAR (ptr, xname))); |
| 6110 | MARK_INTERVAL_TREE (STRING_INTERVALS (ptr->xname)); | 6110 | MARK_INTERVAL_TREE (STRING_INTERVALS (SVAR (ptr, xname))); |
| 6111 | 6111 | ||
| 6112 | ptr = ptr->next; | 6112 | ptr = ptr->next; |
| 6113 | if (ptr) | 6113 | if (ptr) |
| @@ -6473,7 +6473,7 @@ gc_sweep (void) | |||
| 6473 | /* Check if the symbol was created during loadup. In such a case | 6473 | /* Check if the symbol was created during loadup. In such a case |
| 6474 | it might be pointed to by pure bytecode which we don't trace, | 6474 | it might be pointed to by pure bytecode which we don't trace, |
| 6475 | so we conservatively assume that it is live. */ | 6475 | so we conservatively assume that it is live. */ |
| 6476 | int pure_p = PURE_POINTER_P (XSTRING (sym->s.xname)); | 6476 | int pure_p = PURE_POINTER_P (XSTRING (sym->s.INTERNAL_FIELD (xname))); |
| 6477 | 6477 | ||
| 6478 | if (!sym->s.gcmarkbit && !pure_p) | 6478 | if (!sym->s.gcmarkbit && !pure_p) |
| 6479 | { | 6479 | { |
| @@ -6482,7 +6482,7 @@ gc_sweep (void) | |||
| 6482 | sym->s.next = symbol_free_list; | 6482 | sym->s.next = symbol_free_list; |
| 6483 | symbol_free_list = &sym->s; | 6483 | symbol_free_list = &sym->s; |
| 6484 | #if GC_MARK_STACK | 6484 | #if GC_MARK_STACK |
| 6485 | symbol_free_list->function = Vdead; | 6485 | SVAR (symbol_free_list, function) = Vdead; |
| 6486 | #endif | 6486 | #endif |
| 6487 | ++this_free; | 6487 | ++this_free; |
| 6488 | } | 6488 | } |
| @@ -6490,7 +6490,7 @@ gc_sweep (void) | |||
| 6490 | { | 6490 | { |
| 6491 | ++num_used; | 6491 | ++num_used; |
| 6492 | if (!pure_p) | 6492 | if (!pure_p) |
| 6493 | UNMARK_STRING (XSTRING (sym->s.xname)); | 6493 | UNMARK_STRING (XSTRING (sym->s.INTERNAL_FIELD (xname))); |
| 6494 | sym->s.gcmarkbit = 0; | 6494 | sym->s.gcmarkbit = 0; |
| 6495 | } | 6495 | } |
| 6496 | } | 6496 | } |
| @@ -6675,10 +6675,10 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max) | |||
| 6675 | XSETSYMBOL (tem, sym); | 6675 | XSETSYMBOL (tem, sym); |
| 6676 | val = find_symbol_value (tem); | 6676 | val = find_symbol_value (tem); |
| 6677 | if (EQ (val, obj) | 6677 | if (EQ (val, obj) |
| 6678 | || EQ (sym->function, obj) | 6678 | || EQ (SVAR (sym, function), obj) |
| 6679 | || (!NILP (sym->function) | 6679 | || (!NILP (SVAR (sym, function)) |
| 6680 | && COMPILEDP (sym->function) | 6680 | && COMPILEDP (SVAR (sym, function)) |
| 6681 | && EQ (AREF (sym->function, COMPILED_BYTECODE), obj)) | 6681 | && EQ (AREF (SVAR (sym, function), COMPILED_BYTECODE), obj)) |
| 6682 | || (!NILP (val) | 6682 | || (!NILP (val) |
| 6683 | && COMPILEDP (val) | 6683 | && COMPILEDP (val) |
| 6684 | && EQ (AREF (val, COMPILED_BYTECODE), obj))) | 6684 | && EQ (AREF (val, COMPILED_BYTECODE), obj))) |
diff --git a/src/bytecode.c b/src/bytecode.c index dca1e552dd0..523d56bc97b 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 | XSYMBOL (sym)->val.value = val; | 821 | SVAR (XSYMBOL (sym), val.value) = 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 a7a2eb6f528..4512f562064 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -446,11 +446,13 @@ internal_self_insert (int c, EMACS_INT n) | |||
| 446 | /* If we expanded an abbrev which has a hook, | 446 | /* If we expanded an abbrev which has a hook, |
| 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) && ! NILP (XSYMBOL (sym)->function) | 449 | if (SYMBOLP (sym) && ! NILP (sym) |
| 450 | && SYMBOLP (XSYMBOL (sym)->function)) | 450 | && ! NILP (SVAR (XSYMBOL (sym), function)) |
| 451 | && SYMBOLP (SVAR (XSYMBOL (sym), function))) | ||
| 451 | { | 452 | { |
| 452 | Lisp_Object prop; | 453 | Lisp_Object prop; |
| 453 | prop = Fget (XSYMBOL (sym)->function, intern ("no-self-insert")); | 454 | prop = Fget (SVAR (XSYMBOL (sym), function), |
| 455 | intern ("no-self-insert")); | ||
| 454 | if (! NILP (prop)) | 456 | if (! NILP (prop)) |
| 455 | return 1; | 457 | return 1; |
| 456 | } | 458 | } |
diff --git a/src/data.c b/src/data.c index 59228adb28f..4c6f7fe3eae 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 (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt); | 565 | return (EQ (SVAR (XSYMBOL (symbol), function), Qunbound) ? Qnil : Qt); |
| 566 | } | 566 | } |
| 567 | 567 | ||
| 568 | DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, | 568 | DEFUN ("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 | XSYMBOL (symbol)->function = Qunbound; | 588 | SVAR (XSYMBOL (symbol), function) = 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 (XSYMBOL (symbol)->function, Qunbound)) | 597 | if (!EQ (SVAR (XSYMBOL (symbol), function), Qunbound)) |
| 598 | return XSYMBOL (symbol)->function; | 598 | return SVAR (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 XSYMBOL (symbol)->plist; | 607 | return SVAR (XSYMBOL (symbol), plist); |
| 608 | } | 608 | } |
| 609 | 609 | ||
| 610 | DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0, | 610 | DEFUN ("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 = XSYMBOL (symbol)->function; | 631 | function = SVAR (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 | XSYMBOL (symbol)->function = definition; | 639 | SVAR (XSYMBOL (symbol), function) = definition; |
| 640 | /* Handle automatic advice activation. */ | 640 | /* Handle automatic advice activation. */ |
| 641 | if (CONSP (XSYMBOL (symbol)->plist) | 641 | if (CONSP (SVAR (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 = XSYMBOL (symbol)->function; | 645 | definition = SVAR (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 (XSYMBOL (symbol)->function) | 660 | if (CONSP (SVAR (XSYMBOL (symbol), function)) |
| 661 | && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload)) | 661 | && EQ (XCAR (SVAR (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 | XSYMBOL (symbol)->plist = newplist; | 682 | SVAR (XSYMBOL (symbol), plist) = 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 = XSYMBOL (hare)->function; | 2022 | hare = SVAR (XSYMBOL (hare), function); |
| 2023 | if (!SYMBOLP (hare) || EQ (hare, Qunbound)) | 2023 | if (!SYMBOLP (hare) || EQ (hare, Qunbound)) |
| 2024 | break; | 2024 | break; |
| 2025 | hare = XSYMBOL (hare)->function; | 2025 | hare = SVAR (XSYMBOL (hare), function); |
| 2026 | 2026 | ||
| 2027 | tortoise = XSYMBOL (tortoise)->function; | 2027 | tortoise = SVAR (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 = XSYMBOL (result)->function, SYMBOLP (result))) | 2051 | && (result = SVAR (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; |
| @@ -3197,7 +3197,7 @@ syms_of_data (void) | |||
| 3197 | defsubr (&Ssubr_arity); | 3197 | defsubr (&Ssubr_arity); |
| 3198 | defsubr (&Ssubr_name); | 3198 | defsubr (&Ssubr_name); |
| 3199 | 3199 | ||
| 3200 | XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function; | 3200 | SVAR (XSYMBOL (Qwholenump), function) = SVAR (XSYMBOL (Qnatnump), function); |
| 3201 | 3201 | ||
| 3202 | DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum, | 3202 | DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum, |
| 3203 | doc: /* The largest value that is representable in a Lisp integer. */); | 3203 | doc: /* The largest value that is representable in a Lisp integer. */); |
| @@ -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) ? XSYMBOL (obj)->function : obj; | 511 | Lisp_Object fun = SYMBOLP (obj) ? SVAR (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 391058d12c6..64f384f2ca9 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 = XSYMBOL (sym)->function; | 979 | def = SVAR (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 (XSYMBOL (function)->function, Qunbound) | 1896 | if (!EQ (SVAR (XSYMBOL (function), function), Qunbound) |
| 1897 | && !(CONSP (XSYMBOL (function)->function) | 1897 | && !(CONSP (SVAR (XSYMBOL (function), function)) |
| 1898 | && EQ (XCAR (XSYMBOL (function)->function), Qautoload))) | 1898 | && EQ (XCAR (SVAR (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 = XSYMBOL (fun)->function, SYMBOLP (fun))) | 2084 | && (fun = SVAR (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 = XSYMBOL (fun)->function, SYMBOLP (fun))) | 2269 | && (fun = SVAR (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 = XSYMBOL (fun)->function, SYMBOLP (fun))) | 2774 | && (fun = SVAR (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)) |
| @@ -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 (XSYMBOL (symbol)->plist, propname); | 1871 | return Fplist_get (SVAR (XSYMBOL (symbol), plist), propname); |
| 1872 | } | 1872 | } |
| 1873 | 1873 | ||
| 1874 | DEFUN ("plist-put", Fplist_put, Splist_put, 3, 3, 0, | 1874 | DEFUN ("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 | XSYMBOL (symbol)->plist | 1913 | SVAR (XSYMBOL (symbol), plist) |
| 1914 | = Fplist_put (XSYMBOL (symbol)->plist, propname, value); | 1914 | = Fplist_put (SVAR (XSYMBOL (symbol), plist), propname, value); |
| 1915 | return value; | 1915 | return value; |
| 1916 | } | 1916 | } |
| 1917 | 1917 | ||
diff --git a/src/keyboard.c b/src/keyboard.c index a8e7beddbc1..d14d5106306 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -7894,7 +7894,8 @@ parse_menu_item (Lisp_Object item, int inmenubar) | |||
| 7894 | /* If the command is an alias for another | 7894 | /* If the command is an alias for another |
| 7895 | (such as lmenu.el set it up), check if the | 7895 | (such as lmenu.el set it up), check if the |
| 7896 | original command matches the cached command. */ | 7896 | original command matches the cached command. */ |
| 7897 | && !(SYMBOLP (def) && EQ (tem, XSYMBOL (def)->function)))) | 7897 | && !(SYMBOLP (def) |
| 7898 | && EQ (tem, SVAR (XSYMBOL (def), function))))) | ||
| 7898 | keys = Qnil; | 7899 | keys = Qnil; |
| 7899 | } | 7900 | } |
| 7900 | 7901 | ||
| @@ -8823,9 +8824,9 @@ access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt, | |||
| 8823 | /* Handle a symbol whose function definition is a keymap | 8824 | /* Handle a symbol whose function definition is a keymap |
| 8824 | or an array. */ | 8825 | or an array. */ |
| 8825 | if (SYMBOLP (next) && !NILP (Ffboundp (next)) | 8826 | if (SYMBOLP (next) && !NILP (Ffboundp (next)) |
| 8826 | && (ARRAYP (XSYMBOL (next)->function) | 8827 | && (ARRAYP (SVAR (XSYMBOL (next), function)) |
| 8827 | || KEYMAPP (XSYMBOL (next)->function))) | 8828 | || KEYMAPP (SVAR (XSYMBOL (next), function)))) |
| 8828 | next = Fautoload_do_load (XSYMBOL (next)->function, next, Qnil); | 8829 | next = Fautoload_do_load (SVAR (XSYMBOL (next), function), next, Qnil); |
| 8829 | 8830 | ||
| 8830 | /* If the keymap gives a function, not an | 8831 | /* If the keymap gives a function, not an |
| 8831 | array, then call the function with one arg and use | 8832 | array, then call the function with one arg and use |
diff --git a/src/lisp.h b/src/lisp.h index e1c0cc18d6d..5e2195ce01d 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1039,6 +1039,11 @@ enum symbol_redirect | |||
| 1039 | SYMBOL_FORWARDED = 3 | 1039 | SYMBOL_FORWARDED = 3 |
| 1040 | }; | 1040 | }; |
| 1041 | 1041 | ||
| 1042 | /* Most code should use this macro to access | ||
| 1043 | Lisp fields in struct Lisp_Symbol. */ | ||
| 1044 | |||
| 1045 | #define SVAR(sym, field) ((sym)->INTERNAL_FIELD (field)) | ||
| 1046 | |||
| 1042 | struct Lisp_Symbol | 1047 | struct Lisp_Symbol |
| 1043 | { | 1048 | { |
| 1044 | unsigned gcmarkbit : 1; | 1049 | unsigned gcmarkbit : 1; |
| @@ -1066,22 +1071,22 @@ struct Lisp_Symbol | |||
| 1066 | /* The symbol's name, as a Lisp string. | 1071 | /* The symbol's name, as a Lisp string. |
| 1067 | The name "xname" is used to intentionally break code referring to | 1072 | The name "xname" is used to intentionally break code referring to |
| 1068 | the old field "name" of type pointer to struct Lisp_String. */ | 1073 | the old field "name" of type pointer to struct Lisp_String. */ |
| 1069 | Lisp_Object xname; | 1074 | Lisp_Object INTERNAL_FIELD (xname); |
| 1070 | 1075 | ||
| 1071 | /* Value of the symbol or Qunbound if unbound. Which alternative of the | 1076 | /* Value of the symbol or Qunbound if unbound. Which alternative of the |
| 1072 | union is used depends on the `redirect' field above. */ | 1077 | union is used depends on the `redirect' field above. */ |
| 1073 | union { | 1078 | union { |
| 1074 | Lisp_Object value; | 1079 | Lisp_Object INTERNAL_FIELD (value); |
| 1075 | struct Lisp_Symbol *alias; | 1080 | struct Lisp_Symbol *alias; |
| 1076 | struct Lisp_Buffer_Local_Value *blv; | 1081 | struct Lisp_Buffer_Local_Value *blv; |
| 1077 | union Lisp_Fwd *fwd; | 1082 | union Lisp_Fwd *fwd; |
| 1078 | } val; | 1083 | } val; |
| 1079 | 1084 | ||
| 1080 | /* Function value of the symbol or Qunbound if not fboundp. */ | 1085 | /* Function value of the symbol or Qunbound if not fboundp. */ |
| 1081 | Lisp_Object function; | 1086 | Lisp_Object INTERNAL_FIELD (function); |
| 1082 | 1087 | ||
| 1083 | /* The symbol's property list. */ | 1088 | /* The symbol's property list. */ |
| 1084 | Lisp_Object plist; | 1089 | Lisp_Object INTERNAL_FIELD (plist); |
| 1085 | 1090 | ||
| 1086 | /* Next symbol in obarray bucket, if the symbol is interned. */ | 1091 | /* Next symbol in obarray bucket, if the symbol is interned. */ |
| 1087 | struct Lisp_Symbol *next; | 1092 | struct Lisp_Symbol *next; |
| @@ -1090,7 +1095,7 @@ struct Lisp_Symbol | |||
| 1090 | /* Value is name of symbol. */ | 1095 | /* Value is name of symbol. */ |
| 1091 | 1096 | ||
| 1092 | #define SYMBOL_VAL(sym) \ | 1097 | #define SYMBOL_VAL(sym) \ |
| 1093 | (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value) | 1098 | (eassert ((sym)->redirect == SYMBOL_PLAINVAL), SVAR (sym, val.value)) |
| 1094 | #define SYMBOL_ALIAS(sym) \ | 1099 | #define SYMBOL_ALIAS(sym) \ |
| 1095 | (eassert ((sym)->redirect == SYMBOL_VARALIAS), (sym)->val.alias) | 1100 | (eassert ((sym)->redirect == SYMBOL_VARALIAS), (sym)->val.alias) |
| 1096 | #define SYMBOL_BLV(sym) \ | 1101 | #define SYMBOL_BLV(sym) \ |
| @@ -1098,7 +1103,7 @@ struct Lisp_Symbol | |||
| 1098 | #define SYMBOL_FWD(sym) \ | 1103 | #define SYMBOL_FWD(sym) \ |
| 1099 | (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd) | 1104 | (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd) |
| 1100 | #define SET_SYMBOL_VAL(sym, v) \ | 1105 | #define SET_SYMBOL_VAL(sym, v) \ |
| 1101 | (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value = (v)) | 1106 | (eassert ((sym)->redirect == SYMBOL_PLAINVAL), SVAR (sym, val.value) = (v)) |
| 1102 | #define SET_SYMBOL_ALIAS(sym, v) \ | 1107 | #define SET_SYMBOL_ALIAS(sym, v) \ |
| 1103 | (eassert ((sym)->redirect == SYMBOL_VARALIAS), (sym)->val.alias = (v)) | 1108 | (eassert ((sym)->redirect == SYMBOL_VARALIAS), (sym)->val.alias = (v)) |
| 1104 | #define SET_SYMBOL_BLV(sym, v) \ | 1109 | #define SET_SYMBOL_BLV(sym, v) \ |
| @@ -1107,7 +1112,7 @@ struct Lisp_Symbol | |||
| 1107 | (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd = (v)) | 1112 | (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd = (v)) |
| 1108 | 1113 | ||
| 1109 | #define SYMBOL_NAME(sym) \ | 1114 | #define SYMBOL_NAME(sym) \ |
| 1110 | LISP_MAKE_RVALUE (XSYMBOL (sym)->xname) | 1115 | LISP_MAKE_RVALUE (SVAR (XSYMBOL (sym), xname)) |
| 1111 | 1116 | ||
| 1112 | /* Value is non-zero if SYM is an interned symbol. */ | 1117 | /* Value is non-zero if SYM is an interned symbol. */ |
| 1113 | 1118 | ||
diff --git a/src/lread.c b/src/lread.c index 0db37d7492f..8a9547ee579 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -3922,13 +3922,13 @@ init_obarray (void) | |||
| 3922 | /* Fmake_symbol inits fields of new symbols with Qunbound and Qnil, | 3922 | /* Fmake_symbol inits fields of new symbols with Qunbound and Qnil, |
| 3923 | so those two need to be fixed manually. */ | 3923 | so those two need to be fixed manually. */ |
| 3924 | SET_SYMBOL_VAL (XSYMBOL (Qunbound), Qunbound); | 3924 | SET_SYMBOL_VAL (XSYMBOL (Qunbound), Qunbound); |
| 3925 | XSYMBOL (Qunbound)->function = Qunbound; | 3925 | SVAR (XSYMBOL (Qunbound), function) = Qunbound; |
| 3926 | XSYMBOL (Qunbound)->plist = Qnil; | 3926 | SVAR (XSYMBOL (Qunbound), plist) = Qnil; |
| 3927 | /* XSYMBOL (Qnil)->function = Qunbound; */ | 3927 | /* XSYMBOL (Qnil)->function = Qunbound; */ |
| 3928 | SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil); | 3928 | SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil); |
| 3929 | XSYMBOL (Qnil)->constant = 1; | 3929 | XSYMBOL (Qnil)->constant = 1; |
| 3930 | XSYMBOL (Qnil)->declared_special = 1; | 3930 | XSYMBOL (Qnil)->declared_special = 1; |
| 3931 | XSYMBOL (Qnil)->plist = Qnil; | 3931 | SVAR (XSYMBOL (Qnil), plist) = Qnil; |
| 3932 | 3932 | ||
| 3933 | Qt = intern_c_string ("t"); | 3933 | Qt = intern_c_string ("t"); |
| 3934 | SET_SYMBOL_VAL (XSYMBOL (Qt), Qt); | 3934 | SET_SYMBOL_VAL (XSYMBOL (Qt), Qt); |
| @@ -3950,7 +3950,7 @@ defsubr (struct Lisp_Subr *sname) | |||
| 3950 | Lisp_Object sym; | 3950 | Lisp_Object sym; |
| 3951 | sym = intern_c_string (sname->symbol_name); | 3951 | sym = intern_c_string (sname->symbol_name); |
| 3952 | XSETTYPED_PVECTYPE (sname, size, PVEC_SUBR); | 3952 | XSETTYPED_PVECTYPE (sname, size, PVEC_SUBR); |
| 3953 | XSETSUBR (XSYMBOL (sym)->function, sname); | 3953 | XSETSUBR (SVAR (XSYMBOL (sym), function), sname); |
| 3954 | } | 3954 | } |
| 3955 | 3955 | ||
| 3956 | #ifdef NOTDEF /* Use fset in subr.el now! */ | 3956 | #ifdef NOTDEF /* Use fset in subr.el now! */ |
diff --git a/src/xterm.c b/src/xterm.c index e4023f9de76..6831ef6971e 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -10117,7 +10117,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 10117 | terminal->kboard->next_kboard = all_kboards; | 10117 | terminal->kboard->next_kboard = all_kboards; |
| 10118 | all_kboards = terminal->kboard; | 10118 | all_kboards = terminal->kboard; |
| 10119 | 10119 | ||
| 10120 | if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound)) | 10120 | if (!EQ (SVAR (XSYMBOL (Qvendor_specific_keysyms), function), Qunbound)) |
| 10121 | { | 10121 | { |
| 10122 | char *vendor = ServerVendor (dpy); | 10122 | char *vendor = ServerVendor (dpy); |
| 10123 | 10123 | ||