#include "rangetab.h"
Lisp_Object Qspecifierp;
-Lisp_Object Qprepend, Qappend, Qremove_tag_set_prepend, Qremove_tag_set_append;
+Lisp_Object Qprepend, Qremove_tag_set_prepend, Qremove_tag_set_append;
Lisp_Object Qremove_locale, Qremove_locale_type, Qremove_all;
Lisp_Object Qfallback;
static specifier_type_entry_dynarr *the_specifier_type_entry_dynarr;
static const struct lrecord_description ste_description_1[] = {
- { XD_LISP_OBJECT, offsetof(specifier_type_entry, symbol), 1 },
- { XD_STRUCT_PTR, offsetof(specifier_type_entry, meths), 1, &specifier_methods_description },
+ { XD_LISP_OBJECT, offsetof (specifier_type_entry, symbol) },
+ { XD_STRUCT_PTR, offsetof (specifier_type_entry, meths), 1, &specifier_methods_description },
{ XD_END }
};
static const struct struct_description ste_description = {
- sizeof(specifier_type_entry),
+ sizeof (specifier_type_entry),
ste_description_1
};
static const struct lrecord_description sted_description_1[] = {
- XD_DYNARR_DESC(specifier_type_entry_dynarr, &ste_description),
+ XD_DYNARR_DESC (specifier_type_entry_dynarr, &ste_description),
{ XD_END }
};
static const struct struct_description sted_description = {
- sizeof(specifier_type_entry_dynarr),
+ sizeof (specifier_type_entry_dynarr),
sted_description_1
};
!NILP (rest);
rest = XSPECIFIER (rest)->next_specifier)
{
- struct Lisp_Specifier *sp = XSPECIFIER (rest);
+ Lisp_Specifier *sp = XSPECIFIER (rest);
/* This effectively changes the specifier specs.
However, there's no need to call
recompute_cached_specifier_everywhere() or the
!NILP (rest);
rest = XSPECIFIER (rest)->next_specifier)
{
- struct Lisp_Specifier *sp = XSPECIFIER (rest);
+ Lisp_Specifier *sp = XSPECIFIER (rest);
/* Make sure we're actually going to be changing something.
Fremove_specifier() always calls
static Lisp_Object
mark_specifier (Lisp_Object obj)
{
- struct Lisp_Specifier *specifier = XSPECIFIER (obj);
+ Lisp_Specifier *specifier = XSPECIFIER (obj);
mark_object (specifier->global_specs);
mark_object (specifier->device_specs);
{
if (! marked_p (rest))
{
- struct Lisp_Specifier* sp = XSPECIFIER (rest);
+ Lisp_Specifier* sp = XSPECIFIER (rest);
/* A bit of assertion that we're removing both parts of the
magic one altogether */
assert (!MAGIC_SPECIFIER_P(sp)
static void
print_specifier (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
{
- struct Lisp_Specifier *sp = XSPECIFIER (obj);
+ Lisp_Specifier *sp = XSPECIFIER (obj);
char buf[100];
int count = specpdl_depth ();
Lisp_Object the_specs;
static void
finalize_specifier (void *header, int for_disksave)
{
- struct Lisp_Specifier *sp = (struct Lisp_Specifier *) header;
+ Lisp_Specifier *sp = (Lisp_Specifier *) header;
/* don't be snafued by the disksave finalization. */
if (!for_disksave && !GHOST_SPECIFIER_P(sp) && sp->caching)
{
static int
specifier_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
{
- struct Lisp_Specifier *s1 = XSPECIFIER (obj1);
- struct Lisp_Specifier *s2 = XSPECIFIER (obj2);
+ Lisp_Specifier *s1 = XSPECIFIER (obj1);
+ Lisp_Specifier *s2 = XSPECIFIER (obj2);
int retval;
Lisp_Object old_inhibit_quit = Vinhibit_quit;
static unsigned long
specifier_hash (Lisp_Object obj, int depth)
{
- struct Lisp_Specifier *s = XSPECIFIER (obj);
+ Lisp_Specifier *s = XSPECIFIER (obj);
/* specifier hashing is a bit problematic because there are so
many places where data can be stored. We pick what are perhaps
}
static size_t
-sizeof_specifier (CONST void *header)
+sizeof_specifier (const void *header)
{
- if (GHOST_SPECIFIER_P ((struct Lisp_Specifier *) header))
- return offsetof (struct Lisp_Specifier, data);
+ if (GHOST_SPECIFIER_P ((Lisp_Specifier *) header))
+ return offsetof (Lisp_Specifier, data);
else
{
- CONST struct Lisp_Specifier *p = (CONST struct Lisp_Specifier *) header;
- return offsetof (struct Lisp_Specifier, data) + p->methods->extra_data_size;
+ const Lisp_Specifier *p = (const Lisp_Specifier *) header;
+ return offsetof (Lisp_Specifier, data) + p->methods->extra_data_size;
}
}
static const struct lrecord_description specifier_methods_description_1[] = {
- { XD_LISP_OBJECT, offsetof(struct specifier_methods, predicate_symbol), 1 },
+ { XD_LISP_OBJECT, offsetof (struct specifier_methods, predicate_symbol) },
{ XD_END }
};
const struct struct_description specifier_methods_description = {
- sizeof(struct specifier_methods),
+ sizeof (struct specifier_methods),
specifier_methods_description_1
};
};
static const struct struct_description specifier_caching_description = {
- sizeof(struct specifier_caching),
+ sizeof (struct specifier_caching),
specifier_caching_description_1
};
static const struct lrecord_description specifier_description[] = {
- { XD_STRUCT_PTR, offsetof(struct Lisp_Specifier, methods), 1, &specifier_methods_description },
- { XD_LO_LINK, offsetof(struct Lisp_Specifier, next_specifier) },
- { XD_LISP_OBJECT, offsetof(struct Lisp_Specifier, global_specs), 5 },
- { XD_STRUCT_PTR, offsetof(struct Lisp_Specifier, caching), 1, &specifier_caching_description },
- { XD_LISP_OBJECT, offsetof(struct Lisp_Specifier, magic_parent), 2 },
+ { XD_STRUCT_PTR, offsetof (Lisp_Specifier, methods), 1, &specifier_methods_description },
+ { XD_LO_LINK, offsetof (Lisp_Specifier, next_specifier) },
+ { XD_LISP_OBJECT, offsetof (Lisp_Specifier, global_specs) },
+ { XD_LISP_OBJECT, offsetof (Lisp_Specifier, device_specs) },
+ { XD_LISP_OBJECT, offsetof (Lisp_Specifier, frame_specs) },
+ { XD_LISP_OBJECT, offsetof (Lisp_Specifier, window_specs) },
+ { XD_LISP_OBJECT, offsetof (Lisp_Specifier, buffer_specs) },
+ { XD_STRUCT_PTR, offsetof (Lisp_Specifier, caching), 1, &specifier_caching_description },
+ { XD_LISP_OBJECT, offsetof (Lisp_Specifier, magic_parent) },
+ { XD_LISP_OBJECT, offsetof (Lisp_Specifier, fallback) },
{ XD_SPECIFIER_END }
};
specifier_equal, specifier_hash,
specifier_description,
sizeof_specifier,
- struct Lisp_Specifier);
+ Lisp_Specifier);
\f
/************************************************************************/
/* Creating specifiers */
size_t data_size, int call_create_meth)
{
Lisp_Object specifier;
- struct Lisp_Specifier *sp = (struct Lisp_Specifier *)
- alloc_lcrecord (offsetof (struct Lisp_Specifier, data) +
- data_size, &lrecord_specifier);
+ Lisp_Specifier *sp = (Lisp_Specifier *)
+ alloc_lcrecord (offsetof (Lisp_Specifier, data) + data_size,
+ &lrecord_specifier);
sp->methods = spec_meths;
sp->global_specs = Qnil;
A specifier is an object that can be used to keep track of a property
whose value can be per-buffer, per-window, per-frame, or per-device,
-and can further be restricted to a particular console-type or device-class.
-Specifiers are used, for example, for the various built-in properties of a
-face; this allows a face to have different values in different frames,
-buffers, etc. For more information, see `specifier-instance',
+and can further be restricted to a particular console-type or
+device-class. Specifiers are used, for example, for the various
+built-in properties of a face; this allows a face to have different
+values in different frames, buffers, etc.
+
+When speaking of the value of a specifier, it is important to
+distinguish between the *setting* of a specifier, called an
+\"instantiator\", and the *actual value*, called an \"instance\". You
+put various possible instantiators (i.e. settings) into a specifier
+and associate them with particular locales (buffer, window, frame,
+device, global), and then the instance (i.e. actual value) is
+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
+to a specifier using `let-specifier'. To retrieve settings, use
+`specifier-specs', or its lower-level counterpart
+`specifier-spec-list'. To determine the actual value, use
+`specifier-instance'.
+
+For more information, see `set-specifier', `specifier-instance',
`specifier-specs', and `add-spec-to-specifier'; or, for a detailed
-description of specifiers, including how they are instantiated over a
-particular domain (i.e. how their value in that domain is determined),
-see the chapter on specifiers in the XEmacs Lisp Reference Manual.
+description of specifiers, including how exactly the instantiation
+process works, see the chapter on specifiers in the XEmacs Lisp
+Reference Manual.
TYPE specifies the particular type of specifier, and should be one of
-the symbols 'generic, 'integer, 'boolean, 'color, 'font, 'image,
-'face-boolean, or 'toolbar.
-
-For more information on particular types of specifiers, see the functions
-`generic-specifier-p', `integer-specifier-p', `boolean-specifier-p',
-`color-specifier-p', `font-specifier-p', `image-specifier-p',
-`face-boolean-specifier-p', and `toolbar-specifier-p'.
+the symbols 'generic, 'integer, 'natnum, 'boolean, 'color, 'font,
+'image, 'face-boolean, 'display-table, 'gutter, 'gutter-size,
+'gutter-visible or 'toolbar.
+
+For more information on particular types of specifiers, see the
+functions `make-generic-specifier', `make-integer-specifier',
+`make-natnum-specifier', `make-boolean-specifier',
+`make-color-specifier', `make-font-specifier', `make-image-specifier',
+`make-face-boolean-specifier', `make-gutter-size-specifier',
+`make-gutter-visible-specifier', `default-toolbar', `default-gutter',
+and `current-display-table'.
*/
(type))
{
/* This function can GC */
- struct specifier_methods *meths = decode_specifier_type (type,
- ERROR_ME);
+ struct specifier_methods *meths = decode_specifier_type (type, ERROR_ME);
return make_specifier (meths);
}
DEFUN ("valid-specifier-domain-p", Fvalid_specifier_domain_p, 1, 1, 0, /*
Return t if DOMAIN is a valid specifier domain.
A domain is used to instance a specifier (i.e. determine the specifier's
-value in that domain). Valid domains are windows, frames, and devices.
-\(nil is not valid.)
+value in that domain). Valid domains are image instances, windows, frames,
+and devices. \(nil is not valid.) image instances are pseudo-domains since
+instantiation will actually occur in the window the image instance itself is
+instantiated in.
*/
(domain))
{
/* This cannot GC. */
return ((DEVICEP (domain) && DEVICE_LIVE_P (XDEVICE (domain))) ||
(FRAMEP (domain) && FRAME_LIVE_P (XFRAME (domain))) ||
- (WINDOWP (domain) && WINDOW_LIVE_P (XWINDOW (domain))))
+ (WINDOWP (domain) && WINDOW_LIVE_P (XWINDOW (domain))) ||
+ /* #### get image instances out of domains! */
+ IMAGE_INSTANCEP (domain))
? Qt : Qnil;
}
signal_simple_error ("Invalid specifier domain", domain);
}
-static Lisp_Object
+Lisp_Object
decode_domain (Lisp_Object domain)
{
if (NILP (domain))
{
/* The return value of this function must be GCPRO'd. */
Lisp_Object rest, list_to_build_up = Qnil;
- struct Lisp_Specifier *sp = XSPECIFIER (specifier);
+ Lisp_Specifier *sp = XSPECIFIER (specifier);
struct gcpro gcpro1;
GCPRO1 (list_to_build_up);
specifier_add_spec (Lisp_Object specifier, Lisp_Object locale,
Lisp_Object inst_list, enum spec_add_meth add_meth)
{
- struct Lisp_Specifier *sp = XSPECIFIER (specifier);
+ Lisp_Specifier *sp = XSPECIFIER (specifier);
enum spec_locale_type type = locale_type_from_locale (locale);
Lisp_Object *orig_inst_list, tem;
Lisp_Object list_to_build_up = Qnil;
void
set_specifier_fallback (Lisp_Object specifier, Lisp_Object fallback)
{
- struct Lisp_Specifier *sp = XSPECIFIER (specifier);
+ Lisp_Specifier *sp = XSPECIFIER (specifier);
assert (SPECIFIERP (fallback) ||
!NILP (Fvalid_inst_list_p (fallback, Fspecifier_type (specifier))));
if (SPECIFIERP (fallback))
Lisp_Object depth)
{
/* This function can GC */
- struct Lisp_Specifier *sp;
+ Lisp_Specifier *sp;
Lisp_Object device;
Lisp_Object rest;
int count = specpdl_depth ();
GCPRO2 (specifier, inst_list);
sp = XSPECIFIER (specifier);
- device = DFW_DEVICE (domain);
+ device = DOMAIN_DEVICE (domain);
if (no_quit)
/* The instantiate method is allowed to call eval. Since it
Lisp_Object device = Qnil;
Lisp_Object tag = Qnil;
struct device *d;
- struct Lisp_Specifier *sp;
+ Lisp_Specifier *sp;
sp = XSPECIFIER (specifier);
/* Attempt to determine buffer, window, frame, and device from the
domain. */
- if (WINDOWP (domain))
+ /* #### get image instances out of domains! */
+ if (IMAGE_INSTANCEP (domain))
+ window = DOMAIN_WINDOW (domain);
+ else if (WINDOWP (domain))
window = domain;
else if (FRAMEP (domain))
frame = domain;
else if (DEVICEP (domain))
device = domain;
else
- /* #### dmoore - dammit, this should just signal an error or something
- shouldn't it?
- #### No. Errors are handled in Lisp primitives implementation.
+ /* dmoore writes: [dammit, this should just signal an error or something
+ shouldn't it?]
+
+ No. Errors are handled in Lisp primitives implementation.
Invalid domain is a design error here - kkm. */
abort ();
(specifier, domain, inst_list, default_))
{
Lisp_Object val = Qunbound;
- struct Lisp_Specifier *sp = XSPECIFIER (specifier);
+ Lisp_Specifier *sp = XSPECIFIER (specifier);
struct gcpro gcpro1;
Lisp_Object built_up_list = Qnil;
(specifier, matchspec, domain, inst_list, default_))
{
Lisp_Object val = Qunbound;
- struct Lisp_Specifier *sp = XSPECIFIER (specifier);
+ Lisp_Specifier *sp = XSPECIFIER (specifier);
struct gcpro gcpro1;
Lisp_Object built_up_list = Qnil;
(Lisp_Object specifier, struct frame *f,
Lisp_Object oldval))
{
- struct Lisp_Specifier *sp = XSPECIFIER (specifier);
+ Lisp_Specifier *sp = XSPECIFIER (specifier);
assert (!GHOST_SPECIFIER_P (sp));
if (!sp->caching)
method. */
location = (Lisp_Object *)
((char *) w + XSPECIFIER (specifier)->caching->offset_into_struct_window);
+ /* #### What's the point of this check, other than to optimize image
+ instance instantiation? Unless you specify a caching instantiate
+ method the instantiation that specifier_instance will do will
+ always create a new copy. Thus EQ will always fail. Unfortunately
+ 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))
{
Lisp_Object oldval = *location;
What really needs to be done is to write a function
`make-specifier-type' that creates new specifier types.
- #### I'll look into this for 19.14.
- */
+
+ #### [I'll look into this for 19.14.] Well, sometime. (Currently
+ May 2000, 21.2 is in development. 19.14 was released in June 1996.) */
"A generic specifier is a generalized kind of specifier with user-defined\n"
"semantics. The instantiator can be any kind of Lisp object, and the\n"
DEFUN ("generic-specifier-p", Fgeneric_specifier_p, 1, 1, 0, /*
Return non-nil if OBJECT is a generic specifier.
-A generic specifier allows any kind of Lisp object as an instantiator,
-and returns back the Lisp object unchanged when it is instantiated.
+See `make-generic-specifier' for a description of possible generic
+instantiators.
*/
(object))
{
DEFUN ("integer-specifier-p", Finteger_specifier_p, 1, 1, 0, /*
Return non-nil if OBJECT is an integer specifier.
+
+See `make-integer-specifier' for a description of possible integer
+instantiators.
*/
(object))
{
DEFUN ("natnum-specifier-p", Fnatnum_specifier_p, 1, 1, 0, /*
Return non-nil if OBJECT is a natnum (non-negative-integer) specifier.
+
+See `make-natnum-specifier' for a description of possible natnum
+instantiators.
*/
(object))
{
DEFUN ("boolean-specifier-p", Fboolean_specifier_p, 1, 1, 0, /*
Return non-nil if OBJECT is a boolean specifier.
+
+See `make-boolean-specifier' for a description of possible boolean
+instantiators.
*/
(object))
{
DEFINE_SPECIFIER_TYPE (display_table);
-#define VALID_SINGLE_DISPTABLE_INSTANTIATOR_P(instantiator) \
- (VECTORP (instantiator) \
- || (CHAR_TABLEP (instantiator) \
- && (XCHAR_TABLE_TYPE (instantiator) == CHAR_TABLE_TYPE_CHAR \
- || XCHAR_TABLE_TYPE (instantiator) == CHAR_TABLE_TYPE_GENERIC)) \
+#define VALID_SINGLE_DISPTABLE_INSTANTIATOR_P(instantiator) \
+ (VECTORP (instantiator) \
+ || (CHAR_TABLEP (instantiator) \
+ && (XCHAR_TABLE_TYPE (instantiator) == CHAR_TABLE_TYPE_CHAR \
+ || XCHAR_TABLE_TYPE (instantiator) == CHAR_TABLE_TYPE_GENERIC)) \
|| RANGE_TABLEP (instantiator))
static void
DEFUN ("display-table-specifier-p", Fdisplay_table_specifier_p, 1, 1, 0, /*
Return non-nil if OBJECT is a display-table specifier.
+
+See `current-display-table' for a description of possible display-table
+instantiators.
*/
(object))
{
void
syms_of_specifier (void)
{
+ INIT_LRECORD_IMPLEMENTATION (specifier);
+
defsymbol (&Qspecifierp, "specifierp");
defsymbol (&Qconsole_type, "console-type");
/* locales are defined in general.c. */
defsymbol (&Qprepend, "prepend");
- defsymbol (&Qappend, "append");
defsymbol (&Qremove_tag_set_prepend, "remove-tag-set-prepend");
defsymbol (&Qremove_tag_set_append, "remove-tag-set-append");
defsymbol (&Qremove_locale, "remove-locale");