internal_hash (s->buffer_specs, depth + 1));
}
+inline static size_t
+aligned_sizeof_specifier (size_t specifier_type_specific_size)
+{
+ return ALIGN_SIZE (offsetof (Lisp_Specifier, data)
+ + specifier_type_specific_size,
+ ALIGNOF (max_align_t));
+}
+
static size_t
sizeof_specifier (const void *header)
{
- if (GHOST_SPECIFIER_P ((Lisp_Specifier *) header))
- return offsetof (Lisp_Specifier, data);
- else
- {
- const Lisp_Specifier *p = (const Lisp_Specifier *) header;
- return offsetof (Lisp_Specifier, data) + p->methods->extra_data_size;
- }
+ const Lisp_Specifier *p = (const Lisp_Specifier *) header;
+ return aligned_sizeof_specifier (GHOST_SPECIFIER_P (p)
+ ? 0
+ : p->methods->extra_data_size);
}
static const struct lrecord_description specifier_methods_description_1[] = {
{
Lisp_Object specifier;
Lisp_Specifier *sp = (Lisp_Specifier *)
- alloc_lcrecord (offsetof (Lisp_Specifier, data) + data_size,
- &lrecord_specifier);
+ alloc_lcrecord (aligned_sizeof_specifier (data_size), &lrecord_specifier);
sp->methods = spec_meths;
sp->global_specs = Qnil;
retrieved in a specific domain (window, frame, device) by looking
through the possible instantiators (i.e. settings). This process is
called \"instantiation\".
-
+
To put settings into a specifier, use `set-specifier', or the
lower-level functions `add-spec-to-specifier' and
`add-spec-list-to-specifier'. You can also temporarily bind a setting
}
DEFUN ("add-spec-list-to-specifier", Fadd_spec_list_to_specifier, 2, 3, 0, /*
-Add a spec-list (a list of specifications) to SPECIFIER.
-The format of a spec-list is
+Add SPEC-LIST (a list of specifications) to SPECIFIER.
+The format of SPEC-LIST is
((LOCALE (TAG-SET . INSTANTIATOR) ...) ...)
Lisp_Object window = Qnil;
Lisp_Object frame = Qnil;
Lisp_Object device = Qnil;
- Lisp_Object tag = Qnil;
- struct device *d;
- Lisp_Specifier *sp;
-
- sp = XSPECIFIER (specifier);
+ Lisp_Object tag = Qnil; /* #### currently unused */
+ Lisp_Specifier *sp = XSPECIFIER (specifier);
/* Attempt to determine buffer, window, frame, and device from the
domain. */
abort ();
if (NILP (buffer) && !NILP (window))
- buffer = XWINDOW (window)->buffer;
+ buffer = WINDOW_BUFFER (XWINDOW (window));
if (NILP (frame) && !NILP (window))
frame = XWINDOW (window)->frame;
if (NILP (device))
/* frame had better exist; if device is undeterminable, something
really went wrong. */
- device = XFRAME (frame)->device;
+ device = FRAME_DEVICE (XFRAME (frame));
/* device had better be determined by now; abort if not. */
- d = XDEVICE (device);
- tag = DEVICE_CLASS (d);
+ tag = DEVICE_CLASS (XDEVICE (device));
depth = make_int (1 + XINT (depth));
if (XINT (depth) > 20)
int struct_frame_offset,
void (*value_changed_in_frame)
(Lisp_Object specifier, struct frame *f,
- Lisp_Object oldval))
+ Lisp_Object oldval),
+ int always_recompute)
{
Lisp_Specifier *sp = XSPECIFIER (specifier);
assert (!GHOST_SPECIFIER_P (sp));
sp->caching->value_changed_in_window = value_changed_in_window;
sp->caching->offset_into_struct_frame = struct_frame_offset;
sp->caching->value_changed_in_frame = value_changed_in_frame;
+ sp->caching->always_recompute = always_recompute;
Vcached_specifiers = Fcons (specifier, Vcached_specifiers);
if (BODILY_SPECIFIER_P (sp))
GHOST_SPECIFIER(sp)->caching = sp->caching;
struct window *w)
{
Lisp_Object window;
- Lisp_Object newval, *location;
+ Lisp_Object newval, *location, oldval;
assert (!GHOST_SPECIFIER_P (XSPECIFIER (specifier)));
calling equal is no good either as this doesn't take into account
things attached to the specifier - for instance strings on
extents. --andyp */
- if (!EQ (newval, *location))
+ if (!EQ (newval, *location) || XSPECIFIER (specifier)->caching->always_recompute)
{
- Lisp_Object oldval = *location;
+ oldval = *location;
*location = newval;
(XSPECIFIER (specifier)->caching->value_changed_in_window)
(specifier, w, oldval);
struct frame *f)
{
Lisp_Object frame;
- Lisp_Object newval, *location;
+ Lisp_Object newval, *location, oldval;
assert (!GHOST_SPECIFIER_P (XSPECIFIER (specifier)));
method. */
location = (Lisp_Object *)
((char *) f + XSPECIFIER (specifier)->caching->offset_into_struct_frame);
- if (!EQ (newval, *location))
+ if (!EQ (newval, *location) || XSPECIFIER (specifier)->caching->always_recompute)
{
- Lisp_Object oldval = *location;
+ oldval = *location;
*location = newval;
(XSPECIFIER (specifier)->caching->value_changed_in_frame)
(specifier, f, oldval);
specifier_type_create (void)
{
the_specifier_type_entry_dynarr = Dynarr_new (specifier_type_entry);
- dumpstruct (&the_specifier_type_entry_dynarr, &sted_description);
+ dump_add_root_struct_ptr (&the_specifier_type_entry_dynarr, &sted_description);
Vspecifier_type_list = Qnil;
staticpro (&Vspecifier_type_list);
/* Do NOT mark through this, or specifiers will never be GC'd.
This is the same deal as for weak hash tables. */
Vall_specifiers = Qnil;
- pdump_wire_list (&Vall_specifiers);
+ dump_add_weak_object_chain (&Vall_specifiers);
Vuser_defined_tags = Qnil;
staticpro (&Vuser_defined_tags);