comparison src/specifier.h @ 5118:e0db3c197671 ben-lisp-object

merge up to latest default branch, doesn't compile yet
author Ben Wing <ben@xemacs.org>
date Sat, 26 Dec 2009 21:18:49 -0600
parents d00347ec8289
children d1247f3cc363
comparison
equal deleted inserted replaced
5117:3742ea8250b5 5118:e0db3c197671
137 If this function is not present, *no* matchspecs are considered 137 If this function is not present, *no* matchspecs are considered
138 valid. Note that this differs from validate_method(). */ 138 valid. Note that this differs from validate_method(). */
139 void (*validate_matchspec_method) (Lisp_Object matchspec); 139 void (*validate_matchspec_method) (Lisp_Object matchspec);
140 140
141 /* Instantiate method: Return SPECIFIER instance in DOMAIN, 141 /* Instantiate method: Return SPECIFIER instance in DOMAIN,
142 specified by INSTANTIATOR. MATCHSPEC specifies an additional 142 specified by INSTANTIATOR. MATCHSPEC specifies additional
143 constraints on the instance value (see the docstring for 143 constraints on the instance value (see the docstring for
144 Fspecifier_matching_instance function). MATCHSPEC is passed 144 Fspecifier_matching_instance function). MATCHSPEC is passed
145 Qunbound when no matching constraints are imposed. The method is 145 Qunbound when no matching constraints are imposed. The method is
146 called via call_with_suspended_errors(), so allowed to eval 146 called via call_with_suspended_errors(), so allowed to eval
147 safely. 147 safely.
149 DEPTH is a lisp integer denoting current depth of instantiation 149 DEPTH is a lisp integer denoting current depth of instantiation
150 calls. This parameter should be passed as the initial depth value 150 calls. This parameter should be passed as the initial depth value
151 to functions which also instantiate specifiers (of which I can 151 to functions which also instantiate specifiers (of which I can
152 name specifier_instance) to avoid creating "external" 152 name specifier_instance) to avoid creating "external"
153 specification loops. 153 specification loops.
154
155 NO_FALLBACK indicates that the method should not try the fallbacks
156 (and thus simply return Qunbound) in case of a failure to instantiate.
154 157
155 This method must presume that both INSTANTIATOR and MATCHSPEC are 158 This method must presume that both INSTANTIATOR and MATCHSPEC are
156 already validated by the corresponding validate_* methods, and 159 already validated by the corresponding validate_* methods, and
157 may abort if they are invalid. 160 may abort if they are invalid.
158 161
164 specifiers, like integer and boolean. */ 167 specifiers, like integer and boolean. */
165 Lisp_Object (*instantiate_method) (Lisp_Object specifier, 168 Lisp_Object (*instantiate_method) (Lisp_Object specifier,
166 Lisp_Object matchspec, 169 Lisp_Object matchspec,
167 Lisp_Object domain, 170 Lisp_Object domain,
168 Lisp_Object instantiator, 171 Lisp_Object instantiator,
169 Lisp_Object depth); 172 Lisp_Object depth,
173 int no_fallback);
170 174
171 /* Going-to-add method: Called when an instantiator is about 175 /* Going-to-add method: Called when an instantiator is about
172 to be added to a specifier. This function can specify 176 to be added to a specifier. This function can specify
173 that different instantiators should be used instead by 177 that different instantiators should be used instead by
174 returning an inst-list (possibly containing zero elements). 178 returning an inst-list (possibly containing zero elements).
253 /* type-specific extra data attached to a specifier */ 257 /* type-specific extra data attached to a specifier */
254 max_align_t data[1]; 258 max_align_t data[1];
255 }; 259 };
256 typedef struct Lisp_Specifier Lisp_Specifier; 260 typedef struct Lisp_Specifier Lisp_Specifier;
257 261
258 DECLARE_LRECORD (specifier, Lisp_Specifier); 262 DECLARE_LISP_OBJECT (specifier, Lisp_Specifier);
259 #define XSPECIFIER(x) XRECORD (x, specifier, Lisp_Specifier) 263 #define XSPECIFIER(x) XRECORD (x, specifier, Lisp_Specifier)
260 #define wrap_specifier(p) wrap_record (p, specifier) 264 #define wrap_specifier(p) wrap_record (p, specifier)
261 #define SPECIFIERP(x) RECORDP (x, specifier) 265 #define SPECIFIERP(x) RECORDP (x, specifier)
262 #define CHECK_SPECIFIER(x) CHECK_RECORD (x, specifier) 266 #define CHECK_SPECIFIER(x) CHECK_RECORD (x, specifier)
263 #define CONCHECK_SPECIFIER(x) CONCHECK_RECORD (x, specifier) 267 #define CONCHECK_SPECIFIER(x) CONCHECK_RECORD (x, specifier)
341 #define INITIALIZE_SPECIFIER_TYPE_WITH_DATA(type, obj_name, pred_sym) \ 345 #define INITIALIZE_SPECIFIER_TYPE_WITH_DATA(type, obj_name, pred_sym) \
342 do { \ 346 do { \
343 INITIALIZE_SPECIFIER_TYPE (type, obj_name, pred_sym); \ 347 INITIALIZE_SPECIFIER_TYPE (type, obj_name, pred_sym); \
344 type##_specifier_methods->extra_data_size = \ 348 type##_specifier_methods->extra_data_size = \
345 sizeof (struct type##_specifier); \ 349 sizeof (struct type##_specifier); \
346 type##_specifier_methods->extra_description = \ 350 type##_specifier_methods->extra_description = \
347 &type##_specifier_description_0; \ 351 &type##_specifier_description_0; \
348 } while (0) 352 } while (0)
349 353
350 /* Declare that specifier-type TYPE has method METH; used in 354 /* Declare that specifier-type TYPE has method METH; used in
351 initialization routines */ 355 initialization routines */
421 SPEC_REMOVE_ALL 425 SPEC_REMOVE_ALL
422 }; 426 };
423 427
424 struct specifier_caching 428 struct specifier_caching
425 { 429 {
430 #ifdef NEW_GC
431 struct lrecord_header header;
432 #endif /* NEW_GC */
426 int offset_into_struct_window; 433 int offset_into_struct_window;
427 void (*value_changed_in_window) (Lisp_Object specifier, struct window *w, 434 void (*value_changed_in_window) (Lisp_Object specifier, struct window *w,
428 Lisp_Object oldval); 435 Lisp_Object oldval);
429 int offset_into_struct_frame; 436 int offset_into_struct_frame;
430 void (*value_changed_in_frame) (Lisp_Object specifier, struct frame *f, 437 void (*value_changed_in_frame) (Lisp_Object specifier, struct frame *f,
431 Lisp_Object oldval); 438 Lisp_Object oldval);
432 int always_recompute; 439 int always_recompute;
433 }; 440 };
441
442 #ifdef NEW_GC
443 DECLARE_LISP_OBJECT (specifier_caching, struct specifier_caching);
444 #define XSPECIFIER_CACHING(x) \
445 XRECORD (x, specifier_caching, struct specifier_caching)
446 #define wrap_specifier_caching(p) \
447 wrap_record (p, specifier_caching)
448 #define SPECIFIER_CACHINGP(x) RECORDP (x, specifier_caching)
449 #define CHECK_SPECIFIER_CACHING(x) \
450 CHECK_RECORD (x, specifier_caching)
451 #define CONCHECK_SPECIFIER_CACHING(x) \
452 CONCHECK_RECORD (x, specifier_caching)
453 #endif /* NEW_GC */
434 454
435 /* #### get image instances out of domains! */ 455 /* #### get image instances out of domains! */
436 456
437 /* #### I think the following should ABORT() rather than return nil 457 /* #### I think the following should ABORT() rather than return nil
438 when an invalid domain is given; much more likely we'll catch design 458 when an invalid domain is given; much more likely we'll catch design
517 int unlock_ghost_specifiers_protected (void); 537 int unlock_ghost_specifiers_protected (void);
518 538
519 void cleanup_specifiers (void); 539 void cleanup_specifiers (void);
520 void prune_specifiers (void); 540 void prune_specifiers (void);
521 void setup_device_initial_specifier_tags (struct device *d); 541 void setup_device_initial_specifier_tags (struct device *d);
542 void setup_charset_initial_specifier_tags (Lisp_Object charset);
522 void kill_specifier_buffer_locals (Lisp_Object buffer); 543 void kill_specifier_buffer_locals (Lisp_Object buffer);
523 544
524 DECLARE_SPECIFIER_TYPE (generic); 545 DECLARE_SPECIFIER_TYPE (generic);
525 #define XGENERIC_SPECIFIER(x) XSPECIFIER_TYPE (x, generic) 546 #define XGENERIC_SPECIFIER(x) XSPECIFIER_TYPE (x, generic)
526 #define GENERIC_SPECIFIERP(x) SPECIFIER_TYPEP (x, generic) 547 #define GENERIC_SPECIFIERP(x) SPECIFIER_TYPEP (x, generic)
549 #define XDISPLAYTABLE_SPECIFIER(x) XSPECIFIER_TYPE (x, display_table) 570 #define XDISPLAYTABLE_SPECIFIER(x) XSPECIFIER_TYPE (x, display_table)
550 #define DISPLAYTABLE_SPECIFIERP(x) SPECIFIER_TYPEP (x, display_table) 571 #define DISPLAYTABLE_SPECIFIERP(x) SPECIFIER_TYPEP (x, display_table)
551 #define CHECK_DISPLAYTABLE_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, display_table) 572 #define CHECK_DISPLAYTABLE_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, display_table)
552 #define CONCHECK_DISPLAYTABLE_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, display_table) 573 #define CONCHECK_DISPLAYTABLE_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, display_table)
553 574
575 /* The various stages of font instantiation; initial means "find a font for
576 CHARSET that matches the charset's registries" and final means "find a
577 font for CHARSET that matches iso10646-1, since we haven't found a font
578 that matches its registry." */
579 enum font_specifier_matchspec_stages {
580 initial,
581 final,
582 impossible,
583 };
584
585 Lisp_Object define_specifier_tag(Lisp_Object tag,
586 Lisp_Object device_predicate,
587 Lisp_Object charset_predicate);
588
554 #endif /* INCLUDED_specifier_h_ */ 589 #endif /* INCLUDED_specifier_h_ */