diff options
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/lisp.h b/src/lisp.h index ab72bf158a4..1fa1deb82a4 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -725,25 +725,20 @@ struct Lisp_Symbol | |||
| 725 | #define TAG_PTR(tag, ptr) \ | 725 | #define TAG_PTR(tag, ptr) \ |
| 726 | ((USE_LSB_TAG ? (tag) : (EMACS_UINT) (tag) << VALBITS) + (uintptr_t) (ptr)) | 726 | ((USE_LSB_TAG ? (tag) : (EMACS_UINT) (tag) << VALBITS) + (uintptr_t) (ptr)) |
| 727 | 727 | ||
| 728 | /* Yield an integer that tags PTR as a symbol. */ | 728 | /* Yield an integer that contains a symbol tag along with OFFSET. |
| 729 | #define TAG_SYMPTR(ptr) \ | 729 | OFFSET should be the offset in bytes from 'lispsym' to the symbol. */ |
| 730 | #define TAG_SYMOFFSET(offset) \ | ||
| 730 | TAG_PTR (Lisp_Symbol, \ | 731 | TAG_PTR (Lisp_Symbol, \ |
| 731 | ((uintptr_t) ((char *) (ptr) - (char *) lispsym) \ | 732 | ((uintptr_t) (offset) >> (USE_LSB_TAG ? 0 : GCTYPEBITS))) |
| 732 | >> (USE_LSB_TAG ? 0 : GCTYPEBITS))) | ||
| 733 | 733 | ||
| 734 | /* Declare extern constants for Lisp symbols. These can be helpful | 734 | /* Declare extern constants for Lisp symbols. These can be helpful |
| 735 | when using a debugger like GDB, on older platforms where the debug | 735 | when using a debugger like GDB, on older platforms where the debug |
| 736 | format does not represent C macros. However, they don't work with | 736 | format does not represent C macros. */ |
| 737 | GCC if INTPTR_MAX != EMACS_INT_MAX. */ | 737 | #define DEFINE_LISP_SYMBOL_BEGIN(name) \ |
| 738 | #if EMACS_INT_MAX == INTPTR_MAX | 738 | DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name) |
| 739 | # define DEFINE_LISP_SYMBOL_BEGIN(name) \ | 739 | #define DEFINE_LISP_SYMBOL_END(name) \ |
| 740 | DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name) | 740 | DEFINE_GDB_SYMBOL_END (LISP_INITIALLY (TAG_SYMOFFSET (i##name \ |
| 741 | # define DEFINE_LISP_SYMBOL_END(name) \ | 741 | * sizeof *lispsym))) |
| 742 | DEFINE_GDB_SYMBOL_END (LISP_INITIALLY (TAG_SYMPTR (name))) | ||
| 743 | #else | ||
| 744 | # define DEFINE_LISP_SYMBOL_BEGIN(name) /* empty */ | ||
| 745 | # define DEFINE_LISP_SYMBOL_END(name) /* empty */ | ||
| 746 | #endif | ||
| 747 | 742 | ||
| 748 | #include "globals.h" | 743 | #include "globals.h" |
| 749 | 744 | ||
| @@ -973,9 +968,9 @@ XSTRING (Lisp_Object a) | |||
| 973 | return XUNTAG (a, Lisp_String); | 968 | return XUNTAG (a, Lisp_String); |
| 974 | } | 969 | } |
| 975 | 970 | ||
| 976 | /* XSYMBOL_INIT (Qfoo) is like XSYMBOL (Qfoo), except it is valid in | 971 | /* The index of the C-defined Lisp symbol SYM. |
| 977 | static initializers, and SYM must be a C-defined symbol. */ | 972 | This can be used in a static initializer. */ |
| 978 | #define XSYMBOL_INIT(sym) a##sym | 973 | #define SYMBOL_INDEX(sym) i##sym |
| 979 | 974 | ||
| 980 | INLINE struct Lisp_Float * | 975 | INLINE struct Lisp_Float * |
| 981 | XFLOAT (Lisp_Object a) | 976 | XFLOAT (Lisp_Object a) |
| @@ -1054,12 +1049,18 @@ make_lisp_ptr (void *ptr, enum Lisp_Type type) | |||
| 1054 | INLINE Lisp_Object | 1049 | INLINE Lisp_Object |
| 1055 | make_lisp_symbol (struct Lisp_Symbol *sym) | 1050 | make_lisp_symbol (struct Lisp_Symbol *sym) |
| 1056 | { | 1051 | { |
| 1057 | Lisp_Object a = XIL (TAG_SYMPTR (sym)); | 1052 | Lisp_Object a = XIL (TAG_SYMOFFSET ((char *) sym - (char *) lispsym)); |
| 1058 | eassert (XSYMBOL (a) == sym); | 1053 | eassert (XSYMBOL (a) == sym); |
| 1059 | return a; | 1054 | return a; |
| 1060 | } | 1055 | } |
| 1061 | 1056 | ||
| 1062 | INLINE Lisp_Object | 1057 | INLINE Lisp_Object |
| 1058 | builtin_lisp_symbol (int index) | ||
| 1059 | { | ||
| 1060 | return make_lisp_symbol (lispsym + index); | ||
| 1061 | } | ||
| 1062 | |||
| 1063 | INLINE Lisp_Object | ||
| 1063 | make_lisp_proc (struct Lisp_Process *p) | 1064 | make_lisp_proc (struct Lisp_Process *p) |
| 1064 | { | 1065 | { |
| 1065 | return make_lisp_ptr (p, Lisp_Vectorlike); | 1066 | return make_lisp_ptr (p, Lisp_Vectorlike); |