mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 09:14:18 +00:00
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.
This commit is contained in:
parent
ba9a765081
commit
10befec978
5 changed files with 96 additions and 162 deletions
17
src/buffer.c
17
src/buffer.c
|
|
@ -1379,7 +1379,7 @@ buffer_local_value (Lisp_Object variable, Lisp_Object buffer)
|
|||
result = assq_no_quit (variable, BVAR (buf, local_var_alist));
|
||||
if (!NILP (result))
|
||||
{
|
||||
if (blv->fwd.fwdptr)
|
||||
if (blv->fwd)
|
||||
{ /* What binding is loaded right now? */
|
||||
Lisp_Object current_alist_element = blv->valcell;
|
||||
|
||||
|
|
@ -2380,7 +2380,7 @@ void set_buffer_internal_2 (register struct buffer *b)
|
|||
Lisp_Object var = XCAR (XCAR (tail));
|
||||
struct Lisp_Symbol *sym = XSYMBOL (var);
|
||||
if (sym->u.s.redirect == SYMBOL_LOCALIZED /* Just to be sure. */
|
||||
&& SYMBOL_BLV (sym)->fwd.fwdptr)
|
||||
&& SYMBOL_BLV (sym)->fwd)
|
||||
/* Just reference the variable
|
||||
to cause it to become set for this buffer. */
|
||||
Fsymbol_value (var);
|
||||
|
|
@ -4986,24 +4986,25 @@ do \
|
|||
{ \
|
||||
const Lisp_Object sym = TAG_PTR_INITIALLY ( \
|
||||
Lisp_Symbol, (intptr_t)((i##predicate_) * sizeof *lispsym)); \
|
||||
static const struct Lisp_Buffer_Objfwd bo_fwd = { \
|
||||
static const struct Lisp_Fwd bo_fwd = { \
|
||||
.type = Lisp_Fwd_Buffer_Obj, \
|
||||
.offset = offsetof (struct buffer, vname##_), \
|
||||
.predicate = sym, \
|
||||
.u.bufobjfwd = { .offset = offsetof (struct buffer, vname##_), \
|
||||
.predicate = sym }, \
|
||||
}; \
|
||||
defvar_per_buffer (&bo_fwd, lname); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
static void
|
||||
defvar_per_buffer (const struct Lisp_Buffer_Objfwd *bo_fwd,
|
||||
const char *namestring)
|
||||
defvar_per_buffer (const struct Lisp_Fwd *fwd, const char *namestring)
|
||||
{
|
||||
eassert (fwd->type == Lisp_Fwd_Buffer_Obj);
|
||||
const struct Lisp_Buffer_Objfwd *bo_fwd = XBUFFER_OBJFWD (fwd);
|
||||
struct Lisp_Symbol *sym = XSYMBOL (intern (namestring));
|
||||
|
||||
sym->u.s.declared_special = true;
|
||||
sym->u.s.redirect = SYMBOL_FORWARDED;
|
||||
SET_SYMBOL_FWD (sym, bo_fwd);
|
||||
SET_SYMBOL_FWD (sym, fwd);
|
||||
XSETSYMBOL (PER_BUFFER_SYMBOL (bo_fwd->offset), sym);
|
||||
|
||||
if (PER_BUFFER_IDX (bo_fwd->offset) == 0)
|
||||
|
|
|
|||
39
src/data.c
39
src/data.c
|
|
@ -57,25 +57,25 @@ static struct Lisp_Boolfwd const *
|
|||
XBOOLFWD (lispfwd a)
|
||||
{
|
||||
eassert (BOOLFWDP (a));
|
||||
return a.fwdptr;
|
||||
return &a->u.boolfwd;
|
||||
}
|
||||
static struct Lisp_Kboard_Objfwd const *
|
||||
XKBOARD_OBJFWD (lispfwd a)
|
||||
{
|
||||
eassert (KBOARD_OBJFWDP (a));
|
||||
return a.fwdptr;
|
||||
return &a->u.kboardobjfwd;
|
||||
}
|
||||
static struct Lisp_Intfwd const *
|
||||
XFIXNUMFWD (lispfwd a)
|
||||
{
|
||||
eassert (INTFWDP (a));
|
||||
return a.fwdptr;
|
||||
return &a->u.intfwd;
|
||||
}
|
||||
static struct Lisp_Objfwd const *
|
||||
XOBJFWD (lispfwd a)
|
||||
{
|
||||
eassert (OBJFWDP (a));
|
||||
return a.fwdptr;
|
||||
return &a->u.objfwd;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -731,7 +731,7 @@ global value outside of any lexical scope. */)
|
|||
case SYMBOL_LOCALIZED:
|
||||
{
|
||||
struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
|
||||
if (blv->fwd.fwdptr)
|
||||
if (blv->fwd)
|
||||
/* In set_internal, we un-forward vars when their value is
|
||||
set to Qunbound. */
|
||||
return Qt;
|
||||
|
|
@ -1457,8 +1457,9 @@ store_symval_forwarding (lispfwd valcontents, Lisp_Object newval,
|
|||
|
||||
case Lisp_Fwd_Buffer_Obj:
|
||||
{
|
||||
int offset = XBUFFER_OBJFWD (valcontents)->offset;
|
||||
Lisp_Object predicate = XBUFFER_OBJFWD (valcontents)->predicate;
|
||||
const struct Lisp_Buffer_Objfwd *fwd = XBUFFER_OBJFWD (valcontents);
|
||||
int offset = fwd->offset;
|
||||
Lisp_Object predicate = fwd->predicate;
|
||||
|
||||
if (!NILP (newval) && !NILP (predicate))
|
||||
{
|
||||
|
|
@ -1516,12 +1517,12 @@ swap_in_global_binding (struct Lisp_Symbol *symbol)
|
|||
struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (symbol);
|
||||
|
||||
/* Unload the previously loaded binding. */
|
||||
if (blv->fwd.fwdptr)
|
||||
if (blv->fwd)
|
||||
set_blv_value (blv, do_symval_forwarding (blv->fwd));
|
||||
|
||||
/* Select the global binding in the symbol. */
|
||||
set_blv_valcell (blv, blv->defcell);
|
||||
if (blv->fwd.fwdptr)
|
||||
if (blv->fwd)
|
||||
store_symval_forwarding (blv->fwd, XCDR (blv->defcell), NULL);
|
||||
|
||||
/* Indicate that the global binding is set up now. */
|
||||
|
|
@ -1551,7 +1552,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
|
|||
|
||||
/* Unload the previously loaded binding. */
|
||||
tem1 = blv->valcell;
|
||||
if (blv->fwd.fwdptr)
|
||||
if (blv->fwd)
|
||||
set_blv_value (blv, do_symval_forwarding (blv->fwd));
|
||||
/* Choose the new binding. */
|
||||
{
|
||||
|
|
@ -1565,7 +1566,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
|
|||
|
||||
/* Load the new binding. */
|
||||
set_blv_valcell (blv, tem1);
|
||||
if (blv->fwd.fwdptr)
|
||||
if (blv->fwd)
|
||||
store_symval_forwarding (blv->fwd, blv_value (blv), NULL);
|
||||
}
|
||||
}
|
||||
|
|
@ -1598,7 +1599,7 @@ find_symbol_value (Lisp_Object symbol)
|
|||
{
|
||||
struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
|
||||
swap_in_symval_forwarding (sym, blv);
|
||||
return (blv->fwd.fwdptr
|
||||
return (blv->fwd
|
||||
? do_symval_forwarding (blv->fwd)
|
||||
: blv_value (blv));
|
||||
}
|
||||
|
|
@ -1688,7 +1689,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
|
|||
{
|
||||
struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
|
||||
|
||||
if (unbinding_p && blv->fwd.fwdptr)
|
||||
if (unbinding_p && blv->fwd)
|
||||
/* Forbid unbinding built-in variables. */
|
||||
error ("Built-in variables may not be unbound");
|
||||
|
||||
|
|
@ -1707,7 +1708,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
|
|||
We need to unload it, and choose a new binding. */
|
||||
|
||||
/* Write out `realvalue' to the old loaded binding. */
|
||||
if (blv->fwd.fwdptr)
|
||||
if (blv->fwd)
|
||||
set_blv_value (blv, do_symval_forwarding (blv->fwd));
|
||||
|
||||
/* Find the new binding. */
|
||||
|
|
@ -1755,7 +1756,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
|
|||
/* Store the new value in the cons cell. */
|
||||
set_blv_value (blv, newval);
|
||||
|
||||
if (blv->fwd.fwdptr)
|
||||
if (blv->fwd)
|
||||
store_symval_forwarding (blv->fwd, newval, (BUFFERP (where)
|
||||
? XBUFFER (where)
|
||||
: current_buffer));
|
||||
|
|
@ -1942,7 +1943,7 @@ default_value (Lisp_Object symbol)
|
|||
But the `realvalue' slot may be more up to date, since
|
||||
ordinary setq stores just that slot. So use that. */
|
||||
struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
|
||||
if (blv->fwd.fwdptr && BASE_EQ (blv->valcell, blv->defcell))
|
||||
if (blv->fwd && BASE_EQ (blv->valcell, blv->defcell))
|
||||
return do_symval_forwarding (blv->fwd);
|
||||
else
|
||||
return XCDR (blv->defcell);
|
||||
|
|
@ -2037,7 +2038,7 @@ set_default_internal (Lisp_Object symbol, Lisp_Object value,
|
|||
XSETCDR (blv->defcell, value);
|
||||
|
||||
/* If the default binding is now loaded, set the REALVALUE slot too. */
|
||||
if (blv->fwd.fwdptr && BASE_EQ (blv->defcell, blv->valcell))
|
||||
if (blv->fwd && BASE_EQ (blv->defcell, blv->valcell))
|
||||
store_symval_forwarding (blv->fwd, value, NULL);
|
||||
return;
|
||||
}
|
||||
|
|
@ -2129,7 +2130,7 @@ make_blv (struct Lisp_Symbol *sym, bool forwarded,
|
|||
if (forwarded)
|
||||
blv->fwd = valcontents.fwd;
|
||||
else
|
||||
blv->fwd.fwdptr = NULL;
|
||||
blv->fwd = NULL;
|
||||
set_blv_where (blv, Qnil);
|
||||
blv->local_if_set = 0;
|
||||
set_blv_defcell (blv, tem);
|
||||
|
|
@ -2304,7 +2305,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
|
|||
Otherwise, if C code modifies the variable before we load the
|
||||
binding in, then that new value would clobber the default binding
|
||||
the next time we unload it. See bug#34318. */
|
||||
if (blv->fwd.fwdptr)
|
||||
if (blv->fwd)
|
||||
swap_in_symval_forwarding (sym, blv);
|
||||
}
|
||||
|
||||
|
|
|
|||
94
src/lisp.h
94
src/lisp.h
|
|
@ -757,7 +757,7 @@ INLINE void
|
|||
union of the possible values (struct Lisp_Objfwd, struct
|
||||
Lisp_Intfwd, etc.). The pointer is packaged inside a struct to
|
||||
help static checking. */
|
||||
typedef struct { void const *fwdptr; } lispfwd;
|
||||
typedef const struct Lisp_Fwd *lispfwd;
|
||||
|
||||
/* Interned state of a symbol. */
|
||||
|
||||
|
|
@ -2317,7 +2317,7 @@ SYMBOL_BLV (struct Lisp_Symbol *sym)
|
|||
INLINE lispfwd
|
||||
SYMBOL_FWD (struct Lisp_Symbol *sym)
|
||||
{
|
||||
eassume (sym->u.s.redirect == SYMBOL_FORWARDED && sym->u.s.val.fwd.fwdptr);
|
||||
eassume (sym->u.s.redirect == SYMBOL_FORWARDED && sym->u.s.val.fwd);
|
||||
return sym->u.s.val.fwd;
|
||||
}
|
||||
|
||||
|
|
@ -2341,10 +2341,10 @@ SET_SYMBOL_BLV (struct Lisp_Symbol *sym, struct Lisp_Buffer_Local_Value *v)
|
|||
sym->u.s.val.blv = v;
|
||||
}
|
||||
INLINE void
|
||||
SET_SYMBOL_FWD (struct Lisp_Symbol *sym, void const *v)
|
||||
SET_SYMBOL_FWD (struct Lisp_Symbol *sym, lispfwd fwd)
|
||||
{
|
||||
eassume (sym->u.s.redirect == SYMBOL_FORWARDED && v);
|
||||
sym->u.s.val.fwd.fwdptr = v;
|
||||
eassume (sym->u.s.redirect == SYMBOL_FORWARDED && fwd);
|
||||
sym->u.s.val.fwd = fwd;
|
||||
}
|
||||
|
||||
INLINE Lisp_Object
|
||||
|
|
@ -3059,7 +3059,6 @@ make_uint (uintmax_t n)
|
|||
specified int variable. */
|
||||
struct Lisp_Intfwd
|
||||
{
|
||||
enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Int */
|
||||
intmax_t *intvar;
|
||||
};
|
||||
|
||||
|
|
@ -3069,7 +3068,6 @@ struct Lisp_Intfwd
|
|||
nil if it is false. */
|
||||
struct Lisp_Boolfwd
|
||||
{
|
||||
enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Bool */
|
||||
bool *boolvar;
|
||||
};
|
||||
|
||||
|
|
@ -3079,7 +3077,6 @@ struct Lisp_Boolfwd
|
|||
specified variable. */
|
||||
struct Lisp_Objfwd
|
||||
{
|
||||
enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Obj */
|
||||
Lisp_Object *objvar;
|
||||
};
|
||||
|
||||
|
|
@ -3087,7 +3084,6 @@ struct Lisp_Objfwd
|
|||
current buffer. Value is byte index of slot within buffer. */
|
||||
struct Lisp_Buffer_Objfwd
|
||||
{
|
||||
enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Buffer_Obj */
|
||||
int offset;
|
||||
/* One of Qnil, Qintegerp, Qsymbolp, Qstringp, Qfloatp or Qnumberp. */
|
||||
Lisp_Object predicate;
|
||||
|
|
@ -3140,15 +3136,26 @@ struct Lisp_Buffer_Local_Value
|
|||
current kboard. */
|
||||
struct Lisp_Kboard_Objfwd
|
||||
{
|
||||
enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Kboard_Obj */
|
||||
int offset;
|
||||
};
|
||||
|
||||
struct Lisp_Fwd
|
||||
{
|
||||
enum Lisp_Fwd_Type type;
|
||||
union
|
||||
{
|
||||
struct Lisp_Intfwd intfwd;
|
||||
struct Lisp_Boolfwd boolfwd;
|
||||
struct Lisp_Objfwd objfwd;
|
||||
struct Lisp_Buffer_Objfwd bufobjfwd;
|
||||
struct Lisp_Kboard_Objfwd kboardobjfwd;
|
||||
} u;
|
||||
};
|
||||
|
||||
INLINE enum Lisp_Fwd_Type
|
||||
XFWDTYPE (lispfwd a)
|
||||
{
|
||||
enum Lisp_Fwd_Type const *p = a.fwdptr;
|
||||
return *p;
|
||||
return a->type;
|
||||
}
|
||||
|
||||
INLINE bool
|
||||
|
|
@ -3161,7 +3168,7 @@ INLINE struct Lisp_Buffer_Objfwd const *
|
|||
XBUFFER_OBJFWD (lispfwd a)
|
||||
{
|
||||
eassert (BUFFER_OBJFWDP (a));
|
||||
return a.fwdptr;
|
||||
return &a->u.bufobjfwd;
|
||||
}
|
||||
|
||||
INLINE bool
|
||||
|
|
@ -3482,11 +3489,11 @@ call0 (Lisp_Object fn)
|
|||
return calln (fn);
|
||||
}
|
||||
|
||||
extern void defvar_lisp (struct Lisp_Objfwd const *, char const *);
|
||||
extern void defvar_lisp_nopro (struct Lisp_Objfwd const *, char const *);
|
||||
extern void defvar_bool (struct Lisp_Boolfwd const *, char const *);
|
||||
extern void defvar_int (struct Lisp_Intfwd const *, char const *);
|
||||
extern void defvar_kboard (struct Lisp_Kboard_Objfwd const *, char const *);
|
||||
extern void defvar_lisp (struct Lisp_Fwd const *, char const *);
|
||||
extern void defvar_lisp_nopro (struct Lisp_Fwd const *, char const *);
|
||||
extern void defvar_bool (struct Lisp_Fwd const *, char const *);
|
||||
extern void defvar_int (struct Lisp_Fwd const *, char const *);
|
||||
extern void defvar_kboard (struct Lisp_Fwd const *, char const *);
|
||||
|
||||
/* Macros we use to define forwarded Lisp variables.
|
||||
These are used in the syms_of_FILENAME functions.
|
||||
|
|
@ -3505,37 +3512,40 @@ extern void defvar_kboard (struct Lisp_Kboard_Objfwd const *, char const *);
|
|||
All C code uses the `cons_cells_consed' name. This is all done
|
||||
this way to support indirection for multi-threaded Emacs. */
|
||||
|
||||
#define DEFVAR_LISP(lname, vname, doc) \
|
||||
do { \
|
||||
static struct Lisp_Objfwd const o_fwd \
|
||||
= {Lisp_Fwd_Obj, &globals.f_##vname}; \
|
||||
defvar_lisp (&o_fwd, lname); \
|
||||
#define DEFVAR_LISP(lname, vname, doc) \
|
||||
do { \
|
||||
static struct Lisp_Fwd const o_fwd \
|
||||
= {Lisp_Fwd_Obj, .u.objfwd = {&globals.f_##vname}}; \
|
||||
defvar_lisp (&o_fwd, lname); \
|
||||
} while (false)
|
||||
#define DEFVAR_LISP_NOPRO(lname, vname, doc) \
|
||||
do { \
|
||||
static struct Lisp_Objfwd const o_fwd \
|
||||
= {Lisp_Fwd_Obj, &globals.f_##vname}; \
|
||||
defvar_lisp_nopro (&o_fwd, lname); \
|
||||
#define DEFVAR_LISP_NOPRO(lname, vname, doc) \
|
||||
do { \
|
||||
static struct Lisp_Fwd const o_fwd \
|
||||
= {Lisp_Fwd_Obj, .u.objfwd = {&globals.f_##vname}}; \
|
||||
defvar_lisp_nopro (&o_fwd, lname); \
|
||||
} while (false)
|
||||
#define DEFVAR_BOOL(lname, vname, doc) \
|
||||
do { \
|
||||
static struct Lisp_Boolfwd const b_fwd \
|
||||
= {Lisp_Fwd_Bool, &globals.f_##vname}; \
|
||||
defvar_bool (&b_fwd, lname); \
|
||||
#define DEFVAR_BOOL(lname, vname, doc) \
|
||||
do { \
|
||||
static struct Lisp_Fwd const b_fwd \
|
||||
= {Lisp_Fwd_Bool, .u.boolfwd = {&globals.f_##vname}}; \
|
||||
defvar_bool (&b_fwd, lname); \
|
||||
} while (false)
|
||||
#define DEFVAR_INT(lname, vname, doc) \
|
||||
do { \
|
||||
static struct Lisp_Intfwd const i_fwd \
|
||||
= {Lisp_Fwd_Int, &globals.f_##vname}; \
|
||||
defvar_int (&i_fwd, lname); \
|
||||
#define DEFVAR_INT(lname, vname, doc) \
|
||||
do { \
|
||||
static struct Lisp_Fwd const i_fwd \
|
||||
= {Lisp_Fwd_Int, .u.intfwd = {&globals.f_##vname}}; \
|
||||
defvar_int (&i_fwd, lname); \
|
||||
} while (false)
|
||||
|
||||
#define DEFVAR_KBOARD(lname, vname, doc) \
|
||||
do { \
|
||||
static struct Lisp_Kboard_Objfwd const ko_fwd \
|
||||
= {Lisp_Fwd_Kboard_Obj, offsetof (KBOARD, vname##_)}; \
|
||||
do \
|
||||
{ \
|
||||
static struct Lisp_Fwd const ko_fwd \
|
||||
= { Lisp_Fwd_Kboard_Obj, \
|
||||
.u.kboardobjfwd = {offsetof (KBOARD, vname##_)}}; \
|
||||
defvar_kboard (&ko_fwd, lname); \
|
||||
} while (false)
|
||||
} \
|
||||
while (false)
|
||||
|
||||
|
||||
/* Elisp uses multiple stacks:
|
||||
|
|
|
|||
17
src/lread.c
17
src/lread.c
|
|
@ -5241,8 +5241,9 @@ defsubr (union Aligned_Lisp_Subr *aname)
|
|||
C variable of type intmax_t. Sample call (with "xx" to fool make-docfile):
|
||||
DEFxxVAR_INT ("emacs-priority", &emacs_priority, "Documentation"); */
|
||||
void
|
||||
defvar_int (struct Lisp_Intfwd const *i_fwd, char const *namestring)
|
||||
defvar_int (struct Lisp_Fwd const *i_fwd, char const *namestring)
|
||||
{
|
||||
eassert (i_fwd->type == Lisp_Fwd_Int);
|
||||
Lisp_Object sym = intern_c_string (namestring);
|
||||
XBARE_SYMBOL (sym)->u.s.declared_special = true;
|
||||
XBARE_SYMBOL (sym)->u.s.redirect = SYMBOL_FORWARDED;
|
||||
|
|
@ -5251,8 +5252,9 @@ defvar_int (struct Lisp_Intfwd const *i_fwd, char const *namestring)
|
|||
|
||||
/* Similar but define a variable whose value is t if 1, nil if 0. */
|
||||
void
|
||||
defvar_bool (struct Lisp_Boolfwd const *b_fwd, char const *namestring)
|
||||
defvar_bool (struct Lisp_Fwd const *b_fwd, char const *namestring)
|
||||
{
|
||||
eassert (b_fwd->type == Lisp_Fwd_Bool);
|
||||
Lisp_Object sym = intern_c_string (namestring);
|
||||
XBARE_SYMBOL (sym)->u.s.declared_special = true;
|
||||
XBARE_SYMBOL (sym)->u.s.redirect = SYMBOL_FORWARDED;
|
||||
|
|
@ -5266,8 +5268,9 @@ defvar_bool (struct Lisp_Boolfwd const *b_fwd, char const *namestring)
|
|||
gc-marked for some other reason, since marking the same slot twice
|
||||
can cause trouble with strings. */
|
||||
void
|
||||
defvar_lisp_nopro (struct Lisp_Objfwd const *o_fwd, char const *namestring)
|
||||
defvar_lisp_nopro (struct Lisp_Fwd const *o_fwd, char const *namestring)
|
||||
{
|
||||
eassert (o_fwd->type == Lisp_Fwd_Obj);
|
||||
Lisp_Object sym = intern_c_string (namestring);
|
||||
XBARE_SYMBOL (sym)->u.s.declared_special = true;
|
||||
XBARE_SYMBOL (sym)->u.s.redirect = SYMBOL_FORWARDED;
|
||||
|
|
@ -5275,18 +5278,20 @@ defvar_lisp_nopro (struct Lisp_Objfwd const *o_fwd, char const *namestring)
|
|||
}
|
||||
|
||||
void
|
||||
defvar_lisp (struct Lisp_Objfwd const *o_fwd, char const *namestring)
|
||||
defvar_lisp (struct Lisp_Fwd const *o_fwd, char const *namestring)
|
||||
{
|
||||
eassert (o_fwd->type == Lisp_Fwd_Obj);
|
||||
defvar_lisp_nopro (o_fwd, namestring);
|
||||
staticpro (o_fwd->objvar);
|
||||
staticpro (o_fwd->u.objfwd.objvar);
|
||||
}
|
||||
|
||||
/* Similar but define a variable whose value is the Lisp Object stored
|
||||
at a particular offset in the current kboard object. */
|
||||
|
||||
void
|
||||
defvar_kboard (struct Lisp_Kboard_Objfwd const *ko_fwd, char const *namestring)
|
||||
defvar_kboard (struct Lisp_Fwd const *ko_fwd, char const *namestring)
|
||||
{
|
||||
eassert (ko_fwd->type == Lisp_Fwd_Kboard_Obj);
|
||||
Lisp_Object sym = intern_c_string (namestring);
|
||||
XBARE_SYMBOL (sym)->u.s.declared_special = true;
|
||||
XBARE_SYMBOL (sym)->u.s.redirect = SYMBOL_FORWARDED;
|
||||
|
|
|
|||
|
|
@ -2300,89 +2300,6 @@ dump_float (struct dump_context *ctx, const struct Lisp_Float *lfloat)
|
|||
return dump_object_finish (ctx, &out, sizeof (out));
|
||||
}
|
||||
|
||||
static void
|
||||
dump_fwd_int (struct dump_context *ctx, const struct Lisp_Intfwd *intfwd)
|
||||
{
|
||||
#if CHECK_STRUCTS && !defined HASH_Lisp_Intfwd_4D887A7387
|
||||
# error "Lisp_Intfwd changed. See CHECK_STRUCTS comment in config.h."
|
||||
#endif
|
||||
dump_emacs_reloc_immediate_intmax_t (ctx, intfwd->intvar, *intfwd->intvar);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_fwd_bool (struct dump_context *ctx, const struct Lisp_Boolfwd *boolfwd)
|
||||
{
|
||||
#if CHECK_STRUCTS && !defined (HASH_Lisp_Boolfwd_0EA1C7ADCC)
|
||||
# error "Lisp_Boolfwd changed. See CHECK_STRUCTS comment in config.h."
|
||||
#endif
|
||||
dump_emacs_reloc_immediate_bool (ctx, boolfwd->boolvar, *boolfwd->boolvar);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_fwd_obj (struct dump_context *ctx, const struct Lisp_Objfwd *objfwd)
|
||||
{
|
||||
#if CHECK_STRUCTS && !defined (HASH_Lisp_Objfwd_45D3E513DC)
|
||||
# error "Lisp_Objfwd changed. See CHECK_STRUCTS comment in config.h."
|
||||
#endif
|
||||
if (NILP (Fgethash (dump_off_to_lisp (emacs_offset (objfwd->objvar)),
|
||||
ctx->staticpro_table,
|
||||
Qnil)))
|
||||
dump_emacs_reloc_to_lv (ctx, objfwd->objvar, *objfwd->objvar);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_fwd_buffer_obj (struct dump_context *ctx,
|
||||
const struct Lisp_Buffer_Objfwd *buffer_objfwd)
|
||||
{
|
||||
#if CHECK_STRUCTS && !defined (HASH_Lisp_Buffer_Objfwd_611EBD13FF)
|
||||
# error "Lisp_Buffer_Objfwd changed. See CHECK_STRUCTS comment in config.h."
|
||||
#endif
|
||||
struct Lisp_Buffer_Objfwd out;
|
||||
dump_off off;
|
||||
|
||||
dump_object_start (ctx, &out, sizeof (out));
|
||||
DUMP_FIELD_COPY (&out, buffer_objfwd, type);
|
||||
DUMP_FIELD_COPY (&out, buffer_objfwd, offset);
|
||||
dump_field_lv (ctx, &out, buffer_objfwd, &buffer_objfwd->predicate,
|
||||
WEIGHT_NORMAL);
|
||||
off = dump_object_finish (ctx, &out, sizeof out);
|
||||
|
||||
/* Copy this fwd from the dump to the buffer fwd in Emacs. */
|
||||
dump_emacs_reloc_copy_from_dump (ctx, off, (void *) buffer_objfwd,
|
||||
sizeof out);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_fwd (struct dump_context *ctx, lispfwd fwd)
|
||||
{
|
||||
#if CHECK_STRUCTS && !defined (HASH_Lisp_Fwd_Type_9CBA6EE55E)
|
||||
# error "Lisp_Fwd_Type changed. See CHECK_STRUCTS comment in config.h."
|
||||
#endif
|
||||
void const *p = fwd.fwdptr;
|
||||
|
||||
switch (XFWDTYPE (fwd))
|
||||
{
|
||||
case Lisp_Fwd_Int:
|
||||
dump_fwd_int (ctx, p);
|
||||
break;
|
||||
case Lisp_Fwd_Bool:
|
||||
dump_fwd_bool (ctx, p);
|
||||
break;
|
||||
case Lisp_Fwd_Obj:
|
||||
dump_fwd_obj (ctx, p);
|
||||
break;
|
||||
case Lisp_Fwd_Buffer_Obj:
|
||||
dump_fwd_buffer_obj (ctx, p);
|
||||
break;
|
||||
/* The default kboard's contents are not meant to appear in the
|
||||
dump file. */
|
||||
case Lisp_Fwd_Kboard_Obj:
|
||||
break;
|
||||
default:
|
||||
emacs_abort ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dump_field_fwd (struct dump_context *ctx, void *out, const void *in_start,
|
||||
const lispfwd *in_field)
|
||||
|
|
@ -2392,19 +2309,19 @@ dump_field_fwd (struct dump_context *ctx, void *out, const void *in_start,
|
|||
{
|
||||
case Lisp_Fwd_Int:
|
||||
{
|
||||
const struct Lisp_Intfwd *fwd = in_field->fwdptr;
|
||||
const struct Lisp_Intfwd *fwd = &(*in_field)->u.intfwd;
|
||||
dump_emacs_reloc_immediate_intmax_t (ctx, fwd->intvar, *fwd->intvar);
|
||||
}
|
||||
return;
|
||||
case Lisp_Fwd_Bool:
|
||||
{
|
||||
const struct Lisp_Boolfwd *fwd = in_field->fwdptr;
|
||||
const struct Lisp_Boolfwd *fwd = &(*in_field)->u.boolfwd;
|
||||
dump_emacs_reloc_immediate_bool (ctx, fwd->boolvar, *fwd->boolvar);
|
||||
}
|
||||
return;
|
||||
case Lisp_Fwd_Obj:
|
||||
{
|
||||
const struct Lisp_Objfwd *fwd = in_field->fwdptr;
|
||||
const struct Lisp_Objfwd *fwd = &(*in_field)->u.objfwd;
|
||||
if (NILP (Fgethash (dump_off_to_lisp (emacs_offset (fwd->objvar)),
|
||||
ctx->staticpro_table, Qnil)))
|
||||
dump_emacs_reloc_to_lv (ctx, fwd->objvar, *fwd->objvar);
|
||||
|
|
@ -2428,7 +2345,7 @@ dump_blv (struct dump_context *ctx,
|
|||
dump_object_start (ctx, &out, sizeof (out));
|
||||
DUMP_FIELD_COPY (&out, blv, local_if_set);
|
||||
DUMP_FIELD_COPY (&out, blv, found);
|
||||
if (blv->fwd.fwdptr)
|
||||
if (blv->fwd)
|
||||
{
|
||||
eassert (XFWDTYPE (blv->fwd) != Lisp_Fwd_Buffer_Obj);
|
||||
dump_field_fwd (ctx, &out, blv, &blv->fwd);
|
||||
|
|
|
|||
Loading…
Reference in a new issue