Mercurial > hg > xemacs-beta
annotate src/console-impl.h @ 5908:6174848f3e6c
Use parse_integer() in read_atom(); support bases with ratios like integers
src/ChangeLog addition:
2015-05-08 Aidan Kehoe <kehoea@parhasard.net>
* data.c (init_errors_once_early):
Move the Qunsupported_type here from numbers.c, so it's available
when the majority of our types are not supported.
* general-slots.h: Add it here, too.
* number.c: Remove the definition of Qunsupported_type from here.
* lread.c (read_atom):
Check if the first character could reflect a rational, if so, call
parse_integer(), don't check the syntax of the other
characters. This allows us to accept the non-ASCII digit
characters too.
If that worked partially, but not completely, and the next char is
a slash, try to parse as a ratio.
If that fails, try isfloat_string(), but only if the first
character could plausibly be part of a float.
Otherwise, treat as a symbol.
* lread.c (read_rational):
Rename from read_integer. Handle ratios with the same radix
specification as was used for integers.
* lread.c (read1):
Rename read_integer in this function. Support the Common Lisp
#NNNrMMM syntax for parsing a number MMM of arbitrary radix NNN.
man/ChangeLog addition:
2015-05-08 Aidan Kehoe <kehoea@parhasard.net>
* lispref/numbers.texi (Numbers):
Describe the newly-supported arbitrary-base syntax for rationals
(integers and ratios). Describe that ratios can take the same base
specification as integers, something also new.
tests/ChangeLog addition:
2015-05-08 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-reader-tests.el:
Check the arbitrary-base integer reader syntax support, just
added. Check the reader base support for ratios, just added.
Check the non-ASCII-digit support in the reader, just added.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 09 May 2015 00:40:57 +0100 |
parents | 81fee4aee9b6 |
children | 574f0cded429 |
rev | line source |
---|---|
872 | 1 /* Define console object for XEmacs. |
5170
5ddbab03b0e6
various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents:
5157
diff
changeset
|
2 Copyright (C) 1996, 2002, 2003, 2005, 2010 Ben Wing |
872 | 3 |
4 This file is part of XEmacs. | |
5 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
6 XEmacs is free software: you can redistribute it and/or modify it |
872 | 7 under the terms of the GNU General Public License as published by the |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
8 Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
9 option) any later version. |
872 | 10 |
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
872 | 18 |
19 /* Synched up with: Not in FSF. */ | |
20 | |
21 /* Written by Ben Wing. */ | |
22 | |
23 #ifndef INCLUDED_console_impl_h_ | |
24 #define INCLUDED_console_impl_h_ | |
25 | |
26 #include "console.h" | |
3659 | 27 #include "specifier.h" |
872 | 28 |
1204 | 29 extern const struct sized_memory_description cted_description; |
30 extern const struct sized_memory_description console_methods_description; | |
872 | 31 |
32 | |
33 /* | |
34 * Constants returned by device_implementation_flags_method | |
35 */ | |
36 | |
37 /* Set when device uses pixel-based geometry */ | |
38 #define XDEVIMPF_PIXEL_GEOMETRY 0x00000001L | |
39 | |
40 /* Indicates that the device is a printer */ | |
41 #define XDEVIMPF_IS_A_PRINTER 0x00000002L | |
42 | |
43 /* Do not automatically redisplay this device */ | |
44 #define XDEVIMPF_NO_AUTO_REDISPLAY 0x00000004L | |
45 | |
46 /* Do not delete the device when last frame's gone */ | |
47 #define XDEVIMPF_FRAMELESS_OK 0x00000008L | |
48 | |
49 /* Do not preempt resiaply of frame or device once it starts */ | |
50 #define XDEVIMPF_DONT_PREEMPT_REDISPLAY 0x00000010L | |
51 | |
52 struct console_methods | |
53 { | |
54 const char *name; /* Used by print_console, print_device, print_frame */ | |
55 Lisp_Object symbol; | |
56 Lisp_Object predicate_symbol; | |
57 unsigned int flags; /* Read-only implementation flags, set once upon | |
58 console type creation. INITIALIZE_CONSOLE_TYPE sets | |
59 this member to 0. */ | |
60 | |
61 /* console methods */ | |
62 void (*init_console_method) (struct console *, Lisp_Object props); | |
63 void (*mark_console_method) (struct console *); | |
64 int (*initially_selected_for_input_method) (struct console *); | |
65 void (*delete_console_method) (struct console *); | |
66 Lisp_Object (*semi_canonicalize_console_connection_method) | |
67 (Lisp_Object connection, Error_Behavior errb); | |
68 Lisp_Object (*semi_canonicalize_device_connection_method) | |
69 (Lisp_Object connection, Error_Behavior errb); | |
70 Lisp_Object (*canonicalize_console_connection_method) | |
71 (Lisp_Object connection, Error_Behavior errb); | |
72 Lisp_Object (*canonicalize_device_connection_method) | |
73 (Lisp_Object connection, Error_Behavior errb); | |
74 Lisp_Object (*device_to_console_connection_method) | |
75 (Lisp_Object connection, Error_Behavior errb); | |
2828 | 76 Lisp_Object (*perhaps_init_unseen_key_defaults_method) |
77 (struct console *, Lisp_Object keysym); | |
872 | 78 |
79 /* device methods */ | |
80 void (*init_device_method) (struct device *, Lisp_Object props); | |
81 void (*finish_init_device_method) (struct device *, Lisp_Object props); | |
82 void (*delete_device_method) (struct device *); | |
83 void (*mark_device_method) (struct device *); | |
84 void (*asynch_device_change_method) (void); | |
85 Lisp_Object (*device_system_metrics_method) (struct device *, | |
86 enum device_metrics); | |
87 Lisp_Object (*own_selection_method)(Lisp_Object selection_name, | |
88 Lisp_Object selection_value, | |
89 Lisp_Object how_to_add, | |
90 Lisp_Object selection_type, | |
91 int owned_p); | |
92 void (*disown_selection_method)(Lisp_Object selection_name, | |
93 Lisp_Object timeval); | |
94 Lisp_Object (*get_foreign_selection_method) (Lisp_Object selection_symbol, | |
95 Lisp_Object target_type); | |
96 Lisp_Object (*selection_exists_p_method)(Lisp_Object selection_name, | |
97 Lisp_Object selection_type); | |
98 Lisp_Object (*available_selection_types_method)(Lisp_Object selection_name); | |
99 Lisp_Object (*register_selection_data_type_method)(Lisp_Object type_name); | |
100 Lisp_Object (*selection_data_type_name_method)(Lisp_Object type); | |
101 | |
102 /* frame methods */ | |
103 Lisp_Object *device_specific_frame_props; | |
104 void (*init_frame_1_method) (struct frame *, Lisp_Object properties, | |
105 int frame_name_is_defaulted); | |
106 void (*init_frame_2_method) (struct frame *, Lisp_Object properties); | |
107 void (*init_frame_3_method) (struct frame *); | |
108 void (*after_init_frame_method) (struct frame *, int first_on_device, | |
109 int first_on_console); | |
110 void (*mark_frame_method) (struct frame *); | |
111 void (*delete_frame_method) (struct frame *); | |
112 void (*focus_on_frame_method) (struct frame *); | |
113 void (*raise_frame_method) (struct frame *); | |
114 void (*lower_frame_method) (struct frame *); | |
115 void (*enable_frame_method) (struct frame *); | |
116 void (*disable_frame_method) (struct frame *); | |
117 int (*get_mouse_position_method) (struct device *d, Lisp_Object *frame, | |
118 int *x, int *y); | |
119 void (*set_mouse_position_method) (struct window *w, int x, int y); | |
120 void (*make_frame_visible_method) (struct frame *f); | |
121 void (*make_frame_invisible_method) (struct frame *f); | |
122 void (*iconify_frame_method) (struct frame *f); | |
123 Lisp_Object (*frame_property_method) (struct frame *f, Lisp_Object prop); | |
124 int (*internal_frame_property_p_method) (struct frame *f, | |
125 Lisp_Object prop); | |
126 Lisp_Object (*frame_properties_method) (struct frame *f); | |
127 void (*set_frame_properties_method) (struct frame *f, Lisp_Object plist); | |
128 void (*set_frame_size_method) (struct frame *f, int width, int height); | |
129 void (*set_frame_position_method) (struct frame *f, int xoff, int yoff); | |
130 int (*frame_visible_p_method) (struct frame *f); | |
131 int (*frame_totally_visible_p_method) (struct frame *f); | |
132 int (*frame_iconified_p_method) (struct frame *f); | |
133 void (*set_title_from_ibyte_method) (struct frame *f, Ibyte *title); | |
134 void (*set_icon_name_from_ibyte_method) (struct frame *f, Ibyte *title); | |
135 void (*set_frame_pointer_method) (struct frame *f); | |
136 void (*set_frame_icon_method) (struct frame *f); | |
137 void (*popup_menu_method) (Lisp_Object menu, Lisp_Object event); | |
138 Lisp_Object (*get_frame_parent_method) (struct frame *f); | |
139 void (*update_frame_external_traits_method) (struct frame *f, Lisp_Object name); | |
140 int (*frame_size_fixed_p_method) (struct frame *f); | |
141 void (*eject_page_method) (struct frame *f); | |
142 | |
143 /* redisplay methods */ | |
144 int (*left_margin_width_method) (struct window *); | |
145 int (*right_margin_width_method) (struct window *); | |
5628
81fee4aee9b6
text_width methods interface cleanup.
Didier Verna <didier@xemacs.org>
parents:
5515
diff
changeset
|
146 int (*text_width_method) (struct frame *f, struct face_cachel *cachel, |
872 | 147 const Ichar *str, Charcount len); |
148 void (*output_display_block_method) (struct window *, struct display_line *, | |
149 int, int, int, int, int, int, int); | |
150 int (*divider_height_method) (void); | |
151 int (*eol_cursor_width_method) (void); | |
152 void (*output_vertical_divider_method) (struct window *, int); | |
153 void (*clear_to_window_end_method) (struct window *, int, int); | |
5515
f87be7ddd60d
Simplify clear_region interface.
Didier Verna <didier@lrde.epita.fr>
parents:
5402
diff
changeset
|
154 void (*clear_region_method) (Lisp_Object, struct frame*, |
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
4928
diff
changeset
|
155 face_index, int, int, int, int, |
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
4928
diff
changeset
|
156 Lisp_Object, Lisp_Object, |
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
4928
diff
changeset
|
157 Lisp_Object, Lisp_Object); |
872 | 158 void (*clear_frame_method) (struct frame *); |
159 void (*window_output_begin_method) (struct window *); | |
160 void (*frame_output_begin_method) (struct frame *); | |
161 void (*window_output_end_method) (struct window *); | |
162 void (*frame_output_end_method) (struct frame *); | |
163 int (*flash_method) (struct device *); | |
164 void (*ring_bell_method) (struct device *, int volume, int pitch, | |
165 int duration); | |
166 void (*frame_redraw_cursor_method) (struct frame *f); | |
167 void (*set_final_cursor_coords_method) (struct frame *, int, int); | |
168 void (*bevel_area_method) (struct window *, face_index, int, int, int, int, int, | |
169 int, enum edge_style); | |
170 void (*output_pixmap_method) (struct window *w, Lisp_Object image_instance, | |
171 struct display_box *db, struct display_glyph_area *dga, | |
172 face_index findex, int cursor_start, int cursor_width, | |
173 int cursor_height, int offset_bitmap); | |
174 void (*output_string_method) (struct window *w, struct display_line *dl, | |
175 Ichar_dynarr *buf, int xpos, int xoffset, | |
176 int start_pixpos, int width, face_index findex, | |
177 int cursor, int cursor_start, int cursor_width, | |
178 int cursor_height); | |
179 | |
180 /* color methods */ | |
181 int (*initialize_color_instance_method) (Lisp_Color_Instance *, | |
182 Lisp_Object name, | |
183 Lisp_Object device, | |
184 Error_Behavior errb); | |
185 void (*mark_color_instance_method) (Lisp_Color_Instance *); | |
186 void (*print_color_instance_method) (Lisp_Color_Instance *, | |
187 Lisp_Object printcharfun, | |
188 int escapeflag); | |
189 void (*finalize_color_instance_method) (Lisp_Color_Instance *); | |
190 int (*color_instance_equal_method) (Lisp_Color_Instance *, | |
191 Lisp_Color_Instance *, | |
192 int depth); | |
193 Hashcode (*color_instance_hash_method) (Lisp_Color_Instance *, | |
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
5170
diff
changeset
|
194 int depth); |
872 | 195 Lisp_Object (*color_instance_rgb_components_method) (Lisp_Color_Instance *); |
196 int (*valid_color_name_p_method) (struct device *, Lisp_Object color); | |
2527 | 197 Lisp_Object (*color_list_method) (void); |
872 | 198 |
199 /* font methods */ | |
200 int (*initialize_font_instance_method) (Lisp_Font_Instance *, | |
201 Lisp_Object name, | |
202 Lisp_Object device, | |
203 Error_Behavior errb); | |
204 void (*mark_font_instance_method) (Lisp_Font_Instance *); | |
205 void (*print_font_instance_method) (Lisp_Font_Instance *, | |
206 Lisp_Object printcharfun, | |
207 int escapeflag); | |
208 void (*finalize_font_instance_method) (Lisp_Font_Instance *); | |
209 Lisp_Object (*font_instance_truename_method) (Lisp_Font_Instance *, | |
210 Error_Behavior errb); | |
211 Lisp_Object (*font_instance_properties_method) (Lisp_Font_Instance *); | |
2527 | 212 Lisp_Object (*font_list_method) (Lisp_Object pattern, |
1701 | 213 Lisp_Object device, |
214 Lisp_Object maxnumber); | |
3659 | 215 Lisp_Object (*find_charset_font_method) |
216 (Lisp_Object device, Lisp_Object font, Lisp_Object charset, | |
217 enum font_specifier_matchspec_stages stage); | |
218 int (*font_spec_matches_charset_method) | |
219 (struct device *d, Lisp_Object charset, const Ibyte *nonreloc, | |
220 Lisp_Object reloc, Bytecount offset, Bytecount length, | |
221 enum font_specifier_matchspec_stages stage); | |
872 | 222 |
223 /* image methods */ | |
224 void (*mark_image_instance_method) (Lisp_Image_Instance *); | |
225 void (*print_image_instance_method) (Lisp_Image_Instance *, | |
226 Lisp_Object printcharfun, | |
227 int escapeflag); | |
228 void (*finalize_image_instance_method) (Lisp_Image_Instance *); | |
229 void (*unmap_subwindow_method) (Lisp_Image_Instance *); | |
230 void (*map_subwindow_method) (Lisp_Image_Instance *, int x, int y, | |
231 struct display_glyph_area* dga); | |
232 void (*resize_subwindow_method) (Lisp_Image_Instance *, int w, int h); | |
233 void (*redisplay_subwindow_method) (Lisp_Image_Instance *); | |
234 void (*redisplay_widget_method) (Lisp_Image_Instance *); | |
235 /* Maybe this should be a specifier. Unfortunately specifiers don't | |
236 allow us to represent things at the toolkit level, which is what | |
237 is required here. */ | |
238 int (*widget_border_width_method) (void); | |
239 int (*widget_spacing_method) (Lisp_Image_Instance *); | |
240 int (*image_instance_equal_method) (Lisp_Image_Instance *, | |
241 Lisp_Image_Instance *, | |
242 int depth); | |
243 Hashcode (*image_instance_hash_method) (Lisp_Image_Instance *, | |
244 int depth); | |
245 void (*init_image_instance_from_eimage_method) (Lisp_Image_Instance *ii, | |
246 int width, int height, | |
247 int slices, | |
248 unsigned char *eimage, | |
249 int dest_mask, | |
250 Lisp_Object instantiator, | |
2959 | 251 Lisp_Object pointer_fg, |
252 Lisp_Object pointer_bg, | |
872 | 253 Lisp_Object domain); |
254 Lisp_Object (*locate_pixmap_file_method) (Lisp_Object file_method); | |
255 int (*colorize_image_instance_method) (Lisp_Object image_instance, | |
256 Lisp_Object fg, Lisp_Object bg); | |
257 void (*widget_query_string_geometry_method) (Lisp_Object string, | |
258 Lisp_Object face, | |
259 int* width, int* height, | |
260 Lisp_Object domain); | |
261 Lisp_Object image_conversion_list; | |
262 | |
263 #ifdef HAVE_TOOLBARS | |
264 /* toolbar methods */ | |
265 void (*output_frame_toolbars_method) (struct frame *); | |
905 | 266 void (*clear_frame_toolbars_method) (struct frame *); |
872 | 267 void (*initialize_frame_toolbars_method) (struct frame *); |
268 void (*free_frame_toolbars_method) (struct frame *); | |
269 void (*output_toolbar_button_method) (struct frame *, Lisp_Object); | |
270 void (*redraw_frame_toolbars_method) (struct frame *); | |
271 void (*redraw_exposed_toolbars_method) (struct frame *f, int x, int y, | |
272 int width, int height); | |
273 #endif | |
274 | |
275 #ifdef HAVE_SCROLLBARS | |
276 /* scrollbar methods */ | |
277 int (*inhibit_scrollbar_slider_size_change_method) (void); | |
278 void (*free_scrollbar_instance_method) (struct scrollbar_instance *); | |
279 void (*release_scrollbar_instance_method) (struct scrollbar_instance *); | |
280 void (*create_scrollbar_instance_method) (struct frame *, int, | |
281 struct scrollbar_instance *); | |
282 void (*update_scrollbar_instance_values_method) (struct window *, | |
283 struct scrollbar_instance *, | |
284 int, int, int, int, int, | |
285 int, int, int, int, int); | |
286 void (*update_scrollbar_instance_status_method) (struct window *, int, int, | |
287 struct | |
288 scrollbar_instance *); | |
289 void (*scrollbar_pointer_changed_in_window_method) (struct window *w); | |
290 #ifdef MEMORY_USAGE_STATS | |
5170
5ddbab03b0e6
various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents:
5157
diff
changeset
|
291 Bytecount (*compute_scrollbar_instance_usage_method) |
5ddbab03b0e6
various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents:
5157
diff
changeset
|
292 (struct device *, |
5ddbab03b0e6
various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents:
5157
diff
changeset
|
293 struct scrollbar_instance *, |
5ddbab03b0e6
various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents:
5157
diff
changeset
|
294 struct usage_stats *); |
872 | 295 #endif |
1318 | 296 /* Paint the window's deadbox, a rectangle between window |
297 borders and two short edges of both scrollbars. */ | |
298 void (*redisplay_deadbox_method) (struct window *w, int x, int y, int width, | |
299 int height); | |
872 | 300 #endif /* HAVE_SCROLLBARS */ |
301 | |
302 #ifdef HAVE_MENUBARS | |
303 /* menubar methods */ | |
304 void (*update_frame_menubars_method) (struct frame *); | |
305 void (*free_frame_menubars_method) (struct frame *); | |
306 #endif | |
307 | |
308 #ifdef HAVE_DIALOGS | |
309 /* dialog methods */ | |
310 Lisp_Object (*make_dialog_box_internal_method) (struct frame *, | |
311 Lisp_Object type, | |
312 Lisp_Object keys); | |
313 #endif | |
314 }; | |
315 | |
316 #define CONMETH_TYPE(meths) ((meths)->symbol) | |
317 #define CONMETH_IMPL_FLAG(meths, f) ((meths)->flags & (f)) | |
318 | |
319 #define CONSOLE_TYPE_NAME(c) ((c)->conmeths->name) | |
320 #define CONSOLE_TYPE(c) ((c)->conmeths->symbol) | |
321 #define CONSOLE_IMPL_FLAG(c, f) CONMETH_IMPL_FLAG ((c)->conmeths, (f)) | |
322 | |
323 /******** Accessing / calling a console method *********/ | |
324 | |
325 #define HAS_CONTYPE_METH_P(meth, m) ((meth)->m##_method) | |
326 #define CONTYPE_METH(meth, m, args) (((meth)->m##_method) args) | |
327 | |
328 /* Call a void-returning console method, if it exists */ | |
329 #define MAYBE_CONTYPE_METH(meth, m, args) do { \ | |
330 struct console_methods *maybe_contype_meth_meth = (meth); \ | |
331 if (HAS_CONTYPE_METH_P (maybe_contype_meth_meth, m)) \ | |
332 CONTYPE_METH (maybe_contype_meth_meth, m, args); \ | |
333 } while (0) | |
334 | |
335 /* Call a console method, if it exists; otherwise return | |
336 the specified value - meth is multiply evaluated. */ | |
337 #define CONTYPE_METH_OR_GIVEN(meth, m, args, given) \ | |
338 (HAS_CONTYPE_METH_P (meth, m) ? \ | |
339 CONTYPE_METH (meth, m, args) : (given)) | |
340 | |
341 /* Call an int-returning console method, if it exists; otherwise | |
342 return 0 */ | |
343 #define MAYBE_INT_CONTYPE_METH(meth, m, args) \ | |
344 CONTYPE_METH_OR_GIVEN (meth, m, args, 0) | |
345 | |
346 /* Call an Lisp-Object-returning console method, if it exists; | |
347 otherwise return Qnil */ | |
348 #define MAYBE_LISP_CONTYPE_METH(meth, m, args) \ | |
349 CONTYPE_METH_OR_GIVEN (meth, m, args, Qnil) | |
350 | |
351 /******** Same functions, operating on a console instead of a | |
352 struct console_methods ********/ | |
353 | |
354 #define HAS_CONMETH_P(c, m) HAS_CONTYPE_METH_P ((c)->conmeths, m) | |
355 #define CONMETH(c, m, args) CONTYPE_METH ((c)->conmeths, m, args) | |
356 #define MAYBE_CONMETH(c, m, args) MAYBE_CONTYPE_METH ((c)->conmeths, m, args) | |
357 #define CONMETH_OR_GIVEN(c, m, args, given) \ | |
358 CONTYPE_METH_OR_GIVEN((c)->conmeths, m, args, given) | |
359 #define MAYBE_INT_CONMETH(c, m, args) \ | |
360 MAYBE_INT_CONTYPE_METH ((c)->conmeths, m, args) | |
361 #define MAYBE_LISP_CONMETH(c, m, args) \ | |
362 MAYBE_LISP_CONTYPE_METH ((c)->conmeths, m, args) | |
363 | |
364 /******** Defining new console types ********/ | |
365 | |
366 typedef struct console_type_entry console_type_entry; | |
367 struct console_type_entry | |
368 { | |
369 Lisp_Object symbol; | |
370 struct console_methods *meths; | |
371 }; | |
372 | |
373 #define DECLARE_CONSOLE_TYPE(type) \ | |
374 extern struct console_methods * type##_console_methods | |
375 | |
376 #define DEFINE_CONSOLE_TYPE(type) \ | |
377 struct console_methods * type##_console_methods | |
378 | |
379 #define INITIALIZE_CONSOLE_TYPE(type, obj_name, pred_sym) do { \ | |
380 type##_console_methods = xnew_and_zero (struct console_methods); \ | |
381 type##_console_methods->name = obj_name; \ | |
382 type##_console_methods->symbol = Q##type; \ | |
383 defsymbol_nodump (&type##_console_methods->predicate_symbol, pred_sym); \ | |
384 add_entry_to_console_type_list (Q##type, type##_console_methods); \ | |
385 type##_console_methods->image_conversion_list = Qnil; \ | |
386 staticpro_nodump (&type##_console_methods->image_conversion_list); \ | |
2367 | 387 dump_add_root_block_ptr (&type##_console_methods, &console_methods_description); \ |
872 | 388 } while (0) |
389 | |
390 #define REINITIALIZE_CONSOLE_TYPE(type) do { \ | |
391 staticpro_nodump (&type##_console_methods->predicate_symbol); \ | |
392 staticpro_nodump (&type##_console_methods->image_conversion_list); \ | |
393 } while (0) | |
394 | |
395 | |
396 /* Declare that console-type TYPE has method M; used in | |
397 initialization routines */ | |
398 #define CONSOLE_HAS_METHOD(type, m) \ | |
399 (type##_console_methods->m##_method = type##_##m) | |
400 | |
401 /* Declare that console-type TYPE inherits method M | |
402 implementation from console-type FROMTYPE */ | |
403 #define CONSOLE_INHERITS_METHOD(type, fromtype, m) \ | |
404 (type##_console_methods->m##_method = fromtype##_##m) | |
405 | |
406 /* Define console type implementation flags */ | |
407 #define CONSOLE_IMPLEMENTATION_FLAGS(type, flg) \ | |
408 (type##_console_methods->flags = flg) | |
409 | |
410 struct console | |
411 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
412 NORMAL_LISP_OBJECT_HEADER header; |
872 | 413 |
414 /* Description of this console's methods. */ | |
415 struct console_methods *conmeths; | |
416 | |
1204 | 417 /* Enumerated constant listing which type of console this is (TTY, X, |
418 MS-Windows, etc.). This duplicates the symbol in conmeths->symbol, | |
419 which formerly was the only way to determine the console type. | |
420 We need this constant now for KKCC, so that it can be used in | |
421 an XD_UNION clause to determine the Lisp objects in console_data. */ | |
934 | 422 enum console_variant contype; |
423 | |
872 | 424 /* A structure of auxiliary data specific to the console type. |
425 struct x_console is used for X window frames; defined in console-x.h | |
426 struct tty_console is used to TTY's; defined in console-tty.h */ | |
427 void *console_data; | |
428 | |
429 /* ----- begin partially-completed console localization of | |
430 event loop ---- */ | |
431 | |
432 int local_var_flags; | |
433 | |
1204 | 434 #define MARKED_SLOT(x) Lisp_Object x; |
872 | 435 #include "conslots.h" |
436 | |
437 /* Where to store the next keystroke of the macro. | |
438 Index into con->kbd_macro_builder. */ | |
439 int kbd_macro_ptr; | |
440 | |
441 /* The finalized section of the macro starts at kbd_macro_buffer and | |
442 ends before this. This is not the same as kbd_macro_pointer, because | |
443 we advance this to kbd_macro_pointer when a key's command is complete. | |
444 This way, the keystrokes for "end-kbd-macro" are not included in the | |
445 macro. */ | |
446 int kbd_macro_end; | |
447 | |
448 /* ----- end partially-completed console localization of event loop ---- */ | |
449 | |
450 unsigned int input_enabled :1; | |
451 }; | |
452 | |
453 /* Redefine basic properties more efficiently */ | |
454 | |
455 #undef CONSOLE_LIVE_P | |
5124
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5120
diff
changeset
|
456 /* The following is the old way, but it can lead to crashes in certain |
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5120
diff
changeset
|
457 weird circumstances, where you might want to be printing a console via |
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5120
diff
changeset
|
458 debug_print() */ |
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5120
diff
changeset
|
459 /* #define CONSOLE_LIVE_P(con) (!EQ (CONSOLE_TYPE (con), Qdead)) */ |
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5120
diff
changeset
|
460 #define CONSOLE_LIVE_P(con) ((con)->contype != dead_console) |
872 | 461 #undef CONSOLE_DEVICE_LIST |
462 #define CONSOLE_DEVICE_LIST(con) ((con)->device_list) | |
463 | |
464 #define CONSOLE_TYPE_P(con, type) EQ (CONSOLE_TYPE (con), Q##type) | |
465 | |
466 #ifdef ERROR_CHECK_TYPES | |
467 DECLARE_INLINE_HEADER ( | |
468 struct console * | |
469 error_check_console_type (struct console *con, Lisp_Object sym) | |
470 ) | |
471 { | |
472 assert (EQ (CONSOLE_TYPE (con), sym)); | |
473 return con; | |
474 } | |
475 # define CONSOLE_TYPE_DATA(con, type) \ | |
476 (*(struct type##_console **) \ | |
477 &(error_check_console_type (con, Q##type))->console_data) | |
478 #else | |
479 # define CONSOLE_TYPE_DATA(con, type) \ | |
480 (*(struct type##_console **) &((con)->console_data)) | |
481 #endif | |
482 | |
483 #define CHECK_CONSOLE_TYPE(x, type) do { \ | |
484 CHECK_CONSOLE (x); \ | |
485 if (! CONSOLE_TYPE_P (XCONSOLE (x), type)) \ | |
486 dead_wrong_type_argument \ | |
487 (type##_console_methods->predicate_symbol, x); \ | |
488 } while (0) | |
489 #define CONCHECK_CONSOLE_TYPE(x, type) do { \ | |
490 CONCHECK_CONSOLE (x); \ | |
491 if (!(CONSOLEP (x) && \ | |
492 CONSOLE_TYPE_P (XCONSOLE (x), type))) \ | |
493 x = wrong_type_argument \ | |
494 (type##_console_methods->predicate_symbol, x); \ | |
495 } while (0) | |
496 | |
497 /* #### These should be in the console-*.h files but there are | |
498 too many places where the abstraction is broken. Need to | |
499 fix. */ | |
500 | |
501 #ifdef HAVE_GTK | |
502 #define CONSOLE_TYPESYM_GTK_P(typesym) EQ (typesym, Qgtk) | |
503 #else | |
504 #define CONSOLE_TYPESYM_GTK_P(typesym) 0 | |
505 #endif | |
506 | |
507 #ifdef HAVE_X_WINDOWS | |
508 #define CONSOLE_TYPESYM_X_P(typesym) EQ (typesym, Qx) | |
509 #else | |
510 #define CONSOLE_TYPESYM_X_P(typesym) 0 | |
511 #endif | |
512 #ifdef HAVE_TTY | |
513 #define CONSOLE_TYPESYM_TTY_P(typesym) EQ (typesym, Qtty) | |
514 #else | |
515 #define CONSOLE_TYPESYM_TTY_P(typesym) 0 | |
516 #endif | |
517 #ifdef HAVE_MS_WINDOWS | |
518 #define CONSOLE_TYPESYM_MSWINDOWS_P(typesym) EQ (typesym, Qmswindows) | |
519 #else | |
520 #define CONSOLE_TYPESYM_MSWINDOWS_P(typesym) 0 | |
521 #endif | |
522 #define CONSOLE_TYPESYM_STREAM_P(typesym) EQ (typesym, Qstream) | |
523 | |
524 #define CONSOLE_TYPESYM_WIN_P(typesym) \ | |
525 (CONSOLE_TYPESYM_GTK_P (typesym) || CONSOLE_TYPESYM_X_P (typesym) || CONSOLE_TYPESYM_MSWINDOWS_P (typesym)) | |
526 | |
527 #define CONSOLE_X_P(con) CONSOLE_TYPESYM_X_P (CONSOLE_TYPE (con)) | |
528 #define CHECK_X_CONSOLE(z) CHECK_CONSOLE_TYPE (z, x) | |
529 #define CONCHECK_X_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, x) | |
530 | |
531 #define CONSOLE_GTK_P(con) CONSOLE_TYPESYM_GTK_P (CONSOLE_TYPE (con)) | |
532 #define CHECK_GTK_CONSOLE(z) CHECK_CONSOLE_TYPE (z, gtk) | |
533 #define CONCHECK_GTK_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, gtk) | |
534 | |
535 #define CONSOLE_TTY_P(con) CONSOLE_TYPESYM_TTY_P (CONSOLE_TYPE (con)) | |
536 #define CHECK_TTY_CONSOLE(z) CHECK_CONSOLE_TYPE (z, tty) | |
537 #define CONCHECK_TTY_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, tty) | |
538 | |
539 #define CONSOLE_MSWINDOWS_P(con) CONSOLE_TYPESYM_MSWINDOWS_P (CONSOLE_TYPE (con)) | |
540 #define CHECK_MSWINDOWS_CONSOLE(z) CHECK_CONSOLE_TYPE (z, mswindows) | |
541 #define CONCHECK_MSWINDOWS_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, mswindows) | |
542 | |
543 #define CONSOLE_STREAM_P(con) CONSOLE_TYPESYM_STREAM_P (CONSOLE_TYPE (con)) | |
544 #define CHECK_STREAM_CONSOLE(z) CHECK_CONSOLE_TYPE (z, stream) | |
545 #define CONCHECK_STREAM_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, stream) | |
546 | |
547 #define CONSOLE_WIN_P(con) CONSOLE_TYPESYM_WIN_P (CONSOLE_TYPE (con)) | |
548 | |
549 /* This structure marks which slots in a console have corresponding | |
550 default values in console_defaults. | |
551 Each such slot has a nonzero value in this structure. | |
552 The value has only one nonzero bit. | |
553 | |
554 When a console has its own local value for a slot, | |
555 the bit for that slot (found in the same slot in this structure) | |
556 is turned on in the console's local_var_flags slot. | |
557 | |
558 If a slot in this structure is zero, then even though there may | |
559 be a DEFVAR_CONSOLE_LOCAL for the slot, there is no default value for it; | |
560 and the corresponding slot in console_defaults is not used. */ | |
561 | |
562 extern struct console console_local_flags; | |
563 | |
564 #define CONSOLE_NAME(con) ((con)->name) | |
565 #define CONSOLE_CONNECTION(con) ((con)->connection) | |
566 #define CONSOLE_CANON_CONNECTION(con) ((con)->canon_connection) | |
567 #define CONSOLE_FUNCTION_KEY_MAP(con) ((con)->function_key_map) | |
568 #define CONSOLE_SELECTED_DEVICE(con) ((con)->selected_device) | |
569 #define CONSOLE_SELECTED_FRAME(con) \ | |
570 DEVICE_SELECTED_FRAME (XDEVICE ((con)->selected_device)) | |
571 #define CONSOLE_LAST_NONMINIBUF_FRAME(con) NON_LVALUE ((con)->last_nonminibuf_frame) | |
572 #define CONSOLE_QUIT_CHAR(con) ((con)->quit_char) | |
1204 | 573 #define CONSOLE_QUIT_EVENT(con) ((con)->quit_event) |
574 #define CONSOLE_CRITICAL_QUIT_EVENT(con) ((con)->critical_quit_event) | |
872 | 575 |
576 DECLARE_CONSOLE_TYPE (dead); | |
577 | |
578 extern console_type_entry_dynarr *the_console_type_entry_dynarr; | |
579 | |
580 #endif /* INCLUDED_console_impl_h_ */ |