comparison src/device.c @ 934:c925bacdda60

[xemacs-hg @ 2002-07-29 09:21:12 by michaels] 2002-07-17 Marcus Crestani <crestani@informatik.uni-tuebingen.de> Markus Kaltenbach <makalten@informatik.uni-tuebingen.de> Mike Sperber <mike@xemacs.org> configure flag to turn these changes on: --use-kkcc First we added a dumpable flag to lrecord_implementation. It shows, if the object is dumpable and should be processed by the dumper. * lrecord.h (struct lrecord_implementation): added dumpable flag (MAKE_LRECORD_IMPLEMENTATION): fitted the different makro definitions to the new lrecord_implementation and their calls. Then we changed mark_object, that it no longer needs a mark method for those types that have pdump descritions. * alloc.c: (mark_object): If the object has a description, the new mark algorithm is called, and the object is marked according to its description. Otherwise it uses the mark method like before. These procedures mark objects according to their descriptions. They are modeled on the corresponding pdumper procedures. (mark_with_description): (get_indirect_count): (structure_size): (mark_struct_contents): These procedures still call mark_object, this is needed while there are Lisp_Objects without descriptions left. We added pdump descriptions for many Lisp_Objects: * extents.c: extent_auxiliary_description * database.c: database_description * gui.c: gui_item_description * scrollbar.c: scrollbar_instance_description * toolbar.c: toolbar_button_description * event-stream.c: command_builder_description * mule-charset.c: charset_description * device-msw.c: devmode_description * dialog-msw.c: mswindows_dialog_id_description * eldap.c: ldap_description * postgresql.c: pgconn_description pgresult_description * tooltalk.c: tooltalk_message_description tooltalk_pattern_description * ui-gtk.c: emacs_ffi_description emacs_gtk_object_description * events.c: * events.h: * event-stream.c: * event-Xt.c: * event-gtk.c: * event-tty.c: To write a pdump description for Lisp_Event, we converted every struct in the union event to a Lisp_Object. So we created nine new Lisp_Objects: Lisp_Key_Data, Lisp_Button_Data, Lisp_Motion_Data, Lisp_Process_Data, Lisp_Timeout_Data, Lisp_Eval_Data, Lisp_Misc_User_Data, Lisp_Magic_Data, Lisp_Magic_Eval_Data. We also wrote makro selectors and mutators for the fields of the new designed Lisp_Event and added everywhere these new abstractions. We implemented XD_UNION support in (mark_with_description), so we can describe exspecially console/device specific data with XD_UNION. To describe with XD_UNION, we added a field to these objects, which holds the variant type of the object. This field is initialized in the appendant constructor. The variant is an integer, it has also to be described in an description, if XD_UNION is used. XD_UNION is used in following descriptions: * console.c: console_description (get_console_variant): returns the variant (create_console): added variant initialization * console.h (console_variant): the different console types * console-impl.h (struct console): added enum console_variant contype * device.c: device_description (Fmake_device): added variant initialization * device-impl.h (struct device): added enum console_variant devtype * objects.c: image_instance_description font_instance_description (Fmake_color_instance): added variant initialization (Fmake_font_instance): added variant initialization * objects-impl.h (struct Lisp_Color_Instance): added color_instance_type * objects-impl.h (struct Lisp_Font_Instance): added font_instance_type * process.c: process_description (make_process_internal): added variant initialization * process.h (process_variant): the different process types
author michaels
date Mon, 29 Jul 2002 09:21:25 +0000
parents 79c6ff3eef26
children e22b0213b713
comparison
equal deleted inserted replaced
933:f6bc42928b34 934:c925bacdda60
43 #include "specifier.h" 43 #include "specifier.h"
44 #include "sysdep.h" 44 #include "sysdep.h"
45 #include "toolbar.h" 45 #include "toolbar.h"
46 #include "window.h" 46 #include "window.h"
47 47
48 #ifdef USE_KKCC
49 #include "console-tty-impl.h"
50 #ifdef HAVE_MS_WINDOWS
51 #include "console-msw-impl.h"
52 #endif
53 #ifdef HAVE_X_WINDOWS
54 #include "console-x-impl.h"
55 #endif
56 #ifdef HAVE_GTK
57 #include "console-gtk-impl.h"
58 #endif
59 #endif /* USE_KKCC */
60
48 #ifdef HAVE_SCROLLBARS 61 #ifdef HAVE_SCROLLBARS
49 #include "scrollbar.h" 62 #include "scrollbar.h"
50 #endif 63 #endif
51 64
52 #include "syssignal.h" 65 #include "syssignal.h"
82 Lisp_Object Qcreate_device_hook; 95 Lisp_Object Qcreate_device_hook;
83 Lisp_Object Qdelete_device_hook; 96 Lisp_Object Qdelete_device_hook;
84 Lisp_Object Vdevice_class_list; 97 Lisp_Object Vdevice_class_list;
85 98
86 99
100
101 #ifdef USE_KKCC
102
103 static const struct lrecord_description empty_devdata_description [] = {
104 { XD_END }
105 };
106
107 static const struct lrecord_description mswindows_devdata_description [] = {
108 #ifdef HAVE_MS_WINDOWS
109 { XD_LISP_OBJECT, offsetof (struct mswindows_device, fontlist) },
110 #endif
111 { XD_END }
112 };
113
114 static const struct lrecord_description gtk_devdata_description [] = {
115 #ifdef HAVE_GTK
116 { XD_LISP_OBJECT, offsetof (struct gtk_device, x_keysym_map_hash_table) },
117 { XD_LISP_OBJECT, offsetof (struct gtk_device, WM_COMMAND_frame) },
118 #endif
119 { XD_END }
120 };
121
122 static const struct lrecord_description x_devdata_description [] = {
123 #ifdef HAVE_X_WINDOWS
124 { XD_LISP_OBJECT, offsetof (struct x_device, x_keysym_map_hash_table) },
125 { XD_LISP_OBJECT, offsetof (struct x_device, WM_COMMAND_frame) },
126 #endif
127 { XD_END }
128 };
129
130 static const struct struct_description devdata_description []= {
131 { dead_console, empty_devdata_description},
132 { tty_console, empty_devdata_description},
133 { gtk_console, gtk_devdata_description},
134 { x_console, x_devdata_description},
135 { mswindows_console, mswindows_devdata_description},
136 { stream_console, empty_devdata_description},
137 { XD_END }
138 };
139
140 static const struct lrecord_description conmeths_description_1 [] = {
141 { XD_LISP_OBJECT, offsetof (struct console_methods, symbol) },
142 { XD_END }
143 };
144
145 static const struct struct_description conmeths_description = {
146 sizeof (struct console_methods),
147 conmeths_description_1
148 };
149
150 static const struct lrecord_description device_description [] = {
151 { XD_INT, offsetof (struct device, devtype) },
152 { XD_LISP_OBJECT, offsetof (struct device, name) },
153 { XD_LISP_OBJECT, offsetof (struct device, connection) },
154 { XD_LISP_OBJECT, offsetof (struct device, canon_connection) },
155 { XD_LISP_OBJECT, offsetof (struct device, frame_list) },
156 { XD_LISP_OBJECT, offsetof (struct device, console) },
157 { XD_LISP_OBJECT, offsetof (struct device, selected_frame) },
158 { XD_LISP_OBJECT, offsetof (struct device, frame_with_focus_real) },
159 { XD_LISP_OBJECT, offsetof (struct device, frame_with_focus_for_hooks) },
160 { XD_LISP_OBJECT, offsetof (struct device, frame_that_ought_to_have_focus) },
161 { XD_LISP_OBJECT, offsetof (struct device, device_class) },
162 { XD_LISP_OBJECT, offsetof (struct device, user_defined_tags) },
163 { XD_LISP_OBJECT, offsetof (struct device, color_instance_cache) },
164 { XD_LISP_OBJECT, offsetof (struct device, font_instance_cache) },
165 #ifdef MULE
166 { XD_LISP_OBJECT, offsetof (struct device, charset_font_cache_stage_1) },
167 { XD_LISP_OBJECT, offsetof (struct device, charset_font_cache_stage_2) },
168 #endif
169 { XD_LISP_OBJECT, offsetof (struct device, image_instance_cache) },
170 { XD_LISP_OBJECT, offsetof (struct device, frame_list) },
171 { XD_STRUCT_PTR, offsetof (struct device, devmeths), 1, &conmeths_description },
172 { XD_UNION, offsetof (struct device, device_data),
173 XD_INDIRECT (0, 0), devdata_description },
174 { XD_END }
175 };
176 #endif /* USE_KKCC */
177
87 static Lisp_Object 178 static Lisp_Object
88 mark_device (Lisp_Object obj) 179 mark_device (Lisp_Object obj)
89 { 180 {
90 struct device *d = XDEVICE (obj); 181 struct device *d = XDEVICE (obj);
91 182
115 if (DEVICE_LIVE_P (d) && !NILP (DEVICE_CONNECTION (d))) 206 if (DEVICE_LIVE_P (d) && !NILP (DEVICE_CONNECTION (d)))
116 write_fmt_string_lisp (printcharfun, " on %S", 1, DEVICE_CONNECTION (d)); 207 write_fmt_string_lisp (printcharfun, " on %S", 1, DEVICE_CONNECTION (d));
117 write_fmt_string (printcharfun, " 0x%x>", d->header.uid); 208 write_fmt_string (printcharfun, " 0x%x>", d->header.uid);
118 } 209 }
119 210
211 #ifdef USE_KKCC
212 DEFINE_LRECORD_IMPLEMENTATION ("device", device,
213 0, /*dumpable-flag*/
214 mark_device, print_device, 0, 0, 0,
215 device_description,
216 struct device);
217 #else /* not USE_KKCC */
120 DEFINE_LRECORD_IMPLEMENTATION ("device", device, 218 DEFINE_LRECORD_IMPLEMENTATION ("device", device,
121 mark_device, print_device, 0, 0, 0, 0, 219 mark_device, print_device, 0, 0, 0, 0,
122 struct device); 220 struct device);
221 #endif /* not USE_KKCC */
123 222
124 int 223 int
125 valid_device_class_p (Lisp_Object class) 224 valid_device_class_p (Lisp_Object class)
126 { 225 {
127 return !NILP (memq_no_quit (class, Vdevice_class_list)); 226 return !NILP (memq_no_quit (class, Vdevice_class_list));
601 con = XCONSOLE (console); 700 con = XCONSOLE (console);
602 d = allocate_device (console); 701 d = allocate_device (console);
603 device = wrap_device (d); 702 device = wrap_device (d);
604 703
605 d->devmeths = con->conmeths; 704 d->devmeths = con->conmeths;
705 #ifdef USE_KKCC
706 d->devtype = get_console_variant (type);
707 #endif /* USE_KKCC */
606 708
607 DEVICE_NAME (d) = name; 709 DEVICE_NAME (d) = name;
608 DEVICE_CONNECTION (d) = 710 DEVICE_CONNECTION (d) =
609 semi_canonicalize_device_connection (conmeths, connection, ERROR_ME); 711 semi_canonicalize_device_connection (conmeths, connection, ERROR_ME);
610 DEVICE_CANON_CONNECTION (d) = 712 DEVICE_CANON_CONNECTION (d) =