Mercurial > hg > xemacs-beta
comparison src/specifier.h @ 280:7df0dd720c89 r21-0b38
Import from CVS: tag r21-0b38
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:32:22 +0200 |
parents | 6330739388db |
children | 8626e4521993 |
comparison
equal
deleted
inserted
replaced
279:c20b2fb5bb0a | 280:7df0dd720c89 |
---|---|
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 sences. The second one, a |
38 ghost specifier, is a fallback value for the first one. | 38 ghost specifier, is a fallback value for the first one, and contains |
39 values provided by window system, resources etc. which reflect | |
40 default settings for values being specified. | |
41 | |
42 A magic specifier has an "ultimate" fallback value, as any usual | |
43 specifier does. This value, an inst-list, is stored in the fallback | |
44 slot of the ghost specifier object. | |
39 | 45 |
40 Ghost specifiers have the following properties: | 46 Ghost specifiers have the following properties: |
41 - Have back pointers to their parent specifiers. | 47 - Have back pointers to their parent specifiers. |
42 - Do not have instance data. Instead, they share parent's instance | 48 - Do not have instance data. Instead, they share parent's instance |
43 data. | 49 data. |
44 - Have the same methods structure pointer. | 50 - Have the same methods structure pointer. |
45 - Share parent's caching scheme. | 51 - Share parent's caching scheme. |
46 - Store fallback value instead of their parent. | 52 - Store fallback value instead of their parents. |
47 | 53 |
48 Ghost specifiers normally are not modifiable at the lisp level, and | 54 Ghost specifiers normally are not modifiable at the lisp level, and |
49 only used to supply fallback instance values. Although, under | 55 only used to supply fallback instance values. They are accessible |
50 certain rare conditions, all functions that modify specifiers | 56 via (specifier-fallback), but are read-only. Although, under |
51 operate on ghost objects. This behavior is controlled by the global | 57 certain rare conditions, modification of ghost objects is allowed. |
52 variable Vreveal_ghoste_specifiers. It is not exposed to lisp, and | 58 This behavior is controlled by the global variable |
53 is set during calls to lisp functions which initialize global, | 59 Vunlock_ghost_specifiers. It is not exposed to lisp, and is set |
54 device and frame defaults, such as | 60 during calls to lisp functions which initialize global, device and |
61 frame defaults, such as | |
55 init-{global,frame,device}-{faces,toolbars,etc}. | 62 init-{global,frame,device}-{faces,toolbars,etc}. |
56 | 63 |
57 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 |
58 stored in externally unmodifiable ghost objects. Regular lisp code | 65 stored in externally unmodifiable ghost objects. Regular lisp code |
59 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 |
61 specification to consider ghost-provided fallback values, or its own | 68 specification to consider ghost-provided fallback values, or its own |
62 fallback value. | 69 fallback value. |
63 | 70 |
64 Rules of conduct for magic specifiers | 71 Rules of conduct for magic specifiers |
65 ------------------------------------- | 72 ------------------------------------- |
66 1. All functions exposed to lisp operate on a ghost specifier when | 73 1. recompute_*() functions always operate on the whole specifier |
67 Vreveal_ghoste_specifiers is non-nil. This includes both | |
68 modifying and non-modifying functions, such as | |
69 Fspecifier_instance, for symmetry and consistency. | |
70 2. These functions deal with the above condition internally, passing | |
71 mangled specifier pointer to internal functions. The internal | |
72 functions always work on a specifier passed, and do not regard | |
73 the value of Vreveal_ghoste_specifiers. | |
74 3. recompute_*() functions always operate on the whole specifier | |
75 when passed only a ghost object, by substituting it with their | 74 when passed only a ghost object, by substituting it with their |
76 parent bodily object. | 75 parent bodily object. |
77 4. All specifier methods, except for instantiate method, are passed | 76 2. All specifier methods, except for instantiate method, are passed |
78 the bodily object of the magic specifier. Instantiate method is | 77 the bodily object of the magic specifier. Instantiate method is |
79 passed the specifier being instantiated. | 78 passed the specifier being instantiated. |
80 5. Only bodily objects are passed to set_specifier_caching function, | 79 3. Only bodily objects are passed to set_specifier_caching function, |
81 and only these may be cached. | 80 and only these may be cached. |
82 6. All specifiers are added to Vall_specifiers list, both bodily and | 81 4. All specifiers are added to Vall_specifiers list, both bodily and |
83 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 |
84 same time. | 83 same time. |
85 */ | 84 */ |
86 | 85 |
87 struct specifier_methods | 86 struct specifier_methods |
137 Qunbound when no matching constraints are imposed. The method is | 136 Qunbound when no matching constraints are imposed. The method is |
138 called via call_with_suspended_errors(), so allowed to eval | 137 called via call_with_suspended_errors(), so allowed to eval |
139 safely. | 138 safely. |
140 | 139 |
141 DEPTH is a lisp integer denoting current depth of instantiation | 140 DEPTH is a lisp integer denoting current depth of instantiation |
142 calls. #### WTF a method can do with this? | 141 calls. This parameter should be passed as the initial depth value |
142 to functions which also instantiate specifiers (of which I can | |
143 name specifier_instance) to avoid creating "external" | |
144 specification loops. | |
143 | 145 |
144 This method must presume that both INSTANTIATOR and MATCSPEC are | 146 This method must presume that both INSTANTIATOR and MATCSPEC are |
145 already validated by the corresponding validate_* methods, and | 147 already validated by the corresponding validate_* methods, and |
146 may abort if they are invalid. | 148 may abort if they are invalid. |
147 | 149 |
410 void set_specifier_fallback (Lisp_Object specifier, | 412 void set_specifier_fallback (Lisp_Object specifier, |
411 Lisp_Object fallback); | 413 Lisp_Object fallback); |
412 void recompute_all_cached_specifiers_in_window (struct window *w); | 414 void recompute_all_cached_specifiers_in_window (struct window *w); |
413 void recompute_all_cached_specifiers_in_frame (struct frame *f); | 415 void recompute_all_cached_specifiers_in_frame (struct frame *f); |
414 | 416 |
415 /* Counterparts of Fadd_spec_to_specifier and Fremove_specifier, | 417 /* Counterparts of Fadd_spec_to_specifier and Fremove_specifier, which |
416 which operate directly on ghost objects */ | 418 operate directly on ghost objects given a magic specifier. */ |
417 void add_spec_to_ghost_specifier (Lisp_Object specifier, Lisp_Object instantiator, | 419 void add_spec_to_ghost_specifier (Lisp_Object specifier, Lisp_Object instantiator, |
418 Lisp_Object locale, Lisp_Object tag_set, | 420 Lisp_Object locale, Lisp_Object tag_set, |
419 Lisp_Object how_to_add); | 421 Lisp_Object how_to_add); |
420 void remove_ghost_specifier (Lisp_Object specifier, Lisp_Object locale, | 422 void remove_ghost_specifier (Lisp_Object specifier, Lisp_Object locale, |
421 Lisp_Object tag_set, Lisp_Object exact_p); | 423 Lisp_Object tag_set, Lisp_Object exact_p); |
422 | 424 |
423 int reveal_ghost_specifiers_protected (void); | 425 int unlock_ghost_specifiers_protected (void); |
424 | 426 |
425 void cleanup_specifiers (void); | 427 void cleanup_specifiers (void); |
426 void prune_specifiers (int (*obj_marked_p) (Lisp_Object)); | 428 void prune_specifiers (int (*obj_marked_p) (Lisp_Object)); |
427 void setup_device_initial_specifier_tags (struct device *d); | 429 void setup_device_initial_specifier_tags (struct device *d); |
428 void kill_specifier_buffer_locals (Lisp_Object buffer); | 430 void kill_specifier_buffer_locals (Lisp_Object buffer); |