comparison src/glyphs.h @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents 8eaf7971accc
children b405438285a2
comparison
equal deleted inserted replaced
184:bcd2674570bf 185:3d6bfa290dbd
53 inherit mono-pixmap 53 inherit mono-pixmap
54 autodetect mono-pixmap, color-pixmap, pointer, 54 autodetect mono-pixmap, color-pixmap, pointer,
55 text 55 text
56 */ 56 */
57 57
58 typedef struct ii_keyword_entry_dynarr_type
59 {
60 Dynarr_declare (struct ii_keyword_entry);
61 } Ii_keyword_entry_dynarr;
62
63 /* These are methods specific to a particular format of image instantiator 58 /* These are methods specific to a particular format of image instantiator
64 (e.g. xpm, string, etc.). */ 59 (e.g. xpm, string, etc.). */
65 60
61 typedef struct ii_keyword_entry ii_keyword_entry;
62 struct ii_keyword_entry
63 {
64 Lisp_Object keyword;
65 void (*validate) (Lisp_Object data);
66 int multiple_p;
67 };
68
69 typedef struct
70 {
71 Dynarr_declare (ii_keyword_entry);
72 } ii_keyword_entry_dynarr;
73
66 struct image_instantiator_methods 74 struct image_instantiator_methods
67 { 75 {
68 Lisp_Object symbol; 76 Lisp_Object symbol;
69 77
70 Ii_keyword_entry_dynarr *keywords; 78 ii_keyword_entry_dynarr *keywords;
71 /* Implementation specific methods: */ 79 /* Implementation specific methods: */
72 80
73 /* Validate method: Given an instantiator vector, signal an error if 81 /* Validate method: Given an instantiator vector, signal an error if
74 it's invalid for this image-instantiator format. Note that this 82 it's invalid for this image-instantiator format. Note that this
75 validation only occurs after all the keyword-specific validation 83 validation only occurs after all the keyword-specific validation
97 Lisp_Object pointer_bg, 105 Lisp_Object pointer_bg,
98 int dest_mask, 106 int dest_mask,
99 Lisp_Object domain); 107 Lisp_Object domain);
100 }; 108 };
101 109
102 struct ii_keyword_entry
103 {
104 Lisp_Object keyword;
105 void (*validate) (Lisp_Object data);
106 int multiple_p;
107 };
108
109 /***** Calling an image-instantiator method *****/ 110 /***** Calling an image-instantiator method *****/
110 111
111 #define HAS_IIFORMAT_METH_P(mstruc, m) ((mstruc)->m##_method) 112 #define HAS_IIFORMAT_METH_P(mstruc, m) ((mstruc)->m##_method)
112 #define IIFORMAT_METH(mstruc, m, args) (((mstruc)->m##_method) args) 113 #define IIFORMAT_METH(mstruc, m, args) (((mstruc)->m##_method) args)
113 114
133 IIFORMAT_METH (MTiiformat_meth_or_given, m, args) : (given) \ 134 IIFORMAT_METH (MTiiformat_meth_or_given, m, args) : (given) \
134 MAC_END 135 MAC_END
135 136
136 /***** Defining new image-instantiator types *****/ 137 /***** Defining new image-instantiator types *****/
137 138
138 #define DECLARE_IMAGE_INSTANTIATOR_FORMAT(format) \ 139 #define DECLARE_IMAGE_INSTANTIATOR_FORMAT(format) \
139 extern struct image_instantiator_methods *format##_image_instantiator_methods 140 extern struct image_instantiator_methods *format##_image_instantiator_methods
140 141
141 #define DEFINE_IMAGE_INSTANTIATOR_FORMAT(format) \ 142 #define DEFINE_IMAGE_INSTANTIATOR_FORMAT(format) \
142 struct image_instantiator_methods *format##_image_instantiator_methods 143 struct image_instantiator_methods *format##_image_instantiator_methods
143 144
144 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT(format, obj_name) \ 145 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT(format, obj_name) \
145 do { \ 146 do { \
146 format##_image_instantiator_methods = \ 147 format##_image_instantiator_methods = \
147 malloc_type_and_zero (struct image_instantiator_methods); \ 148 xnew_and_zero (struct image_instantiator_methods); \
148 defsymbol (&Q##format, obj_name); \ 149 defsymbol (&Q##format, obj_name); \
149 format##_image_instantiator_methods->symbol = Q##format; \ 150 format##_image_instantiator_methods->symbol = Q##format; \
150 format##_image_instantiator_methods->keywords = \ 151 format##_image_instantiator_methods->keywords = \
151 Dynarr_new (struct ii_keyword_entry); \ 152 Dynarr_new (ii_keyword_entry); \
152 add_entry_to_image_instantiator_format_list \ 153 add_entry_to_image_instantiator_format_list \
153 (Q##format, format##_image_instantiator_methods); \ 154 (Q##format, format##_image_instantiator_methods); \
154 } while (0) 155 } while (0)
155 156
156 /* Declare that image-instantiator format FORMAT has method M; used in 157 /* Declare that image-instantiator format FORMAT has method M; used in
157 initialization routines */ 158 initialization routines */
158 #define IIFORMAT_HAS_METHOD(format, m) \ 159 #define IIFORMAT_HAS_METHOD(format, m) \
159 (format##_image_instantiator_methods->m##_method = format##_##m) 160 (format##_image_instantiator_methods->m##_method = format##_##m)
505 506
506 /***************************************************************************** 507 /*****************************************************************************
507 * Glyph Cachels * 508 * Glyph Cachels *
508 *****************************************************************************/ 509 *****************************************************************************/
509 510
511 typedef struct glyph_cachel glyph_cachel;
510 struct glyph_cachel 512 struct glyph_cachel
511 { 513 {
512 Lisp_Object glyph; 514 Lisp_Object glyph;
513 515
514 unsigned int updated :1; 516 unsigned int updated :1;