Mercurial > hg > xemacs-beta
comparison src/specifier.h @ 380:8626e4521993 r21-2-5
Import from CVS: tag r21-2-5
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:07:10 +0200 |
parents | 7df0dd720c89 |
children | 74fd4e045ea6 |
comparison
equal
deleted
inserted
replaced
379:76b7d63099ad | 380:8626e4521993 |
---|---|
32 system provided specifications, reflecting user preferences on the | 32 system provided specifications, reflecting user preferences on the |
33 window system, such as default fonts, colors, scrollbar thickness | 33 window system, such as default fonts, colors, scrollbar thickness |
34 etc. | 34 etc. |
35 | 35 |
36 A magic specifier consists of two specifier objects. The first one | 36 A magic specifier consists of two specifier objects. The first one |
37 behaves like a normal specifier in all sences. The second one, a | 37 behaves like a normal specifier in all senses. The second one, a |
38 ghost specifier, is a fallback value for the first one, and contains | 38 ghost specifier, is a fallback value for the first one, and contains |
39 values provided by window system, resources etc. which reflect | 39 values provided by window system, resources etc. which reflect |
40 default settings for values being specified. | 40 default settings for values being specified. |
41 | 41 |
42 A magic specifier has an "ultimate" fallback value, as any usual | 42 A magic specifier has an "ultimate" fallback value, as any usual |
59 Vunlock_ghost_specifiers. It is not exposed to lisp, and is set | 59 Vunlock_ghost_specifiers. It is not exposed to lisp, and is set |
60 during calls to lisp functions which initialize global, device and | 60 during calls to lisp functions which initialize global, device and |
61 frame defaults, such as | 61 frame defaults, such as |
62 init-{global,frame,device}-{faces,toolbars,etc}. | 62 init-{global,frame,device}-{faces,toolbars,etc}. |
63 | 63 |
64 Thus, values supplied by resources or other means of a window system | 64 Thus, values supplied by resources or other means of a window system |
65 stored in externally unmodifiable ghost objects. Regular lisp code | 65 stored in externally unmodifiable ghost objects. Regular lisp code |
66 may thus freely modify the normal part of a magic specifier, and | 66 may thus freely modify the normal part of a magic specifier, and |
67 removing a specification for a particular domain causes the | 67 removing a specification for a particular domain causes the |
68 specification to consider ghost-provided fallback values, or its own | 68 specification to consider ghost-provided fallback values, or its own |
69 fallback value. | 69 fallback value. |
70 | 70 |
71 Rules of conduct for magic specifiers | 71 Rules of conduct for magic specifiers |
72 ------------------------------------- | 72 ------------------------------------- |
73 1. recompute_*() functions always operate on the whole specifier | 73 1. recompute_*() functions always operate on the whole specifier |
74 when passed only a ghost object, by substituting it with their | 74 when passed only a ghost object, by substituting it with their |
75 parent bodily object. | 75 parent bodily object. |
76 2. All specifier methods, except for instantiate method, are passed | 76 2. All specifier methods, except for instantiate method, are passed |
77 the bodily object of the magic specifier. Instantiate method is | 77 the bodily object of the magic specifier. Instantiate method is |
78 passed the specifier being instantiated. | 78 passed the specifier being instantiated. |
79 3. Only bodily objects are passed to set_specifier_caching function, | 79 3. Only bodily objects are passed to set_specifier_caching function, |
80 and only these may be cached. | 80 and only these may be cached. |
81 4. All specifiers are added to Vall_specifiers list, both bodily and | 81 4. All specifiers are added to Vall_specifiers list, both bodily and |
82 ghost. The pair of objects is always removed from the list at the | 82 ghost. The pair of objects is always removed from the list at the |
83 same time. | 83 same time. |
84 */ | 84 */ |
85 | 85 |
86 struct specifier_methods | 86 struct specifier_methods |
87 { | 87 { |
96 /* Mark method: Mark any lisp object within specifier data | 96 /* Mark method: Mark any lisp object within specifier data |
97 structure. Not required if no specifier data are Lisp_Objects. */ | 97 structure. Not required if no specifier data are Lisp_Objects. */ |
98 void (*mark_method) (Lisp_Object specifier, void (*markobj) (Lisp_Object)); | 98 void (*mark_method) (Lisp_Object specifier, void (*markobj) (Lisp_Object)); |
99 | 99 |
100 /* Equal method: Compare two specifiers. This is called after | 100 /* Equal method: Compare two specifiers. This is called after |
101 ensuring that the two specifiers are of the same type, and habe | 101 ensuring that the two specifiers are of the same type, and have |
102 the same specs. Quit is inhibited during the call so it is safe | 102 the same specs. Quit is inhibited during the call so it is safe |
103 to call internal_equal(). | 103 to call internal_equal(). |
104 | 104 |
105 If this function is not present, specifiers considered equal when | 105 If this function is not present, specifiers considered equal when |
106 the above conditions are met, i.e. as if the method returned | 106 the above conditions are met, i.e. as if the method returned |
218 /* This can be either nil, for a plain, non-magic specifier object, | 218 /* This can be either nil, for a plain, non-magic specifier object, |
219 t for the normal part of the magic specifier, or #<specifier> for | 219 t for the normal part of the magic specifier, or #<specifier> for |
220 the ghost part of the magic specifier, a pointer to its parent | 220 the ghost part of the magic specifier, a pointer to its parent |
221 object */ | 221 object */ |
222 Lisp_Object magic_parent; | 222 Lisp_Object magic_parent; |
223 | 223 |
224 /* Fallback value. For magic specifiers, it is a pointer to the ghost. */ | 224 /* Fallback value. For magic specifiers, it is a pointer to the ghost. */ |
225 Lisp_Object fallback; | 225 Lisp_Object fallback; |
226 | 226 |
227 /* type-specific extra data attached to a specifier */ | 227 /* type-specific extra data attached to a specifier */ |
228 char data[1]; | 228 char data[1]; |
242 #define HAS_SPECMETH_P(sp, m) (!!RAW_SPECMETH (sp, m)) | 242 #define HAS_SPECMETH_P(sp, m) (!!RAW_SPECMETH (sp, m)) |
243 #define SPECMETH(sp, m, args) (((sp)->methods->m##_method) args) | 243 #define SPECMETH(sp, m, args) (((sp)->methods->m##_method) args) |
244 | 244 |
245 /* Call a void-returning specifier method, if it exists. */ | 245 /* Call a void-returning specifier method, if it exists. */ |
246 #define MAYBE_SPECMETH(sp, m, args) do { \ | 246 #define MAYBE_SPECMETH(sp, m, args) do { \ |
247 struct Lisp_Specifier *_maybe_specmeth_sp = (sp); \ | 247 struct Lisp_Specifier *maybe_specmeth_sp = (sp); \ |
248 if (HAS_SPECMETH_P (_maybe_specmeth_sp, m)) \ | 248 if (HAS_SPECMETH_P (maybe_specmeth_sp, m)) \ |
249 SPECMETH (_maybe_specmeth_sp, m, args); \ | 249 SPECMETH (maybe_specmeth_sp, m, args); \ |
250 } while (0) | 250 } while (0) |
251 | 251 |
252 /***** Defining new specifier types *****/ | 252 /***** Defining new specifier types *****/ |
253 | 253 |
254 #ifdef ERROR_CHECK_TYPECHECK | 254 #ifdef ERROR_CHECK_TYPECHECK |