aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2010-05-13 15:13:52 +0200
committerJoakim Verona2010-05-13 15:13:52 +0200
commitce07fa9adcea121b5515f98e161e257d1210c9b0 (patch)
treee1f4791841752bfc70d9daa3f5ddcb75ec2a8193 /src
parent86fa4cb5094901384f680e2ba4d6424e53fa820c (diff)
parent38d93f03c75ddbf853fe9de5444ee2d4e01226a0 (diff)
downloademacs-ce07fa9adcea121b5515f98e161e257d1210c9b0.tar.gz
emacs-ce07fa9adcea121b5515f98e161e257d1210c9b0.zip
merge and fixes
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit15
-rw-r--r--src/ChangeLog1066
-rw-r--r--src/ChangeLog.18
-rw-r--r--src/ChangeLog.216
-rw-r--r--src/ChangeLog.32
-rw-r--r--src/ChangeLog.427
-rw-r--r--src/ChangeLog.52
-rw-r--r--src/ChangeLog.914
-rw-r--r--src/Makefile.in540
-rw-r--r--src/alloc.c98
-rw-r--r--src/bidi.c99
-rw-r--r--src/buffer.c221
-rw-r--r--src/buffer.h28
-rw-r--r--src/bytecode.c14
-rw-r--r--src/callproc.c8
-rw-r--r--src/character.h2
-rw-r--r--src/charset.c5
-rw-r--r--src/coding.c2
-rw-r--r--src/composite.c40
-rw-r--r--src/config.in62
-rw-r--r--src/data.c1269
-rw-r--r--src/dired.c6
-rw-r--r--src/dispextern.h34
-rw-r--r--src/dispnew.c6
-rw-r--r--src/doc.c2
-rw-r--r--src/ecrt0.c11
-rw-r--r--src/emacs.c31
-rw-r--r--src/eval.c356
-rw-r--r--src/fileio.c217
-rw-r--r--src/floatfns.c70
-rw-r--r--src/fns.c12
-rw-r--r--src/font.c8
-rw-r--r--src/frame.c23
-rw-r--r--src/frame.h2
-rw-r--r--src/fringe.c16
-rw-r--r--src/ftfont.c370
-rw-r--r--src/gtkutil.c283
-rw-r--r--src/image.c2
-rw-r--r--src/insdel.c2
-rw-r--r--src/keyboard.c62
-rw-r--r--src/lisp.h315
-rw-r--r--src/lread.c94
-rw-r--r--src/m/alpha.h41
-rw-r--r--src/m/amdx86-64.h85
-rw-r--r--src/m/arm.h24
-rw-r--r--src/m/hp800.h69
-rw-r--r--src/m/ia64.h19
-rw-r--r--src/m/ibmrs6000.h31
-rw-r--r--src/m/ibmrs6000.inp4
-rw-r--r--src/m/ibms390.h19
-rw-r--r--src/m/ibms390x.h45
-rw-r--r--src/m/intel386.h65
-rw-r--r--src/m/iris4d.h31
-rw-r--r--src/m/m68k.h8
-rw-r--r--src/m/macppc.h24
-rw-r--r--src/m/mips.h41
-rw-r--r--src/m/sh3.h2
-rw-r--r--src/m/sparc.h43
-rw-r--r--src/m/template.h42
-rw-r--r--src/m/vax.h17
-rw-r--r--src/m/xtensa.h2
-rw-r--r--src/makefile.w32-in22
-rw-r--r--src/msdos.c11
-rw-r--r--src/nsmenu.m2
-rw-r--r--src/print.c64
-rw-r--r--src/process.c30
-rw-r--r--src/s/aix4-2.h87
-rw-r--r--src/s/bsd-common.h39
-rw-r--r--src/s/cygwin.h41
-rw-r--r--src/s/darwin.h127
-rw-r--r--src/s/freebsd.h59
-rw-r--r--src/s/gnu-linux.h114
-rw-r--r--src/s/gnu.h7
-rw-r--r--src/s/hpux10-20.h118
-rw-r--r--src/s/hpux11.h5
-rw-r--r--src/s/irix6-5.h23
-rw-r--r--src/s/ms-w32.h104
-rw-r--r--src/s/msdos.h63
-rw-r--r--src/s/netbsd.h58
-rw-r--r--src/s/openbsd.h29
-rw-r--r--src/s/sol2-10.h26
-rw-r--r--src/s/sol2-6.h47
-rw-r--r--src/s/template.h74
-rw-r--r--src/s/unixware.h28
-rw-r--r--src/s/usg5-4.h100
-rw-r--r--src/syntax.c2
-rw-r--r--src/sysdep.c126
-rw-r--r--src/syssignal.h11
-rw-r--r--src/systty.h7
-rw-r--r--src/term.c44
-rw-r--r--src/w16select.c4
-rw-r--r--src/w32.c24
-rw-r--r--src/w32console.c56
-rw-r--r--src/w32fns.c14
-rw-r--r--src/w32term.c6
-rw-r--r--src/window.c35
-rw-r--r--src/xdisp.c803
-rw-r--r--src/xmenu.c7
-rw-r--r--src/xrdb.c16
-rw-r--r--src/xsettings.c257
-rw-r--r--src/xsettings.h1
-rw-r--r--src/xsmfns.c27
-rw-r--r--src/xterm.c65
103 files changed, 5075 insertions, 3780 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index b959baae8f3..5ecdaa4a572 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -21,6 +21,8 @@
21 21
22# Force loading of symbols, enough to give us gdb_valbits etc. 22# Force loading of symbols, enough to give us gdb_valbits etc.
23set main 23set main
24# With some compilers, we need this to give us struct Lisp_Symbol etc.:
25set Fmake_symbol
24 26
25# Find lwlib source files too. 27# Find lwlib source files too.
26dir ../lwlib 28dir ../lwlib
@@ -889,6 +891,19 @@ Print the address of the char-table $, and its purpose.
889This command assumes that $ is an Emacs Lisp char-table value. 891This command assumes that $ is an Emacs Lisp char-table value.
890end 892end
891 893
894define xsubchartable
895 xgetptr $
896 print (struct Lisp_Sub_Char_Table *) $ptr
897 xgetint $->depth
898 set $depth = $int
899 xgetint $->min_char
900 printf "Depth: %d, Min char: %d (0x%x)\n", $depth, $int, $int
901end
902document xsubchartable
903Print the address of the sub-char-table $, its depth and min-char.
904This command assumes that $ is an Emacs Lisp sub-char-table value.
905end
906
892define xboolvector 907define xboolvector
893 xgetptr $ 908 xgetptr $
894 print (struct Lisp_Bool_Vector *) $ptr 909 print (struct Lisp_Bool_Vector *) $ptr
diff --git a/src/ChangeLog b/src/ChangeLog
index a32558a2ac7..16c20e188b4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,1037 @@
12010-05-12 Glenn Morris <rgm@gnu.org>
2
3 * Makefile.in (YMF_PASS_LDFLAGS, LD, LINKER): Simplify the logic.
4 (LINKER_WAS_SPECIFIED): Remove.
5
6 * Makefile.in (LIB_GCC): Set using configure, not cpp.
7 (GNULIB_VAR) [!ORDINARY_LINK]: Always set to $LIB_GCC.
8 * m/arm.h (LIB_GCC) [GNU_LINUX]:
9 * s/cygwin.h (LIB_GCC):
10 * s/freebsd.h (LIB_GCC):
11 * s/gnu-linux.h (LIB_GCC):
12 * s/msdos.h (LIB_GCC):
13 * s/netbsd.h (LIB_GCC):
14 Move to configure.
15
162010-05-11 Karel Klic <kklic@redhat.com>
17
18 * ftfont.c: Fix incorrect parentheses of #if condition for
19 definining M17N_FLT_USE_NEW_FEATURE.
20
212010-05-11 Glenn Morris <rgm@gnu.org>
22
23 * Makefile.in (LIBS_SYSTEM) [MSDOS]: Do not reset.
24 * s/msdos.h (MSDOS_LIBS_SYSTEM): Remove.
25
262010-05-10 Eli Zaretskii <eliz@gnu.org>
27
28 * xdisp.c (init_iterator): Don't turn on bidi reordering in
29 unibyte buffers. See
30 http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00263.html.
31
322010-05-10 Glenn Morris <rgm@gnu.org>
33
34 * Makefile.in (LIBS_SYSTEM): Set using configure, not cpp.
35 (LIBS_SYSTEM) [MSDOS]: Reset with MSDOS_LIBS_SYSTEM.
36 (LIBES): Use LIBS_SYSTEM as a variable.
37 * s/msdos.h (LIBS_SYSTEM): Rename to MSDOS_LIBS_SYSTEM. Always define.
38 * s/aix4-2.h (LIBS_SYSTEM):
39 * s/freebsd.h (LIBS_SYSTEM):
40 * s/hpux10-20.h (LIBS_SYSTEM):
41 * s/sol2-6.h (LIBS_SYSTEM):
42 * s/unixware.h (LIBS_SYSTEM):
43 Move to configure.
44
45 * s/aix4-2.h (MAIL_USE_LOCKF):
46 * s/bsd-common.h (MAIL_USE_FLOCK):
47 * s/darwin.h (MAIL_USE_FLOCK):
48 * s/gnu-linux.h (MAIL_USE_FLOCK):
49 * s/irix6-5.h (MAIL_USE_FLOCK):
50 * s/template.h (MAIL_USE_FLOCK):
51 Move to configure.
52
532010-05-08 Chong Yidong <cyd@stupidchicken.com>
54
55 * Version 23.2 released.
56
572010-05-08 Andreas Schwab <schwab@linux-m68k.org>
58
59 * composite.c (autocmp_chars): Save point as marker before calling
60 auto-composition-function (Bug#5984).
61
62 * lisp.h (restore_point_unwind): Add prototype.
63
64 * fileio.c (restore_point_unwind): Remove static attribute.
65
662010-05-08 Kenichi Handa <handa@m17n.org>
67
68 * ftfont.c (M17N_FLT_USE_NEW_FEATURE): Define it if we can use the
69 new feature of libotf and m17n-flt.
70 (ftfont_check_otf) [M17N_FLT_USE_NEW_FEATURE]:
71 Call OTF_check_features even if no specific feature is given.
72 (PACK_OTF_TAG) [M17N_FLT_USE_NEW_FEATURE]: New macro.
73 (ftfont_drive_otf) [M17N_FLT_USE_NEW_FEATURE]: Handle the case
74 that OUT is NULL. Use OTF_drive_gsub_with_log and
75 OTF_drive_gpos_with_log instead of OTF_drive_gsub and
76 OTF_drive_gpos.
77 (ftfont_try_otf) [M17N_FLT_USE_NEW_FEATURE]: New function.
78 (ftfont_shape_by_flt) [M17N_FLT_USE_NEW_FEATURE]:
79 Setup mflt_enable_new_feature and mflt_try_otf.
80
812010-05-08 Jan Djärv <jan.h.d@swipnet.se>
82
83 * xsettings.c (Ftool_bar_get_system_style): Correct comment.
84
85 * gtkutil.c (xg_pack_tool_bar): Change show_all to show for handle
86 box and toolbar (Bug #6139).
87 (xg_create_tool_bar): Remove comment (Bug #6139).
88 (xg_make_tool_item): Remove gtk_widget_show_all (Bug #6139).
89 (xg_show_toolbar_item): Add gtk_widget_show for weventbox (Bug #6139).
90
912010-05-08 Juanma Barranquero <lekktu@gmail.com>
92
93 * makefile.w32-in ($(BLD)/eval.$(O), $(BLD)/w32fns.$(O)):
94 Update dependencies.
95
962010-05-08 Eli Zaretskii <eliz@gnu.org>
97
98 * fringe.c (update_window_fringes): Set up truncation bitmaps for
99 R2L lines.
100
1012010-05-08 Glenn Morris <rgm@gnu.org>
102
103 * Makefile.in (THIS_IS_MAKEFILE): Remove, unused.
104
105 * Makefile.in (LIBS_TERMCAP): Set with configure, not cpp.
106 (TERMCAP_OBJ): New, set by configure, replacing termcapobj.
107 (termcapobj): Replace with TERMCAP_OBJ.
108 (otherobj): Use $TERMCAP_OBJ instead of $termcapobj.
109 (LIBES): Use LIBS_TERMCAP as a variable.
110
111 * s/freebsd.h (osreldate.h): No longer include, since this file
112 does not use __FreeBSD_version any more.
113
114 * s/aix4-2.h (TERMINFO):
115 * s/cygwin.h (TERMINFO):
116 * s/darwin.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]:
117 * s/freebsd.h (TERMINFO, LIBS_TERMCAP):
118 * s/gnu-linux.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]:
119 * s/gnu.h (TERMINFO, LIBS_TERMCAP) [HAVE_LIBNCURSES]:
120 * s/hpux10-20.h (TERMINFO, LIBS_TERMCAP):
121 * s/irix6-5.h (TERMINFO):
122 * s/netbsd.h (LIBS_TERMCAP):
123 * s/openbsd.h (TERMINFO, LIBS_TERMCAP):
124 * s/sol2-6.h (LIBS_TERMCAP) [!TERMINFO]:
125 * s/usg5-4.h (TERMINFO):
126 Move to configure.
127
1282010-05-07 Stefan Monnier <monnier@iro.umontreal.ca>
129
130 * eval.c (unbind_to): Don't unbind a local binding into the global
131 binding when the local binding disappeared. Inversely, don't unbind
132 a global binding into a newly created local binding.
133 * data.c (set_internal): Make its `buf' arg into a `where' arg so we
134 can specify the frame to use, when applicable. Adjust callers.
135
1362010-05-07 Vincent Belaïche <vincent.belaiche@gmail.com>
137 Stefan Monnier <monnier@iro.umontreal.ca>
138
139 * floatfns.c (Fisnan, Fcopysign, Ffrexp, Fldexp): New functions.
140
1412010-05-07 Eli Zaretskii <eliz@gnu.org>
142
143 * w32fns.c: Include w32.h.
144 (Fw32_shell_execute): Decode the error message before passing it
145 to `error'. (Bug#6126)
146
147 * msdos.c (dos_set_window_size):
148 * w16select.c (Fx_selection_exists_p): Use `Fsymbol_value (foo)'
149 instead of `XSYMBOL (foo)->value'.
150
1512010-05-07 Eli Zaretskii <eliz@gnu.org>
152
153 Fix the MS-DOS build, broken by autoconfiscation.
154
155 * Makefile.in: Don't use Make-style comments past the "start of
156 cpp stuff" line.
157 (MSDOS_OBJ): Remove xmenu.o (it is now defined by XMENU_OBJ).
158
159 * s/msdos.h (UNEXEC): Don't define (@unexec@ in Makefile.in is
160 edited directly by msdos/sed1v2.inp).
161
1622010-05-07 Glenn Morris <rgm@gnu.org>
163
164 * Makefile.in (LD_SWITCH_SYSTEM): Set with configure, not cpp.
165 (LD_SWITCH_SYSTEM_EXTRA): New variable, set by configure.
166 (TEMACS_LDFLAGS): Use $LD_SWITCH_SYSTEM and $LD_SWITCH_SYSTEM_EXTRA,
167 move out of cpp section.
168 * s/freebsd.h (LD_SWITCH_SYSTEM):
169 * s/gnu-linux.h (LD_SWITCH_SYSTEM):
170 * s/netbsd.h (LD_SWITCH_SYSTEM):
171 * s/openbsd.h (LD_SWITCH_SYSTEM): Move to configure.in.
172
1732010-05-07 Dan Nicolaescu <dann@ics.uci.edu>
174
175 Define LIB_STANDARD and START_FILES using autoconf.
176 * s/usg5-4.h (LIB_STANDARD):
177 * s/netbsd.h (START_FILES):
178 * s/irix6-5.h (LIB_STANDARD):
179 * s/hpux10-20.h (LIB_STANDARD, START_FILES):
180 * s/gnu-linux.h (START_FILES, LIB_STANDARD):
181 * s/freebsd.h (START_FILES):
182 * s/darwin.h (START_FILES):
183 * s/cygwin.h (START_FILES):
184 * s/aix4-2.h (LIB_STANDARD):
185 * m/ibmrs6000.h (START_FILES): Remove, move logic to configure.in.
186 * Makefile.in (STARTFILES): Rename to START_FILES, define using
187 autoconf, not cpp.
188
1892010-05-06 Dan Nicolaescu <dann@ics.uci.edu>
190
191 Remove NEED_BSDTTY and NEED_UNISTD_H.
192 * s/hpux10-20.h (NEED_BSDTTY): Remove.
193 * s/aix4-2.h (NEED_UNISTD_H): Remove.
194 * systty.h: Simplify conditionals for including <sys/bsdtty.h>,
195 <sys/ptyio.h> and <unistd.h>.
196
197 * emacs.c (main): Remove NO_DIR_LIBRARY conditional, unused.
198
199 * Makefile.in (STARTFILES): Conditionally define to make the usage clear.
200 * s/gnu.h (START_FILES): Remove empty definition.
201
2022010-05-06 Jan Djärv <jan.h.d@swipnet.se>
203
204 * xterm.c (x_draw_image_relief): Move declaration of extra to beginning.
205
2062010-05-06 Glenn Morris <rgm@gnu.org>
207
208 * Makefile.in (CPP, LN_S): Remove unused variables.
209
2102010-05-05 Stefan Monnier <monnier@iro.umontreal.ca>
211
212 * syntax.c (Fchar_syntax): Check the arg is a character (bug#6080).
213
2142010-05-05 Lawrence Mitchell <wence@gmx.li>
215
216 * m/sparc.h: Fix typo in earlier change.
217
2182010-05-04 Stefan Monnier <monnier@iro.umontreal.ca>
219
220 Misc tweaks.
221 * eval.c (Fdefvaralias): Remove unintended nested if.
222 (internal_condition_case_2, internal_condition_case_n): Use ANSI type.
223
2242010-05-04 Bernhard Herzog <bh@intevation.de> (tiny change)
225
226 * xsmfns.c (smc_save_yourself_CB): strlen(client_id) => strlen(cwd).
227
2282010-05-04 Dan Nicolaescu <dann@ics.uci.edu>
229
230 Remove BSD_PGRPS.
231 * s/bsd-common.h (BSD_PGRPS): Remove undef.
232 * s/gnu-linux.h (BSD_PGRPS): Remove.
233 * term.c (dissociate_if_controlling_tty):
234 * sysdep.c (narrow_foreground_group, widen_foreground_group)
235 (init_sys_modes, reset_sys_modes):
236 * emacs.c (main):
237 * callproc.c (Fcall_process, child_setup): Remove code depending
238 on BSD_PGRPS.
239
240 Remove POSIX_SIGNALS.
241 * s/usg5-4.h (POSIX_SIGNALS):
242 * s/netbsd.h (POSIX_SIGNALS):
243 * s/msdos.h (POSIX_SIGNALS):
244 * s/ms-w32.h (POSIX_SIGNALS):
245 * s/hpux11.h (POSIX_SIGNALS):
246 * s/gnu.h (POSIX_SIGNALS):
247 * s/gnu-linux.h (POSIX_SIGNALS):
248 * s/freebsd.h (POSIX_SIGNALS):
249 * s/darwin.h (POSIX_SIGNALS):
250 * s/cygwin.h (POSIX_SIGNALS):
251 * s/aix4-2.h (POSIX_SIGNALS): Remove definition.
252 * s/unixware.h:
253 * s/sol2-6.h: Remove comments on POSIX_SIGNALS.
254 * process.c (create_process):
255 * syssignal.h:
256 * sysdep.c (wait_for_termination, init_signals):
257 * process.c (create_process):
258 * msdos.c: POSIX_SIGNALS is always defined on all platforms,
259 remove all code that assumes the contrary.
260
2612010-05-04 Glenn Morris <rgm@gnu.org>
262
263 * s/gnu-linux.h (LD_SWITCH_SYSTEM): Use LD_SWITCH_X_SITE_AUX as a shell
264 variable.
265 * s/netbsd.h (LD_SWITCH_SYSTEM_tmp): Remove.
266 (LD_SWITCH_SYSTEM): Use $LD_SWITCH_X_SITE_AUX_RPATH.
267 * s/openbsd.h (LD_SWITCH_SYSTEM_tmp): Remove.
268 (LD_SWITCH_SYSTEM): Use $LD_SWITCH_X_SITE_AUX_RPATH instead of
269 LD_SWITCH_SYSTEM_tmp.
270 * Makefile.in (LD_SWITCH_X_SITE_AUX, LD_SWITCH_X_SITE_AUX_RPATH):
271 New variables, set by configure.
272
273 * s/aix4-2.h (LD_SWITCH_SYSTEM_TEMACS): Move to configure.in.
274 * s/darwin.h (HEADERPAD_EXTRA, LIBS_NSGUI): Remove.
275 (LD_SWITCH_SYSTEM_TEMACS): Move to configure.in.
276 * Makefile.in (LD_SWITCH_SYSTEM_TEMACS): New variable, set by configure.
277 (TEMACS_LDFLAGS): Use $LD_SWITCH_SYSTEM_TEMACS.
278
279 * s/aix4-2.h (C_SWITCH_SYSTEM):
280 * m/alpha.h (C_SWITCH_MACHINE):
281 Move to configure.in.
282 * Makefile.in (C_SWITCH_MACHINE, C_SWITCH_SYSTEM):
283 New variables, set by configure.
284 (ALL_CFLAGS): Use $C_SWITCH_MACHINE and $C_SWITCH_SYSTEM in place of
285 $c_switch_machine and $c_switch_system.
286
2872010-05-04 Dan Nicolaescu <dann@ics.uci.edu>
288
289 * s/hpux10-20.h (LIB_STANDARD): New definition.
290 * Makefile.in (ORDINARY_LINK): Remove setting LIB_STANDARD based
291 on it, not used anymore.
292
2932010-05-03 Chong Yidong <cyd@stupidchicken.com>
294
295 * eval.c (internal_condition_case_n): Rename from
296 internal_condition_case_2.
297 (internal_condition_case_2): New function.
298
299 * xdisp.c (safe_call): Use internal_condition_case_n.
300
301 * fileio.c (Fdelete_file, internal_delete_file): New arg FORCE.
302 (internal_delete_file, Frename_file): Callers changed.
303
304 * buffer.c (Fkill_buffer):
305 * callproc.c (delete_temp_file): Callers changed (Bug#6070).
306
307 * lisp.h: Update prototypes.
308
3092010-05-03 Glenn Morris <rgm@gnu.org>
310
311 * Makefile.in (LIBX_EXTRA, LIBX_BASE): New variables.
312 (LIBXT_OTHER, LIBX_OTHER): New, set by configure.
313 (LIBXT): Set with configure, not cpp.
314 (LIBX): Remove.
315 (LIBES): Replace $LIBX with $LIBX_BASE and $LIBX_OTHER.
316
3172010-05-02 Dan Nicolaescu <dann@ics.uci.edu>
318
319 * m/amdx86-64.h (START_FILES, LIB_STANDARD): Remove.
320 The FreeBSD is not needed, the default works, Solaris version is
321 not needed, and the remaining case is not supported by configure.
322
3232010-05-02 Jan Djärv <jan.h.d@swipnet.se>
324
325 * xsmfns.c (CHDIR_OPT): New define.
326 (smc_save_yourself_CB): Add CHDIR_OPT to options to use when
327 restarting emacs.
328
329 * xterm.c (x_connection_closed): Call Fkill_emacs instead of
330 shut_down_emacs.
331
332 * emacs.c (USAGE1): Mention --chdir.
333 (main): Handle --chdir.
334 (standard_args): Add --chdir.
335 (fatal_error_signal): Call Fkill_emacs for SIGTERM and SIGHUP (Bug
336 #5552).
337
3382010-05-01 Dan Nicolaescu <dann@ics.uci.edu>
339
340 Remove LD_SWITCH_MACHINE.
341 * Makefile.in (LD_SWITCH_MACHINE): Remove definition, unused.
342 (TEMACS_LDFLAGS): Do not use LD_SWITCH_MACHINE.
343
344 Clean up IRIX code.
345 * m/iris4d.h (TERMINFO, FIRST_PTY_LETTER): Move definitions ...
346 * s/irix6-5.h (TERMINFO, FIRST_PTY_LETTER): ... here.
347
348 Clean up AIX code.
349 * m/ibmrs6000.inp: Remove file, unused.
350 * m/ibmrs6000.h (IBMR2AIX): Remove, unused.
351 (LD_SWITCH_MACHINE): Rename to LD_SWITCH_SYSTEM_TEMACS, and move
352 definition ...
353 * s/aix4-2.h (LD_SWITCH_SYSTEM_TEMACS): ... here.
354
355 * sysdep.c (child_setup_tty, init_sys_modes): Remove !IBMR2AIX code,
356 unused.
357
3582010-05-01 Eli Zaretskii <eliz@gnu.org>
359
360 Emulate POSIX_SIGNALS on MS-Windows.
361
362 * s/ms-w32.h (POSIX_SIGNALS, struct sigaction, SIG_BLOCK)
363 (SIG_SETMASK, SIG_UNBLOCK): Define.
364
365 * sysdep.c (sys_signal) [WINDOWSNT]: #ifdef away.
366 (wait_for_termination) [WINDOWSNT]: Move MS-Windows specific code
367 from non-POSIX_SIGNALS section to POSIX_SIGNALS section.
368
369 * w32.c (sigemptyset, sigaddset, sigfillset, sigprocmask):
370 New stubs.
371
372 Miscellaneous fixes of bidi display.
373
374 * xdisp.c (find_row_end): New function, refactored from display_line.
375 (display_line): Use it.
376 (extend_face_to_end_of_line): In almost-filled rows, extend only
377 if the row is R2L and not continued.
378 (display_line): Fix prepending of truncation glyphs to R2L rows.
379 Preserve overlay and string info in row->end.
380 (insert_left_trunc_glyphs): Support addition of left truncation
381 glyphs to R2L rows.
382 (set_cursor_from_row): Don't place cursor on the vertical border
383 glyph between adjacent windows. Fix a crash when a display string
384 is continued to the next line. Don't return zero if cursor was
385 found by `cursor' property of a display string.
386 (try_cursor_movement): Don't assume that row->end == (row+1)->start,
387 test for that explicitly.
388
3892010-05-01 Glenn Morris <rgm@gnu.org>
390
391 * Makefile.in (gmallocobj, rallocobj, vmlimitobj): Initialize to null,
392 for clarity.
393 (OTHER_OBJ): Remove.
394 (PRE_ALLOC_OBJ, POST_ALLOC_OBJ): New, set by configure.
395 (otherobj): Use PRE_ALLOC_OBJ, POST_ALLOC_OBJ rather than OTHER_OBJ.
396
3972010-05-01 Karel Klíč <kklic@redhat.com>
398
399 * fileio.c (Ffile_selinux_context): Context functions may return null.
400
4012010-04-30 Dan Nicolaescu <dann@ics.uci.edu>
402
403 * s/gnu.h (POSIX_SIGNALS, START_FILES): New definitions.
404
4052010-04-30 Glenn Morris <rgm@gnu.org>
406
407 * Makefile.in (vmlimitobj) [!SYSTEM_MALLOC]: New variable. (Bug#6065)
408 (OTHER_OBJ): Define as a separate variable, for clarity.
409
4102010-04-30 Jan Djärv <jan.h.d@swipnet.se>
411
412 * xsettings.c: include limits.h and update file comment.
413
4142010-04-30 Glenn Morris <rgm@gnu.org>
415
416 * Makefile.in (OLDXMENU, LIBXMENU) [HAVE_MENUS]:
417 Set with configure, not cpp.
418 (LIBW): Remove, replace with $TOOLKIT_LIBW.
419
420 * Makefile.in (mallocobj): Remove.
421 (otherobj): Simplify using @OTHER_OBJ@.
422
423 * Makefile.in (dispnew.o, frame.o, fringe.o, font.o, fontset.o)
424 (keyboard.o, window.o, xdisp.o, xfaces.o, menu.o):
425 Don't bother making nsgui.h dependency platform-specific.
426
427 * Makefile.in (nsfns.o): Remove duplicate nsgui.h dependency.
428
4292010-04-29 Stefan Monnier <monnier@iro.umontreal.ca>
430
431 * process.c (read_process_output, exec_sentinel): Don't burp if the
432 sentinel/filter kills the current buffer (bug#6060).
433
434 Fix wrong-docstring problem introduced with hash-consing. (Bug#6008)
435 * eval.c (Fautoload): Set doc to a unique number rather than to 0.
436 Remove unused var `args'.
437 * lisp.h (XSETCARFASTINT, XSETCDRFASTINT): Remove.
438 (LOADHIST_ATTACH): Wrap with do...while to avoid surprises for callers.
439 * doc.c (store_function_docstring): Use XSETCAR.
440
4412010-04-28 Glenn Morris <rgm@gnu.org>
442
443 * Makefile.in (BASE_WINDOW_SUPPORT, X_WINDOW_SUPPORT): New variables.
444 (WINDOW_SUPPORT) [HAVE_WINDOW_SYSTEM]: Use them.
445
446 * Makefile.in (CYGWIN_OBJ): Set with configure, not cpp.
447
448 * Makefile.in (GPM_MOUSE_SUPPORT): New, set by configure.
449 (MOUSE_SUPPORT) [!HAVE_MOUSE]: Use $GPM_MOUSE_SUPPORT.
450
451 * Makefile.in (FONT_OBJ): New, set by configure.
452 (FONT_DRIVERS): Use $FONT_OBJ.
453
454 * Makefile.in (LIBXMU): Set with configure, not cpp.
455 * s/aix4-2.h (LIBXMU):
456 * s/hpux10-20.h (LIBXMU):
457 Remove definition, now set in configure.
458
459 * Makefile.in (NS_OBJ, NS_SUPPORT): Set with configure, not cpp.
460
461 * m/amdx86-64.h [i386]: Move this test to configure.in.
462
4632010-04-27 Glenn Morris <rgm@gnu.org>
464
465 * Makefile.in (LIBXTR6): Set with configure, not cpp.
466 * s/unixware.h (NEED_LIBW): Remove definition.
467
468 * Makefile.in (LUCID_LIBW, MOTIF_LIBW): Remove, replacing by...
469 (TOOLKIT_LIBW): New, set by configure.
470 (@X_TOOLKIT_TYPE@): No longer define it.
471
472 * Makefile.in (LIBXP): Remove, since included in MOTIF_LIBW.
473 (MOTIF_LIBW): Set with configure, not cpp.
474 * s/aix4-2.h (LIB_MOTIF):
475 * s/gnu-linux.h (LIB_MOTIF):
476 * s/unixware.h (LIB_MOTIF): Move to configure.in.
477
4782010-04-27 Dan Nicolaescu <dann@ics.uci.edu>
479
480 Reduce CPP usage.
481 * Makefile.in (LIB_X11_LIB): Remove, inline in the only user.
482 (obj): Use autoconf for unexec instead of cpp.
483 (C_SWITCH_SYSTEM, C_SWITCH_MACHINE, C_SWITCH_X_SITE): Remove
484 definitions and undefs. Inline definitions in the only user.
485 (ALL_CFLAGS): Substitute C_SWITCH_X_SYSTEM using autoconf.
486
4872010-04-27 Glenn Morris <rgm@gnu.org>
488
489 * m/amdx86-64.h (START_FILES, LIB_STANDARD): Change the logic around,
490 since the defaults (set by the system file) are fine in most cases.
491 [GNU_LINUX, __OpenBSD__, __NetBSD__, __APPLE__]: Remove sections.
492 * m/ibms390x.h (START_FILES, LIB_STANDARD):
493 * m/macppc.h (START_FILES, LIB_STANDARD) [GNU_LINUX]:
494 * m/sparc.h (START_FILES, LIB_STANDARD) [__linux__]:
495 Remove definitions, since they are set correctly in s/gnu-linux.h.
496 * s/freebsd.h (START_FILES, LIB_STANDARD):
497 * s/gnu-linux.h (START_FILES, LIB_STANDARD):
498 * s/hpux10-20.h (START_FILES):
499 * s/netbsd.h (START_FILES, LIB_STANDARD, START_FILES_1, END_FILES_1):
500 Use $CRT_DIR in place of fixed /usr/lib, /lib directories.
501
502 * Makefile.in (LIBXP, LUCID_LIBW, WIDGET_OBJ): Set via configure.
503 (MOTIF_LIBW): Use $LIBXP.
504 (otherobj): Use $WIDGET_OBJ.
505
5062010-04-26 Dan Nicolaescu <dann@ics.uci.edu>
507
508 * Makefile.in (LIBS_MACHINE): Remove, unused.
509
510 Use autoconf instead of cpp for LIB_MATH.
511 * s/darwin.h (LIB_MATH): Do not define here, move to configure.
512 * s/cygwin.h (LIB_MATH): Likewise.
513 * Makefile.in (LIB_MATH): Do not define with cpp.
514 (LIBES): Use autoconf for LIB_MATH.
515
5162010-04-26 Kenichi Handa <handa@m17n.org>
517
518 * composite.c (Ffind_composition_internal): Fix the return value
519 for an automatic composition.
520
5212010-04-25 Dan Nicolaescu <dann@ics.uci.edu>
522
523 Remove all NO_ARG_ARRAY uses.
524 * fns.c (concat2, concat3, nconc2):
525 * eval.c (apply1, call1, call2, call3, call4, call5, call6)
526 (call7): Remove NO_ARG_ARRAY usage, assume it's always true.
527 * m/xtensa.h (NO_ARG_ARRAY):
528 * m/template.h (NO_ARG_ARRAY):
529 * m/sparc.h (NO_ARG_ARRAY):
530 * m/sh3.h (NO_ARG_ARRAY):
531 * m/mips.h (NO_ARG_ARRAY):
532 * m/macppc.h (NO_ARG_ARRAY):
533 * m/iris4d.h (NO_ARG_ARRAY):
534 * m/intel386.h (NO_ARG_ARRAY):
535 * m/ibms390x.h (NO_ARG_ARRAY):
536 * m/ibms390.h (NO_ARG_ARRAY):
537 * m/ibmrs6000.h (NO_ARG_ARRAY):
538 * m/ia64.h (NO_ARG_ARRAY):
539 * m/hp800.h (NO_ARG_ARRAY):
540 * m/arm.h (NO_ARG_ARRAY):
541 * m/amdx86-64.h (NO_ARG_ARRAY):
542 * m/alpha.h (NO_ARG_ARRAY): Remove definition.
543
5442010-04-25 Eli Zaretskii <eliz@gnu.org>
545
546 * xdisp.c (display_line): Don't assume 2nd call to
547 get_next_display_element cannot return zero. (Bug#6030)
548 (iterate_out_of_display_property): New function, body from pop_it.
549 (pop_it): Use it.
550
5512010-04-24 Glenn Morris <rgm@gnu.org>
552
553 * m/amdx86-64.h (START_FILES, LIB_STANDARD) [__OpenBSD__]:
554 For clarity, revert to using fixed /usr/lib rather than $CRT_DIR.
555 (START_FILES, LIB_STANDARD) [__FreeBSD__]: Merge into the generic case,
556 since CRT_DIR defaults to /usr/lib. Suggested by Dan Nicolaescu.
557
5582010-04-24 Eli Zaretskii <eliz@gnu.org>
559
560 * xdisp.c (display_line): Use `reseat' instead of `reseat_1', and
561 use `get_next_display_element' and `set_iterator_to_next' to
562 advance to the next character, when looking for the character that
563 begins the next row.
564
565 * .gdbinit: Add a "set Fmake_symbol" line to force GDB to load the
566 definition of "struct Lisp_Symbol".
567
5682010-04-24 Glenn Morris <rgm@gnu.org>
569
570 * Makefile.in (CRT_DIR): New variable, set by configure.
571 * m/amdx86-64.h, m/ibms390x.h (START_FILES, LIB_STANDARD):
572 Use $CRT_DIR rather than HAVE_LIB64_DIR. (Bug#5655)
573
5742010-04-23 Dan Nicolaescu <dann@ics.uci.edu>
575
576 * Makefile.in: Remove C_SWITCH_X_MACHINE, unused.
577
578 * s/cygwin.h (LIBS_DEBUG): Remove, unused.
579
580 Remove redundant flags.
581 * s/freebsd.h (C_SWITCH_SYSTEM):
582 * s/hpux10-20.h (C_SWITCH_X_SYSTEM, LD_SWITCH_X_DEFAULT):
583 * s/netbsd.h (C_SWITCH_SYSTEM):
584 * s/openbsd.h (LD_SWITCH_X_DEFAULT): Remove, configure takes care
585 of these.
586
587 Simplify m/intel386.h.
588 * m/intel386.h (CRT0_DUMMIES): Remove, inline value in the only
589 user: ecrt0.c.
590 (SOLARIS2): Remove LOAD_AVE_TYPE, LOAD_AVE_CVT, LIBS_MACHINE, unused.
591 (USG5_4): Move LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE definitions to
592 the only user: s/unixware.h.
593 * ecrt0.c: Remove #ifndef static. Inline CRT0_DUMMIES definition
594 from m/intel386.h.
595 * s/unixware.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE): Definitions
596 moved here from m/intel386.h.
597
598 * m/mips.h: Remove #if 0 code.
599
6002010-04-23 Eli Zaretskii <eliz@gnu.org>
601
602 Fix display of composed characters from L2R scripts in bidi buffers.
603 * xdisp.c (set_iterator_to_next, next_element_from_composition):
604 After advancing IT past the composition, resync the bidi iterator
605 with IT's position. (Bug#5977)
606
6072010-04-23 Dan Nicolaescu <dann@ics.uci.edu>
608
609 * Makefile.in (LD_SWITCH_MACHINE_TEMACS): Remove, unused.
610 (TEMACS_LDFLAGS): Don't use LD_SWITCH_SYSTEM_TEMACS.
611
6122010-04-23 Stefan Monnier <monnier@iro.umontreal.ca>
613
614 * gtkutil.c: Include xsettings.h for Ftool_bar_get_system_style.
615
6162010-04-23 Eli Zaretskii <eliz@gnu.org>
617
618 Support `display' text properties and overlay strings in bidi buffers.
619 * xdisp.c (pop_it): When the stack is popped after displaying
620 from a string, bidi-iterate to exit from the text portion covered
621 by the `display' property or overlay. (Bug#5988, bug#5920)
622
6232010-04-23 Dan Nicolaescu <dann@ics.uci.edu>
624
625 * m/macppc.h (LD_SWITCH_SYSTEM_TEMACS): Remove #undef.
626 (LD_SWITCH_MACHINE_TEMACS): Remove, configure sets nocombreloc.
627
628 * s/netbsd.h (LD_SWITCH_SYSTEM_TEMACS): Remove, configure sets nocombreloc.
629 * s/openbsd.h (LD_SWITCH_SYSTEM_TEMACS): Remove.
630
631 Simplify STARTFILES definition.
632 * s/hpux10-20.h (START_FILES): Explicitly define here instead of
633 relying on Makefile.in to define it.
634 * s/cygwin.h (START_FILES): Likewise.
635 * Makefile.in (STARTFILES): Remove conditional code, not needed anymore.
636
637 Clean up Solaris code.
638 * s/sol2-6.h (LD_SWITCH_SYSTEM_TEMACS, C_SWITCH_X_SYSTEM)
639 (LIB_MOTIF): Remove, configure takes care of this.
640 (NOT_USING_MOTIF): Remove, unused.
641 * xrdb.c: Remove #if 0-ed #include.
642 (SYSV): Remove conditional for old SysV.
643 * sysdep.c (closedir): Remove conditional code for Solaris,
644 Solaris has closedir.
645
6462010-04-22 Jan Djärv <jan.h.d@swipnet.se>
647
648 * xsettings.c (read_and_apply_settings): Check if current_font is
649 NULL before strcmp (Bug#6001).
650
6512010-04-21 Dan Nicolaescu <dann@ics.uci.edu>
652
653 Clean up HP-UX files.
654 * m/hp800.h (NO_REMAP, VIRT_ADDR_VARIES, DATA_SEG_BITS)
655 (DATA_START, TEXT_START, LOAD_AVE_TYPE, LOAD_AVE_CVT)
656 (LDAV_SYMBOL, index, rindex): Move definitions only used in HP-UX ...
657 * s/hpux10-20.h: ... to the only user, here.
658
6592010-04-21 Eli Zaretskii <eliz@gnu.org>
660
661 * bidi.c (bidi_find_paragraph_start, bidi_at_paragraph_end): Don't
662 use buffer-local values of paragraph-start and paragraph-separate.
663 <paragraph_start_re, paragraph_separate_re>: Rename from
664 fallback_paragraph_start_re and fallback_paragraph_separate_re.
665 (Bug#5992)
666
6672010-04-21 Jan Djärv <jan.h.d@swipnet.se>
668
669 * xsettings.c: Qmonospace_font_name, Qtool_bar_style and
670 current_tool_bar_style are new.
671 (store_config_changed_event): Rename from store_font_changed_event.
672 (XSETTINGS_TOOL_BAR_STYLE): New define.
673 (SEEN_FONT, SEEN_TB_STYLE): New enum values.
674 (struct xsettings): Add font and tb_style, set xft stuff inside #ifdef
675 HAVE_XFT.
676 (something_changedCB): store_font_changed_event is now
677 store_config_changed_event
678 (parse_settings): Rename from parse_xft_settings. Read
679 non-xft xsettings outside #ifdef HAVE_XFT.
680 (read_settings): Renamed from read_xft_settings.
681 (apply_xft_settings): Take current settings as parameter. Do not
682 call read_(xft)_settings.
683 (read_and_apply_settings): New function.
684 (xft_settings_event): Do non-xft stuff out of HAVE_XFT. Call
685 read_and_apply_settings if there are settings to be read.
686 (init_xsettings): Renamed from init_xfd_settings.
687 Call read_and_apply_settings unconditionally.
688 (xsettings_initialize): Call init_xsettings.
689 (Ftool_bar_get_system_style): New function.
690 (syms_of_xsettings): Define Qmonospace_font_name and
691 Qtool_bar_style. Initialize current_tool_bar_style to nil.
692 defsubr Stool_bar_get_system_style. Fprovide on
693 dynamic-setting.
694 Move misplaced HAVE_GCONF
695
696 * xsettings.h (Ftool_bar_get_system_style): Declare.
697
698 * xdisp.c: Vtool_bar_style, tool_bar_max_label_size,
699 Qtext, Qboth, Qboth_horiz are new.
700 (syms_of_xdisp): Intern Qtext, Qboth, Qboth_horiz, DEFVAR
701 Vtool_bar_style, tool_bar_max_label_size.
702
703 * lisp.h: Extern declare Qtext, Qboth, Qboth_horiz.
704
705 * keyboard.c: QClabel is new.
706 (parse_tool_bar_item): Take out QClabel from tool bar items.
707 Try to construct a label if ther is no QClabel.
708 (syms_of_keyboard): Intern :label as QClabel.
709
710 * dispextern.h (tool_bar_item_idx): TOOL_BAR_ITEM_LABEL is new.
711 (Vtool_bar_style, tool_bar_max_label_size, DEFAULT_TOOL_BAR_LABEL_SIZE):
712 New.
713
714 * Makefile.in (SOME_MACHINE_LISP): font-setting.el renamed to
715 dynamic-setting.el.
716
717 * gtkutil.c (xg_tool_bar_menu_proxy): Handle label in tool bar item.
718 (xg_make_tool_item, xg_show_toolbar_item): New function.
719 (update_frame_tool_bar): Take label from TOOL_BAR_ITEM_LABEL.
720 Call xg_make_tool_item to make a tool bar item.
721 Call xg_show_toolbar_item. Use wtoolbar instead of x->toolbar_widget.
722
723 * xterm.c (x_draw_image_relief): Take Vtool_bar_button_margin
724 into account for toolbars.
725
7262010-04-21 Jan Djärv <jan.h.d@swipnet.se>
727
728 * data.c (make_blv): Declarations before code (Bug#5993).
729
7302010-04-21 Glenn Morris <rgm@gnu.org>
731
732 * Makefile.in (DBUS_OBJ, GTK_OBJ, XMENU_OBJ, XOBJ):
733 Define using autoconf, not cpp.
734 (LIBXSM): New variable, set by autoconf.
735 (LIBXT): Use $LIBXSM.
736
7372010-04-21 Dan Nicolaescu <local_user@dannlt>
738
739 Remove NOMULTIPLEJOBS, unused.
740 * s/template.h (NOMULTIPLEJOBS):
741 * s/msdos.h (NOMULTIPLEJOBS): Remove, unused.
742
743 Simplify LD_SWITCH_SYSTEM_TEMACS usage.
744 * s/freebsd.h (LD_SWITCH_SYSTEM_TEMACS):
745 * s/gnu-linux.h (LD_SWITCH_SYSTEM_TEMACS): Remove, configure
746 detects -znocombreloc and passes it to the linker
747 * s/hpux10-20.h (LD_SWITCH_SYSTEM_TEMACS): Remove, empty.
748
7492010-04-21 Glenn Morris <rgm@gnu.org>
750
751 * Makefile.in (LIBSELINUX_LIBS): Move out of #ifdef.
752
7532010-04-21 Karel Klíč <kklic@redhat.com>
754
755 * Makefile.in (LIBSELINUX_LIBS): New.
756 (LIBES): Add $LIBSELINUX_LIBS.
757 * eval.c, lisp.h (call7): New function.
758 * fileio.c [HAVE_LIBSELINUX]: Include selinux headers.
759 (Ffile_selinux_context, Fset_file_selinux_context):
760 New functions.
761 (Fcopy_file): New parameter preserve-selinux-context.
762 (Frename_file): Preserve selinux context when renaming by copy-file.
763
7642010-04-21 Juanma Barranquero <lekktu@gmail.com>
765 Eli Zaretskii <eliz@gnu.org>
766
767 Don't depend on cm.c or termcap.c on Windows, use stubs.
768 * makefile.w32-in (OBJ1): Remove cm.$(O) and termcap.$(O).
769 ($(BLD)/cm.$(O), $(BLD)/termcap.$(O)): Remove.
770 * w32console.c (current_tty, cost): New vars; lifted from cm.c.
771 (evalcost, cmputc, cmcheckmagic, cmcostinit, cmgoto, Wcm_clear)
772 (sys_tputs, sys_tgetstr): New stubs.
773 * s/ms-w32.h (chcheckmagic, cmcostinit, cmgoto, cmputc, Wcm_clear)
774 (tputs, tgetstr): New; define to sys_*.
775
7762010-04-20 Juanma Barranquero <lekktu@gmail.com>
777
778 * buffer.c (syms_of_buffer) <bidi-display-reordering>: Doc fix.
779
7802010-04-20 Stefan Monnier <monnier@iro.umontreal.ca>
781
782 * data.c (Fmake_variable_buffer_local, Fmake_local_variable):
783 Just signal a warning rather than an error when inside a let.
784 (Fmake_variable_frame_local): Add the same test.
785
786 * font.c (syms_of_font): Make the style table vars read-only.
787
788 * buffer.h (struct buffer): Remove unused var `direction_reversed'.
789 * buffer.c (init_buffer_once, syms_of_buffer): Remove its initialization.
790
791 * bidi.c (bidi_initialize): Simplify fallback_paragraph_*_re init.
792
7932010-04-20 Eli Zaretskii <eliz@gnu.org>
794
795 Fix R2L paragraph display on TTY.
796
797 * xdisp.c (unproduce_glyphs): New function.
798 (display_line): Use it when produced glyphs are discarded from R2L
799 glyph rows.
800 (append_composite_glyph): In R2L rows, prepend the glyph rather
801 than appending it.
802
803 * term.c (append_composite_glyph): In R2L rows, prepend the glyph
804 rather than append it. Set up the resolved_level and bidi_type
805 attributes of the appended glyph.
806 (produce_special_glyphs): Mirror the backslash continuation
807 character in R2L lines.
808
809 Implement display of R2L paragraphs in GUI sessions.
810
811 * xdisp.c [HAVE_WINDOW_SYSTEM]: Add prototype for
812 append_stretch_glyph.
813 (set_cursor_from_row) <cursor_x>: Remove unused variable. Fix
814 off-by-one error in computing x at end of text in the row.
815 (append_stretch_glyph): In reversed row, prepend the glyph rather
816 than append it. Set resolved_level and bidi_type of the glyph.
817 (extend_face_to_end_of_line): If the row is reversed, prepend a
818 stretch glyph whose width is such that the rightmost glyph will be
819 drawn at the right margin of the window. Fix off-by-one error on
820 TTY frames in testing whether a line needs face extension. Fix
821 face extension at ZV. If this is the last glyph row, use
822 DEFAULT_FACE_ID, to avoid painting the rest of the window with the
823 region face.
824 (set_cursor_from_row, display_line): Use
825 MATRIX_ROW_CONTINUATION_LINE_P instead of testing value of
826 row->continuation_lines_width.
827 (next_element_from_buffer): Don't call bidi_paragraph_init if we
828 are at ZV. Fixes a crash when reseated to ZV by
829 try_window_reusing_current_matrix.
830 (display_and_set_cursor, erase_phys_cursor): Handle negative HPOS,
831 which happens with R2L glyph rows. Fixes a crash when inserting a
832 character at end of an R2L line.
833 (set_cursor_from_row): Don't be fooled by truncated rows: don't
834 treat them as having zero-width characters. Improve comments.
835 Don't reverse pos_before and pos_after for reversed glyph rows.
836 Set cursor.x to negative value when the cursor might be on the
837 left fringe.
838 (IT_OVERFLOW_NEWLINE_INTO_FRINGE): For R2L lines, consider the
839 left fringe, not the right one.
840 (notice_overwritten_cursor, draw_phys_cursor_glyph)
841 (erase_phys_cursor): For reversed cursor_row, support cursor on
842 the left fringe.
843
844 * fringe.c (update_window_fringes): For R2L rows, swap the bitmaps
845 of continuation indicators on the fringes.
846 (draw_fringe_bitmap): For reversed glyph rows, allow cursor on the
847 left fringe.
848
849 * w32term.c (w32_draw_window_cursor): For reversed glyph rows,
850 draw cursor on the left fringe.
851
852 * xterm.c (x_draw_window_cursor): For reversed glyph rows, draw
853 cursor on the left fringe.
854
855 * dispnew.c (update_text_area): Handle reversed desired rows when
856 the cursor is on the left fringe.
857 (set_window_cursor_after_update): Limit cursor's hpos by -1 from
858 below, not by 0, for when the cursor is on the left fringe.
859
8602010-04-20 Jan Djärv <jan.h.d@swipnet.se>
861
862 * gtkutil.c (xg_event_is_for_scrollbar): Check if grabbed
863 widget is a scrollbar.
864
8652010-04-20 Kenichi Handa <handa@m17n.org>
866
867 * charset.c (char_charset): Consider Vcharset_non_preferred_head
868 only when the arg CHARSET_LIST is nil.
869
8702010-04-20 Stefan Monnier <monnier@iro.umontreal.ca>
871
872 Make variable forwarding explicit rather the using special values.
873 Basically, this makes the structure of buffer-local values and object
874 forwarding explicit in the type of Lisp_Symbols rather than use
875 special Lisp_Objects for that. This tends to lead to slightly more
876 verbose code, but is more C-like, simpler, and makes it easier to make
877 sure we handled all cases, among other things by letting the compiler
878 help us check it.
879 * lisp.h (enum Lisp_Misc_Type, union Lisp_Misc):
880 Removing forwarding objects.
881 (enum Lisp_Fwd_Type, enum symbol_redirect, union Lisp_Fwd): New types.
882 (struct Lisp_Symbol): Make the various forms of variable-forwarding
883 explicit rather than hiding them inside Lisp_Object "values".
884 (XFWDTYPE): New macro.
885 (XINTFWD, XBOOLFWD, XOBJFWD, XKBOARD_OBJFWD): Redefine.
886 (XBUFFER_LOCAL_VALUE): Remove.
887 (SYMBOL_VAL, SYMBOL_ALIAS, SYMBOL_BLV, SYMBOL_FWD, SET_SYMBOL_VAL)
888 (SET_SYMBOL_ALIAS, SET_SYMBOL_BLV, SET_SYMBOL_FWD): New macros.
889 (SYMBOL_VALUE, SET_SYMBOL_VALUE): Remove.
890 (struct Lisp_Intfwd, struct Lisp_Boolfwd, struct Lisp_Objfwd)
891 (struct Lisp_Buffer_Objfwd, struct Lisp_Kboard_Objfwd):
892 Remove the Lisp_Misc_* header.
893 (struct Lisp_Buffer_Local_Value): Redefine.
894 (BLV_FOUND, SET_BLV_FOUND, BLV_VALUE, SET_BLV_VALUE): New macros.
895 (struct Lisp_Misc_Any): Add filler to get the right size.
896 (struct Lisp_Free): Use struct Lisp_Misc_Any rather than struct
897 Lisp_Intfwd.
898 (DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT)
899 (DEFVAR_KBOARD): Allocate a forwarding object.
900 * data.c (do_blv_forwarding, store_blv_forwarding): New macros.
901 (let_shadows_global_binding_p): New function.
902 (union Lisp_Val_Fwd): New type.
903 (make_blv): New function.
904 (swap_in_symval_forwarding, indirect_variable, do_symval_forwarding)
905 (store_symval_forwarding, swap_in_global_binding, Fboundp)
906 (swap_in_symval_forwarding, find_symbol_value, Fset)
907 (let_shadows_buffer_binding_p, set_internal, default_value)
908 (Fset_default, Fmake_variable_buffer_local, Fmake_local_variable)
909 (Fkill_local_variable, Fmake_variable_frame_local)
910 (Flocal_variable_p, Flocal_variable_if_set_p)
911 (Fvariable_binding_locus):
912 * xdisp.c (select_frame_for_redisplay):
913 * lread.c (Fintern, Funintern, init_obarray, defvar_int)
914 (defvar_bool, defvar_lisp_nopro, defvar_lisp, defvar_kboard):
915 * frame.c (store_frame_param):
916 * eval.c (Fdefvaralias, Fuser_variable_p, specbind, unbind_to):
917 * bytecode.c (Fbyte_code) <varref, varset>: Adapt to the new symbol
918 value structure.
919 * buffer.c (PER_BUFFER_SYMBOL): Move from buffer.h.
920 (clone_per_buffer_values): Only adjust markers into the current buffer.
921 (reset_buffer_local_variables): PER_BUFFER_IDX is never -2.
922 (Fbuffer_local_value, set_buffer_internal_1)
923 (swap_out_buffer_local_variables):
924 Adapt to the new symbol value structure.
925 (DEFVAR_PER_BUFFER): Allocate a Lisp_Buffer_Objfwd object.
926 (defvar_per_buffer): Take a new arg for the fwd object.
927 (buffer_lisp_local_variables): Return a proper alist (different fix
928 for bug#4138).
929 * alloc.c (Fmake_symbol): Use SET_SYMBOL_VAL.
930 (Fgarbage_collect): Don't handle buffer_defaults specially.
931 (mark_object): Handle new symbol value structure rather than the old
932 special Lisp_Misc_* objects.
933 (gc_sweep) <symbols>: Free also the buffer-local-value objects.
934 * term.c (set_tty_color_mode):
935 * bidi.c (bidi_initialize): Don't access the ->value field directly.
936 * buffer.h (PER_BUFFER_VAR_OFFSET): Don't bother with
937 a buffer_local_flags.
938 * print.c (print_object): Get rid of impossible forwarding objects.
939
9402010-04-19 Eli Zaretskii <eliz@gnu.org>
941
942 * bidi.c (bidi_get_type, bidi_get_category)
943 (bidi_at_paragraph_end, bidi_resolve_weak, bidi_resolve_neutral)
944 (bidi_type_of_next_char, bidi_level_of_next_char):
945 Declare static. Use `INLINE' rather than `inline'.
946
9472010-04-19 Juanma Barranquero <lekktu@gmail.com>
948
949 * dired.c (Ffile_attributes): Fix typo in docstring.
950
9512010-04-19 Adrian Robert <Adrian.B.Robert@gmail.com>
952
953 * nsmenu.m (EmacsDialog-runDialogAt:): Declare ret as
954 NSInteger (Bug#5811).
955
9562010-04-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
957
958 * s/darwin.h (PTY_ITERATION, PTY_NAME_SPRINTF, PTY_TTY_NAME_SPRINTF)
959 (PTY_OPEN): New defines. Use openpty (Bug#726, Bug#5819).
960
9612010-04-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
962
963 * frame.h (FRAME_LINE_TO_PIXEL_Y): Add missing parenthesis.
964
9652010-04-19 Chong Yidong <cyd@stupidchicken.com>
966
967 * xdisp.c (prepare_menu_bars): Don't call ns_set_doc_edited for
968 terminal frames (Bug#5837).
969
9702010-04-19 Eli Zaretskii <eliz@gnu.org>
971
972 * .gdbinit (xsubchartable): New command.
973
9742010-04-19 Eli Zaretskii <eliz@gnu.org>
975
976 * xdisp.c (display_line): Don't write beyond the last glyph row in
977 the desired matrix. Fixes a crash in "emacs -nw" (bug#5972), see
978 http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00075.html
979 and
980 http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00213.html
981
9822010-04-18 Stefan Monnier <monnier@iro.umontreal.ca>
983
984 * alloc.c (Fpurecopy): Hash-cons if requested.
985 (syms_of_alloc): Update purify-flag docstring.
986
9872010-04-18 Jan Djärv <jan.h.d@swipnet.se>
988
989 * gtkutil.c (xg_set_geometry): Set size in geometry string also.
990 (x_wm_set_size_hint): Set USER_POS in hint_flags (Bug#5968).
991
9922010-04-17 Eli Zaretskii <eliz@gnu.org>
993
994 Fix a crash when an NSM character is inserted at BEGV.
995
996 * bidi.c (bidi_init_it): Fix initialization of bidi_it->prev.
997 (bidi_resolve_weak): Don't use prev.type_after_w1 if it is
998 NEUTRAL_B or UNKNOWN_BT.
999
10002010-04-16 Eli Zaretskii <eliz@gnu.org>
1001
1002 * xdisp.c (set_cursor_from_row): Don't consider possibility of
1003 other rows with cursor unless they are different from this row and
1004 this row is part of a continued line. (Bug#5943)
1005
10062010-04-16 Dan Nicolaescu <dann@ics.uci.edu>
1007
1008 * s/freebsd.h: Restore osreldate.h include.
1009 Suggested by Naohiro Aota.
1010
10112010-04-16 Jan Djärv <jan.h.d@swipnet.se>
1012
1013 * xmenu.c (apply_systemfont_to_menu): *childs was incorrectly used.
1014
10152010-04-16 Ken Brown <kbrown@cornell.edu> (tiny change)
1016
1017 * s/cygwin.h: Avoid linking against static libgcc.
1018
10192010-04-15 Juri Linkov <juri@jurta.org>
1020
1021 * window.c: Add Qscroll_command.
1022 Remove Vscroll_preserve_screen_position_commands.
1023 (window_scroll_pixel_based, window_scroll_line_based): Check the
1024 `scroll-command' property on the last command instead of searching
1025 the last command in Vscroll_preserve_screen_position_commands.
1026 (syms_of_window): Initialize and staticpro `Qscroll_command'.
1027 Put Qscroll_command property on Qscroll_up and Qscroll_down.
1028 (scroll-preserve-screen-position): Doc fix.
1029 (Vscroll_preserve_screen_position_commands): Remove variable.
1030
10312010-04-15 Dan Nicolaescu <dann@ics.uci.edu>
1032
1033 * xdisp.c (message): Do not use NO_ARG_ARRAY.
1034
12010-04-14 Dan Nicolaescu <dann@ics.uci.edu> 10352010-04-14 Dan Nicolaescu <dann@ics.uci.edu>
2 1036
3 Reduce cpp use in Makefile.in. 1037 Reduce cpp use in Makefile.in.
@@ -62,7 +1096,8 @@
62 1096
632010-04-12 Dan Nicolaescu <dann@ics.uci.edu> 10972010-04-12 Dan Nicolaescu <dann@ics.uci.edu>
64 1098
65 * Makefile.in (C_SWITCH_SYSTEM,C_SWITCH_MACHINE,C_SWITCH_X_SITE): Undefine. 1099 * Makefile.in (C_SWITCH_SYSTEM,C_SWITCH_MACHINE,C_SWITCH_X_SITE):
1100 Undefine.
66 1101
672010-04-11 Dan Nicolaescu <dann@ics.uci.edu> 11022010-04-11 Dan Nicolaescu <dann@ics.uci.edu>
68 1103
@@ -136,10 +1171,10 @@
136 (parse_xft_settings): Also check for XSETTINGS_FONT_NAME and save that 1171 (parse_xft_settings): Also check for XSETTINGS_FONT_NAME and save that
137 in current_font. 1172 in current_font.
138 (init_gconf): Read value of SYSTEM_FONT and save it in current_font. 1173 (init_gconf): Read value of SYSTEM_FONT and save it in current_font.
139 (Ffont_get_system_normal_font, xsettings_get_system_normal_font): New 1174 (Ffont_get_system_normal_font, xsettings_get_system_normal_font):
140 functions. 1175 New functions.
141 (syms_of_xsettings): Initialize current_font. defsubr 1176 (syms_of_xsettings): Initialize current_font.
142 Sfont_get_system_normal_font. 1177 defsubr Sfont_get_system_normal_font.
143 1178
144 * xsettings.h (Ffont_get_system_normal_font, 1179 * xsettings.h (Ffont_get_system_normal_font,
145 xsettings_get_system_normal_font): Declare. 1180 xsettings_get_system_normal_font): Declare.
@@ -284,6 +1319,11 @@
284 (gif_load): Put GIF extension data to the property 1319 (gif_load): Put GIF extension data to the property
285 `Qextension_data'. 1320 `Qextension_data'.
286 1321
13222010-04-05 Chong Yidong <cyd@stupidchicken.com>
1323
1324 * xdisp.c (prepare_menu_bars): Don't call ns_set_doc_edited for
1325 terminal frames (Bug#5837).
1326
2872010-03-31 Chong Yidong <cyd@stupidchicken.com> 13272010-03-31 Chong Yidong <cyd@stupidchicken.com>
288 1328
289 * nsfns.m (ns_set_doc_edited): Remove unused arg OLDVAL. 1329 * nsfns.m (ns_set_doc_edited): Remove unused arg OLDVAL.
@@ -2761,7 +3801,7 @@
2761 * xterm.h: Rename x_non_menubar_window_to_frame to 3801 * xterm.h: Rename x_non_menubar_window_to_frame to
2762 x_menubar_window_to_frame. 3802 x_menubar_window_to_frame.
2763 3803
2764 * xterm.c: Remove declarations also in xterm.h 3804 * xterm.c: Remove declarations also in xterm.h.
2765 (XTmouse_position): Do not return valid positions 3805 (XTmouse_position): Do not return valid positions
2766 for clicks in the menubar and the toolbar for Gtk+. 3806 for clicks in the menubar and the toolbar for Gtk+.
2767 3807
@@ -3321,7 +4361,7 @@
33212009-07-04 Eli Zaretskii <eliz@gnu.org> 43612009-07-04 Eli Zaretskii <eliz@gnu.org>
3322 4362
3323 Emulation of `getloadavg' on MS-Windows. 4363 Emulation of `getloadavg' on MS-Windows.
3324 * w32.c: Include float.h 4364 * w32.c: Include float.h.
3325 (g_b_init_get_native_system_info, g_b_init_get_system_times) 4365 (g_b_init_get_native_system_info, g_b_init_get_system_times)
3326 (GetNativeSystemInfo_Proc, GetSystemTimes_Proc): Declare. 4366 (GetNativeSystemInfo_Proc, GetSystemTimes_Proc): Declare.
3327 (get_native_system_info, get_system_times): New functions. 4367 (get_native_system_info, get_system_times): New functions.
@@ -7913,7 +8953,7 @@
7913 <after-change-functions>: Reflow docstrings. 8953 <after-change-functions>: Reflow docstrings.
7914 8954
79152008-08-04 Adrian Robert <Adrian.B.Robert@gmail.com> 89552008-08-04 Adrian Robert <Adrian.B.Robert@gmail.com>
7916 Ken Raeburn <raeburn@gnu.org> 8956 Ken Raeburn <raeburn@gnu.org>
7917 8957
7918 Dock menu customization, based on a patch by Ken Raeburn, plus some 8958 Dock menu customization, based on a patch by Ken Raeburn, plus some
7919 other fixes. 8959 other fixes.
@@ -8978,7 +10018,7 @@
8978 batch-compiling for bootstrap). 10018 batch-compiling for bootstrap).
8979 10019
89802008-07-15 Chris Hall <chris@web.workinglinux.com> (tiny change) 100202008-07-15 Chris Hall <chris@web.workinglinux.com> (tiny change)
8981 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 10021 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
8982 10022
8983 (make_initial_frame): Call init_frame_faces(f) in CANNOT_DUMP case -- 10023 (make_initial_frame): Call init_frame_faces(f) in CANNOT_DUMP case --
8984 fix crash due to different init order. 10024 fix crash due to different init order.
@@ -9267,7 +10307,7 @@
92672008-07-10 Dan Nicolaescu <dann@ics.uci.edu> 103072008-07-10 Dan Nicolaescu <dann@ics.uci.edu>
9268 10308
9269 * fileio.c: 10309 * fileio.c:
9270 * sysdep.c 10310 * sysdep.c:
9271 * systty.h: 10311 * systty.h:
9272 * m/ibmrs6000.h: 10312 * m/ibmrs6000.h:
9273 * m/iris4d.h: 10313 * m/iris4d.h:
@@ -9596,7 +10636,7 @@
9596 (USG_SHARED_LIBRARIES): Remove duplicate definition. 10636 (USG_SHARED_LIBRARIES): Remove duplicate definition.
9597 10637
95982008-06-26 Juanma Barranquero <lekktu@gmail.com> 106382008-06-26 Juanma Barranquero <lekktu@gmail.com>
9599 Eli Zaretskii <eliz@gnu.org> 10639 Eli Zaretskii <eliz@gnu.org>
9600 10640
9601 * makefile.w32-in (LOCAL_FLAGS): 10641 * makefile.w32-in (LOCAL_FLAGS):
9602 Don't include WINDOWSNT, DOS_NT and _UCHAR_T. 10642 Don't include WINDOWSNT, DOS_NT and _UCHAR_T.
@@ -9844,7 +10884,7 @@
9844 the property of LFACE_FONT of LFACE (if any). 10884 the property of LFACE_FONT of LFACE (if any).
9845 10885
98462008-06-21 Seiji Zenitani <zenitani@mac.com> 108862008-06-21 Seiji Zenitani <zenitani@mac.com>
9847 Ryo Yoshitake <ryo@shiftmode.net> 10887 Ryo Yoshitake <ryo@shiftmode.net>
9848 10888
9849 * xterm.c (x_set_frame_alpha): Add x_catch_errors for bug#437. 10889 * xterm.c (x_set_frame_alpha): Add x_catch_errors for bug#437.
9850 10890
@@ -10940,7 +11980,7 @@
10940 * xterm.c (x_set_frame_alpha): Move declarations before statements. 11980 * xterm.c (x_set_frame_alpha): Move declarations before statements.
10941 11981
109422008-05-21 Seiji Zenitani <zenitani@mac.com> 119822008-05-21 Seiji Zenitani <zenitani@mac.com>
10943 Ryo Yoshitake <ryo@shiftmode.net> 11983 Ryo Yoshitake <ryo@shiftmode.net>
10944 11984
10945 * frame.c (Qalpha): Add a new frame parameter `alpha'. 11985 * frame.c (Qalpha): Add a new frame parameter `alpha'.
10946 (Vframe_alpha_lower_limit): New variable. 11986 (Vframe_alpha_lower_limit): New variable.
diff --git a/src/ChangeLog.1 b/src/ChangeLog.1
index 921123f236a..8b4a9afbc6c 100644
--- a/src/ChangeLog.1
+++ b/src/ChangeLog.1
@@ -1187,7 +1187,7 @@
1187 prompt. 1187 prompt.
1188 (various): Pass window being displayed as arg to vmotion. 1188 (various): Pass window being displayed as arg to vmotion.
1189 (various): Compute starting-hpos arg to compute_motion 1189 (various): Compute starting-hpos arg to compute_motion
1190 using minibuf_prompt_width if in minibuf starting at top. 1190 using minibuf_prompt_width if in minibuf starting at top.
1191 1191
1192 * window.c (Fdisplay_buffer & callers): 1192 * window.c (Fdisplay_buffer & callers):
1193 Take second arg, non-nil means do not use selected window 1193 Take second arg, non-nil means do not use selected window
@@ -1645,8 +1645,8 @@
1645 Use signal, not sigset, since we simulate signal on 1645 Use signal, not sigset, since we simulate signal on
1646 all system versions when nec. 1646 all system versions when nec.
1647 1647
1648 * buffer.c (syms_of_buffer, init_buffer_once, 1648 * buffer.c (syms_of_buffer, init_buffer_once)
1649 reset_buffer_local_variables): 1649 (reset_buffer_local_variables):
1650 Define default-abbrev-mode, and init new buffers' abbrev-mode 1650 Define default-abbrev-mode, and init new buffers' abbrev-mode
1651 from it. Move definition of abbrev-mode here from abbrev.c. 1651 from it. Move definition of abbrev-mode here from abbrev.c.
1652 1652
@@ -2861,7 +2861,7 @@
2861 * keymap.c, callint.c, minibuf.c, fns.c, commands.h: 2861 * keymap.c, callint.c, minibuf.c, fns.c, commands.h:
2862 Rename MinbufLocalMap to Vminibuffer_local_map, etc. 2862 Rename MinbufLocalMap to Vminibuffer_local_map, etc.
2863 Rename minibuf-local-{,-ns,-completion,must-match}map, 2863 Rename minibuf-local-{,-ns,-completion,must-match}map,
2864 and DefLispVar them (document even!). 2864 and DefLispVar them (document even!).
2865 => New lisp variables minibuffer-local-map, minibuffer-local-ns-map, 2865 => New lisp variables minibuffer-local-map, minibuffer-local-ns-map,
2866 minibuffer-local-completion-map, minibuffer-local-must-match-map. 2866 minibuffer-local-completion-map, minibuffer-local-must-match-map.
2867 2867
diff --git a/src/ChangeLog.2 b/src/ChangeLog.2
index 265cc95e60d..7313f56ae8e 100644
--- a/src/ChangeLog.2
+++ b/src/ChangeLog.2
@@ -984,7 +984,7 @@
9841988-01-06 Richard Stallman (rms@frosted-flakes) 9841988-01-06 Richard Stallman (rms@frosted-flakes)
985 985
986 * s-hpux.h: Don't define nomultiplejobs, LDAV_SYMBOL, LIBS_DEBUG 986 * s-hpux.h: Don't define nomultiplejobs, LDAV_SYMBOL, LIBS_DEBUG
987 or BROKEN_FIONREAD. 987 or BROKEN_FIONREAD.
988 * m-hp9000s300.h: Define those four. 988 * m-hp9000s300.h: Define those four.
989 * s-hpux.h: Define BSTRING, and define bcopy, etc., as macros. 989 * s-hpux.h: Define BSTRING, and define bcopy, etc., as macros.
990 990
@@ -2817,7 +2817,7 @@
28171986-11-26 Richard M. Stallman (rms@prep) 28171986-11-26 Richard M. Stallman (rms@prep)
2818 2818
2819 * sysdep.c (get_system_name): 2819 * sysdep.c (get_system_name):
2820 Eliminate internal static var in USG case. 2820 Eliminate internal static var in USG case.
2821 2821
2822 * lisp.h: New case testing and conversion macros 2822 * lisp.h: New case testing and conversion macros
2823 UPPERCASEP, LOWERCASEP, NOCASEP, UPCASE, DOWNCASE. 2823 UPPERCASEP, LOWERCASEP, NOCASEP, UPCASE, DOWNCASE.
@@ -3852,7 +3852,7 @@
3852 (so now (let ((case-fold-search t))) doesn't force buffer-localness) 3852 (so now (let ((case-fold-search t))) doesn't force buffer-localness)
3853 However, setting a binding will still make it buffer-local. 3853 However, setting a binding will still make it buffer-local.
3854 (ie (let ((case-fold-search t)) (setq case-fold-search t)) 3854 (ie (let ((case-fold-search t)) (setq case-fold-search t))
3855 will cause case-fold-search be buffer-local even outside the let) 3855 will cause case-fold-search be buffer-local even outside the let)
3856 3856
3857 * xfns.c: 3857 * xfns.c:
3858 Preserve studlycaps: "Gnuemacs" => "GNU Emacs" 3858 Preserve studlycaps: "Gnuemacs" => "GNU Emacs"
@@ -4452,16 +4452,16 @@
4452 * search.c (Freplace_match): Delete unused some_multiletter_word init. 4452 * search.c (Freplace_match): Delete unused some_multiletter_word init.
4453 * alloc.c (gc_sweep): Delete unused next initializers. 4453 * alloc.c (gc_sweep): Delete unused next initializers.
4454 * fns.c (concat): After error on non-int elt for string, 4454 * fns.c (concat): After error on non-int elt for string,
4455 do store the new value from the error handler. 4455 do store the new value from the error handler.
4456 * lread.c (read1): Comment out unused end =. 4456 * lread.c (read1): Comment out unused end =.
4457 * lread.c (read_list): Delete unused tail =. 4457 * lread.c (read_list): Delete unused tail =.
4458 * data.c (Fmake_variable_buffer_local): 4458 * data.c (Fmake_variable_buffer_local):
4459 If value type is Lisp_Some_Buffer_Local_Value, 4459 If value type is Lisp_Some_Buffer_Local_Value,
4460 change it to Lisp_Buffer_Local_Value permanently. 4460 change it to Lisp_Buffer_Local_Value permanently.
4461 * undo.c (record_block): Delete unused cp =. 4461 * undo.c (record_block): Delete unused cp =.
4462 Don't bother reallocing if n = 0 after first batch. 4462 Don't bother reallocing if n = 0 after first batch.
4463 * fileio.c (Fverify_visited_file_modtime): 4463 * fileio.c (Fverify_visited_file_modtime):
4464 If CHECK_BUFFER changes buf, use the changed value. 4464 If CHECK_BUFFER changes buf, use the changed value.
4465 4465
44661986-07-07 Richard M. Stallman (rms@prep) 44661986-07-07 Richard M. Stallman (rms@prep)
4467 4467
diff --git a/src/ChangeLog.3 b/src/ChangeLog.3
index fbe3f752aed..241019b51c7 100644
--- a/src/ChangeLog.3
+++ b/src/ChangeLog.3
@@ -14197,7 +14197,7 @@
141971989-12-14 Joseph Arceneaux (jla@spiff) 141971989-12-14 Joseph Arceneaux (jla@spiff)
14198 14198
14199 * xfns.c: New variable Vx_no_window_manager. 14199 * xfns.c: New variable Vx_no_window_manager.
14200 (Fx_track_pointer): If bufp < 0, abort. 14200 (Fx_track_pointer): If bufp < 0, abort.
14201 14201
14202 * xterm.c (XTread_socket): When leaving window, set x_mouse_x and 14202 * xterm.c (XTread_socket): When leaving window, set x_mouse_x and
14203 x_mouse_y to -1. 14203 x_mouse_y to -1.
diff --git a/src/ChangeLog.4 b/src/ChangeLog.4
index 7e5728fbbcd..c853ad7b4a6 100644
--- a/src/ChangeLog.4
+++ b/src/ChangeLog.4
@@ -4329,7 +4329,7 @@
4329 4329
43301993-11-01 Richard Stallman (rms@mole.gnu.ai.mit.edu) 43301993-11-01 Richard Stallman (rms@mole.gnu.ai.mit.edu)
4331 4331
4332 * s/sunos4-1-3.h (HAVE_TERMIOS): Defined. 4332 * s/sunos4-1-3.h (HAVE_TERMIOS): Define.
4333 4333
43341993-10-25 Brian J. Fox (bfox@albert.gnu.ai.mit.edu) 43341993-10-25 Brian J. Fox (bfox@albert.gnu.ai.mit.edu)
4335 4335
@@ -4411,7 +4411,7 @@
4411 4411
4412 * keyboard.c (read_key_sequence): Don't declare first_event; it is 4412 * keyboard.c (read_key_sequence): Don't declare first_event; it is
4413 no longer used. Change "#if 0" for first_event reading to 4413 no longer used. Change "#if 0" for first_event reading to
4414 "#if defined (GOBBLE_FIRST_EVENT)". 4414 "#if defined (GOBBLE_FIRST_EVENT)".
4415 4415
44161993-10-03 Brian J. Fox (bfox@ai.mit.edu) 44161993-10-03 Brian J. Fox (bfox@ai.mit.edu)
4417 4417
@@ -4426,9 +4426,9 @@
4426 4426
4427 * Makefile.in: File removed. It is now generated by ../configure. 4427 * Makefile.in: File removed. It is now generated by ../configure.
4428 4428
4429 * Makefile.in.in (LIBES): Add $(GNULIB_VAR) again at end. This 4429 * Makefile.in.in (LIBES): Add $(GNULIB_VAR) again at end.
4430 change to ymakefile was mysteriously lost. Were any others lost 4430 This change to ymakefile was mysteriously lost.
4431 too? 4431 Were any others lost too?
4432 4432
44331993-10-02 Brian J. Fox (bfox@ai.mit.edu) 44331993-10-02 Brian J. Fox (bfox@ai.mit.edu)
4434 4434
@@ -4461,8 +4461,7 @@
4461 4461
44621993-09-24 Brian J. Fox (bfox@ai.mit.edu) 44621993-09-24 Brian J. Fox (bfox@ai.mit.edu)
4463 4463
4464 * textprop.c (validate_plist): Add declaration for `list' 4464 * textprop.c (validate_plist): Add declaration for `list' argument.
4465 argument.
4466 4465
4467 * frame.c (Fhandle_switch_frame): Doc fix. 4466 * frame.c (Fhandle_switch_frame): Doc fix.
4468 4467
@@ -4501,7 +4500,7 @@
4501 * doc.c (Fsubstitute_command_keys): Pass new arg. 4500 * doc.c (Fsubstitute_command_keys): Pass new arg.
4502 * abbrev.c (Funexpand_abbrev, Fexpand_abbrev): Pass new arg. 4501 * abbrev.c (Funexpand_abbrev, Fexpand_abbrev): Pass new arg.
4503 4502
4504 * s/aix3-2.h (AIX3_2): Defined. 4503 * s/aix3-2.h (AIX3_2): Define.
4505 * m/ibmrs6000.h (LIBS_MACHINE): Include -lrts, -liconv only if AIX3_2. 4504 * m/ibmrs6000.h (LIBS_MACHINE): Include -lrts, -liconv only if AIX3_2.
4506 4505
4507 * xterm.h (HAVE_X11R4): If AIX, do not define HAVE_X11R4. 4506 * xterm.h (HAVE_X11R4): If AIX, do not define HAVE_X11R4.
@@ -4703,13 +4702,13 @@
4703 4702
4704 * xfns.c (XScreenNumberOfScreen): New function. 4703 * xfns.c (XScreenNumberOfScreen): New function.
4705 4704
4706 * m/tek4300.h (C_DEBUG_SWITCH, SYSTEM_MALLOC): Defined. 4705 * m/tek4300.h (C_DEBUG_SWITCH, SYSTEM_MALLOC): Define.
4707 4706
4708 * m/iris4d.h (START_FILES, LIB_STANDARD): Don't define if USG5_4. 4707 * m/iris4d.h (START_FILES, LIB_STANDARD): Don't define if USG5_4.
4709 (DEFAULT_ENTRY_ADDRESS): Likewise. 4708 (DEFAULT_ENTRY_ADDRESS): Likewise.
4710 (UNEXEC): Use unexelfsgi.o if USG5_4. 4709 (UNEXEC): Use unexelfsgi.o if USG5_4.
4711 4710
4712 * s/irix5-0.h (C_SWITCH_MACHINE): Deleted. 4711 * s/irix5-0.h (C_SWITCH_MACHINE): Delete.
4713 4712
47141993-08-13 Frederic Pierresteguy (F.Pierresteguy@frcl.bull.fr) 47131993-08-13 Frederic Pierresteguy (F.Pierresteguy@frcl.bull.fr)
4715 4714
@@ -4809,7 +4808,7 @@
4809 4808
4810 * m/dpx2.h (HAVE_TCATTR): Macro #defined. 4809 * m/dpx2.h (HAVE_TCATTR): Macro #defined.
4811 (HAVE_CLOSEDIR): #undef to allow use of closedir in sysdep.c. 4810 (HAVE_CLOSEDIR): #undef to allow use of closedir in sysdep.c.
4812 (SIGTSTP): Commented #undef to allow use of ^Z in shell-mode. 4811 (SIGTSTP): Comment #undef to allow use of ^Z in shell-mode.
4813 (SIGNALS_VIA_CHARACTERS): #defined. 4812 (SIGNALS_VIA_CHARACTERS): #defined.
4814 4813
48151993-08-09 Paul Eggert (eggert@twinsun.com) 48141993-08-09 Paul Eggert (eggert@twinsun.com)
@@ -4849,10 +4848,10 @@
4849 and calculate position properly. 4848 and calculate position properly.
4850 4849
4851 * s/bsd4-2.h, s/bsd4-3.h, s/umax.h, s/rtu.h, s/dgux.h (HAVE_VFORK): 4850 * s/bsd4-2.h, s/bsd4-3.h, s/umax.h, s/rtu.h, s/dgux.h (HAVE_VFORK):
4852 Defined. 4851 Define.
4853 4852
4854 * ymakefile (alloc.o): Don't use DEBUG_MOLE. 4853 * ymakefile (alloc.o): Don't use DEBUG_MOLE.
4855 (DEBUG_MOLE): Deleted. 4854 (DEBUG_MOLE): Delete.
4856 * gnu-hp300: File deleted. 4855 * gnu-hp300: File deleted.
4857 4856
4858 * .gdbinit: Don't put -q in args. 4857 * .gdbinit: Don't put -q in args.
@@ -4878,7 +4877,7 @@
4878 (main): Call init_buffer, init_callproc and init_cmdargs 4877 (main): Call init_buffer, init_callproc and init_cmdargs
4879 before init_lread. 4878 before init_lread.
4880 (syms_of_emacs): Install the function, and protect the variable. 4879 (syms_of_emacs): Install the function, and protect the variable.
4881 * lisp.h (Vinvocation_directory): Declared. 4880 * lisp.h (Vinvocation_directory): Declare.
4882 * lread.c (init_lread): Normally put Vinvocation_directory 4881 * lread.c (init_lread): Normally put Vinvocation_directory
4883 at end of Vload_path, if not present already. 4882 at end of Vload_path, if not present already.
4884 4883
diff --git a/src/ChangeLog.5 b/src/ChangeLog.5
index d30bd1bdb00..e4991971461 100644
--- a/src/ChangeLog.5
+++ b/src/ChangeLog.5
@@ -6107,7 +6107,7 @@
6107 * fileio.c (Fmake_symbolic_link, Ffile_accessible_directory_p, 6107 * fileio.c (Fmake_symbolic_link, Ffile_accessible_directory_p,
6108 Finsert_file_contents, auto_save_error, Fwrite_region): Likewise. 6108 Finsert_file_contents, auto_save_error, Fwrite_region): Likewise.
6109 (Fcopy_file, build_annotations, Fdo_auto_save): Delete unused 6109 (Fcopy_file, build_annotations, Fdo_auto_save): Delete unused
6110 variables. 6110 variables.
6111 6111
61121994-08-23 Richard Stallman <rms@mole.gnu.ai.mit.edu> 61121994-08-23 Richard Stallman <rms@mole.gnu.ai.mit.edu>
6113 6113
diff --git a/src/ChangeLog.9 b/src/ChangeLog.9
index b161a21eb72..6e53a39ac93 100644
--- a/src/ChangeLog.9
+++ b/src/ChangeLog.9
@@ -3913,7 +3913,7 @@
39132001-01-05 Gerd Moellmann <gerd@gnu.org> 39132001-01-05 Gerd Moellmann <gerd@gnu.org>
3914 3914
3915 * sysdep.c: Don't prototype srandom; it takes an unsigned argument 3915 * sysdep.c: Don't prototype srandom; it takes an unsigned argument
3916 on some systems, and an unsigned long on others, like FreeBSD 4.1. 3916 on some systems, and an unsigned long on others, like FreeBSD 4.1.
3917 3917
39182001-01-04 Gerd Moellmann <gerd@gnu.org> 39182001-01-04 Gerd Moellmann <gerd@gnu.org>
3919 3919
@@ -5161,9 +5161,9 @@
5161 `vertical-line', `mode-line' and `header-line' events. 5161 `vertical-line', `mode-line' and `header-line' events.
5162 5162
5163 * xdisp.c (try_window_id): Avoid starting to display in the middle 5163 * xdisp.c (try_window_id): Avoid starting to display in the middle
5164 of a character, a TAB for instance. This is easier than to set 5164 of a character, a TAB for instance. This is easier than to set
5165 up the iterator exactly, and it's not a frequent case, so the 5165 up the iterator exactly, and it's not a frequent case, so the
5166 additional effort wouldn't really pay off. 5166 additional effort wouldn't really pay off.
5167 5167
51682000-11-26 Andrew Choi <akochoi@i-cable.com> 51682000-11-26 Andrew Choi <akochoi@i-cable.com>
5169 5169
@@ -5196,9 +5196,9 @@
51962000-11-24 Gerd Moellmann <gerd@gnu.org> 51962000-11-24 Gerd Moellmann <gerd@gnu.org>
5197 5197
5198 * xdisp.c (init_from_display_pos): If POS says we're already after 5198 * xdisp.c (init_from_display_pos): If POS says we're already after
5199 an overlay string ending at POS, make sure to pop the iterator 5199 an overlay string ending at POS, make sure to pop the iterator
5200 because it will be in front of that overlay string. When POS is 5200 because it will be in front of that overlay string. When POS is
5201 ZV, we've thereby also ``processed'' overlay strings at ZV. 5201 ZV, we've thereby also ``processed'' overlay strings at ZV.
5202 5202
5203 * xfaces.c (lface_from_face_name): Function comment fix. 5203 * xfaces.c (lface_from_face_name): Function comment fix.
5204 5204
diff --git a/src/Makefile.in b/src/Makefile.in
index dada7164761..2719f3a232a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,8 +1,8 @@
1 1
2# Makefile for GNU Emacs. 2# Makefile for GNU Emacs.
3# Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 3# Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002,
4# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 4# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5# Free Software Foundation, Inc. 5# Free Software Foundation, Inc.
6 6
7# This file is part of GNU Emacs. 7# This file is part of GNU Emacs.
8 8
@@ -38,11 +38,9 @@ srcdir = @srcdir@
38abs_builddir = @abs_builddir@ 38abs_builddir = @abs_builddir@
39VPATH = $(srcdir) 39VPATH = $(srcdir)
40CC = @CC@ 40CC = @CC@
41CPP = @CPP@
42CFLAGS = @CFLAGS@ 41CFLAGS = @CFLAGS@
43CPPFLAGS = @CPPFLAGS@ 42CPPFLAGS = @CPPFLAGS@
44LDFLAGS = @LDFLAGS@ 43LDFLAGS = @LDFLAGS@
45LN_S = @LN_S@
46EXEEXT = @EXEEXT@ 44EXEEXT = @EXEEXT@
47version = @version@ 45version = @version@
48# Substitute an assignment for the MAKE variable, because 46# Substitute an assignment for the MAKE variable, because
@@ -69,43 +67,120 @@ bootstrap_exe = ${abs_builddir}/bootstrap-emacs${EXEEXT}
69 67
70OTHER_FILES = @OTHER_FILES@ 68OTHER_FILES = @OTHER_FILES@
71 69
70CRT_DIR=@CRT_DIR@
71
72## Machine-specific CFLAGS.
73C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
74## System-specific CFLAGS.
75C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
76## This holds any special options for linking temacs only (ie, not
77## used by configure). Not used elsewhere because it sometimes
78## contains options that have to do with using Emacs's crt0,
79## which are only good with temacs.
80LD_SWITCH_SYSTEM_TEMACS=@LD_SWITCH_SYSTEM_TEMACS@
81## Next two must come before LD_SWITCH_SYSTEM.
82## If needed, a -R option that says where to find X windows at run time.
83LD_SWITCH_X_SITE_AUX=@LD_SWITCH_X_SITE_AUX@
84## As above, but using -rpath instead.
85LD_SWITCH_X_SITE_AUX_RPATH=@LD_SWITCH_X_SITE_AUX_RPATH@
86## System-specific LDFLAGS.
87LD_SWITCH_SYSTEM=@LD_SWITCH_SYSTEM@
88LD_SWITCH_SYSTEM_EXTRA=@LD_SWITCH_SYSTEM_EXTRA@
89## Flags to pass to ld only for temacs.
90TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_EXTRA) $(LD_SWITCH_SYSTEM_TEMACS)
91
92## Some systems define this to request special libraries.
93LIBS_SYSTEM=@LIBS_SYSTEM@
94
95## Where to find libgcc.a, if using gcc and necessary.
96LIB_GCC=@LIB_GCC@
97
72LIBTIFF=@LIBTIFF@ 98LIBTIFF=@LIBTIFF@
73LIBJPEG=@LIBJPEG@ 99LIBJPEG=@LIBJPEG@
74LIBPNG=@LIBPNG@ 100LIBPNG=@LIBPNG@
75LIBGIF=@LIBGIF@ 101LIBGIF=@LIBGIF@
76LIBXPM=@LIBXPM@ 102LIBXPM=@LIBXPM@
77XFT_LIBS=@XFT_LIBS@ 103XFT_LIBS=@XFT_LIBS@
78 104LIBX_EXTRA=$(LIBTIFF) $(LIBJPEG) $(LIBPNG) $(LIBGIF) $(LIBXPM) -lX11 $(XFT_LIBS)
79C_SWITCH_SYSTEM=@c_switch_system@
80C_SWITCH_MACHINE=@c_switch_machine@
81
82C_SWITCH_X_SITE=@C_SWITCH_X_SITE@
83 105
84DBUS_CFLAGS = @DBUS_CFLAGS@ 106DBUS_CFLAGS = @DBUS_CFLAGS@
85DBUS_LIBS = @DBUS_LIBS@ 107DBUS_LIBS = @DBUS_LIBS@
108DBUS_OBJ = @DBUS_OBJ@
86 109
87GCONF_CFLAGS = @GCONF_CFLAGS@ 110GCONF_CFLAGS = @GCONF_CFLAGS@
88GCONF_LIBS = @GCONF_LIBS@ 111GCONF_LIBS = @GCONF_LIBS@
89 112
113GTK_OBJ=@GTK_OBJ@
114
115## -ltermcap, or -lncurses, or -lcurses, or "".
116LIBS_TERMCAP=@LIBS_TERMCAP@
117## terminfo.o if TERMINFO, else tparam.o.
118TERMCAP_OBJ=@TERMCAP_OBJ@
119
120LIBXMU=@LIBXMU@
121
122LIBXSM=@LIBXSM@
123
124LIBXTR6=@LIBXTR6@
125
126## $(LIBXMU) -lXt $(LIBXTR6) -lXext if USE_X_TOOLKIT, else $(LIBXSM).
127## Only used if HAVE_X_WINDOWS.
128LIBXT_OTHER=@LIBXT_OTHER@
129
130XMENU_OBJ=@XMENU_OBJ@
131XOBJ=@XOBJ@
132
133TOOLKIT_LIBW=@TOOLKIT_LIBW@
134
90LIBSOUND= @LIBSOUND@ 135LIBSOUND= @LIBSOUND@
91CFLAGS_SOUND= @CFLAGS_SOUND@ 136CFLAGS_SOUND= @CFLAGS_SOUND@
92 137
93RSVG_LIBS= @RSVG_LIBS@ 138RSVG_LIBS= @RSVG_LIBS@
94RSVG_CFLAGS= @RSVG_CFLAGS@ 139RSVG_CFLAGS= @RSVG_CFLAGS@
95 140
141IMAGEMAGICK_LIBS= @IMAGEMAGICK_LIBS@
142IMAGEMAGICK_CFLAGS= @IMAGEMAGICK_CFLAGS@
143
144
145## widget.o if USE_X_TOOLKIT, otherwise empty.
146WIDGET_OBJ=@WIDGET_OBJ@
147
148## sheap.o if CYGWIN, otherwise empty.
149CYGWIN_OBJ=@CYGWIN_OBJ@
150
151NS_OBJ=@NS_OBJ@
152NS_SUPPORT=@NS_SUPPORT@
153
154## Only used if HAVE_X_WINDOWS and HAVE_WINDOW_SYSTEM.
155FONT_OBJ=@FONT_OBJ@
156
157## ${lispsource}mouse.elc if HAVE_GPM, otherwise empty.
158## Not used if HAVE_MOUSE.
159GPM_MOUSE_SUPPORT=@GPM_MOUSE_SUPPORT@
160
161BASE_WINDOW_SUPPORT=${lispsource}fringe.elc ${lispsource}image.elc \
162 ${lispsource}international/fontset.elc ${lispsource}dnd.elc \
163 ${lispsource}tool-bar.elc ${lispsource}mwheel.elc
164
165X_WINDOW_SUPPORT=${lispsource}x-dnd.elc ${lispsource}term/common-win.elc \
166 ${lispsource}term/x-win.elc ${lispsource}dynamic-setting.elc
167
168LIBSELINUX_LIBS = @LIBSELINUX_LIBS@
169
96INTERVALS_H = dispextern.h intervals.h composite.h 170INTERVALS_H = dispextern.h intervals.h composite.h
97 171
98GETLOADAVG_LIBS = @GETLOADAVG_LIBS@ 172GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
99 173
100RUN_TEMACS = `/bin/pwd`/temacs 174RUN_TEMACS = `/bin/pwd`/temacs
101 175
176START_FILES = @START_FILES@
177
102# ========================== start of cpp stuff ======================= 178# ========================== start of cpp stuff =======================
103/* From here on, comments must be done in C syntax. */ 179/* From here on, comments must be done in C syntax. */
104 180
105/* just to be sure the sh is used */ 181/* just to be sure the sh is used */
106SHELL=/bin/sh 182SHELL=/bin/sh
107 183
108#define THIS_IS_MAKEFILE
109#define NOT_C_CODE 184#define NOT_C_CODE
110#include "config.h" 185#include "config.h"
111 186
@@ -113,11 +188,6 @@ SHELL=/bin/sh
113DEPFLAGS = -MMD -MF deps/$*.d 188DEPFLAGS = -MMD -MF deps/$*.d
114#endif 189#endif
115 190
116/* Undefine until the user can be moved in the non-cpp section. */
117#undef C_SWITCH_SYSTEM
118#undef C_SWITCH_MACHINE
119#undef C_SWITCH_X_SITE
120
121/* Do not let the file name mktime.c get messed up. */ 191/* Do not let the file name mktime.c get messed up. */
122#ifdef mktime 192#ifdef mktime
123#undef mktime 193#undef mktime
@@ -136,101 +206,11 @@ DEPFLAGS = -MMD -MF deps/$*.d
136 do not let it interfere with this file. */ 206 do not let it interfere with this file. */
137#undef register 207#undef register
138 208
139/* Some machines do not find the standard C libraries in the usual place. */ 209/* This macro is for switches specifically related to X Windows. */
140#ifndef ORDINARY_LINK
141#ifndef LIB_STANDARD
142#define LIB_STANDARD -lc
143#endif
144#else
145#ifndef LIB_STANDARD
146#define LIB_STANDARD
147#endif
148#endif
149
150/* Under GNUstep, putting libc on the link line causes problems. */
151#ifdef NS_IMPL_GNUSTEP
152#undef LIB_STANDARD
153#define LIB_STANDARD
154#endif
155
156/* Some s/SYSTEM.h files define this to request special libraries. */
157#ifndef LIBS_SYSTEM
158#define LIBS_SYSTEM
159#endif
160
161/* Some m/MACHINE.h files define this to request special libraries. */
162#ifndef LIBS_MACHINE
163#define LIBS_MACHINE
164#endif
165
166#ifndef LIB_MATH
167# define LIB_MATH -lm
168#endif /* LIB_MATH */
169
170/* Some s/SYSTEM.h files define this to request special switches in ld. */
171#ifndef LD_SWITCH_SYSTEM
172#if !defined (__GNUC__) && ((defined (BSD_SYSTEM) && !defined (COFF)))
173#define LD_SWITCH_SYSTEM -X
174#else /* (defined (BSD_SYSTEM) && !defined (COFF)) */
175#define LD_SWITCH_SYSTEM
176#endif /* (defined (BSD_SYSTEM) && !defined (COFF)) */
177#endif /* LD_SWITCH_SYSTEM */
178
179/* This holds special options for linking temacs
180 that should be used for linking anything else. */
181#ifndef LD_SWITCH_SYSTEM_TEMACS
182#define LD_SWITCH_SYSTEM_TEMACS
183#endif
184
185/* Some m/MACHINE.h files define this to request special switches in ld. */
186#ifndef LD_SWITCH_MACHINE
187#define LD_SWITCH_MACHINE
188#endif
189
190/* This holds special options for linking temacs
191 that should be used for linking anything else. */
192#ifndef LD_SWITCH_MACHINE_TEMACS
193#define LD_SWITCH_MACHINE_TEMACS
194#endif
195
196/* These macros are for switches specifically related to X Windows. */
197#ifndef C_SWITCH_X_MACHINE
198#define C_SWITCH_X_MACHINE
199#endif
200
201#ifndef C_SWITCH_X_SYSTEM
202#define C_SWITCH_X_SYSTEM
203#endif
204
205#ifndef LD_SWITCH_X_SITE 210#ifndef LD_SWITCH_X_SITE
206#define LD_SWITCH_X_SITE 211#define LD_SWITCH_X_SITE
207#endif 212#endif
208 213
209#ifndef LD_SWITCH_X_DEFAULT
210#define LD_SWITCH_X_DEFAULT
211#endif
212
213#ifndef ORDINARY_LINK
214
215#ifndef START_FILES
216#ifdef NO_REMAP
217#define START_FILES pre-crt0.o /lib/crt0.o
218#else /* ! defined (NO_REMAP) */
219#define START_FILES ecrt0.o
220#endif /* ! defined (NO_REMAP) */
221#endif /* START_FILES */
222STARTFILES = START_FILES
223
224#else /* ORDINARY_LINK */
225
226/* config.h might want to force START_FILES anyway */
227#ifdef START_FILES
228STARTFILES = START_FILES
229#endif /* START_FILES */
230
231#endif /* not ORDINARY_LINK */
232
233
234#ifdef NS_IMPL_GNUSTEP 214#ifdef NS_IMPL_GNUSTEP
235/* Pull in stuff from GNUstep-make. */ 215/* Pull in stuff from GNUstep-make. */
236FOUNDATION_LIB=gnu 216FOUNDATION_LIB=gnu
@@ -240,10 +220,6 @@ include @GNUSTEP_MAKEFILES@/Additional/gui.make
240shared=no 220shared=no
241#endif 221#endif
242 222
243#ifdef HAVE_DBUS
244DBUS_OBJ = dbusbind.o
245#endif
246
247/* DO NOT use -R. There is a special hack described in lastfile.c 223/* DO NOT use -R. There is a special hack described in lastfile.c
248 which is used instead. Some initialized data areas are modified 224 which is used instead. Some initialized data areas are modified
249 at initial startup, then labeled as part of the text area when 225 at initial startup, then labeled as part of the text area when
@@ -255,13 +231,10 @@ DBUS_OBJ = dbusbind.o
255 -DHAVE_CONFIG_H is needed for some other files to take advantage of 231 -DHAVE_CONFIG_H is needed for some other files to take advantage of
256 the information in ``config.h''. */ 232 the information in ``config.h''. */
257 233
258#undef C_SWITCH_MACHINE 234/* C_SWITCH_X_SITE must come before C_SWITCH_X_SYSTEM
259#undef C_SWITCH_SYSTEM
260#undef C_SWITCH_X_SITE
261
262/* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM
263 since it may have -I options that should override those two. */ 235 since it may have -I options that should override those two. */
264ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${IMAGEMAGICK_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS} 236/* MYCPPFLAGS only referenced in etc/DEBUG. */
237ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} ${C_SWITCH_MACHINE} ${C_SWITCH_SYSTEM} @C_SWITCH_X_SITE@ @C_SWITCH_X_SYSTEM@ ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${IMAGEMAGICK_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS}
265ALL_OBJC_CFLAGS=$(ALL_CFLAGS) @GNU_OBJC_CFLAGS@ 238ALL_OBJC_CFLAGS=$(ALL_CFLAGS) @GNU_OBJC_CFLAGS@
266 239
267.SUFFIXES: .m 240.SUFFIXES: .m
@@ -276,117 +249,38 @@ ALL_OBJC_CFLAGS=$(ALL_CFLAGS) @GNU_OBJC_CFLAGS@
276#endif 249#endif
277 $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $< 250 $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $<
278 251
279#ifndef LIB_X11_LIB
280#define LIB_X11_LIB -lX11
281#endif
282
283#ifdef HAVE_X_WINDOWS 252#ifdef HAVE_X_WINDOWS
284XMENU_OBJ = xmenu.o 253/* This test needs to say in cpp for the time being, since s/msdos.h
285XOBJ= xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o \ 254 defines HAVE_MENUS, and does not use the configure script. */
286 xsettings.o xgselect.o
287
288#ifdef HAVE_MENUS 255#ifdef HAVE_MENUS
289 256OLDXMENU=@OLDXMENU@
290#ifdef USE_GTK 257LIBXMENU=@LIBXMENU@
291GTK_OBJ= gtkutil.o
292#endif
293
294/* The X Menu stuff is present in the X10 distribution, but missing
295 from X11. If we have X10, just use the installed library;
296 otherwise, use our own copy. */
297#ifdef HAVE_X11
298#ifdef USE_X_TOOLKIT
299OLDXMENU=${lwlibdir}liblw.a
300LIBXMENU= $(OLDXMENU)
301#else /* not USE_X_TOOLKIT */
302OLDXMENU= ${oldXMenudir}libXMenu11.a
303LIBXMENU= $(OLDXMENU)
304#endif /* not USE_X_TOOLKIT */
305#else /* not HAVE_X11 */
306LIBXMENU= -lXMenu
307#endif /* not HAVE_X11 */
308
309#else /* not HAVE_MENUS */ 258#else /* not HAVE_MENUS */
310
311/* Otherwise, do not worry about the menu library at all. */
312LIBXMENU=
313#endif /* not HAVE_MENUS */
314
315#ifdef USE_X_TOOLKIT
316# define @X_TOOLKIT_TYPE@
317# if HAVE_XAW3D
318LUCID_LIBW= -lXaw3d
319# else
320LUCID_LIBW= -lXaw
321# endif
322# if defined (HAVE_MOTIF_2_1) && defined (HAVE_LIBXP)
323# define LIB_MOTIF_EXTRA -lXp
324# else
325# define LIB_MOTIF_EXTRA
326# endif
327# ifdef LIB_MOTIF
328MOTIF_LIBW= LIB_MOTIF LIB_MOTIF_EXTRA
329# else
330MOTIF_LIBW= -lXm LIB_MOTIF_EXTRA
331# endif
332LIBW=$(@X_TOOLKIT_TYPE@_LIBW)
333
334#ifdef HAVE_X11XTR6
335#ifdef NEED_LIBW
336LIBXTR6 = -lSM -lICE -lw
337#else
338LIBXTR6 = -lSM -lICE
339#endif
340#endif
341
342#ifndef LIBXMU
343#define LIBXMU -lXmu
344#endif
345
346LIBXT= $(LIBW) LIBXMU -lXt $(LIBXTR6) -lXext
347
348#else /* not USE_X_TOOLKIT */
349
350#ifdef USE_GTK
351LIBW=@GTK_LIBS@
352OLDXMENU= 259OLDXMENU=
353LIBXMENU= 260LIBXMENU=
354#endif /* USE_GTK */ 261#endif /* not HAVE_MENUS */
355
356#ifdef HAVE_X_SM
357LIBXT=$(LIBW) -lSM -lICE
358#else
359LIBXT=$(LIBW)
360#endif
361#endif /* not USE_X_TOOLKIT */
362 262
363#ifdef HAVE_X11 263LIBXT=$(TOOLKIT_LIBW) $(LIBXT_OTHER)
364/* LD_SWITCH_X_DEFAULT comes after everything else that specifies 264LIBX_BASE=$(LIBXMENU) LD_SWITCH_X_SITE
365 options for where to find X libraries, but before those libraries. */ 265LIBX_OTHER=@LIBX_OTHER@
366X11_LDFLAGS = LD_SWITCH_X_SITE LD_SWITCH_X_DEFAULT
367LIBX= $(LIBXMENU) $(X11_LDFLAGS) $(LIBXT) $(LIBTIFF) $(LIBJPEG) $(LIBPNG) $(LIBGIF) $(LIBXPM) LIB_X11_LIB $(XFT_LIBS)
368#else /* not HAVE_X11 */
369LIBX= $(LIBXMENU) LD_SWITCH_X_SITE
370#endif /* not HAVE_X11 */
371#endif /* not HAVE_X_WINDOWS */ 266#endif /* not HAVE_X_WINDOWS */
372 267
373LIBSOUND= @LIBSOUND@
374CFLAGS_SOUND= @CFLAGS_SOUND@
375 268
376RSVG_LIBS= @RSVG_LIBS@ 269/* A macro which other sections of Makefile can redefine to munge the
377RSVG_CFLAGS= @RSVG_CFLAGS@ 270 flags before they are passed to LD. This is helpful if you have
271 redefined LD to something odd, like "gcc".
272 (The YMF prefix is a holdover from the old name "ymakefile".) */
273#define YMF_PASS_LDFLAGS(flags) flags
378 274
379IMAGEMAGICK_LIBS= @IMAGEMAGICK_LIBS@
380IMAGEMAGICK_CFLAGS= @IMAGEMAGICK_CFLAGS@
381 275
382#ifndef ORDINARY_LINK 276#ifdef ORDINARY_LINK
383/* Fix linking if compiled with GCC. */ 277LD = $(CC)
384#ifdef __GNUC__
385 278
386#ifdef LINKER 279#else /* not ORDINARY_LINK */
387#define LINKER_WAS_SPECIFIED 280GNULIB_VAR = $(LIB_GCC)
388#endif
389 281
282/* Fix linking if compiled with GCC. */
283#if defined (__GNUC__) && ! defined (LINKER)
390/* Versions of GCC >= 2.0 put their library, libgcc.a, in obscure 284/* Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
391 places that are difficult to figure out at make time. Fortunately, 285 places that are difficult to figure out at make time. Fortunately,
392 these same versions allow you to pass arbitrary flags on to the 286 these same versions allow you to pass arbitrary flags on to the
@@ -395,90 +289,42 @@ IMAGEMAGICK_CFLAGS= @IMAGEMAGICK_CFLAGS@
395 Well, it is not quite perfect. The "-nostdlib" keeps GCC from 289 Well, it is not quite perfect. The "-nostdlib" keeps GCC from
396 searching for libraries in its internal directories, so we have to 290 searching for libraries in its internal directories, so we have to
397 ask GCC explicitly where to find libgcc.a. */ 291 ask GCC explicitly where to find libgcc.a. */
398
399#ifndef LINKER
400#define LINKER $(CC) -nostdlib 292#define LINKER $(CC) -nostdlib
401#endif 293/* GCC passes any argument prefixed with -Xlinker directly to the linker.
402 294 See prefix-args.c for an explanation of why we do not do this with the
403#ifndef LIB_GCC 295 shell''s ``for'' construct. Note that sane people do not have '.' in
404/* Ask GCC where to find libgcc.a. */ 296 their paths, so we must use ./prefix-args. */
405#define LIB_GCC `$(CC) -print-libgcc-file-name` 297#undef YMF_PASS_LDFLAGS
406#endif /* not LIB_GCC */
407
408GNULIB_VAR = LIB_GCC
409
410#ifndef LINKER_WAS_SPECIFIED
411/* GCC passes any argument prefixed with -Xlinker directly to the
412 linker. See prefix-args.c for an explanation of why we do not do
413 this with the shell''s ``for'' construct.
414 Note that some people do not have '.' in their paths, so we must
415 use ./prefix-args. */
416#define YMF_PASS_LDFLAGS(flags) `./prefix-args -Xlinker flags` 298#define YMF_PASS_LDFLAGS(flags) `./prefix-args -Xlinker flags`
417#else 299#endif /* defined (__GNUC__) && ! defined (LINKER) */
418#define YMF_PASS_LDFLAGS(flags) flags
419#endif
420
421#else /* not __GNUC__ */
422GNULIB_VAR =
423 300
424#endif /* not __GNUC__ */
425#endif /* not ORDINARY_LINK */
426
427#ifdef ORDINARY_LINK
428LD = $(CC)
429#else
430#ifdef LINKER 301#ifdef LINKER
431LD=LINKER 302LD=LINKER
432#else /* not LINKER */ 303#else /* not LINKER */
433LD=ld 304LD=ld
434#endif /* not LINKER */ 305#endif /* not LINKER */
306
435#endif /* not ORDINARY_LINK */ 307#endif /* not ORDINARY_LINK */
436 308
437/* Flags to pass to LD only for temacs. */
438/* Do not split this line with a backslash. That can cause trouble with
439 some cpps. */
440TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_SWITCH_MACHINE_TEMACS
441
442/* A macro which other sections of Makefile can redefine to munge the
443 flags before they are passed to LD. This is helpful if you have
444 redefined LD to something odd, like "gcc".
445 (The YMF prefix is a holdover from the old name "ymakefile".)
446 */
447#ifndef YMF_PASS_LDFLAGS
448#define YMF_PASS_LDFLAGS(flags) flags
449#endif
450 309
451#ifdef MSDOS 310#ifdef MSDOS
452#ifdef HAVE_X_WINDOWS 311#ifdef HAVE_X_WINDOWS
453MSDOS_OBJ = dosfns.o msdos.o xmenu.o 312MSDOS_OBJ = dosfns.o msdos.o
454#else 313#else
455MSDOS_OBJ = dosfns.o msdos.o w16select.o xmenu.o termcap.o 314MSDOS_OBJ = dosfns.o msdos.o w16select.o termcap.o
456#endif 315#endif
457#endif 316#endif
458 317
459#ifdef CYGWIN
460CYGWIN_OBJ = sheap.o
461#endif
462
463#ifdef HAVE_NS 318#ifdef HAVE_NS
464ns_appdir=@ns_appdir@/ 319ns_appdir=@ns_appdir@/
465ns_appbindir=@ns_appbindir@/ 320ns_appbindir=@ns_appbindir@/
466ns_appresdir=@ns_appresdir@/ 321ns_appresdir=@ns_appresdir@/
467ns_appsrc=@ns_appsrc@ 322ns_appsrc=@ns_appsrc@
468/* Object files for NeXTstep */
469NS_OBJ= nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
470 fontset.o fringe.o image.o
471#endif /* HAVE_NS */ 323#endif /* HAVE_NS */
472 324
473#ifdef HAVE_WINDOW_SYSTEM 325#ifdef HAVE_WINDOW_SYSTEM
474#ifdef HAVE_X_WINDOWS 326#ifdef HAVE_X_WINDOWS
475#if defined (HAVE_XFT) 327FONT_DRIVERS=$(FONT_OBJ)
476FONT_DRIVERS = xfont.o ftfont.o xftfont.o ftxfont.o
477#elif defined (HAVE_FREETYPE)
478FONT_DRIVERS = xfont.o ftfont.o ftxfont.o
479#else /* ! defined (HAVE_XFT) && ! defined (HAVE_FREETYPE) */
480FONT_DRIVERS = xfont.o
481#endif /* ! defined (HAVE_XFT) && ! defined (HAVE_FREETYPE) */
482#endif /* HAVE_X_WINDOWS */ 328#endif /* HAVE_X_WINDOWS */
483#endif /* HAVE_WINDOW_SYSTEM */ 329#endif /* HAVE_WINDOW_SYSTEM */
484 330
@@ -493,7 +339,7 @@ obj= dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
493 cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \ 339 cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \
494 alloc.o data.o doc.o editfns.o callint.o \ 340 alloc.o data.o doc.o editfns.o callint.o \
495 eval.o floatfns.o fns.o font.o print.o lread.o \ 341 eval.o floatfns.o fns.o font.o print.o lread.o \
496 syntax.o UNEXEC bytecode.o \ 342 syntax.o @unexec@ bytecode.o \
497 process.o callproc.o \ 343 process.o callproc.o \
498 region-cache.o sound.o atimer.o \ 344 region-cache.o sound.o atimer.o \
499 doprnt.o strftime.o intervals.o textprop.o composite.o md5.o \ 345 doprnt.o strftime.o intervals.o textprop.o composite.o md5.o \
@@ -509,24 +355,10 @@ SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
509 w32.o w32console.o w32fns.o w32heap.o w32inevt.o \ 355 w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
510 w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_DRIVERS) 356 w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_DRIVERS)
511 357
512 358gmallocobj =
513#ifdef TERMINFO 359rallocobj =
514/* Used to be -ltermcap here. If your machine needs that, 360vmlimitobj =
515 define LIBS_TERMCAP in the m/MACHINE.h file. */
516#ifndef LIBS_TERMCAP
517#define LIBS_TERMCAP -lcurses
518#endif /* LIBS_TERMCAP */
519termcapobj = terminfo.o
520#else /* ! defined (TERMINFO) */
521#ifndef LIBS_TERMCAP
522#define LIBS_TERMCAP
523#endif /* LIBS_TERMCAP */
524termcapobj = tparam.o
525#endif /* ! defined (TERMINFO) */
526
527
528#ifndef SYSTEM_MALLOC 361#ifndef SYSTEM_MALLOC
529
530#ifndef DOUG_LEA_MALLOC 362#ifndef DOUG_LEA_MALLOC
531gmallocobj = gmalloc.o 363gmallocobj = gmalloc.o
532#endif 364#endif
@@ -535,36 +367,23 @@ gmallocobj = gmalloc.o
535rallocobj = ralloc.o 367rallocobj = ralloc.o
536#endif 368#endif
537 369
538mallocobj = $(gmallocobj) $(rallocobj) vm-limit.o 370vmlimitobj = vm-limit.o
539 371#endif /* !SYSTEM_MALLOC */
540#endif /* SYSTEM_MALLOC */
541 372
373/* Empty on Cygwin, lastfile.o elsewhere. */
374PRE_ALLOC_OBJ=@PRE_ALLOC_OBJ@
375/* lastfile.o vm-limit.o on Cygwin, $vmlimitobj elsewhere. */
376POST_ALLOC_OBJ=@POST_ALLOC_OBJ@
542 377
543#ifdef USE_X_TOOLKIT 378/* List of object files that make-docfile should not be told about. */
544widgetobj= widget.o 379otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(gmallocobj) $(rallocobj) \
545#else /* not USE_X_TOOLKIT */ 380 $(POST_ALLOC_OBJ) $(WIDGET_OBJ) $(LIBOBJS)
546widgetobj=
547#endif /* not USE_X_TOOLKIT */
548
549
550/* define otherobj as list of object files that make-docfile
551 should not be told about. */
552#ifdef CYGWIN
553/* Cygwin differs because of its unexec(). */
554otherobj= $(termcapobj) $(gmallocobj) $(rallocobj) lastfile.o vm-limit.o $(widgetobj) $(LIBOBJS)
555#else
556otherobj= $(termcapobj) lastfile.o $(mallocobj) $(widgetobj) $(LIBOBJS)
557#endif
558 381
559#ifdef HAVE_MOUSE 382#ifdef HAVE_MOUSE
560#define MOUSE_SUPPORT ${lispsource}mouse.elc \ 383#define MOUSE_SUPPORT ${lispsource}mouse.elc \
561 ${lispsource}select.elc ${lispsource}scroll-bar.elc 384 ${lispsource}select.elc ${lispsource}scroll-bar.elc
562#else 385#else
563#ifdef HAVE_GPM 386#define MOUSE_SUPPORT $(GPM_MOUSE_SUPPORT)
564#define MOUSE_SUPPORT ${lispsource}mouse.elc
565#else
566#define MOUSE_SUPPORT
567#endif
568#endif 387#endif
569 388
570#ifdef MSDOS 389#ifdef MSDOS
@@ -578,15 +397,9 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(widgetobj) $(LIBOBJS)
578 397
579#ifdef HAVE_WINDOW_SYSTEM 398#ifdef HAVE_WINDOW_SYSTEM
580#ifdef HAVE_X_WINDOWS 399#ifdef HAVE_X_WINDOWS
581#define WINDOW_SUPPORT ${lispsource}fringe.elc ${lispsource}image.elc \ 400#define WINDOW_SUPPORT $(BASE_WINDOW_SUPPORT) $(X_WINDOW_SUPPORT)
582 ${lispsource}international/fontset.elc ${lispsource}dnd.elc \
583 ${lispsource}tool-bar.elc ${lispsource}mwheel.elc ${lispsource}x-dnd.elc \
584 ${lispsource}term/common-win.elc ${lispsource}term/x-win.elc \
585 ${lispsource}font-setting.elc
586#else 401#else
587#define WINDOW_SUPPORT ${lispsource}fringe.elc ${lispsource}image.elc \ 402#define WINDOW_SUPPORT $(BASE_WINDOW_SUPPORT)
588 ${lispsource}international/fontset.elc ${lispsource}dnd.elc \
589 ${lispsource}tool-bar.elc ${lispsource}mwheel.elc
590#endif 403#endif
591#else 404#else
592#define WINDOW_SUPPORT 405#define WINDOW_SUPPORT
@@ -607,13 +420,6 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(widgetobj) $(LIBOBJS)
607#define TOOLTIP_SUPPORT 420#define TOOLTIP_SUPPORT
608#endif 421#endif
609 422
610#ifdef HAVE_NS
611#define NS_SUPPORT ${lispsource}emacs-lisp/easymenu.elc \
612 ${lispsource}term/ns-win.elc
613#else
614#define NS_SUPPORT
615#endif
616
617/* This is the platform-specific list of Lisp files loaded into the 423/* This is the platform-specific list of Lisp files loaded into the
618 dumped Emacs. It is arranged like this because it is easier to generate 424 dumped Emacs. It is arranged like this because it is easier to generate
619 it semi-mechanically from loadup.el this way. 425 it semi-mechanically from loadup.el this way.
@@ -714,7 +520,7 @@ lisp= \
714 MSDOS_SUPPORT \ 520 MSDOS_SUPPORT \
715 WINNT_SUPPORT \ 521 WINNT_SUPPORT \
716 WINDOW_SUPPORT \ 522 WINDOW_SUPPORT \
717 NS_SUPPORT \ 523 ${NS_SUPPORT} \
718 ${lispsource}widget.elc \ 524 ${lispsource}widget.elc \
719 ${lispsource}window.elc \ 525 ${lispsource}window.elc \
720 ${lispsource}version.el 526 ${lispsource}version.el
@@ -817,7 +623,7 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \
817 ../lisp/tooltip.elc ../lisp/image.elc \ 623 ../lisp/tooltip.elc ../lisp/image.elc \
818 ../lisp/fringe.elc ../lisp/dnd.elc \ 624 ../lisp/fringe.elc ../lisp/dnd.elc \
819 ../lisp/mwheel.elc ../lisp/tool-bar.elc \ 625 ../lisp/mwheel.elc ../lisp/tool-bar.elc \
820 ../lisp/x-dnd.elc ../lisp/font-setting.elc \ 626 ../lisp/x-dnd.elc ../lisp/dynamic-setting.elc \
821 ../lisp/international/ccl.elc \ 627 ../lisp/international/ccl.elc \
822 ../lisp/international/fontset.elc \ 628 ../lisp/international/fontset.elc \
823 ../lisp/mouse.elc \ 629 ../lisp/mouse.elc \
@@ -832,11 +638,11 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \
832 duplicated symbols. If the standard libraries were compiled 638 duplicated symbols. If the standard libraries were compiled
833 with GCC, we might need gnulib again after them. */ 639 with GCC, we might need gnulib again after them. */
834 640
835LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) $(RSVG_LIBS) ${IMAGEMAGICK_LIBS} $(DBUS_LIBS) \ 641LIBES = $(LOADLIBES) $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
836 @LIBGPM@ @LIBRESOLV@ LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \ 642 $(RSVG_LIBS) ${IMAGEMAGICK_LIBS} $(DBUS_LIBS) @LIBGPM@ @LIBRESOLV@ $(LIBS_SYSTEM) \
837 $(GETLOADAVG_LIBS) ${GCONF_LIBS} \ 643 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \
838 @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ @M17N_FLT_LIBS@ \ 644 @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ @M17N_FLT_LIBS@ \
839 $(GNULIB_VAR) LIB_MATH LIB_STANDARD $(GNULIB_VAR) 645 $(GNULIB_VAR) @LIB_MATH@ @LIB_STANDARD@ $(GNULIB_VAR)
840 646
841all: emacs${EXEEXT} $(OTHER_FILES) 647all: emacs${EXEEXT} $(OTHER_FILES)
842 648
@@ -877,7 +683,8 @@ ${libsrc}make-docfile${EXEEXT}:
877buildobj.h: Makefile 683buildobj.h: Makefile
878 echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h 684 echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h
879 685
880temacs${EXEEXT}: $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT} 686/* FIXME LOCALCPP not defined or mentioned anywhere. */
687temacs${EXEEXT}: $(LOCALCPP) $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT}
881#ifdef NS_IMPL_GNUSTEP 688#ifdef NS_IMPL_GNUSTEP
882 $(CC) -rdynamic YMF_PASS_LDFLAGS ( ${TEMACS_LDFLAGS} \ 689 $(CC) -rdynamic YMF_PASS_LDFLAGS ( ${TEMACS_LDFLAGS} \
883 -L@GNUSTEP_SYSTEM_LIBRARIES@ -lgnustep-gui -lgnustep-base \ 690 -L@GNUSTEP_SYSTEM_LIBRARIES@ -lgnustep-gui -lgnustep-base \
@@ -885,13 +692,10 @@ temacs${EXEEXT}: $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} pre
885 ${obj} ${otherobj} ${LIBES} 692 ${obj} ${otherobj} ${LIBES}
886#else 693#else
887 $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \ 694 $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
888 -o temacs ${STARTFILES} ${obj} ${otherobj} \ 695 -o temacs ${START_FILES} ${obj} ${otherobj} \
889 ${LIBES} 696 ${LIBES}
890#endif 697#endif
891 698
892/* We do not use ALL_LDFLAGS because LD_SWITCH_SYSTEM and LD_SWITCH_MACHINE
893 often contain options that have to do with using Emacs''s crt0,
894 which are only good with temacs. */
895prefix-args${EXEEXT}: prefix-args.o $(config_h) 699prefix-args${EXEEXT}: prefix-args.o $(config_h)
896 $(CC) $(LDFLAGS) prefix-args.o -o prefix-args 700 $(CC) $(LDFLAGS) prefix-args.o -o prefix-args
897 701
@@ -906,19 +710,12 @@ stamp-oldxmenu: ${OLDXMENU} ../src/$(OLDXMENU)
906/* Supply an ordering for parallel make. */ 710/* Supply an ordering for parallel make. */
907../src/$(OLDXMENU): ${OLDXMENU} 711../src/$(OLDXMENU): ${OLDXMENU}
908 712
909/* Encode the values of these two macros in Make variables,
910 so we can use $(...) to substitute their values within "...". */
911C_SWITCH_X_MACHINE_1 = C_SWITCH_X_MACHINE
912C_SWITCH_X_SYSTEM_1 = C_SWITCH_X_SYSTEM
913
914#ifdef USE_X_TOOLKIT 713#ifdef USE_X_TOOLKIT
915$(OLDXMENU): really-lwlib 714$(OLDXMENU): really-lwlib
916 715
917really-lwlib: 716really-lwlib:
918 cd ${lwlibdir}; ${MAKE} ${MFLAGS} \ 717 cd ${lwlibdir}; ${MAKE} ${MFLAGS} \
919 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' \ 718 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}'
920 "C_SWITCH_X_MACHINE=$(C_SWITCH_X_MACHINE_1)" \
921 "C_SWITCH_X_SYSTEM=$(C_SWITCH_X_SYSTEM_1)"
922 @true /* make -t should not create really-lwlib. */ 719 @true /* make -t should not create really-lwlib. */
923.PHONY: really-lwlib 720.PHONY: really-lwlib
924#else /* not USE_X_TOOLKIT */ 721#else /* not USE_X_TOOLKIT */
@@ -926,9 +723,7 @@ $(OLDXMENU): really-oldXMenu
926 723
927really-oldXMenu: 724really-oldXMenu:
928 cd ${oldXMenudir}; ${MAKE} ${MFLAGS} \ 725 cd ${oldXMenudir}; ${MAKE} ${MFLAGS} \
929 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' \ 726 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}'
930 "C_SWITCH_X_MACHINE=$(C_SWITCH_X_MACHINE_1)" \
931 "C_SWITCH_X_SYSTEM=$(C_SWITCH_X_SYSTEM_1)"
932 @true /* make -t should not create really-oldXMenu. */ 727 @true /* make -t should not create really-oldXMenu. */
933.PHONY: really-oldXMenu 728.PHONY: really-oldXMenu
934#endif /* not USE_X_TOOLKIT */ 729#endif /* not USE_X_TOOLKIT */
@@ -958,6 +753,14 @@ doc.o: buildobj.h
958 753
959#ifndef AUTO_DEPEND 754#ifndef AUTO_DEPEND
960 755
756/* FIXME some of these dependencies are platform-specific.
757Eg callproc.c only depends on w32.h for WINDOWSNT builds.
758One way to fix this would be to replace w32.h (etc) by $(W32_H),
759a variable set by configure. Does not seem worth the trouble.
760
761nsgui.h: In fact, every .o file depends directly or indirectly on
762dispextern.h and hence nsgui.h under NS. But the ones that actually
763use stuff there are more limited. */
961atimer.o: atimer.c atimer.h syssignal.h systime.h lisp.h blockinput.h \ 764atimer.o: atimer.c atimer.h syssignal.h systime.h lisp.h blockinput.h \
962 $(config_h) 765 $(config_h)
963bidi.o: bidi.c buffer.h character.h dispextern.h lisp.h $(config_h) 766bidi.o: bidi.c buffer.h character.h dispextern.h lisp.h $(config_h)
@@ -993,7 +796,7 @@ dired.o: dired.c commands.h buffer.h lisp.h $(config_h) character.h charset.h \
993 coding.h regex.h systime.h blockinput.h atimer.h composite.h 796 coding.h regex.h systime.h blockinput.h atimer.h composite.h
994dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \ 797dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \
995 window.h buffer.h termchar.h termopts.h termhooks.h cm.h \ 798 window.h buffer.h termchar.h termopts.h termhooks.h cm.h \
996 disptab.h indent.h $(INTERVALS_H) \ 799 disptab.h indent.h $(INTERVALS_H) nsgui.h \
997 xterm.h blockinput.h atimer.h character.h msdos.h keyboard.h \ 800 xterm.h blockinput.h atimer.h character.h msdos.h keyboard.h \
998 syssignal.h lisp.h $(config_h) 801 syssignal.h lisp.h $(config_h)
999doc.o: doc.c lisp.h $(config_h) epaths.h buffer.h keyboard.h keymap.h \ 802doc.o: doc.c lisp.h $(config_h) epaths.h buffer.h keyboard.h keymap.h \
@@ -1014,18 +817,19 @@ filelock.o: filelock.c buffer.h character.h coding.h systime.h composite.h \
1014filemode.o: filemode.c $(config_h) 817filemode.o: filemode.c $(config_h)
1015frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \ 818frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \
1016 blockinput.h atimer.h systime.h buffer.h character.h fontset.h font.h \ 819 blockinput.h atimer.h systime.h buffer.h character.h fontset.h font.h \
1017 msdos.h dosfns.h dispextern.h w32term.h termchar.h coding.h composite.h \ 820 msdos.h dosfns.h dispextern.h w32term.h nsgui.h termchar.h coding.h \
1018 lisp.h $(config_h) termhooks.h ccl.h 821 composite.h lisp.h $(config_h) termhooks.h ccl.h
1019fringe.o: fringe.c dispextern.h frame.h window.h buffer.h termhooks.h \ 822fringe.o: fringe.c dispextern.h nsgui.h frame.h window.h buffer.h termhooks.h \
1020 blockinput.h atimer.h systime.h lisp.h $(config_h) 823 blockinput.h atimer.h systime.h lisp.h $(config_h)
1021font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \ 824font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \
1022 font.h lisp.h $(config_h) buffer.h composite.h fontset.h xterm.h 825 font.h lisp.h $(config_h) buffer.h composite.h fontset.h xterm.h nsgui.h
1023ftfont.o: dispextern.h frame.h character.h charset.h composite.h font.h \ 826ftfont.o: dispextern.h frame.h character.h charset.h composite.h font.h \
1024 lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h fontset.h \ 827 lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h fontset.h \
1025 ccl.h ftfont.h 828 ccl.h ftfont.h
1026fontset.o: fontset.c fontset.h ccl.h buffer.h character.h \ 829fontset.o: fontset.c fontset.h ccl.h buffer.h character.h \
1027 charset.h frame.h keyboard.h termhooks.h font.h lisp.h $(config_h) \ 830 charset.h frame.h keyboard.h termhooks.h font.h lisp.h $(config_h) \
1028 blockinput.h atimer.h systime.h coding.h $(INTERVALS_H) window.h xterm.h 831 blockinput.h atimer.h systime.h coding.h $(INTERVALS_H) nsgui.h \
832 window.h xterm.h
1029getloadavg.o: getloadavg.c $(config_h) 833getloadavg.o: getloadavg.c $(config_h)
1030gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \ 834gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \
1031 blockinput.h window.h atimer.h systime.h termhooks.h keyboard.h \ 835 blockinput.h window.h atimer.h systime.h termhooks.h keyboard.h \
@@ -1041,7 +845,7 @@ insdel.o: insdel.c window.h buffer.h $(INTERVALS_H) blockinput.h character.h \
1041keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \ 845keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \
1042 commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \ 846 commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \
1043 systime.h syntax.h $(INTERVALS_H) blockinput.h atimer.h composite.h \ 847 systime.h syntax.h $(INTERVALS_H) blockinput.h atimer.h composite.h \
1044 xterm.h puresize.h msdos.h keymap.h w32term.h nsterm.h coding.h \ 848 xterm.h puresize.h msdos.h keymap.h w32term.h nsterm.h nsgui.h coding.h \
1045 lisp.h $(config_h) 849 lisp.h $(config_h)
1046keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \ 850keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
1047 atimer.h systime.h puresize.h character.h charset.h $(INTERVALS_H) keymap.h window.h \ 851 atimer.h systime.h puresize.h character.h charset.h $(INTERVALS_H) keymap.h window.h \
@@ -1062,7 +866,7 @@ msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \
1062 termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \ 866 termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \
1063 keyboard.h $(INTERVALS_H) buffer.h commands.h blockinput.h atimer.h lisp.h $(config_h) 867 keyboard.h $(INTERVALS_H) buffer.h commands.h blockinput.h atimer.h lisp.h $(config_h)
1064nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \ 868nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \
1065 dispextern.h nsgui.h fontset.h $(INTERVALS_H) keyboard.h blockinput.h \ 869 dispextern.h fontset.h $(INTERVALS_H) keyboard.h blockinput.h \
1066 atimer.h systime.h epaths.h termhooks.h coding.h systime.h lisp.h $(config_h) 870 atimer.h systime.h epaths.h termhooks.h coding.h systime.h lisp.h $(config_h)
1067nsfont.o: nsterm.h dispextern.h frame.h lisp.h lisp.h $(config_h) 871nsfont.o: nsterm.h dispextern.h frame.h lisp.h lisp.h $(config_h)
1068nsimage.o: nsimage.m nsterm.h lisp.h $(config_h) 872nsimage.o: nsimage.m nsterm.h lisp.h $(config_h)
@@ -1120,16 +924,16 @@ widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \
1120window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \ 924window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \
1121 disptab.h keyboard.h msdos.h coding.h termhooks.h \ 925 disptab.h keyboard.h msdos.h coding.h termhooks.h \
1122 keymap.h blockinput.h atimer.h systime.h $(INTERVALS_H) \ 926 keymap.h blockinput.h atimer.h systime.h $(INTERVALS_H) \
1123 xterm.h w32term.h nsterm.h lisp.h $(config_h) 927 xterm.h w32term.h nsterm.h nsgui.h lisp.h $(config_h)
1124xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h \ 928xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h \
1125 coding.h termchar.h frame.h window.h disptab.h termhooks.h character.h \ 929 coding.h termchar.h frame.h window.h disptab.h termhooks.h character.h \
1126 charset.h lisp.h $(config_h) keyboard.h $(INTERVALS_H) region-cache.h xterm.h \ 930 charset.h lisp.h $(config_h) keyboard.h $(INTERVALS_H) region-cache.h \
1127 w32term.h nsterm.h msdos.h composite.h fontset.h ccl.h \ 931 xterm.h w32term.h nsterm.h nsgui.h msdos.h composite.h fontset.h ccl.h \
1128 blockinput.h atimer.h systime.h keymap.h font.h 932 blockinput.h atimer.h systime.h keymap.h font.h
1129xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \ 933xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \
1130 window.h character.h charset.h msdos.h dosfns.h composite.h atimer.h \ 934 window.h character.h charset.h msdos.h dosfns.h composite.h atimer.h \
1131 systime.h keyboard.h fontset.h w32term.h nsterm.h coding.h ccl.h \ 935 systime.h keyboard.h fontset.h w32term.h nsterm.h coding.h ccl.h \
1132 $(INTERVALS_H) termchar.h termhooks.h font.h lisp.h $(config_h) 936 $(INTERVALS_H) nsgui.h termchar.h termhooks.h font.h lisp.h $(config_h)
1133xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \ 937xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \
1134 $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \ 938 $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \
1135 character.h charset.h coding.h gtkutil.h lisp.h $(config_h) termhooks.h \ 939 character.h charset.h coding.h gtkutil.h lisp.h $(config_h) termhooks.h \
@@ -1142,7 +946,7 @@ ftxfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
1142 font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h 946 font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h
1143menu.o: menu.c lisp.h keyboard.h keymap.h frame.h termhooks.h blockinput.h \ 947menu.o: menu.c lisp.h keyboard.h keymap.h frame.h termhooks.h blockinput.h \
1144 dispextern.h $(srcdir)/../lwlib/lwlib.h xterm.h gtkutil.h menu.h \ 948 dispextern.h $(srcdir)/../lwlib/lwlib.h xterm.h gtkutil.h menu.h \
1145 lisp.h $(config_h) systime.h coding.h composite.h window.h atimer.h 949 lisp.h $(config_h) systime.h coding.h composite.h window.h atimer.h nsgui.h
1146xmenu.o: xmenu.c xterm.h termhooks.h window.h dispextern.h frame.h buffer.h \ 950xmenu.o: xmenu.c xterm.h termhooks.h window.h dispextern.h frame.h buffer.h \
1147 charset.h keyboard.h $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h \ 951 charset.h keyboard.h $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h \
1148 systime.h gtkutil.h msdos.h coding.h menu.h lisp.h $(config_h) composite.h \ 952 systime.h gtkutil.h msdos.h coding.h menu.h lisp.h $(config_h) composite.h \
@@ -1200,12 +1004,6 @@ textprop.o: textprop.c buffer.h window.h $(INTERVALS_H) \
1200 select which of these should be compiled. */ 1004 select which of these should be compiled. */
1201 1005
1202#ifdef HAVE_NS 1006#ifdef HAVE_NS
1203/* In fact, every .o file depends directly or indirectly on dispextern.h
1204 and hence nsgui.h under NS. But the ones that actually use stuff there
1205 are more limited. */
1206dispnew.o font.o fontset.o frame.o fringe.o image.o keyboard.o menu.o \
1207 window.o xdisp.o xfaces.o: nsgui.h
1208
1209${ns_appdir}: ${ns_appsrc} 1007${ns_appdir}: ${ns_appsrc}
1210 rm -fr ${ns_appdir} 1008 rm -fr ${ns_appdir}
1211 mkdir -p ${ns_appdir} 1009 mkdir -p ${ns_appdir}
@@ -1331,6 +1129,6 @@ bootstrap-emacs${EXEEXT}: temacs${EXEEXT}
1331 cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS=${bootstrap_exe} 1129 cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS=${bootstrap_exe}
1332 1130
1333#ifdef AUTO_DEPEND 1131#ifdef AUTO_DEPEND
1334ALLOBJS=$(STARTFILES) ${obj} ${otherobj} prefix-args.o 1132ALLOBJS=$(START_FILES) ${obj} ${otherobj} prefix-args.o
1335-include $(ALLOBJS:%.o=deps/%.d) 1133-include $(ALLOBJS:%.o=deps/%.d)
1336#endif 1134#endif
diff --git a/src/alloc.c b/src/alloc.c
index 98d60067f9e..c1f1094d15f 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1365,7 +1365,7 @@ uninterrupt_malloc ()
1365 pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); 1365 pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
1366 pthread_mutex_init (&alloc_mutex, &attr); 1366 pthread_mutex_init (&alloc_mutex, &attr);
1367#else /* !DOUG_LEA_MALLOC */ 1367#else /* !DOUG_LEA_MALLOC */
1368 /* Some systems such as Solaris 2.6 doesn't have a recursive mutex, 1368 /* Some systems such as Solaris 2.6 don't have a recursive mutex,
1369 and the bundled gmalloc.c doesn't require it. */ 1369 and the bundled gmalloc.c doesn't require it. */
1370 pthread_mutex_init (&alloc_mutex, NULL); 1370 pthread_mutex_init (&alloc_mutex, NULL);
1371#endif /* !DOUG_LEA_MALLOC */ 1371#endif /* !DOUG_LEA_MALLOC */
@@ -3193,13 +3193,13 @@ Its value and function definition are void, and its property list is nil. */)
3193 p = XSYMBOL (val); 3193 p = XSYMBOL (val);
3194 p->xname = name; 3194 p->xname = name;
3195 p->plist = Qnil; 3195 p->plist = Qnil;
3196 p->value = Qunbound; 3196 p->redirect = SYMBOL_PLAINVAL;
3197 SET_SYMBOL_VAL (p, Qunbound);
3197 p->function = Qunbound; 3198 p->function = Qunbound;
3198 p->next = NULL; 3199 p->next = NULL;
3199 p->gcmarkbit = 0; 3200 p->gcmarkbit = 0;
3200 p->interned = SYMBOL_UNINTERNED; 3201 p->interned = SYMBOL_UNINTERNED;
3201 p->constant = 0; 3202 p->constant = 0;
3202 p->indirect_variable = 0;
3203 consing_since_gc += sizeof (struct Lisp_Symbol); 3203 consing_since_gc += sizeof (struct Lisp_Symbol);
3204 symbols_consed++; 3204 symbols_consed++;
3205 return val; 3205 return val;
@@ -4893,14 +4893,21 @@ Does not copy symbols. Copies strings without text properties. */)
4893 if (PURE_POINTER_P (XPNTR (obj))) 4893 if (PURE_POINTER_P (XPNTR (obj)))
4894 return obj; 4894 return obj;
4895 4895
4896 if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing. */
4897 {
4898 Lisp_Object tmp = Fgethash (obj, Vpurify_flag, Qnil);
4899 if (!NILP (tmp))
4900 return tmp;
4901 }
4902
4896 if (CONSP (obj)) 4903 if (CONSP (obj))
4897 return pure_cons (XCAR (obj), XCDR (obj)); 4904 obj = pure_cons (XCAR (obj), XCDR (obj));
4898 else if (FLOATP (obj)) 4905 else if (FLOATP (obj))
4899 return make_pure_float (XFLOAT_DATA (obj)); 4906 obj = make_pure_float (XFLOAT_DATA (obj));
4900 else if (STRINGP (obj)) 4907 else if (STRINGP (obj))
4901 return make_pure_string (SDATA (obj), SCHARS (obj), 4908 obj = make_pure_string (SDATA (obj), SCHARS (obj),
4902 SBYTES (obj), 4909 SBYTES (obj),
4903 STRING_MULTIBYTE (obj)); 4910 STRING_MULTIBYTE (obj));
4904 else if (COMPILEDP (obj) || VECTORP (obj)) 4911 else if (COMPILEDP (obj) || VECTORP (obj))
4905 { 4912 {
4906 register struct Lisp_Vector *vec; 4913 register struct Lisp_Vector *vec;
@@ -4920,10 +4927,15 @@ Does not copy symbols. Copies strings without text properties. */)
4920 } 4927 }
4921 else 4928 else
4922 XSETVECTOR (obj, vec); 4929 XSETVECTOR (obj, vec);
4923 return obj;
4924 } 4930 }
4925 else if (MARKERP (obj)) 4931 else if (MARKERP (obj))
4926 error ("Attempt to copy a marker to pure storage"); 4932 error ("Attempt to copy a marker to pure storage");
4933 else
4934 /* Not purified, don't hash-cons. */
4935 return obj;
4936
4937 if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing. */
4938 Fputhash (obj, obj, Vpurify_flag);
4927 4939
4928 return obj; 4940 return obj;
4929} 4941}
@@ -5569,17 +5581,42 @@ mark_object (arg)
5569 break; 5581 break;
5570 CHECK_ALLOCATED_AND_LIVE (live_symbol_p); 5582 CHECK_ALLOCATED_AND_LIVE (live_symbol_p);
5571 ptr->gcmarkbit = 1; 5583 ptr->gcmarkbit = 1;
5572 mark_object (ptr->value);
5573 mark_object (ptr->function); 5584 mark_object (ptr->function);
5574 mark_object (ptr->plist); 5585 mark_object (ptr->plist);
5575 5586 switch (ptr->redirect)
5587 {
5588 case SYMBOL_PLAINVAL: mark_object (SYMBOL_VAL (ptr)); break;
5589 case SYMBOL_VARALIAS:
5590 {
5591 Lisp_Object tem;
5592 XSETSYMBOL (tem, SYMBOL_ALIAS (ptr));
5593 mark_object (tem);
5594 break;
5595 }
5596 case SYMBOL_LOCALIZED:
5597 {
5598 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (ptr);
5599 /* If the value is forwarded to a buffer or keyboard field,
5600 these are marked when we see the corresponding object.
5601 And if it's forwarded to a C variable, either it's not
5602 a Lisp_Object var, or it's staticpro'd already. */
5603 mark_object (blv->where);
5604 mark_object (blv->valcell);
5605 mark_object (blv->defcell);
5606 break;
5607 }
5608 case SYMBOL_FORWARDED:
5609 /* If the value is forwarded to a buffer or keyboard field,
5610 these are marked when we see the corresponding object.
5611 And if it's forwarded to a C variable, either it's not
5612 a Lisp_Object var, or it's staticpro'd already. */
5613 break;
5614 default: abort ();
5615 }
5576 if (!PURE_POINTER_P (XSTRING (ptr->xname))) 5616 if (!PURE_POINTER_P (XSTRING (ptr->xname)))
5577 MARK_STRING (XSTRING (ptr->xname)); 5617 MARK_STRING (XSTRING (ptr->xname));
5578 MARK_INTERVAL_TREE (STRING_INTERVALS (ptr->xname)); 5618 MARK_INTERVAL_TREE (STRING_INTERVALS (ptr->xname));
5579 5619
5580 /* Note that we do not mark the obarray of the symbol.
5581 It is safe not to do so because nothing accesses that
5582 slot except to check whether it is nil. */
5583 ptr = ptr->next; 5620 ptr = ptr->next;
5584 if (ptr) 5621 if (ptr)
5585 { 5622 {
@@ -5598,22 +5635,6 @@ mark_object (arg)
5598 5635
5599 switch (XMISCTYPE (obj)) 5636 switch (XMISCTYPE (obj))
5600 { 5637 {
5601 case Lisp_Misc_Buffer_Local_Value:
5602 {
5603 register struct Lisp_Buffer_Local_Value *ptr
5604 = XBUFFER_LOCAL_VALUE (obj);
5605 /* If the cdr is nil, avoid recursion for the car. */
5606 if (EQ (ptr->cdr, Qnil))
5607 {
5608 obj = ptr->realvalue;
5609 goto loop;
5610 }
5611 mark_object (ptr->realvalue);
5612 mark_object (ptr->buffer);
5613 mark_object (ptr->frame);
5614 obj = ptr->cdr;
5615 goto loop;
5616 }
5617 5638
5618 case Lisp_Misc_Marker: 5639 case Lisp_Misc_Marker:
5619 /* DO NOT mark thru the marker's chain. 5640 /* DO NOT mark thru the marker's chain.
@@ -5621,17 +5642,6 @@ mark_object (arg)
5621 instead, markers are removed from the chain when freed by gc. */ 5642 instead, markers are removed from the chain when freed by gc. */
5622 break; 5643 break;
5623 5644
5624 case Lisp_Misc_Intfwd:
5625 case Lisp_Misc_Boolfwd:
5626 case Lisp_Misc_Objfwd:
5627 case Lisp_Misc_Buffer_Objfwd:
5628 case Lisp_Misc_Kboard_Objfwd:
5629 /* Don't bother with Lisp_Buffer_Objfwd,
5630 since all markable slots in current buffer marked anyway. */
5631 /* Don't need to do Lisp_Objfwd, since the places they point
5632 are protected with staticpro. */
5633 break;
5634
5635 case Lisp_Misc_Save_Value: 5645 case Lisp_Misc_Save_Value:
5636#if GC_MARK_STACK 5646#if GC_MARK_STACK
5637 { 5647 {
@@ -6036,6 +6046,8 @@ gc_sweep ()
6036 6046
6037 if (!sym->gcmarkbit && !pure_p) 6047 if (!sym->gcmarkbit && !pure_p)
6038 { 6048 {
6049 if (sym->redirect == SYMBOL_LOCALIZED)
6050 xfree (SYMBOL_BLV (sym));
6039 sym->next = symbol_free_list; 6051 sym->next = symbol_free_list;
6040 symbol_free_list = sym; 6052 symbol_free_list = sym;
6041#if GC_MARK_STACK 6053#if GC_MARK_STACK
@@ -6371,7 +6383,9 @@ If this portion is smaller than `gc-cons-threshold', this is ignored. */);
6371 6383
6372 DEFVAR_LISP ("purify-flag", &Vpurify_flag, 6384 DEFVAR_LISP ("purify-flag", &Vpurify_flag,
6373 doc: /* Non-nil means loading Lisp code in order to dump an executable. 6385 doc: /* Non-nil means loading Lisp code in order to dump an executable.
6374This means that certain objects should be allocated in shared (pure) space. */); 6386This means that certain objects should be allocated in shared (pure) space.
6387It can also be set to a hash-table, in which case this table is used to
6388do hash-consing of the objects allocated to pure space. */);
6375 6389
6376 DEFVAR_BOOL ("garbage-collection-messages", &garbage_collection_messages, 6390 DEFVAR_BOOL ("garbage-collection-messages", &garbage_collection_messages,
6377 doc: /* Non-nil means display messages at start and end of garbage collection. */); 6391 doc: /* Non-nil means display messages at start and end of garbage collection. */);
diff --git a/src/bidi.c b/src/bidi.c
index 0c8a3182510..d4c7d2451d7 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -23,7 +23,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23 as per UAX#9, a part of the Unicode Standard. 23 as per UAX#9, a part of the Unicode Standard.
24 24
25 Unlike the reference and most other implementations, this one is 25 Unlike the reference and most other implementations, this one is
26 designed to be called once for every character in the buffer. 26 designed to be called once for every character in the buffer or
27 string.
27 28
28 The main entry point is bidi_get_next_char_visually. Each time it 29 The main entry point is bidi_get_next_char_visually. Each time it
29 is called, it finds the next character in the visual order, and 30 is called, it finds the next character in the visual order, and
@@ -34,6 +35,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
34 more details about its algorithm that finds the next visual-order 35 more details about its algorithm that finds the next visual-order
35 character by resolving their levels on the fly. 36 character by resolving their levels on the fly.
36 37
38 The two other entry points are bidi_paragraph_init and
39 bidi_mirror_char. The first determines the base direction of a
40 paragraph, while the second returns the mirrored version of its
41 argument character.
42
37 If you want to understand the code, you will have to read it 43 If you want to understand the code, you will have to read it
38 together with the relevant portions of UAX#9. The comments include 44 together with the relevant portions of UAX#9. The comments include
39 references to UAX#9 rules, for that very reason. 45 references to UAX#9 rules, for that very reason.
@@ -96,7 +102,7 @@ typedef enum {
96 102
97int bidi_ignore_explicit_marks_for_paragraph_level = 1; 103int bidi_ignore_explicit_marks_for_paragraph_level = 1;
98 104
99static Lisp_Object fallback_paragraph_start_re, fallback_paragraph_separate_re; 105static Lisp_Object paragraph_start_re, paragraph_separate_re;
100static Lisp_Object Qparagraph_start, Qparagraph_separate; 106static Lisp_Object Qparagraph_start, Qparagraph_separate;
101 107
102static void 108static void
@@ -393,26 +399,24 @@ bidi_initialize ()
393 bidi_type[i].to ? bidi_type[i].to : bidi_type[i].from, 399 bidi_type[i].to ? bidi_type[i].to : bidi_type[i].from,
394 make_number (bidi_type[i].type)); 400 make_number (bidi_type[i].type));
395 401
396 fallback_paragraph_start_re =
397 XSYMBOL (Fintern_soft (build_string ("paragraph-start"), Qnil))->value;
398 if (!STRINGP (fallback_paragraph_start_re))
399 fallback_paragraph_start_re = build_string ("\f\\|[ \t]*$");
400 staticpro (&fallback_paragraph_start_re);
401 Qparagraph_start = intern ("paragraph-start"); 402 Qparagraph_start = intern ("paragraph-start");
402 staticpro (&Qparagraph_start); 403 staticpro (&Qparagraph_start);
403 fallback_paragraph_separate_re = 404 paragraph_start_re = Fsymbol_value (Qparagraph_start);
404 XSYMBOL (Fintern_soft (build_string ("paragraph-separate"), Qnil))->value; 405 if (!STRINGP (paragraph_start_re))
405 if (!STRINGP (fallback_paragraph_separate_re)) 406 paragraph_start_re = build_string ("\f\\|[ \t]*$");
406 fallback_paragraph_separate_re = build_string ("[ \t\f]*$"); 407 staticpro (&paragraph_start_re);
407 staticpro (&fallback_paragraph_separate_re);
408 Qparagraph_separate = intern ("paragraph-separate"); 408 Qparagraph_separate = intern ("paragraph-separate");
409 staticpro (&Qparagraph_separate); 409 staticpro (&Qparagraph_separate);
410 paragraph_separate_re = Fsymbol_value (Qparagraph_separate);
411 if (!STRINGP (paragraph_separate_re))
412 paragraph_separate_re = build_string ("[ \t\f]*$");
413 staticpro (&paragraph_separate_re);
410 bidi_initialized = 1; 414 bidi_initialized = 1;
411} 415}
412 416
413/* Return the bidi type of a character CH, subject to the current 417/* Return the bidi type of a character CH, subject to the current
414 directional OVERRIDE. */ 418 directional OVERRIDE. */
415bidi_type_t 419static INLINE bidi_type_t
416bidi_get_type (int ch, bidi_dir_t override) 420bidi_get_type (int ch, bidi_dir_t override)
417{ 421{
418 bidi_type_t default_type; 422 bidi_type_t default_type;
@@ -463,7 +467,7 @@ bidi_check_type (bidi_type_t type)
463} 467}
464 468
465/* Given a bidi TYPE of a character, return its category. */ 469/* Given a bidi TYPE of a character, return its category. */
466bidi_category_t 470static INLINE bidi_category_t
467bidi_get_category (bidi_type_t type) 471bidi_get_category (bidi_type_t type)
468{ 472{
469 switch (type) 473 switch (type)
@@ -520,7 +524,7 @@ bidi_mirror_char (int c)
520 524
521/* Copy the bidi iterator from FROM to TO. To save cycles, this only 525/* Copy the bidi iterator from FROM to TO. To save cycles, this only
522 copies the part of the level stack that is actually in use. */ 526 copies the part of the level stack that is actually in use. */
523static inline void 527static INLINE void
524bidi_copy_it (struct bidi_it *to, struct bidi_it *from) 528bidi_copy_it (struct bidi_it *to, struct bidi_it *from)
525{ 529{
526 int i; 530 int i;
@@ -540,14 +544,14 @@ static struct bidi_it bidi_cache[1000]; /* FIXME: make this dynamically allocate
540static int bidi_cache_idx; 544static int bidi_cache_idx;
541static int bidi_cache_last_idx; 545static int bidi_cache_last_idx;
542 546
543static inline void 547static INLINE void
544bidi_cache_reset (void) 548bidi_cache_reset (void)
545{ 549{
546 bidi_cache_idx = 0; 550 bidi_cache_idx = 0;
547 bidi_cache_last_idx = -1; 551 bidi_cache_last_idx = -1;
548} 552}
549 553
550static inline void 554static INLINE void
551bidi_cache_fetch_state (int idx, struct bidi_it *bidi_it) 555bidi_cache_fetch_state (int idx, struct bidi_it *bidi_it)
552{ 556{
553 int current_scan_dir = bidi_it->scan_dir; 557 int current_scan_dir = bidi_it->scan_dir;
@@ -564,7 +568,7 @@ bidi_cache_fetch_state (int idx, struct bidi_it *bidi_it)
564 level less or equal to LEVEL. if LEVEL is -1, disregard the 568 level less or equal to LEVEL. if LEVEL is -1, disregard the
565 resolved levels in cached states. DIR, if non-zero, means search 569 resolved levels in cached states. DIR, if non-zero, means search
566 in that direction from the last cache hit. */ 570 in that direction from the last cache hit. */
567static inline int 571static INLINE int
568bidi_cache_search (int charpos, int level, int dir) 572bidi_cache_search (int charpos, int level, int dir)
569{ 573{
570 int i, i_start; 574 int i, i_start;
@@ -655,7 +659,7 @@ bidi_cache_find_level_change (int level, int dir, int before)
655 return -1; 659 return -1;
656} 660}
657 661
658static inline void 662static INLINE void
659bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved) 663bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved)
660{ 664{
661 int idx; 665 int idx;
@@ -710,7 +714,7 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved)
710 bidi_cache_idx = idx + 1; 714 bidi_cache_idx = idx + 1;
711} 715}
712 716
713static inline bidi_type_t 717static INLINE bidi_type_t
714bidi_cache_find (int charpos, int level, struct bidi_it *bidi_it) 718bidi_cache_find (int charpos, int level, struct bidi_it *bidi_it)
715{ 719{
716 int i = bidi_cache_search (charpos, level, bidi_it->scan_dir); 720 int i = bidi_cache_search (charpos, level, bidi_it->scan_dir);
@@ -730,7 +734,7 @@ bidi_cache_find (int charpos, int level, struct bidi_it *bidi_it)
730 return UNKNOWN_BT; 734 return UNKNOWN_BT;
731} 735}
732 736
733static inline int 737static INLINE int
734bidi_peek_at_next_level (struct bidi_it *bidi_it) 738bidi_peek_at_next_level (struct bidi_it *bidi_it)
735{ 739{
736 if (bidi_cache_idx == 0 || bidi_cache_last_idx == -1) 740 if (bidi_cache_idx == 0 || bidi_cache_last_idx == -1)
@@ -743,19 +747,16 @@ bidi_peek_at_next_level (struct bidi_it *bidi_it)
743 following the buffer position, -1 if position is at the beginning 747 following the buffer position, -1 if position is at the beginning
744 of a new paragraph, or -2 if position is neither at beginning nor 748 of a new paragraph, or -2 if position is neither at beginning nor
745 at end of a paragraph. */ 749 at end of a paragraph. */
746EMACS_INT 750static EMACS_INT
747bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos) 751bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos)
748{ 752{
749 Lisp_Object sep_re = Fbuffer_local_value (Qparagraph_separate, 753 /* FIXME: Why Fbuffer_local_value rather than just Fsymbol_value? */
750 Fcurrent_buffer ()); 754 Lisp_Object sep_re;
751 Lisp_Object start_re = Fbuffer_local_value (Qparagraph_start, 755 Lisp_Object start_re;
752 Fcurrent_buffer ());
753 EMACS_INT val; 756 EMACS_INT val;
754 757
755 if (!STRINGP (sep_re)) 758 sep_re = paragraph_separate_re;
756 sep_re = fallback_paragraph_separate_re; 759 start_re = paragraph_start_re;
757 if (!STRINGP (start_re))
758 start_re = fallback_paragraph_start_re;
759 760
760 val = fast_looking_at (sep_re, charpos, bytepos, ZV, ZV_BYTE, Qnil); 761 val = fast_looking_at (sep_re, charpos, bytepos, ZV, ZV_BYTE, Qnil);
761 if (val < 0) 762 if (val < 0)
@@ -773,7 +774,7 @@ bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos)
773 embedding levels on either side of the run boundary. Also, update 774 embedding levels on either side of the run boundary. Also, update
774 the saved info about previously seen characters, since that info is 775 the saved info about previously seen characters, since that info is
775 generally valid for a single level run. */ 776 generally valid for a single level run. */
776static inline void 777static INLINE void
777bidi_set_sor_type (struct bidi_it *bidi_it, int level_before, int level_after) 778bidi_set_sor_type (struct bidi_it *bidi_it, int level_before, int level_after)
778{ 779{
779 int higher_level = level_before > level_after ? level_before : level_after; 780 int higher_level = level_before > level_after ? level_before : level_after;
@@ -824,11 +825,9 @@ bidi_line_init (struct bidi_it *bidi_it)
824static EMACS_INT 825static EMACS_INT
825bidi_find_paragraph_start (EMACS_INT pos, EMACS_INT pos_byte) 826bidi_find_paragraph_start (EMACS_INT pos, EMACS_INT pos_byte)
826{ 827{
827 Lisp_Object re = Fbuffer_local_value (Qparagraph_start, Fcurrent_buffer ()); 828 Lisp_Object re = paragraph_start_re;
828 EMACS_INT limit = ZV, limit_byte = ZV_BYTE; 829 EMACS_INT limit = ZV, limit_byte = ZV_BYTE;
829 830
830 if (!STRINGP (re))
831 re = fallback_paragraph_start_re;
832 while (pos_byte > BEGV_BYTE 831 while (pos_byte > BEGV_BYTE
833 && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0) 832 && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0)
834 { 833 {
@@ -873,7 +872,6 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it)
873 int ch, ch_len; 872 int ch, ch_len;
874 EMACS_INT pos; 873 EMACS_INT pos;
875 bidi_type_t type; 874 bidi_type_t type;
876 EMACS_INT sep_len;
877 875
878 /* If we are inside a paragraph separator, we are just waiting 876 /* If we are inside a paragraph separator, we are just waiting
879 for the separator to be exhausted; use the previous paragraph 877 for the separator to be exhausted; use the previous paragraph
@@ -954,7 +952,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it)
954 952
955/* Do whatever UAX#9 clause X8 says should be done at paragraph's 953/* Do whatever UAX#9 clause X8 says should be done at paragraph's
956 end. */ 954 end. */
957static inline void 955static INLINE void
958bidi_set_paragraph_end (struct bidi_it *bidi_it) 956bidi_set_paragraph_end (struct bidi_it *bidi_it)
959{ 957{
960 bidi_it->invalid_levels = 0; 958 bidi_it->invalid_levels = 0;
@@ -976,10 +974,11 @@ bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, struct bidi_it *bidi_it)
976 bidi_it->new_paragraph = 1; 974 bidi_it->new_paragraph = 1;
977 bidi_it->separator_limit = -1; 975 bidi_it->separator_limit = -1;
978 bidi_it->type = NEUTRAL_B; 976 bidi_it->type = NEUTRAL_B;
979 bidi_it->type_after_w1 = UNKNOWN_BT; 977 bidi_it->type_after_w1 = NEUTRAL_B;
980 bidi_it->orig_type = UNKNOWN_BT; 978 bidi_it->orig_type = NEUTRAL_B;
981 bidi_it->prev_was_pdf = 0; 979 bidi_it->prev_was_pdf = 0;
982 bidi_it->prev.type = bidi_it->prev.type_after_w1 = UNKNOWN_BT; 980 bidi_it->prev.type = bidi_it->prev.type_after_w1 =
981 bidi_it->prev.orig_type = UNKNOWN_BT;
983 bidi_it->last_strong.type = bidi_it->last_strong.type_after_w1 = 982 bidi_it->last_strong.type = bidi_it->last_strong.type_after_w1 =
984 bidi_it->last_strong.orig_type = UNKNOWN_BT; 983 bidi_it->last_strong.orig_type = UNKNOWN_BT;
985 bidi_it->next_for_neutral.charpos = -1; 984 bidi_it->next_for_neutral.charpos = -1;
@@ -995,7 +994,7 @@ bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, struct bidi_it *bidi_it)
995 994
996/* Push the current embedding level and override status; reset the 995/* Push the current embedding level and override status; reset the
997 current level to LEVEL and the current override status to OVERRIDE. */ 996 current level to LEVEL and the current override status to OVERRIDE. */
998static inline void 997static INLINE void
999bidi_push_embedding_level (struct bidi_it *bidi_it, 998bidi_push_embedding_level (struct bidi_it *bidi_it,
1000 int level, bidi_dir_t override) 999 int level, bidi_dir_t override)
1001{ 1000{
@@ -1008,7 +1007,7 @@ bidi_push_embedding_level (struct bidi_it *bidi_it,
1008 1007
1009/* Pop the embedding level and directional override status from the 1008/* Pop the embedding level and directional override status from the
1010 stack, and return the new level. */ 1009 stack, and return the new level. */
1011static inline int 1010static INLINE int
1012bidi_pop_embedding_level (struct bidi_it *bidi_it) 1011bidi_pop_embedding_level (struct bidi_it *bidi_it)
1013{ 1012{
1014 /* UAX#9 says to ignore invalid PDFs. */ 1013 /* UAX#9 says to ignore invalid PDFs. */
@@ -1018,7 +1017,7 @@ bidi_pop_embedding_level (struct bidi_it *bidi_it)
1018} 1017}
1019 1018
1020/* Record in SAVED_INFO the information about the current character. */ 1019/* Record in SAVED_INFO the information about the current character. */
1021static inline void 1020static INLINE void
1022bidi_remember_char (struct bidi_saved_info *saved_info, 1021bidi_remember_char (struct bidi_saved_info *saved_info,
1023 struct bidi_it *bidi_it) 1022 struct bidi_it *bidi_it)
1024{ 1023{
@@ -1034,7 +1033,7 @@ bidi_remember_char (struct bidi_saved_info *saved_info,
1034 1033
1035/* Resolve the type of a neutral character according to the type of 1034/* Resolve the type of a neutral character according to the type of
1036 surrounding strong text and the current embedding level. */ 1035 surrounding strong text and the current embedding level. */
1037static inline bidi_type_t 1036static INLINE bidi_type_t
1038bidi_resolve_neutral_1 (bidi_type_t prev_type, bidi_type_t next_type, int lev) 1037bidi_resolve_neutral_1 (bidi_type_t prev_type, bidi_type_t next_type, int lev)
1039{ 1038{
1040 /* N1: European and Arabic numbers are treated as though they were R. */ 1039 /* N1: European and Arabic numbers are treated as though they were R. */
@@ -1051,7 +1050,7 @@ bidi_resolve_neutral_1 (bidi_type_t prev_type, bidi_type_t next_type, int lev)
1051 return STRONG_R; 1050 return STRONG_R;
1052} 1051}
1053 1052
1054static inline int 1053static INLINE int
1055bidi_explicit_dir_char (int c) 1054bidi_explicit_dir_char (int c)
1056{ 1055{
1057 /* FIXME: this should be replaced with a lookup table with suitable 1056 /* FIXME: this should be replaced with a lookup table with suitable
@@ -1301,7 +1300,7 @@ bidi_resolve_explicit (struct bidi_it *bidi_it)
1301 1300
1302/* Advance in the buffer, resolve weak types and return the type of 1301/* Advance in the buffer, resolve weak types and return the type of
1303 the next character after weak type resolution. */ 1302 the next character after weak type resolution. */
1304bidi_type_t 1303static bidi_type_t
1305bidi_resolve_weak (struct bidi_it *bidi_it) 1304bidi_resolve_weak (struct bidi_it *bidi_it)
1306{ 1305{
1307 bidi_type_t type; 1306 bidi_type_t type;
@@ -1353,7 +1352,9 @@ bidi_resolve_weak (struct bidi_it *bidi_it)
1353 current level run, and thus not relevant to this NSM. 1352 current level run, and thus not relevant to this NSM.
1354 This is why NSM gets the type_after_w1 of the previous 1353 This is why NSM gets the type_after_w1 of the previous
1355 character. */ 1354 character. */
1356 if (bidi_it->prev.type != UNKNOWN_BT) 1355 if (bidi_it->prev.type_after_w1 != UNKNOWN_BT
1356 /* if type_after_w1 is NEUTRAL_B, this NSM is at sor */
1357 && bidi_it->prev.type_after_w1 != NEUTRAL_B)
1357 type = bidi_it->prev.type_after_w1; 1358 type = bidi_it->prev.type_after_w1;
1358 else if (bidi_it->sor == R2L) 1359 else if (bidi_it->sor == R2L)
1359 type = STRONG_R; 1360 type = STRONG_R;
@@ -1490,7 +1491,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it)
1490 return type; 1491 return type;
1491} 1492}
1492 1493
1493bidi_type_t 1494static bidi_type_t
1494bidi_resolve_neutral (struct bidi_it *bidi_it) 1495bidi_resolve_neutral (struct bidi_it *bidi_it)
1495{ 1496{
1496 int prev_level = bidi_it->level_stack[bidi_it->stack_idx].level; 1497 int prev_level = bidi_it->level_stack[bidi_it->stack_idx].level;
@@ -1614,7 +1615,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it)
1614/* Given an iterator state in BIDI_IT, advance one character position 1615/* Given an iterator state in BIDI_IT, advance one character position
1615 in the buffer to the next character (in the logical order), resolve 1616 in the buffer to the next character (in the logical order), resolve
1616 the bidi type of that next character, and return that type. */ 1617 the bidi type of that next character, and return that type. */
1617bidi_type_t 1618static bidi_type_t
1618bidi_type_of_next_char (struct bidi_it *bidi_it) 1619bidi_type_of_next_char (struct bidi_it *bidi_it)
1619{ 1620{
1620 bidi_type_t type; 1621 bidi_type_t type;
@@ -1640,7 +1641,7 @@ bidi_type_of_next_char (struct bidi_it *bidi_it)
1640 the buffer to the next character (in the logical order), resolve 1641 the buffer to the next character (in the logical order), resolve
1641 the embedding and implicit levels of that next character, and 1642 the embedding and implicit levels of that next character, and
1642 return the resulting level. */ 1643 return the resulting level. */
1643int 1644static int
1644bidi_level_of_next_char (struct bidi_it *bidi_it) 1645bidi_level_of_next_char (struct bidi_it *bidi_it)
1645{ 1646{
1646 bidi_type_t type; 1647 bidi_type_t type;
diff --git a/src/buffer.c b/src/buffer.c
index 0759ce1c43c..339bc99dcb1 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -78,9 +78,6 @@ static Lisp_Object Vbuffer_defaults;
78 be a DEFVAR_PER_BUFFER for the slot, there is no default value for it; 78 be a DEFVAR_PER_BUFFER for the slot, there is no default value for it;
79 and the corresponding slot in buffer_defaults is not used. 79 and the corresponding slot in buffer_defaults is not used.
80 80
81 If a slot is -2, then there is no DEFVAR_PER_BUFFER for it,
82 but there is a default value which is copied into each buffer.
83
84 If a slot in this structure corresponding to a DEFVAR_PER_BUFFER is 81 If a slot in this structure corresponding to a DEFVAR_PER_BUFFER is
85 zero, that is a bug */ 82 zero, that is a bug */
86 83
@@ -94,6 +91,12 @@ DECL_ALIGN (struct buffer, buffer_local_symbols);
94/* A Lisp_Object pointer to the above, used for staticpro */ 91/* A Lisp_Object pointer to the above, used for staticpro */
95static Lisp_Object Vbuffer_local_symbols; 92static Lisp_Object Vbuffer_local_symbols;
96 93
94/* Return the symbol of the per-buffer variable at offset OFFSET in
95 the buffer structure. */
96
97#define PER_BUFFER_SYMBOL(OFFSET) \
98 (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_symbols))
99
97/* Flags indicating which built-in buffer-local variables 100/* Flags indicating which built-in buffer-local variables
98 are permanent locals. */ 101 are permanent locals. */
99static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS]; 102static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS];
@@ -507,7 +510,7 @@ clone_per_buffer_values (from, to)
507 continue; 510 continue;
508 511
509 obj = PER_BUFFER_VALUE (from, offset); 512 obj = PER_BUFFER_VALUE (from, offset);
510 if (MARKERP (obj)) 513 if (MARKERP (obj) && XMARKER (obj)->buffer == from)
511 { 514 {
512 struct Lisp_Marker *m = XMARKER (obj); 515 struct Lisp_Marker *m = XMARKER (obj);
513 obj = Fmake_marker (); 516 obj = Fmake_marker ();
@@ -770,9 +773,7 @@ reset_buffer_local_variables (b, permanent_too)
770 { 773 {
771 Lisp_Object tmp, prop, last = Qnil; 774 Lisp_Object tmp, prop, last = Qnil;
772 for (tmp = b->local_var_alist; CONSP (tmp); tmp = XCDR (tmp)) 775 for (tmp = b->local_var_alist; CONSP (tmp); tmp = XCDR (tmp))
773 if (CONSP (XCAR (tmp)) 776 if (!NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local)))
774 && SYMBOLP (XCAR (XCAR (tmp)))
775 && !NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local)))
776 { 777 {
777 /* If permanent-local, keep it. */ 778 /* If permanent-local, keep it. */
778 last = tmp; 779 last = tmp;
@@ -822,9 +823,7 @@ reset_buffer_local_variables (b, permanent_too)
822 int idx = PER_BUFFER_IDX (offset); 823 int idx = PER_BUFFER_IDX (offset);
823 if ((idx > 0 824 if ((idx > 0
824 && (permanent_too 825 && (permanent_too
825 || buffer_permanent_local_flags[idx] == 0)) 826 || buffer_permanent_local_flags[idx] == 0)))
826 /* Is -2 used anywhere? */
827 || idx == -2)
828 PER_BUFFER_VALUE (b, offset) = PER_BUFFER_DEFAULT (offset); 827 PER_BUFFER_VALUE (b, offset) = PER_BUFFER_DEFAULT (offset);
829 } 828 }
830} 829}
@@ -938,59 +937,49 @@ is the default binding of the variable. */)
938 CHECK_SYMBOL (variable); 937 CHECK_SYMBOL (variable);
939 CHECK_BUFFER (buffer); 938 CHECK_BUFFER (buffer);
940 buf = XBUFFER (buffer); 939 buf = XBUFFER (buffer);
940 sym = XSYMBOL (variable);
941 941
942 sym = indirect_variable (XSYMBOL (variable)); 942 start:
943 XSETSYMBOL (variable, sym); 943 switch (sym->redirect)
944
945 /* Look in local_var_list */
946 result = Fassoc (variable, buf->local_var_alist);
947 if (NILP (result))
948 { 944 {
949 int offset, idx; 945 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
950 int found = 0; 946 case SYMBOL_PLAINVAL: result = SYMBOL_VAL (sym); break;
951 947 case SYMBOL_LOCALIZED:
952 /* Look in special slots */ 948 { /* Look in local_var_alist. */
953 /* buffer-local Lisp variables start at `undo_list', 949 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
954 tho only the ones from `name' on are GC'd normally. */ 950 XSETSYMBOL (variable, sym); /* Update In case of aliasing. */
955 for (offset = PER_BUFFER_VAR_OFFSET (undo_list); 951 result = Fassoc (variable, buf->local_var_alist);
956 offset < sizeof (struct buffer); 952 if (!NILP (result))
957 /* sizeof EMACS_INT == sizeof Lisp_Object */ 953 {
958 offset += (sizeof (EMACS_INT))) 954 if (blv->fwd)
959 { 955 { /* What binding is loaded right now? */
960 idx = PER_BUFFER_IDX (offset); 956 Lisp_Object current_alist_element = blv->valcell;
961 if ((idx == -1 || PER_BUFFER_VALUE_P (buf, idx))
962 && SYMBOLP (PER_BUFFER_SYMBOL (offset))
963 && EQ (PER_BUFFER_SYMBOL (offset), variable))
964 {
965 result = PER_BUFFER_VALUE (buf, offset);
966 found = 1;
967 break;
968 }
969 }
970
971 if (!found)
972 result = Fdefault_value (variable);
973 }
974 else
975 {
976 Lisp_Object valcontents;
977 Lisp_Object current_alist_element;
978
979 /* What binding is loaded right now? */
980 valcontents = sym->value;
981 current_alist_element
982 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr);
983
984 /* The value of the currently loaded binding is not
985 stored in it, but rather in the realvalue slot.
986 Store that value into the binding it belongs to
987 in case that is the one we are about to use. */
988 957
989 Fsetcdr (current_alist_element, 958 /* The value of the currently loaded binding is not
990 do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)); 959 stored in it, but rather in the realvalue slot.
960 Store that value into the binding it belongs to
961 in case that is the one we are about to use. */
991 962
992 /* Now get the (perhaps updated) value out of the binding. */ 963 XSETCDR (current_alist_element,
993 result = XCDR (result); 964 do_symval_forwarding (blv->fwd));
965 }
966 /* Now get the (perhaps updated) value out of the binding. */
967 result = XCDR (result);
968 }
969 else
970 result = Fdefault_value (variable);
971 break;
972 }
973 case SYMBOL_FORWARDED:
974 {
975 union Lisp_Fwd *fwd = SYMBOL_FWD (sym);
976 if (BUFFER_OBJFWDP (fwd))
977 result = PER_BUFFER_VALUE (buf, XBUFFER_OBJFWD (fwd)->offset);
978 else
979 result = Fdefault_value (variable);
980 break;
981 }
982 default: abort ();
994 } 983 }
995 984
996 if (!EQ (result, Qunbound)) 985 if (!EQ (result, Qunbound))
@@ -1025,12 +1014,7 @@ buffer_lisp_local_variables (buf)
1025 if (buf != current_buffer) 1014 if (buf != current_buffer)
1026 val = XCDR (elt); 1015 val = XCDR (elt);
1027 1016
1028 /* If symbol is unbound, put just the symbol in the list. */ 1017 result = Fcons (Fcons (XCAR (elt), val), result);
1029 if (EQ (val, Qunbound))
1030 result = Fcons (XCAR (elt), result);
1031 /* Otherwise, put (symbol . value) in the list. */
1032 else
1033 result = Fcons (Fcons (XCAR (elt), val), result);
1034 } 1018 }
1035 1019
1036 return result; 1020 return result;
@@ -1563,7 +1547,7 @@ with SIGHUP. */)
1563 Lisp_Object tem; 1547 Lisp_Object tem;
1564 tem = Fsymbol_value (intern ("delete-auto-save-files")); 1548 tem = Fsymbol_value (intern ("delete-auto-save-files"));
1565 if (! NILP (tem)) 1549 if (! NILP (tem))
1566 internal_delete_file (b->auto_save_file_name); 1550 internal_delete_file (b->auto_save_file_name, Qt);
1567 } 1551 }
1568 1552
1569 if (b->base_buffer) 1553 if (b->base_buffer)
@@ -1862,8 +1846,7 @@ set_buffer_internal_1 (b)
1862 register struct buffer *b; 1846 register struct buffer *b;
1863{ 1847{
1864 register struct buffer *old_buf; 1848 register struct buffer *old_buf;
1865 register Lisp_Object tail, valcontents; 1849 register Lisp_Object tail;
1866 Lisp_Object tem;
1867 1850
1868#ifdef USE_MMAP_FOR_BUFFERS 1851#ifdef USE_MMAP_FOR_BUFFERS
1869 if (b->text->beg == NULL) 1852 if (b->text->beg == NULL)
@@ -1935,34 +1918,21 @@ set_buffer_internal_1 (b)
1935 /* Look down buffer's list of local Lisp variables 1918 /* Look down buffer's list of local Lisp variables
1936 to find and update any that forward into C variables. */ 1919 to find and update any that forward into C variables. */
1937 1920
1938 for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail)) 1921 do
1939 { 1922 {
1940 if (CONSP (XCAR (tail)) 1923 for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail))
1941 && SYMBOLP (XCAR (XCAR (tail))) 1924 {
1942 && (valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))), 1925 Lisp_Object var = XCAR (XCAR (tail));
1943 (BUFFER_LOCAL_VALUEP (valcontents))) 1926 struct Lisp_Symbol *sym = XSYMBOL (var);
1944 && (tem = XBUFFER_LOCAL_VALUE (valcontents)->realvalue, 1927 if (sym->redirect == SYMBOL_LOCALIZED /* Just to be sure. */
1945 (BOOLFWDP (tem) || INTFWDP (tem) || OBJFWDP (tem)))) 1928 && SYMBOL_BLV (sym)->fwd)
1946 /* Just reference the variable to cause it to become set for 1929 /* Just reference the variable
1947 this buffer. */ 1930 to cause it to become set for this buffer. */
1948 Fsymbol_value (XCAR (XCAR (tail))); 1931 Fsymbol_value (var);
1932 }
1949 } 1933 }
1950
1951 /* Do the same with any others that were local to the previous buffer */ 1934 /* Do the same with any others that were local to the previous buffer */
1952 1935 while (b != old_buf && (b = old_buf, b));
1953 if (old_buf)
1954 for (tail = old_buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
1955 {
1956 if (CONSP (tail)
1957 && SYMBOLP (XCAR (XCAR (tail)))
1958 && (valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))),
1959 (BUFFER_LOCAL_VALUEP (valcontents)))
1960 && (tem = XBUFFER_LOCAL_VALUE (valcontents)->realvalue,
1961 (BOOLFWDP (tem) || INTFWDP (tem) || OBJFWDP (tem))))
1962 /* Just reference the variable to cause it to become set for
1963 this buffer. */
1964 Fsymbol_value (XCAR (XCAR (tail)));
1965 }
1966} 1936}
1967 1937
1968/* Switch to buffer B temporarily for redisplay purposes. 1938/* Switch to buffer B temporarily for redisplay purposes.
@@ -2677,23 +2647,22 @@ static void
2677swap_out_buffer_local_variables (b) 2647swap_out_buffer_local_variables (b)
2678 struct buffer *b; 2648 struct buffer *b;
2679{ 2649{
2680 Lisp_Object oalist, alist, sym, buffer; 2650 Lisp_Object oalist, alist, buffer;
2681 2651
2682 XSETBUFFER (buffer, b); 2652 XSETBUFFER (buffer, b);
2683 oalist = b->local_var_alist; 2653 oalist = b->local_var_alist;
2684 2654
2685 for (alist = oalist; CONSP (alist); alist = XCDR (alist)) 2655 for (alist = oalist; CONSP (alist); alist = XCDR (alist))
2686 { 2656 {
2687 if (CONSP (XCAR (alist)) 2657 Lisp_Object sym = XCAR (XCAR (alist));
2688 && (sym = XCAR (XCAR (alist)), SYMBOLP (sym)) 2658 eassert (XSYMBOL (sym)->redirect == SYMBOL_LOCALIZED);
2689 /* Need not do anything if some other buffer's binding is 2659 /* Need not do anything if some other buffer's binding is
2690 now encached. */ 2660 now encached. */
2691 && EQ (XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->buffer, 2661 if (EQ (SYMBOL_BLV (XSYMBOL (sym))->where, buffer))
2692 buffer))
2693 { 2662 {
2694 /* Symbol is set up for this buffer's old local value: 2663 /* Symbol is set up for this buffer's old local value:
2695 swap it out! */ 2664 swap it out! */
2696 swap_in_global_binding (sym); 2665 swap_in_global_binding (XSYMBOL (sym));
2697 } 2666 }
2698 } 2667 }
2699} 2668}
@@ -5162,7 +5131,9 @@ init_buffer_once ()
5162 /* Make sure all markable slots in buffer_defaults 5131 /* Make sure all markable slots in buffer_defaults
5163 are initialized reasonably, so mark_buffer won't choke. */ 5132 are initialized reasonably, so mark_buffer won't choke. */
5164 reset_buffer (&buffer_defaults); 5133 reset_buffer (&buffer_defaults);
5134 eassert (EQ (buffer_defaults.name, make_number (0)));
5165 reset_buffer_local_variables (&buffer_defaults, 1); 5135 reset_buffer_local_variables (&buffer_defaults, 1);
5136 eassert (EQ (buffer_local_symbols.name, make_number (0)));
5166 reset_buffer (&buffer_local_symbols); 5137 reset_buffer (&buffer_local_symbols);
5167 reset_buffer_local_variables (&buffer_local_symbols, 1); 5138 reset_buffer_local_variables (&buffer_local_symbols, 1);
5168 /* Prevent GC from getting confused. */ 5139 /* Prevent GC from getting confused. */
@@ -5204,7 +5175,6 @@ init_buffer_once ()
5204 buffer_defaults.word_wrap = Qnil; 5175 buffer_defaults.word_wrap = Qnil;
5205 buffer_defaults.ctl_arrow = Qt; 5176 buffer_defaults.ctl_arrow = Qt;
5206 buffer_defaults.bidi_display_reordering = Qnil; 5177 buffer_defaults.bidi_display_reordering = Qnil;
5207 buffer_defaults.direction_reversed = Qnil;
5208 buffer_defaults.bidi_paragraph_direction = Qnil; 5178 buffer_defaults.bidi_paragraph_direction = Qnil;
5209 buffer_defaults.cursor_type = Qt; 5179 buffer_defaults.cursor_type = Qt;
5210 buffer_defaults.extra_line_spacing = Qnil; 5180 buffer_defaults.extra_line_spacing = Qnil;
@@ -5291,7 +5261,6 @@ init_buffer_once ()
5291 XSETFASTINT (buffer_local_flags.cache_long_line_scans, idx); ++idx; 5261 XSETFASTINT (buffer_local_flags.cache_long_line_scans, idx); ++idx;
5292 XSETFASTINT (buffer_local_flags.category_table, idx); ++idx; 5262 XSETFASTINT (buffer_local_flags.category_table, idx); ++idx;
5293 XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx; 5263 XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx;
5294 XSETFASTINT (buffer_local_flags.direction_reversed, idx); ++idx;
5295 XSETFASTINT (buffer_local_flags.bidi_paragraph_direction, idx); ++idx; 5264 XSETFASTINT (buffer_local_flags.bidi_paragraph_direction, idx); ++idx;
5296 XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx); 5265 XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx);
5297 /* Make this one a permanent local. */ 5266 /* Make this one a permanent local. */
@@ -5421,33 +5390,41 @@ init_buffer ()
5421 in the buffer that is current now. */ 5390 in the buffer that is current now. */
5422 5391
5423/* TYPE is nil for a general Lisp variable. 5392/* TYPE is nil for a general Lisp variable.
5424 An integer specifies a type; then only LIsp values 5393 An integer specifies a type; then only Lisp values
5425 with that type code are allowed (except that nil is allowed too). 5394 with that type code are allowed (except that nil is allowed too).
5426 LNAME is the LIsp-level variable name. 5395 LNAME is the Lisp-level variable name.
5427 VNAME is the name of the buffer slot. 5396 VNAME is the name of the buffer slot.
5428 DOC is a dummy where you write the doc string as a comment. */ 5397 DOC is a dummy where you write the doc string as a comment. */
5429#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ 5398#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \
5430 defvar_per_buffer (lname, vname, type, 0) 5399 do { \
5400 static struct Lisp_Buffer_Objfwd bo_fwd; \
5401 defvar_per_buffer (&bo_fwd, lname, vname, type, 0); \
5402 } while (0)
5431 5403
5432static void 5404static void
5433defvar_per_buffer (namestring, address, type, doc) 5405defvar_per_buffer (bo_fwd, namestring, address, type, doc)
5406 struct Lisp_Buffer_Objfwd *bo_fwd;
5434 char *namestring; 5407 char *namestring;
5435 Lisp_Object *address; 5408 Lisp_Object *address;
5436 Lisp_Object type; 5409 Lisp_Object type;
5437 char *doc; 5410 char *doc;
5438{ 5411{
5439 Lisp_Object sym, val; 5412 struct Lisp_Symbol *sym;
5440 int offset; 5413 int offset;
5441 5414
5442 sym = intern (namestring); 5415 sym = XSYMBOL (intern (namestring));
5443 val = allocate_misc ();
5444 offset = (char *)address - (char *)current_buffer; 5416 offset = (char *)address - (char *)current_buffer;
5445 5417
5446 XMISCTYPE (val) = Lisp_Misc_Buffer_Objfwd; 5418 bo_fwd->type = Lisp_Fwd_Buffer_Obj;
5447 XBUFFER_OBJFWD (val)->offset = offset; 5419 bo_fwd->offset = offset;
5448 XBUFFER_OBJFWD (val)->slottype = type; 5420 bo_fwd->slottype = type;
5449 SET_SYMBOL_VALUE (sym, val); 5421 sym->redirect = SYMBOL_FORWARDED;
5450 PER_BUFFER_SYMBOL (offset) = sym; 5422 {
5423 /* I tried to do the job without a cast, but it seems impossible.
5424 union Lisp_Fwd *fwd; &(fwd->u_buffer_objfwd) = bo_fwd; */
5425 SET_SYMBOL_FWD (sym, (union Lisp_Fwd *)bo_fwd);
5426 }
5427 XSETSYMBOL (PER_BUFFER_SYMBOL (offset), sym);
5451 5428
5452 if (PER_BUFFER_IDX (offset) == 0) 5429 if (PER_BUFFER_IDX (offset) == 0)
5453 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding 5430 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding
@@ -5805,25 +5782,19 @@ The variable `coding-system-for-write', if non-nil, overrides this variable.
5805 5782
5806This variable is never applied to a way of decoding a file while reading it. */); 5783This variable is never applied to a way of decoding a file while reading it. */);
5807 5784
5808 DEFVAR_PER_BUFFER ("direction-reversed",
5809 &current_buffer->direction_reversed, Qnil,
5810 doc: /* Non-nil means set beginning of lines at the right edge of the window.
5811See also the variable `bidi-display-reordering'. */);
5812
5813 DEFVAR_PER_BUFFER ("bidi-display-reordering", 5785 DEFVAR_PER_BUFFER ("bidi-display-reordering",
5814 &current_buffer->bidi_display_reordering, Qnil, 5786 &current_buffer->bidi_display_reordering, Qnil,
5815 doc: /* Non-nil means reorder bidirectional text for display in the visual order. 5787 doc: /* Non-nil means reorder bidirectional text for display in the visual order. */);
5816See also the variable `direction-reversed'. */);
5817 5788
5818 DEFVAR_PER_BUFFER ("bidi-paragraph-direction", 5789 DEFVAR_PER_BUFFER ("bidi-paragraph-direction",
5819 &current_buffer->bidi_paragraph_direction, Qnil, 5790 &current_buffer->bidi_paragraph_direction, Qnil,
5820 doc: /* *If non-nil, forces directionality of text paragraphs in the buffer. 5791 doc: /* *If non-nil, forces directionality of text paragraphs in the buffer.
5821 5792
5822If this is nil (the default), the direction of each paragraph is 5793If this is nil (the default), the direction of each paragraph is
5823determined by the first strong directional character of its text. 5794determined by the first strong directional character of its text.
5824The values of `right-to-left' and `left-to-right' override that. 5795The values of `right-to-left' and `left-to-right' override that.
5825Any other value is treated as nil. 5796Any other value is treated as nil.
5826 5797
5827This variable has no effect unless the buffer's value of 5798This variable has no effect unless the buffer's value of
5828\`bidi-display-reordering' is non-nil. */); 5799\`bidi-display-reordering' is non-nil. */);
5829 5800
diff --git a/src/buffer.h b/src/buffer.h
index fa3fc6dafb8..d03152abd85 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -107,6 +107,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
107#define BUF_BEG(buf) (BEG) 107#define BUF_BEG(buf) (BEG)
108#define BUF_BEG_BYTE(buf) (BEG_BYTE) 108#define BUF_BEG_BYTE(buf) (BEG_BYTE)
109 109
110/* !!!FIXME: all the BUF_BEGV/BUF_ZV/BUF_PT macros are flawed:
111 on indirect (or base) buffers, that value is only correct if that buffer
112 is the current_buffer, or if the buffer's text hasn't been modified (via
113 an indirect buffer) since it was last current. */
114
110/* Position of beginning of accessible range of buffer. */ 115/* Position of beginning of accessible range of buffer. */
111#define BUF_BEGV(buf) ((buf)->begv) 116#define BUF_BEGV(buf) ((buf)->begv)
112#define BUF_BEGV_BYTE(buf) ((buf)->begv_byte) 117#define BUF_BEGV_BYTE(buf) ((buf)->begv_byte)
@@ -313,7 +318,7 @@ while (0)
313 - (ptr - (current_buffer)->text->beg <= (unsigned) (GPT_BYTE - BEG_BYTE) ? 0 : GAP_SIZE) \ 318 - (ptr - (current_buffer)->text->beg <= (unsigned) (GPT_BYTE - BEG_BYTE) ? 0 : GAP_SIZE) \
314 + BEG_BYTE) 319 + BEG_BYTE)
315 320
316/* Return character at position POS. */ 321/* Return character at byte position POS. */
317 322
318#define FETCH_CHAR(pos) \ 323#define FETCH_CHAR(pos) \
319 (!NILP (current_buffer->enable_multibyte_characters) \ 324 (!NILP (current_buffer->enable_multibyte_characters) \
@@ -327,7 +332,7 @@ while (0)
327/* Variables used locally in FETCH_MULTIBYTE_CHAR. */ 332/* Variables used locally in FETCH_MULTIBYTE_CHAR. */
328extern unsigned char *_fetch_multibyte_char_p; 333extern unsigned char *_fetch_multibyte_char_p;
329 334
330/* Return character code of multi-byte form at position POS. If POS 335/* Return character code of multi-byte form at byte position POS. If POS
331 doesn't point the head of valid multi-byte form, only the byte at 336 doesn't point the head of valid multi-byte form, only the byte at
332 POS is returned. No range checking. */ 337 POS is returned. No range checking. */
333 338
@@ -336,7 +341,7 @@ extern unsigned char *_fetch_multibyte_char_p;
336 + (pos) + BEG_ADDR - BEG_BYTE), \ 341 + (pos) + BEG_ADDR - BEG_BYTE), \
337 STRING_CHAR (_fetch_multibyte_char_p)) 342 STRING_CHAR (_fetch_multibyte_char_p))
338 343
339/* Return character at position POS. If the current buffer is unibyte 344/* Return character at byte position POS. If the current buffer is unibyte
340 and the character is not ASCII, make the returning character 345 and the character is not ASCII, make the returning character
341 multibyte. */ 346 multibyte. */
342 347
@@ -447,7 +452,10 @@ struct buffer_text
447 /* The markers that refer to this buffer. 452 /* The markers that refer to this buffer.
448 This is actually a single marker --- 453 This is actually a single marker ---
449 successive elements in its marker `chain' 454 successive elements in its marker `chain'
450 are the other markers referring to this buffer. */ 455 are the other markers referring to this buffer.
456 This is a singly linked unordered list, which means that it's
457 very cheap to add a marker to the list and it's also very cheap
458 to move a marker within a buffer. */
451 struct Lisp_Marker *markers; 459 struct Lisp_Marker *markers;
452 460
453 /* Usually 0. Temporarily set to 1 in decode_coding_gap to 461 /* Usually 0. Temporarily set to 1 in decode_coding_gap to
@@ -671,9 +679,6 @@ struct buffer
671 /* Non-nil means reorder bidirectional text for display in the 679 /* Non-nil means reorder bidirectional text for display in the
672 visual order. */ 680 visual order. */
673 Lisp_Object bidi_display_reordering; 681 Lisp_Object bidi_display_reordering;
674 /* Non-nil means set beginning of lines at the right edge of
675 windows. */
676 Lisp_Object direction_reversed;
677 /* If non-nil, specifies which direction of text to force in all the 682 /* If non-nil, specifies which direction of text to force in all the
678 paragraphs of the buffer. Nil means determine paragraph 683 paragraphs of the buffer. Nil means determine paragraph
679 direction dynamically for each paragraph. */ 684 direction dynamically for each paragraph. */
@@ -843,6 +848,7 @@ extern struct buffer buffer_defaults;
843 be a Lisp-level local variable for the slot, it has no default value, 848 be a Lisp-level local variable for the slot, it has no default value,
844 and the corresponding slot in buffer_defaults is not used. */ 849 and the corresponding slot in buffer_defaults is not used. */
845 850
851
846extern struct buffer buffer_local_flags; 852extern struct buffer buffer_local_flags;
847 853
848/* For each buffer slot, this points to the Lisp symbol name 854/* For each buffer slot, this points to the Lisp symbol name
@@ -948,7 +954,7 @@ extern int last_per_buffer_idx;
948 from the start of a buffer structure. */ 954 from the start of a buffer structure. */
949 955
950#define PER_BUFFER_VAR_OFFSET(VAR) \ 956#define PER_BUFFER_VAR_OFFSET(VAR) \
951 ((char *) &buffer_local_flags.VAR - (char *) &buffer_local_flags) 957 ((char *) &((struct buffer *)0)->VAR - (char *) ((struct buffer *)0))
952 958
953/* Return the index of buffer-local variable VAR. Each per-buffer 959/* Return the index of buffer-local variable VAR. Each per-buffer
954 variable has an index > 0 associated with it, except when it always 960 variable has an index > 0 associated with it, except when it always
@@ -1013,11 +1019,5 @@ extern int last_per_buffer_idx;
1013#define PER_BUFFER_VALUE(BUFFER, OFFSET) \ 1019#define PER_BUFFER_VALUE(BUFFER, OFFSET) \
1014 (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) 1020 (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER)))
1015 1021
1016/* Return the symbol of the per-buffer variable at offset OFFSET in
1017 the buffer structure. */
1018
1019#define PER_BUFFER_SYMBOL(OFFSET) \
1020 (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_symbols))
1021
1022/* arch-tag: 679305dd-d41c-4a50-b170-3caf5c97b2d1 1022/* arch-tag: 679305dd-d41c-4a50-b170-3caf5c97b2d1
1023 (do not change this comment) */ 1023 (do not change this comment) */
diff --git a/src/bytecode.c b/src/bytecode.c
index e95614c72a9..c53c5acdbb3 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -505,8 +505,9 @@ If the third argument is incorrect, Emacs may crash. */)
505 v1 = vectorp[op]; 505 v1 = vectorp[op];
506 if (SYMBOLP (v1)) 506 if (SYMBOLP (v1))
507 { 507 {
508 v2 = SYMBOL_VALUE (v1); 508 if (XSYMBOL (v1)->redirect != SYMBOL_PLAINVAL
509 if (MISCP (v2) || EQ (v2, Qunbound)) 509 || (v2 = SYMBOL_VAL (XSYMBOL (v1)),
510 EQ (v2, Qunbound)))
510 { 511 {
511 BEFORE_POTENTIAL_GC (); 512 BEFORE_POTENTIAL_GC ();
512 v2 = Fsymbol_value (v1); 513 v2 = Fsymbol_value (v1);
@@ -597,14 +598,13 @@ If the third argument is incorrect, Emacs may crash. */)
597 /* Inline the most common case. */ 598 /* Inline the most common case. */
598 if (SYMBOLP (sym) 599 if (SYMBOLP (sym)
599 && !EQ (val, Qunbound) 600 && !EQ (val, Qunbound)
600 && !XSYMBOL (sym)->indirect_variable 601 && !XSYMBOL (sym)->redirect
601 && !SYMBOL_CONSTANT_P (sym) 602 && !SYMBOL_CONSTANT_P (sym))
602 && !MISCP (XSYMBOL (sym)->value)) 603 XSYMBOL (sym)->val.value = val;
603 XSYMBOL (sym)->value = val;
604 else 604 else
605 { 605 {
606 BEFORE_POTENTIAL_GC (); 606 BEFORE_POTENTIAL_GC ();
607 set_internal (sym, val, current_buffer, 0); 607 set_internal (sym, val, Qnil, 0);
608 AFTER_POTENTIAL_GC (); 608 AFTER_POTENTIAL_GC ();
609 } 609 }
610 } 610 }
diff --git a/src/callproc.c b/src/callproc.c
index 378c647f385..44dd6ed7764 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -91,7 +91,7 @@ extern char **environ;
91#endif 91#endif
92 92
93#ifdef HAVE_SETPGID 93#ifdef HAVE_SETPGID
94#if !defined (USG) || defined (BSD_PGRPS) 94#if !defined (USG)
95#undef setpgrp 95#undef setpgrp
96#define setpgrp setpgid 96#define setpgrp setpgid
97#endif 97#endif
@@ -581,7 +581,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
581#ifdef HAVE_SETSID 581#ifdef HAVE_SETSID
582 setsid (); 582 setsid ();
583#endif 583#endif
584#if defined (USG) && !defined (BSD_PGRPS) 584#if defined (USG)
585 setpgrp (); 585 setpgrp ();
586#else 586#else
587 setpgrp (pid, pid); 587 setpgrp (pid, pid);
@@ -856,7 +856,7 @@ delete_temp_file (name)
856 /* Suppress jka-compr handling, etc. */ 856 /* Suppress jka-compr handling, etc. */
857 int count = SPECPDL_INDEX (); 857 int count = SPECPDL_INDEX ();
858 specbind (intern ("file-name-handler-alist"), Qnil); 858 specbind (intern ("file-name-handler-alist"), Qnil);
859 internal_delete_file (name); 859 internal_delete_file (name, Qt);
860 unbind_to (count, Qnil); 860 unbind_to (count, Qnil);
861 return Qnil; 861 return Qnil;
862} 862}
@@ -1251,7 +1251,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir)
1251#endif /* not MSDOS */ 1251#endif /* not MSDOS */
1252#endif /* not WINDOWSNT */ 1252#endif /* not WINDOWSNT */
1253 1253
1254#if defined(USG) && !defined(BSD_PGRPS) 1254#if defined(USG)
1255#ifndef SETPGRP_RELEASES_CTTY 1255#ifndef SETPGRP_RELEASES_CTTY
1256 setpgrp (); /* No arguments but equivalent in this case */ 1256 setpgrp (); /* No arguments but equivalent in this case */
1257#endif 1257#endif
diff --git a/src/character.h b/src/character.h
index 1f1f6eade84..41f47e4b179 100644
--- a/src/character.h
+++ b/src/character.h
@@ -296,7 +296,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
296 296
297/* If P is after LIMIT, advance P to the previous character boundary. 297/* If P is after LIMIT, advance P to the previous character boundary.
298 Assumes that P is already at a character boundary of the same 298 Assumes that P is already at a character boundary of the same
299 mulitbyte form whose beginning address is LIMIT. */ 299 multibyte form whose beginning address is LIMIT. */
300 300
301#define PREV_CHAR_BOUNDARY(p, limit) \ 301#define PREV_CHAR_BOUNDARY(p, limit) \
302 do { \ 302 do { \
diff --git a/src/charset.c b/src/charset.c
index 125c9131687..18c0bbb6310 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -2082,8 +2082,9 @@ char_charset (c, charset_list, code_return)
2082 return charset; 2082 return charset;
2083 } 2083 }
2084 charset_list = XCDR (charset_list); 2084 charset_list = XCDR (charset_list);
2085 if (c <= MAX_UNICODE_CHAR 2085 if (! maybe_null
2086 && EQ (charset_list, Vcharset_non_preferred_head)) 2086 && c <= MAX_UNICODE_CHAR
2087 && EQ (charset_list, Vcharset_non_preferred_head))
2087 return CHARSET_FROM_ID (charset_unicode); 2088 return CHARSET_FROM_ID (charset_unicode);
2088 } 2089 }
2089 return (maybe_null ? NULL 2090 return (maybe_null ? NULL
diff --git a/src/coding.c b/src/coding.c
index bdc37cb7c53..6435fa1ddb1 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -6408,7 +6408,7 @@ detect_coding (coding)
6408 { 6408 {
6409 /* We didn't find an 8-bit code. We may 6409 /* We didn't find an 8-bit code. We may
6410 have found a null-byte, but it's very 6410 have found a null-byte, but it's very
6411 rare that a binary file confirm to 6411 rare that a binary file conforms to
6412 ISO-2022. */ 6412 ISO-2022. */
6413 src = src_end; 6413 src = src_end;
6414 coding->head_ascii = src - coding->source; 6414 coding->head_ascii = src - coding->source;
diff --git a/src/composite.c b/src/composite.c
index 632c9f90d12..341eb371871 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -74,8 +74,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
74 composition rules to tell how to compose (2N+2)th element with 74 composition rules to tell how to compose (2N+2)th element with
75 the previously composed 2N glyphs. 75 the previously composed 2N glyphs.
76 76
77 COMPONENTS-VEC -- Vector of integers. In relative composition, the 77 COMPONENTS-VEC -- Vector of integers. In a relative composition,
78 elements are characters to be composed. In rule-base 78 the elements are the characters to be composed. In a rule-base
79 composition, the elements are characters or encoded 79 composition, the elements are characters or encoded
80 composition rules. 80 composition rules.
81 81
@@ -95,13 +95,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
95 get_composition_id checks the validity of `composition' property, 95 get_composition_id checks the validity of `composition' property,
96 and, if valid, assigns a new ID, registers the information in 96 and, if valid, assigns a new ID, registers the information in
97 composition_hash_table and composition_table, and changes the form 97 composition_hash_table and composition_table, and changes the form
98 of the property value. If the property is invalid, return -1 98 of the property value. If the property is invalid,
99 without changing the property value. 99 get_composition_id returns -1 without changing the property value.
100 100
101 We use two tables to keep information about composition; 101 We use two tables to keep the information about composition;
102 composition_hash_table and composition_table. 102 composition_hash_table and composition_table.
103 103
104 The former is a hash table in which keys are COMPONENTS-VECs and 104 The former is a hash table whose keys are COMPONENTS-VECs and
105 values are the corresponding COMPOSITION-IDs. This hash table is 105 values are the corresponding COMPOSITION-IDs. This hash table is
106 weak, but as each key (COMPONENTS-VEC) is also kept as a value of the 106 weak, but as each key (COMPONENTS-VEC) is also kept as a value of the
107 `composition' property, it won't be collected as garbage until all 107 `composition' property, it won't be collected as garbage until all
@@ -162,8 +162,8 @@ Lisp_Object Vauto_composition_function;
162Lisp_Object Qauto_composition_function; 162Lisp_Object Qauto_composition_function;
163Lisp_Object Vcomposition_function_table; 163Lisp_Object Vcomposition_function_table;
164 164
165/* Maxinum number of characters to lookback to check 165/* Maximum number of characters to look back for
166 auto-composition. */ 166 auto-compositions. */
167#define MAX_AUTO_COMPOSITION_LOOKBACK 3 167#define MAX_AUTO_COMPOSITION_LOOKBACK 3
168 168
169EXFUN (Fremove_list_of_text_properties, 4); 169EXFUN (Fremove_list_of_text_properties, 4);
@@ -990,6 +990,14 @@ autocmp_chars (cft_element, charpos, bytepos, limit, win, face, string)
990 { 990 {
991 Lisp_Object args[6]; 991 Lisp_Object args[6];
992 992
993 /* Save point as marker before calling out to lisp. */
994 if (NILP (string))
995 {
996 Lisp_Object m = Fmake_marker ();
997 set_marker_both (m, Qnil, pt, pt_byte);
998 record_unwind_protect (restore_point_unwind, m);
999 }
1000
993 args[0] = Vauto_composition_function; 1001 args[0] = Vauto_composition_function;
994 args[1] = AREF (elt, 2); 1002 args[1] = AREF (elt, 2);
995 args[2] = pos; 1003 args[2] = pos;
@@ -998,8 +1006,10 @@ autocmp_chars (cft_element, charpos, bytepos, limit, win, face, string)
998 args[5] = string; 1006 args[5] = string;
999 gstring = safe_call (6, args); 1007 gstring = safe_call (6, args);
1000 } 1008 }
1001 if (NILP (string)) 1009 else if (NILP (string))
1002 TEMP_SET_PT_BOTH (pt, pt_byte); 1010 {
1011 TEMP_SET_PT_BOTH (pt, pt_byte);
1012 }
1003 return unbind_to (count, gstring); 1013 return unbind_to (count, gstring);
1004 } 1014 }
1005 } 1015 }
@@ -1011,7 +1021,7 @@ autocmp_chars (cft_element, charpos, bytepos, limit, win, face, string)
1011 1021
1012/* Update cmp_it->stop_pos to the next position after CHARPOS (and 1022/* Update cmp_it->stop_pos to the next position after CHARPOS (and
1013 BYTEPOS) where character composition may happen. If BYTEPOS is 1023 BYTEPOS) where character composition may happen. If BYTEPOS is
1014 negative, compoute it. If it is a static composition, set 1024 negative, compute it. If it is a static composition, set
1015 cmp_it->ch to -1. Otherwise, set cmp_it->ch to the character that 1025 cmp_it->ch to -1. Otherwise, set cmp_it->ch to the character that
1016 triggers a automatic composition. */ 1026 triggers a automatic composition. */
1017 1027
@@ -1241,7 +1251,7 @@ struct position_record
1241 unsigned char *p; 1251 unsigned char *p;
1242}; 1252};
1243 1253
1244/* Update the members of POSTION to the next character boundary. */ 1254/* Update the members of POSITION to the next character boundary. */
1245#define FORWARD_CHAR(POSITION, STOP) \ 1255#define FORWARD_CHAR(POSITION, STOP) \
1246 do { \ 1256 do { \
1247 (POSITION).pos++; \ 1257 (POSITION).pos++; \
@@ -1257,7 +1267,7 @@ struct position_record
1257 } \ 1267 } \
1258 } while (0) 1268 } while (0)
1259 1269
1260/* Update the members of POSTION to the previous character boundary. */ 1270/* Update the members of POSITION to the previous character boundary. */
1261#define BACKWARD_CHAR(POSITION, STOP) \ 1271#define BACKWARD_CHAR(POSITION, STOP) \
1262 do { \ 1272 do { \
1263 if ((POSITION).pos == STOP) \ 1273 if ((POSITION).pos == STOP) \
@@ -1429,7 +1439,7 @@ find_automatic_composition (pos, limit, start, end, gstring, string)
1429 } 1439 }
1430 if (need_adjustment) 1440 if (need_adjustment)
1431 { 1441 {
1432 /* As we have called Lisp, there's a possibilily that 1442 /* As we have called Lisp, there's a possibility that
1433 buffer/string is relocated. */ 1443 buffer/string is relocated. */
1434 if (NILP (string)) 1444 if (NILP (string))
1435 cur.p = BYTE_POS_ADDR (cur.pos_byte); 1445 cur.p = BYTE_POS_ADDR (cur.pos_byte);
@@ -1674,7 +1684,7 @@ See `find-composition' for more details. */)
1674 1684
1675 if (find_automatic_composition (from, to, &s, &e, &gstring, string) 1685 if (find_automatic_composition (from, to, &s, &e, &gstring, string)
1676 && (e <= XINT (pos) ? e > end : s < start)) 1686 && (e <= XINT (pos) ? e > end : s < start))
1677 return list3 (make_number (start), make_number (end), gstring); 1687 return list3 (make_number (s), make_number (e), gstring);
1678 } 1688 }
1679 if (!COMPOSITION_VALID_P (start, end, prop)) 1689 if (!COMPOSITION_VALID_P (start, end, prop))
1680 return Fcons (make_number (start), Fcons (make_number (end), 1690 return Fcons (make_number (start), Fcons (make_number (end),
diff --git a/src/config.in b/src/config.in
index e1837e74560..9020d976342 100644
--- a/src/config.in
+++ b/src/config.in
@@ -135,8 +135,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
135/* Define to 1 if you have the <com_err.h> header file. */ 135/* Define to 1 if you have the <com_err.h> header file. */
136#undef HAVE_COM_ERR_H 136#undef HAVE_COM_ERR_H
137 137
138/* Define to 1 if you have /usr/lib/crti.o. */ 138/* Define to 1 if you have the `copysign' function. */
139#undef HAVE_CRTIN 139#undef HAVE_COPYSIGN
140 140
141/* Define to 1 if using D-Bus. */ 141/* Define to 1 if using D-Bus. */
142#undef HAVE_DBUS 142#undef HAVE_DBUS
@@ -294,6 +294,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
294/* Define to 1 if netdb.h declares h_errno. */ 294/* Define to 1 if netdb.h declares h_errno. */
295#undef HAVE_H_ERRNO 295#undef HAVE_H_ERRNO
296 296
297/* Define to 1 if using imagemagick. */
298#undef HAVE_IMAGEMAGICK
299
297/* Define to 1 if you have the `index' function. */ 300/* Define to 1 if you have the `index' function. */
298#undef HAVE_INDEX 301#undef HAVE_INDEX
299 302
@@ -303,6 +306,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
303/* Define to 1 if you have the <inttypes.h> header file. */ 306/* Define to 1 if you have the <inttypes.h> header file. */
304#undef HAVE_INTTYPES_H 307#undef HAVE_INTTYPES_H
305 308
309/* Define to 1 if you have the `isnan' function. */
310#undef HAVE_ISNAN
311
306/* Define to 1 if you have the jpeg library (-ljpeg). */ 312/* Define to 1 if you have the jpeg library (-ljpeg). */
307#undef HAVE_JPEG 313#undef HAVE_JPEG
308 314
@@ -318,10 +324,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
318/* Define to 1 if you have the <kerberos/krb.h> header file. */ 324/* Define to 1 if you have the <kerberos/krb.h> header file. */
319#undef HAVE_KERBEROS_KRB_H 325#undef HAVE_KERBEROS_KRB_H
320 326
321/* Define to 1 if `e_text' is a member of `krb5_error'. */ 327/* Define to 1 if `e_text' is member of `krb5_error'. */
322#undef HAVE_KRB5_ERROR_E_TEXT 328#undef HAVE_KRB5_ERROR_E_TEXT
323 329
324/* Define to 1 if `text' is a member of `krb5_error'. */ 330/* Define to 1 if `text' is member of `krb5_error'. */
325#undef HAVE_KRB5_ERROR_TEXT 331#undef HAVE_KRB5_ERROR_TEXT
326 332
327/* Define to 1 if you have the <krb5.h> header file. */ 333/* Define to 1 if you have the <krb5.h> header file. */
@@ -333,9 +339,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
333/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ 339/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
334#undef HAVE_LANGINFO_CODESET 340#undef HAVE_LANGINFO_CODESET
335 341
336/* Define to 1 if the directory /usr/lib64 exists. */
337#undef HAVE_LIB64_DIR
338
339/* Define to 1 if you have the `com_err' library (-lcom_err). */ 342/* Define to 1 if you have the `com_err' library (-lcom_err). */
340#undef HAVE_LIBCOM_ERR 343#undef HAVE_LIBCOM_ERR
341 344
@@ -399,15 +402,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
399/* Define to 1 if you have the resolv library (-lresolv). */ 402/* Define to 1 if you have the resolv library (-lresolv). */
400#undef HAVE_LIBRESOLV 403#undef HAVE_LIBRESOLV
401 404
405/* Define to 1 if using SELinux. */
406#undef HAVE_LIBSELINUX
407
402/* Define to 1 if you have the `Xext' library (-lXext). */ 408/* Define to 1 if you have the `Xext' library (-lXext). */
403#undef HAVE_LIBXEXT 409#undef HAVE_LIBXEXT
404 410
405/* Define to 1 if you have the `Xmu' library (-lXmu). */ 411/* Define to 1 if you have the `Xmu' library (-lXmu). */
406#undef HAVE_LIBXMU 412#undef HAVE_LIBXMU
407 413
408/* Define to 1 if you have the Xp library (-lXp). */
409#undef HAVE_LIBXP
410
411/* Define to 1 if you have the <limits.h> header file. */ 414/* Define to 1 if you have the <limits.h> header file. */
412#undef HAVE_LIMITS_H 415#undef HAVE_LIMITS_H
413 416
@@ -488,9 +491,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
488/* Define to 1 if you have a working `mmap' system call. */ 491/* Define to 1 if you have a working `mmap' system call. */
489#undef HAVE_MMAP 492#undef HAVE_MMAP
490 493
491/* Define to 1 if you have Motif 2.1 or newer. */
492#undef HAVE_MOTIF_2_1
493
494/* Define to 1 if you have the `mremap' function. */ 494/* Define to 1 if you have the `mremap' function. */
495#undef HAVE_MREMAP 495#undef HAVE_MREMAP
496 496
@@ -615,25 +615,25 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
615/* Define to 1 if you have the `strsignal' function. */ 615/* Define to 1 if you have the `strsignal' function. */
616#undef HAVE_STRSIGNAL 616#undef HAVE_STRSIGNAL
617 617
618/* Define to 1 if `ifr_addr' is a member of `struct ifreq'. */ 618/* Define to 1 if `ifr_addr' is member of `struct ifreq'. */
619#undef HAVE_STRUCT_IFREQ_IFR_ADDR 619#undef HAVE_STRUCT_IFREQ_IFR_ADDR
620 620
621/* Define to 1 if `ifr_broadaddr' is a member of `struct ifreq'. */ 621/* Define to 1 if `ifr_broadaddr' is member of `struct ifreq'. */
622#undef HAVE_STRUCT_IFREQ_IFR_BROADADDR 622#undef HAVE_STRUCT_IFREQ_IFR_BROADADDR
623 623
624/* Define to 1 if `ifr_flags' is a member of `struct ifreq'. */ 624/* Define to 1 if `ifr_flags' is member of `struct ifreq'. */
625#undef HAVE_STRUCT_IFREQ_IFR_FLAGS 625#undef HAVE_STRUCT_IFREQ_IFR_FLAGS
626 626
627/* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */ 627/* Define to 1 if `ifr_hwaddr' is member of `struct ifreq'. */
628#undef HAVE_STRUCT_IFREQ_IFR_HWADDR 628#undef HAVE_STRUCT_IFREQ_IFR_HWADDR
629 629
630/* Define to 1 if `ifr_netmask' is a member of `struct ifreq'. */ 630/* Define to 1 if `ifr_netmask' is member of `struct ifreq'. */
631#undef HAVE_STRUCT_IFREQ_IFR_NETMASK 631#undef HAVE_STRUCT_IFREQ_IFR_NETMASK
632 632
633/* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */ 633/* Define to 1 if `n_un.n_name' is member of `struct nlist'. */
634#undef HAVE_STRUCT_NLIST_N_UN_N_NAME 634#undef HAVE_STRUCT_NLIST_N_UN_N_NAME
635 635
636/* Define to 1 if `tm_zone' is a member of `struct tm'. */ 636/* Define to 1 if `tm_zone' is member of `struct tm'. */
637#undef HAVE_STRUCT_TM_TM_ZONE 637#undef HAVE_STRUCT_TM_TM_ZONE
638 638
639/* Define to 1 if `struct utimbuf' is declared by <utime.h>. */ 639/* Define to 1 if `struct utimbuf' is declared by <utime.h>. */
@@ -813,10 +813,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
813 its own, you might want to add "-L/..." or something similar. */ 813 its own, you might want to add "-L/..." or something similar. */
814#undef LD_SWITCH_X_SITE 814#undef LD_SWITCH_X_SITE
815 815
816/* Define LD_SWITCH_X_SITE_AUX with an -R option in case it's needed (for
817 Solaris, for example). */
818#undef LD_SWITCH_X_SITE_AUX
819
820/* Define to 1 if localtime caches TZ. */ 816/* Define to 1 if localtime caches TZ. */
821#undef LOCALTIME_CACHE 817#undef LOCALTIME_CACHE
822 818
@@ -826,6 +822,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
826/* Define to unlink, rather than empty, mail spool after reading. */ 822/* Define to unlink, rather than empty, mail spool after reading. */
827#undef MAIL_UNLINK_SPOOL 823#undef MAIL_UNLINK_SPOOL
828 824
825/* Define if the mailer uses flock to interlock the mail spool. */
826#undef MAIL_USE_FLOCK
827
828/* Define if the mailer uses lockf to interlock the mail spool. */
829#undef MAIL_USE_LOCKF
830
829/* Define to support MMDF mailboxes in movemail. */ 831/* Define to support MMDF mailboxes in movemail. */
830#undef MAIL_USE_MMDF 832#undef MAIL_USE_MMDF
831 833
@@ -860,9 +862,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
860/* Define to the one symbol short name of this package. */ 862/* Define to the one symbol short name of this package. */
861#undef PACKAGE_TARNAME 863#undef PACKAGE_TARNAME
862 864
863/* Define to the home page for this package. */
864#undef PACKAGE_URL
865
866/* Define to the version of this package. */ 865/* Define to the version of this package. */
867#undef PACKAGE_VERSION 866#undef PACKAGE_VERSION
868 867
@@ -897,6 +896,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
897/* Process async input synchronously. */ 896/* Process async input synchronously. */
898#undef SYNC_INPUT 897#undef SYNC_INPUT
899 898
899/* Define to 1 if you use terminfo instead of termcap. */
900#undef TERMINFO
901
900/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ 902/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
901#undef TIME_WITH_SYS_TIME 903#undef TIME_WITH_SYS_TIME
902 904
@@ -910,9 +912,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
910 <sys/cpustats.h>. */ 912 <sys/cpustats.h>. */
911#undef UMAX4_3 913#undef UMAX4_3
912 914
913/* Define to the unexec source file name. */
914#undef UNEXEC_SRC
915
916/* Define to 1 if using GTK. */ 915/* Define to 1 if using GTK. */
917#undef USE_GTK 916#undef USE_GTK
918 917
@@ -1078,9 +1077,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1078 parallel this exactly since GNUstep is multi-OS. */ 1077 parallel this exactly since GNUstep is multi-OS. */
1079#ifdef HAVE_NS 1078#ifdef HAVE_NS
1080# ifdef NS_IMPL_GNUSTEP 1079# ifdef NS_IMPL_GNUSTEP
1081/* See also .m.o rule in Makefile.in */
1082/* FIXME: are all these flags really needed? Document here why. */
1083# define C_SWITCH_X_SYSTEM -D_REENTRANT -fPIC -fno-strict-aliasing
1084/* GNUstep needs a bit more pure memory. Of the existing knobs, 1080/* GNUstep needs a bit more pure memory. Of the existing knobs,
1085SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */ 1081SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */
1086# define SYSTEM_PURESIZE_EXTRA 30000 1082# define SYSTEM_PURESIZE_EXTRA 30000
diff --git a/src/data.c b/src/data.c
index bdba3a9bb36..2d71434cc76 100644
--- a/src/data.c
+++ b/src/data.c
@@ -91,7 +91,7 @@ Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
91 91
92Lisp_Object Qinteractive_form; 92Lisp_Object Qinteractive_form;
93 93
94static Lisp_Object swap_in_symval_forwarding P_ ((Lisp_Object, Lisp_Object)); 94static void swap_in_symval_forwarding (struct Lisp_Symbol *, struct Lisp_Buffer_Local_Value *);
95 95
96Lisp_Object Vmost_positive_fixnum, Vmost_negative_fixnum; 96Lisp_Object Vmost_positive_fixnum, Vmost_negative_fixnum;
97 97
@@ -582,12 +582,35 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0,
582 register Lisp_Object symbol; 582 register Lisp_Object symbol;
583{ 583{
584 Lisp_Object valcontents; 584 Lisp_Object valcontents;
585 struct Lisp_Symbol *sym;
585 CHECK_SYMBOL (symbol); 586 CHECK_SYMBOL (symbol);
587 sym = XSYMBOL (symbol);
586 588
587 valcontents = SYMBOL_VALUE (symbol); 589 start:
588 590 switch (sym->redirect)
589 if (BUFFER_LOCAL_VALUEP (valcontents)) 591 {
590 valcontents = swap_in_symval_forwarding (symbol, valcontents); 592 case SYMBOL_PLAINVAL: valcontents = SYMBOL_VAL (sym); break;
593 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
594 case SYMBOL_LOCALIZED:
595 {
596 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
597 if (blv->fwd)
598 /* In set_internal, we un-forward vars when their value is
599 set to Qunbound. */
600 return Qt;
601 else
602 {
603 swap_in_symval_forwarding (sym, blv);
604 valcontents = BLV_VALUE (blv);
605 }
606 break;
607 }
608 case SYMBOL_FORWARDED:
609 /* In set_internal, we un-forward vars when their value is
610 set to Qunbound. */
611 return Qt;
612 default: abort ();
613 }
591 614
592 return (EQ (valcontents, Qunbound) ? Qnil : Qt); 615 return (EQ (valcontents, Qunbound) ? Qnil : Qt);
593} 616}
@@ -824,14 +847,14 @@ indirect_variable (symbol)
824 847
825 hare = tortoise = symbol; 848 hare = tortoise = symbol;
826 849
827 while (hare->indirect_variable) 850 while (hare->redirect == SYMBOL_VARALIAS)
828 { 851 {
829 hare = XSYMBOL (hare->value); 852 hare = SYMBOL_ALIAS (hare);
830 if (!hare->indirect_variable) 853 if (hare->redirect != SYMBOL_VARALIAS)
831 break; 854 break;
832 855
833 hare = XSYMBOL (hare->value); 856 hare = SYMBOL_ALIAS (hare);
834 tortoise = XSYMBOL (tortoise->value); 857 tortoise = SYMBOL_ALIAS (tortoise);
835 858
836 if (hare == tortoise) 859 if (hare == tortoise)
837 { 860 {
@@ -865,44 +888,46 @@ variable chain of symbols. */)
865 This does not handle buffer-local variables; use 888 This does not handle buffer-local variables; use
866 swap_in_symval_forwarding for that. */ 889 swap_in_symval_forwarding for that. */
867 890
891#define do_blv_forwarding(blv) \
892 ((blv)->forwarded ? do_symval_forwarding (BLV_FWD (blv)) : BLV_VALUE (blv))
893
868Lisp_Object 894Lisp_Object
869do_symval_forwarding (valcontents) 895do_symval_forwarding (valcontents)
870 register Lisp_Object valcontents; 896 register union Lisp_Fwd *valcontents;
871{ 897{
872 register Lisp_Object val; 898 register Lisp_Object val;
873 if (MISCP (valcontents)) 899 switch (XFWDTYPE (valcontents))
874 switch (XMISCTYPE (valcontents)) 900 {
875 { 901 case Lisp_Fwd_Int:
876 case Lisp_Misc_Intfwd: 902 XSETINT (val, *XINTFWD (valcontents)->intvar);
877 XSETINT (val, *XINTFWD (valcontents)->intvar); 903 return val;
878 return val; 904
879 905 case Lisp_Fwd_Bool:
880 case Lisp_Misc_Boolfwd: 906 return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil);
881 return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil); 907
882 908 case Lisp_Fwd_Obj:
883 case Lisp_Misc_Objfwd: 909 return *XOBJFWD (valcontents)->objvar;
884 return *XOBJFWD (valcontents)->objvar; 910
885 911 case Lisp_Fwd_Buffer_Obj:
886 case Lisp_Misc_Buffer_Objfwd: 912 return PER_BUFFER_VALUE (current_buffer,
887 return PER_BUFFER_VALUE (current_buffer, 913 XBUFFER_OBJFWD (valcontents)->offset);
888 XBUFFER_OBJFWD (valcontents)->offset); 914
889 915 case Lisp_Fwd_Kboard_Obj:
890 case Lisp_Misc_Kboard_Objfwd: 916 /* We used to simply use current_kboard here, but from Lisp
891 /* We used to simply use current_kboard here, but from Lisp 917 code, it's value is often unexpected. It seems nicer to
892 code, it's value is often unexpected. It seems nicer to 918 allow constructions like this to work as intuitively expected:
893 allow constructions like this to work as intuitively expected: 919
894 920 (with-selected-frame frame
895 (with-selected-frame frame 921 (define-key local-function-map "\eOP" [f1]))
896 (define-key local-function-map "\eOP" [f1])) 922
897 923 On the other hand, this affects the semantics of
898 On the other hand, this affects the semantics of 924 last-command and real-last-command, and people may rely on
899 last-command and real-last-command, and people may rely on 925 that. I took a quick look at the Lisp codebase, and I
900 that. I took a quick look at the Lisp codebase, and I 926 don't think anything will break. --lorentey */
901 don't think anything will break. --lorentey */ 927 return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset
902 return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset 928 + (char *)FRAME_KBOARD (SELECTED_FRAME ()));
903 + (char *)FRAME_KBOARD (SELECTED_FRAME ())); 929 default: abort ();
904 } 930 }
905 return valcontents;
906} 931}
907 932
908/* Store NEWVAL into SYMBOL, where VALCONTENTS is found in the value cell 933/* Store NEWVAL into SYMBOL, where VALCONTENTS is found in the value cell
@@ -913,102 +938,93 @@ do_symval_forwarding (valcontents)
913 BUF non-zero means set the value in buffer BUF instead of the 938 BUF non-zero means set the value in buffer BUF instead of the
914 current buffer. This only plays a role for per-buffer variables. */ 939 current buffer. This only plays a role for per-buffer variables. */
915 940
916void 941#define store_blv_forwarding(blv, newval, buf) \
917store_symval_forwarding (symbol, valcontents, newval, buf) 942 do { \
918 Lisp_Object symbol; 943 if ((blv)->forwarded) \
919 register Lisp_Object valcontents, newval; 944 store_symval_forwarding (BLV_FWD (blv), (newval), (buf)); \
945 else \
946 SET_BLV_VALUE (blv, newval); \
947 } while (0)
948
949static void
950store_symval_forwarding (/* symbol, */ valcontents, newval, buf)
951 /* struct Lisp_Symbol *symbol; */
952 union Lisp_Fwd *valcontents;
953 register Lisp_Object newval;
920 struct buffer *buf; 954 struct buffer *buf;
921{ 955{
922 switch (SWITCH_ENUM_CAST (XTYPE (valcontents))) 956 switch (XFWDTYPE (valcontents))
923 { 957 {
924 case Lisp_Misc: 958 case Lisp_Fwd_Int:
925 switch (XMISCTYPE (valcontents)) 959 CHECK_NUMBER (newval);
960 *XINTFWD (valcontents)->intvar = XINT (newval);
961 break;
962
963 case Lisp_Fwd_Bool:
964 *XBOOLFWD (valcontents)->boolvar = !NILP (newval);
965 break;
966
967 case Lisp_Fwd_Obj:
968 *XOBJFWD (valcontents)->objvar = newval;
969
970 /* If this variable is a default for something stored
971 in the buffer itself, such as default-fill-column,
972 find the buffers that don't have local values for it
973 and update them. */
974 if (XOBJFWD (valcontents)->objvar > (Lisp_Object *) &buffer_defaults
975 && XOBJFWD (valcontents)->objvar < (Lisp_Object *) (&buffer_defaults + 1))
926 { 976 {
927 case Lisp_Misc_Intfwd: 977 int offset = ((char *) XOBJFWD (valcontents)->objvar
928 CHECK_NUMBER (newval); 978 - (char *) &buffer_defaults);
929 *XINTFWD (valcontents)->intvar = XINT (newval); 979 int idx = PER_BUFFER_IDX (offset);
930 /* This can never happen since intvar points to an EMACS_INT 980
931 which is at least large enough to hold a Lisp_Object. 981 Lisp_Object tail;
932 if (*XINTFWD (valcontents)->intvar != XINT (newval)) 982
933 error ("Value out of range for variable `%s'", 983 if (idx <= 0)
934 SDATA (SYMBOL_NAME (symbol))); */ 984 break;
935 break; 985
936 986 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
937 case Lisp_Misc_Boolfwd:
938 *XBOOLFWD (valcontents)->boolvar = !NILP (newval);
939 break;
940
941 case Lisp_Misc_Objfwd:
942 *XOBJFWD (valcontents)->objvar = newval;
943
944 /* If this variable is a default for something stored
945 in the buffer itself, such as default-fill-column,
946 find the buffers that don't have local values for it
947 and update them. */
948 if (XOBJFWD (valcontents)->objvar > (Lisp_Object *) &buffer_defaults
949 && XOBJFWD (valcontents)->objvar < (Lisp_Object *) (&buffer_defaults + 1))
950 { 987 {
951 int offset = ((char *) XOBJFWD (valcontents)->objvar 988 Lisp_Object buf;
952 - (char *) &buffer_defaults); 989 struct buffer *b;
953 int idx = PER_BUFFER_IDX (offset);
954
955 Lisp_Object tail;
956
957 if (idx <= 0)
958 break;
959
960 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
961 {
962 Lisp_Object buf;
963 struct buffer *b;
964 990
965 buf = Fcdr (XCAR (tail)); 991 buf = Fcdr (XCAR (tail));
966 if (!BUFFERP (buf)) continue; 992 if (!BUFFERP (buf)) continue;
967 b = XBUFFER (buf); 993 b = XBUFFER (buf);
968 994
969 if (! PER_BUFFER_VALUE_P (b, idx)) 995 if (! PER_BUFFER_VALUE_P (b, idx))
970 PER_BUFFER_VALUE (b, offset) = newval; 996 PER_BUFFER_VALUE (b, offset) = newval;
971 }
972 } 997 }
973 break; 998 }
974 999 break;
975 case Lisp_Misc_Buffer_Objfwd:
976 {
977 int offset = XBUFFER_OBJFWD (valcontents)->offset;
978 Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype;
979
980 if (!(NILP (type) || NILP (newval)
981 || (XINT (type) == LISP_INT_TAG
982 ? INTEGERP (newval)
983 : XTYPE (newval) == XINT (type))))
984 buffer_slot_type_mismatch (newval, XINT (type));
985
986 if (buf == NULL)
987 buf = current_buffer;
988 PER_BUFFER_VALUE (buf, offset) = newval;
989 }
990 break;
991 1000
992 case Lisp_Misc_Kboard_Objfwd: 1001 case Lisp_Fwd_Buffer_Obj:
993 { 1002 {
994 char *base = (char *) FRAME_KBOARD (SELECTED_FRAME ()); 1003 int offset = XBUFFER_OBJFWD (valcontents)->offset;
995 char *p = base + XKBOARD_OBJFWD (valcontents)->offset; 1004 Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype;
996 *(Lisp_Object *) p = newval; 1005
997 } 1006 if (!(NILP (type) || NILP (newval)
998 break; 1007 || (XINT (type) == LISP_INT_TAG
1008 ? INTEGERP (newval)
1009 : XTYPE (newval) == XINT (type))))
1010 buffer_slot_type_mismatch (newval, XINT (type));
1011
1012 if (buf == NULL)
1013 buf = current_buffer;
1014 PER_BUFFER_VALUE (buf, offset) = newval;
1015 }
1016 break;
999 1017
1000 default: 1018 case Lisp_Fwd_Kboard_Obj:
1001 goto def; 1019 {
1002 } 1020 char *base = (char *) FRAME_KBOARD (SELECTED_FRAME ());
1021 char *p = base + XKBOARD_OBJFWD (valcontents)->offset;
1022 *(Lisp_Object *) p = newval;
1023 }
1003 break; 1024 break;
1004 1025
1005 default: 1026 default:
1006 def: 1027 abort (); /* goto def; */
1007 valcontents = SYMBOL_VALUE (symbol);
1008 if (BUFFER_LOCAL_VALUEP (valcontents))
1009 XBUFFER_LOCAL_VALUE (valcontents)->realvalue = newval;
1010 else
1011 SET_SYMBOL_VALUE (symbol, newval);
1012 } 1028 }
1013} 1029}
1014 1030
@@ -1017,25 +1033,22 @@ store_symval_forwarding (symbol, valcontents, newval, buf)
1017 1033
1018void 1034void
1019swap_in_global_binding (symbol) 1035swap_in_global_binding (symbol)
1020 Lisp_Object symbol; 1036 struct Lisp_Symbol *symbol;
1021{ 1037{
1022 Lisp_Object valcontents = SYMBOL_VALUE (symbol); 1038 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (symbol);
1023 struct Lisp_Buffer_Local_Value *blv = XBUFFER_LOCAL_VALUE (valcontents);
1024 Lisp_Object cdr = blv->cdr;
1025 1039
1026 /* Unload the previously loaded binding. */ 1040 /* Unload the previously loaded binding. */
1027 Fsetcdr (XCAR (cdr), 1041 if (blv->fwd)
1028 do_symval_forwarding (blv->realvalue)); 1042 SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd));
1029 1043
1030 /* Select the global binding in the symbol. */ 1044 /* Select the global binding in the symbol. */
1031 XSETCAR (cdr, cdr); 1045 blv->valcell = blv->defcell;
1032 store_symval_forwarding (symbol, blv->realvalue, XCDR (cdr), NULL); 1046 if (blv->fwd)
1047 store_symval_forwarding (blv->fwd, XCDR (blv->defcell), NULL);
1033 1048
1034 /* Indicate that the global binding is set up now. */ 1049 /* Indicate that the global binding is set up now. */
1035 blv->frame = Qnil; 1050 blv->where = Qnil;
1036 blv->buffer = Qnil; 1051 SET_BLV_FOUND (blv, 0);
1037 blv->found_for_frame = 0;
1038 blv->found_for_buffer = 0;
1039} 1052}
1040 1053
1041/* Set up the buffer-local symbol SYMBOL for validity in the current buffer. 1054/* Set up the buffer-local symbol SYMBOL for validity in the current buffer.
@@ -1045,55 +1058,50 @@ swap_in_global_binding (symbol)
1045 Return the value forwarded one step past the buffer-local stage. 1058 Return the value forwarded one step past the buffer-local stage.
1046 This could be another forwarding pointer. */ 1059 This could be another forwarding pointer. */
1047 1060
1048static Lisp_Object 1061static void
1049swap_in_symval_forwarding (symbol, valcontents) 1062swap_in_symval_forwarding (symbol, blv)
1050 Lisp_Object symbol, valcontents; 1063 struct Lisp_Symbol *symbol;
1064 struct Lisp_Buffer_Local_Value *blv;
1051{ 1065{
1052 register Lisp_Object tem1; 1066 register Lisp_Object tem1;
1053 1067
1054 tem1 = XBUFFER_LOCAL_VALUE (valcontents)->buffer; 1068 eassert (blv == SYMBOL_BLV (symbol));
1069
1070 tem1 = blv->where;
1055 1071
1056 if (NILP (tem1) 1072 if (NILP (tem1)
1057 || current_buffer != XBUFFER (tem1) 1073 || (blv->frame_local
1058 || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame 1074 ? !EQ (selected_frame, tem1)
1059 && ! EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame))) 1075 : current_buffer != XBUFFER (tem1)))
1060 { 1076 {
1061 struct Lisp_Symbol *sym = XSYMBOL (symbol);
1062 if (sym->indirect_variable)
1063 {
1064 sym = indirect_variable (sym);
1065 XSETSYMBOL (symbol, sym);
1066 }
1067 1077
1068 /* Unload the previously loaded binding. */ 1078 /* Unload the previously loaded binding. */
1069 tem1 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); 1079 tem1 = blv->valcell;
1070 Fsetcdr (tem1, 1080 if (blv->fwd)
1071 do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)); 1081 SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd));
1072 /* Choose the new binding. */ 1082 /* Choose the new binding. */
1073 tem1 = assq_no_quit (symbol, current_buffer->local_var_alist); 1083 {
1074 XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 0; 1084 Lisp_Object var;
1075 XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0; 1085 XSETSYMBOL (var, symbol);
1076 if (NILP (tem1)) 1086 if (blv->frame_local)
1077 { 1087 {
1078 if (XBUFFER_LOCAL_VALUE (valcontents)->check_frame) 1088 tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist);
1079 tem1 = assq_no_quit (symbol, XFRAME (selected_frame)->param_alist); 1089 blv->where = selected_frame;
1080 if (! NILP (tem1)) 1090 }
1081 XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 1; 1091 else
1082 else 1092 {
1083 tem1 = XBUFFER_LOCAL_VALUE (valcontents)->cdr; 1093 tem1 = assq_no_quit (var, current_buffer->local_var_alist);
1084 } 1094 XSETBUFFER (blv->where, current_buffer);
1085 else 1095 }
1086 XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 1; 1096 }
1097 if (!(blv->found = !NILP (tem1)))
1098 tem1 = blv->defcell;
1087 1099
1088 /* Load the new binding. */ 1100 /* Load the new binding. */
1089 XSETCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, tem1); 1101 blv->valcell = tem1;
1090 XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, current_buffer); 1102 if (blv->fwd)
1091 XBUFFER_LOCAL_VALUE (valcontents)->frame = selected_frame; 1103 store_symval_forwarding (blv->fwd, BLV_VALUE (blv), NULL);
1092 store_symval_forwarding (symbol,
1093 XBUFFER_LOCAL_VALUE (valcontents)->realvalue,
1094 Fcdr (tem1), NULL);
1095 } 1104 }
1096 return XBUFFER_LOCAL_VALUE (valcontents)->realvalue;
1097} 1105}
1098 1106
1099/* Find the value of a symbol, returning Qunbound if it's not bound. 1107/* Find the value of a symbol, returning Qunbound if it's not bound.
@@ -1106,16 +1114,27 @@ Lisp_Object
1106find_symbol_value (symbol) 1114find_symbol_value (symbol)
1107 Lisp_Object symbol; 1115 Lisp_Object symbol;
1108{ 1116{
1109 register Lisp_Object valcontents; 1117 struct Lisp_Symbol *sym;
1110 register Lisp_Object val;
1111 1118
1112 CHECK_SYMBOL (symbol); 1119 CHECK_SYMBOL (symbol);
1113 valcontents = SYMBOL_VALUE (symbol); 1120 sym = XSYMBOL (symbol);
1114 1121
1115 if (BUFFER_LOCAL_VALUEP (valcontents)) 1122 start:
1116 valcontents = swap_in_symval_forwarding (symbol, valcontents); 1123 switch (sym->redirect)
1117 1124 {
1118 return do_symval_forwarding (valcontents); 1125 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
1126 case SYMBOL_PLAINVAL: return SYMBOL_VAL (sym);
1127 case SYMBOL_LOCALIZED:
1128 {
1129 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
1130 swap_in_symval_forwarding (sym, blv);
1131 return blv->fwd ? do_symval_forwarding (blv->fwd) : BLV_VALUE (blv);
1132 }
1133 /* FALLTHROUGH */
1134 case SYMBOL_FORWARDED:
1135 return do_symval_forwarding (SYMBOL_FWD (sym));
1136 default: abort ();
1137 }
1119} 1138}
1120 1139
1121DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0, 1140DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0,
@@ -1137,26 +1156,25 @@ DEFUN ("set", Fset, Sset, 2, 2, 0,
1137 (symbol, newval) 1156 (symbol, newval)
1138 register Lisp_Object symbol, newval; 1157 register Lisp_Object symbol, newval;
1139{ 1158{
1140 return set_internal (symbol, newval, current_buffer, 0); 1159 set_internal (symbol, newval, Qnil, 0);
1160 return newval;
1141} 1161}
1142 1162
1143/* Return 1 if SYMBOL currently has a let-binding 1163/* Return 1 if SYMBOL currently has a let-binding
1144 which was made in the buffer that is now current. */ 1164 which was made in the buffer that is now current. */
1145 1165
1146static int 1166static int
1147let_shadows_buffer_binding_p (symbol) 1167let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
1148 struct Lisp_Symbol *symbol;
1149{ 1168{
1150 volatile struct specbinding *p; 1169 struct specbinding *p;
1151 1170
1152 for (p = specpdl_ptr - 1; p >= specpdl; p--) 1171 for (p = specpdl_ptr - 1; p >= specpdl; p--)
1153 if (p->func == NULL 1172 if (p->func == NULL
1154 && CONSP (p->symbol)) 1173 && CONSP (p->symbol))
1155 { 1174 {
1156 struct Lisp_Symbol *let_bound_symbol = XSYMBOL (XCAR (p->symbol)); 1175 struct Lisp_Symbol *let_bound_symbol = XSYMBOL (XCAR (p->symbol));
1157 if ((symbol == let_bound_symbol 1176 eassert (let_bound_symbol->redirect != SYMBOL_VARALIAS);
1158 || (let_bound_symbol->indirect_variable 1177 if (symbol == let_bound_symbol
1159 && symbol == indirect_variable (let_bound_symbol)))
1160 && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer) 1178 && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer)
1161 break; 1179 break;
1162 } 1180 }
@@ -1164,141 +1182,173 @@ let_shadows_buffer_binding_p (symbol)
1164 return p >= specpdl; 1182 return p >= specpdl;
1165} 1183}
1166 1184
1185static int
1186let_shadows_global_binding_p (symbol)
1187 Lisp_Object symbol;
1188{
1189 struct specbinding *p;
1190
1191 for (p = specpdl_ptr - 1; p >= specpdl; p--)
1192 if (p->func == NULL && EQ (p->symbol, symbol))
1193 break;
1194
1195 return p >= specpdl;
1196}
1197
1167/* Store the value NEWVAL into SYMBOL. 1198/* Store the value NEWVAL into SYMBOL.
1168 If buffer-locality is an issue, BUF specifies which buffer to use. 1199 If buffer/frame-locality is an issue, WHERE specifies which context to use.
1169 (0 stands for the current buffer.) 1200 (nil stands for the current buffer/frame).
1170 1201
1171 If BINDFLAG is zero, then if this symbol is supposed to become 1202 If BINDFLAG is zero, then if this symbol is supposed to become
1172 local in every buffer where it is set, then we make it local. 1203 local in every buffer where it is set, then we make it local.
1173 If BINDFLAG is nonzero, we don't do that. */ 1204 If BINDFLAG is nonzero, we don't do that. */
1174 1205
1175Lisp_Object 1206void
1176set_internal (symbol, newval, buf, bindflag) 1207set_internal (symbol, newval, where, bindflag)
1177 register Lisp_Object symbol, newval; 1208 register Lisp_Object symbol, newval, where;
1178 struct buffer *buf;
1179 int bindflag; 1209 int bindflag;
1180{ 1210{
1181 int voide = EQ (newval, Qunbound); 1211 int voide = EQ (newval, Qunbound);
1182 1212 struct Lisp_Symbol *sym;
1183 register Lisp_Object valcontents, innercontents, tem1, current_alist_element; 1213 Lisp_Object tem1;
1184
1185 if (buf == 0)
1186 buf = current_buffer;
1187 1214
1188 /* If restoring in a dead buffer, do nothing. */ 1215 /* If restoring in a dead buffer, do nothing. */
1189 if (NILP (buf->name)) 1216 /* if (BUFFERP (where) && NILP (XBUFFER (where)->name))
1190 return newval; 1217 return; */
1191 1218
1192 CHECK_SYMBOL (symbol); 1219 CHECK_SYMBOL (symbol);
1193 if (SYMBOL_CONSTANT_P (symbol) 1220 if (SYMBOL_CONSTANT_P (symbol))
1194 && (NILP (Fkeywordp (symbol))
1195 || !EQ (newval, SYMBOL_VALUE (symbol))))
1196 xsignal1 (Qsetting_constant, symbol);
1197
1198 innercontents = valcontents = SYMBOL_VALUE (symbol);
1199
1200 if (BUFFER_OBJFWDP (valcontents))
1201 { 1221 {
1202 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1222 if (NILP (Fkeywordp (symbol))
1203 int idx = PER_BUFFER_IDX (offset); 1223 || !EQ (newval, Fsymbol_value (symbol)))
1204 if (idx > 0 1224 xsignal1 (Qsetting_constant, symbol);
1205 && !bindflag 1225 else
1206 && !let_shadows_buffer_binding_p (XSYMBOL (symbol))) 1226 /* Allow setting keywords to their own value. */
1207 SET_PER_BUFFER_VALUE_P (buf, idx, 1); 1227 return;
1208 } 1228 }
1209 else if (BUFFER_LOCAL_VALUEP (valcontents))
1210 {
1211 /* valcontents is a struct Lisp_Buffer_Local_Value. */
1212 if (XSYMBOL (symbol)->indirect_variable)
1213 XSETSYMBOL (symbol, indirect_variable (XSYMBOL (symbol)));
1214
1215 /* What binding is loaded right now? */
1216 current_alist_element
1217 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr);
1218
1219 /* If the current buffer is not the buffer whose binding is
1220 loaded, or if there may be frame-local bindings and the frame
1221 isn't the right one, or if it's a Lisp_Buffer_Local_Value and
1222 the default binding is loaded, the loaded binding may be the
1223 wrong one. */
1224 if (!BUFFERP (XBUFFER_LOCAL_VALUE (valcontents)->buffer)
1225 || buf != XBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer)
1226 || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame
1227 && !EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame))
1228 /* Also unload a global binding (if the var is local_if_set). */
1229 || (EQ (XCAR (current_alist_element),
1230 current_alist_element)))
1231 {
1232 /* The currently loaded binding is not necessarily valid.
1233 We need to unload it, and choose a new binding. */
1234
1235 /* Write out `realvalue' to the old loaded binding. */
1236 Fsetcdr (current_alist_element,
1237 do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue));
1238 1229
1239 /* Find the new binding. */ 1230 sym = XSYMBOL (symbol);
1240 tem1 = Fassq (symbol, buf->local_var_alist);
1241 XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 1;
1242 XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 0;
1243 1231
1244 if (NILP (tem1)) 1232 start:
1245 { 1233 switch (sym->redirect)
1246 /* This buffer still sees the default value. */ 1234 {
1247 1235 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
1248 /* If the variable is not local_if_set, 1236 case SYMBOL_PLAINVAL: SET_SYMBOL_VAL (sym , newval); return;
1249 or if this is `let' rather than `set', 1237 case SYMBOL_LOCALIZED:
1250 make CURRENT-ALIST-ELEMENT point to itself, 1238 {
1251 indicating that we're seeing the default value. 1239 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
1252 Likewise if the variable has been let-bound 1240 if (NILP (where))
1253 in the current buffer. */ 1241 {
1254 if (bindflag || !XBUFFER_LOCAL_VALUE (valcontents)->local_if_set 1242 if (blv->frame_local)
1255 || let_shadows_buffer_binding_p (XSYMBOL (symbol))) 1243 where = selected_frame;
1256 { 1244 else
1257 XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0; 1245 XSETBUFFER (where, current_buffer);
1258 1246 }
1259 if (XBUFFER_LOCAL_VALUE (valcontents)->check_frame) 1247 /* If the current buffer is not the buffer whose binding is
1260 tem1 = Fassq (symbol, 1248 loaded, or if there may be frame-local bindings and the frame
1261 XFRAME (selected_frame)->param_alist); 1249 isn't the right one, or if it's a Lisp_Buffer_Local_Value and
1262 1250 the default binding is loaded, the loaded binding may be the
1263 if (! NILP (tem1)) 1251 wrong one. */
1264 XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 1; 1252 if (!EQ (blv->where, where)
1265 else 1253 /* Also unload a global binding (if the var is local_if_set). */
1266 tem1 = XBUFFER_LOCAL_VALUE (valcontents)->cdr; 1254 || (EQ (blv->valcell, blv->defcell)))
1267 } 1255 {
1268 /* If it's a Lisp_Buffer_Local_Value, being set not bound, 1256 /* The currently loaded binding is not necessarily valid.
1269 and we're not within a let that was made for this buffer, 1257 We need to unload it, and choose a new binding. */
1270 create a new buffer-local binding for the variable. 1258
1271 That means, give this buffer a new assoc for a local value 1259 /* Write out `realvalue' to the old loaded binding. */
1272 and load that binding. */ 1260 if (blv->fwd)
1273 else 1261 SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd));
1274 { 1262
1275 tem1 = Fcons (symbol, XCDR (current_alist_element)); 1263 /* Find the new binding. */
1276 buf->local_var_alist 1264 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */
1277 = Fcons (tem1, buf->local_var_alist); 1265 tem1 = Fassq (symbol,
1278 } 1266 (blv->frame_local
1279 } 1267 ? XFRAME (where)->param_alist
1268 : XBUFFER (where)->local_var_alist));
1269 blv->where = where;
1270 blv->found = 1;
1271
1272 if (NILP (tem1))
1273 {
1274 /* This buffer still sees the default value. */
1275
1276 /* If the variable is a Lisp_Some_Buffer_Local_Value,
1277 or if this is `let' rather than `set',
1278 make CURRENT-ALIST-ELEMENT point to itself,
1279 indicating that we're seeing the default value.
1280 Likewise if the variable has been let-bound
1281 in the current buffer. */
1282 if (bindflag || !blv->local_if_set
1283 || let_shadows_buffer_binding_p (sym))
1284 {
1285 blv->found = 0;
1286 tem1 = blv->defcell;
1287 }
1288 /* If it's a local_if_set, being set not bound,
1289 and we're not within a let that was made for this buffer,
1290 create a new buffer-local binding for the variable.
1291 That means, give this buffer a new assoc for a local value
1292 and load that binding. */
1293 else
1294 {
1295 /* local_if_set is only supported for buffer-local
1296 bindings, not for frame-local bindings. */
1297 eassert (!blv->frame_local);
1298 tem1 = Fcons (symbol, XCDR (blv->defcell));
1299 XBUFFER (where)->local_var_alist
1300 = Fcons (tem1, XBUFFER (where)->local_var_alist);
1301 }
1302 }
1303
1304 /* Record which binding is now loaded. */
1305 blv->valcell = tem1;
1306 }
1280 1307
1281 /* Record which binding is now loaded. */ 1308 /* Store the new value in the cons cell. */
1282 XSETCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, tem1); 1309 SET_BLV_VALUE (blv, newval);
1283 1310
1284 /* Set `buffer' and `frame' slots for the binding now loaded. */ 1311 if (blv->fwd)
1285 XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, buf); 1312 {
1286 XBUFFER_LOCAL_VALUE (valcontents)->frame = selected_frame; 1313 if (voide)
1287 } 1314 /* If storing void (making the symbol void), forward only through
1288 innercontents = XBUFFER_LOCAL_VALUE (valcontents)->realvalue; 1315 buffer-local indicator, not through Lisp_Objfwd, etc. */
1316 blv->fwd = NULL;
1317 else
1318 store_symval_forwarding (blv->fwd, newval,
1319 BUFFERP (where)
1320 ? XBUFFER (where) : current_buffer);
1321 }
1322 break;
1323 }
1324 case SYMBOL_FORWARDED:
1325 {
1326 struct buffer *buf
1327 = BUFFERP (where) ? XBUFFER (where) : current_buffer;
1328 union Lisp_Fwd *innercontents = SYMBOL_FWD (sym);
1329 if (BUFFER_OBJFWDP (innercontents))
1330 {
1331 int offset = XBUFFER_OBJFWD (innercontents)->offset;
1332 int idx = PER_BUFFER_IDX (offset);
1333 if (idx > 0
1334 && !bindflag
1335 && !let_shadows_buffer_binding_p (sym))
1336 SET_PER_BUFFER_VALUE_P (buf, idx, 1);
1337 }
1289 1338
1290 /* Store the new value in the cons-cell. */ 1339 if (voide)
1291 XSETCDR (XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr), newval); 1340 { /* If storing void (making the symbol void), forward only through
1341 buffer-local indicator, not through Lisp_Objfwd, etc. */
1342 sym->redirect = SYMBOL_PLAINVAL;
1343 SET_SYMBOL_VAL (sym, newval);
1344 }
1345 else
1346 store_symval_forwarding (/* sym, */ innercontents, newval, buf);
1347 break;
1348 }
1349 default: abort ();
1292 } 1350 }
1293 1351 return;
1294 /* If storing void (making the symbol void), forward only through
1295 buffer-local indicator, not through Lisp_Objfwd, etc. */
1296 if (voide)
1297 store_symval_forwarding (symbol, Qnil, newval, buf);
1298 else
1299 store_symval_forwarding (symbol, innercontents, newval, buf);
1300
1301 return newval;
1302} 1352}
1303 1353
1304/* Access or set a buffer-local symbol's default value. */ 1354/* Access or set a buffer-local symbol's default value. */
@@ -1310,38 +1360,46 @@ Lisp_Object
1310default_value (symbol) 1360default_value (symbol)
1311 Lisp_Object symbol; 1361 Lisp_Object symbol;
1312{ 1362{
1313 register Lisp_Object valcontents; 1363 struct Lisp_Symbol *sym;
1314 1364
1315 CHECK_SYMBOL (symbol); 1365 CHECK_SYMBOL (symbol);
1316 valcontents = SYMBOL_VALUE (symbol); 1366 sym = XSYMBOL (symbol);
1317 1367
1318 /* For a built-in buffer-local variable, get the default value 1368 start:
1319 rather than letting do_symval_forwarding get the current value. */ 1369 switch (sym->redirect)
1320 if (BUFFER_OBJFWDP (valcontents))
1321 { 1370 {
1322 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1371 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
1323 if (PER_BUFFER_IDX (offset) != 0) 1372 case SYMBOL_PLAINVAL: return SYMBOL_VAL (sym);
1324 return PER_BUFFER_DEFAULT (offset); 1373 case SYMBOL_LOCALIZED:
1325 } 1374 {
1375 /* If var is set up for a buffer that lacks a local value for it,
1376 the current value is nominally the default value.
1377 But the `realvalue' slot may be more up to date, since
1378 ordinary setq stores just that slot. So use that. */
1379 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
1380 if (blv->fwd && EQ (blv->valcell, blv->defcell))
1381 return do_symval_forwarding (blv->fwd);
1382 else
1383 return XCDR (blv->defcell);
1384 }
1385 case SYMBOL_FORWARDED:
1386 {
1387 union Lisp_Fwd *valcontents = SYMBOL_FWD (sym);
1326 1388
1327 /* Handle user-created local variables. */ 1389 /* For a built-in buffer-local variable, get the default value
1328 if (BUFFER_LOCAL_VALUEP (valcontents)) 1390 rather than letting do_symval_forwarding get the current value. */
1329 { 1391 if (BUFFER_OBJFWDP (valcontents))
1330 /* If var is set up for a buffer that lacks a local value for it, 1392 {
1331 the current value is nominally the default value. 1393 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1332 But the `realvalue' slot may be more up to date, since 1394 if (PER_BUFFER_IDX (offset) != 0)
1333 ordinary setq stores just that slot. So use that. */ 1395 return PER_BUFFER_DEFAULT (offset);
1334 Lisp_Object current_alist_element, alist_element_car; 1396 }
1335 current_alist_element 1397
1336 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); 1398 /* For other variables, get the current value. */
1337 alist_element_car = XCAR (current_alist_element); 1399 return do_symval_forwarding (valcontents);
1338 if (EQ (alist_element_car, current_alist_element)) 1400 }
1339 return do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue); 1401 default: abort ();
1340 else
1341 return XCDR (XBUFFER_LOCAL_VALUE (valcontents)->cdr);
1342 } 1402 }
1343 /* For other variables, get the current value. */
1344 return do_symval_forwarding (valcontents);
1345} 1403}
1346 1404
1347DEFUN ("default-boundp", Fdefault_boundp, Sdefault_boundp, 1, 1, 0, 1405DEFUN ("default-boundp", Fdefault_boundp, Sdefault_boundp, 1, 1, 0,
@@ -1381,50 +1439,68 @@ for this variable. */)
1381 (symbol, value) 1439 (symbol, value)
1382 Lisp_Object symbol, value; 1440 Lisp_Object symbol, value;
1383{ 1441{
1384 register Lisp_Object valcontents, current_alist_element, alist_element_buffer; 1442 struct Lisp_Symbol *sym;
1385 1443
1386 CHECK_SYMBOL (symbol); 1444 CHECK_SYMBOL (symbol);
1387 valcontents = SYMBOL_VALUE (symbol); 1445 if (SYMBOL_CONSTANT_P (symbol))
1388
1389 /* Handle variables like case-fold-search that have special slots
1390 in the buffer. Make them work apparently like Lisp_Buffer_Local_Value
1391 variables. */
1392 if (BUFFER_OBJFWDP (valcontents))
1393 { 1446 {
1394 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1447 if (NILP (Fkeywordp (symbol))
1395 int idx = PER_BUFFER_IDX (offset); 1448 || !EQ (value, Fdefault_value (symbol)))
1449 xsignal1 (Qsetting_constant, symbol);
1450 else
1451 /* Allow setting keywords to their own value. */
1452 return value;
1453 }
1454 sym = XSYMBOL (symbol);
1396 1455
1397 PER_BUFFER_DEFAULT (offset) = value; 1456 start:
1457 switch (sym->redirect)
1458 {
1459 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
1460 case SYMBOL_PLAINVAL: return Fset (symbol, value);
1461 case SYMBOL_LOCALIZED:
1462 {
1463 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
1398 1464
1399 /* If this variable is not always local in all buffers, 1465 /* Store new value into the DEFAULT-VALUE slot. */
1400 set it in the buffers that don't nominally have a local value. */ 1466 XSETCDR (blv->defcell, value);
1401 if (idx > 0)
1402 {
1403 struct buffer *b;
1404 1467
1405 for (b = all_buffers; b; b = b->next) 1468 /* If the default binding is now loaded, set the REALVALUE slot too. */
1406 if (!PER_BUFFER_VALUE_P (b, idx)) 1469 if (blv->fwd && EQ (blv->defcell, blv->valcell))
1407 PER_BUFFER_VALUE (b, offset) = value; 1470 store_symval_forwarding (blv->fwd, value, NULL);
1408 } 1471 return value;
1409 return value; 1472 }
1410 } 1473 case SYMBOL_FORWARDED:
1474 {
1475 union Lisp_Fwd *valcontents = SYMBOL_FWD (sym);
1411 1476
1412 if (!BUFFER_LOCAL_VALUEP (valcontents)) 1477 /* Handle variables like case-fold-search that have special slots
1413 return Fset (symbol, value); 1478 in the buffer.
1479 Make them work apparently like Lisp_Buffer_Local_Value variables. */
1480 if (BUFFER_OBJFWDP (valcontents))
1481 {
1482 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1483 int idx = PER_BUFFER_IDX (offset);
1414 1484
1415 /* Store new value into the DEFAULT-VALUE slot. */ 1485 PER_BUFFER_DEFAULT (offset) = value;
1416 XSETCDR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, value);
1417 1486
1418 /* If the default binding is now loaded, set the REALVALUE slot too. */ 1487 /* If this variable is not always local in all buffers,
1419 current_alist_element 1488 set it in the buffers that don't nominally have a local value. */
1420 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); 1489 if (idx > 0)
1421 alist_element_buffer = Fcar (current_alist_element); 1490 {
1422 if (EQ (alist_element_buffer, current_alist_element)) 1491 struct buffer *b;
1423 store_symval_forwarding (symbol,
1424 XBUFFER_LOCAL_VALUE (valcontents)->realvalue,
1425 value, NULL);
1426 1492
1427 return value; 1493 for (b = all_buffers; b; b = b->next)
1494 if (!PER_BUFFER_VALUE_P (b, idx))
1495 PER_BUFFER_VALUE (b, offset) = value;
1496 }
1497 return value;
1498 }
1499 else
1500 return Fset (symbol, value);
1501 }
1502 default: abort ();
1503 }
1428} 1504}
1429 1505
1430DEFUN ("setq-default", Fsetq_default, Ssetq_default, 0, UNEVALLED, 0, 1506DEFUN ("setq-default", Fsetq_default, Ssetq_default, 0, UNEVALLED, 0,
@@ -1468,6 +1544,39 @@ usage: (setq-default [VAR VALUE]...) */)
1468 1544
1469/* Lisp functions for creating and removing buffer-local variables. */ 1545/* Lisp functions for creating and removing buffer-local variables. */
1470 1546
1547union Lisp_Val_Fwd
1548 {
1549 Lisp_Object value;
1550 union Lisp_Fwd *fwd;
1551 };
1552
1553static struct Lisp_Buffer_Local_Value *
1554make_blv (struct Lisp_Symbol *sym, int forwarded, union Lisp_Val_Fwd valcontents)
1555{
1556 struct Lisp_Buffer_Local_Value *blv
1557 = xmalloc (sizeof (struct Lisp_Buffer_Local_Value));
1558 Lisp_Object symbol;
1559 Lisp_Object tem;
1560
1561 XSETSYMBOL (symbol, sym);
1562 tem = Fcons (symbol, (forwarded
1563 ? do_symval_forwarding (valcontents.fwd)
1564 : valcontents.value));
1565
1566 /* Buffer_Local_Values cannot have as realval a buffer-local
1567 or keyboard-local forwarding. */
1568 eassert (!(forwarded && BUFFER_OBJFWDP (valcontents.fwd)));
1569 eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd)));
1570 blv->fwd = forwarded ? valcontents.fwd : NULL;
1571 blv->where = Qnil;
1572 blv->frame_local = 0;
1573 blv->local_if_set = 0;
1574 blv->defcell = tem;
1575 blv->valcell = tem;
1576 SET_BLV_FOUND (blv, 0);
1577 return blv;
1578}
1579
1471DEFUN ("make-variable-buffer-local", Fmake_variable_buffer_local, Smake_variable_buffer_local, 1580DEFUN ("make-variable-buffer-local", Fmake_variable_buffer_local, Smake_variable_buffer_local,
1472 1, 1, "vMake Variable Buffer Local: ", 1581 1, 1, "vMake Variable Buffer Local: ",
1473 doc: /* Make VARIABLE become buffer-local whenever it is set. 1582 doc: /* Make VARIABLE become buffer-local whenever it is set.
@@ -1485,42 +1594,58 @@ The function `default-value' gets the default value and `set-default' sets it.
1485 (variable) 1594 (variable)
1486 register Lisp_Object variable; 1595 register Lisp_Object variable;
1487{ 1596{
1488 register Lisp_Object tem, valcontents, newval;
1489 struct Lisp_Symbol *sym; 1597 struct Lisp_Symbol *sym;
1598 struct Lisp_Buffer_Local_Value *blv = NULL;
1599 union Lisp_Val_Fwd valcontents;
1600 int forwarded;
1490 1601
1491 CHECK_SYMBOL (variable); 1602 CHECK_SYMBOL (variable);
1492 sym = indirect_variable (XSYMBOL (variable)); 1603 sym = XSYMBOL (variable);
1493 1604
1494 valcontents = sym->value; 1605 start:
1495 if (sym->constant || KBOARD_OBJFWDP (valcontents)) 1606 switch (sym->redirect)
1496 error ("Symbol %s may not be buffer-local", SDATA (sym->xname));
1497
1498 if (BUFFER_OBJFWDP (valcontents))
1499 return variable;
1500 else if (BUFFER_LOCAL_VALUEP (valcontents))
1501 { 1607 {
1502 if (XBUFFER_LOCAL_VALUE (valcontents)->check_frame) 1608 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
1503 error ("Symbol %s may not be buffer-local", SDATA (sym->xname)); 1609 case SYMBOL_PLAINVAL:
1504 newval = valcontents; 1610 forwarded = 0; valcontents.value = SYMBOL_VAL (sym);
1611 if (EQ (valcontents.value, Qunbound))
1612 valcontents.value = Qnil;
1613 break;
1614 case SYMBOL_LOCALIZED:
1615 blv = SYMBOL_BLV (sym);
1616 if (blv->frame_local)
1617 error ("Symbol %s may not be buffer-local",
1618 SDATA (SYMBOL_NAME (variable)));
1619 break;
1620 case SYMBOL_FORWARDED:
1621 forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym);
1622 if (KBOARD_OBJFWDP (valcontents.fwd))
1623 error ("Symbol %s may not be buffer-local",
1624 SDATA (SYMBOL_NAME (variable)));
1625 else if (BUFFER_OBJFWDP (valcontents.fwd))
1626 return variable;
1627 break;
1628 default: abort ();
1505 } 1629 }
1506 else 1630
1631 if (sym->constant)
1632 error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable)));
1633
1634 if (!blv)
1507 { 1635 {
1508 if (EQ (valcontents, Qunbound)) 1636 blv = make_blv (sym, forwarded, valcontents);
1509 sym->value = Qnil; 1637 sym->redirect = SYMBOL_LOCALIZED;
1510 tem = Fcons (Qnil, Fsymbol_value (variable)); 1638 SET_SYMBOL_BLV (sym, blv);
1511 XSETCAR (tem, tem); 1639 {
1512 newval = allocate_misc (); 1640 Lisp_Object symbol;
1513 XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; 1641 XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */
1514 XBUFFER_LOCAL_VALUE (newval)->realvalue = sym->value; 1642 if (let_shadows_global_binding_p (symbol))
1515 XBUFFER_LOCAL_VALUE (newval)->buffer = Fcurrent_buffer (); 1643 message ("Making %s buffer-local while let-bound!",
1516 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; 1644 SDATA (SYMBOL_NAME (variable)));
1517 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; 1645 }
1518 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
1519 XBUFFER_LOCAL_VALUE (newval)->check_frame = 0;
1520 XBUFFER_LOCAL_VALUE (newval)->cdr = tem;
1521 sym->value = newval;
1522 } 1646 }
1523 XBUFFER_LOCAL_VALUE (newval)->local_if_set = 1; 1647
1648 blv->local_if_set = 1;
1524 return variable; 1649 return variable;
1525} 1650}
1526 1651
@@ -1547,82 +1672,97 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1547 (variable) 1672 (variable)
1548 register Lisp_Object variable; 1673 register Lisp_Object variable;
1549{ 1674{
1550 register Lisp_Object tem, valcontents; 1675 register Lisp_Object tem;
1676 int forwarded;
1677 union Lisp_Val_Fwd valcontents;
1551 struct Lisp_Symbol *sym; 1678 struct Lisp_Symbol *sym;
1679 struct Lisp_Buffer_Local_Value *blv = NULL;
1552 1680
1553 CHECK_SYMBOL (variable); 1681 CHECK_SYMBOL (variable);
1554 sym = indirect_variable (XSYMBOL (variable)); 1682 sym = XSYMBOL (variable);
1683
1684 start:
1685 switch (sym->redirect)
1686 {
1687 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
1688 case SYMBOL_PLAINVAL:
1689 forwarded = 0; valcontents.value = SYMBOL_VAL (sym); break;
1690 case SYMBOL_LOCALIZED:
1691 blv = SYMBOL_BLV (sym);
1692 if (blv->frame_local)
1693 error ("Symbol %s may not be buffer-local",
1694 SDATA (SYMBOL_NAME (variable)));
1695 break;
1696 case SYMBOL_FORWARDED:
1697 forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym);
1698 if (KBOARD_OBJFWDP (valcontents.fwd))
1699 error ("Symbol %s may not be buffer-local",
1700 SDATA (SYMBOL_NAME (variable)));
1701 break;
1702 default: abort ();
1703 }
1555 1704
1556 valcontents = sym->value; 1705 if (sym->constant)
1557 if (sym->constant || KBOARD_OBJFWDP (valcontents) 1706 error ("Symbol %s may not be buffer-local",
1558 || (BUFFER_LOCAL_VALUEP (valcontents) 1707 SDATA (SYMBOL_NAME (variable)));
1559 && (XBUFFER_LOCAL_VALUE (valcontents)->check_frame)))
1560 error ("Symbol %s may not be buffer-local", SDATA (sym->xname));
1561 1708
1562 if ((BUFFER_LOCAL_VALUEP (valcontents) 1709 if (blv ? blv->local_if_set
1563 && XBUFFER_LOCAL_VALUE (valcontents)->local_if_set) 1710 : (forwarded && BUFFER_OBJFWDP (valcontents.fwd)))
1564 || BUFFER_OBJFWDP (valcontents))
1565 { 1711 {
1566 tem = Fboundp (variable); 1712 tem = Fboundp (variable);
1567
1568 /* Make sure the symbol has a local value in this particular buffer, 1713 /* Make sure the symbol has a local value in this particular buffer,
1569 by setting it to the same value it already has. */ 1714 by setting it to the same value it already has. */
1570 Fset (variable, (EQ (tem, Qt) ? Fsymbol_value (variable) : Qunbound)); 1715 Fset (variable, (EQ (tem, Qt) ? Fsymbol_value (variable) : Qunbound));
1571 return variable; 1716 return variable;
1572 } 1717 }
1573 /* Make sure symbol is set up to hold per-buffer values. */ 1718 if (!blv)
1574 if (!BUFFER_LOCAL_VALUEP (valcontents))
1575 { 1719 {
1576 Lisp_Object newval; 1720 blv = make_blv (sym, forwarded, valcontents);
1577 tem = Fcons (Qnil, do_symval_forwarding (valcontents)); 1721 sym->redirect = SYMBOL_LOCALIZED;
1578 XSETCAR (tem, tem); 1722 SET_SYMBOL_BLV (sym, blv);
1579 newval = allocate_misc (); 1723 {
1580 XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; 1724 Lisp_Object symbol;
1581 XBUFFER_LOCAL_VALUE (newval)->realvalue = sym->value; 1725 XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */
1582 XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; 1726 if (let_shadows_global_binding_p (symbol))
1583 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; 1727 message ("Making %s local to %s while let-bound!",
1584 XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0; 1728 SDATA (SYMBOL_NAME (variable)),
1585 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; 1729 SDATA (current_buffer->name));
1586 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; 1730 }
1587 XBUFFER_LOCAL_VALUE (newval)->check_frame = 0;
1588 XBUFFER_LOCAL_VALUE (newval)->cdr = tem;
1589 sym->value = newval;
1590 } 1731 }
1732
1591 /* Make sure this buffer has its own value of symbol. */ 1733 /* Make sure this buffer has its own value of symbol. */
1592 XSETSYMBOL (variable, sym); /* Propagate variable indirections. */ 1734 XSETSYMBOL (variable, sym); /* Update in case of aliasing. */
1593 tem = Fassq (variable, current_buffer->local_var_alist); 1735 tem = Fassq (variable, current_buffer->local_var_alist);
1594 if (NILP (tem)) 1736 if (NILP (tem))
1595 { 1737 {
1738 if (let_shadows_buffer_binding_p (sym))
1739 message ("Making %s buffer-local while locally let-bound!",
1740 SDATA (SYMBOL_NAME (variable)));
1741
1596 /* Swap out any local binding for some other buffer, and make 1742 /* Swap out any local binding for some other buffer, and make
1597 sure the current value is permanently recorded, if it's the 1743 sure the current value is permanently recorded, if it's the
1598 default value. */ 1744 default value. */
1599 find_symbol_value (variable); 1745 find_symbol_value (variable);
1600 1746
1601 current_buffer->local_var_alist 1747 current_buffer->local_var_alist
1602 = Fcons (Fcons (variable, XCDR (XBUFFER_LOCAL_VALUE (sym->value)->cdr)), 1748 = Fcons (Fcons (variable, XCDR (blv->defcell)),
1603 current_buffer->local_var_alist); 1749 current_buffer->local_var_alist);
1604 1750
1605 /* Make sure symbol does not think it is set up for this buffer; 1751 /* Make sure symbol does not think it is set up for this buffer;
1606 force it to look once again for this buffer's value. */ 1752 force it to look once again for this buffer's value. */
1607 { 1753 if (current_buffer == XBUFFER (blv->where))
1608 Lisp_Object *pvalbuf; 1754 blv->where = Qnil;
1609 1755 /* blv->valcell = blv->defcell;
1610 valcontents = sym->value; 1756 * SET_BLV_FOUND (blv, 0); */
1611 1757 blv->found = 0;
1612 pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer;
1613 if (current_buffer == XBUFFER (*pvalbuf))
1614 *pvalbuf = Qnil;
1615 XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0;
1616 }
1617 } 1758 }
1618 1759
1619 /* If the symbol forwards into a C variable, then load the binding 1760 /* If the symbol forwards into a C variable, then load the binding
1620 for this buffer now. If C code modifies the variable before we 1761 for this buffer now. If C code modifies the variable before we
1621 load the binding in, then that new value will clobber the default 1762 load the binding in, then that new value will clobber the default
1622 binding the next time we unload it. */ 1763 binding the next time we unload it. */
1623 valcontents = XBUFFER_LOCAL_VALUE (sym->value)->realvalue; 1764 if (blv->fwd)
1624 if (INTFWDP (valcontents) || BOOLFWDP (valcontents) || OBJFWDP (valcontents)) 1765 swap_in_symval_forwarding (sym, blv);
1625 swap_in_symval_forwarding (variable, sym->value);
1626 1766
1627 return variable; 1767 return variable;
1628} 1768}
@@ -1634,31 +1774,43 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1634 (variable) 1774 (variable)
1635 register Lisp_Object variable; 1775 register Lisp_Object variable;
1636{ 1776{
1637 register Lisp_Object tem, valcontents; 1777 register Lisp_Object tem;
1778 struct Lisp_Buffer_Local_Value *blv;
1638 struct Lisp_Symbol *sym; 1779 struct Lisp_Symbol *sym;
1639 1780
1640 CHECK_SYMBOL (variable); 1781 CHECK_SYMBOL (variable);
1641 sym = indirect_variable (XSYMBOL (variable)); 1782 sym = XSYMBOL (variable);
1642
1643 valcontents = sym->value;
1644 1783
1645 if (BUFFER_OBJFWDP (valcontents)) 1784 start:
1785 switch (sym->redirect)
1646 { 1786 {
1647 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1787 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
1648 int idx = PER_BUFFER_IDX (offset); 1788 case SYMBOL_PLAINVAL: return variable;
1649 1789 case SYMBOL_FORWARDED:
1650 if (idx > 0) 1790 {
1651 { 1791 union Lisp_Fwd *valcontents = SYMBOL_FWD (sym);
1652 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 0); 1792 if (BUFFER_OBJFWDP (valcontents))
1653 PER_BUFFER_VALUE (current_buffer, offset) 1793 {
1654 = PER_BUFFER_DEFAULT (offset); 1794 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1655 } 1795 int idx = PER_BUFFER_IDX (offset);
1656 return variable; 1796
1797 if (idx > 0)
1798 {
1799 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 0);
1800 PER_BUFFER_VALUE (current_buffer, offset)
1801 = PER_BUFFER_DEFAULT (offset);
1802 }
1803 }
1804 return variable;
1805 }
1806 case SYMBOL_LOCALIZED:
1807 blv = SYMBOL_BLV (sym);
1808 if (blv->frame_local)
1809 return variable;
1810 break;
1811 default: abort ();
1657 } 1812 }
1658 1813
1659 if (!BUFFER_LOCAL_VALUEP (valcontents))
1660 return variable;
1661
1662 /* Get rid of this buffer's alist element, if any. */ 1814 /* Get rid of this buffer's alist element, if any. */
1663 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ 1815 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */
1664 tem = Fassq (variable, current_buffer->local_var_alist); 1816 tem = Fassq (variable, current_buffer->local_var_alist);
@@ -1670,14 +1822,13 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1670 loaded, recompute its value. We have to do it now, or else 1822 loaded, recompute its value. We have to do it now, or else
1671 forwarded objects won't work right. */ 1823 forwarded objects won't work right. */
1672 { 1824 {
1673 Lisp_Object *pvalbuf, buf; 1825 Lisp_Object buf; XSETBUFFER (buf, current_buffer);
1674 valcontents = sym->value; 1826 if (EQ (buf, blv->where))
1675 pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer;
1676 XSETBUFFER (buf, current_buffer);
1677 if (EQ (buf, *pvalbuf))
1678 { 1827 {
1679 *pvalbuf = Qnil; 1828 blv->where = Qnil;
1680 XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0; 1829 /* blv->valcell = blv->defcell;
1830 * SET_BLV_FOUND (blv, 0); */
1831 blv->found = 0;
1681 find_symbol_value (variable); 1832 find_symbol_value (variable);
1682 } 1833 }
1683 } 1834 }
@@ -1712,39 +1863,52 @@ frame-local bindings). */)
1712 (variable) 1863 (variable)
1713 register Lisp_Object variable; 1864 register Lisp_Object variable;
1714{ 1865{
1715 register Lisp_Object tem, valcontents, newval; 1866 int forwarded;
1867 union Lisp_Val_Fwd valcontents;
1716 struct Lisp_Symbol *sym; 1868 struct Lisp_Symbol *sym;
1869 struct Lisp_Buffer_Local_Value *blv = NULL;
1717 1870
1718 CHECK_SYMBOL (variable); 1871 CHECK_SYMBOL (variable);
1719 sym = indirect_variable (XSYMBOL (variable)); 1872 sym = XSYMBOL (variable);
1720 1873
1721 valcontents = sym->value; 1874 start:
1722 if (sym->constant || KBOARD_OBJFWDP (valcontents) 1875 switch (sym->redirect)
1723 || BUFFER_OBJFWDP (valcontents))
1724 error ("Symbol %s may not be frame-local", SDATA (sym->xname));
1725
1726 if (BUFFER_LOCAL_VALUEP (valcontents))
1727 { 1876 {
1728 if (!XBUFFER_LOCAL_VALUE (valcontents)->check_frame) 1877 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
1729 error ("Symbol %s may not be frame-local", SDATA (sym->xname)); 1878 case SYMBOL_PLAINVAL:
1730 return variable; 1879 forwarded = 0; valcontents.value = SYMBOL_VAL (sym);
1880 if (EQ (valcontents.value, Qunbound))
1881 valcontents.value = Qnil;
1882 break;
1883 case SYMBOL_LOCALIZED:
1884 if (SYMBOL_BLV (sym)->frame_local)
1885 return variable;
1886 else
1887 error ("Symbol %s may not be frame-local",
1888 SDATA (SYMBOL_NAME (variable)));
1889 case SYMBOL_FORWARDED:
1890 forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym);
1891 if (KBOARD_OBJFWDP (valcontents.fwd) || BUFFER_OBJFWDP (valcontents.fwd))
1892 error ("Symbol %s may not be frame-local",
1893 SDATA (SYMBOL_NAME (variable)));
1894 break;
1895 default: abort ();
1731 } 1896 }
1732 1897
1733 if (EQ (valcontents, Qunbound)) 1898 if (sym->constant)
1734 sym->value = Qnil; 1899 error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable)));
1735 tem = Fcons (Qnil, Fsymbol_value (variable)); 1900
1736 XSETCAR (tem, tem); 1901 blv = make_blv (sym, forwarded, valcontents);
1737 newval = allocate_misc (); 1902 blv->frame_local = 1;
1738 XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; 1903 sym->redirect = SYMBOL_LOCALIZED;
1739 XBUFFER_LOCAL_VALUE (newval)->realvalue = sym->value; 1904 SET_SYMBOL_BLV (sym, blv);
1740 XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; 1905 {
1741 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; 1906 Lisp_Object symbol;
1742 XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0; 1907 XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */
1743 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; 1908 if (let_shadows_global_binding_p (symbol))
1744 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; 1909 message ("Making %s frame-local while let-bound!",
1745 XBUFFER_LOCAL_VALUE (newval)->check_frame = 1; 1910 SDATA (SYMBOL_NAME (variable)));
1746 XBUFFER_LOCAL_VALUE (newval)->cdr = tem; 1911 }
1747 sym->value = newval;
1748 return variable; 1912 return variable;
1749} 1913}
1750 1914
@@ -1755,7 +1919,6 @@ BUFFER defaults to the current buffer. */)
1755 (variable, buffer) 1919 (variable, buffer)
1756 register Lisp_Object variable, buffer; 1920 register Lisp_Object variable, buffer;
1757{ 1921{
1758 Lisp_Object valcontents;
1759 register struct buffer *buf; 1922 register struct buffer *buf;
1760 struct Lisp_Symbol *sym; 1923 struct Lisp_Symbol *sym;
1761 1924
@@ -1768,29 +1931,46 @@ BUFFER defaults to the current buffer. */)
1768 } 1931 }
1769 1932
1770 CHECK_SYMBOL (variable); 1933 CHECK_SYMBOL (variable);
1771 sym = indirect_variable (XSYMBOL (variable)); 1934 sym = XSYMBOL (variable);
1772 XSETSYMBOL (variable, sym);
1773 1935
1774 valcontents = sym->value; 1936 start:
1775 if (BUFFER_LOCAL_VALUEP (valcontents)) 1937 switch (sym->redirect)
1776 { 1938 {
1777 Lisp_Object tail, elt; 1939 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
1778 1940 case SYMBOL_PLAINVAL: return Qnil;
1779 for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) 1941 case SYMBOL_LOCALIZED:
1780 { 1942 {
1781 elt = XCAR (tail); 1943 Lisp_Object tail, elt, tmp;
1782 if (EQ (variable, XCAR (elt))) 1944 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
1783 return Qt; 1945 XSETBUFFER (tmp, buf);
1784 } 1946
1785 } 1947 for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
1786 if (BUFFER_OBJFWDP (valcontents)) 1948 {
1787 { 1949 elt = XCAR (tail);
1788 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1950 if (EQ (variable, XCAR (elt)))
1789 int idx = PER_BUFFER_IDX (offset); 1951 {
1790 if (idx == -1 || PER_BUFFER_VALUE_P (buf, idx)) 1952 eassert (!blv->frame_local);
1791 return Qt; 1953 eassert (BLV_FOUND (blv) || !EQ (blv->where, tmp));
1954 return Qt;
1955 }
1956 }
1957 eassert (!BLV_FOUND (blv) || !EQ (blv->where, tmp));
1958 return Qnil;
1959 }
1960 case SYMBOL_FORWARDED:
1961 {
1962 union Lisp_Fwd *valcontents = SYMBOL_FWD (sym);
1963 if (BUFFER_OBJFWDP (valcontents))
1964 {
1965 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1966 int idx = PER_BUFFER_IDX (offset);
1967 if (idx == -1 || PER_BUFFER_VALUE_P (buf, idx))
1968 return Qt;
1969 }
1970 return Qnil;
1971 }
1972 default: abort ();
1792 } 1973 }
1793 return Qnil;
1794} 1974}
1795 1975
1796DEFUN ("local-variable-if-set-p", Flocal_variable_if_set_p, Slocal_variable_if_set_p, 1976DEFUN ("local-variable-if-set-p", Flocal_variable_if_set_p, Slocal_variable_if_set_p,
@@ -1804,40 +1984,29 @@ BUFFER defaults to the current buffer. */)
1804 (variable, buffer) 1984 (variable, buffer)
1805 register Lisp_Object variable, buffer; 1985 register Lisp_Object variable, buffer;
1806{ 1986{
1807 Lisp_Object valcontents;
1808 register struct buffer *buf;
1809 struct Lisp_Symbol *sym; 1987 struct Lisp_Symbol *sym;
1810 1988
1811 if (NILP (buffer))
1812 buf = current_buffer;
1813 else
1814 {
1815 CHECK_BUFFER (buffer);
1816 buf = XBUFFER (buffer);
1817 }
1818
1819 CHECK_SYMBOL (variable); 1989 CHECK_SYMBOL (variable);
1820 sym = indirect_variable (XSYMBOL (variable)); 1990 sym = XSYMBOL (variable);
1821 XSETSYMBOL (variable, sym);
1822 1991
1823 valcontents = sym->value; 1992 start:
1824 1993 switch (sym->redirect)
1825 if (BUFFER_OBJFWDP (valcontents))
1826 /* All these slots become local if they are set. */
1827 return Qt;
1828 else if (BUFFER_LOCAL_VALUEP (valcontents))
1829 { 1994 {
1830 Lisp_Object tail, elt; 1995 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
1831 if (XBUFFER_LOCAL_VALUE (valcontents)->local_if_set) 1996 case SYMBOL_PLAINVAL: return Qnil;
1832 return Qt; 1997 case SYMBOL_LOCALIZED:
1833 for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) 1998 {
1834 { 1999 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
1835 elt = XCAR (tail); 2000 if (blv->local_if_set)
1836 if (EQ (variable, XCAR (elt))) 2001 return Qt;
1837 return Qt; 2002 XSETSYMBOL (variable, sym); /* Update in case of aliasing. */
1838 } 2003 return Flocal_variable_p (variable, buffer);
2004 }
2005 case SYMBOL_FORWARDED:
2006 /* All BUFFER_OBJFWD slots become local if they are set. */
2007 return (BUFFER_OBJFWDP (SYMBOL_FWD (sym)) ? Qt : Qnil);
2008 default: abort ();
1839 } 2009 }
1840 return Qnil;
1841} 2010}
1842 2011
1843DEFUN ("variable-binding-locus", Fvariable_binding_locus, Svariable_binding_locus, 2012DEFUN ("variable-binding-locus", Fvariable_binding_locus, Svariable_binding_locus,
@@ -1849,30 +2018,40 @@ If the current binding is global (the default), the value is nil. */)
1849 (variable) 2018 (variable)
1850 register Lisp_Object variable; 2019 register Lisp_Object variable;
1851{ 2020{
1852 Lisp_Object valcontents;
1853 struct Lisp_Symbol *sym; 2021 struct Lisp_Symbol *sym;
1854 2022
1855 CHECK_SYMBOL (variable); 2023 CHECK_SYMBOL (variable);
1856 sym = indirect_variable (XSYMBOL (variable)); 2024 sym = XSYMBOL (variable);
1857 2025
1858 /* Make sure the current binding is actually swapped in. */ 2026 /* Make sure the current binding is actually swapped in. */
1859 find_symbol_value (variable); 2027 find_symbol_value (variable);
1860 2028
1861 valcontents = sym->value; 2029 start:
1862 2030 switch (sym->redirect)
1863 if (BUFFER_LOCAL_VALUEP (valcontents)
1864 || BUFFER_OBJFWDP (valcontents))
1865 { 2031 {
2032 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
2033 case SYMBOL_PLAINVAL: return Qnil;
2034 case SYMBOL_FORWARDED:
2035 {
2036 union Lisp_Fwd *valcontents = SYMBOL_FWD (sym);
2037 if (KBOARD_OBJFWDP (valcontents))
2038 return Fframe_terminal (Fselected_frame ());
2039 else if (!BUFFER_OBJFWDP (valcontents))
2040 return Qnil;
2041 }
2042 /* FALLTHROUGH */
2043 case SYMBOL_LOCALIZED:
1866 /* For a local variable, record both the symbol and which 2044 /* For a local variable, record both the symbol and which
1867 buffer's or frame's value we are saving. */ 2045 buffer's or frame's value we are saving. */
1868 if (!NILP (Flocal_variable_p (variable, Qnil))) 2046 if (!NILP (Flocal_variable_p (variable, Qnil)))
1869 return Fcurrent_buffer (); 2047 return Fcurrent_buffer ();
1870 else if (BUFFER_LOCAL_VALUEP (valcontents) 2048 else if (sym->redirect == SYMBOL_LOCALIZED
1871 && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame) 2049 && BLV_FOUND (SYMBOL_BLV (sym)))
1872 return XBUFFER_LOCAL_VALUE (valcontents)->frame; 2050 return SYMBOL_BLV (sym)->where;
2051 else
2052 return Qnil;
2053 default: abort ();
1873 } 2054 }
1874
1875 return Qnil;
1876} 2055}
1877 2056
1878/* This code is disabled now that we use the selected frame to return 2057/* This code is disabled now that we use the selected frame to return
diff --git a/src/dired.c b/src/dired.c
index 2240f6ec76e..a3ea23df2f6 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -935,9 +935,9 @@ DEFUN ("file-attributes", Ffile_attributes, Sfile_attributes, 1, 2, 0,
935Value is nil if specified file cannot be opened. 935Value is nil if specified file cannot be opened.
936 936
937ID-FORMAT specifies the preferred format of attributes uid and gid (see 937ID-FORMAT specifies the preferred format of attributes uid and gid (see
938below) - valid values are 'string and 'integer. The latter is the default, 938below) - valid values are 'string and 'integer. The latter is the
939but we plan to change that, so you should specify a non-nil value for 939default, but we plan to change that, so you should specify a non-nil value
940ID-FORMAT if you use the returned uid or gid. 940for ID-FORMAT if you use the returned uid or gid.
941 941
942Elements of the attribute list are: 942Elements of the attribute list are:
943 0. t for directory, string (name linked to) for symbolic link, or nil. 943 0. t for directory, string (name linked to) for symbolic link, or nil.
diff --git a/src/dispextern.h b/src/dispextern.h
index 00da256c43e..72c0b2ef414 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1956,6 +1956,7 @@ enum it_method {
1956 NUM_IT_METHODS 1956 NUM_IT_METHODS
1957}; 1957};
1958 1958
1959/* FIXME: What is this? Why 5? */
1959#define IT_STACK_SIZE 5 1960#define IT_STACK_SIZE 5
1960 1961
1961/* Iterator for composition (both for static and automatic). */ 1962/* Iterator for composition (both for static and automatic). */
@@ -2222,13 +2223,22 @@ struct it
2222 MODE_LINE_FACE_ID, etc, depending on what we are displaying. */ 2223 MODE_LINE_FACE_ID, etc, depending on what we are displaying. */
2223 int base_face_id; 2224 int base_face_id;
2224 2225
2225 /* If what == IT_CHARACTER, character and length in bytes. This is 2226 /* If `what' == IT_CHARACTER, the character and the length in bytes
2226 a character from a buffer or string. It may be different from 2227 of its multibyte sequence. The character comes from a buffer or
2227 the character displayed in case that 2228 a string. It may be different from the character displayed in
2228 unibyte_display_via_language_environment is set. 2229 case that unibyte_display_via_language_environment is set.
2229 2230
2230 If what == IT_COMPOSITION, the first component of a composition 2231 If `what' == IT_COMPOSITION, the first component of a composition
2231 and length in bytes of the composition. */ 2232 and length in bytes of the composition.
2233
2234 If `what' is anything else, these two are undefined (will
2235 probably hold values for the last IT_CHARACTER or IT_COMPOSITION
2236 traversed by the iterator.
2237
2238 The values are updated by get_next_display_element, so they are
2239 out of sync with the value returned by IT_CHARPOS between the
2240 time set_iterator_to_next advances the position and the time
2241 get_next_display_element loads the new values into c and len. */
2232 int c, len; 2242 int c, len;
2233 2243
2234 /* If what == IT_COMPOSITION, iterator substructure for the 2244 /* If what == IT_COMPOSITION, iterator substructure for the
@@ -2783,6 +2793,9 @@ enum tool_bar_item_idx
2783 /* Icon file name of right to left image when an RTL locale is used. */ 2793 /* Icon file name of right to left image when an RTL locale is used. */
2784 TOOL_BAR_ITEM_RTL_IMAGE, 2794 TOOL_BAR_ITEM_RTL_IMAGE,
2785 2795
2796 /* Label to show when text labels are enabled. */
2797 TOOL_BAR_ITEM_LABEL,
2798
2786 /* Sentinel = number of slots in tool_bar_items occupied by one 2799 /* Sentinel = number of slots in tool_bar_items occupied by one
2787 tool-bar item. */ 2800 tool-bar item. */
2788 TOOL_BAR_ITEM_NSLOTS 2801 TOOL_BAR_ITEM_NSLOTS
@@ -2804,6 +2817,15 @@ enum tool_bar_item_image
2804 2817
2805extern Lisp_Object Vtool_bar_button_margin; 2818extern Lisp_Object Vtool_bar_button_margin;
2806 2819
2820/* Tool bar style */
2821
2822extern Lisp_Object Vtool_bar_style;
2823
2824/* Maximum number of characters a label can have to be shown. */
2825
2826extern EMACS_INT tool_bar_max_label_size;
2827#define DEFAULT_TOOL_BAR_LABEL_SIZE 14
2828
2807/* Thickness of relief to draw around tool-bar buttons. */ 2829/* Thickness of relief to draw around tool-bar buttons. */
2808 2830
2809extern EMACS_INT tool_bar_button_relief; 2831extern EMACS_INT tool_bar_button_relief;
diff --git a/src/dispnew.c b/src/dispnew.c
index 2be00c9c3b0..7ab2bf35811 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -4251,7 +4251,9 @@ update_text_area (w, vpos)
4251 doesn't work with lbearing/rbearing), so we must do it 4251 doesn't work with lbearing/rbearing), so we must do it
4252 this way. */ 4252 this way. */
4253 if (vpos == w->phys_cursor.vpos 4253 if (vpos == w->phys_cursor.vpos
4254 && w->phys_cursor.hpos >= desired_row->used[TEXT_AREA]) 4254 && (desired_row->reversed_p
4255 ? (w->phys_cursor.hpos < 0)
4256 : (w->phys_cursor.hpos >= desired_row->used[TEXT_AREA])))
4255 { 4257 {
4256 w->phys_cursor_on_p = 0; 4258 w->phys_cursor_on_p = 0;
4257 x = -1; 4259 x = -1;
@@ -4415,7 +4417,7 @@ set_window_cursor_after_update (w)
4415 } 4417 }
4416 4418
4417 /* Window cursor can be out of sync for horizontally split windows. */ 4419 /* Window cursor can be out of sync for horizontally split windows. */
4418 hpos = max (0, hpos); 4420 hpos = max (-1, hpos); /* -1 is for when cursor is on the left fringe */
4419 hpos = min (w->current_matrix->matrix_w - 1, hpos); 4421 hpos = min (w->current_matrix->matrix_w - 1, hpos);
4420 vpos = max (0, vpos); 4422 vpos = max (0, vpos);
4421 vpos = min (w->current_matrix->nrows - 1, vpos); 4423 vpos = min (w->current_matrix->nrows - 1, vpos);
diff --git a/src/doc.c b/src/doc.c
index 303aed0486d..536d22c57a6 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -538,7 +538,7 @@ store_function_docstring (fun, offset)
538 { 538 {
539 tem = Fcdr (Fcdr (fun)); 539 tem = Fcdr (Fcdr (fun));
540 if (CONSP (tem) && INTEGERP (XCAR (tem))) 540 if (CONSP (tem) && INTEGERP (XCAR (tem)))
541 XSETCARFASTINT (tem, offset); 541 XSETCAR (tem, make_number (offset));
542 } 542 }
543 else if (EQ (tem, Qmacro)) 543 else if (EQ (tem, Qmacro))
544 store_function_docstring (XCDR (fun), offset); 544 store_function_docstring (XCDR (fun), offset);
diff --git a/src/ecrt0.c b/src/ecrt0.c
index 0d7d26d3685..458771319c7 100644
--- a/src/ecrt0.c
+++ b/src/ecrt0.c
@@ -61,15 +61,7 @@ int data_start = 0;
61 61
62char **environ; 62char **environ;
63 63
64#ifndef static
65/* On systems where the static storage class is usable, this function
66 should be declared as static. Otherwise, the static keyword has
67 been defined to be something else, and code for those systems must
68 take care of this declaration appropriately. */
69static start1 (); 64static start1 ();
70#endif
71
72#ifdef CRT0_DUMMIES
73 65
74/* Define symbol "start": here; some systems want that symbol. */ 66/* Define symbol "start": here; some systems want that symbol. */
75asm(" .text "); 67asm(" .text ");
@@ -83,7 +75,7 @@ _start ()
83} 75}
84 76
85static 77static
86start1 (CRT0_DUMMIES argc, xargv) 78start1 (bogus_fp, argc, xargv)
87 int argc; 79 int argc;
88 char *xargv; 80 char *xargv;
89{ 81{
@@ -98,7 +90,6 @@ start1 (CRT0_DUMMIES argc, xargv)
98 and optimize it out. */ 90 and optimize it out. */
99 (void) &start1; 91 (void) &start1;
100} 92}
101#endif /* CRT0_DUMMIES */
102 93
103/* arch-tag: 4025c2fb-d6b1-4d29-b1b6-8100b6bd1e74 94/* arch-tag: 4025c2fb-d6b1-4d29-b1b6-8100b6bd1e74
104 (do not change this comment) */ 95 (do not change this comment) */
diff --git a/src/emacs.c b/src/emacs.c
index 400a6b0e594..6b19b45d0b0 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -81,7 +81,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
81#endif 81#endif
82 82
83#ifdef HAVE_SETPGID 83#ifdef HAVE_SETPGID
84#if !defined (USG) || defined (BSD_PGRPS) 84#if !defined (USG)
85#undef setpgrp 85#undef setpgrp
86#define setpgrp setpgid 86#define setpgrp setpgid
87#endif 87#endif
@@ -193,11 +193,6 @@ EMACS_INT emacs_priority;
193 data on the first attempt to change it inside asynchronous code. */ 193 data on the first attempt to change it inside asynchronous code. */
194int running_asynch_code; 194int running_asynch_code;
195 195
196#ifdef BSD_PGRPS
197/* See sysdep.c. */
198extern int inherited_pgroup;
199#endif
200
201#if defined(HAVE_X_WINDOWS) || defined(HAVE_NS) 196#if defined(HAVE_X_WINDOWS) || defined(HAVE_NS)
202/* If non-zero, -d was specified, meaning we're using some window system. */ 197/* If non-zero, -d was specified, meaning we're using some window system. */
203int display_arg; 198int display_arg;
@@ -268,6 +263,7 @@ read the main documentation for these command-line arguments.\n\
268Initialization options:\n\ 263Initialization options:\n\
269\n\ 264\n\
270--batch do not do interactive display; implies -q\n\ 265--batch do not do interactive display; implies -q\n\
266--chdir DIR change to directory DIR\n\
271--daemon start a server in the background\n\ 267--daemon start a server in the background\n\
272--debug-init enable Emacs Lisp debugger for init file\n\ 268--debug-init enable Emacs Lisp debugger for init file\n\
273--display, -d DISPLAY use X server DISPLAY\n\ 269--display, -d DISPLAY use X server DISPLAY\n\
@@ -385,6 +381,9 @@ fatal_error_signal (sig)
385 { 381 {
386 fatal_error_in_progress = 1; 382 fatal_error_in_progress = 1;
387 383
384 if (sig == SIGTERM || sig == SIGHUP)
385 Fkill_emacs (make_number (sig));
386
388 shut_down_emacs (sig, 0, Qnil); 387 shut_down_emacs (sig, 0, Qnil);
389 } 388 }
390 389
@@ -765,6 +764,7 @@ main (int argc, char **argv)
765#ifdef NS_IMPL_COCOA 764#ifdef NS_IMPL_COCOA
766 char dname_arg2[80]; 765 char dname_arg2[80];
767#endif 766#endif
767 char *ch_to_dir;
768 768
769#if GC_MARK_STACK 769#if GC_MARK_STACK
770 extern Lisp_Object *stack_base; 770 extern Lisp_Object *stack_base;
@@ -832,6 +832,14 @@ main (int argc, char **argv)
832 exit (0); 832 exit (0);
833 } 833 }
834 } 834 }
835 if (argmatch (argv, argc, "-chdir", "--chdir", 2, &ch_to_dir, &skip_args))
836 if (chdir (ch_to_dir) == -1)
837 {
838 fprintf (stderr, "%s: Can't chdir to %s: %s\n",
839 argv[0], ch_to_dir, strerror (errno));
840 exit (1);
841 }
842
835 843
836#ifdef HAVE_PERSONALITY_LINUX32 844#ifdef HAVE_PERSONALITY_LINUX32
837 if (!initialized 845 if (!initialized
@@ -1174,17 +1182,9 @@ main (int argc, char **argv)
1174 1182
1175 if (! noninteractive) 1183 if (! noninteractive)
1176 { 1184 {
1177#ifdef BSD_PGRPS
1178 if (initialized)
1179 {
1180 inherited_pgroup = EMACS_GETPGRP (0);
1181 setpgrp (0, getpid ());
1182 }
1183#else
1184#if defined (USG5) && defined (INTERRUPT_INPUT) 1185#if defined (USG5) && defined (INTERRUPT_INPUT)
1185 setpgrp (); 1186 setpgrp ();
1186#endif 1187#endif
1187#endif
1188#if defined (HAVE_GTK_AND_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC) 1188#if defined (HAVE_GTK_AND_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC)
1189 { 1189 {
1190 extern void malloc_enable_thread P_ ((void)); 1190 extern void malloc_enable_thread P_ ((void));
@@ -1582,9 +1582,7 @@ main (int argc, char **argv)
1582 syms_of_ccl (); 1582 syms_of_ccl ();
1583 syms_of_character (); 1583 syms_of_character ();
1584 syms_of_cmds (); 1584 syms_of_cmds ();
1585#ifndef NO_DIR_LIBRARY
1586 syms_of_dired (); 1585 syms_of_dired ();
1587#endif /* not NO_DIR_LIBRARY */
1588 syms_of_display (); 1586 syms_of_display ();
1589 syms_of_doc (); 1587 syms_of_doc ();
1590 syms_of_editfns (); 1588 syms_of_editfns ();
@@ -1802,6 +1800,7 @@ struct standard_args
1802const struct standard_args standard_args[] = 1800const struct standard_args standard_args[] =
1803{ 1801{
1804 { "-version", "--version", 150, 0 }, 1802 { "-version", "--version", 150, 0 },
1803 { "-chdir", "--chdir", 130, 1 },
1805 { "-t", "--terminal", 120, 1 }, 1804 { "-t", "--terminal", 120, 1 },
1806 { "-nw", "--no-window-system", 110, 0 }, 1805 { "-nw", "--no-window-system", 110, 0 },
1807 { "-nw", "--no-windows", 110, 0 }, 1806 { "-nw", "--no-windows", 110, 0 },
diff --git a/src/eval.c b/src/eval.c
index 6609d3b5c8a..2a0330acc38 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -26,6 +26,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26#include "commands.h" 26#include "commands.h"
27#include "keyboard.h" 27#include "keyboard.h"
28#include "dispextern.h" 28#include "dispextern.h"
29#include "frame.h" /* For XFRAME. */
29 30
30#if HAVE_X_WINDOWS 31#if HAVE_X_WINDOWS
31#include "xterm.h" 32#include "xterm.h"
@@ -767,24 +768,43 @@ The return value is BASE-VARIABLE. */)
767 CHECK_SYMBOL (new_alias); 768 CHECK_SYMBOL (new_alias);
768 CHECK_SYMBOL (base_variable); 769 CHECK_SYMBOL (base_variable);
769 770
770 if (SYMBOL_CONSTANT_P (new_alias)) 771 sym = XSYMBOL (new_alias);
772
773 if (sym->constant)
774 /* Not sure why, but why not? */
771 error ("Cannot make a constant an alias"); 775 error ("Cannot make a constant an alias");
772 776
773 sym = XSYMBOL (new_alias); 777 switch (sym->redirect)
778 {
779 case SYMBOL_FORWARDED:
780 error ("Cannot make an internal variable an alias");
781 case SYMBOL_LOCALIZED:
782 error ("Don't know how to make a localized variable an alias");
783 }
784
774 /* http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg00834.html 785 /* http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg00834.html
775 If n_a is bound, but b_v is not, set the value of b_v to n_a. 786 If n_a is bound, but b_v is not, set the value of b_v to n_a,
776 This is for the sake of define-obsolete-variable-alias and user 787 so that old-code that affects n_a before the aliasing is setup
777 customizations. */ 788 still works. */
778 if (NILP (Fboundp (base_variable)) && !NILP (Fboundp (new_alias))) 789 if (NILP (Fboundp (base_variable)))
779 XSYMBOL(base_variable)->value = sym->value; 790 set_internal (base_variable, find_symbol_value (new_alias), Qnil, 1);
780 sym->indirect_variable = 1; 791
781 sym->value = base_variable; 792 {
793 struct specbinding *p;
794
795 for (p = specpdl_ptr - 1; p >= specpdl; p--)
796 if (p->func == NULL
797 && (EQ (new_alias,
798 CONSP (p->symbol) ? XCAR (p->symbol) : p->symbol)))
799 error ("Don't know how to make a let-bound variable an alias");
800 }
801
802 sym->redirect = SYMBOL_VARALIAS;
803 SET_SYMBOL_ALIAS (sym, XSYMBOL (base_variable));
782 sym->constant = SYMBOL_CONSTANT_P (base_variable); 804 sym->constant = SYMBOL_CONSTANT_P (base_variable);
783 LOADHIST_ATTACH (new_alias); 805 LOADHIST_ATTACH (new_alias);
784 if (!NILP (docstring)) 806 /* Even if docstring is nil: remove old docstring. */
785 Fput (new_alias, Qvariable_documentation, docstring); 807 Fput (new_alias, Qvariable_documentation, docstring);
786 else
787 Fput (new_alias, Qvariable_documentation, Qnil);
788 808
789 return base_variable; 809 return base_variable;
790} 810}
@@ -944,7 +964,7 @@ chain of symbols. */)
944 return Qnil; 964 return Qnil;
945 965
946 /* If indirect and there's an alias loop, don't check anything else. */ 966 /* If indirect and there's an alias loop, don't check anything else. */
947 if (XSYMBOL (variable)->indirect_variable 967 if (XSYMBOL (variable)->redirect == SYMBOL_VARALIAS
948 && NILP (internal_condition_case_1 (lisp_indirect_variable, variable, 968 && NILP (internal_condition_case_1 (lisp_indirect_variable, variable,
949 Qt, user_variable_p_eh))) 969 Qt, user_variable_p_eh)))
950 return Qnil; 970 return Qnil;
@@ -968,11 +988,11 @@ chain of symbols. */)
968 || (!NILP (Fget (variable, intern ("custom-autoload"))))) 988 || (!NILP (Fget (variable, intern ("custom-autoload")))))
969 return Qt; 989 return Qt;
970 990
971 if (!XSYMBOL (variable)->indirect_variable) 991 if (!(XSYMBOL (variable)->redirect == SYMBOL_VARALIAS))
972 return Qnil; 992 return Qnil;
973 993
974 /* An indirect variable? Let's follow the chain. */ 994 /* An indirect variable? Let's follow the chain. */
975 variable = XSYMBOL (variable)->value; 995 XSETSYMBOL (variable, SYMBOL_ALIAS (XSYMBOL (variable)));
976 } 996 }
977} 997}
978 998
@@ -1541,17 +1561,64 @@ internal_condition_case_1 (bfun, arg, handlers, hfun)
1541 return val; 1561 return val;
1542} 1562}
1543 1563
1564/* Like internal_condition_case_1 but call BFUN with ARG1 and ARG2 as
1565 its arguments. */
1566
1567Lisp_Object
1568internal_condition_case_2 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object),
1569 Lisp_Object arg1,
1570 Lisp_Object arg2,
1571 Lisp_Object handlers,
1572 Lisp_Object (*hfun) (Lisp_Object))
1573{
1574 Lisp_Object val;
1575 struct catchtag c;
1576 struct handler h;
1577
1578 /* Since Fsignal will close off all calls to x_catch_errors,
1579 we will get the wrong results if some are not closed now. */
1580#if HAVE_X_WINDOWS
1581 if (x_catching_errors ())
1582 abort ();
1583#endif
1584
1585 c.tag = Qnil;
1586 c.val = Qnil;
1587 c.backlist = backtrace_list;
1588 c.handlerlist = handlerlist;
1589 c.lisp_eval_depth = lisp_eval_depth;
1590 c.pdlcount = SPECPDL_INDEX ();
1591 c.poll_suppress_count = poll_suppress_count;
1592 c.interrupt_input_blocked = interrupt_input_blocked;
1593 c.gcpro = gcprolist;
1594 c.byte_stack = byte_stack_list;
1595 if (_setjmp (c.jmp))
1596 {
1597 return (*hfun) (c.val);
1598 }
1599 c.next = catchlist;
1600 catchlist = &c;
1601 h.handler = handlers;
1602 h.var = Qnil;
1603 h.next = handlerlist;
1604 h.tag = &c;
1605 handlerlist = &h;
1606
1607 val = (*bfun) (arg1, arg2);
1608 catchlist = c.next;
1609 handlerlist = h.next;
1610 return val;
1611}
1544 1612
1545/* Like internal_condition_case but call BFUN with NARGS as first, 1613/* Like internal_condition_case but call BFUN with NARGS as first,
1546 and ARGS as second argument. */ 1614 and ARGS as second argument. */
1547 1615
1548Lisp_Object 1616Lisp_Object
1549internal_condition_case_2 (bfun, nargs, args, handlers, hfun) 1617internal_condition_case_n (Lisp_Object (*bfun) (int, Lisp_Object*),
1550 Lisp_Object (*bfun) (); 1618 int nargs,
1551 int nargs; 1619 Lisp_Object *args,
1552 Lisp_Object *args; 1620 Lisp_Object handlers,
1553 Lisp_Object handlers; 1621 Lisp_Object (*hfun) (Lisp_Object))
1554 Lisp_Object (*hfun) ();
1555{ 1622{
1556 Lisp_Object val; 1623 Lisp_Object val;
1557 struct catchtag c; 1624 struct catchtag c;
@@ -2112,8 +2179,6 @@ this does nothing and returns nil. */)
2112 (function, file, docstring, interactive, type) 2179 (function, file, docstring, interactive, type)
2113 Lisp_Object function, file, docstring, interactive, type; 2180 Lisp_Object function, file, docstring, interactive, type;
2114{ 2181{
2115 Lisp_Object args[4];
2116
2117 CHECK_SYMBOL (function); 2182 CHECK_SYMBOL (function);
2118 CHECK_STRING (file); 2183 CHECK_STRING (file);
2119 2184
@@ -2129,8 +2194,11 @@ this does nothing and returns nil. */)
2129 LOADHIST_ATTACH (Fcons (Qautoload, function)); 2194 LOADHIST_ATTACH (Fcons (Qautoload, function));
2130 else 2195 else
2131 /* We don't want the docstring in purespace (instead, 2196 /* We don't want the docstring in purespace (instead,
2132 Snarf-documentation should (hopefully) overwrite it). */ 2197 Snarf-documentation should (hopefully) overwrite it).
2133 docstring = make_number (0); 2198 We used to use 0 here, but that leads to accidental sharing in
2199 purecopy's hash-consing, so we use a (hopefully) unique integer
2200 instead. */
2201 docstring = make_number (XHASH (function));
2134 return Ffset (function, 2202 return Ffset (function,
2135 Fpurecopy (list5 (Qautoload, file, docstring, 2203 Fpurecopy (list5 (Qautoload, file, docstring,
2136 interactive, type))); 2204 interactive, type)));
@@ -2764,7 +2832,6 @@ apply1 (fn, arg)
2764 if (NILP (arg)) 2832 if (NILP (arg))
2765 RETURN_UNGCPRO (Ffuncall (1, &fn)); 2833 RETURN_UNGCPRO (Ffuncall (1, &fn));
2766 gcpro1.nvars = 2; 2834 gcpro1.nvars = 2;
2767#ifdef NO_ARG_ARRAY
2768 { 2835 {
2769 Lisp_Object args[2]; 2836 Lisp_Object args[2];
2770 args[0] = fn; 2837 args[0] = fn;
@@ -2772,9 +2839,6 @@ apply1 (fn, arg)
2772 gcpro1.var = args; 2839 gcpro1.var = args;
2773 RETURN_UNGCPRO (Fapply (2, args)); 2840 RETURN_UNGCPRO (Fapply (2, args));
2774 } 2841 }
2775#else /* not NO_ARG_ARRAY */
2776 RETURN_UNGCPRO (Fapply (2, &fn));
2777#endif /* not NO_ARG_ARRAY */
2778} 2842}
2779 2843
2780/* Call function fn on no arguments */ 2844/* Call function fn on no arguments */
@@ -2795,7 +2859,6 @@ call1 (fn, arg1)
2795 Lisp_Object fn, arg1; 2859 Lisp_Object fn, arg1;
2796{ 2860{
2797 struct gcpro gcpro1; 2861 struct gcpro gcpro1;
2798#ifdef NO_ARG_ARRAY
2799 Lisp_Object args[2]; 2862 Lisp_Object args[2];
2800 2863
2801 args[0] = fn; 2864 args[0] = fn;
@@ -2803,11 +2866,6 @@ call1 (fn, arg1)
2803 GCPRO1 (args[0]); 2866 GCPRO1 (args[0]);
2804 gcpro1.nvars = 2; 2867 gcpro1.nvars = 2;
2805 RETURN_UNGCPRO (Ffuncall (2, args)); 2868 RETURN_UNGCPRO (Ffuncall (2, args));
2806#else /* not NO_ARG_ARRAY */
2807 GCPRO1 (fn);
2808 gcpro1.nvars = 2;
2809 RETURN_UNGCPRO (Ffuncall (2, &fn));
2810#endif /* not NO_ARG_ARRAY */
2811} 2869}
2812 2870
2813/* Call function fn with 2 arguments arg1, arg2 */ 2871/* Call function fn with 2 arguments arg1, arg2 */
@@ -2817,7 +2875,6 @@ call2 (fn, arg1, arg2)
2817 Lisp_Object fn, arg1, arg2; 2875 Lisp_Object fn, arg1, arg2;
2818{ 2876{
2819 struct gcpro gcpro1; 2877 struct gcpro gcpro1;
2820#ifdef NO_ARG_ARRAY
2821 Lisp_Object args[3]; 2878 Lisp_Object args[3];
2822 args[0] = fn; 2879 args[0] = fn;
2823 args[1] = arg1; 2880 args[1] = arg1;
@@ -2825,11 +2882,6 @@ call2 (fn, arg1, arg2)
2825 GCPRO1 (args[0]); 2882 GCPRO1 (args[0]);
2826 gcpro1.nvars = 3; 2883 gcpro1.nvars = 3;
2827 RETURN_UNGCPRO (Ffuncall (3, args)); 2884 RETURN_UNGCPRO (Ffuncall (3, args));
2828#else /* not NO_ARG_ARRAY */
2829 GCPRO1 (fn);
2830 gcpro1.nvars = 3;
2831 RETURN_UNGCPRO (Ffuncall (3, &fn));
2832#endif /* not NO_ARG_ARRAY */
2833} 2885}
2834 2886
2835/* Call function fn with 3 arguments arg1, arg2, arg3 */ 2887/* Call function fn with 3 arguments arg1, arg2, arg3 */
@@ -2839,7 +2891,6 @@ call3 (fn, arg1, arg2, arg3)
2839 Lisp_Object fn, arg1, arg2, arg3; 2891 Lisp_Object fn, arg1, arg2, arg3;
2840{ 2892{
2841 struct gcpro gcpro1; 2893 struct gcpro gcpro1;
2842#ifdef NO_ARG_ARRAY
2843 Lisp_Object args[4]; 2894 Lisp_Object args[4];
2844 args[0] = fn; 2895 args[0] = fn;
2845 args[1] = arg1; 2896 args[1] = arg1;
@@ -2848,11 +2899,6 @@ call3 (fn, arg1, arg2, arg3)
2848 GCPRO1 (args[0]); 2899 GCPRO1 (args[0]);
2849 gcpro1.nvars = 4; 2900 gcpro1.nvars = 4;
2850 RETURN_UNGCPRO (Ffuncall (4, args)); 2901 RETURN_UNGCPRO (Ffuncall (4, args));
2851#else /* not NO_ARG_ARRAY */
2852 GCPRO1 (fn);
2853 gcpro1.nvars = 4;
2854 RETURN_UNGCPRO (Ffuncall (4, &fn));
2855#endif /* not NO_ARG_ARRAY */
2856} 2902}
2857 2903
2858/* Call function fn with 4 arguments arg1, arg2, arg3, arg4 */ 2904/* Call function fn with 4 arguments arg1, arg2, arg3, arg4 */
@@ -2862,7 +2908,6 @@ call4 (fn, arg1, arg2, arg3, arg4)
2862 Lisp_Object fn, arg1, arg2, arg3, arg4; 2908 Lisp_Object fn, arg1, arg2, arg3, arg4;
2863{ 2909{
2864 struct gcpro gcpro1; 2910 struct gcpro gcpro1;
2865#ifdef NO_ARG_ARRAY
2866 Lisp_Object args[5]; 2911 Lisp_Object args[5];
2867 args[0] = fn; 2912 args[0] = fn;
2868 args[1] = arg1; 2913 args[1] = arg1;
@@ -2872,11 +2917,6 @@ call4 (fn, arg1, arg2, arg3, arg4)
2872 GCPRO1 (args[0]); 2917 GCPRO1 (args[0]);
2873 gcpro1.nvars = 5; 2918 gcpro1.nvars = 5;
2874 RETURN_UNGCPRO (Ffuncall (5, args)); 2919 RETURN_UNGCPRO (Ffuncall (5, args));
2875#else /* not NO_ARG_ARRAY */
2876 GCPRO1 (fn);
2877 gcpro1.nvars = 5;
2878 RETURN_UNGCPRO (Ffuncall (5, &fn));
2879#endif /* not NO_ARG_ARRAY */
2880} 2920}
2881 2921
2882/* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5 */ 2922/* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5 */
@@ -2886,7 +2926,6 @@ call5 (fn, arg1, arg2, arg3, arg4, arg5)
2886 Lisp_Object fn, arg1, arg2, arg3, arg4, arg5; 2926 Lisp_Object fn, arg1, arg2, arg3, arg4, arg5;
2887{ 2927{
2888 struct gcpro gcpro1; 2928 struct gcpro gcpro1;
2889#ifdef NO_ARG_ARRAY
2890 Lisp_Object args[6]; 2929 Lisp_Object args[6];
2891 args[0] = fn; 2930 args[0] = fn;
2892 args[1] = arg1; 2931 args[1] = arg1;
@@ -2897,11 +2936,6 @@ call5 (fn, arg1, arg2, arg3, arg4, arg5)
2897 GCPRO1 (args[0]); 2936 GCPRO1 (args[0]);
2898 gcpro1.nvars = 6; 2937 gcpro1.nvars = 6;
2899 RETURN_UNGCPRO (Ffuncall (6, args)); 2938 RETURN_UNGCPRO (Ffuncall (6, args));
2900#else /* not NO_ARG_ARRAY */
2901 GCPRO1 (fn);
2902 gcpro1.nvars = 6;
2903 RETURN_UNGCPRO (Ffuncall (6, &fn));
2904#endif /* not NO_ARG_ARRAY */
2905} 2939}
2906 2940
2907/* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6 */ 2941/* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6 */
@@ -2911,7 +2945,6 @@ call6 (fn, arg1, arg2, arg3, arg4, arg5, arg6)
2911 Lisp_Object fn, arg1, arg2, arg3, arg4, arg5, arg6; 2945 Lisp_Object fn, arg1, arg2, arg3, arg4, arg5, arg6;
2912{ 2946{
2913 struct gcpro gcpro1; 2947 struct gcpro gcpro1;
2914#ifdef NO_ARG_ARRAY
2915 Lisp_Object args[7]; 2948 Lisp_Object args[7];
2916 args[0] = fn; 2949 args[0] = fn;
2917 args[1] = arg1; 2950 args[1] = arg1;
@@ -2923,11 +2956,27 @@ call6 (fn, arg1, arg2, arg3, arg4, arg5, arg6)
2923 GCPRO1 (args[0]); 2956 GCPRO1 (args[0]);
2924 gcpro1.nvars = 7; 2957 gcpro1.nvars = 7;
2925 RETURN_UNGCPRO (Ffuncall (7, args)); 2958 RETURN_UNGCPRO (Ffuncall (7, args));
2926#else /* not NO_ARG_ARRAY */ 2959}
2927 GCPRO1 (fn); 2960
2928 gcpro1.nvars = 7; 2961/* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7 */
2929 RETURN_UNGCPRO (Ffuncall (7, &fn)); 2962/* ARGSUSED */
2930#endif /* not NO_ARG_ARRAY */ 2963Lisp_Object
2964call7 (fn, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
2965 Lisp_Object fn, arg1, arg2, arg3, arg4, arg5, arg6, arg7;
2966{
2967 struct gcpro gcpro1;
2968 Lisp_Object args[8];
2969 args[0] = fn;
2970 args[1] = arg1;
2971 args[2] = arg2;
2972 args[3] = arg3;
2973 args[4] = arg4;
2974 args[5] = arg5;
2975 args[6] = arg6;
2976 args[7] = arg7;
2977 GCPRO1 (args[0]);
2978 gcpro1.nvars = 8;
2979 RETURN_UNGCPRO (Ffuncall (8, args));
2931} 2980}
2932 2981
2933/* The caller should GCPRO all the elements of ARGS. */ 2982/* The caller should GCPRO all the elements of ARGS. */
@@ -3263,78 +3312,94 @@ void
3263specbind (symbol, value) 3312specbind (symbol, value)
3264 Lisp_Object symbol, value; 3313 Lisp_Object symbol, value;
3265{ 3314{
3266 Lisp_Object valcontents; 3315 struct Lisp_Symbol *sym;
3316
3317 eassert (!handling_signal);
3267 3318
3268 CHECK_SYMBOL (symbol); 3319 CHECK_SYMBOL (symbol);
3320 sym = XSYMBOL (symbol);
3269 if (specpdl_ptr == specpdl + specpdl_size) 3321 if (specpdl_ptr == specpdl + specpdl_size)
3270 grow_specpdl (); 3322 grow_specpdl ();
3271 3323
3272 /* The most common case is that of a non-constant symbol with a 3324 start:
3273 trivial value. Make that as fast as we can. */ 3325 switch (sym->redirect)
3274 valcontents = SYMBOL_VALUE (symbol); 3326 {
3275 if (!MISCP (valcontents) && !SYMBOL_CONSTANT_P (symbol)) 3327 case SYMBOL_VARALIAS:
3276 { 3328 sym = indirect_variable (sym); XSETSYMBOL (symbol, sym); goto start;
3277 specpdl_ptr->symbol = symbol; 3329 case SYMBOL_PLAINVAL:
3278 specpdl_ptr->old_value = valcontents; 3330 { /* The most common case is that of a non-constant symbol with a
3279 specpdl_ptr->func = NULL; 3331 trivial value. Make that as fast as we can. */
3280 ++specpdl_ptr; 3332 specpdl_ptr->symbol = symbol;
3281 SET_SYMBOL_VALUE (symbol, value); 3333 specpdl_ptr->old_value = SYMBOL_VAL (sym);
3282 } 3334 specpdl_ptr->func = NULL;
3283 else 3335 ++specpdl_ptr;
3284 { 3336 if (!sym->constant)
3285 Lisp_Object ovalue = find_symbol_value (symbol); 3337 SET_SYMBOL_VAL (sym, value);
3286 specpdl_ptr->func = 0;
3287 specpdl_ptr->old_value = ovalue;
3288
3289 valcontents = XSYMBOL (symbol)->value;
3290
3291 if (BUFFER_LOCAL_VALUEP (valcontents)
3292 || BUFFER_OBJFWDP (valcontents))
3293 {
3294 Lisp_Object where, current_buffer;
3295
3296 current_buffer = Fcurrent_buffer ();
3297
3298 /* For a local variable, record both the symbol and which
3299 buffer's or frame's value we are saving. */
3300 if (!NILP (Flocal_variable_p (symbol, Qnil)))
3301 where = current_buffer;
3302 else if (BUFFER_LOCAL_VALUEP (valcontents)
3303 && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame)
3304 where = XBUFFER_LOCAL_VALUE (valcontents)->frame;
3305 else 3338 else
3306 where = Qnil; 3339 set_internal (symbol, value, Qnil, 1);
3307 3340 break;
3308 /* We're not using the `unused' slot in the specbinding
3309 structure because this would mean we have to do more
3310 work for simple variables. */
3311 specpdl_ptr->symbol = Fcons (symbol, Fcons (where, current_buffer));
3312
3313 /* If SYMBOL is a per-buffer variable which doesn't have a
3314 buffer-local value here, make the `let' change the global
3315 value by changing the value of SYMBOL in all buffers not
3316 having their own value. This is consistent with what
3317 happens with other buffer-local variables. */
3318 if (NILP (where)
3319 && BUFFER_OBJFWDP (valcontents))
3320 {
3321 ++specpdl_ptr;
3322 Fset_default (symbol, value);
3323 return;
3324 }
3325 } 3341 }
3326 else 3342 case SYMBOL_LOCALIZED: case SYMBOL_FORWARDED:
3327 specpdl_ptr->symbol = symbol; 3343 {
3328 3344 Lisp_Object ovalue = find_symbol_value (symbol);
3329 specpdl_ptr++; 3345 specpdl_ptr->func = 0;
3330 /* We used to do 3346 specpdl_ptr->old_value = ovalue;
3331 if (BUFFER_OBJFWDP (ovalue) || KBOARD_OBJFWDP (ovalue)) 3347
3332 store_symval_forwarding (symbol, ovalue, value, NULL); 3348 eassert (sym->redirect != SYMBOL_LOCALIZED
3333 else 3349 || (EQ (SYMBOL_BLV (sym)->where,
3334 but ovalue comes from find_symbol_value which should never return 3350 SYMBOL_BLV (sym)->frame_local ?
3335 such an internal value. */ 3351 Fselected_frame () : Fcurrent_buffer ())));
3336 eassert (!(BUFFER_OBJFWDP (ovalue) || KBOARD_OBJFWDP (ovalue))); 3352
3337 set_internal (symbol, value, 0, 1); 3353 if (sym->redirect == SYMBOL_LOCALIZED
3354 || BUFFER_OBJFWDP (SYMBOL_FWD (sym)))
3355 {
3356 Lisp_Object where, cur_buf = Fcurrent_buffer ();
3357
3358 /* For a local variable, record both the symbol and which
3359 buffer's or frame's value we are saving. */
3360 if (!NILP (Flocal_variable_p (symbol, Qnil)))
3361 {
3362 eassert (sym->redirect != SYMBOL_LOCALIZED
3363 || (BLV_FOUND (SYMBOL_BLV (sym))
3364 && EQ (cur_buf, SYMBOL_BLV (sym)->where)));
3365 where = cur_buf;
3366 }
3367 else if (sym->redirect == SYMBOL_LOCALIZED
3368 && BLV_FOUND (SYMBOL_BLV (sym)))
3369 where = SYMBOL_BLV (sym)->where;
3370 else
3371 where = Qnil;
3372
3373 /* We're not using the `unused' slot in the specbinding
3374 structure because this would mean we have to do more
3375 work for simple variables. */
3376 /* FIXME: The third value `current_buffer' is only used in
3377 let_shadows_buffer_binding_p which is itself only used
3378 in set_internal for local_if_set. */
3379 specpdl_ptr->symbol = Fcons (symbol, Fcons (where, cur_buf));
3380
3381 /* If SYMBOL is a per-buffer variable which doesn't have a
3382 buffer-local value here, make the `let' change the global
3383 value by changing the value of SYMBOL in all buffers not
3384 having their own value. This is consistent with what
3385 happens with other buffer-local variables. */
3386 if (NILP (where)
3387 && sym->redirect == SYMBOL_FORWARDED)
3388 {
3389 eassert (BUFFER_OBJFWDP (SYMBOL_FWD (sym)));
3390 ++specpdl_ptr;
3391 Fset_default (symbol, value);
3392 return;
3393 }
3394 }
3395 else
3396 specpdl_ptr->symbol = symbol;
3397
3398 specpdl_ptr++;
3399 set_internal (symbol, value, Qnil, 1);
3400 break;
3401 }
3402 default: abort ();
3338 } 3403 }
3339} 3404}
3340 3405
@@ -3393,21 +3458,26 @@ unbind_to (count, value)
3393 3458
3394 if (NILP (where)) 3459 if (NILP (where))
3395 Fset_default (symbol, this_binding.old_value); 3460 Fset_default (symbol, this_binding.old_value);
3461 /* If `where' is non-nil, reset the value in the appropriate
3462 local binding, but only if that binding still exists. */
3396 else if (BUFFERP (where)) 3463 else if (BUFFERP (where))
3397 set_internal (symbol, this_binding.old_value, XBUFFER (where), 1); 3464 {
3398 else 3465 if (BUFFERP (where)
3399 set_internal (symbol, this_binding.old_value, NULL, 1); 3466 ? !NILP (Flocal_variable_p (symbol, where))
3467 : !NILP (Fassq (symbol, XFRAME (where)->param_alist)))
3468 set_internal (symbol, this_binding.old_value, where, 1);
3469 }
3400 } 3470 }
3471 /* If variable has a trivial value (no forwarding), we can
3472 just set it. No need to check for constant symbols here,
3473 since that was already done by specbind. */
3474 else if (XSYMBOL (this_binding.symbol)->redirect == SYMBOL_PLAINVAL)
3475 SET_SYMBOL_VAL (XSYMBOL (this_binding.symbol),
3476 this_binding.old_value);
3401 else 3477 else
3402 { 3478 /* NOTE: we only ever come here if make_local_foo was used for
3403 /* If variable has a trivial value (no forwarding), we can 3479 the first time on this var within this let. */
3404 just set it. No need to check for constant symbols here, 3480 Fset_default (this_binding.symbol, this_binding.old_value);
3405 since that was already done by specbind. */
3406 if (!MISCP (SYMBOL_VALUE (this_binding.symbol)))
3407 SET_SYMBOL_VALUE (this_binding.symbol, this_binding.old_value);
3408 else
3409 set_internal (this_binding.symbol, this_binding.old_value, 0, 1);
3410 }
3411 } 3481 }
3412 3482
3413 if (NILP (Vquit_flag) && !NILP (quitf)) 3483 if (NILP (Vquit_flag) && !NILP (quitf))
diff --git a/src/fileio.c b/src/fileio.c
index e9440adabe0..85685ebc9c4 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -53,6 +53,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
53#include <ctype.h> 53#include <ctype.h>
54#include <errno.h> 54#include <errno.h>
55 55
56#ifdef HAVE_LIBSELINUX
57#include <selinux/selinux.h>
58#include <selinux/context.h>
59#endif
60
56#include "lisp.h" 61#include "lisp.h"
57#include "intervals.h" 62#include "intervals.h"
58#include "buffer.h" 63#include "buffer.h"
@@ -294,7 +299,7 @@ close_file_unwind (fd)
294 299
295/* Restore point, having saved it as a marker. */ 300/* Restore point, having saved it as a marker. */
296 301
297static Lisp_Object 302Lisp_Object
298restore_point_unwind (location) 303restore_point_unwind (location)
299 Lisp_Object location; 304 Lisp_Object location;
300{ 305{
@@ -331,6 +336,8 @@ Lisp_Object Qfile_accessible_directory_p;
331Lisp_Object Qfile_modes; 336Lisp_Object Qfile_modes;
332Lisp_Object Qset_file_modes; 337Lisp_Object Qset_file_modes;
333Lisp_Object Qset_file_times; 338Lisp_Object Qset_file_times;
339Lisp_Object Qfile_selinux_context;
340Lisp_Object Qset_file_selinux_context;
334Lisp_Object Qfile_newer_than_file_p; 341Lisp_Object Qfile_newer_than_file_p;
335Lisp_Object Qinsert_file_contents; 342Lisp_Object Qinsert_file_contents;
336Lisp_Object Qwrite_region; 343Lisp_Object Qwrite_region;
@@ -1894,7 +1901,7 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
1894 return; 1901 return;
1895} 1902}
1896 1903
1897DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 5, 1904DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 6,
1898 "fCopy file: \nGCopy %s to file: \np\nP", 1905 "fCopy file: \nGCopy %s to file: \np\nP",
1899 doc: /* Copy FILE to NEWNAME. Both args must be strings. 1906 doc: /* Copy FILE to NEWNAME. Both args must be strings.
1900If NEWNAME names a directory, copy FILE there. 1907If NEWNAME names a directory, copy FILE there.
@@ -1916,10 +1923,13 @@ last-modified time as the old one. (This works on only some systems.)
1916A prefix arg makes KEEP-TIME non-nil. 1923A prefix arg makes KEEP-TIME non-nil.
1917 1924
1918If PRESERVE-UID-GID is non-nil, we try to transfer the 1925If PRESERVE-UID-GID is non-nil, we try to transfer the
1919uid and gid of FILE to NEWNAME. */) 1926uid and gid of FILE to NEWNAME.
1920 (file, newname, ok_if_already_exists, keep_time, preserve_uid_gid) 1927
1928If PRESERVE-SELINUX-CONTEXT is non-nil and SELinux is enabled
1929on the system, we copy the SELinux context of FILE to NEWNAME. */)
1930 (file, newname, ok_if_already_exists, keep_time, preserve_uid_gid, preserve_selinux_context)
1921 Lisp_Object file, newname, ok_if_already_exists, keep_time; 1931 Lisp_Object file, newname, ok_if_already_exists, keep_time;
1922 Lisp_Object preserve_uid_gid; 1932 Lisp_Object preserve_uid_gid, preserve_selinux_context;
1923{ 1933{
1924 int ifd, ofd, n; 1934 int ifd, ofd, n;
1925 char buf[16 * 1024]; 1935 char buf[16 * 1024];
@@ -1929,6 +1939,10 @@ uid and gid of FILE to NEWNAME. */)
1929 int count = SPECPDL_INDEX (); 1939 int count = SPECPDL_INDEX ();
1930 int input_file_statable_p; 1940 int input_file_statable_p;
1931 Lisp_Object encoded_file, encoded_newname; 1941 Lisp_Object encoded_file, encoded_newname;
1942#if HAVE_LIBSELINUX
1943 security_context_t con;
1944 int fail, conlength = 0;
1945#endif
1932 1946
1933 encoded_file = encoded_newname = Qnil; 1947 encoded_file = encoded_newname = Qnil;
1934 GCPRO4 (file, newname, encoded_file, encoded_newname); 1948 GCPRO4 (file, newname, encoded_file, encoded_newname);
@@ -1949,8 +1963,9 @@ uid and gid of FILE to NEWNAME. */)
1949 if (NILP (handler)) 1963 if (NILP (handler))
1950 handler = Ffind_file_name_handler (newname, Qcopy_file); 1964 handler = Ffind_file_name_handler (newname, Qcopy_file);
1951 if (!NILP (handler)) 1965 if (!NILP (handler))
1952 RETURN_UNGCPRO (call6 (handler, Qcopy_file, file, newname, 1966 RETURN_UNGCPRO (call7 (handler, Qcopy_file, file, newname,
1953 ok_if_already_exists, keep_time, preserve_uid_gid)); 1967 ok_if_already_exists, keep_time, preserve_uid_gid,
1968 preserve_selinux_context));
1954 1969
1955 encoded_file = ENCODE_FILE (file); 1970 encoded_file = ENCODE_FILE (file);
1956 encoded_newname = ENCODE_FILE (newname); 1971 encoded_newname = ENCODE_FILE (newname);
@@ -2004,6 +2019,15 @@ uid and gid of FILE to NEWNAME. */)
2004 copyable by us. */ 2019 copyable by us. */
2005 input_file_statable_p = (fstat (ifd, &st) >= 0); 2020 input_file_statable_p = (fstat (ifd, &st) >= 0);
2006 2021
2022#if HAVE_LIBSELINUX
2023 if (!NILP (preserve_selinux_context) && is_selinux_enabled ())
2024 {
2025 conlength = fgetfilecon (ifd, &con);
2026 if (conlength == -1)
2027 report_file_error ("Doing fgetfilecon", Fcons (file, Qnil));
2028 }
2029#endif
2030
2007 if (out_st.st_mode != 0 2031 if (out_st.st_mode != 0
2008 && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino) 2032 && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino)
2009 { 2033 {
@@ -2061,6 +2085,18 @@ uid and gid of FILE to NEWNAME. */)
2061 } 2085 }
2062#endif /* not MSDOS */ 2086#endif /* not MSDOS */
2063 2087
2088#if HAVE_LIBSELINUX
2089 if (conlength > 0)
2090 {
2091 /* Set the modified context back to the file. */
2092 fail = fsetfilecon (ofd, con);
2093 if (fail)
2094 report_file_error ("Doing fsetfilecon", Fcons (newname, Qnil));
2095
2096 freecon (con);
2097 }
2098#endif
2099
2064 /* Closing the output clobbers the file times on some systems. */ 2100 /* Closing the output clobbers the file times on some systems. */
2065 if (emacs_close (ofd) < 0) 2101 if (emacs_close (ofd) < 0)
2066 report_file_error ("I/O error", Fcons (newname, Qnil)); 2102 report_file_error ("I/O error", Fcons (newname, Qnil));
@@ -2158,11 +2194,17 @@ DEFUN ("delete-directory-internal", Fdelete_directory_internal,
2158 return Qnil; 2194 return Qnil;
2159} 2195}
2160 2196
2161DEFUN ("delete-file", Fdelete_file, Sdelete_file, 1, 1, "fDelete file: ", 2197DEFUN ("delete-file", Fdelete_file, Sdelete_file, 1, 2, "fDelete file: \nP",
2162 doc: /* Delete file named FILENAME. If it is a symlink, remove the symlink. 2198 doc: /* Delete file named FILENAME. If it is a symlink, remove the symlink.
2163If file has multiple names, it continues to exist with the other names. */) 2199If file has multiple names, it continues to exist with the other names.
2164 (filename) 2200
2201If optional arg FORCE is non-nil, really delete the file regardless of
2202`delete-by-moving-to-trash'. Otherwise, \"deleting\" actually moves
2203it to the system's trash can if `delete-by-moving-to-trash' is non-nil.
2204Interactively, FORCE is non-nil if called with a prefix arg. */)
2205 (filename, force)
2165 Lisp_Object filename; 2206 Lisp_Object filename;
2207 Lisp_Object force;
2166{ 2208{
2167 Lisp_Object handler; 2209 Lisp_Object handler;
2168 Lisp_Object encoded_file; 2210 Lisp_Object encoded_file;
@@ -2181,7 +2223,7 @@ If file has multiple names, it continues to exist with the other names. */)
2181 if (!NILP (handler)) 2223 if (!NILP (handler))
2182 return call2 (handler, Qdelete_file, filename); 2224 return call2 (handler, Qdelete_file, filename);
2183 2225
2184 if (delete_by_moving_to_trash) 2226 if (delete_by_moving_to_trash && NILP (force))
2185 return call1 (Qmove_file_to_trash, filename); 2227 return call1 (Qmove_file_to_trash, filename);
2186 2228
2187 encoded_file = ENCODE_FILE (filename); 2229 encoded_file = ENCODE_FILE (filename);
@@ -2198,14 +2240,15 @@ internal_delete_file_1 (ignore)
2198 return Qt; 2240 return Qt;
2199} 2241}
2200 2242
2201/* Delete file FILENAME, returning 1 if successful and 0 if failed. */ 2243/* Delete file FILENAME, returning 1 if successful and 0 if failed.
2244 FORCE means to ignore `delete-by-moving-to-trash'. */
2202 2245
2203int 2246int
2204internal_delete_file (filename) 2247internal_delete_file (Lisp_Object filename, Lisp_Object force)
2205 Lisp_Object filename;
2206{ 2248{
2207 Lisp_Object tem; 2249 Lisp_Object tem;
2208 tem = internal_condition_case_1 (Fdelete_file, filename, 2250
2251 tem = internal_condition_case_2 (Fdelete_file, filename, force,
2209 Qt, internal_delete_file_1); 2252 Qt, internal_delete_file_1);
2210 return NILP (tem); 2253 return NILP (tem);
2211} 2254}
@@ -2287,7 +2330,7 @@ This is what happens in interactive use with M-x. */)
2287 have copy-file prompt again. */ 2330 have copy-file prompt again. */
2288 Fcopy_file (file, newname, 2331 Fcopy_file (file, newname,
2289 NILP (ok_if_already_exists) ? Qnil : Qt, 2332 NILP (ok_if_already_exists) ? Qnil : Qt,
2290 Qt, Qt); 2333 Qt, Qt, Qt);
2291 2334
2292 count = SPECPDL_INDEX (); 2335 count = SPECPDL_INDEX ();
2293 specbind (Qdelete_by_moving_to_trash, Qnil); 2336 specbind (Qdelete_by_moving_to_trash, Qnil);
@@ -2299,7 +2342,7 @@ This is what happens in interactive use with M-x. */)
2299 ) 2342 )
2300 call2 (Qdelete_directory, file, Qt); 2343 call2 (Qdelete_directory, file, Qt);
2301 else 2344 else
2302 Fdelete_file (file); 2345 Fdelete_file (file, Qt);
2303 unbind_to (count, Qnil); 2346 unbind_to (count, Qnil);
2304 } 2347 }
2305 else 2348 else
@@ -2844,6 +2887,140 @@ See `file-symlink-p' to distinguish symlinks. */)
2844#endif 2887#endif
2845} 2888}
2846 2889
2890DEFUN ("file-selinux-context", Ffile_selinux_context,
2891 Sfile_selinux_context, 1, 1, 0,
2892 doc: /* Return SELinux context of file named FILENAME,
2893as a list ("user", "role", "type", "range"). Return (nil, nil, nil, nil)
2894if file does not exist, is not accessible, or SELinux is disabled */)
2895 (filename)
2896 Lisp_Object filename;
2897{
2898 Lisp_Object absname;
2899 Lisp_Object values[4];
2900 Lisp_Object handler;
2901#if HAVE_LIBSELINUX
2902 security_context_t con;
2903 int conlength;
2904 context_t context;
2905#endif
2906
2907 absname = expand_and_dir_to_file (filename, current_buffer->directory);
2908
2909 /* If the file name has special constructs in it,
2910 call the corresponding file handler. */
2911 handler = Ffind_file_name_handler (absname, Qfile_selinux_context);
2912 if (!NILP (handler))
2913 return call2 (handler, Qfile_selinux_context, absname);
2914
2915 absname = ENCODE_FILE (absname);
2916
2917 values[0] = Qnil;
2918 values[1] = Qnil;
2919 values[2] = Qnil;
2920 values[3] = Qnil;
2921#if HAVE_LIBSELINUX
2922 if (is_selinux_enabled ())
2923 {
2924 conlength = lgetfilecon (SDATA (absname), &con);
2925 if (conlength > 0)
2926 {
2927 context = context_new (con);
2928 if (context_user_get (context))
2929 values[0] = build_string (context_user_get (context));
2930 if (context_role_get (context))
2931 values[1] = build_string (context_role_get (context));
2932 if (context_type_get (context))
2933 values[2] = build_string (context_type_get (context));
2934 if (context_range_get (context))
2935 values[3] = build_string (context_range_get (context));
2936 context_free (context);
2937 }
2938 if (con)
2939 freecon (con);
2940 }
2941#endif
2942
2943 return Flist (sizeof(values) / sizeof(values[0]), values);
2944}
2945
2946DEFUN ("set-file-selinux-context", Fset_file_selinux_context,
2947 Sset_file_selinux_context, 2, 2, 0,
2948 doc: /* Set SELinux context of file named FILENAME to CONTEXT
2949as a list ("user", "role", "type", "range"). Has no effect if SELinux
2950is disabled. */)
2951 (filename, context)
2952 Lisp_Object filename, context;
2953{
2954 Lisp_Object absname, encoded_absname;
2955 Lisp_Object handler;
2956 Lisp_Object user = CAR_SAFE (context);
2957 Lisp_Object role = CAR_SAFE (CDR_SAFE (context));
2958 Lisp_Object type = CAR_SAFE (CDR_SAFE (CDR_SAFE (context)));
2959 Lisp_Object range = CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (context))));
2960#if HAVE_LIBSELINUX
2961 security_context_t con;
2962 int fail, conlength;
2963 context_t parsed_con;
2964#endif
2965
2966 absname = Fexpand_file_name (filename, current_buffer->directory);
2967
2968 /* If the file name has special constructs in it,
2969 call the corresponding file handler. */
2970 handler = Ffind_file_name_handler (absname, Qset_file_selinux_context);
2971 if (!NILP (handler))
2972 return call3 (handler, Qset_file_selinux_context, absname, context);
2973
2974 encoded_absname = ENCODE_FILE (absname);
2975
2976#if HAVE_LIBSELINUX
2977 if (is_selinux_enabled ())
2978 {
2979 /* Get current file context. */
2980 conlength = lgetfilecon (SDATA (encoded_absname), &con);
2981 if (conlength > 0)
2982 {
2983 parsed_con = context_new (con);
2984 /* Change the parts defined in the parameter.*/
2985 if (STRINGP (user))
2986 {
2987 if (context_user_set (parsed_con, SDATA (user)))
2988 error ("Doing context_user_set");
2989 }
2990 if (STRINGP (role))
2991 {
2992 if (context_role_set (parsed_con, SDATA (role)))
2993 error ("Doing context_role_set");
2994 }
2995 if (STRINGP (type))
2996 {
2997 if (context_type_set (parsed_con, SDATA (type)))
2998 error ("Doing context_type_set");
2999 }
3000 if (STRINGP (range))
3001 {
3002 if (context_range_set (parsed_con, SDATA (range)))
3003 error ("Doing context_range_set");
3004 }
3005
3006 /* Set the modified context back to the file. */
3007 fail = lsetfilecon (SDATA (encoded_absname), context_str (parsed_con));
3008 if (fail)
3009 report_file_error ("Doing lsetfilecon", Fcons (absname, Qnil));
3010
3011 context_free (parsed_con);
3012 }
3013 else
3014 report_file_error("Doing lgetfilecon", Fcons (absname, Qnil));
3015
3016 if (con)
3017 freecon (con);
3018 }
3019#endif
3020
3021 return Qnil;
3022}
3023
2847DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0, 3024DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0,
2848 doc: /* Return mode bits of file named FILENAME, as an integer. 3025 doc: /* Return mode bits of file named FILENAME, as an integer.
2849Return nil, if file does not exist or is not accessible. */) 3026Return nil, if file does not exist or is not accessible. */)
@@ -5505,6 +5682,8 @@ syms_of_fileio ()
5505 Qfile_modes = intern_c_string ("file-modes"); 5682 Qfile_modes = intern_c_string ("file-modes");
5506 Qset_file_modes = intern_c_string ("set-file-modes"); 5683 Qset_file_modes = intern_c_string ("set-file-modes");
5507 Qset_file_times = intern_c_string ("set-file-times"); 5684 Qset_file_times = intern_c_string ("set-file-times");
5685 Qfile_selinux_context = intern_c_string("file-selinux-context");
5686 Qset_file_selinux_context = intern_c_string("set-file-selinux-context");
5508 Qfile_newer_than_file_p = intern_c_string ("file-newer-than-file-p"); 5687 Qfile_newer_than_file_p = intern_c_string ("file-newer-than-file-p");
5509 Qinsert_file_contents = intern_c_string ("insert-file-contents"); 5688 Qinsert_file_contents = intern_c_string ("insert-file-contents");
5510 Qwrite_region = intern_c_string ("write-region"); 5689 Qwrite_region = intern_c_string ("write-region");
@@ -5540,6 +5719,8 @@ syms_of_fileio ()
5540 staticpro (&Qfile_modes); 5719 staticpro (&Qfile_modes);
5541 staticpro (&Qset_file_modes); 5720 staticpro (&Qset_file_modes);
5542 staticpro (&Qset_file_times); 5721 staticpro (&Qset_file_times);
5722 staticpro (&Qfile_selinux_context);
5723 staticpro (&Qset_file_selinux_context);
5543 staticpro (&Qfile_newer_than_file_p); 5724 staticpro (&Qfile_newer_than_file_p);
5544 staticpro (&Qinsert_file_contents); 5725 staticpro (&Qinsert_file_contents);
5545 staticpro (&Qwrite_region); 5726 staticpro (&Qwrite_region);
@@ -5773,6 +5954,8 @@ When non-nil, the function `move-file-to-trash' will be used by
5773 defsubr (&Sfile_modes); 5954 defsubr (&Sfile_modes);
5774 defsubr (&Sset_file_modes); 5955 defsubr (&Sset_file_modes);
5775 defsubr (&Sset_file_times); 5956 defsubr (&Sset_file_times);
5957 defsubr (&Sfile_selinux_context);
5958 defsubr (&Sset_file_selinux_context);
5776 defsubr (&Sset_default_file_modes); 5959 defsubr (&Sset_default_file_modes);
5777 defsubr (&Sdefault_file_modes); 5960 defsubr (&Sdefault_file_modes);
5778 defsubr (&Sfile_newer_than_file_p); 5961 defsubr (&Sfile_newer_than_file_p);
diff --git a/src/floatfns.c b/src/floatfns.c
index 3f7030b7605..5cd996d033c 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -288,6 +288,70 @@ DEFUN ("tan", Ftan, Stan, 1, 1, 0,
288 IN_FLOAT (d = sin (d) / c, "tan", arg); 288 IN_FLOAT (d = sin (d) / c, "tan", arg);
289 return make_float (d); 289 return make_float (d);
290} 290}
291
292#if defined HAVE_ISNAN && defined HAVE_COPYSIGN
293DEFUN ("isnan", Fisnan, Sisnan, 1, 1, 0,
294 doc: /* Return non nil iff argument X is a NaN. */)
295 (x)
296 Lisp_Object x;
297{
298 CHECK_FLOAT (x);
299 return isnan (XFLOAT_DATA (x)) ? Qt : Qnil;
300}
301
302DEFUN ("copysign", Fcopysign, Scopysign, 1, 2, 0,
303 doc: /* Copy sign of X2 to value of X1, and return the result.
304Cause an error if X1 or X2 is not a float. */)
305 (x1, x2)
306 Lisp_Object x1, x2;
307{
308 double f1, f2;
309
310 CHECK_FLOAT (x1);
311 CHECK_FLOAT (x2);
312
313 f1 = XFLOAT_DATA (x1);
314 f2 = XFLOAT_DATA (x2);
315
316 return make_float (copysign (f1, f2));
317}
318
319DEFUN ("frexp", Ffrexp, Sfrexp, 1, 1, 0,
320 doc: /* Get significand and exponent of a floating point number.
321Breaks the floating point number X into its binary significand SGNFCAND
322\(a floating point value between 0.5 (included) and 1.0 (excluded))
323and an integral exponent EXP for 2, such that:
324
325 X = SGNFCAND * 2^EXP
326
327The function returns the cons cell (SGNFCAND . EXP).
328If X is zero, both parts (SGNFCAND and EXP) are zero. */)
329 (x)
330 Lisp_Object x;
331{
332 double f = XFLOATINT (x);
333
334 if (f == 0.0)
335 return Fcons (make_float (0.0), make_number (0));
336 else
337 {
338 int exp;
339 double sgnfcand = frexp (f, &exp);
340 return Fcons (make_float (sgnfcand), make_number (exp));
341 }
342}
343
344DEFUN ("ldexp", Fldexp, Sldexp, 1, 2, 0,
345 doc: /* Construct number X from significand SGNFCAND and exponent EXP.
346Returns the floating point value resulting from multiplying SGNFCAND
347(the significand) by 2 raised to the power of EXP (the exponent). */)
348 (sgnfcand, exp)
349 Lisp_Object sgnfcand, exp;
350{
351 CHECK_NUMBER (exp);
352 return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exp)));
353}
354#endif
291 355
292#if 0 /* Leave these out unless we find there's a reason for them. */ 356#if 0 /* Leave these out unless we find there's a reason for them. */
293 357
@@ -1017,6 +1081,12 @@ syms_of_floatfns ()
1017 defsubr (&Scos); 1081 defsubr (&Scos);
1018 defsubr (&Ssin); 1082 defsubr (&Ssin);
1019 defsubr (&Stan); 1083 defsubr (&Stan);
1084#if defined HAVE_ISNAN && defined HAVE_COPYSIGN
1085 defsubr (&Sisnan);
1086 defsubr (&Scopysign);
1087 defsubr (&Sfrexp);
1088 defsubr (&Sldexp);
1089#endif
1020#if 0 1090#if 0
1021 defsubr (&Sacosh); 1091 defsubr (&Sacosh);
1022 defsubr (&Sasinh); 1092 defsubr (&Sasinh);
diff --git a/src/fns.c b/src/fns.c
index 0100ff228f2..b4d132ea0c1 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -392,14 +392,10 @@ Lisp_Object
392concat2 (s1, s2) 392concat2 (s1, s2)
393 Lisp_Object s1, s2; 393 Lisp_Object s1, s2;
394{ 394{
395#ifdef NO_ARG_ARRAY
396 Lisp_Object args[2]; 395 Lisp_Object args[2];
397 args[0] = s1; 396 args[0] = s1;
398 args[1] = s2; 397 args[1] = s2;
399 return concat (2, args, Lisp_String, 0); 398 return concat (2, args, Lisp_String, 0);
400#else
401 return concat (2, &s1, Lisp_String, 0);
402#endif /* NO_ARG_ARRAY */
403} 399}
404 400
405/* ARGSUSED */ 401/* ARGSUSED */
@@ -407,15 +403,11 @@ Lisp_Object
407concat3 (s1, s2, s3) 403concat3 (s1, s2, s3)
408 Lisp_Object s1, s2, s3; 404 Lisp_Object s1, s2, s3;
409{ 405{
410#ifdef NO_ARG_ARRAY
411 Lisp_Object args[3]; 406 Lisp_Object args[3];
412 args[0] = s1; 407 args[0] = s1;
413 args[1] = s2; 408 args[1] = s2;
414 args[2] = s3; 409 args[2] = s3;
415 return concat (3, args, Lisp_String, 0); 410 return concat (3, args, Lisp_String, 0);
416#else
417 return concat (3, &s1, Lisp_String, 0);
418#endif /* NO_ARG_ARRAY */
419} 411}
420 412
421DEFUN ("append", Fappend, Sappend, 0, MANY, 0, 413DEFUN ("append", Fappend, Sappend, 0, MANY, 0,
@@ -2344,14 +2336,10 @@ Lisp_Object
2344nconc2 (s1, s2) 2336nconc2 (s1, s2)
2345 Lisp_Object s1, s2; 2337 Lisp_Object s1, s2;
2346{ 2338{
2347#ifdef NO_ARG_ARRAY
2348 Lisp_Object args[2]; 2339 Lisp_Object args[2];
2349 args[0] = s1; 2340 args[0] = s1;
2350 args[1] = s2; 2341 args[1] = s2;
2351 return Fnconc (2, args); 2342 return Fnconc (2, args);
2352#else
2353 return Fnconc (2, &s1);
2354#endif /* NO_ARG_ARRAY */
2355} 2343}
2356 2344
2357DEFUN ("nconc", Fnconc, Snconc, 0, MANY, 0, 2345DEFUN ("nconc", Fnconc, Snconc, 0, MANY, 0,
diff --git a/src/font.c b/src/font.c
index 765712198fe..2d55065e9c8 100644
--- a/src/font.c
+++ b/src/font.c
@@ -5376,22 +5376,30 @@ non-nil value in the table are supported. If REPERTORY is nil, Emacs
5376gets the repertory information by an opened font and ENCODING. */); 5376gets the repertory information by an opened font and ENCODING. */);
5377 Vfont_encoding_alist = Qnil; 5377 Vfont_encoding_alist = Qnil;
5378 5378
5379 /* FIXME: These 3 vars are not quite what they appear: setq on them
5380 won't have any effect other than disconnect them from the style
5381 table used by the font display code. So we make them read-only,
5382 to avoid this confusing situation. */
5383
5379 DEFVAR_LISP_NOPRO ("font-weight-table", &Vfont_weight_table, 5384 DEFVAR_LISP_NOPRO ("font-weight-table", &Vfont_weight_table,
5380 doc: /* Vector of valid font weight values. 5385 doc: /* Vector of valid font weight values.
5381Each element has the form: 5386Each element has the form:
5382 [NUMERIC-VALUE SYMBOLIC-NAME ALIAS-NAME ...] 5387 [NUMERIC-VALUE SYMBOLIC-NAME ALIAS-NAME ...]
5383NUMERIC-VALUE is an integer, and SYMBOLIC-NAME and ALIAS-NAME are symbols. */); 5388NUMERIC-VALUE is an integer, and SYMBOLIC-NAME and ALIAS-NAME are symbols. */);
5384 Vfont_weight_table = BUILD_STYLE_TABLE (weight_table); 5389 Vfont_weight_table = BUILD_STYLE_TABLE (weight_table);
5390 XSYMBOL (intern_c_string ("font-weight-table"))->constant = 1;
5385 5391
5386 DEFVAR_LISP_NOPRO ("font-slant-table", &Vfont_slant_table, 5392 DEFVAR_LISP_NOPRO ("font-slant-table", &Vfont_slant_table,
5387 doc: /* Vector of font slant symbols vs the corresponding numeric values. 5393 doc: /* Vector of font slant symbols vs the corresponding numeric values.
5388See `font-weight-table' for the format of the vector. */); 5394See `font-weight-table' for the format of the vector. */);
5389 Vfont_slant_table = BUILD_STYLE_TABLE (slant_table); 5395 Vfont_slant_table = BUILD_STYLE_TABLE (slant_table);
5396 XSYMBOL (intern_c_string ("font-slant-table"))->constant = 1;
5390 5397
5391 DEFVAR_LISP_NOPRO ("font-width-table", &Vfont_width_table, 5398 DEFVAR_LISP_NOPRO ("font-width-table", &Vfont_width_table,
5392 doc: /* Alist of font width symbols vs the corresponding numeric values. 5399 doc: /* Alist of font width symbols vs the corresponding numeric values.
5393See `font-weight-table' for the format of the vector. */); 5400See `font-weight-table' for the format of the vector. */);
5394 Vfont_width_table = BUILD_STYLE_TABLE (width_table); 5401 Vfont_width_table = BUILD_STYLE_TABLE (width_table);
5402 XSYMBOL (intern_c_string ("font-width-table"))->constant = 1;
5395 5403
5396 staticpro (&font_style_table); 5404 staticpro (&font_style_table);
5397 font_style_table = Fmake_vector (make_number (3), Qnil); 5405 font_style_table = Fmake_vector (make_number (3), Qnil);
diff --git a/src/frame.c b/src/frame.c
index 757ed8f01a3..3e1b2daf556 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2298,13 +2298,20 @@ store_frame_param (f, prop, val)
2298 without messing up the symbol's status. */ 2298 without messing up the symbol's status. */
2299 if (SYMBOLP (prop)) 2299 if (SYMBOLP (prop))
2300 { 2300 {
2301 Lisp_Object valcontents; 2301 struct Lisp_Symbol *sym = XSYMBOL (prop);
2302 valcontents = SYMBOL_VALUE (prop); 2302 start:
2303 if ((BUFFER_LOCAL_VALUEP (valcontents)) 2303 switch (sym->redirect)
2304 && XBUFFER_LOCAL_VALUE (valcontents)->check_frame 2304 {
2305 && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame 2305 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
2306 && XFRAME (XBUFFER_LOCAL_VALUE (valcontents)->frame) == f) 2306 case SYMBOL_PLAINVAL: case SYMBOL_FORWARDED: break;
2307 swap_in_global_binding (prop); 2307 case SYMBOL_LOCALIZED:
2308 { struct Lisp_Buffer_Local_Value *blv = sym->val.blv;
2309 if (blv->frame_local && BLV_FOUND (blv) && XFRAME (blv->where) == f)
2310 swap_in_global_binding (sym);
2311 break;
2312 }
2313 default: abort ();
2314 }
2308 } 2315 }
2309 2316
2310 /* The tty color needed to be set before the frame's parameter 2317 /* The tty color needed to be set before the frame's parameter
@@ -2520,6 +2527,8 @@ If FRAME is nil, describe the currently selected frame. */)
2520 || EQ (parameter, Qbackground_mode)) 2527 || EQ (parameter, Qbackground_mode))
2521 value = Fcdr (Fassq (parameter, f->param_alist)); 2528 value = Fcdr (Fassq (parameter, f->param_alist));
2522 else 2529 else
2530 /* FIXME: Avoid this code path at all (as well as code duplication)
2531 by sharing more code with Fframe_parameters. */
2523 value = Fcdr (Fassq (parameter, Fframe_parameters (frame))); 2532 value = Fcdr (Fassq (parameter, Fframe_parameters (frame)));
2524 } 2533 }
2525 2534
diff --git a/src/frame.h b/src/frame.h
index 36b0b6b069c..887d47eff21 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -980,7 +980,7 @@ extern Lisp_Object selected_frame;
980 at ROW/COL. */ 980 at ROW/COL. */
981 981
982#define FRAME_LINE_TO_PIXEL_Y(f, row) \ 982#define FRAME_LINE_TO_PIXEL_Y(f, row) \
983 ((row < FRAME_TOP_MARGIN (f) ? 0 : FRAME_INTERNAL_BORDER_WIDTH (f)) \ 983 (((row) < FRAME_TOP_MARGIN (f) ? 0 : FRAME_INTERNAL_BORDER_WIDTH (f)) \
984 + (row) * FRAME_LINE_HEIGHT (f)) 984 + (row) * FRAME_LINE_HEIGHT (f))
985 985
986#define FRAME_COL_TO_PIXEL_X(f, col) \ 986#define FRAME_COL_TO_PIXEL_X(f, col) \
diff --git a/src/fringe.c b/src/fringe.c
index 952e95a5517..6dcacbbcd3f 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -825,7 +825,7 @@ draw_fringe_bitmap (w, row, left_p)
825{ 825{
826 int overlay = 0; 826 int overlay = 0;
827 827
828 if (!left_p && row->cursor_in_fringe_p) 828 if (left_p == row->reversed_p && row->cursor_in_fringe_p)
829 { 829 {
830 Lisp_Object cursor = Qnil; 830 Lisp_Object cursor = Qnil;
831 831
@@ -857,7 +857,7 @@ draw_fringe_bitmap (w, row, left_p)
857 int bm = get_logical_cursor_bitmap (w, cursor); 857 int bm = get_logical_cursor_bitmap (w, cursor);
858 if (bm != NO_FRINGE_BITMAP) 858 if (bm != NO_FRINGE_BITMAP)
859 { 859 {
860 draw_fringe_bitmap_1 (w, row, 0, 2, bm); 860 draw_fringe_bitmap_1 (w, row, left_p, 2, bm);
861 overlay = EQ (cursor, Qbox) ? 3 : 1; 861 overlay = EQ (cursor, Qbox) ? 3 : 1;
862 } 862 }
863 } 863 }
@@ -1082,7 +1082,8 @@ update_window_fringes (w, keep_current_p)
1082 left = row->left_user_fringe_bitmap; 1082 left = row->left_user_fringe_bitmap;
1083 left_face_id = row->left_user_fringe_face_id; 1083 left_face_id = row->left_user_fringe_face_id;
1084 } 1084 }
1085 else if (row->truncated_on_left_p) 1085 else if ((!row->reversed_p && row->truncated_on_left_p)
1086 || (row->reversed_p && row->truncated_on_right_p))
1086 left = LEFT_FRINGE(0, Qtruncation, 0); 1087 left = LEFT_FRINGE(0, Qtruncation, 0);
1087 else if (row->indicate_bob_p && EQ (boundary_top, Qleft)) 1088 else if (row->indicate_bob_p && EQ (boundary_top, Qleft))
1088 left = ((row->indicate_eob_p && EQ (boundary_bot, Qleft)) 1089 left = ((row->indicate_eob_p && EQ (boundary_bot, Qleft))
@@ -1090,7 +1091,8 @@ update_window_fringes (w, keep_current_p)
1090 : LEFT_FRINGE (2, Qtop, 0)); 1091 : LEFT_FRINGE (2, Qtop, 0));
1091 else if (row->indicate_eob_p && EQ (boundary_bot, Qleft)) 1092 else if (row->indicate_eob_p && EQ (boundary_bot, Qleft))
1092 left = LEFT_FRINGE (3, Qbottom, row->ends_at_zv_p); 1093 left = LEFT_FRINGE (3, Qbottom, row->ends_at_zv_p);
1093 else if (MATRIX_ROW_CONTINUATION_LINE_P (row)) 1094 else if ((!row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row))
1095 || (row->reversed_p && row->continued_p))
1094 left = LEFT_FRINGE (4, Qcontinuation, 0); 1096 left = LEFT_FRINGE (4, Qcontinuation, 0);
1095 else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft)) 1097 else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft))
1096 left = LEFT_FRINGE (5, Qempty_line, 0); 1098 left = LEFT_FRINGE (5, Qempty_line, 0);
@@ -1109,7 +1111,8 @@ update_window_fringes (w, keep_current_p)
1109 right = row->right_user_fringe_bitmap; 1111 right = row->right_user_fringe_bitmap;
1110 right_face_id = row->right_user_fringe_face_id; 1112 right_face_id = row->right_user_fringe_face_id;
1111 } 1113 }
1112 else if (row->truncated_on_right_p) 1114 else if ((!row->reversed_p && row->truncated_on_right_p)
1115 || (row->reversed_p && row->truncated_on_left_p))
1113 right = RIGHT_FRINGE (0, Qtruncation, 0); 1116 right = RIGHT_FRINGE (0, Qtruncation, 0);
1114 else if (row->indicate_bob_p && EQ (boundary_top, Qright)) 1117 else if (row->indicate_bob_p && EQ (boundary_top, Qright))
1115 right = ((row->indicate_eob_p && EQ (boundary_bot, Qright)) 1118 right = ((row->indicate_eob_p && EQ (boundary_bot, Qright))
@@ -1117,7 +1120,8 @@ update_window_fringes (w, keep_current_p)
1117 : RIGHT_FRINGE (2, Qtop, 0)); 1120 : RIGHT_FRINGE (2, Qtop, 0));
1118 else if (row->indicate_eob_p && EQ (boundary_bot, Qright)) 1121 else if (row->indicate_eob_p && EQ (boundary_bot, Qright))
1119 right = RIGHT_FRINGE (3, Qbottom, row->ends_at_zv_p); 1122 right = RIGHT_FRINGE (3, Qbottom, row->ends_at_zv_p);
1120 else if (row->continued_p) 1123 else if ((!row->reversed_p && row->continued_p)
1124 || (row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row)))
1121 right = RIGHT_FRINGE (4, Qcontinuation, 0); 1125 right = RIGHT_FRINGE (4, Qcontinuation, 0);
1122 else if (row->indicate_top_line_p && EQ (arrow_top, Qright)) 1126 else if (row->indicate_top_line_p && EQ (arrow_top, Qright))
1123 right = RIGHT_FRINGE (6, Qup, 0); 1127 right = RIGHT_FRINGE (6, Qup, 0);
diff --git a/src/ftfont.c b/src/ftfont.c
index f4fe5b8e5c0..9699dc58009 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -1578,6 +1578,14 @@ ftfont_otf_capability (font)
1578 1578
1579#ifdef HAVE_M17N_FLT 1579#ifdef HAVE_M17N_FLT
1580 1580
1581#if (((LIBOTF_MAJOR_VERSION > 1) || (LIBOTF_RELEASE_NUMBER >= 10)) \
1582 && ((M17NLIB_MAJOR_VERSION > 1) || (M17NLIB_MINOR_VERSION >= 6)))
1583/* We can use the new feature of libotf and m17n-flt to handle the
1584 character encoding scheme introduced in Unicode 5.1 and 5.2 for
1585 some Agian scripts. */
1586#define M17N_FLT_USE_NEW_FEATURE
1587#endif
1588
1581struct MFLTFontFT 1589struct MFLTFontFT
1582{ 1590{
1583 MFLTFont flt_font; 1591 MFLTFont flt_font;
@@ -1696,10 +1704,16 @@ ftfont_check_otf (MFLTFont *font, MFLTOtfSpec *spec)
1696 else 1704 else
1697 tags[n] = spec->features[i][n]; 1705 tags[n] = spec->features[i][n];
1698 } 1706 }
1707#ifdef M17N_FLT_USE_NEW_FEATURE
1708 if (OTF_check_features (otf, i == 0, spec->script, spec->langsys,
1709 tags, n - negative) != 1)
1710 return 0;
1711#else /* not M17N_FLT_USE_NEW_FEATURE */
1699 if (n - negative > 0 1712 if (n - negative > 0
1700 && OTF_check_features (otf, i == 0, spec->script, spec->langsys, 1713 && OTF_check_features (otf, i == 0, spec->script, spec->langsys,
1701 tags, n - negative) != 1) 1714 tags, n - negative) != 1)
1702 return 0; 1715 return 0;
1716#endif /* not M17N_FLT_USE_NEW_FEATURE */
1703 } 1717 }
1704 return 1; 1718 return 1;
1705} 1719}
@@ -1757,6 +1771,356 @@ setup_otf_gstring (int size)
1757 memset (otf_gstring.glyphs, 0, sizeof (OTF_Glyph) * size); 1771 memset (otf_gstring.glyphs, 0, sizeof (OTF_Glyph) * size);
1758} 1772}
1759 1773
1774#ifdef M17N_FLT_USE_NEW_FEATURE
1775
1776/* Pack 32-bit OTF tag (0x7F7F7F7F) into 28-bit (0x0FFFFFFF). */
1777#define PACK_OTF_TAG(TAG) \
1778 ((((TAG) & 0x7F000000) >> 3) \
1779 | (((TAG) & 0x7F0000) >> 2) \
1780 | (((TAG) & 0x7F00) >> 1) \
1781 | ((TAG) & 0x7F))
1782
1783/* Assuming that FONT is an OpenType font, apply OpenType features
1784 specified in SPEC on glyphs between FROM and TO of IN, and record
1785 the lastly applied feature in each glyph of IN. If OUT is not
1786 NULL, append the resulting glyphs to OUT while storing glyph
1787 position adjustment information in ADJUSTMENT. */
1788
1789static int
1790ftfont_drive_otf (font, spec, in, from, to, out, adjustment)
1791 MFLTFont *font;
1792 MFLTOtfSpec *spec;
1793 MFLTGlyphString *in;
1794 int from, to;
1795 MFLTGlyphString *out;
1796 MFLTGlyphAdjustment *adjustment;
1797{
1798 struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font;
1799 FT_Face ft_face = flt_font_ft->ft_face;
1800 OTF *otf = flt_font_ft->otf;
1801 int len = to - from;
1802 int i, j, gidx;
1803 OTF_Glyph *otfg;
1804 char script[5], *langsys = NULL;
1805 char *gsub_features = NULL, *gpos_features = NULL;
1806 OTF_Feature *features;
1807
1808 if (len == 0)
1809 return from;
1810 OTF_tag_name (spec->script, script);
1811 if (spec->langsys)
1812 {
1813 langsys = alloca (5);
1814 OTF_tag_name (spec->langsys, langsys);
1815 }
1816 for (i = 0; i < 2; i++)
1817 {
1818 char *p;
1819
1820 if (spec->features[i] && spec->features[i][1] != 0xFFFFFFFF)
1821 {
1822 for (j = 0; spec->features[i][j]; j++);
1823 if (i == 0)
1824 p = gsub_features = alloca (6 * j);
1825 else
1826 p = gpos_features = alloca (6 * j);
1827 for (j = 0; spec->features[i][j]; j++)
1828 {
1829 if (spec->features[i][j] == 0xFFFFFFFF)
1830 *p++ = '*', *p++ = ',';
1831 else
1832 {
1833 OTF_tag_name (spec->features[i][j], p);
1834 p[4] = ',';
1835 p += 5;
1836 }
1837 }
1838 *--p = '\0';
1839 }
1840 }
1841
1842 setup_otf_gstring (len);
1843 for (i = 0; i < len; i++)
1844 {
1845 otf_gstring.glyphs[i].c = in->glyphs[from + i].c;
1846 otf_gstring.glyphs[i].glyph_id = in->glyphs[from + i].code;
1847 }
1848
1849 OTF_drive_gdef (otf, &otf_gstring);
1850 gidx = out ? out->used : from;
1851
1852 if (gsub_features && out)
1853 {
1854 if (OTF_drive_gsub_with_log (otf, &otf_gstring, script, langsys,
1855 gsub_features) < 0)
1856 goto simple_copy;
1857 if (out->allocated < out->used + otf_gstring.used)
1858 return -2;
1859 features = otf->gsub->FeatureList.Feature;
1860 for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; )
1861 {
1862 MFLTGlyph *g;
1863 int min_from, max_to;
1864 int j;
1865 int feature_idx = otfg->positioning_type >> 4;
1866
1867 g = out->glyphs + out->used;
1868 *g = in->glyphs[from + otfg->f.index.from];
1869 if (g->code != otfg->glyph_id)
1870 {
1871 g->c = 0;
1872 g->code = otfg->glyph_id;
1873 g->measured = 0;
1874 }
1875 out->used++;
1876 min_from = g->from;
1877 max_to = g->to;
1878 if (otfg->f.index.from < otfg->f.index.to)
1879 {
1880 /* OTFG substitutes multiple glyphs in IN. */
1881 for (j = from + otfg->f.index.from + 1;
1882 j <= from + otfg->f.index.to; j++)
1883 {
1884 if (min_from > in->glyphs[j].from)
1885 min_from = in->glyphs[j].from;
1886 if (max_to < in->glyphs[j].to)
1887 max_to = in->glyphs[j].to;
1888 }
1889 g->from = min_from;
1890 g->to = max_to;
1891 }
1892 if (feature_idx)
1893 {
1894 unsigned int tag = features[feature_idx - 1].FeatureTag;
1895 tag = PACK_OTF_TAG (tag);
1896 g->internal = (g->internal & ~0x1FFFFFFF) | tag;
1897 }
1898 for (i++, otfg++; (i < otf_gstring.used
1899 && otfg->f.index.from == otfg[-1].f.index.from);
1900 i++, otfg++)
1901 {
1902 g = out->glyphs + out->used;
1903 *g = in->glyphs[from + otfg->f.index.to];
1904 if (g->code != otfg->glyph_id)
1905 {
1906 g->c = 0;
1907 g->code = otfg->glyph_id;
1908 g->measured = 0;
1909 }
1910 feature_idx = otfg->positioning_type >> 4;
1911 if (feature_idx)
1912 {
1913 unsigned int tag = features[feature_idx - 1].FeatureTag;
1914 tag = PACK_OTF_TAG (tag);
1915 g->internal = (g->internal & ~0x1FFFFFFF) | tag;
1916 }
1917 out->used++;
1918 }
1919 }
1920 }
1921 else if (gsub_features)
1922 {
1923 /* Just for checking which features will be applied. */
1924 if (OTF_drive_gsub_with_log (otf, &otf_gstring, script, langsys,
1925 gsub_features) < 0)
1926 goto simple_copy;
1927 features = otf->gsub->FeatureList.Feature;
1928 for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; i++,
1929 otfg++)
1930 {
1931 int feature_idx = otfg->positioning_type >> 4;
1932
1933 if (feature_idx)
1934 {
1935 unsigned int tag = features[feature_idx - 1].FeatureTag;
1936 tag = PACK_OTF_TAG (tag);
1937 for (j = otfg->f.index.from; j <= otfg->f.index.to; j++)
1938 {
1939 MFLTGlyph *g = in->glyphs + (from + j);
1940 g->internal = (g->internal & ~0x1FFFFFFF) | tag;
1941 }
1942 }
1943 }
1944 }
1945 else if (out)
1946 {
1947 if (out->allocated < out->used + len)
1948 return -2;
1949 for (i = 0; i < len; i++)
1950 out->glyphs[out->used++] = in->glyphs[from + i];
1951 }
1952
1953 if (gpos_features && out)
1954 {
1955 MFLTGlyph *base = NULL, *mark = NULL, *g;
1956 int x_ppem, y_ppem, x_scale, y_scale;
1957
1958 if (OTF_drive_gpos_with_log (otf, &otf_gstring, script, langsys,
1959 gpos_features) < 0)
1960 return to;
1961 features = otf->gpos->FeatureList.Feature;
1962 x_ppem = ft_face->size->metrics.x_ppem;
1963 y_ppem = ft_face->size->metrics.y_ppem;
1964 x_scale = ft_face->size->metrics.x_scale;
1965 y_scale = ft_face->size->metrics.y_scale;
1966
1967 for (i = 0, otfg = otf_gstring.glyphs, g = out->glyphs + gidx;
1968 i < otf_gstring.used; i++, otfg++, g++)
1969 {
1970 MFLTGlyph *prev;
1971 int feature_idx = otfg->positioning_type >> 4;
1972
1973 if (feature_idx)
1974 {
1975 unsigned int tag = features[feature_idx - 1].FeatureTag;
1976 tag = PACK_OTF_TAG (tag);
1977 g->internal = (g->internal & ~0x1FFFFFFF) | tag;
1978 }
1979
1980 if (! otfg->glyph_id)
1981 continue;
1982 switch (otfg->positioning_type & 0xF)
1983 {
1984 case 0:
1985 break;
1986 case 1: /* Single */
1987 case 2: /* Pair */
1988 {
1989 int format = otfg->f.f1.format;
1990
1991 if (format & OTF_XPlacement)
1992 adjustment[i].xoff
1993 = otfg->f.f1.value->XPlacement * x_scale / 0x10000;
1994 if (format & OTF_XPlaDevice)
1995 adjustment[i].xoff
1996 += DEVICE_DELTA (otfg->f.f1.value->XPlaDevice, x_ppem);
1997 if (format & OTF_YPlacement)
1998 adjustment[i].yoff
1999 = - (otfg->f.f1.value->YPlacement * y_scale / 0x10000);
2000 if (format & OTF_YPlaDevice)
2001 adjustment[i].yoff
2002 -= DEVICE_DELTA (otfg->f.f1.value->YPlaDevice, y_ppem);
2003 if (format & OTF_XAdvance)
2004 adjustment[i].xadv
2005 += otfg->f.f1.value->XAdvance * x_scale / 0x10000;
2006 if (format & OTF_XAdvDevice)
2007 adjustment[i].xadv
2008 += DEVICE_DELTA (otfg->f.f1.value->XAdvDevice, x_ppem);
2009 if (format & OTF_YAdvance)
2010 adjustment[i].yadv
2011 += otfg->f.f1.value->YAdvance * y_scale / 0x10000;
2012 if (format & OTF_YAdvDevice)
2013 adjustment[i].yadv
2014 += DEVICE_DELTA (otfg->f.f1.value->YAdvDevice, y_ppem);
2015 adjustment[i].set = 1;
2016 }
2017 break;
2018 case 3: /* Cursive */
2019 /* Not yet supported. */
2020 break;
2021 case 4: /* Mark-to-Base */
2022 case 5: /* Mark-to-Ligature */
2023 if (! base)
2024 break;
2025 prev = base;
2026 goto label_adjust_anchor;
2027 default: /* i.e. case 6 Mark-to-Mark */
2028 if (! mark)
2029 break;
2030 prev = mark;
2031
2032 label_adjust_anchor:
2033 {
2034 int base_x, base_y, mark_x, mark_y;
2035 int this_from, this_to;
2036
2037 base_x = otfg->f.f4.base_anchor->XCoordinate * x_scale / 0x10000;
2038 base_y = otfg->f.f4.base_anchor->YCoordinate * y_scale / 0x10000;
2039 mark_x = otfg->f.f4.mark_anchor->XCoordinate * x_scale / 0x10000;
2040 mark_y = otfg->f.f4.mark_anchor->YCoordinate * y_scale / 0x10000;
2041
2042 if (otfg->f.f4.base_anchor->AnchorFormat != 1)
2043 adjust_anchor (ft_face, otfg->f.f4.base_anchor,
2044 prev->code, x_ppem, y_ppem, &base_x, &base_y);
2045 if (otfg->f.f4.mark_anchor->AnchorFormat != 1)
2046 adjust_anchor (ft_face, otfg->f.f4.mark_anchor, g->code,
2047 x_ppem, y_ppem, &mark_x, &mark_y);
2048 adjustment[i].xoff = (base_x - mark_x);
2049 adjustment[i].yoff = - (base_y - mark_y);
2050 adjustment[i].back = (g - prev);
2051 adjustment[i].xadv = 0;
2052 adjustment[i].advance_is_absolute = 1;
2053 adjustment[i].set = 1;
2054 this_from = g->from;
2055 this_to = g->to;
2056 for (j = 0; prev + j < g; j++)
2057 {
2058 if (this_from > prev[j].from)
2059 this_from = prev[j].from;
2060 if (this_to < prev[j].to)
2061 this_to = prev[j].to;
2062 }
2063 for (; prev <= g; prev++)
2064 {
2065 prev->from = this_from;
2066 prev->to = this_to;
2067 }
2068 }
2069 }
2070 if (otfg->GlyphClass == OTF_GlyphClass0)
2071 base = mark = g;
2072 else if (otfg->GlyphClass == OTF_GlyphClassMark)
2073 mark = g;
2074 else
2075 base = g;
2076 }
2077 }
2078 else if (gpos_features)
2079 {
2080 if (OTF_drive_gpos_with_log (otf, &otf_gstring, script, langsys,
2081 gpos_features) < 0)
2082 return to;
2083 features = otf->gpos->FeatureList.Feature;
2084 for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used;
2085 i++, otfg++)
2086 if (otfg->positioning_type & 0xF)
2087 {
2088 int feature_idx = otfg->positioning_type >> 4;
2089
2090 if (feature_idx)
2091 {
2092 unsigned int tag = features[feature_idx - 1].FeatureTag;
2093 tag = PACK_OTF_TAG (tag);
2094 for (j = otfg->f.index.from; j <= otfg->f.index.to; j++)
2095 {
2096 MFLTGlyph *g = in->glyphs + (from + j);
2097 g->internal = (g->internal & ~0x1FFFFFFF) | tag;
2098 }
2099 }
2100 }
2101 }
2102 return to;
2103
2104 simple_copy:
2105 if (! out)
2106 return to;
2107 if (out->allocated < out->used + len)
2108 return -2;
2109 font->get_metrics (font, in, from, to);
2110 memcpy (out->glyphs + out->used, in->glyphs + from,
2111 sizeof (MFLTGlyph) * len);
2112 out->used += len;
2113 return to;
2114}
2115
2116static int
2117ftfont_try_otf (MFLTFont *font, MFLTOtfSpec *spec,
2118 MFLTGlyphString *in, int from, int to)
2119{
2120 return ftfont_drive_otf (font, spec, in, from, to, NULL, NULL);
2121}
2122
2123#else /* not M17N_FLT_USE_NEW_FEATURE */
1760 2124
1761static int 2125static int
1762ftfont_drive_otf (font, spec, in, from, to, out, adjustment) 2126ftfont_drive_otf (font, spec, in, from, to, out, adjustment)
@@ -2011,6 +2375,8 @@ ftfont_drive_otf (font, spec, in, from, to, out, adjustment)
2011 return to; 2375 return to;
2012} 2376}
2013 2377
2378#endif /* not M17N_FLT_USE_NEW_FEATURE */
2379
2014static MFLTGlyphString gstring; 2380static MFLTGlyphString gstring;
2015 2381
2016static int m17n_flt_initialized; 2382static int m17n_flt_initialized;
@@ -2034,6 +2400,10 @@ ftfont_shape_by_flt (lgstring, font, ft_face, otf, matrix)
2034 if (! m17n_flt_initialized) 2400 if (! m17n_flt_initialized)
2035 { 2401 {
2036 M17N_INIT (); 2402 M17N_INIT ();
2403#ifdef M17N_FLT_USE_NEW_FEATURE
2404 mflt_enable_new_feature = 1;
2405 mflt_try_otf = ftfont_try_otf;
2406#endif /* M17N_FLT_USE_NEW_FEATURE */
2037 m17n_flt_initialized = 1; 2407 m17n_flt_initialized = 1;
2038 } 2408 }
2039 2409
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 25da0baec79..c8800817b68 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -35,6 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
35#include "charset.h" 35#include "charset.h"
36#include "coding.h" 36#include "coding.h"
37#include <gdk/gdkkeysyms.h> 37#include <gdk/gdkkeysyms.h>
38#include "xsettings.h"
38 39
39#ifdef HAVE_XFT 40#ifdef HAVE_XFT
40#include <X11/Xft/Xft.h> 41#include <X11/Xft/Xft.h>
@@ -542,7 +543,9 @@ xg_set_geometry (f)
542 if (yneg) 543 if (yneg)
543 top = -top; 544 top = -top;
544 545
545 sprintf (geom_str, "%c%d%c%d", 546 sprintf (geom_str, "=%dx%d%c%d%c%d",
547 FRAME_PIXEL_WIDTH (f),
548 FRAME_PIXEL_HEIGHT (f),
546 (xneg ? '-' : '+'), left, 549 (xneg ? '-' : '+'), left,
547 (yneg ? '-' : '+'), top); 550 (yneg ? '-' : '+'), top);
548 551
@@ -951,6 +954,12 @@ x_wm_set_size_hint (f, flags, user_position)
951 else if (win_gravity == StaticGravity) 954 else if (win_gravity == StaticGravity)
952 size_hints.win_gravity = GDK_GRAVITY_STATIC; 955 size_hints.win_gravity = GDK_GRAVITY_STATIC;
953 956
957 if (user_position)
958 {
959 hint_flags &= ~GDK_HINT_POS;
960 hint_flags |= GDK_HINT_USER_POS;
961 }
962
954 if (hint_flags != f->output_data.x->hint_flags 963 if (hint_flags != f->output_data.x->hint_flags
955 || memcmp (&size_hints, 964 || memcmp (&size_hints,
956 &f->output_data.x->size_hints, 965 &f->output_data.x->size_hints,
@@ -3363,8 +3372,8 @@ xg_event_is_for_scrollbar (f, event)
3363 || event->type == MotionNotify)) 3372 || event->type == MotionNotify))
3364 { 3373 {
3365 /* If we are releasing or moving the scroll bar, it has the grab. */ 3374 /* If we are releasing or moving the scroll bar, it has the grab. */
3366 retval = gtk_grab_get_current () != 0 3375 GtkWidget *w = gtk_grab_get_current ();
3367 && gtk_grab_get_current () != f->output_data.x->edit_widget; 3376 retval = w != 0 && GTK_IS_SCROLLBAR (w);
3368 } 3377 }
3369 3378
3370 return retval; 3379 return retval;
@@ -3514,7 +3523,16 @@ xg_tool_bar_menu_proxy (toolitem, user_data)
3514{ 3523{
3515 GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (toolitem)); 3524 GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (toolitem));
3516 GtkButton *wbutton = GTK_BUTTON (gtk_bin_get_child (GTK_BIN (weventbox))); 3525 GtkButton *wbutton = GTK_BUTTON (gtk_bin_get_child (GTK_BIN (weventbox)));
3517 GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label (""); 3526 GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton)));
3527 GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data;
3528 GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data;
3529 GtkImage *wimage = GTK_IS_IMAGE (c1->widget)
3530 ? GTK_IMAGE (c1->widget) : GTK_IMAGE (c2->widget);
3531 GtkLabel *wlbl = GTK_IS_LABEL (c1->widget)
3532 ? GTK_LABEL (c1->widget) : GTK_LABEL (c2->widget);
3533 GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label
3534 (gtk_label_get_text (wlbl));
3535
3518 GtkWidget *wmenuimage; 3536 GtkWidget *wmenuimage;
3519 3537
3520 if (gtk_button_get_use_stock (wbutton)) 3538 if (gtk_button_get_use_stock (wbutton))
@@ -3522,7 +3540,6 @@ xg_tool_bar_menu_proxy (toolitem, user_data)
3522 GTK_ICON_SIZE_MENU); 3540 GTK_ICON_SIZE_MENU);
3523 else 3541 else
3524 { 3542 {
3525 GtkImage *wimage = GTK_IMAGE (gtk_bin_get_child (GTK_BIN (wbutton)));
3526 GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (wbutton)); 3543 GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (wbutton));
3527 GtkImageType store_type = gtk_image_get_storage_type (wimage); 3544 GtkImageType store_type = gtk_image_get_storage_type (wimage);
3528 3545
@@ -3761,7 +3778,9 @@ xg_pack_tool_bar (f)
3761 3778
3762 gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->handlebox_widget, 3779 gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->handlebox_widget,
3763 vbox_pos); 3780 vbox_pos);
3764 gtk_widget_show_all (x->handlebox_widget); 3781
3782 gtk_widget_show (x->toolbar_widget);
3783 gtk_widget_show (x->handlebox_widget);
3765} 3784}
3766 3785
3767/* Create a tool bar for frame F. */ 3786/* Create a tool bar for frame F. */
@@ -3777,13 +3796,6 @@ xg_create_tool_bar (f)
3777 3796
3778 gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar"); 3797 gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar");
3779 3798
3780 /* We only have icons, so override any user setting. We could
3781 use the caption property of the toolbar item (see update_frame_tool_bar
3782 below), but some of those strings are long, making the toolbar so
3783 long it does not fit on the screen. The GtkToolbar widget makes every
3784 item equal size, so the longest caption determine the size of every
3785 tool bar item. I think the creators of the GtkToolbar widget
3786 counted on 4 or 5 character long strings. */
3787 gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS); 3799 gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS);
3788 gtk_toolbar_set_orientation (GTK_TOOLBAR (x->toolbar_widget), 3800 gtk_toolbar_set_orientation (GTK_TOOLBAR (x->toolbar_widget),
3789 GTK_ORIENTATION_HORIZONTAL); 3801 GTK_ORIENTATION_HORIZONTAL);
@@ -3826,6 +3838,131 @@ find_rtl_image (f, image, rtl)
3826 return image; 3838 return image;
3827} 3839}
3828 3840
3841static GtkToolItem *
3842xg_make_tool_item (FRAME_PTR f,
3843 GtkWidget *wimage,
3844 GtkWidget **wbutton,
3845 char *label,
3846 int i)
3847{
3848 GtkToolItem *ti = gtk_tool_item_new ();
3849 GtkWidget *vb = EQ (Vtool_bar_style, Qboth_horiz)
3850 ? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0);
3851 GtkWidget *wb = gtk_button_new ();
3852 GtkWidget *weventbox = gtk_event_box_new ();
3853
3854 if (wimage)
3855 gtk_box_pack_start_defaults (GTK_BOX (vb), wimage);
3856
3857 gtk_box_pack_start_defaults (GTK_BOX (vb), gtk_label_new (label));
3858 gtk_button_set_focus_on_click (GTK_BUTTON (wb), FALSE);
3859 gtk_button_set_relief (GTK_BUTTON (wb), GTK_RELIEF_NONE);
3860 gtk_container_add (GTK_CONTAINER (wb), vb);
3861 gtk_container_add (GTK_CONTAINER (weventbox), wb);
3862 gtk_container_add (GTK_CONTAINER (ti), weventbox);
3863
3864 if (wimage)
3865 {
3866 /* The EMACS_INT cast avoids a warning. */
3867 g_signal_connect (G_OBJECT (ti), "create-menu-proxy",
3868 G_CALLBACK (xg_tool_bar_menu_proxy),
3869 (gpointer) (EMACS_INT) i);
3870
3871 g_signal_connect (G_OBJECT (wb), "clicked",
3872 G_CALLBACK (xg_tool_bar_callback),
3873 (gpointer) (EMACS_INT) i);
3874
3875 g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f);
3876
3877 /* Catch expose events to overcome an annoying redraw bug, see
3878 comment for xg_tool_bar_item_expose_callback. */
3879 g_signal_connect (G_OBJECT (ti),
3880 "expose-event",
3881 G_CALLBACK (xg_tool_bar_item_expose_callback),
3882 0);
3883
3884 gtk_tool_item_set_homogeneous (ti, FALSE);
3885
3886 /* Callback to save modifyer mask (Shift/Control, etc). GTK makes
3887 no distinction based on modifiers in the activate callback,
3888 so we have to do it ourselves. */
3889 g_signal_connect (wb, "button-release-event",
3890 G_CALLBACK (xg_tool_bar_button_cb),
3891 NULL);
3892
3893 g_object_set_data (G_OBJECT (wb), XG_FRAME_DATA, (gpointer)f);
3894
3895 /* Use enter/leave notify to show help. We use the events
3896 rather than the GtkButton specific signals "enter" and
3897 "leave", so we can have only one callback. The event
3898 will tell us what kind of event it is. */
3899 /* The EMACS_INT cast avoids a warning. */
3900 g_signal_connect (G_OBJECT (weventbox),
3901 "enter-notify-event",
3902 G_CALLBACK (xg_tool_bar_help_callback),
3903 (gpointer) (EMACS_INT) i);
3904 g_signal_connect (G_OBJECT (weventbox),
3905 "leave-notify-event",
3906 G_CALLBACK (xg_tool_bar_help_callback),
3907 (gpointer) (EMACS_INT) i);
3908 }
3909
3910 if (wbutton) *wbutton = wb;
3911
3912 return ti;
3913}
3914
3915static void
3916xg_show_toolbar_item (GtkToolItem *ti)
3917{
3918 Lisp_Object style = Ftool_bar_get_system_style ();
3919
3920 int show_label = EQ (style, Qboth)
3921 || EQ (style, Qboth_horiz) || EQ (style, Qtext);
3922 int show_image = ! EQ (style, Qtext);
3923 int horiz = EQ (style, Qboth_horiz);
3924
3925 GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti));
3926 GtkWidget *wbutton = gtk_bin_get_child (GTK_BIN (weventbox));
3927 GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton)));
3928 GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data;
3929 GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data;
3930 GtkWidget *wimage = GTK_IS_IMAGE (c1->widget)
3931 ? c1->widget : c2->widget;
3932 GtkWidget *wlbl = GTK_IS_LABEL (c1->widget)
3933 ? c1->widget : c2->widget;
3934 GtkWidget *new_box = NULL;
3935
3936 if (GTK_IS_VBOX (vb) && horiz)
3937 new_box = gtk_hbox_new (FALSE, 0);
3938 else if (GTK_IS_HBOX (vb) && !horiz && show_label && show_image)
3939 new_box = gtk_vbox_new (FALSE, 0);
3940 if (new_box)
3941 {
3942 gtk_widget_ref (wimage);
3943 gtk_widget_ref (wlbl);
3944 gtk_container_remove (GTK_CONTAINER (vb), wimage);
3945 gtk_container_remove (GTK_CONTAINER (vb), wlbl);
3946 gtk_widget_destroy (GTK_WIDGET (vb));
3947 gtk_box_pack_start_defaults (GTK_BOX (new_box), wimage);
3948 gtk_box_pack_start_defaults (GTK_BOX (new_box), wlbl);
3949 gtk_container_add (GTK_CONTAINER (wbutton), new_box);
3950 gtk_widget_unref (wimage);
3951 gtk_widget_unref (wlbl);
3952 vb = GTK_BOX (new_box);
3953 }
3954
3955 if (show_label) gtk_widget_show (wlbl);
3956 else gtk_widget_hide (wlbl);
3957 if (show_image) gtk_widget_show (wimage);
3958 else gtk_widget_hide (wimage);
3959 gtk_widget_show (GTK_WIDGET (weventbox));
3960 gtk_widget_show (GTK_WIDGET (vb));
3961 gtk_widget_show (GTK_WIDGET (wbutton));
3962 gtk_widget_show (GTK_WIDGET (ti));
3963}
3964
3965
3829/* Update the tool bar for frame F. Add new buttons and remove old. */ 3966/* Update the tool bar for frame F. Add new buttons and remove old. */
3830 3967
3831extern Lisp_Object Qx_gtk_map_stock; 3968extern Lisp_Object Qx_gtk_map_stock;
@@ -3877,8 +4014,8 @@ update_frame_tool_bar (f)
3877 4014
3878 wtoolbar = GTK_TOOLBAR (x->toolbar_widget); 4015 wtoolbar = GTK_TOOLBAR (x->toolbar_widget);
3879 gtk_widget_size_request (GTK_WIDGET (wtoolbar), &old_req); 4016 gtk_widget_size_request (GTK_WIDGET (wtoolbar), &old_req);
3880 dir = gtk_widget_get_direction (x->toolbar_widget); 4017 dir = gtk_widget_get_direction (GTK_WIDGET (wtoolbar));
3881 4018
3882 for (i = 0; i < f->n_tool_bar_items; ++i) 4019 for (i = 0; i < f->n_tool_bar_items; ++i)
3883 { 4020 {
3884 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); 4021 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
@@ -3896,8 +4033,10 @@ update_frame_tool_bar (f)
3896 GtkWidget *wbutton = NULL; 4033 GtkWidget *wbutton = NULL;
3897 GtkWidget *weventbox; 4034 GtkWidget *weventbox;
3898 Lisp_Object specified_file; 4035 Lisp_Object specified_file;
3899 4036 Lisp_Object lbl = PROP (TOOL_BAR_ITEM_LABEL);
3900 ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (x->toolbar_widget), i); 4037 char *label = SSDATA (PROP (TOOL_BAR_ITEM_LABEL));
4038
4039 ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i);
3901 4040
3902 if (ti) 4041 if (ti)
3903 { 4042 {
@@ -3905,6 +4044,7 @@ update_frame_tool_bar (f)
3905 wbutton = gtk_bin_get_child (GTK_BIN (weventbox)); 4044 wbutton = gtk_bin_get_child (GTK_BIN (weventbox));
3906 } 4045 }
3907 4046
4047
3908 image = PROP (TOOL_BAR_ITEM_IMAGES); 4048 image = PROP (TOOL_BAR_ITEM_IMAGES);
3909 4049
3910 /* Ignore invalid image specifications. */ 4050 /* Ignore invalid image specifications. */
@@ -3936,7 +4076,7 @@ update_frame_tool_bar (f)
3936 icon_size = gtk_toolbar_get_icon_size (wtoolbar); 4076 icon_size = gtk_toolbar_get_icon_size (wtoolbar);
3937 } 4077 }
3938 else if (gtk_stock_lookup (SSDATA (stock), &stock_item)) 4078 else if (gtk_stock_lookup (SSDATA (stock), &stock_item))
3939 icon_size = gtk_toolbar_get_icon_size (wtoolbar); 4079 icon_size = gtk_toolbar_get_icon_size (wtoolbar);
3940 else 4080 else
3941 { 4081 {
3942 stock = Qnil; 4082 stock = Qnil;
@@ -3980,22 +4120,15 @@ update_frame_tool_bar (f)
3980 4120
3981 if (img->load_failed_p || img->pixmap == None) 4121 if (img->load_failed_p || img->pixmap == None)
3982 { 4122 {
3983 if (ti) 4123 if (ti)
3984 gtk_widget_hide_all (GTK_WIDGET (ti)); 4124 gtk_widget_hide_all (GTK_WIDGET (ti));
3985 else 4125 else
3986 { 4126 {
3987 /* Insert an empty (non-image) button */ 4127 /* Insert an empty (non-image) button */
3988 weventbox = gtk_event_box_new (); 4128 ti = xg_make_tool_item (f, NULL, NULL, "", i);
3989 wbutton = gtk_button_new (); 4129 gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1);
3990 gtk_button_set_focus_on_click (GTK_BUTTON (wbutton), FALSE);
3991 gtk_button_set_relief (GTK_BUTTON (wbutton),
3992 GTK_RELIEF_NONE);
3993 gtk_container_add (GTK_CONTAINER (weventbox), wbutton);
3994 ti = gtk_tool_item_new ();
3995 gtk_container_add (GTK_CONTAINER (ti), weventbox);
3996 gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, -1);
3997 } 4130 }
3998 continue; 4131 continue;
3999 } 4132 }
4000 } 4133 }
4001 4134
@@ -4026,73 +4159,27 @@ update_frame_tool_bar (f)
4026 } 4159 }
4027 4160
4028 gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); 4161 gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
4029 wbutton = gtk_button_new (); 4162 ti = xg_make_tool_item (f, w, &wbutton, label, i);
4030 gtk_button_set_focus_on_click (GTK_BUTTON (wbutton), FALSE); 4163 gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1);
4031 gtk_button_set_relief (GTK_BUTTON (wbutton), GTK_RELIEF_NONE);
4032 gtk_container_add (GTK_CONTAINER (wbutton), w);
4033 weventbox = gtk_event_box_new ();
4034 gtk_container_add (GTK_CONTAINER (weventbox), wbutton);
4035 ti = gtk_tool_item_new ();
4036 gtk_container_add (GTK_CONTAINER (ti), weventbox);
4037 gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, -1);
4038
4039
4040 /* The EMACS_INT cast avoids a warning. */
4041 g_signal_connect (G_OBJECT (ti), "create-menu-proxy",
4042 G_CALLBACK (xg_tool_bar_menu_proxy),
4043 (gpointer) (EMACS_INT) i);
4044
4045 g_signal_connect (G_OBJECT (wbutton), "clicked",
4046 G_CALLBACK (xg_tool_bar_callback),
4047 (gpointer) (EMACS_INT) i);
4048
4049 gtk_widget_show_all (GTK_WIDGET (ti));
4050
4051
4052 g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f);
4053
4054 /* Catch expose events to overcome an annoying redraw bug, see
4055 comment for xg_tool_bar_item_expose_callback. */
4056 g_signal_connect (G_OBJECT (ti),
4057 "expose-event",
4058 G_CALLBACK (xg_tool_bar_item_expose_callback),
4059 0);
4060
4061 gtk_widget_set_sensitive (wbutton, enabled_p); 4164 gtk_widget_set_sensitive (wbutton, enabled_p);
4062 gtk_tool_item_set_homogeneous (ti, FALSE);
4063
4064 /* Callback to save modifyer mask (Shift/Control, etc). GTK makes
4065 no distinction based on modifiers in the activate callback,
4066 so we have to do it ourselves. */
4067 g_signal_connect (wbutton, "button-release-event",
4068 G_CALLBACK (xg_tool_bar_button_cb),
4069 NULL);
4070
4071 g_object_set_data (G_OBJECT (wbutton), XG_FRAME_DATA, (gpointer)f);
4072
4073 /* Use enter/leave notify to show help. We use the events
4074 rather than the GtkButton specific signals "enter" and
4075 "leave", so we can have only one callback. The event
4076 will tell us what kind of event it is. */
4077 /* The EMACS_INT cast avoids a warning. */
4078 g_signal_connect (G_OBJECT (weventbox),
4079 "enter-notify-event",
4080 G_CALLBACK (xg_tool_bar_help_callback),
4081 (gpointer) (EMACS_INT) i);
4082 g_signal_connect (G_OBJECT (weventbox),
4083 "leave-notify-event",
4084 G_CALLBACK (xg_tool_bar_help_callback),
4085 (gpointer) (EMACS_INT) i);
4086 } 4165 }
4087 else 4166 else
4088 { 4167 {
4089 GtkWidget *wimage = gtk_bin_get_child (GTK_BIN (wbutton)); 4168 GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton)));
4169 GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data;
4170 GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data;
4171 GtkWidget *wimage = GTK_IS_IMAGE (c1->widget)
4172 ? c1->widget : c2->widget;
4173 GtkWidget *wlbl = GTK_IS_LABEL (c1->widget)
4174 ? c1->widget : c2->widget;
4175
4090 Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage), 4176 Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage),
4091 XG_TOOL_BAR_IMAGE_DATA); 4177 XG_TOOL_BAR_IMAGE_DATA);
4092 gpointer old_stock_name = g_object_get_data (G_OBJECT (wimage), 4178 gpointer old_stock_name = g_object_get_data (G_OBJECT (wimage),
4093 XG_TOOL_BAR_STOCK_NAME); 4179 XG_TOOL_BAR_STOCK_NAME);
4094 gpointer old_icon_name = g_object_get_data (G_OBJECT (wimage), 4180 gpointer old_icon_name = g_object_get_data (G_OBJECT (wimage),
4095 XG_TOOL_BAR_ICON_NAME); 4181 XG_TOOL_BAR_ICON_NAME);
4182 gtk_label_set_text (GTK_LABEL (wlbl), label);
4096 if (stock_name && 4183 if (stock_name &&
4097 (! old_stock_name || strcmp (old_stock_name, stock_name) != 0)) 4184 (! old_stock_name || strcmp (old_stock_name, stock_name) != 0))
4098 { 4185 {
@@ -4103,7 +4190,8 @@ update_frame_tool_bar (f)
4103 (GDestroyNotify) xfree); 4190 (GDestroyNotify) xfree);
4104 g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA, 4191 g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
4105 NULL); 4192 NULL);
4106 g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME, NULL); 4193 g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME,
4194 NULL);
4107 } 4195 }
4108 else if (icon_name && 4196 else if (icon_name &&
4109 (! old_icon_name || strcmp (old_icon_name, icon_name) != 0)) 4197 (! old_icon_name || strcmp (old_icon_name, icon_name) != 0))
@@ -4126,14 +4214,15 @@ update_frame_tool_bar (f)
4126 4214
4127 g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME, 4215 g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME,
4128 NULL); 4216 NULL);
4129 g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME, NULL); 4217 g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME,
4218 NULL);
4130 } 4219 }
4131 4220
4132 gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin); 4221 gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin);
4133 4222
4134 gtk_widget_set_sensitive (wbutton, enabled_p); 4223 gtk_widget_set_sensitive (wbutton, enabled_p);
4135 gtk_widget_show_all (GTK_WIDGET (ti)); 4224 }
4136 } 4225 xg_show_toolbar_item (ti);
4137 4226
4138#undef PROP 4227#undef PROP
4139 } 4228 }
@@ -4142,16 +4231,16 @@ update_frame_tool_bar (f)
4142 can be reused later on. */ 4231 can be reused later on. */
4143 do 4232 do
4144 { 4233 {
4145 ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (x->toolbar_widget), i++); 4234 ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i++);
4146 if (ti) gtk_widget_hide_all (GTK_WIDGET (ti)); 4235 if (ti) gtk_widget_hide_all (GTK_WIDGET (ti));
4147 } while (ti != NULL); 4236 } while (ti != NULL);
4148 4237
4149 new_req.height = 0; 4238 new_req.height = 0;
4150 if (pack_tool_bar && f->n_tool_bar_items != 0) 4239 if (pack_tool_bar && f->n_tool_bar_items != 0)
4151 xg_pack_tool_bar (f); 4240 xg_pack_tool_bar (f);
4152 4241
4153 4242
4154 gtk_widget_size_request (GTK_WIDGET (x->toolbar_widget), &new_req); 4243 gtk_widget_size_request (GTK_WIDGET (wtoolbar), &new_req);
4155 if (old_req.height != new_req.height 4244 if (old_req.height != new_req.height
4156 && ! FRAME_X_OUTPUT (f)->toolbar_detached) 4245 && ! FRAME_X_OUTPUT (f)->toolbar_detached)
4157 { 4246 {
@@ -4195,7 +4284,7 @@ free_frame_tool_bar (f)
4195 4284
4196/*********************************************************************** 4285/***********************************************************************
4197 Initializing 4286 Initializing
4198 ***********************************************************************/ 4287***********************************************************************/
4199void 4288void
4200xg_initialize () 4289xg_initialize ()
4201{ 4290{
diff --git a/src/image.c b/src/image.c
index 8159575e640..5865d7be00a 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7961,7 +7961,7 @@ imagemagick_load_image (f, img, contents, size, filename)
7961 7961
7962DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0,0,0, 7962DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0,0,0,
7963 doc: /* Return image file types supported by ImageMagick. 7963 doc: /* Return image file types supported by ImageMagick.
7964 Since ImageMagic recognizes a lot of file-types that clash with Emacs, 7964 Since ImageMagick recognizes a lot of file-types that clash with Emacs,
7965 such as .c, we want to be able to alter the list at the lisp level. */) 7965 such as .c, we want to be able to alter the list at the lisp level. */)
7966 () 7966 ()
7967{ 7967{
diff --git a/src/insdel.c b/src/insdel.c
index ededd597b0d..6cc797a12ff 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -54,7 +54,7 @@ static void adjust_point (EMACS_INT nchars, EMACS_INT nbytes);
54Lisp_Object Fcombine_after_change_execute (); 54Lisp_Object Fcombine_after_change_execute ();
55 55
56/* Non-nil means don't call the after-change-functions right away, 56/* Non-nil means don't call the after-change-functions right away,
57 just record an element in Vcombine_after_change_calls_list. */ 57 just record an element in combine_after_change_list. */
58Lisp_Object Vcombine_after_change_calls; 58Lisp_Object Vcombine_after_change_calls;
59 59
60/* List of elements of the form (BEG-UNCHANGED END-UNCHANGED CHANGE-AMOUNT) 60/* List of elements of the form (BEG-UNCHANGED END-UNCHANGED CHANGE-AMOUNT)
diff --git a/src/keyboard.c b/src/keyboard.c
index f2aeff89542..74efb856852 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -496,7 +496,7 @@ Lisp_Object Qevent_symbol_elements;
496/* menu item parts */ 496/* menu item parts */
497Lisp_Object Qmenu_enable; 497Lisp_Object Qmenu_enable;
498Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence; 498Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence;
499Lisp_Object QCbutton, QCtoggle, QCradio; 499Lisp_Object QCbutton, QCtoggle, QCradio, QClabel;
500extern Lisp_Object Qmenu_item; 500extern Lisp_Object Qmenu_item;
501 501
502/* An event header symbol HEAD may have a property named 502/* An event header symbol HEAD may have a property named
@@ -1520,7 +1520,6 @@ Lisp_Object
1520command_loop_1 () 1520command_loop_1 ()
1521{ 1521{
1522 Lisp_Object cmd; 1522 Lisp_Object cmd;
1523 int lose;
1524 Lisp_Object keybuf[30]; 1523 Lisp_Object keybuf[30];
1525 int i; 1524 int i;
1526 int prev_modiff = 0; 1525 int prev_modiff = 0;
@@ -8249,7 +8248,11 @@ process_tool_bar_item (key, def, data, args)
8249 8248
8250 - `:help HELP-STRING'. 8249 - `:help HELP-STRING'.
8251 8250
8252 Gives a help string to display for the tool bar item. */ 8251 Gives a help string to display for the tool bar item.
8252
8253 - `:label LABEL-STRING'.
8254
8255 A text label to show with the tool bar button if labels are enabled. */
8253 8256
8254static int 8257static int
8255parse_tool_bar_item (key, item) 8258parse_tool_bar_item (key, item)
@@ -8260,7 +8263,7 @@ parse_tool_bar_item (key, item)
8260 8263
8261 Lisp_Object filter = Qnil; 8264 Lisp_Object filter = Qnil;
8262 Lisp_Object caption; 8265 Lisp_Object caption;
8263 int i; 8266 int i, have_label = 0;
8264 8267
8265 /* Defininition looks like `(menu-item CAPTION BINDING PROPS...)'. 8268 /* Defininition looks like `(menu-item CAPTION BINDING PROPS...)'.
8266 Rule out items that aren't lists, don't start with 8269 Rule out items that aren't lists, don't start with
@@ -8338,6 +8341,12 @@ parse_tool_bar_item (key, item)
8338 else if (EQ (key, QChelp)) 8341 else if (EQ (key, QChelp))
8339 /* `:help HELP-STRING'. */ 8342 /* `:help HELP-STRING'. */
8340 PROP (TOOL_BAR_ITEM_HELP) = value; 8343 PROP (TOOL_BAR_ITEM_HELP) = value;
8344 else if (EQ (key, QClabel))
8345 {
8346 /* `:label LABEL-STRING'. */
8347 PROP (TOOL_BAR_ITEM_LABEL) = value;
8348 have_label = 1;
8349 }
8341 else if (EQ (key, QCfilter)) 8350 else if (EQ (key, QCfilter))
8342 /* ':filter FORM'. */ 8351 /* ':filter FORM'. */
8343 filter = value; 8352 filter = value;
@@ -8365,6 +8374,49 @@ parse_tool_bar_item (key, item)
8365 PROP (TOOL_BAR_ITEM_RTL_IMAGE) = value; 8374 PROP (TOOL_BAR_ITEM_RTL_IMAGE) = value;
8366 } 8375 }
8367 8376
8377
8378 if (!have_label)
8379 {
8380 /* Try to make one from caption and key. */
8381 Lisp_Object key = PROP (TOOL_BAR_ITEM_KEY);
8382 Lisp_Object capt = PROP (TOOL_BAR_ITEM_CAPTION);
8383 char *label = SYMBOLP (key) ? (char *) SDATA (SYMBOL_NAME (key)) : "";
8384 char *caption = STRINGP (capt) ? (char *) SDATA (capt) : "";
8385 char buf[64];
8386 EMACS_INT max_lbl = 2*tool_bar_max_label_size;
8387 Lisp_Object new_lbl;
8388
8389 if (strlen (caption) < max_lbl && caption[0] != '\0')
8390 {
8391 strcpy (buf, caption);
8392 while (buf[0] != '\0' && buf[strlen (buf) -1] == '.')
8393 buf[strlen (buf)-1] = '\0';
8394 if (strlen (buf) <= max_lbl)
8395 caption = buf;
8396 }
8397
8398 if (strlen (caption) <= max_lbl)
8399 label = caption;
8400
8401 if (strlen (label) <= max_lbl && label[0] != '\0')
8402 {
8403 int i;
8404 if (label != buf) strcpy (buf, label);
8405
8406 for (i = 0; i < strlen (buf); ++i)
8407 {
8408 if (buf[i] == '-') buf[i] = ' ';
8409 }
8410 label = buf;
8411
8412 }
8413 else label = "";
8414
8415 new_lbl = Fupcase_initials (make_string (label, strlen (label)));
8416 if (SCHARS (new_lbl) <= tool_bar_max_label_size)
8417 PROP (TOOL_BAR_ITEM_LABEL) = new_lbl;
8418 }
8419
8368 /* If got a filter apply it on binding. */ 8420 /* If got a filter apply it on binding. */
8369 if (!NILP (filter)) 8421 if (!NILP (filter))
8370 PROP (TOOL_BAR_ITEM_BINDING) 8422 PROP (TOOL_BAR_ITEM_BINDING)
@@ -11700,6 +11752,8 @@ syms_of_keyboard ()
11700 staticpro (&QCtoggle); 11752 staticpro (&QCtoggle);
11701 QCradio = intern_c_string (":radio"); 11753 QCradio = intern_c_string (":radio");
11702 staticpro (&QCradio); 11754 staticpro (&QCradio);
11755 QClabel = intern_c_string (":label");
11756 staticpro (&QClabel);
11703 11757
11704 Qmode_line = intern_c_string ("mode-line"); 11758 Qmode_line = intern_c_string ("mode-line");
11705 staticpro (&Qmode_line); 11759 staticpro (&Qmode_line);
diff --git a/src/lisp.h b/src/lisp.h
index 7f5d5df66c6..7d329cc754c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -223,13 +223,7 @@ enum Lisp_Misc_Type
223 { 223 {
224 Lisp_Misc_Free = 0x5eab, 224 Lisp_Misc_Free = 0x5eab,
225 Lisp_Misc_Marker, 225 Lisp_Misc_Marker,
226 Lisp_Misc_Intfwd,
227 Lisp_Misc_Boolfwd,
228 Lisp_Misc_Objfwd,
229 Lisp_Misc_Buffer_Objfwd,
230 Lisp_Misc_Buffer_Local_Value,
231 Lisp_Misc_Overlay, 226 Lisp_Misc_Overlay,
232 Lisp_Misc_Kboard_Objfwd,
233 Lisp_Misc_Save_Value, 227 Lisp_Misc_Save_Value,
234 /* Currently floats are not a misc type, 228 /* Currently floats are not a misc type,
235 but let's define this in case we want to change that. */ 229 but let's define this in case we want to change that. */
@@ -238,6 +232,18 @@ enum Lisp_Misc_Type
238 Lisp_Misc_Limit 232 Lisp_Misc_Limit
239 }; 233 };
240 234
235/* These are the types of forwarding objects used in the value slot
236 of symbols for special built-in variables whose value is stored in
237 C variables. */
238enum Lisp_Fwd_Type
239 {
240 Lisp_Fwd_Int, /* Fwd to a C `int' variable. */
241 Lisp_Fwd_Bool, /* Fwd to a C boolean var. */
242 Lisp_Fwd_Obj, /* Fwd to a C Lisp_Object variable. */
243 Lisp_Fwd_Buffer_Obj, /* Fwd to a Lisp_Object field of buffers. */
244 Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */
245 };
246
241#ifndef GCTYPEBITS 247#ifndef GCTYPEBITS
242#define GCTYPEBITS 3 248#define GCTYPEBITS 3
243#endif 249#endif
@@ -566,17 +572,19 @@ extern size_t pure_size;
566#define XMISCANY(a) (eassert (MISCP (a)), &(XMISC(a)->u_any)) 572#define XMISCANY(a) (eassert (MISCP (a)), &(XMISC(a)->u_any))
567#define XMISCTYPE(a) (XMISCANY (a)->type) 573#define XMISCTYPE(a) (XMISCANY (a)->type)
568#define XMARKER(a) (eassert (MARKERP (a)), &(XMISC(a)->u_marker)) 574#define XMARKER(a) (eassert (MARKERP (a)), &(XMISC(a)->u_marker))
569#define XINTFWD(a) (eassert (INTFWDP (a)), &(XMISC(a)->u_intfwd))
570#define XBOOLFWD(a) (eassert (BOOLFWDP (a)), &(XMISC(a)->u_boolfwd))
571#define XOBJFWD(a) (eassert (OBJFWDP (a)), &(XMISC(a)->u_objfwd))
572#define XOVERLAY(a) (eassert (OVERLAYP (a)), &(XMISC(a)->u_overlay)) 575#define XOVERLAY(a) (eassert (OVERLAYP (a)), &(XMISC(a)->u_overlay))
573#define XSAVE_VALUE(a) (eassert (SAVE_VALUEP (a)), &(XMISC(a)->u_save_value)) 576#define XSAVE_VALUE(a) (eassert (SAVE_VALUEP (a)), &(XMISC(a)->u_save_value))
577
578/* Forwarding object types. */
579
580#define XFWDTYPE(a) (a->u_intfwd.type)
581#define XINTFWD(a) (eassert (INTFWDP (a)), &((a)->u_intfwd))
582#define XBOOLFWD(a) (eassert (BOOLFWDP (a)), &((a)->u_boolfwd))
583#define XOBJFWD(a) (eassert (OBJFWDP (a)), &((a)->u_objfwd))
574#define XBUFFER_OBJFWD(a) \ 584#define XBUFFER_OBJFWD(a) \
575 (eassert (BUFFER_OBJFWDP (a)), &(XMISC(a)->u_buffer_objfwd)) 585 (eassert (BUFFER_OBJFWDP (a)), &((a)->u_buffer_objfwd))
576#define XBUFFER_LOCAL_VALUE(a) \
577 (eassert (BUFFER_LOCAL_VALUEP (a)), &(XMISC(a)->u_buffer_local_value))
578#define XKBOARD_OBJFWD(a) \ 586#define XKBOARD_OBJFWD(a) \
579 (eassert (KBOARD_OBJFWDP (a)), &(XMISC(a)->u_kboard_objfwd)) 587 (eassert (KBOARD_OBJFWDP (a)), &((a)->u_kboard_objfwd))
580 588
581/* Pseudovector types. */ 589/* Pseudovector types. */
582 590
@@ -713,11 +721,6 @@ struct Lisp_Cons
713#define XSETCAR(c,n) (XCAR_AS_LVALUE(c) = (n)) 721#define XSETCAR(c,n) (XCAR_AS_LVALUE(c) = (n))
714#define XSETCDR(c,n) (XCDR_AS_LVALUE(c) = (n)) 722#define XSETCDR(c,n) (XCDR_AS_LVALUE(c) = (n))
715 723
716/* For performance: Fast storage of positive integers into the
717 fields of a cons cell. See above caveats. */
718#define XSETCARFASTINT(c,n) XSETFASTINT(XCAR_AS_LVALUE(c),(n))
719#define XSETCDRFASTINT(c,n) XSETFASTINT(XCDR_AS_LVALUE(c),(n))
720
721/* Take the car or cdr of something whose type is not known. */ 724/* Take the car or cdr of something whose type is not known. */
722#define CAR(c) \ 725#define CAR(c) \
723 (CONSP ((c)) ? XCAR ((c)) \ 726 (CONSP ((c)) ? XCAR ((c)) \
@@ -988,19 +991,32 @@ enum symbol_interned
988 SYMBOL_INTERNED_IN_INITIAL_OBARRAY = 2 991 SYMBOL_INTERNED_IN_INITIAL_OBARRAY = 2
989}; 992};
990 993
994enum symbol_redirect
995{
996 SYMBOL_PLAINVAL = 4,
997 SYMBOL_VARALIAS = 1,
998 SYMBOL_LOCALIZED = 2,
999 SYMBOL_FORWARDED = 3
1000};
1001
991/* In a symbol, the markbit of the plist is used as the gc mark bit */ 1002/* In a symbol, the markbit of the plist is used as the gc mark bit */
992 1003
993struct Lisp_Symbol 1004struct Lisp_Symbol
994{ 1005{
995 unsigned gcmarkbit : 1; 1006 unsigned gcmarkbit : 1;
996 1007
997 /* Non-zero means symbol serves as a variable alias. The symbol 1008 /* Indicates where the value can be found:
998 holding the real value is found in the value slot. */ 1009 0 : it's a plain var, the value is in the `value' field.
999 unsigned indirect_variable : 1; 1010 1 : it's a varalias, the value is really in the `alias' symbol.
1011 2 : it's a localized var, the value is in the `blv' object.
1012 3 : it's a forwarding variable, the value is in `forward'.
1013 */
1014 enum symbol_redirect redirect : 3;
1000 1015
1001 /* Non-zero means symbol is constant, i.e. changing its value 1016 /* Non-zero means symbol is constant, i.e. changing its value
1002 should signal an error. */ 1017 should signal an error. If the value is 3, then the var
1003 unsigned constant : 1; 1018 can be changed, but only by `defconst'. */
1019 unsigned constant : 2;
1004 1020
1005 /* Interned state of the symbol. This is an enumerator from 1021 /* Interned state of the symbol. This is an enumerator from
1006 enum symbol_interned. */ 1022 enum symbol_interned. */
@@ -1013,10 +1029,15 @@ struct Lisp_Symbol
1013 Lisp_Object xname; 1029 Lisp_Object xname;
1014 1030
1015 /* Value of the symbol or Qunbound if unbound. If this symbol is a 1031 /* Value of the symbol or Qunbound if unbound. If this symbol is a
1016 defvaralias, `value' contains the symbol for which it is an 1032 defvaralias, `alias' contains the symbol for which it is an
1017 alias. Use the SYMBOL_VALUE and SET_SYMBOL_VALUE macros to get 1033 alias. Use the SYMBOL_VALUE and SET_SYMBOL_VALUE macros to get
1018 and set a symbol's value, to take defvaralias into account. */ 1034 and set a symbol's value, to take defvaralias into account. */
1019 Lisp_Object value; 1035 union {
1036 Lisp_Object value;
1037 struct Lisp_Symbol *alias;
1038 struct Lisp_Buffer_Local_Value *blv;
1039 union Lisp_Fwd *fwd;
1040 } val;
1020 1041
1021 /* Function value of the symbol or Qunbound if not fboundp. */ 1042 /* Function value of the symbol or Qunbound if not fboundp. */
1022 Lisp_Object function; 1043 Lisp_Object function;
@@ -1030,6 +1051,23 @@ struct Lisp_Symbol
1030 1051
1031/* Value is name of symbol. */ 1052/* Value is name of symbol. */
1032 1053
1054#define SYMBOL_VAL(sym) \
1055 (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value)
1056#define SYMBOL_ALIAS(sym) \
1057 (eassert ((sym)->redirect == SYMBOL_VARALIAS), (sym)->val.alias)
1058#define SYMBOL_BLV(sym) \
1059 (eassert ((sym)->redirect == SYMBOL_LOCALIZED), (sym)->val.blv)
1060#define SYMBOL_FWD(sym) \
1061 (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd)
1062#define SET_SYMBOL_VAL(sym, v) \
1063 (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value = (v))
1064#define SET_SYMBOL_ALIAS(sym, v) \
1065 (eassert ((sym)->redirect == SYMBOL_VARALIAS), (sym)->val.alias = (v))
1066#define SET_SYMBOL_BLV(sym, v) \
1067 (eassert ((sym)->redirect == SYMBOL_LOCALIZED), (sym)->val.blv = (v))
1068#define SET_SYMBOL_FWD(sym, v) \
1069 (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd = (v))
1070
1033#define SYMBOL_NAME(sym) \ 1071#define SYMBOL_NAME(sym) \
1034 LISP_MAKE_RVALUE (XSYMBOL (sym)->xname) 1072 LISP_MAKE_RVALUE (XSYMBOL (sym)->xname)
1035 1073
@@ -1049,24 +1087,6 @@ struct Lisp_Symbol
1049 1087
1050#define SYMBOL_CONSTANT_P(sym) XSYMBOL (sym)->constant 1088#define SYMBOL_CONSTANT_P(sym) XSYMBOL (sym)->constant
1051 1089
1052/* Value is the value of SYM, with defvaralias taken into
1053 account. */
1054
1055#define SYMBOL_VALUE(sym) \
1056 (XSYMBOL (sym)->indirect_variable \
1057 ? indirect_variable (XSYMBOL (sym))->value \
1058 : XSYMBOL (sym)->value)
1059
1060/* Set SYM's value to VAL, taking defvaralias into account. */
1061
1062#define SET_SYMBOL_VALUE(sym, val) \
1063 do { \
1064 if (XSYMBOL (sym)->indirect_variable) \
1065 indirect_variable (XSYMBOL (sym))->value = (val); \
1066 else \
1067 XSYMBOL (sym)->value = (val); \
1068 } while (0)
1069
1070 1090
1071/*********************************************************************** 1091/***********************************************************************
1072 Hash Tables 1092 Hash Tables
@@ -1200,9 +1220,11 @@ struct Lisp_Hash_Table
1200 1220
1201struct Lisp_Misc_Any /* Supertype of all Misc types. */ 1221struct Lisp_Misc_Any /* Supertype of all Misc types. */
1202{ 1222{
1203 enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Marker */ 1223 enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_??? */
1204 unsigned gcmarkbit : 1; 1224 unsigned gcmarkbit : 1;
1205 int spacer : 15; 1225 int spacer : 15;
1226 /* Make it as long as "Lisp_Free without padding". */
1227 void *fill;
1206}; 1228};
1207 1229
1208struct Lisp_Marker 1230struct Lisp_Marker
@@ -1225,7 +1247,7 @@ struct Lisp_Marker
1225 - Fmarker_buffer 1247 - Fmarker_buffer
1226 - Fset_marker: check eq(oldbuf, newbuf) to avoid unchain+rechain. 1248 - Fset_marker: check eq(oldbuf, newbuf) to avoid unchain+rechain.
1227 - unchain_marker: to find the list from which to unchain. 1249 - unchain_marker: to find the list from which to unchain.
1228 - Fkill_buffer: to unchain the markers of current indirect buffer. 1250 - Fkill_buffer: to only unchain the markers of current indirect buffer.
1229 */ 1251 */
1230 struct buffer *buffer; 1252 struct buffer *buffer;
1231 1253
@@ -1239,7 +1261,10 @@ struct Lisp_Marker
1239 struct Lisp_Marker *next; 1261 struct Lisp_Marker *next;
1240 /* This is the char position where the marker points. */ 1262 /* This is the char position where the marker points. */
1241 EMACS_INT charpos; 1263 EMACS_INT charpos;
1242 /* This is the byte position. */ 1264 /* This is the byte position.
1265 It's mostly used as a charpos<->bytepos cache (i.e. it's not directly
1266 used to implement the functionality of markers, but rather to (ab)use
1267 markers as a cache for char<->byte mappings). */
1243 EMACS_INT bytepos; 1268 EMACS_INT bytepos;
1244}; 1269};
1245 1270
@@ -1249,9 +1274,7 @@ struct Lisp_Marker
1249 specified int variable. */ 1274 specified int variable. */
1250struct Lisp_Intfwd 1275struct Lisp_Intfwd
1251 { 1276 {
1252 int type : 16; /* = Lisp_Misc_Intfwd */ 1277 enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Int */
1253 unsigned gcmarkbit : 1;
1254 int spacer : 15;
1255 EMACS_INT *intvar; 1278 EMACS_INT *intvar;
1256 }; 1279 };
1257 1280
@@ -1261,9 +1284,7 @@ struct Lisp_Intfwd
1261 nil if it is zero. */ 1284 nil if it is zero. */
1262struct Lisp_Boolfwd 1285struct Lisp_Boolfwd
1263 { 1286 {
1264 int type : 16; /* = Lisp_Misc_Boolfwd */ 1287 enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Bool */
1265 unsigned gcmarkbit : 1;
1266 int spacer : 15;
1267 int *boolvar; 1288 int *boolvar;
1268 }; 1289 };
1269 1290
@@ -1273,9 +1294,7 @@ struct Lisp_Boolfwd
1273 specified variable. */ 1294 specified variable. */
1274struct Lisp_Objfwd 1295struct Lisp_Objfwd
1275 { 1296 {
1276 int type : 16; /* = Lisp_Misc_Objfwd */ 1297 enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Obj */
1277 unsigned gcmarkbit : 1;
1278 int spacer : 15;
1279 Lisp_Object *objvar; 1298 Lisp_Object *objvar;
1280 }; 1299 };
1281 1300
@@ -1283,11 +1302,9 @@ struct Lisp_Objfwd
1283 current buffer. Value is byte index of slot within buffer. */ 1302 current buffer. Value is byte index of slot within buffer. */
1284struct Lisp_Buffer_Objfwd 1303struct Lisp_Buffer_Objfwd
1285 { 1304 {
1286 int type : 16; /* = Lisp_Misc_Buffer_Objfwd */ 1305 enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Buffer_Obj */
1287 unsigned gcmarkbit : 1;
1288 int spacer : 15;
1289 Lisp_Object slottype; /* Qnil, Lisp_Int, Lisp_Symbol, or Lisp_String. */
1290 int offset; 1306 int offset;
1307 Lisp_Object slottype; /* Qnil, Lisp_Int, Lisp_Symbol, or Lisp_String. */
1291 }; 1308 };
1292 1309
1293/* struct Lisp_Buffer_Local_Value is used in a symbol value cell when 1310/* struct Lisp_Buffer_Local_Value is used in a symbol value cell when
@@ -1316,48 +1333,51 @@ struct Lisp_Buffer_Objfwd
1316 1333
1317struct Lisp_Buffer_Local_Value 1334struct Lisp_Buffer_Local_Value
1318 { 1335 {
1319 int type : 16; /* = Lisp_Misc_Buffer_Local_Value */
1320 unsigned gcmarkbit : 1;
1321 int spacer : 11;
1322
1323 /* 1 means that merely setting the variable creates a local 1336 /* 1 means that merely setting the variable creates a local
1324 binding for the current buffer */ 1337 binding for the current buffer */
1325 unsigned int local_if_set : 1; 1338 unsigned int local_if_set : 1;
1326 /* 1 means this variable is allowed to have frame-local bindings, 1339 /* 1 means this variable can have frame-local bindings, otherwise, it is
1327 so check for them when looking for the proper binding. */ 1340 can have buffer-local bindings. The two cannot be combined. */
1328 unsigned int check_frame : 1; 1341 unsigned int frame_local : 1;
1329 /* 1 means that the binding now loaded was found 1342 /* 1 means that the binding now loaded was found.
1330 as a local binding for the buffer in the `buffer' slot. */ 1343 Presumably equivalent to (defcell!=valcell) */
1331 unsigned int found_for_buffer : 1; 1344 unsigned int found : 1;
1332 /* 1 means that the binding now loaded was found 1345 /* If non-NULL, a forwarding to the C var where it should also be set. */
1333 as a local binding for the frame in the `frame' slot. */ 1346 union Lisp_Fwd *fwd; /* Should never be (Buffer|Kboard)_Objfwd. */
1334 unsigned int found_for_frame : 1; 1347 /* The buffer or frame for which the loaded binding was found. */
1335 Lisp_Object realvalue; 1348 Lisp_Object where;
1336 /* The buffer and frame for which the loaded binding was found. */ 1349 /* A cons cell that holds the default value. It has the form
1337 /* Having both is only needed if we want to allow variables that are 1350 (SYMBOL . DEFAULT-VALUE). */
1338 both buffer local and frame local (in which case, we currently give 1351 Lisp_Object defcell;
1339 precedence to the buffer-local binding). I don't think such 1352 /* The cons cell from `where's parameter alist.
1340 a combination is desirable. --Stef */ 1353 It always has the form (SYMBOL . VALUE)
1341 Lisp_Object buffer, frame; 1354 Note that if `forward' is non-nil, VALUE may be out of date.
1342 1355 Also if the currently loaded binding is the default binding, then
1343 /* A cons cell, (LOADED-BINDING . DEFAULT-VALUE). 1356 this is `eq'ual to defcell. */
1344 1357 Lisp_Object valcell;
1345 LOADED-BINDING is the binding now loaded. It is a cons cell
1346 whose cdr is the binding's value. The cons cell may be an
1347 element of a buffer's local-variable alist, or an element of a
1348 frame's parameter alist, or it may be this cons cell.
1349
1350 DEFAULT-VALUE is the variable's default value, seen when the
1351 current buffer and selected frame do not have their own
1352 bindings for the variable. When the default binding is loaded,
1353 LOADED-BINDING is actually this very cons cell; thus, its car
1354 points to itself. */
1355 Lisp_Object cdr;
1356 }; 1358 };
1357 1359
1360#define BLV_FOUND(blv) \
1361 (eassert ((blv)->found == !EQ ((blv)->defcell, (blv)->valcell)), (blv)->found)
1362#define SET_BLV_FOUND(blv, v) \
1363 (eassert ((v) == !EQ ((blv)->defcell, (blv)->valcell)), (blv)->found = (v))
1364
1365#define BLV_VALUE(blv) (XCDR ((blv)->valcell))
1366#define SET_BLV_VALUE(blv, v) (XSETCDR ((blv)->valcell, v))
1367
1358/* START and END are markers in the overlay's buffer, and 1368/* START and END are markers in the overlay's buffer, and
1359 PLIST is the overlay's property list. */ 1369 PLIST is the overlay's property list. */
1360struct Lisp_Overlay 1370struct Lisp_Overlay
1371/* An overlay's real data content is:
1372 - plist
1373 - buffer
1374 - insertion type of both ends
1375 - start & start_byte
1376 - end & end_byte
1377 - next (singly linked list of overlays).
1378 - start_next and end_next (singly linked list of markers).
1379 I.e. 9words plus 2 bits, 3words of which are for external linked lists.
1380*/
1361 { 1381 {
1362 enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Overlay */ 1382 enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Overlay */
1363 unsigned gcmarkbit : 1; 1383 unsigned gcmarkbit : 1;
@@ -1370,9 +1390,7 @@ struct Lisp_Overlay
1370 current kboard. */ 1390 current kboard. */
1371struct Lisp_Kboard_Objfwd 1391struct Lisp_Kboard_Objfwd
1372 { 1392 {
1373 enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Kboard_Objfwd */ 1393 enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Kboard_Obj */
1374 unsigned gcmarkbit : 1;
1375 int spacer : 15;
1376 int offset; 1394 int offset;
1377 }; 1395 };
1378 1396
@@ -1401,9 +1419,9 @@ struct Lisp_Free
1401#ifdef USE_LSB_TAG 1419#ifdef USE_LSB_TAG
1402 /* Try to make sure that sizeof(Lisp_Misc) preserves TYPEBITS-alignment. 1420 /* Try to make sure that sizeof(Lisp_Misc) preserves TYPEBITS-alignment.
1403 This assumes that Lisp_Marker is the largest of the alternatives and 1421 This assumes that Lisp_Marker is the largest of the alternatives and
1404 that Lisp_Intfwd has the same size as "Lisp_Free w/o padding". */ 1422 that Lisp_Misc_Any has the same size as "Lisp_Free w/o padding". */
1405 char padding[((((sizeof (struct Lisp_Marker) - 1) >> GCTYPEBITS) + 1) 1423 char padding[((((sizeof (struct Lisp_Marker) - 1) >> GCTYPEBITS) + 1)
1406 << GCTYPEBITS) - sizeof (struct Lisp_Intfwd)]; 1424 << GCTYPEBITS) - sizeof (struct Lisp_Misc_Any)];
1407#endif 1425#endif
1408 }; 1426 };
1409 1427
@@ -1414,15 +1432,18 @@ union Lisp_Misc
1414 { 1432 {
1415 struct Lisp_Misc_Any u_any; /* Supertype of all Misc types. */ 1433 struct Lisp_Misc_Any u_any; /* Supertype of all Misc types. */
1416 struct Lisp_Free u_free; /* Includes padding to force alignment. */ 1434 struct Lisp_Free u_free; /* Includes padding to force alignment. */
1417 struct Lisp_Marker u_marker; 1435 struct Lisp_Marker u_marker; /* 5 */
1418 struct Lisp_Intfwd u_intfwd; 1436 struct Lisp_Overlay u_overlay; /* 5 */
1419 struct Lisp_Boolfwd u_boolfwd; 1437 struct Lisp_Save_Value u_save_value; /* 3 */
1420 struct Lisp_Objfwd u_objfwd; 1438 };
1421 struct Lisp_Buffer_Objfwd u_buffer_objfwd; 1439
1422 struct Lisp_Buffer_Local_Value u_buffer_local_value; 1440union Lisp_Fwd
1423 struct Lisp_Overlay u_overlay; 1441 {
1424 struct Lisp_Kboard_Objfwd u_kboard_objfwd; 1442 struct Lisp_Intfwd u_intfwd; /* 2 */
1425 struct Lisp_Save_Value u_save_value; 1443 struct Lisp_Boolfwd u_boolfwd; /* 2 */
1444 struct Lisp_Objfwd u_objfwd; /* 2 */
1445 struct Lisp_Buffer_Objfwd u_buffer_objfwd; /* 2 */
1446 struct Lisp_Kboard_Objfwd u_kboard_objfwd; /* 2 */
1426 }; 1447 };
1427 1448
1428/* Lisp floating point type */ 1449/* Lisp floating point type */
@@ -1564,15 +1585,13 @@ typedef struct {
1564#define VECTORP(x) (VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG)) 1585#define VECTORP(x) (VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG))
1565#define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay) 1586#define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay)
1566#define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker) 1587#define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
1567#define INTFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Intfwd)
1568#define BOOLFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Boolfwd)
1569#define OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Objfwd)
1570#define BUFFER_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Objfwd)
1571#define BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Local_Value)
1572#define SOME_BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Some_Buffer_Local_Value)
1573#define KBOARD_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Kboard_Objfwd)
1574#define SAVE_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value) 1588#define SAVE_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value)
1575 1589
1590#define INTFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Int)
1591#define BOOLFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Bool)
1592#define OBJFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Obj)
1593#define BUFFER_OBJFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Buffer_Obj)
1594#define KBOARD_OBJFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Kboard_Obj)
1576 1595
1577/* True if object X is a pseudovector whose code is CODE. */ 1596/* True if object X is a pseudovector whose code is CODE. */
1578#define PSEUDOVECTORP(x, code) \ 1597#define PSEUDOVECTORP(x, code) \
@@ -1789,24 +1808,44 @@ extern void defsubr P_ ((struct Lisp_Subr *));
1789#define MANY -2 1808#define MANY -2
1790#define UNEVALLED -1 1809#define UNEVALLED -1
1791 1810
1792extern void defvar_lisp (const char *, Lisp_Object *); 1811extern void defvar_lisp (struct Lisp_Objfwd *, const char *, Lisp_Object *);
1793extern void defvar_lisp_nopro (const char *, Lisp_Object *); 1812extern void defvar_lisp_nopro (struct Lisp_Objfwd *, const char *, Lisp_Object *);
1794extern void defvar_bool (const char *, int *); 1813extern void defvar_bool (struct Lisp_Boolfwd *, const char *, int *);
1795extern void defvar_int (const char *, EMACS_INT *); 1814extern void defvar_int (struct Lisp_Intfwd *, const char *, EMACS_INT *);
1796extern void defvar_kboard (const char *, int); 1815extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int);
1797 1816
1798/* Macros we use to define forwarded Lisp variables. 1817/* Macros we use to define forwarded Lisp variables.
1799 These are used in the syms_of_FILENAME functions. */ 1818 These are used in the syms_of_FILENAME functions. */
1800 1819
1801#define DEFVAR_LISP(lname, vname, doc) defvar_lisp (lname, vname) 1820#define DEFVAR_LISP(lname, vname, doc) \
1802#define DEFVAR_LISP_NOPRO(lname, vname, doc) defvar_lisp_nopro (lname, vname) 1821 do { \
1803#define DEFVAR_BOOL(lname, vname, doc) defvar_bool (lname, vname) 1822 static struct Lisp_Objfwd o_fwd; \
1804#define DEFVAR_INT(lname, vname, doc) defvar_int (lname, vname) 1823 defvar_lisp (&o_fwd, lname, vname); \
1824 } while (0)
1825#define DEFVAR_LISP_NOPRO(lname, vname, doc) \
1826 do { \
1827 static struct Lisp_Objfwd o_fwd; \
1828 defvar_lisp_nopro (&o_fwd, lname, vname); \
1829 } while (0)
1830#define DEFVAR_BOOL(lname, vname, doc) \
1831 do { \
1832 static struct Lisp_Boolfwd b_fwd; \
1833 defvar_bool (&b_fwd, lname, vname); \
1834 } while (0)
1835#define DEFVAR_INT(lname, vname, doc) \
1836 do { \
1837 static struct Lisp_Intfwd i_fwd; \
1838 defvar_int (&i_fwd, lname, vname); \
1839 } while (0)
1805 1840
1806#define DEFVAR_KBOARD(lname, vname, doc) \ 1841#define DEFVAR_KBOARD(lname, vname, doc) \
1807 defvar_kboard (lname, \ 1842 do { \
1808 (int)((char *)(&current_kboard->vname) \ 1843 static struct Lisp_Kboard_Objfwd ko_fwd; \
1809 - (char *)current_kboard)) 1844 defvar_kboard (&ko_fwd, \
1845 lname, \
1846 (int)((char *)(&current_kboard->vname) \
1847 - (char *)current_kboard)); \
1848 } while (0)
1810 1849
1811 1850
1812 1851
@@ -2341,13 +2380,11 @@ extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
2341extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object, 2380extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object,
2342 Lisp_Object)) NO_RETURN; 2381 Lisp_Object)) NO_RETURN;
2343extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object)) NO_RETURN; 2382extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
2344extern void store_symval_forwarding P_ ((Lisp_Object, Lisp_Object, 2383extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *);
2345 Lisp_Object, struct buffer *)); 2384extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, int);
2346extern Lisp_Object do_symval_forwarding P_ ((Lisp_Object));
2347extern Lisp_Object set_internal P_ ((Lisp_Object, Lisp_Object, struct buffer *, int));
2348extern void syms_of_data P_ ((void)); 2385extern void syms_of_data P_ ((void));
2349extern void init_data P_ ((void)); 2386extern void init_data P_ ((void));
2350extern void swap_in_global_binding P_ ((Lisp_Object)); 2387extern void swap_in_global_binding P_ ((struct Lisp_Symbol *));
2351 2388
2352/* Defined in cmds.c */ 2389/* Defined in cmds.c */
2353EXFUN (Fend_of_line, 1); 2390EXFUN (Fend_of_line, 1);
@@ -2593,7 +2630,7 @@ extern Lisp_Object Qinhibit_point_motion_hooks;
2593extern Lisp_Object Qinhibit_redisplay, Qdisplay; 2630extern Lisp_Object Qinhibit_redisplay, Qdisplay;
2594extern Lisp_Object Qinhibit_eval_during_redisplay; 2631extern Lisp_Object Qinhibit_eval_during_redisplay;
2595extern Lisp_Object Qmessage_truncate_lines; 2632extern Lisp_Object Qmessage_truncate_lines;
2596extern Lisp_Object Qimage; 2633extern Lisp_Object Qimage, Qtext, Qboth, Qboth_horiz;
2597extern Lisp_Object Vmessage_log_max; 2634extern Lisp_Object Vmessage_log_max;
2598extern int message_enable_multibyte; 2635extern int message_enable_multibyte;
2599extern Lisp_Object echo_area_buffer[2]; 2636extern Lisp_Object echo_area_buffer[2];
@@ -2779,7 +2816,9 @@ extern Lisp_Object intern_c_string (const char *);
2779extern Lisp_Object make_symbol P_ ((char *)); 2816extern Lisp_Object make_symbol P_ ((char *));
2780extern Lisp_Object oblookup P_ ((Lisp_Object, const char *, int, int)); 2817extern Lisp_Object oblookup P_ ((Lisp_Object, const char *, int, int));
2781#define LOADHIST_ATTACH(x) \ 2818#define LOADHIST_ATTACH(x) \
2782 if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list) 2819 do { \
2820 if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); \
2821 } while (0)
2783extern Lisp_Object Vcurrent_load_list; 2822extern Lisp_Object Vcurrent_load_list;
2784extern Lisp_Object Vload_history, Vload_suffixes, Vload_file_rep_suffixes; 2823extern Lisp_Object Vload_history, Vload_suffixes, Vload_file_rep_suffixes;
2785extern int openp P_ ((Lisp_Object, Lisp_Object, Lisp_Object, 2824extern int openp P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
@@ -2855,13 +2894,15 @@ extern Lisp_Object call3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object
2855extern Lisp_Object call4 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); 2894extern Lisp_Object call4 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
2856extern Lisp_Object call5 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); 2895extern Lisp_Object call5 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
2857extern Lisp_Object call6 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); 2896extern Lisp_Object call6 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
2897extern Lisp_Object call7 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
2858EXFUN (Fdo_auto_save, 2); 2898EXFUN (Fdo_auto_save, 2);
2859extern Lisp_Object apply_lambda P_ ((Lisp_Object, Lisp_Object, int)); 2899extern Lisp_Object apply_lambda P_ ((Lisp_Object, Lisp_Object, int));
2860extern Lisp_Object internal_catch P_ ((Lisp_Object, Lisp_Object (*) (Lisp_Object), Lisp_Object)); 2900extern Lisp_Object internal_catch P_ ((Lisp_Object, Lisp_Object (*) (Lisp_Object), Lisp_Object));
2861extern Lisp_Object internal_lisp_condition_case P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); 2901extern Lisp_Object internal_lisp_condition_case P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
2862extern Lisp_Object internal_condition_case P_ ((Lisp_Object (*) (void), Lisp_Object, Lisp_Object (*) (Lisp_Object))); 2902extern Lisp_Object internal_condition_case P_ ((Lisp_Object (*) (void), Lisp_Object, Lisp_Object (*) (Lisp_Object)));
2863extern Lisp_Object internal_condition_case_1 P_ ((Lisp_Object (*) (Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object))); 2903extern Lisp_Object internal_condition_case_1 P_ ((Lisp_Object (*) (Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object)));
2864extern Lisp_Object internal_condition_case_2 P_ ((Lisp_Object (*) (int, Lisp_Object *), int, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object))); 2904extern Lisp_Object internal_condition_case_2 P_ ((Lisp_Object (*) (Lisp_Object, Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object)));
2905extern Lisp_Object internal_condition_case_n P_ ((Lisp_Object (*) (int, Lisp_Object *), int, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object)));
2865extern void specbind P_ ((Lisp_Object, Lisp_Object)); 2906extern void specbind P_ ((Lisp_Object, Lisp_Object));
2866extern void record_unwind_protect P_ ((Lisp_Object (*) (Lisp_Object), Lisp_Object)); 2907extern void record_unwind_protect P_ ((Lisp_Object (*) (Lisp_Object), Lisp_Object));
2867extern Lisp_Object unbind_to P_ ((int, Lisp_Object)); 2908extern Lisp_Object unbind_to P_ ((int, Lisp_Object));
@@ -3018,8 +3059,9 @@ EXFUN (Ffile_readable_p, 1);
3018EXFUN (Ffile_executable_p, 1); 3059EXFUN (Ffile_executable_p, 1);
3019EXFUN (Fread_file_name, 6); 3060EXFUN (Fread_file_name, 6);
3020extern Lisp_Object close_file_unwind P_ ((Lisp_Object)); 3061extern Lisp_Object close_file_unwind P_ ((Lisp_Object));
3062extern Lisp_Object restore_point_unwind P_ ((Lisp_Object));
3021extern void report_file_error P_ ((const char *, Lisp_Object)) NO_RETURN; 3063extern void report_file_error P_ ((const char *, Lisp_Object)) NO_RETURN;
3022extern int internal_delete_file P_ ((Lisp_Object)); 3064extern int internal_delete_file P_ ((Lisp_Object, Lisp_Object));
3023extern void syms_of_fileio P_ ((void)); 3065extern void syms_of_fileio P_ ((void));
3024extern Lisp_Object make_temp_name P_ ((Lisp_Object, int)); 3066extern Lisp_Object make_temp_name P_ ((Lisp_Object, int));
3025EXFUN (Fmake_symbolic_link, 3); 3067EXFUN (Fmake_symbolic_link, 3);
@@ -3388,6 +3430,7 @@ extern void syms_of_term P_ ((void));
3388extern void fatal P_ ((const char *msgid, ...)) NO_RETURN; 3430extern void fatal P_ ((const char *msgid, ...)) NO_RETURN;
3389 3431
3390/* Defined in terminal.c */ 3432/* Defined in terminal.c */
3433EXFUN (Fframe_terminal, 1);
3391EXFUN (Fdelete_terminal, 2); 3434EXFUN (Fdelete_terminal, 2);
3392extern void syms_of_terminal P_ ((void)); 3435extern void syms_of_terminal P_ ((void));
3393 3436
diff --git a/src/lread.c b/src/lread.c
index 83ebc8b3b10..a04b9679d83 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3687,7 +3687,8 @@ it defaults to the value of `obarray'. */)
3687 && EQ (obarray, initial_obarray)) 3687 && EQ (obarray, initial_obarray))
3688 { 3688 {
3689 XSYMBOL (sym)->constant = 1; 3689 XSYMBOL (sym)->constant = 1;
3690 XSYMBOL (sym)->value = sym; 3690 XSYMBOL (sym)->redirect = SYMBOL_PLAINVAL;
3691 SET_SYMBOL_VAL (XSYMBOL (sym), sym);
3691 } 3692 }
3692 3693
3693 ptr = &XVECTOR (obarray)->contents[XINT (tem)]; 3694 ptr = &XVECTOR (obarray)->contents[XINT (tem)];
@@ -3768,8 +3769,6 @@ OBARRAY defaults to the value of the variable `obarray'. */)
3768 error ("Attempt to unintern t or nil"); */ 3769 error ("Attempt to unintern t or nil"); */
3769 3770
3770 XSYMBOL (tem)->interned = SYMBOL_UNINTERNED; 3771 XSYMBOL (tem)->interned = SYMBOL_UNINTERNED;
3771 XSYMBOL (tem)->constant = 0;
3772 XSYMBOL (tem)->indirect_variable = 0;
3773 3772
3774 hash = oblookup_last_bucket_number; 3773 hash = oblookup_last_bucket_number;
3775 3774
@@ -3914,35 +3913,31 @@ void
3914init_obarray () 3913init_obarray ()
3915{ 3914{
3916 Lisp_Object oblength; 3915 Lisp_Object oblength;
3917 int hash;
3918 Lisp_Object *tem;
3919 3916
3920 XSETFASTINT (oblength, OBARRAY_SIZE); 3917 XSETFASTINT (oblength, OBARRAY_SIZE);
3921 3918
3922 Qnil = Fmake_symbol (make_pure_c_string ("nil"));
3923 Vobarray = Fmake_vector (oblength, make_number (0)); 3919 Vobarray = Fmake_vector (oblength, make_number (0));
3924 initial_obarray = Vobarray; 3920 initial_obarray = Vobarray;
3925 staticpro (&initial_obarray); 3921 staticpro (&initial_obarray);
3926 /* Intern nil in the obarray */
3927 XSYMBOL (Qnil)->interned = SYMBOL_INTERNED_IN_INITIAL_OBARRAY;
3928 XSYMBOL (Qnil)->constant = 1;
3929
3930 /* These locals are to kludge around a pyramid compiler bug. */
3931 hash = hash_string ("nil", 3);
3932 /* Separate statement here to avoid VAXC bug. */
3933 hash %= OBARRAY_SIZE;
3934 tem = &XVECTOR (Vobarray)->contents[hash];
3935 *tem = Qnil;
3936 3922
3937 Qunbound = Fmake_symbol (make_pure_c_string ("unbound")); 3923 Qunbound = Fmake_symbol (make_pure_c_string ("unbound"));
3938 XSYMBOL (Qnil)->function = Qunbound; 3924 /* Set temporary dummy values to Qnil and Vpurify_flag to satisfy the
3939 XSYMBOL (Qunbound)->value = Qunbound; 3925 NILP (Vpurify_flag) check in intern_c_string. */
3926 Qnil = make_number (-1); Vpurify_flag = make_number (1);
3927 Qnil = intern_c_string ("nil");
3928
3929 /* Fmake_symbol inits fields of new symbols with Qunbound and Qnil,
3930 so those two need to be fixed manally. */
3931 SET_SYMBOL_VAL (XSYMBOL (Qunbound), Qunbound);
3940 XSYMBOL (Qunbound)->function = Qunbound; 3932 XSYMBOL (Qunbound)->function = Qunbound;
3933 XSYMBOL (Qunbound)->plist = Qnil;
3934 /* XSYMBOL (Qnil)->function = Qunbound; */
3935 SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil);
3936 XSYMBOL (Qnil)->constant = 1;
3937 XSYMBOL (Qnil)->plist = Qnil;
3941 3938
3942 Qt = intern_c_string ("t"); 3939 Qt = intern_c_string ("t");
3943 XSYMBOL (Qnil)->value = Qnil; 3940 SET_SYMBOL_VAL (XSYMBOL (Qt), Qt);
3944 XSYMBOL (Qnil)->plist = Qnil;
3945 XSYMBOL (Qt)->value = Qt;
3946 XSYMBOL (Qt)->constant = 1; 3941 XSYMBOL (Qt)->constant = 1;
3947 3942
3948 /* Qt is correct even if CANNOT_DUMP. loadup.el will set to nil at end. */ 3943 /* Qt is correct even if CANNOT_DUMP. loadup.el will set to nil at end. */
@@ -3981,27 +3976,29 @@ defalias (sname, string)
3981 to a C variable of type int. Sample call: 3976 to a C variable of type int. Sample call:
3982 DEFVAR_INT ("emacs-priority", &emacs_priority, "Documentation"); */ 3977 DEFVAR_INT ("emacs-priority", &emacs_priority, "Documentation"); */
3983void 3978void
3984defvar_int (const char *namestring, EMACS_INT *address) 3979defvar_int (struct Lisp_Intfwd *i_fwd,
3980 const char *namestring, EMACS_INT *address)
3985{ 3981{
3986 Lisp_Object sym, val; 3982 Lisp_Object sym;
3987 sym = intern_c_string (namestring); 3983 sym = intern_c_string (namestring);
3988 val = allocate_misc (); 3984 i_fwd->type = Lisp_Fwd_Int;
3989 XMISCTYPE (val) = Lisp_Misc_Intfwd; 3985 i_fwd->intvar = address;
3990 XINTFWD (val)->intvar = address; 3986 XSYMBOL (sym)->redirect = SYMBOL_FORWARDED;
3991 SET_SYMBOL_VALUE (sym, val); 3987 SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)i_fwd);
3992} 3988}
3993 3989
3994/* Similar but define a variable whose value is t if address contains 1, 3990/* Similar but define a variable whose value is t if address contains 1,
3995 nil if address contains 0. */ 3991 nil if address contains 0. */
3996void 3992void
3997defvar_bool (const char *namestring, int *address) 3993defvar_bool (struct Lisp_Boolfwd *b_fwd,
3994 const char *namestring, int *address)
3998{ 3995{
3999 Lisp_Object sym, val; 3996 Lisp_Object sym;
4000 sym = intern_c_string (namestring); 3997 sym = intern_c_string (namestring);
4001 val = allocate_misc (); 3998 b_fwd->type = Lisp_Fwd_Bool;
4002 XMISCTYPE (val) = Lisp_Misc_Boolfwd; 3999 b_fwd->boolvar = address;
4003 XBOOLFWD (val)->boolvar = address; 4000 XSYMBOL (sym)->redirect = SYMBOL_FORWARDED;
4004 SET_SYMBOL_VALUE (sym, val); 4001 SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)b_fwd);
4005 Vbyte_boolean_vars = Fcons (sym, Vbyte_boolean_vars); 4002 Vbyte_boolean_vars = Fcons (sym, Vbyte_boolean_vars);
4006} 4003}
4007 4004
@@ -4011,20 +4008,22 @@ defvar_bool (const char *namestring, int *address)
4011 gc-marked for some other reason, since marking the same slot twice 4008 gc-marked for some other reason, since marking the same slot twice
4012 can cause trouble with strings. */ 4009 can cause trouble with strings. */
4013void 4010void
4014defvar_lisp_nopro (const char *namestring, Lisp_Object *address) 4011defvar_lisp_nopro (struct Lisp_Objfwd *o_fwd,
4012 const char *namestring, Lisp_Object *address)
4015{ 4013{
4016 Lisp_Object sym, val; 4014 Lisp_Object sym;
4017 sym = intern_c_string (namestring); 4015 sym = intern_c_string (namestring);
4018 val = allocate_misc (); 4016 o_fwd->type = Lisp_Fwd_Obj;
4019 XMISCTYPE (val) = Lisp_Misc_Objfwd; 4017 o_fwd->objvar = address;
4020 XOBJFWD (val)->objvar = address; 4018 XSYMBOL (sym)->redirect = SYMBOL_FORWARDED;
4021 SET_SYMBOL_VALUE (sym, val); 4019 SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)o_fwd);
4022} 4020}
4023 4021
4024void 4022void
4025defvar_lisp (const char *namestring, Lisp_Object *address) 4023defvar_lisp (struct Lisp_Objfwd *o_fwd,
4024 const char *namestring, Lisp_Object *address)
4026{ 4025{
4027 defvar_lisp_nopro (namestring, address); 4026 defvar_lisp_nopro (o_fwd, namestring, address);
4028 staticpro (address); 4027 staticpro (address);
4029} 4028}
4030 4029
@@ -4032,14 +4031,15 @@ defvar_lisp (const char *namestring, Lisp_Object *address)
4032 at a particular offset in the current kboard object. */ 4031 at a particular offset in the current kboard object. */
4033 4032
4034void 4033void
4035defvar_kboard (const char *namestring, int offset) 4034defvar_kboard (struct Lisp_Kboard_Objfwd *ko_fwd,
4035 const char *namestring, int offset)
4036{ 4036{
4037 Lisp_Object sym, val; 4037 Lisp_Object sym;
4038 sym = intern_c_string (namestring); 4038 sym = intern_c_string (namestring);
4039 val = allocate_misc (); 4039 ko_fwd->type = Lisp_Fwd_Kboard_Obj;
4040 XMISCTYPE (val) = Lisp_Misc_Kboard_Objfwd; 4040 ko_fwd->offset = offset;
4041 XKBOARD_OBJFWD (val)->offset = offset; 4041 XSYMBOL (sym)->redirect = SYMBOL_FORWARDED;
4042 SET_SYMBOL_VALUE (sym, val); 4042 SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)ko_fwd);
4043} 4043}
4044 4044
4045/* Record the value of load-path used at the start of dumping 4045/* Record the value of load-path used at the start of dumping
diff --git a/src/m/alpha.h b/src/m/alpha.h
index 065a0dd7d71..04ad9eaaf8f 100644
--- a/src/m/alpha.h
+++ b/src/m/alpha.h
@@ -1,6 +1,7 @@
1/* Machine description file for the alpha chip. 1/* Machine description file for the alpha chip.
2 Copyright (C) 1994, 1997, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2
3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1994, 1997, 1999, 2001, 2002, 2003, 2004, 2005, 2006,
4 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 5
5Author: Rainer Schoepf 6Author: Rainer Schoepf
6(according to authors.el) 7(according to authors.el)
@@ -20,35 +21,16 @@ GNU General Public License for more details.
20You should have received a copy of the GNU General Public License 21You should have received a copy of the GNU General Public License
21along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 22along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 23
23
24/* The following line tells the configuration script what sort of
25 operating system this machine is likely to run.
26 USUAL-OPSYS="note"
27
28NOTE-START
29Use -opsystem=osf1
30NOTE-END
31
32*/
33
34#ifndef _LP64 24#ifndef _LP64
35#define _LP64 /* This doesn't appear to be necessary 25#define _LP64 /* This doesn't appear to be necessary on OSF 4/5 -- fx. */
36 on OSF 4/5 -- fx. */
37#endif 26#endif
38 27
39/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 28/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
40 is the most significant byte. */ 29 is the most significant byte. */
41
42#undef WORDS_BIG_ENDIAN 30#undef WORDS_BIG_ENDIAN
43 31
44/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
45 * group of arguments and treat it as an array of the arguments. */
46
47#define NO_ARG_ARRAY
48
49/* Now define a symbol for the cpu type, if your compiler 32/* Now define a symbol for the cpu type, if your compiler
50 does not define it automatically. */ 33 does not define it automatically. */
51
52/* __alpha defined automatically */ 34/* __alpha defined automatically */
53 35
54 36
@@ -57,15 +39,12 @@ NOTE-END
57 are always unsigned. 39 are always unsigned.
58 40
59 This flag only matters if you use USE_LISP_UNION_TYPE. */ 41 This flag only matters if you use USE_LISP_UNION_TYPE. */
60
61#define EXPLICIT_SIGN_EXTEND 42#define EXPLICIT_SIGN_EXTEND
62 43
63/* Data type of load average, as read out of kmem. */ 44/* Data type of load average, as read out of kmem. */
64
65#define LOAD_AVE_TYPE long 45#define LOAD_AVE_TYPE long
66 46
67/* Convert that into an integer that is 100 for a load average of 1.0 */ 47/* Convert that into an integer that is 100 for a load average of 1.0 */
68
69#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) 48#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
70 49
71/* GNU malloc and the relocating allocator do not work together 50/* GNU malloc and the relocating allocator do not work together
@@ -82,16 +61,6 @@ NOTE-END
82/* #define SYSTEM_MALLOC */ 61/* #define SYSTEM_MALLOC */
83 62
84#ifdef __ELF__ 63#ifdef __ELF__
85/* With ELF, make sure that all common symbols get allocated to in the
86 data section. Otherwise, the dump of temacs may miss variables in
87 the shared library that have been initialized. For example, with
88 GNU libc, __malloc_initialized would normally be resolved to the
89 shared library's .bss section, which is fatal. */
90# ifdef __GNUC__
91# define C_SWITCH_MACHINE -fno-common
92# else
93# error What gives? Fix me if DEC Unix supports ELF now.
94# endif
95 64
96#undef UNEXEC 65#undef UNEXEC
97#define UNEXEC unexelf.o 66#define UNEXEC unexelf.o
@@ -106,12 +75,10 @@ NOTE-END
106#else /* not __ELF__ */ 75#else /* not __ELF__ */
107 76
108/* Describe layout of the address space in an executing process. */ 77/* Describe layout of the address space in an executing process. */
109
110#define TEXT_START 0x120000000 78#define TEXT_START 0x120000000
111#define DATA_START 0x140000000 79#define DATA_START 0x140000000
112 80
113/* The program to be used for unexec. */ 81/* The program to be used for unexec. */
114
115#define UNEXEC unexalpha.o 82#define UNEXEC unexalpha.o
116 83
117#endif /* __ELF__ */ 84#endif /* __ELF__ */
diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h
index 4bea30d12de..1910c37bffc 100644
--- a/src/m/amdx86-64.h
+++ b/src/m/amdx86-64.h
@@ -1,6 +1,7 @@
1/* machine description file for AMD x86-64. 1/* machine description file for AMD x86-64.
2 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 2
3 Free Software Foundation, Inc. 3Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -17,32 +18,13 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 18You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20#ifdef i386
21/* Although we're running on an amd64 kernel, we're actually compiling for
22 the x86 architecture. The user should probably have provided an
23 explicit --build to `configure', but if everything else than the kernel
24 is running in i386 mode, then the bug is really ours: we should have
25 guessed better. */
26#include "m/intel386.h"
27#else
28
29/* The following line tells the configuration script what sort of
30 operating system this machine is likely to run.
31 USUAL-OPSYS="linux" */
32
33#define BITS_PER_LONG 64 21#define BITS_PER_LONG 64
34#define BITS_PER_EMACS_INT 64 22#define BITS_PER_EMACS_INT 64
35 23
36/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 24/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
37 is the most significant byte. */ 25 is the most significant byte. */
38
39#undef WORDS_BIG_ENDIAN 26#undef WORDS_BIG_ENDIAN
40 27
41/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
42 * group of arguments and treat it as an array of the arguments. */
43
44#define NO_ARG_ARRAY
45
46/* Now define a symbol for the cpu type, if your compiler 28/* Now define a symbol for the cpu type, if your compiler
47 does not define it automatically: 29 does not define it automatically:
48 Ones defined so far include vax, m68000, ns16000, pyramid, 30 Ones defined so far include vax, m68000, ns16000, pyramid,
@@ -58,77 +40,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
58 are always unsigned. 40 are always unsigned.
59 41
60 This flag only matters if you use USE_LISP_UNION_TYPE. */ 42 This flag only matters if you use USE_LISP_UNION_TYPE. */
61
62#define EXPLICIT_SIGN_EXTEND 43#define EXPLICIT_SIGN_EXTEND
63 44
64/* Data type of load average, as read out of kmem. */ 45/* Data type of load average, as read out of kmem. */
65
66#define LOAD_AVE_TYPE long 46#define LOAD_AVE_TYPE long
67 47
68/* Convert that into an integer that is 100 for a load average of 1.0 */ 48/* Convert that into an integer that is 100 for a load average of 1.0 */
69
70#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) 49#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
71 50
72/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ 51/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
73#undef DATA_SEG_BITS 52#undef DATA_SEG_BITS
74 53
75#ifdef __FreeBSD__
76
77/* The libraries for binaries native to the build host's architecture are
78 installed under /usr/lib in FreeBSD, and the ones that need special paths
79 are 32-bit compatibility libraries (installed under /usr/lib32). To build
80 a native binary of Emacs on FreeBSD/amd64 we can just point to /usr/lib. */
81
82#undef START_FILES
83#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
84
85/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD.
86 The reason is that some functions in libgcc.a call functions from libc.a,
87 and some libc.a functions need functions from libgcc.a. Since most
88 versions of ld are one-pass linkers, we need to mention -lgcc twice,
89 or else we risk getting unresolved externals. */
90#undef LIB_STANDARD
91#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
92
93#elif defined(__OpenBSD__)
94
95#undef START_FILES
96#define START_FILES pre-crt0.o /usr/lib/crt0.o /usr/lib/crtbegin.o
97#undef LIB_STANDARD
98#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o
99
100#elif defined(__NetBSD__)
101
102/* LIB_STANDARD and START_FILES set correctly in s/netbsd.h */
103
104#elif defined(SOLARIS2)
105
106#undef START_FILES
107#undef LIB_STANDARD
108
109#elif defined(__APPLE__)
110
111/* LIB_STANDARD and START_FILES set correctly in s/darwin.h */
112
113#else /* !__OpenBSD__ && !__FreeBSD__ && !__NetBSD__ && !SOLARIS2
114 && !__APPLE__ */
115/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD.
116 The reason is that some functions in libgcc.a call functions from libc.a,
117 and some libc.a functions need functions from libgcc.a. Since most
118 versions of ld are one-pass linkers, we need to mention -lgcc twice,
119 or else we risk getting unresolved externals. */
120#undef START_FILES
121#undef LIB_STANDARD
122#ifdef HAVE_LIB64_DIR
123#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
124#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o
125#else
126#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
127#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
128#endif
129
130#endif /* __FreeBSD__ */
131#endif /* !i386 */
132
133/* arch-tag: 8a5e001d-e12e-4692-a3a6-0b15ba271c6e 54/* arch-tag: 8a5e001d-e12e-4692-a3a6-0b15ba271c6e
134 (do not change this comment) */ 55 (do not change this comment) */
diff --git a/src/m/arm.h b/src/m/arm.h
index b04c5ecc1d9..cf30e2e1b19 100644
--- a/src/m/arm.h
+++ b/src/m/arm.h
@@ -1,6 +1,7 @@
1/* Machine description file for ARM-based non-RISCiX machines. 1/* Machine description file for ARM-based non-RISCiX machines.
2 Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2
3 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -17,30 +18,11 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 18You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20
21
22/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 21/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
23 is the most significant byte. */ 22 is the most significant byte. */
24
25#undef WORDS_BIG_ENDIAN 23#undef WORDS_BIG_ENDIAN
26 24
27/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
28 * group of arguments and treat it as an array of the arguments. We can't
29 * do this on the arm with gcc, since the first 4 args are in registers. */
30
31#ifdef __GNUC__
32#define NO_ARG_ARRAY
33#else
34#undef NO_ARG_ARRAY
35#endif
36
37#define NO_REMAP 25#define NO_REMAP
38 26
39/* armin76@gentoo.org reported that the lgcc_s flag is necessary to
40 build on ARM EABI under GNU/Linux (Bug#5518). */
41#ifdef GNU_LINUX
42#define LIB_GCC -lgcc_s
43#endif
44
45/* arch-tag: 07856f0c-f0c8-4bd8-99af-0b7fa1e5ee42 27/* arch-tag: 07856f0c-f0c8-4bd8-99af-0b7fa1e5ee42
46 (do not change this comment) */ 28 (do not change this comment) */
diff --git a/src/m/hp800.h b/src/m/hp800.h
index d95da6643ab..9bc361e3cc4 100644
--- a/src/m/hp800.h
+++ b/src/m/hp800.h
@@ -1,6 +1,7 @@
1/* machine description file for hp9000 series 800 machines. 1/* machine description file for hp9000 series 800 machines.
2 Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2
3 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -17,81 +18,17 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 18You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20
21/* The following line tells the configuration script what sort of
22 operating system this machine is likely to run.
23 USUAL-OPSYS="hpux" */
24
25/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 21/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
26 is the most significant byte. */ 22 is the most significant byte. */
27
28#define WORDS_BIG_ENDIAN 23#define WORDS_BIG_ENDIAN
29 24
30/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
31 * group of arguments and treat it as an array of the arguments. */
32
33#define NO_ARG_ARRAY
34
35/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend 25/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
36 the bit field into an int. In other words, if bit fields 26 the bit field into an int. In other words, if bit fields
37 are always unsigned. 27 are always unsigned.
38 28
39 This flag only matters if you use USE_LISP_UNION_TYPE. */ 29 This flag only matters if you use USE_LISP_UNION_TYPE. */
40
41#define EXPLICIT_SIGN_EXTEND 30#define EXPLICIT_SIGN_EXTEND
42 31
43
44/* Stuff for just HPUX. */
45
46#if defined (__hpux)
47
48/* Define NO_REMAP if memory segmentation makes it not work well
49 to change the boundary between the text section and data section
50 when Emacs is dumped. If you define this, the preloaded Lisp
51 code will not be sharable; but that's better than failing completely. */
52
53#define NO_REMAP
54
55/* Define VIRT_ADDR_VARIES if the virtual addresses of
56 pure and impure space as loaded can vary, and even their
57 relative order cannot be relied on.
58
59 Otherwise Emacs assumes that text space precedes data space,
60 numerically. */
61
62#define VIRT_ADDR_VARIES
63
64/* the data segment on this machine always starts at address 0x40000000. */
65
66#define DATA_SEG_BITS 0x40000000
67
68#define DATA_START 0x40000000
69#define TEXT_START 0x00000000
70
71/* Data type of load average, as read out of kmem. */
72
73#define LOAD_AVE_TYPE double
74
75/* Convert that into an integer that is 100 for a load average of 1.0 */
76
77#define LOAD_AVE_CVT(x) ((int) (x * 100.0))
78
79/* The symbol in the kernel where the load average is found
80 is named _avenrun. At this time there are two major flavors
81 of hp-ux (there is the s800 and s300 (s200) flavors). The
82 differences are thusly moved to the corresponding machine description file.
83*/
84
85/* no underscore please */
86#define LDAV_SYMBOL "avenrun"
87
88/* On USG systems these have different names. */
89
90#define index strchr
91#define rindex strrchr
92
93#endif /* __hpux */
94
95/* Systems with GCC don't need to lose. */ 32/* Systems with GCC don't need to lose. */
96#ifdef __NetBSD__ 33#ifdef __NetBSD__
97# ifdef __GNUC__ 34# ifdef __GNUC__
diff --git a/src/m/ia64.h b/src/m/ia64.h
index 188697b7e89..acf6c25844f 100644
--- a/src/m/ia64.h
+++ b/src/m/ia64.h
@@ -1,7 +1,9 @@
1/* machine description file for the IA-64 architecture. 1/* machine description file for the IA-64 architecture.
2 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2
3 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 Contributed by David Mosberger <davidm@hpl.hp.com> 4 2009, 2010 Free Software Foundation, Inc.
5
6Contributed by David Mosberger <davidm@hpl.hp.com>
5 7
6This file is part of GNU Emacs. 8This file is part of GNU Emacs.
7 9
@@ -23,20 +25,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23 25
24/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 26/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
25 is the most significant byte. */ 27 is the most significant byte. */
26
27#undef WORDS_BIG_ENDIAN 28#undef WORDS_BIG_ENDIAN
28 29
29/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
30 group of arguments and treat it as an array of the arguments. */
31
32#define NO_ARG_ARRAY
33
34/* Now define a symbol for the cpu type, if your compiler 30/* Now define a symbol for the cpu type, if your compiler
35 does not define it automatically. */ 31 does not define it automatically. */
36
37/* __ia64__ defined automatically */ 32/* __ia64__ defined automatically */
38 33
39
40/* Define the type to use. */ 34/* Define the type to use. */
41#define EMACS_INT long 35#define EMACS_INT long
42#define EMACS_UINT unsigned long 36#define EMACS_UINT unsigned long
@@ -46,15 +40,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
46 are always unsigned. 40 are always unsigned.
47 41
48 This flag only matters if you use USE_LISP_UNION_TYPE. */ 42 This flag only matters if you use USE_LISP_UNION_TYPE. */
49
50#define EXPLICIT_SIGN_EXTEND 43#define EXPLICIT_SIGN_EXTEND
51 44
52/* Data type of load average, as read out of kmem. */ 45/* Data type of load average, as read out of kmem. */
53
54#define LOAD_AVE_TYPE long 46#define LOAD_AVE_TYPE long
55 47
56/* Convert that into an integer that is 100 for a load average of 1.0 */ 48/* Convert that into an integer that is 100 for a load average of 1.0 */
57
58#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) 49#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
59 50
60#ifdef __ELF__ 51#ifdef __ELF__
diff --git a/src/m/ibmrs6000.h b/src/m/ibmrs6000.h
index a7d35cc8ab7..3831e500641 100644
--- a/src/m/ibmrs6000.h
+++ b/src/m/ibmrs6000.h
@@ -1,6 +1,7 @@
1/* R2 AIX machine/system dependent defines 1/* R2 AIX machine/system dependent defines
2 Copyright (C) 1988, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2
3 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1988, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -18,39 +19,14 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20 21
21/* The following line tells the configuration script what sort of
22 operating system this machine is likely to run.
23 USUAL-OPSYS="aix3-1" */
24
25/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
26 * group of arguments and treat it as an array of the arguments. */
27
28#define NO_ARG_ARRAY
29
30/* Now define a symbol for the cpu type, if your compiler
31 does not define it automatically. */
32
33#define IBMR2AIX
34
35/* The data segment in this machine always starts at address 0x20000000. 22/* The data segment in this machine always starts at address 0x20000000.
36 An address of data cannot be stored correctly in a Lisp object; 23 An address of data cannot be stored correctly in a Lisp object;
37 we always lose the high bits. We must tell XPNTR to add them back. */ 24 we always lose the high bits. We must tell XPNTR to add them back. */
38
39#define TEXT_START 0x10000000 25#define TEXT_START 0x10000000
40#define DATA_START 0x20000000 26#define DATA_START 0x20000000
41#define WORDS_BIG_ENDIAN 27#define WORDS_BIG_ENDIAN
42#define DATA_SEG_BITS 0x20000000 28#define DATA_SEG_BITS 0x20000000
43 29
44/* sfreed@unm.edu says add -bI:/usr/lpp/X11/bin/smt.exp for AIX 3.2.4. */
45/* marc@sti.com (Marc Pawliger) says ibmrs6000.inp is needed to avoid
46 linker error for updated X11R5 libraries, which references pthread library
47 which most machines don't have. We use the name .inp instead of .imp
48 because .inp is a better convention to use in make-dist for naming
49 random input files. */
50#ifdef THIS_IS_MAKEFILE /* Don't use this in configure. */
51#define LD_SWITCH_MACHINE -Wl,-bnodelcsect
52#endif /* THIS_IS_MAKEFILE */
53
54#ifndef NLIST_STRUCT 30#ifndef NLIST_STRUCT
55/* AIX supposedly doesn't use this interface, but on the RS/6000 31/* AIX supposedly doesn't use this interface, but on the RS/6000
56 it apparently does. */ 32 it apparently does. */
@@ -60,7 +36,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
60#undef ADDR_CORRECT 36#undef ADDR_CORRECT
61#define ADDR_CORRECT(x) ((int)(x)) 37#define ADDR_CORRECT(x) ((int)(x))
62 38
63#define START_FILES
64/*** BUILD 9008 - FIONREAD problem still exists in X-Windows. ***/ 39/*** BUILD 9008 - FIONREAD problem still exists in X-Windows. ***/
65#define BROKEN_FIONREAD 40#define BROKEN_FIONREAD
66/* As we define BROKEN_FIONREAD, SIGIO will be undefined in systty.h. 41/* As we define BROKEN_FIONREAD, SIGIO will be undefined in systty.h.
diff --git a/src/m/ibmrs6000.inp b/src/m/ibmrs6000.inp
deleted file mode 100644
index d7f3fddaf6f..00000000000
--- a/src/m/ibmrs6000.inp
+++ /dev/null
@@ -1,4 +0,0 @@
1#!
2pthread_yield
3
4# arch-tag: fc6d01ea-c488-4862-bbdb-e8d3e0f6fdb3
diff --git a/src/m/ibms390.h b/src/m/ibms390.h
index 794ab869511..1dce4ffbf47 100644
--- a/src/m/ibms390.h
+++ b/src/m/ibms390.h
@@ -1,6 +1,7 @@
1/* machine description file template. 1/* machine description file template.
2 Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2
3 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 2008, 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -18,34 +19,21 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20 21
21/* The following line tells the configuration script what sort of
22 operating system this machine is likely to run.
23 USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */
24
25/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 22/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
26 is the most significant byte. */ 23 is the most significant byte. */
27
28#define WORDS_BIG_ENDIAN 24#define WORDS_BIG_ENDIAN
29 25
30/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
31 * group of arguments and treat it as an array of the arguments. */
32
33#define NO_ARG_ARRAY
34
35/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend 26/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
36 the 24-bit bit field into an int. In other words, if bit fields 27 the 24-bit bit field into an int. In other words, if bit fields
37 are always unsigned. 28 are always unsigned.
38 29
39 This flag only matters if you use USE_LISP_UNION_TYPE. */ 30 This flag only matters if you use USE_LISP_UNION_TYPE. */
40
41#define EXPLICIT_SIGN_EXTEND 31#define EXPLICIT_SIGN_EXTEND
42 32
43/* Data type of load average, as read out of kmem. */ 33/* Data type of load average, as read out of kmem. */
44
45#define LOAD_AVE_TYPE long 34#define LOAD_AVE_TYPE long
46 35
47/* Convert that into an integer that is 100 for a load average of 1.0 */ 36/* Convert that into an integer that is 100 for a load average of 1.0 */
48
49#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) 37#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
50 38
51/* Define VIRT_ADDR_VARIES if the virtual addresses of 39/* Define VIRT_ADDR_VARIES if the virtual addresses of
@@ -54,7 +42,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
54 42
55 Otherwise Emacs assumes that text space precedes data space, 43 Otherwise Emacs assumes that text space precedes data space,
56 numerically. */ 44 numerically. */
57
58#define VIRT_ADDR_VARIES 45#define VIRT_ADDR_VARIES
59 46
60/* arch-tag: d8a0ffa4-a8f0-4736-90d3-7fd7b21b8314 47/* arch-tag: d8a0ffa4-a8f0-4736-90d3-7fd7b21b8314
diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h
index 9429e4282bf..fda3007cb74 100644
--- a/src/m/ibms390x.h
+++ b/src/m/ibms390x.h
@@ -1,6 +1,7 @@
1/* machine description file for IBM S390 in 64-bit mode 1/* machine description file for IBM S390 in 64-bit mode
2 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 2
3 Free Software Foundation, Inc. 3Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -20,31 +21,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20/* This file was made by copying the significant parts of amdx86-64.h 21/* This file was made by copying the significant parts of amdx86-64.h
21 into ibms390.h. */ 22 into ibms390.h. */
22 23
23 24/* Used for machine IBM s390 64 bits with opsys gnu-linux. */
24/* The following line tells the configuration script what sort of
25 operating system this machine is likely to run.
26 USUAL-OPSYS="<name of system .h file here, without the s- or .h>"
27
28NOTE-START
29IBM s390 64 bits (-machine=ibms390x64)
30
31 The possibilities for -opsystem are: gnu-linux.
32
33NOTE-END */
34
35#define BITS_PER_LONG 64 25#define BITS_PER_LONG 64
36#define BITS_PER_EMACS_INT 64 26#define BITS_PER_EMACS_INT 64
37 27
38/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 28/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
39 is the most significant byte. */ 29 is the most significant byte. */
40
41#define WORDS_BIG_ENDIAN 30#define WORDS_BIG_ENDIAN
42 31
43/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
44 * group of arguments and treat it as an array of the arguments. */
45
46#define NO_ARG_ARRAY
47
48/* Define the type to use. */ 32/* Define the type to use. */
49#define EMACS_INT long 33#define EMACS_INT long
50#define EMACS_UINT unsigned long 34#define EMACS_UINT unsigned long
@@ -54,15 +38,12 @@ NOTE-END */
54 are always unsigned. 38 are always unsigned.
55 39
56 This flag only matters if you use USE_LISP_UNION_TYPE. */ 40 This flag only matters if you use USE_LISP_UNION_TYPE. */
57
58#undef EXPLICIT_SIGN_EXTEND 41#undef EXPLICIT_SIGN_EXTEND
59 42
60/* Data type of load average, as read out of kmem. */ 43/* Data type of load average, as read out of kmem. */
61
62#define LOAD_AVE_TYPE long 44#define LOAD_AVE_TYPE long
63 45
64/* Convert that into an integer that is 100 for a load average of 1.0 */ 46/* Convert that into an integer that is 100 for a load average of 1.0 */
65
66#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) 47#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
67 48
68/* Define VIRT_ADDR_VARIES if the virtual addresses of 49/* Define VIRT_ADDR_VARIES if the virtual addresses of
@@ -71,38 +52,20 @@ NOTE-END */
71 52
72 Otherwise Emacs assumes that text space precedes data space, 53 Otherwise Emacs assumes that text space precedes data space,
73 numerically. */ 54 numerically. */
74
75#define VIRT_ADDR_VARIES 55#define VIRT_ADDR_VARIES
76 56
77/* Define HAVE_ALLOCA to say that the system provides a properly 57/* Define HAVE_ALLOCA to say that the system provides a properly
78 working alloca function and it should be used. Undefine it if an 58 working alloca function and it should be used. Undefine it if an
79 assembler-language alloca in the file alloca.s should be used. */ 59 assembler-language alloca in the file alloca.s should be used. */
80
81#define HAVE_ALLOCA 60#define HAVE_ALLOCA
82 61
83/* On the 64 bit architecture, we can use 60 bits for addresses */ 62/* On the 64 bit architecture, we can use 60 bits for addresses */
84
85#define VALBITS 60 63#define VALBITS 60
86 64
87#define LINKER $(CC) -nostdlib 65#define LINKER $(CC) -nostdlib
88 66
89/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ 67/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
90
91#define XPNTR(a) XUINT (a) 68#define XPNTR(a) XUINT (a)
92 69
93#undef START_FILES
94#ifdef HAVE_LIB64_DIR
95#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
96#else
97#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
98#endif
99
100#undef LIB_STANDARD
101#ifdef HAVE_LIB64_DIR
102#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o
103#else
104#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
105#endif
106
107/* arch-tag: 4b87653c-6add-4663-8691-7d9dc17b5519 70/* arch-tag: 4b87653c-6add-4663-8691-7d9dc17b5519
108 (do not change this comment) */ 71 (do not change this comment) */
diff --git a/src/m/intel386.h b/src/m/intel386.h
index dc50d5ea6a2..984a9959736 100644
--- a/src/m/intel386.h
+++ b/src/m/intel386.h
@@ -1,6 +1,7 @@
1/* Machine description file for intel 386. 1/* Machine description file for intel 386.
2 Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2
3 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -18,69 +19,10 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20 21
21/* The following line tells the configuration script what sort of
22 operating system this machine is likely to run.
23 USUAL-OPSYS="note"
24
25NOTE-START
26Intel 386 (-machine=intel386)
27
28 The possibilities for -opsystem are: bsd4-2, usg5-2-2, usg5-3,
29 isc2-2, 386-ix, and linux.
30
31 18.58 should support a wide variety of operating systems.
32 Use linux for Linux.
33 It isn't clear what to do on an SCO system.
34
35NOTE-END */
36
37/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 22/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
38 is the most significant byte. */ 23 is the most significant byte. */
39
40#undef WORDS_BIG_ENDIAN 24#undef WORDS_BIG_ENDIAN
41 25
42/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
43 * group of arguments and treat it as an array of the arguments. */
44
45/* #define NO_ARG_ARRAY */
46
47/* crt0.c, if it is used, should use the i386-bsd style of entry.
48 with no extra dummy args. On USG and XENIX,
49 NO_REMAP says this isn't used. */
50
51#define CRT0_DUMMIES bogus_fp,
52
53#ifdef SOLARIS2
54/* Data type of load average, as read out of kmem. */
55#define LOAD_AVE_TYPE long
56
57/* Convert that into an integer that is 100 for a load average of 1.0 */
58/* This is totally uncalibrated. */
59#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE))
60
61/* J.W.Hawtin@lut.ac.uk say Solaris 2.4 as well as Solaris 2.1 on X86
62 requires -lkvm as well.
63 And handa@etl.gov.jp says that -lkvm needs -llelf, at least on 2.5. */
64#define LIBS_MACHINE -lkvm -lelf
65
66/* configure thinks solaris X86 has gethostname, but it does not work,
67 so undefine it. */
68#undef HAVE_GETHOSTNAME
69
70#else /* not SOLARIS2 */
71#ifdef USG5_4 /* Older USG systems do not support the load average. */
72/* Data type of load average, as read out of kmem. */
73
74#define LOAD_AVE_TYPE long
75
76/* Convert that into an integer that is 100 for a load average of 1.0 */
77/* This is totally uncalibrated. */
78
79#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE))
80#define FSCALE 256.0
81#endif /* USG5_4 */
82#endif /* not SOLARIS2 */
83
84#ifdef USG 26#ifdef USG
85#define TEXT_START 0 27#define TEXT_START 0
86#endif /* USG */ 28#endif /* USG */
@@ -88,7 +30,6 @@ NOTE-END */
88#ifdef WINDOWSNT 30#ifdef WINDOWSNT
89#define VIRT_ADDR_VARIES 31#define VIRT_ADDR_VARIES
90#define DATA_START get_data_start () 32#define DATA_START get_data_start ()
91#define NO_ARG_ARRAY
92#endif 33#endif
93 34
94#ifdef GNU_LINUX 35#ifdef GNU_LINUX
diff --git a/src/m/iris4d.h b/src/m/iris4d.h
index 1c276ecb167..e7f332057e5 100644
--- a/src/m/iris4d.h
+++ b/src/m/iris4d.h
@@ -1,6 +1,7 @@
1/* machine description file for Iris-4D machines. Use with s/irix*.h. 1/* machine description file for Iris-4D machines. Use with s/irix*.h.
2 Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2
3 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -20,49 +21,29 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 21
21/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 22/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
22 is the most significant byte. */ 23 is the most significant byte. */
23
24#define WORDS_BIG_ENDIAN 24#define WORDS_BIG_ENDIAN
25 25
26/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
27 * group of arguments and treat it as an array of the arguments. */
28
29#define NO_ARG_ARRAY
30
31/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend 26/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
32 the bit field into an int. In other words, if bit fields 27 the bit field into an int. In other words, if bit fields
33 are always unsigned. 28 are always unsigned.
34 29
35 This flag only matters if you use USE_LISP_UNION_TYPE. */ 30 This flag only matters if you use USE_LISP_UNION_TYPE. */
36
37#define EXPLICIT_SIGN_EXTEND 31#define EXPLICIT_SIGN_EXTEND
38 32
39#define TEXT_START 0x400000 33#define TEXT_START 0x400000
40 34
41/* 35/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which
42 * DATA_SEG_BITS forces extra bits to be or'd in with any pointers which 36 were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for
43 * were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for 37 the value field of a LISP_OBJECT). */
44 * the value field of a LISP_OBJECT).
45 */
46
47#define DATA_START 0x10000000 38#define DATA_START 0x10000000
48#define DATA_SEG_BITS 0x10000000 39#define DATA_SEG_BITS 0x10000000
49 40
50/* Use terminfo instead of termcap. */
51
52#define TERMINFO
53
54/* Letter to use in finding device name of first pty,
55 if system supports pty's. 'a' means it is /dev/ptya0 */
56
57#undef FIRST_PTY_LETTER
58#define FIRST_PTY_LETTER 'q'
59 41
60#if _MIPS_SZLONG != 64 42#if _MIPS_SZLONG != 64
61/* fixme: should there be 64-bit definitions? (The ones below aren't OK.) */ 43/* fixme: should there be 64-bit definitions? (The ones below aren't OK.) */
62 44
63/* The standard definitions of these macros would work ok, 45/* The standard definitions of these macros would work ok,
64 but these are faster because the constants are short. */ 46 but these are faster because the constants are short. */
65
66#define XUINT(a) (((unsigned)(a) << BITS_PER_INT-VALBITS) >> BITS_PER_INT-VALBITS) 47#define XUINT(a) (((unsigned)(a) << BITS_PER_INT-VALBITS) >> BITS_PER_INT-VALBITS)
67 48
68#define XSET(var, type, ptr) \ 49#define XSET(var, type, ptr) \
diff --git a/src/m/m68k.h b/src/m/m68k.h
index b844f12fd6f..668db282593 100644
--- a/src/m/m68k.h
+++ b/src/m/m68k.h
@@ -1,6 +1,7 @@
1/* Machine description file for generic Motorola 68k. 1/* Machine description file for generic Motorola 68k.
2 Copyright (C) 1985, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2
3 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1985, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 2008, 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -19,12 +20,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 21/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
21 is the most significant byte. */ 22 is the most significant byte. */
22
23#define WORDS_BIG_ENDIAN 23#define WORDS_BIG_ENDIAN
24 24
25/* Now define a symbol for the cpu type, if your compiler 25/* Now define a symbol for the cpu type, if your compiler
26 does not define it automatically. */ 26 does not define it automatically. */
27
28#ifndef m68k 27#ifndef m68k
29#define m68k 28#define m68k
30#endif 29#endif
@@ -34,7 +33,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
34 are always unsigned. 33 are always unsigned.
35 34
36 This flag only matters if you use USE_LISP_UNION_TYPE. */ 35 This flag only matters if you use USE_LISP_UNION_TYPE. */
37
38#define EXPLICIT_SIGN_EXTEND 36#define EXPLICIT_SIGN_EXTEND
39 37
40#ifdef GNU_LINUX 38#ifdef GNU_LINUX
diff --git a/src/m/macppc.h b/src/m/macppc.h
index 150fc356518..b9dcf3bdc92 100644
--- a/src/m/macppc.h
+++ b/src/m/macppc.h
@@ -1,6 +1,7 @@
1/* machine description file For the powerpc Macintosh. 1/* machine description file For the powerpc Macintosh.
2 Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2
3 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -19,20 +20,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 21/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
21 is the most significant byte. */ 22 is the most significant byte. */
22
23#define WORDS_BIG_ENDIAN 23#define WORDS_BIG_ENDIAN
24 24
25/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
26 * group of arguments and treat it as an array of the arguments. */
27
28#define NO_ARG_ARRAY
29
30/* Data type of load average, as read out of kmem. */ 25/* Data type of load average, as read out of kmem. */
31
32#define LOAD_AVE_TYPE long 26#define LOAD_AVE_TYPE long
33 27
34/* Convert that into an integer that is 100 for a load average of 1.0 */ 28/* Convert that into an integer that is 100 for a load average of 1.0 */
35
36#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) 29#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
37 30
38#if (defined (__NetBSD__) || defined (__OpenBSD__)) && defined (__ELF__) 31#if (defined (__NetBSD__) || defined (__OpenBSD__)) && defined (__ELF__)
@@ -41,19 +34,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41 34
42/* NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says this is needed 35/* NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says this is needed
43 For MkLinux/LinuxPPC. */ 36 For MkLinux/LinuxPPC. */
44
45#ifdef GNU_LINUX 37#ifdef GNU_LINUX
46#define LINKER $(CC) -nostdlib 38#define LINKER $(CC) -nostdlib
47/* s/gnu-linux.h defines this to `-z nocombreloc' which does not work here
48 because prefix-args is not used. */
49#undef LD_SWITCH_SYSTEM_TEMACS
50#define LD_SWITCH_MACHINE_TEMACS -Xlinker -znocombreloc
51#ifdef _ARCH_PPC64
52#undef START_FILES
53#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
54#undef LIB_STANDARD
55#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o
56#endif
57#endif 39#endif
58 40
59#ifdef _ARCH_PPC64 41#ifdef _ARCH_PPC64
diff --git a/src/m/mips.h b/src/m/mips.h
index 7a84b6596c8..8e81c077426 100644
--- a/src/m/mips.h
+++ b/src/m/mips.h
@@ -1,6 +1,7 @@
1/* m- file for Mips machines. 1/* m- file for Mips machines.
2 Copyright (C) 1987, 1992, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2
3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1987, 1992, 1999, 2001, 2002, 2003, 2004, 2005, 2006,
4 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -17,57 +18,21 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 18You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20
21/* The following line tells the configuration script what sort of
22 operating system this machine is likely to run.
23 USUAL-OPSYS="note"
24
25NOTE-START
26This is used on GNU/Linux and netbsd.
27NOTE-END */
28
29/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 21/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
30 is the most significant byte. */ 22 is the most significant byte. */
31
32#if ! (defined (__MIPSEL__) || defined (MIPSEL) || defined (_MIPSEL)) 23#if ! (defined (__MIPSEL__) || defined (MIPSEL) || defined (_MIPSEL))
33#define WORDS_BIG_ENDIAN 24#define WORDS_BIG_ENDIAN
34#endif 25#endif
35 26
36/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
37 * group of arguments and treat it as an array of the arguments. */
38
39#define NO_ARG_ARRAY
40
41/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend 27/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
42 the 24-bit bit field into an int. In other words, if bit fields 28 the 24-bit bit field into an int. In other words, if bit fields
43 are always unsigned. 29 are always unsigned.
44 30
45 This flag only matters if you use USE_LISP_UNION_TYPE. */ 31 This flag only matters if you use USE_LISP_UNION_TYPE. */
46
47#define EXPLICIT_SIGN_EXTEND 32#define EXPLICIT_SIGN_EXTEND
48 33
49/* Describe layout of the address space in an executing process. */ 34/* Describe layout of the address space in an executing process. */
50
51#define TEXT_START 0x00400000 35#define TEXT_START 0x00400000
52 36
53
54#if 0 /* These definitions were advantageous when not using
55 USE_LSB_TAG. With that, they get ignored but cause errors. */
56
57#define DATA_SEG_BITS 0x10000000
58
59/* The standard definitions of these macros would work ok,
60 but these are faster because the constants are short. */
61
62#define XUINT(a) (((unsigned)(a) << (BITS_PER_INT-VALBITS)) >> (BITS_PER_INT-VALBITS))
63
64#define XSET(var, type, ptr) \
65 ((var) = \
66 ((int)(type) << VALBITS) \
67 + (((unsigned) (ptr) << (BITS_PER_INT-VALBITS)) >> (BITS_PER_INT-VALBITS)))
68
69/* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee 37/* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee
70 (do not change this comment) */ 38 (do not change this comment) */
71
72#endif /* 0 */
73
diff --git a/src/m/sh3.h b/src/m/sh3.h
index bb8e2937b01..703513d23f7 100644
--- a/src/m/sh3.h
+++ b/src/m/sh3.h
@@ -4,7 +4,5 @@
4# define WORDS_BIG_ENDIAN 4# define WORDS_BIG_ENDIAN
5#endif 5#endif
6 6
7#define NO_ARG_ARRAY
8
9/* arch-tag: 1b01b84f-f044-4afa-aa4b-caa54ec38966 7/* arch-tag: 1b01b84f-f044-4afa-aa4b-caa54ec38966
10 (do not change this comment) */ 8 (do not change this comment) */
diff --git a/src/m/sparc.h b/src/m/sparc.h
index 3eeb87a2b0e..39240dcbf5c 100644
--- a/src/m/sparc.h
+++ b/src/m/sparc.h
@@ -1,6 +1,7 @@
1/* machine description file for Sun 4 SPARC. 1/* machine description file for Sun 4 SPARC.
2 Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2
3 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -17,64 +18,34 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 18You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20/* The following line tells the configuration script what sort of
21 operating system this machine is likely to run.
22 USUAL-OPSYS="note"
23
24NOTE-START
25Use -opsystem=sunos4 for operating system version 4, and
26-opsystem=bsd4-2 for earlier versions.
27NOTE-END */
28
29/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 21/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
30 is the most significant byte. */ 22 is the most significant byte. */
31
32#define WORDS_BIG_ENDIAN 23#define WORDS_BIG_ENDIAN
33 24
34/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
35 * group of arguments and treat it as an array of the arguments. */
36
37#define NO_ARG_ARRAY
38
39/* __sparc__ is defined by the compiler by default. */ 25/* __sparc__ is defined by the compiler by default. */
40 26
41/* XINT must explicitly sign-extend 27/* XINT must explicitly sign-extend
42 This flag only matters if you use USE_LISP_UNION_TYPE. */ 28 This flag only matters if you use USE_LISP_UNION_TYPE. */
43
44#define EXPLICIT_SIGN_EXTEND 29#define EXPLICIT_SIGN_EXTEND
45 30
46/* Data type of load average, as read out of kmem. */ 31/* Data type of load average, as read out of kmem. */
47
48#define LOAD_AVE_TYPE long 32#define LOAD_AVE_TYPE long
49 33
50/* Convert that into an integer that is 100 for a load average of 1.0 */ 34/* Convert that into an integer that is 100 for a load average of 1.0 */
51
52#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) 35#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
53 36
54/* Mask for address bits within a memory segment */ 37/* Mask for address bits within a memory segment */
55
56#define SEGMENT_MASK (SEGSIZ - 1) 38#define SEGMENT_MASK (SEGSIZ - 1)
57 39
58#ifdef __arch64__ /* GCC, 64-bit ABI. */ 40#ifdef __arch64__ /* GCC, 64-bit ABI. */
41
59#define BITS_PER_LONG 64 42#define BITS_PER_LONG 64
60#ifdef __linux__
61#undef START_FILES
62#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
63
64/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD.
65 The reason is that some functions in libgcc.a call functions from libc.a,
66 and some libc.a functions need functions from libgcc.a. Since most
67 versions of ld are one-pass linkers, we need to mention -lgcc twice,
68 or else we risk getting unresolved externals. */
69#undef LIB_STANDARD
70#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o
71#endif
72 43
73#ifndef _LP64 44#ifndef _LP64
74#define _LP64 /* Done on Alpha -- not sure if it 45#define _LP64 /* Done on Alpha -- not sure if it should be here. -- fx */
75 should be here. -- fx */
76#endif
77#endif 46#endif
78 47
48#endif /* __arch64__ */
49
79/* arch-tag: 0a6f7882-33fd-4811-9832-7466c51e50f7 50/* arch-tag: 0a6f7882-33fd-4811-9832-7466c51e50f7
80 (do not change this comment) */ 51 (do not change this comment) */
diff --git a/src/m/template.h b/src/m/template.h
index 6e0dbb79844..9b8d2d63055 100644
--- a/src/m/template.h
+++ b/src/m/template.h
@@ -1,6 +1,7 @@
1/* machine description file template. 1/* machine description file template.
2 Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2
3 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 2008, 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -17,21 +18,10 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 18You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20
21/* The following line tells the configuration script what sort of
22 operating system this machine is likely to run.
23 USUAL-OPSYS="<name of system .h file here, without the s- or .h>" */
24
25/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 21/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
26 is the most significant byte. */ 22 is the most significant byte. */
27
28#define WORDS_BIG_ENDIAN 23#define WORDS_BIG_ENDIAN
29 24
30/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
31 * group of arguments and treat it as an array of the arguments. */
32
33#define NO_ARG_ARRAY
34
35/* Now define a symbol for the cpu type, if your compiler 25/* Now define a symbol for the cpu type, if your compiler
36 does not define it automatically. 26 does not define it automatically.
37 Ones defined so far include m68k and many others */ 27 Ones defined so far include m68k and many others */
@@ -41,21 +31,17 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41 are always unsigned. 31 are always unsigned.
42 32
43 This flag only matters if you use USE_LISP_UNION_TYPE. */ 33 This flag only matters if you use USE_LISP_UNION_TYPE. */
44
45#define EXPLICIT_SIGN_EXTEND 34#define EXPLICIT_SIGN_EXTEND
46 35
47/* Data type of load average, as read out of kmem. */ 36/* Data type of load average, as read out of kmem. */
48
49#define LOAD_AVE_TYPE long 37#define LOAD_AVE_TYPE long
50 38
51/* Convert that into an integer that is 100 for a load average of 1.0 */ 39/* Convert that into an integer that is 100 for a load average of 1.0 */
52
53#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) 40#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
54 41
55/* Define CANNOT_DUMP on machines where unexec does not work. 42/* Define CANNOT_DUMP on machines where unexec does not work.
56 Then the function dump-emacs will not be defined 43 Then the function dump-emacs will not be defined
57 and temacs will do (load "loadup") automatically unless told otherwise. */ 44 and temacs will do (load "loadup") automatically unless told otherwise. */
58
59#define CANNOT_DUMP 45#define CANNOT_DUMP
60 46
61/* Define VIRT_ADDR_VARIES if the virtual addresses of 47/* Define VIRT_ADDR_VARIES if the virtual addresses of
@@ -64,31 +50,25 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
64 50
65 Otherwise Emacs assumes that text space precedes data space, 51 Otherwise Emacs assumes that text space precedes data space,
66 numerically. */ 52 numerically. */
67
68#define VIRT_ADDR_VARIES 53#define VIRT_ADDR_VARIES
69 54
70/* Define NO_REMAP if memory segmentation makes it not work well 55/* Define NO_REMAP if memory segmentation makes it not work well
71 to change the boundary between the text section and data section 56 to change the boundary between the text section and data section
72 when Emacs is dumped. If you define this, the preloaded Lisp 57 when Emacs is dumped. If you define this, the preloaded Lisp
73 code will not be sharable; but that's better than failing completely. */ 58 code will not be sharable; but that's better than failing completely. */
74
75#define NO_REMAP 59#define NO_REMAP
76 60
77/* Some really obscure 4.2-based systems (like Sequent DYNIX) 61/* Some really obscure 4.2-based systems (like Sequent DYNIX)
78 * do not support asynchronous I/O (using SIGIO) on sockets, 62 do not support asynchronous I/O (using SIGIO) on sockets,
79 * even though it works fine on tty's. If you have one of 63 even though it works fine on tty's. If you have one of
80 * these systems, define the following, and then use it in 64 these systems, define the following, and then use it in
81 * config.h (or elsewhere) to decide when (not) to use SIGIO. 65 config.h (or elsewhere) to decide when (not) to use SIGIO.
82 * 66
83 * You'd think this would go in an operating-system description file, 67 You'd think this would go in an operating-system description file,
84 * but since it only occurs on some, but not all, BSD systems, the 68 but since it only occurs on some, but not all, BSD systems, the
85 * reasonable place to select for it is in the machine description 69 reasonable place to select for it is in the machine description file. */
86 * file.
87 */
88
89#define NO_SOCK_SIGIO 70#define NO_SOCK_SIGIO
90 71
91
92/* After adding support for a new system, modify the large case 72/* After adding support for a new system, modify the large case
93 statement in the `configure' script to recognize reasonable 73 statement in the `configure' script to recognize reasonable
94 configuration names, and add a description of the system to 74 configuration names, and add a description of the system to
diff --git a/src/m/vax.h b/src/m/vax.h
index f33c2d5227a..3426a20d55e 100644
--- a/src/m/vax.h
+++ b/src/m/vax.h
@@ -1,6 +1,7 @@
1/* machine description file for vax. 1/* machine description file for vax.
2 Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2
3 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 2008, 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -18,18 +19,8 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20 21
21/* The following line tells the configuration script what sort of
22 operating system this machine is likely to run.
23 USUAL-OPSYS="note"
24
25NOTE-START
26The vax (-machine=vax) runs zillions of different operating systems.
27
28NOTE-END */
29
30/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word 22/* Define WORDS_BIG_ENDIAN if lowest-numbered byte in a word
31 is the most significant byte. */ 23 is the most significant byte. */
32
33#undef WORDS_BIG_ENDIAN 24#undef WORDS_BIG_ENDIAN
34 25
35/* #define vax -- appears to be done automatically */ 26/* #define vax -- appears to be done automatically */
@@ -38,11 +29,9 @@ NOTE-END */
38 support the load average, so disable it for them. */ 29 support the load average, so disable it for them. */
39 30
40/* Data type of load average, as read out of kmem. */ 31/* Data type of load average, as read out of kmem. */
41
42#define LOAD_AVE_TYPE double 32#define LOAD_AVE_TYPE double
43 33
44/* Convert that into an integer that is 100 for a load average of 1.0 */ 34/* Convert that into an integer that is 100 for a load average of 1.0 */
45
46#define LOAD_AVE_CVT(x) ((int) ((x) * 100.0)) 35#define LOAD_AVE_CVT(x) ((int) ((x) * 100.0))
47 36
48#define HAVE_FTIME 37#define HAVE_FTIME
diff --git a/src/m/xtensa.h b/src/m/xtensa.h
index d53686d9401..664f18dcb10 100644
--- a/src/m/xtensa.h
+++ b/src/m/xtensa.h
@@ -2,8 +2,6 @@
2 2
3Add a license notice if this grows to > 10 lines of code. */ 3Add a license notice if this grows to > 10 lines of code. */
4 4
5#define NO_ARG_ARRAY
6
7#ifdef __LITTLE_ENDIAN 5#ifdef __LITTLE_ENDIAN
8#undef WORDS_BIG_ENDIAN 6#undef WORDS_BIG_ENDIAN
9#else 7#else
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 5eaba6374fd..34af372dc5e 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -62,7 +62,6 @@ OBJ1 = $(BLD)/alloc.$(O) \
62 $(BLD)/callint.$(O) \ 62 $(BLD)/callint.$(O) \
63 $(BLD)/callproc.$(O) \ 63 $(BLD)/callproc.$(O) \
64 $(BLD)/casefiddle.$(O) \ 64 $(BLD)/casefiddle.$(O) \
65 $(BLD)/cm.$(O) \
66 $(BLD)/cmds.$(O) \ 65 $(BLD)/cmds.$(O) \
67 $(BLD)/data.$(O) \ 66 $(BLD)/data.$(O) \
68 $(BLD)/dired.$(O) \ 67 $(BLD)/dired.$(O) \
@@ -98,7 +97,6 @@ OBJ1 = $(BLD)/alloc.$(O) \
98 $(BLD)/syntax.$(O) \ 97 $(BLD)/syntax.$(O) \
99 $(BLD)/sysdep.$(O) \ 98 $(BLD)/sysdep.$(O) \
100 $(BLD)/term.$(O) \ 99 $(BLD)/term.$(O) \
101 $(BLD)/termcap.$(O) \
102 $(BLD)/tparam.$(O) \ 100 $(BLD)/tparam.$(O) \
103 $(BLD)/undo.$(O) \ 101 $(BLD)/undo.$(O) \
104 $(BLD)/unexw32.$(O) \ 102 $(BLD)/unexw32.$(O) \
@@ -494,17 +492,6 @@ $(BLD)/chartab.$(O) : \
494 $(SRC)/character.h \ 492 $(SRC)/character.h \
495 $(SRC)/charset.h 493 $(SRC)/charset.h
496 494
497$(BLD)/cm.$(O) : \
498 $(SRC)/cm.c \
499 $(CONFIG_H) \
500 $(SRC)/lisp.h \
501 $(SRC)/cm.h \
502 $(SRC)/dispextern.h \
503 $(SRC)/frame.h \
504 $(SRC)/termchar.h \
505 $(SRC)/termhooks.h \
506 $(SRC)/w32gui.h
507
508$(BLD)/cmds.$(O) : \ 495$(BLD)/cmds.$(O) : \
509 $(SRC)/cmds.c \ 496 $(SRC)/cmds.c \
510 $(CONFIG_H) \ 497 $(CONFIG_H) \
@@ -710,6 +697,7 @@ $(BLD)/eval.$(O) : \
710 $(SRC)/commands.h \ 697 $(SRC)/commands.h \
711 $(SRC)/composite.h \ 698 $(SRC)/composite.h \
712 $(SRC)/dispextern.h \ 699 $(SRC)/dispextern.h \
700 $(SRC)/frame.h \
713 $(SRC)/keyboard.h \ 701 $(SRC)/keyboard.h \
714 $(SRC)/systime.h \ 702 $(SRC)/systime.h \
715 $(SRC)/w32gui.h 703 $(SRC)/w32gui.h
@@ -1407,13 +1395,6 @@ $(BLD)/term.$(O) : \
1407 $(SRC)/w32gui.h \ 1395 $(SRC)/w32gui.h \
1408 $(SRC)/window.h 1396 $(SRC)/window.h
1409 1397
1410$(BLD)/termcap.$(O) : \
1411 $(SRC)/termcap.c \
1412 $(CONFIG_H) \
1413 $(EMACS_ROOT)/nt/inc/unistd.h \
1414 $(EMACS_ROOT)/nt/inc/sys/file.h \
1415 $(SRC)/lisp.h
1416
1417$(BLD)/terminal.$(O) : \ 1398$(BLD)/terminal.$(O) : \
1418 $(SRC)/terminal.c \ 1399 $(SRC)/terminal.c \
1419 $(CONFIG_H) \ 1400 $(CONFIG_H) \
@@ -1574,6 +1555,7 @@ $(BLD)/w32fns.$(O) : \
1574 $(SRC)/keyboard.h \ 1555 $(SRC)/keyboard.h \
1575 $(SRC)/systime.h \ 1556 $(SRC)/systime.h \
1576 $(SRC)/termhooks.h \ 1557 $(SRC)/termhooks.h \
1558 $(SRC)/w32.h \
1577 $(SRC)/w32font.h \ 1559 $(SRC)/w32font.h \
1578 $(SRC)/w32gui.h \ 1560 $(SRC)/w32gui.h \
1579 $(SRC)/w32heap.h \ 1561 $(SRC)/w32heap.h \
diff --git a/src/msdos.c b/src/msdos.c
index 6cde7cd6ebc..ea604d29992 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -528,8 +528,7 @@ dos_set_window_size (rows, cols)
528 /* If the user specified a special video mode for these dimensions, 528 /* If the user specified a special video mode for these dimensions,
529 use that mode. */ 529 use that mode. */
530 sprintf (video_name, "screen-dimensions-%dx%d", *rows, *cols); 530 sprintf (video_name, "screen-dimensions-%dx%d", *rows, *cols);
531 video_mode = XSYMBOL (Fintern_soft (build_string (video_name), 531 video_mode = Fsymbol_value (Fintern_soft (build_string (video_name), Qnil));
532 Qnil))-> value;
533 532
534 if (INTEGERP (video_mode) 533 if (INTEGERP (video_mode)
535 && (video_mode_value = XINT (video_mode)) > 0) 534 && (video_mode_value = XINT (video_mode)) > 0)
@@ -4458,8 +4457,6 @@ setpriority (x,y,z) int x,y,z; { return 0; }
4458 4457
4459#if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2 4458#if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2
4460 4459
4461#ifdef POSIX_SIGNALS
4462
4463/* Augment DJGPP library POSIX signal functions. This is needed 4460/* Augment DJGPP library POSIX signal functions. This is needed
4464 as of DJGPP v2.01, but might be in the library in later releases. */ 4461 as of DJGPP v2.01, but might be in the library in later releases. */
4465 4462
@@ -4557,12 +4554,6 @@ sigprocmask (how, new_set, old_set)
4557 return 0; 4554 return 0;
4558} 4555}
4559 4556
4560#else /* not POSIX_SIGNALS */
4561
4562sigsetmask (x) int x; { return 0; }
4563sigblock (mask) int mask; { return 0; }
4564
4565#endif /* not POSIX_SIGNALS */
4566#endif /* not __DJGPP_MINOR__ < 2 */ 4557#endif /* not __DJGPP_MINOR__ < 2 */
4567 4558
4568#ifndef HAVE_SELECT 4559#ifndef HAVE_SELECT
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 2581be9aeb7..f85ebc165af 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1709,7 +1709,7 @@ void process_dialog (id window, Lisp_Object list)
1709 1709
1710- (Lisp_Object)runDialogAt: (NSPoint)p 1710- (Lisp_Object)runDialogAt: (NSPoint)p
1711{ 1711{
1712 int ret; 1712 NSInteger ret;
1713 extern EMACS_TIME timer_check (int do_it_now); /* TODO: add to a header */ 1713 extern EMACS_TIME timer_check (int do_it_now); /* TODO: add to a header */
1714 1714
1715 /* initiate a session that will be ended by pop_down_menu */ 1715 /* initiate a session that will be ended by pop_down_menu */
diff --git a/src/print.c b/src/print.c
index ccbf8d8c0c7..6d403e00fe0 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2267,70 +2267,6 @@ print_object (obj, printcharfun, escapeflag)
2267 strout ("#<misc free cell>", -1, -1, printcharfun, 0); 2267 strout ("#<misc free cell>", -1, -1, printcharfun, 0);
2268 break; 2268 break;
2269 2269
2270 case Lisp_Misc_Intfwd:
2271 sprintf (buf, "#<intfwd to %ld>", (long) *XINTFWD (obj)->intvar);
2272 strout (buf, -1, -1, printcharfun, 0);
2273 break;
2274
2275 case Lisp_Misc_Boolfwd:
2276 sprintf (buf, "#<boolfwd to %s>",
2277 (*XBOOLFWD (obj)->boolvar ? "t" : "nil"));
2278 strout (buf, -1, -1, printcharfun, 0);
2279 break;
2280
2281 case Lisp_Misc_Objfwd:
2282 strout ("#<objfwd to ", -1, -1, printcharfun, 0);
2283 print_object (*XOBJFWD (obj)->objvar, printcharfun, escapeflag);
2284 PRINTCHAR ('>');
2285 break;
2286
2287 case Lisp_Misc_Buffer_Objfwd:
2288 strout ("#<buffer_objfwd to ", -1, -1, printcharfun, 0);
2289 print_object (PER_BUFFER_VALUE (current_buffer,
2290 XBUFFER_OBJFWD (obj)->offset),
2291 printcharfun, escapeflag);
2292 PRINTCHAR ('>');
2293 break;
2294
2295 case Lisp_Misc_Kboard_Objfwd:
2296 strout ("#<kboard_objfwd to ", -1, -1, printcharfun, 0);
2297 print_object (*(Lisp_Object *) ((char *) current_kboard
2298 + XKBOARD_OBJFWD (obj)->offset),
2299 printcharfun, escapeflag);
2300 PRINTCHAR ('>');
2301 break;
2302
2303 case Lisp_Misc_Buffer_Local_Value:
2304 strout ("#<buffer_local_value ", -1, -1, printcharfun, 0);
2305 if (XBUFFER_LOCAL_VALUE (obj)->local_if_set)
2306 strout ("[local-if-set] ", -1, -1, printcharfun, 0);
2307 strout ("[realvalue] ", -1, -1, printcharfun, 0);
2308 print_object (XBUFFER_LOCAL_VALUE (obj)->realvalue,
2309 printcharfun, escapeflag);
2310 if (XBUFFER_LOCAL_VALUE (obj)->found_for_buffer)
2311 strout ("[local in buffer] ", -1, -1, printcharfun, 0);
2312 else
2313 strout ("[buffer] ", -1, -1, printcharfun, 0);
2314 print_object (XBUFFER_LOCAL_VALUE (obj)->buffer,
2315 printcharfun, escapeflag);
2316 if (XBUFFER_LOCAL_VALUE (obj)->check_frame)
2317 {
2318 if (XBUFFER_LOCAL_VALUE (obj)->found_for_frame)
2319 strout ("[local in frame] ", -1, -1, printcharfun, 0);
2320 else
2321 strout ("[frame] ", -1, -1, printcharfun, 0);
2322 print_object (XBUFFER_LOCAL_VALUE (obj)->frame,
2323 printcharfun, escapeflag);
2324 }
2325 strout ("[alist-elt] ", -1, -1, printcharfun, 0);
2326 print_object (XCAR (XBUFFER_LOCAL_VALUE (obj)->cdr),
2327 printcharfun, escapeflag);
2328 strout ("[default-value] ", -1, -1, printcharfun, 0);
2329 print_object (XCDR (XBUFFER_LOCAL_VALUE (obj)->cdr),
2330 printcharfun, escapeflag);
2331 PRINTCHAR ('>');
2332 break;
2333
2334 case Lisp_Misc_Save_Value: 2270 case Lisp_Misc_Save_Value:
2335 strout ("#<save_value ", -1, -1, printcharfun, 0); 2271 strout ("#<save_value ", -1, -1, printcharfun, 0);
2336 sprintf(buf, "ptr=0x%08lx int=%d", 2272 sprintf(buf, "ptr=0x%08lx int=%d",
diff --git a/src/process.c b/src/process.c
index 7e8f4cc57bc..a09ac297a2d 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1866,7 +1866,6 @@ create_process (process, new_argv, current_dir)
1866#if !defined (WINDOWSNT) && defined (FD_CLOEXEC) 1866#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
1867 int wait_child_setup[2]; 1867 int wait_child_setup[2];
1868#endif 1868#endif
1869#ifdef POSIX_SIGNALS
1870 sigset_t procmask; 1869 sigset_t procmask;
1871 sigset_t blocked; 1870 sigset_t blocked;
1872 struct sigaction sigint_action; 1871 struct sigaction sigint_action;
@@ -1874,7 +1873,6 @@ create_process (process, new_argv, current_dir)
1874#ifdef AIX 1873#ifdef AIX
1875 struct sigaction sighup_action; 1874 struct sigaction sighup_action;
1876#endif 1875#endif
1877#endif /* POSIX_SIGNALS */
1878 /* Use volatile to protect variables from being clobbered by longjmp. */ 1876 /* Use volatile to protect variables from being clobbered by longjmp. */
1879 volatile int forkin, forkout; 1877 volatile int forkin, forkout;
1880 volatile int pty_flag = 0; 1878 volatile int pty_flag = 0;
@@ -1979,7 +1977,6 @@ create_process (process, new_argv, current_dir)
1979 1977
1980 /* Delay interrupts until we have a chance to store 1978 /* Delay interrupts until we have a chance to store
1981 the new fork's pid in its process structure */ 1979 the new fork's pid in its process structure */
1982#ifdef POSIX_SIGNALS
1983 sigemptyset (&blocked); 1980 sigemptyset (&blocked);
1984#ifdef SIGCHLD 1981#ifdef SIGCHLD
1985 sigaddset (&blocked, SIGCHLD); 1982 sigaddset (&blocked, SIGCHLD);
@@ -1996,13 +1993,6 @@ create_process (process, new_argv, current_dir)
1996#endif 1993#endif
1997#endif /* HAVE_WORKING_VFORK */ 1994#endif /* HAVE_WORKING_VFORK */
1998 sigprocmask (SIG_BLOCK, &blocked, &procmask); 1995 sigprocmask (SIG_BLOCK, &blocked, &procmask);
1999#else /* !POSIX_SIGNALS */
2000#ifdef SIGCHLD
2001#if defined (BSD_SYSTEM)
2002 sigsetmask (sigmask (SIGCHLD));
2003#endif /* BSD_SYSTEM */
2004#endif /* SIGCHLD */
2005#endif /* !POSIX_SIGNALS */
2006 1996
2007 FD_SET (inchannel, &input_wait_mask); 1997 FD_SET (inchannel, &input_wait_mask);
2008 FD_SET (inchannel, &non_keyboard_wait_mask); 1998 FD_SET (inchannel, &non_keyboard_wait_mask);
@@ -2153,15 +2143,7 @@ create_process (process, new_argv, current_dir)
2153 signal (SIGQUIT, SIG_DFL); 2143 signal (SIGQUIT, SIG_DFL);
2154 2144
2155 /* Stop blocking signals in the child. */ 2145 /* Stop blocking signals in the child. */
2156#ifdef POSIX_SIGNALS
2157 sigprocmask (SIG_SETMASK, &procmask, 0); 2146 sigprocmask (SIG_SETMASK, &procmask, 0);
2158#else /* !POSIX_SIGNALS */
2159#ifdef SIGCHLD
2160#if defined (BSD_SYSTEM)
2161 sigsetmask (SIGEMPTYMASK);
2162#endif /* BSD_SYSTEM */
2163#endif /* SIGCHLD */
2164#endif /* !POSIX_SIGNALS */
2165 2147
2166 if (pty_flag) 2148 if (pty_flag)
2167 child_setup_tty (xforkout); 2149 child_setup_tty (xforkout);
@@ -2243,7 +2225,6 @@ create_process (process, new_argv, current_dir)
2243 2225
2244 /* Restore the signal state whether vfork succeeded or not. 2226 /* Restore the signal state whether vfork succeeded or not.
2245 (We will signal an error, below, if it failed.) */ 2227 (We will signal an error, below, if it failed.) */
2246#ifdef POSIX_SIGNALS
2247#ifdef HAVE_WORKING_VFORK 2228#ifdef HAVE_WORKING_VFORK
2248 /* Restore the parent's signal handlers. */ 2229 /* Restore the parent's signal handlers. */
2249 sigaction (SIGINT, &sigint_action, 0); 2230 sigaction (SIGINT, &sigint_action, 0);
@@ -2254,13 +2235,6 @@ create_process (process, new_argv, current_dir)
2254#endif /* HAVE_WORKING_VFORK */ 2235#endif /* HAVE_WORKING_VFORK */
2255 /* Stop blocking signals in the parent. */ 2236 /* Stop blocking signals in the parent. */
2256 sigprocmask (SIG_SETMASK, &procmask, 0); 2237 sigprocmask (SIG_SETMASK, &procmask, 0);
2257#else /* !POSIX_SIGNALS */
2258#ifdef SIGCHLD
2259#if defined (BSD_SYSTEM)
2260 sigsetmask (SIGEMPTYMASK);
2261#endif /* BSD_SYSTEM */
2262#endif /* SIGCHLD */
2263#endif /* !POSIX_SIGNALS */
2264 2238
2265 /* Now generate the error if vfork failed. */ 2239 /* Now generate the error if vfork failed. */
2266 if (pid < 0) 2240 if (pid < 0)
@@ -5396,7 +5370,7 @@ read_process_output (proc, channel)
5396 /* There's no good reason to let process filters change the current 5370 /* There's no good reason to let process filters change the current
5397 buffer, and many callers of accept-process-output, sit-for, and 5371 buffer, and many callers of accept-process-output, sit-for, and
5398 friends don't expect current-buffer to be changed from under them. */ 5372 friends don't expect current-buffer to be changed from under them. */
5399 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 5373 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
5400 5374
5401 /* Read and dispose of the process output. */ 5375 /* Read and dispose of the process output. */
5402 outstream = p->filter; 5376 outstream = p->filter;
@@ -6814,7 +6788,7 @@ exec_sentinel (proc, reason)
6814 /* There's no good reason to let sentinels change the current 6788 /* There's no good reason to let sentinels change the current
6815 buffer, and many callers of accept-process-output, sit-for, and 6789 buffer, and many callers of accept-process-output, sit-for, and
6816 friends don't expect current-buffer to be changed from under them. */ 6790 friends don't expect current-buffer to be changed from under them. */
6817 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 6791 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
6818 6792
6819 sentinel = p->sentinel; 6793 sentinel = p->sentinel;
6820 if (NILP (sentinel)) 6794 if (NILP (sentinel))
diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h
index 32bc67bfd46..cdb97b7f9fa 100644
--- a/src/s/aix4-2.h
+++ b/src/s/aix4-2.h
@@ -1,6 +1,6 @@
1/* 1/*
2Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 2Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
3 Free Software Foundation, Inc. 3 2010 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -17,68 +17,48 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20/* 20/* Define symbols to identify the version of Unix this is.
21 * Define symbols to identify the version of Unix this is. 21 Define all the symbols that apply correctly. */
22 * Define all the symbols that apply correctly.
23 */
24
25#define USG /* System III, System V, etc */ 22#define USG /* System III, System V, etc */
26#define USG5 23#define USG5
27 24
28/* This symbol should be defined on AIX Version 3 ??????? */ 25/* This symbol should be defined on AIX Version 3 ??????? */
29#ifndef _AIX 26#ifndef _AIX
30#define _AIX 27#define _AIX
31#endif 28#endif
32 29
33/* SYSTEM_TYPE should indicate the kind of system you are using. 30/* SYSTEM_TYPE should indicate the kind of system you are using.
34 It sets the Lisp variable system-type. */ 31 It sets the Lisp variable system-type. */
35
36#define SYSTEM_TYPE "aix" 32#define SYSTEM_TYPE "aix"
37 33
38/* In AIX, you allocate a pty by opening /dev/ptc to get the master side. 34/* In AIX, you allocate a pty by opening /dev/ptc to get the master side.
39 To get the name of the slave side, you just ttyname() the master side. */ 35 To get the name of the slave side, you just ttyname() the master side. */
40
41#define PTY_ITERATION for (c = 0; !c ; c++) 36#define PTY_ITERATION for (c = 0; !c ; c++)
42#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptc"); 37#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptc");
43#define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd)); 38#define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd));
44 39
45/* 40/* Define HAVE_TERMIO if the system provides sysV-style ioctls
46 * Define HAVE_TERMIO if the system provides sysV-style ioctls 41 for terminal control. */
47 * for terminal control.
48 */
49
50#define HAVE_TERMIOS 42#define HAVE_TERMIOS
51 43
52/* 44/* Define HAVE_PTYS if the system supports pty devices. */
53 * Define HAVE_PTYS if the system supports pty devices.
54 */
55
56#define HAVE_PTYS 45#define HAVE_PTYS
57 46
58/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ 47/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */
59
60#define HAVE_SOCKETS 48#define HAVE_SOCKETS
61 49
62 50
63/* 51/* Define SYSV_SYSTEM_DIR to use the V.3 getdents/readir library
64 * Define SYSV_SYSTEM_DIR to use the V.3 getdents/readir 52 functions. Almost, but not quite the same as the 4.2 functions. */
65 * library functions. Almost, but not quite the same as
66 * the 4.2 functions
67 */
68
69#define SYSV_SYSTEM_DIR 53#define SYSV_SYSTEM_DIR
70 54
71/* Define this symbol if your system has the functions bcopy, etc. */ 55/* Define this symbol if your system has the functions bcopy, etc. */
72
73#define BSTRING 56#define BSTRING
74 57
75/* The file containing the kernel's symbol table is called /unix. */ 58/* The file containing the kernel's symbol table is called /unix. */
76
77#define KERNEL_FILE "/unix" 59#define KERNEL_FILE "/unix"
78 60
79/* The symbol in the kernel where the load average is found 61/* The kernel symbol where the load average is found is named avenrun. */
80 is named avenrun. */
81
82#define LDAV_SYMBOL "avenrun" 62#define LDAV_SYMBOL "avenrun"
83 63
84/* Special itemss needed to make Emacs run on this system. */ 64/* Special itemss needed to make Emacs run on this system. */
@@ -87,40 +67,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
87#define LINKER cc 67#define LINKER cc
88#endif 68#endif
89 69
90/* No need to specify -lc when linking. */
91
92#define LIB_STANDARD
93
94/* -lpthreads seems to be necessary for Xlib in X11R6, and should be harmless
95 on older versions of X where it happens to exist. */
96#ifdef HAVE_LIBPTHREADS
97#define LIBS_SYSTEM -lrts -lIM -liconv -lpthreads
98#else
99/* IBM's X11R5 use -lIM and -liconv in AIX 3.2.2. */
100#define LIBS_SYSTEM -lrts -lIM -liconv
101#endif
102
103/* Use terminfo instead of termcap. */
104
105#define TERMINFO
106
107/* The following definition seems to be needed in AIX version 3.1.6.8. 70/* The following definition seems to be needed in AIX version 3.1.6.8.
108 It may not have been needed in certain earlier versions. */ 71 It may not have been needed in certain earlier versions. */
109#define HAVE_TCATTR 72#define HAVE_TCATTR
110 73
111/* Include unistd.h, even though we don't define POSIX. */
112#define NEED_UNISTD_H
113
114/* AIX doesn't define this. */ 74/* AIX doesn't define this. */
115#define unix 1 75#define unix 1
116 76
117#ifndef __GNUC__
118/* Some programs in src produce warnings saying certain subprograms
119 are to comples and need a MAXMEM value greater than 2000 for
120 additional optimization. --nils@exp-math.uni-essen.de */
121#define C_SWITCH_SYSTEM -ma -qmaxmem=4000
122#endif
123
124/* string.h defines rindex as a macro, at least with native cc, so we 77/* string.h defines rindex as a macro, at least with native cc, so we
125 lose declaring char * rindex without this. 78 lose declaring char * rindex without this.
126 It is just a guess which versions of AIX need this definition. */ 79 It is just a guess which versions of AIX need this definition. */
@@ -128,19 +81,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
128 81
129/* Perry Smith <pedz@ddivt1.austin.ibm.com> says these are correct. */ 82/* Perry Smith <pedz@ddivt1.austin.ibm.com> says these are correct. */
130#define SIGNALS_VIA_CHARACTERS 83#define SIGNALS_VIA_CHARACTERS
131#define MAIL_USE_LOCKF
132#define CLASH_DETECTION 84#define CLASH_DETECTION
133 85
134/* Perry Smith <pedz@ddivt1.austin.ibm.com> says these are correct. */ 86/* Perry Smith <pedz@ddivt1.austin.ibm.com> says these are correct. */
135#define POSIX_SIGNALS
136#undef sigmask 87#undef sigmask
137 88
138/* olson@mcs.anl.gov says -li18n is needed by -lXm. */
139#define LIB_MOTIF -lXm -li18n
140
141#ifndef HAVE_LIBXMU 89#ifndef HAVE_LIBXMU
142#define LIBXMU
143
144/* Unfortunately without libXmu we cannot support EditRes. */ 90/* Unfortunately without libXmu we cannot support EditRes. */
145#define NO_EDITRES 91#define NO_EDITRES
146#endif 92#endif
@@ -148,7 +94,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
148/* On AIX Emacs uses the gmalloc.c malloc implementation. But given 94/* On AIX Emacs uses the gmalloc.c malloc implementation. But given
149 the way this system works, libc functions that return malloced 95 the way this system works, libc functions that return malloced
150 memory use the libc malloc implementation. Calling xfree or 96 memory use the libc malloc implementation. Calling xfree or
151 xrealloc on the results of such functions results in a crash. 97 xrealloc on the results of such functions results in a crash.
152 98
153 One solution for this could be to define SYSTEM_MALLOC here, but 99 One solution for this could be to define SYSTEM_MALLOC here, but
154 that does not currently work on this system. 100 that does not currently work on this system.
@@ -156,11 +102,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
156 It is possible to completely override the malloc implementation on 102 It is possible to completely override the malloc implementation on
157 AIX, but that involves putting the malloc functions in a shared 103 AIX, but that involves putting the malloc functions in a shared
158 library and setting the MALLOCTYPE environment variable to point to 104 library and setting the MALLOCTYPE environment variable to point to
159 tha shared library. 105 that shared library.
160 106
161 Emacs currently calls xrealloc on the results of get_current_dir name, 107 Emacs currently calls xrealloc on the results of get_current_dir name,
162 to avoid a crash just use the Emacs implementation for that function. 108 to avoid a crash just use the Emacs implementation for that function. */
163*/
164#define BROKEN_GET_CURRENT_DIR_NAME 1 109#define BROKEN_GET_CURRENT_DIR_NAME 1
165 110
166#define UNEXEC unexaix.o 111#define UNEXEC unexaix.o
diff --git a/src/s/bsd-common.h b/src/s/bsd-common.h
index 9dad7a9b1d9..2a8934d7f50 100644
--- a/src/s/bsd-common.h
+++ b/src/s/bsd-common.h
@@ -1,6 +1,7 @@
1/* Definitions file for GNU Emacs running on bsd 4.3 1/* Definitions file for GNU Emacs running on bsd 4.3
2 Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2
3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1985, 1986, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 2008, 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -18,10 +19,8 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20 21
21/* 22/* Define symbols to identify the version of Unix this is.
22 * Define symbols to identify the version of Unix this is. 23 Define all the symbols that apply correctly. */
23 * Define all the symbols that apply correctly.
24 */
25 24
26/* We give these symbols the numeric values found in <sys/param.h> to 25/* We give these symbols the numeric values found in <sys/param.h> to
27 avoid warnings about redefined macros. */ 26 avoid warnings about redefined macros. */
@@ -48,9 +47,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
48 47
49#define SYSV_SYSTEM_DIR 48#define SYSV_SYSTEM_DIR
50 49
51/* POSIX-style pgrp behavior. */
52#undef BSD_PGRPS
53
54#define UNEXEC unexelf.o 50#define UNEXEC unexelf.o
55 51
56/* If the system's imake configuration file defines `NeedWidePrototypes' 52/* If the system's imake configuration file defines `NeedWidePrototypes'
@@ -58,61 +54,40 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
58 generated in the Makefile generated by `xmkmf'. If we don't 54 generated in the Makefile generated by `xmkmf'. If we don't
59 define NARROWPROTO, we will see the wrong function prototypes 55 define NARROWPROTO, we will see the wrong function prototypes
60 for X functions taking float or double parameters. */ 56 for X functions taking float or double parameters. */
61
62#define NARROWPROTO 1 57#define NARROWPROTO 1
63 58
64/* SYSTEM_TYPE should indicate the kind of system you are using. 59/* SYSTEM_TYPE should indicate the kind of system you are using.
65 It sets the Lisp variable system-type. */ 60 It sets the Lisp variable system-type. */
66
67#define SYSTEM_TYPE "berkeley-unix" 61#define SYSTEM_TYPE "berkeley-unix"
68 62
69/* Do not use interrupt_input = 1 by default, because in 4.3 63/* Do not use interrupt_input = 1 by default, because in 4.3
70 we can make noninterrupt input work properly. */ 64 we can make noninterrupt input work properly. */
71
72#undef INTERRUPT_INPUT 65#undef INTERRUPT_INPUT
73 66
74/* First pty name is /dev/ptyp0. */ 67/* First pty name is /dev/ptyp0. */
75
76#define FIRST_PTY_LETTER 'p' 68#define FIRST_PTY_LETTER 'p'
77 69
78/* 70/* Define HAVE_PTYS if the system supports pty devices. */
79 * Define HAVE_PTYS if the system supports pty devices.
80 */
81
82#define HAVE_PTYS 71#define HAVE_PTYS
83 72
84/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ 73/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */
85
86#define HAVE_SOCKETS 74#define HAVE_SOCKETS
87 75
88/* Define this symbol if your system has the functions bcopy, etc. */ 76/* Define this symbol if your system has the functions bcopy, etc. */
89
90#define BSTRING 77#define BSTRING
91 78
92/* define MAIL_USE_FLOCK if the mailer uses flock
93 to interlock access to /usr/spool/mail/$USER.
94 The alternative is that a lock file named
95 /usr/spool/mail/$USER.lock. */
96
97#define MAIL_USE_FLOCK
98
99/* Define CLASH_DETECTION if you want lock files to be written 79/* Define CLASH_DETECTION if you want lock files to be written
100 so that Emacs can tell instantly when you try to modify 80 so that Emacs can tell instantly when you try to modify
101 a file that someone else has modified in his Emacs. */ 81 a file that someone else has modified in his Emacs. */
102
103#define CLASH_DETECTION 82#define CLASH_DETECTION
104 83
105/* The file containing the kernel's symbol table is called /vmunix. */ 84/* The file containing the kernel's symbol table is called /vmunix. */
106
107#define KERNEL_FILE "/vmunix" 85#define KERNEL_FILE "/vmunix"
108 86
109/* The symbol in the kernel where the load average is found 87/* The kernel symbol where the load average is found is named _avenrun. */
110 is named _avenrun. */
111
112#define LDAV_SYMBOL "_avenrun" 88#define LDAV_SYMBOL "_avenrun"
113 89
114/* Send signals to subprocesses by "typing" special chars at them. */ 90/* Send signals to subprocesses by "typing" special chars at them. */
115
116#define SIGNALS_VIA_CHARACTERS 91#define SIGNALS_VIA_CHARACTERS
117 92
118/* arch-tag: 0c367245-bde3-492e-9029-3ff6898beb95 93/* arch-tag: 0c367245-bde3-492e-9029-3ff6898beb95
diff --git a/src/s/cygwin.h b/src/s/cygwin.h
index 9ca5c67ce37..e2afb7ddc44 100644
--- a/src/s/cygwin.h
+++ b/src/s/cygwin.h
@@ -1,6 +1,7 @@
1/* System description header file for Cygwin. 1/* System description header file for Cygwin.
2 Copyright (C) 1985, 1986, 1992, 1999, 2002, 2003, 2004, 2005, 2006, 2
3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1985, 1986, 1992, 1999, 2002, 2003, 2004, 2005, 2006,
4 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -19,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20/* SYSTEM_TYPE should indicate the kind of system you are using. 21/* SYSTEM_TYPE should indicate the kind of system you are using.
21 It sets the Lisp variable system-type. */ 22 It sets the Lisp variable system-type. */
22
23#define SYSTEM_TYPE "cygwin" 23#define SYSTEM_TYPE "cygwin"
24 24
25/* Emacs can read input using SIGIO and buffering characters itself, 25/* Emacs can read input using SIGIO and buffering characters itself,
@@ -43,26 +43,19 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
43 It would have Emacs fork off a separate process 43 It would have Emacs fork off a separate process
44 to read the input and send it to the true Emacs process 44 to read the input and send it to the true Emacs process
45 through a pipe. */ 45 through a pipe. */
46
47#undef INTERRUPT_INPUT 46#undef INTERRUPT_INPUT
48 47
49/* 48/* Define HAVE_TERMIOS if the system provides POSIX-style
50 * Define HAVE_TERMIOS if the system provides POSIX-style 49 functions and macros for terminal control.
51 * functions and macros for terminal control.
52 *
53 * Define HAVE_TERMIO if the system provides sysV-style ioctls
54 * for terminal control.
55 *
56 * Do not define both. HAVE_TERMIOS is preferred, if it is
57 * supported on your system.
58 */
59 50
60#define HAVE_TERMIOS 51 Define HAVE_TERMIO if the system provides sysV-style ioctls
52 for terminal control.
61 53
62/* 54 Do not define both. HAVE_TERMIOS is preferred, if it is
63 * Define HAVE_PTYS if the system supports pty devices. 55 supported on your system. */
64 */ 56#define HAVE_TERMIOS
65 57
58/* Define HAVE_PTYS if the system supports pty devices. */
66#define HAVE_PTYS 59#define HAVE_PTYS
67#define PTY_ITERATION for (i = 0; i < 1; i++) /* ick */ 60#define PTY_ITERATION for (i = 0; i < 1; i++) /* ick */
68#define PTY_NAME_SPRINTF /* none */ 61#define PTY_NAME_SPRINTF /* none */
@@ -81,13 +74,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
81 while (0) 74 while (0)
82 75
83/* Define this symbol if your system has the functions bcopy, etc. */ 76/* Define this symbol if your system has the functions bcopy, etc. */
84
85#define BSTRING 77#define BSTRING
86 78
87/* Define CLASH_DETECTION if you want lock files to be written 79/* Define CLASH_DETECTION if you want lock files to be written
88 so that Emacs can tell instantly when you try to modify 80 so that Emacs can tell instantly when you try to modify
89 a file that someone else has modified in his Emacs. */ 81 a file that someone else has modified in his Emacs. */
90
91#define CLASH_DETECTION 82#define CLASH_DETECTION
92 83
93/* If the system's imake configuration file defines `NeedWidePrototypes' 84/* If the system's imake configuration file defines `NeedWidePrototypes'
@@ -95,22 +86,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
95 generated in the Makefile generated by `xmkmf'. If we don't 86 generated in the Makefile generated by `xmkmf'. If we don't
96 define NARROWPROTO, we will see the wrong function prototypes 87 define NARROWPROTO, we will see the wrong function prototypes
97 for X functions taking float or double parameters. */ 88 for X functions taking float or double parameters. */
98
99#define NARROWPROTO 1 89#define NARROWPROTO 1
100 90
101/* used in various places to enable cygwin-specific code changes */ 91/* Used in various places to enable cygwin-specific code changes. */
102#define CYGWIN 1 92#define CYGWIN 1
103 93
104#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) 94#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
105#define SYSV_SYSTEM_DIR 1 95#define SYSV_SYSTEM_DIR 1
106#define UNEXEC unexcw.o 96#define UNEXEC unexcw.o
107#define POSIX_SIGNALS 1
108#define LINKER $(CC) 97#define LINKER $(CC)
109 98
110/* Use terminfo instead of termcap. Fewer environment variables to
111 go wrong, more terminal types. */
112#define TERMINFO
113
114#define HAVE_SOCKETS 99#define HAVE_SOCKETS
115 100
116/* vfork() interacts badly with setsid(), causing ptys to fail to 101/* vfork() interacts badly with setsid(), causing ptys to fail to
@@ -132,7 +117,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
132 returns ENOSYS. A workaround is to set G_SLICE=always-malloc. */ 117 returns ENOSYS. A workaround is to set G_SLICE=always-malloc. */
133#define G_SLICE_ALWAYS_MALLOC 118#define G_SLICE_ALWAYS_MALLOC
134 119
135/* the end */
136
137/* arch-tag: 5ae7ba00-83b0-4ab3-806a-3e845779191b 120/* arch-tag: 5ae7ba00-83b0-4ab3-806a-3e845779191b
138 (do not change this comment) */ 121 (do not change this comment) */
diff --git a/src/s/darwin.h b/src/s/darwin.h
index e8081c6dd25..76c0054cd3f 100644
--- a/src/s/darwin.h
+++ b/src/s/darwin.h
@@ -1,6 +1,7 @@
1/* System description header file for Darwin (Mac OS X). 1/* System description header file for Darwin (Mac OS X).
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2
3 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
4 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -18,11 +19,8 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20 21
21/* 22/* Define symbols to identify the version of Unix this is.
22 * Define symbols to identify the version of Unix this is. 23 Define all the symbols that apply correctly. */
23 * Define all the symbols that apply correctly.
24 */
25
26#define BSD4_2 24#define BSD4_2
27/* BSD4_3 and BSD4_4 are already defined in sys/param.h */ 25/* BSD4_3 and BSD4_4 are already defined in sys/param.h */
28#define BSD_SYSTEM 26#define BSD_SYSTEM
@@ -30,14 +28,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30/* More specific than the above two. We cannot use __APPLE__ as this 28/* More specific than the above two. We cannot use __APPLE__ as this
31 may not be defined on non-OSX Darwin, and we cannot define DARWIN 29 may not be defined on non-OSX Darwin, and we cannot define DARWIN
32 here because Panther and lower CoreFoundation.h uses DARWIN to 30 here because Panther and lower CoreFoundation.h uses DARWIN to
33 distinguish OS X from pure Darwin. */ 31 distinguish OS X from pure Darwin. */
34
35#define DARWIN_OS 32#define DARWIN_OS
36 33
37 34
38/* SYSTEM_TYPE should indicate the kind of system you are using. 35/* SYSTEM_TYPE should indicate the kind of system you are using.
39 It sets the Lisp variable system-type. */ 36 It sets the Lisp variable system-type. */
40
41#define SYSTEM_TYPE "darwin" 37#define SYSTEM_TYPE "darwin"
42 38
43/* Emacs can read input using SIGIO and buffering characters itself, 39/* Emacs can read input using SIGIO and buffering characters itself,
@@ -61,58 +57,54 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
61 It would have Emacs fork off a separate process 57 It would have Emacs fork off a separate process
62 to read the input and send it to the true Emacs process 58 to read the input and send it to the true Emacs process
63 through a pipe. */ 59 through a pipe. */
64
65#define INTERRUPT_INPUT 60#define INTERRUPT_INPUT
66 61
67/* Letter to use in finding device name of first pty, 62/* Letter to use in finding device name of first pty,
68 if system supports pty's. 'a' means it is /dev/ptya0 */ 63 if system supports pty's. 'a' means it is /dev/ptya0 */
69
70#define FIRST_PTY_LETTER 'p' 64#define FIRST_PTY_LETTER 'p'
71 65
72/* 66/* Define HAVE_TERMIOS if the system provides POSIX-style
73 * Define HAVE_TERMIOS if the system provides POSIX-style 67 functions and macros for terminal control.
74 * functions and macros for terminal control.
75 *
76 * Define HAVE_TERMIO if the system provides sysV-style ioctls
77 * for terminal control.
78 *
79 * Do not define both. HAVE_TERMIOS is preferred, if it is
80 * supported on your system.
81 */
82 68
83#define HAVE_TERMIOS 69 Define HAVE_TERMIO if the system provides sysV-style ioctls
70 for terminal control.
84 71
72 Do not define both. HAVE_TERMIOS is preferred, if it is supported
73 on your system. */
74#define HAVE_TERMIOS
85#define NO_TERMIO 75#define NO_TERMIO
86 76
87/* 77/* Define HAVE_PTYS if the system supports pty devices.
88 * Define HAVE_PTYS if the system supports pty devices. 78 Note: PTYs are broken on darwin <6. Use at your own risk. */
89 * Note: PTYs are broken on darwin <6. Use at your own risk.
90 */
91
92#define HAVE_PTYS 79#define HAVE_PTYS
93 80/* Run only once. We need a `for'-loop because the code uses `continue'. */
94/** 81#define PTY_ITERATION for (i = 0; i < 1; i++)
95 * PTYs only work correctly on Darwin 7 or higher. So make the 82#define PTY_NAME_SPRINTF /* none */
96 * default for process-connection-type dependent on the kernel 83#define PTY_TTY_NAME_SPRINTF /* none */
97 * version. 84/* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8.
98 */ 85 But we don't have to block SIGCHLD because it is blocked in the
86 implementation of grantpt. */
87#define PTY_OPEN \
88 do \
89 { \
90 int slave; \
91 if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1) \
92 fd = -1; \
93 else \
94 emacs_close (slave); \
95 } \
96 while (0)
97
98/* PTYs only work correctly on Darwin 7 or higher. So make the default
99 for process-connection-type dependent on the kernel version. */
99#define MIN_PTY_KERNEL_VERSION '7' 100#define MIN_PTY_KERNEL_VERSION '7'
100 101
101/* Define this symbol if your system has the functions bcopy, etc. */ 102/* Define this symbol if your system has the functions bcopy, etc. */
102
103#define BSTRING 103#define BSTRING
104 104
105/* define MAIL_USE_FLOCK if the mailer uses flock
106 to interlock access to /usr/spool/mail/$USER.
107 The alternative is that a lock file named
108 /usr/spool/mail/$USER.lock. */
109
110#define MAIL_USE_FLOCK
111
112/* Define CLASH_DETECTION if you want lock files to be written 105/* Define CLASH_DETECTION if you want lock files to be written
113 so that Emacs can tell instantly when you try to modify 106 so that Emacs can tell instantly when you try to modify
114 a file that someone else has modified in his Emacs. */ 107 a file that someone else has modified in his Emacs. */
115
116#define CLASH_DETECTION 108#define CLASH_DETECTION
117 109
118/* Avoid the use of the name init_process (process.c) because it is 110/* Avoid the use of the name init_process (process.c) because it is
@@ -122,74 +114,42 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
122/* Used in dispnew.c. Copied from freebsd.h. */ 114/* Used in dispnew.c. Copied from freebsd.h. */
123#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) 115#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
124 116
125/* System uses OXTABS instead of the expected TAB3. (Copied from 117/* System uses OXTABS instead of the expected TAB3. (Copied from bsd386.h.) */
126 bsd386.h.) */
127#define TAB3 OXTABS 118#define TAB3 OXTABS
128 119
129/* Darwin ld insists on the use of malloc routines in the System 120/* Darwin ld insists on the use of malloc routines in the System framework. */
130 framework. */
131#define SYSTEM_MALLOC 121#define SYSTEM_MALLOC
132 122
133/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ 123/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */
134#define HAVE_SOCKETS 124#define HAVE_SOCKETS
135 125
136/* Definitions for how to dump. Copied from nextstep.h. */ 126/* Definitions for how to dump. Copied from nextstep.h. */
137
138#define UNEXEC unexmacosx.o 127#define UNEXEC unexmacosx.o
139 128
140#define START_FILES pre-crt0.o
141
142/* start_of_text isn't actually used, so make it compile without error. */ 129/* start_of_text isn't actually used, so make it compile without error. */
143#define TEXT_START (0) 130#define TEXT_START (0)
144 131
145/* Definitions for how to compile & link. */ 132/* Definitions for how to compile & link. */
146
147#ifdef HAVE_NS 133#ifdef HAVE_NS
148#define LIBS_NSGUI -framework AppKit
149#define SYSTEM_PURESIZE_EXTRA 200000 134#define SYSTEM_PURESIZE_EXTRA 200000
150#define HEADERPAD_EXTRA 6C8 135#endif
151#else /* !HAVE_NS */
152#define LIBS_NSGUI
153#define HEADERPAD_EXTRA 690
154#endif /* !HAVE_NS */
155 136
156/* On Darwin, res_init appears not to be useful: see bug#562 and 137/* On Darwin, res_init appears not to be useful: see bug#562 and
157 http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01467.html */ 138 http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01467.html */
158
159#undef HAVE_RES_INIT 139#undef HAVE_RES_INIT
160#undef HAVE_LIBRESOLV 140#undef HAVE_LIBRESOLV
161 141
162/* The -headerpad option tells ld (see man page) to leave room at the
163 end of the header for adding load commands. Needed for dumping.
164 0x690 is the total size of 30 segment load commands (at 56
165 each); under Cocoa 31 commands are required. */
166#define LD_SWITCH_SYSTEM_TEMACS -prebind LIBS_NSGUI -Xlinker -headerpad -Xlinker HEADERPAD_EXTRA
167
168#ifdef emacs 142#ifdef emacs
169#define malloc unexec_malloc 143#define malloc unexec_malloc
170#define realloc unexec_realloc 144#define realloc unexec_realloc
171#define free unexec_free 145#define free unexec_free
172/* Don't use posix_memalign because it is not compatible with 146/* Don't use posix_memalign because it is not compatible with unexmacosx.c. */
173 unexmacosx.c. */
174#undef HAVE_POSIX_MEMALIGN 147#undef HAVE_POSIX_MEMALIGN
175#endif 148#endif
176 149
177/* The ncurses library has been moved out of the System framework in
178 Mac OS X 10.2. So if ./configure detects it, set the command-line
179 option to use it. */
180#ifdef HAVE_LIBNCURSES
181#define LIBS_TERMCAP -lncurses
182/* This prevents crashes when running Emacs in Terminal.app under
183 10.2. */
184#define TERMINFO
185#endif
186
187/* Link this program just by running cc. */ 150/* Link this program just by running cc. */
188#define ORDINARY_LINK 151#define ORDINARY_LINK
189 152
190/* Adding -lm confuses the dynamic linker, so omit it. */
191#define LIB_MATH
192
193/* Define the following so emacs symbols will not conflict with those 153/* Define the following so emacs symbols will not conflict with those
194 in the System framework. Otherwise -prebind will not work. */ 154 in the System framework. Otherwise -prebind will not work. */
195 155
@@ -211,12 +171,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
211 ioctl TIOCSCTTY. */ 171 ioctl TIOCSCTTY. */
212#define DONT_REOPEN_PTY 172#define DONT_REOPEN_PTY
213 173
214/* This makes create_process in process.c save and restore signal 174/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */
215 handlers correctly. Suggested by Nozomu Ando.*/
216#define POSIX_SIGNALS
217
218/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the
219 stack. */
220#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS 175#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
221 176
222/* arch-tag: 481d443d-4f89-43ea-b5fb-49706d95fa41 177/* arch-tag: 481d443d-4f89-43ea-b5fb-49706d95fa41
diff --git a/src/s/freebsd.h b/src/s/freebsd.h
index a84627d3268..2b53ec0413f 100644
--- a/src/s/freebsd.h
+++ b/src/s/freebsd.h
@@ -1,9 +1,8 @@
1/* System description header for FreeBSD systems. 1/* System description header for FreeBSD systems.
2 This file describes the parameters that system description files 2
3 should define or not. 3Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 4 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 5 Free Software Foundation, Inc.
6 Free Software Foundation, Inc.
7 6
8Author: Shawn M. Carey 7Author: Shawn M. Carey
9(according to authors.el) 8(according to authors.el)
@@ -31,28 +30,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31 30
32#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) 31#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
33 32
34#define LIBS_SYSTEM -lutil
35#if __FreeBSD_version < 400000
36#define LIBS_TERMCAP -ltermcap
37#else
38#define TERMINFO
39#define LIBS_TERMCAP -lncurses
40#endif
41
42/* Let `ld' find image libs and similar things in /usr/local/lib. The
43 system compiler, GCC, has apparently been modified to not look
44 there, contrary to what a stock GCC would do. */
45
46#define LD_SWITCH_SYSTEM -L/usr/local/lib
47#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o
48#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o
49#undef LIB_GCC
50#define LIB_GCC
51
52#define HAVE_GETLOADAVG 1 33#define HAVE_GETLOADAVG 1
53#define DECLARE_GETPWUID_WITH_UID_T 34#define DECLARE_GETPWUID_WITH_UID_T
54 35
55/* this silences a few compilation warnings */ 36/* This silences a few compilation warnings. */
56#undef BSD_SYSTEM 37#undef BSD_SYSTEM
57#if __FreeBSD__ == 1 38#if __FreeBSD__ == 1
58#define BSD_SYSTEM 199103 39#define BSD_SYSTEM 199103
@@ -67,13 +48,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
67 ioctl TIOCSCTTY. */ 48 ioctl TIOCSCTTY. */
68#define DONT_REOPEN_PTY 49#define DONT_REOPEN_PTY
69 50
70/* The following is needed to make `configure' find Xpm, Xaw3d and
71 image include and library files if using /usr/bin/gcc. That
72 compiler seems to be modified to not find headers in
73 /usr/local/include or libs in /usr/local/lib by default. */
74
75#define C_SWITCH_SYSTEM -I/usr/X11R6/include -I/usr/local/include -L/usr/local/lib
76
77/* Circumvent a bug in FreeBSD. In the following sequence of 51/* Circumvent a bug in FreeBSD. In the following sequence of
78 writes/reads on a PTY, read(2) returns bogus data: 52 writes/reads on a PTY, read(2) returns bogus data:
79 53
@@ -87,37 +61,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
87 successfully after processing (for example with CRs added if the 61 successfully after processing (for example with CRs added if the
88 terminal is set up that way which it is here). The same bytes will 62 terminal is set up that way which it is here). The same bytes will
89 be seen again in a later read(2), without the CRs. */ 63 be seen again in a later read(2), without the CRs. */
90
91#define BROKEN_PTY_READ_AFTER_EAGAIN 1 64#define BROKEN_PTY_READ_AFTER_EAGAIN 1
92 65
93/* Tell that garbage collector that setjmp is known to save all 66/* Tell that garbage collector that setjmp is known to save all
94 registers relevant for conservative garbage collection in the 67 registers relevant for conservative garbage collection in the jmp_buf. */
95 jmp_buf. */
96
97#define GC_SETJMP_WORKS 1 68#define GC_SETJMP_WORKS 1
98 69
99/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the 70/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */
100 stack. */
101
102#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS 71#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
103 72
104/* Define USE_MMAP_FOR_BUFFERS to let Emacs use mmap(2) to allocate 73/* Define USE_MMAP_FOR_BUFFERS to let Emacs use mmap(2) to allocate
105 buffer text. This overrides REL_ALLOC. */ 74 buffer text. This overrides REL_ALLOC. */
106
107#define USE_MMAP_FOR_BUFFERS 1 75#define USE_MMAP_FOR_BUFFERS 1
108 76
109/* Use sigprocmask(2) and friends instead of sigblock(2); the man page
110 of sigblock says it is obsolete. */
111
112#define POSIX_SIGNALS 1
113
114/* The `combreloc' setting became the default, and it seems to be
115 incompatible with unexec. Symptom is an immediate SEGV in
116 XtInitializeWidget when starting Emacs under X11. */
117
118#if defined __FreeBSD_version && __FreeBSD_version >= 500042
119#define LD_SWITCH_SYSTEM_TEMACS -znocombreloc
120#endif
121
122/* arch-tag: 426529ca-b7c4-448f-b10a-d4dcdc9c78eb 77/* arch-tag: 426529ca-b7c4-448f-b10a-d4dcdc9c78eb
123 (do not change this comment) */ 78 (do not change this comment) */
diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h
index b9139435f61..3aa2dc16f42 100644
--- a/src/s/gnu-linux.h
+++ b/src/s/gnu-linux.h
@@ -1,6 +1,9 @@
1/* This file is the configuration file for Linux-based GNU systems 1/* This file is the configuration file for Linux-based GNU systems
2 Copyright (C) 1985, 1986, 1992, 1994, 1996, 1999, 2001, 2002, 2003, 2004, 2
3 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1985, 1986, 1992, 1994, 1996, 1999, 2001, 2002, 2003, 2004,
4 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5
6This file was put together by Michael K. Johnson and Rik Faith.
4 7
5This file is part of GNU Emacs. 8This file is part of GNU Emacs.
6 9
@@ -17,20 +20,13 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 20You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 21along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 22
20/* This file was put together by Michael K. Johnson and Rik Faith. */ 23/* Define symbols to identify the version of Unix this is.
21 24 Define all the symbols that apply correctly. */
22
23/*
24 * Define symbols to identify the version of Unix this is.
25 * Define all the symbols that apply correctly.
26 */
27
28#define USG 25#define USG
29#define GNU_LINUX 26#define GNU_LINUX
30 27
31/* SYSTEM_TYPE should indicate the kind of system you are using. 28/* SYSTEM_TYPE should indicate the kind of system you are using.
32 It sets the Lisp variable system-type. */ 29 It sets the Lisp variable system-type. */
33
34#define SYSTEM_TYPE "gnu/linux" /* All the best software is free. */ 30#define SYSTEM_TYPE "gnu/linux" /* All the best software is free. */
35 31
36#ifndef NOT_C_CODE 32#ifndef NOT_C_CODE
@@ -49,9 +45,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
49#if defined HAVE_GRANTPT 45#if defined HAVE_GRANTPT
50#define UNIX98_PTYS 46#define UNIX98_PTYS
51 47
52/* Run only once. We need a `for'-loop because the code uses 48/* Run only once. We need a `for'-loop because the code uses `continue'. */
53 `continue'. */
54
55#define PTY_ITERATION for (i = 0; i < 1; i++) 49#define PTY_ITERATION for (i = 0; i < 1; i++)
56 50
57#ifdef HAVE_GETPT 51#ifdef HAVE_GETPT
@@ -63,7 +57,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
63 57
64/* Note that grantpt and unlockpt may fork. We must block SIGCHLD to 58/* Note that grantpt and unlockpt may fork. We must block SIGCHLD to
65 prevent sigchld_handler from intercepting the child's death. */ 59 prevent sigchld_handler from intercepting the child's death. */
66
67#define PTY_TTY_NAME_SPRINTF \ 60#define PTY_TTY_NAME_SPRINTF \
68 { \ 61 { \
69 char *ptyname; \ 62 char *ptyname; \
@@ -85,58 +78,29 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
85 78
86/* Letter to use in finding device name of first pty, 79/* Letter to use in finding device name of first pty,
87 if system supports pty's. 'p' means it is /dev/ptyp0 */ 80 if system supports pty's. 'p' means it is /dev/ptyp0 */
88
89#define FIRST_PTY_LETTER 'p' 81#define FIRST_PTY_LETTER 'p'
90 82
91#endif /* not HAVE_GRANTPT */ 83#endif /* not HAVE_GRANTPT */
92 84
93/* Define HAVE_TERMIOS if the system provides POSIX-style 85/* Define HAVE_TERMIOS if the system provides POSIX-style
94 functions and macros for terminal control. */ 86 functions and macros for terminal control. */
95
96#define HAVE_TERMIOS 87#define HAVE_TERMIOS
97 88
98/* Define HAVE_PTYS if the system supports pty devices. */ 89/* Define HAVE_PTYS if the system supports pty devices. */
99
100#define HAVE_PTYS 90#define HAVE_PTYS
101 91
102#define HAVE_SOCKETS 92#define HAVE_SOCKETS
103 93
104/* Define this symbol if your system has the functions bcopy, etc. */ 94/* Define this symbol if your system has the functions bcopy, etc. */
105
106#define BSTRING 95#define BSTRING
107 96
108/* This is used in list_system_processes. */ 97/* This is used in list_system_processes. */
109#define HAVE_PROCFS 1 98#define HAVE_PROCFS 1
110 99
111/* define MAIL_USE_FLOCK if the mailer uses flock
112 to interlock access to /usr/spool/mail/$USER.
113 The alternative is that a lock file named
114 /usr/spool/mail/$USER.lock. */
115
116/* On GNU/Linux systems, both methods are used by various mail
117 programs. I assume that most people are using newer mailers that
118 have heard of flock. Change this if you need to. */
119/* Debian contains a patch which says: ``On Debian/GNU/Linux systems,
120 configure gets the right answers, and that means *NOT* using flock.
121 Using flock is guaranteed to be the wrong thing. See Debian Policy
122 for details.'' and then uses `#ifdef DEBIAN'. Unfortunately the
123 Debian maintainer hasn't provided a clean fix for Emacs.
124 movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and
125 HAVE_MAILLOCK_H are defined, so the following appears to be the
126 correct logic. -- fx */
127/* We must check for HAVE_LIBLOCKFILE too, as movemail does.
128 liblockfile is a Free Software replacement for libmail, used on
129 Debian systems and elsewhere. -rfr */
130
131#if !((defined (HAVE_LIBMAIL) || defined (HAVE_LIBLOCKFILE)) && \
132 defined (HAVE_MAILLOCK_H))
133#define MAIL_USE_FLOCK
134#endif
135 100
136/* Define CLASH_DETECTION if you want lock files to be written 101/* Define CLASH_DETECTION if you want lock files to be written
137 so that Emacs can tell instantly when you try to modify 102 so that Emacs can tell instantly when you try to modify
138 a file that someone else has modified in his Emacs. */ 103 a file that someone else has modified in his Emacs. */
139
140#define CLASH_DETECTION 104#define CLASH_DETECTION
141 105
142/* Here, on a separate page, add any special hacks needed 106/* Here, on a separate page, add any special hacks needed
@@ -146,45 +110,24 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
146 your system and must be used only through an encapsulation 110 your system and must be used only through an encapsulation
147 (Which you should place, by convention, in sysdep.c). */ 111 (Which you should place, by convention, in sysdep.c). */
148 112
149/* This is needed for dispnew.c:update_frame */ 113/* This is needed for dispnew.c:update_frame. */
150
151#ifdef emacs 114#ifdef emacs
152#include <stdio.h> /* Get the definition of _IO_STDIO_H. */ 115#include <stdio.h> /* Get the definition of _IO_STDIO_H. */
153#if defined(_IO_STDIO_H) || defined(_STDIO_USES_IOSTREAM) 116#if defined(_IO_STDIO_H) || defined(_STDIO_USES_IOSTREAM)
154/* new C libio names */ 117/* New C libio names. */
155#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \ 118#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
156 ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base) 119 ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)
157#elif defined (__UCLIBC__) 120#elif defined (__UCLIBC__)
158/* using the uClibc library */ 121/* Using the uClibc library. */
159#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \ 122#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
160 ((FILE)->__bufpos - (FILE)->__bufstart) 123 ((FILE)->__bufpos - (FILE)->__bufstart)
161#else /* !_IO_STDIO_H && ! __UCLIBC__ */ 124#else /* !_IO_STDIO_H && ! __UCLIBC__ */
162/* old C++ iostream names */ 125/* Old C++ iostream names. */
163#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \ 126#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
164 ((FILE)->_pptr - (FILE)->_pbase) 127 ((FILE)->_pptr - (FILE)->_pbase)
165#endif /* !_IO_STDIO_H && ! __UCLIBC__ */ 128#endif /* !_IO_STDIO_H && ! __UCLIBC__ */
166#endif /* emacs */ 129#endif /* emacs */
167 130
168/* Ask GCC where to find libgcc.a. */
169#define LIB_GCC `$(CC) $(C_SWITCH_X_SITE) -print-libgcc-file-name`
170
171#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
172
173/* Here is how to find X Windows. LD_SWITCH_X_SITE_AUX gives an -R option
174 says where to find X windows at run time. */
175
176#ifdef __mips__
177#define LD_SWITCH_SYSTEM -G 0 LD_SWITCH_X_SITE_AUX
178#else
179#define LD_SWITCH_SYSTEM LD_SWITCH_X_SITE_AUX
180#endif /* __mips__ */
181
182/* Link temacs with -z nocombreloc so that unexec works right, whether or
183 not -z combreloc is the default. GNU ld ignores unknown -z KEYWORD
184 switches, so this also works with older versions that don't implement
185 -z combreloc. */
186#define LD_SWITCH_SYSTEM_TEMACS -z nocombreloc
187
188#ifdef emacs 131#ifdef emacs
189#define INTERRUPT_INPUT 132#define INTERRUPT_INPUT
190#endif 133#endif
@@ -192,24 +135,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
192#define SYSV_SYSTEM_DIR /* use dirent.h */ 135#define SYSV_SYSTEM_DIR /* use dirent.h */
193 136
194#define POSIX /* affects getpagesize.h and systty.h */ 137#define POSIX /* affects getpagesize.h and systty.h */
195#define POSIX_SIGNALS
196
197#undef LIB_GCC
198#define LIB_GCC
199#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
200
201/* _BSD_SOURCE is redundant, at least in glibc2, since we define
202 _GNU_SOURCE. Left in in case it's relevant to libc5 systems and
203 anyone's still using Emacs on those. --fx 2002-12-14 */
204#define C_SWITCH_SYSTEM -D_BSD_SOURCE
205
206/* Paul Abrahams <abrahams@equinox.shaysnet.com> says this is needed. */
207#define LIB_MOTIF -lXm -lXpm
208
209#ifdef HAVE_LIBNCURSES
210#define TERMINFO
211#define LIBS_TERMCAP -lncurses
212#endif
213 138
214#define UNEXEC unexelf.o 139#define UNEXEC unexelf.o
215 140
@@ -220,11 +145,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
220#define HAVE_XRMSETDATABASE 145#define HAVE_XRMSETDATABASE
221#endif 146#endif
222 147
223/* Use BSD process groups, but use setpgid() instead of setpgrp() to
224 actually set a process group. */
225/* Interesting: only GNU/Linux defines this, but the BSDs do not... */
226#define BSD_PGRPS
227
228#define NARROWPROTO 1 148#define NARROWPROTO 1
229 149
230/* Use mmap directly for allocating larger buffers. */ 150/* Use mmap directly for allocating larger buffers. */
@@ -233,8 +153,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
233#endif 153#endif
234 154
235/* Tell that garbage collector that setjmp is known to save all 155/* Tell that garbage collector that setjmp is known to save all
236 registers relevant for conservative garbage collection in the 156 registers relevant for conservative garbage collection in the jmp_buf. */
237 jmp_buf. */
238/* Not all the architectures are tested, but there are Debian packages 157/* Not all the architectures are tested, but there are Debian packages
239 for SCM and/or Guile on them, so the technique must work. See also 158 for SCM and/or Guile on them, so the technique must work. See also
240 comments in alloc.c concerning setjmp and gcc. Fixme: it's 159 comments in alloc.c concerning setjmp and gcc. Fixme: it's
@@ -242,7 +161,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
242 register window-flushing. */ 161 register window-flushing. */
243/* Don't use #cpu here since in newest development versions of GCC, 162/* Don't use #cpu here since in newest development versions of GCC,
244 we must call cpp with -traditional, and that disables #cpu. */ 163 we must call cpp with -traditional, and that disables #cpu. */
245
246#if defined __i386__ || defined __sparc__ || defined __mc68000__ \ 164#if defined __i386__ || defined __sparc__ || defined __mc68000__ \
247 || defined __alpha__ || defined __mips__ || defined __s390__ \ 165 || defined __alpha__ || defined __mips__ || defined __s390__ \
248 || defined __arm__ || defined __powerpc__ || defined __amd64__ \ 166 || defined __arm__ || defined __powerpc__ || defined __amd64__ \
diff --git a/src/s/gnu.h b/src/s/gnu.h
index bf68cabe051..9f6fe52a5de 100644
--- a/src/s/gnu.h
+++ b/src/s/gnu.h
@@ -28,13 +28,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28 28
29#define SIGNALS_VIA_CHARACTERS 29#define SIGNALS_VIA_CHARACTERS
30 30
31/* Tell Emacs that we are a terminfo based system; disable the use
32 of local termcap. (GNU uses ncurses.) */
33#ifdef HAVE_LIBNCURSES
34#define TERMINFO
35#define LIBS_TERMCAP -lncurses
36#endif
37
38/* Use mmap directly for allocating larger buffers. */ 31/* Use mmap directly for allocating larger buffers. */
39#ifdef DOUG_LEA_MALLOC 32#ifdef DOUG_LEA_MALLOC
40#undef REL_ALLOC 33#undef REL_ALLOC
diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h
index e56b25ecaee..91988ef6727 100644
--- a/src/s/hpux10-20.h
+++ b/src/s/hpux10-20.h
@@ -1,6 +1,7 @@
1/* System description file for hpux version 10.20. 1/* System description file for hpux version 10.20.
2 Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2
3 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -20,56 +21,39 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 21
21#define RUN_TIME_REMAP 22#define RUN_TIME_REMAP
22 23
23/* 24/* Define symbols to identify the version of Unix this is.
24 * Define symbols to identify the version of Unix this is. 25 Define all the symbols that apply correctly. */
25 * Define all the symbols that apply correctly.
26 */
27
28#define USG /* System III, System V, etc */ 26#define USG /* System III, System V, etc */
29
30#define USG5 27#define USG5
31
32#define HPUX 28#define HPUX
33 29
34/* SYSTEM_TYPE should indicate the kind of system you are using. 30/* SYSTEM_TYPE should indicate the kind of system you are using.
35 It sets the Lisp variable system-type. */ 31 It sets the Lisp variable system-type. */
36
37#define SYSTEM_TYPE "hpux" 32#define SYSTEM_TYPE "hpux"
38 33
39/* Letter to use in finding device name of first pty, 34/* Letter to use in finding device name of first pty,
40 if system supports pty's. 'p' means it is /dev/ptym/ptyp0 */ 35 if system supports pty's. 'p' means it is /dev/ptym/ptyp0 */
41
42#define FIRST_PTY_LETTER 'p' 36#define FIRST_PTY_LETTER 'p'
43 37
44/* 38/* Define HAVE_TERMIO if the system provides sysV-style ioctls
45 * Define HAVE_TERMIO if the system provides sysV-style ioctls 39 for terminal control. */
46 * for terminal control.
47 */
48
49#define HAVE_TERMIO 40#define HAVE_TERMIO
50 41
51/* 42/* Define HAVE_PTYS if the system supports pty devices. */
52 * Define HAVE_PTYS if the system supports pty devices.
53 */
54
55#define HAVE_PTYS 43#define HAVE_PTYS
56 44
57/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ 45/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */
58
59#define HAVE_SOCKETS 46#define HAVE_SOCKETS
60 47
61/* Define this symbol if your system has the functions bcopy, etc. 48/* Define this symbol if your system has the functions bcopy, etc.
62 * s800 and later versions of s300 (s200) kernels have equivalents 49 s800 and later versions of s300 (s200) kernels have equivalents
63 * of the BSTRING functions of BSD. If your s200 kernel doesn't have 50 of the BSTRING functions of BSD. If your s200 kernel doesn't have
64 * em comment out this section. 51 em comment out this section. */
65 */
66
67#define BSTRING 52#define BSTRING
68 53
69/* Define CLASH_DETECTION if you want lock files to be written 54/* Define CLASH_DETECTION if you want lock files to be written
70 so that Emacs can tell instantly when you try to modify 55 so that Emacs can tell instantly when you try to modify
71 a file that someone else has modified in his Emacs. */ 56 a file that someone else has modified in his Emacs. */
72
73#define CLASH_DETECTION 57#define CLASH_DETECTION
74 58
75/* The symbol in the kernel where the load average is found 59/* The symbol in the kernel where the load average is found
@@ -77,23 +61,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
77 61
78/* Special hacks needed to make Emacs run on this system. */ 62/* Special hacks needed to make Emacs run on this system. */
79 63
80/* Use the system provided termcap(3) library */
81#define TERMINFO
82
83/* In hpux, the symbol SIGIO is defined, but the feature 64/* In hpux, the symbol SIGIO is defined, but the feature
84 doesn't work in the way Emacs needs it to. */ 65 doesn't work in the way Emacs needs it to. */
85
86#define BROKEN_SIGIO 66#define BROKEN_SIGIO
87 67
88/* Some additional system facilities exist. */ 68/* Some additional system facilities exist. */
89
90#define HAVE_PERROR /* Delete this line for version 6. */ 69#define HAVE_PERROR /* Delete this line for version 6. */
91 70
92#define UNEXEC unexhp9k800.o 71#define UNEXEC unexhp9k800.o
93 72
94/* Include the file bsdtty.h, since this machine has job control. */
95#define NEED_BSDTTY
96
97/* This is how to get the device name of the tty end of a pty. */ 73/* This is how to get the device name of the tty end of a pty. */
98#define PTY_TTY_NAME_SPRINTF \ 74#define PTY_TTY_NAME_SPRINTF \
99 sprintf (pty_name, "/dev/pty/tty%c%x", c, i); 75 sprintf (pty_name, "/dev/pty/tty%c%x", c, i);
@@ -105,17 +81,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
105/* This triggers a conditional in xfaces.c. */ 81/* This triggers a conditional in xfaces.c. */
106#define XOS_NEEDS_TIME_H 82#define XOS_NEEDS_TIME_H
107 83
108/* Don't use shared libraries. unexec doesn't handle them.
109 Note GCC automatically passes -a archive to ld, and it has its own
110 conflicting -a. */
111#define LD_SWITCH_SYSTEM_TEMACS
112
113#ifndef HAVE_LIBXMU
114/* HP-UX doesn't supply Xmu. */
115#define LIBXMU
116
117#endif
118
119/* Assar Westerlund <assar@sics.se> says this is necessary for 84/* Assar Westerlund <assar@sics.se> says this is necessary for
120 HP-UX 10.20, and that it works for HP-UX 0 as well. */ 85 HP-UX 10.20, and that it works for HP-UX 0 as well. */
121#define NO_EDITRES 86#define NO_EDITRES
@@ -128,7 +93,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
128 version number A.09.05. 93 version number A.09.05.
129 94
130 You can fix the math library by installing patch number PHSS_4630. 95 You can fix the math library by installing patch number PHSS_4630.
131 But we can fix it more reliably for Emacs like this. */ 96 But we can fix it more reliably for Emacs like this. */
132#undef HAVE_RINT 97#undef HAVE_RINT
133 98
134/* We have to go this route, rather than hpux9's approach of renaming the 99/* We have to go this route, rather than hpux9's approach of renaming the
@@ -143,35 +108,56 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
143/* AlainF 20-Jul-1996 says this is right. */ 108/* AlainF 20-Jul-1996 says this is right. */
144#define KERNEL_FILE "/stand/vmunix" 109#define KERNEL_FILE "/stand/vmunix"
145 110
146#define LIBS_SYSTEM -l:libdld.sl
147 111
148/* Rainer Malzbender <rainer@displaytech.com> says definining 112/* Rainer Malzbender <rainer@displaytech.com> says definining
149 HAVE_XRMSETDATABASE allows Emacs to compile on HP-UX 10.20 113 HAVE_XRMSETDATABASE allows Emacs to compile on HP-UX 10.20 using GCC. */
150 using GCC. */
151
152#ifndef HAVE_XRMSETDATABASE 114#ifndef HAVE_XRMSETDATABASE
153#define HAVE_XRMSETDATABASE 115#define HAVE_XRMSETDATABASE
154#endif 116#endif
155 117
156/* Make sure we get select from libc rather than from libcurses
157 because libcurses on HPUX 10.10 has a broken version of select.
158 We used to use -lc -lcurses, but this may be cleaner. */
159#define LIBS_TERMCAP -ltermcap
160
161/* However, HPUX 10 puts Xaw and Xmu in a strange place
162 (if you install them at all). So search that place. */
163#define C_SWITCH_X_SYSTEM -I/usr/include/X11R6 -I/usr/include/X11R5 -I/usr/include/Motif1.2 -I/usr/contrib/X11R6/include -I/usr/contrib/X11R5/include
164#define LD_SWITCH_X_DEFAULT -L/usr/lib/X11R6 -L/usr/lib/X11R5 -L/usr/lib/Motif1.2 -L/usr/contrib/X11R5/lib
165
166/* 2000-11-21: Temporarily disable Unix 98 large file support found by 118/* 2000-11-21: Temporarily disable Unix 98 large file support found by
167 configure. It fails on HPUX 11, at least, because it enables 119 configure. It fails on HPUX 11, at least, because it enables
168 header sections which lose when `static' is defined away, as it is 120 header sections which lose when `static' is defined away, as it is
169 on HP-UX. (You get duplicate symbol errors on linking). */ 121 on HP-UX. (You get duplicate symbol errors on linking). */
170
171#undef _FILE_OFFSET_BITS 122#undef _FILE_OFFSET_BITS
172 123
173/* otherwise sigunblock wont be defined */ 124/* Define NO_REMAP if memory segmentation makes it not work well
174#define POSIX_SIGNALS 125 to change the boundary between the text section and data section
126 when Emacs is dumped. If you define this, the preloaded Lisp
127 code will not be sharable; but that's better than failing completely. */
128#define NO_REMAP
129
130/* Define VIRT_ADDR_VARIES if the virtual addresses of
131 pure and impure space as loaded can vary, and even their
132 relative order cannot be relied on.
133
134 Otherwise Emacs assumes that text space precedes data space,
135 numerically. */
136#define VIRT_ADDR_VARIES
137
138/* The data segment on this machine always starts at address 0x40000000. */
139#define DATA_SEG_BITS 0x40000000
140
141#define DATA_START 0x40000000
142#define TEXT_START 0x00000000
143
144/* Data type of load average, as read out of kmem. */
145#define LOAD_AVE_TYPE double
146
147/* Convert that into an integer that is 100 for a load average of 1.0 */
148#define LOAD_AVE_CVT(x) ((int) (x * 100.0))
149
150/* The kernel symbol where the load average is found is named _avenrun.
151 At this time there are two major flavors of hp-ux (there is the s800
152 and s300 (s200) flavors). The differences are thusly moved to the
153 corresponding machine description file. */
154
155/* No underscore please. */
156#define LDAV_SYMBOL "avenrun"
157
158/* On USG systems these have different names. */
159#define index strchr
160#define rindex strrchr
175 161
176/* arch-tag: 8d8dcbf1-ca9b-48a1-94be-b750de18a5c6 162/* arch-tag: 8d8dcbf1-ca9b-48a1-94be-b750de18a5c6
177 (do not change this comment) */ 163 (do not change this comment) */
diff --git a/src/s/hpux11.h b/src/s/hpux11.h
index 3382395a90f..48f60841047 100644
--- a/src/s/hpux11.h
+++ b/src/s/hpux11.h
@@ -1,10 +1,5 @@
1#include "hpux10-20.h" 1#include "hpux10-20.h"
2 2
3#ifdef POSIX_SIGNALS
4#undef POSIX_SIGNALS
5#endif
6#define POSIX_SIGNALS 1
7
8/* SA_RESTART resets the timeout of `select', so don't use it. */ 3/* SA_RESTART resets the timeout of `select', so don't use it. */
9#define BROKEN_SA_RESTART 4#define BROKEN_SA_RESTART
10 5
diff --git a/src/s/irix6-5.h b/src/s/irix6-5.h
index 0a0b0d4af26..e9e14f0cf35 100644
--- a/src/s/irix6-5.h
+++ b/src/s/irix6-5.h
@@ -27,10 +27,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27 27
28#define SETPGRP_RELEASES_CTTY 28#define SETPGRP_RELEASES_CTTY
29 29
30#ifdef LIB_STANDARD
31#undef LIB_STANDARD
32#endif
33
34#ifdef SYSTEM_TYPE 30#ifdef SYSTEM_TYPE
35#undef SYSTEM_TYPE 31#undef SYSTEM_TYPE
36#endif 32#endif
@@ -44,6 +40,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
44/* Make process_send_signal work by "typing" a signal character on the pty. */ 40/* Make process_send_signal work by "typing" a signal character on the pty. */
45#define SIGNALS_VIA_CHARACTERS 41#define SIGNALS_VIA_CHARACTERS
46 42
43/* Letter to use in finding device name of first pty,
44 if system supports pty's. 'a' means it is /dev/ptya0 */
45#undef FIRST_PTY_LETTER
46#define FIRST_PTY_LETTER 'q'
47
47/* No need to use sprintf to get the tty name--we get that from _getpty. */ 48/* No need to use sprintf to get the tty name--we get that from _getpty. */
48#define PTY_TTY_NAME_SPRINTF 49#define PTY_TTY_NAME_SPRINTF
49/* No need to get the pty name at all. */ 50/* No need to get the pty name at all. */
@@ -84,21 +85,10 @@ char *_getpty();
84 85
85#define UNEXEC unexelf.o 86#define UNEXEC unexelf.o
86 87
87/* define MAIL_USE_FLOCK if the mailer uses flock
88 to interlock access to /usr/spool/mail/$USER.
89 The alternative is that a lock file named
90 /usr/spool/mail/$USER.lock. */
91
92#define MAIL_USE_FLOCK
93
94#define NARROWPROTO 1 88#define NARROWPROTO 1
95 89
96#define USE_MMAP_FOR_BUFFERS 1 90#define USE_MMAP_FOR_BUFFERS 1
97 91
98/* arch-tag: ad0660e0-acf8-46ae-b866-4f3df5b1101b
99 (do not change this comment) */
100
101
102#if _MIPS_SZLONG == 64 /* -mabi=64 (gcc) or -64 (MIPSpro) */ 92#if _MIPS_SZLONG == 64 /* -mabi=64 (gcc) or -64 (MIPSpro) */
103#define _LP64 /* lisp.h takes care of the rest */ 93#define _LP64 /* lisp.h takes care of the rest */
104#endif /* _MIPS_SZLONG */ 94#endif /* _MIPS_SZLONG */
@@ -111,5 +101,8 @@ char *_getpty();
111#define GC_SETJMP_WORKS 1 101#define GC_SETJMP_WORKS 1
112#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS 102#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
113 103
104/* arch-tag: ad0660e0-acf8-46ae-b866-4f3df5b1101b
105 (do not change this comment) */
106
114/* arch-tag: d7ad9ec2-54ad-4b2f-adf2-0070c5c63e83 107/* arch-tag: d7ad9ec2-54ad-4b2f-adf2-0070c5c63e83
115 (do not change this comment) */ 108 (do not change this comment) */
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 3e5c65eaab5..2d6cc2f4bd5 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -1,6 +1,7 @@
1/* System description file for Windows NT. 1/* System description file for Windows NT.
2 Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2
3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006,
4 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -17,10 +18,8 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 18You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 20
20/* 21/* Define symbols to identify the version of Unix this is.
21 * Define symbols to identify the version of Unix this is. 22 Define all the symbols that apply correctly. */
22 * Define all the symbols that apply correctly.
23 */
24 23
25#ifndef WINDOWSNT 24#ifndef WINDOWSNT
26#define WINDOWSNT 25#define WINDOWSNT
@@ -30,71 +29,55 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30#endif 29#endif
31 30
32/* If you are compiling with a non-C calling convention but need to 31/* If you are compiling with a non-C calling convention but need to
33 declare vararg routines differently, put it here */ 32 declare vararg routines differently, put it here. */
34#define _VARARGS_ __cdecl 33#define _VARARGS_ __cdecl
35 34
36/* If you are providing a function to something that will call the 35/* If you are providing a function to something that will call the
37 function back (like a signal handler and signal, or main) its calling 36 function back (like a signal handler and signal, or main) its calling
38 convention must be whatever standard the libraries expect */ 37 convention must be whatever standard the libraries expect. */
39#define _CALLBACK_ __cdecl 38#define _CALLBACK_ __cdecl
40 39
41/* SYSTEM_TYPE should indicate the kind of system you are using. 40/* SYSTEM_TYPE should indicate the kind of system you are using.
42 It sets the Lisp variable system-type. */ 41 It sets the Lisp variable system-type. */
43
44#define SYSTEM_TYPE "windows-nt" 42#define SYSTEM_TYPE "windows-nt"
45#define SYMS_SYSTEM syms_of_ntterm () 43#define SYMS_SYSTEM syms_of_ntterm ()
46 44
47#define NO_MATHERR 1 45#define NO_MATHERR 1
48 46
49/* Letter to use in finding device name of first pty, 47/* Letter to use in finding device name of first pty,
50 if system supports pty's. 'a' means it is /dev/ptya0 */ 48 if system supports pty's. 'a' means it is /dev/ptya0 */
51
52#define FIRST_PTY_LETTER 'a' 49#define FIRST_PTY_LETTER 'a'
53 50
54/* 51/* Define HAVE_TIMEVAL if the system supports the BSD style clock values.
55 * Define HAVE_TIMEVAL if the system supports the BSD style clock values. 52 Look in <sys/time.h> for a timeval structure. */
56 * Look in <sys/time.h> for a timeval structure.
57 */
58
59#define HAVE_TIMEVAL 1 53#define HAVE_TIMEVAL 1
60 54
61/* NT supports Winsock which is close enough (with some hacks) */ 55/* NT supports Winsock which is close enough (with some hacks). */
62
63#define HAVE_SOCKETS 1 56#define HAVE_SOCKETS 1
64 57
65/* But our select implementation doesn't allow us to make non-blocking 58/* But our select implementation doesn't allow us to make non-blocking
66 connects. So until that is fixed, this is necessary: */ 59 connects. So until that is fixed, this is necessary: */
67
68#define BROKEN_NON_BLOCKING_CONNECT 1 60#define BROKEN_NON_BLOCKING_CONNECT 1
69 61
70/* And the select implementation does 1-byte read-ahead waiting 62/* And the select implementation does 1-byte read-ahead waiting
71 for received packets, so datagrams are broken too. */ 63 for received packets, so datagrams are broken too. */
72
73#define BROKEN_DATAGRAM_SOCKETS 1 64#define BROKEN_DATAGRAM_SOCKETS 1
74 65
75/* Define this symbol if your system has the functions bcopy, etc. */ 66/* Define this symbol if your system has the functions bcopy, etc. */
76
77#define BSTRING 67#define BSTRING
78#define bzero(b, l) memset(b, 0, l) 68#define bzero(b, l) memset(b, 0, l)
79#define bcopy(s, d, l) memmove(d, s, l) 69#define bcopy(s, d, l) memmove(d, s, l)
80#define bcmp(a, b, l) memcmp(a, b, l) 70#define bcmp(a, b, l) memcmp(a, b, l)
81 71
82/* bcopy (aka memmove aka memcpy at least on x86) under MSVC is quite safe */ 72/* bcopy (aka memmove aka memcpy at least on x86) under MSVC is quite safe. */
83#define GAP_USE_BCOPY 1 73#define GAP_USE_BCOPY 1
84#define BCOPY_UPWARD_SAFE 1 74#define BCOPY_UPWARD_SAFE 1
85#define BCOPY_DOWNWARD_SAFE 1 75#define BCOPY_DOWNWARD_SAFE 1
86 76
87/* If your system uses COFF (Common Object File Format) then define the 77/* If your system uses COFF (Common Object File Format) then define the
88 preprocessor symbol "COFF". */ 78 preprocessor symbol "COFF". */
89
90#define COFF 1 79#define COFF 1
91 80
92/* define MAIL_USE_FLOCK if the mailer uses flock
93 to interlock access to /usr/spool/mail/$USER.
94 The alternative is that a lock file named
95 /usr/spool/mail/$USER.lock. */
96
97/* #define MAIL_USE_FLOCK */
98#define MAIL_USE_POP 1 81#define MAIL_USE_POP 1
99#define MAIL_USE_SYSTEM_LOCK 1 82#define MAIL_USE_SYSTEM_LOCK 1
100 83
@@ -106,24 +89,33 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
106 89
107/* ============================================================ */ 90/* ============================================================ */
108 91
109/* Here, add any special hacks needed 92/* Here, add any special hacks needed to make Emacs work on this
110 to make Emacs work on this system. For example, 93 system. For example, you might define certain system call names
111 you might define certain system call names that don't 94 that don't exist on your system, or that do different things on
112 exist on your system, or that do different things on 95 your system and must be used only through an encapsulation (which
113 your system and must be used only through an encapsulation 96 you should place, by convention, in sysdep.c). */
114 (Which you should place, by convention, in sysdep.c). */
115 97
116/* Define this to be the separator between path elements */ 98/* Define this to be the separator between path elements. */
117#define DIRECTORY_SEP XINT (Vdirectory_sep_char) 99#define DIRECTORY_SEP XINT (Vdirectory_sep_char)
118 100
119/* Define this to be the separator between devices and paths */ 101/* Define this to be the separator between devices and paths. */
120#define DEVICE_SEP ':' 102#define DEVICE_SEP ':'
121 103
122/* We'll support either convention on NT. */ 104/* We'll support either convention on NT. */
123#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\') 105#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
124#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_)) 106#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
125 107
126/* The null device on Windows NT. */ 108#include <sys/types.h>
109struct sigaction {
110 int sa_flags;
111 void (*sa_handler)(int);
112 sigset_t sa_mask;
113};
114#define SIG_BLOCK 1
115#define SIG_SETMASK 2
116#define SIG_UNBLOCK 3
117
118/* The null device on Windows NT. */
127#define NULL_DEVICE "NUL:" 119#define NULL_DEVICE "NUL:"
128 120
129#ifndef MAXPATHLEN 121#ifndef MAXPATHLEN
@@ -213,11 +205,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
213 205
214#define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B") 206#define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B")
215 207
216/* get some redefinitions in place */ 208/* Get some redefinitions in place. */
217 209
218#ifdef emacs 210#ifdef emacs
219 211
220/* calls that are emulated or shadowed */ 212/* Calls that are emulated or shadowed. */
221#undef access 213#undef access
222#define access sys_access 214#define access sys_access
223#undef chdir 215#undef chdir
@@ -254,15 +246,26 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
254#undef write 246#undef write
255#define write sys_write 247#define write sys_write
256 248
257/* subprocess calls that are emulated */ 249/* Subprocess calls that are emulated. */
258#define spawnve sys_spawnve 250#define spawnve sys_spawnve
259#define wait sys_wait 251#define wait sys_wait
260#define kill sys_kill 252#define kill sys_kill
261#define signal sys_signal 253#define signal sys_signal
262 254
255/* termcap.c calls that are emulated. */
256#define tputs sys_tputs
257#define tgetstr sys_tgetstr
258
259/* cm.c calls that are emulated. */
260#define chcheckmagic sys_chcheckmagic
261#define cmcostinit sys_cmcostinit
262#define cmgoto sys_cmgoto
263#define cmputc sys_cmputc
264#define Wcm_clear sys_Wcm_clear
265
263#endif /* emacs */ 266#endif /* emacs */
264 267
265/* map to MSVC names */ 268/* Map to MSVC names. */
266#define execlp _execlp 269#define execlp _execlp
267#define execvp _execvp 270#define execvp _execvp
268#define fdopen _fdopen 271#define fdopen _fdopen
@@ -296,8 +299,8 @@ typedef int pid_t;
296#define utime _utime 299#define utime _utime
297#endif 300#endif
298 301
299/* this is hacky, but is necessary to avoid warnings about macro 302/* This is hacky, but is necessary to avoid warnings about macro
300 redefinitions using the SDK compilers */ 303 redefinitions using the SDK compilers. */
301#ifndef __STDC__ 304#ifndef __STDC__
302#define __STDC__ 1 305#define __STDC__ 1
303#define MUST_UNDEF__STDC__ 306#define MUST_UNDEF__STDC__
@@ -310,7 +313,7 @@ typedef int pid_t;
310#undef MUST_UNDEF__STDC__ 313#undef MUST_UNDEF__STDC__
311#endif 314#endif
312 315
313/* Defines that we need that aren't in the standard signal.h */ 316/* Defines that we need that aren't in the standard signal.h. */
314#define SIGHUP 1 /* Hang up */ 317#define SIGHUP 1 /* Hang up */
315#define SIGQUIT 3 /* Quit process */ 318#define SIGQUIT 3 /* Quit process */
316#define SIGTRAP 5 /* Trace trap */ 319#define SIGTRAP 5 /* Trace trap */
@@ -353,8 +356,7 @@ extern char *get_emacs_configuration_options (void);
353 356
354#include <sys/stat.h> 357#include <sys/stat.h>
355 358
356/* Define for those source files that do not include enough NT 359/* Define for those source files that do not include enough NT system files. */
357 system files. */
358#ifndef NULL 360#ifndef NULL
359#ifdef __cplusplus 361#ifdef __cplusplus
360#define NULL 0 362#define NULL 0
@@ -389,7 +391,7 @@ extern char *get_emacs_configuration_options (void);
389 removed. Also, obviously, all files that define initialized data 391 removed. Also, obviously, all files that define initialized data
390 must include config.h to pick up this pragma. */ 392 must include config.h to pick up this pragma. */
391 393
392/* Names must be < 8 bytes */ 394/* Names must be < 8 bytes. */
393#ifdef _MSC_VER 395#ifdef _MSC_VER
394#pragma data_seg("EMDATA") 396#pragma data_seg("EMDATA")
395#pragma bss_seg("EMBSS") 397#pragma bss_seg("EMBSS")
diff --git a/src/s/msdos.h b/src/s/msdos.h
index 115ec05b0a4..90f630c8627 100644
--- a/src/s/msdos.h
+++ b/src/s/msdos.h
@@ -1,7 +1,7 @@
1/* System description file for MS-DOS 1/* System description file for MS-DOS
2 2
3 Copyright (C) 1993, 1996, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 3Copyright (C) 1993, 1996, 1997, 2001, 2002, 2003, 2004, 2005, 2006,
4 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
7 7
@@ -21,11 +21,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21/* Note: lots of stuff here was taken from s-msdos.h in demacs. */ 21/* Note: lots of stuff here was taken from s-msdos.h in demacs. */
22 22
23 23
24/* 24/* Define symbols to identify the version of Unix this is.
25 * Define symbols to identify the version of Unix this is. 25 Define all the symbols that apply correctly. */
26 * Define all the symbols that apply correctly.
27 */
28
29#ifndef MSDOS 26#ifndef MSDOS
30#define MSDOS 27#define MSDOS
31#endif 28#endif
@@ -38,46 +35,34 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
38#undef BSD_SYSTEM 35#undef BSD_SYSTEM
39 36
40/* SYSTEM_TYPE should indicate the kind of system you are using. 37/* SYSTEM_TYPE should indicate the kind of system you are using.
41 It sets the Lisp variable system-type. */ 38 It sets the Lisp variable system-type. */
42
43#define SYSTEM_TYPE "ms-dos" 39#define SYSTEM_TYPE "ms-dos"
44 40
45#define SYMS_SYSTEM syms_of_dosfns();syms_of_msdos();syms_of_win16select() 41#define SYMS_SYSTEM syms_of_dosfns();syms_of_msdos();syms_of_win16select()
46 42
47/* NOMULTIPLEJOBS should be defined if your system's shell
48 does not have "job control" (the ability to stop a program,
49 run some other program, then continue the first one). */
50
51#define NOMULTIPLEJOBS
52
53#define SYSV_SYSTEM_DIR 43#define SYSV_SYSTEM_DIR
54 44
55/* Define this symbol if your system has the functions bcopy, etc. */ 45/* Define this symbol if your system has the functions bcopy, etc. */
56
57#define BSTRING 46#define BSTRING
58 47
59/* Define this is the compiler understands `volatile'. */ 48/* Define this is the compiler understands `volatile'. */
60#define HAVE_VOLATILE 49#define HAVE_VOLATILE
61 50
62 51
63/* subprocesses should be defined if you want to 52/* subprocesses should be defined if you want to have code for
64 have code for asynchronous subprocesses 53 asynchronous subprocesses (as used in M-x compile and M-x shell).
65 (as used in M-x compile and M-x shell).
66 This is the only system that needs this. */ 54 This is the only system that needs this. */
67
68#undef subprocesses 55#undef subprocesses
69 56
70/* If your system uses COFF (Common Object File Format) then define the 57/* If your system uses COFF (Common Object File Format) then define the
71 preprocessor symbol "COFF". */ 58 preprocessor symbol "COFF". */
72
73#define COFF 59#define COFF
74 60
75/* Here, on a separate page, add any special hacks needed 61/* Here, on a separate page, add any special hacks needed to make
76 to make Emacs work on this system. For example, 62 Emacs work on this system. For example, you might define certain
77 you might define certain system call names that don't 63 system call names that don't exist on your system, or that do
78 exist on your system, or that do different things on 64 different things on your system and must be used only through an
79 your system and must be used only through an encapsulation 65 encapsulation (which you should place, by convention, in sysdep.c). */
80 (Which you should place, by convention, in sysdep.c). */
81 66
82/* Avoid incompatibilities between gmalloc.c and system header files 67/* Avoid incompatibilities between gmalloc.c and system header files
83 in how to declare valloc. */ 68 in how to declare valloc. */
@@ -89,7 +74,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
89 74
90/* setjmp and longjmp can safely replace _setjmp and _longjmp, 75/* setjmp and longjmp can safely replace _setjmp and _longjmp,
91 but they will run slower. */ 76 but they will run slower. */
92
93#define _setjmp setjmp 77#define _setjmp setjmp
94#define _longjmp longjmp 78#define _longjmp longjmp
95 79
@@ -101,7 +85,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
101#define ORDINARY_LINK 85#define ORDINARY_LINK
102 86
103/* command.com does not understand `...` so we define this. */ 87/* command.com does not understand `...` so we define this. */
104#define LIB_GCC -Lgcc
105#define SEPCHAR ';' 88#define SEPCHAR ';'
106 89
107#define NULL_DEVICE "nul" 90#define NULL_DEVICE "nul"
@@ -116,17 +99,17 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
116:AB=<BG %d>:AF=<FG %d>:op=<DefC>:" 99:AB=<BG %d>:AF=<FG %d>:op=<DefC>:"
117 100
118/* Define this to a function (Fdowncase, Fupcase) if your file system 101/* Define this to a function (Fdowncase, Fupcase) if your file system
119 likes that */ 102 likes that. */
120#define FILE_SYSTEM_CASE Fmsdos_downcase_filename 103#define FILE_SYSTEM_CASE Fmsdos_downcase_filename
121 104
122/* Define this to be the separator between devices and paths */ 105/* Define this to be the separator between devices and paths. */
123#define DEVICE_SEP ':' 106#define DEVICE_SEP ':'
124 107
125/* We'll support either convention on MSDOG. */ 108/* We'll support either convention on MSDOG. */
126#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\') 109#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
127#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_)) 110#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
128 111
129/* bcopy under djgpp is quite safe */ 112/* bcopy under djgpp is quite safe. */
130#define GAP_USE_BCOPY 113#define GAP_USE_BCOPY
131#define BCOPY_UPWARD_SAFE 1 114#define BCOPY_UPWARD_SAFE 1
132#define BCOPY_DOWNWARD_SAFE 1 115#define BCOPY_DOWNWARD_SAFE 1
@@ -134,13 +117,10 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
134/* Mode line description of a buffer's type. */ 117/* Mode line description of a buffer's type. */
135#define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B") 118#define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B")
136 119
137/* Do we have POSIX signals? */
138#define POSIX_SIGNALS
139
140/* We have (the code to control) a mouse. */ 120/* We have (the code to control) a mouse. */
141#define HAVE_MOUSE 121#define HAVE_MOUSE
142 122
143/* We canuse mouse menus. */ 123/* We can use mouse menus. */
144#define HAVE_MENUS 124#define HAVE_MENUS
145 125
146/* Define one of these for easier conditionals. */ 126/* Define one of these for easier conditionals. */
@@ -149,7 +129,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
149 commentary below, in the non-X branch. The 140KB number was 129 commentary below, in the non-X branch. The 140KB number was
150 measured on GNU/Linux and on MS-WIndows. */ 130 measured on GNU/Linux and on MS-WIndows. */
151#define SYSTEM_PURESIZE_EXTRA (-170000+140000) 131#define SYSTEM_PURESIZE_EXTRA (-170000+140000)
152#define LIBS_SYSTEM -lxext -lsys
153#else 132#else
154/* We need a little extra space, see ../../lisp/loadup.el. 133/* We need a little extra space, see ../../lisp/loadup.el.
155 As of 20091024, DOS-specific files use up 62KB of pure space. But 134 As of 20091024, DOS-specific files use up 62KB of pure space. But
@@ -164,15 +143,11 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
164#endif 143#endif
165 144
166/* Tell the garbage collector that setjmp is known to save all 145/* Tell the garbage collector that setjmp is known to save all
167 registers relevant for conservative garbage collection in the 146 registers relevant for conservative garbage collection in the jmp_buf. */
168 jmp_buf. */
169
170#define GC_SETJMP_WORKS 1 147#define GC_SETJMP_WORKS 1
171#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS 148#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
172 149
173#define NO_REMAP 150#define NO_REMAP
174 151
175#define UNEXEC unexec.o
176
177/* arch-tag: d184f860-815d-4ff4-8187-d05c0f3c37d0 152/* arch-tag: d184f860-815d-4ff4-8187-d05c0f3c37d0
178 (do not change this comment) */ 153 (do not change this comment) */
diff --git a/src/s/netbsd.h b/src/s/netbsd.h
index 682b9482352..b8df9014ecc 100644
--- a/src/s/netbsd.h
+++ b/src/s/netbsd.h
@@ -1,7 +1,7 @@
1/* s/ file for netbsd system. 1/* s/ file for netbsd system.
2 2
3 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 3Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
4 2008, 2009, 2010 Free Software Foundation, Inc. 4 2010 Free Software Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
7 7
@@ -19,55 +19,19 @@ You should have received a copy of the GNU General Public License
19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21 21
22/* Get most of the stuff from bsd-common */ 22/* Get most of the stuff from bsd-common. */
23#include "bsd-common.h" 23#include "bsd-common.h"
24 24
25#define HAVE_GETLOADAVG 1 25#define HAVE_GETLOADAVG 1
26 26
27#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) 27#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
28 28
29#define LIBS_TERMCAP -ltermcap
30
31#define START_FILES pre-crt0.o /usr/lib/crt0.o START_FILES_1 /usr/lib/crtbegin.o
32#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o END_FILES_1
33#undef LIB_GCC
34#define LIB_GCC
35
36#ifdef HAVE_CRTIN
37#define START_FILES_1 /usr/lib/crti.o
38#define END_FILES_1 /usr/lib/crtn.o
39#else
40#define START_FILES_1
41#define END_FILES_1
42#endif
43
44#define AMPERSAND_FULL_NAME 29#define AMPERSAND_FULL_NAME
45 30
46/* Here is how to find X Windows. LD_SWITCH_X_SITE_AUX gives an -R option
47 says where to find X windows at run time. We convert it to a -rpath option
48 which is what OSF1 uses. */
49#define LD_SWITCH_SYSTEM_tmp `echo LD_SWITCH_X_SITE_AUX | sed -e 's/-R/-Wl,-rpath,/'`
50#define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_tmp -Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib
51
52/* The following is needed to make `configure' find Xpm, Xaw3d and
53 image include and library files if using /usr/bin/gcc. That
54 compiler seems to be modified to not find headers in
55 /usr/local/include or libs in /usr/local/lib by default. */
56
57#define C_SWITCH_SYSTEM -I/usr/X11R6/include -I/usr/pkg/include -I/usr/local/include -L/usr/pkg/lib -L/usr/local/lib
58
59/* Link temacs with -z nocombreloc so that unexec works right, whether or
60 not -z combreloc is the default. GNU ld ignores unknown -z KEYWORD
61 switches, so this also works with older versions that don't implement
62 -z combreloc. */
63
64#define LD_SWITCH_SYSTEM_TEMACS -Wl,-z,nocombreloc
65
66/* On post 1.3 releases of NetBSD, gcc -nostdlib also clears 31/* On post 1.3 releases of NetBSD, gcc -nostdlib also clears
67 the library search parth, i.e. it won't search /usr/lib 32 the library search parth, i.e. it won't search /usr/lib
68 for libc and friends. Using -nostartfiles instead avoids 33 for libc and friends. Using -nostartfiles instead avoids
69 this problem, and will also work on earlier NetBSD releases */ 34 this problem, and will also work on earlier NetBSD releases. */
70
71#define LINKER $(CC) -nostartfiles 35#define LINKER $(CC) -nostartfiles
72 36
73#define DEFAULT_SOUND_DEVICE "/dev/audio" 37#define DEFAULT_SOUND_DEVICE "/dev/audio"
@@ -75,7 +39,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
75/* Greg A. Woods <woods@weird.com> says we must include signal.h 39/* Greg A. Woods <woods@weird.com> says we must include signal.h
76 before syssignal.h is included, to work around interface conflicts 40 before syssignal.h is included, to work around interface conflicts
77 that are handled with CPP __RENAME() macro in signal.h. */ 41 that are handled with CPP __RENAME() macro in signal.h. */
78
79#ifndef NOT_C_CODE 42#ifndef NOT_C_CODE
80#include <signal.h> 43#include <signal.h>
81#endif 44#endif
@@ -83,23 +46,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
83/* Don't close pty in process.c to make it as controlling terminal. 46/* Don't close pty in process.c to make it as controlling terminal.
84 It is already a controlling terminal of subprocess, because we did 47 It is already a controlling terminal of subprocess, because we did
85 ioctl TIOCSCTTY. */ 48 ioctl TIOCSCTTY. */
86
87#define DONT_REOPEN_PTY 49#define DONT_REOPEN_PTY
88 50
89/* Tell that garbage collector that setjmp is known to save all 51/* Tell that garbage collector that setjmp is known to save all
90 registers relevant for conservative garbage collection in the 52 registers relevant for conservative garbage collection in the jmp_buf. */
91 jmp_buf. */
92
93#define GC_SETJMP_WORKS 1 53#define GC_SETJMP_WORKS 1
94 54
95/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method. */ 55/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method. */
96
97#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS 56#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
98 57
99/* Use sigprocmask and friends instead of sigblock;
100 sigblock is considered obsolete on NetBSD. */
101
102#define POSIX_SIGNALS 1
103
104/* arch-tag: e80f364a-04e9-4faf-93cb-f36a0fe95c81 58/* arch-tag: e80f364a-04e9-4faf-93cb-f36a0fe95c81
105 (do not change this comment) */ 59 (do not change this comment) */
diff --git a/src/s/openbsd.h b/src/s/openbsd.h
index a74601d3ad8..d9d60e3b868 100644
--- a/src/s/openbsd.h
+++ b/src/s/openbsd.h
@@ -1,32 +1,7 @@
1/* s/ file for openbsd systems. */ 1/* System file for openbsd. */
2 2
3/* Mostly the same as NetBSD. */ 3/* The same as NetBSD. Note there are differences in configure. */
4#include "netbsd.h" 4#include "netbsd.h"
5 5
6/* This very-badly named symbol is conditionally defined in netbsd.h.
7 Better would be either to not need it in the first place, or to choose
8 a more descriptive name. */
9#ifndef LD_SWITCH_SYSTEM_tmp
10#define LD_SWITCH_SYSTEM_tmp /* empty */
11#endif
12
13/* David Mazieres <dm@reeducation-labor.lcs.mit.edu> says this
14 is necessary. Otherwise Emacs dumps core when run -nw. */
15#undef LIBS_TERMCAP
16
17#define TERMINFO
18#define LIBS_TERMCAP -lncurses
19
20#undef LD_SWITCH_SYSTEM_TEMACS
21#undef LD_SWITCH_SYSTEM
22
23 /* Han Boetes <han@mijncomputer.nl> says this
24 is necessary, otherwise Emacs dumps core on elf systems. */
25#define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_tmp -Z
26
27/* The version of gcc on OpenBSD doesn't search /usr/local/lib by
28 default. */
29#define LD_SWITCH_X_DEFAULT -L/usr/local/lib
30
31/* arch-tag: 7e3f65ca-3f48-4237-933f-2b208b21e8e2 6/* arch-tag: 7e3f65ca-3f48-4237-933f-2b208b21e8e2
32 (do not change this comment) */ 7 (do not change this comment) */
diff --git a/src/s/sol2-10.h b/src/s/sol2-10.h
index 865e17525c4..fd74ae798c9 100644
--- a/src/s/sol2-10.h
+++ b/src/s/sol2-10.h
@@ -4,20 +4,18 @@
4 4
5#define SYSTEM_MALLOC 5#define SYSTEM_MALLOC
6 6
7/* 7/* Use the Solaris dldump() function, called from unexsol.c, to dump
8 * Use the Solaris dldump() function, called from unexsol.c, to dump 8 emacs, instead of the generic ELF dump code found in unexelf.c.
9 * emacs, instead of the generic ELF dump code found in unexelf.c. 9 The resulting binary has a complete symbol table, and is better
10 * The resulting binary has a complete symbol table, and is better 10 for debugging and other observabilty tools (debuggers, pstack, etc).
11 * for debugging and other observabilty tools (debuggers, pstack, etc). 11
12 * 12 If you encounter a problem using dldump(), please consider sending
13 * If you encounter a problem using dldump(), please consider sending 13 a message to the OpenSolaris tools-linking mailing list:
14 * a message to the OpenSolaris tools-linking mailing list: 14 http://mail.opensolaris.org/mailman/listinfo/tools-linking
15 * http://mail.opensolaris.org/mailman/listinfo/tools-linking 15
16 * 16 It is likely that dldump() works with older Solaris too,
17 * It is likely that dldump() works with older Solaris too, 17 but this has not been tested, and so, this change is for
18 * but this has not been tested, and so, this change is for 18 Solaris 10 and newer only at this time. */
19 * Solaris 10 and newer only at this time.
20 */
21#undef UNEXEC 19#undef UNEXEC
22#define UNEXEC unexsol.o 20#define UNEXEC unexsol.o
23 21
diff --git a/src/s/sol2-6.h b/src/s/sol2-6.h
index 408a0a2ed02..f9a4c44d74e 100644
--- a/src/s/sol2-6.h
+++ b/src/s/sol2-6.h
@@ -1,7 +1,7 @@
1/* Definitions file for GNU Emacs running on Solaris 2.6. 1/* Definitions file for GNU Emacs running on Solaris 2.6.
2 2
3 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 3Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 2008, 2009, 2010 Free Software Foundation, Inc. 4 2008, 2009, 2010 Free Software Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
7 7
@@ -27,8 +27,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27 27
28#define POSIX 28#define POSIX
29 29
30#define LIBS_SYSTEM -lsocket -lnsl -lkstat
31
32/* Prefer kstat over kvm in getloadavg.c, kstat doesn't require root. 30/* Prefer kstat over kvm in getloadavg.c, kstat doesn't require root.
33 ghazi@caip.rutgers.edu, 7/21/97. Don't redefine if already defined 31 ghazi@caip.rutgers.edu, 7/21/97. Don't redefine if already defined
34 (e.g., by config.h). */ 32 (e.g., by config.h). */
@@ -38,19 +36,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
38 36
39/* inoue@ainet.or.jp says Solaris has a bug related to X11R6-style 37/* inoue@ainet.or.jp says Solaris has a bug related to X11R6-style
40 XIM support. */ 38 XIM support. */
41
42#define INHIBIT_X11R6_XIM 39#define INHIBIT_X11R6_XIM
43 40
44/* Must use the system's termcap, if we use any termcap.
45 It does special things. */
46
47#ifndef TERMINFO
48#define LIBS_TERMCAP -ltermcap
49#endif
50
51/* This is the same definition as in usg5-4.h, but with sigblock/sigunblock 41/* This is the same definition as in usg5-4.h, but with sigblock/sigunblock
52 rather than sighold/sigrelse, which appear to be BSD4.1 specific and won't 42 rather than sighold/sigrelse, which appear to be BSD4.1 specific.
53 work if POSIX_SIGNALS is defined. It may also be appropriate for SVR4.x 43 It may also be appropriate for SVR4.x
54 (x<2) but I'm not sure. fnf@cygnus.com */ 44 (x<2) but I'm not sure. fnf@cygnus.com */
55/* This sets the name of the slave side of the PTY. On SysVr4, 45/* This sets the name of the slave side of the PTY. On SysVr4,
56 grantpt(3) forks a subprocess, so keep sigchld_handler() from 46 grantpt(3) forks a subprocess, so keep sigchld_handler() from
@@ -73,35 +63,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
73 pty_name[sizeof (pty_name) - 1] = 0; \ 63 pty_name[sizeof (pty_name) - 1] = 0; \
74 } 64 }
75 65
76/* `#ifdef USE_MOTIF' won't work here, since USE_MOTIF isn't defined yet.
77 Instead, dynamically check whether USE_MOTIF expands to something. */
78#define NOT_USING_MOTIF { set x USE_MOTIF; test "$$2" = "USE_MOTIF"; }
79
80#ifndef __GNUC__
81#define LD_SWITCH_SYSTEM_TEMACS -L/usr/ccs/lib LD_SWITCH_X_SITE_AUX \
82 `NOT_USING_MOTIF || echo ' -R/usr/dt/lib'`
83#else /* GCC */
84/* We use ./prefix-args because we don't know whether LD_SWITCH_X_SITE_AUX
85 has anything in it. It can be empty.
86 This works ok in temacs. */
87#define LD_SWITCH_SYSTEM_TEMACS -L/usr/ccs/lib \
88 `./prefix-args -Xlinker LD_SWITCH_X_SITE_AUX` \
89 `NOT_USING_MOTIF || echo ' -R/usr/dt/lib -L/usr/dt/lib'`
90
91/* Get rid of -traditional and let const really do its thing. */
92#undef C_SWITCH_SYSTEM
93#undef const
94#endif /* GCC */
95
96/* Gregory Neil Shapiro <gshapiro@hhmi.org> reports the Motif header files
97 are in this directory on Solaris 2.4. */
98#define C_SWITCH_X_SYSTEM -I/usr/dt/include
99
100/* -lgen is needed for the regex and regcmp functions
101 which are used by Motif. In the future we can try changing
102 regex.c to provide them in Emacs, but this is safer for now. */
103#define LIB_MOTIF -lXm -lgen
104
105/* This is the only known way to avoid some crashes 66/* This is the only known way to avoid some crashes
106 that seem to relate to screwed up malloc data 67 that seem to relate to screwed up malloc data
107 after deleting a frame. */ 68 after deleting a frame. */
diff --git a/src/s/template.h b/src/s/template.h
index e5fd2541c7b..16df03092d2 100644
--- a/src/s/template.h
+++ b/src/s/template.h
@@ -1,8 +1,9 @@
1/* Template for system description header files. 1/* Template for system description header files.
2 This file describes the parameters that system description files 2 This file describes the parameters that system description files
3 should define or not. 3 should define or not.
4 Copyright (C) 1985, 1986, 1992, 1999, 2001, 2002, 2003, 2004, 2005, 4
5 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 5Copyright (C) 1985, 1986, 1992, 1999, 2001, 2002, 2003, 2004, 2005,
6 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
6 7
7This file is part of GNU Emacs. 8This file is part of GNU Emacs.
8 9
@@ -20,10 +21,8 @@ You should have received a copy of the GNU General Public License
20along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 21along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 22
22 23
23/* 24/* Define symbols to identify the version of Unix this is.
24 * Define symbols to identify the version of Unix this is. 25 Define all the symbols that apply correctly. */
25 * Define all the symbols that apply correctly.
26 */
27 26
28/* #define USG5 */ 27/* #define USG5 */
29/* #define USG */ 28/* #define USG */
@@ -33,16 +32,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
33/* #define BSD_SYSTEM */ 32/* #define BSD_SYSTEM */
34 33
35/* SYSTEM_TYPE should indicate the kind of system you are using. 34/* SYSTEM_TYPE should indicate the kind of system you are using.
36 It sets the Lisp variable system-type. */ 35 It sets the Lisp variable system-type. */
37 36
38#define SYSTEM_TYPE "berkeley-unix" 37#define SYSTEM_TYPE "berkeley-unix"
39 38
40/* NOMULTIPLEJOBS should be defined if your system's shell
41 does not have "job control" (the ability to stop a program,
42 run some other program, then continue the first one). */
43
44/* #define NOMULTIPLEJOBS */
45
46/* Emacs can read input using SIGIO and buffering characters itself, 39/* Emacs can read input using SIGIO and buffering characters itself,
47 or using CBREAK mode and making C-g cause SIGINT. 40 or using CBREAK mode and making C-g cause SIGINT.
48 The choice is controlled by the variable interrupt_input. 41 The choice is controlled by the variable interrupt_input.
@@ -63,62 +56,46 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
63 Another method of doing input is planned but not implemented. 56 Another method of doing input is planned but not implemented.
64 It would have Emacs fork off a separate process 57 It would have Emacs fork off a separate process
65 to read the input and send it to the true Emacs process 58 to read the input and send it to the true Emacs process
66 through a pipe. */ 59 through a pipe. */
67
68#define INTERRUPT_INPUT 60#define INTERRUPT_INPUT
69 61
70/* Letter to use in finding device name of first pty, 62/* Letter to use in finding device name of first pty,
71 if system supports pty's. 'a' means it is /dev/ptya0 */ 63 if system supports pty's. 'a' means it is /dev/ptya0. */
72
73#define FIRST_PTY_LETTER 'a' 64#define FIRST_PTY_LETTER 'a'
74 65
75/* 66/* Define HAVE_TERMIOS if the system provides POSIX-style
76 * Define HAVE_TERMIOS if the system provides POSIX-style 67 functions and macros for terminal control.
77 * functions and macros for terminal control. 68
78 * 69 Define HAVE_TERMIO if the system provides sysV-style ioctls
79 * Define HAVE_TERMIO if the system provides sysV-style ioctls 70 for terminal control.
80 * for terminal control. 71
81 * 72 Do not define both. HAVE_TERMIOS is preferred, if it is
82 * Do not define both. HAVE_TERMIOS is preferred, if it is 73 supported on your system. */
83 * supported on your system.
84 */
85 74
86#define HAVE_TERMIOS 75#define HAVE_TERMIOS
87/* #define HAVE_TERMIO */ 76/* #define HAVE_TERMIO */
88 77
89/* 78/* Define HAVE_PTYS if the system supports pty devices. */
90 * Define HAVE_PTYS if the system supports pty devices.
91 */
92
93#define HAVE_PTYS 79#define HAVE_PTYS
94 80
95/* Define this symbol if your system has the functions bcopy, etc. */ 81/* Define this symbol if your system has the functions bcopy, etc. */
96
97#define BSTRING 82#define BSTRING
98 83
99/* subprocesses should be undefined if you do NOT want to 84/* subprocesses should be undefined if you do NOT want to
100 have code for asynchronous subprocesses 85 have code for asynchronous subprocesses
101 (as used in M-x compile and M-x shell). 86 (as used in M-x compile and M-x shell).
102 Currently only MSDOS does not support this. */ 87 Currently only MSDOS does not support this. */
103 88
104/* #undef subprocesses */ 89/* #undef subprocesses */
105 90
106/* If your system uses COFF (Common Object File Format) then define the 91/* If your system uses COFF (Common Object File Format) then define the
107 preprocessor symbol "COFF". */ 92 preprocessor symbol "COFF". */
108 93
109/* #define COFF */ 94/* #define COFF */
110 95
111/* define MAIL_USE_FLOCK if the mailer uses flock
112 to interlock access to /usr/spool/mail/$USER.
113 The alternative is that a lock file named
114 /usr/spool/mail/$USER.lock. */
115
116#define MAIL_USE_FLOCK
117
118/* Define CLASH_DETECTION if you want lock files to be written 96/* Define CLASH_DETECTION if you want lock files to be written
119 so that Emacs can tell instantly when you try to modify 97 so that Emacs can tell instantly when you try to modify
120 a file that someone else has modified in his Emacs. */ 98 a file that someone else has modified in his Emacs. */
121
122#define CLASH_DETECTION 99#define CLASH_DETECTION
123 100
124/* Define this if your operating system declares signal handlers to 101/* Define this if your operating system declares signal handlers to
@@ -139,12 +116,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
139 116
140/* ============================================================ */ 117/* ============================================================ */
141 118
142/* Here, add any special hacks needed 119/* Here, add any special hacks needed to make Emacs work on this
143 to make Emacs work on this system. For example, 120 system. For example, you might define certain system call names
144 you might define certain system call names that don't 121 that don't exist on your system, or that do different things on
145 exist on your system, or that do different things on 122 your system and must be used only through an encapsulation (which
146 your system and must be used only through an encapsulation 123 you should place, by convention, in sysdep.c). */
147 (Which you should place, by convention, in sysdep.c). */
148 124
149/* If the system's imake configuration file defines `NeedWidePrototypes' 125/* If the system's imake configuration file defines `NeedWidePrototypes'
150 as `NO', we must define NARROWPROTO manually. Such a define is 126 as `NO', we must define NARROWPROTO manually. Such a define is
diff --git a/src/s/unixware.h b/src/s/unixware.h
index 9fedb426868..864f09786b6 100644
--- a/src/s/unixware.h
+++ b/src/s/unixware.h
@@ -1,7 +1,7 @@
1/* s/ file for Unixware. 1/* s/ file for Unixware.
2 2
3 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 3Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 2008, 2009, 2010 Free Software Foundation, Inc. 4 2008, 2009, 2010 Free Software Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
7 7
@@ -28,18 +28,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28 28
29#undef HAVE_SYSV_SIGPAUSE 29#undef HAVE_SYSV_SIGPAUSE
30 30
31/* Motif needs -lgen. */
32#define LIBS_SYSTEM -lsocket -lnsl -lelf -lgen
33
34/* This is the same definition as in usg5-4.h, but with sigblock/sigunblock 31/* This is the same definition as in usg5-4.h, but with sigblock/sigunblock
35 rather than sighold/sigrelse, which appear to be BSD4.1 specific and won't 32 rather than sighold/sigrelse, which appear to be BSD4.1 specific.
36 work if POSIX_SIGNALS is defined. It may also be appropriate for SVR4.x 33 It may also be appropriate for SVR4.x
37 (x<2) but I'm not sure. fnf@cygnus.com */ 34 (x<2) but I'm not sure. fnf@cygnus.com */
38/* This sets the name of the slave side of the PTY. On SysVr4, 35/* This sets the name of the slave side of the PTY. On SysVr4,
39 grantpt(3) forks a subprocess, so keep sigchld_handler() from 36 grantpt(3) forks a subprocess, so keep sigchld_handler() from
40 intercepting that death. If any child but grantpt's should die 37 intercepting that death. If any child but grantpt's should die
41 within, it should be caught after sigrelse(2). */ 38 within, it should be caught after sigrelse(2). */
42
43#define PTY_TTY_NAME_SPRINTF \ 39#define PTY_TTY_NAME_SPRINTF \
44 { \ 40 { \
45 char *ptsname(), *ptyname; \ 41 char *ptsname(), *ptyname; \
@@ -56,15 +52,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
56 pty_name[sizeof(pty_name) - 1] = 0; \ 52 pty_name[sizeof(pty_name) - 1] = 0; \
57 } 53 }
58 54
59/* Use libw.a along with X11R6 Xt. */ 55/* Data type of load average, as read out of kmem. */
60#define NEED_LIBW 56#define LOAD_AVE_TYPE long
61 57
62/* ryanr@ellingtn.ftc.nrcs.usda.gov (Richard Anthony Ryan) says -lXimp 58/* Convert that into an integer that is 100 for a load average of 1.0 */
63 is needed in UNIX_SV ... 4.2 1.1.2. */ 59/* This is totally uncalibrated. */
64#define LIB_MOTIF -lXm -lXimp 60#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE))
65 61#define FSCALE 256.0
66/* arch-tag: 9bbfcfc1-19be-45a1-9699-af57b87da2c6
67 (do not change this comment) */
68 62
69 63
70#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base) 64#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base)
diff --git a/src/s/usg5-4.h b/src/s/usg5-4.h
index b02caf9a3da..f870086368c 100644
--- a/src/s/usg5-4.h
+++ b/src/s/usg5-4.h
@@ -1,6 +1,10 @@
1/* Definitions file for GNU Emacs running on AT&T's System V Release 4 1/* Definitions file for GNU Emacs running on AT&T's System V Release 4
2 Copyright (C) 1987, 1990, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2
3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1987, 1990, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5
6Written by James Van Artsdalen of Dell Computer Corp. james@bigtex.cactus.org.
7Subsequently improved for Dell 2.2 by Eric S. Raymond <esr@snark.thyrsus.com>.
4 8
5This file is part of GNU Emacs. 9This file is part of GNU Emacs.
6 10
@@ -17,61 +21,36 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 21You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 22along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 23
20/* This file written by James Van Artsdalen of Dell Computer Corporation. 24/* Use the SysVr3 file for at least base configuration. */
21 * james@bigtex.cactus.org. Subsequently improved for Dell 2.2 by Eric
22 * S. Raymond <esr@snark.thyrsus.com>.
23 */
24
25/* Use the SysVr3 file for at least base configuration. */
26
27#define USG /* System III, System V, etc */ 25#define USG /* System III, System V, etc */
28 26
29#define USG5 27#define USG5
30#define USG5_4 28#define USG5_4
31 29
32/* SYSTEM_TYPE should indicate the kind of system you are using. 30/* SYSTEM_TYPE should indicate the kind of system you are using.
33 It sets the Lisp variable system-type. */ 31 It sets the Lisp variable system-type. */
34
35#define SYSTEM_TYPE "usg-unix-v" 32#define SYSTEM_TYPE "usg-unix-v"
36 33
37/* 34/* Define HAVE_TERMIO if the system provides sysV-style ioctls
38 * Define HAVE_TERMIO if the system provides sysV-style ioctls 35 for terminal control. */
39 * for terminal control.
40 */
41
42#define HAVE_TERMIO 36#define HAVE_TERMIO
43 37
44/* 38/* Define SYSV_SYSTEM_DIR to use the V.3 getdents/readir library
45 * Define HAVE_PTYS if the system supports pty devices. 39 functions. Almost, but not quite the same as the 4.2 functions. */
46 */
47
48/*
49 * Define SYSV_SYSTEM_DIR to use the V.3 getdents/readir
50 * library functions. Almost, but not quite the same as
51 * the 4.2 functions
52 */
53#define SYSV_SYSTEM_DIR 40#define SYSV_SYSTEM_DIR
54 41
55/* The file containing the kernel's symbol table is called /unix. */ 42/* The file containing the kernel's symbol table is called /unix. */
56
57#define KERNEL_FILE "/unix" 43#define KERNEL_FILE "/unix"
58 44
59/* The symbol in the kernel where the load average is found 45/* The kernel symbol where the load average is found is named avenrun. */
60 is named avenrun. */
61
62#define LDAV_SYMBOL "avenrun" 46#define LDAV_SYMBOL "avenrun"
63 47
64/* Special hacks needed to make Emacs run on this system. */
65
66#define POSIX_SIGNALS
67
68/* setjmp and longjmp can safely replace _setjmp and _longjmp, 48/* setjmp and longjmp can safely replace _setjmp and _longjmp,
69 but they will run slower. */ 49 but they will run slower. */
70
71#define _setjmp setjmp 50#define _setjmp setjmp
72#define _longjmp longjmp 51#define _longjmp longjmp
73 52
74/* On USG systems these have different names */ 53/* On USG systems these have different names. */
75#ifndef HAVE_INDEX 54#ifndef HAVE_INDEX
76#define index strchr 55#define index strchr
77#endif /* ! defined (HAVE_INDEX) */ 56#endif /* ! defined (HAVE_INDEX) */
@@ -79,41 +58,27 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
79#define rindex strrchr 58#define rindex strrchr
80#endif /* ! defined (HAVE_RINDEX) */ 59#endif /* ! defined (HAVE_RINDEX) */
81 60
82/* Use terminfo instead of termcap. */ 61/* The docs for system V/386 suggest v.3 has sigpause, so let's try it. */
83
84#define TERMINFO
85
86
87/* The docs for system V/386 suggest v.3 has sigpause,
88 so let's give it a try. */
89#define HAVE_SYSV_SIGPAUSE 62#define HAVE_SYSV_SIGPAUSE
90 63
91 64/* If we're using the System V X port, BSD bstring functions will be handy. */
92/* If we're using the System V X port, BSD bstring functions will be handy */
93
94#ifdef HAVE_X_WINDOWS 65#ifdef HAVE_X_WINDOWS
95#define BSTRING 66#define BSTRING
96#endif /* HAVE_X_WINDOWS */ 67#endif /* HAVE_X_WINDOWS */
97 68
98/* On USG systems signal handlers return void */ 69/* On USG systems signal handlers return void. */
99
100#define SIGTYPE void 70#define SIGTYPE void
101 71
102#define ORDINARY_LINK 72#define ORDINARY_LINK
103 73
104#define LIB_STANDARD 74/* Undump with ELF. */
105
106/* Undump with ELF */
107
108#undef COFF 75#undef COFF
109 76
110#define UNEXEC unexelf.o 77#define UNEXEC unexelf.o
111 78
112/* Get FIONREAD from <sys/filio.h>. Get <sys/ttold.h> to get struct 79/* Get FIONREAD from <sys/filio.h>. Get <sys/ttold.h> to get struct tchars.
113 * tchars. But get <termio.h> first to make sure ttold.h doesn't 80 But get <termio.h> first to make sure ttold.h doesn't interfere.
114 * interfere. And don't try to use SIGIO yet. 81 And don't try to use SIGIO yet. */
115 */
116
117#ifndef NOT_C_CODE 82#ifndef NOT_C_CODE
118#include <sys/wait.h> 83#include <sys/wait.h>
119#endif 84#endif
@@ -130,15 +95,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
130#endif 95#endif
131 96
132/* Some SVr4s don't define NSIG in sys/signal.h for ANSI environments; 97/* Some SVr4s don't define NSIG in sys/signal.h for ANSI environments;
133 * instead, there's a system variable _sys_nsig. Unfortunately, we need the 98 instead, there's a system variable _sys_nsig. Unfortunately, we need the
134 * constant to dimension an array. So wire in the appropriate value here. 99 constant to dimension an array. So wire in the appropriate value here. */
135 */
136#define NSIG_MINIMUM 32 100#define NSIG_MINIMUM 32
137 101
138/* We can support this */ 102/* We can support this. */
139
140#define CLASH_DETECTION 103#define CLASH_DETECTION
141 104
105/* Define HAVE_PTYS if the system supports pty devices. */
142#define HAVE_PTYS 106#define HAVE_PTYS
143#define HAVE_TERMIOS 107#define HAVE_TERMIOS
144 108
@@ -146,7 +110,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
146 waiting, because a previous waitsys(2) cleaned up the carcass of child 110 waiting, because a previous waitsys(2) cleaned up the carcass of child
147 without clearing the SIGCHLD pending info. So, use a non-blocking 111 without clearing the SIGCHLD pending info. So, use a non-blocking
148 wait3 instead, which maps to waitpid(2) in SysVr4. */ 112 wait3 instead, which maps to waitpid(2) in SysVr4. */
149
150#define wait3(status, options, rusage) \ 113#define wait3(status, options, rusage) \
151 waitpid ((pid_t) -1, (status), (options)) 114 waitpid ((pid_t) -1, (status), (options))
152#define WRETCODE(w) (w >> 8) 115#define WRETCODE(w) (w >> 8)
@@ -154,20 +117,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
154/* TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY 117/* TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY
155 subprocesses the usual way. But TIOCSIGNAL does work for PTYs, and 118 subprocesses the usual way. But TIOCSIGNAL does work for PTYs, and
156 this is all we need. */ 119 this is all we need. */
157
158#define TIOCSIGSEND TIOCSIGNAL 120#define TIOCSIGSEND TIOCSIGNAL
159 121
160/* This change means that we don't loop through allocate_pty too many 122/* This change means that we don't loop through allocate_pty too many
161 times in the (rare) event of a failure. */ 123 times in the (rare) event of a failure. */
162
163#define FIRST_PTY_LETTER 'z' 124#define FIRST_PTY_LETTER 'z'
164 125
165/* This sets the name of the master side of the PTY. */ 126/* This sets the name of the master side of the PTY. */
166
167#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx"); 127#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
168 128
169/* Push various streams modules onto a PTY channel. */ 129/* Push various streams modules onto a PTY channel. */
170
171#define SETUP_SLAVE_PTY \ 130#define SETUP_SLAVE_PTY \
172 if (ioctl (xforkin, I_PUSH, "ptem") == -1) \ 131 if (ioctl (xforkin, I_PUSH, "ptem") == -1) \
173 fatal ("ioctl I_PUSH ptem", errno); \ 132 fatal ("ioctl I_PUSH ptem", errno); \
@@ -176,8 +135,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
176 if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) \ 135 if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) \
177 fatal ("ioctl I_PUSH ttcompat", errno); 136 fatal ("ioctl I_PUSH ttcompat", errno);
178 137
179/* This definition was suggested for next release. 138/* This definition was suggested for next release. So give it a try. */
180 So give it a try. */
181#define HAVE_SOCKETS 139#define HAVE_SOCKETS
182 140
183/* arch-tag: 1a0ed909-5faa-434b-b7c3-9d86c63d53a6 141/* arch-tag: 1a0ed909-5faa-434b-b7c3-9d86c63d53a6
diff --git a/src/syntax.c b/src/syntax.c
index a80f047e43c..4741fa260d2 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -858,7 +858,7 @@ are listed in the documentation of `modify-syntax-entry'. */)
858 Lisp_Object character; 858 Lisp_Object character;
859{ 859{
860 int char_int; 860 int char_int;
861 CHECK_NUMBER (character); 861 CHECK_CHARACTER (character);
862 char_int = XINT (character); 862 char_int = XINT (character);
863 SETUP_BUFFER_SYNTAX_TABLE (); 863 SETUP_BUFFER_SYNTAX_TABLE ();
864 return make_number (syntax_code_spec[(int) SYNTAX (char_int)]); 864 return make_number (syntax_code_spec[(int) SYNTAX (char_int)]);
diff --git a/src/sysdep.c b/src/sysdep.c
index 506af23ef30..1e114655b4e 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -73,7 +73,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
73#include <errno.h> 73#include <errno.h>
74 74
75#ifdef HAVE_SETPGID 75#ifdef HAVE_SETPGID
76#if !defined (USG) || defined (BSD_PGRPS) 76#if !defined (USG)
77#undef setpgrp 77#undef setpgrp
78#define setpgrp setpgid 78#define setpgrp setpgid
79#endif 79#endif
@@ -419,7 +419,10 @@ wait_for_termination (pid)
419 else 419 else
420 sigpause (SIGEMPTYMASK); 420 sigpause (SIGEMPTYMASK);
421#else /* not BSD_SYSTEM, and not HPUX version >= 6 */ 421#else /* not BSD_SYSTEM, and not HPUX version >= 6 */
422#ifdef POSIX_SIGNALS /* would this work for GNU/Linux as well? */ 422#ifdef WINDOWSNT
423 wait (0);
424 break;
425#else /* not WINDOWSNT */
423 sigblock (sigmask (SIGCHLD)); 426 sigblock (sigmask (SIGCHLD));
424 errno = 0; 427 errno = 0;
425 if (kill (pid, 0) == -1 && errno == ESRCH) 428 if (kill (pid, 0) == -1 && errno == ESRCH)
@@ -429,29 +432,7 @@ wait_for_termination (pid)
429 } 432 }
430 433
431 sigsuspend (&empty_mask); 434 sigsuspend (&empty_mask);
432#else /* not POSIX_SIGNALS */
433#ifdef HAVE_SYSV_SIGPAUSE
434 sighold (SIGCHLD);
435 if (0 > kill (pid, 0))
436 {
437 sigrelse (SIGCHLD);
438 break;
439 }
440 sigpause (SIGCHLD);
441#else /* not HAVE_SYSV_SIGPAUSE */
442#ifdef WINDOWSNT
443 wait (0);
444 break;
445#else /* not WINDOWSNT */
446 if (0 > kill (pid, 0))
447 break;
448 /* Using sleep instead of pause avoids timing error.
449 If the inferior dies just before the sleep,
450 we lose just one second. */
451 sleep (1);
452#endif /* not WINDOWSNT */ 435#endif /* not WINDOWSNT */
453#endif /* not HAVE_SYSV_SIGPAUSE */
454#endif /* not POSIX_SIGNALS */
455#endif /* not BSD_SYSTEM, and not HPUX version >= 6 */ 436#endif /* not BSD_SYSTEM, and not HPUX version >= 6 */
456#else /* not subprocesses */ 437#else /* not subprocesses */
457 break; 438 break;
@@ -546,11 +527,6 @@ child_setup_tty (out)
546#endif /* not SIGNALS_VIA_CHARACTERS */ 527#endif /* not SIGNALS_VIA_CHARACTERS */
547 528
548#ifdef AIX 529#ifdef AIX
549/* AIX enhanced edit loses NULs, so disable it */
550#ifndef IBMR2AIX
551 s.main.c_line = 0;
552 s.main.c_iflag &= ~ASCEDIT;
553#endif
554 /* Also, PTY overloads NUL and BREAK. 530 /* Also, PTY overloads NUL and BREAK.
555 don't ignore break, but don't signal either, so it looks like NUL. */ 531 don't ignore break, but don't signal either, so it looks like NUL. */
556 s.main.c_iflag &= ~IGNBRK; 532 s.main.c_iflag &= ~IGNBRK;
@@ -883,65 +859,7 @@ unrequest_sigio ()
883#endif /* FASYNC */ 859#endif /* FASYNC */
884#endif /* F_SETFL */ 860#endif /* F_SETFL */
885#endif /* SIGIO */ 861#endif /* SIGIO */
886
887/* Saving and restoring the process group of Emacs's terminal. */
888
889#ifdef BSD_PGRPS
890
891/* The process group of which Emacs was a member when it initially
892 started.
893
894 If Emacs was in its own process group (i.e. inherited_pgroup ==
895 getpid ()), then we know we're running under a shell with job
896 control (Emacs would never be run as part of a pipeline).
897 Everything is fine.
898
899 If Emacs was not in its own process group, then we know we're
900 running under a shell (or a caller) that doesn't know how to
901 separate itself from Emacs (like sh). Emacs must be in its own
902 process group in order to receive SIGIO correctly. In this
903 situation, we put ourselves in our own pgroup, forcibly set the
904 tty's pgroup to our pgroup, and make sure to restore and reinstate
905 the tty's pgroup just like any other terminal setting. If
906 inherited_group was not the tty's pgroup, then we'll get a
907 SIGTTmumble when we try to change the tty's pgroup, and a CONT if
908 it goes foreground in the future, which is what should happen.
909
910 This variable is initialized in emacs.c. */
911int inherited_pgroup;
912
913/* Split off the foreground process group to Emacs alone. When we are
914 in the foreground, but not started in our own process group,
915 redirect the tty device handle FD to point to our own process
916 group. We need to be in our own process group to receive SIGIO
917 properly. */
918static void
919narrow_foreground_group (int fd)
920{
921 int me = getpid ();
922 862
923 setpgrp (0, inherited_pgroup);
924#if 0
925 /* XXX inherited_pgroup should not be zero here, but GTK seems to
926 mess this up. */
927 if (! inherited_pgroup)
928 abort (); /* Should not happen. */
929#endif
930 if (inherited_pgroup != me)
931 EMACS_SET_TTY_PGRP (fd, &me); /* XXX This only works on the controlling tty. */
932 setpgrp (0, me);
933}
934
935/* Set the tty to our original foreground group. */
936static void
937widen_foreground_group (int fd)
938{
939 if (inherited_pgroup != getpid ())
940 EMACS_SET_TTY_PGRP (fd, &inherited_pgroup);
941 setpgrp (0, inherited_pgroup);
942}
943
944#endif /* BSD_PGRPS */
945 863
946/* Getting and setting emacs_tty structures. */ 864/* Getting and setting emacs_tty structures. */
947 865
@@ -1126,15 +1044,6 @@ init_sys_modes (tty_out)
1126 if (!tty_out->output) 1044 if (!tty_out->output)
1127 return; /* The tty is suspended. */ 1045 return; /* The tty is suspended. */
1128 1046
1129#ifdef BSD_PGRPS
1130#if 0
1131 /* read_socket_hook is not global anymore. I think doing this
1132 unconditionally will not cause any problems. */
1133 if (! read_socket_hook && EQ (Vinitial_window_system, Qnil))
1134#endif
1135 narrow_foreground_group (fileno (tty_out->input));
1136#endif
1137
1138 if (! tty_out->old_tty) 1047 if (! tty_out->old_tty)
1139 tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); 1048 tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty));
1140 1049
@@ -1258,16 +1167,10 @@ init_sys_modes (tty_out)
1258#endif /* mips or HAVE_TCATTR */ 1167#endif /* mips or HAVE_TCATTR */
1259 1168
1260#ifdef AIX 1169#ifdef AIX
1261#ifndef IBMR2AIX
1262 /* AIX enhanced edit loses NULs, so disable it. */
1263 tty.main.c_line = 0;
1264 tty.main.c_iflag &= ~ASCEDIT;
1265#else
1266 tty.main.c_cc[VSTRT] = CDISABLE; 1170 tty.main.c_cc[VSTRT] = CDISABLE;
1267 tty.main.c_cc[VSTOP] = CDISABLE; 1171 tty.main.c_cc[VSTOP] = CDISABLE;
1268 tty.main.c_cc[VSUSP] = CDISABLE; 1172 tty.main.c_cc[VSUSP] = CDISABLE;
1269 tty.main.c_cc[VDSUSP] = CDISABLE; 1173 tty.main.c_cc[VDSUSP] = CDISABLE;
1270#endif /* IBMR2AIX */
1271 if (tty_out->flow_control) 1174 if (tty_out->flow_control)
1272 { 1175 {
1273#ifdef VSTART 1176#ifdef VSTART
@@ -1590,9 +1493,6 @@ reset_sys_modes (tty_out)
1590 dos_ttcooked (); 1493 dos_ttcooked ();
1591#endif 1494#endif
1592 1495
1593#ifdef BSD_PGRPS
1594 widen_foreground_group (fileno (tty_out->input));
1595#endif
1596} 1496}
1597 1497
1598#ifdef HAVE_PTYS 1498#ifdef HAVE_PTYS
@@ -2101,10 +2001,10 @@ read_input_waiting ()
2101/* POSIX signals support - DJB */ 2001/* POSIX signals support - DJB */
2102/* Anyone with POSIX signals should have ANSI C declarations */ 2002/* Anyone with POSIX signals should have ANSI C declarations */
2103 2003
2104#ifdef POSIX_SIGNALS
2105
2106sigset_t empty_mask, full_mask; 2004sigset_t empty_mask, full_mask;
2107 2005
2006#ifndef WINDOWSNT
2007
2108signal_handler_t 2008signal_handler_t
2109sys_signal (int signal_number, signal_handler_t action) 2009sys_signal (int signal_number, signal_handler_t action)
2110{ 2010{
@@ -2133,6 +2033,8 @@ sys_signal (int signal_number, signal_handler_t action)
2133 return (old_action.sa_handler); 2033 return (old_action.sa_handler);
2134} 2034}
2135 2035
2036#endif /* WINDOWSNT */
2037
2136#ifndef __GNUC__ 2038#ifndef __GNUC__
2137/* If we're compiling with GCC, we don't need this function, since it 2039/* If we're compiling with GCC, we don't need this function, since it
2138 can be written as a macro. */ 2040 can be written as a macro. */
@@ -2175,7 +2077,6 @@ sys_sigsetmask (sigset_t new_mask)
2175 return (old_mask); 2077 return (old_mask);
2176} 2078}
2177 2079
2178#endif /* POSIX_SIGNALS */
2179 2080
2180#if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST 2081#if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST
2181static char *my_sys_siglist[NSIG]; 2082static char *my_sys_siglist[NSIG];
@@ -2188,10 +2089,8 @@ static char *my_sys_siglist[NSIG];
2188void 2089void
2189init_signals () 2090init_signals ()
2190{ 2091{
2191#ifdef POSIX_SIGNALS
2192 sigemptyset (&empty_mask); 2092 sigemptyset (&empty_mask);
2193 sigfillset (&full_mask); 2093 sigfillset (&full_mask);
2194#endif
2195 2094
2196#if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST 2095#if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST
2197 if (! initialized) 2096 if (! initialized)
@@ -2709,13 +2608,6 @@ closedir (DIR *dirp /* stream from opendir */)
2709 int rtnval; 2608 int rtnval;
2710 2609
2711 rtnval = emacs_close (dirp->dd_fd); 2610 rtnval = emacs_close (dirp->dd_fd);
2712
2713 /* Some systems (like Solaris) allocate the buffer and the DIR all
2714 in one block. Why in the world are we freeing this ourselves
2715 anyway? */
2716#if ! defined (SOLARIS2)
2717 xfree ((char *) dirp->dd_buf); /* directory block defined in <dirent.h> */
2718#endif
2719 xfree ((char *) dirp); 2611 xfree ((char *) dirp);
2720 2612
2721 return rtnval; 2613 return rtnval;
diff --git a/src/syssignal.h b/src/syssignal.h
index f435d338594..9a145b78cb1 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -30,8 +30,6 @@ extern void init_signals P_ ((void));
30extern pthread_t main_thread; 30extern pthread_t main_thread;
31#endif 31#endif
32 32
33#ifdef POSIX_SIGNALS
34
35/* Don't #include <signal.h>. That header should always be #included 33/* Don't #include <signal.h>. That header should always be #included
36 before "config.h", because some configuration files (like s/hpux.h) 34 before "config.h", because some configuration files (like s/hpux.h)
37 indicate that SIGIO doesn't work by #undef-ing SIGIO. If this file 35 indicate that SIGIO doesn't work by #undef-ing SIGIO. If this file
@@ -87,15 +85,6 @@ sigset_t sys_sigsetmask P_ ((sigset_t new_mask));
87 85
88#define sys_sigdel(MASK,SIG) sigdelset (&MASK,SIG) 86#define sys_sigdel(MASK,SIG) sigdelset (&MASK,SIG)
89 87
90#else /* ! defined (POSIX_SIGNALS) */
91
92#ifndef sigunblock
93#define sigunblock(SIG) \
94{ SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); }
95#endif
96
97#endif /* ! defined (POSIX_SIGNALS) */
98
99#ifndef SIGMASKTYPE 88#ifndef SIGMASKTYPE
100#define SIGMASKTYPE int 89#define SIGMASKTYPE int
101#endif 90#endif
diff --git a/src/systty.h b/src/systty.h
index 057f58f6064..fcc6cf81e51 100644
--- a/src/systty.h
+++ b/src/systty.h
@@ -51,11 +51,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
51#include <termios.h> 51#include <termios.h>
52#endif 52#endif
53 53
54#ifdef NEED_BSDTTY 54#ifdef HPUX
55#include <sys/bsdtty.h> 55#include <sys/bsdtty.h>
56#endif
57
58#if defined (HPUX) && defined (HAVE_PTYS)
59#include <sys/ptyio.h> 56#include <sys/ptyio.h>
60#endif 57#endif
61 58
@@ -63,7 +60,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
63#include <sys/pty.h> 60#include <sys/pty.h>
64#endif /* AIX */ 61#endif /* AIX */
65 62
66#if (defined (POSIX) || defined (NEED_UNISTD_H)) && defined (HAVE_UNISTD_H) 63#ifdef HAVE_UNISTD_H
67#include <unistd.h> 64#include <unistd.h>
68#endif 65#endif
69 66
diff --git a/src/term.c b/src/term.c
index df7dc9ee464..fad6e3c80d7 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1589,7 +1589,6 @@ append_glyph (it)
1589 } 1589 }
1590} 1590}
1591 1591
1592
1593/* Produce glyphs for the display element described by IT. *IT 1592/* Produce glyphs for the display element described by IT. *IT
1594 specifies what we want to produce a glyph for (character, image, ...), 1593 specifies what we want to produce a glyph for (character, image, ...),
1595 and where in the glyph matrix we currently are (glyph row and hpos). 1594 and where in the glyph matrix we currently are (glyph row and hpos).
@@ -1808,6 +1807,17 @@ append_composite_glyph (it)
1808 glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area]; 1807 glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area];
1809 if (glyph < it->glyph_row->glyphs[1 + it->area]) 1808 if (glyph < it->glyph_row->glyphs[1 + it->area])
1810 { 1809 {
1810 /* If the glyph row is reversed, we need to prepend the glyph
1811 rather than append it. */
1812 if (it->glyph_row->reversed_p && it->area == TEXT_AREA)
1813 {
1814 struct glyph *g;
1815
1816 /* Make room for the new glyph. */
1817 for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--)
1818 g[1] = *g;
1819 glyph = it->glyph_row->glyphs[it->area];
1820 }
1811 glyph->type = COMPOSITE_GLYPH; 1821 glyph->type = COMPOSITE_GLYPH;
1812 glyph->pixel_width = it->pixel_width; 1822 glyph->pixel_width = it->pixel_width;
1813 glyph->u.cmp.id = it->cmp_it.id; 1823 glyph->u.cmp.id = it->cmp_it.id;
@@ -1828,6 +1838,18 @@ append_composite_glyph (it)
1828 glyph->padding_p = 0; 1838 glyph->padding_p = 0;
1829 glyph->charpos = CHARPOS (it->position); 1839 glyph->charpos = CHARPOS (it->position);
1830 glyph->object = it->object; 1840 glyph->object = it->object;
1841 if (it->bidi_p)
1842 {
1843 glyph->resolved_level = it->bidi_it.resolved_level;
1844 if ((it->bidi_it.type & 7) != it->bidi_it.type)
1845 abort ();
1846 glyph->bidi_type = it->bidi_it.type;
1847 }
1848 else
1849 {
1850 glyph->resolved_level = 0;
1851 glyph->bidi_type = UNKNOWN_BT;
1852 }
1831 1853
1832 ++it->glyph_row->used[it->area]; 1854 ++it->glyph_row->used[it->area];
1833 ++glyph; 1855 ++glyph;
@@ -1889,12 +1911,16 @@ produce_special_glyphs (it, what)
1889 1911
1890 if (what == IT_CONTINUATION) 1912 if (what == IT_CONTINUATION)
1891 { 1913 {
1892 /* Continuation glyph. */ 1914 /* Continuation glyph. For R2L lines, we mirror it by hand. */
1893 SET_GLYPH_FROM_CHAR (glyph, '\\'); 1915 if (it->bidi_it.paragraph_dir == R2L)
1916 SET_GLYPH_FROM_CHAR (glyph, '/');
1917 else
1918 SET_GLYPH_FROM_CHAR (glyph, '\\');
1894 if (it->dp 1919 if (it->dp
1895 && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc)) 1920 && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc))
1896 && GLYPH_CODE_CHAR_VALID_P (gc)) 1921 && GLYPH_CODE_CHAR_VALID_P (gc))
1897 { 1922 {
1923 /* FIXME: Should we mirror GC for R2L lines? */
1898 SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); 1924 SET_GLYPH_FROM_GLYPH_CODE (glyph, gc);
1899 spec_glyph_lookup_face (XWINDOW (it->window), &glyph); 1925 spec_glyph_lookup_face (XWINDOW (it->window), &glyph);
1900 } 1926 }
@@ -1907,6 +1933,7 @@ produce_special_glyphs (it, what)
1907 && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc)) 1933 && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc))
1908 && GLYPH_CODE_CHAR_VALID_P (gc)) 1934 && GLYPH_CODE_CHAR_VALID_P (gc))
1909 { 1935 {
1936 /* FIXME: Should we mirror GC for R2L lines? */
1910 SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); 1937 SET_GLYPH_FROM_GLYPH_CODE (glyph, gc);
1911 spec_glyph_lookup_face (XWINDOW (it->window), &glyph); 1938 spec_glyph_lookup_face (XWINDOW (it->window), &glyph);
1912 } 1939 }
@@ -2244,7 +2271,7 @@ set_tty_color_mode (tty, f)
2244 struct tty_display_info *tty; 2271 struct tty_display_info *tty;
2245 struct frame *f; 2272 struct frame *f;
2246{ 2273{
2247 Lisp_Object tem, val, color_mode_spec; 2274 Lisp_Object tem, val;
2248 Lisp_Object color_mode; 2275 Lisp_Object color_mode;
2249 int mode; 2276 int mode;
2250 extern Lisp_Object Qtty_color_mode; 2277 extern Lisp_Object Qtty_color_mode;
@@ -2256,12 +2283,13 @@ set_tty_color_mode (tty, f)
2256 2283
2257 if (INTEGERP (val)) 2284 if (INTEGERP (val))
2258 color_mode = val; 2285 color_mode = val;
2259 else 2286 else if (SYMBOLP (tty_color_mode_alist))
2260 { 2287 {
2261 tem = (NILP (tty_color_mode_alist) ? Qnil 2288 tem = Fassq (val, Fsymbol_value (tty_color_mode_alist));
2262 : Fassq (val, XSYMBOL (tty_color_mode_alist)->value));
2263 color_mode = CONSP (tem) ? XCDR (tem) : Qnil; 2289 color_mode = CONSP (tem) ? XCDR (tem) : Qnil;
2264 } 2290 }
2291 else
2292 color_mode = Qnil;
2265 2293
2266 mode = INTEGERP (color_mode) ? XINT (color_mode) : 0; 2294 mode = INTEGERP (color_mode) ? XINT (color_mode) : 0;
2267 2295
@@ -3351,7 +3379,7 @@ dissociate_if_controlling_tty (int fd)
3351 EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */ 3379 EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */
3352 if (pgid != -1) 3380 if (pgid != -1)
3353 { 3381 {
3354#if defined (USG) && !defined (BSD_PGRPS) 3382#if defined (USG)
3355 setpgrp (); 3383 setpgrp ();
3356 no_controlling_tty = 1; 3384 no_controlling_tty = 1;
3357#elif defined (CYGWIN) 3385#elif defined (CYGWIN)
diff --git a/src/w16select.c b/src/w16select.c
index c6a84e46a60..9ebf6de6250 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -685,8 +685,8 @@ and t is the same as `SECONDARY'. */)
685 into the clipboard if we run under Windows, so we cannot check 685 into the clipboard if we run under Windows, so we cannot check
686 the clipboard alone.) */ 686 the clipboard alone.) */
687 if ((EQ (selection, Qnil) || EQ (selection, QPRIMARY)) 687 if ((EQ (selection, Qnil) || EQ (selection, QPRIMARY))
688 && ! NILP (SYMBOL_VALUE (Fintern_soft (build_string ("kill-ring"), 688 && ! NILP (Fsymbol_value (Fintern_soft (build_string ("kill-ring"),
689 Qnil)))) 689 Qnil))))
690 return Qt; 690 return Qt;
691 691
692 if (EQ (selection, QCLIPBOARD)) 692 if (EQ (selection, QCLIPBOARD))
diff --git a/src/w32.c b/src/w32.c
index 2ff344abd65..0f2d8b54e6b 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1482,6 +1482,30 @@ sigunblock (int sig)
1482} 1482}
1483 1483
1484int 1484int
1485sigemptyset (sigset_t *set)
1486{
1487 return 0;
1488}
1489
1490int
1491sigaddset (sigset_t *set, int signo)
1492{
1493 return 0;
1494}
1495
1496int
1497sigfillset (sigset_t *set)
1498{
1499 return 0;
1500}
1501
1502int
1503sigprocmask (int how, const sigset_t *set, sigset_t *oset)
1504{
1505 return 0;
1506}
1507
1508int
1485setpgrp (int pid, int gid) 1509setpgrp (int pid, int gid)
1486{ 1510{
1487 return 0; 1511 return 0;
diff --git a/src/w32console.c b/src/w32console.c
index c10f2181e7d..dcebe466e32 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -488,6 +488,62 @@ w32con_set_terminal_window (struct frame *f, int size)
488} 488}
489 489
490/*********************************************************************** 490/***********************************************************************
491 stubs from termcap.c
492 ***********************************************************************/
493
494void
495sys_tputs (char *str, int nlines, int (*outfun)())
496{
497}
498
499char *
500sys_tgetstr (char *cap, char **area)
501{
502 return NULL;
503}
504
505
506/***********************************************************************
507 stubs from cm.c
508 ***********************************************************************/
509
510struct tty_display_info *current_tty = NULL;
511int cost = 0;
512
513int
514evalcost (char c)
515{
516 return c;
517}
518
519int
520cmputc (char c)
521{
522 return c;
523}
524
525void
526cmcheckmagic (struct tty_display_info *tty)
527{
528}
529
530void
531cmcostinit (struct tty_display_info *tty)
532{
533}
534
535void
536cmgoto (struct tty_display_info *tty, int row, int col)
537{
538}
539
540void
541Wcm_clear (struct tty_display_info *tty)
542{
543}
544
545
546/***********************************************************************
491 Faces 547 Faces
492 ***********************************************************************/ 548 ***********************************************************************/
493 549
diff --git a/src/w32fns.c b/src/w32fns.c
index 795e7208569..bc310da0d2f 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -47,6 +47,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
47#include "systime.h" 47#include "systime.h"
48#include "termhooks.h" 48#include "termhooks.h"
49#include "w32heap.h" 49#include "w32heap.h"
50#include "w32.h"
50 51
51#include "bitmaps/gray.xbm" 52#include "bitmaps/gray.xbm"
52 53
@@ -6333,6 +6334,7 @@ an integer representing a ShowWindow flag:
6333 Lisp_Object operation, document, parameters, show_flag; 6334 Lisp_Object operation, document, parameters, show_flag;
6334{ 6335{
6335 Lisp_Object current_dir; 6336 Lisp_Object current_dir;
6337 char *errstr;
6336 6338
6337 CHECK_STRING (document); 6339 CHECK_STRING (document);
6338 6340
@@ -6353,7 +6355,17 @@ an integer representing a ShowWindow flag:
6353 XINT (show_flag) : SW_SHOWDEFAULT)) 6355 XINT (show_flag) : SW_SHOWDEFAULT))
6354 > 32) 6356 > 32)
6355 return Qt; 6357 return Qt;
6356 error ("ShellExecute failed: %s", w32_strerror (0)); 6358 errstr = w32_strerror (0);
6359 /* The error string might be encoded in the locale's encoding. */
6360 if (!NILP (Vlocale_coding_system))
6361 {
6362 Lisp_Object decoded =
6363 code_convert_string_norecord (make_unibyte_string (errstr,
6364 strlen (errstr)),
6365 Vlocale_coding_system, 0);
6366 errstr = (char *)SDATA (decoded);
6367 }
6368 error ("ShellExecute failed: %s", errstr);
6357} 6369}
6358 6370
6359/* Lookup virtual keycode from string representing the name of a 6371/* Lookup virtual keycode from string representing the name of a
diff --git a/src/w32term.c b/src/w32term.c
index 7222e26efd2..0b71b7e02b7 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5136,10 +5136,12 @@ w32_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, act
5136 } 5136 }
5137 5137
5138 if (glyph_row->exact_window_width_line_p 5138 if (glyph_row->exact_window_width_line_p
5139 && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA]) 5139 && (glyph_row->reversed_p
5140 ? (w->phys_cursor.hpos < 0)
5141 : (w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])))
5140 { 5142 {
5141 glyph_row->cursor_in_fringe_p = 1; 5143 glyph_row->cursor_in_fringe_p = 1;
5142 draw_fringe_bitmap (w, glyph_row, 0); 5144 draw_fringe_bitmap (w, glyph_row, glyph_row->reversed_p);
5143 return; 5145 return;
5144 } 5146 }
5145 5147
diff --git a/src/window.c b/src/window.c
index b9683fbbca8..882f76d9758 100644
--- a/src/window.c
+++ b/src/window.c
@@ -54,7 +54,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
54 54
55Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; 55Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
56Lisp_Object Qdisplay_buffer; 56Lisp_Object Qdisplay_buffer;
57Lisp_Object Qscroll_up, Qscroll_down; 57Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
58Lisp_Object Qwindow_size_fixed; 58Lisp_Object Qwindow_size_fixed;
59 59
60extern Lisp_Object Qleft_margin, Qright_margin; 60extern Lisp_Object Qleft_margin, Qright_margin;
@@ -168,10 +168,6 @@ static Lisp_Object Vwindow_configuration_change_hook;
168 168
169Lisp_Object Vscroll_preserve_screen_position; 169Lisp_Object Vscroll_preserve_screen_position;
170 170
171/* List of commands affected by `Vscroll_preserve_screen_position'. */
172
173Lisp_Object Vscroll_preserve_screen_position_commands;
174
175/* Non-nil means that text is inserted before window's markers. */ 171/* Non-nil means that text is inserted before window's markers. */
176 172
177Lisp_Object Vwindow_point_insertion_type; 173Lisp_Object Vwindow_point_insertion_type;
@@ -4946,12 +4942,13 @@ window_scroll_pixel_based (window, n, whole, noerror)
4946 if (!NILP (Vscroll_preserve_screen_position)) 4942 if (!NILP (Vscroll_preserve_screen_position))
4947 { 4943 {
4948 /* We preserve the goal pixel coordinate across consecutive 4944 /* We preserve the goal pixel coordinate across consecutive
4949 calls to scroll-up or scroll-down. This avoids the 4945 calls to scroll-up, scroll-down and other commands that
4946 have the `scroll-command' property. This avoids the
4950 possibility of point becoming "stuck" on a tall line when 4947 possibility of point becoming "stuck" on a tall line when
4951 scrolling by one line. */ 4948 scrolling by one line. */
4952 if (window_scroll_pixel_based_preserve_y < 0 4949 if (window_scroll_pixel_based_preserve_y < 0
4953 || NILP (Fmemq (current_kboard->Vlast_command, 4950 || !SYMBOLP (current_kboard->Vlast_command)
4954 Vscroll_preserve_screen_position_commands))) 4951 || NILP (Fget (current_kboard->Vlast_command, Qscroll_command)))
4955 { 4952 {
4956 start_display (&it, w, start); 4953 start_display (&it, w, start);
4957 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); 4954 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
@@ -5211,8 +5208,8 @@ window_scroll_line_based (window, n, whole, noerror)
5211 if (!NILP (Vscroll_preserve_screen_position)) 5208 if (!NILP (Vscroll_preserve_screen_position))
5212 { 5209 {
5213 if (window_scroll_preserve_vpos <= 0 5210 if (window_scroll_preserve_vpos <= 0
5214 || NILP (Fmemq (current_kboard->Vlast_command, 5211 || !SYMBOLP (current_kboard->Vlast_command)
5215 Vscroll_preserve_screen_position_commands))) 5212 || NILP (Fget (current_kboard->Vlast_command, Qscroll_command)))
5216 { 5213 {
5217 struct position posit 5214 struct position posit
5218 = *compute_motion (startpos, 0, 0, 0, 5215 = *compute_motion (startpos, 0, 0, 0,
@@ -7180,6 +7177,12 @@ syms_of_window ()
7180 Qscroll_down = intern_c_string ("scroll-down"); 7177 Qscroll_down = intern_c_string ("scroll-down");
7181 staticpro (&Qscroll_down); 7178 staticpro (&Qscroll_down);
7182 7179
7180 Qscroll_command = intern_c_string ("scroll-command");
7181 staticpro (&Qscroll_command);
7182
7183 Fput (Qscroll_up, Qscroll_command, Qt);
7184 Fput (Qscroll_down, Qscroll_command, Qt);
7185
7183 Qwindow_size_fixed = intern_c_string ("window-size-fixed"); 7186 Qwindow_size_fixed = intern_c_string ("window-size-fixed");
7184 staticpro (&Qwindow_size_fixed); 7187 staticpro (&Qwindow_size_fixed);
7185 Fset (Qwindow_size_fixed, Qnil); 7188 Fset (Qwindow_size_fixed, Qnil);
@@ -7270,18 +7273,10 @@ A value of t means point keeps its screen position if the scroll
7270command moved it vertically out of the window, e.g. when scrolling 7273command moved it vertically out of the window, e.g. when scrolling
7271by full screens. 7274by full screens.
7272Any other value means point always keeps its screen position. 7275Any other value means point always keeps its screen position.
7273Scroll commands are defined by the variable 7276Scroll commands should have the `scroll-command' property
7274`scroll-preserve-screen-position-commands'. */); 7277on their symbols to be controlled by this variable. */);
7275 Vscroll_preserve_screen_position = Qnil; 7278 Vscroll_preserve_screen_position = Qnil;
7276 7279
7277 DEFVAR_LISP ("scroll-preserve-screen-position-commands",
7278 &Vscroll_preserve_screen_position_commands,
7279 doc: /* A list of commands whose scrolling should keep screen position unchanged.
7280This list defines the names of scroll commands affected by the variable
7281`scroll-preserve-screen-position'. */);
7282 Vscroll_preserve_screen_position_commands =
7283 Fcons (Qscroll_down, Fcons (Qscroll_up, Qnil));
7284
7285 DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type, 7280 DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type,
7286 doc: /* Type of marker to use for `window-point'. */); 7281 doc: /* Type of marker to use for `window-point'. */);
7287 Vwindow_point_insertion_type = Qnil; 7282 Vwindow_point_insertion_type = Qnil;
diff --git a/src/xdisp.c b/src/xdisp.c
index 902651dcc44..cd8ad7bec82 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -80,7 +80,39 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
80 You will find a lot of redisplay optimizations when you start 80 You will find a lot of redisplay optimizations when you start
81 looking at the innards of redisplay. The overall goal of all these 81 looking at the innards of redisplay. The overall goal of all these
82 optimizations is to make redisplay fast because it is done 82 optimizations is to make redisplay fast because it is done
83 frequently. 83 frequently. Some of these optimizations are implemented by the
84 following functions:
85
86 . try_cursor_movement
87
88 This function tries to update the display if the text in the
89 window did not change and did not scroll, only point moved, and
90 it did not move off the displayed portion of the text.
91
92 . try_window_reusing_current_matrix
93
94 This function reuses the current matrix of a window when text
95 has not changed, but the window start changed (e.g., due to
96 scrolling).
97
98 . try_window_id
99
100 This function attempts to redisplay a window by reusing parts of
101 its existing display. It finds and reuses the part that was not
102 changed, and redraws the rest.
103
104 . try_window
105
106 This function performs the full redisplay of a single window
107 assuming that its fonts were not changed and that the cursor
108 will not end up in the scroll margins. (Loading fonts requires
109 re-adjustment of dimensions of glyph matrices, which makes this
110 method impossible to use.)
111
112 These optimizations are tried in sequence (some can be skipped if
113 it is known that they are not applicable). If none of the
114 optimizations were successful, redisplay calls redisplay_windows,
115 which performs a full redisplay of all windows.
84 116
85 Desired matrices. 117 Desired matrices.
86 118
@@ -112,13 +144,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
112 see in dispextern.h. 144 see in dispextern.h.
113 145
114 Glyphs in a desired matrix are normally constructed in a loop 146 Glyphs in a desired matrix are normally constructed in a loop
115 calling get_next_display_element and then produce_glyphs. The call 147 calling get_next_display_element and then PRODUCE_GLYPHS. The call
116 to produce_glyphs will fill the iterator structure with pixel 148 to PRODUCE_GLYPHS will fill the iterator structure with pixel
117 information about the element being displayed and at the same time 149 information about the element being displayed and at the same time
118 produce glyphs for it. If the display element fits on the line 150 produce glyphs for it. If the display element fits on the line
119 being displayed, set_iterator_to_next is called next, otherwise the 151 being displayed, set_iterator_to_next is called next, otherwise the
120 glyphs produced are discarded. 152 glyphs produced are discarded. The function display_line is the
121 153 workhorse of filling glyph rows in the desired matrix with glyphs.
154 In addition to producing glyphs, it also handles line truncation
155 and continuation, word wrap, and cursor positioning (for the
156 latter, see also set_cursor_from_row).
122 157
123 Frame matrices. 158 Frame matrices.
124 159
@@ -139,7 +174,50 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
139 wanted to have without having to move many bytes around. To be 174 wanted to have without having to move many bytes around. To be
140 honest, there is a little bit more done, but not much more. If you 175 honest, there is a little bit more done, but not much more. If you
141 plan to extend that code, take a look at dispnew.c. The function 176 plan to extend that code, take a look at dispnew.c. The function
142 build_frame_matrix is a good starting point. */ 177 build_frame_matrix is a good starting point.
178
179 Bidirectional display.
180
181 Bidirectional display adds quite some hair to this already complex
182 design. The good news are that a large portion of that hairy stuff
183 is hidden in bidi.c behind only 3 interfaces. bidi.c implements a
184 reordering engine which is called by set_iterator_to_next and
185 returns the next character to display in the visual order. See
186 commentary on bidi.c for more details. As far as redisplay is
187 concerned, the effect of calling bidi_get_next_char_visually, the
188 main interface of the reordering engine, is that the iterator gets
189 magically placed on the buffer or string position that is to be
190 displayed next. In other words, a linear iteration through the
191 buffer/string is replaced with a non-linear one. All the rest of
192 the redisplay is oblivious to the bidi reordering.
193
194 Well, almost oblivious---there are still complications, most of
195 them due to the fact that buffer and string positions no longer
196 change monotonously with glyph indices in a glyph row. Moreover,
197 for continued lines, the buffer positions may not even be
198 monotonously changing with vertical positions. Also, accounting
199 for face changes, overlays, etc. becomes more complex because
200 non-linear iteration could potentially skip many positions with
201 changes, and then cross them again on the way back...
202
203 One other prominent effect of bidirectional display is that some
204 paragraphs of text need to be displayed starting at the right
205 margin of the window---the so-called right-to-left, or R2L
206 paragraphs. R2L paragraphs are displayed with R2L glyph rows,
207 which have their reversed_p flag set. The bidi reordering engine
208 produces characters in such rows starting from the character which
209 should be the rightmost on display. PRODUCE_GLYPHS then reverses
210 the order, when it fills up the glyph row whose reversed_p flag is
211 set, by prepending each new glyph to what is already there, instead
212 of appending it. When the glyph row is complete, the function
213 extend_face_to_end_of_line fills the empty space to the left of the
214 leftmost character with special glyphs, which will display as,
215 well, empty. On text terminals, these special glyphs are simply
216 blank characters. On graphics terminals, there's a single stretch
217 glyph with suitably computed width. Both the blanks and the
218 stretch glyph are given the face of the background of the line.
219 This way, the terminal-specific back-end can still draw the glyphs
220 left to right, even for R2L lines. */
143 221
144#include <config.h> 222#include <config.h>
145#include <stdio.h> 223#include <stdio.h>
@@ -279,6 +357,14 @@ EMACS_INT tool_bar_button_relief;
279 357
280Lisp_Object Vauto_resize_tool_bars; 358Lisp_Object Vauto_resize_tool_bars;
281 359
360/* Type of tool bar. Can be symbols image, text, both or both-hroiz. */
361
362Lisp_Object Vtool_bar_style;
363
364/* Maximum number of characters a label can have to be shown. */
365
366EMACS_INT tool_bar_max_label_size;
367
282/* Non-zero means draw block and hollow cursor as wide as the glyph 368/* Non-zero means draw block and hollow cursor as wide as the glyph
283 under it. For example, if a block cursor is over a tab, it will be 369 under it. For example, if a block cursor is over a tab, it will be
284 drawn as wide as that tab on the display. */ 370 drawn as wide as that tab on the display. */
@@ -326,12 +412,14 @@ extern Lisp_Object Voverflow_newline_into_fringe;
326/* Test if overflow newline into fringe. Called with iterator IT 412/* Test if overflow newline into fringe. Called with iterator IT
327 at or past right window margin, and with IT->current_x set. */ 413 at or past right window margin, and with IT->current_x set. */
328 414
329#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) \ 415#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(IT) \
330 (!NILP (Voverflow_newline_into_fringe) \ 416 (!NILP (Voverflow_newline_into_fringe) \
331 && FRAME_WINDOW_P (it->f) \ 417 && FRAME_WINDOW_P ((IT)->f) \
332 && WINDOW_RIGHT_FRINGE_WIDTH (it->w) > 0 \ 418 && ((IT)->bidi_it.paragraph_dir == R2L \
333 && it->current_x == it->last_visible_x \ 419 ? (WINDOW_LEFT_FRINGE_WIDTH ((IT)->w) > 0) \
334 && it->line_wrap != WORD_WRAP) 420 : (WINDOW_RIGHT_FRINGE_WIDTH ((IT)->w) > 0)) \
421 && (IT)->current_x == (IT)->last_visible_x \
422 && (IT)->line_wrap != WORD_WRAP)
335 423
336#else /* !HAVE_WINDOW_SYSTEM */ 424#else /* !HAVE_WINDOW_SYSTEM */
337#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) 0 425#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) 0
@@ -362,7 +450,7 @@ Lisp_Object Qescape_glyph;
362Lisp_Object Qnobreak_space; 450Lisp_Object Qnobreak_space;
363 451
364/* The symbol `image' which is the car of the lists used to represent 452/* The symbol `image' which is the car of the lists used to represent
365 images in Lisp. */ 453 images in Lisp. Also a tool bar style. */
366 454
367Lisp_Object Qimage; 455Lisp_Object Qimage;
368 456
@@ -370,6 +458,9 @@ Lisp_Object Qimage;
370Lisp_Object QCmap, QCpointer; 458Lisp_Object QCmap, QCpointer;
371Lisp_Object Qrect, Qcircle, Qpoly; 459Lisp_Object Qrect, Qcircle, Qpoly;
372 460
461/* Tool bar styles */
462Lisp_Object Qtext, Qboth, Qboth_horiz;
463
373/* Non-zero means print newline to stdout before next mini-buffer 464/* Non-zero means print newline to stdout before next mini-buffer
374 message. */ 465 message. */
375 466
@@ -999,6 +1090,8 @@ static void display_tool_bar_line P_ ((struct it *, int));
999static void notice_overwritten_cursor P_ ((struct window *, 1090static void notice_overwritten_cursor P_ ((struct window *,
1000 enum glyph_row_area, 1091 enum glyph_row_area,
1001 int, int, int, int)); 1092 int, int, int, int));
1093static void append_stretch_glyph P_ ((struct it *, Lisp_Object,
1094 int, int, int));
1002 1095
1003 1096
1004 1097
@@ -2358,7 +2451,7 @@ safe_call (nargs, args)
2358 specbind (Qinhibit_redisplay, Qt); 2451 specbind (Qinhibit_redisplay, Qt);
2359 /* Use Qt to ensure debugger does not run, 2452 /* Use Qt to ensure debugger does not run,
2360 so there is no possibility of wanting to redisplay. */ 2453 so there is no possibility of wanting to redisplay. */
2361 val = internal_condition_case_2 (Ffuncall, nargs, args, Qt, 2454 val = internal_condition_case_n (Ffuncall, nargs, args, Qt,
2362 safe_eval_handler); 2455 safe_eval_handler);
2363 UNGCPRO; 2456 UNGCPRO;
2364 val = unbind_to (count, val); 2457 val = unbind_to (count, val);
@@ -2605,8 +2698,12 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
2605 /* Are multibyte characters enabled in current_buffer? */ 2698 /* Are multibyte characters enabled in current_buffer? */
2606 it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters); 2699 it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
2607 2700
2608 /* Do we need to reorder bidirectional text? */ 2701 /* Do we need to reorder bidirectional text? Not if this is a
2609 it->bidi_p = !NILP (current_buffer->bidi_display_reordering); 2702 unibyte buffer: by definition, none of the single-byte characters
2703 are strong R2L, so no reordering is needed. And bidi.c doesn't
2704 support unibyte buffers anyway. */
2705 it->bidi_p
2706 = !NILP (current_buffer->bidi_display_reordering) && it->multibyte_p;
2610 2707
2611 /* Non-zero if we should highlight the region. */ 2708 /* Non-zero if we should highlight the region. */
2612 highlight_region_p 2709 highlight_region_p
@@ -5166,6 +5263,33 @@ push_it (it)
5166 ++it->sp; 5263 ++it->sp;
5167} 5264}
5168 5265
5266static void
5267iterate_out_of_display_property (it)
5268 struct it *it;
5269{
5270 /* Maybe initialize paragraph direction. If we are at the beginning
5271 of a new paragraph, next_element_from_buffer may not have a
5272 chance to do that. */
5273 if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV)
5274 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
5275 /* prev_stop can be zero, so check against BEGV as well. */
5276 while (it->bidi_it.charpos >= BEGV
5277 && it->prev_stop <= it->bidi_it.charpos
5278 && it->bidi_it.charpos < CHARPOS (it->position))
5279 bidi_get_next_char_visually (&it->bidi_it);
5280 /* Record the stop_pos we just crossed, for when we cross it
5281 back, maybe. */
5282 if (it->bidi_it.charpos > CHARPOS (it->position))
5283 it->prev_stop = CHARPOS (it->position);
5284 /* If we ended up not where pop_it put us, resync IT's
5285 positional members with the bidi iterator. */
5286 if (it->bidi_it.charpos != CHARPOS (it->position))
5287 {
5288 SET_TEXT_POS (it->position,
5289 it->bidi_it.charpos, it->bidi_it.bytepos);
5290 it->current.pos = it->position;
5291 }
5292}
5169 5293
5170/* Restore IT's settings from IT->stack. Called, for example, when no 5294/* Restore IT's settings from IT->stack. Called, for example, when no
5171 more overlay strings must be processed, and we return to delivering 5295 more overlay strings must be processed, and we return to delivering
@@ -5206,6 +5330,18 @@ pop_it (it)
5206 break; 5330 break;
5207 case GET_FROM_BUFFER: 5331 case GET_FROM_BUFFER:
5208 it->object = it->w->buffer; 5332 it->object = it->w->buffer;
5333 if (it->bidi_p)
5334 {
5335 /* Bidi-iterate until we get out of the portion of text, if
5336 any, covered by a `display' text property or an overlay
5337 with `display' property. (We cannot just jump there,
5338 because the internal coherency of the bidi iterator state
5339 can not be preserved across such jumps.) We also must
5340 determine the paragraph base direction if the overlay we
5341 just processed is at the beginning of a new
5342 paragraph. */
5343 iterate_out_of_display_property (it);
5344 }
5209 break; 5345 break;
5210 case GET_FROM_STRING: 5346 case GET_FROM_STRING:
5211 it->object = it->string; 5347 it->object = it->string;
@@ -6151,6 +6287,15 @@ set_iterator_to_next (it, reseat_p)
6151 { 6287 {
6152 IT_CHARPOS (*it) += it->cmp_it.nchars; 6288 IT_CHARPOS (*it) += it->cmp_it.nchars;
6153 IT_BYTEPOS (*it) += it->cmp_it.nbytes; 6289 IT_BYTEPOS (*it) += it->cmp_it.nbytes;
6290 if (it->bidi_p)
6291 {
6292 if (it->bidi_it.new_paragraph)
6293 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
6294 /* Resync the bidi iterator with IT's new position.
6295 FIXME: this doesn't support bidirectional text. */
6296 while (it->bidi_it.charpos < IT_CHARPOS (*it))
6297 bidi_get_next_char_visually (&it->bidi_it);
6298 }
6154 if (it->cmp_it.to < it->cmp_it.nglyphs) 6299 if (it->cmp_it.to < it->cmp_it.nglyphs)
6155 it->cmp_it.from = it->cmp_it.to; 6300 it->cmp_it.from = it->cmp_it.to;
6156 else 6301 else
@@ -6631,13 +6776,20 @@ next_element_from_buffer (it)
6631 { 6776 {
6632 it->bidi_it.charpos = IT_CHARPOS (*it); 6777 it->bidi_it.charpos = IT_CHARPOS (*it);
6633 it->bidi_it.bytepos = IT_BYTEPOS (*it); 6778 it->bidi_it.bytepos = IT_BYTEPOS (*it);
6634 /* If we are at the beginning of a line, we can produce the next 6779 if (it->bidi_it.bytepos == ZV_BYTE)
6635 element right away. */ 6780 {
6636 if (it->bidi_it.bytepos == BEGV_BYTE 6781 /* Nothing to do, but reset the FIRST_ELT flag, like
6782 bidi_paragraph_init does, because we are not going to
6783 call it. */
6784 it->bidi_it.first_elt = 0;
6785 }
6786 else if (it->bidi_it.bytepos == BEGV_BYTE
6637 /* FIXME: Should support all Unicode line separators. */ 6787 /* FIXME: Should support all Unicode line separators. */
6638 || FETCH_CHAR (it->bidi_it.bytepos - 1) == '\n' 6788 || FETCH_CHAR (it->bidi_it.bytepos - 1) == '\n'
6639 || FETCH_CHAR (it->bidi_it.bytepos) == '\n') 6789 || FETCH_CHAR (it->bidi_it.bytepos) == '\n')
6640 { 6790 {
6791 /* If we are at the beginning of a line, we can produce the
6792 next element right away. */
6641 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it); 6793 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
6642 bidi_get_next_char_visually (&it->bidi_it); 6794 bidi_get_next_char_visually (&it->bidi_it);
6643 } 6795 }
@@ -6865,6 +7017,15 @@ next_element_from_composition (it)
6865 { 7017 {
6866 IT_CHARPOS (*it) += it->cmp_it.nchars; 7018 IT_CHARPOS (*it) += it->cmp_it.nchars;
6867 IT_BYTEPOS (*it) += it->cmp_it.nbytes; 7019 IT_BYTEPOS (*it) += it->cmp_it.nbytes;
7020 if (it->bidi_p)
7021 {
7022 if (it->bidi_it.new_paragraph)
7023 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
7024 /* Resync the bidi iterator with IT's new position.
7025 FIXME: this doesn't support bidirectional text. */
7026 while (it->bidi_it.charpos < IT_CHARPOS (*it))
7027 bidi_get_next_char_visually (&it->bidi_it);
7028 }
6868 return 0; 7029 return 0;
6869 } 7030 }
6870 it->position = it->current.pos; 7031 it->position = it->current.pos;
@@ -8472,7 +8633,6 @@ message (m, a1, a2, a3)
8472 if (m) 8633 if (m)
8473 { 8634 {
8474 int len; 8635 int len;
8475#ifdef NO_ARG_ARRAY
8476 char *a[3]; 8636 char *a[3];
8477 a[0] = (char *) a1; 8637 a[0] = (char *) a1;
8478 a[1] = (char *) a2; 8638 a[1] = (char *) a2;
@@ -8480,11 +8640,6 @@ message (m, a1, a2, a3)
8480 8640
8481 len = doprnt (FRAME_MESSAGE_BUF (f), 8641 len = doprnt (FRAME_MESSAGE_BUF (f),
8482 FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, 3, a); 8642 FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, 3, a);
8483#else
8484 len = doprnt (FRAME_MESSAGE_BUF (f),
8485 FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, 3,
8486 (char **) &a1);
8487#endif /* NO_ARG_ARRAY */
8488 8643
8489 message2 (FRAME_MESSAGE_BUF (f), len, 0); 8644 message2 (FRAME_MESSAGE_BUF (f), len, 0);
8490 } 8645 }
@@ -9837,7 +9992,8 @@ prepare_menu_bars ()
9837 update_tool_bar (f, 0); 9992 update_tool_bar (f, 0);
9838#endif 9993#endif
9839#ifdef HAVE_NS 9994#ifdef HAVE_NS
9840 if (windows_or_buffers_changed) 9995 if (windows_or_buffers_changed
9996 && FRAME_NS_P (f))
9841 ns_set_doc_edited (f, Fbuffer_modified_p 9997 ns_set_doc_edited (f, Fbuffer_modified_p
9842 (XWINDOW (f->selected_window)->buffer)); 9998 (XWINDOW (f->selected_window)->buffer));
9843#endif 9999#endif
@@ -11519,7 +11675,7 @@ static void
11519select_frame_for_redisplay (frame) 11675select_frame_for_redisplay (frame)
11520 Lisp_Object frame; 11676 Lisp_Object frame;
11521{ 11677{
11522 Lisp_Object tail, symbol, val; 11678 Lisp_Object tail, tem;
11523 Lisp_Object old = selected_frame; 11679 Lisp_Object old = selected_frame;
11524 struct Lisp_Symbol *sym; 11680 struct Lisp_Symbol *sym;
11525 11681
@@ -11527,20 +11683,18 @@ select_frame_for_redisplay (frame)
11527 11683
11528 selected_frame = frame; 11684 selected_frame = frame;
11529 11685
11530 do 11686 do {
11531 { 11687 for (tail = XFRAME (frame)->param_alist; CONSP (tail); tail = XCDR (tail))
11532 for (tail = XFRAME (frame)->param_alist; CONSP (tail); tail = XCDR (tail)) 11688 if (CONSP (XCAR (tail))
11533 if (CONSP (XCAR (tail)) 11689 && (tem = XCAR (XCAR (tail)),
11534 && (symbol = XCAR (XCAR (tail)), 11690 SYMBOLP (tem))
11535 SYMBOLP (symbol)) 11691 && (sym = indirect_variable (XSYMBOL (tem)),
11536 && (sym = indirect_variable (XSYMBOL (symbol)), 11692 sym->redirect == SYMBOL_LOCALIZED)
11537 val = sym->value, 11693 && sym->val.blv->frame_local)
11538 (BUFFER_LOCAL_VALUEP (val))) 11694 /* Use find_symbol_value rather than Fsymbol_value
11539 && XBUFFER_LOCAL_VALUE (val)->check_frame) 11695 to avoid an error if it is void. */
11540 /* Use find_symbol_value rather than Fsymbol_value 11696 find_symbol_value (tem);
11541 to avoid an error if it is void. */ 11697 } while (!EQ (frame, old) && (frame = old, 1));
11542 find_symbol_value (symbol);
11543 } while (!EQ (frame, old) && (frame = old, 1));
11544} 11698}
11545 11699
11546 11700
@@ -12548,7 +12702,6 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12548 /* The last known character position in row. */ 12702 /* The last known character position in row. */
12549 int last_pos = MATRIX_ROW_START_CHARPOS (row) + delta; 12703 int last_pos = MATRIX_ROW_START_CHARPOS (row) + delta;
12550 int x = row->x; 12704 int x = row->x;
12551 int cursor_x = x;
12552 EMACS_INT pt_old = PT - delta; 12705 EMACS_INT pt_old = PT - delta;
12553 EMACS_INT pos_before = MATRIX_ROW_START_CHARPOS (row) + delta; 12706 EMACS_INT pos_before = MATRIX_ROW_START_CHARPOS (row) + delta;
12554 EMACS_INT pos_after = MATRIX_ROW_END_CHARPOS (row) + delta; 12707 EMACS_INT pos_after = MATRIX_ROW_END_CHARPOS (row) + delta;
@@ -12584,8 +12737,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12584 } 12737 }
12585 while (end > glyph 12738 while (end > glyph
12586 && INTEGERP ((end - 1)->object) 12739 && INTEGERP ((end - 1)->object)
12587 /* CHARPOS is zero for blanks inserted by 12740 /* CHARPOS is zero for blanks and stretch glyphs
12588 extend_face_to_end_of_line. */ 12741 inserted by extend_face_to_end_of_line. */
12589 && (end - 1)->charpos <= 0) 12742 && (end - 1)->charpos <= 0)
12590 --end; 12743 --end;
12591 glyph_before = glyph - 1; 12744 glyph_before = glyph - 1;
@@ -12599,9 +12752,6 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12599 to front, so swap the edge pointers. */ 12752 to front, so swap the edge pointers. */
12600 glyphs_end = end = glyph - 1; 12753 glyphs_end = end = glyph - 1;
12601 glyph += row->used[TEXT_AREA] - 1; 12754 glyph += row->used[TEXT_AREA] - 1;
12602 /* Reverse the known positions in the row. */
12603 last_pos = pos_after = MATRIX_ROW_START_CHARPOS (row) + delta;
12604 pos_before = MATRIX_ROW_END_CHARPOS (row) + delta;
12605 12755
12606 while (glyph > end + 1 12756 while (glyph > end + 1
12607 && INTEGERP (glyph->object) 12757 && INTEGERP (glyph->object)
@@ -12616,7 +12766,6 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12616 rightmost (first in the reading order) glyph. */ 12766 rightmost (first in the reading order) glyph. */
12617 for (g = end + 1; g < glyph; g++) 12767 for (g = end + 1; g < glyph; g++)
12618 x += g->pixel_width; 12768 x += g->pixel_width;
12619 cursor_x = x;
12620 while (end < glyph 12769 while (end < glyph
12621 && INTEGERP ((end + 1)->object) 12770 && INTEGERP ((end + 1)->object)
12622 && (end + 1)->charpos <= 0) 12771 && (end + 1)->charpos <= 0)
@@ -12631,7 +12780,14 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12631 rightmost glyph. Case in point: an empty last line that is 12780 rightmost glyph. Case in point: an empty last line that is
12632 part of an R2L paragraph. */ 12781 part of an R2L paragraph. */
12633 cursor = end - 1; 12782 cursor = end - 1;
12634 x = -1; /* will be computed below, at lable compute_x */ 12783 /* Avoid placing the cursor on the last glyph of the row, where
12784 on terminal frames we hold the vertical border between
12785 adjacent windows. */
12786 if (!FRAME_WINDOW_P (WINDOW_XFRAME (w))
12787 && !WINDOW_RIGHTMOST_P (w)
12788 && cursor == row->glyphs[LAST_AREA] - 1)
12789 cursor--;
12790 x = -1; /* will be computed below, at label compute_x */
12635 } 12791 }
12636 12792
12637 /* Step 1: Try to find the glyph whose character position 12793 /* Step 1: Try to find the glyph whose character position
@@ -12767,8 +12923,11 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12767 string_seen = 1; 12923 string_seen = 1;
12768 } 12924 }
12769 --glyph; 12925 --glyph;
12770 if (glyph == end) 12926 if (glyph == glyphs_end) /* don't dereference outside TEXT_AREA */
12771 break; 12927 {
12928 x--; /* can't use any pixel_width */
12929 break;
12930 }
12772 x -= glyph->pixel_width; 12931 x -= glyph->pixel_width;
12773 } 12932 }
12774 12933
@@ -12808,7 +12967,10 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12808 } 12967 }
12809 else if (match_with_avoid_cursor 12968 else if (match_with_avoid_cursor
12810 /* zero-width characters produce no glyphs */ 12969 /* zero-width characters produce no glyphs */
12811 || eabs (glyph_after - glyph_before) == 1) 12970 || ((row->reversed_p
12971 ? glyph_after > glyphs_end
12972 : glyph_after < glyphs_end)
12973 && eabs (glyph_after - glyph_before) == 1))
12812 { 12974 {
12813 cursor = glyph_after; 12975 cursor = glyph_after;
12814 x = -1; 12976 x = -1;
@@ -12864,7 +13026,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12864 13026
12865 cursor = glyph; 13027 cursor = glyph;
12866 for (glyph += incr; 13028 for (glyph += incr;
12867 EQ (glyph->object, str); 13029 (row->reversed_p ? glyph > stop : glyph < stop)
13030 && EQ (glyph->object, str);
12868 glyph += incr) 13031 glyph += incr)
12869 { 13032 {
12870 Lisp_Object cprop; 13033 Lisp_Object cprop;
@@ -12904,8 +13067,9 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12904 13067
12905 /* If we reached the end of the line, and END was from a string, 13068 /* If we reached the end of the line, and END was from a string,
12906 the cursor is not on this line. */ 13069 the cursor is not on this line. */
12907 if (glyph == end 13070 if (cursor == NULL
12908 && STRINGP ((glyph - incr)->object) 13071 && (row->reversed_p ? glyph <= end : glyph >= end)
13072 && STRINGP (end->object)
12909 && row->continued_p) 13073 && row->continued_p)
12910 return 0; 13074 return 0;
12911 } 13075 }
@@ -12927,11 +13091,17 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12927 } 13091 }
12928 } 13092 }
12929 13093
12930 /* ROW could be part of a continued line, which might have other 13094 /* ROW could be part of a continued line, which, under bidi
12931 rows whose start and end charpos occlude point. Only set 13095 reordering, might have other rows whose start and end charpos
12932 w->cursor if we found a better approximation to the cursor 13096 occlude point. Only set w->cursor if we found a better
12933 position than we have from previously examined rows. */ 13097 approximation to the cursor position than we have from previously
12934 if (w->cursor.vpos >= 0 13098 examined candidate rows belonging to the same continued line. */
13099 if (/* we already have a candidate row */
13100 w->cursor.vpos >= 0
13101 /* that candidate is not the row we are processing */
13102 && MATRIX_ROW (matrix, w->cursor.vpos) != row
13103 /* the row we are processing is part of a continued line */
13104 && (row->continued_p || MATRIX_ROW_CONTINUATION_LINE_P (row))
12935 /* Make sure cursor.vpos specifies a row whose start and end 13105 /* Make sure cursor.vpos specifies a row whose start and end
12936 charpos occlude point. This is because some callers of this 13106 charpos occlude point. This is because some callers of this
12937 function leave cursor.vpos at the row where the cursor was 13107 function leave cursor.vpos at the row where the cursor was
@@ -13557,11 +13727,14 @@ try_cursor_movement (window, startp, scroll_step)
13557 ++row; 13727 ++row;
13558 } 13728 }
13559 13729
13560 /* The end position of a row equals the start position 13730 /* If the end position of a row equals the start
13561 of the next row. If PT is there, we would rather 13731 position of the next row, and PT is at that position,
13562 display it in the next line. */ 13732 we would rather display cursor in the next line. */
13563 while (MATRIX_ROW_BOTTOM_Y (row) < last_y 13733 while (MATRIX_ROW_BOTTOM_Y (row) < last_y
13564 && MATRIX_ROW_END_CHARPOS (row) == PT 13734 && MATRIX_ROW_END_CHARPOS (row) == PT
13735 && row < w->current_matrix->rows
13736 + w->current_matrix->nrows - 1
13737 && MATRIX_ROW_START_CHARPOS (row+1) == PT
13565 && !cursor_row_p (w, row)) 13738 && !cursor_row_p (w, row))
13566 ++row; 13739 ++row;
13567 13740
@@ -16580,24 +16753,61 @@ insert_left_trunc_glyphs (it)
16580 produce_special_glyphs (&truncate_it, IT_TRUNCATION); 16753 produce_special_glyphs (&truncate_it, IT_TRUNCATION);
16581 16754
16582 /* Overwrite glyphs from IT with truncation glyphs. */ 16755 /* Overwrite glyphs from IT with truncation glyphs. */
16583 from = truncate_it.glyph_row->glyphs[TEXT_AREA]; 16756 if (!it->glyph_row->reversed_p)
16584 end = from + truncate_it.glyph_row->used[TEXT_AREA];
16585 to = it->glyph_row->glyphs[TEXT_AREA];
16586 toend = to + it->glyph_row->used[TEXT_AREA];
16587
16588 while (from < end)
16589 *to++ = *from++;
16590
16591 /* There may be padding glyphs left over. Overwrite them too. */
16592 while (to < toend && CHAR_GLYPH_PADDING_P (*to))
16593 { 16757 {
16594 from = truncate_it.glyph_row->glyphs[TEXT_AREA]; 16758 from = truncate_it.glyph_row->glyphs[TEXT_AREA];
16759 end = from + truncate_it.glyph_row->used[TEXT_AREA];
16760 to = it->glyph_row->glyphs[TEXT_AREA];
16761 toend = to + it->glyph_row->used[TEXT_AREA];
16762
16595 while (from < end) 16763 while (from < end)
16596 *to++ = *from++; 16764 *to++ = *from++;
16765
16766 /* There may be padding glyphs left over. Overwrite them too. */
16767 while (to < toend && CHAR_GLYPH_PADDING_P (*to))
16768 {
16769 from = truncate_it.glyph_row->glyphs[TEXT_AREA];
16770 while (from < end)
16771 *to++ = *from++;
16772 }
16773
16774 if (to > toend)
16775 it->glyph_row->used[TEXT_AREA] = to - it->glyph_row->glyphs[TEXT_AREA];
16597 } 16776 }
16777 else
16778 {
16779 /* In R2L rows, overwrite the last (rightmost) glyphs, and do
16780 that back to front. */
16781 end = truncate_it.glyph_row->glyphs[TEXT_AREA];
16782 from = end + truncate_it.glyph_row->used[TEXT_AREA] - 1;
16783 toend = it->glyph_row->glyphs[TEXT_AREA];
16784 to = toend + it->glyph_row->used[TEXT_AREA] - 1;
16785
16786 while (from >= end && to >= toend)
16787 *to-- = *from--;
16788 while (to >= toend && CHAR_GLYPH_PADDING_P (*to))
16789 {
16790 from =
16791 truncate_it.glyph_row->glyphs[TEXT_AREA]
16792 + truncate_it.glyph_row->used[TEXT_AREA] - 1;
16793 while (from >= end && to >= toend)
16794 *to-- = *from--;
16795 }
16796 if (from >= end)
16797 {
16798 /* Need to free some room before prepending additional
16799 glyphs. */
16800 int move_by = from - end + 1;
16801 struct glyph *g0 = it->glyph_row->glyphs[TEXT_AREA];
16802 struct glyph *g = g0 + it->glyph_row->used[TEXT_AREA] - 1;
16598 16803
16599 if (to > toend) 16804 for ( ; g >= g0; g--)
16600 it->glyph_row->used[TEXT_AREA] = to - it->glyph_row->glyphs[TEXT_AREA]; 16805 g[move_by] = *g;
16806 while (from >= end)
16807 *to-- = *from--;
16808 it->glyph_row->used[TEXT_AREA] += move_by;
16809 }
16810 }
16601} 16811}
16602 16812
16603 16813
@@ -16774,9 +16984,11 @@ append_space_for_newline (it, default_face_p)
16774 16984
16775 16985
16776/* Extend the face of the last glyph in the text area of IT->glyph_row 16986/* Extend the face of the last glyph in the text area of IT->glyph_row
16777 to the end of the display line. Called from display_line. 16987 to the end of the display line. Called from display_line. If the
16778 If the glyph row is empty, add a space glyph to it so that we 16988 glyph row is empty, add a space glyph to it so that we know the
16779 know the face to draw. Set the glyph row flag fill_line_p. */ 16989 face to draw. Set the glyph row flag fill_line_p. If the glyph
16990 row is R2L, prepend a stretch glyph to cover the empty space to the
16991 left of the leftmost glyph. */
16780 16992
16781static void 16993static void
16782extend_face_to_end_of_line (it) 16994extend_face_to_end_of_line (it)
@@ -16785,15 +16997,22 @@ extend_face_to_end_of_line (it)
16785 struct face *face; 16997 struct face *face;
16786 struct frame *f = it->f; 16998 struct frame *f = it->f;
16787 16999
16788 /* If line is already filled, do nothing. */ 17000 /* If line is already filled, do nothing. Non window-system frames
16789 if (it->current_x >= it->last_visible_x) 17001 get a grace of one more ``pixel'' because their characters are
17002 1-``pixel'' wide, so they hit the equality too early. This grace
17003 is needed only for R2L rows that are not continued, to produce
17004 one extra blank where we could display the cursor. */
17005 if (it->current_x >= it->last_visible_x
17006 + (!FRAME_WINDOW_P (f)
17007 && it->glyph_row->reversed_p
17008 && !it->glyph_row->continued_p))
16790 return; 17009 return;
16791 17010
16792 /* Face extension extends the background and box of IT->face_id 17011 /* Face extension extends the background and box of IT->face_id
16793 to the end of the line. If the background equals the background 17012 to the end of the line. If the background equals the background
16794 of the frame, we don't have to do anything. */ 17013 of the frame, we don't have to do anything. */
16795 if (it->face_before_selective_p) 17014 if (it->face_before_selective_p)
16796 face = FACE_FROM_ID (it->f, it->saved_face_id); 17015 face = FACE_FROM_ID (f, it->saved_face_id);
16797 else 17016 else
16798 face = FACE_FROM_ID (f, it->face_id); 17017 face = FACE_FROM_ID (f, it->face_id);
16799 17018
@@ -16801,7 +17020,8 @@ extend_face_to_end_of_line (it)
16801 && it->glyph_row->displays_text_p 17020 && it->glyph_row->displays_text_p
16802 && face->box == FACE_NO_BOX 17021 && face->box == FACE_NO_BOX
16803 && face->background == FRAME_BACKGROUND_PIXEL (f) 17022 && face->background == FRAME_BACKGROUND_PIXEL (f)
16804 && !face->stipple) 17023 && !face->stipple
17024 && !it->glyph_row->reversed_p)
16805 return; 17025 return;
16806 17026
16807 /* Set the glyph row flag indicating that the face of the last glyph 17027 /* Set the glyph row flag indicating that the face of the last glyph
@@ -16828,6 +17048,50 @@ extend_face_to_end_of_line (it)
16828 it->glyph_row->glyphs[TEXT_AREA][0].face_id = it->face_id; 17048 it->glyph_row->glyphs[TEXT_AREA][0].face_id = it->face_id;
16829 it->glyph_row->used[TEXT_AREA] = 1; 17049 it->glyph_row->used[TEXT_AREA] = 1;
16830 } 17050 }
17051#ifdef HAVE_WINDOW_SYSTEM
17052 if (it->glyph_row->reversed_p)
17053 {
17054 /* Prepend a stretch glyph to the row, such that the
17055 rightmost glyph will be drawn flushed all the way to the
17056 right margin of the window. The stretch glyph that will
17057 occupy the empty space, if any, to the left of the
17058 glyphs. */
17059 struct font *font = face->font ? face->font : FRAME_FONT (f);
17060 struct glyph *row_start = it->glyph_row->glyphs[TEXT_AREA];
17061 struct glyph *row_end = row_start + it->glyph_row->used[TEXT_AREA];
17062 struct glyph *g;
17063 int row_width, stretch_ascent, stretch_width;
17064 struct text_pos saved_pos;
17065 int saved_face_id, saved_avoid_cursor;
17066
17067 for (row_width = 0, g = row_start; g < row_end; g++)
17068 row_width += g->pixel_width;
17069 stretch_width = window_box_width (it->w, TEXT_AREA) - row_width;
17070 if (stretch_width > 0)
17071 {
17072 stretch_ascent =
17073 (((it->ascent + it->descent)
17074 * FONT_BASE (font)) / FONT_HEIGHT (font));
17075 saved_pos = it->position;
17076 bzero (&it->position, sizeof it->position);
17077 saved_avoid_cursor = it->avoid_cursor_p;
17078 it->avoid_cursor_p = 1;
17079 saved_face_id = it->face_id;
17080 /* The last row's stretch glyph should get the default
17081 face, to avoid painting the rest of the window with
17082 the region face, if the region ends at ZV. */
17083 if (it->glyph_row->ends_at_zv_p)
17084 it->face_id = DEFAULT_FACE_ID;
17085 else
17086 it->face_id = face->id;
17087 append_stretch_glyph (it, make_number (0), stretch_width,
17088 it->ascent + it->descent, stretch_ascent);
17089 it->position = saved_pos;
17090 it->avoid_cursor_p = saved_avoid_cursor;
17091 it->face_id = saved_face_id;
17092 }
17093 }
17094#endif /* HAVE_WINDOW_SYSTEM */
16831 } 17095 }
16832 else 17096 else
16833 { 17097 {
@@ -16846,7 +17110,13 @@ extend_face_to_end_of_line (it)
16846 it->object = make_number (0); 17110 it->object = make_number (0);
16847 it->c = ' '; 17111 it->c = ' ';
16848 it->len = 1; 17112 it->len = 1;
16849 it->face_id = face->id; 17113 /* The last row's blank glyphs should get the default face, to
17114 avoid painting the rest of the window with the region face,
17115 if the region ends at ZV. */
17116 if (it->glyph_row->ends_at_zv_p)
17117 it->face_id = DEFAULT_FACE_ID;
17118 else
17119 it->face_id = face->id;
16850 17120
16851 PRODUCE_GLYPHS (it); 17121 PRODUCE_GLYPHS (it);
16852 17122
@@ -17132,6 +17402,148 @@ handle_line_prefix (struct it *it)
17132 17402
17133 17403
17134 17404
17405/* Remove N glyphs at the start of a reversed IT->glyph_row. Called
17406 only for R2L lines from display_line, when it decides that too many
17407 glyphs were produced by PRODUCE_GLYPHS, and the line needs to be
17408 continued. */
17409static void
17410unproduce_glyphs (it, n)
17411 struct it *it;
17412 int n;
17413{
17414 struct glyph *glyph, *end;
17415
17416 xassert (it->glyph_row);
17417 xassert (it->glyph_row->reversed_p);
17418 xassert (it->area == TEXT_AREA);
17419 xassert (n <= it->glyph_row->used[TEXT_AREA]);
17420
17421 if (n > it->glyph_row->used[TEXT_AREA])
17422 n = it->glyph_row->used[TEXT_AREA];
17423 glyph = it->glyph_row->glyphs[TEXT_AREA] + n;
17424 end = it->glyph_row->glyphs[TEXT_AREA] + it->glyph_row->used[TEXT_AREA];
17425 for ( ; glyph < end; glyph++)
17426 glyph[-n] = *glyph;
17427}
17428
17429/* Find the positions in a bidi-reordered ROW to serve as ROW->start
17430 and ROW->end. */
17431static struct display_pos
17432find_row_end (it, row)
17433 struct it *it;
17434 struct glyph_row *row;
17435{
17436 /* FIXME: Revisit this when glyph ``spilling'' in continuation
17437 lines' rows is implemented for bidi-reordered rows. */
17438 EMACS_INT min_pos = ZV + 1, max_pos = 0;
17439 struct glyph *g;
17440 struct it save_it;
17441 struct text_pos tpos;
17442 struct display_pos row_end = it->current;
17443
17444 for (g = row->glyphs[TEXT_AREA];
17445 g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA];
17446 g++)
17447 {
17448 if (BUFFERP (g->object))
17449 {
17450 if (g->charpos > 0 && g->charpos < min_pos)
17451 min_pos = g->charpos;
17452 if (g->charpos > max_pos)
17453 max_pos = g->charpos;
17454 }
17455 }
17456 /* Empty lines have a valid buffer position at their first
17457 glyph, but that glyph's OBJECT is zero, as if it didn't come
17458 from a buffer. If we didn't find any valid buffer positions
17459 in this row, maybe we have such an empty line. */
17460 if (max_pos == 0 && row->used[TEXT_AREA])
17461 {
17462 for (g = row->glyphs[TEXT_AREA];
17463 g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA];
17464 g++)
17465 {
17466 if (INTEGERP (g->object))
17467 {
17468 if (g->charpos > 0 && g->charpos < min_pos)
17469 min_pos = g->charpos;
17470 if (g->charpos > max_pos)
17471 max_pos = g->charpos;
17472 }
17473 }
17474 }
17475
17476 /* ROW->start is the value of min_pos, the minimal buffer position
17477 we have in ROW. */
17478 if (min_pos <= ZV)
17479 {
17480 /* Avoid calling the costly CHAR_TO_BYTE if possible. */
17481 if (min_pos != row->start.pos.charpos)
17482 SET_TEXT_POS (row->start.pos, min_pos, CHAR_TO_BYTE (min_pos));
17483 if (max_pos == 0)
17484 max_pos = min_pos;
17485 }
17486
17487 /* For ROW->end, we need the position that is _after_ max_pos, in
17488 the logical order, unless we are at ZV. */
17489 if (row->ends_at_zv_p)
17490 {
17491 if (!row->used[TEXT_AREA])
17492 row->start.pos = row_end.pos;
17493 }
17494 else if (row->used[TEXT_AREA] && max_pos)
17495 {
17496 int at_eol_p;
17497
17498 SET_TEXT_POS (tpos, max_pos, CHAR_TO_BYTE (max_pos));
17499 save_it = *it;
17500 it->bidi_p = 0;
17501 reseat (it, tpos, 0);
17502 if (!get_next_display_element (it))
17503 abort (); /* this row cannot be at ZV, see above */
17504 at_eol_p = ITERATOR_AT_END_OF_LINE_P (it);
17505 set_iterator_to_next (it, 1);
17506 row_end = it->current;
17507 /* If the character at max_pos is not a newline and the
17508 characters at max_pos+1 is a newline, skip that newline as
17509 well. Note that this may skip some invisible text. */
17510 if (!at_eol_p
17511 && get_next_display_element (it)
17512 && ITERATOR_AT_END_OF_LINE_P (it))
17513 {
17514 set_iterator_to_next (it, 1);
17515 /* Record the position after the newline of a continued row.
17516 We will need that to set ROW->end of the last row
17517 produced for a continued line. */
17518 if (row->continued_p)
17519 save_it.eol_pos = it->current.pos;
17520 else
17521 {
17522 row_end = it->current;
17523 save_it.eol_pos.charpos = save_it.eol_pos.bytepos = 0;
17524 }
17525 }
17526 else if (!row->continued_p
17527 && MATRIX_ROW_CONTINUATION_LINE_P (row)
17528 && it->eol_pos.charpos > 0)
17529 {
17530 /* Last row of a continued line. Use the position recorded
17531 in IT->eol_pos, to the effect that the newline belongs to
17532 this row, not to the row which displays the character
17533 with the largest buffer position before the newline. */
17534 row_end.pos = it->eol_pos;
17535 it->eol_pos.charpos = it->eol_pos.bytepos = 0;
17536 }
17537 *it = save_it;
17538 /* The members of ROW->end that are not taken from buffer
17539 positions are copied from IT->current. */
17540 row_end.string_pos = it->current.string_pos;
17541 row_end.overlay_string_index = it->current.overlay_string_index;
17542 row_end.dpvec_index = it->current.dpvec_index;
17543 }
17544 return row_end;
17545}
17546
17135/* Construct the glyph row IT->glyph_row in the desired matrix of 17547/* Construct the glyph row IT->glyph_row in the desired matrix of
17136 IT->w from text at the current position of IT. See dispextern.h 17548 IT->w from text at the current position of IT. See dispextern.h
17137 for an overview of struct it. Value is non-zero if 17549 for an overview of struct it. Value is non-zero if
@@ -17149,7 +17561,6 @@ display_line (it)
17149 int wrap_row_used = -1, wrap_row_ascent, wrap_row_height; 17561 int wrap_row_used = -1, wrap_row_ascent, wrap_row_height;
17150 int wrap_row_phys_ascent, wrap_row_phys_height; 17562 int wrap_row_phys_ascent, wrap_row_phys_height;
17151 int wrap_row_extra_line_spacing; 17563 int wrap_row_extra_line_spacing;
17152 struct display_pos row_end;
17153 int cvpos; 17564 int cvpos;
17154 17565
17155 /* We always start displaying at hpos zero even if hscrolled. */ 17566 /* We always start displaying at hpos zero even if hscrolled. */
@@ -17396,6 +17807,9 @@ display_line (it)
17396 /* A padding glyph that doesn't fit on this line. 17807 /* A padding glyph that doesn't fit on this line.
17397 This means the whole character doesn't fit 17808 This means the whole character doesn't fit
17398 on the line. */ 17809 on the line. */
17810 if (row->reversed_p)
17811 unproduce_glyphs (it, row->used[TEXT_AREA]
17812 - n_glyphs_before);
17399 row->used[TEXT_AREA] = n_glyphs_before; 17813 row->used[TEXT_AREA] = n_glyphs_before;
17400 17814
17401 /* Fill the rest of the row with continuation 17815 /* Fill the rest of the row with continuation
@@ -17418,6 +17832,9 @@ display_line (it)
17418 else if (wrap_row_used > 0) 17832 else if (wrap_row_used > 0)
17419 { 17833 {
17420 back_to_wrap: 17834 back_to_wrap:
17835 if (row->reversed_p)
17836 unproduce_glyphs (it,
17837 row->used[TEXT_AREA] - wrap_row_used);
17421 *it = wrap_it; 17838 *it = wrap_it;
17422 it->continuation_lines_width += wrap_x; 17839 it->continuation_lines_width += wrap_x;
17423 row->used[TEXT_AREA] = wrap_row_used; 17840 row->used[TEXT_AREA] = wrap_row_used;
@@ -17453,6 +17870,9 @@ display_line (it)
17453 /* Something other than a TAB that draws past 17870 /* Something other than a TAB that draws past
17454 the right edge of the window. Restore 17871 the right edge of the window. Restore
17455 positions to values before the element. */ 17872 positions to values before the element. */
17873 if (row->reversed_p)
17874 unproduce_glyphs (it, row->used[TEXT_AREA]
17875 - (n_glyphs_before + i));
17456 row->used[TEXT_AREA] = n_glyphs_before + i; 17876 row->used[TEXT_AREA] = n_glyphs_before + i;
17457 17877
17458 /* Display continuation glyphs. */ 17878 /* Display continuation glyphs. */
@@ -17558,9 +17978,26 @@ display_line (it)
17558 { 17978 {
17559 int i, n; 17979 int i, n;
17560 17980
17561 for (i = row->used[TEXT_AREA] - 1; i > 0; --i) 17981 if (!row->reversed_p)
17562 if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i])) 17982 {
17563 break; 17983 for (i = row->used[TEXT_AREA] - 1; i > 0; --i)
17984 if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i]))
17985 break;
17986 }
17987 else
17988 {
17989 for (i = 0; i < row->used[TEXT_AREA]; i++)
17990 if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i]))
17991 break;
17992 /* Remove any padding glyphs at the front of ROW, to
17993 make room for the truncation glyphs we will be
17994 adding below. The loop below always inserts at
17995 least one truncation glyph, so also remove the
17996 last glyph added to ROW. */
17997 unproduce_glyphs (it, i + 1);
17998 /* Adjust i for the loop below. */
17999 i = row->used[TEXT_AREA] - (i + 1);
18000 }
17564 18001
17565 for (n = row->used[TEXT_AREA]; i < n; ++i) 18002 for (n = row->used[TEXT_AREA]; i < n; ++i)
17566 { 18003 {
@@ -17651,116 +18088,13 @@ display_line (it)
17651 compute_line_metrics (it); 18088 compute_line_metrics (it);
17652 18089
17653 /* Remember the position at which this line ends. */ 18090 /* Remember the position at which this line ends. */
17654 row->end = row_end = it->current; 18091 row->end = it->current;
18092 /* ROW->start and ROW->end must be the smallest and the largest
18093 buffer positions in ROW. But if ROW was bidi-reordered, these
18094 two positions can be anywhere in the row, so we must rescan all
18095 of the ROW's glyphs to find them. */
17655 if (it->bidi_p) 18096 if (it->bidi_p)
17656 { 18097 row->end = find_row_end (it, row);
17657 /* ROW->start and ROW->end must be the smallest and largest
17658 buffer positions in ROW. But if ROW was bidi-reordered,
17659 these two positions can be anywhere in the row, so we must
17660 rescan all of the ROW's glyphs to find them. */
17661 /* FIXME: Revisit this when glyph ``spilling'' in continuation
17662 lines' rows is implemented for bidi-reordered rows. */
17663 EMACS_INT min_pos = ZV + 1, max_pos = 0;
17664 struct glyph *g;
17665 struct it save_it;
17666 struct text_pos tpos;
17667
17668 for (g = row->glyphs[TEXT_AREA];
17669 g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA];
17670 g++)
17671 {
17672 if (BUFFERP (g->object))
17673 {
17674 if (g->charpos > 0 && g->charpos < min_pos)
17675 min_pos = g->charpos;
17676 if (g->charpos > max_pos)
17677 max_pos = g->charpos;
17678 }
17679 }
17680 /* Empty lines have a valid buffer position at their first
17681 glyph, but that glyph's OBJECT is zero, as if it didn't come
17682 from a buffer. If we didn't find any valid buffer positions
17683 in this row, maybe we have such an empty line. */
17684 if (min_pos == ZV + 1 && row->used[TEXT_AREA])
17685 {
17686 for (g = row->glyphs[TEXT_AREA];
17687 g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA];
17688 g++)
17689 {
17690 if (INTEGERP (g->object))
17691 {
17692 if (g->charpos > 0 && g->charpos < min_pos)
17693 min_pos = g->charpos;
17694 if (g->charpos > max_pos)
17695 max_pos = g->charpos;
17696 }
17697 }
17698 }
17699 if (min_pos <= ZV)
17700 {
17701 if (min_pos != row->start.pos.charpos)
17702 {
17703 row->start.pos.charpos = min_pos;
17704 row->start.pos.bytepos = CHAR_TO_BYTE (min_pos);
17705 }
17706 if (max_pos == 0)
17707 max_pos = min_pos;
17708 }
17709 /* For ROW->end, we need the position that is _after_ max_pos,
17710 in the logical order, unless we are at ZV. */
17711 if (row->ends_at_zv_p)
17712 {
17713 row_end = row->end = it->current;
17714 if (!row->used[TEXT_AREA])
17715 {
17716 row->start.pos.charpos = row_end.pos.charpos;
17717 row->start.pos.bytepos = row_end.pos.bytepos;
17718 }
17719 }
17720 else if (row->used[TEXT_AREA] && max_pos)
17721 {
17722 SET_TEXT_POS (tpos, max_pos + 1, CHAR_TO_BYTE (max_pos + 1));
17723 row_end = it->current;
17724 row_end.pos = tpos;
17725 /* If the character at max_pos+1 is a newline, skip that as
17726 well. Note that this may skip some invisible text. */
17727 if (FETCH_CHAR (tpos.bytepos) == '\n'
17728 || (FETCH_CHAR (tpos.bytepos) == '\r' && it->selective))
17729 {
17730 save_it = *it;
17731 it->bidi_p = 0;
17732 reseat_1 (it, tpos, 0);
17733 set_iterator_to_next (it, 1);
17734 /* Record the position after the newline of a continued
17735 row. We will need that to set ROW->end of the last
17736 row produced for a continued line. */
17737 if (row->continued_p)
17738 {
17739 save_it.eol_pos.charpos = IT_CHARPOS (*it);
17740 save_it.eol_pos.bytepos = IT_BYTEPOS (*it);
17741 }
17742 else
17743 {
17744 row_end = it->current;
17745 save_it.eol_pos.charpos = save_it.eol_pos.bytepos = 0;
17746 }
17747 *it = save_it;
17748 }
17749 else if (!row->continued_p
17750 && row->continuation_lines_width
17751 && it->eol_pos.charpos > 0)
17752 {
17753 /* Last row of a continued line. Use the position
17754 recorded in ROW->eol_pos, to the effect that the
17755 newline belongs to this row, not to the row which
17756 displays the character with the largest buffer
17757 position. */
17758 row_end.pos = it->eol_pos;
17759 it->eol_pos.charpos = it->eol_pos.bytepos = 0;
17760 }
17761 row->end = row_end;
17762 }
17763 }
17764 18098
17765 /* Record whether this row ends inside an ellipsis. */ 18099 /* Record whether this row ends inside an ellipsis. */
17766 row->ends_in_ellipsis_p 18100 row->ends_in_ellipsis_p
@@ -17808,11 +18142,13 @@ display_line (it)
17808 it->current_y += row->height; 18142 it->current_y += row->height;
17809 ++it->vpos; 18143 ++it->vpos;
17810 ++it->glyph_row; 18144 ++it->glyph_row;
17811 /* The next row should use same value of the reversed_p flag as this 18145 /* The next row should by default use the same value of the
17812 one. set_iterator_to_next decides when it's a new paragraph, and 18146 reversed_p flag as this one. set_iterator_to_next decides when
17813 PRODUCE_GLYPHS recomputes the value of the flag accordingly. */ 18147 it's a new paragraph, and PRODUCE_GLYPHS recomputes the value of
17814 it->glyph_row->reversed_p = row->reversed_p; 18148 the flag accordingly. */
17815 it->start = row_end; 18149 if (it->glyph_row < MATRIX_BOTTOM_TEXT_ROW (it->w->desired_matrix, it->w))
18150 it->glyph_row->reversed_p = row->reversed_p;
18151 it->start = row->end;
17816 return row->displays_text_p; 18152 return row->displays_text_p;
17817} 18153}
17818 18154
@@ -21415,6 +21751,17 @@ append_composite_glyph (it)
21415 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; 21751 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
21416 if (glyph < it->glyph_row->glyphs[area + 1]) 21752 if (glyph < it->glyph_row->glyphs[area + 1])
21417 { 21753 {
21754 /* If the glyph row is reversed, we need to prepend the glyph
21755 rather than append it. */
21756 if (it->glyph_row->reversed_p && it->area == TEXT_AREA)
21757 {
21758 struct glyph *g;
21759
21760 /* Make room for the new glyph. */
21761 for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--)
21762 g[1] = *g;
21763 glyph = it->glyph_row->glyphs[it->area];
21764 }
21418 glyph->charpos = CHARPOS (it->position); 21765 glyph->charpos = CHARPOS (it->position);
21419 glyph->object = it->object; 21766 glyph->object = it->object;
21420 glyph->pixel_width = it->pixel_width; 21767 glyph->pixel_width = it->pixel_width;
@@ -21660,6 +22007,17 @@ append_stretch_glyph (it, object, width, height, ascent)
21660 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; 22007 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
21661 if (glyph < it->glyph_row->glyphs[area + 1]) 22008 if (glyph < it->glyph_row->glyphs[area + 1])
21662 { 22009 {
22010 /* If the glyph row is reversed, we need to prepend the glyph
22011 rather than append it. */
22012 if (it->glyph_row->reversed_p && area == TEXT_AREA)
22013 {
22014 struct glyph *g;
22015
22016 /* Make room for the additional glyph. */
22017 for (g = glyph - 1; g >= it->glyph_row->glyphs[area]; g--)
22018 g[1] = *g;
22019 glyph = it->glyph_row->glyphs[area];
22020 }
21663 glyph->charpos = CHARPOS (it->position); 22021 glyph->charpos = CHARPOS (it->position);
21664 glyph->object = object; 22022 glyph->object = object;
21665 glyph->pixel_width = width; 22023 glyph->pixel_width = width;
@@ -21686,6 +22044,11 @@ append_stretch_glyph (it, object, width, height, ascent)
21686 abort (); 22044 abort ();
21687 glyph->bidi_type = it->bidi_it.type; 22045 glyph->bidi_type = it->bidi_it.type;
21688 } 22046 }
22047 else
22048 {
22049 glyph->resolved_level = 0;
22050 glyph->bidi_type = UNKNOWN_BT;
22051 }
21689 ++it->glyph_row->used[area]; 22052 ++it->glyph_row->used[area];
21690 } 22053 }
21691 else 22054 else
@@ -23166,7 +23529,7 @@ notice_overwritten_cursor (w, area, x0, x1, y0, y1)
23166 if (row->cursor_in_fringe_p) 23529 if (row->cursor_in_fringe_p)
23167 { 23530 {
23168 row->cursor_in_fringe_p = 0; 23531 row->cursor_in_fringe_p = 0;
23169 draw_fringe_bitmap (w, row, 0); 23532 draw_fringe_bitmap (w, row, row->reversed_p);
23170 w->phys_cursor_on_p = 0; 23533 w->phys_cursor_on_p = 0;
23171 return; 23534 return;
23172 } 23535 }
@@ -23267,7 +23630,9 @@ draw_phys_cursor_glyph (w, row, hl)
23267 /* If cursor hpos is out of bounds, don't draw garbage. This can 23630 /* If cursor hpos is out of bounds, don't draw garbage. This can
23268 happen in mini-buffer windows when switching between echo area 23631 happen in mini-buffer windows when switching between echo area
23269 glyphs and mini-buffer. */ 23632 glyphs and mini-buffer. */
23270 if (w->phys_cursor.hpos < row->used[TEXT_AREA]) 23633 if ((row->reversed_p
23634 ? (w->phys_cursor.hpos >= 0)
23635 : (w->phys_cursor.hpos < row->used[TEXT_AREA])))
23271 { 23636 {
23272 int on_p = w->phys_cursor_on_p; 23637 int on_p = w->phys_cursor_on_p;
23273 int x1; 23638 int x1;
@@ -23347,7 +23712,7 @@ erase_phys_cursor (w)
23347 if (cursor_row->cursor_in_fringe_p) 23712 if (cursor_row->cursor_in_fringe_p)
23348 { 23713 {
23349 cursor_row->cursor_in_fringe_p = 0; 23714 cursor_row->cursor_in_fringe_p = 0;
23350 draw_fringe_bitmap (w, cursor_row, 0); 23715 draw_fringe_bitmap (w, cursor_row, cursor_row->reversed_p);
23351 goto mark_cursor_off; 23716 goto mark_cursor_off;
23352 } 23717 }
23353 23718
@@ -23356,7 +23721,9 @@ erase_phys_cursor (w)
23356 should have cleared the cursor. Note that we wouldn't be 23721 should have cleared the cursor. Note that we wouldn't be
23357 able to erase the cursor in this case because we don't have a 23722 able to erase the cursor in this case because we don't have a
23358 cursor glyph at hand. */ 23723 cursor glyph at hand. */
23359 if (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA]) 23724 if ((cursor_row->reversed_p
23725 ? (w->phys_cursor.hpos < 0)
23726 : (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA])))
23360 goto mark_cursor_off; 23727 goto mark_cursor_off;
23361 23728
23362 /* If the cursor is in the mouse face area, redisplay that when 23729 /* If the cursor is in the mouse face area, redisplay that when
@@ -23372,7 +23739,7 @@ erase_phys_cursor (w)
23372 /* Don't redraw the cursor's spot in mouse face if it is at the 23739 /* Don't redraw the cursor's spot in mouse face if it is at the
23373 end of a line (on a newline). The cursor appears there, but 23740 end of a line (on a newline). The cursor appears there, but
23374 mouse highlighting does not. */ 23741 mouse highlighting does not. */
23375 && cursor_row->used[TEXT_AREA] > hpos) 23742 && cursor_row->used[TEXT_AREA] > hpos && hpos >= 0)
23376 mouse_face_here_p = 1; 23743 mouse_face_here_p = 1;
23377 23744
23378 /* Maybe clear the display under the cursor. */ 23745 /* Maybe clear the display under the cursor. */
@@ -23454,7 +23821,7 @@ display_and_set_cursor (w, on, hpos, vpos, x, y)
23454 23821
23455 glyph = NULL; 23822 glyph = NULL;
23456 if (!glyph_row->exact_window_width_line_p 23823 if (!glyph_row->exact_window_width_line_p
23457 || hpos < glyph_row->used[TEXT_AREA]) 23824 || (0 <= hpos && hpos < glyph_row->used[TEXT_AREA]))
23458 glyph = glyph_row->glyphs[TEXT_AREA] + hpos; 23825 glyph = glyph_row->glyphs[TEXT_AREA] + hpos;
23459 23826
23460 xassert (interrupt_input_blocked); 23827 xassert (interrupt_input_blocked);
@@ -25557,6 +25924,12 @@ syms_of_xdisp ()
25557 staticpro (&Qnobreak_space); 25924 staticpro (&Qnobreak_space);
25558 Qimage = intern_c_string ("image"); 25925 Qimage = intern_c_string ("image");
25559 staticpro (&Qimage); 25926 staticpro (&Qimage);
25927 Qtext = intern_c_string ("text");
25928 staticpro (&Qtext);
25929 Qboth = intern_c_string ("both");
25930 staticpro (&Qboth);
25931 Qboth_horiz = intern_c_string ("both-horiz");
25932 staticpro (&Qboth_horiz);
25560 QCmap = intern_c_string (":map"); 25933 QCmap = intern_c_string (":map");
25561 staticpro (&QCmap); 25934 staticpro (&QCmap);
25562 QCpointer = intern_c_string (":pointer"); 25935 QCpointer = intern_c_string (":pointer");
@@ -25897,6 +26270,22 @@ vertical margin. */);
25897 doc: /* *Relief thickness of tool-bar buttons. */); 26270 doc: /* *Relief thickness of tool-bar buttons. */);
25898 tool_bar_button_relief = DEFAULT_TOOL_BAR_BUTTON_RELIEF; 26271 tool_bar_button_relief = DEFAULT_TOOL_BAR_BUTTON_RELIEF;
25899 26272
26273 DEFVAR_LISP ("tool-bar-style", &Vtool_bar_style,
26274 doc: /* *Tool bar style to use.
26275It can be one of
26276 image - show images only
26277 text - show text only
26278 both - show both, text under image
26279 both-horiz - show text to the right of the image
26280 any other - use system default or image if no system default. */);
26281 Vtool_bar_style = Qnil;
26282
26283 DEFVAR_INT ("tool-bar-max-label-size", &tool_bar_max_label_size,
26284 doc: /* *Maximum number of characters a label can have to be shown.
26285The tool bar style must also show labels for this to have any effect, see
26286`tool-bar-style'. */);
26287 tool_bar_max_label_size = DEFAULT_TOOL_BAR_LABEL_SIZE;
26288
25900 DEFVAR_LISP ("fontification-functions", &Vfontification_functions, 26289 DEFVAR_LISP ("fontification-functions", &Vfontification_functions,
25901 doc: /* List of functions to call to fontify regions of text. 26290 doc: /* List of functions to call to fontify regions of text.
25902Each function is called with one argument POS. Functions must 26291Each function is called with one argument POS. Functions must
diff --git a/src/xmenu.c b/src/xmenu.c
index c8067a47deb..796dd3093e8 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -978,14 +978,9 @@ apply_systemfont_to_menu (w)
978 if (XtIsShell (w)) /* popup menu */ 978 if (XtIsShell (w)) /* popup menu */
979 { 979 {
980 Widget *childs = NULL; 980 Widget *childs = NULL;
981 int num = 0;
982 981
983 XtVaGetValues (w, XtNnumChildren, &num, NULL);
984 if (num != 1) return; /* Should only be one. */
985
986 childs[0] = 0;
987 XtVaGetValues (w, XtNchildren, &childs, NULL); 982 XtVaGetValues (w, XtNchildren, &childs, NULL);
988 if (childs && *childs) w = *childs; 983 if (*childs) w = *childs;
989 } 984 }
990 985
991 /* Only use system font if the default is used for the menu. */ 986 /* Only use system font if the default is used for the menu. */
diff --git a/src/xrdb.c b/src/xrdb.c
index 7808bacc59f..bd3474c0466 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -34,24 +34,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
34#include <stdio.h> 34#include <stdio.h>
35#include <setjmp.h> 35#include <setjmp.h>
36 36
37#if 1 /* I'd really appreciate it if this code could go away... -JimB */
38/* This avoids lossage in the `dual-universe' headers on AT&T SysV
39 X11. Don't do it on Solaris, because it breaks compilation with
40 XFree86 4.0.3 (and probably many other X11R6 releases) on Solaris
41 2 */
42#if defined(USG5) && !defined(SOLARIS2)
43#ifndef SYSV
44#define SYSV
45#endif
46#endif /* USG5 && !SOLARIS2 */
47
48#endif /* 1 */
49
50#include <X11/Xlib.h> 37#include <X11/Xlib.h>
51#include <X11/Xatom.h> 38#include <X11/Xatom.h>
52#if 0
53#include <X11/Xos.h>
54#endif
55#include <X11/X.h> 39#include <X11/X.h>
56#include <X11/Xutil.h> 40#include <X11/Xutil.h>
57#include <X11/Xresource.h> 41#include <X11/Xresource.h>
diff --git a/src/xsettings.c b/src/xsettings.c
index 1db7a24ebad..f1b4c8c9b23 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -1,4 +1,4 @@
1/* Functions for handle font changes dynamically. 1/* Functions for handle font and other changes dynamically.
2 Copyright (C) 2009, 2010 2 Copyright (C) 2009, 2010
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
@@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include "config.h" 20#include "config.h"
21#include <limits.h>
21#include <setjmp.h> 22#include <setjmp.h>
22#include <fcntl.h> 23#include <fcntl.h>
23#include "lisp.h" 24#include "lisp.h"
@@ -41,10 +42,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41static char *current_mono_font; 42static char *current_mono_font;
42static char *current_font; 43static char *current_font;
43static struct x_display_info *first_dpyinfo; 44static struct x_display_info *first_dpyinfo;
44static Lisp_Object Qfont_name, Qfont_render; 45static Lisp_Object Qmonospace_font_name, Qfont_name, Qfont_render,
46 Qtool_bar_style;
45static int use_system_font; 47static int use_system_font;
46static Lisp_Object Vxft_settings; 48static Lisp_Object Vxft_settings;
47 49static Lisp_Object current_tool_bar_style;
48 50
49#ifdef HAVE_GCONF 51#ifdef HAVE_GCONF
50static GConfClient *gconf_client; 52static GConfClient *gconf_client;
@@ -52,7 +54,7 @@ static GConfClient *gconf_client;
52 54
53 55
54static void 56static void
55store_font_changed_event (arg, display_name) 57store_config_changed_event (arg, display_name)
56 Lisp_Object arg; 58 Lisp_Object arg;
57 Lisp_Object display_name; 59 Lisp_Object display_name;
58{ 60{
@@ -64,7 +66,32 @@ store_font_changed_event (arg, display_name)
64 kbd_buffer_store_event (&event); 66 kbd_buffer_store_event (&event);
65} 67}
66 68
67#define XSETTINGS_FONT_NAME "Gtk/FontName" 69#define XSETTINGS_FONT_NAME "Gtk/FontName"
70#define XSETTINGS_TOOL_BAR_STYLE "Gtk/ToolbarStyle"
71
72enum {
73 SEEN_AA = 0x01,
74 SEEN_HINTING = 0x02,
75 SEEN_RGBA = 0x04,
76 SEEN_LCDFILTER = 0x08,
77 SEEN_HINTSTYLE = 0x10,
78 SEEN_DPI = 0x20,
79 SEEN_FONT = 0x40,
80 SEEN_TB_STYLE = 0x80,
81};
82struct xsettings
83{
84#ifdef HAVE_XFT
85 FcBool aa, hinting;
86 int rgba, lcdfilter, hintstyle;
87 double dpi;
88#endif
89
90 char *font;
91 char *tb_style;
92
93 unsigned seen;
94};
68 95
69#ifdef HAVE_GCONF 96#ifdef HAVE_GCONF
70 97
@@ -105,8 +132,8 @@ something_changedCB (client, cnxn_id, entry, user_data)
105 found = dpyinfo == first_dpyinfo; 132 found = dpyinfo == first_dpyinfo;
106 133
107 if (found && use_system_font) 134 if (found && use_system_font)
108 store_font_changed_event (Qfont_name, 135 store_config_changed_event (Qmonospace_font_name,
109 XCAR (first_dpyinfo->name_list_element)); 136 XCAR (first_dpyinfo->name_list_element));
110 } 137 }
111} 138}
112#endif /* HAVE_GCONF */ 139#endif /* HAVE_GCONF */
@@ -124,6 +151,8 @@ something_changedCB (client, cnxn_id, entry, user_data)
124#define FC_LCD_FILTER "lcdfilter" 151#define FC_LCD_FILTER "lcdfilter"
125#endif 152#endif
126 153
154#endif /* HAVE_XFT */
155
127/* Find the window that contains the XSETTINGS property values. */ 156/* Find the window that contains the XSETTINGS property values. */
128 157
129static void 158static void
@@ -144,23 +173,6 @@ get_prop_window (dpyinfo)
144 XUngrabServer (dpy); 173 XUngrabServer (dpy);
145} 174}
146 175
147enum {
148 SEEN_AA = 0x01,
149 SEEN_HINTING = 0x02,
150 SEEN_RGBA = 0x04,
151 SEEN_LCDFILTER = 0x08,
152 SEEN_HINTSTYLE = 0x10,
153 SEEN_DPI = 0x20,
154};
155struct xsettings
156{
157 FcBool aa, hinting;
158 int rgba, lcdfilter, hintstyle;
159 double dpi;
160
161 unsigned seen;
162};
163
164#define SWAP32(nr) (((nr) << 24) | (((nr) << 8) & 0xff0000) \ 176#define SWAP32(nr) (((nr) << 24) | (((nr) << 8) & 0xff0000) \
165 | (((nr) >> 8) & 0xff00) | ((nr) >> 24)) 177 | (((nr) >> 8) & 0xff00) | ((nr) >> 24))
166#define SWAP16(nr) (((nr) << 8) | ((nr) >> 8)) 178#define SWAP16(nr) (((nr) << 8) | ((nr) >> 8))
@@ -217,7 +229,7 @@ struct xsettings
217*/ 229*/
218 230
219static int 231static int
220parse_xft_settings (prop, bytes, settings) 232parse_settings (prop, bytes, settings)
221 unsigned char *prop; 233 unsigned char *prop;
222 unsigned long bytes; 234 unsigned long bytes;
223 struct xsettings *settings; 235 struct xsettings *settings;
@@ -268,8 +280,13 @@ parse_xft_settings (prop, bytes, settings)
268 bytes_parsed += 4; /* Skip serial for this value */ 280 bytes_parsed += 4; /* Skip serial for this value */
269 if (bytes_parsed > bytes) return BadLength; 281 if (bytes_parsed > bytes) return BadLength;
270 282
271 want_this = (nlen > 6 && strncmp (name, "Xft/", 4) == 0) 283 want_this =
272 || (strcmp (XSETTINGS_FONT_NAME, name) == 0); 284#ifdef HAVE_XFT
285 (nlen > 6 && strncmp (name, "Xft/", 4) == 0)
286 ||
287#endif
288 (strcmp (XSETTINGS_FONT_NAME, name) == 0)
289 || (strcmp (XSETTINGS_TOOL_BAR_STYLE, name) == 0);
273 290
274 switch (type) 291 switch (type)
275 { 292 {
@@ -311,7 +328,18 @@ parse_xft_settings (prop, bytes, settings)
311 if (want_this) 328 if (want_this)
312 { 329 {
313 ++settings_seen; 330 ++settings_seen;
314 if (strcmp (name, "Xft/Antialias") == 0) 331 if (strcmp (name, XSETTINGS_FONT_NAME) == 0)
332 {
333 settings->font = xstrdup (sval);
334 settings->seen |= SEEN_FONT;
335 }
336 else if (strcmp (name, XSETTINGS_TOOL_BAR_STYLE) == 0)
337 {
338 settings->tb_style = xstrdup (sval);
339 settings->seen |= SEEN_TB_STYLE;
340 }
341#ifdef HAVE_XFT
342 else if (strcmp (name, "Xft/Antialias") == 0)
315 { 343 {
316 settings->seen |= SEEN_AA; 344 settings->seen |= SEEN_AA;
317 settings->aa = ival != 0; 345 settings->aa = ival != 0;
@@ -366,11 +394,7 @@ parse_xft_settings (prop, bytes, settings)
366 else 394 else
367 settings->seen &= ~SEEN_LCDFILTER; 395 settings->seen &= ~SEEN_LCDFILTER;
368 } 396 }
369 else if (strcmp (name, XSETTINGS_FONT_NAME) == 0) 397#endif /* HAVE_XFT */
370 {
371 free (current_font);
372 current_font = xstrdup (sval);
373 }
374 } 398 }
375 } 399 }
376 400
@@ -378,7 +402,7 @@ parse_xft_settings (prop, bytes, settings)
378} 402}
379 403
380static int 404static int
381read_xft_settings (dpyinfo, settings) 405read_settings (dpyinfo, settings)
382 struct x_display_info *dpyinfo; 406 struct x_display_info *dpyinfo;
383 struct xsettings *settings; 407 struct xsettings *settings;
384{ 408{
@@ -400,7 +424,7 @@ read_xft_settings (dpyinfo, settings)
400 424
401 if (rc == Success && prop != NULL && act_form == 8 && nitems > 0 425 if (rc == Success && prop != NULL && act_form == 8 && nitems > 0
402 && act_type == dpyinfo->Xatom_xsettings_prop) 426 && act_type == dpyinfo->Xatom_xsettings_prop)
403 rc = parse_xft_settings (prop, nitems, settings); 427 rc = parse_settings (prop, nitems, settings);
404 428
405 XFree (prop); 429 XFree (prop);
406 430
@@ -411,18 +435,17 @@ read_xft_settings (dpyinfo, settings)
411 435
412 436
413static void 437static void
414apply_xft_settings (dpyinfo, send_event_p) 438apply_xft_settings (dpyinfo, send_event_p, settings)
415 struct x_display_info *dpyinfo; 439 struct x_display_info *dpyinfo;
416 int send_event_p; 440 int send_event_p;
441 struct xsettings *settings;
417{ 442{
443#ifdef HAVE_XFT
418 FcPattern *pat; 444 FcPattern *pat;
419 struct xsettings settings, oldsettings; 445 struct xsettings oldsettings;
420 int changed = 0; 446 int changed = 0;
421 char buf[256]; 447 char buf[256];
422 448
423 if (!read_xft_settings (dpyinfo, &settings))
424 return;
425
426 memset (&oldsettings, 0, sizeof (oldsettings)); 449 memset (&oldsettings, 0, sizeof (oldsettings));
427 buf[0] = '\0'; 450 buf[0] = '\0';
428 pat = FcPatternCreate (); 451 pat = FcPatternCreate ();
@@ -436,74 +459,74 @@ apply_xft_settings (dpyinfo, send_event_p)
436 FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba); 459 FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba);
437 FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi); 460 FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi);
438 461
439 if ((settings.seen & SEEN_AA) != 0 && oldsettings.aa != settings.aa) 462 if ((settings->seen & SEEN_AA) != 0 && oldsettings.aa != settings->aa)
440 { 463 {
441 FcPatternDel (pat, FC_ANTIALIAS); 464 FcPatternDel (pat, FC_ANTIALIAS);
442 FcPatternAddBool (pat, FC_ANTIALIAS, settings.aa); 465 FcPatternAddBool (pat, FC_ANTIALIAS, settings->aa);
443 ++changed; 466 ++changed;
444 oldsettings.aa = settings.aa; 467 oldsettings.aa = settings->aa;
445 } 468 }
446 sprintf (buf, "Antialias: %d", oldsettings.aa); 469 sprintf (buf, "Antialias: %d", oldsettings.aa);
447 470
448 if ((settings.seen & SEEN_HINTING) != 0 471 if ((settings->seen & SEEN_HINTING) != 0
449 && oldsettings.hinting != settings.hinting) 472 && oldsettings.hinting != settings->hinting)
450 { 473 {
451 FcPatternDel (pat, FC_HINTING); 474 FcPatternDel (pat, FC_HINTING);
452 FcPatternAddBool (pat, FC_HINTING, settings.hinting); 475 FcPatternAddBool (pat, FC_HINTING, settings->hinting);
453 ++changed; 476 ++changed;
454 oldsettings.hinting = settings.hinting; 477 oldsettings.hinting = settings->hinting;
455 } 478 }
456 if (strlen (buf) > 0) strcat (buf, ", "); 479 if (strlen (buf) > 0) strcat (buf, ", ");
457 sprintf (buf+strlen (buf), "Hinting: %d", oldsettings.hinting); 480 sprintf (buf+strlen (buf), "Hinting: %d", oldsettings.hinting);
458 if ((settings.seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings.rgba) 481 if ((settings->seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings->rgba)
459 { 482 {
460 FcPatternDel (pat, FC_RGBA); 483 FcPatternDel (pat, FC_RGBA);
461 FcPatternAddInteger (pat, FC_RGBA, settings.rgba); 484 FcPatternAddInteger (pat, FC_RGBA, settings->rgba);
462 oldsettings.rgba = settings.rgba; 485 oldsettings.rgba = settings->rgba;
463 ++changed; 486 ++changed;
464 } 487 }
465 if (strlen (buf) > 0) strcat (buf, ", "); 488 if (strlen (buf) > 0) strcat (buf, ", ");
466 sprintf (buf+strlen (buf), "RGBA: %d", oldsettings.rgba); 489 sprintf (buf+strlen (buf), "RGBA: %d", oldsettings.rgba);
467 490
468 /* Older fontconfig versions don't have FC_LCD_FILTER. */ 491 /* Older fontconfig versions don't have FC_LCD_FILTER. */
469 if ((settings.seen & SEEN_LCDFILTER) != 0 492 if ((settings->seen & SEEN_LCDFILTER) != 0
470 && oldsettings.lcdfilter != settings.lcdfilter) 493 && oldsettings.lcdfilter != settings->lcdfilter)
471 { 494 {
472 FcPatternDel (pat, FC_LCD_FILTER); 495 FcPatternDel (pat, FC_LCD_FILTER);
473 FcPatternAddInteger (pat, FC_LCD_FILTER, settings.lcdfilter); 496 FcPatternAddInteger (pat, FC_LCD_FILTER, settings->lcdfilter);
474 ++changed; 497 ++changed;
475 oldsettings.lcdfilter = settings.lcdfilter; 498 oldsettings.lcdfilter = settings->lcdfilter;
476 } 499 }
477 if (strlen (buf) > 0) strcat (buf, ", "); 500 if (strlen (buf) > 0) strcat (buf, ", ");
478 sprintf (buf+strlen (buf), "LCDFilter: %d", oldsettings.lcdfilter); 501 sprintf (buf+strlen (buf), "LCDFilter: %d", oldsettings.lcdfilter);
479 502
480 if ((settings.seen & SEEN_HINTSTYLE) != 0 503 if ((settings->seen & SEEN_HINTSTYLE) != 0
481 && oldsettings.hintstyle != settings.hintstyle) 504 && oldsettings.hintstyle != settings->hintstyle)
482 { 505 {
483 FcPatternDel (pat, FC_HINT_STYLE); 506 FcPatternDel (pat, FC_HINT_STYLE);
484 FcPatternAddInteger (pat, FC_HINT_STYLE, settings.hintstyle); 507 FcPatternAddInteger (pat, FC_HINT_STYLE, settings->hintstyle);
485 ++changed; 508 ++changed;
486 oldsettings.hintstyle = settings.hintstyle; 509 oldsettings.hintstyle = settings->hintstyle;
487 } 510 }
488 if (strlen (buf) > 0) strcat (buf, ", "); 511 if (strlen (buf) > 0) strcat (buf, ", ");
489 sprintf (buf+strlen (buf), "Hintstyle: %d", oldsettings.hintstyle); 512 sprintf (buf+strlen (buf), "Hintstyle: %d", oldsettings.hintstyle);
490 513
491 if ((settings.seen & SEEN_DPI) != 0 && oldsettings.dpi != settings.dpi 514 if ((settings->seen & SEEN_DPI) != 0 && oldsettings.dpi != settings->dpi
492 && settings.dpi > 0) 515 && settings->dpi > 0)
493 { 516 {
494 Lisp_Object frame, tail; 517 Lisp_Object frame, tail;
495 518
496 FcPatternDel (pat, FC_DPI); 519 FcPatternDel (pat, FC_DPI);
497 FcPatternAddDouble (pat, FC_DPI, settings.dpi); 520 FcPatternAddDouble (pat, FC_DPI, settings->dpi);
498 ++changed; 521 ++changed;
499 oldsettings.dpi = settings.dpi; 522 oldsettings.dpi = settings->dpi;
500 523
501 /* Change the DPI on this display and all frames on the display. */ 524 /* Change the DPI on this display and all frames on the display. */
502 dpyinfo->resy = dpyinfo->resx = settings.dpi; 525 dpyinfo->resy = dpyinfo->resx = settings->dpi;
503 FOR_EACH_FRAME (tail, frame) 526 FOR_EACH_FRAME (tail, frame)
504 if (FRAME_X_P (XFRAME (frame)) 527 if (FRAME_X_P (XFRAME (frame))
505 && FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo) 528 && FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo)
506 XFRAME (frame)->resy = XFRAME (frame)->resx = settings.dpi; 529 XFRAME (frame)->resy = XFRAME (frame)->resx = settings->dpi;
507 } 530 }
508 531
509 if (strlen (buf) > 0) strcat (buf, ", "); 532 if (strlen (buf) > 0) strcat (buf, ", ");
@@ -513,23 +536,68 @@ apply_xft_settings (dpyinfo, send_event_p)
513 { 536 {
514 XftDefaultSet (dpyinfo->display, pat); 537 XftDefaultSet (dpyinfo->display, pat);
515 if (send_event_p) 538 if (send_event_p)
516 store_font_changed_event (Qfont_render, 539 store_config_changed_event (Qfont_render,
517 XCAR (dpyinfo->name_list_element)); 540 XCAR (dpyinfo->name_list_element));
518 Vxft_settings = make_string (buf, strlen (buf)); 541 Vxft_settings = make_string (buf, strlen (buf));
519 } 542 }
520 else 543 else
521 FcPatternDestroy (pat); 544 FcPatternDestroy (pat);
545#endif /* HAVE_XFT */
522} 546}
523 547
524#endif /* HAVE_XFT */ 548static void
549read_and_apply_settings (dpyinfo, send_event_p)
550 struct x_display_info *dpyinfo;
551 int send_event_p;
552{
553 struct xsettings settings;
554 Lisp_Object dpyname = XCAR (dpyinfo->name_list_element);
555
556 if (!read_settings (dpyinfo, &settings))
557 return;
558
559 apply_xft_settings (dpyinfo, True, &settings);
560 if (settings.seen & SEEN_TB_STYLE)
561 {
562 Lisp_Object style = Qnil;
563 if (strcmp (settings.tb_style, "both") == 0)
564 style = Qboth;
565 else if (strcmp (settings.tb_style, "both-horiz") == 0)
566 style = Qboth_horiz;
567 else if (strcmp (settings.tb_style, "icons") == 0)
568 style = Qimage;
569 else if (strcmp (settings.tb_style, "text") == 0)
570 style = Qtext;
571 if (!NILP (style) && !EQ (style, current_tool_bar_style))
572 {
573 current_tool_bar_style = style;
574 if (send_event_p)
575 store_config_changed_event (Qtool_bar_style, dpyname);
576 }
577 free (settings.tb_style);
578 }
579
580 if (settings.seen & SEEN_FONT)
581 {
582 if (!current_font || strcmp (current_font, settings.font) != 0)
583 {
584 free (current_font);
585 current_font = settings.font;
586 if (send_event_p)
587 store_config_changed_event (Qfont_name, dpyname);
588 }
589 else
590 free (settings.font);
591 }
592}
525 593
526void 594void
527xft_settings_event (dpyinfo, event) 595xft_settings_event (dpyinfo, event)
528 struct x_display_info *dpyinfo; 596 struct x_display_info *dpyinfo;
529 XEvent *event; 597 XEvent *event;
530{ 598{
531#ifdef HAVE_XFT
532 int check_window_p = 0; 599 int check_window_p = 0;
600 int apply_settings = 0;
533 601
534 switch (event->type) 602 switch (event->type)
535 { 603 {
@@ -549,20 +617,21 @@ xft_settings_event (dpyinfo, event)
549 if (event->xproperty.window == dpyinfo->xsettings_window 617 if (event->xproperty.window == dpyinfo->xsettings_window
550 && event->xproperty.state == PropertyNewValue 618 && event->xproperty.state == PropertyNewValue
551 && event->xproperty.atom == dpyinfo->Xatom_xsettings_prop) 619 && event->xproperty.atom == dpyinfo->Xatom_xsettings_prop)
552 { 620 apply_settings = 1;
553 apply_xft_settings (dpyinfo, True);
554 }
555 break; 621 break;
556 } 622 }
557 623
624
558 if (check_window_p) 625 if (check_window_p)
559 { 626 {
560 dpyinfo->xsettings_window = None; 627 dpyinfo->xsettings_window = None;
561 get_prop_window (dpyinfo); 628 get_prop_window (dpyinfo);
562 if (dpyinfo->xsettings_window != None) 629 if (dpyinfo->xsettings_window != None)
563 apply_xft_settings (dpyinfo, True); 630 apply_settings = 1;
564 } 631 }
565#endif /* HAVE_XFT */ 632
633 if (apply_settings)
634 read_and_apply_settings (dpyinfo, True);
566} 635}
567 636
568 637
@@ -600,10 +669,9 @@ init_gconf ()
600} 669}
601 670
602static void 671static void
603init_xfd_settings (dpyinfo) 672init_xsettings (dpyinfo)
604 struct x_display_info *dpyinfo; 673 struct x_display_info *dpyinfo;
605{ 674{
606#ifdef HAVE_XFT
607 char sel[64]; 675 char sel[64];
608 Display *dpy = dpyinfo->display; 676 Display *dpy = dpyinfo->display;
609 677
@@ -622,18 +690,9 @@ init_xfd_settings (dpyinfo)
622 690
623 get_prop_window (dpyinfo); 691 get_prop_window (dpyinfo);
624 if (dpyinfo->xsettings_window != None) 692 if (dpyinfo->xsettings_window != None)
625 apply_xft_settings (dpyinfo, False); 693 read_and_apply_settings (dpyinfo, False);
626 694
627 UNBLOCK_INPUT; 695 UNBLOCK_INPUT;
628
629#else /* ! HAVE_XFT */
630
631 dpyinfo->Xatom_xsettings_sel = None;
632 dpyinfo->Xatom_xsettings_prop = None;
633 dpyinfo->Xatom_xsettings_mgr = None;
634 dpyinfo->xsettings_window = None;
635
636#endif /* ! HAVE_XFT */
637} 696}
638 697
639void 698void
@@ -642,7 +701,7 @@ xsettings_initialize (dpyinfo)
642{ 701{
643 if (first_dpyinfo == NULL) first_dpyinfo = dpyinfo; 702 if (first_dpyinfo == NULL) first_dpyinfo = dpyinfo;
644 init_gconf (); 703 init_gconf ();
645 init_xfd_settings (dpyinfo); 704 init_xsettings (dpyinfo);
646} 705}
647 706
648const char * 707const char *
@@ -678,6 +737,23 @@ DEFUN ("font-get-system-font", Ffont_get_system_font, Sfont_get_system_font,
678 : Qnil; 737 : Qnil;
679} 738}
680 739
740DEFUN ("tool-bar-get-system-style", Ftool_bar_get_system_style, Stool_bar_get_system_style,
741 0, 0, 0,
742 doc: /* Get the system tool bar style.
743If no system tool bar style is known, return `tool-bar-style' if set to a
744known style. Otherwise return image. */)
745 ()
746{
747 if (EQ (Vtool_bar_style, Qimage)
748 || EQ (Vtool_bar_style, Qtext)
749 || EQ (Vtool_bar_style, Qboth)
750 || EQ (Vtool_bar_style, Qboth_horiz))
751 return Vtool_bar_style;
752 if (!NILP (current_tool_bar_style))
753 return current_tool_bar_style;
754 return Qimage;
755}
756
681void 757void
682syms_of_xsettings () 758syms_of_xsettings ()
683{ 759{
@@ -688,6 +764,8 @@ syms_of_xsettings ()
688 gconf_client = NULL; 764 gconf_client = NULL;
689#endif 765#endif
690 766
767 Qmonospace_font_name = intern_c_string ("monospace-font-name");
768 staticpro (&Qmonospace_font_name);
691 Qfont_name = intern_c_string ("font-name"); 769 Qfont_name = intern_c_string ("font-name");
692 staticpro (&Qfont_name); 770 staticpro (&Qfont_name);
693 Qfont_render = intern_c_string ("font-render"); 771 Qfont_render = intern_c_string ("font-render");
@@ -709,6 +787,13 @@ syms_of_xsettings ()
709 Fprovide (intern_c_string ("system-font-setting"), Qnil); 787 Fprovide (intern_c_string ("system-font-setting"), Qnil);
710#endif 788#endif
711#endif 789#endif
790
791 current_tool_bar_style = Qnil;
792 Qtool_bar_style = intern_c_string ("tool-bar-style");
793 staticpro (&Qtool_bar_style);
794 defsubr (&Stool_bar_get_system_style);
795
796 Fprovide (intern_c_string ("dynamic-setting"), Qnil);
712} 797}
713 798
714/* arch-tag: 541716ed-2e6b-42e1-8212-3197e01ea61d 799/* arch-tag: 541716ed-2e6b-42e1-8212-3197e01ea61d
diff --git a/src/xsettings.h b/src/xsettings.h
index f6399ea1bcc..53fca2ad6b5 100644
--- a/src/xsettings.h
+++ b/src/xsettings.h
@@ -22,6 +22,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 22
23EXFUN (Ffont_get_system_font, 0); 23EXFUN (Ffont_get_system_font, 0);
24EXFUN (Ffont_get_system_normal_font, 0); 24EXFUN (Ffont_get_system_normal_font, 0);
25EXFUN (Ftool_bar_get_system_style, 0);
25 26
26extern void xsettings_initialize P_ ((struct x_display_info *dpyinfo)); 27extern void xsettings_initialize P_ ((struct x_display_info *dpyinfo));
27extern void xft_settings_event P_ ((struct x_display_info *dpyinfo, 28extern void xft_settings_event P_ ((struct x_display_info *dpyinfo,
diff --git a/src/xsmfns.c b/src/xsmfns.c
index ec5ca3b1a9f..78d7d9f6523 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -90,6 +90,10 @@ Lisp_Object Vx_session_previous_id;
90 90
91#define NOSPLASH_OPT "--no-splash" 91#define NOSPLASH_OPT "--no-splash"
92 92
93/* The option to make Emacs start in the given directory. */
94
95#define CHDIR_OPT "--chdir="
96
93static void 97static void
94ice_connection_closed () 98ice_connection_closed ()
95{ 99{
@@ -206,7 +210,7 @@ smc_save_yourself_CB (smcConn,
206 int props_idx = 0; 210 int props_idx = 0;
207 211
208 char *cwd = NULL; 212 char *cwd = NULL;
209 char *smid_opt; 213 char *smid_opt, *chdir_opt = NULL;
210 214
211 /* How to start a new instance of Emacs. */ 215 /* How to start a new instance of Emacs. */
212 props[props_idx] = &prop_ptr[props_idx]; 216 props[props_idx] = &prop_ptr[props_idx];
@@ -228,11 +232,12 @@ smc_save_yourself_CB (smcConn,
228 props[props_idx]->vals[0].value = SDATA (Vinvocation_name); 232 props[props_idx]->vals[0].value = SDATA (Vinvocation_name);
229 ++props_idx; 233 ++props_idx;
230 234
231 /* How to restart Emacs (i.e.: /path/to/emacs --smid=xxxx --no-splash). */ 235 /* How to restart Emacs. */
232 props[props_idx] = &prop_ptr[props_idx]; 236 props[props_idx] = &prop_ptr[props_idx];
233 props[props_idx]->name = SmRestartCommand; 237 props[props_idx]->name = SmRestartCommand;
234 props[props_idx]->type = SmLISTofARRAY8; 238 props[props_idx]->type = SmLISTofARRAY8;
235 props[props_idx]->num_vals = 3; /* /path/to/emacs, --smid=xxx --no-splash */ 239 /* /path/to/emacs, --smid=xxx --no-splash --chdir=dir */
240 props[props_idx]->num_vals = 4;
236 props[props_idx]->vals = &values[val_idx]; 241 props[props_idx]->vals = &values[val_idx];
237 props[props_idx]->vals[0].length = strlen (emacs_program); 242 props[props_idx]->vals[0].length = strlen (emacs_program);
238 props[props_idx]->vals[0].value = emacs_program; 243 props[props_idx]->vals[0].value = emacs_program;
@@ -246,7 +251,19 @@ smc_save_yourself_CB (smcConn,
246 251
247 props[props_idx]->vals[2].length = strlen (NOSPLASH_OPT); 252 props[props_idx]->vals[2].length = strlen (NOSPLASH_OPT);
248 props[props_idx]->vals[2].value = NOSPLASH_OPT; 253 props[props_idx]->vals[2].value = NOSPLASH_OPT;
249 val_idx += 3; 254
255 cwd = get_current_dir_name ();
256 if (cwd)
257 {
258 chdir_opt = xmalloc (strlen (CHDIR_OPT) + strlen (cwd) + 1);
259 strcpy (chdir_opt, CHDIR_OPT);
260 strcat (chdir_opt, cwd);
261
262 props[props_idx]->vals[3].length = strlen (chdir_opt);
263 props[props_idx]->vals[3].value = chdir_opt;
264 }
265
266 val_idx += cwd ? 4 : 3;
250 ++props_idx; 267 ++props_idx;
251 268
252 /* User id. */ 269 /* User id. */
@@ -259,7 +276,6 @@ smc_save_yourself_CB (smcConn,
259 props[props_idx]->vals[0].value = SDATA (Vuser_login_name); 276 props[props_idx]->vals[0].value = SDATA (Vuser_login_name);
260 ++props_idx; 277 ++props_idx;
261 278
262 cwd = get_current_dir_name ();
263 279
264 if (cwd) 280 if (cwd)
265 { 281 {
@@ -277,6 +293,7 @@ smc_save_yourself_CB (smcConn,
277 SmcSetProperties (smcConn, props_idx, props); 293 SmcSetProperties (smcConn, props_idx, props);
278 294
279 xfree (smid_opt); 295 xfree (smid_opt);
296 xfree (chdir_opt);
280 297
281 free (cwd); 298 free (cwd);
282 299
diff --git a/src/xterm.c b/src/xterm.c
index 29ed5bb865c..f867632f22f 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2291,7 +2291,7 @@ static void
2291x_draw_image_relief (s) 2291x_draw_image_relief (s)
2292 struct glyph_string *s; 2292 struct glyph_string *s;
2293{ 2293{
2294 int x0, y0, x1, y1, thick, raised_p; 2294 int x0, y0, x1, y1, thick, raised_p, extra;
2295 XRectangle r; 2295 XRectangle r;
2296 int x = s->x; 2296 int x = s->x;
2297 int y = s->ybase - image_ascent (s->img, s->face, &s->slice); 2297 int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
@@ -2322,10 +2322,13 @@ x_draw_image_relief (s)
2322 raised_p = s->img->relief > 0; 2322 raised_p = s->img->relief > 0;
2323 } 2323 }
2324 2324
2325 x0 = x - thick; 2325 extra = s->face->id == TOOL_BAR_FACE_ID
2326 y0 = y - thick; 2326 ? XINT (Vtool_bar_button_margin) : 0;
2327 x1 = x + s->slice.width + thick - 1; 2327
2328 y1 = y + s->slice.height + thick - 1; 2328 x0 = x - thick - extra;
2329 y0 = y - thick - extra;
2330 x1 = x + s->slice.width + thick - 1 + extra;
2331 y1 = y + s->slice.height + thick - 1 + extra;
2329 2332
2330 x_setup_relief_colors (s); 2333 x_setup_relief_colors (s);
2331 get_glyph_string_clip_rect (s, &r); 2334 get_glyph_string_clip_rect (s, &r);
@@ -7492,36 +7495,40 @@ x_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, activ
7492 w->phys_cursor_on_p = 1; 7495 w->phys_cursor_on_p = 1;
7493 7496
7494 if (glyph_row->exact_window_width_line_p 7497 if (glyph_row->exact_window_width_line_p
7495 && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA]) 7498 && (glyph_row->reversed_p
7499 ? (w->phys_cursor.hpos < 0)
7500 : (w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])))
7496 { 7501 {
7497 glyph_row->cursor_in_fringe_p = 1; 7502 glyph_row->cursor_in_fringe_p = 1;
7498 draw_fringe_bitmap (w, glyph_row, 0); 7503 draw_fringe_bitmap (w, glyph_row, glyph_row->reversed_p);
7499 } 7504 }
7500 else 7505 else
7501 switch (cursor_type)
7502 { 7506 {
7503 case HOLLOW_BOX_CURSOR: 7507 switch (cursor_type)
7504 x_draw_hollow_cursor (w, glyph_row); 7508 {
7505 break; 7509 case HOLLOW_BOX_CURSOR:
7510 x_draw_hollow_cursor (w, glyph_row);
7511 break;
7506 7512
7507 case FILLED_BOX_CURSOR: 7513 case FILLED_BOX_CURSOR:
7508 draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR); 7514 draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR);
7509 break; 7515 break;
7510 7516
7511 case BAR_CURSOR: 7517 case BAR_CURSOR:
7512 x_draw_bar_cursor (w, glyph_row, cursor_width, BAR_CURSOR); 7518 x_draw_bar_cursor (w, glyph_row, cursor_width, BAR_CURSOR);
7513 break; 7519 break;
7514 7520
7515 case HBAR_CURSOR: 7521 case HBAR_CURSOR:
7516 x_draw_bar_cursor (w, glyph_row, cursor_width, HBAR_CURSOR); 7522 x_draw_bar_cursor (w, glyph_row, cursor_width, HBAR_CURSOR);
7517 break; 7523 break;
7518 7524
7519 case NO_CURSOR: 7525 case NO_CURSOR:
7520 w->phys_cursor_width = 0; 7526 w->phys_cursor_width = 0;
7521 break; 7527 break;
7522 7528
7523 default: 7529 default:
7524 abort (); 7530 abort ();
7531 }
7525 } 7532 }
7526 7533
7527#ifdef HAVE_X_I18N 7534#ifdef HAVE_X_I18N
@@ -7929,8 +7936,8 @@ x_connection_closed (dpy, error_message)
7929 if (terminal_list->next_terminal == NULL) 7936 if (terminal_list->next_terminal == NULL)
7930 { 7937 {
7931 fprintf (stderr, "%s\n", error_msg); 7938 fprintf (stderr, "%s\n", error_msg);
7932 shut_down_emacs (0, 0, Qnil); 7939 Fkill_emacs (make_number (70));
7933 exit (70); 7940 /* NOTREACHED */
7934 } 7941 }
7935 xg_display_close (dpyinfo->display); 7942 xg_display_close (dpyinfo->display);
7936#endif 7943#endif
@@ -7956,8 +7963,8 @@ x_connection_closed (dpy, error_message)
7956 if (terminal_list == 0) 7963 if (terminal_list == 0)
7957 { 7964 {
7958 fprintf (stderr, "%s\n", error_msg); 7965 fprintf (stderr, "%s\n", error_msg);
7959 shut_down_emacs (0, 0, Qnil); 7966 Fkill_emacs (make_number (70));
7960 exit (70); 7967 /* NOTREACHED */
7961 } 7968 }
7962 7969
7963 /* Ordinary stack unwind doesn't deal with these. */ 7970 /* Ordinary stack unwind doesn't deal with these. */