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