diff options
| author | Miles Bader | 2007-07-15 02:05:20 +0000 |
|---|---|---|
| committer | Miles Bader | 2007-07-15 02:05:20 +0000 |
| commit | 7eb1e4534e88a32fe5e549e630fdabf3e062be2b (patch) | |
| tree | 34fc72789f1cfbfeb067cf507f8871c322df300a /src | |
| parent | 76d11d2cf9623e9f4c38e8239c4444ffc1fae485 (diff) | |
| parent | 6f8a87c027ebd6f9cfdac5c0df97d651227bec62 (diff) | |
| download | emacs-7eb1e4534e88a32fe5e549e630fdabf3e062be2b.tar.gz emacs-7eb1e4534e88a32fe5e549e630fdabf3e062be2b.zip | |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 803-813)
- Update from CVS
- Merge from emacs--rel--22
* emacs--rel--22 (patch 51-58)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 233-236)
- Merge from emacs--devo--0
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--multi-tty--0--patch-25
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 246 | ||||
| -rw-r--r-- | src/Makefile.in | 2 | ||||
| -rw-r--r-- | src/alloc.c | 13 | ||||
| -rw-r--r-- | src/buffer.c | 4 | ||||
| -rw-r--r-- | src/callint.c | 11 | ||||
| -rw-r--r-- | src/casetab.c | 2 | ||||
| -rw-r--r-- | src/coding.c | 6 | ||||
| -rw-r--r-- | src/config.in | 4 | ||||
| -rw-r--r-- | src/doc.c | 2 | ||||
| -rw-r--r-- | src/editfns.c | 6 | ||||
| -rw-r--r-- | src/eval.c | 123 | ||||
| -rw-r--r-- | src/fileio.c | 5 | ||||
| -rw-r--r-- | src/fns.c | 47 | ||||
| -rw-r--r-- | src/fontset.c | 2 | ||||
| -rw-r--r-- | src/gmalloc.c | 177 | ||||
| -rw-r--r-- | src/image.c | 4 | ||||
| -rw-r--r-- | src/keyboard.c | 2 | ||||
| -rw-r--r-- | src/keymap.c | 502 | ||||
| -rw-r--r-- | src/keymap.h | 4 | ||||
| -rw-r--r-- | src/lisp.h | 14 | ||||
| -rw-r--r-- | src/macgui.h | 4 | ||||
| -rw-r--r-- | src/macmenu.c | 118 | ||||
| -rw-r--r-- | src/macterm.c | 88 | ||||
| -rw-r--r-- | src/makefile.w32-in | 3 | ||||
| -rw-r--r-- | src/minibuf.c | 24 | ||||
| -rw-r--r-- | src/print.c | 2 | ||||
| -rw-r--r-- | src/process.c | 311 | ||||
| -rw-r--r-- | src/process.h | 76 | ||||
| -rw-r--r-- | src/search.c | 179 | ||||
| -rw-r--r-- | src/term.c | 13 | ||||
| -rw-r--r-- | src/w32.c | 12 | ||||
| -rw-r--r-- | src/w32bdf.c | 3 | ||||
| -rw-r--r-- | src/w32fns.c | 12 | ||||
| -rw-r--r-- | src/w32menu.c | 68 | ||||
| -rw-r--r-- | src/w32term.c | 5 | ||||
| -rw-r--r-- | src/window.c | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 2 |
37 files changed, 1313 insertions, 785 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 4d2e7ccb375..a707d884454 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,219 @@ | |||
| 1 | 2007-07-14 Jason Rumney <jasonr@gnu.org> | ||
| 2 | |||
| 3 | * process.c [WINDOWSNT]: Don't undefine AF_INET6. | ||
| 4 | |||
| 5 | 2007-07-14 Richard Stallman <rms@gnu.org> | ||
| 6 | |||
| 7 | * eval.c (maybe_call_debugger): New function. | ||
| 8 | (find_handler_clause): Use maybe_call_debugger. | ||
| 9 | Call it when the handler says `debug'. | ||
| 10 | Eliminate DEBUGGER_VALUE_PTR. | ||
| 11 | (Fsignal): Eliminate debugger_value. | ||
| 12 | (Qdebug): New variable. | ||
| 13 | (syms_of_eval): Initialize it. | ||
| 14 | |||
| 15 | 2007-07-14 Juanma Barranquero <lekktu@gmail.com> | ||
| 16 | |||
| 17 | * eval.c (Fprogn): | ||
| 18 | * keyboard.c (Ftrack_mouse): | ||
| 19 | * print.c (Fwith_output_to_temp_buffer): | ||
| 20 | * window.c (Fsave_window_excursion): Doc fix. | ||
| 21 | |||
| 22 | 2007-07-13 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 23 | |||
| 24 | * eval.c (init_eval_once): Bump max_lisp_eval_depth to 400. | ||
| 25 | |||
| 26 | 2007-07-12 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 27 | |||
| 28 | * process.h (struct Lisp_Process): Turn slots infd, outfd, | ||
| 29 | kill_without_query, pty_flag, tick, update_tick, decoding_carryover, | ||
| 30 | inherit_coding_system_flag, filter_multibyte, adaptive_read_buffering, | ||
| 31 | read_output_delay, and read_output_skip from Lisp_Objects to ints. | ||
| 32 | Remove unused encoding_carryover. | ||
| 33 | * process.c: Adjust all functions accordingly. | ||
| 34 | |||
| 35 | 2007-07-12 Richard Stallman <rms@gnu.org> | ||
| 36 | |||
| 37 | * term.c: Include unistd.h only if HAVE_UNISTD_H. | ||
| 38 | |||
| 39 | 2007-07-11 Jason Rumney <jasonr@gnu.org> | ||
| 40 | |||
| 41 | * makefile.w32-in (LIBS): Include OLE32. | ||
| 42 | |||
| 43 | * w32fns.c (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM. | ||
| 44 | (w32_msg_pump) <WM_DESTROY>: Uninitialize COM. | ||
| 45 | |||
| 46 | 2007-07-11 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 47 | |||
| 48 | * lisp.h (struct Lisp_Hash_Table): Turn next_weak into a bare pointer. | ||
| 49 | * fns.c (weak_hash_tables): Rename from Vweak_hash_tables and turned | ||
| 50 | from a Lisp_Object into a bare pointer. | ||
| 51 | (make_hash_table, copy_hash_table, sweep_weak_hash_tables, init_fns): | ||
| 52 | Adjust the code correspondingly. | ||
| 53 | |||
| 54 | * alloc.c (emacs_blocked_free): Remove unused var `bytes_used_now'. | ||
| 55 | |||
| 56 | * term.c: Include unistd.h for ttyname, used in handle_one_term_event. | ||
| 57 | (term_show_mouse_face): Remove unused var `j'. | ||
| 58 | (handle_one_term_event): Remove unused vars `i' and `j'. | ||
| 59 | Don't cast return value of ttyname since it's not necessary. | ||
| 60 | |||
| 61 | 2007-07-10 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 62 | |||
| 63 | * alloc.c (mark_maybe_pointer): Enforce mult-of-8 alignment when using | ||
| 64 | USE_LSB_TAG. Suggested by Dmitry Antipov <dmantipov@yandex.ru>. | ||
| 65 | |||
| 66 | * fns.c (map_char_table): Use an array of int for `indices' rather than | ||
| 67 | an array of Lisp_Objects (which are only ever integers anyway). | ||
| 68 | (Fmap_char_table): Update caller. | ||
| 69 | * lisp.h: Update prototype. | ||
| 70 | * keymap.c (Fset_keymap_parent, map_keymap, Fcopy_keymap): | ||
| 71 | * fontset.c (Ffontset_info): | ||
| 72 | * casetab.c (set_case_table): Update callers. | ||
| 73 | |||
| 74 | * editfns.c (Ftranspose_regions): Use EMACS_INT for positions. | ||
| 75 | |||
| 76 | * keymap.c (struct accessible_keymaps_data) | ||
| 77 | (struct where_is_internal_data): New structures. | ||
| 78 | (accessible_keymaps_1, where_is_internal_1): Use them to change | ||
| 79 | interface to adhere to the one used by map_keymap. | ||
| 80 | (Faccessible_keymaps, where_is_internal): Use map_keymap. | ||
| 81 | (accessible_keymaps_char_table, where_is_internal_2): Remove. | ||
| 82 | |||
| 83 | * keymap.h (map_keymap_function_t): More informative prototype. | ||
| 84 | |||
| 85 | 2007-07-10 Guanpeng Xu <herberteuler@hotmail.com> | ||
| 86 | |||
| 87 | * search.c (Vinhibit_changing_match_data, search_regs_1): New vars. | ||
| 88 | (looking_at_1): Don't change search_regs and last_thing_searched | ||
| 89 | if `inhibit-changing-match-data' is non-nil. | ||
| 90 | (string_match_1, search_buffer, set_search_regs): Likewise. | ||
| 91 | (syms_of_search): Add Lisp level definition for | ||
| 92 | `inhibit-changing-match-data' and set it to nil. | ||
| 93 | (boyer_moore): If `inhibit-changing-match-data' is non-nil, compute | ||
| 94 | start and end of the match, instead of using values in search_regs. | ||
| 95 | |||
| 96 | 2007-07-01 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 97 | |||
| 98 | * minibuf.c (Fcompleting_read): New value `confirm-only' | ||
| 99 | for `require-match'. | ||
| 100 | |||
| 101 | 2007-06-28 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 102 | |||
| 103 | * fileio.c (Fdo_auto_save): Revert last patch installed unwillingly as | ||
| 104 | part of the 2007-06-27 change to syms_of_fileio. | ||
| 105 | |||
| 106 | 2007-06-28 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 107 | |||
| 108 | * macterm.c [USE_MAC_TSM] (mac_handle_text_input_event): | ||
| 109 | Check WINDOWP before using XWINDOW. Consolidate return statements. | ||
| 110 | |||
| 111 | 2007-06-27 Richard Stallman <rms@gnu.org> | ||
| 112 | |||
| 113 | * fileio.c (syms_of_fileio) <after-insert-file-functions>: Doc fix. | ||
| 114 | |||
| 115 | 2007-06-27 Juanma Barranquero <lekktu@gmail.com> | ||
| 116 | |||
| 117 | * buffer.c (syms_of_buffer) <selective-display>: Fix typo in docstring. | ||
| 118 | |||
| 119 | 2007-06-26 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 120 | |||
| 121 | * gmalloc.c [HAVE_GTK_AND_PTHREAD]: Check this after including config.h. | ||
| 122 | (_aligned_blocks_mutex) [USE_PTHREAD]: New variable. | ||
| 123 | (LOCK_ALIGNED_BLOCKS, UNLOCK_ALIGNED_BLOCKS): New macros. | ||
| 124 | (_free_internal, memalign): Use them. | ||
| 125 | (_malloc_mutex, _aligned_blocks_mutex) [USE_PTHREAD]: | ||
| 126 | Initialize to PTHREAD_MUTEX_INITIALIZER. | ||
| 127 | (malloc_initialize_1) [USE_PTHREAD]: Don't use recursive mutex. | ||
| 128 | (morecore_nolock): Rename from morecore. All uses changed. | ||
| 129 | Use only nolock versions of internal allocation functions. | ||
| 130 | (_malloc_internal_nolock, _realloc_internal_nolock) | ||
| 131 | (_free_internal_nolock): New functions created from | ||
| 132 | _malloc_internal, _realloc_internal, and _free_internal. | ||
| 133 | (_malloc_internal, _realloc_internal, _free_internal): Use them. | ||
| 134 | Copy hook value to automatic variable before its use. | ||
| 135 | (memalign): Copy hook value to automatic variable before its use. | ||
| 136 | |||
| 137 | 2007-06-26 Kenichi Handa <handa@m17n.org> | ||
| 138 | |||
| 139 | * coding.c (Ffind_operation_coding_system): Docstring improved. | ||
| 140 | (syms_of_coding): Docstring of `file-coding-system-alist' improved. | ||
| 141 | |||
| 142 | 2007-06-25 David Kastrup <dak@gnu.org> | ||
| 143 | |||
| 144 | * keymap.c (Fcurrent_active_maps): Add `position' argument. | ||
| 145 | (Fwhere_is_internal): Adjust call to `current-active-maps' to | ||
| 146 | cater for additional parameter. | ||
| 147 | |||
| 148 | * keymap.h: Adjust number of parameters to `current-active-maps'. | ||
| 149 | |||
| 150 | * doc.c (Fsubstitute_command_keys): Adjust call of | ||
| 151 | `current-active-maps'. | ||
| 152 | |||
| 153 | 2007-06-25 David Kastrup <dak@gnu.org> | ||
| 154 | |||
| 155 | * callint.c (Fcall_interactively): Make the parsing of interactive | ||
| 156 | specs somewhat more readable. | ||
| 157 | |||
| 158 | 2007-06-23 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 159 | |||
| 160 | * macterm.c (x_draw_fringe_bitmap) [MAC_OSX]: Extend fringe background | ||
| 161 | to scroll bar gap also when bitmap fills fringe. Draw only foreground | ||
| 162 | if extended background has already been filled. | ||
| 163 | |||
| 164 | 2007-06-22 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 165 | |||
| 166 | * macgui.h (USE_CG_DRAWING): Don't require USE_ATSUI. | ||
| 167 | (USE_MAC_TOOLBAR): Require USE_CG_DRAWING. | ||
| 168 | |||
| 169 | * macmenu.c (mac_dialog_modal_filter, Fx_popup_dialog) [MAC_OSX]: | ||
| 170 | Put special treatment for Fmessage_box, Fyes_or_no_p, and Fy_or_n_p | ||
| 171 | in #if 0 as it is not compatible with y-or-n-p-with-timeout. | ||
| 172 | (timer_check) [TARGET_API_MAC_CARBON]: Add extern. | ||
| 173 | [TARGET_API_MAC_CARBON] (mac_handle_dialog_event): Use QuitEventLoop | ||
| 174 | instead of QuitAppModalLoopForWindow. Consolidate QuitEventLoop calls. | ||
| 175 | (pop_down_dialog) [TARGET_API_MAC_CARBON]: New function. | ||
| 176 | [TARGET_API_MAC_CARBON] (create_and_show_dialog): Use it for unwind. | ||
| 177 | Run timers during dialog popup. | ||
| 178 | (Fmenu_or_popup_active_p) [TARGET_API_MAC_CARBON]: Use popup_activated. | ||
| 179 | |||
| 180 | 2007-06-21 Jason Rumney <jasonr@gnu.org> | ||
| 181 | |||
| 182 | * image.c (convert_mono_to_color_image): Swap fore and background. | ||
| 183 | |||
| 184 | 2007-06-20 Jason Rumney <jasonr@gnu.org> | ||
| 185 | |||
| 186 | * w32bdf.c (w32_BDF_to_x_font): Unmap memory when finished. | ||
| 187 | (w32_free_bdf_font): Unmap memory not handle. | ||
| 188 | |||
| 189 | 2007-06-20 Sam Steingold <sds@gnu.org> | ||
| 190 | |||
| 191 | * gmalloc.c (__morecore): Fix the declaration to comply with the | ||
| 192 | definition. | ||
| 193 | |||
| 194 | 2007-06-20 Juanma Barranquero <lekktu@gmail.com> | ||
| 195 | |||
| 196 | * w32term.c (w32_delete_display): Remove leftover declaration. | ||
| 197 | (w32_define_cursor, w32_initialize): Make static. | ||
| 198 | |||
| 199 | * w32.c (_wsa_errlist): Fix typo in error message. | ||
| 200 | (init_environment): Ignore any environment variable from the | ||
| 201 | registry having a null value. | ||
| 202 | |||
| 203 | 2007-06-20 Glenn Morris <rgm@gnu.org> | ||
| 204 | |||
| 205 | * Makefile.in (LIBGIF): Default to -lgif. | ||
| 206 | |||
| 207 | 2007-06-17 Jason Rumney <jasonr@gnu.org> | ||
| 208 | |||
| 209 | * w32menu.c (add_menu_item): Don't use multibyte string functions on | ||
| 210 | unicode strings. | ||
| 211 | |||
| 212 | 2007-06-16 Juanma Barranquero <lekktu@gmail.com> | ||
| 213 | |||
| 214 | * xdisp.c (syms_of_xdisp) <auto-resize-tool-bars>: | ||
| 215 | Fix typo in docstring. | ||
| 216 | |||
| 1 | 2007-06-16 Eli Zaretskii <eliz@gnu.org> | 217 | 2007-06-16 Eli Zaretskii <eliz@gnu.org> |
| 2 | 218 | ||
| 3 | * w32menu.c (add_menu_item): Escape `&' characters in menu items | 219 | * w32menu.c (add_menu_item): Escape `&' characters in menu items |
| @@ -92,7 +308,7 @@ | |||
| 92 | 308 | ||
| 93 | * w32fns.c (Fx_file_dialog): Take size from struct not pointer. | 309 | * w32fns.c (Fx_file_dialog): Take size from struct not pointer. |
| 94 | 310 | ||
| 95 | 2007-06-08 Juanma Barranquero <lekktu@gmail.com> | 311 | 2007-06-08 Juanma Barranquero <lekktu@gmail.com> |
| 96 | 312 | ||
| 97 | * callint.c (Fcall_interactively): | 313 | * callint.c (Fcall_interactively): |
| 98 | * editfns.c (Fdelete_and_extract_region): | 314 | * editfns.c (Fdelete_and_extract_region): |
| @@ -110,7 +326,7 @@ | |||
| 110 | * xselect.c (Fx_get_atom_name): | 326 | * xselect.c (Fx_get_atom_name): |
| 111 | * xterm.c (x_term_init): Use empty_unibyte_string. | 327 | * xterm.c (x_term_init): Use empty_unibyte_string. |
| 112 | 328 | ||
| 113 | 2007-06-08 Dmitry Antipov <dmitry.antipov@mail.ru> (tiny change) | 329 | 2007-06-08 Dmitry Antipov <dmantipov@yandex.ru> (tiny change) |
| 114 | 330 | ||
| 115 | * alloc.c (init_strings): Initialize canonical empty strings. | 331 | * alloc.c (init_strings): Initialize canonical empty strings. |
| 116 | (make_uninit_string, make_uninit_multibyte_string): Return appropriate | 332 | (make_uninit_string, make_uninit_multibyte_string): Return appropriate |
| @@ -145,7 +361,7 @@ | |||
| 145 | [TARGET_API_MAC_CARBON] (install_menu_target_item_handler): | 361 | [TARGET_API_MAC_CARBON] (install_menu_target_item_handler): |
| 146 | Remove argument. Install handler to application. | 362 | Remove argument. Install handler to application. |
| 147 | (set_frame_menubar): Don't change deep_p. | 363 | (set_frame_menubar): Don't change deep_p. |
| 148 | (mac_menu_show): Use FRAME_OUTER_TO_INNER_DIFF_X and | 364 | (mac_menu_show): Use FRAME_OUTER_TO_INNER_DIFF_X and |
| 149 | FRAME_OUTER_TO_INNER_DIFF_Y. | 365 | FRAME_OUTER_TO_INNER_DIFF_Y. |
| 150 | (DIALOG_BUTTON_COMMAND_ID_OFFSET, DIALOG_BUTTON_COMMAND_ID_P) | 366 | (DIALOG_BUTTON_COMMAND_ID_OFFSET, DIALOG_BUTTON_COMMAND_ID_P) |
| 151 | (DIALOG_BUTTON_COMMAND_ID_VALUE, DIALOG_BUTTON_MAKE_COMMAND_ID) | 367 | (DIALOG_BUTTON_COMMAND_ID_VALUE, DIALOG_BUTTON_MAKE_COMMAND_ID) |
| @@ -497,6 +713,10 @@ | |||
| 497 | 713 | ||
| 498 | 2007-04-24 Chong Yidong <cyd@stupidchicken.com> | 714 | 2007-04-24 Chong Yidong <cyd@stupidchicken.com> |
| 499 | 715 | ||
| 716 | * Branch for 22.1. | ||
| 717 | |||
| 718 | 2007-04-24 Chong Yidong <cyd@stupidchicken.com> | ||
| 719 | |||
| 500 | * xdisp.c (redisplay_window): Use BEG_UNCHANGED and END_UNCHANGED | 720 | * xdisp.c (redisplay_window): Use BEG_UNCHANGED and END_UNCHANGED |
| 501 | values of the actual window. | 721 | values of the actual window. |
| 502 | 722 | ||
| @@ -993,13 +1213,13 @@ | |||
| 993 | when popup menu finishes. | 1213 | when popup menu finishes. |
| 994 | 1214 | ||
| 995 | * w32fns.c (menubar_in_use): New flag. | 1215 | * w32fns.c (menubar_in_use): New flag. |
| 996 | (w32_wnd_proc) [WM_INITMENU, WM_EXITMENULOOP, WM_TIMER, WM_COMMAND]: | 1216 | (w32_wnd_proc) <WM_INITMENU, WM_EXITMENULOOP, WM_TIMER, WM_COMMAND>: |
| 997 | Use it. | 1217 | Use it. |
| 998 | 1218 | ||
| 999 | * w32menu.c (Fx_popup_menu): Don't free menu strings here. | 1219 | * w32menu.c (Fx_popup_menu): Don't free menu strings here. |
| 1000 | (w32_menu_show): Do it here instead. | 1220 | (w32_menu_show): Do it here instead. |
| 1001 | 1221 | ||
| 1002 | * w32fns.c (w32_wnd_proc) [WM_INITMENU]: Set menubar_active frame | 1222 | * w32fns.c (w32_wnd_proc) <WM_INITMENU>: Set menubar_active frame |
| 1003 | parameter. | 1223 | parameter. |
| 1004 | 1224 | ||
| 1005 | * w32menu.c (current_popup_menu): Make available globally. | 1225 | * w32menu.c (current_popup_menu): Make available globally. |
| @@ -1007,7 +1227,7 @@ | |||
| 1007 | menu event into the keyboard buffer. Remove menu_command_in_progress. | 1227 | menu event into the keyboard buffer. Remove menu_command_in_progress. |
| 1008 | 1228 | ||
| 1009 | * w32fns.c (current_popup_menu): Use from w32menu.c. | 1229 | * w32fns.c (current_popup_menu): Use from w32menu.c. |
| 1010 | (w32_wnd_proc) [WM_EXITMENULOOP, WM_TIMER]: Use menubar_active | 1230 | (w32_wnd_proc) <WM_EXITMENULOOP, WM_TIMER>: Use menubar_active |
| 1011 | and current_popup_menu to determine whether a menubar menu has | 1231 | and current_popup_menu to determine whether a menubar menu has |
| 1012 | been cancelled. | 1232 | been cancelled. |
| 1013 | 1233 | ||
| @@ -10118,7 +10338,7 @@ | |||
| 10118 | * w32term.h (x_output): Add focus_state. | 10338 | * w32term.h (x_output): Add focus_state. |
| 10119 | 10339 | ||
| 10120 | * w32term.c (x_focus_changed, w32_detect_focus_change): New functions. | 10340 | * w32term.c (x_focus_changed, w32_detect_focus_change): New functions. |
| 10121 | (w32_read_socket) [WM_SETFOCUS]: Call w32_detect_focus_change. | 10341 | (w32_read_socket) <WM_SETFOCUS>: Call w32_detect_focus_change. |
| 10122 | 10342 | ||
| 10123 | 2005-03-25 Stefan Monnier <monnier@iro.umontreal.ca> | 10343 | 2005-03-25 Stefan Monnier <monnier@iro.umontreal.ca> |
| 10124 | 10344 | ||
| @@ -10517,7 +10737,7 @@ | |||
| 10517 | (XTread_socket) [!MAC_OSX]: Don't pass keyboard events to TSM. | 10737 | (XTread_socket) [!MAC_OSX]: Don't pass keyboard events to TSM. |
| 10518 | [MAC_OS8] (make_mac_terminal_frame) [TARGET_API_MAC_CARBON]: | 10738 | [MAC_OS8] (make_mac_terminal_frame) [TARGET_API_MAC_CARBON]: |
| 10519 | Set default cursors. | 10739 | Set default cursors. |
| 10520 | (mac_initialize) [USE_CARBON_EVENTS && !MAC_OSX] : Don't call | 10740 | (mac_initialize) [USE_CARBON_EVENTS && !MAC_OSX]: Don't call |
| 10521 | init_service_handler or init_quit_char_handler. | 10741 | init_service_handler or init_quit_char_handler. |
| 10522 | (mac_initialize) [!MAC_OSX]: Don't call MakeMeTheFrontProcess. | 10742 | (mac_initialize) [!MAC_OSX]: Don't call MakeMeTheFrontProcess. |
| 10523 | 10743 | ||
| @@ -11454,7 +11674,7 @@ | |||
| 11454 | (install_window_handler) [TARGET_API_MAC_CARBON]: | 11674 | (install_window_handler) [TARGET_API_MAC_CARBON]: |
| 11455 | Register handlers for tracking/receiving drag-and-drop items. | 11675 | Register handlers for tracking/receiving drag-and-drop items. |
| 11456 | (do_ae_open_documents): Generate unibyte strings for filenames. | 11676 | (do_ae_open_documents): Generate unibyte strings for filenames. |
| 11457 | (mac_do_receive_drag) [TARGET_API_MAC_CARBON] : Likewise. | 11677 | (mac_do_receive_drag) [TARGET_API_MAC_CARBON]: Likewise. |
| 11458 | Reject only non-filename items. Set event modifiers, and return value. | 11678 | Reject only non-filename items. Set event modifiers, and return value. |
| 11459 | 11679 | ||
| 11460 | 2004-12-28 Dan Nicolaescu <dann@ics.uci.edu> | 11680 | 2004-12-28 Dan Nicolaescu <dann@ics.uci.edu> |
| @@ -13411,7 +13631,7 @@ | |||
| 13411 | 13631 | ||
| 13412 | * w32term.h (AppendMenuW_Proc): Move declaration from w32menu.c. | 13632 | * w32term.h (AppendMenuW_Proc): Move declaration from w32menu.c. |
| 13413 | 13633 | ||
| 13414 | * w32fns.c (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: | 13634 | * w32fns.c (w32_wnd_proc) <WM_MEASUREITEM, WM_DRAWITEM>: |
| 13415 | Handle Unicode menu titles. | 13635 | Handle Unicode menu titles. |
| 13416 | 13636 | ||
| 13417 | 2004-09-07 Kim F. Storm <storm@cua.dk> | 13637 | 2004-09-07 Kim F. Storm <storm@cua.dk> |
| @@ -15844,7 +16064,7 @@ | |||
| 15844 | 16064 | ||
| 15845 | * macgui.h [MAC_OSX]: Include Carbon/Carbon.h. | 16065 | * macgui.h [MAC_OSX]: Include Carbon/Carbon.h. |
| 15846 | (mktime, DEBUG, Z, free, malloc, realloc, max, min) | 16066 | (mktime, DEBUG, Z, free, malloc, realloc, max, min) |
| 15847 | (init_process) [MAC_OSX] : Avoid conflicts with Carbon/Carbon.h. | 16067 | (init_process) [MAC_OSX]: Avoid conflicts with Carbon/Carbon.h. |
| 15848 | [!MAC_OSX]: Include QDOffscreen.h and Controls.h. | 16068 | [!MAC_OSX]: Include QDOffscreen.h and Controls.h. |
| 15849 | (INFINITY) [MAC_OSX]: Avoid conflict with definition in math.h. | 16069 | (INFINITY) [MAC_OSX]: Avoid conflict with definition in math.h. |
| 15850 | (Bitmap): Remove typedef. | 16070 | (Bitmap): Remove typedef. |
| @@ -16149,7 +16369,7 @@ | |||
| 16149 | 16369 | ||
| 16150 | * cmds.c (Fend_of_line): Doc fix. | 16370 | * cmds.c (Fend_of_line): Doc fix. |
| 16151 | 16371 | ||
| 16152 | 2004-02-16 Dmitry Antipov <dmitry.antipov@mail.ru> (tiny change) | 16372 | 2004-02-16 Dmitry Antipov <dmantipov@yandex.ru> (tiny change) |
| 16153 | 16373 | ||
| 16154 | * keyboard.c (prev_read): New static variable. | 16374 | * keyboard.c (prev_read): New static variable. |
| 16155 | (read_avail_input): Use it to zero out only those slots in buf[] | 16375 | (read_avail_input): Use it to zero out only those slots in buf[] |
| @@ -21965,7 +22185,7 @@ | |||
| 21965 | (best_matching_font, choose_face_font): Add `needs_overstrike' | 22185 | (best_matching_font, choose_face_font): Add `needs_overstrike' |
| 21966 | argument, and use it to return whether overstriking is desirable | 22186 | argument, and use it to return whether overstriking is desirable |
| 21967 | for this face/font combo. | 22187 | for this face/font combo. |
| 21968 | (set_font_frame_param: Pass new argument to choose_face_font. | 22188 | (set_font_frame_param): Pass new argument to choose_face_font. |
| 21969 | 22189 | ||
| 21970 | 2002-11-17 Ben Key <BKey1@tampabay.rr.com> | 22190 | 2002-11-17 Ben Key <BKey1@tampabay.rr.com> |
| 21971 | 22191 | ||
diff --git a/src/Makefile.in b/src/Makefile.in index 93496ca1199..a00cd10ef57 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -440,7 +440,7 @@ XFT_LIBS=@XFT_LIBS@ | |||
| 440 | 440 | ||
| 441 | #if HAVE_GIF | 441 | #if HAVE_GIF |
| 442 | #ifndef LIBGIF | 442 | #ifndef LIBGIF |
| 443 | #define LIBGIF -lungif | 443 | #define LIBGIF -lgif |
| 444 | #endif /* not defined LIBGIF */ | 444 | #endif /* not defined LIBGIF */ |
| 445 | #else /* not HAVE_GIF */ | 445 | #else /* not HAVE_GIF */ |
| 446 | #define LIBGIF | 446 | #define LIBGIF |
diff --git a/src/alloc.c b/src/alloc.c index cc6d1d55870..0c5b9d7a02b 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -1181,8 +1181,6 @@ emacs_blocked_free (ptr, ptr2) | |||
| 1181 | void *ptr; | 1181 | void *ptr; |
| 1182 | const void *ptr2; | 1182 | const void *ptr2; |
| 1183 | { | 1183 | { |
| 1184 | EMACS_INT bytes_used_now; | ||
| 1185 | |||
| 1186 | BLOCK_INPUT_ALLOC; | 1184 | BLOCK_INPUT_ALLOC; |
| 1187 | 1185 | ||
| 1188 | #ifdef GC_MALLOC_CHECK | 1186 | #ifdef GC_MALLOC_CHECK |
| @@ -4266,9 +4264,14 @@ mark_maybe_pointer (p) | |||
| 4266 | { | 4264 | { |
| 4267 | struct mem_node *m; | 4265 | struct mem_node *m; |
| 4268 | 4266 | ||
| 4269 | /* Quickly rule out some values which can't point to Lisp data. We | 4267 | /* Quickly rule out some values which can't point to Lisp data. */ |
| 4270 | assume that Lisp data is aligned on even addresses. */ | 4268 | if ((EMACS_INT) p % |
| 4271 | if ((EMACS_INT) p & 1) | 4269 | #ifdef USE_LSB_TAG |
| 4270 | 8 /* USE_LSB_TAG needs Lisp data to be aligned on multiples of 8. */ | ||
| 4271 | #else | ||
| 4272 | 2 /* We assume that Lisp data is aligned on even addresses. */ | ||
| 4273 | #endif | ||
| 4274 | ) | ||
| 4272 | return; | 4275 | return; |
| 4273 | 4276 | ||
| 4274 | m = mem_find (p); | 4277 | m = mem_find (p); |
diff --git a/src/buffer.c b/src/buffer.c index dee7b04190a..c74a6cbc2a5 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -5682,8 +5682,8 @@ Backing up is done before the first time the file is saved. */); | |||
| 5682 | DEFVAR_PER_BUFFER ("selective-display", ¤t_buffer->selective_display, | 5682 | DEFVAR_PER_BUFFER ("selective-display", ¤t_buffer->selective_display, |
| 5683 | Qnil, | 5683 | Qnil, |
| 5684 | doc: /* Non-nil enables selective display. | 5684 | doc: /* Non-nil enables selective display. |
| 5685 | An Integer N as value means display only lines | 5685 | An integer N as value means display only lines |
| 5686 | that start with less than n columns of space. | 5686 | that start with less than N columns of space. |
| 5687 | A value of t means that the character ^M makes itself and | 5687 | A value of t means that the character ^M makes itself and |
| 5688 | all the rest of the line invisible; also, when saving the buffer | 5688 | all the rest of the line invisible; also, when saving the buffer |
| 5689 | in a file, save the ^M as a newline. */); | 5689 | in a file, save the ^M as a newline. */); |
diff --git a/src/callint.c b/src/callint.c index 85ee6722710..e404f2ac71a 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -473,16 +473,19 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 473 | /* Count the number of arguments the interactive spec would have | 473 | /* Count the number of arguments the interactive spec would have |
| 474 | us give to the function. */ | 474 | us give to the function. */ |
| 475 | tem = string; | 475 | tem = string; |
| 476 | for (j = 0; *tem; j++) | 476 | for (j = 0; *tem;) |
| 477 | { | 477 | { |
| 478 | /* 'r' specifications ("point and mark as 2 numeric args") | 478 | /* 'r' specifications ("point and mark as 2 numeric args") |
| 479 | produce *two* arguments. */ | 479 | produce *two* arguments. */ |
| 480 | if (*tem == 'r') j++; | 480 | if (*tem == 'r') |
| 481 | j += 2; | ||
| 482 | else | ||
| 483 | j++; | ||
| 481 | tem = (unsigned char *) index (tem, '\n'); | 484 | tem = (unsigned char *) index (tem, '\n'); |
| 482 | if (tem) | 485 | if (tem) |
| 483 | tem++; | 486 | ++tem; |
| 484 | else | 487 | else |
| 485 | tem = (unsigned char *) ""; | 488 | break; |
| 486 | } | 489 | } |
| 487 | count = j; | 490 | count = j; |
| 488 | 491 | ||
diff --git a/src/casetab.c b/src/casetab.c index 42c268dd7c6..cc0e814c171 100644 --- a/src/casetab.c +++ b/src/casetab.c | |||
| @@ -126,7 +126,7 @@ set_case_table (table, standard) | |||
| 126 | int standard; | 126 | int standard; |
| 127 | { | 127 | { |
| 128 | Lisp_Object up, canon, eqv; | 128 | Lisp_Object up, canon, eqv; |
| 129 | Lisp_Object indices[3]; | 129 | int indices[3]; |
| 130 | 130 | ||
| 131 | check_case_table (table); | 131 | check_case_table (table); |
| 132 | 132 | ||
diff --git a/src/coding.c b/src/coding.c index 8dc20ef6a3a..2b7a7422d5c 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -7472,6 +7472,8 @@ They may specify a coding system, a cons of coding systems, | |||
| 7472 | or a function symbol to call. | 7472 | or a function symbol to call. |
| 7473 | In the last case, we call the function with one argument, | 7473 | In the last case, we call the function with one argument, |
| 7474 | which is a list of all the arguments given to this function. | 7474 | which is a list of all the arguments given to this function. |
| 7475 | If the function can't decide a coding system, it can return | ||
| 7476 | `undecided' so that the normal code-detection is performed. | ||
| 7475 | 7477 | ||
| 7476 | If OPERATION is `insert-file-contents', the argument corresponding to | 7478 | If OPERATION is `insert-file-contents', the argument corresponding to |
| 7477 | TARGET may be a cons (FILENAME . BUFFER). In that case, FILENAME is a | 7479 | TARGET may be a cons (FILENAME . BUFFER). In that case, FILENAME is a |
| @@ -7973,7 +7975,9 @@ and the cdr part is used for encoding. | |||
| 7973 | If VAL is a function symbol, the function must return a coding system | 7975 | If VAL is a function symbol, the function must return a coding system |
| 7974 | or a cons of coding systems which are used as above. The function is | 7976 | or a cons of coding systems which are used as above. The function is |
| 7975 | called with an argument that is a list of the arguments with which | 7977 | called with an argument that is a list of the arguments with which |
| 7976 | `find-operation-coding-system' was called. | 7978 | `find-operation-coding-system' was called. If the function can't decide |
| 7979 | a coding system, it can return `undecided' so that the normal | ||
| 7980 | code-detection is performed. | ||
| 7977 | 7981 | ||
| 7978 | See also the function `find-operation-coding-system' | 7982 | See also the function `find-operation-coding-system' |
| 7979 | and the variable `auto-coding-alist'. */); | 7983 | and the variable `auto-coding-alist'. */); |
diff --git a/src/config.in b/src/config.in index 2b7b5503dcb..742c0f44673 100644 --- a/src/config.in +++ b/src/config.in | |||
| @@ -228,7 +228,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 228 | /* Define to 1 if you have the `get_current_dir_name' function. */ | 228 | /* Define to 1 if you have the `get_current_dir_name' function. */ |
| 229 | #undef HAVE_GET_CURRENT_DIR_NAME | 229 | #undef HAVE_GET_CURRENT_DIR_NAME |
| 230 | 230 | ||
| 231 | /* Define to 1 if you have a gif library (default -lungif; otherwise specify | 231 | /* Define to 1 if you have a gif library (default -lgif; otherwise specify |
| 232 | with LIBGIF). */ | 232 | with LIBGIF). */ |
| 233 | #undef HAVE_GIF | 233 | #undef HAVE_GIF |
| 234 | 234 | ||
| @@ -769,7 +769,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 769 | Solaris, for example). */ | 769 | Solaris, for example). */ |
| 770 | #undef LD_SWITCH_X_SITE_AUX | 770 | #undef LD_SWITCH_X_SITE_AUX |
| 771 | 771 | ||
| 772 | /* Compiler option to link with the gif library (if not -lungif). */ | 772 | /* Compiler option to link with the gif library (if not -lgif). */ |
| 773 | #undef LIBGIF | 773 | #undef LIBGIF |
| 774 | 774 | ||
| 775 | /* Define to 1 if localtime caches TZ. */ | 775 | /* Define to 1 if localtime caches TZ. */ |
| @@ -883,7 +883,7 @@ a new string, without any text properties, is returned. */) | |||
| 883 | struct buffer *oldbuf; | 883 | struct buffer *oldbuf; |
| 884 | int start_idx; | 884 | int start_idx; |
| 885 | /* This is for computing the SHADOWS arg for describe_map_tree. */ | 885 | /* This is for computing the SHADOWS arg for describe_map_tree. */ |
| 886 | Lisp_Object active_maps = Fcurrent_active_maps (Qnil); | 886 | Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil); |
| 887 | Lisp_Object earlier_maps; | 887 | Lisp_Object earlier_maps; |
| 888 | 888 | ||
| 889 | changed = 1; | 889 | changed = 1; |
diff --git a/src/editfns.c b/src/editfns.c index 5fd40ed51c7..f88d0a6b54c 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -4112,9 +4112,9 @@ Transposing beyond buffer boundaries is an error. */) | |||
| 4112 | (startr1, endr1, startr2, endr2, leave_markers) | 4112 | (startr1, endr1, startr2, endr2, leave_markers) |
| 4113 | Lisp_Object startr1, endr1, startr2, endr2, leave_markers; | 4113 | Lisp_Object startr1, endr1, startr2, endr2, leave_markers; |
| 4114 | { | 4114 | { |
| 4115 | register int start1, end1, start2, end2; | 4115 | register EMACS_INT start1, end1, start2, end2; |
| 4116 | int start1_byte, start2_byte, len1_byte, len2_byte; | 4116 | EMACS_INT start1_byte, start2_byte, len1_byte, len2_byte; |
| 4117 | int gap, len1, len_mid, len2; | 4117 | EMACS_INT gap, len1, len_mid, len2; |
| 4118 | unsigned char *start1_addr, *start2_addr, *temp; | 4118 | unsigned char *start1_addr, *start2_addr, *temp; |
| 4119 | 4119 | ||
| 4120 | INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2, tmp_interval3; | 4120 | INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2, tmp_interval3; |
diff --git a/src/eval.c b/src/eval.c index b1bd3daef7a..6de9a5acc99 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -97,6 +97,7 @@ Lisp_Object Qinhibit_quit, Vinhibit_quit, Vquit_flag; | |||
| 97 | Lisp_Object Qand_rest, Qand_optional; | 97 | Lisp_Object Qand_rest, Qand_optional; |
| 98 | Lisp_Object Qdebug_on_error; | 98 | Lisp_Object Qdebug_on_error; |
| 99 | Lisp_Object Qdeclare; | 99 | Lisp_Object Qdeclare; |
| 100 | Lisp_Object Qdebug; | ||
| 100 | 101 | ||
| 101 | /* This holds either the symbol `run-hooks' or nil. | 102 | /* This holds either the symbol `run-hooks' or nil. |
| 102 | It is nil at an early stage of startup, and when Emacs | 103 | It is nil at an early stage of startup, and when Emacs |
| @@ -220,7 +221,7 @@ init_eval_once () | |||
| 220 | specpdl_ptr = specpdl; | 221 | specpdl_ptr = specpdl; |
| 221 | /* Don't forget to update docs (lispref node "Local Variables"). */ | 222 | /* Don't forget to update docs (lispref node "Local Variables"). */ |
| 222 | max_specpdl_size = 1000; | 223 | max_specpdl_size = 1000; |
| 223 | max_lisp_eval_depth = 300; | 224 | max_lisp_eval_depth = 400; |
| 224 | 225 | ||
| 225 | Vrun_hooks = Qnil; | 226 | Vrun_hooks = Qnil; |
| 226 | } | 227 | } |
| @@ -433,7 +434,7 @@ usage: (cond CLAUSES...) */) | |||
| 433 | 434 | ||
| 434 | DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0, | 435 | DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0, |
| 435 | doc: /* Eval BODY forms sequentially and return value of last one. | 436 | doc: /* Eval BODY forms sequentially and return value of last one. |
| 436 | usage: (progn BODY ...) */) | 437 | usage: (progn BODY...) */) |
| 437 | (args) | 438 | (args) |
| 438 | Lisp_Object args; | 439 | Lisp_Object args; |
| 439 | { | 440 | { |
| @@ -1595,8 +1596,7 @@ internal_condition_case_2 (bfun, nargs, args, handlers, hfun) | |||
| 1595 | 1596 | ||
| 1596 | 1597 | ||
| 1597 | static Lisp_Object find_handler_clause P_ ((Lisp_Object, Lisp_Object, | 1598 | static Lisp_Object find_handler_clause P_ ((Lisp_Object, Lisp_Object, |
| 1598 | Lisp_Object, Lisp_Object, | 1599 | Lisp_Object, Lisp_Object)); |
| 1599 | Lisp_Object *)); | ||
| 1600 | 1600 | ||
| 1601 | DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0, | 1601 | DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0, |
| 1602 | doc: /* Signal an error. Args are ERROR-SYMBOL and associated DATA. | 1602 | doc: /* Signal an error. Args are ERROR-SYMBOL and associated DATA. |
| @@ -1622,7 +1622,6 @@ See also the function `condition-case'. */) | |||
| 1622 | Lisp_Object conditions; | 1622 | Lisp_Object conditions; |
| 1623 | extern int gc_in_progress; | 1623 | extern int gc_in_progress; |
| 1624 | extern int waiting_for_input; | 1624 | extern int waiting_for_input; |
| 1625 | Lisp_Object debugger_value; | ||
| 1626 | Lisp_Object string; | 1625 | Lisp_Object string; |
| 1627 | Lisp_Object real_error_symbol; | 1626 | Lisp_Object real_error_symbol; |
| 1628 | struct backtrace *bp; | 1627 | struct backtrace *bp; |
| @@ -1680,7 +1679,7 @@ See also the function `condition-case'. */) | |||
| 1680 | register Lisp_Object clause; | 1679 | register Lisp_Object clause; |
| 1681 | 1680 | ||
| 1682 | clause = find_handler_clause (handlerlist->handler, conditions, | 1681 | clause = find_handler_clause (handlerlist->handler, conditions, |
| 1683 | error_symbol, data, &debugger_value); | 1682 | error_symbol, data); |
| 1684 | 1683 | ||
| 1685 | if (EQ (clause, Qlambda)) | 1684 | if (EQ (clause, Qlambda)) |
| 1686 | { | 1685 | { |
| @@ -1711,7 +1710,7 @@ See also the function `condition-case'. */) | |||
| 1711 | handlerlist = allhandlers; | 1710 | handlerlist = allhandlers; |
| 1712 | /* If no handler is present now, try to run the debugger, | 1711 | /* If no handler is present now, try to run the debugger, |
| 1713 | and if that fails, throw to top level. */ | 1712 | and if that fails, throw to top level. */ |
| 1714 | find_handler_clause (Qerror, conditions, error_symbol, data, &debugger_value); | 1713 | find_handler_clause (Qerror, conditions, error_symbol, data); |
| 1715 | if (catchlist != 0) | 1714 | if (catchlist != 0) |
| 1716 | Fthrow (Qtop_level, Qt); | 1715 | Fthrow (Qtop_level, Qt); |
| 1717 | 1716 | ||
| @@ -1863,75 +1862,54 @@ skip_debugger (conditions, data) | |||
| 1863 | = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA). | 1862 | = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA). |
| 1864 | This is for memory-full errors only. | 1863 | This is for memory-full errors only. |
| 1865 | 1864 | ||
| 1866 | Store value returned from debugger into *DEBUGGER_VALUE_PTR. | ||
| 1867 | |||
| 1868 | We need to increase max_specpdl_size temporarily around | 1865 | We need to increase max_specpdl_size temporarily around |
| 1869 | anything we do that can push on the specpdl, so as not to get | 1866 | anything we do that can push on the specpdl, so as not to get |
| 1870 | a second error here in case we're handling specpdl overflow. */ | 1867 | a second error here in case we're handling specpdl overflow. */ |
| 1871 | 1868 | ||
| 1872 | static Lisp_Object | 1869 | static Lisp_Object |
| 1873 | find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) | 1870 | find_handler_clause (handlers, conditions, sig, data) |
| 1874 | Lisp_Object handlers, conditions, sig, data; | 1871 | Lisp_Object handlers, conditions, sig, data; |
| 1875 | Lisp_Object *debugger_value_ptr; | ||
| 1876 | { | 1872 | { |
| 1877 | register Lisp_Object h; | 1873 | register Lisp_Object h; |
| 1878 | register Lisp_Object tem; | 1874 | register Lisp_Object tem; |
| 1875 | int debugger_called = 0; | ||
| 1876 | int debugger_considered = 0; | ||
| 1879 | 1877 | ||
| 1880 | if (EQ (handlers, Qt)) /* t is used by handlers for all conditions, set up by C code. */ | 1878 | /* t is used by handlers for all conditions, set up by C code. */ |
| 1879 | if (EQ (handlers, Qt)) | ||
| 1881 | return Qt; | 1880 | return Qt; |
| 1881 | |||
| 1882 | /* Don't run the debugger for a memory-full error. | ||
| 1883 | (There is no room in memory to do that!) */ | ||
| 1884 | if (NILP (sig)) | ||
| 1885 | debugger_considered = 1; | ||
| 1886 | |||
| 1882 | /* error is used similarly, but means print an error message | 1887 | /* error is used similarly, but means print an error message |
| 1883 | and run the debugger if that is enabled. */ | 1888 | and run the debugger if that is enabled. */ |
| 1884 | if (EQ (handlers, Qerror) | 1889 | if (EQ (handlers, Qerror) |
| 1885 | || !NILP (Vdebug_on_signal)) /* This says call debugger even if | 1890 | || !NILP (Vdebug_on_signal)) /* This says call debugger even if |
| 1886 | there is a handler. */ | 1891 | there is a handler. */ |
| 1887 | { | 1892 | { |
| 1888 | int debugger_called = 0; | 1893 | if (!NILP (sig) && wants_debugger (Vstack_trace_on_error, conditions)) |
| 1889 | Lisp_Object sig_symbol, combined_data; | ||
| 1890 | /* This is set to 1 if we are handling a memory-full error, | ||
| 1891 | because these must not run the debugger. | ||
| 1892 | (There is no room in memory to do that!) */ | ||
| 1893 | int no_debugger = 0; | ||
| 1894 | |||
| 1895 | if (NILP (sig)) | ||
| 1896 | { | ||
| 1897 | combined_data = data; | ||
| 1898 | sig_symbol = Fcar (data); | ||
| 1899 | no_debugger = 1; | ||
| 1900 | } | ||
| 1901 | else | ||
| 1902 | { | ||
| 1903 | combined_data = Fcons (sig, data); | ||
| 1904 | sig_symbol = sig; | ||
| 1905 | } | ||
| 1906 | |||
| 1907 | if (wants_debugger (Vstack_trace_on_error, conditions)) | ||
| 1908 | { | 1894 | { |
| 1909 | max_specpdl_size++; | 1895 | max_specpdl_size++; |
| 1910 | #ifdef PROTOTYPES | 1896 | #ifdef PROTOTYPES |
| 1911 | internal_with_output_to_temp_buffer ("*Backtrace*", | 1897 | internal_with_output_to_temp_buffer ("*Backtrace*", |
| 1912 | (Lisp_Object (*) (Lisp_Object)) Fbacktrace, | 1898 | (Lisp_Object (*) (Lisp_Object)) Fbacktrace, |
| 1913 | Qnil); | 1899 | Qnil); |
| 1914 | #else | 1900 | #else |
| 1915 | internal_with_output_to_temp_buffer ("*Backtrace*", | 1901 | internal_with_output_to_temp_buffer ("*Backtrace*", |
| 1916 | Fbacktrace, Qnil); | 1902 | Fbacktrace, Qnil); |
| 1917 | #endif | 1903 | #endif |
| 1918 | max_specpdl_size--; | 1904 | max_specpdl_size--; |
| 1919 | } | 1905 | } |
| 1920 | if (! no_debugger | 1906 | |
| 1921 | /* Don't try to run the debugger with interrupts blocked. | 1907 | if (!debugger_considered) |
| 1922 | The editing loop would return anyway. */ | ||
| 1923 | && ! INPUT_BLOCKED_P | ||
| 1924 | && (EQ (sig_symbol, Qquit) | ||
| 1925 | ? debug_on_quit | ||
| 1926 | : wants_debugger (Vdebug_on_error, conditions)) | ||
| 1927 | && ! skip_debugger (conditions, combined_data) | ||
| 1928 | && when_entered_debugger < num_nonmacro_input_events) | ||
| 1929 | { | 1908 | { |
| 1930 | *debugger_value_ptr | 1909 | debugger_considered = 1; |
| 1931 | = call_debugger (Fcons (Qerror, | 1910 | debugger_called = maybe_call_debugger (conditions, sig, data); |
| 1932 | Fcons (combined_data, Qnil))); | ||
| 1933 | debugger_called = 1; | ||
| 1934 | } | 1911 | } |
| 1912 | |||
| 1935 | /* If there is no handler, return saying whether we ran the debugger. */ | 1913 | /* If there is no handler, return saying whether we ran the debugger. */ |
| 1936 | if (EQ (handlers, Qerror)) | 1914 | if (EQ (handlers, Qerror)) |
| 1937 | { | 1915 | { |
| @@ -1940,6 +1918,7 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) | |||
| 1940 | return Qt; | 1918 | return Qt; |
| 1941 | } | 1919 | } |
| 1942 | } | 1920 | } |
| 1921 | |||
| 1943 | for (h = handlers; CONSP (h); h = Fcdr (h)) | 1922 | for (h = handlers; CONSP (h); h = Fcdr (h)) |
| 1944 | { | 1923 | { |
| 1945 | Lisp_Object handler, condit; | 1924 | Lisp_Object handler, condit; |
| @@ -1958,18 +1937,55 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) | |||
| 1958 | /* Handle a list of condition names in handler HANDLER. */ | 1937 | /* Handle a list of condition names in handler HANDLER. */ |
| 1959 | else if (CONSP (condit)) | 1938 | else if (CONSP (condit)) |
| 1960 | { | 1939 | { |
| 1961 | while (CONSP (condit)) | 1940 | Lisp_Object tail; |
| 1941 | for (tail = condit; CONSP (tail); tail = XCDR (tail)) | ||
| 1962 | { | 1942 | { |
| 1963 | tem = Fmemq (Fcar (condit), conditions); | 1943 | tem = Fmemq (Fcar (tail), conditions); |
| 1964 | if (!NILP (tem)) | 1944 | if (!NILP (tem)) |
| 1965 | return handler; | 1945 | { |
| 1966 | condit = XCDR (condit); | 1946 | /* This handler is going to apply. |
| 1947 | Does it allow the debugger to run first? */ | ||
| 1948 | if (! debugger_considered && !NILP (Fmemq (Qdebug, condit))) | ||
| 1949 | maybe_call_debugger (conditions, sig, data); | ||
| 1950 | return handler; | ||
| 1951 | } | ||
| 1967 | } | 1952 | } |
| 1968 | } | 1953 | } |
| 1969 | } | 1954 | } |
| 1955 | |||
| 1970 | return Qnil; | 1956 | return Qnil; |
| 1971 | } | 1957 | } |
| 1972 | 1958 | ||
| 1959 | /* Call the debugger if calling it is currently enabled for CONDITIONS. | ||
| 1960 | SIG and DATA describe the signal, as in find_handler_clause. */ | ||
| 1961 | |||
| 1962 | int | ||
| 1963 | maybe_call_debugger (conditions, sig, data) | ||
| 1964 | Lisp_Object conditions, sig, data; | ||
| 1965 | { | ||
| 1966 | Lisp_Object combined_data; | ||
| 1967 | |||
| 1968 | combined_data = Fcons (sig, data); | ||
| 1969 | |||
| 1970 | if ( | ||
| 1971 | /* Don't try to run the debugger with interrupts blocked. | ||
| 1972 | The editing loop would return anyway. */ | ||
| 1973 | ! INPUT_BLOCKED_P | ||
| 1974 | /* Does user wants to enter debugger for this kind of error? */ | ||
| 1975 | && (EQ (sig, Qquit) | ||
| 1976 | ? debug_on_quit | ||
| 1977 | : wants_debugger (Vdebug_on_error, conditions)) | ||
| 1978 | && ! skip_debugger (conditions, combined_data) | ||
| 1979 | /* rms: what's this for? */ | ||
| 1980 | && when_entered_debugger < num_nonmacro_input_events) | ||
| 1981 | { | ||
| 1982 | call_debugger (Fcons (Qerror, Fcons (combined_data, Qnil))); | ||
| 1983 | return 1; | ||
| 1984 | } | ||
| 1985 | |||
| 1986 | return 0; | ||
| 1987 | } | ||
| 1988 | |||
| 1973 | /* dump an error message; called like printf */ | 1989 | /* dump an error message; called like printf */ |
| 1974 | 1990 | ||
| 1975 | /* VARARGS 1 */ | 1991 | /* VARARGS 1 */ |
| @@ -3610,6 +3626,9 @@ before making `inhibit-quit' nil. */); | |||
| 3610 | Qand_optional = intern ("&optional"); | 3626 | Qand_optional = intern ("&optional"); |
| 3611 | staticpro (&Qand_optional); | 3627 | staticpro (&Qand_optional); |
| 3612 | 3628 | ||
| 3629 | Qdebug = intern ("debug"); | ||
| 3630 | staticpro (&Qdebug); | ||
| 3631 | |||
| 3613 | DEFVAR_LISP ("stack-trace-on-error", &Vstack_trace_on_error, | 3632 | DEFVAR_LISP ("stack-trace-on-error", &Vstack_trace_on_error, |
| 3614 | doc: /* *Non-nil means errors display a backtrace buffer. | 3633 | doc: /* *Non-nil means errors display a backtrace buffer. |
| 3615 | More precisely, this happens for any error that is handled | 3634 | More precisely, this happens for any error that is handled |
diff --git a/src/fileio.c b/src/fileio.c index cdbd35748f1..78ab412ddf4 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -6685,8 +6685,9 @@ or local variable spec of the tailing lines with `coding:' tag. */); | |||
| 6685 | 6685 | ||
| 6686 | DEFVAR_LISP ("after-insert-file-functions", &Vafter_insert_file_functions, | 6686 | DEFVAR_LISP ("after-insert-file-functions", &Vafter_insert_file_functions, |
| 6687 | doc: /* A list of functions to be called at the end of `insert-file-contents'. | 6687 | doc: /* A list of functions to be called at the end of `insert-file-contents'. |
| 6688 | Each is passed one argument, the number of characters inserted. | 6688 | Each is passed one argument, the number of characters inserted, |
| 6689 | It should return the new character count, and leave point the same. | 6689 | with point at the start of the inserted text. Each function |
| 6690 | should leave point the same, and return the new character count. | ||
| 6690 | If `insert-file-contents' is intercepted by a handler from | 6691 | If `insert-file-contents' is intercepted by a handler from |
| 6691 | `file-name-handler-alist', that handler is responsible for calling the | 6692 | `file-name-handler-alist', that handler is responsible for calling the |
| 6692 | functions in `after-insert-file-functions' if appropriate. */); | 6693 | functions in `after-insert-file-functions' if appropriate. */); |
| @@ -2825,8 +2825,8 @@ DEFUN ("optimize-char-table", Foptimize_char_table, Soptimize_char_table, | |||
| 2825 | void | 2825 | void |
| 2826 | map_char_table (c_function, function, table, subtable, arg, depth, indices) | 2826 | map_char_table (c_function, function, table, subtable, arg, depth, indices) |
| 2827 | void (*c_function) P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); | 2827 | void (*c_function) P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); |
| 2828 | Lisp_Object function, table, subtable, arg, *indices; | 2828 | Lisp_Object function, table, subtable, arg; |
| 2829 | int depth; | 2829 | int depth, *indices; |
| 2830 | { | 2830 | { |
| 2831 | int i, to; | 2831 | int i, to; |
| 2832 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 2832 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| @@ -2860,7 +2860,7 @@ map_char_table (c_function, function, table, subtable, arg, depth, indices) | |||
| 2860 | } | 2860 | } |
| 2861 | else | 2861 | else |
| 2862 | { | 2862 | { |
| 2863 | int charset = XFASTINT (indices[0]) - 128; | 2863 | int charset = indices[0] - 128; |
| 2864 | 2864 | ||
| 2865 | i = 32; | 2865 | i = 32; |
| 2866 | to = SUB_CHAR_TABLE_ORDINARY_SLOTS; | 2866 | to = SUB_CHAR_TABLE_ORDINARY_SLOTS; |
| @@ -2874,8 +2874,8 @@ map_char_table (c_function, function, table, subtable, arg, depth, indices) | |||
| 2874 | int charset; | 2874 | int charset; |
| 2875 | 2875 | ||
| 2876 | elt = XCHAR_TABLE (subtable)->contents[i]; | 2876 | elt = XCHAR_TABLE (subtable)->contents[i]; |
| 2877 | XSETFASTINT (indices[depth], i); | 2877 | indices[depth] = i; |
| 2878 | charset = XFASTINT (indices[0]) - 128; | 2878 | charset = indices[0] - 128; |
| 2879 | if (depth == 0 | 2879 | if (depth == 0 |
| 2880 | && (!CHARSET_DEFINED_P (charset) | 2880 | && (!CHARSET_DEFINED_P (charset) |
| 2881 | || charset == CHARSET_8_BIT_CONTROL | 2881 | || charset == CHARSET_8_BIT_CONTROL |
| @@ -2892,8 +2892,8 @@ map_char_table (c_function, function, table, subtable, arg, depth, indices) | |||
| 2892 | { | 2892 | { |
| 2893 | int c1, c2, c; | 2893 | int c1, c2, c; |
| 2894 | 2894 | ||
| 2895 | c1 = depth >= 1 ? XFASTINT (indices[1]) : 0; | 2895 | c1 = depth >= 1 ? indices[1] : 0; |
| 2896 | c2 = depth >= 2 ? XFASTINT (indices[2]) : 0; | 2896 | c2 = depth >= 2 ? indices[2] : 0; |
| 2897 | c = MAKE_CHAR (charset, c1, c2); | 2897 | c = MAKE_CHAR (charset, c1, c2); |
| 2898 | 2898 | ||
| 2899 | if (NILP (elt)) | 2899 | if (NILP (elt)) |
| @@ -2927,14 +2927,14 @@ The key is always a possible IDX argument to `aref'. */) | |||
| 2927 | Lisp_Object function, char_table; | 2927 | Lisp_Object function, char_table; |
| 2928 | { | 2928 | { |
| 2929 | /* The depth of char table is at most 3. */ | 2929 | /* The depth of char table is at most 3. */ |
| 2930 | Lisp_Object indices[3]; | 2930 | int indices[3]; |
| 2931 | 2931 | ||
| 2932 | CHECK_CHAR_TABLE (char_table); | 2932 | CHECK_CHAR_TABLE (char_table); |
| 2933 | 2933 | ||
| 2934 | /* When Lisp_Object is represented as a union, `call2' cannot directly | 2934 | /* When Lisp_Object is represented as a union, `call2' cannot directly |
| 2935 | be passed to map_char_table because it returns a Lisp_Object rather | 2935 | be passed to map_char_table because it returns a Lisp_Object rather |
| 2936 | than returning nothing. | 2936 | than returning nothing. |
| 2937 | Casting leads to crashes on some architectures. -stef */ | 2937 | Casting leads to crashes on some architectures. --Stef */ |
| 2938 | map_char_table (void_call2, Qnil, char_table, char_table, function, 0, indices); | 2938 | map_char_table (void_call2, Qnil, char_table, char_table, function, 0, indices); |
| 2939 | return Qnil; | 2939 | return Qnil; |
| 2940 | } | 2940 | } |
| @@ -4271,7 +4271,7 @@ base64_decode_1 (from, to, length, multibyte, nchars_return) | |||
| 4271 | 4271 | ||
| 4272 | /* The list of all weak hash tables. Don't staticpro this one. */ | 4272 | /* The list of all weak hash tables. Don't staticpro this one. */ |
| 4273 | 4273 | ||
| 4274 | Lisp_Object Vweak_hash_tables; | 4274 | struct Lisp_Hash_Table *weak_hash_tables; |
| 4275 | 4275 | ||
| 4276 | /* Various symbols. */ | 4276 | /* Various symbols. */ |
| 4277 | 4277 | ||
| @@ -4617,11 +4617,11 @@ make_hash_table (test, size, rehash_size, rehash_threshold, weak, | |||
| 4617 | 4617 | ||
| 4618 | /* Maybe add this hash table to the list of all weak hash tables. */ | 4618 | /* Maybe add this hash table to the list of all weak hash tables. */ |
| 4619 | if (NILP (h->weak)) | 4619 | if (NILP (h->weak)) |
| 4620 | h->next_weak = Qnil; | 4620 | h->next_weak = NULL; |
| 4621 | else | 4621 | else |
| 4622 | { | 4622 | { |
| 4623 | h->next_weak = Vweak_hash_tables; | 4623 | h->next_weak = weak_hash_tables; |
| 4624 | Vweak_hash_tables = table; | 4624 | weak_hash_tables = h; |
| 4625 | } | 4625 | } |
| 4626 | 4626 | ||
| 4627 | return table; | 4627 | return table; |
| @@ -4652,8 +4652,8 @@ copy_hash_table (h1) | |||
| 4652 | /* Maybe add this hash table to the list of all weak hash tables. */ | 4652 | /* Maybe add this hash table to the list of all weak hash tables. */ |
| 4653 | if (!NILP (h2->weak)) | 4653 | if (!NILP (h2->weak)) |
| 4654 | { | 4654 | { |
| 4655 | h2->next_weak = Vweak_hash_tables; | 4655 | h2->next_weak = weak_hash_tables; |
| 4656 | Vweak_hash_tables = table; | 4656 | weak_hash_tables = h2; |
| 4657 | } | 4657 | } |
| 4658 | 4658 | ||
| 4659 | return table; | 4659 | return table; |
| @@ -4972,13 +4972,12 @@ sweep_weak_table (h, remove_entries_p) | |||
| 4972 | 4972 | ||
| 4973 | /* Remove elements from weak hash tables that don't survive the | 4973 | /* Remove elements from weak hash tables that don't survive the |
| 4974 | current garbage collection. Remove weak tables that don't survive | 4974 | current garbage collection. Remove weak tables that don't survive |
| 4975 | from Vweak_hash_tables. Called from gc_sweep. */ | 4975 | from weak_hash_tables. Called from gc_sweep. */ |
| 4976 | 4976 | ||
| 4977 | void | 4977 | void |
| 4978 | sweep_weak_hash_tables () | 4978 | sweep_weak_hash_tables () |
| 4979 | { | 4979 | { |
| 4980 | Lisp_Object table, used, next; | 4980 | struct Lisp_Hash_Table *h, *used, *next; |
| 4981 | struct Lisp_Hash_Table *h; | ||
| 4982 | int marked; | 4981 | int marked; |
| 4983 | 4982 | ||
| 4984 | /* Mark all keys and values that are in use. Keep on marking until | 4983 | /* Mark all keys and values that are in use. Keep on marking until |
| @@ -4990,9 +4989,8 @@ sweep_weak_hash_tables () | |||
| 4990 | do | 4989 | do |
| 4991 | { | 4990 | { |
| 4992 | marked = 0; | 4991 | marked = 0; |
| 4993 | for (table = Vweak_hash_tables; !GC_NILP (table); table = h->next_weak) | 4992 | for (h = weak_hash_tables; h; h = h->next_weak) |
| 4994 | { | 4993 | { |
| 4995 | h = XHASH_TABLE (table); | ||
| 4996 | if (h->size & ARRAY_MARK_FLAG) | 4994 | if (h->size & ARRAY_MARK_FLAG) |
| 4997 | marked |= sweep_weak_table (h, 0); | 4995 | marked |= sweep_weak_table (h, 0); |
| 4998 | } | 4996 | } |
| @@ -5000,9 +4998,8 @@ sweep_weak_hash_tables () | |||
| 5000 | while (marked); | 4998 | while (marked); |
| 5001 | 4999 | ||
| 5002 | /* Remove tables and entries that aren't used. */ | 5000 | /* Remove tables and entries that aren't used. */ |
| 5003 | for (table = Vweak_hash_tables, used = Qnil; !GC_NILP (table); table = next) | 5001 | for (h = weak_hash_tables, used = NULL; h; h = next) |
| 5004 | { | 5002 | { |
| 5005 | h = XHASH_TABLE (table); | ||
| 5006 | next = h->next_weak; | 5003 | next = h->next_weak; |
| 5007 | 5004 | ||
| 5008 | if (h->size & ARRAY_MARK_FLAG) | 5005 | if (h->size & ARRAY_MARK_FLAG) |
| @@ -5013,11 +5010,11 @@ sweep_weak_hash_tables () | |||
| 5013 | 5010 | ||
| 5014 | /* Add table to the list of used weak hash tables. */ | 5011 | /* Add table to the list of used weak hash tables. */ |
| 5015 | h->next_weak = used; | 5012 | h->next_weak = used; |
| 5016 | used = table; | 5013 | used = h; |
| 5017 | } | 5014 | } |
| 5018 | } | 5015 | } |
| 5019 | 5016 | ||
| 5020 | Vweak_hash_tables = used; | 5017 | weak_hash_tables = used; |
| 5021 | } | 5018 | } |
| 5022 | 5019 | ||
| 5023 | 5020 | ||
| @@ -5918,7 +5915,7 @@ used if both `use-dialog-box' and this variable are non-nil. */); | |||
| 5918 | void | 5915 | void |
| 5919 | init_fns () | 5916 | init_fns () |
| 5920 | { | 5917 | { |
| 5921 | Vweak_hash_tables = Qnil; | 5918 | weak_hash_tables = NULL; |
| 5922 | } | 5919 | } |
| 5923 | 5920 | ||
| 5924 | /* arch-tag: 787f8219-5b74-46bd-8469-7e1cc475fa31 | 5921 | /* arch-tag: 787f8219-5b74-46bd-8469-7e1cc475fa31 |
diff --git a/src/fontset.c b/src/fontset.c index 7d227d8f43f..855d2322412 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -1438,7 +1438,7 @@ If FRAME is omitted, it defaults to the currently selected frame. */) | |||
| 1438 | { | 1438 | { |
| 1439 | Lisp_Object fontset; | 1439 | Lisp_Object fontset; |
| 1440 | FRAME_PTR f; | 1440 | FRAME_PTR f; |
| 1441 | Lisp_Object indices[3]; | 1441 | int indices[3]; |
| 1442 | Lisp_Object val, tail, elt; | 1442 | Lisp_Object val, tail, elt; |
| 1443 | Lisp_Object *realized; | 1443 | Lisp_Object *realized; |
| 1444 | struct font_info *fontp = NULL; | 1444 | struct font_info *fontp = NULL; |
diff --git a/src/gmalloc.c b/src/gmalloc.c index 50535d4940c..fcd9f655321 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c | |||
| @@ -1,9 +1,6 @@ | |||
| 1 | /* This file is no longer automatically generated from libc. */ | 1 | /* This file is no longer automatically generated from libc. */ |
| 2 | 2 | ||
| 3 | #define _MALLOC_INTERNAL | 3 | #define _MALLOC_INTERNAL |
| 4 | #ifdef HAVE_GTK_AND_PTHREAD | ||
| 5 | #define USE_PTHREAD | ||
| 6 | #endif | ||
| 7 | 4 | ||
| 8 | /* The malloc headers and source files from the C library follow here. */ | 5 | /* The malloc headers and source files from the C library follow here. */ |
| 9 | 6 | ||
| @@ -40,6 +37,10 @@ Fifth Floor, Boston, MA 02110-1301, USA. | |||
| 40 | #include <config.h> | 37 | #include <config.h> |
| 41 | #endif | 38 | #endif |
| 42 | 39 | ||
| 40 | #ifdef HAVE_GTK_AND_PTHREAD | ||
| 41 | #define USE_PTHREAD | ||
| 42 | #endif | ||
| 43 | |||
| 43 | #if ((defined __cplusplus || (defined (__STDC__) && __STDC__) \ | 44 | #if ((defined __cplusplus || (defined (__STDC__) && __STDC__) \ |
| 44 | || defined STDC_HEADERS || defined PROTOTYPES) \ | 45 | || defined STDC_HEADERS || defined PROTOTYPES) \ |
| 45 | && ! defined (BROKEN_PROTOTYPES)) | 46 | && ! defined (BROKEN_PROTOTYPES)) |
| @@ -235,14 +236,21 @@ extern __malloc_size_t _bytes_free; | |||
| 235 | extern __ptr_t _malloc_internal PP ((__malloc_size_t __size)); | 236 | extern __ptr_t _malloc_internal PP ((__malloc_size_t __size)); |
| 236 | extern __ptr_t _realloc_internal PP ((__ptr_t __ptr, __malloc_size_t __size)); | 237 | extern __ptr_t _realloc_internal PP ((__ptr_t __ptr, __malloc_size_t __size)); |
| 237 | extern void _free_internal PP ((__ptr_t __ptr)); | 238 | extern void _free_internal PP ((__ptr_t __ptr)); |
| 239 | extern __ptr_t _malloc_internal_nolock PP ((__malloc_size_t __size)); | ||
| 240 | extern __ptr_t _realloc_internal_nolock PP ((__ptr_t __ptr, __malloc_size_t __size)); | ||
| 241 | extern void _free_internal_nolock PP ((__ptr_t __ptr)); | ||
| 238 | 242 | ||
| 239 | #ifdef USE_PTHREAD | 243 | #ifdef USE_PTHREAD |
| 240 | extern pthread_mutex_t _malloc_mutex; | 244 | extern pthread_mutex_t _malloc_mutex, _aligned_blocks_mutex; |
| 241 | #define LOCK() pthread_mutex_lock (&_malloc_mutex) | 245 | #define LOCK() pthread_mutex_lock (&_malloc_mutex) |
| 242 | #define UNLOCK() pthread_mutex_unlock (&_malloc_mutex) | 246 | #define UNLOCK() pthread_mutex_unlock (&_malloc_mutex) |
| 247 | #define LOCK_ALIGNED_BLOCKS() pthread_mutex_lock (&_aligned_blocks_mutex) | ||
| 248 | #define UNLOCK_ALIGNED_BLOCKS() pthread_mutex_unlock (&_aligned_blocks_mutex) | ||
| 243 | #else | 249 | #else |
| 244 | #define LOCK() | 250 | #define LOCK() |
| 245 | #define UNLOCK() | 251 | #define UNLOCK() |
| 252 | #define LOCK_ALIGNED_BLOCKS() | ||
| 253 | #define UNLOCK_ALIGNED_BLOCKS() | ||
| 246 | #endif | 254 | #endif |
| 247 | 255 | ||
| 248 | #endif /* _MALLOC_INTERNAL. */ | 256 | #endif /* _MALLOC_INTERNAL. */ |
| @@ -373,7 +381,7 @@ Fifth Floor, Boston, MA 02110-1301, USA. | |||
| 373 | extern __ptr_t bss_sbrk PP ((ptrdiff_t __size)); | 381 | extern __ptr_t bss_sbrk PP ((ptrdiff_t __size)); |
| 374 | extern int bss_sbrk_did_unexec; | 382 | extern int bss_sbrk_did_unexec; |
| 375 | #endif | 383 | #endif |
| 376 | __ptr_t (*__morecore) PP ((ptrdiff_t __size)) = __default_morecore; | 384 | __ptr_t (*__morecore) PP ((__malloc_ptrdiff_t __size)) = __default_morecore; |
| 377 | 385 | ||
| 378 | /* Debugging hook for `malloc'. */ | 386 | /* Debugging hook for `malloc'. */ |
| 379 | __ptr_t (*__malloc_hook) PP ((__malloc_size_t __size)); | 387 | __ptr_t (*__malloc_hook) PP ((__malloc_size_t __size)); |
| @@ -554,7 +562,8 @@ register_heapinfo () | |||
| 554 | 562 | ||
| 555 | #ifdef USE_PTHREAD | 563 | #ifdef USE_PTHREAD |
| 556 | static pthread_once_t malloc_init_once_control = PTHREAD_ONCE_INIT; | 564 | static pthread_once_t malloc_init_once_control = PTHREAD_ONCE_INIT; |
| 557 | pthread_mutex_t _malloc_mutex; | 565 | pthread_mutex_t _malloc_mutex = PTHREAD_MUTEX_INITIALIZER; |
| 566 | pthread_mutex_t _aligned_blocks_mutex = PTHREAD_MUTEX_INITIALIZER; | ||
| 558 | #endif | 567 | #endif |
| 559 | 568 | ||
| 560 | static void | 569 | static void |
| @@ -567,7 +576,9 @@ malloc_initialize_1 () | |||
| 567 | if (__malloc_initialize_hook) | 576 | if (__malloc_initialize_hook) |
| 568 | (*__malloc_initialize_hook) (); | 577 | (*__malloc_initialize_hook) (); |
| 569 | 578 | ||
| 570 | #ifdef USE_PTHREAD | 579 | /* We don't use recursive mutex because pthread_mutexattr_init may |
| 580 | call malloc internally. */ | ||
| 581 | #if 0 /* defined (USE_PTHREAD) */ | ||
| 571 | { | 582 | { |
| 572 | pthread_mutexattr_t attr; | 583 | pthread_mutexattr_t attr; |
| 573 | 584 | ||
| @@ -616,9 +627,9 @@ static int morecore_recursing; | |||
| 616 | 627 | ||
| 617 | /* Get neatly aligned memory, initializing or | 628 | /* Get neatly aligned memory, initializing or |
| 618 | growing the heap info table as necessary. */ | 629 | growing the heap info table as necessary. */ |
| 619 | static __ptr_t morecore PP ((__malloc_size_t)); | 630 | static __ptr_t morecore_nolock PP ((__malloc_size_t)); |
| 620 | static __ptr_t | 631 | static __ptr_t |
| 621 | morecore (size) | 632 | morecore_nolock (size) |
| 622 | __malloc_size_t size; | 633 | __malloc_size_t size; |
| 623 | { | 634 | { |
| 624 | __ptr_t result; | 635 | __ptr_t result; |
| @@ -661,7 +672,7 @@ morecore (size) | |||
| 661 | `morecore_recursing' flag and return null. */ | 672 | `morecore_recursing' flag and return null. */ |
| 662 | int save = errno; /* Don't want to clobber errno with ENOMEM. */ | 673 | int save = errno; /* Don't want to clobber errno with ENOMEM. */ |
| 663 | morecore_recursing = 1; | 674 | morecore_recursing = 1; |
| 664 | newinfo = (malloc_info *) _realloc_internal | 675 | newinfo = (malloc_info *) _realloc_internal_nolock |
| 665 | (_heapinfo, newsize * sizeof (malloc_info)); | 676 | (_heapinfo, newsize * sizeof (malloc_info)); |
| 666 | morecore_recursing = 0; | 677 | morecore_recursing = 0; |
| 667 | if (newinfo == NULL) | 678 | if (newinfo == NULL) |
| @@ -717,7 +728,7 @@ morecore (size) | |||
| 717 | /* Reset _heaplimit so _free_internal never decides | 728 | /* Reset _heaplimit so _free_internal never decides |
| 718 | it can relocate or resize the info table. */ | 729 | it can relocate or resize the info table. */ |
| 719 | _heaplimit = 0; | 730 | _heaplimit = 0; |
| 720 | _free_internal (oldinfo); | 731 | _free_internal_nolock (oldinfo); |
| 721 | PROTECT_MALLOC_STATE (0); | 732 | PROTECT_MALLOC_STATE (0); |
| 722 | 733 | ||
| 723 | /* The new heap limit includes the new table just allocated. */ | 734 | /* The new heap limit includes the new table just allocated. */ |
| @@ -732,7 +743,7 @@ morecore (size) | |||
| 732 | 743 | ||
| 733 | /* Allocate memory from the heap. */ | 744 | /* Allocate memory from the heap. */ |
| 734 | __ptr_t | 745 | __ptr_t |
| 735 | _malloc_internal (size) | 746 | _malloc_internal_nolock (size) |
| 736 | __malloc_size_t size; | 747 | __malloc_size_t size; |
| 737 | { | 748 | { |
| 738 | __ptr_t result; | 749 | __ptr_t result; |
| @@ -752,7 +763,6 @@ _malloc_internal (size) | |||
| 752 | return NULL; | 763 | return NULL; |
| 753 | #endif | 764 | #endif |
| 754 | 765 | ||
| 755 | LOCK (); | ||
| 756 | PROTECT_MALLOC_STATE (0); | 766 | PROTECT_MALLOC_STATE (0); |
| 757 | 767 | ||
| 758 | if (size < sizeof (struct list)) | 768 | if (size < sizeof (struct list)) |
| @@ -802,8 +812,10 @@ _malloc_internal (size) | |||
| 802 | /* No free fragments of the desired size, so get a new block | 812 | /* No free fragments of the desired size, so get a new block |
| 803 | and break it into fragments, returning the first. */ | 813 | and break it into fragments, returning the first. */ |
| 804 | #ifdef GC_MALLOC_CHECK | 814 | #ifdef GC_MALLOC_CHECK |
| 805 | result = _malloc_internal (BLOCKSIZE); | 815 | result = _malloc_internal_nolock (BLOCKSIZE); |
| 806 | PROTECT_MALLOC_STATE (0); | 816 | PROTECT_MALLOC_STATE (0); |
| 817 | #elif defined (USE_PTHREAD) | ||
| 818 | result = _malloc_internal_nolock (BLOCKSIZE); | ||
| 807 | #else | 819 | #else |
| 808 | result = malloc (BLOCKSIZE); | 820 | result = malloc (BLOCKSIZE); |
| 809 | #endif | 821 | #endif |
| @@ -874,7 +886,7 @@ _malloc_internal (size) | |||
| 874 | _heaplimit += wantblocks - lastblocks; | 886 | _heaplimit += wantblocks - lastblocks; |
| 875 | continue; | 887 | continue; |
| 876 | } | 888 | } |
| 877 | result = morecore (wantblocks * BLOCKSIZE); | 889 | result = morecore_nolock (wantblocks * BLOCKSIZE); |
| 878 | if (result == NULL) | 890 | if (result == NULL) |
| 879 | goto out; | 891 | goto out; |
| 880 | block = BLOCK (result); | 892 | block = BLOCK (result); |
| @@ -932,7 +944,19 @@ _malloc_internal (size) | |||
| 932 | 944 | ||
| 933 | PROTECT_MALLOC_STATE (1); | 945 | PROTECT_MALLOC_STATE (1); |
| 934 | out: | 946 | out: |
| 947 | return result; | ||
| 948 | } | ||
| 949 | |||
| 950 | __ptr_t | ||
| 951 | _malloc_internal (size) | ||
| 952 | __malloc_size_t size; | ||
| 953 | { | ||
| 954 | __ptr_t result; | ||
| 955 | |||
| 956 | LOCK (); | ||
| 957 | result = _malloc_internal_nolock (size); | ||
| 935 | UNLOCK (); | 958 | UNLOCK (); |
| 959 | |||
| 936 | return result; | 960 | return result; |
| 937 | } | 961 | } |
| 938 | 962 | ||
| @@ -940,10 +964,21 @@ __ptr_t | |||
| 940 | malloc (size) | 964 | malloc (size) |
| 941 | __malloc_size_t size; | 965 | __malloc_size_t size; |
| 942 | { | 966 | { |
| 967 | __ptr_t (*hook) (__malloc_size_t); | ||
| 968 | |||
| 943 | if (!__malloc_initialized && !__malloc_initialize ()) | 969 | if (!__malloc_initialized && !__malloc_initialize ()) |
| 944 | return NULL; | 970 | return NULL; |
| 945 | 971 | ||
| 946 | return (__malloc_hook != NULL ? *__malloc_hook : _malloc_internal) (size); | 972 | /* Copy the value of __malloc_hook to an automatic variable in case |
| 973 | __malloc_hook is modified in another thread between its | ||
| 974 | NULL-check and the use. | ||
| 975 | |||
| 976 | Note: Strictly speaking, this is not a right solution. We should | ||
| 977 | use mutexes to access non-read-only variables that are shared | ||
| 978 | among multiple threads. We just leave it for compatibility with | ||
| 979 | glibc malloc (i.e., assignments to __malloc_hook) for now. */ | ||
| 980 | hook = __malloc_hook; | ||
| 981 | return (hook != NULL ? *hook : _malloc_internal) (size); | ||
| 947 | } | 982 | } |
| 948 | 983 | ||
| 949 | #ifndef _LIBC | 984 | #ifndef _LIBC |
| @@ -1024,9 +1059,9 @@ void (*__free_hook) PP ((__ptr_t __ptr)); | |||
| 1024 | struct alignlist *_aligned_blocks = NULL; | 1059 | struct alignlist *_aligned_blocks = NULL; |
| 1025 | 1060 | ||
| 1026 | /* Return memory to the heap. | 1061 | /* Return memory to the heap. |
| 1027 | Like `free' but don't call a __free_hook if there is one. */ | 1062 | Like `_free_internal' but don't lock mutex. */ |
| 1028 | void | 1063 | void |
| 1029 | _free_internal (ptr) | 1064 | _free_internal_nolock (ptr) |
| 1030 | __ptr_t ptr; | 1065 | __ptr_t ptr; |
| 1031 | { | 1066 | { |
| 1032 | int type; | 1067 | int type; |
| @@ -1043,9 +1078,9 @@ _free_internal (ptr) | |||
| 1043 | if (ptr == NULL) | 1078 | if (ptr == NULL) |
| 1044 | return; | 1079 | return; |
| 1045 | 1080 | ||
| 1046 | LOCK (); | ||
| 1047 | PROTECT_MALLOC_STATE (0); | 1081 | PROTECT_MALLOC_STATE (0); |
| 1048 | 1082 | ||
| 1083 | LOCK_ALIGNED_BLOCKS (); | ||
| 1049 | for (l = _aligned_blocks; l != NULL; l = l->next) | 1084 | for (l = _aligned_blocks; l != NULL; l = l->next) |
| 1050 | if (l->aligned == ptr) | 1085 | if (l->aligned == ptr) |
| 1051 | { | 1086 | { |
| @@ -1053,6 +1088,7 @@ _free_internal (ptr) | |||
| 1053 | ptr = l->exact; | 1088 | ptr = l->exact; |
| 1054 | break; | 1089 | break; |
| 1055 | } | 1090 | } |
| 1091 | UNLOCK_ALIGNED_BLOCKS (); | ||
| 1056 | 1092 | ||
| 1057 | block = BLOCK (ptr); | 1093 | block = BLOCK (ptr); |
| 1058 | 1094 | ||
| @@ -1158,7 +1194,7 @@ _free_internal (ptr) | |||
| 1158 | table's blocks to the system before we have copied them to | 1194 | table's blocks to the system before we have copied them to |
| 1159 | the new location. */ | 1195 | the new location. */ |
| 1160 | _heaplimit = 0; | 1196 | _heaplimit = 0; |
| 1161 | _free_internal (_heapinfo); | 1197 | _free_internal_nolock (_heapinfo); |
| 1162 | _heaplimit = oldlimit; | 1198 | _heaplimit = oldlimit; |
| 1163 | 1199 | ||
| 1164 | /* Tell malloc to search from the beginning of the heap for | 1200 | /* Tell malloc to search from the beginning of the heap for |
| @@ -1166,8 +1202,8 @@ _free_internal (ptr) | |||
| 1166 | _heapindex = 0; | 1202 | _heapindex = 0; |
| 1167 | 1203 | ||
| 1168 | /* Allocate new space for the info table and move its data. */ | 1204 | /* Allocate new space for the info table and move its data. */ |
| 1169 | newinfo = (malloc_info *) _malloc_internal (info_blocks | 1205 | newinfo = (malloc_info *) _malloc_internal_nolock (info_blocks |
| 1170 | * BLOCKSIZE); | 1206 | * BLOCKSIZE); |
| 1171 | PROTECT_MALLOC_STATE (0); | 1207 | PROTECT_MALLOC_STATE (0); |
| 1172 | memmove (newinfo, _heapinfo, info_blocks * BLOCKSIZE); | 1208 | memmove (newinfo, _heapinfo, info_blocks * BLOCKSIZE); |
| 1173 | _heapinfo = newinfo; | 1209 | _heapinfo = newinfo; |
| @@ -1230,8 +1266,8 @@ _free_internal (ptr) | |||
| 1230 | _chunks_free -= BLOCKSIZE >> type; | 1266 | _chunks_free -= BLOCKSIZE >> type; |
| 1231 | _bytes_free -= BLOCKSIZE; | 1267 | _bytes_free -= BLOCKSIZE; |
| 1232 | 1268 | ||
| 1233 | #ifdef GC_MALLOC_CHECK | 1269 | #if defined (GC_MALLOC_CHECK) || defined (USE_PTHREAD) |
| 1234 | _free_internal (ADDRESS (block)); | 1270 | _free_internal_nolock (ADDRESS (block)); |
| 1235 | #else | 1271 | #else |
| 1236 | free (ADDRESS (block)); | 1272 | free (ADDRESS (block)); |
| 1237 | #endif | 1273 | #endif |
| @@ -1269,6 +1305,16 @@ _free_internal (ptr) | |||
| 1269 | } | 1305 | } |
| 1270 | 1306 | ||
| 1271 | PROTECT_MALLOC_STATE (1); | 1307 | PROTECT_MALLOC_STATE (1); |
| 1308 | } | ||
| 1309 | |||
| 1310 | /* Return memory to the heap. | ||
| 1311 | Like `free' but don't call a __free_hook if there is one. */ | ||
| 1312 | void | ||
| 1313 | _free_internal (ptr) | ||
| 1314 | __ptr_t ptr; | ||
| 1315 | { | ||
| 1316 | LOCK (); | ||
| 1317 | _free_internal_nolock (ptr); | ||
| 1272 | UNLOCK (); | 1318 | UNLOCK (); |
| 1273 | } | 1319 | } |
| 1274 | 1320 | ||
| @@ -1278,8 +1324,10 @@ FREE_RETURN_TYPE | |||
| 1278 | free (ptr) | 1324 | free (ptr) |
| 1279 | __ptr_t ptr; | 1325 | __ptr_t ptr; |
| 1280 | { | 1326 | { |
| 1281 | if (__free_hook != NULL) | 1327 | void (*hook) (__ptr_t) = __free_hook; |
| 1282 | (*__free_hook) (ptr); | 1328 | |
| 1329 | if (hook != NULL) | ||
| 1330 | (*hook) (ptr); | ||
| 1283 | else | 1331 | else |
| 1284 | _free_internal (ptr); | 1332 | _free_internal (ptr); |
| 1285 | } | 1333 | } |
| @@ -1415,7 +1463,7 @@ __ptr_t (*__realloc_hook) PP ((__ptr_t __ptr, __malloc_size_t __size)); | |||
| 1415 | new region. This module has incestuous knowledge of the | 1463 | new region. This module has incestuous knowledge of the |
| 1416 | internals of both free and malloc. */ | 1464 | internals of both free and malloc. */ |
| 1417 | __ptr_t | 1465 | __ptr_t |
| 1418 | _realloc_internal (ptr, size) | 1466 | _realloc_internal_nolock (ptr, size) |
| 1419 | __ptr_t ptr; | 1467 | __ptr_t ptr; |
| 1420 | __malloc_size_t size; | 1468 | __malloc_size_t size; |
| 1421 | { | 1469 | { |
| @@ -1425,15 +1473,14 @@ _realloc_internal (ptr, size) | |||
| 1425 | 1473 | ||
| 1426 | if (size == 0) | 1474 | if (size == 0) |
| 1427 | { | 1475 | { |
| 1428 | _free_internal (ptr); | 1476 | _free_internal_nolock (ptr); |
| 1429 | return _malloc_internal (0); | 1477 | return _malloc_internal_nolock (0); |
| 1430 | } | 1478 | } |
| 1431 | else if (ptr == NULL) | 1479 | else if (ptr == NULL) |
| 1432 | return _malloc_internal (size); | 1480 | return _malloc_internal_nolock (size); |
| 1433 | 1481 | ||
| 1434 | block = BLOCK (ptr); | 1482 | block = BLOCK (ptr); |
| 1435 | 1483 | ||
| 1436 | LOCK (); | ||
| 1437 | PROTECT_MALLOC_STATE (0); | 1484 | PROTECT_MALLOC_STATE (0); |
| 1438 | 1485 | ||
| 1439 | type = _heapinfo[block].busy.type; | 1486 | type = _heapinfo[block].busy.type; |
| @@ -1443,11 +1490,11 @@ _realloc_internal (ptr, size) | |||
| 1443 | /* Maybe reallocate a large block to a small fragment. */ | 1490 | /* Maybe reallocate a large block to a small fragment. */ |
| 1444 | if (size <= BLOCKSIZE / 2) | 1491 | if (size <= BLOCKSIZE / 2) |
| 1445 | { | 1492 | { |
| 1446 | result = _malloc_internal (size); | 1493 | result = _malloc_internal_nolock (size); |
| 1447 | if (result != NULL) | 1494 | if (result != NULL) |
| 1448 | { | 1495 | { |
| 1449 | memcpy (result, ptr, size); | 1496 | memcpy (result, ptr, size); |
| 1450 | _free_internal (ptr); | 1497 | _free_internal_nolock (ptr); |
| 1451 | goto out; | 1498 | goto out; |
| 1452 | } | 1499 | } |
| 1453 | } | 1500 | } |
| @@ -1467,7 +1514,7 @@ _realloc_internal (ptr, size) | |||
| 1467 | Now we will free this chunk; increment the statistics counter | 1514 | Now we will free this chunk; increment the statistics counter |
| 1468 | so it doesn't become wrong when _free_internal decrements it. */ | 1515 | so it doesn't become wrong when _free_internal decrements it. */ |
| 1469 | ++_chunks_used; | 1516 | ++_chunks_used; |
| 1470 | _free_internal (ADDRESS (block + blocks)); | 1517 | _free_internal_nolock (ADDRESS (block + blocks)); |
| 1471 | result = ptr; | 1518 | result = ptr; |
| 1472 | } | 1519 | } |
| 1473 | else if (blocks == _heapinfo[block].busy.info.size) | 1520 | else if (blocks == _heapinfo[block].busy.info.size) |
| @@ -1482,8 +1529,8 @@ _realloc_internal (ptr, size) | |||
| 1482 | /* Prevent free from actually returning memory to the system. */ | 1529 | /* Prevent free from actually returning memory to the system. */ |
| 1483 | oldlimit = _heaplimit; | 1530 | oldlimit = _heaplimit; |
| 1484 | _heaplimit = 0; | 1531 | _heaplimit = 0; |
| 1485 | _free_internal (ptr); | 1532 | _free_internal_nolock (ptr); |
| 1486 | result = _malloc_internal (size); | 1533 | result = _malloc_internal_nolock (size); |
| 1487 | PROTECT_MALLOC_STATE (0); | 1534 | PROTECT_MALLOC_STATE (0); |
| 1488 | if (_heaplimit == 0) | 1535 | if (_heaplimit == 0) |
| 1489 | _heaplimit = oldlimit; | 1536 | _heaplimit = oldlimit; |
| @@ -1493,13 +1540,13 @@ _realloc_internal (ptr, size) | |||
| 1493 | the thing we just freed. Unfortunately it might | 1540 | the thing we just freed. Unfortunately it might |
| 1494 | have been coalesced with its neighbors. */ | 1541 | have been coalesced with its neighbors. */ |
| 1495 | if (_heapindex == block) | 1542 | if (_heapindex == block) |
| 1496 | (void) _malloc_internal (blocks * BLOCKSIZE); | 1543 | (void) _malloc_internal_nolock (blocks * BLOCKSIZE); |
| 1497 | else | 1544 | else |
| 1498 | { | 1545 | { |
| 1499 | __ptr_t previous | 1546 | __ptr_t previous |
| 1500 | = _malloc_internal ((block - _heapindex) * BLOCKSIZE); | 1547 | = _malloc_internal_nolock ((block - _heapindex) * BLOCKSIZE); |
| 1501 | (void) _malloc_internal (blocks * BLOCKSIZE); | 1548 | (void) _malloc_internal_nolock (blocks * BLOCKSIZE); |
| 1502 | _free_internal (previous); | 1549 | _free_internal_nolock (previous); |
| 1503 | } | 1550 | } |
| 1504 | goto out; | 1551 | goto out; |
| 1505 | } | 1552 | } |
| @@ -1519,18 +1566,31 @@ _realloc_internal (ptr, size) | |||
| 1519 | { | 1566 | { |
| 1520 | /* The new size is different; allocate a new space, | 1567 | /* The new size is different; allocate a new space, |
| 1521 | and copy the lesser of the new size and the old. */ | 1568 | and copy the lesser of the new size and the old. */ |
| 1522 | result = _malloc_internal (size); | 1569 | result = _malloc_internal_nolock (size); |
| 1523 | if (result == NULL) | 1570 | if (result == NULL) |
| 1524 | goto out; | 1571 | goto out; |
| 1525 | memcpy (result, ptr, min (size, (__malloc_size_t) 1 << type)); | 1572 | memcpy (result, ptr, min (size, (__malloc_size_t) 1 << type)); |
| 1526 | _free_internal (ptr); | 1573 | _free_internal_nolock (ptr); |
| 1527 | } | 1574 | } |
| 1528 | break; | 1575 | break; |
| 1529 | } | 1576 | } |
| 1530 | 1577 | ||
| 1531 | PROTECT_MALLOC_STATE (1); | 1578 | PROTECT_MALLOC_STATE (1); |
| 1532 | out: | 1579 | out: |
| 1580 | return result; | ||
| 1581 | } | ||
| 1582 | |||
| 1583 | __ptr_t | ||
| 1584 | _realloc_internal (ptr, size) | ||
| 1585 | __ptr_t ptr; | ||
| 1586 | __malloc_size_t size; | ||
| 1587 | { | ||
| 1588 | __ptr_t result; | ||
| 1589 | |||
| 1590 | LOCK(); | ||
| 1591 | result = _realloc_internal_nolock (ptr, size); | ||
| 1533 | UNLOCK (); | 1592 | UNLOCK (); |
| 1593 | |||
| 1534 | return result; | 1594 | return result; |
| 1535 | } | 1595 | } |
| 1536 | 1596 | ||
| @@ -1539,11 +1599,13 @@ realloc (ptr, size) | |||
| 1539 | __ptr_t ptr; | 1599 | __ptr_t ptr; |
| 1540 | __malloc_size_t size; | 1600 | __malloc_size_t size; |
| 1541 | { | 1601 | { |
| 1602 | __ptr_t (*hook) (__ptr_t, __malloc_size_t); | ||
| 1603 | |||
| 1542 | if (!__malloc_initialized && !__malloc_initialize ()) | 1604 | if (!__malloc_initialized && !__malloc_initialize ()) |
| 1543 | return NULL; | 1605 | return NULL; |
| 1544 | 1606 | ||
| 1545 | return (__realloc_hook != NULL ? *__realloc_hook : _realloc_internal) | 1607 | hook = __realloc_hook; |
| 1546 | (ptr, size); | 1608 | return (hook != NULL ? *hook : _realloc_internal) (ptr, size); |
| 1547 | } | 1609 | } |
| 1548 | /* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc. | 1610 | /* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc. |
| 1549 | 1611 | ||
| @@ -1681,9 +1743,10 @@ memalign (alignment, size) | |||
| 1681 | { | 1743 | { |
| 1682 | __ptr_t result; | 1744 | __ptr_t result; |
| 1683 | unsigned long int adj, lastadj; | 1745 | unsigned long int adj, lastadj; |
| 1746 | __ptr_t (*hook) (__malloc_size_t, __malloc_size_t) = __memalign_hook; | ||
| 1684 | 1747 | ||
| 1685 | if (__memalign_hook) | 1748 | if (hook) |
| 1686 | return (*__memalign_hook) (alignment, size); | 1749 | return (*hook) (alignment, size); |
| 1687 | 1750 | ||
| 1688 | /* Allocate a block with enough extra space to pad the block with up to | 1751 | /* Allocate a block with enough extra space to pad the block with up to |
| 1689 | (ALIGNMENT - 1) bytes if necessary. */ | 1752 | (ALIGNMENT - 1) bytes if necessary. */ |
| @@ -1718,6 +1781,7 @@ memalign (alignment, size) | |||
| 1718 | of an allocated block. */ | 1781 | of an allocated block. */ |
| 1719 | 1782 | ||
| 1720 | struct alignlist *l; | 1783 | struct alignlist *l; |
| 1784 | LOCK_ALIGNED_BLOCKS (); | ||
| 1721 | for (l = _aligned_blocks; l != NULL; l = l->next) | 1785 | for (l = _aligned_blocks; l != NULL; l = l->next) |
| 1722 | if (l->aligned == NULL) | 1786 | if (l->aligned == NULL) |
| 1723 | /* This slot is free. Use it. */ | 1787 | /* This slot is free. Use it. */ |
| @@ -1725,16 +1789,23 @@ memalign (alignment, size) | |||
| 1725 | if (l == NULL) | 1789 | if (l == NULL) |
| 1726 | { | 1790 | { |
| 1727 | l = (struct alignlist *) malloc (sizeof (struct alignlist)); | 1791 | l = (struct alignlist *) malloc (sizeof (struct alignlist)); |
| 1728 | if (l == NULL) | 1792 | if (l != NULL) |
| 1729 | { | 1793 | { |
| 1730 | free (result); | 1794 | l->next = _aligned_blocks; |
| 1731 | return NULL; | 1795 | _aligned_blocks = l; |
| 1732 | } | 1796 | } |
| 1733 | l->next = _aligned_blocks; | ||
| 1734 | _aligned_blocks = l; | ||
| 1735 | } | 1797 | } |
| 1736 | l->exact = result; | 1798 | if (l != NULL) |
| 1737 | result = l->aligned = (char *) result + alignment - adj; | 1799 | { |
| 1800 | l->exact = result; | ||
| 1801 | result = l->aligned = (char *) result + alignment - adj; | ||
| 1802 | } | ||
| 1803 | UNLOCK_ALIGNED_BLOCKS (); | ||
| 1804 | if (l == NULL) | ||
| 1805 | { | ||
| 1806 | free (result); | ||
| 1807 | result = NULL; | ||
| 1808 | } | ||
| 1738 | } | 1809 | } |
| 1739 | 1810 | ||
| 1740 | return result; | 1811 | return result; |
diff --git a/src/image.c b/src/image.c index 322689c8d0f..f22c5014404 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -3123,8 +3123,8 @@ static void convert_mono_to_color_image (f, img, foreground, background) | |||
| 3123 | release_frame_dc (f, hdc); | 3123 | release_frame_dc (f, hdc); |
| 3124 | old_prev = SelectObject (old_img_dc, img->pixmap); | 3124 | old_prev = SelectObject (old_img_dc, img->pixmap); |
| 3125 | new_prev = SelectObject (new_img_dc, new_pixmap); | 3125 | new_prev = SelectObject (new_img_dc, new_pixmap); |
| 3126 | SetTextColor (new_img_dc, foreground); | 3126 | SetTextColor (new_img_dc, background); |
| 3127 | SetBkColor (new_img_dc, background); | 3127 | SetBkColor (new_img_dc, foreground); |
| 3128 | 3128 | ||
| 3129 | BitBlt (new_img_dc, 0, 0, img->width, img->height, old_img_dc, | 3129 | BitBlt (new_img_dc, 0, 0, img->width, img->height, old_img_dc, |
| 3130 | 0, 0, SRCCOPY); | 3130 | 0, 0, SRCCOPY); |
diff --git a/src/keyboard.c b/src/keyboard.c index 9786449a003..1fc666aa2ff 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -1498,7 +1498,7 @@ DEFUN ("track-mouse", Ftrack_mouse, Strack_mouse, 0, UNEVALLED, 0, | |||
| 1498 | Within a `track-mouse' form, mouse motion generates input events that | 1498 | Within a `track-mouse' form, mouse motion generates input events that |
| 1499 | you can read with `read-event'. | 1499 | you can read with `read-event'. |
| 1500 | Normally, mouse motion is ignored. | 1500 | Normally, mouse motion is ignored. |
| 1501 | usage: (track-mouse BODY ...) */) | 1501 | usage: (track-mouse BODY...) */) |
| 1502 | (args) | 1502 | (args) |
| 1503 | Lisp_Object args; | 1503 | Lisp_Object args; |
| 1504 | { | 1504 | { |
diff --git a/src/keymap.c b/src/keymap.c index 904e3c89d55..869fd7a24a6 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -422,7 +422,7 @@ Return PARENT. PARENT should be nil or another keymap. */) | |||
| 422 | 422 | ||
| 423 | if (CHAR_TABLE_P (XCAR (list))) | 423 | if (CHAR_TABLE_P (XCAR (list))) |
| 424 | { | 424 | { |
| 425 | Lisp_Object indices[3]; | 425 | int indices[3]; |
| 426 | 426 | ||
| 427 | map_char_table (fix_submap_inheritance, Qnil, | 427 | map_char_table (fix_submap_inheritance, Qnil, |
| 428 | XCAR (list), XCAR (list), | 428 | XCAR (list), XCAR (list), |
| @@ -721,7 +721,7 @@ map_keymap (map, fun, args, data, autoload) | |||
| 721 | } | 721 | } |
| 722 | else if (CHAR_TABLE_P (binding)) | 722 | else if (CHAR_TABLE_P (binding)) |
| 723 | { | 723 | { |
| 724 | Lisp_Object indices[3]; | 724 | int indices[3]; |
| 725 | map_char_table (map_keymap_char_table_item, Qnil, binding, binding, | 725 | map_char_table (map_keymap_char_table_item, Qnil, binding, binding, |
| 726 | Fcons (make_save_value (fun, 0), | 726 | Fcons (make_save_value (fun, 0), |
| 727 | Fcons (make_save_value (data, 0), | 727 | Fcons (make_save_value (data, 0), |
| @@ -1072,7 +1072,7 @@ is not copied. */) | |||
| 1072 | Lisp_Object elt = XCAR (keymap); | 1072 | Lisp_Object elt = XCAR (keymap); |
| 1073 | if (CHAR_TABLE_P (elt)) | 1073 | if (CHAR_TABLE_P (elt)) |
| 1074 | { | 1074 | { |
| 1075 | Lisp_Object indices[3]; | 1075 | int indices[3]; |
| 1076 | elt = Fcopy_sequence (elt); | 1076 | elt = Fcopy_sequence (elt); |
| 1077 | map_char_table (copy_keymap_1, Qnil, elt, elt, elt, 0, indices); | 1077 | map_char_table (copy_keymap_1, Qnil, elt, elt, elt, 0, indices); |
| 1078 | } | 1078 | } |
| @@ -1149,7 +1149,7 @@ binding KEY to DEF is added at the front of KEYMAP. */) | |||
| 1149 | if (SYMBOLP (def) && !EQ (Vdefine_key_rebound_commands, Qt)) | 1149 | if (SYMBOLP (def) && !EQ (Vdefine_key_rebound_commands, Qt)) |
| 1150 | Vdefine_key_rebound_commands = Fcons (def, Vdefine_key_rebound_commands); | 1150 | Vdefine_key_rebound_commands = Fcons (def, Vdefine_key_rebound_commands); |
| 1151 | 1151 | ||
| 1152 | meta_bit = (VECTORP (key) || STRINGP (key) && STRING_MULTIBYTE (key) | 1152 | meta_bit = (VECTORP (key) || (STRINGP (key) && STRING_MULTIBYTE (key)) |
| 1153 | ? meta_modifier : 0x80); | 1153 | ? meta_modifier : 0x80); |
| 1154 | 1154 | ||
| 1155 | if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, 0))) | 1155 | if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, 0))) |
| @@ -1534,14 +1534,47 @@ current_minor_maps (modeptr, mapptr) | |||
| 1534 | } | 1534 | } |
| 1535 | 1535 | ||
| 1536 | DEFUN ("current-active-maps", Fcurrent_active_maps, Scurrent_active_maps, | 1536 | DEFUN ("current-active-maps", Fcurrent_active_maps, Scurrent_active_maps, |
| 1537 | 0, 1, 0, | 1537 | 0, 2, 0, |
| 1538 | doc: /* Return a list of the currently active keymaps. | 1538 | doc: /* Return a list of the currently active keymaps. |
| 1539 | OLP if non-nil indicates that we should obey `overriding-local-map' and | 1539 | OLP if non-nil indicates that we should obey `overriding-local-map' and |
| 1540 | `overriding-terminal-local-map'. */) | 1540 | `overriding-terminal-local-map'. POSITION can specify a click position |
| 1541 | (olp) | 1541 | like in the respective argument of `key-binding'. */) |
| 1542 | Lisp_Object olp; | 1542 | (olp, position) |
| 1543 | Lisp_Object olp, position; | ||
| 1543 | { | 1544 | { |
| 1544 | Lisp_Object keymaps = Fcons (current_global_map, Qnil); | 1545 | int count = SPECPDL_INDEX (); |
| 1546 | |||
| 1547 | Lisp_Object keymaps; | ||
| 1548 | |||
| 1549 | /* If a mouse click position is given, our variables are based on | ||
| 1550 | the buffer clicked on, not the current buffer. So we may have to | ||
| 1551 | switch the buffer here. */ | ||
| 1552 | |||
| 1553 | if (CONSP (position)) | ||
| 1554 | { | ||
| 1555 | Lisp_Object window; | ||
| 1556 | |||
| 1557 | window = POSN_WINDOW (position); | ||
| 1558 | |||
| 1559 | if (WINDOWP (window) | ||
| 1560 | && BUFFERP (XWINDOW (window)->buffer) | ||
| 1561 | && XBUFFER (XWINDOW (window)->buffer) != current_buffer) | ||
| 1562 | { | ||
| 1563 | /* Arrange to go back to the original buffer once we're done | ||
| 1564 | processing the key sequence. We don't use | ||
| 1565 | save_excursion_{save,restore} here, in analogy to | ||
| 1566 | `read-key-sequence' to avoid saving point. Maybe this | ||
| 1567 | would not be a problem here, but it is easier to keep | ||
| 1568 | things the same. | ||
| 1569 | */ | ||
| 1570 | |||
| 1571 | record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); | ||
| 1572 | |||
| 1573 | set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); | ||
| 1574 | } | ||
| 1575 | } | ||
| 1576 | |||
| 1577 | keymaps = Fcons (current_global_map, Qnil); | ||
| 1545 | 1578 | ||
| 1546 | if (!NILP (olp)) | 1579 | if (!NILP (olp)) |
| 1547 | { | 1580 | { |
| @@ -1555,15 +1588,76 @@ OLP if non-nil indicates that we should obey `overriding-local-map' and | |||
| 1555 | } | 1588 | } |
| 1556 | if (NILP (XCDR (keymaps))) | 1589 | if (NILP (XCDR (keymaps))) |
| 1557 | { | 1590 | { |
| 1558 | Lisp_Object local; | ||
| 1559 | Lisp_Object *maps; | 1591 | Lisp_Object *maps; |
| 1560 | int nmaps, i; | 1592 | int nmaps, i; |
| 1561 | 1593 | ||
| 1562 | /* This usually returns the buffer's local map, | 1594 | Lisp_Object keymap, local_map; |
| 1563 | but that can be overridden by a `local-map' property. */ | 1595 | EMACS_INT pt; |
| 1564 | local = get_local_map (PT, current_buffer, Qlocal_map); | 1596 | |
| 1565 | if (!NILP (local)) | 1597 | pt = INTEGERP (position) ? XINT (position) |
| 1566 | keymaps = Fcons (local, keymaps); | 1598 | : MARKERP (position) ? marker_position (position) |
| 1599 | : PT; | ||
| 1600 | |||
| 1601 | /* Get the buffer local maps, possibly overriden by text or | ||
| 1602 | overlay properties */ | ||
| 1603 | |||
| 1604 | local_map = get_local_map (pt, current_buffer, Qlocal_map); | ||
| 1605 | keymap = get_local_map (pt, current_buffer, Qkeymap); | ||
| 1606 | |||
| 1607 | if (CONSP (position)) | ||
| 1608 | { | ||
| 1609 | Lisp_Object string; | ||
| 1610 | |||
| 1611 | /* For a mouse click, get the local text-property keymap | ||
| 1612 | of the place clicked on, rather than point. */ | ||
| 1613 | |||
| 1614 | if (POSN_INBUFFER_P (position)) | ||
| 1615 | { | ||
| 1616 | Lisp_Object pos; | ||
| 1617 | |||
| 1618 | pos = POSN_BUFFER_POSN (position); | ||
| 1619 | if (INTEGERP (pos) | ||
| 1620 | && XINT (pos) >= BEG && XINT (pos) <= Z) | ||
| 1621 | { | ||
| 1622 | local_map = get_local_map (XINT (pos), | ||
| 1623 | current_buffer, Qlocal_map); | ||
| 1624 | |||
| 1625 | keymap = get_local_map (XINT (pos), | ||
| 1626 | current_buffer, Qkeymap); | ||
| 1627 | } | ||
| 1628 | } | ||
| 1629 | |||
| 1630 | /* If on a mode line string with a local keymap, | ||
| 1631 | or for a click on a string, i.e. overlay string or a | ||
| 1632 | string displayed via the `display' property, | ||
| 1633 | consider `local-map' and `keymap' properties of | ||
| 1634 | that string. */ | ||
| 1635 | |||
| 1636 | if (string = POSN_STRING (position), | ||
| 1637 | (CONSP (string) && STRINGP (XCAR (string)))) | ||
| 1638 | { | ||
| 1639 | Lisp_Object pos, map; | ||
| 1640 | |||
| 1641 | pos = XCDR (string); | ||
| 1642 | string = XCAR (string); | ||
| 1643 | if (INTEGERP (pos) | ||
| 1644 | && XINT (pos) >= 0 | ||
| 1645 | && XINT (pos) < SCHARS (string)) | ||
| 1646 | { | ||
| 1647 | map = Fget_text_property (pos, Qlocal_map, string); | ||
| 1648 | if (!NILP (map)) | ||
| 1649 | local_map = map; | ||
| 1650 | |||
| 1651 | map = Fget_text_property (pos, Qkeymap, string); | ||
| 1652 | if (!NILP (map)) | ||
| 1653 | keymap = map; | ||
| 1654 | } | ||
| 1655 | } | ||
| 1656 | |||
| 1657 | } | ||
| 1658 | |||
| 1659 | if (!NILP (local_map)) | ||
| 1660 | keymaps = Fcons (local_map, keymaps); | ||
| 1567 | 1661 | ||
| 1568 | /* Now put all the minor mode keymaps on the list. */ | 1662 | /* Now put all the minor mode keymaps on the list. */ |
| 1569 | nmaps = current_minor_maps (0, &maps); | 1663 | nmaps = current_minor_maps (0, &maps); |
| @@ -1572,12 +1666,12 @@ OLP if non-nil indicates that we should obey `overriding-local-map' and | |||
| 1572 | if (!NILP (maps[i])) | 1666 | if (!NILP (maps[i])) |
| 1573 | keymaps = Fcons (maps[i], keymaps); | 1667 | keymaps = Fcons (maps[i], keymaps); |
| 1574 | 1668 | ||
| 1575 | /* This returns nil unless there is a `keymap' property. */ | 1669 | if (!NILP (keymap)) |
| 1576 | local = get_local_map (PT, current_buffer, Qkeymap); | 1670 | keymaps = Fcons (keymap, keymaps); |
| 1577 | if (!NILP (local)) | ||
| 1578 | keymaps = Fcons (local, keymaps); | ||
| 1579 | } | 1671 | } |
| 1580 | 1672 | ||
| 1673 | unbind_to (count, Qnil); | ||
| 1674 | |||
| 1581 | return keymaps; | 1675 | return keymaps; |
| 1582 | } | 1676 | } |
| 1583 | 1677 | ||
| @@ -1945,12 +2039,23 @@ DEFUN ("current-minor-mode-maps", Fcurrent_minor_mode_maps, Scurrent_minor_mode_ | |||
| 1945 | 2039 | ||
| 1946 | /* Help functions for describing and documenting keymaps. */ | 2040 | /* Help functions for describing and documenting keymaps. */ |
| 1947 | 2041 | ||
| 2042 | struct accessible_keymaps_data { | ||
| 2043 | Lisp_Object maps, tail, thisseq; | ||
| 2044 | /* Does the current sequence end in the meta-prefix-char? */ | ||
| 2045 | int is_metized; | ||
| 2046 | }; | ||
| 1948 | 2047 | ||
| 1949 | static void | 2048 | static void |
| 1950 | accessible_keymaps_1 (key, cmd, maps, tail, thisseq, is_metized) | 2049 | accessible_keymaps_1 (key, cmd, args, data) |
| 1951 | Lisp_Object maps, tail, thisseq, key, cmd; | 2050 | Lisp_Object key, cmd, args; |
| 1952 | int is_metized; /* If 1, `key' is assumed to be INTEGERP. */ | 2051 | /* Use void* to be compatible with map_keymap_function_t. */ |
| 2052 | void *data; | ||
| 1953 | { | 2053 | { |
| 2054 | struct accessible_keymaps_data *d = data; /* Cast! */ | ||
| 2055 | Lisp_Object maps = d->maps; | ||
| 2056 | Lisp_Object tail = d->tail; | ||
| 2057 | Lisp_Object thisseq = d->thisseq; | ||
| 2058 | int is_metized = d->is_metized && INTEGERP (key); | ||
| 1954 | Lisp_Object tem; | 2059 | Lisp_Object tem; |
| 1955 | 2060 | ||
| 1956 | cmd = get_keymap (get_keyelt (cmd, 0), 0, 0); | 2061 | cmd = get_keymap (get_keyelt (cmd, 0), 0, 0); |
| @@ -2004,17 +2109,6 @@ accessible_keymaps_1 (key, cmd, maps, tail, thisseq, is_metized) | |||
| 2004 | } | 2109 | } |
| 2005 | } | 2110 | } |
| 2006 | 2111 | ||
| 2007 | static void | ||
| 2008 | accessible_keymaps_char_table (args, index, cmd) | ||
| 2009 | Lisp_Object args, index, cmd; | ||
| 2010 | { | ||
| 2011 | accessible_keymaps_1 (index, cmd, | ||
| 2012 | XCAR (XCAR (args)), | ||
| 2013 | XCAR (XCDR (args)), | ||
| 2014 | XCDR (XCDR (args)), | ||
| 2015 | XINT (XCDR (XCAR (args)))); | ||
| 2016 | } | ||
| 2017 | |||
| 2018 | /* This function cannot GC. */ | 2112 | /* This function cannot GC. */ |
| 2019 | 2113 | ||
| 2020 | DEFUN ("accessible-keymaps", Faccessible_keymaps, Saccessible_keymaps, | 2114 | DEFUN ("accessible-keymaps", Faccessible_keymaps, Saccessible_keymaps, |
| @@ -2029,14 +2123,11 @@ then the value includes only maps for prefixes that start with PREFIX. */) | |||
| 2029 | Lisp_Object keymap, prefix; | 2123 | Lisp_Object keymap, prefix; |
| 2030 | { | 2124 | { |
| 2031 | Lisp_Object maps, tail; | 2125 | Lisp_Object maps, tail; |
| 2032 | int prefixlen = 0; | 2126 | int prefixlen = XINT (Flength (prefix)); |
| 2033 | 2127 | ||
| 2034 | /* no need for gcpro because we don't autoload any keymaps. */ | 2128 | /* no need for gcpro because we don't autoload any keymaps. */ |
| 2035 | 2129 | ||
| 2036 | if (!NILP (prefix)) | 2130 | if (!NILP (prefix)) |
| 2037 | prefixlen = XINT (Flength (prefix)); | ||
| 2038 | |||
| 2039 | if (!NILP (prefix)) | ||
| 2040 | { | 2131 | { |
| 2041 | /* If a prefix was specified, start with the keymap (if any) for | 2132 | /* If a prefix was specified, start with the keymap (if any) for |
| 2042 | that prefix, so we don't waste time considering other prefixes. */ | 2133 | that prefix, so we don't waste time considering other prefixes. */ |
| @@ -2046,7 +2137,9 @@ then the value includes only maps for prefixes that start with PREFIX. */) | |||
| 2046 | if the prefix is not defined in this particular map. | 2137 | if the prefix is not defined in this particular map. |
| 2047 | It might even give us a list that isn't a keymap. */ | 2138 | It might even give us a list that isn't a keymap. */ |
| 2048 | tem = get_keymap (tem, 0, 0); | 2139 | tem = get_keymap (tem, 0, 0); |
| 2049 | if (CONSP (tem)) | 2140 | /* If the keymap is autoloaded `tem' is not a cons-cell, but we still |
| 2141 | want to return it. */ | ||
| 2142 | if (!NILP (tem)) | ||
| 2050 | { | 2143 | { |
| 2051 | /* Convert PREFIX to a vector now, so that later on | 2144 | /* Convert PREFIX to a vector now, so that later on |
| 2052 | we don't have to deal with the possibility of a string. */ | 2145 | we don't have to deal with the possibility of a string. */ |
| @@ -2086,57 +2179,26 @@ then the value includes only maps for prefixes that start with PREFIX. */) | |||
| 2086 | 2179 | ||
| 2087 | for (tail = maps; CONSP (tail); tail = XCDR (tail)) | 2180 | for (tail = maps; CONSP (tail); tail = XCDR (tail)) |
| 2088 | { | 2181 | { |
| 2089 | register Lisp_Object thisseq, thismap; | 2182 | struct accessible_keymaps_data data; |
| 2183 | register Lisp_Object thismap = Fcdr (XCAR (tail)); | ||
| 2090 | Lisp_Object last; | 2184 | Lisp_Object last; |
| 2091 | /* Does the current sequence end in the meta-prefix-char? */ | ||
| 2092 | int is_metized; | ||
| 2093 | 2185 | ||
| 2094 | thisseq = Fcar (Fcar (tail)); | 2186 | data.thisseq = Fcar (XCAR (tail)); |
| 2095 | thismap = Fcdr (Fcar (tail)); | 2187 | data.maps = maps; |
| 2096 | last = make_number (XINT (Flength (thisseq)) - 1); | 2188 | data.tail = tail; |
| 2097 | is_metized = (XINT (last) >= 0 | 2189 | last = make_number (XINT (Flength (data.thisseq)) - 1); |
| 2190 | /* Does the current sequence end in the meta-prefix-char? */ | ||
| 2191 | data.is_metized = (XINT (last) >= 0 | ||
| 2098 | /* Don't metize the last char of PREFIX. */ | 2192 | /* Don't metize the last char of PREFIX. */ |
| 2099 | && XINT (last) >= prefixlen | 2193 | && XINT (last) >= prefixlen |
| 2100 | && EQ (Faref (thisseq, last), meta_prefix_char)); | 2194 | && EQ (Faref (data.thisseq, last), meta_prefix_char)); |
| 2101 | |||
| 2102 | for (; CONSP (thismap); thismap = XCDR (thismap)) | ||
| 2103 | { | ||
| 2104 | Lisp_Object elt; | ||
| 2105 | |||
| 2106 | elt = XCAR (thismap); | ||
| 2107 | |||
| 2108 | QUIT; | ||
| 2109 | |||
| 2110 | if (CHAR_TABLE_P (elt)) | ||
| 2111 | { | ||
| 2112 | Lisp_Object indices[3]; | ||
| 2113 | |||
| 2114 | map_char_table (accessible_keymaps_char_table, Qnil, elt, | ||
| 2115 | elt, Fcons (Fcons (maps, make_number (is_metized)), | ||
| 2116 | Fcons (tail, thisseq)), | ||
| 2117 | 0, indices); | ||
| 2118 | } | ||
| 2119 | else if (VECTORP (elt)) | ||
| 2120 | { | ||
| 2121 | register int i; | ||
| 2122 | |||
| 2123 | /* Vector keymap. Scan all the elements. */ | ||
| 2124 | for (i = 0; i < ASIZE (elt); i++) | ||
| 2125 | accessible_keymaps_1 (make_number (i), AREF (elt, i), | ||
| 2126 | maps, tail, thisseq, is_metized); | ||
| 2127 | 2195 | ||
| 2128 | } | 2196 | /* Since we can't run lisp code, we can't scan autoloaded maps. */ |
| 2129 | else if (CONSP (elt)) | 2197 | if (CONSP (thismap)) |
| 2130 | accessible_keymaps_1 (XCAR (elt), XCDR (elt), | 2198 | map_keymap (thismap, accessible_keymaps_1, Qnil, &data, 0); |
| 2131 | maps, tail, thisseq, | ||
| 2132 | is_metized && INTEGERP (XCAR (elt))); | ||
| 2133 | |||
| 2134 | } | ||
| 2135 | } | 2199 | } |
| 2136 | |||
| 2137 | return maps; | 2200 | return maps; |
| 2138 | } | 2201 | } |
| 2139 | |||
| 2140 | Lisp_Object Qsingle_key_description, Qkey_description; | 2202 | Lisp_Object Qsingle_key_description, Qkey_description; |
| 2141 | 2203 | ||
| 2142 | /* This function cannot GC. */ | 2204 | /* This function cannot GC. */ |
| @@ -2407,7 +2469,7 @@ around function keys and event symbols. */) | |||
| 2407 | { | 2469 | { |
| 2408 | char buf[256]; | 2470 | char buf[256]; |
| 2409 | 2471 | ||
| 2410 | sprintf (buf, "Invalid char code %d", XINT (key)); | 2472 | sprintf (buf, "Invalid char code %ld", XINT (key)); |
| 2411 | return build_string (buf); | 2473 | return build_string (buf); |
| 2412 | } | 2474 | } |
| 2413 | else if (charset | 2475 | else if (charset |
| @@ -2550,8 +2612,8 @@ ascii_sequence_p (seq) | |||
| 2550 | /* where-is - finding a command in a set of keymaps. */ | 2612 | /* where-is - finding a command in a set of keymaps. */ |
| 2551 | 2613 | ||
| 2552 | static Lisp_Object where_is_internal (); | 2614 | static Lisp_Object where_is_internal (); |
| 2553 | static Lisp_Object where_is_internal_1 (); | 2615 | static void where_is_internal_1 P_ ((Lisp_Object key, Lisp_Object binding, |
| 2554 | static void where_is_internal_2 (); | 2616 | Lisp_Object args, void *data)); |
| 2555 | 2617 | ||
| 2556 | /* Like Flookup_key, but uses a list of keymaps SHADOW instead of a single map. | 2618 | /* Like Flookup_key, but uses a list of keymaps SHADOW instead of a single map. |
| 2557 | Returns the first non-nil binding found in any of those maps. */ | 2619 | Returns the first non-nil binding found in any of those maps. */ |
| @@ -2580,6 +2642,12 @@ shadow_lookup (shadow, key, flag) | |||
| 2580 | 2642 | ||
| 2581 | static Lisp_Object Vmouse_events; | 2643 | static Lisp_Object Vmouse_events; |
| 2582 | 2644 | ||
| 2645 | struct where_is_internal_data { | ||
| 2646 | Lisp_Object definition, noindirect, this, last; | ||
| 2647 | int last_is_meta; | ||
| 2648 | Lisp_Object sequences; | ||
| 2649 | }; | ||
| 2650 | |||
| 2583 | /* This function can GC if Flookup_key autoloads any keymaps. */ | 2651 | /* This function can GC if Flookup_key autoloads any keymaps. */ |
| 2584 | 2652 | ||
| 2585 | static Lisp_Object | 2653 | static Lisp_Object |
| @@ -2617,6 +2685,7 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap) | |||
| 2617 | { | 2685 | { |
| 2618 | /* Key sequence to reach map, and the map that it reaches */ | 2686 | /* Key sequence to reach map, and the map that it reaches */ |
| 2619 | register Lisp_Object this, map, tem; | 2687 | register Lisp_Object this, map, tem; |
| 2688 | struct where_is_internal_data data; | ||
| 2620 | 2689 | ||
| 2621 | /* In order to fold [META-PREFIX-CHAR CHAR] sequences into | 2690 | /* In order to fold [META-PREFIX-CHAR CHAR] sequences into |
| 2622 | [M-CHAR] sequences, check if last character of the sequence | 2691 | [M-CHAR] sequences, check if last character of the sequence |
| @@ -2641,148 +2710,94 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap) | |||
| 2641 | 2710 | ||
| 2642 | QUIT; | 2711 | QUIT; |
| 2643 | 2712 | ||
| 2644 | while (CONSP (map)) | 2713 | data.definition = definition; |
| 2645 | { | 2714 | data.noindirect = noindirect; |
| 2646 | /* Because the code we want to run on each binding is rather | 2715 | data.this = this; |
| 2647 | large, we don't want to have two separate loop bodies for | 2716 | data.last = last; |
| 2648 | sparse keymap bindings and tables; we want to iterate one | 2717 | data.last_is_meta = last_is_meta; |
| 2649 | loop body over both keymap and vector bindings. | 2718 | data.sequences = Qnil; |
| 2650 | 2719 | ||
| 2651 | For this reason, if Fcar (map) is a vector, we don't | 2720 | if (CONSP (map)) |
| 2652 | advance map to the next element until i indicates that we | 2721 | map_keymap (map, where_is_internal_1, Qnil, &data, 0); |
| 2653 | have finished off the vector. */ | ||
| 2654 | Lisp_Object elt, key, binding; | ||
| 2655 | elt = XCAR (map); | ||
| 2656 | map = XCDR (map); | ||
| 2657 | 2722 | ||
| 2658 | sequences = Qnil; | 2723 | sequences = data.sequences; |
| 2659 | 2724 | ||
| 2660 | QUIT; | 2725 | while (CONSP (sequences)) |
| 2661 | 2726 | { | |
| 2662 | /* Set key and binding to the current key and binding, and | 2727 | Lisp_Object sequence, remapped, function; |
| 2663 | advance map and i to the next binding. */ | 2728 | |
| 2664 | if (VECTORP (elt)) | 2729 | sequence = XCAR (sequences); |
| 2730 | sequences = XCDR (sequences); | ||
| 2731 | |||
| 2732 | /* If the current sequence is a command remapping with | ||
| 2733 | format [remap COMMAND], find the key sequences | ||
| 2734 | which run COMMAND, and use those sequences instead. */ | ||
| 2735 | remapped = Qnil; | ||
| 2736 | if (NILP (no_remap) | ||
| 2737 | && VECTORP (sequence) && XVECTOR (sequence)->size == 2 | ||
| 2738 | && EQ (AREF (sequence, 0), Qremap) | ||
| 2739 | && (function = AREF (sequence, 1), SYMBOLP (function))) | ||
| 2665 | { | 2740 | { |
| 2666 | Lisp_Object sequence; | 2741 | Lisp_Object remapped1; |
| 2667 | int i; | 2742 | |
| 2668 | /* In a vector, look at each element. */ | 2743 | remapped1 = where_is_internal (function, keymaps, firstonly, noindirect, Qt); |
| 2669 | for (i = 0; i < XVECTOR (elt)->size; i++) | 2744 | if (CONSP (remapped1)) |
| 2670 | { | 2745 | { |
| 2671 | binding = AREF (elt, i); | 2746 | /* Verify that this key binding actually maps to the |
| 2672 | XSETFASTINT (key, i); | 2747 | remapped command (see below). */ |
| 2673 | sequence = where_is_internal_1 (binding, key, definition, | 2748 | if (!EQ (shadow_lookup (keymaps, XCAR (remapped1), Qnil), function)) |
| 2674 | noindirect, this, | 2749 | continue; |
| 2675 | last, nomenus, last_is_meta); | 2750 | sequence = XCAR (remapped1); |
| 2676 | if (!NILP (sequence)) | 2751 | remapped = XCDR (remapped1); |
| 2677 | sequences = Fcons (sequence, sequences); | 2752 | goto record_sequence; |
| 2678 | } | 2753 | } |
| 2679 | } | 2754 | } |
| 2680 | else if (CHAR_TABLE_P (elt)) | ||
| 2681 | { | ||
| 2682 | Lisp_Object indices[3]; | ||
| 2683 | Lisp_Object args; | ||
| 2684 | |||
| 2685 | args = Fcons (Fcons (Fcons (definition, noindirect), | ||
| 2686 | Qnil), /* Result accumulator. */ | ||
| 2687 | Fcons (Fcons (this, last), | ||
| 2688 | Fcons (make_number (nomenus), | ||
| 2689 | make_number (last_is_meta)))); | ||
| 2690 | map_char_table (where_is_internal_2, Qnil, elt, elt, args, | ||
| 2691 | 0, indices); | ||
| 2692 | sequences = XCDR (XCAR (args)); | ||
| 2693 | } | ||
| 2694 | else if (CONSP (elt)) | ||
| 2695 | { | ||
| 2696 | Lisp_Object sequence; | ||
| 2697 | 2755 | ||
| 2698 | key = XCAR (elt); | 2756 | /* Verify that this key binding is not shadowed by another |
| 2699 | binding = XCDR (elt); | 2757 | binding for the same key, before we say it exists. |
| 2700 | 2758 | ||
| 2701 | sequence = where_is_internal_1 (binding, key, definition, | 2759 | Mechanism: look for local definition of this key and if |
| 2702 | noindirect, this, | 2760 | it is defined and does not match what we found then |
| 2703 | last, nomenus, last_is_meta); | 2761 | ignore this key. |
| 2704 | if (!NILP (sequence)) | ||
| 2705 | sequences = Fcons (sequence, sequences); | ||
| 2706 | } | ||
| 2707 | 2762 | ||
| 2763 | Either nil or number as value from Flookup_key | ||
| 2764 | means undefined. */ | ||
| 2765 | if (!EQ (shadow_lookup (keymaps, sequence, Qnil), definition)) | ||
| 2766 | continue; | ||
| 2708 | 2767 | ||
| 2709 | while (!NILP (sequences)) | 2768 | record_sequence: |
| 2769 | /* Don't annoy user with strings from a menu such as | ||
| 2770 | Select Paste. Change them all to "(any string)", | ||
| 2771 | so that there seems to be only one menu item | ||
| 2772 | to report. */ | ||
| 2773 | if (! NILP (sequence)) | ||
| 2710 | { | 2774 | { |
| 2711 | Lisp_Object sequence, remapped, function; | 2775 | Lisp_Object tem; |
| 2712 | 2776 | tem = Faref (sequence, make_number (XVECTOR (sequence)->size - 1)); | |
| 2713 | sequence = XCAR (sequences); | 2777 | if (STRINGP (tem)) |
| 2714 | sequences = XCDR (sequences); | 2778 | Faset (sequence, make_number (XVECTOR (sequence)->size - 1), |
| 2715 | 2779 | build_string ("(any string)")); | |
| 2716 | /* If the current sequence is a command remapping with | 2780 | } |
| 2717 | format [remap COMMAND], find the key sequences | ||
| 2718 | which run COMMAND, and use those sequences instead. */ | ||
| 2719 | remapped = Qnil; | ||
| 2720 | if (NILP (no_remap) | ||
| 2721 | && VECTORP (sequence) && XVECTOR (sequence)->size == 2 | ||
| 2722 | && EQ (AREF (sequence, 0), Qremap) | ||
| 2723 | && (function = AREF (sequence, 1), SYMBOLP (function))) | ||
| 2724 | { | ||
| 2725 | Lisp_Object remapped1; | ||
| 2726 | |||
| 2727 | remapped1 = where_is_internal (function, keymaps, firstonly, noindirect, Qt); | ||
| 2728 | if (CONSP (remapped1)) | ||
| 2729 | { | ||
| 2730 | /* Verify that this key binding actually maps to the | ||
| 2731 | remapped command (see below). */ | ||
| 2732 | if (!EQ (shadow_lookup (keymaps, XCAR (remapped1), Qnil), function)) | ||
| 2733 | continue; | ||
| 2734 | sequence = XCAR (remapped1); | ||
| 2735 | remapped = XCDR (remapped1); | ||
| 2736 | goto record_sequence; | ||
| 2737 | } | ||
| 2738 | } | ||
| 2739 | |||
| 2740 | /* Verify that this key binding is not shadowed by another | ||
| 2741 | binding for the same key, before we say it exists. | ||
| 2742 | |||
| 2743 | Mechanism: look for local definition of this key and if | ||
| 2744 | it is defined and does not match what we found then | ||
| 2745 | ignore this key. | ||
| 2746 | |||
| 2747 | Either nil or number as value from Flookup_key | ||
| 2748 | means undefined. */ | ||
| 2749 | if (!EQ (shadow_lookup (keymaps, sequence, Qnil), definition)) | ||
| 2750 | continue; | ||
| 2751 | |||
| 2752 | record_sequence: | ||
| 2753 | /* Don't annoy user with strings from a menu such as | ||
| 2754 | Select Paste. Change them all to "(any string)", | ||
| 2755 | so that there seems to be only one menu item | ||
| 2756 | to report. */ | ||
| 2757 | if (! NILP (sequence)) | ||
| 2758 | { | ||
| 2759 | Lisp_Object tem; | ||
| 2760 | tem = Faref (sequence, make_number (XVECTOR (sequence)->size - 1)); | ||
| 2761 | if (STRINGP (tem)) | ||
| 2762 | Faset (sequence, make_number (XVECTOR (sequence)->size - 1), | ||
| 2763 | build_string ("(any string)")); | ||
| 2764 | } | ||
| 2765 | 2781 | ||
| 2766 | /* It is a true unshadowed match. Record it, unless it's already | 2782 | /* It is a true unshadowed match. Record it, unless it's already |
| 2767 | been seen (as could happen when inheriting keymaps). */ | 2783 | been seen (as could happen when inheriting keymaps). */ |
| 2768 | if (NILP (Fmember (sequence, found))) | 2784 | if (NILP (Fmember (sequence, found))) |
| 2769 | found = Fcons (sequence, found); | 2785 | found = Fcons (sequence, found); |
| 2770 | 2786 | ||
| 2771 | /* If firstonly is Qnon_ascii, then we can return the first | 2787 | /* If firstonly is Qnon_ascii, then we can return the first |
| 2772 | binding we find. If firstonly is not Qnon_ascii but not | 2788 | binding we find. If firstonly is not Qnon_ascii but not |
| 2773 | nil, then we should return the first ascii-only binding | 2789 | nil, then we should return the first ascii-only binding |
| 2774 | we find. */ | 2790 | we find. */ |
| 2775 | if (EQ (firstonly, Qnon_ascii)) | 2791 | if (EQ (firstonly, Qnon_ascii)) |
| 2776 | RETURN_UNGCPRO (sequence); | 2792 | RETURN_UNGCPRO (sequence); |
| 2777 | else if (!NILP (firstonly) && ascii_sequence_p (sequence)) | 2793 | else if (!NILP (firstonly) && ascii_sequence_p (sequence)) |
| 2778 | RETURN_UNGCPRO (sequence); | 2794 | RETURN_UNGCPRO (sequence); |
| 2779 | 2795 | ||
| 2780 | if (CONSP (remapped)) | 2796 | if (CONSP (remapped)) |
| 2781 | { | 2797 | { |
| 2782 | sequence = XCAR (remapped); | 2798 | sequence = XCAR (remapped); |
| 2783 | remapped = XCDR (remapped); | 2799 | remapped = XCDR (remapped); |
| 2784 | goto record_sequence; | 2800 | goto record_sequence; |
| 2785 | } | ||
| 2786 | } | 2801 | } |
| 2787 | } | 2802 | } |
| 2788 | } | 2803 | } |
| @@ -2835,7 +2850,7 @@ remapped command in the returned list. */) | |||
| 2835 | else if (!NILP (keymap)) | 2850 | else if (!NILP (keymap)) |
| 2836 | keymaps = Fcons (keymap, Fcons (current_global_map, Qnil)); | 2851 | keymaps = Fcons (keymap, Fcons (current_global_map, Qnil)); |
| 2837 | else | 2852 | else |
| 2838 | keymaps = Fcurrent_active_maps (Qnil); | 2853 | keymaps = Fcurrent_active_maps (Qnil, Qnil); |
| 2839 | 2854 | ||
| 2840 | /* Only use caching for the menubar (i.e. called with (def nil t nil). | 2855 | /* Only use caching for the menubar (i.e. called with (def nil t nil). |
| 2841 | We don't really need to check `keymap'. */ | 2856 | We don't really need to check `keymap'. */ |
| @@ -2901,53 +2916,19 @@ remapped command in the returned list. */) | |||
| 2901 | return result; | 2916 | return result; |
| 2902 | } | 2917 | } |
| 2903 | 2918 | ||
| 2904 | /* This is the function that Fwhere_is_internal calls using map_char_table. | ||
| 2905 | ARGS has the form | ||
| 2906 | (((DEFINITION . NOINDIRECT) . (KEYMAP . RESULT)) | ||
| 2907 | . | ||
| 2908 | ((THIS . LAST) . (NOMENUS . LAST_IS_META))) | ||
| 2909 | Since map_char_table doesn't really use the return value from this function, | ||
| 2910 | we the result append to RESULT, the slot in ARGS. | ||
| 2911 | |||
| 2912 | This function can GC because it calls where_is_internal_1 which can | ||
| 2913 | GC. */ | ||
| 2914 | |||
| 2915 | static void | ||
| 2916 | where_is_internal_2 (args, key, binding) | ||
| 2917 | Lisp_Object args, key, binding; | ||
| 2918 | { | ||
| 2919 | Lisp_Object definition, noindirect, this, last; | ||
| 2920 | Lisp_Object result, sequence; | ||
| 2921 | int nomenus, last_is_meta; | ||
| 2922 | struct gcpro gcpro1, gcpro2, gcpro3; | ||
| 2923 | |||
| 2924 | GCPRO3 (args, key, binding); | ||
| 2925 | result = XCDR (XCAR (args)); | ||
| 2926 | definition = XCAR (XCAR (XCAR (args))); | ||
| 2927 | noindirect = XCDR (XCAR (XCAR (args))); | ||
| 2928 | this = XCAR (XCAR (XCDR (args))); | ||
| 2929 | last = XCDR (XCAR (XCDR (args))); | ||
| 2930 | nomenus = XFASTINT (XCAR (XCDR (XCDR (args)))); | ||
| 2931 | last_is_meta = XFASTINT (XCDR (XCDR (XCDR (args)))); | ||
| 2932 | |||
| 2933 | sequence = where_is_internal_1 (binding, key, definition, noindirect, | ||
| 2934 | this, last, nomenus, last_is_meta); | ||
| 2935 | |||
| 2936 | if (!NILP (sequence)) | ||
| 2937 | XSETCDR (XCAR (args), Fcons (sequence, result)); | ||
| 2938 | |||
| 2939 | UNGCPRO; | ||
| 2940 | } | ||
| 2941 | |||
| 2942 | |||
| 2943 | /* This function can GC because get_keyelt can. */ | 2919 | /* This function can GC because get_keyelt can. */ |
| 2944 | 2920 | ||
| 2945 | static Lisp_Object | 2921 | static void |
| 2946 | where_is_internal_1 (binding, key, definition, noindirect, this, last, | 2922 | where_is_internal_1 (key, binding, args, data) |
| 2947 | nomenus, last_is_meta) | 2923 | Lisp_Object key, binding, args; |
| 2948 | Lisp_Object binding, key, definition, noindirect, this, last; | 2924 | void *data; |
| 2949 | int nomenus, last_is_meta; | ||
| 2950 | { | 2925 | { |
| 2926 | struct where_is_internal_data *d = data; /* Cast! */ | ||
| 2927 | Lisp_Object definition = d->definition; | ||
| 2928 | Lisp_Object noindirect = d->noindirect; | ||
| 2929 | Lisp_Object this = d->this; | ||
| 2930 | Lisp_Object last = d->last; | ||
| 2931 | int last_is_meta = d->last_is_meta; | ||
| 2951 | Lisp_Object sequence; | 2932 | Lisp_Object sequence; |
| 2952 | 2933 | ||
| 2953 | /* Search through indirections unless that's not wanted. */ | 2934 | /* Search through indirections unless that's not wanted. */ |
| @@ -2961,7 +2942,7 @@ where_is_internal_1 (binding, key, definition, noindirect, this, last, | |||
| 2961 | || EQ (binding, definition) | 2942 | || EQ (binding, definition) |
| 2962 | || (CONSP (definition) && !NILP (Fequal (binding, definition))))) | 2943 | || (CONSP (definition) && !NILP (Fequal (binding, definition))))) |
| 2963 | /* Doesn't match. */ | 2944 | /* Doesn't match. */ |
| 2964 | return Qnil; | 2945 | return; |
| 2965 | 2946 | ||
| 2966 | /* We have found a match. Construct the key sequence where we found it. */ | 2947 | /* We have found a match. Construct the key sequence where we found it. */ |
| 2967 | if (INTEGERP (key) && last_is_meta) | 2948 | if (INTEGERP (key) && last_is_meta) |
| @@ -2976,10 +2957,9 @@ where_is_internal_1 (binding, key, definition, noindirect, this, last, | |||
| 2976 | { | 2957 | { |
| 2977 | Lisp_Object sequences = Fgethash (binding, where_is_cache, Qnil); | 2958 | Lisp_Object sequences = Fgethash (binding, where_is_cache, Qnil); |
| 2978 | Fputhash (binding, Fcons (sequence, sequences), where_is_cache); | 2959 | Fputhash (binding, Fcons (sequence, sequences), where_is_cache); |
| 2979 | return Qnil; | ||
| 2980 | } | 2960 | } |
| 2981 | else | 2961 | else |
| 2982 | return sequence; | 2962 | d->sequences = Fcons (sequence, d->sequences); |
| 2983 | } | 2963 | } |
| 2984 | 2964 | ||
| 2985 | /* describe-bindings - summarizing all the bindings in a set of keymaps. */ | 2965 | /* describe-bindings - summarizing all the bindings in a set of keymaps. */ |
diff --git a/src/keymap.h b/src/keymap.h index b305a318944..6d8323d5038 100644 --- a/src/keymap.h +++ b/src/keymap.h | |||
| @@ -34,7 +34,7 @@ EXFUN (Fkey_binding, 4); | |||
| 34 | EXFUN (Fkey_description, 2); | 34 | EXFUN (Fkey_description, 2); |
| 35 | EXFUN (Fsingle_key_description, 2); | 35 | EXFUN (Fsingle_key_description, 2); |
| 36 | EXFUN (Fwhere_is_internal, 5); | 36 | EXFUN (Fwhere_is_internal, 5); |
| 37 | EXFUN (Fcurrent_active_maps, 1); | 37 | EXFUN (Fcurrent_active_maps, 2); |
| 38 | extern Lisp_Object access_keymap P_ ((Lisp_Object, Lisp_Object, int, int, int)); | 38 | extern Lisp_Object access_keymap P_ ((Lisp_Object, Lisp_Object, int, int, int)); |
| 39 | extern Lisp_Object get_keyelt P_ ((Lisp_Object, int)); | 39 | extern Lisp_Object get_keyelt P_ ((Lisp_Object, int)); |
| 40 | extern Lisp_Object get_keymap P_ ((Lisp_Object, int, int)); | 40 | extern Lisp_Object get_keymap P_ ((Lisp_Object, int, int)); |
| @@ -48,7 +48,7 @@ extern void syms_of_keymap P_ ((void)); | |||
| 48 | extern void keys_of_keymap P_ ((void)); | 48 | extern void keys_of_keymap P_ ((void)); |
| 49 | 49 | ||
| 50 | typedef void (*map_keymap_function_t) | 50 | typedef void (*map_keymap_function_t) |
| 51 | P_ ((Lisp_Object, Lisp_Object, Lisp_Object, void*)); | 51 | P_ ((Lisp_Object key, Lisp_Object val, Lisp_Object args, void* data)); |
| 52 | extern void map_keymap P_ ((Lisp_Object map, map_keymap_function_t fun, Lisp_Object largs, void* cargs, int autoload)); | 52 | extern void map_keymap P_ ((Lisp_Object map, map_keymap_function_t fun, Lisp_Object largs, void* cargs, int autoload)); |
| 53 | 53 | ||
| 54 | #endif | 54 | #endif |
diff --git a/src/lisp.h b/src/lisp.h index 7bf59d0f55a..b835c531e5e 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -56,7 +56,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 56 | #ifdef GC_CHECK_CONS_LIST | 56 | #ifdef GC_CHECK_CONS_LIST |
| 57 | #define CHECK_CONS_LIST() check_cons_list() | 57 | #define CHECK_CONS_LIST() check_cons_list() |
| 58 | #else | 58 | #else |
| 59 | #define CHECK_CONS_LIST() 0 | 59 | #define CHECK_CONS_LIST() ((void)0) |
| 60 | #endif | 60 | #endif |
| 61 | 61 | ||
| 62 | /* These are default choices for the types to use. */ | 62 | /* These are default choices for the types to use. */ |
| @@ -1041,16 +1041,16 @@ struct Lisp_Hash_Table | |||
| 1041 | hash table size to reduce collisions. */ | 1041 | hash table size to reduce collisions. */ |
| 1042 | Lisp_Object index; | 1042 | Lisp_Object index; |
| 1043 | 1043 | ||
| 1044 | /* Next weak hash table if this is a weak hash table. The head | ||
| 1045 | of the list is in Vweak_hash_tables. */ | ||
| 1046 | Lisp_Object next_weak; | ||
| 1047 | |||
| 1048 | /* User-supplied hash function, or nil. */ | 1044 | /* User-supplied hash function, or nil. */ |
| 1049 | Lisp_Object user_hash_function; | 1045 | Lisp_Object user_hash_function; |
| 1050 | 1046 | ||
| 1051 | /* User-supplied key comparison function, or nil. */ | 1047 | /* User-supplied key comparison function, or nil. */ |
| 1052 | Lisp_Object user_cmp_function; | 1048 | Lisp_Object user_cmp_function; |
| 1053 | 1049 | ||
| 1050 | /* Next weak hash table if this is a weak hash table. The head | ||
| 1051 | of the list is in weak_hash_tables. */ | ||
| 1052 | struct Lisp_Hash_Table *next_weak; | ||
| 1053 | |||
| 1054 | /* C function to compare two keys. */ | 1054 | /* C function to compare two keys. */ |
| 1055 | int (* cmpfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object, | 1055 | int (* cmpfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object, |
| 1056 | unsigned, Lisp_Object, unsigned)); | 1056 | unsigned, Lisp_Object, unsigned)); |
| @@ -2428,7 +2428,7 @@ EXFUN (Fstring_lessp, 2); | |||
| 2428 | extern int char_table_translate P_ ((Lisp_Object, int)); | 2428 | extern int char_table_translate P_ ((Lisp_Object, int)); |
| 2429 | extern void map_char_table P_ ((void (*) (Lisp_Object, Lisp_Object, Lisp_Object), | 2429 | extern void map_char_table P_ ((void (*) (Lisp_Object, Lisp_Object, Lisp_Object), |
| 2430 | Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, int, | 2430 | Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, int, |
| 2431 | Lisp_Object *)); | 2431 | int *)); |
| 2432 | extern Lisp_Object char_table_ref_and_index P_ ((Lisp_Object, int, int *)); | 2432 | extern Lisp_Object char_table_ref_and_index P_ ((Lisp_Object, int, int *)); |
| 2433 | extern void syms_of_fns P_ ((void)); | 2433 | extern void syms_of_fns P_ ((void)); |
| 2434 | 2434 | ||
| @@ -3255,6 +3255,7 @@ EXFUN (Fx_file_dialog, 5); | |||
| 3255 | #endif | 3255 | #endif |
| 3256 | 3256 | ||
| 3257 | /* Defined in xfaces.c */ | 3257 | /* Defined in xfaces.c */ |
| 3258 | EXFUN (Fclear_face_cache, 1); | ||
| 3258 | extern void syms_of_xfaces P_ ((void)); | 3259 | extern void syms_of_xfaces P_ ((void)); |
| 3259 | 3260 | ||
| 3260 | #ifndef HAVE_GETLOADAVG | 3261 | #ifndef HAVE_GETLOADAVG |
| @@ -3270,6 +3271,7 @@ extern void syms_of_xfns P_ ((void)); | |||
| 3270 | extern void syms_of_xsmfns P_ ((void)); | 3271 | extern void syms_of_xsmfns P_ ((void)); |
| 3271 | 3272 | ||
| 3272 | /* Defined in xselect.c */ | 3273 | /* Defined in xselect.c */ |
| 3274 | EXFUN (Fx_send_client_event, 6); | ||
| 3273 | extern void syms_of_xselect P_ ((void)); | 3275 | extern void syms_of_xselect P_ ((void)); |
| 3274 | 3276 | ||
| 3275 | /* Defined in xterm.c */ | 3277 | /* Defined in xterm.c */ |
diff --git a/src/macgui.h b/src/macgui.h index fb6f858c547..29905370763 100644 --- a/src/macgui.h +++ b/src/macgui.h | |||
| @@ -98,7 +98,7 @@ typedef unsigned long Time; | |||
| 98 | /* Whether to use Quartz 2D routines for drawing operations other than | 98 | /* Whether to use Quartz 2D routines for drawing operations other than |
| 99 | texts. */ | 99 | texts. */ |
| 100 | #ifndef USE_CG_DRAWING | 100 | #ifndef USE_CG_DRAWING |
| 101 | #if USE_ATSUI && MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 | 101 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 |
| 102 | #define USE_CG_DRAWING 1 | 102 | #define USE_CG_DRAWING 1 |
| 103 | #endif | 103 | #endif |
| 104 | #endif | 104 | #endif |
| @@ -119,7 +119,7 @@ typedef unsigned long Time; | |||
| 119 | 119 | ||
| 120 | /* Whether to use HIToolbar. */ | 120 | /* Whether to use HIToolbar. */ |
| 121 | #ifndef USE_MAC_TOOLBAR | 121 | #ifndef USE_MAC_TOOLBAR |
| 122 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 && MAC_OS_X_VERSION_MIN_REQUIRED != 1020 | 122 | #if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 && MAC_OS_X_VERSION_MIN_REQUIRED != 1020 |
| 123 | #define USE_MAC_TOOLBAR 1 | 123 | #define USE_MAC_TOOLBAR 1 |
| 124 | #endif | 124 | #endif |
| 125 | #endif | 125 | #endif |
diff --git a/src/macmenu.c b/src/macmenu.c index c10a76f8a5d..0aa0f620778 100644 --- a/src/macmenu.c +++ b/src/macmenu.c | |||
| @@ -882,7 +882,7 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 882 | 882 | ||
| 883 | /* Regard ESC and C-g as Cancel even without the Cancel button. */ | 883 | /* Regard ESC and C-g as Cancel even without the Cancel button. */ |
| 884 | 884 | ||
| 885 | #ifdef MAC_OSX | 885 | #if 0 /* defined (MAC_OSX) */ |
| 886 | static Boolean | 886 | static Boolean |
| 887 | mac_dialog_modal_filter (dialog, event, item_hit) | 887 | mac_dialog_modal_filter (dialog, event, item_hit) |
| 888 | DialogRef dialog; | 888 | DialogRef dialog; |
| @@ -991,7 +991,7 @@ for instance using the window manager, then this produces a quit and | |||
| 991 | but I don't want to make one now. */ | 991 | but I don't want to make one now. */ |
| 992 | CHECK_WINDOW (window); | 992 | CHECK_WINDOW (window); |
| 993 | 993 | ||
| 994 | #ifdef MAC_OSX | 994 | #if 0 /* defined (MAC_OSX) */ |
| 995 | /* Special treatment for Fmessage_box, Fyes_or_no_p, and Fy_or_n_p. */ | 995 | /* Special treatment for Fmessage_box, Fyes_or_no_p, and Fy_or_n_p. */ |
| 996 | if (EQ (position, Qt) | 996 | if (EQ (position, Qt) |
| 997 | && STRINGP (Fcar (contents)) | 997 | && STRINGP (Fcar (contents)) |
| @@ -2330,14 +2330,17 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2330 | #define DIALOG_BUTTON_MAKE_COMMAND_ID(value) \ | 2330 | #define DIALOG_BUTTON_MAKE_COMMAND_ID(value) \ |
| 2331 | ((value) + DIALOG_BUTTON_COMMAND_ID_OFFSET) | 2331 | ((value) + DIALOG_BUTTON_COMMAND_ID_OFFSET) |
| 2332 | 2332 | ||
| 2333 | extern EMACS_TIME timer_check P_ ((int)); | ||
| 2334 | |||
| 2333 | static pascal OSStatus | 2335 | static pascal OSStatus |
| 2334 | mac_handle_dialog_event (next_handler, event, data) | 2336 | mac_handle_dialog_event (next_handler, event, data) |
| 2335 | EventHandlerCallRef next_handler; | 2337 | EventHandlerCallRef next_handler; |
| 2336 | EventRef event; | 2338 | EventRef event; |
| 2337 | void *data; | 2339 | void *data; |
| 2338 | { | 2340 | { |
| 2339 | OSStatus err; | 2341 | OSStatus err, result = eventNotHandledErr; |
| 2340 | WindowRef window = (WindowRef) data; | 2342 | WindowRef window = (WindowRef) data; |
| 2343 | int quit_event_loop_p = 0; | ||
| 2341 | 2344 | ||
| 2342 | switch (GetEventClass (event)) | 2345 | switch (GetEventClass (event)) |
| 2343 | { | 2346 | { |
| @@ -2352,12 +2355,11 @@ mac_handle_dialog_event (next_handler, event, data) | |||
| 2352 | if (DIALOG_BUTTON_COMMAND_ID_P (command.commandID)) | 2355 | if (DIALOG_BUTTON_COMMAND_ID_P (command.commandID)) |
| 2353 | { | 2356 | { |
| 2354 | SetWRefCon (window, command.commandID); | 2357 | SetWRefCon (window, command.commandID); |
| 2355 | err = QuitAppModalLoopForWindow (window); | 2358 | quit_event_loop_p = 1; |
| 2356 | 2359 | break; | |
| 2357 | return err == noErr ? noErr : eventNotHandledErr; | ||
| 2358 | } | 2360 | } |
| 2359 | 2361 | ||
| 2360 | return CallNextEventHandler (next_handler, event); | 2362 | result = CallNextEventHandler (next_handler, event); |
| 2361 | } | 2363 | } |
| 2362 | break; | 2364 | break; |
| 2363 | 2365 | ||
| @@ -2367,8 +2369,8 @@ mac_handle_dialog_event (next_handler, event, data) | |||
| 2367 | char char_code; | 2369 | char char_code; |
| 2368 | 2370 | ||
| 2369 | result = CallNextEventHandler (next_handler, event); | 2371 | result = CallNextEventHandler (next_handler, event); |
| 2370 | if (result == noErr) | 2372 | if (result != eventNotHandledErr) |
| 2371 | return noErr; | 2373 | break; |
| 2372 | 2374 | ||
| 2373 | err = GetEventParameter (event, kEventParamKeyMacCharCodes, | 2375 | err = GetEventParameter (event, kEventParamKeyMacCharCodes, |
| 2374 | typeChar, NULL, sizeof (char), | 2376 | typeChar, NULL, sizeof (char), |
| @@ -2377,7 +2379,7 @@ mac_handle_dialog_event (next_handler, event, data) | |||
| 2377 | switch (char_code) | 2379 | switch (char_code) |
| 2378 | { | 2380 | { |
| 2379 | case kEscapeCharCode: | 2381 | case kEscapeCharCode: |
| 2380 | err = QuitAppModalLoopForWindow (window); | 2382 | quit_event_loop_p = 1; |
| 2381 | break; | 2383 | break; |
| 2382 | 2384 | ||
| 2383 | default: | 2385 | default: |
| @@ -2392,26 +2394,26 @@ mac_handle_dialog_event (next_handler, event, data) | |||
| 2392 | typeUInt32, NULL, sizeof (UInt32), | 2394 | typeUInt32, NULL, sizeof (UInt32), |
| 2393 | NULL, &key_code); | 2395 | NULL, &key_code); |
| 2394 | if (err == noErr) | 2396 | if (err == noErr) |
| 2395 | { | 2397 | if (mac_quit_char_key_p (modifiers, key_code)) |
| 2396 | if (mac_quit_char_key_p (modifiers, key_code)) | 2398 | quit_event_loop_p = 1; |
| 2397 | err = QuitAppModalLoopForWindow (window); | ||
| 2398 | else | ||
| 2399 | err = eventNotHandledErr; | ||
| 2400 | } | ||
| 2401 | } | 2399 | } |
| 2402 | break; | 2400 | break; |
| 2403 | } | 2401 | } |
| 2404 | |||
| 2405 | if (err == noErr) | ||
| 2406 | result = noErr; | ||
| 2407 | |||
| 2408 | return result; | ||
| 2409 | } | 2402 | } |
| 2410 | break; | 2403 | break; |
| 2411 | 2404 | ||
| 2412 | default: | 2405 | default: |
| 2413 | abort (); | 2406 | abort (); |
| 2414 | } | 2407 | } |
| 2408 | |||
| 2409 | if (quit_event_loop_p) | ||
| 2410 | { | ||
| 2411 | err = QuitEventLoop (GetCurrentEventLoop ()); | ||
| 2412 | if (err == noErr) | ||
| 2413 | result = noErr; | ||
| 2414 | } | ||
| 2415 | |||
| 2416 | return result; | ||
| 2415 | } | 2417 | } |
| 2416 | 2418 | ||
| 2417 | static OSStatus | 2419 | static OSStatus |
| @@ -2446,6 +2448,25 @@ install_dialog_event_handler (window) | |||
| 2446 | #define DIALOG_ICON_LEFT_MARGIN (24) | 2448 | #define DIALOG_ICON_LEFT_MARGIN (24) |
| 2447 | #define DIALOG_ICON_TOP_MARGIN (15) | 2449 | #define DIALOG_ICON_TOP_MARGIN (15) |
| 2448 | 2450 | ||
| 2451 | static Lisp_Object | ||
| 2452 | pop_down_dialog (arg) | ||
| 2453 | Lisp_Object arg; | ||
| 2454 | { | ||
| 2455 | struct Lisp_Save_Value *p = XSAVE_VALUE (arg); | ||
| 2456 | WindowRef window = p->pointer; | ||
| 2457 | |||
| 2458 | BLOCK_INPUT; | ||
| 2459 | |||
| 2460 | if (popup_activated_flag) | ||
| 2461 | EndAppModalStateForWindow (window); | ||
| 2462 | DisposeWindow (window); | ||
| 2463 | popup_activated_flag = 0; | ||
| 2464 | |||
| 2465 | UNBLOCK_INPUT; | ||
| 2466 | |||
| 2467 | return Qnil; | ||
| 2468 | } | ||
| 2469 | |||
| 2449 | static int | 2470 | static int |
| 2450 | create_and_show_dialog (f, first_wv) | 2471 | create_and_show_dialog (f, first_wv) |
| 2451 | FRAME_PTR f; | 2472 | FRAME_PTR f; |
| @@ -2459,6 +2480,7 @@ create_and_show_dialog (f, first_wv) | |||
| 2459 | Rect empty_rect, *rects; | 2480 | Rect empty_rect, *rects; |
| 2460 | WindowRef window = NULL; | 2481 | WindowRef window = NULL; |
| 2461 | ControlRef *buttons, default_button = NULL, text; | 2482 | ControlRef *buttons, default_button = NULL, text; |
| 2483 | int specpdl_count = SPECPDL_INDEX (); | ||
| 2462 | 2484 | ||
| 2463 | dialog_name = first_wv->name; | 2485 | dialog_name = first_wv->name; |
| 2464 | nb_buttons = dialog_name[1] - '0'; | 2486 | nb_buttons = dialog_name[1] - '0'; |
| @@ -2475,8 +2497,11 @@ create_and_show_dialog (f, first_wv) | |||
| 2475 | kWindowStandardHandlerAttribute, | 2497 | kWindowStandardHandlerAttribute, |
| 2476 | &empty_rect, &window); | 2498 | &empty_rect, &window); |
| 2477 | if (err == noErr) | 2499 | if (err == noErr) |
| 2478 | err = SetThemeWindowBackground (window, kThemeBrushMovableModalBackground, | 2500 | { |
| 2479 | true); | 2501 | record_unwind_protect (pop_down_dialog, make_save_value (window, 0)); |
| 2502 | err = SetThemeWindowBackground (window, kThemeBrushMovableModalBackground, | ||
| 2503 | true); | ||
| 2504 | } | ||
| 2480 | if (err == noErr) | 2505 | if (err == noErr) |
| 2481 | err = SetWindowTitleWithCFString (window, (dialog_name[0] == 'Q' | 2506 | err = SetWindowTitleWithCFString (window, (dialog_name[0] == 'Q' |
| 2482 | ? CFSTR ("Question") | 2507 | ? CFSTR ("Question") |
| @@ -2701,7 +2726,45 @@ create_and_show_dialog (f, first_wv) | |||
| 2701 | SetWRefCon (window, 0); | 2726 | SetWRefCon (window, 0); |
| 2702 | ShowWindow (window); | 2727 | ShowWindow (window); |
| 2703 | BringToFront (window); | 2728 | BringToFront (window); |
| 2704 | err = RunAppModalLoopForWindow (window); | 2729 | popup_activated_flag = 1; |
| 2730 | err = BeginAppModalStateForWindow (window); | ||
| 2731 | } | ||
| 2732 | if (err == noErr) | ||
| 2733 | { | ||
| 2734 | EventTargetRef toolbox_dispatcher = GetEventDispatcherTarget (); | ||
| 2735 | |||
| 2736 | while (1) | ||
| 2737 | { | ||
| 2738 | EMACS_TIME next_time = timer_check (1); | ||
| 2739 | long secs = EMACS_SECS (next_time); | ||
| 2740 | long usecs = EMACS_USECS (next_time); | ||
| 2741 | EventTimeout timeout; | ||
| 2742 | EventRef event; | ||
| 2743 | |||
| 2744 | if (secs < 0 || (secs == 0 && usecs == 0)) | ||
| 2745 | { | ||
| 2746 | /* Sometimes timer_check returns -1 (no timers) even if | ||
| 2747 | there are timers. So do a timeout anyway. */ | ||
| 2748 | secs = 1; | ||
| 2749 | usecs = 0; | ||
| 2750 | } | ||
| 2751 | |||
| 2752 | timeout = (secs * kEventDurationSecond | ||
| 2753 | + usecs * kEventDurationMicrosecond); | ||
| 2754 | err = ReceiveNextEvent (0, NULL, timeout, kEventRemoveFromQueue, | ||
| 2755 | &event); | ||
| 2756 | if (err == noErr) | ||
| 2757 | { | ||
| 2758 | SendEventToEventTarget (event, toolbox_dispatcher); | ||
| 2759 | ReleaseEvent (event); | ||
| 2760 | } | ||
| 2761 | else if (err != eventLoopTimedOutErr) | ||
| 2762 | { | ||
| 2763 | if (err == eventLoopQuitErr) | ||
| 2764 | err = noErr; | ||
| 2765 | break; | ||
| 2766 | } | ||
| 2767 | } | ||
| 2705 | } | 2768 | } |
| 2706 | if (err == noErr) | 2769 | if (err == noErr) |
| 2707 | { | 2770 | { |
| @@ -2711,8 +2774,7 @@ create_and_show_dialog (f, first_wv) | |||
| 2711 | result = DIALOG_BUTTON_COMMAND_ID_VALUE (command_id); | 2774 | result = DIALOG_BUTTON_COMMAND_ID_VALUE (command_id); |
| 2712 | } | 2775 | } |
| 2713 | 2776 | ||
| 2714 | if (window) | 2777 | unbind_to (specpdl_count, Qnil); |
| 2715 | DisposeWindow (window); | ||
| 2716 | 2778 | ||
| 2717 | return result; | 2779 | return result; |
| 2718 | } | 2780 | } |
| @@ -3282,9 +3344,13 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_ | |||
| 3282 | doc: /* Return t if a menu or popup dialog is active. */) | 3344 | doc: /* Return t if a menu or popup dialog is active. */) |
| 3283 | () | 3345 | () |
| 3284 | { | 3346 | { |
| 3347 | #if TARGET_API_MAC_CARBON | ||
| 3348 | return (popup_activated ()) ? Qt : Qnil; | ||
| 3349 | #else | ||
| 3285 | /* Always return Qnil since menu selection functions do not return | 3350 | /* Always return Qnil since menu selection functions do not return |
| 3286 | until a selection has been made or cancelled. */ | 3351 | until a selection has been made or cancelled. */ |
| 3287 | return Qnil; | 3352 | return Qnil; |
| 3353 | #endif | ||
| 3288 | } | 3354 | } |
| 3289 | 3355 | ||
| 3290 | void | 3356 | void |
diff --git a/src/macterm.c b/src/macterm.c index 9ea51f87cfb..fa0682feca0 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -2196,11 +2196,12 @@ x_draw_fringe_bitmap (w, row, p) | |||
| 2196 | Display *display = FRAME_MAC_DISPLAY (f); | 2196 | Display *display = FRAME_MAC_DISPLAY (f); |
| 2197 | struct face *face = p->face; | 2197 | struct face *face = p->face; |
| 2198 | int rowY; | 2198 | int rowY; |
| 2199 | int overlay_p = p->overlay_p; | ||
| 2199 | 2200 | ||
| 2200 | #ifdef MAC_OSX | 2201 | #ifdef MAC_OSX |
| 2201 | if (p->bx >= 0 && !p->overlay_p) | 2202 | if (!overlay_p) |
| 2202 | { | 2203 | { |
| 2203 | int bx = p->bx, nx = p->nx; | 2204 | int bx = p->bx, by = p->by, nx = p->nx, ny = p->ny; |
| 2204 | 2205 | ||
| 2205 | #if 0 /* MAC_TODO: stipple */ | 2206 | #if 0 /* MAC_TODO: stipple */ |
| 2206 | /* In case the same realized face is used for fringes and | 2207 | /* In case the same realized face is used for fringes and |
| @@ -2229,17 +2230,40 @@ x_draw_fringe_bitmap (w, row, p) | |||
| 2229 | int width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w) | 2230 | int width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w) |
| 2230 | * FRAME_COLUMN_WIDTH (f)); | 2231 | * FRAME_COLUMN_WIDTH (f)); |
| 2231 | 2232 | ||
| 2232 | if (left + width == bx) | 2233 | if (bx < 0 |
| 2234 | && (left + width == p->x | ||
| 2235 | || p->x + p->wd == left)) | ||
| 2233 | { | 2236 | { |
| 2234 | bx = left + sb_width; | 2237 | /* Bitmap fills the fringe and we need background |
| 2235 | nx += width - sb_width; | 2238 | extension. */ |
| 2239 | int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); | ||
| 2240 | |||
| 2241 | bx = p->x; | ||
| 2242 | nx = p->wd; | ||
| 2243 | by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, | ||
| 2244 | row->y)); | ||
| 2245 | ny = row->visible_height; | ||
| 2246 | } | ||
| 2247 | |||
| 2248 | if (bx >= 0) | ||
| 2249 | { | ||
| 2250 | if (left + width == bx) | ||
| 2251 | { | ||
| 2252 | bx = left + sb_width; | ||
| 2253 | nx += width - sb_width; | ||
| 2254 | } | ||
| 2255 | else if (bx + nx == left) | ||
| 2256 | nx += width - sb_width; | ||
| 2236 | } | 2257 | } |
| 2237 | else if (bx + nx == left) | ||
| 2238 | nx += width - sb_width; | ||
| 2239 | } | 2258 | } |
| 2240 | } | 2259 | } |
| 2241 | 2260 | ||
| 2242 | mac_erase_rectangle (f, face->gc, bx, p->by, nx, p->ny); | 2261 | if (bx >= 0) |
| 2262 | { | ||
| 2263 | mac_erase_rectangle (f, face->gc, bx, by, nx, ny); | ||
| 2264 | /* The fringe background has already been filled. */ | ||
| 2265 | overlay_p = 1; | ||
| 2266 | } | ||
| 2243 | 2267 | ||
| 2244 | #if 0 /* MAC_TODO: stipple */ | 2268 | #if 0 /* MAC_TODO: stipple */ |
| 2245 | if (!face->stipple) | 2269 | if (!face->stipple) |
| @@ -2304,10 +2328,10 @@ x_draw_fringe_bitmap (w, row, p) | |||
| 2304 | : face->foreground)); | 2328 | : face->foreground)); |
| 2305 | #if USE_CG_DRAWING | 2329 | #if USE_CG_DRAWING |
| 2306 | mac_draw_cg_image (fringe_bmp[p->which], f, face->gc, 0, p->dh, | 2330 | mac_draw_cg_image (fringe_bmp[p->which], f, face->gc, 0, p->dh, |
| 2307 | p->wd, p->h, p->x, p->y, p->overlay_p); | 2331 | p->wd, p->h, p->x, p->y, overlay_p); |
| 2308 | #else | 2332 | #else |
| 2309 | mac_draw_bitmap (f, face->gc, p->x, p->y, | 2333 | mac_draw_bitmap (f, face->gc, p->x, p->y, |
| 2310 | p->wd, p->h, p->bits + p->dh, p->overlay_p); | 2334 | p->wd, p->h, p->bits + p->dh, overlay_p); |
| 2311 | #endif | 2335 | #endif |
| 2312 | XSetForeground (display, face->gc, gcv.foreground); | 2336 | XSetForeground (display, face->gc, gcv.foreground); |
| 2313 | } | 2337 | } |
| @@ -11135,7 +11159,7 @@ mac_handle_text_input_event (next_handler, event, data) | |||
| 11135 | EventRef event; | 11159 | EventRef event; |
| 11136 | void *data; | 11160 | void *data; |
| 11137 | { | 11161 | { |
| 11138 | OSStatus result, err = noErr; | 11162 | OSStatus err, result; |
| 11139 | Lisp_Object id_key = Qnil; | 11163 | Lisp_Object id_key = Qnil; |
| 11140 | int num_params; | 11164 | int num_params; |
| 11141 | const EventParamName *names; | 11165 | const EventParamName *names; |
| @@ -11196,6 +11220,7 @@ mac_handle_text_input_event (next_handler, event, data) | |||
| 11196 | SetEventParameter (event, EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER, | 11220 | SetEventParameter (event, EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER, |
| 11197 | typeUInt32, sizeof (UInt32), &seqno_uaia); | 11221 | typeUInt32, sizeof (UInt32), &seqno_uaia); |
| 11198 | seqno_uaia++; | 11222 | seqno_uaia++; |
| 11223 | result = noErr; | ||
| 11199 | break; | 11224 | break; |
| 11200 | 11225 | ||
| 11201 | case kEventTextInputUnicodeForKeyEvent: | 11226 | case kEventTextInputUnicodeForKeyEvent: |
| @@ -11213,7 +11238,7 @@ mac_handle_text_input_event (next_handler, event, data) | |||
| 11213 | if (err == noErr && mac_mapped_modifiers (modifiers)) | 11238 | if (err == noErr && mac_mapped_modifiers (modifiers)) |
| 11214 | /* There're mapped modifier keys. Process it in | 11239 | /* There're mapped modifier keys. Process it in |
| 11215 | do_keystroke. */ | 11240 | do_keystroke. */ |
| 11216 | return eventNotHandledErr; | 11241 | break; |
| 11217 | if (err == noErr) | 11242 | if (err == noErr) |
| 11218 | err = GetEventParameter (kbd_event, kEventParamKeyUnicodes, | 11243 | err = GetEventParameter (kbd_event, kEventParamKeyUnicodes, |
| 11219 | typeUnicodeText, NULL, 0, &actual_size, | 11244 | typeUnicodeText, NULL, 0, &actual_size, |
| @@ -11252,16 +11277,20 @@ mac_handle_text_input_event (next_handler, event, data) | |||
| 11252 | XSETFRAME (read_socket_inev->frame_or_window, f); | 11277 | XSETFRAME (read_socket_inev->frame_or_window, f); |
| 11253 | } | 11278 | } |
| 11254 | } | 11279 | } |
| 11255 | return eventNotHandledErr; | 11280 | break; |
| 11256 | } | 11281 | } |
| 11257 | } | 11282 | } |
| 11283 | if (err == noErr) | ||
| 11284 | { | ||
| 11285 | /* Non-ASCII keystrokes without mapped modifiers are | ||
| 11286 | processed at the Lisp level. */ | ||
| 11287 | id_key = Qunicode_for_key_event; | ||
| 11288 | num_params = sizeof (names_ufke) / sizeof (names_ufke[0]); | ||
| 11289 | names = names_ufke; | ||
| 11290 | types = types_ufke; | ||
| 11291 | result = noErr; | ||
| 11292 | } | ||
| 11258 | } | 11293 | } |
| 11259 | /* Non-ASCII keystrokes without mapped modifiers are processed | ||
| 11260 | at the Lisp level. */ | ||
| 11261 | id_key = Qunicode_for_key_event; | ||
| 11262 | num_params = sizeof (names_ufke) / sizeof (names_ufke[0]); | ||
| 11263 | names = names_ufke; | ||
| 11264 | types = types_ufke; | ||
| 11265 | break; | 11294 | break; |
| 11266 | 11295 | ||
| 11267 | case kEventTextInputOffsetToPos: | 11296 | case kEventTextInputOffsetToPos: |
| @@ -11271,22 +11300,24 @@ mac_handle_text_input_event (next_handler, event, data) | |||
| 11271 | Point p; | 11300 | Point p; |
| 11272 | 11301 | ||
| 11273 | if (!OVERLAYP (Vmac_ts_active_input_overlay)) | 11302 | if (!OVERLAYP (Vmac_ts_active_input_overlay)) |
| 11274 | return eventNotHandledErr; | 11303 | break; |
| 11275 | 11304 | ||
| 11276 | /* Strictly speaking, this is not always correct because | 11305 | /* Strictly speaking, this is not always correct because |
| 11277 | previous events may change some states about display. */ | 11306 | previous events may change some states about display. */ |
| 11278 | if (NILP (Foverlay_get (Vmac_ts_active_input_overlay, Qbefore_string))) | 11307 | if (!NILP (Foverlay_get (Vmac_ts_active_input_overlay, Qbefore_string))) |
| 11308 | { | ||
| 11309 | /* Active input area is displayed around the current point. */ | ||
| 11310 | f = SELECTED_FRAME (); | ||
| 11311 | w = XWINDOW (f->selected_window); | ||
| 11312 | } | ||
| 11313 | else if (WINDOWP (echo_area_window)) | ||
| 11279 | { | 11314 | { |
| 11280 | /* Active input area is displayed in the echo area. */ | 11315 | /* Active input area is displayed in the echo area. */ |
| 11281 | w = XWINDOW (echo_area_window); | 11316 | w = XWINDOW (echo_area_window); |
| 11282 | f = WINDOW_XFRAME (w); | 11317 | f = WINDOW_XFRAME (w); |
| 11283 | } | 11318 | } |
| 11284 | else | 11319 | else |
| 11285 | { | 11320 | break; |
| 11286 | /* Active input area is displayed around the current point. */ | ||
| 11287 | f = SELECTED_FRAME (); | ||
| 11288 | w = XWINDOW (f->selected_window); | ||
| 11289 | } | ||
| 11290 | 11321 | ||
| 11291 | p.h = (WINDOW_TO_FRAME_PIXEL_X (w, w->cursor.x) | 11322 | p.h = (WINDOW_TO_FRAME_PIXEL_X (w, w->cursor.x) |
| 11292 | + WINDOW_LEFT_FRINGE_WIDTH (w) | 11323 | + WINDOW_LEFT_FRINGE_WIDTH (w) |
| @@ -11296,6 +11327,8 @@ mac_handle_text_input_event (next_handler, event, data) | |||
| 11296 | + f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f)); | 11327 | + f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f)); |
| 11297 | err = SetEventParameter (event, kEventParamTextInputReplyPoint, | 11328 | err = SetEventParameter (event, kEventParamTextInputReplyPoint, |
| 11298 | typeQDPoint, sizeof (typeQDPoint), &p); | 11329 | typeQDPoint, sizeof (typeQDPoint), &p); |
| 11330 | if (err == noErr) | ||
| 11331 | result = noErr; | ||
| 11299 | } | 11332 | } |
| 11300 | break; | 11333 | break; |
| 11301 | 11334 | ||
| @@ -11307,9 +11340,6 @@ mac_handle_text_input_event (next_handler, event, data) | |||
| 11307 | err = mac_store_event_ref_as_apple_event (0, 0, Qtext_input, id_key, | 11340 | err = mac_store_event_ref_as_apple_event (0, 0, Qtext_input, id_key, |
| 11308 | event, num_params, | 11341 | event, num_params, |
| 11309 | names, types); | 11342 | names, types); |
| 11310 | if (err == noErr) | ||
| 11311 | result = noErr; | ||
| 11312 | |||
| 11313 | return result; | 11343 | return result; |
| 11314 | } | 11344 | } |
| 11315 | #endif | 11345 | #endif |
diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 7f45f584bcf..d9986fb8368 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in | |||
| @@ -139,7 +139,7 @@ LIBS = $(TLIB0) \ | |||
| 139 | $(TLIB1) \ | 139 | $(TLIB1) \ |
| 140 | $(TLIBW32) \ | 140 | $(TLIBW32) \ |
| 141 | $(TLASTLIB) \ | 141 | $(TLASTLIB) \ |
| 142 | $(WINMM) \ | 142 | $(WINMM) \ |
| 143 | $(ADVAPI32) \ | 143 | $(ADVAPI32) \ |
| 144 | $(GDI32) \ | 144 | $(GDI32) \ |
| 145 | $(COMDLG32) \ | 145 | $(COMDLG32) \ |
| @@ -147,6 +147,7 @@ LIBS = $(TLIB0) \ | |||
| 147 | $(MPR) \ | 147 | $(MPR) \ |
| 148 | $(SHELL32) \ | 148 | $(SHELL32) \ |
| 149 | $(WINSPOOL) \ | 149 | $(WINSPOOL) \ |
| 150 | $(OLE32) \ | ||
| 150 | $(libc) | 151 | $(libc) |
| 151 | 152 | ||
| 152 | # | 153 | # |
diff --git a/src/minibuf.c b/src/minibuf.c index 698a3478eb7..eeed61be868 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -1723,9 +1723,15 @@ PREDICATE limits completion to a subset of COLLECTION. | |||
| 1723 | See `try-completion' and `all-completions' for more details | 1723 | See `try-completion' and `all-completions' for more details |
| 1724 | on completion, COLLECTION, and PREDICATE. | 1724 | on completion, COLLECTION, and PREDICATE. |
| 1725 | 1725 | ||
| 1726 | If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless | 1726 | REQUIRE-MATCH can take the following values: |
| 1727 | the input is (or completes to) an element of COLLECTION or is null. | 1727 | - t means that the user is not allowed to exit unless |
| 1728 | If it is also not t, typing RET does not exit if it does non-null completion. | 1728 | the input is (or completes to) an element of COLLECTION or is null. |
| 1729 | - nil means that the user can exit with any input. | ||
| 1730 | - `confirm-only' means that the user can exit with any input, but she will | ||
| 1731 | need to confirm her choice if the input is not an element of COLLECTION. | ||
| 1732 | - anything else behaves like t except that typing RET does not exit if it | ||
| 1733 | does non-null completion. | ||
| 1734 | |||
| 1729 | If the input is null, `completing-read' returns DEF, or an empty string | 1735 | If the input is null, `completing-read' returns DEF, or an empty string |
| 1730 | if DEF is nil, regardless of the value of REQUIRE-MATCH. | 1736 | if DEF is nil, regardless of the value of REQUIRE-MATCH. |
| 1731 | 1737 | ||
| @@ -2236,6 +2242,18 @@ a repetition of this command will exit. */) | |||
| 2236 | goto exit; | 2242 | goto exit; |
| 2237 | } | 2243 | } |
| 2238 | 2244 | ||
| 2245 | if (EQ (Vminibuffer_completion_confirm, intern ("confirm-only"))) | ||
| 2246 | { /* The user is permitted to exit with an input that's rejected | ||
| 2247 | by test-completion, but at the condition to confirm her choice. */ | ||
| 2248 | if (EQ (current_kboard->Vlast_command, Vthis_command)) | ||
| 2249 | goto exit; | ||
| 2250 | else | ||
| 2251 | { | ||
| 2252 | temp_echo_area_glyphs (build_string (" [Confirm]")); | ||
| 2253 | return Qnil; | ||
| 2254 | } | ||
| 2255 | } | ||
| 2256 | |||
| 2239 | /* Call do_completion, but ignore errors. */ | 2257 | /* Call do_completion, but ignore errors. */ |
| 2240 | SET_PT (ZV); | 2258 | SET_PT (ZV); |
| 2241 | val = internal_condition_case (complete_and_exit_1, Qerror, | 2259 | val = internal_condition_case (complete_and_exit_1, Qerror, |
diff --git a/src/print.c b/src/print.c index 250b62ec3a5..0eb026df831 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -690,7 +690,7 @@ If variable `temp-buffer-show-function' is non-nil, call it at the end | |||
| 690 | to get the buffer displayed instead of just displaying the non-selected | 690 | to get the buffer displayed instead of just displaying the non-selected |
| 691 | buffer and calling the hook. It gets one argument, the buffer to display. | 691 | buffer and calling the hook. It gets one argument, the buffer to display. |
| 692 | 692 | ||
| 693 | usage: (with-output-to-temp-buffer BUFNAME BODY ...) */) | 693 | usage: (with-output-to-temp-buffer BUFNAME BODY...) */) |
| 694 | (args) | 694 | (args) |
| 695 | Lisp_Object args; | 695 | Lisp_Object args; |
| 696 | { | 696 | { |
diff --git a/src/process.c b/src/process.c index 9a7cf29963f..b63edbe0b6d 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -121,14 +121,6 @@ Boston, MA 02110-1301, USA. */ | |||
| 121 | #include <sys/wait.h> | 121 | #include <sys/wait.h> |
| 122 | #endif | 122 | #endif |
| 123 | 123 | ||
| 124 | /* Disable IPv6 support for w32 until someone figures out how to do it | ||
| 125 | properly. */ | ||
| 126 | #ifdef WINDOWSNT | ||
| 127 | # ifdef AF_INET6 | ||
| 128 | # undef AF_INET6 | ||
| 129 | # endif | ||
| 130 | #endif | ||
| 131 | |||
| 132 | #include "lisp.h" | 124 | #include "lisp.h" |
| 133 | #include "systime.h" | 125 | #include "systime.h" |
| 134 | #include "systty.h" | 126 | #include "systty.h" |
| @@ -393,7 +385,7 @@ struct sockaddr_and_len { | |||
| 393 | int len; | 385 | int len; |
| 394 | } datagram_address[MAXDESC]; | 386 | } datagram_address[MAXDESC]; |
| 395 | #define DATAGRAM_CHAN_P(chan) (datagram_address[chan].sa != 0) | 387 | #define DATAGRAM_CHAN_P(chan) (datagram_address[chan].sa != 0) |
| 396 | #define DATAGRAM_CONN_P(proc) (PROCESSP (proc) && datagram_address[XINT (XPROCESS (proc)->infd)].sa != 0) | 388 | #define DATAGRAM_CONN_P(proc) (PROCESSP (proc) && datagram_address[XPROCESS (proc)->infd].sa != 0) |
| 397 | #else | 389 | #else |
| 398 | #define DATAGRAM_CHAN_P(chan) (0) | 390 | #define DATAGRAM_CHAN_P(chan) (0) |
| 399 | #define DATAGRAM_CONN_P(proc) (0) | 391 | #define DATAGRAM_CONN_P(proc) (0) |
| @@ -628,19 +620,19 @@ make_process (name) | |||
| 628 | 620 | ||
| 629 | p = allocate_process (); | 621 | p = allocate_process (); |
| 630 | 622 | ||
| 631 | XSETINT (p->infd, -1); | 623 | p->infd = -1; |
| 632 | XSETINT (p->outfd, -1); | 624 | p->outfd = -1; |
| 633 | XSETFASTINT (p->tick, 0); | 625 | p->tick = 0; |
| 634 | XSETFASTINT (p->update_tick, 0); | 626 | p->update_tick = 0; |
| 635 | p->pid = 0; | 627 | p->pid = 0; |
| 636 | p->raw_status_new = 0; | 628 | p->raw_status_new = 0; |
| 637 | p->status = Qrun; | 629 | p->status = Qrun; |
| 638 | p->mark = Fmake_marker (); | 630 | p->mark = Fmake_marker (); |
| 639 | 631 | ||
| 640 | #ifdef ADAPTIVE_READ_BUFFERING | 632 | #ifdef ADAPTIVE_READ_BUFFERING |
| 641 | p->adaptive_read_buffering = Qnil; | 633 | p->adaptive_read_buffering = 0; |
| 642 | XSETFASTINT (p->read_output_delay, 0); | 634 | p->read_output_delay = 0; |
| 643 | p->read_output_skip = Qnil; | 635 | p->read_output_skip = 0; |
| 644 | #endif | 636 | #endif |
| 645 | 637 | ||
| 646 | /* If name is already in use, modify it until it is unused. */ | 638 | /* If name is already in use, modify it until it is unused. */ |
| @@ -679,8 +671,8 @@ setup_process_coding_systems (process) | |||
| 679 | Lisp_Object process; | 671 | Lisp_Object process; |
| 680 | { | 672 | { |
| 681 | struct Lisp_Process *p = XPROCESS (process); | 673 | struct Lisp_Process *p = XPROCESS (process); |
| 682 | int inch = XINT (p->infd); | 674 | int inch = p->infd; |
| 683 | int outch = XINT (p->outfd); | 675 | int outch = p->outfd; |
| 684 | 676 | ||
| 685 | if (inch < 0 || outch < 0) | 677 | if (inch < 0 || outch < 0) |
| 686 | return; | 678 | return; |
| @@ -692,7 +684,7 @@ setup_process_coding_systems (process) | |||
| 692 | proc_decode_coding_system[inch]); | 684 | proc_decode_coding_system[inch]); |
| 693 | if (! NILP (p->filter)) | 685 | if (! NILP (p->filter)) |
| 694 | { | 686 | { |
| 695 | if (NILP (p->filter_multibyte)) | 687 | if (!p->filter_multibyte) |
| 696 | setup_raw_text_coding_system (proc_decode_coding_system[inch]); | 688 | setup_raw_text_coding_system (proc_decode_coding_system[inch]); |
| 697 | } | 689 | } |
| 698 | else if (BUFFERP (p->buffer)) | 690 | else if (BUFFERP (p->buffer)) |
| @@ -815,10 +807,10 @@ nil, indicating the current buffer's process. */) | |||
| 815 | if (NETCONN1_P (p)) | 807 | if (NETCONN1_P (p)) |
| 816 | { | 808 | { |
| 817 | p->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); | 809 | p->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); |
| 818 | XSETINT (p->tick, ++process_tick); | 810 | p->tick = ++process_tick; |
| 819 | status_notify (p); | 811 | status_notify (p); |
| 820 | } | 812 | } |
| 821 | else if (XINT (p->infd) >= 0) | 813 | else if (p->infd >= 0) |
| 822 | { | 814 | { |
| 823 | #ifdef SIGCHLD | 815 | #ifdef SIGCHLD |
| 824 | Lisp_Object symbol; | 816 | Lisp_Object symbol; |
| @@ -846,7 +838,7 @@ nil, indicating the current buffer's process. */) | |||
| 846 | /* Do this now, since remove_process will make sigchld_handler do nothing. */ | 838 | /* Do this now, since remove_process will make sigchld_handler do nothing. */ |
| 847 | p->status | 839 | p->status |
| 848 | = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); | 840 | = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); |
| 849 | XSETINT (p->tick, ++process_tick); | 841 | p->tick = ++process_tick; |
| 850 | status_notify (p); | 842 | status_notify (p); |
| 851 | } | 843 | } |
| 852 | } | 844 | } |
| @@ -1038,18 +1030,18 @@ The string argument is normally a multibyte string, except: | |||
| 1038 | (debug) | 1030 | (debug) |
| 1039 | (set-process-filter process ...) */ | 1031 | (set-process-filter process ...) */ |
| 1040 | 1032 | ||
| 1041 | if (XINT (p->infd) >= 0) | 1033 | if (p->infd >= 0) |
| 1042 | { | 1034 | { |
| 1043 | if (EQ (filter, Qt) && !EQ (p->status, Qlisten)) | 1035 | if (EQ (filter, Qt) && !EQ (p->status, Qlisten)) |
| 1044 | { | 1036 | { |
| 1045 | FD_CLR (XINT (p->infd), &input_wait_mask); | 1037 | FD_CLR (p->infd, &input_wait_mask); |
| 1046 | FD_CLR (XINT (p->infd), &non_keyboard_wait_mask); | 1038 | FD_CLR (p->infd, &non_keyboard_wait_mask); |
| 1047 | } | 1039 | } |
| 1048 | else if (EQ (p->filter, Qt) | 1040 | else if (EQ (p->filter, Qt) |
| 1049 | && !EQ (p->command, Qt)) /* Network process not stopped. */ | 1041 | && !EQ (p->command, Qt)) /* Network process not stopped. */ |
| 1050 | { | 1042 | { |
| 1051 | FD_SET (XINT (p->infd), &input_wait_mask); | 1043 | FD_SET (p->infd, &input_wait_mask); |
| 1052 | FD_SET (XINT (p->infd), &non_keyboard_wait_mask); | 1044 | FD_SET (p->infd, &non_keyboard_wait_mask); |
| 1053 | } | 1045 | } |
| 1054 | } | 1046 | } |
| 1055 | 1047 | ||
| @@ -1111,8 +1103,8 @@ DEFUN ("set-process-window-size", Fset_process_window_size, | |||
| 1111 | CHECK_NATNUM (height); | 1103 | CHECK_NATNUM (height); |
| 1112 | CHECK_NATNUM (width); | 1104 | CHECK_NATNUM (width); |
| 1113 | 1105 | ||
| 1114 | if (XINT (XPROCESS (process)->infd) < 0 | 1106 | if (XPROCESS (process)->infd < 0 |
| 1115 | || set_window_size (XINT (XPROCESS (process)->infd), | 1107 | || set_window_size (XPROCESS (process)->infd, |
| 1116 | XINT (height), XINT (width)) <= 0) | 1108 | XINT (height), XINT (width)) <= 0) |
| 1117 | return Qnil; | 1109 | return Qnil; |
| 1118 | else | 1110 | else |
| @@ -1140,7 +1132,7 @@ for the process which will run. */) | |||
| 1140 | register Lisp_Object process, flag; | 1132 | register Lisp_Object process, flag; |
| 1141 | { | 1133 | { |
| 1142 | CHECK_PROCESS (process); | 1134 | CHECK_PROCESS (process); |
| 1143 | XPROCESS (process)->inherit_coding_system_flag = flag; | 1135 | XPROCESS (process)->inherit_coding_system_flag = !NILP (flag); |
| 1144 | return flag; | 1136 | return flag; |
| 1145 | } | 1137 | } |
| 1146 | 1138 | ||
| @@ -1155,7 +1147,7 @@ the process output. */) | |||
| 1155 | register Lisp_Object process; | 1147 | register Lisp_Object process; |
| 1156 | { | 1148 | { |
| 1157 | CHECK_PROCESS (process); | 1149 | CHECK_PROCESS (process); |
| 1158 | return XPROCESS (process)->inherit_coding_system_flag; | 1150 | return XPROCESS (process)->inherit_coding_system_flag ? Qt : Qnil; |
| 1159 | } | 1151 | } |
| 1160 | 1152 | ||
| 1161 | DEFUN ("set-process-query-on-exit-flag", | 1153 | DEFUN ("set-process-query-on-exit-flag", |
| @@ -1168,7 +1160,7 @@ exiting if PROCESS is running. */) | |||
| 1168 | register Lisp_Object process, flag; | 1160 | register Lisp_Object process, flag; |
| 1169 | { | 1161 | { |
| 1170 | CHECK_PROCESS (process); | 1162 | CHECK_PROCESS (process); |
| 1171 | XPROCESS (process)->kill_without_query = Fnull (flag); | 1163 | XPROCESS (process)->kill_without_query = NILP (flag); |
| 1172 | return flag; | 1164 | return flag; |
| 1173 | } | 1165 | } |
| 1174 | 1166 | ||
| @@ -1180,7 +1172,7 @@ DEFUN ("process-query-on-exit-flag", | |||
| 1180 | register Lisp_Object process; | 1172 | register Lisp_Object process; |
| 1181 | { | 1173 | { |
| 1182 | CHECK_PROCESS (process); | 1174 | CHECK_PROCESS (process); |
| 1183 | return Fnull (XPROCESS (process)->kill_without_query); | 1175 | return (XPROCESS (process)->kill_without_query ? Qnil : Qt); |
| 1184 | } | 1176 | } |
| 1185 | 1177 | ||
| 1186 | #ifdef DATAGRAM_SOCKETS | 1178 | #ifdef DATAGRAM_SOCKETS |
| @@ -1355,7 +1347,7 @@ list_processes_1 (query_only) | |||
| 1355 | p = XPROCESS (proc); | 1347 | p = XPROCESS (proc); |
| 1356 | if (NILP (p->childp)) | 1348 | if (NILP (p->childp)) |
| 1357 | continue; | 1349 | continue; |
| 1358 | if (!NILP (query_only) && !NILP (p->kill_without_query)) | 1350 | if (!NILP (query_only) && p->kill_without_query) |
| 1359 | continue; | 1351 | continue; |
| 1360 | if (STRINGP (p->name) | 1352 | if (STRINGP (p->name) |
| 1361 | && ( i = SCHARS (p->name), (i > w_proc))) | 1353 | && ( i = SCHARS (p->name), (i > w_proc))) |
| @@ -1418,7 +1410,7 @@ list_processes_1 (query_only) | |||
| 1418 | p = XPROCESS (proc); | 1410 | p = XPROCESS (proc); |
| 1419 | if (NILP (p->childp)) | 1411 | if (NILP (p->childp)) |
| 1420 | continue; | 1412 | continue; |
| 1421 | if (!NILP (query_only) && !NILP (p->kill_without_query)) | 1413 | if (!NILP (query_only) && p->kill_without_query) |
| 1422 | continue; | 1414 | continue; |
| 1423 | 1415 | ||
| 1424 | Finsert (1, &p->name); | 1416 | Finsert (1, &p->name); |
| @@ -1494,7 +1486,7 @@ list_processes_1 (query_only) | |||
| 1494 | if (NILP (port)) | 1486 | if (NILP (port)) |
| 1495 | port = Fformat_network_address (Fplist_get (p->childp, QClocal), Qnil); | 1487 | port = Fformat_network_address (Fplist_get (p->childp, QClocal), Qnil); |
| 1496 | sprintf (tembuf, "(network %s server on %s)\n", | 1488 | sprintf (tembuf, "(network %s server on %s)\n", |
| 1497 | (DATAGRAM_CHAN_P (XINT (p->infd)) ? "datagram" : "stream"), | 1489 | (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"), |
| 1498 | (STRINGP (port) ? (char *)SDATA (port) : "?")); | 1490 | (STRINGP (port) ? (char *)SDATA (port) : "?")); |
| 1499 | insert_string (tembuf); | 1491 | insert_string (tembuf); |
| 1500 | } | 1492 | } |
| @@ -1512,7 +1504,7 @@ list_processes_1 (query_only) | |||
| 1512 | if (NILP (host)) | 1504 | if (NILP (host)) |
| 1513 | host = Fformat_network_address (Fplist_get (p->childp, QCremote), Qnil); | 1505 | host = Fformat_network_address (Fplist_get (p->childp, QCremote), Qnil); |
| 1514 | sprintf (tembuf, "(network %s connection to %s)\n", | 1506 | sprintf (tembuf, "(network %s connection to %s)\n", |
| 1515 | (DATAGRAM_CHAN_P (XINT (p->infd)) ? "datagram" : "stream"), | 1507 | (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"), |
| 1516 | (STRINGP (host) ? (char *)SDATA (host) : "?")); | 1508 | (STRINGP (host) ? (char *)SDATA (host) : "?")); |
| 1517 | insert_string (tembuf); | 1509 | insert_string (tembuf); |
| 1518 | } | 1510 | } |
| @@ -1643,11 +1635,13 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) | |||
| 1643 | XPROCESS (proc)->sentinel = Qnil; | 1635 | XPROCESS (proc)->sentinel = Qnil; |
| 1644 | XPROCESS (proc)->filter = Qnil; | 1636 | XPROCESS (proc)->filter = Qnil; |
| 1645 | XPROCESS (proc)->filter_multibyte | 1637 | XPROCESS (proc)->filter_multibyte |
| 1646 | = buffer_defaults.enable_multibyte_characters; | 1638 | = !NILP (buffer_defaults.enable_multibyte_characters); |
| 1647 | XPROCESS (proc)->command = Flist (nargs - 2, args + 2); | 1639 | XPROCESS (proc)->command = Flist (nargs - 2, args + 2); |
| 1648 | 1640 | ||
| 1649 | #ifdef ADAPTIVE_READ_BUFFERING | 1641 | #ifdef ADAPTIVE_READ_BUFFERING |
| 1650 | XPROCESS (proc)->adaptive_read_buffering = Vprocess_adaptive_read_buffering; | 1642 | XPROCESS (proc)->adaptive_read_buffering |
| 1643 | = (NILP (Vprocess_adaptive_read_buffering) ? 0 | ||
| 1644 | : EQ (Vprocess_adaptive_read_buffering, Qt) ? 1 : 2); | ||
| 1651 | #endif | 1645 | #endif |
| 1652 | 1646 | ||
| 1653 | /* Make the process marker point into the process buffer (if any). */ | 1647 | /* Make the process marker point into the process buffer (if any). */ |
| @@ -1778,13 +1772,11 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) | |||
| 1778 | #endif /* not VMS */ | 1772 | #endif /* not VMS */ |
| 1779 | 1773 | ||
| 1780 | XPROCESS (proc)->decoding_buf = make_uninit_string (0); | 1774 | XPROCESS (proc)->decoding_buf = make_uninit_string (0); |
| 1781 | XPROCESS (proc)->decoding_carryover = make_number (0); | 1775 | XPROCESS (proc)->decoding_carryover = 0; |
| 1782 | XPROCESS (proc)->encoding_buf = make_uninit_string (0); | 1776 | XPROCESS (proc)->encoding_buf = make_uninit_string (0); |
| 1783 | XPROCESS (proc)->encoding_carryover = make_number (0); | ||
| 1784 | 1777 | ||
| 1785 | XPROCESS (proc)->inherit_coding_system_flag | 1778 | XPROCESS (proc)->inherit_coding_system_flag |
| 1786 | = (NILP (buffer) || !inherit_process_coding_system | 1779 | = (NILP (buffer) || !inherit_process_coding_system); |
| 1787 | ? Qnil : Qt); | ||
| 1788 | 1780 | ||
| 1789 | create_process (proc, (char **) new_argv, current_dir); | 1781 | create_process (proc, (char **) new_argv, current_dir); |
| 1790 | 1782 | ||
| @@ -1956,15 +1948,15 @@ create_process (process, new_argv, current_dir) | |||
| 1956 | /* Record this as an active process, with its channels. | 1948 | /* Record this as an active process, with its channels. |
| 1957 | As a result, child_setup will close Emacs's side of the pipes. */ | 1949 | As a result, child_setup will close Emacs's side of the pipes. */ |
| 1958 | chan_process[inchannel] = process; | 1950 | chan_process[inchannel] = process; |
| 1959 | XSETINT (XPROCESS (process)->infd, inchannel); | 1951 | XPROCESS (process)->infd = inchannel; |
| 1960 | XSETINT (XPROCESS (process)->outfd, outchannel); | 1952 | XPROCESS (process)->outfd = outchannel; |
| 1961 | 1953 | ||
| 1962 | /* Previously we recorded the tty descriptor used in the subprocess. | 1954 | /* Previously we recorded the tty descriptor used in the subprocess. |
| 1963 | It was only used for getting the foreground tty process, so now | 1955 | It was only used for getting the foreground tty process, so now |
| 1964 | we just reopen the device (see emacs_get_tty_pgrp) as this is | 1956 | we just reopen the device (see emacs_get_tty_pgrp) as this is |
| 1965 | more portable (see USG_SUBTTY_WORKS above). */ | 1957 | more portable (see USG_SUBTTY_WORKS above). */ |
| 1966 | 1958 | ||
| 1967 | XPROCESS (process)->pty_flag = (pty_flag ? Qt : Qnil); | 1959 | XPROCESS (process)->pty_flag = pty_flag; |
| 1968 | XPROCESS (process)->status = Qrun; | 1960 | XPROCESS (process)->status = Qrun; |
| 1969 | setup_process_coding_systems (process); | 1961 | setup_process_coding_systems (process); |
| 1970 | 1962 | ||
| @@ -2481,7 +2473,7 @@ DEFUN ("process-datagram-address", Fprocess_datagram_address, Sprocess_datagram_ | |||
| 2481 | if (!DATAGRAM_CONN_P (process)) | 2473 | if (!DATAGRAM_CONN_P (process)) |
| 2482 | return Qnil; | 2474 | return Qnil; |
| 2483 | 2475 | ||
| 2484 | channel = XINT (XPROCESS (process)->infd); | 2476 | channel = XPROCESS (process)->infd; |
| 2485 | return conv_sockaddr_to_lisp (datagram_address[channel].sa, | 2477 | return conv_sockaddr_to_lisp (datagram_address[channel].sa, |
| 2486 | datagram_address[channel].len); | 2478 | datagram_address[channel].len); |
| 2487 | } | 2479 | } |
| @@ -2501,7 +2493,7 @@ Returns nil upon error setting address, ADDRESS otherwise. */) | |||
| 2501 | if (!DATAGRAM_CONN_P (process)) | 2493 | if (!DATAGRAM_CONN_P (process)) |
| 2502 | return Qnil; | 2494 | return Qnil; |
| 2503 | 2495 | ||
| 2504 | channel = XINT (XPROCESS (process)->infd); | 2496 | channel = XPROCESS (process)->infd; |
| 2505 | 2497 | ||
| 2506 | len = get_lisp_to_sockaddr_size (address, &family); | 2498 | len = get_lisp_to_sockaddr_size (address, &family); |
| 2507 | if (datagram_address[channel].len != len) | 2499 | if (datagram_address[channel].len != len) |
| @@ -2666,7 +2658,7 @@ OPTION is not a supported option, return nil instead; otherwise return t. */) | |||
| 2666 | if (!NETCONN1_P (p)) | 2658 | if (!NETCONN1_P (p)) |
| 2667 | error ("Process is not a network process"); | 2659 | error ("Process is not a network process"); |
| 2668 | 2660 | ||
| 2669 | s = XINT (p->infd); | 2661 | s = p->infd; |
| 2670 | if (s < 0) | 2662 | if (s < 0) |
| 2671 | error ("Process is not running"); | 2663 | error ("Process is not running"); |
| 2672 | 2664 | ||
| @@ -3425,18 +3417,18 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3425 | p->buffer = buffer; | 3417 | p->buffer = buffer; |
| 3426 | p->sentinel = sentinel; | 3418 | p->sentinel = sentinel; |
| 3427 | p->filter = filter; | 3419 | p->filter = filter; |
| 3428 | p->filter_multibyte = buffer_defaults.enable_multibyte_characters; | 3420 | p->filter_multibyte = !NILP (buffer_defaults.enable_multibyte_characters); |
| 3429 | /* Override the above only if :filter-multibyte is specified. */ | 3421 | /* Override the above only if :filter-multibyte is specified. */ |
| 3430 | if (! NILP (Fplist_member (contact, QCfilter_multibyte))) | 3422 | if (! NILP (Fplist_member (contact, QCfilter_multibyte))) |
| 3431 | p->filter_multibyte = Fplist_get (contact, QCfilter_multibyte); | 3423 | p->filter_multibyte = !NILP (Fplist_get (contact, QCfilter_multibyte)); |
| 3432 | p->log = Fplist_get (contact, QClog); | 3424 | p->log = Fplist_get (contact, QClog); |
| 3433 | if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) | 3425 | if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) |
| 3434 | p->kill_without_query = Qt; | 3426 | p->kill_without_query = 1; |
| 3435 | if ((tem = Fplist_get (contact, QCstop), !NILP (tem))) | 3427 | if ((tem = Fplist_get (contact, QCstop), !NILP (tem))) |
| 3436 | p->command = Qt; | 3428 | p->command = Qt; |
| 3437 | p->pid = 0; | 3429 | p->pid = 0; |
| 3438 | XSETINT (p->infd, inch); | 3430 | p->infd = inch; |
| 3439 | XSETINT (p->outfd, outch); | 3431 | p->outfd = outch; |
| 3440 | if (is_server && socktype == SOCK_STREAM) | 3432 | if (is_server && socktype == SOCK_STREAM) |
| 3441 | p->status = Qlisten; | 3433 | p->status = Qlisten; |
| 3442 | 3434 | ||
| @@ -3557,13 +3549,11 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3557 | setup_process_coding_systems (proc); | 3549 | setup_process_coding_systems (proc); |
| 3558 | 3550 | ||
| 3559 | p->decoding_buf = make_uninit_string (0); | 3551 | p->decoding_buf = make_uninit_string (0); |
| 3560 | p->decoding_carryover = make_number (0); | 3552 | p->decoding_carryover = 0; |
| 3561 | p->encoding_buf = make_uninit_string (0); | 3553 | p->encoding_buf = make_uninit_string (0); |
| 3562 | p->encoding_carryover = make_number (0); | ||
| 3563 | 3554 | ||
| 3564 | p->inherit_coding_system_flag | 3555 | p->inherit_coding_system_flag |
| 3565 | = (!NILP (tem) || NILP (buffer) || !inherit_process_coding_system | 3556 | = (!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); |
| 3566 | ? Qnil : Qt); | ||
| 3567 | 3557 | ||
| 3568 | UNGCPRO; | 3558 | UNGCPRO; |
| 3569 | return proc; | 3559 | return proc; |
| @@ -3826,16 +3816,16 @@ deactivate_process (proc) | |||
| 3826 | register int inchannel, outchannel; | 3816 | register int inchannel, outchannel; |
| 3827 | register struct Lisp_Process *p = XPROCESS (proc); | 3817 | register struct Lisp_Process *p = XPROCESS (proc); |
| 3828 | 3818 | ||
| 3829 | inchannel = XINT (p->infd); | 3819 | inchannel = p->infd; |
| 3830 | outchannel = XINT (p->outfd); | 3820 | outchannel = p->outfd; |
| 3831 | 3821 | ||
| 3832 | #ifdef ADAPTIVE_READ_BUFFERING | 3822 | #ifdef ADAPTIVE_READ_BUFFERING |
| 3833 | if (XINT (p->read_output_delay) > 0) | 3823 | if (p->read_output_delay > 0) |
| 3834 | { | 3824 | { |
| 3835 | if (--process_output_delay_count < 0) | 3825 | if (--process_output_delay_count < 0) |
| 3836 | process_output_delay_count = 0; | 3826 | process_output_delay_count = 0; |
| 3837 | XSETINT (p->read_output_delay, 0); | 3827 | p->read_output_delay = 0; |
| 3838 | p->read_output_skip = Qnil; | 3828 | p->read_output_skip = 0; |
| 3839 | } | 3829 | } |
| 3840 | #endif | 3830 | #endif |
| 3841 | 3831 | ||
| @@ -3857,8 +3847,8 @@ deactivate_process (proc) | |||
| 3857 | emacs_close (outchannel); | 3847 | emacs_close (outchannel); |
| 3858 | #endif | 3848 | #endif |
| 3859 | 3849 | ||
| 3860 | XSETINT (p->infd, -1); | 3850 | p->infd = -1; |
| 3861 | XSETINT (p->outfd, -1); | 3851 | p->outfd = -1; |
| 3862 | #ifdef DATAGRAM_SOCKETS | 3852 | #ifdef DATAGRAM_SOCKETS |
| 3863 | if (DATAGRAM_CHAN_P (inchannel)) | 3853 | if (DATAGRAM_CHAN_P (inchannel)) |
| 3864 | { | 3854 | { |
| @@ -3906,8 +3896,8 @@ close_process_descs () | |||
| 3906 | process = chan_process[i]; | 3896 | process = chan_process[i]; |
| 3907 | if (!NILP (process)) | 3897 | if (!NILP (process)) |
| 3908 | { | 3898 | { |
| 3909 | int in = XINT (XPROCESS (process)->infd); | 3899 | int in = XPROCESS (process)->infd; |
| 3910 | int out = XINT (XPROCESS (process)->outfd); | 3900 | int out = XPROCESS (process)->outfd; |
| 3911 | if (in >= 0) | 3901 | if (in >= 0) |
| 3912 | emacs_close (in); | 3902 | emacs_close (in); |
| 3913 | if (out >= 0 && in != out) | 3903 | if (out >= 0 && in != out) |
| @@ -4151,8 +4141,8 @@ server_accept_connection (server, channel) | |||
| 4151 | p->filter = ps->filter; | 4141 | p->filter = ps->filter; |
| 4152 | p->command = Qnil; | 4142 | p->command = Qnil; |
| 4153 | p->pid = 0; | 4143 | p->pid = 0; |
| 4154 | XSETINT (p->infd, s); | 4144 | p->infd = s; |
| 4155 | XSETINT (p->outfd, s); | 4145 | p->outfd = s; |
| 4156 | p->status = Qrun; | 4146 | p->status = Qrun; |
| 4157 | 4147 | ||
| 4158 | /* Client processes for accepted connections are not stopped initially. */ | 4148 | /* Client processes for accepted connections are not stopped initially. */ |
| @@ -4175,12 +4165,11 @@ server_accept_connection (server, channel) | |||
| 4175 | setup_process_coding_systems (proc); | 4165 | setup_process_coding_systems (proc); |
| 4176 | 4166 | ||
| 4177 | p->decoding_buf = make_uninit_string (0); | 4167 | p->decoding_buf = make_uninit_string (0); |
| 4178 | p->decoding_carryover = make_number (0); | 4168 | p->decoding_carryover = 0; |
| 4179 | p->encoding_buf = make_uninit_string (0); | 4169 | p->encoding_buf = make_uninit_string (0); |
| 4180 | p->encoding_carryover = make_number (0); | ||
| 4181 | 4170 | ||
| 4182 | p->inherit_coding_system_flag | 4171 | p->inherit_coding_system_flag |
| 4183 | = (NILP (buffer) ? Qnil : ps->inherit_coding_system_flag); | 4172 | = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag); |
| 4184 | 4173 | ||
| 4185 | if (!NILP (ps->log)) | 4174 | if (!NILP (ps->log)) |
| 4186 | call3 (ps->log, server, proc, | 4175 | call3 (ps->log, server, proc, |
| @@ -4305,7 +4294,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, | |||
| 4305 | 4294 | ||
| 4306 | /* If wait_proc is a process to watch, set wait_channel accordingly. */ | 4295 | /* If wait_proc is a process to watch, set wait_channel accordingly. */ |
| 4307 | if (wait_proc != NULL) | 4296 | if (wait_proc != NULL) |
| 4308 | wait_channel = XINT (wait_proc->infd); | 4297 | wait_channel = wait_proc->infd; |
| 4309 | 4298 | ||
| 4310 | record_unwind_protect (wait_reading_process_output_unwind, | 4299 | record_unwind_protect (wait_reading_process_output_unwind, |
| 4311 | make_number (waiting_for_user_input_p)); | 4300 | make_number (waiting_for_user_input_p)); |
| @@ -4490,9 +4479,9 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, | |||
| 4490 | XSETPROCESS (proc, wait_proc); | 4479 | XSETPROCESS (proc, wait_proc); |
| 4491 | 4480 | ||
| 4492 | /* Read data from the process, until we exhaust it. */ | 4481 | /* Read data from the process, until we exhaust it. */ |
| 4493 | while (XINT (wait_proc->infd) >= 0) | 4482 | while (wait_proc->infd >= 0) |
| 4494 | { | 4483 | { |
| 4495 | nread = read_process_output (proc, XINT (wait_proc->infd)); | 4484 | nread = read_process_output (proc, wait_proc->infd); |
| 4496 | 4485 | ||
| 4497 | if (nread == 0) | 4486 | if (nread == 0) |
| 4498 | break; | 4487 | break; |
| @@ -4522,9 +4511,9 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, | |||
| 4522 | 4511 | ||
| 4523 | if (wait_proc && just_wait_proc) | 4512 | if (wait_proc && just_wait_proc) |
| 4524 | { | 4513 | { |
| 4525 | if (XINT (wait_proc->infd) < 0) /* Terminated */ | 4514 | if (wait_proc->infd < 0) /* Terminated */ |
| 4526 | break; | 4515 | break; |
| 4527 | FD_SET (XINT (wait_proc->infd), &Available); | 4516 | FD_SET (wait_proc->infd, &Available); |
| 4528 | check_delay = 0; | 4517 | check_delay = 0; |
| 4529 | IF_NON_BLOCKING_CONNECT (check_connect = 0); | 4518 | IF_NON_BLOCKING_CONNECT (check_connect = 0); |
| 4530 | } | 4519 | } |
| @@ -4572,7 +4561,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, | |||
| 4572 | 4561 | ||
| 4573 | #ifdef ADAPTIVE_READ_BUFFERING | 4562 | #ifdef ADAPTIVE_READ_BUFFERING |
| 4574 | /* Set the timeout for adaptive read buffering if any | 4563 | /* Set the timeout for adaptive read buffering if any |
| 4575 | process has non-nil read_output_skip and non-zero | 4564 | process has non-zero read_output_skip and non-zero |
| 4576 | read_output_delay, and we are not reading output for a | 4565 | read_output_delay, and we are not reading output for a |
| 4577 | specific wait_channel. It is not executed if | 4566 | specific wait_channel. It is not executed if |
| 4578 | Vprocess_adaptive_read_buffering is nil. */ | 4567 | Vprocess_adaptive_read_buffering is nil. */ |
| @@ -4587,16 +4576,16 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, | |||
| 4587 | if (NILP (proc)) | 4576 | if (NILP (proc)) |
| 4588 | continue; | 4577 | continue; |
| 4589 | /* Find minimum non-zero read_output_delay among the | 4578 | /* Find minimum non-zero read_output_delay among the |
| 4590 | processes with non-nil read_output_skip. */ | 4579 | processes with non-zero read_output_skip. */ |
| 4591 | if (XINT (XPROCESS (proc)->read_output_delay) > 0) | 4580 | if (XPROCESS (proc)->read_output_delay > 0) |
| 4592 | { | 4581 | { |
| 4593 | check_delay--; | 4582 | check_delay--; |
| 4594 | if (NILP (XPROCESS (proc)->read_output_skip)) | 4583 | if (!XPROCESS (proc)->read_output_skip) |
| 4595 | continue; | 4584 | continue; |
| 4596 | FD_CLR (channel, &Available); | 4585 | FD_CLR (channel, &Available); |
| 4597 | XPROCESS (proc)->read_output_skip = Qnil; | 4586 | XPROCESS (proc)->read_output_skip = 0; |
| 4598 | if (XINT (XPROCESS (proc)->read_output_delay) < usecs) | 4587 | if (XPROCESS (proc)->read_output_delay < usecs) |
| 4599 | usecs = XINT (XPROCESS (proc)->read_output_delay); | 4588 | usecs = XPROCESS (proc)->read_output_delay; |
| 4600 | } | 4589 | } |
| 4601 | } | 4590 | } |
| 4602 | EMACS_SET_SECS_USECS (timeout, 0, usecs); | 4591 | EMACS_SET_SECS_USECS (timeout, 0, usecs); |
| @@ -4869,7 +4858,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, | |||
| 4869 | else | 4858 | else |
| 4870 | { | 4859 | { |
| 4871 | /* Preserve status of processes already terminated. */ | 4860 | /* Preserve status of processes already terminated. */ |
| 4872 | XSETINT (XPROCESS (proc)->tick, ++process_tick); | 4861 | XPROCESS (proc)->tick = ++process_tick; |
| 4873 | deactivate_process (proc); | 4862 | deactivate_process (proc); |
| 4874 | if (XPROCESS (proc)->raw_status_new) | 4863 | if (XPROCESS (proc)->raw_status_new) |
| 4875 | update_status (XPROCESS (proc)); | 4864 | update_status (XPROCESS (proc)); |
| @@ -4921,7 +4910,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, | |||
| 4921 | #endif | 4910 | #endif |
| 4922 | if (xerrno) | 4911 | if (xerrno) |
| 4923 | { | 4912 | { |
| 4924 | XSETINT (p->tick, ++process_tick); | 4913 | p->tick = ++process_tick; |
| 4925 | p->status = Fcons (Qfailed, Fcons (make_number (xerrno), Qnil)); | 4914 | p->status = Fcons (Qfailed, Fcons (make_number (xerrno), Qnil)); |
| 4926 | deactivate_process (proc); | 4915 | deactivate_process (proc); |
| 4927 | } | 4916 | } |
| @@ -4934,8 +4923,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, | |||
| 4934 | exec_sentinel (proc, build_string ("open\n")); | 4923 | exec_sentinel (proc, build_string ("open\n")); |
| 4935 | if (!EQ (p->filter, Qt) && !EQ (p->command, Qt)) | 4924 | if (!EQ (p->filter, Qt) && !EQ (p->command, Qt)) |
| 4936 | { | 4925 | { |
| 4937 | FD_SET (XINT (p->infd), &input_wait_mask); | 4926 | FD_SET (p->infd, &input_wait_mask); |
| 4938 | FD_SET (XINT (p->infd), &non_keyboard_wait_mask); | 4927 | FD_SET (p->infd, &non_keyboard_wait_mask); |
| 4939 | } | 4928 | } |
| 4940 | } | 4929 | } |
| 4941 | } | 4930 | } |
| @@ -5009,7 +4998,7 @@ read_process_output (proc, channel) | |||
| 5009 | register struct Lisp_Process *p = XPROCESS (proc); | 4998 | register struct Lisp_Process *p = XPROCESS (proc); |
| 5010 | register int opoint; | 4999 | register int opoint; |
| 5011 | struct coding_system *coding = proc_decode_coding_system[channel]; | 5000 | struct coding_system *coding = proc_decode_coding_system[channel]; |
| 5012 | int carryover = XINT (p->decoding_carryover); | 5001 | int carryover = p->decoding_carryover; |
| 5013 | int readmax = 4096; | 5002 | int readmax = 4096; |
| 5014 | 5003 | ||
| 5015 | #ifdef VMS | 5004 | #ifdef VMS |
| @@ -5062,9 +5051,9 @@ read_process_output (proc, channel) | |||
| 5062 | { | 5051 | { |
| 5063 | nbytes = emacs_read (channel, chars + carryover, readmax); | 5052 | nbytes = emacs_read (channel, chars + carryover, readmax); |
| 5064 | #ifdef ADAPTIVE_READ_BUFFERING | 5053 | #ifdef ADAPTIVE_READ_BUFFERING |
| 5065 | if (nbytes > 0 && !NILP (p->adaptive_read_buffering)) | 5054 | if (nbytes > 0 && p->adaptive_read_buffering) |
| 5066 | { | 5055 | { |
| 5067 | int delay = XINT (p->read_output_delay); | 5056 | int delay = p->read_output_delay; |
| 5068 | if (nbytes < 256) | 5057 | if (nbytes < 256) |
| 5069 | { | 5058 | { |
| 5070 | if (delay < READ_OUTPUT_DELAY_MAX_MAX) | 5059 | if (delay < READ_OUTPUT_DELAY_MAX_MAX) |
| @@ -5080,10 +5069,10 @@ read_process_output (proc, channel) | |||
| 5080 | if (delay == 0) | 5069 | if (delay == 0) |
| 5081 | process_output_delay_count--; | 5070 | process_output_delay_count--; |
| 5082 | } | 5071 | } |
| 5083 | XSETINT (p->read_output_delay, delay); | 5072 | p->read_output_delay = delay; |
| 5084 | if (delay) | 5073 | if (delay) |
| 5085 | { | 5074 | { |
| 5086 | p->read_output_skip = Qt; | 5075 | p->read_output_skip = 1; |
| 5087 | process_output_skip = 1; | 5076 | process_output_skip = 1; |
| 5088 | } | 5077 | } |
| 5089 | } | 5078 | } |
| @@ -5101,7 +5090,7 @@ read_process_output (proc, channel) | |||
| 5101 | } | 5090 | } |
| 5102 | #endif /* not VMS */ | 5091 | #endif /* not VMS */ |
| 5103 | 5092 | ||
| 5104 | XSETINT (p->decoding_carryover, 0); | 5093 | p->decoding_carryover = 0; |
| 5105 | 5094 | ||
| 5106 | /* At this point, NBYTES holds number of bytes just received | 5095 | /* At this point, NBYTES holds number of bytes just received |
| 5107 | (including the one in proc_buffered_char[channel]). */ | 5096 | (including the one in proc_buffered_char[channel]). */ |
| @@ -5175,14 +5164,14 @@ read_process_output (proc, channel) | |||
| 5175 | valid memory because p->outfd will be changed once EOF is | 5164 | valid memory because p->outfd will be changed once EOF is |
| 5176 | sent to the process. */ | 5165 | sent to the process. */ |
| 5177 | if (NILP (p->encode_coding_system) | 5166 | if (NILP (p->encode_coding_system) |
| 5178 | && proc_encode_coding_system[XINT (p->outfd)]) | 5167 | && proc_encode_coding_system[p->outfd]) |
| 5179 | { | 5168 | { |
| 5180 | p->encode_coding_system = coding->symbol; | 5169 | p->encode_coding_system = coding->symbol; |
| 5181 | setup_coding_system (coding->symbol, | 5170 | setup_coding_system (coding->symbol, |
| 5182 | proc_encode_coding_system[XINT (p->outfd)]); | 5171 | proc_encode_coding_system[p->outfd]); |
| 5183 | if (proc_encode_coding_system[XINT (p->outfd)]->eol_type | 5172 | if (proc_encode_coding_system[p->outfd]->eol_type |
| 5184 | == CODING_EOL_UNDECIDED) | 5173 | == CODING_EOL_UNDECIDED) |
| 5185 | proc_encode_coding_system[XINT (p->outfd)]->eol_type | 5174 | proc_encode_coding_system[p->outfd]->eol_type |
| 5186 | = system_eol_type; | 5175 | = system_eol_type; |
| 5187 | } | 5176 | } |
| 5188 | } | 5177 | } |
| @@ -5195,9 +5184,9 @@ read_process_output (proc, channel) | |||
| 5195 | p->decoding_buf = make_uninit_string (carryover); | 5184 | p->decoding_buf = make_uninit_string (carryover); |
| 5196 | bcopy (chars + coding->consumed, SDATA (p->decoding_buf), | 5185 | bcopy (chars + coding->consumed, SDATA (p->decoding_buf), |
| 5197 | carryover); | 5186 | carryover); |
| 5198 | XSETINT (p->decoding_carryover, carryover); | 5187 | p->decoding_carryover = carryover; |
| 5199 | /* Adjust the multibyteness of TEXT to that of the filter. */ | 5188 | /* Adjust the multibyteness of TEXT to that of the filter. */ |
| 5200 | if (NILP (p->filter_multibyte) != ! STRING_MULTIBYTE (text)) | 5189 | if (p->filter_multibyte != STRING_MULTIBYTE (text)) |
| 5201 | text = (STRING_MULTIBYTE (text) | 5190 | text = (STRING_MULTIBYTE (text) |
| 5202 | ? Fstring_as_unibyte (text) | 5191 | ? Fstring_as_unibyte (text) |
| 5203 | : Fstring_to_multibyte (text)); | 5192 | : Fstring_to_multibyte (text)); |
| @@ -5289,14 +5278,14 @@ read_process_output (proc, channel) | |||
| 5289 | { | 5278 | { |
| 5290 | p->decode_coding_system = coding->symbol; | 5279 | p->decode_coding_system = coding->symbol; |
| 5291 | if (NILP (p->encode_coding_system) | 5280 | if (NILP (p->encode_coding_system) |
| 5292 | && proc_encode_coding_system[XINT (p->outfd)]) | 5281 | && proc_encode_coding_system[p->outfd]) |
| 5293 | { | 5282 | { |
| 5294 | p->encode_coding_system = coding->symbol; | 5283 | p->encode_coding_system = coding->symbol; |
| 5295 | setup_coding_system (coding->symbol, | 5284 | setup_coding_system (coding->symbol, |
| 5296 | proc_encode_coding_system[XINT (p->outfd)]); | 5285 | proc_encode_coding_system[p->outfd]); |
| 5297 | if (proc_encode_coding_system[XINT (p->outfd)]->eol_type | 5286 | if (proc_encode_coding_system[p->outfd]->eol_type |
| 5298 | == CODING_EOL_UNDECIDED) | 5287 | == CODING_EOL_UNDECIDED) |
| 5299 | proc_encode_coding_system[XINT (p->outfd)]->eol_type | 5288 | proc_encode_coding_system[p->outfd]->eol_type |
| 5300 | = system_eol_type; | 5289 | = system_eol_type; |
| 5301 | } | 5290 | } |
| 5302 | } | 5291 | } |
| @@ -5308,7 +5297,7 @@ read_process_output (proc, channel) | |||
| 5308 | p->decoding_buf = make_uninit_string (carryover); | 5297 | p->decoding_buf = make_uninit_string (carryover); |
| 5309 | bcopy (chars + coding->consumed, SDATA (p->decoding_buf), | 5298 | bcopy (chars + coding->consumed, SDATA (p->decoding_buf), |
| 5310 | carryover); | 5299 | carryover); |
| 5311 | XSETINT (p->decoding_carryover, carryover); | 5300 | p->decoding_carryover = carryover; |
| 5312 | 5301 | ||
| 5313 | /* Adjust the multibyteness of TEXT to that of the buffer. */ | 5302 | /* Adjust the multibyteness of TEXT to that of the buffer. */ |
| 5314 | if (NILP (current_buffer->enable_multibyte_characters) | 5303 | if (NILP (current_buffer->enable_multibyte_characters) |
| @@ -5427,10 +5416,10 @@ send_process (proc, buf, len, object) | |||
| 5427 | update_status (p); | 5416 | update_status (p); |
| 5428 | if (! EQ (p->status, Qrun)) | 5417 | if (! EQ (p->status, Qrun)) |
| 5429 | error ("Process %s not running", SDATA (p->name)); | 5418 | error ("Process %s not running", SDATA (p->name)); |
| 5430 | if (XINT (p->outfd) < 0) | 5419 | if (p->outfd < 0) |
| 5431 | error ("Output file descriptor of %s is closed", SDATA (p->name)); | 5420 | error ("Output file descriptor of %s is closed", SDATA (p->name)); |
| 5432 | 5421 | ||
| 5433 | coding = proc_encode_coding_system[XINT (p->outfd)]; | 5422 | coding = proc_encode_coding_system[p->outfd]; |
| 5434 | Vlast_coding_system_used = coding->symbol; | 5423 | Vlast_coding_system_used = coding->symbol; |
| 5435 | 5424 | ||
| 5436 | if ((STRINGP (object) && STRING_MULTIBYTE (object)) | 5425 | if ((STRINGP (object) && STRING_MULTIBYTE (object)) |
| @@ -5523,7 +5512,7 @@ send_process (proc, buf, len, object) | |||
| 5523 | if (pty_max_bytes == 0) | 5512 | if (pty_max_bytes == 0) |
| 5524 | { | 5513 | { |
| 5525 | #if defined (HAVE_FPATHCONF) && defined (_PC_MAX_CANON) | 5514 | #if defined (HAVE_FPATHCONF) && defined (_PC_MAX_CANON) |
| 5526 | pty_max_bytes = fpathconf (XFASTINT (p->outfd), _PC_MAX_CANON); | 5515 | pty_max_bytes = fpathconf (p->outfd, _PC_MAX_CANON); |
| 5527 | if (pty_max_bytes < 0) | 5516 | if (pty_max_bytes < 0) |
| 5528 | pty_max_bytes = 250; | 5517 | pty_max_bytes = 250; |
| 5529 | #else | 5518 | #else |
| @@ -5545,7 +5534,7 @@ send_process (proc, buf, len, object) | |||
| 5545 | 5534 | ||
| 5546 | /* Decide how much data we can send in one batch. | 5535 | /* Decide how much data we can send in one batch. |
| 5547 | Long lines need to be split into multiple batches. */ | 5536 | Long lines need to be split into multiple batches. */ |
| 5548 | if (!NILP (p->pty_flag)) | 5537 | if (p->pty_flag) |
| 5549 | { | 5538 | { |
| 5550 | /* Starting this at zero is always correct when not the first | 5539 | /* Starting this at zero is always correct when not the first |
| 5551 | iteration because the previous iteration ended by sending C-d. | 5540 | iteration because the previous iteration ended by sending C-d. |
| @@ -5574,7 +5563,7 @@ send_process (proc, buf, len, object) | |||
| 5574 | /* Send this batch, using one or more write calls. */ | 5563 | /* Send this batch, using one or more write calls. */ |
| 5575 | while (this > 0) | 5564 | while (this > 0) |
| 5576 | { | 5565 | { |
| 5577 | int outfd = XINT (p->outfd); | 5566 | int outfd = p->outfd; |
| 5578 | old_sigpipe = (SIGTYPE (*) ()) signal (SIGPIPE, send_process_trap); | 5567 | old_sigpipe = (SIGTYPE (*) ()) signal (SIGPIPE, send_process_trap); |
| 5579 | #ifdef DATAGRAM_SOCKETS | 5568 | #ifdef DATAGRAM_SOCKETS |
| 5580 | if (DATAGRAM_CHAN_P (outfd)) | 5569 | if (DATAGRAM_CHAN_P (outfd)) |
| @@ -5594,12 +5583,12 @@ send_process (proc, buf, len, object) | |||
| 5594 | { | 5583 | { |
| 5595 | rv = emacs_write (outfd, (char *) buf, this); | 5584 | rv = emacs_write (outfd, (char *) buf, this); |
| 5596 | #ifdef ADAPTIVE_READ_BUFFERING | 5585 | #ifdef ADAPTIVE_READ_BUFFERING |
| 5597 | if (XINT (p->read_output_delay) > 0 | 5586 | if (p->read_output_delay > 0 |
| 5598 | && EQ (p->adaptive_read_buffering, Qt)) | 5587 | && p->adaptive_read_buffering == 1) |
| 5599 | { | 5588 | { |
| 5600 | XSETFASTINT (p->read_output_delay, 0); | 5589 | p->read_output_delay = 0; |
| 5601 | process_output_delay_count--; | 5590 | process_output_delay_count--; |
| 5602 | p->read_output_skip = Qnil; | 5591 | p->read_output_skip = 0; |
| 5603 | } | 5592 | } |
| 5604 | #endif | 5593 | #endif |
| 5605 | } | 5594 | } |
| @@ -5642,7 +5631,7 @@ send_process (proc, buf, len, object) | |||
| 5642 | if (errno == EAGAIN) | 5631 | if (errno == EAGAIN) |
| 5643 | { | 5632 | { |
| 5644 | int flags = FWRITE; | 5633 | int flags = FWRITE; |
| 5645 | ioctl (XINT (p->outfd), TIOCFLUSH, &flags); | 5634 | ioctl (p->outfd, TIOCFLUSH, &flags); |
| 5646 | } | 5635 | } |
| 5647 | #endif /* BROKEN_PTY_READ_AFTER_EAGAIN */ | 5636 | #endif /* BROKEN_PTY_READ_AFTER_EAGAIN */ |
| 5648 | 5637 | ||
| @@ -5691,7 +5680,7 @@ send_process (proc, buf, len, object) | |||
| 5691 | #endif | 5680 | #endif |
| 5692 | p->raw_status_new = 0; | 5681 | p->raw_status_new = 0; |
| 5693 | p->status = Fcons (Qexit, Fcons (make_number (256), Qnil)); | 5682 | p->status = Fcons (Qexit, Fcons (make_number (256), Qnil)); |
| 5694 | XSETINT (p->tick, ++process_tick); | 5683 | p->tick = ++process_tick; |
| 5695 | deactivate_process (proc); | 5684 | deactivate_process (proc); |
| 5696 | #ifdef VMS | 5685 | #ifdef VMS |
| 5697 | error ("Error writing to process %s; closed it", SDATA (p->name)); | 5686 | error ("Error writing to process %s; closed it", SDATA (p->name)); |
| @@ -5743,10 +5732,10 @@ send_process_object (proc, start, end) | |||
| 5743 | update_status (p); | 5732 | update_status (p); |
| 5744 | if (! EQ (p->status, Qrun)) | 5733 | if (! EQ (p->status, Qrun)) |
| 5745 | error ("Process %s not running", SDATA (p->name)); | 5734 | error ("Process %s not running", SDATA (p->name)); |
| 5746 | if (XINT (p->outfd) < 0) | 5735 | if (p->outfd < 0) |
| 5747 | error ("Output file descriptor of %s is closed", SDATA (p->name)); | 5736 | error ("Output file descriptor of %s is closed", SDATA (p->name)); |
| 5748 | 5737 | ||
| 5749 | coding = proc_encode_coding_system[XINT (p->outfd)]; | 5738 | coding = proc_encode_coding_system[p->outfd]; |
| 5750 | if (! EQ (coding->symbol, p->encode_coding_system)) | 5739 | if (! EQ (coding->symbol, p->encode_coding_system)) |
| 5751 | /* The coding system for encoding was changed to raw-text | 5740 | /* The coding system for encoding was changed to raw-text |
| 5752 | because we sent a unibyte text previously. Now we are | 5741 | because we sent a unibyte text previously. Now we are |
| @@ -5835,7 +5824,7 @@ emacs_get_tty_pgrp (p) | |||
| 5835 | int gid = -1; | 5824 | int gid = -1; |
| 5836 | 5825 | ||
| 5837 | #ifdef TIOCGPGRP | 5826 | #ifdef TIOCGPGRP |
| 5838 | if (ioctl (XINT (p->infd), TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name)) | 5827 | if (ioctl (p->infd, TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name)) |
| 5839 | { | 5828 | { |
| 5840 | int fd; | 5829 | int fd; |
| 5841 | /* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the | 5830 | /* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the |
| @@ -5873,7 +5862,7 @@ return t unconditionally. */) | |||
| 5873 | if (!EQ (p->childp, Qt)) | 5862 | if (!EQ (p->childp, Qt)) |
| 5874 | error ("Process %s is not a subprocess", | 5863 | error ("Process %s is not a subprocess", |
| 5875 | SDATA (p->name)); | 5864 | SDATA (p->name)); |
| 5876 | if (XINT (p->infd) < 0) | 5865 | if (p->infd < 0) |
| 5877 | error ("Process %s is not active", | 5866 | error ("Process %s is not active", |
| 5878 | SDATA (p->name)); | 5867 | SDATA (p->name)); |
| 5879 | 5868 | ||
| @@ -5916,11 +5905,11 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 5916 | if (!EQ (p->childp, Qt)) | 5905 | if (!EQ (p->childp, Qt)) |
| 5917 | error ("Process %s is not a subprocess", | 5906 | error ("Process %s is not a subprocess", |
| 5918 | SDATA (p->name)); | 5907 | SDATA (p->name)); |
| 5919 | if (XINT (p->infd) < 0) | 5908 | if (p->infd < 0) |
| 5920 | error ("Process %s is not active", | 5909 | error ("Process %s is not active", |
| 5921 | SDATA (p->name)); | 5910 | SDATA (p->name)); |
| 5922 | 5911 | ||
| 5923 | if (NILP (p->pty_flag)) | 5912 | if (!p->pty_flag) |
| 5924 | current_group = Qnil; | 5913 | current_group = Qnil; |
| 5925 | 5914 | ||
| 5926 | /* If we are using pgrps, get a pgrp number and make it negative. */ | 5915 | /* If we are using pgrps, get a pgrp number and make it negative. */ |
| @@ -5939,7 +5928,7 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 5939 | struct termios t; | 5928 | struct termios t; |
| 5940 | cc_t *sig_char = NULL; | 5929 | cc_t *sig_char = NULL; |
| 5941 | 5930 | ||
| 5942 | tcgetattr (XINT (p->infd), &t); | 5931 | tcgetattr (p->infd, &t); |
| 5943 | 5932 | ||
| 5944 | switch (signo) | 5933 | switch (signo) |
| 5945 | { | 5934 | { |
| @@ -5979,16 +5968,16 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 5979 | switch (signo) | 5968 | switch (signo) |
| 5980 | { | 5969 | { |
| 5981 | case SIGINT: | 5970 | case SIGINT: |
| 5982 | ioctl (XINT (p->infd), TIOCGETC, &c); | 5971 | ioctl (p->infd, TIOCGETC, &c); |
| 5983 | send_process (proc, &c.t_intrc, 1, Qnil); | 5972 | send_process (proc, &c.t_intrc, 1, Qnil); |
| 5984 | return; | 5973 | return; |
| 5985 | case SIGQUIT: | 5974 | case SIGQUIT: |
| 5986 | ioctl (XINT (p->infd), TIOCGETC, &c); | 5975 | ioctl (p->infd, TIOCGETC, &c); |
| 5987 | send_process (proc, &c.t_quitc, 1, Qnil); | 5976 | send_process (proc, &c.t_quitc, 1, Qnil); |
| 5988 | return; | 5977 | return; |
| 5989 | #ifdef SIGTSTP | 5978 | #ifdef SIGTSTP |
| 5990 | case SIGTSTP: | 5979 | case SIGTSTP: |
| 5991 | ioctl (XINT (p->infd), TIOCGLTC, &lc); | 5980 | ioctl (p->infd, TIOCGLTC, &lc); |
| 5992 | send_process (proc, &lc.t_suspc, 1, Qnil); | 5981 | send_process (proc, &lc.t_suspc, 1, Qnil); |
| 5993 | return; | 5982 | return; |
| 5994 | #endif /* ! defined (SIGTSTP) */ | 5983 | #endif /* ! defined (SIGTSTP) */ |
| @@ -6003,16 +5992,16 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 6003 | switch (signo) | 5992 | switch (signo) |
| 6004 | { | 5993 | { |
| 6005 | case SIGINT: | 5994 | case SIGINT: |
| 6006 | ioctl (XINT (p->infd), TCGETA, &t); | 5995 | ioctl (p->infd, TCGETA, &t); |
| 6007 | send_process (proc, &t.c_cc[VINTR], 1, Qnil); | 5996 | send_process (proc, &t.c_cc[VINTR], 1, Qnil); |
| 6008 | return; | 5997 | return; |
| 6009 | case SIGQUIT: | 5998 | case SIGQUIT: |
| 6010 | ioctl (XINT (p->infd), TCGETA, &t); | 5999 | ioctl (p->infd, TCGETA, &t); |
| 6011 | send_process (proc, &t.c_cc[VQUIT], 1, Qnil); | 6000 | send_process (proc, &t.c_cc[VQUIT], 1, Qnil); |
| 6012 | return; | 6001 | return; |
| 6013 | #ifdef SIGTSTP | 6002 | #ifdef SIGTSTP |
| 6014 | case SIGTSTP: | 6003 | case SIGTSTP: |
| 6015 | ioctl (XINT (p->infd), TCGETA, &t); | 6004 | ioctl (p->infd, TCGETA, &t); |
| 6016 | send_process (proc, &t.c_cc[VSWTCH], 1, Qnil); | 6005 | send_process (proc, &t.c_cc[VSWTCH], 1, Qnil); |
| 6017 | return; | 6006 | return; |
| 6018 | #endif /* ! defined (SIGTSTP) */ | 6007 | #endif /* ! defined (SIGTSTP) */ |
| @@ -6070,7 +6059,7 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 6070 | case SIGCONT: | 6059 | case SIGCONT: |
| 6071 | p->raw_status_new = 0; | 6060 | p->raw_status_new = 0; |
| 6072 | p->status = Qrun; | 6061 | p->status = Qrun; |
| 6073 | XSETINT (p->tick, ++process_tick); | 6062 | p->tick = ++process_tick; |
| 6074 | if (!nomsg) | 6063 | if (!nomsg) |
| 6075 | status_notify (NULL); | 6064 | status_notify (NULL); |
| 6076 | break; | 6065 | break; |
| @@ -6090,7 +6079,7 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 6090 | sys$forcex (&(p->pid), 0, 1); | 6079 | sys$forcex (&(p->pid), 0, 1); |
| 6091 | whoosh: | 6080 | whoosh: |
| 6092 | #endif | 6081 | #endif |
| 6093 | flush_pending_output (XINT (p->infd)); | 6082 | flush_pending_output (p->infd); |
| 6094 | break; | 6083 | break; |
| 6095 | } | 6084 | } |
| 6096 | 6085 | ||
| @@ -6107,7 +6096,7 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 6107 | #ifdef TIOCSIGSEND | 6096 | #ifdef TIOCSIGSEND |
| 6108 | if (!NILP (current_group)) | 6097 | if (!NILP (current_group)) |
| 6109 | { | 6098 | { |
| 6110 | if (ioctl (XINT (p->infd), TIOCSIGSEND, signo) == -1) | 6099 | if (ioctl (p->infd, TIOCSIGSEND, signo) == -1) |
| 6111 | EMACS_KILLPG (gid, signo); | 6100 | EMACS_KILLPG (gid, signo); |
| 6112 | } | 6101 | } |
| 6113 | else | 6102 | else |
| @@ -6173,10 +6162,10 @@ If PROCESS is a network process, inhibit handling of incoming traffic. */) | |||
| 6173 | 6162 | ||
| 6174 | p = XPROCESS (process); | 6163 | p = XPROCESS (process); |
| 6175 | if (NILP (p->command) | 6164 | if (NILP (p->command) |
| 6176 | && XINT (p->infd) >= 0) | 6165 | && p->infd >= 0) |
| 6177 | { | 6166 | { |
| 6178 | FD_CLR (XINT (p->infd), &input_wait_mask); | 6167 | FD_CLR (p->infd, &input_wait_mask); |
| 6179 | FD_CLR (XINT (p->infd), &non_keyboard_wait_mask); | 6168 | FD_CLR (p->infd, &non_keyboard_wait_mask); |
| 6180 | } | 6169 | } |
| 6181 | p->command = Qt; | 6170 | p->command = Qt; |
| 6182 | return process; | 6171 | return process; |
| @@ -6204,11 +6193,11 @@ If PROCESS is a network process, resume handling of incoming traffic. */) | |||
| 6204 | 6193 | ||
| 6205 | p = XPROCESS (process); | 6194 | p = XPROCESS (process); |
| 6206 | if (EQ (p->command, Qt) | 6195 | if (EQ (p->command, Qt) |
| 6207 | && XINT (p->infd) >= 0 | 6196 | && p->infd >= 0 |
| 6208 | && (!EQ (p->filter, Qt) || EQ (p->status, Qlisten))) | 6197 | && (!EQ (p->filter, Qt) || EQ (p->status, Qlisten))) |
| 6209 | { | 6198 | { |
| 6210 | FD_SET (XINT (p->infd), &input_wait_mask); | 6199 | FD_SET (p->infd, &input_wait_mask); |
| 6211 | FD_SET (XINT (p->infd), &non_keyboard_wait_mask); | 6200 | FD_SET (p->infd, &non_keyboard_wait_mask); |
| 6212 | } | 6201 | } |
| 6213 | p->command = Qnil; | 6202 | p->command = Qnil; |
| 6214 | return process; | 6203 | return process; |
| @@ -6405,7 +6394,7 @@ text to PROCESS after you call this function. */) | |||
| 6405 | return process; | 6394 | return process; |
| 6406 | 6395 | ||
| 6407 | proc = get_process (process); | 6396 | proc = get_process (process); |
| 6408 | coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)]; | 6397 | coding = proc_encode_coding_system[XPROCESS (proc)->outfd]; |
| 6409 | 6398 | ||
| 6410 | /* Make sure the process is really alive. */ | 6399 | /* Make sure the process is really alive. */ |
| 6411 | if (XPROCESS (proc)->raw_status_new) | 6400 | if (XPROCESS (proc)->raw_status_new) |
| @@ -6422,7 +6411,7 @@ text to PROCESS after you call this function. */) | |||
| 6422 | #ifdef VMS | 6411 | #ifdef VMS |
| 6423 | send_process (proc, "\032", 1, Qnil); /* ^z */ | 6412 | send_process (proc, "\032", 1, Qnil); /* ^z */ |
| 6424 | #else | 6413 | #else |
| 6425 | if (!NILP (XPROCESS (proc)->pty_flag)) | 6414 | if (XPROCESS (proc)->pty_flag) |
| 6426 | send_process (proc, "\004", 1, Qnil); | 6415 | send_process (proc, "\004", 1, Qnil); |
| 6427 | else | 6416 | else |
| 6428 | { | 6417 | { |
| @@ -6434,18 +6423,18 @@ text to PROCESS after you call this function. */) | |||
| 6434 | (In some old system, shutdown to socketpair doesn't work. | 6423 | (In some old system, shutdown to socketpair doesn't work. |
| 6435 | Then we just can't win.) */ | 6424 | Then we just can't win.) */ |
| 6436 | if (XPROCESS (proc)->pid == 0 | 6425 | if (XPROCESS (proc)->pid == 0 |
| 6437 | || XINT (XPROCESS (proc)->outfd) == XINT (XPROCESS (proc)->infd)) | 6426 | || XPROCESS (proc)->outfd == XPROCESS (proc)->infd) |
| 6438 | shutdown (XINT (XPROCESS (proc)->outfd), 1); | 6427 | shutdown (XPROCESS (proc)->outfd, 1); |
| 6439 | /* In case of socketpair, outfd == infd, so don't close it. */ | 6428 | /* In case of socketpair, outfd == infd, so don't close it. */ |
| 6440 | if (XINT (XPROCESS (proc)->outfd) != XINT (XPROCESS (proc)->infd)) | 6429 | if (XPROCESS (proc)->outfd != XPROCESS (proc)->infd) |
| 6441 | emacs_close (XINT (XPROCESS (proc)->outfd)); | 6430 | emacs_close (XPROCESS (proc)->outfd); |
| 6442 | #else /* not HAVE_SHUTDOWN */ | 6431 | #else /* not HAVE_SHUTDOWN */ |
| 6443 | emacs_close (XINT (XPROCESS (proc)->outfd)); | 6432 | emacs_close (XPROCESS (proc)->outfd); |
| 6444 | #endif /* not HAVE_SHUTDOWN */ | 6433 | #endif /* not HAVE_SHUTDOWN */ |
| 6445 | new_outfd = emacs_open (NULL_DEVICE, O_WRONLY, 0); | 6434 | new_outfd = emacs_open (NULL_DEVICE, O_WRONLY, 0); |
| 6446 | if (new_outfd < 0) | 6435 | if (new_outfd < 0) |
| 6447 | abort (); | 6436 | abort (); |
| 6448 | old_outfd = XINT (XPROCESS (proc)->outfd); | 6437 | old_outfd = XPROCESS (proc)->outfd; |
| 6449 | 6438 | ||
| 6450 | if (!proc_encode_coding_system[new_outfd]) | 6439 | if (!proc_encode_coding_system[new_outfd]) |
| 6451 | proc_encode_coding_system[new_outfd] | 6440 | proc_encode_coding_system[new_outfd] |
| @@ -6456,7 +6445,7 @@ text to PROCESS after you call this function. */) | |||
| 6456 | bzero (proc_encode_coding_system[old_outfd], | 6445 | bzero (proc_encode_coding_system[old_outfd], |
| 6457 | sizeof (struct coding_system)); | 6446 | sizeof (struct coding_system)); |
| 6458 | 6447 | ||
| 6459 | XSETINT (XPROCESS (proc)->outfd, new_outfd); | 6448 | XPROCESS (proc)->outfd = new_outfd; |
| 6460 | } | 6449 | } |
| 6461 | #endif /* VMS */ | 6450 | #endif /* VMS */ |
| 6462 | return process; | 6451 | return process; |
| @@ -6479,7 +6468,7 @@ kill_buffer_processes (buffer) | |||
| 6479 | { | 6468 | { |
| 6480 | if (NETCONN_P (proc)) | 6469 | if (NETCONN_P (proc)) |
| 6481 | Fdelete_process (proc); | 6470 | Fdelete_process (proc); |
| 6482 | else if (XINT (XPROCESS (proc)->infd) >= 0) | 6471 | else if (XPROCESS (proc)->infd >= 0) |
| 6483 | process_send_signal (proc, SIGHUP, Qnil, 1); | 6472 | process_send_signal (proc, SIGHUP, Qnil, 1); |
| 6484 | } | 6473 | } |
| 6485 | } | 6474 | } |
| @@ -6609,21 +6598,21 @@ sigchld_handler (signo) | |||
| 6609 | union { int i; WAITTYPE wt; } u; | 6598 | union { int i; WAITTYPE wt; } u; |
| 6610 | int clear_desc_flag = 0; | 6599 | int clear_desc_flag = 0; |
| 6611 | 6600 | ||
| 6612 | XSETINT (p->tick, ++process_tick); | 6601 | p->tick = ++process_tick; |
| 6613 | u.wt = w; | 6602 | u.wt = w; |
| 6614 | p->raw_status = u.i; | 6603 | p->raw_status = u.i; |
| 6615 | p->raw_status_new = 1; | 6604 | p->raw_status_new = 1; |
| 6616 | 6605 | ||
| 6617 | /* If process has terminated, stop waiting for its output. */ | 6606 | /* If process has terminated, stop waiting for its output. */ |
| 6618 | if ((WIFSIGNALED (w) || WIFEXITED (w)) | 6607 | if ((WIFSIGNALED (w) || WIFEXITED (w)) |
| 6619 | && XINT (p->infd) >= 0) | 6608 | && p->infd >= 0) |
| 6620 | clear_desc_flag = 1; | 6609 | clear_desc_flag = 1; |
| 6621 | 6610 | ||
| 6622 | /* We use clear_desc_flag to avoid a compiler bug in Microsoft C. */ | 6611 | /* We use clear_desc_flag to avoid a compiler bug in Microsoft C. */ |
| 6623 | if (clear_desc_flag) | 6612 | if (clear_desc_flag) |
| 6624 | { | 6613 | { |
| 6625 | FD_CLR (XINT (p->infd), &input_wait_mask); | 6614 | FD_CLR (p->infd, &input_wait_mask); |
| 6626 | FD_CLR (XINT (p->infd), &non_keyboard_wait_mask); | 6615 | FD_CLR (p->infd, &non_keyboard_wait_mask); |
| 6627 | } | 6616 | } |
| 6628 | 6617 | ||
| 6629 | /* Tell wait_reading_process_output that it needs to wake up and | 6618 | /* Tell wait_reading_process_output that it needs to wake up and |
| @@ -6800,18 +6789,18 @@ status_notify (deleting_process) | |||
| 6800 | proc = Fcdr (Fcar (tail)); | 6789 | proc = Fcdr (Fcar (tail)); |
| 6801 | p = XPROCESS (proc); | 6790 | p = XPROCESS (proc); |
| 6802 | 6791 | ||
| 6803 | if (XINT (p->tick) != XINT (p->update_tick)) | 6792 | if (p->tick != p->update_tick) |
| 6804 | { | 6793 | { |
| 6805 | XSETINT (p->update_tick, XINT (p->tick)); | 6794 | p->update_tick = p->tick; |
| 6806 | 6795 | ||
| 6807 | /* If process is still active, read any output that remains. */ | 6796 | /* If process is still active, read any output that remains. */ |
| 6808 | while (! EQ (p->filter, Qt) | 6797 | while (! EQ (p->filter, Qt) |
| 6809 | && ! EQ (p->status, Qconnect) | 6798 | && ! EQ (p->status, Qconnect) |
| 6810 | && ! EQ (p->status, Qlisten) | 6799 | && ! EQ (p->status, Qlisten) |
| 6811 | && ! EQ (p->command, Qt) /* Network process not stopped. */ | 6800 | && ! EQ (p->command, Qt) /* Network process not stopped. */ |
| 6812 | && XINT (p->infd) >= 0 | 6801 | && p->infd >= 0 |
| 6813 | && p != deleting_process | 6802 | && p != deleting_process |
| 6814 | && read_process_output (proc, XINT (p->infd)) > 0); | 6803 | && read_process_output (proc, p->infd) > 0); |
| 6815 | 6804 | ||
| 6816 | buffer = p->buffer; | 6805 | buffer = p->buffer; |
| 6817 | 6806 | ||
| @@ -6838,7 +6827,7 @@ status_notify (deleting_process) | |||
| 6838 | So set p->update_tick again | 6827 | So set p->update_tick again |
| 6839 | so that an error in the sentinel will not cause | 6828 | so that an error in the sentinel will not cause |
| 6840 | this code to be run again. */ | 6829 | this code to be run again. */ |
| 6841 | XSETINT (p->update_tick, XINT (p->tick)); | 6830 | p->update_tick = p->tick; |
| 6842 | /* Now output the message suitably. */ | 6831 | /* Now output the message suitably. */ |
| 6843 | if (!NILP (p->sentinel)) | 6832 | if (!NILP (p->sentinel)) |
| 6844 | exec_sentinel (proc, msg); | 6833 | exec_sentinel (proc, msg); |
| @@ -6911,9 +6900,9 @@ encode subprocess input. */) | |||
| 6911 | 6900 | ||
| 6912 | CHECK_PROCESS (process); | 6901 | CHECK_PROCESS (process); |
| 6913 | p = XPROCESS (process); | 6902 | p = XPROCESS (process); |
| 6914 | if (XINT (p->infd) < 0) | 6903 | if (p->infd < 0) |
| 6915 | error ("Input file descriptor of %s closed", SDATA (p->name)); | 6904 | error ("Input file descriptor of %s closed", SDATA (p->name)); |
| 6916 | if (XINT (p->outfd) < 0) | 6905 | if (p->outfd < 0) |
| 6917 | error ("Output file descriptor of %s closed", SDATA (p->name)); | 6906 | error ("Output file descriptor of %s closed", SDATA (p->name)); |
| 6918 | Fcheck_coding_system (decoding); | 6907 | Fcheck_coding_system (decoding); |
| 6919 | Fcheck_coding_system (encoding); | 6908 | Fcheck_coding_system (encoding); |
| @@ -6950,7 +6939,7 @@ suppressed. */) | |||
| 6950 | 6939 | ||
| 6951 | CHECK_PROCESS (process); | 6940 | CHECK_PROCESS (process); |
| 6952 | p = XPROCESS (process); | 6941 | p = XPROCESS (process); |
| 6953 | p->filter_multibyte = flag; | 6942 | p->filter_multibyte = !NILP (flag); |
| 6954 | setup_process_coding_systems (process); | 6943 | setup_process_coding_systems (process); |
| 6955 | 6944 | ||
| 6956 | return Qnil; | 6945 | return Qnil; |
| @@ -6967,7 +6956,7 @@ DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p, | |||
| 6967 | CHECK_PROCESS (process); | 6956 | CHECK_PROCESS (process); |
| 6968 | p = XPROCESS (process); | 6957 | p = XPROCESS (process); |
| 6969 | 6958 | ||
| 6970 | return (NILP (p->filter_multibyte) ? Qnil : Qt); | 6959 | return (p->filter_multibyte ? Qt : Qnil); |
| 6971 | } | 6960 | } |
| 6972 | 6961 | ||
| 6973 | 6962 | ||
diff --git a/src/process.h b/src/process.h index 718d2a70ea8..fd7847b5e29 100644 --- a/src/process.h +++ b/src/process.h | |||
| @@ -36,10 +36,6 @@ struct Lisp_Process | |||
| 36 | { | 36 | { |
| 37 | EMACS_INT size; | 37 | EMACS_INT size; |
| 38 | struct Lisp_Vector *v_next; | 38 | struct Lisp_Vector *v_next; |
| 39 | /* Descriptor by which we read from this process */ | ||
| 40 | Lisp_Object infd; | ||
| 41 | /* Descriptor by which we write to this process */ | ||
| 42 | Lisp_Object outfd; | ||
| 43 | /* Name of subprocess terminal. */ | 39 | /* Name of subprocess terminal. */ |
| 44 | Lisp_Object tty_name; | 40 | Lisp_Object tty_name; |
| 45 | /* Name of this process */ | 41 | /* Name of this process */ |
| @@ -64,61 +60,65 @@ struct Lisp_Process | |||
| 64 | Lisp_Object plist; | 60 | Lisp_Object plist; |
| 65 | /* Marker set to end of last buffer-inserted output from this process */ | 61 | /* Marker set to end of last buffer-inserted output from this process */ |
| 66 | Lisp_Object mark; | 62 | Lisp_Object mark; |
| 67 | /* Non-nil means kill silently if Emacs is exited. | ||
| 68 | This is the inverse of the `query-on-exit' flag. */ | ||
| 69 | Lisp_Object kill_without_query; | ||
| 70 | /* Symbol indicating status of process. | 63 | /* Symbol indicating status of process. |
| 71 | This may be a symbol: run, open, or closed. | 64 | This may be a symbol: run, open, or closed. |
| 72 | Or it may be a list, whose car is stop, exit or signal | 65 | Or it may be a list, whose car is stop, exit or signal |
| 73 | and whose cdr is a pair (EXIT_CODE . COREDUMP_FLAG) | 66 | and whose cdr is a pair (EXIT_CODE . COREDUMP_FLAG) |
| 74 | or (SIGNAL_NUMBER . COREDUMP_FLAG). */ | 67 | or (SIGNAL_NUMBER . COREDUMP_FLAG). */ |
| 75 | Lisp_Object status; | 68 | Lisp_Object status; |
| 76 | /* Non-nil if communicating through a pty. */ | ||
| 77 | Lisp_Object pty_flag; | ||
| 78 | /* Event-count of last event in which this process changed status. */ | ||
| 79 | Lisp_Object tick; | ||
| 80 | /* Event-count of last such event reported. */ | ||
| 81 | Lisp_Object update_tick; | ||
| 82 | /* Coding-system for decoding the input from this process. */ | 69 | /* Coding-system for decoding the input from this process. */ |
| 83 | Lisp_Object decode_coding_system; | 70 | Lisp_Object decode_coding_system; |
| 84 | /* Working buffer for decoding. */ | 71 | /* Working buffer for decoding. */ |
| 85 | Lisp_Object decoding_buf; | 72 | Lisp_Object decoding_buf; |
| 86 | /* Size of carryover in decoding. */ | ||
| 87 | Lisp_Object decoding_carryover; | ||
| 88 | /* Coding-system for encoding the output to this process. */ | 73 | /* Coding-system for encoding the output to this process. */ |
| 89 | Lisp_Object encode_coding_system; | 74 | Lisp_Object encode_coding_system; |
| 90 | /* Working buffer for encoding. */ | 75 | /* Working buffer for encoding. */ |
| 91 | Lisp_Object encoding_buf; | 76 | Lisp_Object encoding_buf; |
| 92 | /* Size of carryover in encoding. */ | ||
| 93 | Lisp_Object encoding_carryover; | ||
| 94 | /* Flag to set coding-system of the process buffer from the | ||
| 95 | coding_system used to decode process output. */ | ||
| 96 | Lisp_Object inherit_coding_system_flag; | ||
| 97 | /* Flat to decide the multibyteness of a string given to the | ||
| 98 | filter (if any). It is initialized to the value of | ||
| 99 | `default-enable-multibyte-characters' when the process is | ||
| 100 | generated, and can be changed by the function | ||
| 101 | `set-process-fileter-multibyte'. */ | ||
| 102 | Lisp_Object filter_multibyte; | ||
| 103 | /* Should we delay reading output from this process. | ||
| 104 | Initialized from `Vprocess_adaptive_read_buffering'. */ | ||
| 105 | Lisp_Object adaptive_read_buffering; | ||
| 106 | /* Hysteresis to try to read process output in larger blocks. | ||
| 107 | On some systems, e.g. GNU/Linux, Emacs is seen as | ||
| 108 | an interactive app also when reading process output, meaning | ||
| 109 | that process output can be read in as little as 1 byte at a | ||
| 110 | time. Value is micro-seconds to delay reading output from | ||
| 111 | this process. Range is 0 .. 50000. */ | ||
| 112 | Lisp_Object read_output_delay; | ||
| 113 | /* Skip reading this process on next read. */ | ||
| 114 | Lisp_Object read_output_skip; | ||
| 115 | 77 | ||
| 116 | /* After this point, there are no Lisp_Objects any more. */ | 78 | /* After this point, there are no Lisp_Objects any more. */ |
| 79 | /* alloc.c assumes that `pid' is the first such non-Lisp slot. */ | ||
| 117 | 80 | ||
| 118 | /* Number of this process. | 81 | /* Number of this process. |
| 119 | allocate_process assumes this is the first non-Lisp_Object field. | 82 | allocate_process assumes this is the first non-Lisp_Object field. |
| 120 | A value 0 is used for pseudo-processes such as network connections. */ | 83 | A value 0 is used for pseudo-processes such as network connections. */ |
| 121 | pid_t pid; | 84 | pid_t pid; |
| 85 | /* Descriptor by which we read from this process */ | ||
| 86 | int infd; | ||
| 87 | /* Descriptor by which we write to this process */ | ||
| 88 | int outfd; | ||
| 89 | /* Event-count of last event in which this process changed status. */ | ||
| 90 | int tick; | ||
| 91 | /* Event-count of last such event reported. */ | ||
| 92 | int update_tick; | ||
| 93 | /* Size of carryover in decoding. */ | ||
| 94 | int decoding_carryover; | ||
| 95 | /* Hysteresis to try to read process output in larger blocks. | ||
| 96 | On some systems, e.g. GNU/Linux, Emacs is seen as | ||
| 97 | an interactive app also when reading process output, meaning | ||
| 98 | that process output can be read in as little as 1 byte at a | ||
| 99 | time. Value is micro-seconds to delay reading output from | ||
| 100 | this process. Range is 0 .. 50000. */ | ||
| 101 | int read_output_delay; | ||
| 102 | /* Should we delay reading output from this process. | ||
| 103 | Initialized from `Vprocess_adaptive_read_buffering'. | ||
| 104 | 0 = nil, 1 = t, 2 = other. */ | ||
| 105 | int adaptive_read_buffering : 2; | ||
| 106 | /* Skip reading this process on next read. */ | ||
| 107 | int read_output_skip : 1; | ||
| 108 | /* Non-nil means kill silently if Emacs is exited. | ||
| 109 | This is the inverse of the `query-on-exit' flag. */ | ||
| 110 | int kill_without_query : 1; | ||
| 111 | /* Non-nil if communicating through a pty. */ | ||
| 112 | int pty_flag : 1; | ||
| 113 | /* Flag to set coding-system of the process buffer from the | ||
| 114 | coding_system used to decode process output. */ | ||
| 115 | int inherit_coding_system_flag : 1; | ||
| 116 | /* Flag to decide the multibyteness of a string given to the | ||
| 117 | filter (if any). It is initialized to the value of | ||
| 118 | `default-enable-multibyte-characters' when the process is | ||
| 119 | generated, and can be changed by the function | ||
| 120 | `set-process-filter-multibyte'. */ | ||
| 121 | int filter_multibyte : 1; | ||
| 122 | /* Record the process status in the raw form in which it comes from `wait'. | 122 | /* Record the process status in the raw form in which it comes from `wait'. |
| 123 | This is to avoid consing in a signal handler. The `raw_status_new' | 123 | This is to avoid consing in a signal handler. The `raw_status_new' |
| 124 | flag indicates that `raw_status' contains a new status that still | 124 | flag indicates that `raw_status' contains a new status that still |
diff --git a/src/search.c b/src/search.c index c9c6dfdd242..154f6c80e2d 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -92,6 +92,11 @@ Lisp_Object Qsearch_failed; | |||
| 92 | 92 | ||
| 93 | Lisp_Object Vsearch_spaces_regexp; | 93 | Lisp_Object Vsearch_spaces_regexp; |
| 94 | 94 | ||
| 95 | /* If non-nil, the match data will not be changed during call to | ||
| 96 | searching or matching functions. This variable is for internal use | ||
| 97 | only. */ | ||
| 98 | Lisp_Object Vinhibit_changing_match_data; | ||
| 99 | |||
| 95 | static void set_search_regs (); | 100 | static void set_search_regs (); |
| 96 | static void save_search_regs (); | 101 | static void save_search_regs (); |
| 97 | static int simple_search (); | 102 | static int simple_search (); |
| @@ -321,7 +326,9 @@ looking_at_1 (string, posix) | |||
| 321 | = current_buffer->case_eqv_table; | 326 | = current_buffer->case_eqv_table; |
| 322 | 327 | ||
| 323 | CHECK_STRING (string); | 328 | CHECK_STRING (string); |
| 324 | bufp = compile_pattern (string, &search_regs, | 329 | bufp = compile_pattern (string, |
| 330 | (NILP (Vinhibit_changing_match_data) | ||
| 331 | ? &search_regs : NULL), | ||
| 325 | (!NILP (current_buffer->case_fold_search) | 332 | (!NILP (current_buffer->case_fold_search) |
| 326 | ? current_buffer->case_canon_table : Qnil), | 333 | ? current_buffer->case_canon_table : Qnil), |
| 327 | posix, | 334 | posix, |
| @@ -352,7 +359,9 @@ looking_at_1 (string, posix) | |||
| 352 | re_match_object = Qnil; | 359 | re_match_object = Qnil; |
| 353 | 360 | ||
| 354 | i = re_match_2 (bufp, (char *) p1, s1, (char *) p2, s2, | 361 | i = re_match_2 (bufp, (char *) p1, s1, (char *) p2, s2, |
| 355 | PT_BYTE - BEGV_BYTE, &search_regs, | 362 | PT_BYTE - BEGV_BYTE, |
| 363 | (NILP (Vinhibit_changing_match_data) | ||
| 364 | ? &search_regs : NULL), | ||
| 356 | ZV_BYTE - BEGV_BYTE); | 365 | ZV_BYTE - BEGV_BYTE); |
| 357 | immediate_quit = 0; | 366 | immediate_quit = 0; |
| 358 | 367 | ||
| @@ -360,7 +369,7 @@ looking_at_1 (string, posix) | |||
| 360 | matcher_overflow (); | 369 | matcher_overflow (); |
| 361 | 370 | ||
| 362 | val = (0 <= i ? Qt : Qnil); | 371 | val = (0 <= i ? Qt : Qnil); |
| 363 | if (i >= 0) | 372 | if (NILP (Vinhibit_changing_match_data) && i >= 0) |
| 364 | for (i = 0; i < search_regs.num_regs; i++) | 373 | for (i = 0; i < search_regs.num_regs; i++) |
| 365 | if (search_regs.start[i] >= 0) | 374 | if (search_regs.start[i] >= 0) |
| 366 | { | 375 | { |
| @@ -369,7 +378,11 @@ looking_at_1 (string, posix) | |||
| 369 | search_regs.end[i] | 378 | search_regs.end[i] |
| 370 | = BYTE_TO_CHAR (search_regs.end[i] + BEGV_BYTE); | 379 | = BYTE_TO_CHAR (search_regs.end[i] + BEGV_BYTE); |
| 371 | } | 380 | } |
| 372 | XSETBUFFER (last_thing_searched, current_buffer); | 381 | |
| 382 | /* Set last_thing_searched only when match data is changed. */ | ||
| 383 | if (NILP (Vinhibit_changing_match_data)) | ||
| 384 | XSETBUFFER (last_thing_searched, current_buffer); | ||
| 385 | |||
| 373 | return val; | 386 | return val; |
| 374 | } | 387 | } |
| 375 | 388 | ||
| @@ -431,7 +444,9 @@ string_match_1 (regexp, string, start, posix) | |||
| 431 | XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] | 444 | XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] |
| 432 | = current_buffer->case_eqv_table; | 445 | = current_buffer->case_eqv_table; |
| 433 | 446 | ||
| 434 | bufp = compile_pattern (regexp, &search_regs, | 447 | bufp = compile_pattern (regexp, |
| 448 | (NILP (Vinhibit_changing_match_data) | ||
| 449 | ? &search_regs : NULL), | ||
| 435 | (!NILP (current_buffer->case_fold_search) | 450 | (!NILP (current_buffer->case_fold_search) |
| 436 | ? current_buffer->case_canon_table : Qnil), | 451 | ? current_buffer->case_canon_table : Qnil), |
| 437 | posix, | 452 | posix, |
| @@ -442,21 +457,27 @@ string_match_1 (regexp, string, start, posix) | |||
| 442 | val = re_search (bufp, (char *) SDATA (string), | 457 | val = re_search (bufp, (char *) SDATA (string), |
| 443 | SBYTES (string), pos_byte, | 458 | SBYTES (string), pos_byte, |
| 444 | SBYTES (string) - pos_byte, | 459 | SBYTES (string) - pos_byte, |
| 445 | &search_regs); | 460 | (NILP (Vinhibit_changing_match_data) |
| 461 | ? &search_regs : NULL)); | ||
| 446 | immediate_quit = 0; | 462 | immediate_quit = 0; |
| 447 | last_thing_searched = Qt; | 463 | |
| 464 | /* Set last_thing_searched only when match data is changed. */ | ||
| 465 | if (NILP (Vinhibit_changing_match_data)) | ||
| 466 | last_thing_searched = Qt; | ||
| 467 | |||
| 448 | if (val == -2) | 468 | if (val == -2) |
| 449 | matcher_overflow (); | 469 | matcher_overflow (); |
| 450 | if (val < 0) return Qnil; | 470 | if (val < 0) return Qnil; |
| 451 | 471 | ||
| 452 | for (i = 0; i < search_regs.num_regs; i++) | 472 | if (NILP (Vinhibit_changing_match_data)) |
| 453 | if (search_regs.start[i] >= 0) | 473 | for (i = 0; i < search_regs.num_regs; i++) |
| 454 | { | 474 | if (search_regs.start[i] >= 0) |
| 455 | search_regs.start[i] | 475 | { |
| 456 | = string_byte_to_char (string, search_regs.start[i]); | 476 | search_regs.start[i] |
| 457 | search_regs.end[i] | 477 | = string_byte_to_char (string, search_regs.start[i]); |
| 458 | = string_byte_to_char (string, search_regs.end[i]); | 478 | search_regs.end[i] |
| 459 | } | 479 | = string_byte_to_char (string, search_regs.end[i]); |
| 480 | } | ||
| 460 | 481 | ||
| 461 | return make_number (string_byte_to_char (string, val)); | 482 | return make_number (string_byte_to_char (string, val)); |
| 462 | } | 483 | } |
| @@ -1074,6 +1095,11 @@ do \ | |||
| 1074 | } \ | 1095 | } \ |
| 1075 | while (0) | 1096 | while (0) |
| 1076 | 1097 | ||
| 1098 | /* Only used in search_buffer, to record the end position of the match | ||
| 1099 | when searching regexps and SEARCH_REGS should not be changed | ||
| 1100 | (i.e. Vinhibit_changing_match_data is non-nil). */ | ||
| 1101 | static struct re_registers search_regs_1; | ||
| 1102 | |||
| 1077 | static int | 1103 | static int |
| 1078 | search_buffer (string, pos, pos_byte, lim, lim_byte, n, | 1104 | search_buffer (string, pos, pos_byte, lim, lim_byte, n, |
| 1079 | RE, trt, inverse_trt, posix) | 1105 | RE, trt, inverse_trt, posix) |
| @@ -1109,7 +1135,10 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, | |||
| 1109 | int s1, s2; | 1135 | int s1, s2; |
| 1110 | struct re_pattern_buffer *bufp; | 1136 | struct re_pattern_buffer *bufp; |
| 1111 | 1137 | ||
| 1112 | bufp = compile_pattern (string, &search_regs, trt, posix, | 1138 | bufp = compile_pattern (string, |
| 1139 | (NILP (Vinhibit_changing_match_data) | ||
| 1140 | ? &search_regs : &search_regs_1), | ||
| 1141 | trt, posix, | ||
| 1113 | !NILP (current_buffer->enable_multibyte_characters)); | 1142 | !NILP (current_buffer->enable_multibyte_characters)); |
| 1114 | 1143 | ||
| 1115 | immediate_quit = 1; /* Quit immediately if user types ^G, | 1144 | immediate_quit = 1; /* Quit immediately if user types ^G, |
| @@ -1142,7 +1171,8 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, | |||
| 1142 | int val; | 1171 | int val; |
| 1143 | val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2, | 1172 | val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2, |
| 1144 | pos_byte - BEGV_BYTE, lim_byte - pos_byte, | 1173 | pos_byte - BEGV_BYTE, lim_byte - pos_byte, |
| 1145 | &search_regs, | 1174 | (NILP (Vinhibit_changing_match_data) |
| 1175 | ? &search_regs : &search_regs_1), | ||
| 1146 | /* Don't allow match past current point */ | 1176 | /* Don't allow match past current point */ |
| 1147 | pos_byte - BEGV_BYTE); | 1177 | pos_byte - BEGV_BYTE); |
| 1148 | if (val == -2) | 1178 | if (val == -2) |
| @@ -1151,18 +1181,27 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, | |||
| 1151 | } | 1181 | } |
| 1152 | if (val >= 0) | 1182 | if (val >= 0) |
| 1153 | { | 1183 | { |
| 1154 | pos_byte = search_regs.start[0] + BEGV_BYTE; | 1184 | if (NILP (Vinhibit_changing_match_data)) |
| 1155 | for (i = 0; i < search_regs.num_regs; i++) | 1185 | { |
| 1156 | if (search_regs.start[i] >= 0) | 1186 | pos_byte = search_regs.start[0] + BEGV_BYTE; |
| 1157 | { | 1187 | for (i = 0; i < search_regs.num_regs; i++) |
| 1158 | search_regs.start[i] | 1188 | if (search_regs.start[i] >= 0) |
| 1159 | = BYTE_TO_CHAR (search_regs.start[i] + BEGV_BYTE); | 1189 | { |
| 1160 | search_regs.end[i] | 1190 | search_regs.start[i] |
| 1161 | = BYTE_TO_CHAR (search_regs.end[i] + BEGV_BYTE); | 1191 | = BYTE_TO_CHAR (search_regs.start[i] + BEGV_BYTE); |
| 1162 | } | 1192 | search_regs.end[i] |
| 1163 | XSETBUFFER (last_thing_searched, current_buffer); | 1193 | = BYTE_TO_CHAR (search_regs.end[i] + BEGV_BYTE); |
| 1164 | /* Set pos to the new position. */ | 1194 | } |
| 1165 | pos = search_regs.start[0]; | 1195 | XSETBUFFER (last_thing_searched, current_buffer); |
| 1196 | /* Set pos to the new position. */ | ||
| 1197 | pos = search_regs.start[0]; | ||
| 1198 | } | ||
| 1199 | else | ||
| 1200 | { | ||
| 1201 | pos_byte = search_regs_1.start[0] + BEGV_BYTE; | ||
| 1202 | /* Set pos to the new position. */ | ||
| 1203 | pos = BYTE_TO_CHAR (search_regs_1.start[0] + BEGV_BYTE); | ||
| 1204 | } | ||
| 1166 | } | 1205 | } |
| 1167 | else | 1206 | else |
| 1168 | { | 1207 | { |
| @@ -1176,7 +1215,8 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, | |||
| 1176 | int val; | 1215 | int val; |
| 1177 | val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2, | 1216 | val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2, |
| 1178 | pos_byte - BEGV_BYTE, lim_byte - pos_byte, | 1217 | pos_byte - BEGV_BYTE, lim_byte - pos_byte, |
| 1179 | &search_regs, | 1218 | (NILP (Vinhibit_changing_match_data) |
| 1219 | ? &search_regs : &search_regs_1), | ||
| 1180 | lim_byte - BEGV_BYTE); | 1220 | lim_byte - BEGV_BYTE); |
| 1181 | if (val == -2) | 1221 | if (val == -2) |
| 1182 | { | 1222 | { |
| @@ -1184,17 +1224,25 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, | |||
| 1184 | } | 1224 | } |
| 1185 | if (val >= 0) | 1225 | if (val >= 0) |
| 1186 | { | 1226 | { |
| 1187 | pos_byte = search_regs.end[0] + BEGV_BYTE; | 1227 | if (NILP (Vinhibit_changing_match_data)) |
| 1188 | for (i = 0; i < search_regs.num_regs; i++) | 1228 | { |
| 1189 | if (search_regs.start[i] >= 0) | 1229 | pos_byte = search_regs.end[0] + BEGV_BYTE; |
| 1190 | { | 1230 | for (i = 0; i < search_regs.num_regs; i++) |
| 1191 | search_regs.start[i] | 1231 | if (search_regs.start[i] >= 0) |
| 1192 | = BYTE_TO_CHAR (search_regs.start[i] + BEGV_BYTE); | 1232 | { |
| 1193 | search_regs.end[i] | 1233 | search_regs.start[i] |
| 1194 | = BYTE_TO_CHAR (search_regs.end[i] + BEGV_BYTE); | 1234 | = BYTE_TO_CHAR (search_regs.start[i] + BEGV_BYTE); |
| 1195 | } | 1235 | search_regs.end[i] |
| 1196 | XSETBUFFER (last_thing_searched, current_buffer); | 1236 | = BYTE_TO_CHAR (search_regs.end[i] + BEGV_BYTE); |
| 1197 | pos = search_regs.end[0]; | 1237 | } |
| 1238 | XSETBUFFER (last_thing_searched, current_buffer); | ||
| 1239 | pos = search_regs.end[0]; | ||
| 1240 | } | ||
| 1241 | else | ||
| 1242 | { | ||
| 1243 | pos_byte = search_regs_1.end[0] + BEGV_BYTE; | ||
| 1244 | pos = BYTE_TO_CHAR (search_regs_1.end[0] + BEGV_BYTE); | ||
| 1245 | } | ||
| 1198 | } | 1246 | } |
| 1199 | else | 1247 | else |
| 1200 | { | 1248 | { |
| @@ -1926,7 +1974,7 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt, | |||
| 1926 | cursor += dirlen - i - direction; /* fix cursor */ | 1974 | cursor += dirlen - i - direction; /* fix cursor */ |
| 1927 | if (i + direction == 0) | 1975 | if (i + direction == 0) |
| 1928 | { | 1976 | { |
| 1929 | int position; | 1977 | int position, start, end; |
| 1930 | 1978 | ||
| 1931 | cursor -= direction; | 1979 | cursor -= direction; |
| 1932 | 1980 | ||
| @@ -1934,11 +1982,24 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt, | |||
| 1934 | ? 1 - len_byte : 0); | 1982 | ? 1 - len_byte : 0); |
| 1935 | set_search_regs (position, len_byte); | 1983 | set_search_regs (position, len_byte); |
| 1936 | 1984 | ||
| 1985 | if (NILP (Vinhibit_changing_match_data)) | ||
| 1986 | { | ||
| 1987 | start = search_regs.start[0]; | ||
| 1988 | end = search_regs.end[0]; | ||
| 1989 | } | ||
| 1990 | else | ||
| 1991 | /* If Vinhibit_changing_match_data is non-nil, | ||
| 1992 | search_regs will not be changed. So let's | ||
| 1993 | compute start and end here. */ | ||
| 1994 | { | ||
| 1995 | start = BYTE_TO_CHAR (position); | ||
| 1996 | end = BYTE_TO_CHAR (position + len_byte); | ||
| 1997 | } | ||
| 1998 | |||
| 1937 | if ((n -= direction) != 0) | 1999 | if ((n -= direction) != 0) |
| 1938 | cursor += dirlen; /* to resume search */ | 2000 | cursor += dirlen; /* to resume search */ |
| 1939 | else | 2001 | else |
| 1940 | return ((direction > 0) | 2002 | return direction > 0 ? end : start; |
| 1941 | ? search_regs.end[0] : search_regs.start[0]); | ||
| 1942 | } | 2003 | } |
| 1943 | else | 2004 | else |
| 1944 | cursor += stride_for_teases; /* <sigh> we lose - */ | 2005 | cursor += stride_for_teases; /* <sigh> we lose - */ |
| @@ -2003,18 +2064,30 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt, | |||
| 2003 | pos_byte += dirlen - i- direction; | 2064 | pos_byte += dirlen - i- direction; |
| 2004 | if (i + direction == 0) | 2065 | if (i + direction == 0) |
| 2005 | { | 2066 | { |
| 2006 | int position; | 2067 | int position, start, end; |
| 2007 | pos_byte -= direction; | 2068 | pos_byte -= direction; |
| 2008 | 2069 | ||
| 2009 | position = pos_byte + ((direction > 0) ? 1 - len_byte : 0); | 2070 | position = pos_byte + ((direction > 0) ? 1 - len_byte : 0); |
| 2010 | |||
| 2011 | set_search_regs (position, len_byte); | 2071 | set_search_regs (position, len_byte); |
| 2012 | 2072 | ||
| 2073 | if (NILP (Vinhibit_changing_match_data)) | ||
| 2074 | { | ||
| 2075 | start = search_regs.start[0]; | ||
| 2076 | end = search_regs.end[0]; | ||
| 2077 | } | ||
| 2078 | else | ||
| 2079 | /* If Vinhibit_changing_match_data is non-nil, | ||
| 2080 | search_regs will not be changed. So let's | ||
| 2081 | compute start and end here. */ | ||
| 2082 | { | ||
| 2083 | start = BYTE_TO_CHAR (position); | ||
| 2084 | end = BYTE_TO_CHAR (position + len_byte); | ||
| 2085 | } | ||
| 2086 | |||
| 2013 | if ((n -= direction) != 0) | 2087 | if ((n -= direction) != 0) |
| 2014 | pos_byte += dirlen; /* to resume search */ | 2088 | pos_byte += dirlen; /* to resume search */ |
| 2015 | else | 2089 | else |
| 2016 | return ((direction > 0) | 2090 | return direction > 0 ? end : start; |
| 2017 | ? search_regs.end[0] : search_regs.start[0]); | ||
| 2018 | } | 2091 | } |
| 2019 | else | 2092 | else |
| 2020 | pos_byte += stride_for_teases; | 2093 | pos_byte += stride_for_teases; |
| @@ -2037,6 +2110,9 @@ set_search_regs (beg_byte, nbytes) | |||
| 2037 | { | 2110 | { |
| 2038 | int i; | 2111 | int i; |
| 2039 | 2112 | ||
| 2113 | if (!NILP (Vinhibit_changing_match_data)) | ||
| 2114 | return; | ||
| 2115 | |||
| 2040 | /* Make sure we have registers in which to store | 2116 | /* Make sure we have registers in which to store |
| 2041 | the match position. */ | 2117 | the match position. */ |
| 2042 | if (search_regs.num_regs == 0) | 2118 | if (search_regs.num_regs == 0) |
| @@ -3167,6 +3243,13 @@ or other such regexp constructs are not replaced with this. | |||
| 3167 | A value of nil (which is the normal value) means treat spaces literally. */); | 3243 | A value of nil (which is the normal value) means treat spaces literally. */); |
| 3168 | Vsearch_spaces_regexp = Qnil; | 3244 | Vsearch_spaces_regexp = Qnil; |
| 3169 | 3245 | ||
| 3246 | DEFVAR_LISP ("inhibit-changing-match-data", &Vinhibit_changing_match_data, | ||
| 3247 | doc: /* Internal use only. | ||
| 3248 | If non-nil, the match data will not be changed during call to searching or | ||
| 3249 | matching functions, such as `looking-at', `string-match', `re-search-forward' | ||
| 3250 | etc. */); | ||
| 3251 | Vinhibit_changing_match_data = Qnil; | ||
| 3252 | |||
| 3170 | defsubr (&Slooking_at); | 3253 | defsubr (&Slooking_at); |
| 3171 | defsubr (&Sposix_looking_at); | 3254 | defsubr (&Sposix_looking_at); |
| 3172 | defsubr (&Sstring_match); | 3255 | defsubr (&Sstring_match); |
diff --git a/src/term.c b/src/term.c index 122eab91bdb..813fc29655c 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -27,7 +27,10 @@ Boston, MA 02110-1301, USA. */ | |||
| 27 | #include <string.h> | 27 | #include <string.h> |
| 28 | #include <errno.h> | 28 | #include <errno.h> |
| 29 | #include <sys/file.h> | 29 | #include <sys/file.h> |
| 30 | #include <unistd.h> /* For isatty. */ | 30 | |
| 31 | #ifdef HAVE_UNISTD_H | ||
| 32 | #include <unistd.h> | ||
| 33 | #endif | ||
| 31 | 34 | ||
| 32 | #if HAVE_TERMIOS_H | 35 | #if HAVE_TERMIOS_H |
| 33 | #include <termios.h> /* For TIOCNOTTY. */ | 36 | #include <termios.h> /* For TIOCNOTTY. */ |
| @@ -2343,9 +2346,9 @@ the currently selected frame. */) | |||
| 2343 | void | 2346 | void |
| 2344 | term_mouse_moveto (int x, int y) | 2347 | term_mouse_moveto (int x, int y) |
| 2345 | { | 2348 | { |
| 2349 | /* TODO: how to set mouse position? | ||
| 2346 | const char *name; | 2350 | const char *name; |
| 2347 | int fd; | 2351 | int fd; |
| 2348 | /* TODO: how to set mouse position? | ||
| 2349 | name = (const char *) ttyname (0); | 2352 | name = (const char *) ttyname (0); |
| 2350 | fd = open (name, O_WRONLY); | 2353 | fd = open (name, O_WRONLY); |
| 2351 | SOME_FUNCTION (x, y, fd); | 2354 | SOME_FUNCTION (x, y, fd); |
| @@ -2359,7 +2362,7 @@ term_show_mouse_face (enum draw_glyphs_face draw) | |||
| 2359 | { | 2362 | { |
| 2360 | struct window *w = XWINDOW (Qmouse_face_window); | 2363 | struct window *w = XWINDOW (Qmouse_face_window); |
| 2361 | int save_x, save_y; | 2364 | int save_x, save_y; |
| 2362 | int i, j; | 2365 | int i; |
| 2363 | 2366 | ||
| 2364 | struct frame *f = XFRAME (w->frame); | 2367 | struct frame *f = XFRAME (w->frame); |
| 2365 | struct tty_display_info *tty = FRAME_TTY (f); | 2368 | struct tty_display_info *tty = FRAME_TTY (f); |
| @@ -2882,7 +2885,7 @@ int | |||
| 2882 | handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event, struct input_event* hold_quit) | 2885 | handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event, struct input_event* hold_quit) |
| 2883 | { | 2886 | { |
| 2884 | struct frame *f = XFRAME (tty->top_frame); | 2887 | struct frame *f = XFRAME (tty->top_frame); |
| 2885 | int i, j, fd; | 2888 | int fd; |
| 2886 | struct input_event ie; | 2889 | struct input_event ie; |
| 2887 | int do_help = 0; | 2890 | int do_help = 0; |
| 2888 | int count = 0; | 2891 | int count = 0; |
| @@ -2906,7 +2909,7 @@ handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event, struct in | |||
| 2906 | arg[1] = arg[3] = (unsigned short) event->y + gpm_zerobased; | 2909 | arg[1] = arg[3] = (unsigned short) event->y + gpm_zerobased; |
| 2907 | arg[4] = (unsigned short) 3; | 2910 | arg[4] = (unsigned short) 3; |
| 2908 | 2911 | ||
| 2909 | name = (const char *) ttyname (0); | 2912 | name = ttyname (0); |
| 2910 | fd = open (name, O_WRONLY); | 2913 | fd = open (name, O_WRONLY); |
| 2911 | ioctl (fd, TIOCLINUX, buf + sizeof (short) - 1); | 2914 | ioctl (fd, TIOCLINUX, buf + sizeof (short) - 1); |
| 2912 | close (fd); | 2915 | close (fd); |
| @@ -113,7 +113,7 @@ extern int w32_num_mouse_buttons; | |||
| 113 | 113 | ||
| 114 | 114 | ||
| 115 | /* | 115 | /* |
| 116 | Initialization states | 116 | Initialization states |
| 117 | */ | 117 | */ |
| 118 | static BOOL g_b_init_is_windows_9x; | 118 | static BOOL g_b_init_is_windows_9x; |
| 119 | static BOOL g_b_init_open_process_token; | 119 | static BOOL g_b_init_open_process_token; |
| @@ -1143,7 +1143,9 @@ init_environment (char ** argv) | |||
| 1143 | { | 1143 | { |
| 1144 | int dont_free = 0; | 1144 | int dont_free = 0; |
| 1145 | 1145 | ||
| 1146 | if ((lpval = w32_get_resource (env_vars[i].name, &dwType)) == NULL) | 1146 | if ((lpval = w32_get_resource (env_vars[i].name, &dwType)) == NULL |
| 1147 | /* Also ignore empty environment variables. */ | ||
| 1148 | || *lpval == 0) | ||
| 1147 | { | 1149 | { |
| 1148 | lpval = env_vars[i].def_value; | 1150 | lpval = env_vars[i].def_value; |
| 1149 | dwType = REG_EXPAND_SZ; | 1151 | dwType = REG_EXPAND_SZ; |
| @@ -2514,7 +2516,7 @@ stat (const char * path, struct stat * buf) | |||
| 2514 | != INVALID_HANDLE_VALUE) | 2516 | != INVALID_HANDLE_VALUE) |
| 2515 | { | 2517 | { |
| 2516 | /* This is more accurate in terms of gettting the correct number | 2518 | /* This is more accurate in terms of gettting the correct number |
| 2517 | of links, but is quite slow (it is noticable when Emacs is | 2519 | of links, but is quite slow (it is noticeable when Emacs is |
| 2518 | making a list of file name completions). */ | 2520 | making a list of file name completions). */ |
| 2519 | BY_HANDLE_FILE_INFORMATION info; | 2521 | BY_HANDLE_FILE_INFORMATION info; |
| 2520 | 2522 | ||
| @@ -2999,7 +3001,7 @@ struct { | |||
| 2999 | WSAEINVALIDPROCTABLE , "Invalid procedure table from service provider", | 3001 | WSAEINVALIDPROCTABLE , "Invalid procedure table from service provider", |
| 3000 | WSAEINVALIDPROVIDER , "Invalid service provider version number", | 3002 | WSAEINVALIDPROVIDER , "Invalid service provider version number", |
| 3001 | WSAEPROVIDERFAILEDINIT , "Unable to initialize a service provider", | 3003 | WSAEPROVIDERFAILEDINIT , "Unable to initialize a service provider", |
| 3002 | WSASYSCALLFAILURE , "System call failured", | 3004 | WSASYSCALLFAILURE , "System call failure", |
| 3003 | WSASERVICE_NOT_FOUND , "Service not found", /* not sure */ | 3005 | WSASERVICE_NOT_FOUND , "Service not found", /* not sure */ |
| 3004 | WSATYPE_NOT_FOUND , "Class type not found", | 3006 | WSATYPE_NOT_FOUND , "Class type not found", |
| 3005 | WSA_E_NO_MORE , "No more resources available", /* really not sure */ | 3007 | WSA_E_NO_MORE , "No more resources available", /* really not sure */ |
| @@ -4198,7 +4200,7 @@ globals_of_w32 () | |||
| 4198 | SetConsoleCtrlHandler(shutdown_handler, TRUE); | 4200 | SetConsoleCtrlHandler(shutdown_handler, TRUE); |
| 4199 | } | 4201 | } |
| 4200 | 4202 | ||
| 4201 | /* end of nt.c */ | 4203 | /* end of w32.c */ |
| 4202 | 4204 | ||
| 4203 | /* arch-tag: 90442dd3-37be-482b-b272-ac752e3049f1 | 4205 | /* arch-tag: 90442dd3-37be-482b-b272-ac752e3049f1 |
| 4204 | (do not change this comment) */ | 4206 | (do not change this comment) */ |
diff --git a/src/w32bdf.c b/src/w32bdf.c index 64ec2f7a3b0..40e705a18c9 100644 --- a/src/w32bdf.c +++ b/src/w32bdf.c | |||
| @@ -302,7 +302,7 @@ w32_free_bdf_font(bdffont *fontp) | |||
| 302 | font_char *pch; | 302 | font_char *pch; |
| 303 | cache_bitmap *pcb; | 303 | cache_bitmap *pcb; |
| 304 | 304 | ||
| 305 | UnmapViewOfFile(fontp->hfilemap); | 305 | UnmapViewOfFile(fontp->font); |
| 306 | CloseHandle(fontp->hfilemap); | 306 | CloseHandle(fontp->hfilemap); |
| 307 | CloseHandle(fontp->hfile); | 307 | CloseHandle(fontp->hfile); |
| 308 | 308 | ||
| @@ -867,6 +867,7 @@ int w32_BDF_to_x_font (char *file, char* xstr, int len) | |||
| 867 | retval = 1; | 867 | retval = 1; |
| 868 | } | 868 | } |
| 869 | } | 869 | } |
| 870 | UnmapViewOfFile (font); | ||
| 870 | CloseHandle (hfile); | 871 | CloseHandle (hfile); |
| 871 | CloseHandle (hfilemap); | 872 | CloseHandle (hfilemap); |
| 872 | return retval; | 873 | return retval; |
diff --git a/src/w32fns.c b/src/w32fns.c index e76ca2ddc62..cacfa32c177 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -52,6 +52,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 52 | #include <shellapi.h> | 52 | #include <shellapi.h> |
| 53 | #include <ctype.h> | 53 | #include <ctype.h> |
| 54 | #include <winspool.h> | 54 | #include <winspool.h> |
| 55 | #include <objbase.h> | ||
| 55 | 56 | ||
| 56 | #include <dlgs.h> | 57 | #include <dlgs.h> |
| 57 | #define FILE_NAME_TEXT_FIELD edt1 | 58 | #define FILE_NAME_TEXT_FIELD edt1 |
| @@ -2512,6 +2513,13 @@ w32_msg_pump (deferred_msg * msg_buf) | |||
| 2512 | /* Produced by complete_deferred_msg; just ignore. */ | 2513 | /* Produced by complete_deferred_msg; just ignore. */ |
| 2513 | break; | 2514 | break; |
| 2514 | case WM_EMACS_CREATEWINDOW: | 2515 | case WM_EMACS_CREATEWINDOW: |
| 2516 | /* Initialize COM for this window. Even though we don't use it, | ||
| 2517 | some third party shell extensions can cause it to be used in | ||
| 2518 | system dialogs, which causes a crash if it is not initialized. | ||
| 2519 | This is a known bug in Windows, which was fixed long ago, but | ||
| 2520 | the patch for XP is not publically available until XP SP3, | ||
| 2521 | and older versions will never be patched. */ | ||
| 2522 | CoInitialize (NULL); | ||
| 2515 | w32_createwindow ((struct frame *) msg.wParam); | 2523 | w32_createwindow ((struct frame *) msg.wParam); |
| 2516 | if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) | 2524 | if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) |
| 2517 | abort (); | 2525 | abort (); |
| @@ -3658,6 +3666,10 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) | |||
| 3658 | my_post_msg (&wmsg, hwnd, msg, wParam, lParam); | 3666 | my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
| 3659 | goto dflt; | 3667 | goto dflt; |
| 3660 | 3668 | ||
| 3669 | case WM_DESTROY: | ||
| 3670 | CoUninitialize (); | ||
| 3671 | return 0; | ||
| 3672 | |||
| 3661 | case WM_CLOSE: | 3673 | case WM_CLOSE: |
| 3662 | wmsg.dwModifiers = w32_get_modifiers (); | 3674 | wmsg.dwModifiers = w32_get_modifiers (); |
| 3663 | my_post_msg (&wmsg, hwnd, msg, wParam, lParam); | 3675 | my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
diff --git a/src/w32menu.c b/src/w32menu.c index f86bfa3b7db..b92a57061ac 100644 --- a/src/w32menu.c +++ b/src/w32menu.c | |||
| @@ -2292,29 +2292,53 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item) | |||
| 2292 | /* Quote any special characters within the menu item's text and | 2292 | /* Quote any special characters within the menu item's text and |
| 2293 | key binding. */ | 2293 | key binding. */ |
| 2294 | nlen = orig_len = strlen (out_string); | 2294 | nlen = orig_len = strlen (out_string); |
| 2295 | for (p = out_string; *p; p = _mbsinc (p)) | 2295 | if (unicode_append_menu) |
| 2296 | { | 2296 | { |
| 2297 | if (_mbsnextc (p) == '&') | 2297 | /* With UTF-8, & cannot be part of a multibyte character. */ |
| 2298 | nlen++; | 2298 | for (p = out_string; *p; p++) |
| 2299 | } | 2299 | { |
| 2300 | if (*p == '&') | ||
| 2301 | nlen++; | ||
| 2302 | } | ||
| 2303 | } | ||
| 2304 | else | ||
| 2305 | { | ||
| 2306 | /* If encoded with the system codepage, use multibyte string | ||
| 2307 | functions in case of multibyte characters that contain '&'. */ | ||
| 2308 | for (p = out_string; *p; p = _mbsinc (p)) | ||
| 2309 | { | ||
| 2310 | if (_mbsnextc (p) == '&') | ||
| 2311 | nlen++; | ||
| 2312 | } | ||
| 2313 | } | ||
| 2314 | |||
| 2300 | if (nlen > orig_len) | 2315 | if (nlen > orig_len) |
| 2301 | { | 2316 | { |
| 2302 | p = out_string; | 2317 | p = out_string; |
| 2303 | out_string = alloca (nlen + 1); | 2318 | out_string = alloca (nlen + 1); |
| 2304 | q = out_string; | 2319 | q = out_string; |
| 2305 | while (*p) | 2320 | while (*p) |
| 2306 | { | 2321 | { |
| 2307 | if (_mbsnextc (p) == '&') | 2322 | if (unicode_append_menu) |
| 2308 | { | 2323 | { |
| 2309 | _mbsncpy (q, p, 1); | 2324 | if (*p == '&') |
| 2310 | q = _mbsinc (q); | 2325 | *q++ = *p; |
| 2311 | } | 2326 | *q++ = *p++; |
| 2312 | _mbsncpy (q, p, 1); | 2327 | } |
| 2313 | p = _mbsinc (p); | 2328 | else |
| 2314 | q = _mbsinc (q); | 2329 | { |
| 2315 | } | 2330 | if (_mbsnextc (p) == '&') |
| 2316 | *q = '\0'; | 2331 | { |
| 2317 | } | 2332 | _mbsncpy (q, p, 1); |
| 2333 | q = _mbsinc (q); | ||
| 2334 | } | ||
| 2335 | _mbsncpy (q, p, 1); | ||
| 2336 | p = _mbsinc (p); | ||
| 2337 | q = _mbsinc (q); | ||
| 2338 | } | ||
| 2339 | } | ||
| 2340 | *q = '\0'; | ||
| 2341 | } | ||
| 2318 | 2342 | ||
| 2319 | if (item != NULL) | 2343 | if (item != NULL) |
| 2320 | fuFlags = MF_POPUP; | 2344 | fuFlags = MF_POPUP; |
diff --git a/src/w32term.c b/src/w32term.c index 7173a5ed25a..a17fa2de918 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -218,10 +218,9 @@ extern int errno; | |||
| 218 | extern EMACS_INT extra_keyboard_modifiers; | 218 | extern EMACS_INT extra_keyboard_modifiers; |
| 219 | 219 | ||
| 220 | static void x_update_window_end P_ ((struct window *, int, int)); | 220 | static void x_update_window_end P_ ((struct window *, int, int)); |
| 221 | void w32_delete_display P_ ((struct w32_display_info *)); | ||
| 222 | static void w32_handle_tool_bar_click P_ ((struct frame *, | 221 | static void w32_handle_tool_bar_click P_ ((struct frame *, |
| 223 | struct input_event *)); | 222 | struct input_event *)); |
| 224 | void w32_define_cursor P_ ((Window, Cursor)); | 223 | static void w32_define_cursor P_ ((Window, Cursor)); |
| 225 | 224 | ||
| 226 | void x_lower_frame P_ ((struct frame *)); | 225 | void x_lower_frame P_ ((struct frame *)); |
| 227 | void x_scroll_bar_clear P_ ((struct frame *)); | 226 | void x_scroll_bar_clear P_ ((struct frame *)); |
| @@ -3255,7 +3254,7 @@ redo_mouse_highlight () | |||
| 3255 | HIWORD (last_mouse_motion_event.lParam)); | 3254 | HIWORD (last_mouse_motion_event.lParam)); |
| 3256 | } | 3255 | } |
| 3257 | 3256 | ||
| 3258 | void | 3257 | static void |
| 3259 | w32_define_cursor (window, cursor) | 3258 | w32_define_cursor (window, cursor) |
| 3260 | Window window; | 3259 | Window window; |
| 3261 | Cursor cursor; | 3260 | Cursor cursor; |
diff --git a/src/window.c b/src/window.c index 70cb04fa63d..e5dd9b030d9 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -6645,7 +6645,7 @@ and the value of point and mark for each window. | |||
| 6645 | Also restore the choice of selected window. | 6645 | Also restore the choice of selected window. |
| 6646 | Also restore which buffer is current. | 6646 | Also restore which buffer is current. |
| 6647 | Does not restore the value of point in current buffer. | 6647 | Does not restore the value of point in current buffer. |
| 6648 | usage: (save-window-excursion BODY ...) */) | 6648 | usage: (save-window-excursion BODY...) */) |
| 6649 | (args) | 6649 | (args) |
| 6650 | Lisp_Object args; | 6650 | Lisp_Object args; |
| 6651 | { | 6651 | { |
diff --git a/src/xdisp.c b/src/xdisp.c index 7c7fedeb0b8..ca6939109a9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -24153,7 +24153,7 @@ unselects the minibuffer if it is active. */); | |||
| 24153 | This dynamically changes the tool-bar's height to the minimum height | 24153 | This dynamically changes the tool-bar's height to the minimum height |
| 24154 | that is needed to make all tool-bar items visible. | 24154 | that is needed to make all tool-bar items visible. |
| 24155 | If value is `grow-only', the tool-bar's height is only increased | 24155 | If value is `grow-only', the tool-bar's height is only increased |
| 24156 | automatically; to decreace the tool-bar height, use \\[recenter]. */); | 24156 | automatically; to decrease the tool-bar height, use \\[recenter]. */); |
| 24157 | Vauto_resize_tool_bars = Qt; | 24157 | Vauto_resize_tool_bars = Qt; |
| 24158 | 24158 | ||
| 24159 | DEFVAR_BOOL ("auto-raise-tool-bar-buttons", &auto_raise_tool_bar_buttons_p, | 24159 | DEFVAR_BOOL ("auto-raise-tool-bar-buttons", &auto_raise_tool_bar_buttons_p, |