Mercurial > hg > xemacs-beta
annotate lwlib/lwlib.h @ 5916:1152e0091f8c
Avoid confusion about ELC vs. source file encoding, #'load, #'load-internal.
lisp/ChangeLog addition:
2015-06-03 Aidan Kehoe <kehoea@parhasard.net>
* code-files.el (load):
Revise this to respect load-ignore-out-of-date-elc-files, rather
than leaving that to #'load-internal. Avoids a corner case where
the source and the compiled file have different, incompatible
encodings.
Move the call to #'substitute-in-file-name here.
No longer check for a zero-length filename, since #'load-internal
no longer chokes on same and errors correctly.
src/ChangeLog addition:
2015-06-03 Aidan Kehoe <kehoea@parhasard.net>
* lread.c (Fload_internal):
Delegate calling the handler and #'substitute-in-file-name to #'load.
Error correctly with a zero-length file name, instead of giving a
bus error on my machine.
Delegate the check for out-of-date ELC files to #'load,
avoiding a bug where the encoding of the ELC file and the source
file differed.
* lread.c (PRINT_LOADING_MESSAGE_1):
This is simplified, now we no longer have to talk about
out-of-date ELC files.
tests/ChangeLog addition:
2015-06-03 Aidan Kehoe <kehoea@parhasard.net>
* automated/file-tests.el:
Gross sanity check for #'load and #'load-internal with a
zero-length FILE, something that crashed until today.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Wed, 03 Jun 2015 20:13:07 +0100 |
parents | ade4c7e2c6cb |
children |
rev | line source |
---|---|
5422
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
1 /* A general interface to the widgets of different toolkits. |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
2 Copyright (C) 1992, 1993, 1994 Lucid, Inc. |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp. |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
4 |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
5 This file is part of the Lucid Widget Library. |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
6 |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
7 The Lucid Widget Library is free software: you can redistribute it |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
8 and/or modify it under the terms of the GNU General Public License as |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
9 published by the Free Software Foundation, either version 3 of the |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
10 License, or (at your option) any later version. |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
11 |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
12 The Lucid Widget Library is distributed in the hope that it will be |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
15 General Public License for more details. |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
16 |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
18 along with the Lucid Widget Library. If not, see |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
19 <http://www.gnu.org/licenses/>. */ |
ade4c7e2c6cb
Migrate lwlib/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
4528
diff
changeset
|
20 |
440 | 21 #ifndef INCLUDED_lwlib_h_ |
22 #define INCLUDED_lwlib_h_ | |
428 | 23 |
24 #include <X11/Intrinsic.h> | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
25 #include "xt-wrappers.h" |
428 | 26 |
27 #if defined (LWLIB_MENUBARS_LUCID) || defined (LWLIB_MENUBARS_MOTIF) || defined (LWLIB_MENUBARS_ATHENA) | |
28 #define NEED_MENUBARS | |
29 #endif | |
30 #if defined (LWLIB_SCROLLBARS_LUCID) || defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_ATHENA) | |
31 #define NEED_SCROLLBARS | |
32 #endif | |
33 #if defined (LWLIB_DIALOGS_LUCID) || defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_DIALOGS_ATHENA) | |
34 #define NEED_DIALOGS | |
35 #endif | |
36 | |
37 /* | |
38 ** Widget values depend on the Widget type: | |
39 ** | |
40 ** widget: (name value key enabled data contents/selected) | |
41 ** | |
42 ** label: ("name" "string" NULL NULL NULL NULL) | |
43 ** BUTTON: ("name" "string" "key" T/F data <default-button-p>) | |
44 ** CASCADE (button w/menu): | |
45 ** ("name" "string" "key" T/F data (label|button|button w/menu...)) | |
46 ** INCREMENTAL (button w/menu construction callback): | |
47 ** ("name" "string" NULL T/F <opaque pointer>) | |
48 ** menubar: ("name" NULL NULL T/F data (button w/menu)) | |
49 ** scrollbar:("name" NULL NULL T/F NULL NULL) | |
50 ** selectable thing: | |
51 ** ("name" "string" "key" T/F data T/F) | |
52 ** checkbox: selectable thing | |
53 ** radio: ("name" NULL NULL T/F data (selectable thing...)) | |
54 ** strings: ("name" NULL NULL T/F data (selectable thing...)) | |
55 ** TEXT: ("name" "string" <ign> T/F data) | |
56 ** | |
57 ** Note that the above is EXTREMELY bogus. The "type" of the various entities | |
58 ** that a widget_value structure can represent is implicit in the contents of | |
59 ** half a dozen slots, instead of there simply being a type field. This | |
60 ** should all be rethunk. I've added a type field, but for now it's only used | |
61 ** by the new xlwmenu code. | |
62 */ | |
63 | |
64 typedef unsigned long LWLIB_ID; | |
65 | |
66 typedef enum _change_type | |
67 { | |
68 NO_CHANGE = 0, | |
69 INVISIBLE_CHANGE = 1, | |
70 VISIBLE_CHANGE = 2, | |
71 STRUCTURAL_CHANGE = 3 | |
72 } change_type; | |
73 | |
74 typedef enum _widget_value_type | |
75 { | |
76 UNSPECIFIED_TYPE = 0, | |
77 BUTTON_TYPE = 1, | |
78 TOGGLE_TYPE = 2, | |
79 RADIO_TYPE = 3, | |
80 TEXT_TYPE = 4, | |
81 SEPARATOR_TYPE = 5, | |
82 CASCADE_TYPE = 6, | |
83 PUSHRIGHT_TYPE = 7, | |
84 INCREMENTAL_TYPE = 8 | |
85 } widget_value_type; | |
86 | |
87 typedef enum _scroll_action | |
88 { | |
89 SCROLLBAR_LINE_UP = 0, | |
90 SCROLLBAR_LINE_DOWN = 1, | |
91 SCROLLBAR_PAGE_UP = 2, | |
92 SCROLLBAR_PAGE_DOWN = 3, | |
93 SCROLLBAR_DRAG = 4, | |
94 SCROLLBAR_CHANGE = 5, | |
95 SCROLLBAR_TOP = 6, | |
96 SCROLLBAR_BOTTOM = 7 | |
97 } scroll_action; | |
98 | |
99 typedef struct _scroll_event | |
100 { | |
101 scroll_action action; | |
102 int slider_value; | |
103 Time time; | |
104 } scroll_event; | |
105 | |
106 typedef struct _scrollbar_values | |
107 { | |
108 int line_increment; | |
109 int page_increment; | |
110 | |
111 int minimum; | |
112 int maximum; | |
113 | |
114 int slider_size; | |
115 int slider_position; | |
116 | |
117 int scrollbar_width, scrollbar_height; | |
118 int scrollbar_x, scrollbar_y; | |
119 } scrollbar_values; | |
120 | |
434 | 121 typedef struct _widget_args |
122 { | |
123 /* some things are only possible at creation time. args are applied | |
124 to widgets at creation time. */ | |
125 ArgList args; | |
126 int nargs; | |
127 /* Copying args is impossible so we make the caller give us heap allocated | |
444 | 128 args and free them when no one wants them any more. */ |
434 | 129 int ref_count; |
450 | 130 /* Since we are reference counting we need to be able to determine |
131 when something has changed. */ | |
132 Boolean args_changed; | |
434 | 133 } widget_args; |
134 | |
428 | 135 typedef struct _widget_value |
136 { | |
137 /* This slot is only partially utilized right now. */ | |
138 widget_value_type type; | |
139 | |
140 /* name of widget */ | |
141 char* name; | |
444 | 142 /* value (meaning BOGUSLY depends on widget type) */ |
428 | 143 char* value; |
144 /* keyboard equivalent. no implications for XtTranslations */ | |
145 char* key; | |
146 /* accelerator key. For XEmacs, this should be a Lisp_Object holding a | |
147 char or symbol suitable for passing to event_matches_key_specifier_p. | |
148 Outside of emacs, this can be anything: an X KeySym is a good idea. | |
149 lwlib provides support functions for keyboard traversal of menus. Actual | |
150 implementation of those accelerators is up to the application. | |
151 */ | |
152 XtPointer accel; | |
153 /* true if enabled */ | |
154 Boolean enabled; | |
155 /* true if selected */ | |
156 Boolean selected; | |
157 /* true if was edited (maintained by get_value) */ | |
158 Boolean edited; | |
159 /* true if has changed (maintained by lw library) */ | |
160 change_type change; | |
444 | 161 /* Contents of sub-widgets, also selected slot for checkbox */ |
428 | 162 struct _widget_value* contents; |
163 /* data passed to callback */ | |
164 XtPointer call_data; | |
444 | 165 /* next in the list of siblings */ |
428 | 166 struct _widget_value* next; |
167 /* slot for the toolkit dependent part. Always initialize to NULL. */ | |
168 void* toolkit_data; | |
169 /* tell us if we should free the toolkit data slot when freeing the | |
170 widget_value itself. */ | |
171 Boolean free_toolkit_data; | |
172 | |
173 /* data defining a scrollbar; only valid if type == "scrollbar" */ | |
174 scrollbar_values *scrollbar_data; | |
175 | |
434 | 176 /* A reference counted arg structure. */ |
177 struct _widget_args *args; | |
428 | 178 /* we resource the widget_value structures; this points to the next |
179 one on the free list if this one has been deallocated. */ | |
180 struct _widget_value *free_list; | |
181 | |
182 } widget_value; | |
183 | |
184 | |
185 typedef void (*lw_callback) (Widget w, LWLIB_ID id, XtPointer data); | |
186 | |
187 /* menu stuff */ | |
188 /* maybe this should go into a generic lwmenu.h */ | |
189 | |
190 extern int lw_menu_active; | |
191 | |
192 #if defined (LWLIB_MENUBARS_LUCID) | |
193 #include "xlwmenu.h" | |
194 #define lw_set_menu xlw_set_menu | |
195 #define lw_push_menu xlw_push_menu | |
196 #define lw_pop_menu xlw_pop_menu | |
197 #define lw_set_item xlw_set_item | |
198 #define lw_map_menu xlw_map_menu | |
199 #define lw_display_menu xlw_display_menu | |
200 #define lw_kill_menus xlw_kill_menus | |
201 #define lw_get_entries xlw_get_entries | |
202 #define lw_menu_level xlw_menu_level | |
203 #else /* LWLIB_MENUBARS_LUCID */ | |
204 /* do this for the other toolkits too */ | |
205 #endif /* LWLIB_MENUBARS_LUCID */ | |
206 | |
207 #if defined (LWLIB_TABS_LUCID) | |
208 #include "xlwtabs.h" | |
209 #endif | |
210 | |
442 | 211 void lw_register_widget (const char* type, const char* name, LWLIB_ID id, |
428 | 212 widget_value* val, lw_callback pre_activate_cb, |
213 lw_callback selection_cb, | |
214 lw_callback post_activate_cb); | |
215 Widget lw_get_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p); | |
216 Widget lw_make_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p); | |
442 | 217 Widget lw_create_widget (const char* type, const char* name, LWLIB_ID id, |
428 | 218 widget_value* val, Widget parent, Boolean pop_up_p, |
219 lw_callback pre_activate_cb, | |
220 lw_callback selection_cb, | |
221 lw_callback post_activate_cb); | |
222 LWLIB_ID lw_get_widget_id (Widget w); | |
223 int lw_map_widget_values (LWLIB_ID id, int (*mapfunc) (widget_value *value, | |
224 void *closure), | |
225 void *closure); | |
226 void lw_modify_all_widgets (LWLIB_ID id, widget_value* val, Boolean deep_p); | |
227 void lw_destroy_widget (Widget w); | |
228 void lw_destroy_all_widgets (LWLIB_ID id); | |
229 void lw_destroy_everything (void); | |
230 void lw_destroy_all_pop_ups (void); | |
231 Widget lw_raise_all_pop_up_widgets (void); | |
232 widget_value* lw_get_all_values (LWLIB_ID id); | |
233 Boolean lw_get_some_values (LWLIB_ID id, widget_value* val); | |
234 void lw_pop_up_all_widgets (LWLIB_ID id); | |
235 void lw_pop_down_all_widgets (LWLIB_ID id); | |
236 void lw_add_value_args_to_args (widget_value* wv, ArgList addto, int* offset); | |
434 | 237 void lw_add_widget_value_arg (widget_value* wv, String name, XtArgVal value); |
639 | 238 XtArgVal lw_get_value_arg (widget_value* wv, String name); |
434 | 239 void lw_copy_widget_value_args (widget_value* copy, widget_value* val); |
442 | 240 widget_value * copy_widget_value_tree (widget_value *val, change_type change); |
428 | 241 |
242 widget_value *malloc_widget_value (void); | |
243 void free_widget_value (widget_value *); | |
244 void free_widget_value_tree (widget_value *wv); | |
245 widget_value *replace_widget_value_tree (widget_value*, widget_value*); | |
246 | |
247 void lw_popup_menu (Widget, XEvent *); | |
248 | |
249 /* Toolkit independent way of focusing on a Widget at the Xt level. */ | |
250 void lw_set_keyboard_focus (Widget parent, Widget w); | |
251 | |
252 /* Silly Energize hack to invert the "sheet" button */ | |
253 void lw_show_busy (Widget w, Boolean busy); | |
254 | |
442 | 255 void lw_remove_accelerator_spec (char *val); |
256 | |
440 | 257 #endif /* INCLUDED_lwlib_h_ */ |