diff src/device-msw.c @ 5118:e0db3c197671 ben-lisp-object

merge up to latest default branch, doesn't compile yet
author Ben Wing <ben@xemacs.org>
date Sat, 26 Dec 2009 21:18:49 -0600
parents 3742ea8250b5 e34711681f30
children d1247f3cc363
line wrap: on
line diff
--- a/src/device-msw.c	Sat Dec 26 00:20:27 2009 -0600
+++ b/src/device-msw.c	Sat Dec 26 21:18:49 2009 -0600
@@ -60,7 +60,8 @@
 HSZ mswindows_dde_item_open;
 #endif
 
-Lisp_Object Qinit_pre_mswindows_win, Qinit_post_mswindows_win;
+Lisp_Object Qmake_device_early_mswindows_entry_point, 
+  Qmake_device_late_mswindows_entry_point;
 Lisp_Object Qdevmodep;
 
 static Lisp_Object Q_allow_selection;
@@ -73,11 +74,17 @@
   { XD_END }
 };
 
+#ifdef NEW_GC
+DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("mswindows-device", mswindows_device,
+				      0, mswindows_device_data_description_1,
+				      Lisp_Mswindows_Device);
+#else /* not NEW_GC */
 extern const struct sized_memory_description mswindows_device_data_description;
 
 const struct sized_memory_description mswindows_device_data_description = {
   sizeof (struct mswindows_device), mswindows_device_data_description_1
 };
+#endif /* not NEW_GC */
 
 static const struct memory_description msprinter_device_data_description_1 [] = {
   { XD_LISP_OBJECT, offsetof (struct msprinter_device, name) },
@@ -86,11 +93,17 @@
   { XD_END }
 };
 
+#ifdef NEW_GC
+DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("msprinter-device", msprinter_device,
+				      0, msprinter_device_data_description_1,
+				      Lisp_Msprinter_Device);
+#else /* not NEW_GC */
 extern const struct sized_memory_description msprinter_device_data_description;
 
 const struct sized_memory_description msprinter_device_data_description = {
   sizeof (struct msprinter_device), msprinter_device_data_description_1
 };
+#endif /* not NEW_GC */
 
 static Lisp_Object allocate_devmode (DEVMODEW *src_devmode, int do_copy,
 				     Lisp_Object src_name, struct device *d);
@@ -141,12 +154,19 @@
   HDC hdc;
   WNDCLASSEXW wc;
 
+  call0 (Qmake_device_early_mswindows_entry_point);
+
   DEVICE_CLASS (d) = Qcolor;
   DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1;
   init_baud_rate (d);
   init_one_device (d);
 
+#ifdef NEW_GC
+  d->device_data = alloc_lrecord_type (struct mswindows_device,
+				       &lrecord_mswindows_device);
+#else /* not NEW_GC */
   d->device_data = xnew_and_zero (struct mswindows_device);
+#endif /* not NEW_GC */
   hdc = CreateCompatibleDC (NULL);
   assert (hdc != NULL);
   DEVICE_MSWINDOWS_HCDC (d) = hdc;
@@ -252,13 +272,14 @@
 }
 
 static void
-mswindows_finish_init_device (struct device *UNUSED (d),
+mswindows_finish_init_device (struct device *d,
 			      Lisp_Object UNUSED (props))
 {
 #ifdef HAVE_DRAGNDROP
   /* Tell pending clients we are ready. */
   mswindows_dde_enable = 1;
 #endif
+  call1 (Qmake_device_late_mswindows_entry_point, wrap_device(d));
 }
 
 static void
@@ -279,7 +300,9 @@
 #endif
 
   DeleteDC (DEVICE_MSWINDOWS_HCDC (d));
+#ifndef NEW_GC
   xfree (d->device_data, void *);
+#endif /* not NEW_GC */
 }
 
 void
@@ -495,7 +518,12 @@
   LONG dm_size;
   Extbyte *printer_name;
 
+#ifdef NEW_GC
+  d->device_data = alloc_lrecord_type (struct msprinter_device,
+				       &lrecord_msprinter_device);
+#else /* not NEW_GC */
   d->device_data = xnew_and_zero (struct msprinter_device);
+#endif /* not NEW_GC */
 
   DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1;
   DEVICE_MSPRINTER_DEVMODE (d) = Qnil;
@@ -546,7 +574,9 @@
 	  DEVICE_MSPRINTER_DEVMODE (d) = Qnil;
 	}
 
+#ifndef NEW_GC
       xfree (d->device_data, void *);
+#endif /* not NEW_GC */
     }
 }
 
@@ -1175,7 +1205,7 @@
 		internal_hash (dm->printer_name, depth + 1));
 }
 
-DEFINE_NONDUMPABLE_LISP_OBJECT ("msprinter-settings", devmode,
+DEFINE_NODUMP_LISP_OBJECT ("msprinter-settings", devmode,
 					   mark_devmode, print_devmode,
 					   finalize_devmode,
 					   equal_devmode, hash_devmode, 
@@ -1344,6 +1374,11 @@
 {
   INIT_LISP_OBJECT (devmode);
 
+#ifdef NEW_GC
+  INIT_LISP_OBJECT (mswindows_device);
+  INIT_LISP_OBJECT (msprinter_device);
+#endif /* NEW_GC */
+
   DEFSUBR (Fmsprinter_get_settings);
   DEFSUBR (Fmsprinter_select_settings);
   DEFSUBR (Fmsprinter_apply_settings);
@@ -1357,8 +1392,8 @@
   DEFKEYWORD (Q_selected_page_button);
   DEFSYMBOL (Qselected_page_button);
 
-  DEFSYMBOL (Qinit_pre_mswindows_win);
-  DEFSYMBOL (Qinit_post_mswindows_win);
+  DEFSYMBOL (Qmake_device_early_mswindows_entry_point);
+  DEFSYMBOL (  Qmake_device_late_mswindows_entry_point);
 }
 
 void