Mercurial > hg > xemacs-beta
comparison src/device-msw.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 | facf3239ba30 |
children | 229bd619740a |
comparison
equal
deleted
inserted
replaced
3091:c22d8984148c | 3092:141c2920ea48 |
---|---|
71 static const struct memory_description mswindows_device_data_description_1 [] = { | 71 static const struct memory_description mswindows_device_data_description_1 [] = { |
72 { XD_LISP_OBJECT, offsetof (struct mswindows_device, fontlist) }, | 72 { XD_LISP_OBJECT, offsetof (struct mswindows_device, fontlist) }, |
73 { XD_END } | 73 { XD_END } |
74 }; | 74 }; |
75 | 75 |
76 #ifdef NEW_GC | |
77 DEFINE_LRECORD_IMPLEMENTATION ("mswindows-device", mswindows_device, | |
78 1, /*dumpable-flag*/ | |
79 0, 0, 0, 0, 0, | |
80 mswindows_device_data_description_1, | |
81 Lisp_Mswindows_Device); | |
82 #else /* not NEW_GC */ | |
76 extern const struct sized_memory_description mswindows_device_data_description; | 83 extern const struct sized_memory_description mswindows_device_data_description; |
77 | 84 |
78 const struct sized_memory_description mswindows_device_data_description = { | 85 const struct sized_memory_description mswindows_device_data_description = { |
79 sizeof (struct mswindows_device), mswindows_device_data_description_1 | 86 sizeof (struct mswindows_device), mswindows_device_data_description_1 |
80 }; | 87 }; |
88 #endif /* not NEW_GC */ | |
81 | 89 |
82 static const struct memory_description msprinter_device_data_description_1 [] = { | 90 static const struct memory_description msprinter_device_data_description_1 [] = { |
83 { XD_LISP_OBJECT, offsetof (struct msprinter_device, name) }, | 91 { XD_LISP_OBJECT, offsetof (struct msprinter_device, name) }, |
84 { XD_LISP_OBJECT, offsetof (struct msprinter_device, devmode) }, | 92 { XD_LISP_OBJECT, offsetof (struct msprinter_device, devmode) }, |
85 { XD_LISP_OBJECT, offsetof (struct msprinter_device, fontlist) }, | 93 { XD_LISP_OBJECT, offsetof (struct msprinter_device, fontlist) }, |
86 { XD_END } | 94 { XD_END } |
87 }; | 95 }; |
88 | 96 |
97 #ifdef NEW_GC | |
98 DEFINE_LRECORD_IMPLEMENTATION ("msprinter-device", msprinter_device, | |
99 1, /*dumpable-flag*/ | |
100 0, 0, 0, 0, 0, | |
101 msprinter_device_data_description_1, | |
102 Lisp_Msprinter_Device); | |
103 #else /* not NEW_GC */ | |
89 extern const struct sized_memory_description msprinter_device_data_description; | 104 extern const struct sized_memory_description msprinter_device_data_description; |
90 | 105 |
91 const struct sized_memory_description msprinter_device_data_description = { | 106 const struct sized_memory_description msprinter_device_data_description = { |
92 sizeof (struct msprinter_device), msprinter_device_data_description_1 | 107 sizeof (struct msprinter_device), msprinter_device_data_description_1 |
93 }; | 108 }; |
109 #endif /* not NEW_GC */ | |
94 | 110 |
95 static Lisp_Object allocate_devmode (DEVMODEW *src_devmode, int do_copy, | 111 static Lisp_Object allocate_devmode (DEVMODEW *src_devmode, int do_copy, |
96 Lisp_Object src_name, struct device *d); | 112 Lisp_Object src_name, struct device *d); |
97 | 113 |
98 /************************************************************************/ | 114 /************************************************************************/ |
144 DEVICE_CLASS (d) = Qcolor; | 160 DEVICE_CLASS (d) = Qcolor; |
145 DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1; | 161 DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1; |
146 init_baud_rate (d); | 162 init_baud_rate (d); |
147 init_one_device (d); | 163 init_one_device (d); |
148 | 164 |
165 #ifdef NEW_GC | |
166 d->device_data = alloc_lrecord_type (struct mswindows_device, | |
167 &lrecord_mswindows_device); | |
168 #else /* not NEW_GC */ | |
149 d->device_data = xnew_and_zero (struct mswindows_device); | 169 d->device_data = xnew_and_zero (struct mswindows_device); |
170 #endif /* not NEW_GC */ | |
150 hdc = CreateCompatibleDC (NULL); | 171 hdc = CreateCompatibleDC (NULL); |
151 assert (hdc != NULL); | 172 assert (hdc != NULL); |
152 DEVICE_MSWINDOWS_HCDC (d) = hdc; | 173 DEVICE_MSWINDOWS_HCDC (d) = hdc; |
153 DEVICE_MSWINDOWS_FONTLIST (d) = mswindows_enumerate_fonts (hdc); | 174 DEVICE_MSWINDOWS_FONTLIST (d) = mswindows_enumerate_fonts (hdc); |
154 DEVICE_MSWINDOWS_UPDATE_TICK (d) = GetTickCount (); | 175 DEVICE_MSWINDOWS_UPDATE_TICK (d) = GetTickCount (); |
277 CoUninitialize (); | 298 CoUninitialize (); |
278 # endif | 299 # endif |
279 #endif | 300 #endif |
280 | 301 |
281 DeleteDC (DEVICE_MSWINDOWS_HCDC (d)); | 302 DeleteDC (DEVICE_MSWINDOWS_HCDC (d)); |
303 #ifdef NEW_GC | |
304 mc_free (d->device_data); | |
305 #else /* not NEW_GC */ | |
282 xfree (d->device_data, void *); | 306 xfree (d->device_data, void *); |
307 #endif /* not NEW_GC */ | |
283 } | 308 } |
284 | 309 |
285 void | 310 void |
286 mswindows_get_workspace_coords (RECT *rc) | 311 mswindows_get_workspace_coords (RECT *rc) |
287 { | 312 { |
493 { | 518 { |
494 DEVMODEW *pdm; | 519 DEVMODEW *pdm; |
495 LONG dm_size; | 520 LONG dm_size; |
496 Extbyte *printer_name; | 521 Extbyte *printer_name; |
497 | 522 |
523 #ifdef NEW_GC | |
524 d->device_data = alloc_lrecord_type (struct msprinter_device, | |
525 &lrecord_msprinter_device); | |
526 #else /* not NEW_GC */ | |
498 d->device_data = xnew_and_zero (struct msprinter_device); | 527 d->device_data = xnew_and_zero (struct msprinter_device); |
528 #endif /* not NEW_GC */ | |
499 | 529 |
500 DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1; | 530 DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1; |
501 DEVICE_MSPRINTER_DEVMODE (d) = Qnil; | 531 DEVICE_MSPRINTER_DEVMODE (d) = Qnil; |
502 DEVICE_MSPRINTER_NAME (d) = Qnil; | 532 DEVICE_MSPRINTER_NAME (d) = Qnil; |
503 | 533 |
544 { | 574 { |
545 XDEVMODE (DEVICE_MSPRINTER_DEVMODE (d))->device = Qnil; | 575 XDEVMODE (DEVICE_MSPRINTER_DEVMODE (d))->device = Qnil; |
546 DEVICE_MSPRINTER_DEVMODE (d) = Qnil; | 576 DEVICE_MSPRINTER_DEVMODE (d) = Qnil; |
547 } | 577 } |
548 | 578 |
579 #ifdef NEW_GC | |
580 mc_free (d->device_data); | |
581 #else /* not NEW_GC */ | |
549 xfree (d->device_data, void *); | 582 xfree (d->device_data, void *); |
583 #endif /* not NEW_GC */ | |
550 } | 584 } |
551 } | 585 } |
552 | 586 |
553 static Lisp_Object | 587 static Lisp_Object |
554 msprinter_device_system_metrics (struct device *d, | 588 msprinter_device_system_metrics (struct device *d, |
1343 void | 1377 void |
1344 syms_of_device_mswindows (void) | 1378 syms_of_device_mswindows (void) |
1345 { | 1379 { |
1346 INIT_LRECORD_IMPLEMENTATION (devmode); | 1380 INIT_LRECORD_IMPLEMENTATION (devmode); |
1347 | 1381 |
1382 #ifdef NEW_GC | |
1383 INIT_LRECORD_IMPLEMENTATION (mswindows_device); | |
1384 INIT_LRECORD_IMPLEMENTATION (msprinter_device); | |
1385 #endif /* NEW_GC */ | |
1386 | |
1348 DEFSUBR (Fmsprinter_get_settings); | 1387 DEFSUBR (Fmsprinter_get_settings); |
1349 DEFSUBR (Fmsprinter_select_settings); | 1388 DEFSUBR (Fmsprinter_select_settings); |
1350 DEFSUBR (Fmsprinter_apply_settings); | 1389 DEFSUBR (Fmsprinter_apply_settings); |
1351 DEFSUBR (Fmsprinter_settings_copy); | 1390 DEFSUBR (Fmsprinter_settings_copy); |
1352 DEFSUBR (Fmsprinter_settings_despecialize); | 1391 DEFSUBR (Fmsprinter_settings_despecialize); |