Mercurial > hg > xemacs-beta
comparison src/objects-tty.c @ 3092:141c2920ea48
[xemacs-hg @ 2005-11-25 01:41:31 by crestani]
Incremental Garbage Collector
author | crestani |
---|---|
date | Fri, 25 Nov 2005 01:42:08 +0000 |
parents | 491f8cf78a9c |
children | 98af8a976fc3 |
comparison
equal
deleted
inserted
replaced
3091:c22d8984148c | 3092:141c2920ea48 |
---|---|
40 static const struct memory_description tty_color_instance_data_description_1 [] = { | 40 static const struct memory_description tty_color_instance_data_description_1 [] = { |
41 { XD_LISP_OBJECT, offsetof (struct tty_color_instance_data, symbol) }, | 41 { XD_LISP_OBJECT, offsetof (struct tty_color_instance_data, symbol) }, |
42 { XD_END } | 42 { XD_END } |
43 }; | 43 }; |
44 | 44 |
45 #ifdef NEW_GC | |
46 DEFINE_LRECORD_IMPLEMENTATION ("tty-color-instance-data", | |
47 tty_color_instance_data, | |
48 0, /*dumpable-flag*/ | |
49 0, 0, 0, 0, 0, | |
50 tty_color_instance_data_description_1, | |
51 struct tty_color_instance_data); | |
52 #else /* not NEW_GC */ | |
45 const struct sized_memory_description tty_color_instance_data_description = { | 53 const struct sized_memory_description tty_color_instance_data_description = { |
46 sizeof (struct tty_color_instance_data), tty_color_instance_data_description_1 | 54 sizeof (struct tty_color_instance_data), tty_color_instance_data_description_1 |
47 }; | 55 }; |
56 #endif /* not NEW_GC */ | |
48 | 57 |
49 static const struct memory_description tty_font_instance_data_description_1 [] = { | 58 static const struct memory_description tty_font_instance_data_description_1 [] = { |
50 { XD_LISP_OBJECT, offsetof (struct tty_font_instance_data, charset) }, | 59 { XD_LISP_OBJECT, offsetof (struct tty_font_instance_data, charset) }, |
51 { XD_END } | 60 { XD_END } |
52 }; | 61 }; |
53 | 62 |
63 #ifdef NEW_GC | |
64 DEFINE_LRECORD_IMPLEMENTATION ("tty-font-instance-data", | |
65 tty_font_instance_data, | |
66 0, /*dumpable-flag*/ | |
67 0, 0, 0, 0, 0, | |
68 tty_font_instance_data_description_1, | |
69 struct tty_font_instance_data); | |
70 #else /* not NEW_GC */ | |
54 const struct sized_memory_description tty_font_instance_data_description = { | 71 const struct sized_memory_description tty_font_instance_data_description = { |
55 sizeof (struct tty_font_instance_data), tty_font_instance_data_description_1 | 72 sizeof (struct tty_font_instance_data), tty_font_instance_data_description_1 |
56 }; | 73 }; |
74 #endif /* not NEW_GC */ | |
57 | 75 |
58 DEFUN ("register-tty-color", Fregister_tty_color, 3, 3, 0, /* | 76 DEFUN ("register-tty-color", Fregister_tty_color, 3, 3, 0, /* |
59 Register COLOR as a recognized TTY color. | 77 Register COLOR as a recognized TTY color. |
60 COLOR should be a string. | 78 COLOR should be a string. |
61 Strings FG-STRING and BG-STRING should specify the escape sequences to | 79 Strings FG-STRING and BG-STRING should specify the escape sequences to |
174 #endif | 192 #endif |
175 return 0; | 193 return 0; |
176 } | 194 } |
177 | 195 |
178 /* Don't allocate the data until we're sure that we will succeed. */ | 196 /* Don't allocate the data until we're sure that we will succeed. */ |
197 #ifdef NEW_GC | |
198 c->data = alloc_lrecord_type (struct tty_color_instance_data, | |
199 &lrecord_tty_color_instance_data); | |
200 #else /* not NEW_GC */ | |
179 c->data = xnew (struct tty_color_instance_data); | 201 c->data = xnew (struct tty_color_instance_data); |
202 #endif /* not NEW_GC */ | |
180 COLOR_INSTANCE_TTY_SYMBOL (c) = name; | 203 COLOR_INSTANCE_TTY_SYMBOL (c) = name; |
181 | 204 |
182 return 1; | 205 return 1; |
183 } | 206 } |
184 | 207 |
197 | 220 |
198 static void | 221 static void |
199 tty_finalize_color_instance (Lisp_Color_Instance *c) | 222 tty_finalize_color_instance (Lisp_Color_Instance *c) |
200 { | 223 { |
201 if (c->data) | 224 if (c->data) |
225 #ifdef NEW_GC | |
226 mc_free (c->data); | |
227 #else /* not NEW_GC */ | |
202 xfree (c->data, void *); | 228 xfree (c->data, void *); |
229 #endif /* not NEW_GC */ | |
203 } | 230 } |
204 | 231 |
205 static int | 232 static int |
206 tty_color_instance_equal (Lisp_Color_Instance *c1, | 233 tty_color_instance_equal (Lisp_Color_Instance *c1, |
207 Lisp_Color_Instance *c2, | 234 Lisp_Color_Instance *c2, |
252 return 0; | 279 return 0; |
253 #endif | 280 #endif |
254 } | 281 } |
255 | 282 |
256 /* Don't allocate the data until we're sure that we will succeed. */ | 283 /* Don't allocate the data until we're sure that we will succeed. */ |
284 #ifdef NEW_GC | |
285 f->data = alloc_lrecord_type (struct tty_font_instance_data, | |
286 &lrecord_tty_font_instance_data); | |
287 #else /* not NEW_GC */ | |
257 f->data = xnew (struct tty_font_instance_data); | 288 f->data = xnew (struct tty_font_instance_data); |
289 #endif /* not NEW_GC */ | |
258 FONT_INSTANCE_TTY_CHARSET (f) = charset; | 290 FONT_INSTANCE_TTY_CHARSET (f) = charset; |
259 #ifdef MULE | 291 #ifdef MULE |
260 if (CHARSETP (charset)) | 292 if (CHARSETP (charset)) |
261 f->width = XCHARSET_COLUMNS (charset); | 293 f->width = XCHARSET_COLUMNS (charset); |
262 else | 294 else |
285 | 317 |
286 static void | 318 static void |
287 tty_finalize_font_instance (Lisp_Font_Instance *f) | 319 tty_finalize_font_instance (Lisp_Font_Instance *f) |
288 { | 320 { |
289 if (f->data) | 321 if (f->data) |
322 #ifdef NEW_GC | |
323 mc_free (f->data); | |
324 #else /* not NEW_GC */ | |
290 xfree (f->data, void *); | 325 xfree (f->data, void *); |
326 #endif /* not NEW_GC */ | |
291 } | 327 } |
292 | 328 |
293 static Lisp_Object | 329 static Lisp_Object |
294 tty_font_list (Lisp_Object UNUSED (pattern), Lisp_Object UNUSED (device), | 330 tty_font_list (Lisp_Object UNUSED (pattern), Lisp_Object UNUSED (device), |
295 Lisp_Object UNUSED (maxnumber)) | 331 Lisp_Object UNUSED (maxnumber)) |
361 /************************************************************************/ | 397 /************************************************************************/ |
362 | 398 |
363 void | 399 void |
364 syms_of_objects_tty (void) | 400 syms_of_objects_tty (void) |
365 { | 401 { |
402 #ifdef NEW_GC | |
403 INIT_LRECORD_IMPLEMENTATION (tty_color_instance_data); | |
404 INIT_LRECORD_IMPLEMENTATION (tty_font_instance_data); | |
405 #endif /* NEW_GC */ | |
406 | |
366 DEFSUBR (Fregister_tty_color); | 407 DEFSUBR (Fregister_tty_color); |
367 DEFSUBR (Funregister_tty_color); | 408 DEFSUBR (Funregister_tty_color); |
368 DEFSUBR (Ffind_tty_color); | 409 DEFSUBR (Ffind_tty_color); |
369 #if 0 | 410 #if 0 |
370 DEFSUBR (Fset_tty_dynamic_color_specs); | 411 DEFSUBR (Fset_tty_dynamic_color_specs); |