annotate src/specifier.h @ 404:2f8bb876ab1d r21-2-32

Import from CVS: tag r21-2-32
author cvs
date Mon, 13 Aug 2007 11:16:07 +0200
parents 74fd4e045ea6
children 501cfd01ee6d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Generic specifier list implementation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995 Ben Wing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
24 #ifndef INCLUDED_specifier_h_
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
25 #define INCLUDED_specifier_h_
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
27 /*
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
28 MAGIC SPECIFIERS
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
29 ================
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
30
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
31 Magic specifiers are used to provide fallback values for window
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
32 system provided specifications, reflecting user preferences on the
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
33 window system, such as default fonts, colors, scrollbar thickness
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
34 etc.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
35
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
36 A magic specifier consists of two specifier objects. The first one
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 280
diff changeset
37 behaves like a normal specifier in all senses. The second one, a
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
38 ghost specifier, is a fallback value for the first one, and contains
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
39 values provided by window system, resources etc. which reflect
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
40 default settings for values being specified.
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
41
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
42 A magic specifier has an "ultimate" fallback value, as any usual
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
43 specifier does. This value, an inst-list, is stored in the fallback
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
44 slot of the ghost specifier object.
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
45
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
46 Ghost specifiers have the following properties:
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
47 - Have back pointers to their parent specifiers.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
48 - Do not have instance data. Instead, they share parent's instance
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
49 data.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
50 - Have the same methods structure pointer.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
51 - Share parent's caching scheme.
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
52 - Store fallback value instead of their parents.
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
53
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
54 Ghost specifiers normally are not modifiable at the lisp level, and
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
55 only used to supply fallback instance values. They are accessible
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
56 via (specifier-fallback), but are read-only. Although, under
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
57 certain rare conditions, modification of ghost objects is allowed.
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
58 This behavior is controlled by the global variable
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
59 Vunlock_ghost_specifiers. It is not exposed to lisp, and is set
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
60 during calls to lisp functions which initialize global, device and
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
61 frame defaults, such as
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
62 init-{global,frame,device}-{faces,toolbars,etc}.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
63
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 280
diff changeset
64 Thus, values supplied by resources or other means of a window system
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
65 stored in externally unmodifiable ghost objects. Regular lisp code
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
66 may thus freely modify the normal part of a magic specifier, and
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
67 removing a specification for a particular domain causes the
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 280
diff changeset
68 specification to consider ghost-provided fallback values, or its own
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
69 fallback value.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
70
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
71 Rules of conduct for magic specifiers
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
72 -------------------------------------
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
73 1. recompute_*() functions always operate on the whole specifier
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
74 when passed only a ghost object, by substituting it with their
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
75 parent bodily object.
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
76 2. All specifier methods, except for instantiate method, are passed
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
77 the bodily object of the magic specifier. Instantiate method is
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
78 passed the specifier being instantiated.
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 280
diff changeset
79 3. Only bodily objects are passed to set_specifier_caching function,
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
80 and only these may be cached.
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 280
diff changeset
81 4. All specifiers are added to Vall_specifiers list, both bodily and
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 280
diff changeset
82 ghost. The pair of objects is always removed from the list at the
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
83 same time.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
84 */
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
85
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
86 extern const struct struct_description specifier_methods_description;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
87
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 struct specifier_methods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
90 const char *name;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 Lisp_Object predicate_symbol;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 /* Implementation specific methods: */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
95 /* Create method: Initialize specifier data. Optional. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 void (*create_method) (Lisp_Object specifier);
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
97
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
98 /* Mark method: Mark any lisp object within specifier data
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
99 structure. Not required if no specifier data are Lisp_Objects. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
100 void (*mark_method) (Lisp_Object specifier);
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
101
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
102 /* Equal method: Compare two specifiers. This is called after
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 280
diff changeset
103 ensuring that the two specifiers are of the same type, and have
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
104 the same specs. Quit is inhibited during the call so it is safe
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
105 to call internal_equal().
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
106
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
107 If this function is not present, specifiers considered equal when
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
108 the above conditions are met, i.e. as if the method returned
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
109 non-zero. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 int (*equal_method) (Lisp_Object sp1, Lisp_Object sp2, int depth);
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
111
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
112 /* Hash method: Hash specifier instance data. This has to hash only
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
113 data structure of the specifier, as specs are hashed by the core
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
114 code.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
115
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
116 If this function is not present, hashing behaves as if it
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
117 returned zero. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 unsigned long (*hash_method) (Lisp_Object specifier, int depth);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 /* Validate method: Given an instantiator, verify that it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 valid for this specifier type. If not, signal an error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
123 If this function is not present, all instantiators are considered
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
124 valid. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 void (*validate_method) (Lisp_Object instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
127
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
128 /* Copy method: Given an instantiator, copy the bits that we need to
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
129 for this specifier type.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
130
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
131 If this function is not present, then Fcopy_tree is used. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
132 Lisp_Object (*copy_instantiator_method) (Lisp_Object instantiator);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
133
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 /* Validate-matchspec method: Given a matchspec, verify that it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 valid for this specifier type. If not, signal an error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
137 If this function is not present, *no* matchspecs are considered
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 valid. Note that this differs from validate_method(). */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 void (*validate_matchspec_method) (Lisp_Object matchspec);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
141 /* Instantiate method: Return SPECIFIER instance in DOMAIN,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
142 specified by INSTANTIATOR. MATCHSPEC specifies an additional
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
143 constraints on the instance value (see the docstring for
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
144 Fspecifier_matching_instance function). MATCHSPEC is passed
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
145 Qunbound when no matching constraints are imposed. The method is
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
146 called via call_with_suspended_errors(), so allowed to eval
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
147 safely.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
148
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
149 DEPTH is a lisp integer denoting current depth of instantiation
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
150 calls. This parameter should be passed as the initial depth value
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
151 to functions which also instantiate specifiers (of which I can
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
152 name specifier_instance) to avoid creating "external"
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
153 specification loops.
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
154
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
155 This method must presume that both INSTANTIATOR and MATCSPEC are
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
156 already validated by the corresponding validate_* methods, and
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
157 may abort if they are invalid.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
158
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
159 Return value is an instance, which is returned immediately to the
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
160 caller, or Qunbound to continue instantiation lookup chain.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
161
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
162 If this function is not present, INSTANTIATOR is used as the
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
163 specifier instance. This is the usual case for "simple"
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
164 specifiers, like integer and boolean. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 Lisp_Object (*instantiate_method) (Lisp_Object specifier,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 Lisp_Object matchspec,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 Lisp_Object domain,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 Lisp_Object instantiator,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 Lisp_Object depth);
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
170
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 /* Going-to-add method: Called when an instantiator is about
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 to be added to a specifier. This function can specify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 that different instantiators should be used instead by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 returning an inst-list (possibly containing zero elements).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 If the instantiator is fine as-is, return Qt. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 instantiator has been copied with copy-tree, so feel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 free to reuse parts of it to create a new instantiator.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 The tag-set, however, is not copied and is not canonicalized
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
179 (that will be done on the result of this function). */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 Lisp_Object (*going_to_add_method) (Lisp_Object specifier,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 Lisp_Object locale,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 Lisp_Object tag_set,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 Lisp_Object instantiator);
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
184
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
185 /* After-change method: Called when the SPECIFIER has just been
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
186 changed in LOCALE. The method is called upon:
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
187 * Removing and adding specs to/from the specifier;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
188 * Changing the specifier fallback.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
189
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
190 #### The method may have called more than once per each specifier
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
191 change.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
192
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
193 #### Do not still know if this can safely eval. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 void (*after_change_method) (Lisp_Object specifier,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 Lisp_Object locale);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
197 const struct lrecord_description *extra_description;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 int extra_data_size;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 struct Lisp_Specifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 struct lcrecord_header header;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 struct specifier_methods *methods;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 /* we keep a chained list of all current specifiers, for GC cleanup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 purposes. Do NOT mark through this, or specifiers will never
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 be GC'd. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 Lisp_Object next_specifier;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 /* This is a straight list of instantiators. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 Lisp_Object global_specs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
214 /* These are all assoc lists where the key is the type of object the
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 list represents (buffer, window, etc.) and the associated list is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 the actual list of instantiators. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 Lisp_Object device_specs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 Lisp_Object frame_specs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 /* window_specs is actually a key-assoc weak list. See specifier.c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 for an explanation of why (it boils down to the fact that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 dead windows can become live again through window configurations).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 Lisp_Object window_specs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 Lisp_Object buffer_specs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 struct specifier_caching *caching;
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
227
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
228 /* This can be either nil, for a plain, non-magic specifier object,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
229 t for the normal part of the magic specifier, or #<specifier> for
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
230 the ghost part of the magic specifier, a pointer to its parent
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
231 object */
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
232 Lisp_Object magic_parent;
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 280
diff changeset
233
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
234 /* Fallback value. For magic specifiers, it is a pointer to the ghost. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 Lisp_Object fallback;
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
236
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 /* type-specific extra data attached to a specifier */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 char data[1];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 };
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
240 typedef struct Lisp_Specifier Lisp_Specifier;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
242 DECLARE_LRECORD (specifier, Lisp_Specifier);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
243 #define XSPECIFIER(x) XRECORD (x, specifier, Lisp_Specifier)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 #define XSETSPECIFIER(x, p) XSETRECORD (x, p, specifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 #define SPECIFIERP(x) RECORDP (x, specifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 #define CHECK_SPECIFIER(x) CHECK_RECORD (x, specifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 #define CONCHECK_SPECIFIER(x) CONCHECK_RECORD (x, specifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 /***** Calling a specifier method *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 #define RAW_SPECMETH(sp, m) ((sp)->methods->m##_method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 #define HAS_SPECMETH_P(sp, m) (!!RAW_SPECMETH (sp, m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 #define SPECMETH(sp, m, args) (((sp)->methods->m##_method) args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
255 /* Call a void-returning specifier method, if it exists. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
256 #define MAYBE_SPECMETH(sp, m, args) do { \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
257 Lisp_Specifier *maybe_specmeth_sp = (sp); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
258 if (HAS_SPECMETH_P (maybe_specmeth_sp, m)) \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
259 SPECMETH (maybe_specmeth_sp, m, args); \
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 /***** Defining new specifier types *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
264 #define specifier_data_offset (offsetof (Lisp_Specifier, data))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
265 extern const struct lrecord_description specifier_empty_extra_description[];
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
266
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
267 #ifdef ERROR_CHECK_TYPECHECK
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
268 #define DECLARE_SPECIFIER_TYPE(type) \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
269 extern struct specifier_methods * type##_specifier_methods; \
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
270 INLINE_HEADER struct type##_specifier * \
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
271 error_check_##type##_specifier_data (Lisp_Specifier *sp); \
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
272 INLINE_HEADER struct type##_specifier * \
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
273 error_check_##type##_specifier_data (Lisp_Specifier *sp) \
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
274 { \
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
275 if (SPECIFIERP (sp->magic_parent)) \
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
276 { \
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
277 assert (SPECIFIER_TYPE_P (sp, type)); \
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
278 sp = XSPECIFIER (sp->magic_parent); \
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
279 } \
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
280 else \
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
281 assert (NILP (sp->magic_parent) || EQ (sp->magic_parent, Qt)); \
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
282 assert (SPECIFIER_TYPE_P (sp, type)); \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
283 return (struct type##_specifier *) sp->data; \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
284 } \
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
285 INLINE_HEADER Lisp_Specifier * \
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
286 error_check_##type##_specifier_type (Lisp_Object obj); \
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
287 INLINE_HEADER Lisp_Specifier * \
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
288 error_check_##type##_specifier_type (Lisp_Object obj) \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
289 { \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
290 Lisp_Specifier *sp = XSPECIFIER (obj); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
291 assert (SPECIFIER_TYPE_P (sp, type)); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
292 return sp; \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
293 } \
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
294 DECLARE_NOTHING
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
295 #else
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
296 #define DECLARE_SPECIFIER_TYPE(type) \
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 extern struct specifier_methods * type##_specifier_methods
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
298 #endif /* ERROR_CHECK_TYPECHECK */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
300 #define DEFINE_SPECIFIER_TYPE(type) \
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 struct specifier_methods * type##_specifier_methods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 116
diff changeset
303 #define INITIALIZE_SPECIFIER_TYPE(type, obj_name, pred_sym) do { \
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
304 type##_specifier_methods = xnew_and_zero (struct specifier_methods); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
305 type##_specifier_methods->name = obj_name; \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
306 type##_specifier_methods->extra_description = \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
307 specifier_empty_extra_description; \
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
308 defsymbol_nodump (&type##_specifier_methods->predicate_symbol, pred_sym); \
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
309 add_entry_to_specifier_type_list (Q##type, type##_specifier_methods); \
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
310 dumpstruct (&type##_specifier_methods, &specifier_methods_description); \
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
311 } while (0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
312
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
313 #define REINITIALIZE_SPECIFIER_TYPE(type) do { \
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
314 staticpro_nodump (&type##_specifier_methods->predicate_symbol); \
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
315 } while (0)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 #define INITIALIZE_SPECIFIER_TYPE_WITH_DATA(type, obj_name, pred_sym) \
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
318 do { \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
319 INITIALIZE_SPECIFIER_TYPE (type, obj_name, pred_sym); \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
320 type##_specifier_methods->extra_data_size = \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
321 sizeof (struct type##_specifier); \
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
322 type##_specifier_methods->extra_description = \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
323 type##_specifier_description; \
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
324 } while (0)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
326 /* Declare that specifier-type TYPE has method METH; used in
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 initialization routines */
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
328 #define SPECIFIER_HAS_METHOD(type, meth) \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
329 (type##_specifier_methods->meth##_method = type##_##meth)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 /***** Macros for accessing specifier types *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
333 #define SPECIFIER_TYPE_P(sp, type) \
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 ((sp)->methods == type##_specifier_methods)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
336 /* Any of the two of the magic spec */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
337 #define MAGIC_SPECIFIER_P(sp) (!NILP((sp)->magic_parent))
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
338 /* Normal part of the magic specifier */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
339 #define BODILY_SPECIFIER_P(sp) EQ ((sp)->magic_parent, Qt)
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
340 /* Ghost part of the magic specifier */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
341 #define GHOST_SPECIFIER_P(sp) SPECIFIERP((sp)->magic_parent)
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
342
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
343 #define GHOST_SPECIFIER(sp) XSPECIFIER ((sp)->fallback)
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
344
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 #ifdef ERROR_CHECK_TYPECHECK
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
346 # define SPECIFIER_TYPE_DATA(sp, type) \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
347 error_check_##type##_specifier_data (sp)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 #else
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
349 # define SPECIFIER_TYPE_DATA(sp, type) \
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
350 ((struct type##_specifier *) \
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
351 (GHOST_SPECIFIER_P(sp) \
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
352 ? XSPECIFIER((sp)->magic_parent)->data \
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
353 : (sp)->data))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
356 #ifdef ERROR_CHECK_TYPECHECK
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
357 # define XSPECIFIER_TYPE(x, type) \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
358 error_check_##type##_specifier_type (x)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
359 # define XSETSPECIFIER_TYPE(x, p, type) do \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
360 { \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
361 XSETSPECIFIER (x, p); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
362 assert (SPECIFIER_TYPEP (XSPECIFIER(x), type)); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
363 } while (0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
364 #else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
365 # define XSPECIFIER_TYPE(x, type) XSPECIFIER (x)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
366 # define XSETSPECIFIER_TYPE(x, p, type) XSETSPECIFIER (x, p)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
367 #endif /* ERROR_CHECK_TYPE_CHECK */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
369 #define SPECIFIER_TYPEP(x, type) \
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (SPECIFIERP (x) && SPECIFIER_TYPE_P (XSPECIFIER (x), type))
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
371 #define CHECK_SPECIFIER_TYPE(x, type) do { \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
372 CHECK_SPECIFIER (x); \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
373 if (!SPECIFIER_TYPE_P (XSPECIFIER (x), type)) \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
374 dead_wrong_type_argument \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
375 (type##_specifier_methods->predicate_symbol, x); \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
376 } while (0)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
377 #define CONCHECK_SPECIFIER_TYPE(x, type) do { \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
378 CONCHECK_SPECIFIER (x); \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
379 if (!(SPECIFIER_TYPEP (x, type))) \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
380 x = wrong_type_argument \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
381 (type##_specifier_methods->predicate_symbol, x); \
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
382 } while (0)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 /***** Miscellaneous structures *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 enum spec_locale_type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 LOCALE_GLOBAL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 LOCALE_DEVICE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 LOCALE_FRAME,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 LOCALE_WINDOW,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 LOCALE_BUFFER
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 enum spec_add_meth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 SPEC_PREPEND,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 SPEC_APPEND,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 SPEC_REMOVE_TAG_SET_PREPEND,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 SPEC_REMOVE_TAG_SET_APPEND,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 SPEC_REMOVE_LOCALE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 SPEC_REMOVE_LOCALE_TYPE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 SPEC_REMOVE_ALL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 struct specifier_caching
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 int offset_into_struct_window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 void (*value_changed_in_window) (Lisp_Object specifier, struct window *w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 Lisp_Object oldval);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 int offset_into_struct_frame;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 void (*value_changed_in_frame) (Lisp_Object specifier, struct frame *f,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 Lisp_Object oldval);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
416 EXFUN (Fcopy_specifier, 6);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
417 EXFUN (Fmake_specifier, 1);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
418 EXFUN (Fset_specifier_dirty_flag, 1);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
419 EXFUN (Fspecifier_instance, 4);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
420 EXFUN (Fvalid_specifier_locale_p, 1);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
421
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
422 extern Lisp_Object Qfallback, Qnatnum;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
423
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
424 Lisp_Object make_magic_specifier (Lisp_Object type);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
425 Lisp_Object decode_locale_list (Lisp_Object locale);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 extern enum spec_add_meth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 decode_how_to_add_specification (Lisp_Object how_to_add);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
428 Lisp_Object decode_specifier_tag_set (Lisp_Object tag_set);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
430 void add_entry_to_specifier_type_list (Lisp_Object symbol,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
431 struct specifier_methods *meths);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
432 void set_specifier_caching (Lisp_Object specifier,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
433 int struct_window_offset,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
434 void (*value_changed_in_window)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
435 (Lisp_Object specifier, struct window *w,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
436 Lisp_Object oldval),
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
437 int struct_frame_offset,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
438 void (*value_changed_in_frame)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
439 (Lisp_Object specifier, struct frame *f,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
440 Lisp_Object oldval));
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
441 void set_specifier_fallback (Lisp_Object specifier,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
442 Lisp_Object fallback);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
443 void recompute_all_cached_specifiers_in_window (struct window *w);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
444 void recompute_all_cached_specifiers_in_frame (struct frame *f);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
446 /* Counterparts of Fadd_spec_to_specifier and Fremove_specifier, which
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
447 operate directly on ghost objects given a magic specifier. */
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
448 void add_spec_to_ghost_specifier (Lisp_Object specifier, Lisp_Object instantiator,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
449 Lisp_Object locale, Lisp_Object tag_set,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
450 Lisp_Object how_to_add);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
451 void remove_ghost_specifier (Lisp_Object specifier, Lisp_Object locale,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
452 Lisp_Object tag_set, Lisp_Object exact_p);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
453
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 276
diff changeset
454 int unlock_ghost_specifiers_protected (void);
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
455
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
456 void cleanup_specifiers (void);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
457 void prune_specifiers (void);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
458 void setup_device_initial_specifier_tags (struct device *d);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 void kill_specifier_buffer_locals (Lisp_Object buffer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 DECLARE_SPECIFIER_TYPE (generic);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 #define XGENERIC_SPECIFIER(x) XSPECIFIER_TYPE (x, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 #define XSETGENERIC_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 #define GENERIC_SPECIFIERP(x) SPECIFIER_TYPEP (x, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 #define CHECK_GENERIC_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 #define CONCHECK_GENERIC_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 DECLARE_SPECIFIER_TYPE (integer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 #define XINTEGER_SPECIFIER(x) XSPECIFIER_TYPE (x, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 #define XSETINTEGER_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 #define INTEGER_SPECIFIERP(x) SPECIFIER_TYPEP (x, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 #define CHECK_INTEGER_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 #define CONCHECK_INTEGER_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 DECLARE_SPECIFIER_TYPE (natnum);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 #define XNATNUM_SPECIFIER(x) XSPECIFIER_TYPE (x, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 #define XSETNATNUM_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 #define NATNUM_SPECIFIERP(x) SPECIFIER_TYPEP (x, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 #define CHECK_NATNUM_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 #define CONCHECK_NATNUM_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 DECLARE_SPECIFIER_TYPE (boolean);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 #define XBOOLEAN_SPECIFIER(x) XSPECIFIER_TYPE (x, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 #define XSETBOOLEAN_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 #define BOOLEAN_SPECIFIERP(x) SPECIFIER_TYPEP (x, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 #define CHECK_BOOLEAN_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 #define CONCHECK_BOOLEAN_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 0
diff changeset
489 DECLARE_SPECIFIER_TYPE (display_table);
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 0
diff changeset
490 #define XDISPLAYTABLE_SPECIFIER(x) XSPECIFIER_TYPE (x, display_table)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 0
diff changeset
491 #define XSETDISPLAYTABLE_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, display_table)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 0
diff changeset
492 #define DISPLAYTABLE_SPECIFIERP(x) SPECIFIER_TYPEP (x, display_table)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 0
diff changeset
493 #define CHECK_DISPLAYTABLE_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, display_table)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 0
diff changeset
494 #define CONCHECK_DISPLAYTABLE_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, display_table)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 0
diff changeset
495
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
496 #endif /* INCLUDED_specifier_h_ */