Mercurial > hg > xemacs-beta
comparison src/objects-tty.c @ 398:74fd4e045ea6 r21-2-29
Import from CVS: tag r21-2-29
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:13:30 +0200 |
parents | 8626e4521993 |
children | 697ef44129c6 |
comparison
equal
deleted
inserted
replaced
397:f4aeb21a5bad | 398:74fd4e045ea6 |
---|---|
141 } | 141 } |
142 | 142 |
143 #endif /* 0 */ | 143 #endif /* 0 */ |
144 | 144 |
145 static int | 145 static int |
146 tty_initialize_color_instance (struct Lisp_Color_Instance *c, Lisp_Object name, | 146 tty_initialize_color_instance (Lisp_Color_Instance *c, Lisp_Object name, |
147 Lisp_Object device, Error_behavior errb) | 147 Lisp_Object device, Error_behavior errb) |
148 { | 148 { |
149 Lisp_Object result; | 149 Lisp_Object result; |
150 | 150 |
151 name = Fintern (name, Qnil); | 151 name = Fintern (name, Qnil); |
166 | 166 |
167 return 1; | 167 return 1; |
168 } | 168 } |
169 | 169 |
170 static void | 170 static void |
171 tty_mark_color_instance (struct Lisp_Color_Instance *c, | 171 tty_mark_color_instance (Lisp_Color_Instance *c) |
172 void (*markobj) (Lisp_Object)) | 172 { |
173 { | 173 mark_object (COLOR_INSTANCE_TTY_SYMBOL (c)); |
174 markobj (COLOR_INSTANCE_TTY_SYMBOL (c)); | 174 } |
175 } | 175 |
176 | 176 static void |
177 static void | 177 tty_print_color_instance (Lisp_Color_Instance *c, |
178 tty_print_color_instance (struct Lisp_Color_Instance *c, | |
179 Lisp_Object printcharfun, | 178 Lisp_Object printcharfun, |
180 int escapeflag) | 179 int escapeflag) |
181 { | 180 { |
182 } | 181 } |
183 | 182 |
184 static void | 183 static void |
185 tty_finalize_color_instance (struct Lisp_Color_Instance *c) | 184 tty_finalize_color_instance (Lisp_Color_Instance *c) |
186 { | 185 { |
187 if (c->data) | 186 if (c->data) |
188 xfree (c->data); | 187 xfree (c->data); |
189 } | 188 } |
190 | 189 |
191 static int | 190 static int |
192 tty_color_instance_equal (struct Lisp_Color_Instance *c1, | 191 tty_color_instance_equal (Lisp_Color_Instance *c1, |
193 struct Lisp_Color_Instance *c2, | 192 Lisp_Color_Instance *c2, |
194 int depth) | 193 int depth) |
195 { | 194 { |
196 return (EQ (COLOR_INSTANCE_TTY_SYMBOL (c1), | 195 return (EQ (COLOR_INSTANCE_TTY_SYMBOL (c1), |
197 COLOR_INSTANCE_TTY_SYMBOL (c2))); | 196 COLOR_INSTANCE_TTY_SYMBOL (c2))); |
198 } | 197 } |
199 | 198 |
200 static unsigned long | 199 static unsigned long |
201 tty_color_instance_hash (struct Lisp_Color_Instance *c, int depth) | 200 tty_color_instance_hash (Lisp_Color_Instance *c, int depth) |
202 { | 201 { |
203 return LISP_HASH (COLOR_INSTANCE_TTY_SYMBOL (c)); | 202 return LISP_HASH (COLOR_INSTANCE_TTY_SYMBOL (c)); |
204 } | 203 } |
205 | 204 |
206 static int | 205 static int |
213 #endif | 212 #endif |
214 } | 213 } |
215 | 214 |
216 | 215 |
217 static int | 216 static int |
218 tty_initialize_font_instance (struct Lisp_Font_Instance *f, Lisp_Object name, | 217 tty_initialize_font_instance (Lisp_Font_Instance *f, Lisp_Object name, |
219 Lisp_Object device, Error_behavior errb) | 218 Lisp_Object device, Error_behavior errb) |
220 { | 219 { |
221 Bufbyte *str = XSTRING_DATA (name); | 220 Bufbyte *str = XSTRING_DATA (name); |
222 Lisp_Object charset = Qnil; | 221 Lisp_Object charset = Qnil; |
223 | 222 |
224 if (strncmp ((CONST char *) str, "normal", 6)) | 223 if (strncmp ((const char *) str, "normal", 6)) |
225 return 0; | 224 return 0; |
226 str += 6; | 225 str += 6; |
227 if (*str) | 226 if (*str) |
228 { | 227 { |
229 #ifdef MULE | 228 #ifdef MULE |
230 if (*str != '/') | 229 if (*str != '/') |
231 return 0; | 230 return 0; |
232 str++; | 231 str++; |
233 charset = Ffind_charset (intern ((CONST char *) str)); | 232 charset = Ffind_charset (intern ((const char *) str)); |
234 if (NILP (charset)) | 233 if (NILP (charset)) |
235 return 0; | 234 return 0; |
236 #else | 235 #else |
237 return 0; | 236 return 0; |
238 #endif | 237 #endif |
254 | 253 |
255 return 1; | 254 return 1; |
256 } | 255 } |
257 | 256 |
258 static void | 257 static void |
259 tty_mark_font_instance (struct Lisp_Font_Instance *f, | 258 tty_mark_font_instance (Lisp_Font_Instance *f) |
260 void (*markobj) (Lisp_Object)) | 259 { |
261 { | 260 mark_object (FONT_INSTANCE_TTY_CHARSET (f)); |
262 markobj (FONT_INSTANCE_TTY_CHARSET (f)); | 261 } |
263 } | 262 |
264 | 263 static void |
265 static void | 264 tty_print_font_instance (Lisp_Font_Instance *f, |
266 tty_print_font_instance (struct Lisp_Font_Instance *f, | |
267 Lisp_Object printcharfun, | 265 Lisp_Object printcharfun, |
268 int escapeflag) | 266 int escapeflag) |
269 { | 267 { |
270 } | 268 } |
271 | 269 |
272 static void | 270 static void |
273 tty_finalize_font_instance (struct Lisp_Font_Instance *f) | 271 tty_finalize_font_instance (Lisp_Font_Instance *f) |
274 { | 272 { |
275 if (f->data) | 273 if (f->data) |
276 xfree (f->data); | 274 xfree (f->data); |
277 } | 275 } |
278 | 276 |
284 | 282 |
285 #ifdef MULE | 283 #ifdef MULE |
286 | 284 |
287 static int | 285 static int |
288 tty_font_spec_matches_charset (struct device *d, Lisp_Object charset, | 286 tty_font_spec_matches_charset (struct device *d, Lisp_Object charset, |
289 CONST Bufbyte *nonreloc, Lisp_Object reloc, | 287 const Bufbyte *nonreloc, Lisp_Object reloc, |
290 Bytecount offset, Bytecount length) | 288 Bytecount offset, Bytecount length) |
291 { | 289 { |
292 CONST Bufbyte *the_nonreloc = nonreloc; | 290 const Bufbyte *the_nonreloc = nonreloc; |
293 | 291 |
294 if (!the_nonreloc) | 292 if (!the_nonreloc) |
295 the_nonreloc = XSTRING_DATA (reloc); | 293 the_nonreloc = XSTRING_DATA (reloc); |
296 fixup_internal_substring (nonreloc, reloc, offset, &length); | 294 fixup_internal_substring (nonreloc, reloc, offset, &length); |
297 the_nonreloc += offset; | 295 the_nonreloc += offset; |
298 | 296 |
299 if (UNBOUNDP (charset)) | 297 if (UNBOUNDP (charset)) |
300 return !memchr (the_nonreloc, '/', length); | 298 return !memchr (the_nonreloc, '/', length); |
301 the_nonreloc = (CONST Bufbyte *) memchr (the_nonreloc, '/', length); | 299 the_nonreloc = (const Bufbyte *) memchr (the_nonreloc, '/', length); |
302 if (!the_nonreloc) | 300 if (!the_nonreloc) |
303 return 0; | 301 return 0; |
304 the_nonreloc++; | 302 the_nonreloc++; |
305 { | 303 { |
306 struct Lisp_String *s = symbol_name (XSYMBOL (XCHARSET_NAME (charset))); | 304 Lisp_String *s = symbol_name (XSYMBOL (XCHARSET_NAME (charset))); |
307 return !strcmp ((CONST char *) the_nonreloc, | 305 return !strcmp ((const char *) the_nonreloc, |
308 (CONST char *) string_data (s)); | 306 (const char *) string_data (s)); |
309 } | 307 } |
310 } | 308 } |
311 | 309 |
312 /* find a font spec that matches font spec FONT and also matches | 310 /* find a font spec that matches font spec FONT and also matches |
313 (the registry of) CHARSET. */ | 311 (the registry of) CHARSET. */ |
315 tty_find_charset_font (Lisp_Object device, Lisp_Object font, | 313 tty_find_charset_font (Lisp_Object device, Lisp_Object font, |
316 Lisp_Object charset) | 314 Lisp_Object charset) |
317 { | 315 { |
318 Bufbyte *fontname = XSTRING_DATA (font); | 316 Bufbyte *fontname = XSTRING_DATA (font); |
319 | 317 |
320 if (strchr ((CONST char *) fontname, '/')) | 318 if (strchr ((const char *) fontname, '/')) |
321 { | 319 { |
322 if (tty_font_spec_matches_charset (XDEVICE (device), charset, 0, | 320 if (tty_font_spec_matches_charset (XDEVICE (device), charset, 0, |
323 font, 0, -1)) | 321 font, 0, -1)) |
324 return font; | 322 return font; |
325 return Qnil; | 323 return Qnil; |