aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2012-07-31 00:00:41 +0200
committerJoakim Verona2012-07-31 00:00:41 +0200
commit55fa71b3d9bb8609ca3cbb56f92c776ad8724a69 (patch)
treeb002fe941cc8636f8bd735717e440014359839dd /src
parent5fb63197843dcae66f2fe0ddd6f4a9d560e9db2f (diff)
parentb429a4eee4e09b1ba09e17ced5091d042955d84f (diff)
downloademacs-55fa71b3d9bb8609ca3cbb56f92c776ad8724a69.tar.gz
emacs-55fa71b3d9bb8609ca3cbb56f92c776ad8724a69.zip
upstream
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit34
-rw-r--r--src/ChangeLog309
-rw-r--r--src/ChangeLog.106
-rw-r--r--src/ChangeLog.113
-rw-r--r--src/ChangeLog.618
-rw-r--r--src/ChangeLog.78
-rw-r--r--src/ChangeLog.82
-rw-r--r--src/Makefile.in5
-rw-r--r--src/alloc.c235
-rw-r--r--src/buffer.c14
-rw-r--r--src/callint.c9
-rw-r--r--src/charset.c33
-rw-r--r--src/coding.c9
-rw-r--r--src/composite.c12
-rw-r--r--src/conf_post.h131
-rw-r--r--src/data.c8
-rw-r--r--src/dbusbind.c144
-rw-r--r--src/eval.c10
-rw-r--r--src/insdel.c82
-rw-r--r--src/keyboard.c11
-rw-r--r--src/keymap.c35
-rw-r--r--src/lisp.h338
-rw-r--r--src/lread.c10
-rw-r--r--src/makefile.w32-in9
-rw-r--r--src/marker.c2
-rw-r--r--src/nsterm.m30
-rw-r--r--src/regex.c32
-rw-r--r--src/s/aix4-2.h21
-rw-r--r--src/s/freebsd.h22
-rw-r--r--src/s/gnu-linux.h22
-rw-r--r--src/s/irix6-5.h6
-rw-r--r--src/s/netbsd.h24
-rw-r--r--src/s/sol2-6.h21
-rw-r--r--src/s/unixware.h20
-rw-r--r--src/s/usg5-4-common.h10
-rw-r--r--src/search.c4
-rw-r--r--src/sound.c2
-rw-r--r--src/syntax.c10
-rw-r--r--src/term.c3
-rw-r--r--src/w32.c18
-rw-r--r--src/w32console.c11
-rw-r--r--src/w32fns.c31
-rw-r--r--src/w32font.c6
-rw-r--r--src/w32font.h2
-rw-r--r--src/w32gui.h2
-rw-r--r--src/w32heap.c6
-rw-r--r--src/w32heap.h3
-rw-r--r--src/w32inevt.c60
-rw-r--r--src/w32inevt.h5
-rw-r--r--src/w32menu.c2
-rw-r--r--src/w32proc.c12
-rw-r--r--src/w32select.c2
-rw-r--r--src/w32term.c23
-rw-r--r--src/w32term.h5
-rw-r--r--src/w32xfns.c2
-rw-r--r--src/xdisp.c56
-rw-r--r--src/xfaces.c6
-rw-r--r--src/xfns.c2
58 files changed, 1112 insertions, 846 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index c044b404f9b..620ca63a0d6 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -46,17 +46,29 @@ handle SIGALRM ignore
46# Use $bugfix so that the value isn't a constant. 46# Use $bugfix so that the value isn't a constant.
47# Using a constant runs into GDB bugs sometimes. 47# Using a constant runs into GDB bugs sometimes.
48define xgetptr 48define xgetptr
49 set $bugfix = CHECK_LISP_OBJECT_TYPE ? $arg0.i : $arg0 49 if (CHECK_LISP_OBJECT_TYPE)
50 set $bugfix = $arg0.i
51 else
52 set $bugfix = $arg0
53 end
50 set $ptr = ($bugfix & VALMASK) | DATA_SEG_BITS 54 set $ptr = ($bugfix & VALMASK) | DATA_SEG_BITS
51end 55end
52 56
53define xgetint 57define xgetint
54 set $bugfix = CHECK_LISP_OBJECT_TYPE ? $arg0.i : $arg0 58 if (CHECK_LISP_OBJECT_TYPE)
55 set $int = USE_LSB_TAG ? $bugfix >> INTTYPEBITS : $bugfix << INTTYPEBITS >> INTTYPEBITS 59 set $bugfix = $arg0.i
60 else
61 set $bugfix = $arg0
62 end
63 set $int = $bugfix << (USE_LSB_TAG ? 0 : INTTYPEBITS) >> INTTYPEBITS
56end 64end
57 65
58define xgettype 66define xgettype
59 set $bugfix = CHECK_LISP_OBJECT_TYPE ? $arg0.i : $arg0 67 if (CHECK_LISP_OBJECT_TYPE)
68 set $bugfix = $arg0.i
69 else
70 set $bugfix = $arg0
71 end
60 set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1 : $bugfix >> VALBITS) 72 set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1 : $bugfix >> VALBITS)
61end 73end
62 74
@@ -641,7 +653,11 @@ end
641define xvectype 653define xvectype
642 xgetptr $ 654 xgetptr $
643 set $size = ((struct Lisp_Vector *) $ptr)->header.size 655 set $size = ((struct Lisp_Vector *) $ptr)->header.size
644 output ($size & PSEUDOVECTOR_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~ARRAY_MARK_FLAG 656 if ($size & PSEUDOVECTOR_FLAG)
657 output (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_SIZE_BITS)
658 else
659 output $size & ~ARRAY_MARK_FLAG
660 end
645 echo \n 661 echo \n
646end 662end
647document xvectype 663document xvectype
@@ -980,7 +996,7 @@ define xpr
980 if $type == Lisp_Vectorlike 996 if $type == Lisp_Vectorlike
981 set $size = ((struct Lisp_Vector *) $ptr)->header.size 997 set $size = ((struct Lisp_Vector *) $ptr)->header.size
982 if ($size & PSEUDOVECTOR_FLAG) 998 if ($size & PSEUDOVECTOR_FLAG)
983 set $vec = (enum pvec_type) ($size & PVEC_TYPE_MASK) 999 set $vec = (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_SIZE_BITS)
984 if $vec == PVEC_NORMAL_VECTOR 1000 if $vec == PVEC_NORMAL_VECTOR
985 xvector 1001 xvector
986 end 1002 end
@@ -1115,7 +1131,11 @@ define xbacktrace
1115 if $type == Lisp_Vectorlike 1131 if $type == Lisp_Vectorlike
1116 xgetptr (*$bt->function) 1132 xgetptr (*$bt->function)
1117 set $size = ((struct Lisp_Vector *) $ptr)->header.size 1133 set $size = ((struct Lisp_Vector *) $ptr)->header.size
1118 output ($size & PSEUDOVECTOR_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~ARRAY_MARK_FLAG 1134 if ($size & PSEUDOVECTOR_FLAG)
1135 output (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_SIZE_BITS)
1136 else
1137 output $size & ~ARRAY_MARK_FLAG
1138 end
1119 else 1139 else
1120 printf "Lisp type %d", $type 1140 printf "Lisp type %d", $type
1121 end 1141 end
diff --git a/src/ChangeLog b/src/ChangeLog
index 7e91158ee36..f3e8b58e071 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,312 @@
12012-07-30 Glenn Morris <rgm@gnu.org>
2
3 * conf_post.h: New, split from configure.ac's AH_BOTTOM.
4 * Makefile.in (config_h): Add conf_post.h.
5 * makefile.w32-in (CONFIG_H): Add conf_post.h.
6
72012-07-30 Jan Djärv <jan.h.d@swipnet.se>
8
9 * nsterm.m (ns_do_open_file): New variable.
10 (ns_term_init): Set ns_do_open_file to NO after run returns.
11 (openFile, openTempFile, openFileWithoutUI, openFiles): Open
12 files only if ns_do_open_file.
13
142012-07-30 Paul Eggert <eggert@cs.ucla.edu>
15
16 * lisp.h (SWITCH_ENUM_CAST): Remove. All uses removed.
17 This no-op macro hasn't been needed for many years.
18 * src/regex.c (SWITCH_ENUM_CAST) [!emacs]: Likewise.
19
20 Export DIRECTORY_SEP, TYPEMASK, VALMASK to GDB.
21 * alloc.c (gdb_make_enums_visible) [USE_LSB_TAG]: Add lsb_bits.
22 * lisp.h (enum lsb_bits) [USE_LSB_TAG]: New enum, for
23 gdb_make_enums_visible.
24 (TYPEMASK, VALMASK) [USE_LSB_TAGS]: Now enum constants, not macros.
25 (DIRECTORY_SEP): Now a constant, not a macro.
26
272012-07-30 Eli Zaretskii <eliz@gnu.org>
28
29 * w32fns.c (w32_wnd_proc): Pass w32_keyboard_codepage to
30 w32_kbd_patch_key as the 2nd arg. (Bug#12082)
31
32 * w32term.c <w32_keyboard_codepage>: Renamed from
33 keyboard_codepage and now external. All users changed.
34
35 * w32term.h: Add declaration of w32_keyboard_codepage.
36
37 * w32inevt.c (w32_kbd_patch_key): Accept an additional argument --
38 the codepage to translate keys to Unicode. If this argument is
39 -1, use the value returned by GetConsoleCP. All callers changed.
40
412012-07-30 Paul Eggert <eggert@cs.ucla.edu>
42
43 Update .PHONY listings in makefiles.
44 * Makefile.in (.PHONY): Add all, mostlyclean, clean,
45 bootstrap-clean, distclean, maintainer-clean, versioclean,
46 extraclean, frc.
47
48 * lisp.h (STRING_BYTES_BOUND): Cast entire result to ptrdiff_t.
49 This is a bit clearer. Fix some commentary typos.
50
512012-07-30 Glenn Morris <rgm@gnu.org>
52
53 * s/netbsd.h: Let configure include signal.h if needed.
54 Remove file, which is now empty.
55
56 * s/usg5-4-common.h (_longjmp, _setjmp, TIOCSIGSEND):
57 Let configure set them.
58 * s/irix6-5.h (_longjmp, _setjmp, TIOCSIGSEND):
59 No more need to undefine.
60
612012-07-30 Andreas Schwab <schwab@linux-m68k.org>
62
63 * keymap.c (Fkey_description): Don't remove 0x80 bit from
64 non-single-byte char when adding meta modifier. (Bug#12090)
65
662012-07-30 Dmitry Antipov <dmantipov@yandex.ru>
67
68 Convert safe_call to use variable number of arguments.
69 * xdisp.c (safe_call): Convert to use varargs. Adjust users.
70 (safe_call2): Fix comment.
71 * lisp.h (safe_call): Adjust prototype.
72 * coding.c (encode_coding_object): Change to use safe_call2.
73 * xfaces.c (merge_face_heights): Change to use safe_call1.
74
752012-07-30 Glenn Morris <rgm@gnu.org>
76
77 * s/aix4-2.h (sigmask): No need to undefine it, since syssignal.h
78 does that unconditionally. Remove file, which is now empty.
79
80 * s/freebsd.h, s/gnu-linux.h, s/sol2-6.h, s/unixware.h:
81 Remove empty files.
82
832012-07-30 Paul Eggert <eggert@cs.ucla.edu>
84
85 Export to GDB most of lisp.h's remaining object-like macros.
86 * lisp.h (min, max): Move earlier, because they're used earlier now.
87 (INTMASK, ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK)
88 (CHAR_TABLE_STANDARD_SLOTS, CHARTAB_SIZE_BITS_0)
89 (CHARTAB_SIZE_BITS_1, CHARTAB_SIZE_BITS_2, CHARTAB_SIZE_BITS_3)
90 (DEFAULT_HASH_SIZE, COMPILED_ARGLIST, COMPILED_BYTECODE)
91 (COMPILED_CONSTANTS, COMPILED_STACK_DEPTH, COMPILED_DOC_STRING)
92 (COMPILED_INTERACTIVE, CHAR_ALT, CHAR_SUPER, CHAR_HYPER, CHAR_SHIFT)
93 (CHAR_CTL, CHAR_META, CHAR_MODIFIER_MASK, CHARACTERBITS)
94 (MANY, UNEVALLED, FLOAT_TO_STRING_BUFSIZE, MAX_ALLOCA):
95 Now constants, for GDB. They need not be macros.
96 (MOST_POSITIVE_FIXNUM, MOST_NEGATIVE_FIXNUM, STRING_BYTES_BOUND):
97 Now constants, for GDB, as well as macros, for static initializers.
98 (CHAR_TABLE_STANDARD_SLOTS, CHAR_TABLE_EXTRA_SLOTS):
99 Move to after the definition of struct Lisp_Char_Table,
100 since the former now needs that type defined.
101 (enum CHARTAB_SIZE_BITS, enum CHAR_TABLE_STANDARD_SLOTS)
102 (enum DEFAULT_HASH_SIZE, enum Lisp_Compiled, enum char_bits)
103 (enum maxargs, enum FLOAT_TO_STRING_BUFSIZE, enum MAX_ALLOCA):
104 New enums, for gdb_make_enums_visible.
105 (GLYPH_MODE_LINE_FACE): Remove; unused.
106 * alloc.c (STRING_BYTES_MAX): Now a constant, not a macro.
107 (gdb_make_enums_visible): Add enum CHARTAB_SIZE_BITS, enum
108 CHAR_TABLE_STANDARD_SLOTS, enum char_bits, enum DEFAULT_HASH_SIZE,
109 enum FLOAT_TO_STRING_BUFSIZE, enum Lisp_Bits, enum Lisp_Compiled,
110 enum maxargs, enum MAX_ALLOCA.
111 (ARRAY_MARK_FLAG_VAL, PSEUDOVECTOR_FLAG_VAL, VALMASK_VAL): Remove.
112 (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK): Remove;
113 no longer needed, now that they are done in lisp.h.
114
1152012-07-30 Dmitry Antipov <dmantipov@yandex.ru>
116
117 Cleanup string bytes checking.
118 * alloc.c (GC_STRING_BYTES, CHECK_STRING_BYTES): Remove. Convert
119 all users to STRING_BYTES or string_bytes if GC_CHECK_STRING_BYTES.
120 (check_string_bytes): Define to empty if not GC_CHECK_STRING_BYTES.
121 (check_sblock, compact_small_strings): Simplify.
122
1232012-07-29 Paul Eggert <eggert@cs.ucla.edu>
124
125 * lisp.h (LISP_INT_TAG, LISP_INT1_TAG, LISP_STRING_TAG): Remove.
126 These macros are confusing and no longer need to be defined, as
127 the enum values now suffice. All uses replaced with definiens.
128 (Lisp_Int1, Lisp_String): Define directly; this is clearer.
129
1302012-07-29 Juanma Barranquero <lekktu@gmail.com>
131
132 * makefile.w32-in (LISP_H, $(BLD)/emacs.$(O), $(BLD)/w32inevt.$(O))
133 ($(BLD)/w32console.$(O)): Update dependencies.
134
1352012-07-29 Dmitry Antipov <dmantipov@yandex.ru>
136
137 Remove HIDE_LISP_IMPLEMENTATION and cleanup cons free list check.
138 * lisp.h (HIDE_LISP_IMPLEMENTATION): Remove as useless for a long
139 time. Adjust users.
140 (CHECK_CONS_LIST): Remove. Convert all users to check_cons_list.
141
1422012-07-29 Jan Djärv <jan.h.d@swipnet.se>
143
144 * lread.c (init_lread): Remove if-statement in ifdef HAVE_NS before
145 setting sitelisp (Bug#12010).
146
1472012-07-29 Eli Zaretskii <eliz@gnu.org>
148
149 * w32heap.h (OS_9X): Renamed from OS_WINDOWS_95.
150
151 * w32heap.c (cache_system_info):
152 * w32.c (sys_rename):
153 * w32proc.c (find_child_console, sys_kill): All users changed.
154
1552012-07-29 Paul Eggert <eggert@cs.ucla.edu>
156
157 * alloc.c (Fgarbage_collect): Indent as per usual Emacs style.
158
1592012-07-29 Eli Zaretskii <eliz@gnu.org>
160
161 * makefile.w32-in (LISP_H): Add $(NT_INC)/stdalign.h.
162
1632012-07-29 Dmitry Antipov <dmantipov@yandex.ru>
164
165 Cleanup statistics calculation in Fgarbage_collect.
166 * alloc.c (Fgarbage_collect): Rename t1 to meaningful start. Fix
167 zombies percentage calculation. Simplify elapsed time calculation.
168
1692012-07-29 Dmitry Antipov <dmantipov@yandex.ru>
170
171 Generalize marker debugging code under MARKER_DEBUG and use eassert.
172 * insdel.c (CHECK_MARKERS, check_markers_debug_flag): Remove.
173 (gap_left, gap_right, adjust_markers_for_delete, insert_1_both)
174 (insert_from_string_1, insert_from_gap, insert_from_buffer_1)
175 (replace_range, replace_range_2, del_range_2): Change to eassert.
176 * marker.c (byte_char_debug_check): Adjust style.
177
1782012-07-29 Paul Eggert <eggert@cs.ucla.edu>
179
180 Don't use the abbreviation "win" to refer to Windows (Bug#10421).
181 * regex.c (MAX_BUF_SIZE): Remove some incorrect and
182 long-ago-commented-out code that talks about "WIN32".
183 * w32heap.h (OS_WINDOWS_95): Rename from OS_WIN95.
184 All uses changed.
185
1862012-07-28 Paul Eggert <eggert@cs.ucla.edu>
187
188 Use Gnulib stdalign module (Bug#9772, Bug#9960).
189 * alloc.c (XMALLOC_BASE_ALIGNMENT, GC_POINTER_ALIGNMENT, pure_alloc):
190 Simplify by using alignof.
191 (pure_alloc) [! USE_LSB_TAG]: Don't over-align EMACS_INT values.
192 * lisp.h: Include <stdalign.h>.
193 (GCALIGNMENT): New macro and constant.
194 (DECL_ALIGN): Remove. All uses replaced by alignas (GCALIGNMENT).
195 (USE_LSB_TAG): ifdef on alignas, not on DECL_ALIGN.
196 (stdalign): New macro, if not already defined.
197
1982012-07-28 Eli Zaretskii <eliz@gnu.org>
199
200 Fix non-ASCII input in non-GUI frames on MS-Windows. (Bug#12055)
201 * w32inevt.c: Include w32inevt.h.
202 (w32_read_console_input): New inline function, calls either
203 ReadConsoleInputA or ReadConsoleInputW, depending on the value of
204 w32_console_unicode_input.
205 (fill_queue): Call w32_read_console_input instead of ReadConsoleInput.
206 (w32_kbd_patch_key, key_event): Use the codepage returned by
207 GetConsoleCP, rather than the ANSI codepage returned by GetLocaleInfo.
208 (key_event): use uChar.UnicodeChar only if
209 w32_console_unicode_input is non-zero.
210
211 * w32console.c: Include w32heap.h.
212 <w32_console_unicode_input>: New global variable.
213 (initialize_w32_display): Set w32_console_unicode_input to 1 on NT
214 family of Windows, zero otherwise.
215
216 * w32inevt.h: Declare w32_console_unicode_input.
217
218 * xdisp.c (init_iterator): Don't reference tip_frame in a build
219 --without-x. (Bug#11742)
220
2212012-07-27 Paul Eggert <eggert@cs.ucla.edu>
222
223 Adjust GDB to reflect pvec_type changes (Bug#12036).
224 * .gdbinit (xvectype, xpr, xbacktrace): Adjust to reflect the
225 2012-07-04 changes to pseudovector representation. Problem
226 reported by Eli Zaretskii in <http://bugs.gnu.org/12036#30>.
227
2282012-07-27 Michael Albinus <michael.albinus@gmx.de>
229
230 * dbusbind.c (XD_DBUS_VALIDATE_BUS_ADDRESS): Canonicalize session
231 bus address.
232 (xd_close_bus, Fdbus_init_bus): Handle reference counter properly.
233
2342012-07-27 Eli Zaretskii <eliz@gnu.org>
235
236 * alloc.c (listn): Fix the order the arguments are consed onto the
237 list.
238
239 * lisp.h (enum constype): Use CONSTYPE_HEAP and CONSTYPE_PURE for
240 enumeration constants, as PURE and HEAP are too general, and clash
241 with other headers and sources, such as gmalloc.c and the
242 MS-Windows system headers. All users changed.
243
2442012-07-27 Dmitry Antipov <dmantipov@yandex.ru>
245
246 Revert last save_excursion_save and save_excursion_restore changes.
247 * alloc.c, editfns.c, marker.c, lisp.h: Revert.
248 Lots of crashes reported by Chong Yidong <cyd@gnu.org>.
249
2502012-07-27 Dmitry Antipov <dmantipov@yandex.ru>
251
252 Fix recently-introduced typos in Windows port.
253 Reported by Martin Rudalics <rudalics@gmx.at>.
254 * w32.c (init_environment): Replace comma with semicolon.
255 * w32fns.c (syms_of_w32fns): Add missing parenthesis.
256
2572012-07-27 Paul Eggert <eggert@cs.ucla.edu>
258
259 Improve GDB symbol export (Bug#12036).
260 * .gdbinit (xgetptr, xgetint, xgettype): Set $bugfix in different
261 arms of an 'if', not using conditional expressions; otherwise GDB
262 complains about the types in the unevaluated arm when the argument
263 is an integer literal.
264 (xgetint): Simplify expression.
265 * alloc.c (gdb_make_enums_visible): New constant. This ports to
266 GCC 3.4.2 the export of symbols to GDB. Problem reported by Eli
267 Zaretskii in <http://bugs.gnu.org/12036#13>.
268 * lisp.h (PUBLISH_TO_GDB): Remove. All uses removed. No longer
269 needed now that we have gdb_make_enums_visible.
270 (enum CHECK_LISP_OBJECT_TYPE, enum Lisp_Bits, enum More_Lisp_Bits)
271 (enum enum_USE_LSB_TAG):
272 New enum types, packaging up enums that need to be exported to GDB.
273
2742012-07-27 Dmitry Antipov <dmantipov@yandex.ru>
275
276 Utility function to make a list from specified amount of objects.
277 * lisp.h (enum constype): New datatype.
278 (listn): New prototype.
279 * alloc.c (listn): New function.
280 (Fmemory_use_count, syms_of_alloc): Use it.
281 * buffer.c (syms_of_buffer): Likewise.
282 * callint.c (syms_of_callint): Likewise.
283 * charset.c (define_charset_internal): Likewise.
284 * coding.c (syms_of_coding): Likewise.
285 * keymap.c (syms_of_keymap): Likewise.
286 * search.c (syms_of_search): Likewise.
287 * syntax.c (syms_of_syntax): Likewise.
288 * w32.c (init_environment): Likewise.
289 * w32fns.c (Fw32_battery_status, syms_of_w32fns): Likewise.
290 * xdisp.c (syms_of_xdisp): Likewise.
291 * xfns.c (syms_of_xfns): Likewise.
292
2932012-07-27 Dmitry Antipov <dmantipov@yandex.ru>
294
295 Fast save_excursion_save and save_excursion_restore.
296 * lisp.h (struct Lisp_Excursion): New data type.
297 (PVEC_EXCURSION): New pseudovector type.
298 (XEXCURSION, XSETEXCURSION, EXCURSIONP): Convenient macros
299 to deal with it. Adjust comments.
300 (init_marker, attach_marker): New prototype.
301 (unchain_marker): Adjust prototype.
302 * marker.c (attach_marker): Change to global.
303 (init_marker): New function.
304 * alloc.c (Fmake_marker, build_marker): Use it.
305 (build_marker): More easserts.
306 (mark_object): Handle struct Lisp_Excursion.
307 * editfns.c (save_excursion_save, save_excursion_restore):
308 Reimplement to use struct Lisp_Excursion. Add comments.
309
12012-07-26 Paul Eggert <eggert@cs.ucla.edu> 3102012-07-26 Paul Eggert <eggert@cs.ucla.edu>
2 311
3 Fix export of symbols to GDB (Bug#12036). 312 Fix export of symbols to GDB (Bug#12036).
diff --git a/src/ChangeLog.10 b/src/ChangeLog.10
index cf62ec29bbc..6eda101c815 100644
--- a/src/ChangeLog.10
+++ b/src/ChangeLog.10
@@ -15825,7 +15825,7 @@
15825 * w32term.c (w32_draw_fringe_bitmap): Copy unadapted code from 15825 * w32term.c (w32_draw_fringe_bitmap): Copy unadapted code from
15826 xterm.c to handle overlaid fringe bitmaps and to use cursor color 15826 xterm.c to handle overlaid fringe bitmaps and to use cursor color
15827 for displaying cursor in fringe. 15827 for displaying cursor in fringe.
15828 (w32_define_fringe_bitmap, w32_destroy_fringe_bitmap): New W32 15828 (w32_define_fringe_bitmap, w32_destroy_fringe_bitmap): New Windows
15829 specific functions to define and destroy fringe bitmaps in fringe_bmp. 15829 specific functions to define and destroy fringe bitmaps in fringe_bmp.
15830 (w32_redisplay_interface): Add them to redisplay_interface. 15830 (w32_redisplay_interface): Add them to redisplay_interface.
15831 (w32_term_init): Call w32_init_fringe instead of explicitly 15831 (w32_term_init): Call w32_init_fringe instead of explicitly
@@ -21476,7 +21476,7 @@
21476 "Emacs built on Windows 9x/ME crashes at startup on Windows XP, 21476 "Emacs built on Windows 9x/ME crashes at startup on Windows XP,
21477 or Emacs builtpart of on XP crashes at startup on Windows 9x/ME." 21477 or Emacs builtpart of on XP crashes at startup on Windows 9x/ME."
21478 21478
21479 * w32.c: Added wrapper functions around the win32 API functions 21479 * w32.c: Added wrapper functions around the Windows API functions
21480 OpenProcessToken, GetTokenInformation, LookupAccountSid, and 21480 OpenProcessToken, GetTokenInformation, LookupAccountSid, and
21481 GetSidIdentifierAuthority. These wrapper functions serve two 21481 GetSidIdentifierAuthority. These wrapper functions serve two
21482 purposes: 21482 purposes:
@@ -21490,7 +21490,7 @@
21490 the version of advapi32.dll that is found in the 9x branch of 21490 the version of advapi32.dll that is found in the 9x branch of
21491 Microsoft Windows. 21491 Microsoft Windows.
21492 21492
21493 * w32.c (init_user_info): Replace the calls to the win32 API 21493 * w32.c (init_user_info): Replace the calls to the Windows API
21494 functions OpenProcessToken, GetTokenInformation, LookupAccountSid, 21494 functions OpenProcessToken, GetTokenInformation, LookupAccountSid,
21495 and GetSidIdentifierAuthority with calls to the newly added 21495 and GetSidIdentifierAuthority with calls to the newly added
21496 wrapper functions. 21496 wrapper functions.
diff --git a/src/ChangeLog.11 b/src/ChangeLog.11
index 781027ee8ae..d3b0a8284b5 100644
--- a/src/ChangeLog.11
+++ b/src/ChangeLog.11
@@ -3994,7 +3994,8 @@
3994 3994
39952010-09-24 Juanma Barranquero <lekktu@gmail.com> 39952010-09-24 Juanma Barranquero <lekktu@gmail.com>
3996 3996
3997 Remove W32 API function pointer unused since 2005-02-15 (revno 2005-02-15T23:19:26Z!jasonr@gnu.org). 3997 Remove Windows API function pointer unused since 2005-02-15 (revno
3998 2005-02-15T23:19:26Z!jasonr@gnu.org).
3998 * w32fns.c (clipboard_sequence_fn): Don't declare. 3999 * w32fns.c (clipboard_sequence_fn): Don't declare.
3999 (globals_of_w32fns): Don't initialize it. 4000 (globals_of_w32fns): Don't initialize it.
4000 4001
diff --git a/src/ChangeLog.6 b/src/ChangeLog.6
index 3aa1a23818e..64f8b3a8314 100644
--- a/src/ChangeLog.6
+++ b/src/ChangeLog.6
@@ -1269,7 +1269,7 @@
1269 "light", "extralight", and "thin" fonts. 1269 "light", "extralight", and "thin" fonts.
1270 (x_to_win32_charset, win32_to_x_charset): New functions. 1270 (x_to_win32_charset, win32_to_x_charset): New functions.
1271 (win32_to_x_font): Use new height units. Use win32_to_x_charset. 1271 (win32_to_x_font): Use new height units. Use win32_to_x_charset.
1272 (x_to_win32_font): Use x_to_win32_charset. Support Win32 font names 1272 (x_to_win32_font): Use x_to_win32_charset. Support w32 font names
1273 in addition to X font names. 1273 in addition to X font names.
1274 1274
1275 (win32_load_font, Fx_list_fonts, Fx_display_color_cells) 1275 (win32_load_font, Fx_list_fonts, Fx_display_color_cells)
@@ -3625,11 +3625,11 @@
3625 3625
3626 * xdisp.c [HAVE_NTGUI] (set_menu_framebar): Declare external. 3626 * xdisp.c [HAVE_NTGUI] (set_menu_framebar): Declare external.
3627 [HAVE_NTGUI] (frame_title_buf, frame_title_ptr): Include variables 3627 [HAVE_NTGUI] (frame_title_buf, frame_title_ptr): Include variables
3628 for Win32 window system. 3628 for w32 window system.
3629 [HAVE_NTGUI] (store_frame_title, x_consider_frame_title): Include 3629 [HAVE_NTGUI] (store_frame_title, x_consider_frame_title): Include
3630 procedures for Win32 window system. 3630 procedures for w32 window system.
3631 [HAVE_NTGUI] (x_consider_frame_title): Test for Win32 frame. 3631 [HAVE_NTGUI] (x_consider_frame_title): Test for w32 frame.
3632 [HAVE_NTGUI] (display_text_line): Test for Win32 frame on face change. 3632 [HAVE_NTGUI] (display_text_line): Test for w32 frame on face change.
3633 [HAVE_NTGUI] (display_menu_bar): Perform no-op for NT window system. 3633 [HAVE_NTGUI] (display_menu_bar): Perform no-op for NT window system.
3634 3634
3635 * window.c [HAVE_NTGUI] (Fset_window_configuration): Set menu 3635 * window.c [HAVE_NTGUI] (Fset_window_configuration): Set menu
@@ -3659,7 +3659,7 @@
3659 (make_lispy_event): Use FUNCTION_KEY_OFFSET to modify event codes 3659 (make_lispy_event): Use FUNCTION_KEY_OFFSET to modify event codes
3660 before applying modifiers. 3660 before applying modifiers.
3661 3661
3662 * frame.c [HAVE_NTGUI]: Test for a Win32 frame in procedures 3662 * frame.c [HAVE_NTGUI]: Test for a w32 frame in procedures
3663 that test for an X frame. 3663 that test for an X frame.
3664 3664
3665 * frame.h (output_method): New method: output_win32. 3665 * frame.h (output_method): New method: output_win32.
@@ -3673,13 +3673,13 @@
3673 * emacs.c [HAVE_NTGUI]: Declare Vwindow_system. 3673 * emacs.c [HAVE_NTGUI]: Declare Vwindow_system.
3674 [HAVE_NTGUI] (main): Enable inhibit_window_system. 3674 [HAVE_NTGUI] (main): Enable inhibit_window_system.
3675 Initialize environment from registry. 3675 Initialize environment from registry.
3676 Declare syms of Win32 windowing modules. 3676 Declare syms of w32 windowing modules.
3677 3677
3678 * dispnew.c [HAVE_NTGUI]: Include w32term.h. 3678 * dispnew.c [HAVE_NTGUI]: Include w32term.h.
3679 Include dispextern.h before cm.h since dispextern.h includes windows.h. 3679 Include dispextern.h before cm.h since dispextern.h includes windows.h.
3680 [HAVE_NTGUI] (make_frame_glyphs, free_frame_glyphs, scroll_frame_lines) 3680 [HAVE_NTGUI] (make_frame_glyphs, free_frame_glyphs, scroll_frame_lines)
3681 (update_frame, update_line): Test for WIN32 frame. 3681 (update_frame, update_line): Test for w32 frame.
3682 [HAVE_NTGUI] (init_display): Initialize WIN32 window system. 3682 [HAVE_NTGUI] (init_display): Initialize w32 window system.
3683 3683
3684 * dispextern.h [HAVE_NTGUI]: Include win32.h. 3684 * dispextern.h [HAVE_NTGUI]: Include win32.h.
3685 [HAVE_NTGUI] (struct frame_glyphs): Include pixel fields. 3685 [HAVE_NTGUI] (struct frame_glyphs): Include pixel fields.
diff --git a/src/ChangeLog.7 b/src/ChangeLog.7
index 0952826e8c6..ce240ab2928 100644
--- a/src/ChangeLog.7
+++ b/src/ChangeLog.7
@@ -2070,7 +2070,7 @@
2070 (sys_select): Ignore children dead children with pending input. 2070 (sys_select): Ignore children dead children with pending input.
2071 Delay sending SIGCHLD until all output has been read. 2071 Delay sending SIGCHLD until all output has been read.
2072 (sys_kill): Sleep to allow focus change events to propagate. 2072 (sys_kill): Sleep to allow focus change events to propagate.
2073 Use TerminateProcess on Win95. 2073 Use TerminateProcess on Windows 95.
2074 (int_from_hex, enum_locale_fn, Fw32_get_valid_locale_ids): 2074 (int_from_hex, enum_locale_fn, Fw32_get_valid_locale_ids):
2075 New functions. 2075 New functions.
2076 (Vw32_valid_locale_ids): New variable. 2076 (Vw32_valid_locale_ids): New variable.
@@ -5719,13 +5719,13 @@
5719 Loop over handles round robin to ensure fairness. 5719 Loop over handles round robin to ensure fairness.
5720 (sys_kill): Send ctrl-break and ctrl-c keystrokes to subprocesses 5720 (sys_kill): Send ctrl-break and ctrl-c keystrokes to subprocesses
5721 on SIGINT if not sharing consoles, otherwise generate ctrl-break event. 5721 on SIGINT if not sharing consoles, otherwise generate ctrl-break event.
5722 On other termination signals, send WM_QUIT message to Win95 apps 5722 On other termination signals, send WM_QUIT message to Windows 95 apps
5723 and WM_CLOSE to NT apps. 5723 and WM_CLOSE to NT apps.
5724 (syms_of_ntproc): Intern new symbols. defsubr new functions. 5724 (syms_of_ntproc): Intern new symbols. defsubr new functions.
5725 DEFVAR new variables. 5725 DEFVAR new variables.
5726 5726
5727 * w32term.c (SIF_*): Win95 macros defined for NT. 5727 * w32term.c (SIF_*): Windows 95 macros defined for NT.
5728 (struct tagSCROLLINFO): Win95 struct defined for NT. 5728 (struct tagSCROLLINFO): Windows 95 struct defined for NT.
5729 (vertical_scroll_bar_min_handle, vertical_scroll_bar_top_border) 5729 (vertical_scroll_bar_min_handle, vertical_scroll_bar_top_border)
5730 (vertical_scroll_bar_bottom_border, last_scroll_bar_drag_pos) 5730 (vertical_scroll_bar_bottom_border, last_scroll_bar_drag_pos)
5731 (Vw32_gab_focus_on_raise, Vw32_capslock_is_shiftlock): 5731 (Vw32_gab_focus_on_raise, Vw32_capslock_is_shiftlock):
diff --git a/src/ChangeLog.8 b/src/ChangeLog.8
index d3ce1eb2a45..e68966b16a2 100644
--- a/src/ChangeLog.8
+++ b/src/ChangeLog.8
@@ -13203,7 +13203,7 @@
13203 * w32.c (stat): GetFileInformationByHandle can legitimately fail, 13203 * w32.c (stat): GetFileInformationByHandle can legitimately fail,
13204 so don't rely on it succeeding. 13204 so don't rely on it succeeding.
13205 13205
13206 * w32fns.c (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 13206 * w32fns.c (x_to_w32_font): Specify DEFAULT_CHARSET in the Windows
13207 LOGFONT struct if x font doesn't specify the charset. 13207 LOGFONT struct if x font doesn't specify the charset.
13208 (x_to_w32_charset): Change >= to == when testing results of 13208 (x_to_w32_charset): Change >= to == when testing results of
13209 stricmp. 13209 stricmp.
diff --git a/src/Makefile.in b/src/Makefile.in
index 9d835f4cd8c..c7fd697e48c 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -57,7 +57,7 @@ lispdir = ../lisp
57 57
58# Configuration files for .o files to depend on. 58# Configuration files for .o files to depend on.
59S_FILE = @S_FILE@ 59S_FILE = @S_FILE@
60config_h = config.h $(S_FILE) 60config_h = config.h conf_post.h $(S_FILE)
61 61
62bootstrap_exe = $(abs_builddir)/bootstrap-emacs$(EXEEXT) 62bootstrap_exe = $(abs_builddir)/bootstrap-emacs$(EXEEXT)
63 63
@@ -404,6 +404,7 @@ LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
404 $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC) 404 $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC)
405 405
406all: emacs$(EXEEXT) $(OTHER_FILES) 406all: emacs$(EXEEXT) $(OTHER_FILES)
407.PHONY: all
407 408
408$(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT) 409$(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT)
409 cd $(leimdir) && $(MAKE) $(MFLAGS) leim-list.el EMACS=$(bootstrap_exe) 410 cd $(leimdir) && $(MAKE) $(MFLAGS) leim-list.el EMACS=$(bootstrap_exe)
@@ -509,6 +510,8 @@ doc.o: buildobj.h
509## If HAVE_NS, some ns-specific rules (for OTHER_FILES) are inserted here. 510## If HAVE_NS, some ns-specific rules (for OTHER_FILES) are inserted here.
510@ns_frag@ 511@ns_frag@
511 512
513.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
514.PHONY: versioclean extraclean frc
512 515
513mostlyclean: 516mostlyclean:
514 rm -f temacs$(EXEEXT) core *.core \#* *.o libXMenu11.a liblw.a 517 rm -f temacs$(EXEEXT) core *.core \#* *.o libXMenu11.a liblw.a
diff --git a/src/alloc.c b/src/alloc.c
index ac6cb861c4d..5b2553c69cc 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -29,11 +29,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29#include <pthread.h> 29#include <pthread.h>
30#endif 30#endif
31 31
32/* This file is part of the core Lisp implementation, and thus must
33 deal with the real data structures. If the Lisp implementation is
34 replaced, this file likely will not be used. */
35
36#undef HIDE_LISP_IMPLEMENTATION
37#include "lisp.h" 32#include "lisp.h"
38#include "process.h" 33#include "process.h"
39#include "intervals.h" 34#include "intervals.h"
@@ -155,12 +150,6 @@ static pthread_mutex_t alloc_mutex;
155#define VECTOR_UNMARK(V) ((V)->header.size &= ~ARRAY_MARK_FLAG) 150#define VECTOR_UNMARK(V) ((V)->header.size &= ~ARRAY_MARK_FLAG)
156#define VECTOR_MARKED_P(V) (((V)->header.size & ARRAY_MARK_FLAG) != 0) 151#define VECTOR_MARKED_P(V) (((V)->header.size & ARRAY_MARK_FLAG) != 0)
157 152
158/* Value is the number of bytes of S, a pointer to a struct Lisp_String.
159 Be careful during GC, because S->size contains the mark bit for
160 strings. */
161
162#define GC_STRING_BYTES(S) (STRING_BYTES (S))
163
164/* Default value of gc_cons_threshold (see below). */ 153/* Default value of gc_cons_threshold (see below). */
165 154
166#define GC_DEFAULT_THRESHOLD (100000 * sizeof (Lisp_Object)) 155#define GC_DEFAULT_THRESHOLD (100000 * sizeof (Lisp_Object))
@@ -533,12 +522,7 @@ buffer_memory_full (ptrdiff_t nbytes)
533 hold a size_t value and (2) the header size is a multiple of the 522 hold a size_t value and (2) the header size is a multiple of the
534 alignment that Emacs needs for C types and for USE_LSB_TAG. */ 523 alignment that Emacs needs for C types and for USE_LSB_TAG. */
535#define XMALLOC_BASE_ALIGNMENT \ 524#define XMALLOC_BASE_ALIGNMENT \
536 offsetof ( \ 525 alignof (union { long double d; intmax_t i; void *p; })
537 struct { \
538 union { long double d; intmax_t i; void *p; } u; \
539 char c; \
540 }, \
541 c)
542 526
543#if USE_LSB_TAG 527#if USE_LSB_TAG
544# define XMALLOC_HEADER_ALIGNMENT \ 528# define XMALLOC_HEADER_ALIGNMENT \
@@ -1790,13 +1774,13 @@ static char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] =
1790 STRING_BYTES_BOUND, nor can it be so long that the size_t 1774 STRING_BYTES_BOUND, nor can it be so long that the size_t
1791 arithmetic in allocate_string_data would overflow while it is 1775 arithmetic in allocate_string_data would overflow while it is
1792 calculating a value to be passed to malloc. */ 1776 calculating a value to be passed to malloc. */
1793#define STRING_BYTES_MAX \ 1777static ptrdiff_t const STRING_BYTES_MAX =
1794 min (STRING_BYTES_BOUND, \ 1778 min (STRING_BYTES_BOUND,
1795 ((SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD \ 1779 ((SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD
1796 - GC_STRING_EXTRA \ 1780 - GC_STRING_EXTRA
1797 - offsetof (struct sblock, first_data) \ 1781 - offsetof (struct sblock, first_data)
1798 - SDATA_DATA_OFFSET) \ 1782 - SDATA_DATA_OFFSET)
1799 & ~(sizeof (EMACS_INT) - 1))) 1783 & ~(sizeof (EMACS_INT) - 1)));
1800 1784
1801/* Initialize string allocation. Called from init_alloc_once. */ 1785/* Initialize string allocation. Called from init_alloc_once. */
1802 1786
@@ -1812,10 +1796,8 @@ init_strings (void)
1812 1796
1813static int check_string_bytes_count; 1797static int check_string_bytes_count;
1814 1798
1815#define CHECK_STRING_BYTES(S) STRING_BYTES (S) 1799/* Like STRING_BYTES, but with debugging check. Can be
1816 1800 called during GC, so pay attention to the mark bit. */
1817
1818/* Like GC_STRING_BYTES, but with debugging check. */
1819 1801
1820ptrdiff_t 1802ptrdiff_t
1821string_bytes (struct Lisp_String *s) 1803string_bytes (struct Lisp_String *s)
@@ -1847,15 +1829,8 @@ check_sblock (struct sblock *b)
1847 1829
1848 /* Check that the string size recorded in the string is the 1830 /* Check that the string size recorded in the string is the
1849 same as the one recorded in the sdata structure. */ 1831 same as the one recorded in the sdata structure. */
1850 if (from->string) 1832 nbytes = SDATA_SIZE (from->string ? string_bytes (from->string)
1851 CHECK_STRING_BYTES (from->string); 1833 : SDATA_NBYTES (from));
1852
1853 if (from->string)
1854 nbytes = GC_STRING_BYTES (from->string);
1855 else
1856 nbytes = SDATA_NBYTES (from);
1857
1858 nbytes = SDATA_SIZE (nbytes);
1859 from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA); 1834 from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA);
1860 } 1835 }
1861} 1836}
@@ -1876,7 +1851,7 @@ check_string_bytes (int all_p)
1876 { 1851 {
1877 struct Lisp_String *s = b->first_data.string; 1852 struct Lisp_String *s = b->first_data.string;
1878 if (s) 1853 if (s)
1879 CHECK_STRING_BYTES (s); 1854 string_bytes (s);
1880 } 1855 }
1881 1856
1882 for (b = oldest_sblock; b; b = b->next) 1857 for (b = oldest_sblock; b; b = b->next)
@@ -1886,6 +1861,10 @@ check_string_bytes (int all_p)
1886 check_sblock (current_sblock); 1861 check_sblock (current_sblock);
1887} 1862}
1888 1863
1864#else /* not GC_CHECK_STRING_BYTES */
1865
1866#define check_string_bytes(all) ((void) 0)
1867
1889#endif /* GC_CHECK_STRING_BYTES */ 1868#endif /* GC_CHECK_STRING_BYTES */
1890 1869
1891#ifdef GC_CHECK_STRING_FREE_LIST 1870#ifdef GC_CHECK_STRING_FREE_LIST
@@ -1997,7 +1976,7 @@ allocate_string_data (struct Lisp_String *s,
1997 if (s->data) 1976 if (s->data)
1998 { 1977 {
1999 old_data = SDATA_OF_STRING (s); 1978 old_data = SDATA_OF_STRING (s);
2000 old_nbytes = GC_STRING_BYTES (s); 1979 old_nbytes = STRING_BYTES (s);
2001 } 1980 }
2002 else 1981 else
2003 old_data = NULL; 1982 old_data = NULL;
@@ -2131,10 +2110,10 @@ sweep_strings (void)
2131 how large that is. Reset the sdata's string 2110 how large that is. Reset the sdata's string
2132 back-pointer so that we know it's free. */ 2111 back-pointer so that we know it's free. */
2133#ifdef GC_CHECK_STRING_BYTES 2112#ifdef GC_CHECK_STRING_BYTES
2134 if (GC_STRING_BYTES (s) != SDATA_NBYTES (data)) 2113 if (string_bytes (s) != SDATA_NBYTES (data))
2135 abort (); 2114 abort ();
2136#else 2115#else
2137 data->u.nbytes = GC_STRING_BYTES (s); 2116 data->u.nbytes = STRING_BYTES (s);
2138#endif 2117#endif
2139 data->string = NULL; 2118 data->string = NULL;
2140 2119
@@ -2237,22 +2216,17 @@ compact_small_strings (void)
2237 /* Compute the next FROM here because copying below may 2216 /* Compute the next FROM here because copying below may
2238 overwrite data we need to compute it. */ 2217 overwrite data we need to compute it. */
2239 ptrdiff_t nbytes; 2218 ptrdiff_t nbytes;
2219 struct Lisp_String *s = from->string;
2240 2220
2241#ifdef GC_CHECK_STRING_BYTES 2221#ifdef GC_CHECK_STRING_BYTES
2242 /* Check that the string size recorded in the string is the 2222 /* Check that the string size recorded in the string is the
2243 same as the one recorded in the sdata structure. */ 2223 same as the one recorded in the sdata structure. */
2244 if (from->string 2224 if (s && string_bytes (s) != SDATA_NBYTES (from))
2245 && GC_STRING_BYTES (from->string) != SDATA_NBYTES (from))
2246 abort (); 2225 abort ();
2247#endif /* GC_CHECK_STRING_BYTES */ 2226#endif /* GC_CHECK_STRING_BYTES */
2248 2227
2249 if (from->string) 2228 nbytes = s ? STRING_BYTES (s) : SDATA_NBYTES (from);
2250 nbytes = GC_STRING_BYTES (from->string); 2229 eassert (nbytes <= LARGE_STRING_BYTES);
2251 else
2252 nbytes = SDATA_NBYTES (from);
2253
2254 if (nbytes > LARGE_STRING_BYTES)
2255 abort ();
2256 2230
2257 nbytes = SDATA_SIZE (nbytes); 2231 nbytes = SDATA_SIZE (nbytes);
2258 from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA); 2232 from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA);
@@ -2264,8 +2238,8 @@ compact_small_strings (void)
2264 abort (); 2238 abort ();
2265#endif 2239#endif
2266 2240
2267 /* FROM->string non-null means it's alive. Copy its data. */ 2241 /* Non-NULL S means it's alive. Copy its data. */
2268 if (from->string) 2242 if (s)
2269 { 2243 {
2270 /* If TB is full, proceed with the next sblock. */ 2244 /* If TB is full, proceed with the next sblock. */
2271 to_end = (struct sdata *) ((char *) to + nbytes + GC_STRING_EXTRA); 2245 to_end = (struct sdata *) ((char *) to + nbytes + GC_STRING_EXTRA);
@@ -2811,6 +2785,38 @@ list5 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4, L
2811 Fcons (arg5, Qnil))))); 2785 Fcons (arg5, Qnil)))));
2812} 2786}
2813 2787
2788/* Make a list of COUNT Lisp_Objects, where ARG is the
2789 first one. Allocate conses from pure space if TYPE
2790 is CONSTYPE_PURE, or allocate as usual if type is CONSTYPE_HEAP. */
2791
2792Lisp_Object
2793listn (enum constype type, ptrdiff_t count, Lisp_Object arg, ...)
2794{
2795 va_list ap;
2796 ptrdiff_t i;
2797 Lisp_Object val, *objp;
2798
2799 /* Change to SAFE_ALLOCA if you hit this eassert. */
2800 eassert (count <= MAX_ALLOCA / sizeof (Lisp_Object));
2801
2802 objp = alloca (count * sizeof (Lisp_Object));
2803 objp[0] = arg;
2804 va_start (ap, arg);
2805 for (i = 1; i < count; i++)
2806 objp[i] = va_arg (ap, Lisp_Object);
2807 va_end (ap);
2808
2809 for (val = Qnil, i = count - 1; i >= 0; i--)
2810 {
2811 if (type == CONSTYPE_PURE)
2812 val = pure_cons (objp[i], val);
2813 else if (type == CONSTYPE_HEAP)
2814 val = Fcons (objp[i], val);
2815 else
2816 abort ();
2817 }
2818 return val;
2819}
2814 2820
2815DEFUN ("list", Flist, Slist, 0, MANY, 0, 2821DEFUN ("list", Flist, Slist, 0, MANY, 0,
2816 doc: /* Return a newly created list with specified arguments as elements. 2822 doc: /* Return a newly created list with specified arguments as elements.
@@ -4620,10 +4626,10 @@ mark_maybe_pointer (void *p)
4620} 4626}
4621 4627
4622 4628
4623/* Alignment of pointer values. Use offsetof, as it sometimes returns 4629/* Alignment of pointer values. Use alignof, as it sometimes returns
4624 a smaller alignment than GCC's __alignof__ and mark_memory might 4630 a smaller alignment than GCC's __alignof__ and mark_memory might
4625 miss objects if __alignof__ were used. */ 4631 miss objects if __alignof__ were used. */
4626#define GC_POINTER_ALIGNMENT offsetof (struct {char a; void *b;}, b) 4632#define GC_POINTER_ALIGNMENT alignof (void *)
4627 4633
4628/* Define POINTERS_MIGHT_HIDE_IN_OBJECTS to 1 if marking via C pointers does 4634/* Define POINTERS_MIGHT_HIDE_IN_OBJECTS to 1 if marking via C pointers does
4629 not suffice, which is the typical case. A host where a Lisp_Object is 4635 not suffice, which is the typical case. A host where a Lisp_Object is
@@ -5071,17 +5077,11 @@ pure_alloc (size_t size, int type)
5071#if USE_LSB_TAG 5077#if USE_LSB_TAG
5072 size_t alignment = (1 << GCTYPEBITS); 5078 size_t alignment = (1 << GCTYPEBITS);
5073#else 5079#else
5074 size_t alignment = sizeof (EMACS_INT); 5080 size_t alignment = alignof (EMACS_INT);
5075 5081
5076 /* Give Lisp_Floats an extra alignment. */ 5082 /* Give Lisp_Floats an extra alignment. */
5077 if (type == Lisp_Float) 5083 if (type == Lisp_Float)
5078 { 5084 alignment = alignof (struct Lisp_Float);
5079#if defined __GNUC__ && __GNUC__ >= 2
5080 alignment = __alignof (struct Lisp_Float);
5081#else
5082 alignment = sizeof (struct Lisp_Float);
5083#endif
5084 }
5085#endif 5085#endif
5086 5086
5087 again: 5087 again:
@@ -5416,7 +5416,7 @@ See Info node `(elisp)Garbage Collection'. */)
5416 int message_p; 5416 int message_p;
5417 Lisp_Object total[11]; 5417 Lisp_Object total[11];
5418 ptrdiff_t count = SPECPDL_INDEX (); 5418 ptrdiff_t count = SPECPDL_INDEX ();
5419 EMACS_TIME t1; 5419 EMACS_TIME start;
5420 5420
5421 if (abort_on_gc) 5421 if (abort_on_gc)
5422 abort (); 5422 abort ();
@@ -5426,14 +5426,14 @@ See Info node `(elisp)Garbage Collection'. */)
5426 if (pure_bytes_used_before_overflow) 5426 if (pure_bytes_used_before_overflow)
5427 return Qnil; 5427 return Qnil;
5428 5428
5429 CHECK_CONS_LIST (); 5429 check_cons_list ();
5430 5430
5431 /* Don't keep undo information around forever. 5431 /* Don't keep undo information around forever.
5432 Do this early on, so it is no problem if the user quits. */ 5432 Do this early on, so it is no problem if the user quits. */
5433 FOR_EACH_BUFFER (nextb) 5433 FOR_EACH_BUFFER (nextb)
5434 compact_buffer (nextb); 5434 compact_buffer (nextb);
5435 5435
5436 t1 = current_emacs_time (); 5436 start = current_emacs_time ();
5437 5437
5438 /* In case user calls debug_print during GC, 5438 /* In case user calls debug_print during GC,
5439 don't let that cause a recursive GC. */ 5439 don't let that cause a recursive GC. */
@@ -5594,7 +5594,7 @@ See Info node `(elisp)Garbage Collection'. */)
5594 5594
5595 UNBLOCK_INPUT; 5595 UNBLOCK_INPUT;
5596 5596
5597 CHECK_CONS_LIST (); 5597 check_cons_list ();
5598 5598
5599 gc_in_progress = 0; 5599 gc_in_progress = 0;
5600 5600
@@ -5685,18 +5685,16 @@ See Info node `(elisp)Garbage Collection'. */)
5685#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES 5685#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
5686 { 5686 {
5687 /* Compute average percentage of zombies. */ 5687 /* Compute average percentage of zombies. */
5688 double nlive = 0; 5688 double nlive =
5689 5689 (total_conses + total_symbols + total_markers + total_strings
5690 for (i = 0; i < 7; ++i) 5690 + total_vectors + total_floats + total_intervals + total_buffers);
5691 if (CONSP (total[i]))
5692 nlive += XFASTINT (XCAR (total[i]));
5693 5691
5694 avg_live = (avg_live * ngcs + nlive) / (ngcs + 1); 5692 avg_live = (avg_live * ngcs + nlive) / (ngcs + 1);
5695 max_live = max (nlive, max_live); 5693 max_live = max (nlive, max_live);
5696 avg_zombies = (avg_zombies * ngcs + nzombies) / (ngcs + 1); 5694 avg_zombies = (avg_zombies * ngcs + nzombies) / (ngcs + 1);
5697 max_zombies = max (nzombies, max_zombies); 5695 max_zombies = max (nzombies, max_zombies);
5698 ++ngcs; 5696 ++ngcs;
5699 } 5697 }
5700#endif 5698#endif
5701 5699
5702 if (!NILP (Vpost_gc_hook)) 5700 if (!NILP (Vpost_gc_hook))
@@ -5709,10 +5707,9 @@ See Info node `(elisp)Garbage Collection'. */)
5709 /* Accumulate statistics. */ 5707 /* Accumulate statistics. */
5710 if (FLOATP (Vgc_elapsed)) 5708 if (FLOATP (Vgc_elapsed))
5711 { 5709 {
5712 EMACS_TIME t2 = current_emacs_time (); 5710 EMACS_TIME since_start = sub_emacs_time (current_emacs_time (), start);
5713 EMACS_TIME t3 = sub_emacs_time (t2, t1);
5714 Vgc_elapsed = make_float (XFLOAT_DATA (Vgc_elapsed) 5711 Vgc_elapsed = make_float (XFLOAT_DATA (Vgc_elapsed)
5715 + EMACS_TIME_TO_DOUBLE (t3)); 5712 + EMACS_TIME_TO_DOUBLE (since_start));
5716 } 5713 }
5717 5714
5718 gcs_done++; 5715 gcs_done++;
@@ -5929,7 +5926,7 @@ mark_object (Lisp_Object arg)
5929 5926
5930#endif /* not GC_CHECK_MARKED_OBJECTS */ 5927#endif /* not GC_CHECK_MARKED_OBJECTS */
5931 5928
5932 switch (SWITCH_ENUM_CAST (XTYPE (obj))) 5929 switch (XTYPE (obj))
5933 { 5930 {
5934 case Lisp_String: 5931 case Lisp_String:
5935 { 5932 {
@@ -5942,7 +5939,7 @@ mark_object (Lisp_Object arg)
5942#ifdef GC_CHECK_STRING_BYTES 5939#ifdef GC_CHECK_STRING_BYTES
5943 /* Check that the string size recorded in the string is the 5940 /* Check that the string size recorded in the string is the
5944 same as the one recorded in the sdata structure. */ 5941 same as the one recorded in the sdata structure. */
5945 CHECK_STRING_BYTES (ptr); 5942 string_bytes (ptr);
5946#endif /* GC_CHECK_STRING_BYTES */ 5943#endif /* GC_CHECK_STRING_BYTES */
5947 } 5944 }
5948 break; 5945 break;
@@ -6281,10 +6278,7 @@ gc_sweep (void)
6281 sweep_weak_hash_tables (); 6278 sweep_weak_hash_tables ();
6282 6279
6283 sweep_strings (); 6280 sweep_strings ();
6284#ifdef GC_CHECK_STRING_BYTES 6281 check_string_bytes (!noninteractive);
6285 if (!noninteractive)
6286 check_string_bytes (1);
6287#endif
6288 6282
6289 /* Put all unmarked conses on free list */ 6283 /* Put all unmarked conses on free list */
6290 { 6284 {
@@ -6604,11 +6598,7 @@ gc_sweep (void)
6604 } 6598 }
6605 6599
6606 sweep_vectors (); 6600 sweep_vectors ();
6607 6601 check_string_bytes (!noninteractive);
6608#ifdef GC_CHECK_STRING_BYTES
6609 if (!noninteractive)
6610 check_string_bytes (1);
6611#endif
6612} 6602}
6613 6603
6614 6604
@@ -6644,18 +6634,15 @@ Frames, windows, buffers, and subprocesses count as vectors
6644 (but the contents of a buffer's text do not count here). */) 6634 (but the contents of a buffer's text do not count here). */)
6645 (void) 6635 (void)
6646{ 6636{
6647 Lisp_Object consed[8]; 6637 return listn (CONSTYPE_HEAP, 8,
6648 6638 bounded_number (cons_cells_consed),
6649 consed[0] = bounded_number (cons_cells_consed); 6639 bounded_number (floats_consed),
6650 consed[1] = bounded_number (floats_consed); 6640 bounded_number (vector_cells_consed),
6651 consed[2] = bounded_number (vector_cells_consed); 6641 bounded_number (symbols_consed),
6652 consed[3] = bounded_number (symbols_consed); 6642 bounded_number (string_chars_consed),
6653 consed[4] = bounded_number (string_chars_consed); 6643 bounded_number (misc_objects_consed),
6654 consed[5] = bounded_number (misc_objects_consed); 6644 bounded_number (intervals_consed),
6655 consed[6] = bounded_number (intervals_consed); 6645 bounded_number (strings_consed));
6656 consed[7] = bounded_number (strings_consed);
6657
6658 return Flist (8, consed);
6659} 6646}
6660 6647
6661/* Find at most FIND_MAX symbols which have OBJ as their value or 6648/* Find at most FIND_MAX symbols which have OBJ as their value or
@@ -6836,8 +6823,8 @@ do hash-consing of the objects allocated to pure space. */);
6836 /* We build this in advance because if we wait until we need it, we might 6823 /* We build this in advance because if we wait until we need it, we might
6837 not be able to allocate the memory to hold it. */ 6824 not be able to allocate the memory to hold it. */
6838 Vmemory_signal_data 6825 Vmemory_signal_data
6839 = pure_cons (Qerror, 6826 = listn (CONSTYPE_PURE, 2, Qerror,
6840 pure_cons (build_pure_c_string ("Memory exhausted--use M-x save-some-buffers then exit and restart Emacs"), Qnil)); 6827 build_pure_c_string ("Memory exhausted--use M-x save-some-buffers then exit and restart Emacs"));
6841 6828
6842 DEFVAR_LISP ("memory-full", Vmemory_full, 6829 DEFVAR_LISP ("memory-full", Vmemory_full,
6843 doc: /* Non-nil means Emacs cannot get much more Lisp memory. */); 6830 doc: /* Non-nil means Emacs cannot get much more Lisp memory. */);
@@ -6876,28 +6863,26 @@ The time is in seconds as a floating point value. */);
6876#endif 6863#endif
6877} 6864}
6878 6865
6879/* Make some symbols visible to GDB. These cannot be done as enums, like 6866/* When compiled with GCC, GDB might say "No enum type named
6880 GCTYPEBITS or USE_LSB_TAG, since values might not be in 'int' range. 6867 pvec_type" if we don't have at least one symbol with that type, and
6881 Each symbol X has a corresponding X_VAL symbol, verified to have 6868 then xbacktrace could fail. Similarly for the other enums and
6882 the correct value. 6869 their values. */
6883 6870union
6884 This is last, so that the #undef lines don't mess up later code. */ 6871{
6885 6872 enum CHARTAB_SIZE_BITS CHARTAB_SIZE_BITS;
6886#define ARRAY_MARK_FLAG_VAL PTRDIFF_MIN 6873 enum CHAR_TABLE_STANDARD_SLOTS CHAR_TABLE_STANDARD_SLOTS;
6887#define PSEUDOVECTOR_FLAG_VAL (PTRDIFF_MAX - PTRDIFF_MAX / 2) 6874 enum char_bits char_bits;
6888#define VALMASK_VAL (USE_LSB_TAG ? -1 << GCTYPEBITS : VAL_MAX) 6875 enum CHECK_LISP_OBJECT_TYPE CHECK_LISP_OBJECT_TYPE;
6889 6876 enum DEFAULT_HASH_SIZE DEFAULT_HASH_SIZE;
6890verify (ARRAY_MARK_FLAG_VAL == ARRAY_MARK_FLAG); 6877 enum enum_USE_LSB_TAG enum_USE_LSB_TAG;
6891verify (PSEUDOVECTOR_FLAG_VAL == PSEUDOVECTOR_FLAG); 6878 enum FLOAT_TO_STRING_BUFSIZE FLOAT_TO_STRING_BUFSIZE;
6892verify (VALMASK_VAL == VALMASK); 6879 enum Lisp_Bits Lisp_Bits;
6893 6880 enum Lisp_Compiled Lisp_Compiled;
6894#undef ARRAY_MARK_FLAG 6881 enum maxargs maxargs;
6895#undef PSEUDOVECTOR_FLAG 6882 enum MAX_ALLOCA MAX_ALLOCA;
6896#undef VALMASK 6883 enum More_Lisp_Bits More_Lisp_Bits;
6897 6884 enum pvec_type pvec_type;
6898ptrdiff_t const EXTERNALLY_VISIBLE 6885#if USE_LSB_TAG
6899 ARRAY_MARK_FLAG = ARRAY_MARK_FLAG_VAL, 6886 enum lsb_bits lsb_bits;
6900 PSEUDOVECTOR_FLAG = PSEUDOVECTOR_FLAG_VAL; 6887#endif
6901 6888} const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0};
6902EMACS_INT const EXTERNALLY_VISIBLE
6903 VALMASK = VALMASK_VAL;
diff --git a/src/buffer.c b/src/buffer.c
index 06d385110c6..833eb843168 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -56,7 +56,7 @@ struct buffer *all_buffers;
56 Setting the default value also goes through the alist of buffers 56 Setting the default value also goes through the alist of buffers
57 and stores into each buffer that does not say it has a local value. */ 57 and stores into each buffer that does not say it has a local value. */
58 58
59DECL_ALIGN (struct buffer, buffer_defaults); 59struct buffer alignas (GCALIGNMENT) buffer_defaults;
60 60
61/* A Lisp_Object pointer to the above, used for staticpro */ 61/* A Lisp_Object pointer to the above, used for staticpro */
62 62
@@ -83,7 +83,7 @@ struct buffer buffer_local_flags;
83/* This structure holds the names of symbols whose values may be 83/* This structure holds the names of symbols whose values may be
84 buffer-local. It is indexed and accessed in the same way as the above. */ 84 buffer-local. It is indexed and accessed in the same way as the above. */
85 85
86DECL_ALIGN (struct buffer, buffer_local_symbols); 86struct buffer alignas (GCALIGNMENT) buffer_local_symbols;
87 87
88/* A Lisp_Object pointer to the above, used for staticpro */ 88/* A Lisp_Object pointer to the above, used for staticpro */
89static Lisp_Object Vbuffer_local_symbols; 89static Lisp_Object Vbuffer_local_symbols;
@@ -5212,7 +5212,7 @@ syms_of_buffer (void)
5212 DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions"); 5212 DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions");
5213 5213
5214 Fput (Qprotected_field, Qerror_conditions, 5214 Fput (Qprotected_field, Qerror_conditions,
5215 pure_cons (Qprotected_field, pure_cons (Qerror, Qnil))); 5215 listn (CONSTYPE_PURE, 2, Qprotected_field, Qerror));
5216 Fput (Qprotected_field, Qerror_message, 5216 Fput (Qprotected_field, Qerror_message,
5217 build_pure_c_string ("Attempt to modify a protected field")); 5217 build_pure_c_string ("Attempt to modify a protected field"));
5218 5218
@@ -5457,17 +5457,17 @@ Use the command `abbrev-mode' to change this variable. */);
5457 doc: /* Non-nil if searches and matches should ignore case. */); 5457 doc: /* Non-nil if searches and matches should ignore case. */);
5458 5458
5459 DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), 5459 DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column),
5460 make_number (LISP_INT_TAG), 5460 make_number (Lisp_Int0),
5461 doc: /* Column beyond which automatic line-wrapping should happen. 5461 doc: /* Column beyond which automatic line-wrapping should happen.
5462Interactively, you can set the buffer local value using \\[set-fill-column]. */); 5462Interactively, you can set the buffer local value using \\[set-fill-column]. */);
5463 5463
5464 DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin), 5464 DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin),
5465 make_number (LISP_INT_TAG), 5465 make_number (Lisp_Int0),
5466 doc: /* Column for the default `indent-line-function' to indent to. 5466 doc: /* Column for the default `indent-line-function' to indent to.
5467Linefeed indents to this column in Fundamental mode. */); 5467Linefeed indents to this column in Fundamental mode. */);
5468 5468
5469 DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width), 5469 DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width),
5470 make_number (LISP_INT_TAG), 5470 make_number (Lisp_Int0),
5471 doc: /* Distance between tab stops (for display of tab characters), in columns. 5471 doc: /* Distance between tab stops (for display of tab characters), in columns.
5472This should be an integer greater than zero. */); 5472This should be an integer greater than zero. */);
5473 5473
@@ -5588,7 +5588,7 @@ If it is nil, that means don't auto-save this buffer. */);
5588Backing up is done before the first time the file is saved. */); 5588Backing up is done before the first time the file is saved. */);
5589 5589
5590 DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length), 5590 DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length),
5591 make_number (LISP_INT_TAG), 5591 make_number (Lisp_Int0),
5592 doc: /* Length of current buffer when last read in, saved or auto-saved. 5592 doc: /* Length of current buffer when last read in, saved or auto-saved.
55930 initially. 55930 initially.
5594-1 means auto-saving turned off until next real save. 5594-1 means auto-saving turned off until next real save.
diff --git a/src/callint.c b/src/callint.c
index 58e1a5be2f4..4b53b5df34b 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -888,10 +888,11 @@ syms_of_callint (void)
888 callint_message = Qnil; 888 callint_message = Qnil;
889 staticpro (&callint_message); 889 staticpro (&callint_message);
890 890
891 preserved_fns = pure_cons (intern_c_string ("region-beginning"), 891 preserved_fns = listn (CONSTYPE_PURE, 4,
892 pure_cons (intern_c_string ("region-end"), 892 intern_c_string ("region-beginning"),
893 pure_cons (intern_c_string ("point"), 893 intern_c_string ("region-end"),
894 pure_cons (intern_c_string ("mark"), Qnil)))); 894 intern_c_string ("point"),
895 intern_c_string ("mark"));
895 896
896 DEFSYM (Qlist, "list"); 897 DEFSYM (Qlist, "list");
897 DEFSYM (Qlet, "let"); 898 DEFSYM (Qlet, "let");
diff --git a/src/charset.c b/src/charset.c
index 4c47ba45fb6..b621109b75d 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1257,7 +1257,6 @@ define_charset_internal (Lisp_Object name,
1257{ 1257{
1258 const unsigned char *code_space = (const unsigned char *) code_space_chars; 1258 const unsigned char *code_space = (const unsigned char *) code_space_chars;
1259 Lisp_Object args[charset_arg_max]; 1259 Lisp_Object args[charset_arg_max];
1260 Lisp_Object plist[14];
1261 Lisp_Object val; 1260 Lisp_Object val;
1262 int i; 1261 int i;
1263 1262
@@ -1283,22 +1282,22 @@ define_charset_internal (Lisp_Object name,
1283 args[charset_arg_superset] = Qnil; 1282 args[charset_arg_superset] = Qnil;
1284 args[charset_arg_unify_map] = Qnil; 1283 args[charset_arg_unify_map] = Qnil;
1285 1284
1286 plist[0] = intern_c_string (":name"); 1285 args[charset_arg_plist] =
1287 plist[1] = args[charset_arg_name]; 1286 listn (CONSTYPE_HEAP, 14,
1288 plist[2] = intern_c_string (":dimension"); 1287 intern_c_string (":name"),
1289 plist[3] = args[charset_arg_dimension]; 1288 args[charset_arg_name],
1290 plist[4] = intern_c_string (":code-space"); 1289 intern_c_string (":dimension"),
1291 plist[5] = args[charset_arg_code_space]; 1290 args[charset_arg_dimension],
1292 plist[6] = intern_c_string (":iso-final-char"); 1291 intern_c_string (":code-space"),
1293 plist[7] = args[charset_arg_iso_final]; 1292 args[charset_arg_code_space],
1294 plist[8] = intern_c_string (":emacs-mule-id"); 1293 intern_c_string (":iso-final-char"),
1295 plist[9] = args[charset_arg_emacs_mule_id]; 1294 args[charset_arg_iso_final],
1296 plist[10] = intern_c_string (":ascii-compatible-p"); 1295 intern_c_string (":emacs-mule-id"),
1297 plist[11] = args[charset_arg_ascii_compatible_p]; 1296 args[charset_arg_emacs_mule_id],
1298 plist[12] = intern_c_string (":code-offset"); 1297 intern_c_string (":ascii-compatible-p"),
1299 plist[13] = args[charset_arg_code_offset]; 1298 args[charset_arg_ascii_compatible_p],
1300 1299 intern_c_string (":code-offset"),
1301 args[charset_arg_plist] = Flist (14, plist); 1300 args[charset_arg_code_offset]);
1302 Fdefine_charset_internal (charset_arg_max, args); 1301 Fdefine_charset_internal (charset_arg_max, args);
1303 1302
1304 return XINT (CHARSET_SYMBOL_ID (name)); 1303 return XINT (CHARSET_SYMBOL_ID (name));
diff --git a/src/coding.c b/src/coding.c
index 212eb8275fe..e4ed65079d9 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7931,15 +7931,12 @@ encode_coding_object (struct coding_system *coding,
7931 } 7931 }
7932 7932
7933 { 7933 {
7934 Lisp_Object args[3];
7935 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 7934 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
7936 7935
7937 GCPRO5 (coding->src_object, coding->dst_object, src_object, dst_object, 7936 GCPRO5 (coding->src_object, coding->dst_object, src_object, dst_object,
7938 old_deactivate_mark); 7937 old_deactivate_mark);
7939 args[0] = CODING_ATTR_PRE_WRITE (attrs); 7938 safe_call2 (CODING_ATTR_PRE_WRITE (attrs),
7940 args[1] = make_number (BEG); 7939 make_number (BEG), make_number (Z));
7941 args[2] = make_number (Z);
7942 safe_call (3, args);
7943 UNGCPRO; 7940 UNGCPRO;
7944 } 7941 }
7945 if (XBUFFER (coding->src_object) != current_buffer) 7942 if (XBUFFER (coding->src_object) != current_buffer)
@@ -10411,7 +10408,7 @@ syms_of_coding (void)
10411 10408
10412 DEFSYM (Qcoding_system_error, "coding-system-error"); 10409 DEFSYM (Qcoding_system_error, "coding-system-error");
10413 Fput (Qcoding_system_error, Qerror_conditions, 10410 Fput (Qcoding_system_error, Qerror_conditions,
10414 pure_cons (Qcoding_system_error, pure_cons (Qerror, Qnil))); 10411 listn (CONSTYPE_PURE, 2, Qcoding_system_error, Qerror));
10415 Fput (Qcoding_system_error, Qerror_message, 10412 Fput (Qcoding_system_error, Qerror_message,
10416 build_pure_c_string ("Invalid coding system")); 10413 build_pure_c_string ("Invalid coding system"));
10417 10414
diff --git a/src/composite.c b/src/composite.c
index bfc8093a87f..62ab3d04948 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -947,20 +947,12 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t
947 string); 947 string);
948 if (NILP (LGSTRING_ID (lgstring))) 948 if (NILP (LGSTRING_ID (lgstring)))
949 { 949 {
950 Lisp_Object args[6];
951
952 /* Save point as marker before calling out to lisp. */ 950 /* Save point as marker before calling out to lisp. */
953 if (NILP (string)) 951 if (NILP (string))
954 record_unwind_protect (restore_point_unwind, 952 record_unwind_protect (restore_point_unwind,
955 build_marker (current_buffer, pt, pt_byte)); 953 build_marker (current_buffer, pt, pt_byte));
956 954 lgstring = safe_call (6, Vauto_composition_function, AREF (rule, 2),
957 args[0] = Vauto_composition_function; 955 pos, make_number (to), font_object, string);
958 args[1] = AREF (rule, 2);
959 args[2] = pos;
960 args[3] = make_number (to);
961 args[4] = font_object;
962 args[5] = string;
963 lgstring = safe_call (6, args);
964 } 956 }
965 return unbind_to (count, lgstring); 957 return unbind_to (count, lgstring);
966} 958}
diff --git a/src/conf_post.h b/src/conf_post.h
new file mode 100644
index 00000000000..5efecfb8c05
--- /dev/null
+++ b/src/conf_post.h
@@ -0,0 +1,131 @@
1/* conf_post.h --- configure.ac includes this via AH_BOTTOM
2
3Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2012
4 Free Software Foundation, Inc.
5
6This file is part of GNU Emacs.
7
8GNU Emacs is free software: you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation, either version 3 of the License, or
11(at your option) any later version.
12
13GNU Emacs is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20
21/* Commentary:
22
23 Rather than writing this code directly in AH_BOTTOM, we include it
24 via this file. This is so that it does not get processed by
25 autoheader. Eg, any undefs here would otherwise be commented out.
26*/
27
28/* Code: */
29
30/* On AIX 3 this must be included before any other include file. */
31#include <alloca.h>
32#if ! HAVE_ALLOCA
33# error "alloca not available on this machine"
34#endif
35
36#ifdef SIGNAL_H_AHB
37#undef SIGNAL_H_AHB
38#include <signal.h>
39#endif
40
41/* This silences a few compilation warnings on FreeBSD. */
42#ifdef BSD_SYSTEM_AHB
43#undef BSD_SYSTEM_AHB
44#undef BSD_SYSTEM
45#if __FreeBSD__ == 1
46#define BSD_SYSTEM 199103
47#elif __FreeBSD__ == 2
48#define BSD_SYSTEM 199306
49#elif __FreeBSD__ >= 3
50#define BSD_SYSTEM 199506
51#endif
52#endif
53
54/* Define AMPERSAND_FULL_NAME if you use the convention
55 that & in the full name stands for the login id. */
56/* Turned on June 1996 supposing nobody will mind it. */
57#define AMPERSAND_FULL_NAME
58
59/* `subprocesses' should be defined if you want to
60 have code for asynchronous subprocesses
61 (as used in M-x compile and M-x shell).
62 Only MSDOS does not support this (it overrides
63 this in its config_opsysfile below). */
64
65#define subprocesses
66
67/* Include the os dependent file. */
68#ifdef config_opsysfile
69# include config_opsysfile
70#endif
71
72/* Mac OS X / GNUstep need a bit more pure memory. Of the existing knobs,
73 SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */
74#ifdef HAVE_NS
75#if defined NS_IMPL_GNUSTEP
76# define SYSTEM_PURESIZE_EXTRA 30000
77#elif defined DARWIN_OS
78# define SYSTEM_PURESIZE_EXTRA 200000
79#endif
80#endif
81
82#ifdef emacs /* Don't do this for lib-src. */
83/* Tell regex.c to use a type compatible with Emacs. */
84#define RE_TRANSLATE_TYPE Lisp_Object
85#define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C)
86#ifdef make_number
87/* If make_number is a macro, use it. */
88#define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0)))
89#else
90/* If make_number is a function, avoid it. */
91#define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0))
92#endif
93#endif
94
95#include <string.h>
96#include <stdlib.h>
97
98#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */
99#define NO_INLINE __attribute__((noinline))
100#else
101#define NO_INLINE
102#endif
103
104#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
105#define EXTERNALLY_VISIBLE __attribute__((externally_visible))
106#else
107#define EXTERNALLY_VISIBLE
108#endif
109
110#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
111# define ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
112#else
113# define ATTRIBUTE_FORMAT(spec) /* empty */
114#endif
115
116#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
117# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
118 ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
119#else
120# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
121 ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
122#endif
123
124#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
125
126/* Some versions of GNU/Linux define noinline in their headers. */
127#ifdef noinline
128#undef noinline
129#endif
130
131/* conf_post.h ends here */
diff --git a/src/data.c b/src/data.c
index b23bcbe15b3..fd873b22d4d 100644
--- a/src/data.c
+++ b/src/data.c
@@ -928,7 +928,7 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva
928 Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype; 928 Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype;
929 929
930 if (!(NILP (type) || NILP (newval) 930 if (!(NILP (type) || NILP (newval)
931 || (XINT (type) == LISP_INT_TAG 931 || (XINT (type) == Lisp_Int0
932 ? INTEGERP (newval) 932 ? INTEGERP (newval)
933 : XTYPE (newval) == XINT (type)))) 933 : XTYPE (newval) == XINT (type))))
934 buffer_slot_type_mismatch (newval, XINT (type)); 934 buffer_slot_type_mismatch (newval, XINT (type));
@@ -2522,7 +2522,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args)
2522 ptrdiff_t ok_args; 2522 ptrdiff_t ok_args;
2523 EMACS_INT ok_accum; 2523 EMACS_INT ok_accum;
2524 2524
2525 switch (SWITCH_ENUM_CAST (code)) 2525 switch (code)
2526 { 2526 {
2527 case Alogior: 2527 case Alogior:
2528 case Alogxor: 2528 case Alogxor:
@@ -2557,7 +2557,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args)
2557 nargs, args); 2557 nargs, args);
2558 args[argnum] = val; 2558 args[argnum] = val;
2559 next = XINT (args[argnum]); 2559 next = XINT (args[argnum]);
2560 switch (SWITCH_ENUM_CAST (code)) 2560 switch (code)
2561 { 2561 {
2562 case Aadd: 2562 case Aadd:
2563 if (INT_ADD_OVERFLOW (accum, next)) 2563 if (INT_ADD_OVERFLOW (accum, next))
@@ -2643,7 +2643,7 @@ float_arith_driver (double accum, ptrdiff_t argnum, enum arithop code,
2643 args[argnum] = val; /* runs into a compiler bug. */ 2643 args[argnum] = val; /* runs into a compiler bug. */
2644 next = XINT (args[argnum]); 2644 next = XINT (args[argnum]);
2645 } 2645 }
2646 switch (SWITCH_ENUM_CAST (code)) 2646 switch (code)
2647 { 2647 {
2648 case Aadd: 2648 case Aadd:
2649 accum += next; 2649 accum += next;
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 86013d92c07..c1b1310454c 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -261,6 +261,7 @@ xd_symbol_to_dbus_type (Lisp_Object object)
261 261
262#define XD_DBUS_VALIDATE_BUS_ADDRESS(bus) \ 262#define XD_DBUS_VALIDATE_BUS_ADDRESS(bus) \
263 do { \ 263 do { \
264 char const *session_bus_address = getenv ("DBUS_SESSION_BUS_ADDRESS"); \
264 if (STRINGP (bus)) \ 265 if (STRINGP (bus)) \
265 { \ 266 { \
266 DBusAddressEntry **entries; \ 267 DBusAddressEntry **entries; \
@@ -272,6 +273,11 @@ xd_symbol_to_dbus_type (Lisp_Object object)
272 /* Cleanup. */ \ 273 /* Cleanup. */ \
273 dbus_error_free (&derror); \ 274 dbus_error_free (&derror); \
274 dbus_address_entries_free (entries); \ 275 dbus_address_entries_free (entries); \
276 /* Canonicalize session bus address. */ \
277 if ((session_bus_address != NULL) \
278 && (!NILP (Fstring_equal \
279 (bus, build_string (session_bus_address))))) \
280 bus = QCdbus_session_bus; \
275 } \ 281 } \
276 \ 282 \
277 else \ 283 else \
@@ -280,8 +286,7 @@ xd_symbol_to_dbus_type (Lisp_Object object)
280 if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus))) \ 286 if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus))) \
281 XD_SIGNAL2 (build_string ("Wrong bus name"), bus); \ 287 XD_SIGNAL2 (build_string ("Wrong bus name"), bus); \
282 /* We do not want to have an autolaunch for the session bus. */ \ 288 /* We do not want to have an autolaunch for the session bus. */ \
283 if (EQ (bus, QCdbus_session_bus) \ 289 if (EQ (bus, QCdbus_session_bus) && session_bus_address == NULL) \
284 && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL) \
285 XD_SIGNAL2 (build_string ("No connection to bus"), bus); \ 290 XD_SIGNAL2 (build_string ("No connection to bus"), bus); \
286 } \ 291 } \
287 } while (0) 292 } while (0)
@@ -981,7 +986,7 @@ static int
981xd_find_watch_fd (DBusWatch *watch) 986xd_find_watch_fd (DBusWatch *watch)
982{ 987{
983#if HAVE_DBUS_WATCH_GET_UNIX_FD 988#if HAVE_DBUS_WATCH_GET_UNIX_FD
984 /* TODO: Reverse these on Win32, which prefers the opposite. */ 989 /* TODO: Reverse these on w32, which prefers the opposite. */
985 int fd = dbus_watch_get_unix_fd (watch); 990 int fd = dbus_watch_get_unix_fd (watch);
986 if (fd == -1) 991 if (fd == -1)
987 fd = dbus_watch_get_socket (watch); 992 fd = dbus_watch_get_socket (watch);
@@ -1071,19 +1076,19 @@ xd_close_bus (Lisp_Object bus)
1071 /* Retrieve bus address. */ 1076 /* Retrieve bus address. */
1072 connection = xd_get_connection_address (bus); 1077 connection = xd_get_connection_address (bus);
1073 1078
1074 /* Close connection, if there isn't another shared application. */
1075 if (xd_get_connection_references (connection) == 1) 1079 if (xd_get_connection_references (connection) == 1)
1076 { 1080 {
1081 /* Close connection, if there isn't another shared application. */
1077 XD_DEBUG_MESSAGE ("Close connection to bus %s", 1082 XD_DEBUG_MESSAGE ("Close connection to bus %s",
1078 XD_OBJECT_TO_STRING (bus)); 1083 XD_OBJECT_TO_STRING (bus));
1079 dbus_connection_close (connection); 1084 dbus_connection_close (connection);
1080 }
1081 1085
1082 /* Decrement reference count. */ 1086 xd_registered_buses = Fdelete (val, xd_registered_buses);
1083 dbus_connection_unref (connection); 1087 }
1084 1088
1085 /* Remove bus from list of registered buses. */ 1089 else
1086 xd_registered_buses = Fdelete (val, xd_registered_buses); 1090 /* Decrement reference count. */
1091 dbus_connection_unref (connection);
1087 1092
1088 /* Return. */ 1093 /* Return. */
1089 return; 1094 return;
@@ -1124,65 +1129,76 @@ this connection to those buses. */)
1124 /* Close bus if it is already open. */ 1129 /* Close bus if it is already open. */
1125 xd_close_bus (bus); 1130 xd_close_bus (bus);
1126 1131
1127 /* Initialize. */ 1132 /* Check, whether we are still connected. */
1128 dbus_error_init (&derror); 1133 val = Fassoc (bus, xd_registered_buses);
1129 1134 if (!NILP (val))
1130 /* Open the connection. */ 1135 {
1131 if (STRINGP (bus)) 1136 connection = xd_get_connection_address (bus);
1132 if (NILP (private)) 1137 dbus_connection_ref (connection);
1133 connection = dbus_connection_open (SSDATA (bus), &derror); 1138 }
1134 else
1135 connection = dbus_connection_open_private (SSDATA (bus), &derror);
1136 1139
1137 else 1140 else
1138 if (NILP (private)) 1141 {
1139 connection = dbus_bus_get (EQ (bus, QCdbus_system_bus) 1142 /* Initialize. */
1140 ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, 1143 dbus_error_init (&derror);
1141 &derror);
1142 else
1143 connection = dbus_bus_get_private (EQ (bus, QCdbus_system_bus)
1144 ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION,
1145 &derror);
1146
1147 if (dbus_error_is_set (&derror))
1148 XD_ERROR (derror);
1149
1150 if (connection == NULL)
1151 XD_SIGNAL2 (build_string ("No connection to bus"), bus);
1152 1144
1153 /* If it is not the system or session bus, we must register 1145 /* Open the connection. */
1154 ourselves. Otherwise, we have called dbus_bus_get, which has 1146 if (STRINGP (bus))
1155 configured us to exit if the connection closes - we undo this 1147 if (NILP (private))
1156 setting. */ 1148 connection = dbus_connection_open (SSDATA (bus), &derror);
1157 if (STRINGP (bus)) 1149 else
1158 dbus_bus_register (connection, &derror); 1150 connection = dbus_connection_open_private (SSDATA (bus), &derror);
1159 else
1160 dbus_connection_set_exit_on_disconnect (connection, FALSE);
1161
1162 if (dbus_error_is_set (&derror))
1163 XD_ERROR (derror);
1164
1165 /* Add the watch functions. We pass also the bus as data, in order
1166 to distinguish between the buses in xd_remove_watch. */
1167 if (!dbus_connection_set_watch_functions (connection,
1168 xd_add_watch,
1169 xd_remove_watch,
1170 xd_toggle_watch,
1171 SYMBOLP (bus)
1172 ? (void *) XSYMBOL (bus)
1173 : (void *) XSTRING (bus),
1174 NULL))
1175 XD_SIGNAL1 (build_string ("Cannot add watch functions"));
1176
1177 /* Add bus to list of registered buses. */
1178 XSETFASTINT (val, (intptr_t) connection);
1179 xd_registered_buses = Fcons (Fcons (bus, val), xd_registered_buses);
1180
1181 /* We do not want to abort. */
1182 putenv ((char *) "DBUS_FATAL_WARNINGS=0");
1183 1151
1184 /* Cleanup. */ 1152 else
1185 dbus_error_free (&derror); 1153 if (NILP (private))
1154 connection = dbus_bus_get (EQ (bus, QCdbus_system_bus)
1155 ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION,
1156 &derror);
1157 else
1158 connection = dbus_bus_get_private (EQ (bus, QCdbus_system_bus)
1159 ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION,
1160 &derror);
1161
1162 if (dbus_error_is_set (&derror))
1163 XD_ERROR (derror);
1164
1165 if (connection == NULL)
1166 XD_SIGNAL2 (build_string ("No connection to bus"), bus);
1167
1168 /* If it is not the system or session bus, we must register
1169 ourselves. Otherwise, we have called dbus_bus_get, which has
1170 configured us to exit if the connection closes - we undo this
1171 setting. */
1172 if (STRINGP (bus))
1173 dbus_bus_register (connection, &derror);
1174 else
1175 dbus_connection_set_exit_on_disconnect (connection, FALSE);
1176
1177 if (dbus_error_is_set (&derror))
1178 XD_ERROR (derror);
1179
1180 /* Add the watch functions. We pass also the bus as data, in
1181 order to distinguish between the buses in xd_remove_watch. */
1182 if (!dbus_connection_set_watch_functions (connection,
1183 xd_add_watch,
1184 xd_remove_watch,
1185 xd_toggle_watch,
1186 SYMBOLP (bus)
1187 ? (void *) XSYMBOL (bus)
1188 : (void *) XSTRING (bus),
1189 NULL))
1190 XD_SIGNAL1 (build_string ("Cannot add watch functions"));
1191
1192 /* Add bus to list of registered buses. */
1193 XSETFASTINT (val, (intptr_t) connection);
1194 xd_registered_buses = Fcons (Fcons (bus, val), xd_registered_buses);
1195
1196 /* We do not want to abort. */
1197 putenv ((char *) "DBUS_FATAL_WARNINGS=0");
1198
1199 /* Cleanup. */
1200 dbus_error_free (&derror);
1201 }
1186 1202
1187 /* Return reference counter. */ 1203 /* Return reference counter. */
1188 refcount = xd_get_connection_references (connection); 1204 refcount = xd_get_connection_references (connection);
diff --git a/src/eval.c b/src/eval.c
index a0a05ebf0dc..e6cd4e8dc27 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2094,7 +2094,7 @@ eval_sub (Lisp_Object form)
2094 args_left = original_args; 2094 args_left = original_args;
2095 numargs = Flength (args_left); 2095 numargs = Flength (args_left);
2096 2096
2097 CHECK_CONS_LIST (); 2097 check_cons_list ();
2098 2098
2099 if (XINT (numargs) < XSUBR (fun)->min_args 2099 if (XINT (numargs) < XSUBR (fun)->min_args
2100 || (XSUBR (fun)->max_args >= 0 2100 || (XSUBR (fun)->max_args >= 0
@@ -2222,7 +2222,7 @@ eval_sub (Lisp_Object form)
2222 else 2222 else
2223 xsignal1 (Qinvalid_function, original_fun); 2223 xsignal1 (Qinvalid_function, original_fun);
2224 } 2224 }
2225 CHECK_CONS_LIST (); 2225 check_cons_list ();
2226 2226
2227 lisp_eval_depth--; 2227 lisp_eval_depth--;
2228 if (backtrace.debug_on_exit) 2228 if (backtrace.debug_on_exit)
@@ -2762,7 +2762,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2762 if (debug_on_next_call) 2762 if (debug_on_next_call)
2763 do_debug_on_call (Qlambda); 2763 do_debug_on_call (Qlambda);
2764 2764
2765 CHECK_CONS_LIST (); 2765 check_cons_list ();
2766 2766
2767 original_fun = args[0]; 2767 original_fun = args[0];
2768 2768
@@ -2871,13 +2871,13 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2871 else if (EQ (funcar, Qautoload)) 2871 else if (EQ (funcar, Qautoload))
2872 { 2872 {
2873 Fautoload_do_load (fun, original_fun, Qnil); 2873 Fautoload_do_load (fun, original_fun, Qnil);
2874 CHECK_CONS_LIST (); 2874 check_cons_list ();
2875 goto retry; 2875 goto retry;
2876 } 2876 }
2877 else 2877 else
2878 xsignal1 (Qinvalid_function, original_fun); 2878 xsignal1 (Qinvalid_function, original_fun);
2879 } 2879 }
2880 CHECK_CONS_LIST (); 2880 check_cons_list ();
2881 lisp_eval_depth--; 2881 lisp_eval_depth--;
2882 if (backtrace.debug_on_exit) 2882 if (backtrace.debug_on_exit)
2883 val = call_debugger (Fcons (Qexit, Fcons (val, Qnil))); 2883 val = call_debugger (Fcons (Qexit, Fcons (val, Qnil)));
diff --git a/src/insdel.c b/src/insdel.c
index 2074916cfde..9646507bc4b 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -59,14 +59,10 @@ static Lisp_Object combine_after_change_buffer;
59Lisp_Object Qinhibit_modification_hooks; 59Lisp_Object Qinhibit_modification_hooks;
60 60
61static void signal_before_change (ptrdiff_t, ptrdiff_t, ptrdiff_t *); 61static void signal_before_change (ptrdiff_t, ptrdiff_t, ptrdiff_t *);
62 62
63#define CHECK_MARKERS() \ 63/* Also used in marker.c to enable expensive marker checks. */
64 do \ 64
65 { \ 65#ifdef MARKER_DEBUG
66 if (check_markers_debug_flag) \
67 check_markers (); \
68 } \
69 while (0)
70 66
71static void 67static void
72check_markers (void) 68check_markers (void)
@@ -86,7 +82,13 @@ check_markers (void)
86 abort (); 82 abort ();
87 } 83 }
88} 84}
89 85
86#else /* not MARKER_DEBUG */
87
88#define check_markers() do { } while (0)
89
90#endif /* MARKER_DEBUG */
91
90/* Move gap to position CHARPOS. 92/* Move gap to position CHARPOS.
91 Note that this can quit! */ 93 Note that this can quit! */
92 94
@@ -158,8 +160,7 @@ gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, int newgap)
158 was specified or may be where a quit was detected. */ 160 was specified or may be where a quit was detected. */
159 GPT_BYTE = bytepos; 161 GPT_BYTE = bytepos;
160 GPT = charpos; 162 GPT = charpos;
161 if (bytepos < charpos) 163 eassert (charpos <= bytepos);
162 abort ();
163 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ 164 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
164 QUIT; 165 QUIT;
165} 166}
@@ -209,8 +210,7 @@ gap_right (ptrdiff_t charpos, ptrdiff_t bytepos)
209 210
210 GPT = charpos; 211 GPT = charpos;
211 GPT_BYTE = bytepos; 212 GPT_BYTE = bytepos;
212 if (bytepos < charpos) 213 eassert (charpos <= bytepos);
213 abort ();
214 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ 214 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
215 QUIT; 215 QUIT;
216} 216}
@@ -233,9 +233,7 @@ adjust_markers_for_delete (ptrdiff_t from, ptrdiff_t from_byte,
233 for (m = BUF_MARKERS (current_buffer); m; m = m->next) 233 for (m = BUF_MARKERS (current_buffer); m; m = m->next)
234 { 234 {
235 charpos = m->charpos; 235 charpos = m->charpos;
236 236 eassert (charpos <= Z);
237 if (charpos > Z)
238 abort ();
239 237
240 /* If the marker is after the deletion, 238 /* If the marker is after the deletion,
241 relocate by number of chars / bytes deleted. */ 239 relocate by number of chars / bytes deleted. */
@@ -375,7 +373,7 @@ adjust_markers_for_replace (ptrdiff_t from, ptrdiff_t from_byte,
375 } 373 }
376 } 374 }
377 375
378 CHECK_MARKERS (); 376 check_markers ();
379} 377}
380 378
381 379
@@ -835,8 +833,7 @@ insert_1_both (const char *string,
835 Z_BYTE += nbytes; 833 Z_BYTE += nbytes;
836 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ 834 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
837 835
838 if (GPT_BYTE < GPT) 836 eassert (GPT <= GPT_BYTE);
839 abort ();
840 837
841 /* The insert may have been in the unchanged region, so check again. */ 838 /* The insert may have been in the unchanged region, so check again. */
842 if (Z - GPT < END_UNCHANGED) 839 if (Z - GPT < END_UNCHANGED)
@@ -856,7 +853,7 @@ insert_1_both (const char *string,
856 853
857 adjust_point (nchars, nbytes); 854 adjust_point (nchars, nbytes);
858 855
859 CHECK_MARKERS (); 856 check_markers ();
860} 857}
861 858
862/* Insert the part of the text of STRING, a Lisp object assumed to be 859/* Insert the part of the text of STRING, a Lisp object assumed to be
@@ -966,8 +963,7 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
966 Z_BYTE += outgoing_nbytes; 963 Z_BYTE += outgoing_nbytes;
967 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ 964 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
968 965
969 if (GPT_BYTE < GPT) 966 eassert (GPT <= GPT_BYTE);
970 abort ();
971 967
972 /* The insert may have been in the unchanged region, so check again. */ 968 /* The insert may have been in the unchanged region, so check again. */
973 if (Z - GPT < END_UNCHANGED) 969 if (Z - GPT < END_UNCHANGED)
@@ -991,7 +987,7 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
991 987
992 adjust_point (nchars, outgoing_nbytes); 988 adjust_point (nchars, outgoing_nbytes);
993 989
994 CHECK_MARKERS (); 990 check_markers ();
995} 991}
996 992
997/* Insert a sequence of NCHARS chars which occupy NBYTES bytes 993/* Insert a sequence of NCHARS chars which occupy NBYTES bytes
@@ -1015,8 +1011,7 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes)
1015 Z_BYTE += nbytes; 1011 Z_BYTE += nbytes;
1016 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ 1012 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
1017 1013
1018 if (GPT_BYTE < GPT) 1014 eassert (GPT <= GPT_BYTE);
1019 abort ();
1020 1015
1021 adjust_overlays_for_insert (GPT - nchars, nchars); 1016 adjust_overlays_for_insert (GPT - nchars, nchars);
1022 adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes, 1017 adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes,
@@ -1032,7 +1027,7 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes)
1032 if (GPT - nchars < PT) 1027 if (GPT - nchars < PT)
1033 adjust_point (nchars, nbytes); 1028 adjust_point (nchars, nbytes);
1034 1029
1035 CHECK_MARKERS (); 1030 check_markers ();
1036} 1031}
1037 1032
1038/* Insert text from BUF, NCHARS characters starting at CHARPOS, into the 1033/* Insert text from BUF, NCHARS characters starting at CHARPOS, into the
@@ -1151,8 +1146,7 @@ insert_from_buffer_1 (struct buffer *buf,
1151 Z_BYTE += outgoing_nbytes; 1146 Z_BYTE += outgoing_nbytes;
1152 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ 1147 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
1153 1148
1154 if (GPT_BYTE < GPT) 1149 eassert (GPT <= GPT_BYTE);
1155 abort ();
1156 1150
1157 /* The insert may have been in the unchanged region, so check again. */ 1151 /* The insert may have been in the unchanged region, so check again. */
1158 if (Z - GPT < END_UNCHANGED) 1152 if (Z - GPT < END_UNCHANGED)
@@ -1243,7 +1237,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte,
1243 if (Z - GPT < END_UNCHANGED) 1237 if (Z - GPT < END_UNCHANGED)
1244 END_UNCHANGED = Z - GPT; 1238 END_UNCHANGED = Z - GPT;
1245 1239
1246 CHECK_MARKERS (); 1240 check_markers ();
1247 1241
1248 if (len == 0) 1242 if (len == 0)
1249 evaporate_overlays (from); 1243 evaporate_overlays (from);
@@ -1296,7 +1290,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
1296 ptrdiff_t outgoing_insbytes = insbytes; 1290 ptrdiff_t outgoing_insbytes = insbytes;
1297 Lisp_Object deletion; 1291 Lisp_Object deletion;
1298 1292
1299 CHECK_MARKERS (); 1293 check_markers ();
1300 1294
1301 GCPRO1 (new); 1295 GCPRO1 (new);
1302 deletion = Qnil; 1296 deletion = Qnil;
@@ -1357,8 +1351,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
1357 GPT_BYTE = from_byte; 1351 GPT_BYTE = from_byte;
1358 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ 1352 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
1359 1353
1360 if (GPT_BYTE < GPT) 1354 eassert (GPT <= GPT_BYTE);
1361 abort ();
1362 1355
1363 if (GPT - BEG < BEG_UNCHANGED) 1356 if (GPT - BEG < BEG_UNCHANGED)
1364 BEG_UNCHANGED = GPT - BEG; 1357 BEG_UNCHANGED = GPT - BEG;
@@ -1404,8 +1397,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
1404 Z_BYTE += outgoing_insbytes; 1397 Z_BYTE += outgoing_insbytes;
1405 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ 1398 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
1406 1399
1407 if (GPT_BYTE < GPT) 1400 eassert (GPT <= GPT_BYTE);
1408 abort ();
1409 1401
1410 /* Adjust the overlay center as needed. This must be done after 1402 /* Adjust the overlay center as needed. This must be done after
1411 adjusting the markers that bound the overlays. */ 1403 adjusting the markers that bound the overlays. */
@@ -1435,7 +1427,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
1435 if (outgoing_insbytes == 0) 1427 if (outgoing_insbytes == 0)
1436 evaporate_overlays (from); 1428 evaporate_overlays (from);
1437 1429
1438 CHECK_MARKERS (); 1430 check_markers ();
1439 1431
1440 MODIFF++; 1432 MODIFF++;
1441 CHARS_MODIFF = MODIFF; 1433 CHARS_MODIFF = MODIFF;
@@ -1465,7 +1457,7 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
1465{ 1457{
1466 ptrdiff_t nbytes_del, nchars_del; 1458 ptrdiff_t nbytes_del, nchars_del;
1467 1459
1468 CHECK_MARKERS (); 1460 check_markers ();
1469 1461
1470 nchars_del = to - from; 1462 nchars_del = to - from;
1471 nbytes_del = to_byte - from_byte; 1463 nbytes_del = to_byte - from_byte;
@@ -1488,8 +1480,7 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
1488 GPT_BYTE = from_byte; 1480 GPT_BYTE = from_byte;
1489 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ 1481 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
1490 1482
1491 if (GPT_BYTE < GPT) 1483 eassert (GPT <= GPT_BYTE);
1492 abort ();
1493 1484
1494 if (GPT - BEG < BEG_UNCHANGED) 1485 if (GPT - BEG < BEG_UNCHANGED)
1495 BEG_UNCHANGED = GPT - BEG; 1486 BEG_UNCHANGED = GPT - BEG;
@@ -1522,8 +1513,7 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
1522 Z_BYTE += insbytes; 1513 Z_BYTE += insbytes;
1523 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ 1514 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
1524 1515
1525 if (GPT_BYTE < GPT) 1516 eassert (GPT <= GPT_BYTE);
1526 abort ();
1527 1517
1528 /* Adjust the overlay center as needed. This must be done after 1518 /* Adjust the overlay center as needed. This must be done after
1529 adjusting the markers that bound the overlays. */ 1519 adjusting the markers that bound the overlays. */
@@ -1554,7 +1544,7 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
1554 if (insbytes == 0) 1544 if (insbytes == 0)
1555 evaporate_overlays (from); 1545 evaporate_overlays (from);
1556 1546
1557 CHECK_MARKERS (); 1547 check_markers ();
1558 1548
1559 MODIFF++; 1549 MODIFF++;
1560 CHARS_MODIFF = MODIFF; 1550 CHARS_MODIFF = MODIFF;
@@ -1705,7 +1695,7 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
1705 register ptrdiff_t nbytes_del, nchars_del; 1695 register ptrdiff_t nbytes_del, nchars_del;
1706 Lisp_Object deletion; 1696 Lisp_Object deletion;
1707 1697
1708 CHECK_MARKERS (); 1698 check_markers ();
1709 1699
1710 nchars_del = to - from; 1700 nchars_del = to - from;
1711 nbytes_del = to_byte - from_byte; 1701 nbytes_del = to_byte - from_byte;
@@ -1761,15 +1751,14 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
1761 needs to access the previous gap contents. */ 1751 needs to access the previous gap contents. */
1762 *(GPT_ADDR) = 0; 1752 *(GPT_ADDR) = 0;
1763 1753
1764 if (GPT_BYTE < GPT) 1754 eassert (GPT <= GPT_BYTE);
1765 abort ();
1766 1755
1767 if (GPT - BEG < BEG_UNCHANGED) 1756 if (GPT - BEG < BEG_UNCHANGED)
1768 BEG_UNCHANGED = GPT - BEG; 1757 BEG_UNCHANGED = GPT - BEG;
1769 if (Z - GPT < END_UNCHANGED) 1758 if (Z - GPT < END_UNCHANGED)
1770 END_UNCHANGED = Z - GPT; 1759 END_UNCHANGED = Z - GPT;
1771 1760
1772 CHECK_MARKERS (); 1761 check_markers ();
1773 1762
1774 evaporate_overlays (from); 1763 evaporate_overlays (from);
1775 1764
@@ -2201,9 +2190,6 @@ syms_of_insdel (void)
2201 combine_after_change_list = Qnil; 2190 combine_after_change_list = Qnil;
2202 combine_after_change_buffer = Qnil; 2191 combine_after_change_buffer = Qnil;
2203 2192
2204 DEFVAR_BOOL ("check-markers-debug-flag", check_markers_debug_flag,
2205 doc: /* Non-nil means enable debugging checks for invalid marker positions. */);
2206 check_markers_debug_flag = 0;
2207 DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls, 2193 DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls,
2208 doc: /* Used internally by the `combine-after-change-calls' macro. */); 2194 doc: /* Used internally by the `combine-after-change-calls' macro. */);
2209 Vcombine_after_change_calls = Qnil; 2195 Vcombine_after_change_calls = Qnil;
diff --git a/src/keyboard.c b/src/keyboard.c
index bfbfdf2b984..3b30f4c1b2d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2188,14 +2188,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object,
2188 if (!NILP (help) && !STRINGP (help)) 2188 if (!NILP (help) && !STRINGP (help))
2189 { 2189 {
2190 if (FUNCTIONP (help)) 2190 if (FUNCTIONP (help))
2191 { 2191 help = safe_call (4, help, window, object, pos);
2192 Lisp_Object args[4];
2193 args[0] = help;
2194 args[1] = window;
2195 args[2] = object;
2196 args[3] = pos;
2197 help = safe_call (4, args);
2198 }
2199 else 2192 else
2200 help = safe_eval (help); 2193 help = safe_eval (help);
2201 2194
@@ -5336,7 +5329,7 @@ make_lispy_event (struct input_event *event)
5336{ 5329{
5337 int i; 5330 int i;
5338 5331
5339 switch (SWITCH_ENUM_CAST (event->kind)) 5332 switch (event->kind)
5340 { 5333 {
5341 /* A simple keystroke. */ 5334 /* A simple keystroke. */
5342 case ASCII_KEYSTROKE_EVENT: 5335 case ASCII_KEYSTROKE_EVENT:
diff --git a/src/keymap.c b/src/keymap.c
index feaf0cfd961..3c5d45b0680 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2141,7 +2141,7 @@ The `kbd' macro is an approximate inverse of this. */)
2141 continue; 2141 continue;
2142 } 2142 }
2143 else 2143 else
2144 XSETINT (key, (XINT (key) | meta_modifier) & ~0x80); 2144 XSETINT (key, XINT (key) | meta_modifier);
2145 add_meta = 0; 2145 add_meta = 0;
2146 } 2146 }
2147 else if (EQ (key, meta_prefix_char)) 2147 else if (EQ (key, meta_prefix_char))
@@ -3702,13 +3702,12 @@ syms_of_keymap (void)
3702 Fset (intern_c_string ("ctl-x-map"), control_x_map); 3702 Fset (intern_c_string ("ctl-x-map"), control_x_map);
3703 Ffset (intern_c_string ("Control-X-prefix"), control_x_map); 3703 Ffset (intern_c_string ("Control-X-prefix"), control_x_map);
3704 3704
3705 exclude_keys 3705 exclude_keys = listn (CONSTYPE_PURE, 5,
3706 = pure_cons (pure_cons (build_pure_c_string ("DEL"), build_pure_c_string ("\\d")), 3706 pure_cons (build_pure_c_string ("DEL"), build_pure_c_string ("\\d")),
3707 pure_cons (pure_cons (build_pure_c_string ("TAB"), build_pure_c_string ("\\t")), 3707 pure_cons (build_pure_c_string ("TAB"), build_pure_c_string ("\\t")),
3708 pure_cons (pure_cons (build_pure_c_string ("RET"), build_pure_c_string ("\\r")), 3708 pure_cons (build_pure_c_string ("RET"), build_pure_c_string ("\\r")),
3709 pure_cons (pure_cons (build_pure_c_string ("ESC"), build_pure_c_string ("\\e")), 3709 pure_cons (build_pure_c_string ("ESC"), build_pure_c_string ("\\e")),
3710 pure_cons (pure_cons (build_pure_c_string ("SPC"), build_pure_c_string (" ")), 3710 pure_cons (build_pure_c_string ("SPC"), build_pure_c_string (" ")));
3711 Qnil)))));
3712 staticpro (&exclude_keys); 3711 staticpro (&exclude_keys);
3713 3712
3714 DEFVAR_LISP ("define-key-rebound-commands", Vdefine_key_rebound_commands, 3713 DEFVAR_LISP ("define-key-rebound-commands", Vdefine_key_rebound_commands,
@@ -3761,16 +3760,16 @@ be preferred. */);
3761 where_is_preferred_modifier = 0; 3760 where_is_preferred_modifier = 0;
3762 3761
3763 staticpro (&Vmouse_events); 3762 staticpro (&Vmouse_events);
3764 Vmouse_events = pure_cons (intern_c_string ("menu-bar"), 3763 Vmouse_events = listn (CONSTYPE_PURE, 9,
3765 pure_cons (intern_c_string ("tool-bar"), 3764 intern_c_string ("menu-bar"),
3766 pure_cons (intern_c_string ("header-line"), 3765 intern_c_string ("tool-bar"),
3767 pure_cons (intern_c_string ("mode-line"), 3766 intern_c_string ("header-line"),
3768 pure_cons (intern_c_string ("mouse-1"), 3767 intern_c_string ("mode-line"),
3769 pure_cons (intern_c_string ("mouse-2"), 3768 intern_c_string ("mouse-1"),
3770 pure_cons (intern_c_string ("mouse-3"), 3769 intern_c_string ("mouse-2"),
3771 pure_cons (intern_c_string ("mouse-4"), 3770 intern_c_string ("mouse-3"),
3772 pure_cons (intern_c_string ("mouse-5"), 3771 intern_c_string ("mouse-4"),
3773 Qnil))))))))); 3772 intern_c_string ("mouse-5"));
3774 3773
3775 DEFSYM (Qsingle_key_description, "single-key-description"); 3774 DEFSYM (Qsingle_key_description, "single-key-description");
3776 DEFSYM (Qkey_description, "key-description"); 3775 DEFSYM (Qkey_description, "key-description");
diff --git a/src/lisp.h b/src/lisp.h
index e371e0a8049..3fe5cc911df 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -20,6 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20#ifndef EMACS_LISP_H 20#ifndef EMACS_LISP_H
21#define EMACS_LISP_H 21#define EMACS_LISP_H
22 22
23#include <stdalign.h>
23#include <stdarg.h> 24#include <stdarg.h>
24#include <stddef.h> 25#include <stddef.h>
25#include <inttypes.h> 26#include <inttypes.h>
@@ -27,19 +28,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27 28
28#include <intprops.h> 29#include <intprops.h>
29 30
30/* Use the configure flag --enable-checking[=LIST] to enable various 31/* The ubiquitous max and min macros. */
31 types of run time checks for Lisp objects. */ 32#undef min
32 33#undef max
33#ifdef GC_CHECK_CONS_LIST 34#define max(a, b) ((a) > (b) ? (a) : (b))
34extern void check_cons_list (void); 35#define min(a, b) ((a) < (b) ? (a) : (b))
35#define CHECK_CONS_LIST() check_cons_list ()
36#else
37#define CHECK_CONS_LIST() ((void) 0)
38#endif
39
40/* Temporarily disable wider-than-pointer integers until they're tested more.
41 Build with CFLAGS='-DWIDE_EMACS_INT' to try them out. */
42/* #undef WIDE_EMACS_INT */
43 36
44/* EMACS_INT - signed integer wide enough to hold an Emacs value 37/* EMACS_INT - signed integer wide enough to hold an Emacs value
45 EMACS_INT_MAX - maximum value of EMACS_INT; can be used in #if 38 EMACS_INT_MAX - maximum value of EMACS_INT; can be used in #if
@@ -64,12 +57,6 @@ typedef unsigned int EMACS_UINT;
64# endif 57# endif
65#endif 58#endif
66 59
67/* If an enum type is not used, the enum symbols are not put into the
68 executable so the debugger cannot see them on many systems, e.g.,
69 GCC 4.7.1 + GDB 7.4.1 + GNU/Linux. Work around this problem by
70 explicitly using the names in the integer constant expression EXPR. */
71#define PUBLISH_TO_GDB(expr) extern int (*gdb_dummy (int))[(expr) || 1]
72
73/* Number of bits in some machine integer types. */ 60/* Number of bits in some machine integer types. */
74enum 61enum
75 { 62 {
@@ -157,49 +144,46 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
157 on the few static Lisp_Objects used: all the defsubr as well 144 on the few static Lisp_Objects used: all the defsubr as well
158 as the two special buffers buffer_defaults and buffer_local_symbols. */ 145 as the two special buffers buffer_defaults and buffer_local_symbols. */
159 146
160/* First, try and define DECL_ALIGN(type,var) which declares a static 147enum Lisp_Bits
161 variable VAR of type TYPE with the added requirement that it be 148 {
162 TYPEBITS-aligned. */ 149 /* Number of bits in a Lisp_Object tag. This can be used in #if,
163 150 and for GDB's sake also as a regular symbol. */
164/* Number of bits in a Lisp_Object tag. This can be used in #if, 151 GCTYPEBITS =
165 and for GDB's sake also as a regular symbol. */
166enum { GCTYPEBITS = 3 };
167PUBLISH_TO_GDB (GCTYPEBITS);
168#define GCTYPEBITS 3 152#define GCTYPEBITS 3
153 GCTYPEBITS,
154
155 /* 2**GCTYPEBITS. This must also be a macro that expands to a
156 literal integer constant, for MSVC. */
157 GCALIGNMENT =
158#define GCALIGNMENT 8
159 GCALIGNMENT,
169 160
170/* Number of bits in a Lisp_Object value, not counting the tag. */ 161 /* Number of bits in a Lisp_Object value, not counting the tag. */
171enum { VALBITS = BITS_PER_EMACS_INT - GCTYPEBITS }; 162 VALBITS = BITS_PER_EMACS_INT - GCTYPEBITS,
163
164 /* Number of bits in a Lisp fixnum tag. */
165 INTTYPEBITS = GCTYPEBITS - 1,
166
167 /* Number of bits in a Lisp fixnum value, not counting the tag. */
168 FIXNUM_BITS = VALBITS + 1
169 };
170
171#if GCALIGNMENT != 1 << GCTYPEBITS
172# error "GCALIGNMENT and GCTYPEBITS are inconsistent"
173#endif
172 174
173/* The maximum value that can be stored in a EMACS_INT, assuming all 175/* The maximum value that can be stored in a EMACS_INT, assuming all
174 bits other than the type bits contribute to a nonnegative signed value. 176 bits other than the type bits contribute to a nonnegative signed value.
175 This can be used in #if, e.g., '#if VAL_MAX < UINTPTR_MAX' below. */ 177 This can be used in #if, e.g., '#if VAL_MAX < UINTPTR_MAX' below. */
176#define VAL_MAX (EMACS_INT_MAX >> (GCTYPEBITS - 1)) 178#define VAL_MAX (EMACS_INT_MAX >> (GCTYPEBITS - 1))
177 179
178#ifndef NO_DECL_ALIGN
179# ifndef DECL_ALIGN
180# if HAVE_ATTRIBUTE_ALIGNED
181# define DECL_ALIGN(type, var) \
182 type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var
183# elif defined(_MSC_VER)
184# define ALIGN_GCTYPEBITS 8
185# if (1 << GCTYPEBITS) != ALIGN_GCTYPEBITS
186# error ALIGN_GCTYPEBITS is wrong!
187# endif
188# define DECL_ALIGN(type, var) \
189 type __declspec(align(ALIGN_GCTYPEBITS)) var
190# else
191 /* What directives do other compilers use? */
192# endif
193# endif
194#endif
195
196/* Unless otherwise specified, use USE_LSB_TAG on systems where: */ 180/* Unless otherwise specified, use USE_LSB_TAG on systems where: */
197#ifndef USE_LSB_TAG 181#ifndef USE_LSB_TAG
198/* 1. We know malloc returns a multiple of 8. */ 182/* 1. We know malloc returns a multiple of 8. */
199# if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \ 183# if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \
200 || defined DARWIN_OS || defined __sun) 184 || defined DARWIN_OS || defined __sun)
201/* 2. We can specify multiple-of-8 alignment on static variables. */ 185/* 2. We can specify multiple-of-8 alignment on static variables. */
202# ifdef DECL_ALIGN 186# ifdef alignas
203/* 3. Pointers-as-ints exceed VAL_MAX. 187/* 3. Pointers-as-ints exceed VAL_MAX.
204 On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is: 188 On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is:
205 a. unnecessary, because the top bits of an EMACS_INT are unused, and 189 a. unnecessary, because the top bits of an EMACS_INT are unused, and
@@ -211,25 +195,20 @@ enum { VALBITS = BITS_PER_EMACS_INT - GCTYPEBITS };
211# endif 195# endif
212# endif 196# endif
213#endif 197#endif
214/* USE_LSB_TAG can be used in #if; default it to 0 and make it visible
215 to GDB. */
216#ifdef USE_LSB_TAG 198#ifdef USE_LSB_TAG
217# undef USE_LSB_TAG 199# undef USE_LSB_TAG
218enum { USE_LSB_TAG = 1 }; 200enum enum_USE_LSB_TAG { USE_LSB_TAG = 1 };
219PUBLISH_TO_GDB (USE_LSB_TAG);
220# define USE_LSB_TAG 1 201# define USE_LSB_TAG 1
221#else 202#else
222enum { USE_LSB_TAG = 0 }; 203enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 };
223PUBLISH_TO_GDB (USE_LSB_TAG);
224# define USE_LSB_TAG 0 204# define USE_LSB_TAG 0
225#endif 205#endif
226 206
227/* If we cannot use 8-byte alignment, make DECL_ALIGN a no-op. */ 207#ifndef alignas
228#ifndef DECL_ALIGN 208# define alignas(alignment) /* empty */
229# if USE_LSB_TAG 209# if USE_LSB_TAG
230# error "USE_LSB_TAG used without defining DECL_ALIGN" 210# error "USE_LSB_TAG requires alignas"
231# endif 211# endif
232# define DECL_ALIGN(type, var) type var
233#endif 212#endif
234 213
235 214
@@ -239,14 +218,9 @@ PUBLISH_TO_GDB (USE_LSB_TAG);
239 218
240/* Lisp integers use 2 tags, to give them one extra bit, thus 219/* Lisp integers use 2 tags, to give them one extra bit, thus
241 extending their range from, e.g., -2^28..2^28-1 to -2^29..2^29-1. */ 220 extending their range from, e.g., -2^28..2^28-1 to -2^29..2^29-1. */
242enum { INTTYPEBITS = GCTYPEBITS - 1 }; 221static EMACS_INT const INTMASK = EMACS_INT_MAX >> (INTTYPEBITS - 1);
243enum { FIXNUM_BITS = VALBITS + 1 };
244#define INTMASK (EMACS_INT_MAX >> (INTTYPEBITS - 1))
245#define LISP_INT_TAG Lisp_Int0
246#define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 222#define case_Lisp_Int case Lisp_Int0: case Lisp_Int1
247#define LISP_INT1_TAG (USE_LSB_TAG ? 1 << INTTYPEBITS : 1) 223#define LISP_INT_TAG_P(x) (((x) & ~Lisp_Int1) == 0)
248#define LISP_STRING_TAG (5 - LISP_INT1_TAG)
249#define LISP_INT_TAG_P(x) (((x) & ~LISP_INT1_TAG) == 0)
250 224
251/* Stolen from GDB. The only known compiler that doesn't support 225/* Stolen from GDB. The only known compiler that doesn't support
252 enums in bitfields is MSVC. */ 226 enums in bitfields is MSVC. */
@@ -261,7 +235,7 @@ enum Lisp_Type
261 { 235 {
262 /* Integer. XINT (obj) is the integer value. */ 236 /* Integer. XINT (obj) is the integer value. */
263 Lisp_Int0 = 0, 237 Lisp_Int0 = 0,
264 Lisp_Int1 = LISP_INT1_TAG, 238 Lisp_Int1 = USE_LSB_TAG ? 1 << INTTYPEBITS : 1,
265 239
266 /* Symbol. XSYMBOL (object) points to a struct Lisp_Symbol. */ 240 /* Symbol. XSYMBOL (object) points to a struct Lisp_Symbol. */
267 Lisp_Symbol = 2, 241 Lisp_Symbol = 2,
@@ -272,7 +246,7 @@ enum Lisp_Type
272 246
273 /* String. XSTRING (object) points to a struct Lisp_String. 247 /* String. XSTRING (object) points to a struct Lisp_String.
274 The length of the string, and its contents, are stored therein. */ 248 The length of the string, and its contents, are stored therein. */
275 Lisp_String = LISP_STRING_TAG, 249 Lisp_String = USE_LSB_TAG ? 1 : 1 << INTTYPEBITS,
276 250
277 /* Vector of Lisp objects, or something resembling it. 251 /* Vector of Lisp objects, or something resembling it.
278 XVECTOR (object) points to a struct Lisp_Vector, which contains 252 XVECTOR (object) points to a struct Lisp_Vector, which contains
@@ -335,9 +309,9 @@ LISP_MAKE_RVALUE (Lisp_Object o)
335} 309}
336 310
337#define LISP_INITIALLY_ZERO {0} 311#define LISP_INITIALLY_ZERO {0}
338#undef CHECK_LISP_OBJECT_TYPE
339enum { CHECK_LISP_OBJECT_TYPE = 1 };
340 312
313#undef CHECK_LISP_OBJECT_TYPE
314enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 1 };
341#else /* CHECK_LISP_OBJECT_TYPE */ 315#else /* CHECK_LISP_OBJECT_TYPE */
342 316
343/* If a struct type is not wanted, define Lisp_Object as just a number. */ 317/* If a struct type is not wanted, define Lisp_Object as just a number. */
@@ -347,17 +321,16 @@ typedef EMACS_INT Lisp_Object;
347#define XIL(i) (i) 321#define XIL(i) (i)
348#define LISP_MAKE_RVALUE(o) (0+(o)) 322#define LISP_MAKE_RVALUE(o) (0+(o))
349#define LISP_INITIALLY_ZERO 0 323#define LISP_INITIALLY_ZERO 0
350enum { CHECK_LISP_OBJECT_TYPE = 0 }; 324enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 0 };
351#endif /* CHECK_LISP_OBJECT_TYPE */ 325#endif /* CHECK_LISP_OBJECT_TYPE */
352PUBLISH_TO_GDB (CHECK_LISP_OBJECT_TYPE);
353 326
354/* In the size word of a vector, this bit means the vector has been marked. */ 327/* In the size word of a vector, this bit means the vector has been marked. */
355 328
356#define ARRAY_MARK_FLAG PTRDIFF_MIN 329static ptrdiff_t const ARRAY_MARK_FLAG = PTRDIFF_MIN;
357 330
358/* In the size word of a struct Lisp_Vector, this bit means it's really 331/* In the size word of a struct Lisp_Vector, this bit means it's really
359 some other vector-like object. */ 332 some other vector-like object. */
360#define PSEUDOVECTOR_FLAG (PTRDIFF_MAX - PTRDIFF_MAX / 2) 333static ptrdiff_t const PSEUDOVECTOR_FLAG = PTRDIFF_MAX - PTRDIFF_MAX / 2;
361 334
362/* In a pseudovector, the size field actually contains a word with one 335/* In a pseudovector, the size field actually contains a word with one
363 PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to 336 PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to
@@ -394,35 +367,32 @@ enum pvec_type
394 PVEC_SUB_CHAR_TABLE = 0x30, 367 PVEC_SUB_CHAR_TABLE = 0x30,
395 PVEC_FONT = 0x40 368 PVEC_FONT = 0x40
396}; 369};
397PUBLISH_TO_GDB ((enum pvec_type) 0); /* This also publishes PVEC_*. */
398 370
399/* For convenience, we also store the number of elements in these bits. 371/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
400 Note that this size is not necessarily the memory-footprint size, but 372 which were stored in a Lisp_Object. */
401 only the number of Lisp_Object fields (that need to be traced by the GC). 373#ifndef DATA_SEG_BITS
402 The distinction is used e.g. by Lisp_Process which places extra 374# define DATA_SEG_BITS 0
403 non-Lisp_Object fields at the end of the structure. */ 375#endif
404enum 376enum { gdb_DATA_SEG_BITS = DATA_SEG_BITS };
377#undef DATA_SEG_BITS
378
379enum More_Lisp_Bits
405 { 380 {
381 DATA_SEG_BITS = gdb_DATA_SEG_BITS,
382
383 /* For convenience, we also store the number of elements in these bits.
384 Note that this size is not necessarily the memory-footprint size, but
385 only the number of Lisp_Object fields (that need to be traced by GC).
386 The distinction is used, e.g., by Lisp_Process, which places extra
387 non-Lisp_Object fields at the end of the structure. */
406 PSEUDOVECTOR_SIZE_BITS = 16, 388 PSEUDOVECTOR_SIZE_BITS = 16,
407 PSEUDOVECTOR_SIZE_MASK = (1 << PSEUDOVECTOR_SIZE_BITS) - 1, 389 PSEUDOVECTOR_SIZE_MASK = (1 << PSEUDOVECTOR_SIZE_BITS) - 1,
408 PVEC_TYPE_MASK = 0x0fff << PSEUDOVECTOR_SIZE_BITS 390 PVEC_TYPE_MASK = 0x0fff << PSEUDOVECTOR_SIZE_BITS,
409 };
410
411/* Number of bits to put in each character in the internal representation
412 of bool vectors. This should not vary across implementations. */
413enum { BOOL_VECTOR_BITS_PER_CHAR = 8 };
414 391
415/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers 392 /* Number of bits to put in each character in the internal representation
416 which were stored in a Lisp_Object. It is not needed in #if, so 393 of bool vectors. This should not vary across implementations. */
417 for GDB's sake change it from a macro to a regular symbol. */ 394 BOOL_VECTOR_BITS_PER_CHAR = 8
418#ifdef DATA_SEG_BITS 395 };
419enum { gdb_DATA_SEG_BITS = DATA_SEG_BITS };
420# undef DATA_SEG_BITS
421enum { DATA_SEG_BITS = gdb_DATA_SEG_BITS };
422#else
423enum { DATA_SEG_BITS = 0 };
424#endif
425PUBLISH_TO_GDB (DATA_SEG_BITS);
426 396
427/* These macros extract various sorts of values from a Lisp_Object. 397/* These macros extract various sorts of values from a Lisp_Object.
428 For example, if tem is a Lisp_Object whose type is Lisp_Cons, 398 For example, if tem is a Lisp_Object whose type is Lisp_Cons,
@@ -433,8 +403,11 @@ PUBLISH_TO_GDB (DATA_SEG_BITS);
433 403
434#if USE_LSB_TAG 404#if USE_LSB_TAG
435 405
436#define VALMASK (-1 << GCTYPEBITS) 406enum lsb_bits
437#define TYPEMASK ((1 << GCTYPEBITS) - 1) 407 {
408 TYPEMASK = (1 << GCTYPEBITS) - 1,
409 VALMASK = ~ TYPEMASK
410 };
438#define XTYPE(a) ((enum Lisp_Type) (XLI (a) & TYPEMASK)) 411#define XTYPE(a) ((enum Lisp_Type) (XLI (a) & TYPEMASK))
439#define XINT(a) (XLI (a) >> INTTYPEBITS) 412#define XINT(a) (XLI (a) >> INTTYPEBITS)
440#define XUINT(a) ((EMACS_UINT) XLI (a) >> INTTYPEBITS) 413#define XUINT(a) ((EMACS_UINT) XLI (a) >> INTTYPEBITS)
@@ -448,7 +421,7 @@ PUBLISH_TO_GDB (DATA_SEG_BITS);
448 421
449#else /* not USE_LSB_TAG */ 422#else /* not USE_LSB_TAG */
450 423
451#define VALMASK VAL_MAX 424static EMACS_INT const VALMASK = VAL_MAX;
452 425
453#define XTYPE(a) ((enum Lisp_Type) ((EMACS_UINT) XLI (a) >> VALBITS)) 426#define XTYPE(a) ((enum Lisp_Type) ((EMACS_UINT) XLI (a) >> VALBITS))
454 427
@@ -496,9 +469,14 @@ PUBLISH_TO_GDB (DATA_SEG_BITS);
496#define EQ(x, y) (XHASH (x) == XHASH (y)) 469#define EQ(x, y) (XHASH (x) == XHASH (y))
497 470
498/* Largest and smallest representable fixnum values. These are the C 471/* Largest and smallest representable fixnum values. These are the C
499 values. */ 472 values. They are macros for use in static initializers, and
473 constants for visibility to GDB. */
474static EMACS_INT const MOST_POSITIVE_FIXNUM =
500#define MOST_POSITIVE_FIXNUM (EMACS_INT_MAX >> INTTYPEBITS) 475#define MOST_POSITIVE_FIXNUM (EMACS_INT_MAX >> INTTYPEBITS)
476 MOST_POSITIVE_FIXNUM;
477static EMACS_INT const MOST_NEGATIVE_FIXNUM =
501#define MOST_NEGATIVE_FIXNUM (-1 - MOST_POSITIVE_FIXNUM) 478#define MOST_NEGATIVE_FIXNUM (-1 - MOST_POSITIVE_FIXNUM)
479 MOST_NEGATIVE_FIXNUM;
502 480
503/* Value is non-zero if I doesn't fit into a Lisp fixnum. It is 481/* Value is non-zero if I doesn't fit into a Lisp fixnum. It is
504 written this way so that it also works if I is of unsigned 482 written this way so that it also works if I is of unsigned
@@ -666,21 +644,12 @@ struct Lisp_Cons
666 { 644 {
667 /* Please do not use the names of these elements in code other 645 /* Please do not use the names of these elements in code other
668 than the core lisp implementation. Use XCAR and XCDR below. */ 646 than the core lisp implementation. Use XCAR and XCDR below. */
669#ifdef HIDE_LISP_IMPLEMENTATION
670 Lisp_Object car_;
671 union
672 {
673 Lisp_Object cdr_;
674 struct Lisp_Cons *chain;
675 } u;
676#else
677 Lisp_Object car; 647 Lisp_Object car;
678 union 648 union
679 { 649 {
680 Lisp_Object cdr; 650 Lisp_Object cdr;
681 struct Lisp_Cons *chain; 651 struct Lisp_Cons *chain;
682 } u; 652 } u;
683#endif
684 }; 653 };
685 654
686/* Take the car or cdr of something known to be a cons cell. */ 655/* Take the car or cdr of something known to be a cons cell. */
@@ -690,13 +659,8 @@ struct Lisp_Cons
690 fields are not accessible as lvalues. (What if we want to switch to 659 fields are not accessible as lvalues. (What if we want to switch to
691 a copying collector someday? Cached cons cell field addresses may be 660 a copying collector someday? Cached cons cell field addresses may be
692 invalidated at arbitrary points.) */ 661 invalidated at arbitrary points.) */
693#ifdef HIDE_LISP_IMPLEMENTATION
694#define XCAR_AS_LVALUE(c) (XCONS ((c))->car_)
695#define XCDR_AS_LVALUE(c) (XCONS ((c))->u.cdr_)
696#else
697#define XCAR_AS_LVALUE(c) (XCONS ((c))->car) 662#define XCAR_AS_LVALUE(c) (XCONS ((c))->car)
698#define XCDR_AS_LVALUE(c) (XCONS ((c))->u.cdr) 663#define XCDR_AS_LVALUE(c) (XCONS ((c))->u.cdr)
699#endif
700 664
701/* Use these from normal code. */ 665/* Use these from normal code. */
702#define XCAR(c) LISP_MAKE_RVALUE (XCAR_AS_LVALUE (c)) 666#define XCAR(c) LISP_MAKE_RVALUE (XCAR_AS_LVALUE (c))
@@ -757,10 +721,15 @@ extern ptrdiff_t string_bytes (struct Lisp_String *);
757 Although the actual size limit (see STRING_BYTES_MAX in alloc.c) 721 Although the actual size limit (see STRING_BYTES_MAX in alloc.c)
758 may be a bit smaller than STRING_BYTES_BOUND, calculating it here 722 may be a bit smaller than STRING_BYTES_BOUND, calculating it here
759 would expose alloc.c internal details that we'd rather keep 723 would expose alloc.c internal details that we'd rather keep
760 private. The cast to ptrdiff_t ensures that STRING_BYTES_BOUND is 724 private.
761 signed. */ 725
726 This is a macro for use in static initializers, and a constant for
727 visibility to GDB. The cast to ptrdiff_t ensures that
728 the macro is signed. */
729static ptrdiff_t const STRING_BYTES_BOUND =
762#define STRING_BYTES_BOUND \ 730#define STRING_BYTES_BOUND \
763 min (MOST_POSITIVE_FIXNUM, (ptrdiff_t) min (SIZE_MAX, PTRDIFF_MAX) - 1) 731 ((ptrdiff_t) min (MOST_POSITIVE_FIXNUM, min (SIZE_MAX, PTRDIFF_MAX) - 1))
732 STRING_BYTES_BOUND;
764 733
765/* Mark STR as a unibyte string. */ 734/* Mark STR as a unibyte string. */
766#define STRING_SET_UNIBYTE(STR) \ 735#define STRING_SET_UNIBYTE(STR) \
@@ -869,16 +838,6 @@ struct Lisp_Vector
869 of a char-table, and there's no way to access it directly from 838 of a char-table, and there's no way to access it directly from
870 Emacs Lisp program. */ 839 Emacs Lisp program. */
871 840
872/* This is the number of slots that every char table must have. This
873 counts the ordinary slots and the top, defalt, parent, and purpose
874 slots. */
875#define CHAR_TABLE_STANDARD_SLOTS (VECSIZE (struct Lisp_Char_Table) - 1)
876
877/* Return the number of "extra" slots in the char table CT. */
878
879#define CHAR_TABLE_EXTRA_SLOTS(CT) \
880 (((CT)->header.size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS)
881
882#ifdef __GNUC__ 841#ifdef __GNUC__
883 842
884#define CHAR_TABLE_REF_ASCII(CT, IDX) \ 843#define CHAR_TABLE_REF_ASCII(CT, IDX) \
@@ -940,10 +899,13 @@ struct Lisp_Vector
940 ? XSUB_CHAR_TABLE (XCHAR_TABLE (CT)->ascii)->contents[IDX] = VAL \ 899 ? XSUB_CHAR_TABLE (XCHAR_TABLE (CT)->ascii)->contents[IDX] = VAL \
941 : char_table_set (CT, IDX, VAL)) 900 : char_table_set (CT, IDX, VAL))
942 901
943#define CHARTAB_SIZE_BITS_0 6 902enum CHARTAB_SIZE_BITS
944#define CHARTAB_SIZE_BITS_1 4 903 {
945#define CHARTAB_SIZE_BITS_2 5 904 CHARTAB_SIZE_BITS_0 = 6,
946#define CHARTAB_SIZE_BITS_3 7 905 CHARTAB_SIZE_BITS_1 = 4,
906 CHARTAB_SIZE_BITS_2 = 5,
907 CHARTAB_SIZE_BITS_3 = 7
908 };
947 909
948extern const int chartab_size[4]; 910extern const int chartab_size[4];
949 911
@@ -1042,6 +1004,19 @@ struct Lisp_Subr
1042 const char *doc; 1004 const char *doc;
1043 }; 1005 };
1044 1006
1007/* This is the number of slots that every char table must have. This
1008 counts the ordinary slots and the top, defalt, parent, and purpose
1009 slots. */
1010enum CHAR_TABLE_STANDARD_SLOTS
1011 {
1012 CHAR_TABLE_STANDARD_SLOTS = VECSIZE (struct Lisp_Char_Table) - 1
1013 };
1014
1015/* Return the number of "extra" slots in the char table CT. */
1016
1017#define CHAR_TABLE_EXTRA_SLOTS(CT) \
1018 (((CT)->header.size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS)
1019
1045 1020
1046/*********************************************************************** 1021/***********************************************************************
1047 Symbols 1022 Symbols
@@ -1269,7 +1244,7 @@ struct Lisp_Hash_Table
1269 1244
1270/* Default size for hash tables if not specified. */ 1245/* Default size for hash tables if not specified. */
1271 1246
1272#define DEFAULT_HASH_SIZE 65 1247enum DEFAULT_HASH_SIZE { DEFAULT_HASH_SIZE = 65 };
1273 1248
1274/* Default threshold specifying when to resize a hash table. The 1249/* Default threshold specifying when to resize a hash table. The
1275 value gives the ratio of current entries in the hash table and the 1250 value gives the ratio of current entries in the hash table and the
@@ -1509,23 +1484,13 @@ struct Lisp_Float
1509 { 1484 {
1510 union 1485 union
1511 { 1486 {
1512#ifdef HIDE_LISP_IMPLEMENTATION
1513 double data_;
1514#else
1515 double data; 1487 double data;
1516#endif
1517 struct Lisp_Float *chain; 1488 struct Lisp_Float *chain;
1518 } u; 1489 } u;
1519 }; 1490 };
1520 1491
1521#ifdef HIDE_LISP_IMPLEMENTATION 1492#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data : XFLOAT (f)->u.data)
1522#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data_ : XFLOAT (f)->u.data_) 1493#define XFLOAT_INIT(f, n) (XFLOAT (f)->u.data = (n))
1523#else
1524#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data : XFLOAT (f)->u.data)
1525/* This should be used only in alloc.c, which always disables
1526 HIDE_LISP_IMPLEMENTATION. */
1527#define XFLOAT_INIT(f,n) (XFLOAT (f)->u.data = (n))
1528#endif
1529 1494
1530/* A character, declared with the following typedef, is a member 1495/* A character, declared with the following typedef, is a member
1531 of some character set associated with the current buffer. */ 1496 of some character set associated with the current buffer. */
@@ -1536,31 +1501,38 @@ typedef unsigned char UCHAR;
1536 1501
1537/* Meanings of slots in a Lisp_Compiled: */ 1502/* Meanings of slots in a Lisp_Compiled: */
1538 1503
1539#define COMPILED_ARGLIST 0 1504enum Lisp_Compiled
1540#define COMPILED_BYTECODE 1 1505 {
1541#define COMPILED_CONSTANTS 2 1506 COMPILED_ARGLIST = 0,
1542#define COMPILED_STACK_DEPTH 3 1507 COMPILED_BYTECODE = 1,
1543#define COMPILED_DOC_STRING 4 1508 COMPILED_CONSTANTS = 2,
1544#define COMPILED_INTERACTIVE 5 1509 COMPILED_STACK_DEPTH = 3,
1510 COMPILED_DOC_STRING = 4,
1511 COMPILED_INTERACTIVE = 5
1512 };
1545 1513
1546/* Flag bits in a character. These also get used in termhooks.h. 1514/* Flag bits in a character. These also get used in termhooks.h.
1547 Richard Stallman <rms@gnu.ai.mit.edu> thinks that MULE 1515 Richard Stallman <rms@gnu.ai.mit.edu> thinks that MULE
1548 (MUlti-Lingual Emacs) might need 22 bits for the character value 1516 (MUlti-Lingual Emacs) might need 22 bits for the character value
1549 itself, so we probably shouldn't use any bits lower than 0x0400000. */ 1517 itself, so we probably shouldn't use any bits lower than 0x0400000. */
1550#define CHAR_ALT (0x0400000) 1518enum char_bits
1551#define CHAR_SUPER (0x0800000) 1519 {
1552#define CHAR_HYPER (0x1000000) 1520 CHAR_ALT = 0x0400000,
1553#define CHAR_SHIFT (0x2000000) 1521 CHAR_SUPER = 0x0800000,
1554#define CHAR_CTL (0x4000000) 1522 CHAR_HYPER = 0x1000000,
1555#define CHAR_META (0x8000000) 1523 CHAR_SHIFT = 0x2000000,
1556 1524 CHAR_CTL = 0x4000000,
1557#define CHAR_MODIFIER_MASK \ 1525 CHAR_META = 0x8000000,
1558 (CHAR_ALT | CHAR_SUPER | CHAR_HYPER | CHAR_SHIFT | CHAR_CTL | CHAR_META) 1526
1527 CHAR_MODIFIER_MASK =
1528 CHAR_ALT | CHAR_SUPER | CHAR_HYPER | CHAR_SHIFT | CHAR_CTL | CHAR_META,
1529
1530 /* Actually, the current Emacs uses 22 bits for the character value
1531 itself. */
1532 CHARACTERBITS = 22
1533 };
1559 1534
1560 1535
1561/* Actually, the current Emacs uses 22 bits for the character value
1562 itself. */
1563#define CHARACTERBITS 22
1564 1536
1565 1537
1566/* The glyph datatype, used to represent characters on the display. 1538/* The glyph datatype, used to represent characters on the display.
@@ -1617,9 +1589,6 @@ typedef struct {
1617 (XINT (gc) >> CHARACTERBITS)); \ 1589 (XINT (gc) >> CHARACTERBITS)); \
1618 } \ 1590 } \
1619 while (0) 1591 while (0)
1620
1621/* The ID of the mode line highlighting face. */
1622#define GLYPH_MODE_LINE_FACE 1
1623 1592
1624/* Structure to hold mouse highlight data. This is here because other 1593/* Structure to hold mouse highlight data. This is here because other
1625 header files need it for defining struct x_output etc. */ 1594 header files need it for defining struct x_output etc. */
@@ -1894,7 +1863,7 @@ typedef struct {
1894#ifdef _MSC_VER 1863#ifdef _MSC_VER
1895#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ 1864#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
1896 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ 1865 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
1897 static DECL_ALIGN (struct Lisp_Subr, sname) = \ 1866 static struct Lisp_Subr alignas (GCALIGNMENT) sname = \
1898 { (PVEC_SUBR << PSEUDOVECTOR_SIZE_BITS) \ 1867 { (PVEC_SUBR << PSEUDOVECTOR_SIZE_BITS) \
1899 | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \ 1868 | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \
1900 { (Lisp_Object (__cdecl *)(void))fnname }, \ 1869 { (Lisp_Object (__cdecl *)(void))fnname }, \
@@ -1903,7 +1872,7 @@ typedef struct {
1903#else /* not _MSC_VER */ 1872#else /* not _MSC_VER */
1904#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ 1873#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
1905 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ 1874 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
1906 static DECL_ALIGN (struct Lisp_Subr, sname) = \ 1875 static struct Lisp_Subr alignas (GCALIGNMENT) sname = \
1907 { PVEC_SUBR << PSEUDOVECTOR_SIZE_BITS, \ 1876 { PVEC_SUBR << PSEUDOVECTOR_SIZE_BITS, \
1908 { .a ## maxargs = fnname }, \ 1877 { .a ## maxargs = fnname }, \
1909 minargs, maxargs, lname, intspec, 0}; \ 1878 minargs, maxargs, lname, intspec, 0}; \
@@ -1939,8 +1908,11 @@ typedef struct {
1939 is how we define the symbol for function `name' at start-up time. */ 1908 is how we define the symbol for function `name' at start-up time. */
1940extern void defsubr (struct Lisp_Subr *); 1909extern void defsubr (struct Lisp_Subr *);
1941 1910
1942#define MANY -2 1911enum maxargs
1943#define UNEVALLED -1 1912 {
1913 MANY = -2,
1914 UNEVALLED = -1
1915 };
1944 1916
1945extern void defvar_lisp (struct Lisp_Objfwd *, const char *, Lisp_Object *); 1917extern void defvar_lisp (struct Lisp_Objfwd *, const char *, Lisp_Object *);
1946extern void defvar_lisp_nopro (struct Lisp_Objfwd *, const char *, Lisp_Object *); 1918extern void defvar_lisp_nopro (struct Lisp_Objfwd *, const char *, Lisp_Object *);
@@ -2655,6 +2627,8 @@ extern Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object);
2655extern Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); 2627extern Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
2656extern Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, 2628extern Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
2657 Lisp_Object); 2629 Lisp_Object);
2630enum constype {CONSTYPE_HEAP, CONSTYPE_PURE};
2631extern Lisp_Object listn (enum constype, ptrdiff_t, Lisp_Object, ...);
2658extern _Noreturn void string_overflow (void); 2632extern _Noreturn void string_overflow (void);
2659extern Lisp_Object make_string (const char *, ptrdiff_t); 2633extern Lisp_Object make_string (const char *, ptrdiff_t);
2660extern Lisp_Object make_formatted_string (char *, const char *, ...) 2634extern Lisp_Object make_formatted_string (char *, const char *, ...)
@@ -2724,6 +2698,11 @@ extern void init_alloc (void);
2724extern void syms_of_alloc (void); 2698extern void syms_of_alloc (void);
2725extern struct buffer * allocate_buffer (void); 2699extern struct buffer * allocate_buffer (void);
2726extern int valid_lisp_object_p (Lisp_Object); 2700extern int valid_lisp_object_p (Lisp_Object);
2701#ifdef GC_CHECK_CONS_LIST
2702extern void check_cons_list (void);
2703#else
2704#define check_cons_list() ((void) 0)
2705#endif
2727 2706
2728#ifdef REL_ALLOC 2707#ifdef REL_ALLOC
2729/* Defined in ralloc.c */ 2708/* Defined in ralloc.c */
@@ -2766,7 +2745,7 @@ extern void print_error_message (Lisp_Object, Lisp_Object, const char *,
2766 Lisp_Object); 2745 Lisp_Object);
2767extern Lisp_Object internal_with_output_to_temp_buffer 2746extern Lisp_Object internal_with_output_to_temp_buffer
2768 (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object); 2747 (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object);
2769#define FLOAT_TO_STRING_BUFSIZE 350 2748enum FLOAT_TO_STRING_BUFSIZE { FLOAT_TO_STRING_BUFSIZE = 350 };
2770extern int float_to_string (char *, double); 2749extern int float_to_string (char *, double);
2771extern void syms_of_print (void); 2750extern void syms_of_print (void);
2772 2751
@@ -2871,7 +2850,7 @@ extern _Noreturn void verror (const char *, va_list)
2871 ATTRIBUTE_FORMAT_PRINTF (1, 0); 2850 ATTRIBUTE_FORMAT_PRINTF (1, 0);
2872extern Lisp_Object un_autoload (Lisp_Object); 2851extern Lisp_Object un_autoload (Lisp_Object);
2873extern void init_eval_once (void); 2852extern void init_eval_once (void);
2874extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object *); 2853extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object, ...);
2875extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); 2854extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object);
2876extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); 2855extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object);
2877extern void init_eval (void); 2856extern void init_eval (void);
@@ -3330,7 +3309,7 @@ extern void init_system_name (void);
3330 in addition to a device separator. Set the path separator 3309 in addition to a device separator. Set the path separator
3331 to '/', and don't test for a device separator in IS_ANY_SEP. */ 3310 to '/', and don't test for a device separator in IS_ANY_SEP. */
3332 3311
3333#define DIRECTORY_SEP '/' 3312static char const DIRECTORY_SEP = '/';
3334#ifndef IS_DIRECTORY_SEP 3313#ifndef IS_DIRECTORY_SEP
3335#define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP) 3314#define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP)
3336#endif 3315#endif
@@ -3345,8 +3324,6 @@ extern void init_system_name (void);
3345#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_)) 3324#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_))
3346#endif 3325#endif
3347 3326
3348#define SWITCH_ENUM_CAST(x) (x)
3349
3350/* Use this to suppress gcc's warnings. */ 3327/* Use this to suppress gcc's warnings. */
3351#ifdef lint 3328#ifdef lint
3352 3329
@@ -3362,15 +3339,6 @@ extern void init_system_name (void);
3362# define lint_assume(cond) ((void) (0 && (cond))) 3339# define lint_assume(cond) ((void) (0 && (cond)))
3363#endif 3340#endif
3364 3341
3365/* The ubiquitous min and max macros. */
3366
3367#ifdef max
3368#undef max
3369#undef min
3370#endif
3371#define min(a, b) ((a) < (b) ? (a) : (b))
3372#define max(a, b) ((a) > (b) ? (a) : (b))
3373
3374/* We used to use `abs', but that clashes with system headers on some 3342/* We used to use `abs', but that clashes with system headers on some
3375 platforms, and using a name reserved by Standard C is a bad idea 3343 platforms, and using a name reserved by Standard C is a bad idea
3376 anyway. */ 3344 anyway. */
@@ -3413,7 +3381,7 @@ extern void init_system_name (void);
3413/* SAFE_ALLOCA normally allocates memory on the stack, but if size is 3381/* SAFE_ALLOCA normally allocates memory on the stack, but if size is
3414 larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack. */ 3382 larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack. */
3415 3383
3416#define MAX_ALLOCA 16*1024 3384enum MAX_ALLOCA { MAX_ALLOCA = 16*1024 };
3417 3385
3418extern Lisp_Object safe_alloca_unwind (Lisp_Object); 3386extern Lisp_Object safe_alloca_unwind (Lisp_Object);
3419 3387
diff --git a/src/lread.c b/src/lread.c
index 39378bb11dd..0db37d7492f 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4121,12 +4121,7 @@ init_lread (void)
4121 difference between initialized and !initialized in this case, 4121 difference between initialized and !initialized in this case,
4122 so we'll have to do it unconditionally when Vinstallation_directory 4122 so we'll have to do it unconditionally when Vinstallation_directory
4123 is non-nil. */ 4123 is non-nil. */
4124#ifdef HAVE_NS
4125 /* loadpath already includes the app-bundle's site-lisp. */
4126 if (!no_site_lisp && !egetenv ("EMACSLOADPATH") && !loadpath)
4127#else
4128 if (!no_site_lisp && !egetenv ("EMACSLOADPATH")) 4124 if (!no_site_lisp && !egetenv ("EMACSLOADPATH"))
4129#endif
4130 { 4125 {
4131 Lisp_Object sitelisp; 4126 Lisp_Object sitelisp;
4132 sitelisp = decode_env_path (0, PATH_SITELOADSEARCH); 4127 sitelisp = decode_env_path (0, PATH_SITELOADSEARCH);
@@ -4270,12 +4265,7 @@ init_lread (void)
4270 load_path_check (); 4265 load_path_check ();
4271 4266
4272 /* Add the site-lisp directories at the front. */ 4267 /* Add the site-lisp directories at the front. */
4273#ifdef HAVE_NS
4274 /* loadpath already includes the app-bundle's site-lisp. */
4275 if (!no_site_lisp && !loadpath)
4276#else
4277 if (!no_site_lisp) 4268 if (!no_site_lisp)
4278#endif
4279 { 4269 {
4280 Lisp_Object sitelisp; 4270 Lisp_Object sitelisp;
4281 sitelisp = decode_env_path (0, PATH_SITELOADSEARCH); 4271 sitelisp = decode_env_path (0, PATH_SITELOADSEARCH);
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index a2d1c36af64..10ab0619fb4 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -1,4 +1,4 @@
1# -*- Makefile -*- for GNU Emacs on the Microsoft W32 API. 1# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API.
2# Copyright (C) 2000-2012 Free Software Foundation, Inc. 2# Copyright (C) 2000-2012 Free Software Foundation, Inc.
3 3
4# This file is part of GNU Emacs. 4# This file is part of GNU Emacs.
@@ -406,6 +406,7 @@ CODING_H = $(SRC)/coding.h \
406MS_W32_H = $(SRC)/s/ms-w32.h \ 406MS_W32_H = $(SRC)/s/ms-w32.h \
407 $(NT_INC)/sys/stat.h 407 $(NT_INC)/sys/stat.h
408CONFIG_H = $(SRC)/config.h \ 408CONFIG_H = $(SRC)/config.h \
409 $(SRC)/conf_post.h \
409 $(MS_W32_H) 410 $(MS_W32_H)
410DIR_H = $(NT_INC)/sys/dir.h \ 411DIR_H = $(NT_INC)/sys/dir.h \
411 $(SRC)/ndir.h 412 $(SRC)/ndir.h
@@ -438,7 +439,8 @@ LANGINFO_H = $(NT_INC)/langinfo.h \
438LISP_H = $(SRC)/lisp.h \ 439LISP_H = $(SRC)/lisp.h \
439 $(SRC)/globals.h \ 440 $(SRC)/globals.h \
440 $(GNU_LIB)/intprops.h \ 441 $(GNU_LIB)/intprops.h \
441 $(INTTYPES_H) 442 $(INTTYPES_H) \
443 $(NT_INC)/stdalign.h
442MD5_H = $(GNU_LIB)/md5.h \ 444MD5_H = $(GNU_LIB)/md5.h \
443 $(NT_INC)/stdint.h 445 $(NT_INC)/stdint.h
444MENU_H = $(SRC)/menu.h \ 446MENU_H = $(SRC)/menu.h \
@@ -783,7 +785,6 @@ $(BLD)/emacs.$(O) : \
783 $(SRC)/w32heap.h \ 785 $(SRC)/w32heap.h \
784 $(NT_INC)/sys/file.h \ 786 $(NT_INC)/sys/file.h \
785 $(NT_INC)/unistd.h \ 787 $(NT_INC)/unistd.h \
786 $(GNU_LIB)/verify.h \
787 $(BLOCKINPUT_H) \ 788 $(BLOCKINPUT_H) \
788 $(BUFFER_H) \ 789 $(BUFFER_H) \
789 $(CHARACTER_H) \ 790 $(CHARACTER_H) \
@@ -1164,6 +1165,7 @@ $(BLD)/w32inevt.$(O) : \
1164 $(SRC)/w32inevt.c \ 1165 $(SRC)/w32inevt.c \
1165 $(SRC)/termchar.h \ 1166 $(SRC)/termchar.h \
1166 $(SRC)/w32heap.h \ 1167 $(SRC)/w32heap.h \
1168 $(SRC)/w32inevt.h \
1167 $(BLOCKINPUT_H) \ 1169 $(BLOCKINPUT_H) \
1168 $(CONFIG_H) \ 1170 $(CONFIG_H) \
1169 $(DISPEXTERN_H) \ 1171 $(DISPEXTERN_H) \
@@ -1195,6 +1197,7 @@ $(BLD)/w32console.$(O) : \
1195 $(SRC)/w32console.c \ 1197 $(SRC)/w32console.c \
1196 $(SRC)/disptab.h \ 1198 $(SRC)/disptab.h \
1197 $(SRC)/termchar.h \ 1199 $(SRC)/termchar.h \
1200 $(SRC)/w32heap.h \
1198 $(SRC)/w32inevt.h \ 1201 $(SRC)/w32inevt.h \
1199 $(CHARACTER_H) \ 1202 $(CHARACTER_H) \
1200 $(CODING_H) \ 1203 $(CODING_H) \
diff --git a/src/marker.c b/src/marker.c
index 0a93f4c180f..4ea06c7cd57 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -64,7 +64,7 @@ byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos)
64 64
65#else /* not MARKER_DEBUG */ 65#else /* not MARKER_DEBUG */
66 66
67#define byte_char_debug_check(b,charpos,bytepos) do { } while (0) 67#define byte_char_debug_check(b, charpos, bytepos) do { } while (0)
68 68
69#endif /* MARKER_DEBUG */ 69#endif /* MARKER_DEBUG */
70 70
diff --git a/src/nsterm.m b/src/nsterm.m
index 1f06d49c5b9..4e181e9d1d2 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -195,6 +195,7 @@ static int n_emacs_events_pending = 0;
195static NSMutableArray *ns_pending_files, *ns_pending_service_names, 195static NSMutableArray *ns_pending_files, *ns_pending_service_names,
196 *ns_pending_service_args; 196 *ns_pending_service_args;
197static BOOL inNsSelect = 0; 197static BOOL inNsSelect = 0;
198static BOOL ns_do_open_file = NO;
198 199
199/* Convert modifiers in a NeXTstep event to emacs style modifiers. */ 200/* Convert modifiers in a NeXTstep event to emacs style modifiers. */
200#define NS_FUNCTION_KEY_MASK 0x800000 201#define NS_FUNCTION_KEY_MASK 0x800000
@@ -4025,7 +4026,7 @@ ns_term_init (Lisp_Object display_name)
4025 ns_pending_service_names = [[NSMutableArray alloc] init]; 4026 ns_pending_service_names = [[NSMutableArray alloc] init];
4026 ns_pending_service_args = [[NSMutableArray alloc] init]; 4027 ns_pending_service_args = [[NSMutableArray alloc] init];
4027 4028
4028 /* Start app and create the main menu, window, view. 4029/* Start app and create the main menu, window, view.
4029 Needs to be here because ns_initialize_display_info () uses AppKit classes. 4030 Needs to be here because ns_initialize_display_info () uses AppKit classes.
4030 The view will then ask the NSApp to stop and return to Emacs. */ 4031 The view will then ask the NSApp to stop and return to Emacs. */
4031 [EmacsApp sharedApplication]; 4032 [EmacsApp sharedApplication];
@@ -4205,7 +4206,7 @@ ns_term_init (Lisp_Object display_name)
4205#endif /* MAC OS X menu setup */ 4206#endif /* MAC OS X menu setup */
4206 4207
4207 [NSApp run]; 4208 [NSApp run];
4208 4209 ns_do_open_file = YES;
4209 return dpyinfo; 4210 return dpyinfo;
4210} 4211}
4211 4212
@@ -4446,7 +4447,8 @@ ns_term_shutdown (int sig)
4446/* Notification from the Workspace to open a file */ 4447/* Notification from the Workspace to open a file */
4447- (BOOL)application: sender openFile: (NSString *)file 4448- (BOOL)application: sender openFile: (NSString *)file
4448{ 4449{
4449 [ns_pending_files addObject: file]; 4450 if (ns_do_open_file)
4451 [ns_pending_files addObject: file];
4450 return YES; 4452 return YES;
4451} 4453}
4452 4454
@@ -4454,7 +4456,8 @@ ns_term_shutdown (int sig)
4454/* Open a file as a temporary file */ 4456/* Open a file as a temporary file */
4455- (BOOL)application: sender openTempFile: (NSString *)file 4457- (BOOL)application: sender openTempFile: (NSString *)file
4456{ 4458{
4457 [ns_pending_files addObject: file]; 4459 if (ns_do_open_file)
4460 [ns_pending_files addObject: file];
4458 return YES; 4461 return YES;
4459} 4462}
4460 4463
@@ -4462,7 +4465,8 @@ ns_term_shutdown (int sig)
4462/* Notification from the Workspace to open a file noninteractively (?) */ 4465/* Notification from the Workspace to open a file noninteractively (?) */
4463- (BOOL)application: sender openFileWithoutUI: (NSString *)file 4466- (BOOL)application: sender openFileWithoutUI: (NSString *)file
4464{ 4467{
4465 [ns_pending_files addObject: file]; 4468 if (ns_do_open_file)
4469 [ns_pending_files addObject: file];
4466 return YES; 4470 return YES;
4467} 4471}
4468 4472
@@ -4470,11 +4474,17 @@ ns_term_shutdown (int sig)
4470/* Notification from the Workspace to open multiple files */ 4474/* Notification from the Workspace to open multiple files */
4471- (void)application: sender openFiles: (NSArray *)fileList 4475- (void)application: sender openFiles: (NSArray *)fileList
4472{ 4476{
4473 NSEnumerator *files = [fileList objectEnumerator]; 4477 /* Don't open files from the command line, Cocoa parses the command line
4474 NSString *file; 4478 wrong anyway, --option value tries to open value if --option is the last
4475 while ((file = [files nextObject]) != nil) 4479 option. */
4476 [ns_pending_files addObject: file]; 4480 if (ns_ignore_open_file)
4477 4481 {
4482 NSEnumerator *files = [fileList objectEnumerator];
4483 NSString *file;
4484 while ((file = [files nextObject]) != nil)
4485 [ns_pending_files addObject: file];
4486 }
4487
4478 [self replyToOpenOrPrint: NSApplicationDelegateReplySuccess]; 4488 [self replyToOpenOrPrint: NSApplicationDelegateReplySuccess];
4479 4489
4480} 4490}
diff --git a/src/regex.c b/src/regex.c
index 4bf119402ac..afe3751ea5e 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -255,8 +255,6 @@ xrealloc (void *block, size_t size)
255/* Sword must be nonzero for the wordchar pattern commands in re_match_2. */ 255/* Sword must be nonzero for the wordchar pattern commands in re_match_2. */
256enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 }; 256enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 };
257 257
258# define SWITCH_ENUM_CAST(x) (x)
259
260/* Dummy macros for non-Emacs environments. */ 258/* Dummy macros for non-Emacs environments. */
261# define CHAR_CHARSET(c) 0 259# define CHAR_CHARSET(c) 0
262# define CHARSET_LEADING_CODE_BASE(c) 0 260# define CHARSET_LEADING_CODE_BASE(c) 0
@@ -1739,20 +1737,6 @@ static int analyse_first (re_char *p, re_char *pend,
1739 be too small, many things would have to change. */ 1737 be too small, many things would have to change. */
1740# define MAX_BUF_SIZE (1L << 15) 1738# define MAX_BUF_SIZE (1L << 15)
1741 1739
1742#if 0 /* This is when we thought it could be 2^16 bytes. */
1743/* Any other compiler which, like MSC, has allocation limit below 2^16
1744 bytes will have to use approach similar to what was done below for
1745 MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up
1746 reallocating to 0 bytes. Such thing is not going to work too well.
1747 You have been warned!! */
1748#if defined _MSC_VER && !defined WIN32
1749/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes. */
1750# define MAX_BUF_SIZE 65500L
1751#else
1752# define MAX_BUF_SIZE (1L << 16)
1753#endif
1754#endif /* 0 */
1755
1756/* Extend the buffer by twice its current size via realloc and 1740/* Extend the buffer by twice its current size via realloc and
1757 reset the pointers that pointed into the old block to point to the 1741 reset the pointers that pointed into the old block to point to the
1758 correct places in the new one. If extending the buffer results in it 1742 correct places in the new one. If extending the buffer results in it
@@ -3927,7 +3911,7 @@ analyse_first (const re_char *p, const re_char *pend, char *fastmap, const int m
3927 as used for the *? operator. */ 3911 as used for the *? operator. */
3928 re_char *p1 = p; 3912 re_char *p1 = p;
3929 3913
3930 switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) 3914 switch (*p++)
3931 { 3915 {
3932 case succeed: 3916 case succeed:
3933 return 1; 3917 return 1;
@@ -4102,7 +4086,7 @@ analyse_first (const re_char *p, const re_char *pend, char *fastmap, const int m
4102 visited. `re_compile' should make sure this is true. */ 4086 visited. `re_compile' should make sure this is true. */
4103 break; 4087 break;
4104 p += j; 4088 p += j;
4105 switch (SWITCH_ENUM_CAST ((re_opcode_t) *p)) 4089 switch (*p)
4106 { 4090 {
4107 case on_failure_jump: 4091 case on_failure_jump:
4108 case on_failure_keep_string_jump: 4092 case on_failure_keep_string_jump:
@@ -4635,7 +4619,7 @@ static int bcmp_translate (re_char *s1, re_char *s2,
4635static re_char * 4619static re_char *
4636skip_one_char (const re_char *p) 4620skip_one_char (const re_char *p)
4637{ 4621{
4638 switch (SWITCH_ENUM_CAST (*p++)) 4622 switch (*p++)
4639 { 4623 {
4640 case anychar: 4624 case anychar:
4641 break; 4625 break;
@@ -4680,7 +4664,7 @@ skip_noops (const re_char *p, const re_char *pend)
4680 int mcnt; 4664 int mcnt;
4681 while (p < pend) 4665 while (p < pend)
4682 { 4666 {
4683 switch (SWITCH_ENUM_CAST ((re_opcode_t) *p)) 4667 switch (*p)
4684 { 4668 {
4685 case start_memory: 4669 case start_memory:
4686 case stop_memory: 4670 case stop_memory:
@@ -4725,7 +4709,7 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const r
4725 4709
4726 op2 = p2 == pend ? succeed : *p2; 4710 op2 = p2 == pend ? succeed : *p2;
4727 4711
4728 switch (SWITCH_ENUM_CAST (op2)) 4712 switch (op2)
4729 { 4713 {
4730 case succeed: 4714 case succeed:
4731 case endbuf: 4715 case endbuf:
@@ -4849,7 +4833,7 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const r
4849 break; 4833 break;
4850 4834
4851 case charset_not: 4835 case charset_not:
4852 switch (SWITCH_ENUM_CAST (*p1)) 4836 switch (*p1)
4853 { 4837 {
4854 case exactn: 4838 case exactn:
4855 case charset: 4839 case charset:
@@ -5327,7 +5311,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1,
5327 } 5311 }
5328 5312
5329 /* Otherwise match next pattern command. */ 5313 /* Otherwise match next pattern command. */
5330 switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) 5314 switch (*p++)
5331 { 5315 {
5332 /* Ignore these. Used to ignore the n of succeed_n's which 5316 /* Ignore these. Used to ignore the n of succeed_n's which
5333 currently have n == 0. */ 5317 currently have n == 0. */
@@ -6249,7 +6233,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1,
6249 /* A restart point is known. Restore to that state. */ 6233 /* A restart point is known. Restore to that state. */
6250 DEBUG_PRINT1 ("\nFAIL:\n"); 6234 DEBUG_PRINT1 ("\nFAIL:\n");
6251 POP_FAILURE_POINT (str, pat); 6235 POP_FAILURE_POINT (str, pat);
6252 switch (SWITCH_ENUM_CAST ((re_opcode_t) *pat++)) 6236 switch (*pat++)
6253 { 6237 {
6254 case on_failure_keep_string_jump: 6238 case on_failure_keep_string_jump:
6255 assert (str == NULL); 6239 assert (str == NULL);
diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h
deleted file mode 100644
index 6c881a7fb8c..00000000000
--- a/src/s/aix4-2.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2Copyright (C) 1999, 2001-2012 Free Software Foundation, Inc.
3
4This file is part of GNU Emacs.
5
6GNU Emacs is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11GNU Emacs is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18
19/* Perry Smith <pedz@ddivt1.austin.ibm.com> says these are correct. */
20#undef sigmask
21
diff --git a/src/s/freebsd.h b/src/s/freebsd.h
deleted file mode 100644
index 9177403f426..00000000000
--- a/src/s/freebsd.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/* System description header for FreeBSD systems.
2
3Copyright (C) 1994-2012 Free Software Foundation, Inc.
4
5Author: Shawn M. Carey
6(according to authors.el)
7
8This file is part of GNU Emacs.
9
10GNU Emacs is free software: you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation, either version 3 of the License, or
13(at your option) any later version.
14
15GNU Emacs is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22
diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h
deleted file mode 100644
index 2847fd6d19c..00000000000
--- a/src/s/gnu-linux.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/* This file is the configuration file for Linux-based GNU systems
2
3Copyright (C) 1985-1986, 1992, 1994, 1996, 1999, 2001-2012
4 Free Software Foundation, Inc.
5
6This file was put together by Michael K. Johnson and Rik Faith.
7
8This file is part of GNU Emacs.
9
10GNU Emacs is free software: you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation, either version 3 of the License, or
13(at your option) any later version.
14
15GNU Emacs is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22
diff --git a/src/s/irix6-5.h b/src/s/irix6-5.h
index 9b215845461..338c18cca52 100644
--- a/src/s/irix6-5.h
+++ b/src/s/irix6-5.h
@@ -19,14 +19,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include "usg5-4-common.h" 20#include "usg5-4-common.h"
21 21
22#undef _longjmp /* use system versions, not conservative aliases */
23#undef _setjmp
24
25#ifdef emacs 22#ifdef emacs
26char *_getpty(); 23char *_getpty();
27#endif 24#endif
28 25
29#undef SA_RESTART /* not the same as defining BROKEN_SA_RESTART */ 26#undef SA_RESTART /* not the same as defining BROKEN_SA_RESTART */
30
31#undef TIOCSIGSEND /* defined in usg5-4-common.h */
32
diff --git a/src/s/netbsd.h b/src/s/netbsd.h
deleted file mode 100644
index 7a571ee8116..00000000000
--- a/src/s/netbsd.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/* s/ file for netbsd system.
2
3Copyright (C) 2001-2012 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20/* Greg A. Woods <woods@weird.com> says we must include signal.h
21 before syssignal.h is included, to work around interface conflicts
22 that are handled with CPP __RENAME() macro in signal.h. */
23#include <signal.h>
24
diff --git a/src/s/sol2-6.h b/src/s/sol2-6.h
deleted file mode 100644
index 3bed55598b7..00000000000
--- a/src/s/sol2-6.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/* Definitions file for GNU Emacs running on Solaris 2.6.
2
3Copyright (C) 1999-2012 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20#include "usg5-4-common.h"
21
diff --git a/src/s/unixware.h b/src/s/unixware.h
deleted file mode 100644
index 59c74a56f4e..00000000000
--- a/src/s/unixware.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/* s/ file for Unixware.
2
3Copyright (C) 1999-2012 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20#include "usg5-4-common.h"
diff --git a/src/s/usg5-4-common.h b/src/s/usg5-4-common.h
index 6ead01d3712..05f22143460 100644
--- a/src/s/usg5-4-common.h
+++ b/src/s/usg5-4-common.h
@@ -20,11 +20,6 @@ GNU General Public License for more details.
20You should have received a copy of the GNU General Public License 20You should have received a copy of the GNU General Public License
21along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 21along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 22
23/* setjmp and longjmp can safely replace _setjmp and _longjmp,
24 but they will run slower. */
25#define _setjmp setjmp
26#define _longjmp longjmp
27
28/* Get FIONREAD from <sys/filio.h>. Get <sys/ttold.h> to get struct tchars. 23/* Get FIONREAD from <sys/filio.h>. Get <sys/ttold.h> to get struct tchars.
29 But get <termio.h> first to make sure ttold.h doesn't interfere. */ 24 But get <termio.h> first to make sure ttold.h doesn't interfere. */
30#include <sys/wait.h> 25#include <sys/wait.h>
@@ -47,8 +42,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
47 waitpid ((pid_t) -1, (status), (options)) 42 waitpid ((pid_t) -1, (status), (options))
48#define WRETCODE(w) (w >> 8) 43#define WRETCODE(w) (w >> 8)
49 44
50/* TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY
51 subprocesses the usual way. But TIOCSIGNAL does work for PTYs, and
52 this is all we need. */
53#define TIOCSIGSEND TIOCSIGNAL
54
diff --git a/src/search.c b/src/search.c
index 118cec4af48..480d0b75c70 100644
--- a/src/search.c
+++ b/src/search.c
@@ -3054,12 +3054,12 @@ syms_of_search (void)
3054 DEFSYM (Qinvalid_regexp, "invalid-regexp"); 3054 DEFSYM (Qinvalid_regexp, "invalid-regexp");
3055 3055
3056 Fput (Qsearch_failed, Qerror_conditions, 3056 Fput (Qsearch_failed, Qerror_conditions,
3057 pure_cons (Qsearch_failed, pure_cons (Qerror, Qnil))); 3057 listn (CONSTYPE_PURE, 2, Qsearch_failed, Qerror));
3058 Fput (Qsearch_failed, Qerror_message, 3058 Fput (Qsearch_failed, Qerror_message,
3059 build_pure_c_string ("Search failed")); 3059 build_pure_c_string ("Search failed"));
3060 3060
3061 Fput (Qinvalid_regexp, Qerror_conditions, 3061 Fput (Qinvalid_regexp, Qerror_conditions,
3062 pure_cons (Qinvalid_regexp, pure_cons (Qerror, Qnil))); 3062 listn (CONSTYPE_PURE, 2, Qinvalid_regexp, Qerror));
3063 Fput (Qinvalid_regexp, Qerror_message, 3063 Fput (Qinvalid_regexp, Qerror_message,
3064 build_pure_c_string ("Invalid regexp")); 3064 build_pure_c_string ("Invalid regexp"));
3065 3065
diff --git a/src/sound.c b/src/sound.c
index 151bc1a08c1..403f08240ce 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -31,7 +31,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31 cause an error to be generated. 31 cause an error to be generated.
32 32
33 The Windows implementation of play-sound is implemented via the 33 The Windows implementation of play-sound is implemented via the
34 Win32 API functions mciSendString, waveOutGetVolume, and 34 Windows API functions mciSendString, waveOutGetVolume, and
35 waveOutSetVolume which are exported by Winmm.dll. 35 waveOutSetVolume which are exported by Winmm.dll.
36*/ 36*/
37 37
diff --git a/src/syntax.c b/src/syntax.c
index 69c2789ed39..f0e30803dea 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1152,7 +1152,7 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
1152 1152
1153 insert_string ("\twhich means: "); 1153 insert_string ("\twhich means: ");
1154 1154
1155 switch (SWITCH_ENUM_CAST (code)) 1155 switch (code)
1156 { 1156 {
1157 case Swhitespace: 1157 case Swhitespace:
1158 insert_string ("whitespace"); break; 1158 insert_string ("whitespace"); break;
@@ -2525,7 +2525,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2525 if (prefix) 2525 if (prefix)
2526 continue; 2526 continue;
2527 2527
2528 switch (SWITCH_ENUM_CAST (code)) 2528 switch (code)
2529 { 2529 {
2530 case Sescape: 2530 case Sescape:
2531 case Scharquote: 2531 case Scharquote:
@@ -2702,7 +2702,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2702 else if (SYNTAX_FLAGS_PREFIX (syntax)) 2702 else if (SYNTAX_FLAGS_PREFIX (syntax))
2703 continue; 2703 continue;
2704 2704
2705 switch (SWITCH_ENUM_CAST (code)) 2705 switch (code)
2706 { 2706 {
2707 case Sword: 2707 case Sword:
2708 case Ssymbol: 2708 case Ssymbol:
@@ -3123,7 +3123,7 @@ do { prev_from = from; \
3123 3123
3124 if (SYNTAX_FLAGS_PREFIX (prev_from_syntax)) 3124 if (SYNTAX_FLAGS_PREFIX (prev_from_syntax))
3125 continue; 3125 continue;
3126 switch (SWITCH_ENUM_CAST (code)) 3126 switch (code)
3127 { 3127 {
3128 case Sescape: 3128 case Sescape:
3129 case Scharquote: 3129 case Scharquote:
@@ -3473,7 +3473,7 @@ syms_of_syntax (void)
3473 3473
3474 DEFSYM (Qscan_error, "scan-error"); 3474 DEFSYM (Qscan_error, "scan-error");
3475 Fput (Qscan_error, Qerror_conditions, 3475 Fput (Qscan_error, Qerror_conditions,
3476 pure_cons (Qscan_error, pure_cons (Qerror, Qnil))); 3476 listn (CONSTYPE_PURE, 2, Qscan_error, Qerror));
3477 Fput (Qscan_error, Qerror_message, 3477 Fput (Qscan_error, Qerror_message,
3478 build_pure_c_string ("Scan error")); 3478 build_pure_c_string ("Scan error"));
3479 3479
diff --git a/src/term.c b/src/term.c
index 4d73f896d21..f24caeffebb 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2209,11 +2209,10 @@ set_tty_color_mode (struct tty_display_info *tty, struct frame *f)
2209 2209
2210 if (mode != tty->previous_color_mode) 2210 if (mode != tty->previous_color_mode)
2211 { 2211 {
2212 Lisp_Object funsym = intern ("tty-set-up-initial-frame-faces");
2213 tty->previous_color_mode = mode; 2212 tty->previous_color_mode = mode;
2214 tty_setup_colors (tty , mode); 2213 tty_setup_colors (tty , mode);
2215 /* This recomputes all the faces given the new color definitions. */ 2214 /* This recomputes all the faces given the new color definitions. */
2216 safe_call (1, &funsym); 2215 safe_call (1, intern ("tty-set-up-initial-frame-faces"));
2217 } 2216 }
2218} 2217}
2219 2218
diff --git a/src/w32.c b/src/w32.c
index e8c48a50a97..a9f4f6fb50e 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1,4 +1,4 @@
1/* Utility and Unix shadow routines for GNU Emacs on the Microsoft W32 API. 1/* Utility and Unix shadow routines for GNU Emacs on the Microsoft Windows API.
2 Copyright (C) 1994-1995, 2000-2012 Free Software Foundation, Inc. 2 Copyright (C) 1994-1995, 2000-2012 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
@@ -1722,13 +1722,11 @@ init_environment (char ** argv)
1722 dwType = REG_EXPAND_SZ; 1722 dwType = REG_EXPAND_SZ;
1723 dont_free = 1; 1723 dont_free = 1;
1724 if (!strcmp (env_vars[i].name, "HOME") && !appdata) 1724 if (!strcmp (env_vars[i].name, "HOME") && !appdata)
1725 { 1725 Vdelayed_warnings_list
1726 Lisp_Object warning[2]; 1726 = Fcons (listn (CONSTYPE_HEAP, 2,
1727 warning[0] = intern ("initialization"); 1727 intern ("initialization"),
1728 warning[1] = build_string ("Setting HOME to C:\\ by default is deprecated"); 1728 build_string ("Setting HOME to C:\\ by default is deprecated")),
1729 Vdelayed_warnings_list = Fcons (Flist (2, warning), 1729 Vdelayed_warnings_list);
1730 Vdelayed_warnings_list);
1731 }
1732 } 1730 }
1733 1731
1734 if (lpval) 1732 if (lpval)
@@ -2013,7 +2011,7 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2])
2013 2011
2014 2012
2015/* ------------------------------------------------------------------------- */ 2013/* ------------------------------------------------------------------------- */
2016/* IO support and wrapper functions for W32 API. */ 2014/* IO support and wrapper functions for the Windows API. */
2017/* ------------------------------------------------------------------------- */ 2015/* ------------------------------------------------------------------------- */
2018 2016
2019/* Place a wrapper around the MSVC version of ctime. It returns NULL 2017/* Place a wrapper around the MSVC version of ctime. It returns NULL
@@ -2931,7 +2929,7 @@ sys_rename (const char * oldname, const char * newname)
2931 /* volume_info is set indirectly by map_w32_filename. */ 2929 /* volume_info is set indirectly by map_w32_filename. */
2932 oldname_dev = volume_info.serialnum; 2930 oldname_dev = volume_info.serialnum;
2933 2931
2934 if (os_subtype == OS_WIN95) 2932 if (os_subtype == OS_9X)
2935 { 2933 {
2936 char * o; 2934 char * o;
2937 char * p; 2935 char * p;
diff --git a/src/w32console.c b/src/w32console.c
index 42d89cca6d7..76585851e7f 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -1,4 +1,4 @@
1/* Terminal hooks for GNU Emacs on the Microsoft W32 API. 1/* Terminal hooks for GNU Emacs on the Microsoft Windows API.
2 Copyright (C) 1992, 1999, 2001-2012 Free Software Foundation, Inc. 2 Copyright (C) 1992, 1999, 2001-2012 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
@@ -37,6 +37,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
37#include "termhooks.h" 37#include "termhooks.h"
38#include "termchar.h" 38#include "termchar.h"
39#include "dispextern.h" 39#include "dispextern.h"
40#include "w32heap.h" /* for os_subtype */
40#include "w32inevt.h" 41#include "w32inevt.h"
41 42
42/* from window.c */ 43/* from window.c */
@@ -67,6 +68,7 @@ static CONSOLE_CURSOR_INFO prev_console_cursor;
67#endif 68#endif
68 69
69HANDLE keyboard_handle; 70HANDLE keyboard_handle;
71int w32_console_unicode_input;
70 72
71 73
72/* Setting this as the ctrl handler prevents emacs from being killed when 74/* Setting this as the ctrl handler prevents emacs from being killed when
@@ -513,7 +515,7 @@ w32con_set_terminal_modes (struct terminal *t)
513{ 515{
514 CONSOLE_CURSOR_INFO cci; 516 CONSOLE_CURSOR_INFO cci;
515 517
516 /* make cursor big and visible (100 on Win95 makes it disappear) */ 518 /* make cursor big and visible (100 on Windows 95 makes it disappear) */
517 cci.dwSize = 99; 519 cci.dwSize = 99;
518 cci.bVisible = TRUE; 520 cci.bVisible = TRUE;
519 (void) SetConsoleCursorInfo (cur_screen, &cci); 521 (void) SetConsoleCursorInfo (cur_screen, &cci);
@@ -786,6 +788,11 @@ initialize_w32_display (struct terminal *term)
786 info.srWindow.Left); 788 info.srWindow.Left);
787 } 789 }
788 790
791 if (os_subtype == OS_NT)
792 w32_console_unicode_input = 1;
793 else
794 w32_console_unicode_input = 0;
795
789 /* Setup w32_display_info structure for this frame. */ 796 /* Setup w32_display_info structure for this frame. */
790 797
791 w32_initialize_display_info (build_string ("Console")); 798 w32_initialize_display_info (build_string ("Console"));
diff --git a/src/w32fns.c b/src/w32fns.c
index 06938e3124b..91744e2691f 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1,4 +1,4 @@
1/* Graphical user interface functions for the Microsoft W32 API. 1/* Graphical user interface functions for the Microsoft Windows API.
2 2
3Copyright (C) 1989, 1992-2012 Free Software Foundation, Inc. 3Copyright (C) 1989, 1992-2012 Free Software Foundation, Inc.
4 4
@@ -2882,7 +2882,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
2882 key.uChar.AsciiChar = 0; 2882 key.uChar.AsciiChar = 0;
2883 key.dwControlKeyState = modifiers; 2883 key.dwControlKeyState = modifiers;
2884 2884
2885 add = w32_kbd_patch_key (&key); 2885 add = w32_kbd_patch_key (&key, w32_keyboard_codepage);
2886 /* 0 means an unrecognized keycode, negative means 2886 /* 0 means an unrecognized keycode, negative means
2887 dead key. Ignore both. */ 2887 dead key. Ignore both. */
2888 while (--add >= 0) 2888 while (--add >= 0)
@@ -2892,7 +2892,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
2892 (hwnd, WM_CHAR, 2892 (hwnd, WM_CHAR,
2893 (unsigned char) key.uChar.AsciiChar, lParam, 2893 (unsigned char) key.uChar.AsciiChar, lParam,
2894 w32_get_key_modifiers (wParam, lParam)); 2894 w32_get_key_modifiers (wParam, lParam));
2895 w32_kbd_patch_key (&key); 2895 w32_kbd_patch_key (&key, w32_keyboard_codepage);
2896 } 2896 }
2897 return 0; 2897 return 0;
2898 } 2898 }
@@ -6470,7 +6470,6 @@ The following %-sequences are provided:
6470 { 6470 {
6471 Lisp_Object line_status, battery_status, battery_status_symbol; 6471 Lisp_Object line_status, battery_status, battery_status_symbol;
6472 Lisp_Object load_percentage, seconds, minutes, hours, remain; 6472 Lisp_Object load_percentage, seconds, minutes, hours, remain;
6473 Lisp_Object sequences[8];
6474 6473
6475 long seconds_left = (long) system_status.BatteryLifeTime; 6474 long seconds_left = (long) system_status.BatteryLifeTime;
6476 6475
@@ -6544,16 +6543,16 @@ The following %-sequences are provided:
6544 _snprintf (buffer, 16, "%ld:%02ld", m / 60, m % 60); 6543 _snprintf (buffer, 16, "%ld:%02ld", m / 60, m % 60);
6545 remain = build_string (buffer); 6544 remain = build_string (buffer);
6546 } 6545 }
6547 sequences[0] = Fcons (make_number ('L'), line_status); 6546
6548 sequences[1] = Fcons (make_number ('B'), battery_status); 6547 status = listn (CONSTYPE_HEAP, 8,
6549 sequences[2] = Fcons (make_number ('b'), battery_status_symbol); 6548 Fcons (make_number ('L'), line_status),
6550 sequences[3] = Fcons (make_number ('p'), load_percentage); 6549 Fcons (make_number ('B'), battery_status),
6551 sequences[4] = Fcons (make_number ('s'), seconds); 6550 Fcons (make_number ('b'), battery_status_symbol),
6552 sequences[5] = Fcons (make_number ('m'), minutes); 6551 Fcons (make_number ('p'), load_percentage),
6553 sequences[6] = Fcons (make_number ('h'), hours); 6552 Fcons (make_number ('s'), seconds),
6554 sequences[7] = Fcons (make_number ('t'), remain); 6553 Fcons (make_number ('m'), minutes),
6555 6554 Fcons (make_number ('h'), hours),
6556 status = Flist (8, sequences); 6555 Fcons (make_number ('t'), remain));
6557 } 6556 }
6558 return status; 6557 return status;
6559} 6558}
@@ -6576,7 +6575,7 @@ If the underlying system call fails, value is nil. */)
6576 value = Qnil; 6575 value = Qnil;
6577 6576
6578 /* Determining the required information on Windows turns out, sadly, 6577 /* Determining the required information on Windows turns out, sadly,
6579 to be more involved than one would hope. The original Win32 api 6578 to be more involved than one would hope. The original Windows API
6580 call for this will return bogus information on some systems, but we 6579 call for this will return bogus information on some systems, but we
6581 must dynamically probe for the replacement api, since that was 6580 must dynamically probe for the replacement api, since that was
6582 added rather late on. */ 6581 added rather late on. */
@@ -6795,7 +6794,7 @@ syms_of_w32fns (void)
6795 6794
6796 6795
6797 Fput (Qundefined_color, Qerror_conditions, 6796 Fput (Qundefined_color, Qerror_conditions,
6798 pure_cons (Qundefined_color, pure_cons (Qerror, Qnil))); 6797 listn (CONSTYPE_PURE, 2, Qundefined_color, Qerror));
6799 Fput (Qundefined_color, Qerror_message, 6798 Fput (Qundefined_color, Qerror_message,
6800 build_pure_c_string ("Undefined color")); 6799 build_pure_c_string ("Undefined color"));
6801 6800
diff --git a/src/w32font.c b/src/w32font.c
index 81378825412..fd24a90d60b 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -1,4 +1,4 @@
1/* Font backend for the Microsoft W32 API. 1/* Font backend for the Microsoft Windows API.
2 Copyright (C) 2007-2012 Free Software Foundation, Inc. 2 Copyright (C) 2007-2012 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
@@ -292,7 +292,7 @@ intern_font_name (char * string)
292 Lisp_Object str = DECODE_SYSTEM (build_string (string)); 292 Lisp_Object str = DECODE_SYSTEM (build_string (string));
293 int len = SCHARS (str); 293 int len = SCHARS (str);
294 Lisp_Object obarray = check_obarray (Vobarray); 294 Lisp_Object obarray = check_obarray (Vobarray);
295 Lisp_Object tem = oblookup (obarray, SDATA (str), len, len); 295 Lisp_Object tem = oblookup (obarray, SDATA (str), len, len);
296 /* This code is similar to intern function from lread.c. */ 296 /* This code is similar to intern function from lread.c. */
297 return SYMBOLP (tem) ? tem : Fintern (str, obarray); 297 return SYMBOLP (tem) ? tem : Fintern (str, obarray);
298} 298}
@@ -1394,7 +1394,7 @@ font_matches_spec (DWORD type, NEWTEXTMETRICEX *font,
1394 currently appear in fontset.el, so it isn't worth 1394 currently appear in fontset.el, so it isn't worth
1395 creating a mapping table of codepages/scripts to languages 1395 creating a mapping table of codepages/scripts to languages
1396 or opening the font to see if there are any language tags 1396 or opening the font to see if there are any language tags
1397 in it that the W32 API does not expose. Fontset 1397 in it that the Windows API does not expose. Fontset
1398 spec should have a fallback, as some backends do 1398 spec should have a fallback, as some backends do
1399 not recognize language at all. */ 1399 not recognize language at all. */
1400 return 0; 1400 return 0;
diff --git a/src/w32font.h b/src/w32font.h
index 40edafa146d..b08d48a3d36 100644
--- a/src/w32font.h
+++ b/src/w32font.h
@@ -1,4 +1,4 @@
1/* Shared GDI and Uniscribe Font backend declarations for the W32 API. 1/* Shared GDI and Uniscribe Font backend declarations for the Windows API.
2 Copyright (C) 2007-2012 Free Software Foundation, Inc. 2 Copyright (C) 2007-2012 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
diff --git a/src/w32gui.h b/src/w32gui.h
index 1e800e3cf3a..1ea185bfaa1 100644
--- a/src/w32gui.h
+++ b/src/w32gui.h
@@ -1,4 +1,4 @@
1/* Definitions and headers for communication on the Microsoft W32 API. 1/* Definitions and headers for communication on the Microsoft Windows API.
2 Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc. 2 Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
diff --git a/src/w32heap.c b/src/w32heap.c
index cc5e5cd2bf5..26cc9aa0a0f 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -1,4 +1,4 @@
1/* Heap management routines for GNU Emacs on the Microsoft W32 API. 1/* Heap management routines for GNU Emacs on the Microsoft Windows API.
2 Copyright (C) 1994, 2001-2012 Free Software Foundation, Inc. 2 Copyright (C) 1994, 2001-2012 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
@@ -66,7 +66,7 @@ cache_system_info (void)
66 w32_minor_version = version.info.minor; 66 w32_minor_version = version.info.minor;
67 67
68 if (version.info.platform & 0x8000) 68 if (version.info.platform & 0x8000)
69 os_subtype = OS_WIN95; 69 os_subtype = OS_9X;
70 else 70 else
71 os_subtype = OS_NT; 71 os_subtype = OS_NT;
72 72
@@ -79,7 +79,7 @@ cache_system_info (void)
79 GetVersionEx (&osinfo_cache); 79 GetVersionEx (&osinfo_cache);
80 80
81 w32_build_number = osinfo_cache.dwBuildNumber; 81 w32_build_number = osinfo_cache.dwBuildNumber;
82 if (os_subtype == OS_WIN95) 82 if (os_subtype == OS_9X)
83 w32_build_number &= 0xffff; 83 w32_build_number &= 0xffff;
84} 84}
85 85
diff --git a/src/w32heap.h b/src/w32heap.h
index b2d51655098..fda3c58bf01 100644
--- a/src/w32heap.h
+++ b/src/w32heap.h
@@ -51,7 +51,7 @@ extern int w32_minor_version;
51extern int w32_build_number; 51extern int w32_build_number;
52 52
53enum { 53enum {
54 OS_WIN95 = 1, 54 OS_9X = 1,
55 OS_NT 55 OS_NT
56}; 56};
57 57
@@ -92,4 +92,3 @@ IMAGE_SECTION_HEADER * find_section (char * name, IMAGE_NT_HEADERS * nt_header);
92IMAGE_SECTION_HEADER * rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header); 92IMAGE_SECTION_HEADER * rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header);
93 93
94#endif /* NTHEAP_H_ */ 94#endif /* NTHEAP_H_ */
95
diff --git a/src/w32inevt.c b/src/w32inevt.c
index a85fdbbe435..731dd6715dc 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -1,4 +1,4 @@
1/* Input event support for Emacs on the Microsoft W32 API. 1/* Input event support for Emacs on the Microsoft Windows API.
2 Copyright (C) 1992-1993, 1995, 2001-2012 Free Software Foundation, Inc. 2 Copyright (C) 1992-1993, 1995, 2001-2012 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
@@ -41,6 +41,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41#include "termchar.h" 41#include "termchar.h"
42#include "w32heap.h" 42#include "w32heap.h"
43#include "w32term.h" 43#include "w32term.h"
44#include "w32inevt.h"
44 45
45/* stdin, from w32console.c */ 46/* stdin, from w32console.c */
46extern HANDLE keyboard_handle; 47extern HANDLE keyboard_handle;
@@ -61,6 +62,15 @@ static INPUT_RECORD *queue_ptr = event_queue, *queue_end = event_queue;
61/* Temporarily store lead byte of DBCS input sequences. */ 62/* Temporarily store lead byte of DBCS input sequences. */
62static char dbcs_lead = 0; 63static char dbcs_lead = 0;
63 64
65static inline BOOL
66w32_read_console_input (HANDLE h, INPUT_RECORD *rec, DWORD recsize,
67 DWORD *waiting)
68{
69 return (w32_console_unicode_input
70 ? ReadConsoleInputW (h, rec, recsize, waiting)
71 : ReadConsoleInputA (h, rec, recsize, waiting));
72}
73
64static int 74static int
65fill_queue (BOOL block) 75fill_queue (BOOL block)
66{ 76{
@@ -80,8 +90,8 @@ fill_queue (BOOL block)
80 return 0; 90 return 0;
81 } 91 }
82 92
83 rc = ReadConsoleInput (keyboard_handle, event_queue, EVENT_QUEUE_SIZE, 93 rc = w32_read_console_input (keyboard_handle, event_queue, EVENT_QUEUE_SIZE,
84 &events_waiting); 94 &events_waiting);
85 if (!rc) 95 if (!rc)
86 return -1; 96 return -1;
87 queue_ptr = event_queue; 97 queue_ptr = event_queue;
@@ -175,9 +185,11 @@ is_dead_key (int wparam)
175} 185}
176#endif 186#endif
177 187
178/* The return code indicates key code size. */ 188/* The return code indicates key code size. cpID is the codepage to
189 use for translation to Unicode; -1 means use the current console
190 input codepage. */
179int 191int
180w32_kbd_patch_key (KEY_EVENT_RECORD *event) 192w32_kbd_patch_key (KEY_EVENT_RECORD *event, int cpId)
181{ 193{
182 unsigned int key_code = event->wVirtualKeyCode; 194 unsigned int key_code = event->wVirtualKeyCode;
183 unsigned int mods = event->dwControlKeyState; 195 unsigned int mods = event->dwControlKeyState;
@@ -224,7 +236,7 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event)
224#endif 236#endif
225 237
226 /* On NT, call ToUnicode instead and then convert to the current 238 /* On NT, call ToUnicode instead and then convert to the current
227 locale's default codepage. */ 239 console input codepage. */
228 if (os_subtype == OS_NT) 240 if (os_subtype == OS_NT)
229 { 241 {
230 WCHAR buf[128]; 242 WCHAR buf[128];
@@ -233,14 +245,13 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event)
233 keystate, buf, 128, 0); 245 keystate, buf, 128, 0);
234 if (isdead > 0) 246 if (isdead > 0)
235 { 247 {
236 char cp[20]; 248 /* When we are called from the GUI message processing code,
237 int cpId; 249 we are passed the current keyboard codepage, a positive
250 number, to use below. */
251 if (cpId == -1)
252 cpId = GetConsoleCP ();
238 253
239 event->uChar.UnicodeChar = buf[isdead - 1]; 254 event->uChar.UnicodeChar = buf[isdead - 1];
240
241 GetLocaleInfo (GetThreadLocale (),
242 LOCALE_IDEFAULTANSICODEPAGE, cp, 20);
243 cpId = atoi (cp);
244 isdead = WideCharToMultiByte (cpId, 0, buf, isdead, 255 isdead = WideCharToMultiByte (cpId, 0, buf, isdead,
245 ansi_code, 4, NULL, NULL); 256 ansi_code, 4, NULL, NULL);
246 } 257 }
@@ -437,7 +448,7 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
437 base character (ie. translating the base key plus shift 448 base character (ie. translating the base key plus shift
438 modifier). */ 449 modifier). */
439 else if (event->uChar.AsciiChar == 0) 450 else if (event->uChar.AsciiChar == 0)
440 w32_kbd_patch_key (event); 451 w32_kbd_patch_key (event, -1);
441 } 452 }
442 453
443 if (event->uChar.AsciiChar == 0) 454 if (event->uChar.AsciiChar == 0)
@@ -447,26 +458,34 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
447 } 458 }
448 else if (event->uChar.AsciiChar > 0) 459 else if (event->uChar.AsciiChar > 0)
449 { 460 {
461 /* Pure ASCII characters < 128. */
450 emacs_ev->kind = ASCII_KEYSTROKE_EVENT; 462 emacs_ev->kind = ASCII_KEYSTROKE_EVENT;
451 emacs_ev->code = event->uChar.AsciiChar; 463 emacs_ev->code = event->uChar.AsciiChar;
452 } 464 }
453 else if (event->uChar.UnicodeChar > 0) 465 else if (event->uChar.UnicodeChar > 0
466 && w32_console_unicode_input)
454 { 467 {
468 /* Unicode codepoint; only valid if we are using Unicode
469 console input mode. */
455 emacs_ev->kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT; 470 emacs_ev->kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
456 emacs_ev->code = event->uChar.UnicodeChar; 471 emacs_ev->code = event->uChar.UnicodeChar;
457 } 472 }
458 else 473 else
459 { 474 {
460 /* Fallback for non-Unicode versions of Windows. */ 475 /* Fallback handling of non-ASCII characters for non-Unicode
476 versions of Windows, and for non-Unicode input on NT
477 family of Windows. Only characters in the current
478 console codepage are supported by this fallback. */
461 wchar_t code; 479 wchar_t code;
462 char dbcs[2]; 480 char dbcs[2];
463 char cp[20];
464 int cpId; 481 int cpId;
465 482
466 /* Get the codepage to interpret this key with. */ 483 /* Get the current console input codepage to interpret this
467 GetLocaleInfo (GetThreadLocale (), 484 key with. Note that the system defaults for the OEM
468 LOCALE_IDEFAULTANSICODEPAGE, cp, 20); 485 codepage could have been changed by calling SetConsoleCP
469 cpId = atoi (cp); 486 or w32-set-console-codepage, so using GetLocaleInfo to
487 get LOCALE_IDEFAULTCODEPAGE is not TRT here. */
488 cpId = GetConsoleCP ();
470 489
471 dbcs[0] = dbcs_lead; 490 dbcs[0] = dbcs_lead;
472 dbcs[1] = event->uChar.AsciiChar; 491 dbcs[1] = event->uChar.AsciiChar;
@@ -501,6 +520,7 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
501 } 520 }
502 else 521 else
503 { 522 {
523 /* Function keys and other non-character keys. */
504 emacs_ev->kind = NON_ASCII_KEYSTROKE_EVENT; 524 emacs_ev->kind = NON_ASCII_KEYSTROKE_EVENT;
505 emacs_ev->code = event->wVirtualKeyCode; 525 emacs_ev->code = event->wVirtualKeyCode;
506 } 526 }
diff --git a/src/w32inevt.h b/src/w32inevt.h
index d228637abfb..c874e58ef39 100644
--- a/src/w32inevt.h
+++ b/src/w32inevt.h
@@ -1,4 +1,4 @@
1/* Input routines for GNU Emacs on the Microsoft W32 API. 1/* Input routines for GNU Emacs on the Microsoft Windows API.
2 Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc. 2 Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
@@ -19,6 +19,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19#ifndef EMACS_W32INEVT_H 19#ifndef EMACS_W32INEVT_H
20#define EMACS_W32INEVT_H 20#define EMACS_W32INEVT_H
21 21
22extern int w32_console_unicode_input;
23
22extern int w32_console_read_socket (struct terminal *term, int numchars, 24extern int w32_console_read_socket (struct terminal *term, int numchars,
23 struct input_event *hold_quit); 25 struct input_event *hold_quit);
24extern void w32_console_mouse_position (FRAME_PTR *f, int insist, 26extern void w32_console_mouse_position (FRAME_PTR *f, int insist,
@@ -28,4 +30,3 @@ extern void w32_console_mouse_position (FRAME_PTR *f, int insist,
28 unsigned long *time); 30 unsigned long *time);
29 31
30#endif /* EMACS_W32INEVT_H */ 32#endif /* EMACS_W32INEVT_H */
31
diff --git a/src/w32menu.c b/src/w32menu.c
index 871baedd0d3..09484d74b79 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -1,4 +1,4 @@
1/* Menu support for GNU Emacs on the Microsoft W32 API. 1/* Menu support for GNU Emacs on the Microsoft Windows API.
2 Copyright (C) 1986, 1988, 1993-1994, 1996, 1998-1999, 2001-2012 2 Copyright (C) 1986, 1988, 1993-1994, 1996, 1998-1999, 2001-2012
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
diff --git a/src/w32proc.c b/src/w32proc.c
index afc1b21fdde..cfc82fa2c47 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1,4 +1,4 @@
1/* Process support for GNU Emacs on the Microsoft W32 API. 1/* Process support for GNU Emacs on the Microsoft Windows API.
2 Copyright (C) 1992, 1995, 1999-2012 Free Software Foundation, Inc. 2 Copyright (C) 1992, 1995, 1999-2012 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
@@ -799,7 +799,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
799 unixtodos_filename (cmdname); 799 unixtodos_filename (cmdname);
800 argv[0] = cmdname; 800 argv[0] = cmdname;
801 801
802 /* Determine whether program is a 16-bit DOS executable, or a w32 802 /* Determine whether program is a 16-bit DOS executable, or a 32-bit Windows
803 executable that is implicitly linked to the Cygnus dll (implying it 803 executable that is implicitly linked to the Cygnus dll (implying it
804 was compiled with the Cygnus GNU toolchain and hence relies on 804 was compiled with the Cygnus GNU toolchain and hence relies on
805 cygwin.dll to parse the command line - we use this to decide how to 805 cygwin.dll to parse the command line - we use this to decide how to
@@ -1386,7 +1386,7 @@ find_child_console (HWND hwnd, LPARAM arg)
1386 1386
1387 GetClassName (hwnd, window_class, sizeof (window_class)); 1387 GetClassName (hwnd, window_class, sizeof (window_class));
1388 if (strcmp (window_class, 1388 if (strcmp (window_class,
1389 (os_subtype == OS_WIN95) 1389 (os_subtype == OS_9X)
1390 ? "tty" 1390 ? "tty"
1391 : "ConsoleWindowClass") == 0) 1391 : "ConsoleWindowClass") == 0)
1392 { 1392 {
@@ -1517,7 +1517,7 @@ sys_kill (int pid, int sig)
1517 if (NILP (Vw32_start_process_share_console) && cp && cp->hwnd) 1517 if (NILP (Vw32_start_process_share_console) && cp && cp->hwnd)
1518 { 1518 {
1519#if 1 1519#if 1
1520 if (os_subtype == OS_WIN95) 1520 if (os_subtype == OS_9X)
1521 { 1521 {
1522/* 1522/*
1523 Another possibility is to try terminating the VDM out-right by 1523 Another possibility is to try terminating the VDM out-right by
@@ -1536,7 +1536,7 @@ sys_kill (int pid, int sig)
1536 1536
1537*/ 1537*/
1538#if 0 1538#if 0
1539 /* On Win95, posting WM_QUIT causes the 16-bit subsystem 1539 /* On Windows 95, posting WM_QUIT causes the 16-bit subsystem
1540 to hang when cmdproxy is used in conjunction with 1540 to hang when cmdproxy is used in conjunction with
1541 command.com for an interactive shell. Posting 1541 command.com for an interactive shell. Posting
1542 WM_CLOSE pops up a dialog that, when Yes is selected, 1542 WM_CLOSE pops up a dialog that, when Yes is selected,
@@ -1810,7 +1810,7 @@ If successful, the return value is t, otherwise nil. */)
1810 CHECK_NUMBER (process); 1810 CHECK_NUMBER (process);
1811 1811
1812 /* Allow pid to be an internally generated one, or one obtained 1812 /* Allow pid to be an internally generated one, or one obtained
1813 externally. This is necessary because real pids on Win95 are 1813 externally. This is necessary because real pids on Windows 95 are
1814 negative. */ 1814 negative. */
1815 1815
1816 pid = XINT (process); 1816 pid = XINT (process);
diff --git a/src/w32select.c b/src/w32select.c
index 1d4a6f41bdd..59ff4405368 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -1,4 +1,4 @@
1/* Selection processing for Emacs on the Microsoft W32 API. 1/* Selection processing for Emacs on the Microsoft Windows API.
2 2
3Copyright (C) 1993-1994, 2001-2012 Free Software Foundation, Inc. 3Copyright (C) 1993-1994, 2001-2012 Free Software Foundation, Inc.
4 4
diff --git a/src/w32term.c b/src/w32term.c
index 6f0065de9eb..7c4860d5139 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -1,4 +1,4 @@
1/* Implementation of GUI terminal on the Microsoft W32 API. 1/* Implementation of GUI terminal on the Microsoft Windows API.
2 2
3Copyright (C) 1989, 1993-2012 Free Software Foundation, Inc. 3Copyright (C) 1989, 1993-2012 Free Software Foundation, Inc.
4 4
@@ -155,6 +155,9 @@ int vertical_scroll_bar_bottom_border;
155 155
156int last_scroll_bar_drag_pos; 156int last_scroll_bar_drag_pos;
157 157
158/* Keyboard code page - may be changed by language-change events. */
159int w32_keyboard_codepage;
160
158/* Mouse movement. */ 161/* Mouse movement. */
159 162
160/* Where the mouse was last time we reported a mouse event. */ 163/* Where the mouse was last time we reported a mouse event. */
@@ -188,9 +191,6 @@ static int volatile input_signal_count;
188static int input_signal_count; 191static int input_signal_count;
189#endif 192#endif
190 193
191/* Keyboard code page - may be changed by language-change events. */
192static int keyboard_codepage;
193
194static void x_update_window_end (struct window *, int, int); 194static void x_update_window_end (struct window *, int, int);
195static void w32_handle_tool_bar_click (struct frame *, 195static void w32_handle_tool_bar_click (struct frame *,
196 struct input_event *); 196 struct input_event *);
@@ -4235,14 +4235,14 @@ w32_read_socket (struct terminal *terminal, int expected,
4235 4235
4236 /* lParam contains the input language ID in its low 16 bits. 4236 /* lParam contains the input language ID in its low 16 bits.
4237 Use it to update our record of the keyboard codepage. */ 4237 Use it to update our record of the keyboard codepage. */
4238 keyboard_codepage = codepage_for_locale ((LCID)(msg.msg.lParam 4238 w32_keyboard_codepage = codepage_for_locale ((LCID)(msg.msg.lParam
4239 & 0xffff)); 4239 & 0xffff));
4240 4240
4241 if (f) 4241 if (f)
4242 { 4242 {
4243 inev.kind = LANGUAGE_CHANGE_EVENT; 4243 inev.kind = LANGUAGE_CHANGE_EVENT;
4244 XSETFRAME (inev.frame_or_window, f); 4244 XSETFRAME (inev.frame_or_window, f);
4245 inev.code = keyboard_codepage; 4245 inev.code = w32_keyboard_codepage;
4246 inev.modifiers = msg.msg.lParam & 0xffff; 4246 inev.modifiers = msg.msg.lParam & 0xffff;
4247 } 4247 }
4248 break; 4248 break;
@@ -4308,7 +4308,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4308 { 4308 {
4309 dbcs[0] = dbcs_lead; 4309 dbcs[0] = dbcs_lead;
4310 dbcs_lead = 0; 4310 dbcs_lead = 0;
4311 if (!MultiByteToWideChar (keyboard_codepage, 0, 4311 if (!MultiByteToWideChar (w32_keyboard_codepage, 0,
4312 dbcs, 2, &code, 1)) 4312 dbcs, 2, &code, 1))
4313 { 4313 {
4314 /* Garbage */ 4314 /* Garbage */
@@ -4318,7 +4318,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4318 break; 4318 break;
4319 } 4319 }
4320 } 4320 }
4321 else if (IsDBCSLeadByteEx (keyboard_codepage, 4321 else if (IsDBCSLeadByteEx (w32_keyboard_codepage,
4322 (BYTE) msg.msg.wParam)) 4322 (BYTE) msg.msg.wParam))
4323 { 4323 {
4324 dbcs_lead = (char) msg.msg.wParam; 4324 dbcs_lead = (char) msg.msg.wParam;
@@ -4327,7 +4327,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4327 } 4327 }
4328 else 4328 else
4329 { 4329 {
4330 if (!MultiByteToWideChar (keyboard_codepage, 0, 4330 if (!MultiByteToWideChar (w32_keyboard_codepage, 0,
4331 &dbcs[1], 1, &code, 1)) 4331 &dbcs[1], 1, &code, 1))
4332 { 4332 {
4333 /* What to do with garbage? */ 4333 /* What to do with garbage? */
@@ -6426,7 +6426,8 @@ w32_initialize (void)
6426 6426
6427 { 6427 {
6428 DWORD input_locale_id = (DWORD) GetKeyboardLayout (0); 6428 DWORD input_locale_id = (DWORD) GetKeyboardLayout (0);
6429 keyboard_codepage = codepage_for_locale ((LCID) (input_locale_id & 0xffff)); 6429 w32_keyboard_codepage =
6430 codepage_for_locale ((LCID) (input_locale_id & 0xffff));
6430 } 6431 }
6431 6432
6432 /* Create the window thread - it will terminate itself when the app 6433 /* Create the window thread - it will terminate itself when the app
diff --git a/src/w32term.h b/src/w32term.h
index 4fdf560dabc..c0a958ba5e5 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -1,4 +1,4 @@
1/* Definitions and headers for communication on the Microsoft W32 API. 1/* Definitions and headers for communication on the Microsoft Windows API.
2 Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc. 2 Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
@@ -667,6 +667,9 @@ extern void x_delete_display (struct w32_display_info *dpyinfo);
667#define RIGHT_WIN_PRESSED 0x4000 667#define RIGHT_WIN_PRESSED 0x4000
668#define APPS_PRESSED 0x2000 668#define APPS_PRESSED 0x2000
669 669
670/* The current ANSI input codepage for GUI sessions. */
671extern int w32_keyboard_codepage;
672
670/* When compiling on Windows 9x/ME and NT 3.x, the following are not defined 673/* When compiling on Windows 9x/ME and NT 3.x, the following are not defined
671 (even though they are supported on 98 and ME. */ 674 (even though they are supported on 98 and ME. */
672#ifndef WM_MOUSELEAVE 675#ifndef WM_MOUSELEAVE
diff --git a/src/w32xfns.c b/src/w32xfns.c
index 0b0fc26fb6a..745a5cfe3e7 100644
--- a/src/w32xfns.c
+++ b/src/w32xfns.c
@@ -1,4 +1,4 @@
1/* Functions taken directly from X sources for use with the Microsoft W32 API. 1/* Functions taken directly from X sources for use with the Microsoft Windows API.
2 Copyright (C) 1989, 1992-1995, 1999, 2001-2012 Free Software Foundation, Inc. 2 Copyright (C) 1989, 1992-1995, 1999, 2001-2012 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
diff --git a/src/xdisp.c b/src/xdisp.c
index 6a9d2d3ac4c..57a8c9d21a3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2408,16 +2408,12 @@ safe_eval_handler (Lisp_Object arg)
2408 return Qnil; 2408 return Qnil;
2409} 2409}
2410 2410
2411 2411/* Call function FUNC with the rest of NARGS - 1 arguments
2412/* Evaluate SEXPR and return the result, or nil if something went 2412 following. Return the result, or nil if something went
2413 wrong. Prevent redisplay during the evaluation. */ 2413 wrong. Prevent redisplay during the evaluation. */
2414 2414
2415/* Call function ARGS[0] with arguments ARGS[1] to ARGS[NARGS - 1].
2416 Return the result, or nil if something went wrong. Prevent
2417 redisplay during the evaluation. */
2418
2419Lisp_Object 2415Lisp_Object
2420safe_call (ptrdiff_t nargs, Lisp_Object *args) 2416safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
2421{ 2417{
2422 Lisp_Object val; 2418 Lisp_Object val;
2423 2419
@@ -2425,8 +2421,17 @@ safe_call (ptrdiff_t nargs, Lisp_Object *args)
2425 val = Qnil; 2421 val = Qnil;
2426 else 2422 else
2427 { 2423 {
2424 va_list ap;
2425 ptrdiff_t i;
2428 ptrdiff_t count = SPECPDL_INDEX (); 2426 ptrdiff_t count = SPECPDL_INDEX ();
2429 struct gcpro gcpro1; 2427 struct gcpro gcpro1;
2428 Lisp_Object *args = alloca (nargs * sizeof (Lisp_Object));
2429
2430 args[0] = func;
2431 va_start (ap, func);
2432 for (i = 1; i < nargs; i++)
2433 args[i] = va_arg (ap, Lisp_Object);
2434 va_end (ap);
2430 2435
2431 GCPRO1 (args[0]); 2436 GCPRO1 (args[0]);
2432 gcpro1.nvars = nargs; 2437 gcpro1.nvars = nargs;
@@ -2449,10 +2454,7 @@ safe_call (ptrdiff_t nargs, Lisp_Object *args)
2449Lisp_Object 2454Lisp_Object
2450safe_call1 (Lisp_Object fn, Lisp_Object arg) 2455safe_call1 (Lisp_Object fn, Lisp_Object arg)
2451{ 2456{
2452 Lisp_Object args[2]; 2457 return safe_call (2, fn, arg);
2453 args[0] = fn;
2454 args[1] = arg;
2455 return safe_call (2, args);
2456} 2458}
2457 2459
2458static Lisp_Object Qeval; 2460static Lisp_Object Qeval;
@@ -2463,17 +2465,13 @@ safe_eval (Lisp_Object sexpr)
2463 return safe_call1 (Qeval, sexpr); 2465 return safe_call1 (Qeval, sexpr);
2464} 2466}
2465 2467
2466/* Call function FN with one argument ARG. 2468/* Call function FN with two arguments ARG1 and ARG2.
2467 Return the result, or nil if something went wrong. */ 2469 Return the result, or nil if something went wrong. */
2468 2470
2469Lisp_Object 2471Lisp_Object
2470safe_call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) 2472safe_call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2)
2471{ 2473{
2472 Lisp_Object args[3]; 2474 return safe_call (3, fn, arg1, arg2);
2473 args[0] = fn;
2474 args[1] = arg1;
2475 args[2] = arg2;
2476 return safe_call (3, args);
2477} 2475}
2478 2476
2479 2477
@@ -2741,7 +2739,11 @@ init_iterator (struct it *it, struct window *w,
2741 frames when the fringes are turned off. But leave the dimensions 2739 frames when the fringes are turned off. But leave the dimensions
2742 zero for tooltip frames, as these glyphs look ugly there and also 2740 zero for tooltip frames, as these glyphs look ugly there and also
2743 sabotage calculations of tooltip dimensions in x-show-tip. */ 2741 sabotage calculations of tooltip dimensions in x-show-tip. */
2744 if (!(FRAMEP (tip_frame) && it->f == XFRAME (tip_frame))) 2742#ifdef HAVE_WINDOW_SYSTEM
2743 if (!(FRAME_WINDOW_P (it->f)
2744 && FRAMEP (tip_frame)
2745 && it->f == XFRAME (tip_frame)))
2746#endif
2745 { 2747 {
2746 if (it->line_wrap == TRUNCATE) 2748 if (it->line_wrap == TRUNCATE)
2747 { 2749 {
@@ -20517,7 +20519,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
20517 20519
20518 depth++; 20520 depth++;
20519 20521
20520 switch (SWITCH_ENUM_CAST (XTYPE (elt))) 20522 switch (XTYPE (elt))
20521 { 20523 {
20522 case Lisp_String: 20524 case Lisp_String:
20523 { 20525 {
@@ -29184,14 +29186,14 @@ and is used only on frames for which no explicit name has been set
29184\(see `modify-frame-parameters'). */); 29186\(see `modify-frame-parameters'). */);
29185 Vicon_title_format 29187 Vicon_title_format
29186 = Vframe_title_format 29188 = Vframe_title_format
29187 = pure_cons (intern_c_string ("multiple-frames"), 29189 = listn (CONSTYPE_PURE, 3,
29188 pure_cons (build_pure_c_string ("%b"), 29190 intern_c_string ("multiple-frames"),
29189 pure_cons (pure_cons (empty_unibyte_string, 29191 build_pure_c_string ("%b"),
29190 pure_cons (intern_c_string ("invocation-name"), 29192 listn (CONSTYPE_PURE, 4,
29191 pure_cons (build_pure_c_string ("@"), 29193 empty_unibyte_string,
29192 pure_cons (intern_c_string ("system-name"), 29194 intern_c_string ("invocation-name"),
29193 Qnil)))), 29195 build_pure_c_string ("@"),
29194 Qnil))); 29196 intern_c_string ("system-name")));
29195 29197
29196 DEFVAR_LISP ("message-log-max", Vmessage_log_max, 29198 DEFVAR_LISP ("message-log-max", Vmessage_log_max,
29197 doc: /* Maximum number of lines to keep in the message log buffer. 29199 doc: /* Maximum number of lines to keep in the message log buffer.
diff --git a/src/xfaces.c b/src/xfaces.c
index e9089017c4e..6a34c3c8893 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -2254,11 +2254,7 @@ merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid)
2254 { 2254 {
2255 /* Call function with current height as argument. 2255 /* Call function with current height as argument.
2256 From is the new height. */ 2256 From is the new height. */
2257 Lisp_Object args[2]; 2257 result = safe_call1 (from, to);
2258
2259 args[0] = from;
2260 args[1] = to;
2261 result = safe_call (2, args);
2262 2258
2263 /* Ensure that if TO was absolute, so is the result. */ 2259 /* Ensure that if TO was absolute, so is the result. */
2264 if (INTEGERP (to) && !INTEGERP (result)) 2260 if (INTEGERP (to) && !INTEGERP (result))
diff --git a/src/xfns.c b/src/xfns.c
index e431651d93a..c8c96b642f0 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5822,7 +5822,7 @@ syms_of_xfns (void)
5822 /* This is the end of symbol initialization. */ 5822 /* This is the end of symbol initialization. */
5823 5823
5824 Fput (Qundefined_color, Qerror_conditions, 5824 Fput (Qundefined_color, Qerror_conditions,
5825 pure_cons (Qundefined_color, pure_cons (Qerror, Qnil))); 5825 listn (CONSTYPE_PURE, 2, Qundefined_color, Qerror));
5826 Fput (Qundefined_color, Qerror_message, 5826 Fput (Qundefined_color, Qerror_message,
5827 build_pure_c_string ("Undefined color")); 5827 build_pure_c_string ("Undefined color"));
5828 5828