diff options
| author | Helmut Eller | 2024-06-23 06:39:18 +0200 |
|---|---|---|
| committer | Helmut Eller | 2026-02-12 18:51:50 +0100 |
| commit | 10befec978d1f1490f1eb43fd590e9474252063f (patch) | |
| tree | c575f002796f2177bf8cfdadaff78e4b75dbe5e3 /src/buffer.c | |
| parent | ba9a765081873a5caf5053e8b6203b00ef7324e0 (diff) | |
| download | emacs-10befec978d1f1490f1eb43fd590e9474252063f.tar.gz emacs-10befec978d1f1490f1eb43fd590e9474252063f.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 void *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.
(dump_fwd_int, dump_fwd_bool, dump_fwd_obj, dump_fwd_buffer_obj)
(dump_fwd): Deleted.
* 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.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/buffer.c b/src/buffer.c index 70ae2ba3d7b..9abce241897 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1379,7 +1379,7 @@ buffer_local_value (Lisp_Object variable, Lisp_Object buffer) | |||
| 1379 | result = assq_no_quit (variable, BVAR (buf, local_var_alist)); | 1379 | result = assq_no_quit (variable, BVAR (buf, local_var_alist)); |
| 1380 | if (!NILP (result)) | 1380 | if (!NILP (result)) |
| 1381 | { | 1381 | { |
| 1382 | if (blv->fwd.fwdptr) | 1382 | if (blv->fwd) |
| 1383 | { /* What binding is loaded right now? */ | 1383 | { /* What binding is loaded right now? */ |
| 1384 | Lisp_Object current_alist_element = blv->valcell; | 1384 | Lisp_Object current_alist_element = blv->valcell; |
| 1385 | 1385 | ||
| @@ -2380,7 +2380,7 @@ void set_buffer_internal_2 (register struct buffer *b) | |||
| 2380 | Lisp_Object var = XCAR (XCAR (tail)); | 2380 | Lisp_Object var = XCAR (XCAR (tail)); |
| 2381 | struct Lisp_Symbol *sym = XSYMBOL (var); | 2381 | struct Lisp_Symbol *sym = XSYMBOL (var); |
| 2382 | if (sym->u.s.redirect == SYMBOL_LOCALIZED /* Just to be sure. */ | 2382 | if (sym->u.s.redirect == SYMBOL_LOCALIZED /* Just to be sure. */ |
| 2383 | && SYMBOL_BLV (sym)->fwd.fwdptr) | 2383 | && SYMBOL_BLV (sym)->fwd) |
| 2384 | /* Just reference the variable | 2384 | /* Just reference the variable |
| 2385 | to cause it to become set for this buffer. */ | 2385 | to cause it to become set for this buffer. */ |
| 2386 | Fsymbol_value (var); | 2386 | Fsymbol_value (var); |
| @@ -4986,24 +4986,25 @@ do \ | |||
| 4986 | { \ | 4986 | { \ |
| 4987 | const Lisp_Object sym = TAG_PTR_INITIALLY ( \ | 4987 | const Lisp_Object sym = TAG_PTR_INITIALLY ( \ |
| 4988 | Lisp_Symbol, (intptr_t)((i##predicate_) * sizeof *lispsym)); \ | 4988 | Lisp_Symbol, (intptr_t)((i##predicate_) * sizeof *lispsym)); \ |
| 4989 | static const struct Lisp_Buffer_Objfwd bo_fwd = { \ | 4989 | static const struct Lisp_Fwd bo_fwd = { \ |
| 4990 | .type = Lisp_Fwd_Buffer_Obj, \ | 4990 | .type = Lisp_Fwd_Buffer_Obj, \ |
| 4991 | .offset = offsetof (struct buffer, vname##_), \ | 4991 | .u.bufobjfwd = { .offset = offsetof (struct buffer, vname##_), \ |
| 4992 | .predicate = sym, \ | 4992 | .predicate = sym }, \ |
| 4993 | }; \ | 4993 | }; \ |
| 4994 | defvar_per_buffer (&bo_fwd, lname); \ | 4994 | defvar_per_buffer (&bo_fwd, lname); \ |
| 4995 | } \ | 4995 | } \ |
| 4996 | while (0) | 4996 | while (0) |
| 4997 | 4997 | ||
| 4998 | static void | 4998 | static void |
| 4999 | defvar_per_buffer (const struct Lisp_Buffer_Objfwd *bo_fwd, | 4999 | defvar_per_buffer (const struct Lisp_Fwd *fwd, const char *namestring) |
| 5000 | const char *namestring) | ||
| 5001 | { | 5000 | { |
| 5001 | eassert (fwd->type == Lisp_Fwd_Buffer_Obj); | ||
| 5002 | const struct Lisp_Buffer_Objfwd *bo_fwd = XBUFFER_OBJFWD (fwd); | ||
| 5002 | struct Lisp_Symbol *sym = XSYMBOL (intern (namestring)); | 5003 | struct Lisp_Symbol *sym = XSYMBOL (intern (namestring)); |
| 5003 | 5004 | ||
| 5004 | sym->u.s.declared_special = true; | 5005 | sym->u.s.declared_special = true; |
| 5005 | sym->u.s.redirect = SYMBOL_FORWARDED; | 5006 | sym->u.s.redirect = SYMBOL_FORWARDED; |
| 5006 | SET_SYMBOL_FWD (sym, bo_fwd); | 5007 | SET_SYMBOL_FWD (sym, fwd); |
| 5007 | XSETSYMBOL (PER_BUFFER_SYMBOL (bo_fwd->offset), sym); | 5008 | XSETSYMBOL (PER_BUFFER_SYMBOL (bo_fwd->offset), sym); |
| 5008 | 5009 | ||
| 5009 | if (PER_BUFFER_IDX (bo_fwd->offset) == 0) | 5010 | if (PER_BUFFER_IDX (bo_fwd->offset) == 0) |