Mercurial > hg > xemacs-beta
comparison src/console.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 |
---|---|
103 Lisp_Object Vconsole_type_list; | 103 Lisp_Object Vconsole_type_list; |
104 | 104 |
105 console_type_entry_dynarr *the_console_type_entry_dynarr; | 105 console_type_entry_dynarr *the_console_type_entry_dynarr; |
106 | 106 |
107 | 107 |
108 | |
109 #ifdef USE_KKCC | |
110 | |
111 static const struct lrecord_description empty_condata_description [] = { | |
112 { XD_END } | |
113 }; | |
114 | |
115 static const struct lrecord_description tty_condata_description [] = { | |
116 { XD_LISP_OBJECT, offsetof (struct tty_console, terminal_type) }, | |
117 { XD_LISP_OBJECT, offsetof (struct tty_console, instream) }, | |
118 { XD_LISP_OBJECT, offsetof (struct tty_console, outstream) }, | |
119 { XD_END } | |
120 }; | |
121 | |
122 static const struct struct_description condata_description []= { | |
123 { dead_console, empty_condata_description }, | |
124 { tty_console, tty_condata_description }, | |
125 { gtk_console, empty_condata_description }, | |
126 { x_console, empty_condata_description }, | |
127 { mswindows_console, empty_condata_description }, | |
128 { stream_console, empty_condata_description }, | |
129 { XD_END } | |
130 }; | |
131 | |
132 static const struct lrecord_description conmeths_description_1 [] = { | |
133 { XD_LISP_OBJECT, offsetof (struct console_methods, symbol) }, | |
134 /*{ XD_LISP_OBJECT, offsetof (struct console_methods, predicate_symbol) }, | |
135 { XD_LISP_OBJECT, offsetof (struct console_methods, image_conversion_list) },*/ | |
136 { XD_END } | |
137 }; | |
138 | |
139 static const struct struct_description conmeths_description = { | |
140 sizeof (struct console_methods), | |
141 conmeths_description_1 | |
142 }; | |
143 | |
144 static const struct lrecord_description console_description [] = { | |
145 { XD_INT, offsetof (struct console, contype) }, | |
146 { XD_LISP_OBJECT, offsetof (struct console, name) }, | |
147 { XD_LISP_OBJECT, offsetof (struct console, connection) }, | |
148 { XD_LISP_OBJECT, offsetof (struct console, canon_connection) }, | |
149 { XD_LISP_OBJECT, offsetof (struct console, device_list) }, | |
150 { XD_LISP_OBJECT, offsetof (struct console, selected_device) }, | |
151 { XD_LISP_OBJECT, offsetof (struct console, last_nonminibuf_frame) }, | |
152 { XD_LISP_OBJECT, offsetof (struct console, overriding_terminal_local_map) }, | |
153 { XD_LISP_OBJECT, offsetof (struct console, last_command) }, | |
154 { XD_LISP_OBJECT, offsetof (struct console, prefix_arg) }, | |
155 { XD_LISP_OBJECT, offsetof (struct console, command_builder) }, | |
156 { XD_LISP_OBJECT, offsetof (struct console, defining_kbd_macro) }, | |
157 { XD_LISP_OBJECT, offsetof (struct console, kbd_macro_builder) }, | |
158 { XD_LISP_OBJECT, offsetof (struct console, last_kbd_macro) }, | |
159 #ifdef HAVE_TTY | |
160 { XD_LISP_OBJECT, offsetof (struct console, tty_erase_char) }, | |
161 #endif | |
162 { XD_LISP_OBJECT, offsetof (struct console, default_minibuffer_frame) }, | |
163 { XD_LISP_OBJECT, offsetof (struct console, function_key_map) }, | |
164 { XD_STRUCT_PTR, offsetof (struct console, conmeths), 1, &conmeths_description }, | |
165 { XD_UNION, offsetof (struct console, console_data), | |
166 XD_INDIRECT (0, 0), condata_description }, | |
167 { XD_END } | |
168 }; | |
169 | |
170 #endif /* USE_KKCC */ | |
171 | |
108 static Lisp_Object | 172 static Lisp_Object |
109 mark_console (Lisp_Object obj) | 173 mark_console (Lisp_Object obj) |
110 { | 174 { |
111 struct console *con = XCONSOLE (obj); | 175 struct console *con = XCONSOLE (obj); |
112 | 176 |
138 write_fmt_string_lisp (printcharfun, " on %S", 1, | 202 write_fmt_string_lisp (printcharfun, " on %S", 1, |
139 CONSOLE_CONNECTION (con)); | 203 CONSOLE_CONNECTION (con)); |
140 write_fmt_string (printcharfun, " 0x%x>", con->header.uid); | 204 write_fmt_string (printcharfun, " 0x%x>", con->header.uid); |
141 } | 205 } |
142 | 206 |
207 #ifdef USE_KKCC | |
208 DEFINE_LRECORD_IMPLEMENTATION ("console", console, | |
209 0, /*dumpable-flag*/ | |
210 mark_console, print_console, 0, 0, 0, | |
211 console_description, | |
212 struct console); | |
213 #else /* not USE_KKCC */ | |
143 DEFINE_LRECORD_IMPLEMENTATION ("console", console, | 214 DEFINE_LRECORD_IMPLEMENTATION ("console", console, |
144 mark_console, print_console, 0, 0, 0, 0, | 215 mark_console, print_console, 0, 0, 0, 0, |
145 struct console); | 216 struct console); |
217 #endif /* not USE_KKCC */ | |
146 | 218 |
147 static struct console * | 219 static struct console * |
148 allocate_console (void) | 220 allocate_console (void) |
149 { | 221 { |
150 Lisp_Object console; | 222 Lisp_Object console; |
188 | 260 |
189 maybe_invalid_constant ("Invalid console type", type, Qconsole, errb); | 261 maybe_invalid_constant ("Invalid console type", type, Qconsole, errb); |
190 | 262 |
191 return 0; | 263 return 0; |
192 } | 264 } |
265 | |
266 #ifdef USE_KKCC | |
267 enum console_variant | |
268 get_console_variant (Lisp_Object type) | |
269 { | |
270 if (EQ (type, Qtty)) | |
271 { | |
272 return tty_console; | |
273 } | |
274 | |
275 if (EQ (type, Qgtk)) | |
276 { | |
277 return gtk_console; | |
278 } | |
279 | |
280 if (EQ (type, Qx)) | |
281 { | |
282 return x_console; | |
283 } | |
284 | |
285 if (EQ (type, Qmswindows)) | |
286 { | |
287 return mswindows_console; | |
288 } | |
289 | |
290 if (EQ (type, Qstream)) | |
291 { | |
292 return stream_console; | |
293 } | |
294 | |
295 abort (); /* should never happen */ | |
296 return dead_console; | |
297 } | |
298 #endif /* USE_KKCC */ | |
193 | 299 |
194 int | 300 int |
195 valid_console_type_p (Lisp_Object type) | 301 valid_console_type_p (Lisp_Object type) |
196 { | 302 { |
197 return decode_console_type (type, ERROR_ME_NOT) != 0; | 303 return decode_console_type (type, ERROR_ME_NOT) != 0; |
491 console = wrap_console (con); | 597 console = wrap_console (con); |
492 | 598 |
493 GCPRO1 (console); | 599 GCPRO1 (console); |
494 | 600 |
495 con->conmeths = decode_console_type (type, ERROR_ME); | 601 con->conmeths = decode_console_type (type, ERROR_ME); |
602 #ifdef USE_KKCC | |
603 con->contype = get_console_variant (type); | |
604 #endif /* USE_KKCC */ | |
496 | 605 |
497 CONSOLE_NAME (con) = name; | 606 CONSOLE_NAME (con) = name; |
498 CONSOLE_CONNECTION (con) = | 607 CONSOLE_CONNECTION (con) = |
499 semi_canonicalize_console_connection (con->conmeths, connection, | 608 semi_canonicalize_console_connection (con->conmeths, connection, |
500 ERROR_ME); | 609 ERROR_ME); |