aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorHelmut Eller2024-06-23 06:39:18 +0200
committerGerd Möllmann2024-06-23 18:21:53 +0200
commitf67228347920fefcad19874ddc737fc4972c2f1f (patch)
treee6279df58807b0a6f156c68a32870b4503e63ab7 /src/buffer.c
parent7100291e5c34f089627c658401db0715a537aaad (diff)
downloademacs-f67228347920fefcad19874ddc737fc4972c2f1f.tar.gz
emacs-f67228347920fefcad19874ddc737fc4972c2f1f.zip
Introduce a struct Lisp_Fwd
This contains the type and an union of Lisp_Objfwd, Lisp_Intfwd etc. lispfwd is now a pointer to a struct Lisp_Fwd; the fwdptr field is gone. * src/lisp.h (struct Lisp_Fwd): New. (Lisp_Intfwd, Lisp_Boolfwd, Lisp_Objfwd, Lisp_Buffer_Objfwd) (Lisp_Kboard_Objfwd): The type is in in Lisp_Fwd. (lispwfd): Is now a pointer to struct Lisp_Fwd. (SYMBOL_BLV, SET_SYMBOL_FWD, XFWDTYPE, BUFFER_OBJFWDP): Update accordingly. (defvar_lisp, defvar_lisp_nopro, defvar_bool, defvar_int) (defvar_kboard): These all take now a Lisp_Fwd. (DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT) (DEFVAR_KBOARD): Update for new types. * src/lread.c (defvar_int, defvar_bool, defvar_lisp_nopro) (defvar_lisp, defvar_kboard): Update for new types. * src/pdumper.c (dump_field_fwd, dump_blv): Update accordingly. * src/buffer.c (DEFVAR_PER_BUFFER, defvar_per_buffer, buffer_local_value) (set_buffer_internal_1): Update accordingly for new types. * src/data.c (XBOOLFWD, XKBOARD_OBJFWD, XFIXNUMFWD, XOBJFWD, boundp) (store_symval_forwarding, swap_in_global_binding) (swap_in_symval_forwarding, find_symbol_value, set_internal) (default_value, set_default_internal, make_blv, Fmake_local_variable): Update accordingly.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/buffer.c b/src/buffer.c
index d864560ec85..e55560b1cd9 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1366,7 +1366,7 @@ buffer_local_value (Lisp_Object variable, Lisp_Object buffer)
1366 result = assq_no_quit (variable, BVAR (buf, local_var_alist)); 1366 result = assq_no_quit (variable, BVAR (buf, local_var_alist));
1367 if (!NILP (result)) 1367 if (!NILP (result))
1368 { 1368 {
1369 if (blv->fwd.fwdptr) 1369 if (blv->fwd)
1370 { /* What binding is loaded right now? */ 1370 { /* What binding is loaded right now? */
1371 Lisp_Object current_alist_element = blv->valcell; 1371 Lisp_Object current_alist_element = blv->valcell;
1372 1372
@@ -2365,7 +2365,7 @@ void set_buffer_internal_2 (register struct buffer *b)
2365 Lisp_Object var = XCAR (XCAR (tail)); 2365 Lisp_Object var = XCAR (XCAR (tail));
2366 struct Lisp_Symbol *sym = XSYMBOL (var); 2366 struct Lisp_Symbol *sym = XSYMBOL (var);
2367 if (sym->u.s.redirect == SYMBOL_LOCALIZED /* Just to be sure. */ 2367 if (sym->u.s.redirect == SYMBOL_LOCALIZED /* Just to be sure. */
2368 && SYMBOL_BLV (sym)->fwd.fwdptr) 2368 && SYMBOL_BLV (sym)->fwd)
2369 /* Just reference the variable 2369 /* Just reference the variable
2370 to cause it to become set for this buffer. */ 2370 to cause it to become set for this buffer. */
2371 Fsymbol_value (var); 2371 Fsymbol_value (var);
@@ -5023,24 +5023,25 @@ do \
5023 { \ 5023 { \
5024 const Lisp_Object sym = TAG_PTR_INITIALLY ( \ 5024 const Lisp_Object sym = TAG_PTR_INITIALLY ( \
5025 Lisp_Symbol, (intptr_t)((i##predicate_) * sizeof *lispsym)); \ 5025 Lisp_Symbol, (intptr_t)((i##predicate_) * sizeof *lispsym)); \
5026 static const struct Lisp_Buffer_Objfwd bo_fwd = { \ 5026 static const struct Lisp_Fwd bo_fwd = { \
5027 .type = Lisp_Fwd_Buffer_Obj, \ 5027 .type = Lisp_Fwd_Buffer_Obj, \
5028 .offset = offsetof (struct buffer, vname##_), \ 5028 .u.bufobjfwd = { .offset = offsetof (struct buffer, vname##_), \
5029 .predicate = sym, \ 5029 .predicate = sym }, \
5030 }; \ 5030 }; \
5031 defvar_per_buffer (&bo_fwd, lname); \ 5031 defvar_per_buffer (&bo_fwd, lname); \
5032 } \ 5032 } \
5033while (0) 5033while (0)
5034 5034
5035static void 5035static void
5036defvar_per_buffer (const struct Lisp_Buffer_Objfwd *bo_fwd, 5036defvar_per_buffer (const struct Lisp_Fwd *fwd, const char *namestring)
5037 const char *namestring)
5038{ 5037{
5038 eassert (fwd->type == Lisp_Fwd_Buffer_Obj);
5039 const struct Lisp_Buffer_Objfwd *bo_fwd = XBUFFER_OBJFWD (fwd);
5039 struct Lisp_Symbol *sym = XSYMBOL (intern (namestring)); 5040 struct Lisp_Symbol *sym = XSYMBOL (intern (namestring));
5040 5041
5041 sym->u.s.declared_special = true; 5042 sym->u.s.declared_special = true;
5042 sym->u.s.redirect = SYMBOL_FORWARDED; 5043 sym->u.s.redirect = SYMBOL_FORWARDED;
5043 SET_SYMBOL_FWD (sym, bo_fwd); 5044 SET_SYMBOL_FWD (sym, fwd);
5044 XSETSYMBOL (PER_BUFFER_SYMBOL (bo_fwd->offset), sym); 5045 XSETSYMBOL (PER_BUFFER_SYMBOL (bo_fwd->offset), sym);
5045 5046
5046 if (PER_BUFFER_IDX (bo_fwd->offset) == 0) 5047 if (PER_BUFFER_IDX (bo_fwd->offset) == 0)