Mercurial > hg > xemacs-beta
comparison src/specifier.h @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 8de8e3f6228a |
children | 576fb035e263 |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
85 | 85 |
86 extern const struct struct_description specifier_methods_description; | 86 extern const struct struct_description specifier_methods_description; |
87 | 87 |
88 struct specifier_methods | 88 struct specifier_methods |
89 { | 89 { |
90 CONST char *name; | 90 const char *name; |
91 Lisp_Object predicate_symbol; | 91 Lisp_Object predicate_symbol; |
92 | 92 |
93 /* Implementation specific methods: */ | 93 /* Implementation specific methods: */ |
94 | 94 |
95 /* Create method: Initialize specifier data. Optional. */ | 95 /* Create method: Initialize specifier data. Optional. */ |
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 | 154 |
155 This method must presume that both INSTANTIATOR and MATCSPEC are | 155 This method must presume that both INSTANTIATOR and MATCHSPEC are |
156 already validated by the corresponding validate_* methods, and | 156 already validated by the corresponding validate_* methods, and |
157 may abort if they are invalid. | 157 may abort if they are invalid. |
158 | 158 |
159 Return value is an instance, which is returned immediately to the | 159 Return value is an instance, which is returned immediately to the |
160 caller, or Qunbound to continue instantiation lookup chain. | 160 caller, or Qunbound to continue instantiation lookup chain. |
265 extern const struct lrecord_description specifier_empty_extra_description[]; | 265 extern const struct lrecord_description specifier_empty_extra_description[]; |
266 | 266 |
267 #ifdef ERROR_CHECK_TYPECHECK | 267 #ifdef ERROR_CHECK_TYPECHECK |
268 #define DECLARE_SPECIFIER_TYPE(type) \ | 268 #define DECLARE_SPECIFIER_TYPE(type) \ |
269 extern struct specifier_methods * type##_specifier_methods; \ | 269 extern struct specifier_methods * type##_specifier_methods; \ |
270 INLINE struct type##_specifier * \ | 270 INLINE_HEADER struct type##_specifier * \ |
271 error_check_##type##_specifier_data (Lisp_Specifier *sp); \ | 271 error_check_##type##_specifier_data (Lisp_Specifier *sp); \ |
272 INLINE struct type##_specifier * \ | 272 INLINE_HEADER struct type##_specifier * \ |
273 error_check_##type##_specifier_data (Lisp_Specifier *sp) \ | 273 error_check_##type##_specifier_data (Lisp_Specifier *sp) \ |
274 { \ | 274 { \ |
275 if (SPECIFIERP (sp->magic_parent)) \ | 275 if (SPECIFIERP (sp->magic_parent)) \ |
276 { \ | 276 { \ |
277 assert (SPECIFIER_TYPE_P (sp, type)); \ | 277 assert (SPECIFIER_TYPE_P (sp, type)); \ |
280 else \ | 280 else \ |
281 assert (NILP (sp->magic_parent) || EQ (sp->magic_parent, Qt)); \ | 281 assert (NILP (sp->magic_parent) || EQ (sp->magic_parent, Qt)); \ |
282 assert (SPECIFIER_TYPE_P (sp, type)); \ | 282 assert (SPECIFIER_TYPE_P (sp, type)); \ |
283 return (struct type##_specifier *) sp->data; \ | 283 return (struct type##_specifier *) sp->data; \ |
284 } \ | 284 } \ |
285 INLINE Lisp_Specifier * \ | 285 INLINE_HEADER Lisp_Specifier * \ |
286 error_check_##type##_specifier_type (Lisp_Object obj); \ | 286 error_check_##type##_specifier_type (Lisp_Object obj); \ |
287 INLINE Lisp_Specifier * \ | 287 INLINE_HEADER Lisp_Specifier * \ |
288 error_check_##type##_specifier_type (Lisp_Object obj) \ | 288 error_check_##type##_specifier_type (Lisp_Object obj) \ |
289 { \ | 289 { \ |
290 Lisp_Specifier *sp = XSPECIFIER (obj); \ | 290 Lisp_Specifier *sp = XSPECIFIER (obj); \ |
291 assert (SPECIFIER_TYPE_P (sp, type)); \ | 291 assert (SPECIFIER_TYPE_P (sp, type)); \ |
292 return sp; \ | 292 return sp; \ |
293 } \ | 293 } \ |
294 DECLARE_NOTHING | 294 DECLARE_NOTHING |
295 #else | 295 #else |
296 #define DECLARE_SPECIFIER_TYPE(type) \ | 296 #define DECLARE_SPECIFIER_TYPE(type) \ |
297 extern struct specifier_methods * type##_specifier_methods | 297 extern struct specifier_methods * type##_specifier_methods |
298 #endif /* ERROR_CHECK_TYPECHECK */ | 298 #endif /* ERROR_CHECK_TYPECHECK */ |
299 | 299 |
300 #define DEFINE_SPECIFIER_TYPE(type) \ | 300 #define DEFINE_SPECIFIER_TYPE(type) \ |
301 struct specifier_methods * type##_specifier_methods | 301 struct specifier_methods * type##_specifier_methods |
302 | 302 |
303 #define INITIALIZE_SPECIFIER_TYPE(type, obj_name, pred_sym) do { \ | 303 #define INITIALIZE_SPECIFIER_TYPE(type, obj_name, pred_sym) do { \ |
304 type##_specifier_methods = xnew_and_zero (struct specifier_methods); \ | 304 type##_specifier_methods = xnew_and_zero (struct specifier_methods); \ |
305 type##_specifier_methods->name = obj_name; \ | 305 type##_specifier_methods->name = obj_name; \ |
306 type##_specifier_methods->extra_description = \ | 306 type##_specifier_methods->extra_description = \ |
307 specifier_empty_extra_description; \ | 307 specifier_empty_extra_description; \ |
308 defsymbol_nodump (&type##_specifier_methods->predicate_symbol, pred_sym); \ | 308 defsymbol_nodump (&type##_specifier_methods->predicate_symbol, pred_sym); \ |
309 add_entry_to_specifier_type_list (Q##type, type##_specifier_methods); \ | 309 add_entry_to_specifier_type_list (Q##type, type##_specifier_methods); \ |
310 dumpstruct (&type##_specifier_methods, &specifier_methods_description); \ | 310 dumpstruct (&type##_specifier_methods, &specifier_methods_description); \ |
311 } while (0) | 311 } while (0) |
312 | 312 |
313 #define REINITIALIZE_SPECIFIER_TYPE(type) do { \ | 313 #define REINITIALIZE_SPECIFIER_TYPE(type) do { \ |
314 staticpro_nodump (&type##_specifier_methods->predicate_symbol); \ | 314 staticpro_nodump (&type##_specifier_methods->predicate_symbol); \ |
315 } while (0) | 315 } while (0) |
316 | 316 |
317 #define INITIALIZE_SPECIFIER_TYPE_WITH_DATA(type, obj_name, pred_sym) \ | 317 #define INITIALIZE_SPECIFIER_TYPE_WITH_DATA(type, obj_name, pred_sym) \ |
318 do { \ | 318 do { \ |
364 #else | 364 #else |
365 # define XSPECIFIER_TYPE(x, type) XSPECIFIER (x) | 365 # define XSPECIFIER_TYPE(x, type) XSPECIFIER (x) |
366 # define XSETSPECIFIER_TYPE(x, p, type) XSETSPECIFIER (x, p) | 366 # define XSETSPECIFIER_TYPE(x, p, type) XSETSPECIFIER (x, p) |
367 #endif /* ERROR_CHECK_TYPE_CHECK */ | 367 #endif /* ERROR_CHECK_TYPE_CHECK */ |
368 | 368 |
369 #define SPECIFIER_TYPEP(x, type) \ | 369 #define SPECIFIER_TYPEP(x, type) \ |
370 (SPECIFIERP (x) && SPECIFIER_TYPE_P (XSPECIFIER (x), type)) | 370 (SPECIFIERP (x) && SPECIFIER_TYPE_P (XSPECIFIER (x), type)) |
371 #define CHECK_SPECIFIER_TYPE(x, type) do { \ | 371 #define CHECK_SPECIFIER_TYPE(x, type) do { \ |
372 CHECK_SPECIFIER (x); \ | 372 CHECK_SPECIFIER (x); \ |
373 if (!SPECIFIER_TYPE_P (XSPECIFIER (x), type)) \ | 373 if (!SPECIFIER_TYPE_P (XSPECIFIER (x), type)) \ |
374 dead_wrong_type_argument \ | 374 dead_wrong_type_argument \ |
411 int offset_into_struct_frame; | 411 int offset_into_struct_frame; |
412 void (*value_changed_in_frame) (Lisp_Object specifier, struct frame *f, | 412 void (*value_changed_in_frame) (Lisp_Object specifier, struct frame *f, |
413 Lisp_Object oldval); | 413 Lisp_Object oldval); |
414 }; | 414 }; |
415 | 415 |
416 /* #### get image instances out of domains! */ | |
417 | |
418 /* #### I think the following should abort() rather than return nil | |
419 when an invalid domain is given; much more likely we'll catch design | |
420 errors early. --ben */ | |
421 | |
422 /* This turns out to be used heavily so we make it a macro to make it | |
423 inline. Also, the majority of the time the object will turn out to | |
424 be a window so we move it from being checked last to being checked | |
425 first. */ | |
426 #define DOMAIN_DEVICE(obj) \ | |
427 (WINDOWP (obj) ? WINDOW_DEVICE (XWINDOW (obj)) \ | |
428 : (FRAMEP (obj) ? FRAME_DEVICE (XFRAME (obj)) \ | |
429 : (DEVICEP (obj) ? obj \ | |
430 : (IMAGE_INSTANCEP (obj) ? image_instance_device (obj) \ | |
431 : Qnil)))) | |
432 | |
433 #define DOMAIN_FRAME(obj) \ | |
434 (WINDOWP (obj) ? WINDOW_FRAME (XWINDOW (obj)) \ | |
435 : (FRAMEP (obj) ? obj \ | |
436 : (IMAGE_INSTANCEP (obj) ? image_instance_frame (obj) \ | |
437 : Qnil))) | |
438 | |
439 #define DOMAIN_WINDOW(obj) \ | |
440 (WINDOWP (obj) ? obj \ | |
441 : (IMAGE_INSTANCEP (obj) ? image_instance_window (obj) \ | |
442 : Qnil)) | |
443 | |
444 #define DOMAIN_LIVE_P(obj) \ | |
445 (WINDOWP (obj) ? WINDOW_LIVE_P (XWINDOW (obj)) \ | |
446 : (FRAMEP (obj) ? FRAME_LIVE_P (XFRAME (obj)) \ | |
447 : (DEVICEP (obj) ? DEVICE_LIVE_P (XDEVICE (obj)) \ | |
448 : (IMAGE_INSTANCEP (obj) ? image_instance_live_p (obj) \ | |
449 : 0)))) | |
450 | |
451 #define DOMAIN_XDEVICE(obj) \ | |
452 (XDEVICE (DOMAIN_DEVICE (obj))) | |
453 #define DOMAIN_XFRAME(obj) \ | |
454 (XFRAME (DOMAIN_FRAME (obj))) | |
455 #define DOMAIN_XWINDOW(obj) \ | |
456 (XWINDOW (DOMAIN_WINDOW (obj))) | |
457 | |
416 EXFUN (Fcopy_specifier, 6); | 458 EXFUN (Fcopy_specifier, 6); |
417 EXFUN (Fmake_specifier, 1); | 459 EXFUN (Fmake_specifier, 1); |
418 EXFUN (Fset_specifier_dirty_flag, 1); | 460 EXFUN (Fset_specifier_dirty_flag, 1); |
419 EXFUN (Fspecifier_instance, 4); | 461 EXFUN (Fspecifier_instance, 4); |
420 EXFUN (Fvalid_specifier_locale_p, 1); | 462 EXFUN (Fvalid_specifier_locale_p, 1); |
424 Lisp_Object make_magic_specifier (Lisp_Object type); | 466 Lisp_Object make_magic_specifier (Lisp_Object type); |
425 Lisp_Object decode_locale_list (Lisp_Object locale); | 467 Lisp_Object decode_locale_list (Lisp_Object locale); |
426 extern enum spec_add_meth | 468 extern enum spec_add_meth |
427 decode_how_to_add_specification (Lisp_Object how_to_add); | 469 decode_how_to_add_specification (Lisp_Object how_to_add); |
428 Lisp_Object decode_specifier_tag_set (Lisp_Object tag_set); | 470 Lisp_Object decode_specifier_tag_set (Lisp_Object tag_set); |
471 Lisp_Object decode_domain (Lisp_Object domain); | |
429 | 472 |
430 void add_entry_to_specifier_type_list (Lisp_Object symbol, | 473 void add_entry_to_specifier_type_list (Lisp_Object symbol, |
431 struct specifier_methods *meths); | 474 struct specifier_methods *meths); |
432 void set_specifier_caching (Lisp_Object specifier, | 475 void set_specifier_caching (Lisp_Object specifier, |
433 int struct_window_offset, | 476 int struct_window_offset, |