428
|
1 /* XEmacs -- Fully extensible Emacs, running on Unix and other platforms.
|
|
2 Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994
|
|
3 Free Software Foundation, Inc.
|
|
4 Copyright (C) 1995 Sun Microsystems, Inc.
|
1315
|
5 Copyright (C) 2000, 2001, 2002, 2003 Ben Wing.
|
428
|
6
|
|
7 This file is part of XEmacs.
|
|
8
|
|
9 XEmacs is free software; you can redistribute it and/or modify it
|
|
10 under the terms of the GNU General Public License as published by the
|
|
11 Free Software Foundation; either version 2, or (at your option) any
|
|
12 later version.
|
|
13
|
|
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
17 for more details.
|
|
18
|
|
19 You should have received a copy of the GNU General Public License
|
|
20 along with XEmacs; see the file COPYING. If not, write to
|
|
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
22 Boston, MA 02111-1307, USA. */
|
|
23
|
|
24 /* Synched up with: Mule 2.0, FSF 19.28. */
|
|
25
|
442
|
26 /* Capsule summary of the various releases of Lucid Emacs/XEmacs and
|
771
|
27 FSF/GNU Emacs. (Copied from the Internals Manual, where the
|
|
28 canonical version lives.) Provided here for use in cross-referencing
|
|
29 version releases and dates in comments, esp. in the authorship
|
|
30 comments at the beginning of each file. More information about
|
|
31 history can be found in the beginning of the Internals Manual and
|
|
32 in the About page.
|
442
|
33
|
|
34
|
|
35 -- A time line for Lucid Emacs/XEmacs is
|
|
36
|
|
37 version 19.0 shipped with Energize 1.0, April 1992.
|
|
38 version 19.1 released June 4, 1992.
|
|
39 version 19.2 released June 19, 1992.
|
|
40 version 19.3 released September 9, 1992.
|
|
41 version 19.4 released January 21, 1993.
|
|
42 version 19.5 was a repackaging of 19.4 with a few bug fixes and
|
|
43 shipped with Energize 2.0. Never released to the net.
|
|
44 version 19.6 released April 9, 1993.
|
|
45 version 19.7 was a repackaging of 19.6 with a few bug fixes and
|
|
46 shipped with Energize 2.1. Never released to the net.
|
|
47 version 19.8 released September 6, 1993.
|
|
48 version 19.9 released January 12, 1994.
|
|
49 version 19.10 released May 27, 1994.
|
|
50 version 19.11 (first XEmacs) released September 13, 1994.
|
|
51 version 19.12 released June 23, 1995.
|
|
52 version 19.13 released September 1, 1995.
|
|
53 version 19.14 released June 23, 1996.
|
|
54 version 20.0 released February 9, 1997.
|
|
55 version 19.15 released March 28, 1997.
|
|
56 version 20.1 (not released to the net) April 15, 1997.
|
|
57 version 20.2 released May 16, 1997.
|
|
58 version 19.16 released October 31, 1997.
|
771
|
59 version 20.3 (the first stable version of XEmacs 20.x) released November 30,
|
|
60 1997.
|
442
|
61 version 20.4 released February 28, 1998.
|
771
|
62 version 21.0.60 released December 10, 1998. (The version naming scheme was
|
|
63 changed at this point: [a] the second version number is odd for stable
|
|
64 versions, even for beta versions; [b] a third version number is added,
|
|
65 replacing the "beta xxx" ending for beta versions and allowing for
|
|
66 periodic maintenance releases for stable versions. Therefore, 21.0 was
|
|
67 never "officially" released; similarly for 21.2, etc.)
|
|
68 version 21.0.61 released January 4, 1999.
|
|
69 version 21.0.63 released February 3, 1999.
|
|
70 version 21.0.64 released March 1, 1999.
|
|
71 version 21.0.65 released March 5, 1999.
|
|
72 version 21.0.66 released March 12, 1999.
|
|
73 version 21.0.67 released March 25, 1999.
|
788
|
74 version 21.1.2 released May 14, 1999; on comp.emacs, May 28. (This is
|
|
75 the followup to 21.0.67. The second version number was bumped to indicate
|
|
76 the beginning of the "stable" series.)
|
771
|
77 version 21.1.3 released June 26, 1999.
|
|
78 version 21.1.4 released July 8, 1999.
|
|
79 version 21.1.6 released August 14, 1999. (There was no 21.1.5.)
|
|
80 version 21.1.7 released September 26, 1999.
|
|
81 version 21.1.8 released November 2, 1999.
|
|
82 version 21.1.9 released February 13, 2000.
|
|
83 version 21.1.10 released May 7, 2000.
|
|
84 version 21.1.10a released June 24, 2000.
|
|
85 version 21.1.11 released July 18, 2000.
|
|
86 version 21.1.12 released August 5, 2000.
|
|
87 version 21.1.13 released January 7, 2001.
|
|
88 version 21.1.14 released January 27, 2001.
|
|
89 version 21.2.9 released February 3, 1999.
|
|
90 version 21.2.10 released February 5, 1999.
|
|
91 version 21.2.11 released March 1, 1999.
|
|
92 version 21.2.12 released March 5, 1999.
|
|
93 version 21.2.13 released March 12, 1999.
|
|
94 version 21.2.14 released May 14, 1999.
|
|
95 version 21.2.15 released June 4, 1999.
|
|
96 version 21.2.16 released June 11, 1999.
|
|
97 version 21.2.17 released June 22, 1999.
|
|
98 version 21.2.18 released July 14, 1999.
|
|
99 version 21.2.19 released July 30, 1999.
|
|
100 version 21.2.20 released November 10, 1999.
|
|
101 version 21.2.21 released November 28, 1999.
|
|
102 version 21.2.22 released November 29, 1999.
|
|
103 version 21.2.23 released December 7, 1999.
|
|
104 version 21.2.24 released December 14, 1999.
|
|
105 version 21.2.25 released December 24, 1999.
|
|
106 version 21.2.26 released December 31, 1999.
|
|
107 version 21.2.27 released January 18, 2000.
|
|
108 version 21.2.28 released February 7, 2000.
|
|
109 version 21.2.29 released February 16, 2000.
|
|
110 version 21.2.30 released February 21, 2000.
|
|
111 version 21.2.31 released February 23, 2000.
|
|
112 version 21.2.32 released March 20, 2000.
|
|
113 version 21.2.33 released May 1, 2000.
|
|
114 version 21.2.34 released May 28, 2000.
|
|
115 version 21.2.35 released July 19, 2000.
|
|
116 version 21.2.36 released October 4, 2000.
|
|
117 version 21.2.37 released November 14, 2000.
|
|
118 version 21.2.38 released December 5, 2000.
|
|
119 version 21.2.39 released December 31, 2000.
|
|
120 version 21.2.40 released January 8, 2001.
|
788
|
121 version 21.2.41 "Polyhymnia" released January 17, 2001.
|
|
122 version 21.2.42 "Poseidon" released January 20, 2001.
|
|
123 version 21.2.43 "Terspichore" released January 26, 2001.
|
|
124 version 21.2.44 "Thalia" released February 8, 2001.
|
|
125 version 21.2.45 "Thelxepeia" released February 23, 2001.
|
|
126 version 21.2.46 "Urania" released March 21, 2001.
|
|
127 version 21.5.0 "alfalfa" released April 18, 2001.
|
|
128 version 21.5.1 "anise" released May 9, 2001.
|
|
129 version 21.5.2 "artichoke" released July 28, 2001.
|
|
130 version 21.5.3 "asparagus" released September 7, 2001.
|
|
131 version 21.5.4 "bamboo" released January 8, 2002.
|
|
132 version 21.5.5 "beets" released March 5, 2002.
|
826
|
133 version 21.5.6 "bok choi" released April 5, 2002.
|
442
|
134
|
|
135
|
|
136 -- A time line for GNU Emacs version 19 is
|
|
137
|
|
138 version 19.7 (beta) (first beta release) released ??????; prob. late May 1993.
|
|
139 version 19.8 (beta) released May 27, 1993.
|
|
140 version 19.9 (beta) released May 27, 1993.
|
|
141 version 19.10 (beta) released May 30, 1993.
|
|
142 version 19.11 (beta) released June 1, 1993.
|
|
143 version 19.12 (beta) released June 2, 1993.
|
|
144 version 19.13 (beta) released June 8, 1993.
|
|
145 version 19.14 (beta) released June 17, 1993.
|
|
146 version 19.15 (beta) released June 19, 1993.
|
|
147 version 19.16 (beta) released July 6, 1993.
|
|
148 version 19.17 (beta) released late July, 1993.
|
|
149 version 19.18 (beta) released August 9, 1993.
|
|
150 version 19.19 (beta) released August 15, 1993.
|
|
151 version 19.20 (beta) released November 17, 1993.
|
|
152 version 19.21 (beta) released November 17, 1993.
|
|
153 version 19.22 (beta) released November 28, 1993.
|
788
|
154 version 19.23 (beta) released on comp.emacs, May 17, 1994.
|
442
|
155 version 19.24 (beta) released May 16, 1994.
|
|
156 version 19.25 (beta) released June 3, 1994.
|
|
157 version 19.26 (beta) released September 11, 1994.
|
|
158 version 19.27 (beta) released September 14, 1994.
|
|
159 version 19.28 (first ``official'' release) released November 1, 1994.
|
|
160 version 19.29 released June 21, 1995.
|
|
161 version 19.30 released November 24, 1995.
|
|
162 version 19.31 released May 25, 1996.
|
|
163 version 19.32 released July 31, 1996.
|
|
164 version 19.33 released August 11, 1996.
|
788
|
165 version 19.34 released August 21, 1996; on comp.emacs, August 22.
|
442
|
166 version 19.34b released September 6, 1996.
|
|
167
|
|
168
|
788
|
169 -- A time line for GNU Emacs versions 20 and 21 is
|
442
|
170
|
|
171 version 20.1 released September 17, 1997.
|
|
172 version 20.2 released September 20, 1997.
|
|
173 version 20.3 released August 19, 1998.
|
788
|
174 version 20.4 released July 12, 1999; on comp.emacs, July 27.
|
|
175 version 21.1 released October 20, 2001.
|
442
|
176
|
|
177
|
|
178 -- A time line for GNU Emacs version 18 and older is
|
|
179
|
|
180 GNU Emacs version 15 (15.34) was released sometime in 1984 or 1985 and
|
|
181 shared some code with a version of Emacs written by James Gosling (the
|
|
182 same James Gosling who later created the Java language).
|
|
183 GNU Emacs version 16 (first released version was 16.56) was released on
|
|
184 July 15, 1985. All Gosling code was removed due to potential copyright
|
|
185 problems with the code.
|
|
186 version 16.57: released on September 16, 1985.
|
|
187 versions 16.58, 16.59: released on September 17, 1985.
|
|
188 version 16.60: released on September 19, 1985. These later version 16's
|
|
189 incorporated patches from the net, esp. for getting Emacs to work under
|
|
190 System V.
|
|
191 version 17.36 (first official v17 release) released on December 20, 1985.
|
|
192 Included a TeX-able user manual. First official unpatched version that
|
|
193 worked on vanilla System V machines.
|
|
194 version 17.43 (second official v17 release) released on January 25, 1986.
|
|
195 version 17.45 released on January 30, 1986.
|
|
196 version 17.46 released on February 4, 1986.
|
|
197 version 17.48 released on February 10, 1986.
|
|
198 version 17.49 released on February 12, 1986.
|
|
199 version 17.55 released on March 18, 1986.
|
|
200 version 17.57 released on March 27, 1986.
|
|
201 version 17.58 released on April 4, 1986.
|
|
202 version 17.61 released on April 12, 1986.
|
|
203 version 17.63 released on May 7, 1986.
|
|
204 version 17.64 released on May 12, 1986.
|
|
205 version 18.24 (a beta version) released on October 2, 1986.
|
|
206 version 18.30 (a beta version) released on November 15, 1986.
|
|
207 version 18.31 (a beta version) released on November 23, 1986.
|
|
208 version 18.32 (a beta version) released on December 7, 1986.
|
|
209 version 18.33 (a beta version) released on December 12, 1986.
|
|
210 version 18.35 (a beta version) released on January 5, 1987.
|
|
211 version 18.36 (a beta version) released on January 21, 1987.
|
|
212 January 27, 1987: The Great Usenet Renaming. net.emacs is now comp.emacs.
|
|
213 version 18.37 (a beta version) released on February 12, 1987.
|
|
214 version 18.38 (a beta version) released on March 3, 1987.
|
|
215 version 18.39 (a beta version) released on March 14, 1987.
|
|
216 version 18.40 (a beta version) released on March 18, 1987.
|
|
217 version 18.41 (the first ``official'' release) released on March 22, 1987.
|
|
218 version 18.45 released on June 2, 1987.
|
|
219 version 18.46 released on June 9, 1987.
|
|
220 version 18.47 released on June 18, 1987.
|
|
221 version 18.48 released on September 3, 1987.
|
|
222 version 18.49 released on September 18, 1987.
|
|
223 version 18.50 released on February 13, 1988.
|
|
224 version 18.51 released on May 7, 1988.
|
|
225 version 18.52 released on September 1, 1988.
|
|
226 version 18.53 released on February 24, 1989.
|
|
227 version 18.54 released on April 26, 1989.
|
|
228 version 18.55 released on August 23, 1989. This is the earliest version
|
|
229 that is still available by FTP.
|
|
230 version 18.56 released on January 17, 1991.
|
|
231 version 18.57 released late January, 1991.
|
|
232 version 18.58 released ?????.
|
|
233 version 18.59 released October 31, 1992.
|
|
234
|
|
235 */
|
854
|
236
|
428
|
237 /* Note: It is necessary to specify <config.h> and not "config.h" in
|
|
238 order for the --srcdir type of compilation to work properly.
|
|
239 Otherwise the config.h from the srcdir, rather than the one from
|
|
240 the build dir, will be used. */
|
|
241
|
|
242 #include <config.h>
|
|
243 #include "lisp.h"
|
|
244
|
|
245 #include "backtrace.h" /* run-emacs-from-temacs needs this */
|
|
246 #include "buffer.h"
|
|
247 #include "commands.h"
|
|
248 #include "console.h"
|
|
249 #include "process.h"
|
|
250 #include "redisplay.h"
|
438
|
251 #include "frame.h"
|
428
|
252 #include "sysdep.h"
|
|
253
|
|
254 #include "systty.h"
|
|
255 #include "sysfile.h"
|
|
256 #include "systime.h"
|
771
|
257 #include "sysproc.h" /* for qxe_getpid() */
|
428
|
258
|
|
259 #ifdef QUANTIFY
|
|
260 #include <quantify.h>
|
|
261 #endif
|
|
262
|
|
263 #ifdef HAVE_SHLIB
|
|
264 #include "sysdll.h"
|
|
265 #endif
|
|
266
|
|
267 #ifdef TOOLTALK
|
442
|
268 #include TT_C_H_FILE
|
428
|
269 #endif
|
|
270
|
1315
|
271 #ifdef WIN32_ANY
|
872
|
272 #include "console-msw.h"
|
428
|
273 #endif
|
|
274
|
|
275 /* For PATH_EXEC */
|
|
276 #include <paths.h>
|
|
277
|
826
|
278 #if defined (HEAP_IN_DATA) && !defined (PDUMP)
|
428
|
279 void report_sheap_usage (int die_if_pure_storage_exceeded);
|
|
280 #endif
|
|
281
|
|
282 #if !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC)
|
|
283 extern void *(*__malloc_hook)(size_t);
|
|
284 extern void *(*__realloc_hook)(void *, size_t);
|
|
285 extern void (*__free_hook)(void *);
|
|
286 #endif /* not SYSTEM_MALLOC && not DOUG_LEA_MALLOC */
|
|
287
|
|
288 /* Command line args from shell, as list of strings */
|
|
289 Lisp_Object Vcommand_line_args;
|
|
290
|
|
291 /* Set nonzero after XEmacs has started up the first time.
|
|
292 Prevents reinitialization of the Lisp world and keymaps
|
|
293 on subsequent starts. */
|
|
294 int initialized;
|
|
295
|
|
296 #ifdef DOUG_LEA_MALLOC
|
|
297 # include <malloc.h>
|
|
298 /* Preserves a pointer to the memory allocated that copies that
|
|
299 static data inside glibc's malloc. */
|
|
300 static void *malloc_state_ptr;
|
|
301 #endif /* DOUG_LEA_MALLOC */
|
|
302
|
|
303 # ifdef REL_ALLOC
|
|
304 void r_alloc_reinit (void);
|
|
305 # endif
|
|
306
|
|
307 /* Variable whose value is symbol giving operating system type. */
|
|
308 Lisp_Object Vsystem_type;
|
|
309
|
|
310 /* Variable whose value is string giving configuration built for. */
|
|
311 Lisp_Object Vsystem_configuration;
|
|
312
|
|
313 /* Variable whose value is string containing the configuration options
|
|
314 XEmacs was built with. */
|
|
315 Lisp_Object Vsystem_configuration_options;
|
|
316
|
|
317 /* Version numbers and strings */
|
|
318 Lisp_Object Vemacs_major_version;
|
|
319 Lisp_Object Vemacs_minor_version;
|
|
320 Lisp_Object Vemacs_patch_level;
|
|
321 Lisp_Object Vemacs_beta_version;
|
|
322 Lisp_Object Vxemacs_codename;
|
975
|
323 Lisp_Object Vxemacs_extra_name;
|
428
|
324 #ifdef INFODOCK
|
|
325 Lisp_Object Vinfodock_major_version;
|
|
326 Lisp_Object Vinfodock_minor_version;
|
|
327 Lisp_Object Vinfodock_build_version;
|
|
328 #endif
|
|
329
|
|
330 /* The path under which XEmacs was invoked. */
|
|
331 Lisp_Object Vinvocation_path;
|
|
332
|
|
333 /* The name under which XEmacs was invoked, with any leading directory
|
|
334 names discarded. */
|
|
335 Lisp_Object Vinvocation_name;
|
|
336
|
|
337 /* The directory name from which XEmacs was invoked. */
|
|
338 Lisp_Object Vinvocation_directory;
|
|
339
|
|
340 #if 0 /* FSFmacs */
|
|
341 /* The directory name in which to find subdirs such as lisp and etc.
|
|
342 nil means get them only from PATH_LOADSEARCH. */
|
|
343 Lisp_Object Vinstallation_directory;
|
|
344 #endif
|
|
345
|
|
346 Lisp_Object Vemacs_program_name, Vemacs_program_version;
|
|
347 Lisp_Object Vexec_path;
|
|
348 Lisp_Object Vexec_directory, Vconfigure_exec_directory;
|
|
349 Lisp_Object Vlisp_directory, Vconfigure_lisp_directory;
|
460
|
350 Lisp_Object Vmule_lisp_directory, Vconfigure_mule_lisp_directory;
|
428
|
351 Lisp_Object Vmodule_directory, Vconfigure_module_directory;
|
|
352 Lisp_Object Vsite_module_directory, Vconfigure_site_module_directory;
|
|
353 Lisp_Object Vconfigure_package_path;
|
|
354 Lisp_Object Vdata_directory, Vconfigure_data_directory;
|
|
355 Lisp_Object Vdoc_directory, Vconfigure_doc_directory;
|
|
356 Lisp_Object Vconfigure_lock_directory;
|
|
357 Lisp_Object Vdata_directory_list;
|
|
358 Lisp_Object Vconfigure_info_directory;
|
|
359 Lisp_Object Vsite_directory, Vconfigure_site_directory;
|
|
360 Lisp_Object Vconfigure_info_path;
|
|
361 Lisp_Object Vinternal_error_checking;
|
438
|
362 Lisp_Object Vmail_lock_methods, Vconfigure_mail_lock_method;
|
428
|
363
|
|
364 /* The default base directory XEmacs is installed under. */
|
|
365 Lisp_Object Vconfigure_exec_prefix_directory, Vconfigure_prefix_directory;
|
|
366
|
|
367 /* If nonzero, set XEmacs to run at this priority. This is also used
|
|
368 in child_setup and sys_suspend to make sure subshells run at normal
|
|
369 priority. */
|
458
|
370 Fixnum emacs_priority;
|
428
|
371
|
442
|
372 /* Some FSF junk with running_asynch_code, to preserve the match
|
|
373 data. Not necessary because we don't call process filters
|
|
374 asynchronously (i.e. from within QUIT). */
|
428
|
375
|
|
376 /* If non-zero, a window-system was specified on the command line. */
|
|
377 int display_arg;
|
|
378
|
|
379 /* Type of display specified. We cannot use a Lisp symbol here because
|
|
380 Lisp symbols may not initialized at the time that we set this
|
|
381 variable. */
|
771
|
382 const Char_ASCII *display_use;
|
428
|
383
|
|
384 /* If non-zero, then the early error handler will only print the error
|
|
385 message and exit. */
|
|
386 int suppress_early_error_handler_backtrace;
|
|
387
|
|
388 /* An address near the bottom of the stack.
|
|
389 Tells GC how to save a copy of the stack. */
|
|
390 char *stack_bottom;
|
|
391
|
|
392 #ifdef USG_SHARED_LIBRARIES
|
|
393 /* If nonzero, this is the place to put the end of the writable segment
|
|
394 at startup. */
|
|
395
|
|
396 uintptr_t bss_end = 0;
|
|
397 #endif
|
|
398
|
647
|
399 /* Number of bytes of writable memory we can expect to be able to get:
|
|
400 Leave this as an unsigned int because it could potentially be 4G */
|
428
|
401 unsigned int lim_data;
|
|
402
|
442
|
403 /* WARNING!
|
|
404
|
|
405 Some LISP-visible command-line options are set by XEmacs _before_ the
|
|
406 data is dumped in building a --pdump XEmacs, but used _after_ it is
|
446
|
407 restored in normal operation. Thus the dump-time values overwrite the
|
|
408 values XEmacs is getting at runtime. Such variables must be saved
|
442
|
409 before loading the dumpfile, and restored afterward.
|
|
410
|
446
|
411 Therefore these variables may not be initialized in vars_of_emacs().
|
|
412
|
|
413 The save/restore is done immediately before and after pdump_load() in
|
|
414 main_1(). See that function for the current list of protected variables.
|
|
415
|
|
416 Note that saving/restoring is only necessary for a few variables that are
|
|
417 o command line arguments effective at runtime (as opposed to dump-time),
|
|
418 o parsed before pdump_load, and
|
|
419 o exported to Lisp via a DEFVAR.
|
442
|
420 */
|
|
421
|
428
|
422 /* Nonzero means running XEmacs without interactive terminal. */
|
|
423
|
|
424 int noninteractive;
|
|
425
|
|
426 /* Value of Lisp variable `noninteractive'.
|
|
427 Normally same as C variable `noninteractive'
|
442
|
428 but nothing terrible happens if user sets this one.
|
|
429
|
|
430 Shadowed from the pdumper by `noninteractive'. */
|
428
|
431
|
|
432 int noninteractive1;
|
|
433
|
|
434 /* Nonzero means don't perform site-lisp searches at startup */
|
|
435 int inhibit_site_lisp;
|
|
436
|
|
437 /* Nonzero means don't perform site-modules searches at startup */
|
|
438 int inhibit_site_modules;
|
|
439
|
776
|
440 /* Nonzero means don't load user-init or site-start file */
|
|
441 int vanilla_inhibiting;
|
|
442
|
428
|
443 /* Nonzero means don't respect early packages at startup */
|
|
444 int inhibit_early_packages;
|
|
445
|
776
|
446 /* Nonzero means don't respect any packages at startup -- act as if they
|
|
447 don't exist. */
|
|
448 int inhibit_all_packages;
|
|
449
|
428
|
450 /* Nonzero means don't load package autoloads at startup */
|
|
451 int inhibit_autoloads;
|
|
452
|
442
|
453 /* Nonzero means don't load the dump file (ignored if not PDUMP) */
|
|
454
|
|
455 int nodumpfile;
|
|
456
|
428
|
457 /* Nonzero means print debug information about path searching */
|
|
458 int debug_paths;
|
|
459
|
|
460 /* Save argv and argc. */
|
444
|
461 static Extbyte **initial_argv; /* #### currently unused */
|
|
462 static int initial_argc; /* #### currently unused */
|
428
|
463
|
|
464 static void sort_args (int argc, char **argv);
|
|
465
|
|
466 Lisp_Object Qkill_emacs_hook;
|
|
467 Lisp_Object Qsave_buffers_kill_emacs;
|
|
468
|
1315
|
469 Lisp_Object Qtemacs, Qdumping, Qrestarted, Qpdump, Qbatch;
|
|
470
|
442
|
471 /* Nonzero if handling a fatal error already. */
|
|
472 int fatal_error_in_progress;
|
|
473
|
771
|
474 /* Nonzero means we're going down, so we better not run any hooks
|
442
|
475 or do other non-essential stuff. */
|
|
476 int preparing_for_armageddon;
|
|
477
|
771
|
478 /* Nonzero means we're in an unstable situation and need to skip
|
|
479 i18n conversions and such during printing. */
|
|
480 int inhibit_non_essential_printing_operations;
|
442
|
481
|
|
482 static JMP_BUF run_temacs_catch;
|
|
483
|
|
484 static int run_temacs_argc;
|
502
|
485 static Extbyte **run_temacs_argv;
|
|
486 static Extbyte *run_temacs_args;
|
647
|
487 static int run_temacs_argv_size;
|
|
488 static int run_temacs_args_size;
|
442
|
489
|
|
490 #ifdef _MSC_VER
|
771
|
491 static DWORD mswindows_handle_hardware_exceptions (DWORD code);
|
|
492 #endif
|
442
|
493
|
826
|
494 #ifdef WIN32_NATIVE
|
|
495 static DWORD CALLBACK wait_for_termination_signal (LPVOID handle);
|
|
496 #endif
|
|
497
|
442
|
498
|
771
|
499 /************************************************************************/
|
|
500 /* Functions to handle arguments */
|
|
501 /************************************************************************/
|
|
502
|
428
|
503 /* Code for dealing with Lisp access to the Unix command line */
|
|
504
|
|
505 static Lisp_Object
|
442
|
506 make_arg_list_1 (int argc, Extbyte **argv, int skip_args)
|
428
|
507 {
|
|
508 Lisp_Object result = Qnil;
|
|
509 REGISTER int i;
|
|
510
|
|
511 for (i = argc - 1; i >= 0; i--)
|
|
512 {
|
|
513 if (i == 0 || i > skip_args)
|
|
514 {
|
442
|
515 #ifdef WIN32_NATIVE
|
428
|
516 if (i == 0)
|
|
517 {
|
|
518 /* Do not trust to what crt0 has stuffed into argv[0] */
|
814
|
519 Extbyte *full_exe_path;
|
442
|
520 Lisp_Object fullpath;
|
|
521
|
814
|
522 full_exe_path = mswindows_get_module_file_name ();
|
|
523 assert (full_exe_path);
|
771
|
524 fullpath = build_tstr_string (full_exe_path);
|
814
|
525 xfree (full_exe_path);
|
442
|
526 result = Fcons (fullpath, result);
|
814
|
527 #ifdef HAVE_SHLIB
|
442
|
528 {
|
|
529 Extbyte *fullpathext;
|
|
530
|
814
|
531 /* Don't use full_exe_path directly because it's probably
|
|
532 in a different format. */
|
442
|
533 LISP_STRING_TO_EXTERNAL (fullpath, fullpathext,
|
502
|
534 Qdll_filename_encoding);
|
442
|
535 (void) dll_init (fullpathext);
|
|
536 }
|
428
|
537 #endif
|
|
538 }
|
|
539 else
|
|
540 #endif
|
442
|
541 result = Fcons (build_ext_string (argv[i],
|
|
542 Qcommand_argument_encoding),
|
440
|
543 result);
|
428
|
544 }
|
|
545 }
|
|
546 return result;
|
|
547 }
|
|
548
|
|
549 Lisp_Object
|
442
|
550 make_arg_list (int argc, Extbyte **argv)
|
428
|
551 {
|
|
552 return make_arg_list_1 (argc, argv, 0);
|
|
553 }
|
|
554
|
|
555 /* Calling functions are also responsible for calling free_argc_argv
|
|
556 when they are done with the generated list. */
|
|
557 void
|
442
|
558 make_argc_argv (Lisp_Object argv_list, int *argc, Extbyte ***argv)
|
428
|
559 {
|
|
560 Lisp_Object next;
|
|
561 int n = XINT (Flength (argv_list));
|
|
562 REGISTER int i;
|
442
|
563 *argv = (Extbyte**) xmalloc ((n+1) * sizeof (Extbyte*));
|
428
|
564
|
|
565 for (i = 0, next = argv_list; i < n; i++, next = XCDR (next))
|
|
566 {
|
442
|
567 const Extbyte *temp;
|
428
|
568 CHECK_STRING (XCAR (next));
|
|
569
|
442
|
570 LISP_STRING_TO_EXTERNAL (XCAR (next), temp, Qcommand_argument_encoding);
|
428
|
571 (*argv) [i] = xstrdup (temp);
|
|
572 }
|
|
573 (*argv) [n] = 0;
|
|
574 *argc = i;
|
|
575 }
|
|
576
|
|
577 void
|
442
|
578 free_argc_argv (Extbyte **argv)
|
428
|
579 {
|
|
580 int elt = 0;
|
|
581
|
|
582 while (argv[elt])
|
|
583 {
|
|
584 xfree (argv[elt]);
|
|
585 elt++;
|
|
586 }
|
|
587 xfree (argv);
|
|
588 }
|
|
589
|
|
590 static void
|
442
|
591 init_cmdargs (int argc, Extbyte **argv, int skip_args)
|
428
|
592 {
|
|
593 initial_argv = argv;
|
|
594 initial_argc = argc;
|
|
595
|
|
596 Vcommand_line_args = make_arg_list_1 (argc, argv, skip_args);
|
|
597 }
|
|
598
|
|
599 DEFUN ("invocation-name", Finvocation_name, 0, 0, 0, /*
|
|
600 Return the program name that was used to run XEmacs.
|
|
601 Any directory names are omitted.
|
|
602 */
|
|
603 ())
|
|
604 {
|
|
605 return Fcopy_sequence (Vinvocation_name);
|
|
606 }
|
|
607
|
|
608 DEFUN ("invocation-directory", Finvocation_directory, 0, 0, 0, /*
|
|
609 Return the directory name in which the Emacs executable was located.
|
|
610 */
|
|
611 ())
|
|
612 {
|
|
613 return Fcopy_sequence (Vinvocation_directory);
|
|
614 }
|
|
615
|
|
616
|
|
617
|
776
|
618 /* Test whether the next argument in ARGV matches SSTR or a prefix of LSTR
|
|
619 (at least MINLEN characters; if MINLEN is 0, set to size of LSTR). If
|
|
620 so, then if VALPTR is non-null (the argument is supposed to have a
|
|
621 value) store in *VALPTR either the next argument or the portion of this
|
|
622 one after the equal sign. ARGV is read starting at position *SKIPPTR;
|
|
623 this index is advanced by the number of arguments used.
|
428
|
624
|
|
625 Too bad we can't just use getopt for all of this, but we don't have
|
|
626 enough information to do it right. */
|
|
627
|
|
628 static int
|
|
629 argmatch (char **argv, int argc, char *sstr, char *lstr,
|
|
630 int minlen, char **valptr, int *skipptr)
|
|
631 {
|
|
632 char *p = NULL;
|
|
633 int arglen;
|
|
634 char *arg;
|
|
635
|
|
636 /* Don't access argv[argc]; give up in advance. */
|
|
637 if (argc <= *skipptr + 1)
|
|
638 return 0;
|
|
639
|
|
640 arg = argv[*skipptr+1];
|
|
641 if (arg == NULL)
|
|
642 return 0;
|
|
643 if (strcmp (arg, sstr) == 0)
|
|
644 {
|
|
645 if (valptr != NULL)
|
|
646 {
|
|
647 *valptr = argv[*skipptr+2];
|
|
648 *skipptr += 2;
|
|
649 }
|
|
650 else
|
|
651 *skipptr += 1;
|
|
652 return 1;
|
|
653 }
|
|
654 arglen = (valptr != NULL && (p = strchr (arg, '=')) != NULL
|
664
|
655 ? p - arg : (int) strlen (arg));
|
776
|
656 if (lstr && !minlen)
|
|
657 minlen = strlen (lstr);
|
428
|
658 if (lstr == 0 || arglen < minlen || strncmp (arg, lstr, arglen) != 0)
|
|
659 return 0;
|
|
660 else if (valptr == NULL)
|
|
661 {
|
|
662 *skipptr += 1;
|
|
663 return 1;
|
|
664 }
|
|
665 else if (p != NULL)
|
|
666 {
|
|
667 *valptr = p+1;
|
|
668 *skipptr += 1;
|
|
669 return 1;
|
|
670 }
|
|
671 else if (argv[*skipptr+2] != NULL)
|
|
672 {
|
|
673 *valptr = argv[*skipptr+2];
|
|
674 *skipptr += 2;
|
|
675 return 1;
|
|
676 }
|
|
677 else
|
|
678 {
|
|
679 return 0;
|
|
680 }
|
|
681 }
|
|
682
|
1315
|
683 static void
|
|
684 check_compatible_window_system (char *must)
|
|
685 {
|
|
686 if (display_use && strcmp (display_use, must))
|
|
687 fatal ("Incompatible window system type `%s': `%s' already specified",
|
|
688 must, display_use);
|
|
689 display_use = must;
|
|
690 }
|
|
691
|
771
|
692
|
|
693 /************************************************************************/
|
|
694 /* main and friends: XEmacs startup */
|
|
695 /************************************************************************/
|
|
696
|
428
|
697 /* Make stack traces always identify version + configuration */
|
|
698 #define main_1 STACK_TRACE_EYE_CATCHER
|
|
699
|
|
700 /* This function is not static, so that the compiler is less likely to
|
446
|
701 inline it, which would make it not show up in stack traces.
|
|
702
|
|
703 The restart argument is a flag that indicates that main_1 is now
|
771
|
704 being called for the second time in this invocation of xemacs; this
|
|
705 happens as a result of using `run-temacs' in the command line, when
|
|
706 invoking a bare (without dumped data) XEmacs (i.e. `temacs' with
|
|
707 the conventional dumper or `xemacs -nd' with the pdumper). See
|
446
|
708 Frun_emacs_from_temacs().
|
|
709 */
|
814
|
710 DECLARE_DOESNT_RETURN (main_1 (int, Extbyte **, Extbyte **, int));
|
428
|
711 DOESNT_RETURN
|
814
|
712 main_1 (int argc, Extbyte **argv, Extbyte **envp, int restart)
|
428
|
713 {
|
|
714 char stack_bottom_variable;
|
|
715 int skip_args = 0;
|
|
716 Lisp_Object load_me;
|
|
717 #ifdef NeXT
|
|
718 extern int malloc_cookie;
|
|
719 #endif
|
|
720
|
814
|
721 /* !!#### Under MS Windows, this should all be rewritten to deal with
|
|
722 Unicode arguments and environment. We need to retrieve the command
|
|
723 line with GetCommandLine and convert to argv format with
|
|
724 CommandLineToArgvW. Unfortunately we have a bootstrapping problem
|
|
725 currently because we can't initialize the Unicode tables until we've
|
|
726 computed the location of data-directory, which doesn't happen till
|
|
727 startup.el, which is way late. We need to be dumping the Unicode
|
|
728 data, which means we need to fix pdump to correctly dump the "union"
|
|
729 format used by the tables. */
|
854
|
730
|
428
|
731 #if (!defined (SYSTEM_MALLOC) && !defined (HAVE_LIBMCHECK) \
|
|
732 && !defined (DOUG_LEA_MALLOC))
|
|
733 /* Make sure that any libraries we link against haven't installed a
|
|
734 hook for a gmalloc of a potentially incompatible version. */
|
|
735 /* If we're using libmcheck, the hooks have already been initialized, */
|
|
736 /* don't touch them. -slb */
|
|
737 __malloc_hook = NULL;
|
|
738 __realloc_hook = NULL;
|
|
739 __free_hook = NULL;
|
|
740 #endif /* not SYSTEM_MALLOC or HAVE_LIBMCHECK or DOUG_LEA_MALLOC */
|
|
741
|
|
742 noninteractive = 0;
|
1315
|
743 display_use = 0;
|
771
|
744 inhibit_non_essential_printing_operations = 1;
|
428
|
745
|
|
746 #ifdef NeXT
|
|
747 /* 19-Jun-1995 -baw
|
|
748 * NeXT secret magic, ripped from Emacs-for-NS by Carl Edman
|
|
749 * <cedman@princeton.edu>. Note that even Carl doesn't know what this
|
776
|
750 * does; it was provided by NeXT, and it presumably makes NS's mallocator
|
428
|
751 * work with dumping. But malloc_jumpstart() and malloc_freezedry() in
|
|
752 * unexnext.c are both completely undocumented, even in NS header files!
|
|
753 * But hey, it solves all NS related memory problems, so who's
|
|
754 * complaining? */
|
|
755 if (initialized && malloc_jumpstart (malloc_cookie) != 0)
|
442
|
756 stderr_out ("malloc jumpstart failed!\n");
|
428
|
757 #endif /* NeXT */
|
|
758
|
|
759 /*
|
|
760 #if defined (GNU_MALLOC) && \
|
|
761 defined (ERROR_CHECK_MALLOC) && \
|
|
762 !defined (HAVE_LIBMCHECK)
|
|
763 */
|
1303
|
764 #if defined (LOSING_GCC_DESTRUCTOR_FREE_BUG)
|
428
|
765 /* Prior to XEmacs 21, this was `#if 0'ed out. */
|
|
766 /* I'm enabling this because it is the only reliable way I've found to */
|
1303
|
767 /* prevent a very annoying problem where GCC will attempt to free (3) */
|
428
|
768 /* memory at exit() and cause a coredump. */
|
|
769 init_free_hook ();
|
|
770 #endif
|
|
771
|
|
772 sort_args (argc, argv);
|
|
773
|
442
|
774 #if defined (WIN32_NATIVE) || defined (_SCO_DS)
|
428
|
775 environ = envp;
|
|
776 #endif
|
|
777
|
|
778 /* Record (approximately) where the stack begins. */
|
|
779 stack_bottom = &stack_bottom_variable;
|
|
780
|
|
781 #ifdef USG_SHARED_LIBRARIES
|
|
782 if (bss_end)
|
|
783 brk ((void *) bss_end);
|
|
784 #endif
|
|
785
|
|
786 clearerr (stdin);
|
|
787
|
|
788 #if defined (HAVE_MMAP) && defined (REL_ALLOC)
|
|
789 /* ralloc can only be used if using the GNU memory allocator. */
|
|
790 init_ralloc ();
|
1303
|
791 #elif defined (REL_ALLOC) && !defined (DOUG_LEA_MALLOC)
|
428
|
792 if (initialized)
|
1303
|
793 init_ralloc ();
|
428
|
794 #endif
|
|
795
|
|
796 #ifdef HAVE_SOCKS
|
|
797 if (initialized)
|
|
798 SOCKSinit (argv[0]);
|
|
799 #endif /* HAVE_SOCKS */
|
|
800
|
|
801 #ifndef SYSTEM_MALLOC
|
|
802 if (!initialized)
|
|
803 /* Arrange to get warning messages as memory fills up. */
|
|
804 memory_warnings (0, malloc_warning);
|
|
805 #endif /* not SYSTEM_MALLOC */
|
|
806
|
|
807 #ifdef SET_EMACS_PRIORITY
|
|
808 if (emacs_priority != 0)
|
|
809 nice (-emacs_priority);
|
|
810 setuid (getuid ());
|
|
811 #endif /* SET_EMACS_PRIORITY */
|
|
812
|
|
813 #ifdef EXTRA_INITIALIZE
|
|
814 EXTRA_INITIALIZE;
|
|
815 #endif
|
|
816
|
776
|
817 /* NOTE NOTE NOTE: Keep the following args in sync with the big list of
|
|
818 arguments below in standard_args[], with the help text in startup.el,
|
|
819 and with the list of non-clobbered variables near where pdump_load()
|
|
820 is called! */
|
854
|
821
|
776
|
822 /* Handle the -sd/--show-dump-id switch, which means show the hex dump_id
|
|
823 and quit */
|
|
824 if (argmatch (argv, argc, "-sd", "--show-dump-id", 0, NULL, &skip_args))
|
442
|
825 {
|
|
826 #ifdef PDUMP
|
|
827 printf ("%08x\n", dump_id);
|
|
828 #else
|
446
|
829 printf ("Portable dumper not configured; -sd just forces exit.\n");
|
442
|
830 #endif
|
|
831 exit (0);
|
|
832 }
|
854
|
833
|
776
|
834 /* Handle the --no-dump-file/-nd switch, which means don't load the dump
|
|
835 file (ignored when not using pdump) */
|
|
836 if (argmatch (argv, argc, "-nd", "--no-dump-file", 0, NULL, &skip_args))
|
|
837 nodumpfile = 1;
|
442
|
838
|
428
|
839 /* Handle the -batch switch, which means don't do interactive display. */
|
776
|
840 if (argmatch (argv, argc, "-batch", "--batch", 0, NULL, &skip_args))
|
428
|
841 {
|
|
842 #if 0 /* I don't think this is correct. */
|
|
843 inhibit_autoloads = 1;
|
|
844 #endif
|
|
845 noninteractive = 1;
|
|
846 }
|
|
847
|
771
|
848 #ifdef WIN32_NATIVE
|
826
|
849 {
|
|
850 /* Since we aren't a console application, we can't easily be terminated
|
|
851 using ^C. (We aren't a console application to avoid Windows from
|
|
852 automatically and unwantedly creating a console window for us. If
|
|
853 only the Windows designers had some sense in them and didn't create
|
|
854 this artificial console/non-console distinction!) Therefore, we set
|
|
855 up a communication path with i.exe so that when a ^C is sent to it
|
|
856 (using GenerateConsoleCtrlEvent), it in turn signals us to commit
|
|
857 suicide. (This is cleaner than using TerminateProcess()). This
|
|
858 makes (e.g.) the "Stop Build" command from VC++ correctly terminate
|
|
859 XEmacs. */
|
854
|
860
|
826
|
861 char *heventstr;
|
|
862 if (argmatch (argv, argc, "-mswindows-termination-handle", 0, 0,
|
|
863 &heventstr, &skip_args))
|
|
864 {
|
|
865 HANDLE hevent = (HANDLE) atol (heventstr);
|
|
866 DWORD unused;
|
|
867 HANDLE h_thread = CreateThread (NULL, 0, wait_for_termination_signal,
|
|
868 (void *) hevent, 0, &unused);
|
|
869 CloseHandle (h_thread);
|
|
870 }
|
|
871 }
|
|
872
|
771
|
873 /* Handle the -nuni switch, which forces XEmacs to use the ANSI
|
|
874 versions of Unicode-split API's even on Windows NT, which has
|
|
875 full Unicode support. This helps flush out problems in the code
|
|
876 we've written to convert between ANSI and Unicode. */
|
776
|
877 if (argmatch (argv, argc, "-nuni", "--no-unicode-lib-calls", 0, NULL,
|
771
|
878 &skip_args))
|
|
879 no_mswin_unicode_lib_calls = 1;
|
|
880 #endif /* WIN32_NATIVE */
|
|
881
|
428
|
882 if (argmatch (argv, argc, "-debug-paths", "--debug-paths",
|
776
|
883 0, NULL, &skip_args))
|
|
884 debug_paths = 1;
|
|
885
|
|
886 /* Handle (maybe partially) some inhibiting flags. Packages are searched
|
|
887 prior to the rest of the command line being parsed in startup.el. */
|
|
888
|
|
889 if (argmatch (argv, argc, "-no-packages", "--no-packages",
|
|
890 0, NULL, &skip_args))
|
|
891 {
|
|
892 inhibit_all_packages = 1;
|
|
893 inhibit_early_packages = 1;
|
|
894 vanilla_inhibiting = 1;
|
|
895 }
|
|
896
|
428
|
897 if (argmatch (argv, argc, "-no-early-packages", "--no-early-packages",
|
776
|
898 0, NULL, &skip_args))
|
|
899 inhibit_early_packages = 1;
|
|
900
|
|
901 #ifdef HAVE_SHLIB
|
|
902 if (argmatch (argv, argc, "-no-site-modules", "--no-site-modules",
|
|
903 0, NULL, &skip_args))
|
|
904 #endif
|
|
905 inhibit_site_modules = 1;
|
854
|
906
|
776
|
907 if (argmatch (argv, argc, "-vanilla", "--vanilla",
|
|
908 0, NULL, &skip_args))
|
428
|
909 {
|
|
910 inhibit_early_packages = 1;
|
776
|
911 vanilla_inhibiting = 1;
|
428
|
912 }
|
|
913
|
|
914 if (argmatch (argv, argc, "-no-autoloads", "--no-autoloads",
|
776
|
915 0, NULL, &skip_args))
|
428
|
916 {
|
|
917 inhibit_autoloads = 1;
|
776
|
918 inhibit_early_packages = 1;
|
|
919 vanilla_inhibiting = 1;
|
428
|
920 }
|
|
921
|
|
922 /* Partially handle the -version and -help switches: they imply -batch,
|
|
923 but are not removed from the list. */
|
|
924 if (argmatch (argv, argc, "-help", "--help", 3, NULL, &skip_args))
|
|
925 noninteractive = 1, skip_args--;
|
|
926
|
|
927 if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args) ||
|
|
928 argmatch (argv, argc, "-V", 0, 2, NULL, &skip_args))
|
|
929 noninteractive = 1, skip_args--;
|
|
930
|
|
931 /* Now, figure out which type of console is our first console. */
|
|
932
|
|
933 if (noninteractive)
|
|
934 display_use = "stream";
|
1315
|
935
|
|
936 if (argmatch (argv, argc, "-nw", "--no-windows", 0, NULL, &skip_args) ||
|
|
937 argmatch (argv, argc, "-tty", "--use-tty", 0, NULL, &skip_args))
|
|
938 {
|
|
939 check_compatible_window_system ("tty");
|
428
|
940 #ifndef HAVE_TTY
|
1315
|
941 fatal ("Sorry, this XEmacs was not compiled with TTY support");
|
|
942 #endif
|
|
943 }
|
|
944
|
|
945 if (argmatch (argv, argc, "-x", "--use-x", 0, NULL, &skip_args))
|
|
946 {
|
|
947 check_compatible_window_system ("x");
|
|
948 #ifndef HAVE_X_WINDOWS
|
|
949 fatal ("Sorry, this XEmacs was not compiled with X support");
|
|
950 #endif
|
|
951 }
|
|
952
|
|
953 if (argmatch (argv, argc, "-gtk", "--use-gtk", 0, NULL, &skip_args) ||
|
|
954 argmatch (argv, argc, "-gnome", "--use-gnome", 0, NULL, &skip_args))
|
|
955 {
|
|
956 check_compatible_window_system ("gtk");
|
|
957 #ifndef HAVE_GTK
|
|
958 fatal ("Sorry, this XEmacs was not compiled with GTK support");
|
|
959 #endif
|
|
960 }
|
|
961
|
|
962 if (argmatch (argv, argc, "-msw", "--use-ms-windows", 0, NULL, &skip_args))
|
|
963 {
|
|
964 check_compatible_window_system ("mswindows");
|
|
965 #ifndef HAVE_MS_WINDOWS
|
|
966 fatal ("Sorry, this XEmacs was not compiled with MS Windows support");
|
|
967 #endif
|
|
968 }
|
|
969
|
|
970 /* Handle other switches implying particular window systems: */
|
|
971
|
|
972 /* Handle the -t switch, which specifies filename to use as terminal */
|
|
973 {
|
|
974 Extbyte *term;
|
|
975 if (argmatch (argv, argc, "-t", "--terminal", 0, &term, &skip_args))
|
|
976 {
|
|
977 check_compatible_window_system ("tty");
|
|
978 #ifndef HAVE_TTY
|
|
979 fatal ("Sorry, this XEmacs was not compiled with TTY support");
|
|
980 #endif
|
|
981
|
|
982 retry_close (0);
|
|
983 retry_close (1);
|
|
984 if (open (term, O_RDWR | OPEN_BINARY, 2) < 0)
|
|
985 fatal ("%s: %s", term, strerror (errno));
|
|
986 dup (0);
|
|
987 if (! isatty (0))
|
|
988 fatal ("%s: not a tty", term);
|
|
989
|
|
990 #if 0
|
|
991 stderr_out ("Using %s", ttyname (0));
|
|
992 #endif
|
|
993 stderr_out ("Using %s", term);
|
|
994 }
|
|
995 }
|
|
996
|
428
|
997 /* Stupid kludge to catch command-line display spec. We can't
|
|
998 handle this argument entirely in window-system-dependent code
|
|
999 because we don't even know which window-system-dependent code
|
|
1000 to run until we've recognized this argument. */
|
1315
|
1001 {
|
428
|
1002 #ifdef HAVE_X_WINDOWS
|
1315
|
1003 char *dpy = 0;
|
|
1004 int count_before = skip_args;
|
|
1005
|
|
1006 if (argmatch (argv, argc, "-d", "--display", 3, &dpy, &skip_args) ||
|
|
1007 argmatch (argv, argc, "-display", 0, 3, &dpy, &skip_args))
|
|
1008 {
|
|
1009 check_compatible_window_system ("x");
|
|
1010 display_arg = 1;
|
|
1011 }
|
428
|
1012 /* If we have the form --display=NAME,
|
|
1013 convert it into -d name.
|
|
1014 This requires inserting a new element into argv. */
|
|
1015 if (dpy != 0 && skip_args - count_before == 1)
|
|
1016 {
|
|
1017 char **new = (char **) xmalloc (sizeof (char *) * (argc + 2));
|
|
1018 int j;
|
|
1019
|
|
1020 for (j = 0; j < count_before + 1; j++)
|
|
1021 new[j] = argv[j];
|
|
1022 new[count_before + 1] = "-d";
|
|
1023 new[count_before + 2] = dpy;
|
|
1024 for (j = count_before + 2; j <argc; j++)
|
|
1025 new[j + 1] = argv[j];
|
|
1026 argv = new;
|
|
1027 argc++;
|
|
1028 }
|
|
1029 /* Change --display to -d, when its arg is separate. */
|
|
1030 else if (dpy != 0 && skip_args > count_before
|
|
1031 && argv[count_before + 1][1] == '-')
|
|
1032 argv[count_before + 1] = "-d";
|
|
1033
|
|
1034 /* Don't actually discard this arg. */
|
|
1035 skip_args = count_before;
|
1315
|
1036 #endif /* HAVE_X_WINDOWS */
|
|
1037 }
|
|
1038
|
|
1039 /* If no switch telling us which window system to use, try other
|
|
1040 possibilities: */
|
|
1041
|
|
1042 #if defined (HAVE_X_WINDOWS) || defined (HAVE_GTK)
|
|
1043 if (!display_use)
|
|
1044 {
|
|
1045 char *dpy;
|
|
1046 /* If there is a non-empty environment var DISPLAY, assume X or GTK,
|
|
1047 but don't set `display_arg', which is only to be set if the
|
|
1048 display was specified on the command line. */
|
428
|
1049 if ((dpy = getenv ("DISPLAY")) && dpy[0])
|
1315
|
1050 #ifdef HAVE_X_WINDOWS
|
|
1051 /* #### Who gets precedence? X or GTK? For the moment, GTK support is
|
|
1052 unstable so use X. Maybe eventually we will switch this. */
|
428
|
1053 display_use = "x";
|
1315
|
1054 #else
|
|
1055 display_use = "gtk";
|
|
1056 #endif
|
|
1057 }
|
|
1058 #endif /* defined (HAVE_X_WINDOWS) || defined (HAVE_GTK) */
|
|
1059
|
428
|
1060 #ifdef HAVE_MS_WINDOWS
|
1315
|
1061 if (!display_use)
|
|
1062 display_use = "mswindows";
|
428
|
1063 #endif /* HAVE_MS_WINDOWS */
|
1315
|
1064
|
|
1065 #ifdef HAVE_TTY
|
|
1066 if (!display_use)
|
|
1067 display_use = "tty";
|
|
1068 #endif /* HAVE_MS_WINDOWS */
|
|
1069
|
|
1070 if (!display_use)
|
|
1071 fatal ("No window systems and no TTY's in this XEmacs: Must specify "
|
|
1072 "-batch");
|
428
|
1073
|
|
1074 noninteractive1 = noninteractive;
|
|
1075
|
|
1076 /****** Now initialize everything *******/
|
|
1077
|
1204
|
1078 /* NOTE NOTE NOTE:
|
|
1079
|
|
1080 In the code below, there are three different states we are concerned
|
|
1081 about:
|
|
1082
|
|
1083 "raw-temacs" == No dumped Lisp data present. `temacs', or (with pdump)
|
|
1084 `xemacs -nd'.
|
|
1085
|
|
1086 "run-temacs" == We are restarting. run-emacs-from-temacs is called,
|
|
1087 aka `run-temacs' on the command line.
|
|
1088
|
|
1089 "post-dump" == We are running an unexec()ed XEmacs, or we have loaded
|
|
1090 dump data using pdump_load().
|
|
1091
|
|
1092 initialized==0 => raw-temacs
|
|
1093 initialized!=0 && restart!=0 => run-temacs
|
|
1094 initialized!=0 && restart==0 => post-dump
|
|
1095
|
|
1096 When post-pdump_load(), we need to reinitialize various structures.
|
|
1097 This case is noted in the code below by
|
|
1098
|
|
1099 initialized +
|
|
1100 !restart +
|
|
1101 ifdef PDUMP.
|
|
1102
|
|
1103 In the comments below, "dump time" or "dumping" == raw-temacs.
|
|
1104 "run time" == run-temacs or post-dump.
|
|
1105 */
|
|
1106
|
428
|
1107 /* First, do really basic environment initialization -- catching signals
|
|
1108 and the like. These functions have no dependence on any part of
|
|
1109 the Lisp engine and need to be done both at dump time and at run time. */
|
|
1110
|
|
1111 init_signals_very_early ();
|
|
1112 init_data_very_early (); /* Catch math errors. */
|
|
1113 init_floatfns_very_early (); /* Catch floating-point math errors. */
|
|
1114 init_process_times_very_early (); /* Initialize our process timers.
|
|
1115 As early as possible, of course,
|
|
1116 so we can be fairly accurate. */
|
771
|
1117
|
1315
|
1118 #ifdef WIN32_ANY
|
771
|
1119 init_win32_very_early ();
|
|
1120 #endif
|
657
|
1121 #ifdef HAVE_MS_WINDOWS
|
771
|
1122 /* Depends on XEUNICODE_P, only accurate after the previous call */
|
|
1123 init_mswindows_dde_very_early (); /* DDE needs to be initialized early so
|
|
1124 that the client doesn't give up
|
|
1125 waiting. */
|
657
|
1126 #endif
|
428
|
1127
|
|
1128 /* Now initialize the Lisp engine and the like. Done only during
|
|
1129 dumping. No dependence on anything that may be in the user's
|
|
1130 environment when the dumped XEmacs is run.
|
|
1131
|
|
1132 We try to do things in an order that minimizes the non-obvious
|
|
1133 dependencies between functions. */
|
|
1134
|
|
1135 /* purify_flag 1 is correct even if CANNOT_DUMP.
|
|
1136 * loadup.el will set to nil at end. */
|
|
1137
|
|
1138 purify_flag = 0;
|
|
1139 #ifdef PDUMP
|
1204
|
1140 in_pdump = 0;
|
428
|
1141 if (restart)
|
|
1142 initialized = 1;
|
771
|
1143 else if (nodumpfile)
|
|
1144 {
|
|
1145 initialized = 0;
|
442
|
1146 purify_flag = 1;
|
771
|
1147 }
|
|
1148 else
|
|
1149 {
|
|
1150
|
|
1151 /* Keep command options from getting stomped.
|
|
1152
|
|
1153 Some LISP-visible options are changed by XEmacs _after_ the data is
|
|
1154 dumped in building a --pdump XEmacs, but _before_ it is restored in
|
|
1155 normal operation. Thus the restored values overwrite the values
|
|
1156 XEmacs is getting at run-time. Such variables must be saved here,
|
|
1157 and restored after loading the dumped data.
|
|
1158
|
776
|
1159 (Remember: Only LISP-visible options that are set up to this point
|
|
1160 need to be listed here.)
|
771
|
1161 */
|
|
1162
|
|
1163 /* noninteractive1 is saved in noninteractive, which isn't
|
|
1164 LISP-visible */
|
|
1165 int inhibit_early_packages_save = inhibit_early_packages;
|
|
1166 int inhibit_autoloads_save = inhibit_autoloads;
|
776
|
1167 int inhibit_all_packages_save = inhibit_all_packages;
|
|
1168 int vanilla_inhibiting_save = vanilla_inhibiting;
|
771
|
1169 int debug_paths_save = debug_paths;
|
776
|
1170 int inhibit_site_lisp_save = inhibit_site_lisp;
|
771
|
1171 int inhibit_site_modules_save = inhibit_site_modules;
|
|
1172
|
|
1173 initialized = pdump_load (argv[0]);
|
|
1174
|
|
1175 /* Now unstomp everything */
|
|
1176 noninteractive1 = noninteractive;
|
|
1177 inhibit_early_packages = inhibit_early_packages_save;
|
|
1178 inhibit_autoloads = inhibit_autoloads_save;
|
776
|
1179 inhibit_all_packages = inhibit_all_packages_save;
|
|
1180 vanilla_inhibiting = vanilla_inhibiting_save;
|
771
|
1181 debug_paths = debug_paths_save;
|
776
|
1182 inhibit_site_lisp = inhibit_site_lisp_save;
|
771
|
1183 inhibit_site_modules = inhibit_site_modules_save;
|
|
1184
|
|
1185 if (initialized)
|
1315
|
1186 run_temacs_argc = restart ? -2 : -1;
|
771
|
1187 else
|
|
1188 purify_flag = 1;
|
|
1189 }
|
428
|
1190 #else
|
|
1191 if (!initialized)
|
|
1192 purify_flag = 1;
|
|
1193 #endif
|
|
1194
|
1204
|
1195 init_alloc_early ();
|
|
1196
|
428
|
1197 if (!initialized)
|
|
1198 {
|
|
1199 /* Initialize things so that new Lisp objects
|
|
1200 can be created and objects can be staticpro'd.
|
|
1201 Must be basically the very first thing done
|
|
1202 because pretty much all of the initialization
|
|
1203 routines below create new objects. */
|
|
1204 init_alloc_once_early ();
|
|
1205
|
|
1206 /* Initialize Qnil, Qt, Qunbound, and the
|
|
1207 obarray. After this, symbols can be
|
442
|
1208 interned. This depends on init_alloc_once_early(). */
|
428
|
1209 init_symbols_once_early ();
|
|
1210
|
|
1211 /* Declare the basic symbols pertaining to errors,
|
442
|
1212 So that DEFERROR*() can be called. */
|
428
|
1213 init_errors_once_early ();
|
|
1214
|
|
1215 /* Make sure that opaque pointers can be created. */
|
|
1216 init_opaque_once_early ();
|
|
1217
|
771
|
1218 /* Make sure that hash tables can be created. */
|
|
1219 init_elhash_once_early ();
|
|
1220
|
|
1221 /* Make sure that eistrings can be created. */
|
|
1222 init_eistring_once_early ();
|
1204
|
1223
|
428
|
1224 /* Now declare all the symbols and define all the Lisp primitives.
|
|
1225
|
|
1226 The *only* thing that the syms_of_*() functions are allowed to do
|
442
|
1227 is call one of the following:
|
|
1228
|
|
1229 INIT_LRECORD_IMPLEMENTATION()
|
|
1230 defsymbol(), DEFSYMBOL(), or DEFSYMBOL_MULTIWORD_PREDICATE()
|
428
|
1231 defsubr() (i.e. DEFSUBR)
|
442
|
1232 deferror(), DEFERROR(), or DEFERROR_STANDARD()
|
|
1233 defkeyword() or DEFKEYWORD()
|
563
|
1234 Fput()
|
428
|
1235
|
|
1236 Order does not matter in these functions.
|
|
1237 */
|
|
1238
|
|
1239 syms_of_abbrev ();
|
|
1240 syms_of_alloc ();
|
|
1241 syms_of_buffer ();
|
|
1242 syms_of_bytecode ();
|
|
1243 syms_of_callint ();
|
|
1244 syms_of_casefiddle ();
|
|
1245 syms_of_casetab ();
|
|
1246 syms_of_chartab ();
|
|
1247 syms_of_cmdloop ();
|
|
1248 syms_of_cmds ();
|
|
1249 syms_of_console ();
|
|
1250 syms_of_data ();
|
|
1251 #ifdef DEBUG_XEMACS
|
|
1252 syms_of_debug ();
|
440
|
1253 syms_of_tests ();
|
428
|
1254 #endif /* DEBUG_XEMACS */
|
|
1255 syms_of_device ();
|
|
1256 #ifdef HAVE_DIALOGS
|
|
1257 syms_of_dialog ();
|
|
1258 #endif
|
|
1259 syms_of_dired ();
|
|
1260 syms_of_doc ();
|
|
1261 syms_of_editfns ();
|
|
1262 syms_of_elhash ();
|
|
1263 syms_of_emacs ();
|
|
1264 syms_of_eval ();
|
|
1265 #ifdef HAVE_X_WINDOWS
|
|
1266 syms_of_event_Xt ();
|
|
1267 #endif
|
462
|
1268 #ifdef HAVE_GTK
|
|
1269 syms_of_event_gtk ();
|
|
1270 #endif
|
428
|
1271 #ifdef HAVE_DRAGNDROP
|
|
1272 syms_of_dragdrop ();
|
|
1273 #endif
|
|
1274 syms_of_event_stream ();
|
|
1275 syms_of_events ();
|
|
1276 syms_of_extents ();
|
|
1277 syms_of_faces ();
|
|
1278 syms_of_fileio ();
|
|
1279 #ifdef CLASH_DETECTION
|
|
1280 syms_of_filelock ();
|
|
1281 #endif /* CLASH_DETECTION */
|
|
1282 syms_of_floatfns ();
|
|
1283 syms_of_fns ();
|
826
|
1284 #ifdef USE_C_FONT_LOCK
|
428
|
1285 syms_of_font_lock ();
|
826
|
1286 #endif /* USE_C_FONT_LOCK */
|
428
|
1287 syms_of_frame ();
|
|
1288 syms_of_general ();
|
|
1289 syms_of_glyphs ();
|
|
1290 syms_of_glyphs_eimage ();
|
563
|
1291 syms_of_glyphs_shared ();
|
428
|
1292 syms_of_glyphs_widget ();
|
|
1293 syms_of_gui ();
|
|
1294 syms_of_gutter ();
|
|
1295 syms_of_indent ();
|
|
1296 syms_of_intl ();
|
|
1297 syms_of_keymap ();
|
|
1298 syms_of_lread ();
|
|
1299 syms_of_macros ();
|
|
1300 syms_of_marker ();
|
|
1301 syms_of_md5 ();
|
|
1302 #ifdef HAVE_DATABASE
|
|
1303 syms_of_database ();
|
|
1304 #endif
|
|
1305 #ifdef HAVE_MENUBARS
|
|
1306 syms_of_menubar ();
|
|
1307 #endif
|
|
1308 syms_of_minibuf ();
|
|
1309 #ifdef HAVE_SHLIB
|
|
1310 syms_of_module ();
|
|
1311 #endif
|
|
1312 syms_of_objects ();
|
|
1313 syms_of_print ();
|
|
1314 #if !defined (NO_SUBPROCESSES)
|
|
1315 syms_of_process ();
|
|
1316 #ifdef HAVE_WIN32_PROCESSES
|
|
1317 syms_of_process_nt ();
|
|
1318 #endif
|
|
1319 #endif
|
|
1320 syms_of_profile ();
|
1303
|
1321 #if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined (DOUG_LEA_MALLOC)
|
428
|
1322 syms_of_ralloc ();
|
|
1323 #endif /* HAVE_MMAP && REL_ALLOC */
|
|
1324 syms_of_rangetab ();
|
|
1325 syms_of_redisplay ();
|
|
1326 syms_of_search ();
|
|
1327 syms_of_select ();
|
|
1328 syms_of_signal ();
|
|
1329 syms_of_sound ();
|
|
1330 syms_of_specifier ();
|
|
1331 syms_of_symbols ();
|
|
1332 syms_of_syntax ();
|
|
1333 #ifdef HAVE_SCROLLBARS
|
|
1334 syms_of_scrollbar ();
|
|
1335 #endif
|
771
|
1336 syms_of_text ();
|
428
|
1337 #ifdef HAVE_TOOLBARS
|
|
1338 syms_of_toolbar ();
|
|
1339 #endif
|
|
1340 syms_of_undo ();
|
|
1341 syms_of_widget ();
|
|
1342 syms_of_window ();
|
|
1343
|
|
1344 #ifdef HAVE_TTY
|
|
1345 syms_of_console_tty ();
|
|
1346 syms_of_device_tty ();
|
771
|
1347 syms_of_frame_tty ();
|
428
|
1348 syms_of_objects_tty ();
|
|
1349 #endif
|
|
1350
|
462
|
1351 #ifdef HAVE_GTK
|
|
1352 syms_of_device_gtk ();
|
|
1353 syms_of_frame_gtk ();
|
|
1354 syms_of_glyphs_gtk ();
|
|
1355 syms_of_objects_gtk ();
|
|
1356 syms_of_ui_gtk ();
|
|
1357 syms_of_select_gtk ();
|
|
1358 #ifdef HAVE_DIALOGS
|
|
1359 syms_of_dialog_gtk ();
|
|
1360 #endif
|
|
1361 #ifdef HAVE_MENUBARS
|
|
1362 syms_of_menubar_gtk ();
|
|
1363 #endif
|
|
1364 syms_of_select_gtk ();
|
854
|
1365
|
771
|
1366 #ifdef HAVE_GUI_OBJECTS
|
462
|
1367 syms_of_gui_gtk ();
|
|
1368 #endif
|
|
1369 #endif /* HAVE_GTK */
|
|
1370
|
428
|
1371 #ifdef HAVE_X_WINDOWS
|
442
|
1372 #ifdef HAVE_BALLOON_HELP
|
440
|
1373 syms_of_balloon_x ();
|
442
|
1374 #endif
|
428
|
1375 syms_of_device_x ();
|
771
|
1376 #ifdef HAVE_X_DIALOGS
|
428
|
1377 syms_of_dialog_x ();
|
|
1378 #endif
|
|
1379 syms_of_frame_x ();
|
|
1380 syms_of_glyphs_x ();
|
|
1381 syms_of_objects_x ();
|
|
1382 #ifdef HAVE_MENUBARS
|
|
1383 syms_of_menubar_x ();
|
|
1384 #endif
|
440
|
1385 syms_of_select_x ();
|
771
|
1386 #ifdef HAVE_GUI_OBJECTS
|
428
|
1387 syms_of_gui_x ();
|
|
1388 #endif
|
771
|
1389 syms_of_intl_x ();
|
428
|
1390 #ifdef HAVE_XIM
|
|
1391 #ifdef XIM_XLIB
|
|
1392 syms_of_input_method_xlib ();
|
|
1393 #endif
|
|
1394 #endif /* HAVE_XIM */
|
|
1395 #endif /* HAVE_X_WINDOWS */
|
|
1396
|
|
1397 #ifdef HAVE_MS_WINDOWS
|
|
1398 syms_of_console_mswindows ();
|
|
1399 syms_of_device_mswindows ();
|
903
|
1400 syms_of_event_mswindows ();
|
771
|
1401 #ifdef HAVE_DIALOGS
|
442
|
1402 syms_of_dialog_mswindows ();
|
771
|
1403 #endif
|
428
|
1404 syms_of_frame_mswindows ();
|
|
1405 syms_of_objects_mswindows ();
|
|
1406 syms_of_select_mswindows ();
|
|
1407 syms_of_glyphs_mswindows ();
|
771
|
1408 #ifdef HAVE_GUI_OBJECTS
|
440
|
1409 syms_of_gui_mswindows ();
|
771
|
1410 #endif
|
428
|
1411 #ifdef HAVE_MENUBARS
|
|
1412 syms_of_menubar_mswindows ();
|
|
1413 #endif
|
|
1414 #ifdef HAVE_SCROLLBARS
|
|
1415 syms_of_scrollbar_mswindows ();
|
|
1416 #endif
|
442
|
1417 #endif /* HAVE_MS_WINDOWS */
|
902
|
1418 #ifdef WIN32_NATIVE
|
428
|
1419 syms_of_dired_mswindows ();
|
771
|
1420 syms_of_nt ();
|
428
|
1421 #endif
|
1315
|
1422 #ifdef WIN32_ANY
|
442
|
1423 syms_of_win32 ();
|
|
1424 #endif
|
428
|
1425
|
771
|
1426 syms_of_file_coding ();
|
|
1427 syms_of_unicode ();
|
428
|
1428 #ifdef MULE
|
|
1429 syms_of_mule_ccl ();
|
|
1430 syms_of_mule_charset ();
|
771
|
1431 syms_of_mule_coding ();
|
428
|
1432 #ifdef HAVE_WNN
|
|
1433 syms_of_mule_wnn ();
|
|
1434 #endif
|
|
1435 #ifdef HAVE_CANNA
|
|
1436 syms_of_mule_canna ();
|
|
1437 #endif /* HAVE_CANNA */
|
|
1438 #endif /* MULE */
|
|
1439
|
1315
|
1440 #ifdef WIN32_ANY
|
771
|
1441 syms_of_intl_win32 ();
|
|
1442 #endif
|
|
1443
|
428
|
1444 #ifdef SYMS_SYSTEM
|
|
1445 SYMS_SYSTEM;
|
|
1446 #endif
|
|
1447
|
|
1448 #ifdef SYMS_MACHINE
|
|
1449 SYMS_MACHINE;
|
|
1450 #endif
|
|
1451
|
|
1452 /*
|
|
1453 #if defined (GNU_MALLOC) && \
|
|
1454 defined (ERROR_CHECK_MALLOC) && \
|
|
1455 !defined (HAVE_LIBMCHECK)
|
|
1456 */
|
|
1457 /* Prior to XEmacs 21, this was `#if 0'ed out. -slb */
|
|
1458 #if defined (LOSING_GCC_DESTRUCTOR_FREE_BUG)
|
|
1459 syms_of_free_hook ();
|
|
1460 #endif
|
|
1461
|
|
1462 #ifdef TOOLTALK
|
|
1463 syms_of_tooltalk ();
|
|
1464 #endif
|
|
1465
|
|
1466 #ifdef SUNPRO
|
|
1467 syms_of_sunpro ();
|
|
1468 #endif
|
|
1469
|
996
|
1470 #if defined (HAVE_LDAP) && !defined (HAVE_SHLIB)
|
428
|
1471 syms_of_eldap ();
|
|
1472 #endif
|
|
1473
|
|
1474 #ifdef HAVE_GPM
|
442
|
1475 syms_of_gpmevent ();
|
|
1476 #endif
|
|
1477
|
996
|
1478 #if defined (HAVE_POSTGRESQL) && !defined (HAVE_SHLIB)
|
442
|
1479 syms_of_postgresql ();
|
428
|
1480 #endif
|
|
1481
|
|
1482 /* Now create the subtypes for the types that have them.
|
|
1483 We do this before the vars_*() because more symbols
|
|
1484 may get initialized here. */
|
|
1485
|
|
1486 /* Now initialize the console types and associated symbols.
|
|
1487 Other than the first function below, the functions may
|
|
1488 make exactly the following function/macro calls:
|
|
1489
|
|
1490 INITIALIZE_CONSOLE_TYPE()
|
|
1491 CONSOLE_HAS_METHOD()
|
|
1492
|
|
1493 For any given console type, the former macro must be called
|
|
1494 before the any calls to the latter macro. */
|
|
1495
|
|
1496 console_type_create ();
|
|
1497
|
|
1498 console_type_create_stream ();
|
|
1499
|
|
1500 #ifdef HAVE_TTY
|
|
1501 console_type_create_tty ();
|
|
1502 console_type_create_device_tty ();
|
|
1503 console_type_create_frame_tty ();
|
|
1504 console_type_create_objects_tty ();
|
|
1505 console_type_create_redisplay_tty ();
|
|
1506 #endif
|
|
1507
|
462
|
1508 #ifdef HAVE_GTK
|
|
1509 console_type_create_gtk ();
|
|
1510 console_type_create_select_gtk ();
|
|
1511 console_type_create_device_gtk ();
|
|
1512 console_type_create_frame_gtk ();
|
|
1513 console_type_create_objects_gtk ();
|
|
1514 console_type_create_glyphs_gtk ();
|
|
1515 console_type_create_redisplay_gtk ();
|
|
1516 #ifdef HAVE_MENUBARS
|
|
1517 console_type_create_menubar_gtk ();
|
|
1518 #endif
|
|
1519 #ifdef HAVE_SCROLLBARS
|
|
1520 console_type_create_scrollbar_gtk ();
|
|
1521 #endif
|
|
1522 #ifdef HAVE_TOOLBARS
|
|
1523 console_type_create_toolbar_gtk ();
|
|
1524 #endif
|
|
1525 #ifdef HAVE_DIALOGS
|
|
1526 console_type_create_dialog_gtk ();
|
|
1527 #endif
|
|
1528 #endif /* HAVE_GTK */
|
|
1529
|
428
|
1530 #ifdef HAVE_X_WINDOWS
|
|
1531 console_type_create_x ();
|
|
1532 console_type_create_device_x ();
|
|
1533 console_type_create_frame_x ();
|
|
1534 console_type_create_glyphs_x ();
|
|
1535 console_type_create_select_x ();
|
|
1536 #ifdef HAVE_MENUBARS
|
|
1537 console_type_create_menubar_x ();
|
|
1538 #endif
|
|
1539 console_type_create_objects_x ();
|
|
1540 console_type_create_redisplay_x ();
|
|
1541 #ifdef HAVE_SCROLLBARS
|
|
1542 console_type_create_scrollbar_x ();
|
|
1543 #endif
|
|
1544 #ifdef HAVE_TOOLBARS
|
|
1545 console_type_create_toolbar_x ();
|
|
1546 #endif
|
771
|
1547 #ifdef HAVE_X_DIALOGS
|
428
|
1548 console_type_create_dialog_x ();
|
|
1549 #endif
|
|
1550 #endif /* HAVE_X_WINDOWS */
|
|
1551
|
|
1552 #ifdef HAVE_MS_WINDOWS
|
|
1553 console_type_create_mswindows ();
|
|
1554 console_type_create_device_mswindows ();
|
|
1555 console_type_create_frame_mswindows ();
|
|
1556 console_type_create_objects_mswindows ();
|
|
1557 console_type_create_redisplay_mswindows ();
|
|
1558 console_type_create_glyphs_mswindows ();
|
|
1559 console_type_create_select_mswindows ();
|
|
1560 # ifdef HAVE_SCROLLBARS
|
|
1561 console_type_create_scrollbar_mswindows ();
|
|
1562 # endif
|
|
1563 #ifdef HAVE_MENUBARS
|
|
1564 console_type_create_menubar_mswindows ();
|
|
1565 #endif
|
|
1566 #ifdef HAVE_TOOLBARS
|
|
1567 console_type_create_toolbar_mswindows ();
|
|
1568 #endif
|
|
1569 #ifdef HAVE_DIALOGS
|
|
1570 console_type_create_dialog_mswindows ();
|
|
1571 #endif
|
|
1572 #endif
|
|
1573
|
|
1574 /* Now initialize the specifier types and associated symbols.
|
|
1575 Other than the first function below, the functions may
|
|
1576 make exactly the following function/macro calls:
|
|
1577
|
|
1578 INITIALIZE_SPECIFIER_TYPE()
|
|
1579 SPECIFIER_HAS_METHOD()
|
|
1580
|
|
1581 For any given specifier type, the former macro must be called
|
|
1582 before the any calls to the latter macro. */
|
|
1583
|
|
1584 specifier_type_create ();
|
|
1585
|
|
1586 specifier_type_create_image ();
|
|
1587 specifier_type_create_gutter ();
|
|
1588 specifier_type_create_objects ();
|
|
1589 #ifdef HAVE_TOOLBARS
|
|
1590 specifier_type_create_toolbar ();
|
|
1591 #endif
|
|
1592
|
771
|
1593 /* Now initialize the coding system types and associated symbols.
|
|
1594 Other than the first function below, the functions may
|
|
1595 make exactly the following function/macro calls:
|
|
1596
|
|
1597 INITIALIZE_CODING_SYSTEM_TYPE()
|
|
1598 CODING_SYSTEM_HAS_METHOD()
|
|
1599
|
|
1600 For any given coding system type, the former macro must be called
|
|
1601 before the any calls to the latter macro. */
|
|
1602
|
|
1603 coding_system_type_create ();
|
|
1604 coding_system_type_create_unicode ();
|
1315
|
1605 #ifdef WIN32_ANY
|
771
|
1606 coding_system_type_create_intl_win32 ();
|
|
1607 #endif
|
|
1608 #ifdef MULE
|
|
1609 coding_system_type_create_mule_coding ();
|
|
1610 #endif
|
|
1611
|
428
|
1612 /* Now initialize the structure types and associated symbols.
|
|
1613 Other than the first function below, the functions may
|
|
1614 make exactly the following function/macro calls:
|
|
1615
|
|
1616 define_structure_type()
|
|
1617 define_structure_type_keyword()
|
|
1618
|
|
1619 */
|
|
1620
|
|
1621 structure_type_create ();
|
|
1622
|
|
1623 structure_type_create_chartab ();
|
|
1624 structure_type_create_faces ();
|
|
1625 structure_type_create_rangetab ();
|
|
1626 structure_type_create_hash_table ();
|
|
1627
|
|
1628 /* Now initialize the image instantiator formats and associated symbols.
|
|
1629 Other than the first function below, the functions may
|
|
1630 make exactly the following function/macro calls:
|
|
1631
|
|
1632 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT()
|
|
1633 IIFORMAT_HAS_METHOD()
|
|
1634 IIFORMAT_VALID_KEYWORD()
|
|
1635
|
|
1636 For any given image instantiator format, the first macro must be
|
|
1637 called before the any calls to the other macros. */
|
|
1638
|
|
1639 image_instantiator_format_create ();
|
|
1640 image_instantiator_format_create_glyphs_eimage ();
|
|
1641 image_instantiator_format_create_glyphs_widget ();
|
|
1642 #ifdef HAVE_TTY
|
|
1643 image_instantiator_format_create_glyphs_tty ();
|
|
1644 #endif
|
|
1645 #ifdef HAVE_X_WINDOWS
|
|
1646 image_instantiator_format_create_glyphs_x ();
|
|
1647 #endif /* HAVE_X_WINDOWS */
|
|
1648 #ifdef HAVE_MS_WINDOWS
|
|
1649 image_instantiator_format_create_glyphs_mswindows ();
|
1204
|
1650 #endif /* HAVE_MS_WINDOWS */
|
462
|
1651 #ifdef HAVE_GTK
|
|
1652 image_instantiator_format_create_glyphs_gtk ();
|
|
1653 #endif
|
428
|
1654
|
|
1655 /* Now initialize the lstream types and associated symbols.
|
|
1656 Other than the first function below, the functions may
|
|
1657 make exactly the following function/macro calls:
|
|
1658
|
|
1659 LSTREAM_HAS_METHOD()
|
|
1660
|
|
1661 */
|
|
1662
|
|
1663 lstream_type_create ();
|
|
1664 lstream_type_create_file_coding ();
|
853
|
1665 #if defined (HAVE_MS_WINDOWS) && !defined (HAVE_MSG_SELECT)
|
428
|
1666 lstream_type_create_mswindows_selectable ();
|
|
1667 #endif
|
|
1668
|
|
1669 /* Initialize processes implementation.
|
|
1670 The functions may make exactly the following function/macro calls:
|
|
1671
|
|
1672 PROCESS_HAS_METHOD()
|
|
1673 */
|
|
1674 #ifdef HAVE_UNIX_PROCESSES
|
|
1675 process_type_create_unix ();
|
|
1676 #endif
|
|
1677 #ifdef HAVE_WIN32_PROCESSES
|
|
1678 process_type_create_nt ();
|
|
1679 #endif
|
|
1680
|
|
1681 /* Now initialize most variables.
|
|
1682
|
|
1683 These functions may do exactly the following:
|
|
1684
|
771
|
1685 -- assigning a symbol or constant value to a variable
|
|
1686 -- using a global variable that has been initialized
|
|
1687 earlier on in the same function
|
|
1688 -- DEFVAR_INT()
|
|
1689 -- DEFVAR_LISP()
|
|
1690 -- DEFVAR_BOOL()
|
|
1691 -- DEFER_GETTEXT()
|
|
1692 -- staticpro*()
|
|
1693 -- xmalloc*(), xnew*(), and friends
|
|
1694 -- Dynarr_*()
|
|
1695 -- Blocktype_*()
|
1303
|
1696 -- Fprovide (symbol)
|
771
|
1697 -- intern()
|
|
1698 -- Fput()
|
|
1699 -- dump_add_*()
|
|
1700 -- C library functions with no external dependencies, e.g. str*()
|
|
1701 -- defsymbol(), if it's absolutely necessary and you're sure that
|
|
1702 the symbol isn't referenced anywhere else in the initialization
|
|
1703 code
|
|
1704 -- Fset() on a symbol that is unbound
|
|
1705 -- Any of the object-creating functions in alloc.c: e.g.
|
|
1706 - make_string()
|
|
1707 - build_intstring()
|
|
1708 - build_string()
|
|
1709 - make_vector()
|
|
1710 - make_int()
|
|
1711 - make_char()
|
|
1712 - make_extent()
|
1204
|
1713 - basic_alloc_lcrecord()
|
771
|
1714 - Fcons()
|
|
1715 - listN()
|
|
1716 - make_lcrecord_list()
|
|
1717 -- make_opaque_ptr()
|
|
1718 -- make_lisp_hash_table() (not allowed in 21.4!)
|
|
1719 -- certain specifier creation functions (but be careful; see
|
|
1720 glyphs.c for examples)
|
428
|
1721
|
|
1722 perhaps a few others.
|
446
|
1723
|
771
|
1724 NO EXTERNAL-FORMAT CONVERSIONS.
|
|
1725
|
446
|
1726 NB: Initialization or assignment should not be done here to certain
|
|
1727 variables settable from the command line. See the comment above
|
|
1728 the call to pdump_load() in main_1(). This caveat should only
|
|
1729 apply to vars_of_emacs().
|
428
|
1730 */
|
|
1731
|
|
1732 /* Now allow Fprovide() statements to be made. */
|
|
1733 init_provide_once ();
|
|
1734
|
|
1735 /* Do that before any specifier creation (esp. vars_of_glyphs()) */
|
|
1736 vars_of_specifier ();
|
|
1737
|
|
1738 vars_of_abbrev ();
|
|
1739 vars_of_alloc ();
|
|
1740 vars_of_buffer ();
|
|
1741 vars_of_bytecode ();
|
|
1742 vars_of_callint ();
|
|
1743 vars_of_chartab ();
|
|
1744 vars_of_cmdloop ();
|
|
1745 vars_of_cmds ();
|
|
1746 vars_of_console ();
|
|
1747 vars_of_data ();
|
|
1748 #ifdef DEBUG_XEMACS
|
|
1749 vars_of_debug ();
|
440
|
1750 vars_of_tests ();
|
428
|
1751 #endif
|
|
1752 vars_of_console_stream ();
|
|
1753 vars_of_device ();
|
|
1754 #ifdef HAVE_DIALOGS
|
|
1755 vars_of_dialog ();
|
|
1756 #endif
|
|
1757 vars_of_dired ();
|
|
1758 vars_of_doc ();
|
|
1759 #ifdef HAVE_DRAGNDROP
|
|
1760 vars_of_dragdrop ();
|
|
1761 #endif
|
|
1762 vars_of_editfns ();
|
|
1763 vars_of_emacs ();
|
|
1764 vars_of_eval ();
|
814
|
1765 init_eval_semi_early ();
|
428
|
1766
|
|
1767 #ifdef HAVE_X_WINDOWS
|
|
1768 vars_of_event_Xt ();
|
|
1769 #endif
|
1303
|
1770 #if defined (HAVE_TTY) && (defined (DEBUG_TTY_EVENT_STREAM) || !defined (HAVE_X_WINDOWS))
|
428
|
1771 vars_of_event_tty ();
|
|
1772 #endif
|
|
1773 #ifdef HAVE_MS_WINDOWS
|
|
1774 vars_of_event_mswindows ();
|
|
1775 #endif
|
|
1776 vars_of_event_stream ();
|
|
1777
|
|
1778 vars_of_events ();
|
|
1779 vars_of_extents ();
|
|
1780 vars_of_faces ();
|
771
|
1781 vars_of_file_coding ();
|
428
|
1782 vars_of_fileio ();
|
444
|
1783 #ifdef CLASH_DETECTION
|
|
1784 vars_of_filelock ();
|
|
1785 #endif
|
428
|
1786 vars_of_floatfns ();
|
771
|
1787 vars_of_fns ();
|
826
|
1788 #ifdef USE_C_FONT_LOCK
|
428
|
1789 vars_of_font_lock ();
|
826
|
1790 #endif /* USE_C_FONT_LOCK */
|
428
|
1791 vars_of_frame ();
|
|
1792 vars_of_glyphs ();
|
|
1793 vars_of_glyphs_eimage ();
|
|
1794 vars_of_glyphs_widget ();
|
|
1795 vars_of_gui ();
|
|
1796 vars_of_gutter ();
|
|
1797 vars_of_indent ();
|
|
1798 vars_of_insdel ();
|
|
1799 vars_of_intl ();
|
1315
|
1800 #ifdef WIN32_ANY
|
771
|
1801 vars_of_intl_win32 ();
|
|
1802 #endif
|
428
|
1803 #ifdef HAVE_XIM
|
|
1804 #ifdef XIM_MOTIF
|
|
1805 vars_of_input_method_motif ();
|
|
1806 #else /* XIM_XLIB */
|
|
1807 vars_of_input_method_xlib ();
|
|
1808 #endif
|
|
1809 #endif /* HAVE_XIM */
|
|
1810 vars_of_keymap ();
|
|
1811 vars_of_lread ();
|
|
1812 vars_of_lstream ();
|
|
1813 vars_of_macros ();
|
|
1814 vars_of_md5 ();
|
|
1815 #ifdef HAVE_DATABASE
|
|
1816 vars_of_database ();
|
|
1817 #endif
|
|
1818 #ifdef HAVE_MENUBARS
|
|
1819 vars_of_menubar ();
|
|
1820 #endif
|
|
1821 vars_of_minibuf ();
|
|
1822 #ifdef HAVE_SHLIB
|
|
1823 vars_of_module ();
|
|
1824 #endif
|
442
|
1825 #ifdef WIN32_NATIVE
|
902
|
1826 vars_of_dired_mswindows ();
|
440
|
1827 vars_of_nt ();
|
428
|
1828 #endif
|
|
1829 vars_of_objects ();
|
|
1830 vars_of_print ();
|
|
1831
|
|
1832 #ifndef NO_SUBPROCESSES
|
|
1833 vars_of_process ();
|
|
1834 #ifdef HAVE_UNIX_PROCESSES
|
|
1835 vars_of_process_unix ();
|
|
1836 #endif
|
|
1837 #ifdef HAVE_WIN32_PROCESSES
|
|
1838 vars_of_process_nt ();
|
|
1839 #endif
|
|
1840 #endif
|
|
1841
|
|
1842 vars_of_profile ();
|
1303
|
1843 #if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined (DOUG_LEA_MALLOC)
|
428
|
1844 vars_of_ralloc ();
|
|
1845 #endif /* HAVE_MMAP && REL_ALLOC */
|
|
1846 vars_of_redisplay ();
|
814
|
1847 vars_of_regex ();
|
428
|
1848 #ifdef HAVE_SCROLLBARS
|
|
1849 vars_of_scrollbar ();
|
|
1850 #endif
|
|
1851 vars_of_search ();
|
|
1852 vars_of_select ();
|
|
1853 vars_of_sound ();
|
|
1854 vars_of_symbols ();
|
|
1855 vars_of_syntax ();
|
771
|
1856 vars_of_text ();
|
428
|
1857 #ifdef HAVE_TOOLBARS
|
|
1858 vars_of_toolbar ();
|
|
1859 #endif
|
|
1860 vars_of_undo ();
|
|
1861 vars_of_window ();
|
1315
|
1862 #ifdef WIN32_ANY
|
771
|
1863 vars_of_win32 ();
|
|
1864 #endif
|
428
|
1865
|
|
1866 #ifdef HAVE_TTY
|
|
1867 vars_of_console_tty ();
|
|
1868 vars_of_frame_tty ();
|
|
1869 vars_of_objects_tty ();
|
|
1870 #endif
|
|
1871
|
462
|
1872 #ifdef HAVE_GTK
|
|
1873 vars_of_device_gtk ();
|
|
1874 #ifdef HAVE_DIALOGS
|
|
1875 vars_of_dialog_gtk ();
|
|
1876 #endif
|
|
1877 vars_of_event_gtk ();
|
|
1878 vars_of_frame_gtk ();
|
|
1879 vars_of_glyphs_gtk ();
|
|
1880 vars_of_ui_gtk ();
|
|
1881 #ifdef HAVE_MENUBARS
|
|
1882 vars_of_menubar_gtk ();
|
|
1883 #endif
|
|
1884 vars_of_objects_gtk ();
|
|
1885 vars_of_select_gtk ();
|
|
1886 #ifdef HAVE_SCROLLBARS
|
|
1887 vars_of_scrollbar_gtk ();
|
|
1888 #endif
|
|
1889 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
|
|
1890 vars_of_gui_gtk ();
|
|
1891 #endif
|
|
1892 #endif /* HAVE_GTK */
|
|
1893
|
428
|
1894 #ifdef HAVE_X_WINDOWS
|
442
|
1895 #ifdef HAVE_BALLOON_HELP
|
440
|
1896 vars_of_balloon_x ();
|
442
|
1897 #endif
|
428
|
1898 vars_of_device_x ();
|
771
|
1899 #ifdef HAVE_X_DIALOGS
|
428
|
1900 vars_of_dialog_x ();
|
|
1901 #endif
|
|
1902 vars_of_frame_x ();
|
|
1903 vars_of_glyphs_x ();
|
|
1904 #ifdef HAVE_MENUBARS
|
|
1905 vars_of_menubar_x ();
|
|
1906 #endif
|
|
1907 vars_of_objects_x ();
|
440
|
1908 vars_of_select_x ();
|
428
|
1909 #ifdef HAVE_SCROLLBARS
|
|
1910 vars_of_scrollbar_x ();
|
|
1911 #endif
|
771
|
1912 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_X_DIALOGS) || defined (HAVE_TOOLBARS)
|
428
|
1913 vars_of_gui_x ();
|
|
1914 #endif
|
440
|
1915 #endif /* HAVE_X_WINDOWS */
|
428
|
1916
|
462
|
1917
|
428
|
1918 #ifdef HAVE_MS_WINDOWS
|
|
1919 vars_of_device_mswindows ();
|
|
1920 vars_of_console_mswindows ();
|
|
1921 vars_of_frame_mswindows ();
|
|
1922 vars_of_objects_mswindows ();
|
|
1923 vars_of_select_mswindows ();
|
|
1924 vars_of_glyphs_mswindows ();
|
|
1925 #ifdef HAVE_SCROLLBARS
|
|
1926 vars_of_scrollbar_mswindows ();
|
|
1927 #endif
|
|
1928 #ifdef HAVE_MENUBARS
|
|
1929 vars_of_menubar_mswindows ();
|
|
1930 #endif
|
|
1931 #ifdef HAVE_DIALOGS
|
|
1932 vars_of_dialog_mswindows ();
|
|
1933 #endif
|
|
1934 #endif /* HAVE_MS_WINDOWS */
|
|
1935
|
|
1936 #ifdef MULE
|
|
1937 vars_of_mule_ccl ();
|
|
1938 vars_of_mule_charset ();
|
|
1939 #endif
|
|
1940 vars_of_file_coding ();
|
771
|
1941 vars_of_unicode ();
|
428
|
1942 #ifdef MULE
|
771
|
1943 vars_of_mule_coding ();
|
428
|
1944 #ifdef HAVE_WNN
|
|
1945 vars_of_mule_wnn ();
|
|
1946 #endif
|
|
1947 #ifdef HAVE_CANNA
|
|
1948 vars_of_mule_canna ();
|
|
1949 #endif /* HAVE_CANNA */
|
|
1950 #endif /* MULE */
|
|
1951
|
|
1952 #ifdef TOOLTALK
|
|
1953 vars_of_tooltalk ();
|
|
1954 #endif
|
|
1955
|
|
1956 #ifdef SUNPRO
|
|
1957 vars_of_sunpro ();
|
|
1958 #endif
|
|
1959
|
996
|
1960 #if defined (HAVE_LDAP) && !defined (HAVE_SHLIB)
|
428
|
1961 vars_of_eldap ();
|
|
1962 #endif
|
|
1963
|
996
|
1964 #if defined (HAVE_POSTGRESQL) && !defined (HAVE_SHLIB)
|
771
|
1965 vars_of_postgresql ();
|
442
|
1966 #endif
|
|
1967
|
428
|
1968 #ifdef HAVE_GPM
|
442
|
1969 vars_of_gpmevent ();
|
428
|
1970 #endif
|
|
1971
|
|
1972 /* Now initialize any specifier variables. We do this later
|
|
1973 because it has some dependence on the vars initialized
|
|
1974 above.
|
|
1975
|
|
1976 These functions should *only* initialize specifier variables,
|
|
1977 and may make use of the following functions/macros in addition
|
|
1978 to the ones listed above:
|
|
1979
|
|
1980 DEFVAR_SPECIFIER()
|
|
1981 Fmake_specifier()
|
|
1982 set_specifier_fallback()
|
|
1983 set_specifier_caching()
|
|
1984 */
|
|
1985
|
|
1986 specifier_vars_of_glyphs ();
|
863
|
1987 specifier_vars_of_glyphs_widget ();
|
428
|
1988 specifier_vars_of_gutter ();
|
|
1989 #ifdef HAVE_MENUBARS
|
|
1990 specifier_vars_of_menubar ();
|
|
1991 #endif
|
|
1992 specifier_vars_of_redisplay ();
|
|
1993 #ifdef HAVE_SCROLLBARS
|
|
1994 specifier_vars_of_scrollbar ();
|
|
1995 #endif
|
|
1996 #ifdef HAVE_TOOLBARS
|
|
1997 specifier_vars_of_toolbar ();
|
|
1998 #endif
|
|
1999 specifier_vars_of_window ();
|
|
2000
|
|
2001 /* Now comes all the rest of the variables that couldn't
|
|
2002 be handled above. There may be dependencies on variables
|
|
2003 initialized above, and dependencies between one complex_vars_()
|
|
2004 function and another. */
|
|
2005
|
|
2006 #ifdef MULE
|
814
|
2007 /* This depends on vars initialized in vars_of_unicode(). */
|
428
|
2008 complex_vars_of_mule_charset ();
|
|
2009 #endif
|
814
|
2010 /* This one doesn't depend on anything really, and could go into
|
|
2011 vars_of_(), but lots of lots of code gets called and it's easily
|
|
2012 possible that it could get changed to require being a
|
|
2013 complex_vars_of_(), for example if a charset appears anywhere,
|
|
2014 then we suddenly have dependence on the previous call. */
|
428
|
2015 complex_vars_of_file_coding ();
|
1315
|
2016 #ifdef WIN32_ANY
|
771
|
2017 complex_vars_of_intl_win32 ();
|
428
|
2018 #endif
|
|
2019
|
771
|
2020 /* Depends on specifiers. */
|
|
2021 complex_vars_of_faces ();
|
|
2022
|
428
|
2023 /* This calls allocate_glyph(), which creates specifiers
|
|
2024 and also relies on a variable (Vthe_nothing_vector) initialized
|
771
|
2025 above. */
|
428
|
2026 complex_vars_of_glyphs ();
|
|
2027
|
|
2028 /* These rely on the glyphs just created in the previous function,
|
|
2029 and call Fadd_spec_to_specifier(), which relies on various
|
|
2030 variables initialized above. */
|
462
|
2031 #ifdef HAVE_GTK
|
|
2032 complex_vars_of_glyphs_gtk ();
|
|
2033 #endif
|
428
|
2034 #ifdef HAVE_X_WINDOWS
|
|
2035 complex_vars_of_glyphs_x ();
|
|
2036 #endif
|
|
2037 #ifdef HAVE_MS_WINDOWS
|
|
2038 complex_vars_of_glyphs_mswindows ();
|
|
2039 #endif
|
|
2040
|
|
2041 /* This calls Fmake_glyph_internal(). */
|
|
2042 complex_vars_of_alloc ();
|
|
2043
|
|
2044 /* This calls Fmake_glyph_internal(). */
|
|
2045 #ifdef HAVE_MENUBARS
|
|
2046 complex_vars_of_menubar ();
|
|
2047 #endif
|
|
2048
|
617
|
2049 #ifdef HAVE_SCROLLBARS
|
428
|
2050 /* This calls Fmake_glyph_internal(). */
|
|
2051 complex_vars_of_scrollbar ();
|
|
2052 #endif
|
|
2053
|
|
2054 /* This calls allocate_glyph(). */
|
|
2055 complex_vars_of_frame ();
|
|
2056
|
|
2057 /* This calls Fcopy_category_table() under Mule, which calls who
|
|
2058 knows what. */
|
|
2059 complex_vars_of_chartab ();
|
|
2060
|
826
|
2061 /* This calls Fput_char_table(), which (under Mule) depends on the
|
428
|
2062 charsets being initialized. */
|
|
2063 complex_vars_of_casetab ();
|
|
2064
|
|
2065 /* This calls Fcopy_syntax_table(), which relies on char tables. */
|
|
2066 complex_vars_of_syntax ();
|
|
2067
|
|
2068 /* This initializes buffer-local variables, sets things up so
|
|
2069 that buffers can be created, and creates a couple of basic
|
|
2070 buffers. This depends on Vstandard_syntax_table and
|
|
2071 Vstandard_category_table (initialized in the previous
|
|
2072 functions), as well as a whole horde of variables that may
|
|
2073 have been initialized above. */
|
|
2074 complex_vars_of_buffer ();
|
|
2075
|
|
2076 /* This initializes console-local variables. */
|
|
2077 complex_vars_of_console ();
|
|
2078
|
|
2079 /* This creates a couple more buffers, and depends on the
|
|
2080 previous function. */
|
|
2081 complex_vars_of_minibuf ();
|
|
2082
|
|
2083 /* These two might call Ffile_name_as_directory(), which
|
|
2084 might depend on all sorts of things; I'm not sure. */
|
|
2085 complex_vars_of_emacs ();
|
|
2086
|
|
2087 /* This creates a couple of basic keymaps and depends on Lisp
|
|
2088 hash tables and Ffset() (both of which depend on some variables
|
|
2089 initialized in the vars_of_*() section) and possibly other
|
|
2090 stuff. */
|
|
2091 complex_vars_of_keymap ();
|
|
2092
|
|
2093 #ifdef ERROR_CHECK_GC
|
|
2094 {
|
|
2095 extern int always_gc;
|
|
2096 if (always_gc) /* purification debugging hack */
|
|
2097 garbage_collect_1 ();
|
|
2098 }
|
|
2099 #endif
|
1204
|
2100 }
|
|
2101
|
428
|
2102 #ifdef PDUMP
|
1204
|
2103 if (initialized && !restart) /* after successful pdump_load()
|
771
|
2104 (note, we are inside ifdef PDUMP) */
|
|
2105 {
|
1204
|
2106 reinit_alloc_early ();
|
|
2107 reinit_symbols_early ();
|
|
2108 reinit_opaque_early ();
|
|
2109 reinit_eistring_early ();
|
428
|
2110
|
|
2111 reinit_console_type_create_stream ();
|
|
2112 #ifdef HAVE_TTY
|
|
2113 reinit_console_type_create_tty ();
|
|
2114 #endif
|
|
2115 #ifdef HAVE_X_WINDOWS
|
|
2116 reinit_console_type_create_x ();
|
|
2117 reinit_console_type_create_device_x ();
|
|
2118 #endif
|
|
2119 #ifdef HAVE_MS_WINDOWS
|
|
2120 reinit_console_type_create_mswindows ();
|
|
2121 #endif
|
462
|
2122 #ifdef HAVE_GTK
|
|
2123 reinit_console_type_create_gtk ();
|
|
2124 #endif
|
428
|
2125
|
|
2126 reinit_specifier_type_create ();
|
|
2127 reinit_specifier_type_create_image ();
|
|
2128 reinit_specifier_type_create_gutter ();
|
|
2129 reinit_specifier_type_create_objects ();
|
|
2130 #ifdef HAVE_TOOLBARS
|
|
2131 reinit_specifier_type_create_toolbar ();
|
|
2132 #endif
|
|
2133
|
|
2134 structure_type_create ();
|
|
2135
|
771
|
2136 reinit_coding_system_type_create ();
|
|
2137 reinit_coding_system_type_create_unicode ();
|
1315
|
2138 #ifdef WIN32_ANY
|
771
|
2139 reinit_coding_system_type_create_intl_win32 ();
|
|
2140 #endif
|
|
2141 #ifdef MULE
|
|
2142 reinit_coding_system_type_create_mule_coding ();
|
|
2143 #endif
|
|
2144
|
428
|
2145 structure_type_create_chartab ();
|
|
2146 structure_type_create_faces ();
|
|
2147 structure_type_create_rangetab ();
|
|
2148 structure_type_create_hash_table ();
|
|
2149
|
|
2150 lstream_type_create ();
|
|
2151 lstream_type_create_file_coding ();
|
771
|
2152 #if defined (HAVE_MS_WINDOWS) && !defined (HAVE_MSG_SELECT)
|
428
|
2153 lstream_type_create_mswindows_selectable ();
|
|
2154 #endif
|
|
2155 #ifdef HAVE_UNIX_PROCESSES
|
|
2156 process_type_create_unix ();
|
|
2157 #endif
|
|
2158 #ifdef HAVE_WIN32_PROCESSES
|
|
2159 process_type_create_nt ();
|
|
2160 #endif
|
|
2161
|
|
2162 reinit_vars_of_buffer ();
|
|
2163 reinit_vars_of_console ();
|
|
2164 #ifdef DEBUG_XEMACS
|
|
2165 reinit_vars_of_debug ();
|
|
2166 #endif
|
|
2167 reinit_vars_of_device ();
|
|
2168 reinit_vars_of_eval ();
|
1303
|
2169 #if defined (HAVE_TTY) && (defined (DEBUG_TTY_EVENT_STREAM) || !defined (HAVE_X_WINDOWS))
|
428
|
2170 reinit_vars_of_event_tty ();
|
|
2171 #endif
|
|
2172 reinit_vars_of_event_stream ();
|
|
2173 reinit_vars_of_events ();
|
|
2174 reinit_vars_of_extents ();
|
771
|
2175 reinit_vars_of_file_coding ();
|
442
|
2176 reinit_vars_of_fileio ();
|
826
|
2177 #ifdef USE_C_FONT_LOCK
|
428
|
2178 reinit_vars_of_font_lock ();
|
826
|
2179 #endif /* USE_C_FONT_LOCK */
|
428
|
2180 reinit_vars_of_glyphs ();
|
|
2181 reinit_vars_of_glyphs_widget ();
|
|
2182 reinit_vars_of_insdel ();
|
|
2183 reinit_vars_of_lread ();
|
|
2184 reinit_vars_of_lstream ();
|
|
2185 reinit_vars_of_minibuf ();
|
438
|
2186 #ifdef HAVE_SHLIB
|
428
|
2187 reinit_vars_of_module ();
|
438
|
2188 #endif
|
428
|
2189 reinit_vars_of_objects ();
|
|
2190 reinit_vars_of_print ();
|
|
2191 reinit_vars_of_search ();
|
771
|
2192 reinit_vars_of_text ();
|
428
|
2193 reinit_vars_of_undo ();
|
771
|
2194 reinit_vars_of_unicode ();
|
428
|
2195 reinit_vars_of_window ();
|
|
2196
|
|
2197 #ifdef HAVE_MS_WINDOWS
|
788
|
2198 reinit_vars_of_event_mswindows ();
|
428
|
2199 reinit_vars_of_frame_mswindows ();
|
788
|
2200 reinit_vars_of_object_mswindows ();
|
428
|
2201 #endif
|
|
2202
|
462
|
2203 #ifdef HAVE_GTK
|
788
|
2204 reinit_vars_of_event_gtk ();
|
462
|
2205 reinit_vars_of_menubar_gtk ();
|
|
2206 #endif
|
|
2207
|
428
|
2208 #ifdef HAVE_X_WINDOWS
|
|
2209 reinit_vars_of_device_x ();
|
788
|
2210 reinit_vars_of_event_Xt ();
|
438
|
2211 #ifdef HAVE_SCROLLBARS
|
|
2212 reinit_vars_of_scrollbar_x ();
|
440
|
2213 #endif
|
428
|
2214 #ifdef HAVE_MENUBARS
|
|
2215 reinit_vars_of_menubar_x ();
|
|
2216 #endif
|
440
|
2217 reinit_vars_of_select_x ();
|
771
|
2218 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_X_DIALOGS) || defined (HAVE_TOOLBARS)
|
428
|
2219 reinit_vars_of_gui_x ();
|
|
2220 #endif
|
440
|
2221 #endif /* HAVE_X_WINDOWS */
|
428
|
2222
|
771
|
2223 #ifdef MULE
|
|
2224 reinit_vars_of_mule_coding ();
|
|
2225 #endif
|
617
|
2226 #if defined (MULE) && defined (HAVE_WNN)
|
428
|
2227 reinit_vars_of_mule_wnn ();
|
|
2228 #endif
|
|
2229
|
771
|
2230 reinit_complex_vars_of_buffer_runtime_only ();
|
|
2231 reinit_complex_vars_of_console_runtime_only ();
|
428
|
2232 reinit_complex_vars_of_minibuf ();
|
1204
|
2233 }
|
440
|
2234 #endif /* PDUMP */
|
428
|
2235
|
|
2236 /* CONGRATULATIONS!!! We have successfully initialized the Lisp
|
|
2237 engine. */
|
|
2238
|
|
2239 if (initialized)
|
814
|
2240 init_eval_semi_early ();
|
771
|
2241
|
|
2242 #ifdef MULE
|
|
2243 init_mule_charset ();
|
428
|
2244 #endif
|
|
2245
|
|
2246 /* Now do further initialization/setup of stuff that is not needed by the
|
|
2247 syms_of_() routines. This involves stuff that only is enabled in
|
|
2248 an interactive run (redisplay, user input, etc.) and stuff that is
|
|
2249 not needed until we start loading Lisp code (the reader). A lot
|
|
2250 of this stuff involves querying the current environment and needs
|
771
|
2251 to be done both at dump time and at run time. Some will be done
|
|
2252 only at run time, by querying the `initialized' variable. */
|
|
2253
|
1315
|
2254 #ifdef WIN32_ANY
|
771
|
2255 init_intl_win32 (); /* Under Windows, determine whether we use Unicode
|
|
2256 or ANSI to call the system routines -- i.e.
|
|
2257 determine what the coding system `mswindows-tstr'
|
|
2258 is aliased to */
|
|
2259 #endif
|
|
2260 init_buffer_1 (); /* Create *scratch* buffer; init_intl() is going to
|
|
2261 call Lisp code (the very first code we call),
|
|
2262 and needs a current buffer */
|
|
2263 #ifdef MULE
|
|
2264 init_intl (); /* Figure out the locale and set native and
|
|
2265 file-name coding systems, initialize the Unicode tables
|
|
2266 so that we will be able to process non-ASCII from here
|
|
2267 on out! */
|
428
|
2268 #endif
|
|
2269
|
814
|
2270 init_xemacs_process (); /* Set up the process environment (so that
|
|
2271 egetenv works), the basic directory variables
|
|
2272 (exec-directory and so on), and stuff related
|
|
2273 to subprocesses. This should be first because
|
|
2274 many of the functions below call egetenv() to
|
|
2275 get environment variables. */
|
771
|
2276
|
|
2277 #ifdef WIN32_NATIVE
|
|
2278 /*
|
|
2279 * For Win32, call init_environment() to properly enter environment/registry
|
|
2280 * variables into Vprocess_environment.
|
|
2281 */
|
814
|
2282 init_mswindows_environment ();
|
771
|
2283 #endif
|
|
2284
|
|
2285 init_initial_directory (); /* get the directory to use for the
|
|
2286 "*scratch*" buffer, etc. */
|
|
2287
|
428
|
2288 init_lread (); /* Set up the Lisp reader. */
|
442
|
2289 init_cmdargs (argc, (Extbyte **) argv,
|
|
2290 skip_args); /* Create list Vcommand_line_args */
|
771
|
2291 init_buffer_2 (); /* Set default directory of *scratch* buffer */
|
428
|
2292
|
442
|
2293 #ifdef WIN32_NATIVE
|
814
|
2294 init_nt ();
|
771
|
2295 init_select_mswindows ();
|
428
|
2296 #endif
|
|
2297
|
|
2298 init_redisplay (); /* Determine terminal type.
|
|
2299 init_sys_modes uses results */
|
438
|
2300 init_frame ();
|
428
|
2301 init_event_stream (); /* Set up so we can get user input. */
|
|
2302 init_macros (); /* set up so we can run macros. */
|
|
2303 init_editfns (); /* Determine the name of the user we're running as */
|
|
2304 #ifdef SUNPRO
|
|
2305 init_sunpro (); /* Set up Sunpro usage tracking */
|
|
2306 #endif
|
1315
|
2307 #ifdef WIN32_ANY
|
442
|
2308 init_win32 ();
|
|
2309 #endif
|
428
|
2310 #if defined (HAVE_NATIVE_SOUND) && defined (hp9000s800)
|
|
2311 init_hpplay ();
|
|
2312 #endif
|
996
|
2313 #if defined (HAVE_POSTGRESQL) && !defined (HAVE_SHLIB)
|
771
|
2314 /* Set some values taken from environment variables */
|
|
2315 init_postgresql_from_environment ();
|
|
2316 #endif
|
428
|
2317 #ifdef HAVE_TTY
|
|
2318 init_device_tty ();
|
|
2319 #endif
|
442
|
2320 init_console_stream (restart); /* Create the first console */
|
428
|
2321
|
|
2322 /* try to get the actual pathname of the exec file we are running */
|
|
2323 if (!restart)
|
771
|
2324 {
|
|
2325 Vinvocation_name = Fcar (Vcommand_line_args);
|
1303
|
2326 if (XSTRING_DATA (Vinvocation_name)[0] == '-')
|
771
|
2327 {
|
|
2328 /* XEmacs as a login shell, oh goody! */
|
|
2329 Vinvocation_name = build_intstring (egetenv ("SHELL"));
|
|
2330 }
|
428
|
2331 Vinvocation_directory = Vinvocation_name;
|
|
2332
|
771
|
2333 if (!NILP (Ffile_name_directory (Vinvocation_name)))
|
|
2334 {
|
|
2335 /* invocation-name includes a directory component -- presumably it
|
|
2336 is relative to cwd, not $PATH */
|
|
2337 Vinvocation_directory = Fexpand_file_name (Vinvocation_name,
|
|
2338 Qnil);
|
|
2339 Vinvocation_path = Qnil;
|
|
2340 }
|
|
2341 else
|
|
2342 {
|
|
2343 Vinvocation_path = split_env_path ("PATH", NULL);
|
|
2344 locate_file (Vinvocation_path, Vinvocation_name,
|
|
2345 Vlisp_EXEC_SUFFIXES,
|
|
2346 &Vinvocation_directory, X_OK);
|
|
2347 }
|
|
2348
|
|
2349 if (NILP (Vinvocation_directory))
|
|
2350 Vinvocation_directory = Vinvocation_name;
|
|
2351
|
|
2352 Vinvocation_name = Ffile_name_nondirectory (Vinvocation_directory);
|
|
2353 Vinvocation_directory = Ffile_name_directory (Vinvocation_directory);
|
|
2354 }
|
428
|
2355
|
1303
|
2356 #if defined (HAVE_SHLIB) && !defined (WIN32_NATIVE)
|
428
|
2357 /* This is Unix only. MS Windows NT has a library call that does
|
|
2358 The Right Thing on that system. Rumor has it, this must be
|
|
2359 called for GNU dld in temacs and xemacs. */
|
|
2360 {
|
851
|
2361 char *buf = (char *)ALLOCA (XSTRING_LENGTH (Vinvocation_directory)
|
428
|
2362 + XSTRING_LENGTH (Vinvocation_name)
|
|
2363 + 2);
|
|
2364 sprintf (buf, "%s/%s", XSTRING_DATA (Vinvocation_directory),
|
|
2365 XSTRING_DATA (Vinvocation_name));
|
|
2366
|
771
|
2367 C_STRING_TO_EXTERNAL (buf, buf, Qfile_name);
|
428
|
2368 /* All we can do is cry if an error happens, so ignore it. */
|
|
2369 (void) dll_init (buf);
|
|
2370 }
|
|
2371 #endif
|
|
2372
|
|
2373 #if defined (LOCALTIME_CACHE) && defined (HAVE_TZSET)
|
|
2374 /* sun's localtime() has a bug. it caches the value of the time
|
|
2375 zone rather than looking it up every time. Since localtime() is
|
|
2376 called to bolt the undumping time into the undumped emacs, this
|
|
2377 results in localtime() ignoring the TZ environment variable.
|
|
2378 This flushes the new TZ value into localtime(). */
|
|
2379 tzset ();
|
|
2380 #endif /* LOCALTIME_CACHE and TZSET */
|
|
2381
|
|
2382 load_me = Qnil;
|
|
2383 if (!initialized)
|
|
2384 {
|
|
2385 /* Handle -l loadup-and-dump, args passed by Makefile. */
|
|
2386 if (argc > 2 + skip_args && !strcmp (argv[1 + skip_args], "-l"))
|
771
|
2387 /* !!#### need to be Mule-translating this, but later */
|
428
|
2388 load_me = build_string (argv[2 + skip_args]);
|
|
2389 }
|
|
2390
|
|
2391 #ifdef QUANTIFY
|
|
2392 if (initialized)
|
|
2393 quantify_start_recording_data ();
|
|
2394 #endif /* QUANTIFY */
|
|
2395
|
|
2396 initialized = 1;
|
771
|
2397 inhibit_non_essential_printing_operations = 0;
|
428
|
2398
|
|
2399 /* This never returns. */
|
|
2400 initial_command_loop (load_me);
|
|
2401 /* NOTREACHED */
|
|
2402 }
|
|
2403
|
|
2404
|
|
2405 /* Sort the args so we can find the most important ones
|
|
2406 at the beginning of argv. */
|
|
2407
|
|
2408 /* First, here's a table of all the standard options. */
|
|
2409
|
|
2410 struct standard_args
|
|
2411 {
|
442
|
2412 const char *name;
|
|
2413 const char *longname;
|
428
|
2414 int priority;
|
|
2415 int nargs;
|
|
2416 };
|
|
2417
|
442
|
2418 static const struct standard_args standard_args[] =
|
428
|
2419 {
|
776
|
2420 /* Handled by main_1 above: Each must have its own priority and must be
|
|
2421 in the order mentioned in main_1. */
|
442
|
2422 { "-sd", "--show-dump-id", 105, 0 },
|
|
2423 { "-nd", "--no-dump-file", 95, 0 },
|
826
|
2424 { "-batch", "--batch", 88, 0 },
|
771
|
2425 #ifdef WIN32_NATIVE
|
826
|
2426 { "-mswindows-termination-handle", 0, 84, 1 },
|
771
|
2427 { "-nuni", "--no-unicode-lib-calls", 83, 0 },
|
|
2428 #endif /* WIN32_NATIVE */
|
428
|
2429 { "-debug-paths", "--debug-paths", 82, 0 },
|
776
|
2430 { "-no-packages", "--no-packages", 81, 0 },
|
|
2431 { "-no-early-packages", "--no-early-packages", 80, 0 },
|
|
2432 { "-no-site-modules", "--no-site-modules", 78, 0 },
|
|
2433 { "-vanilla", "--vanilla", 76, 0 },
|
|
2434 { "-no-autoloads", "--no-autoloads", 74, 0 },
|
|
2435 { "-help", "--help", 72, 0 },
|
|
2436 { "-version", "--version", 70, 0 },
|
|
2437 { "-V", 0, 68, 0 },
|
1315
|
2438 { "-nw", "--no-windows", 66, 0 },
|
|
2439 { "-tty", "--use-tty", 65, 0 },
|
|
2440 { "-x", "--use-x", 64, 0 },
|
|
2441 { "-gtk", "--use-gtk", 63, 0 },
|
|
2442 { "-gnome", "--use-gnome", 62, 0 },
|
|
2443 { "-msw", "--use-ms-windows", 61, 0 },
|
|
2444 { "-t", "--terminal", 58, 1 },
|
|
2445 { "-d", "--display", 57, 1 },
|
|
2446 { "-display", 0, 56, 1 },
|
428
|
2447
|
|
2448 /* Handled by command-line-early in startup.el: */
|
|
2449 { "-q", "--no-init-file", 50, 0 },
|
|
2450 { "-no-init-file", 0, 50, 0 },
|
776
|
2451 { "-no-site-file", "--no-site-file", 50, 0 },
|
|
2452 { "-unmapped", "--unmapped", 50, 0 },
|
|
2453 { "-u", "--user", 50, 1 },
|
|
2454 { "-user", 0, 50, 1 },
|
|
2455 { "-user-init-file", "--user-init-file", 50, 1 },
|
|
2456 { "-user-init-directory", "--user-init-directory", 50, 1 },
|
|
2457 { "-debug-init", "--debug-init", 50, 0 },
|
428
|
2458
|
|
2459 /* Xt options: */
|
|
2460 { "-i", "--icon-type", 15, 0 },
|
|
2461 { "-itype", 0, 15, 0 },
|
|
2462 { "-iconic", "--iconic", 15, 0 },
|
|
2463 { "-bg", "--background-color", 10, 1 },
|
|
2464 { "-background", 0, 10, 1 },
|
|
2465 { "-fg", "--foreground-color", 10, 1 },
|
|
2466 { "-foreground", 0, 10, 1 },
|
|
2467 { "-bd", "--border-color", 10, 1 },
|
|
2468 { "-bw", "--border-width", 10, 1 },
|
|
2469 { "-ib", "--internal-border", 10, 1 },
|
|
2470 { "-ms", "--mouse-color", 10, 1 },
|
|
2471 { "-cr", "--cursor-color", 10, 1 },
|
|
2472 { "-fn", "--font", 10, 1 },
|
|
2473 { "-font", 0, 10, 1 },
|
|
2474 { "-g", "--geometry", 10, 1 },
|
|
2475 { "-geometry", 0, 10, 1 },
|
|
2476 { "-T", "--title", 10, 1 },
|
|
2477 { "-title", 0, 10, 1 },
|
|
2478 { "-name", "--name", 10, 1 },
|
|
2479 { "-xrm", "--xrm", 10, 1 },
|
|
2480 { "-r", "--reverse-video", 5, 0 },
|
|
2481 { "-rv", 0, 5, 0 },
|
|
2482 { "-reverse", 0, 5, 0 },
|
|
2483 { "-hb", "--horizontal-scroll-bars", 5, 0 },
|
|
2484 { "-vb", "--vertical-scroll-bars", 5, 0 },
|
|
2485
|
776
|
2486 { "-eol", "--enable-eol-detection", 2, 0 },
|
|
2487 { "-enable-eol-detection", 0, 2, 0 },
|
428
|
2488 /* These have the same priority as ordinary file name args,
|
|
2489 so they are not reordered with respect to those. */
|
|
2490 { "-L", "--directory", 0, 1 },
|
|
2491 { "-directory", 0, 0, 1 },
|
|
2492 { "-l", "--load", 0, 1 },
|
|
2493 { "-load", 0, 0, 1 },
|
|
2494 { "-f", "--funcall", 0, 1 },
|
|
2495 { "-funcall", 0, 0, 1 },
|
|
2496 { "-eval", "--eval", 0, 1 },
|
|
2497 { "-insert", "--insert", 0, 1 },
|
|
2498 /* This should be processed after ordinary file name args and the like. */
|
|
2499 { "-kill", "--kill", -10, 0 },
|
|
2500 };
|
|
2501
|
|
2502 /* Reorder the elements of ARGV (assumed to have ARGC elements)
|
|
2503 so that the highest priority ones come first.
|
|
2504 Do not change the order of elements of equal priority.
|
|
2505 If an option takes an argument, keep it and its argument together. */
|
|
2506
|
|
2507 static void
|
|
2508 sort_args (int argc, char **argv)
|
|
2509 {
|
|
2510 char **new_argv = xnew_array (char *, argc);
|
|
2511 /* For each element of argv,
|
|
2512 the corresponding element of options is:
|
|
2513 0 for an option that takes no arguments,
|
|
2514 1 for an option that takes one argument, etc.
|
|
2515 -1 for an ordinary non-option argument. */
|
|
2516 int *options = xnew_array (int, argc);
|
|
2517 int *priority = xnew_array (int, argc);
|
|
2518 int to = 1;
|
|
2519 int from;
|
|
2520 int i;
|
|
2521 int end_of_options_p = 0;
|
|
2522
|
|
2523 /* Categorize all the options,
|
|
2524 and figure out which argv elts are option arguments. */
|
|
2525 for (from = 1; from < argc; from++)
|
|
2526 {
|
|
2527 options[from] = -1;
|
|
2528 priority[from] = 0;
|
|
2529 /* Pseudo options "--" and "run-temacs" indicate end of options */
|
|
2530 if (!strcmp (argv[from], "--") ||
|
|
2531 !strcmp (argv[from], "run-temacs"))
|
|
2532 end_of_options_p = 1;
|
|
2533 if (!end_of_options_p && argv[from][0] == '-')
|
|
2534 {
|
|
2535 int match, thislen;
|
|
2536 char *equals;
|
|
2537
|
|
2538 /* Look for a match with a known old-fashioned option. */
|
|
2539 for (i = 0; i < countof (standard_args); i++)
|
|
2540 if (!strcmp (argv[from], standard_args[i].name))
|
|
2541 {
|
|
2542 options[from] = standard_args[i].nargs;
|
|
2543 priority[from] = standard_args[i].priority;
|
|
2544 if (from + standard_args[i].nargs >= argc)
|
|
2545 fatal ("Option `%s' requires an argument\n", argv[from]);
|
|
2546 from += standard_args[i].nargs;
|
|
2547 goto done;
|
|
2548 }
|
|
2549
|
|
2550 /* Look for a match with a known long option.
|
|
2551 MATCH is -1 if no match so far, -2 if two or more matches so far,
|
|
2552 >= 0 (the table index of the match) if just one match so far. */
|
|
2553 if (argv[from][1] == '-')
|
|
2554 {
|
|
2555 match = -1;
|
|
2556 thislen = strlen (argv[from]);
|
|
2557 equals = strchr (argv[from], '=');
|
|
2558 if (equals != 0)
|
|
2559 thislen = equals - argv[from];
|
|
2560
|
|
2561 for (i = 0; i < countof (standard_args); i++)
|
|
2562 if (standard_args[i].longname
|
|
2563 && !strncmp (argv[from], standard_args[i].longname,
|
|
2564 thislen))
|
|
2565 {
|
|
2566 if (match == -1)
|
|
2567 match = i;
|
|
2568 else
|
|
2569 match = -2;
|
|
2570 }
|
|
2571
|
|
2572 /* If we found exactly one match, use that. */
|
|
2573 if (match >= 0)
|
|
2574 {
|
|
2575 options[from] = standard_args[match].nargs;
|
|
2576 priority[from] = standard_args[match].priority;
|
|
2577 /* If --OPTION=VALUE syntax is used,
|
|
2578 this option uses just one argv element. */
|
|
2579 if (equals != 0)
|
|
2580 options[from] = 0;
|
|
2581 if (from + options[from] >= argc)
|
|
2582 fatal ("Option `%s' requires an argument\n", argv[from]);
|
|
2583 from += options[from];
|
|
2584 }
|
|
2585 }
|
|
2586 done: ;
|
|
2587 }
|
|
2588 }
|
|
2589
|
|
2590 /* Copy the arguments, in order of decreasing priority, to NEW_ARGV. */
|
|
2591 new_argv[0] = argv[0];
|
|
2592 while (to < argc)
|
|
2593 {
|
|
2594 int best = -1;
|
|
2595 int best_priority = -9999;
|
|
2596
|
|
2597 /* Find the highest priority remaining option.
|
|
2598 If several have equal priority, take the first of them. */
|
|
2599 for (from = 1; from < argc; from++)
|
|
2600 {
|
|
2601 if (argv[from] != 0 && priority[from] > best_priority)
|
|
2602 {
|
|
2603 best_priority = priority[from];
|
|
2604 best = from;
|
|
2605 }
|
|
2606 /* Skip option arguments--they are tied to the options. */
|
|
2607 if (options[from] > 0)
|
|
2608 from += options[from];
|
|
2609 }
|
|
2610
|
|
2611 if (best < 0)
|
|
2612 abort ();
|
|
2613
|
1315
|
2614 /* Copy the highest priority remaining option, with its args, to
|
|
2615 NEW_ARGV. */
|
428
|
2616 new_argv[to++] = argv[best];
|
|
2617 for (i = 0; i < options[best]; i++)
|
|
2618 new_argv[to++] = argv[best + i + 1];
|
|
2619
|
|
2620 /* Clear out this option in ARGV. */
|
|
2621 argv[best] = 0;
|
|
2622 for (i = 0; i < options[best]; i++)
|
|
2623 argv[best + i + 1] = 0;
|
|
2624 }
|
|
2625
|
|
2626 memcpy (argv, new_argv, sizeof (char *) * argc);
|
|
2627 xfree (new_argv);
|
|
2628 xfree (options);
|
|
2629 xfree (priority);
|
|
2630 }
|
|
2631
|
|
2632 DEFUN ("running-temacs-p", Frunning_temacs_p, 0, 0, 0, /*
|
|
2633 True if running temacs. This means we are in the dumping stage.
|
|
2634 This is false during normal execution of the `xemacs' program, and
|
|
2635 becomes false once `run-emacs-from-temacs' is run.
|
|
2636 */
|
|
2637 ())
|
|
2638 {
|
|
2639 return run_temacs_argc >= 0 ? Qt : Qnil;
|
|
2640 }
|
|
2641
|
1315
|
2642 DEFUN ("emacs-run-status", Femacs_run_status, 0, 0, 0, /*
|
|
2643 Plist of values indicating the current run status of this XEmacs.
|
|
2644 Currently defined values:
|
|
2645
|
|
2646 `temacs'
|
|
2647 If non-nil, we are running a "raw temacs" (no dump data is present
|
|
2648 and `run-emacs-from-temacs' not called). (same as `running-temacs-p')
|
|
2649
|
|
2650 `dumping'
|
|
2651 If non-nil, we are in the process of creating dump data. (same as
|
|
2652 `purify-flag')
|
|
2653
|
|
2654 `restarted'
|
|
2655 If non-nil, `run-emacs-from-temacs' was called.
|
|
2656
|
|
2657 `pdump'
|
|
2658 If non-nil, we were compiled with pdump (portable dumping) support.
|
|
2659
|
|
2660 `batch'
|
|
2661 If non-nil, we are running non-interactively. (same as `noninteractive')
|
|
2662 */
|
|
2663 ())
|
|
2664 {
|
|
2665 Lisp_Object plist = Qnil;
|
|
2666
|
|
2667 #define ADD_PLIST(key, val) plist = Fcons (val, Fcons (key, plist))
|
|
2668 if (run_temacs_argc >= 0)
|
|
2669 ADD_PLIST (Qtemacs, Qt);
|
|
2670 if (purify_flag)
|
|
2671 ADD_PLIST (Qdumping, Qt);
|
|
2672 if (run_temacs_argc == -2)
|
|
2673 ADD_PLIST (Qrestarted, Qt);
|
|
2674 #ifdef PDUMP
|
|
2675 ADD_PLIST (Qpdump, Qt);
|
|
2676 #endif
|
|
2677 if (noninteractive)
|
|
2678 ADD_PLIST (Qbatch, Qt);
|
|
2679
|
|
2680 #undef ADD_PLIST
|
|
2681 return Fnreverse (plist);
|
|
2682 }
|
|
2683
|
428
|
2684 DEFUN ("run-emacs-from-temacs", Frun_emacs_from_temacs, 0, MANY, 0, /*
|
|
2685 Do not call this. It will reinitialize your XEmacs. You'll be sorry.
|
|
2686 */
|
|
2687 /* If this function is called from startup.el, it will be possible to run
|
|
2688 temacs as an editor using 'temacs -batch -l loadup.el run-temacs', instead
|
|
2689 of having to dump an emacs and then run that (when debugging emacs itself,
|
|
2690 this can be much faster)). [Actually, the speed difference isn't that
|
|
2691 much as long as your filesystem is local, and you don't end up with
|
|
2692 a dumped version in case you want to rerun it. This function is most
|
|
2693 useful when used as part of the `make all-elc' command. --ben]
|
|
2694 This will "restart" emacs with the specified command-line arguments.
|
|
2695
|
|
2696 Martin thinks this function is most useful when using debugging
|
|
2697 tools like Purify or tcov that get confused by XEmacs' dumping. */
|
|
2698 (int nargs, Lisp_Object *args))
|
|
2699 {
|
|
2700 int ac;
|
442
|
2701 const Extbyte *wampum;
|
428
|
2702 int namesize;
|
|
2703 int total_len;
|
|
2704 Lisp_Object orig_invoc_name = Fcar (Vcommand_line_args);
|
442
|
2705 const Extbyte **wampum_all = alloca_array (const Extbyte *, nargs);
|
428
|
2706 int *wampum_all_len = alloca_array (int, nargs);
|
|
2707
|
|
2708 assert (!gc_in_progress);
|
|
2709
|
|
2710 if (run_temacs_argc < 0)
|
563
|
2711 invalid_operation ("I've lost my temacs-hood.", Qunbound);
|
428
|
2712
|
|
2713 /* Need to convert the orig_invoc_name and all of the arguments
|
|
2714 to external format. */
|
|
2715
|
440
|
2716 TO_EXTERNAL_FORMAT (LISP_STRING, orig_invoc_name,
|
|
2717 ALLOCA, (wampum, namesize),
|
|
2718 Qnative);
|
428
|
2719 namesize++;
|
|
2720
|
|
2721 for (ac = 0, total_len = namesize; ac < nargs; ac++)
|
|
2722 {
|
|
2723 CHECK_STRING (args[ac]);
|
440
|
2724 TO_EXTERNAL_FORMAT (LISP_STRING, args[ac],
|
|
2725 ALLOCA, (wampum_all[ac], wampum_all_len[ac]),
|
|
2726 Qnative);
|
428
|
2727 wampum_all_len[ac]++;
|
|
2728 total_len += wampum_all_len[ac];
|
|
2729 }
|
|
2730 DO_REALLOC (run_temacs_args, run_temacs_args_size, total_len, char);
|
|
2731 DO_REALLOC (run_temacs_argv, run_temacs_argv_size, nargs+2, char *);
|
|
2732
|
|
2733 memcpy (run_temacs_args, wampum, namesize);
|
|
2734 run_temacs_argv [0] = run_temacs_args;
|
|
2735 for (ac = 0; ac < nargs; ac++)
|
|
2736 {
|
|
2737 memcpy (run_temacs_args + namesize,
|
|
2738 wampum_all[ac], wampum_all_len[ac]);
|
|
2739 run_temacs_argv [ac + 1] = run_temacs_args + namesize;
|
|
2740 namesize += wampum_all_len[ac];
|
|
2741 }
|
|
2742 run_temacs_argv [nargs + 1] = 0;
|
|
2743 catchlist = NULL; /* Important! Otherwise free_cons() calls in
|
|
2744 condition_case_unwind() may lead to GC death. */
|
771
|
2745 unbind_to (0); /* this closes loadup.el */
|
428
|
2746 purify_flag = 0;
|
|
2747 run_temacs_argc = nargs + 1;
|
1303
|
2748 #if defined (HEAP_IN_DATA) && !defined (PDUMP)
|
428
|
2749 report_sheap_usage (0);
|
|
2750 #endif
|
1315
|
2751
|
|
2752 /* run-temacs usually only occurs as a result of building, and in all such
|
|
2753 cases we want a backtrace, even if it occurs very early. */
|
|
2754 if (NILP (Vstack_trace_on_error))
|
|
2755 Vstack_trace_on_error = Qt;
|
|
2756
|
428
|
2757 LONGJMP (run_temacs_catch, 1);
|
1204
|
2758 RETURN_NOT_REACHED (Qnil);
|
428
|
2759 }
|
|
2760
|
|
2761 /* ARGSUSED */
|
|
2762 int
|
|
2763 main (int argc, char **argv, char **envp)
|
|
2764 {
|
442
|
2765
|
|
2766 #ifdef _MSC_VER
|
|
2767 /* Under VC++, access violations and the like are not sent through
|
|
2768 the standard signal() mechanism. Rather, they need to be handled
|
|
2769 using the Microsoft "structured exception handling" mechanism,
|
|
2770 which vaguely resembles the C++ mechanisms. */
|
|
2771 __try
|
|
2772 {
|
|
2773 #endif
|
|
2774
|
428
|
2775 int volatile vol_argc = argc;
|
|
2776 char ** volatile vol_argv = argv;
|
|
2777 char ** volatile vol_envp = envp;
|
|
2778 /* This is hairy. We need to compute where the XEmacs binary was invoked
|
|
2779 from because temacs initialization requires it to find the lisp
|
|
2780 directories. The code that recomputes the path is guarded by the
|
|
2781 restarted flag. There are three possible paths I've found so far
|
|
2782 through this:
|
|
2783
|
|
2784 temacs -- When running temacs for basic build stuff, the first main_1
|
|
2785 will be the only one invoked. It must compute the path else there
|
|
2786 will be a very ugly bomb in startup.el (can't find obvious location
|
|
2787 for doc-directory data-directory, etc.).
|
|
2788
|
|
2789 temacs w/ run-temacs on the command line -- This is run to bytecompile
|
|
2790 all the out of date dumped lisp. It will execute both of the main_1
|
|
2791 calls and the second one must not touch the first computation because
|
|
2792 argc/argv are hosed the second time through.
|
|
2793
|
|
2794 xemacs -- Only the second main_1 is executed. The invocation path must
|
|
2795 computed but this only matters when running in place or when running
|
|
2796 as a login shell.
|
|
2797
|
|
2798 As a bonus for straightening this out, XEmacs can now be run in place
|
|
2799 as a login shell. This never used to work.
|
|
2800
|
|
2801 As another bonus, we can now guarantee that
|
|
2802 (concat invocation-directory invocation-name) contains the filename
|
|
2803 of the XEmacs binary we are running. This can now be used in a
|
|
2804 definite test for out of date dumped files. -slb */
|
|
2805 int restarted = 0;
|
|
2806 #ifdef QUANTIFY
|
|
2807 quantify_stop_recording_data ();
|
|
2808 quantify_clear_data ();
|
|
2809 #endif /* QUANTIFY */
|
|
2810
|
771
|
2811 inhibit_non_essential_printing_operations = 1;
|
428
|
2812 suppress_early_error_handler_backtrace = 0;
|
|
2813 lim_data = 0; /* force reinitialization of this variable */
|
|
2814
|
|
2815 /* Lisp_Object must fit in a word; check VALBITS and GCTYPEBITS */
|
|
2816 assert (sizeof (Lisp_Object) == sizeof (void *));
|
|
2817
|
|
2818 #ifdef LINUX_SBRK_BUG
|
|
2819 sbrk (1);
|
|
2820 #endif
|
|
2821
|
|
2822 if (!initialized)
|
|
2823 {
|
|
2824 #ifdef DOUG_LEA_MALLOC
|
|
2825 mallopt (M_MMAP_MAX, 0);
|
|
2826 #endif
|
|
2827 run_temacs_argc = 0;
|
|
2828 if (! SETJMP (run_temacs_catch))
|
|
2829 {
|
|
2830 main_1 (vol_argc, vol_argv, vol_envp, 0);
|
|
2831 }
|
|
2832 /* run-emacs-from-temacs called */
|
|
2833 restarted = 1;
|
|
2834 vol_argc = run_temacs_argc;
|
|
2835 vol_argv = run_temacs_argv;
|
|
2836 #ifdef _SCO_DS
|
|
2837 /* This makes absolutely no sense to anyone involved. There are
|
|
2838 several people using this stuff. We've compared versions on
|
|
2839 everything we can think of. We can find no difference.
|
|
2840 However, on both my systems environ is a plain old global
|
|
2841 variable initialized to zero. _environ is the one that
|
|
2842 contains pointers to the actual environment.
|
|
2843
|
|
2844 Since we can't figure out the difference (and we're hours
|
|
2845 away from a release), this takes a very cowardly approach and
|
|
2846 is bracketed with both a system specific preprocessor test
|
|
2847 and a runtime "do you have this problem" test
|
|
2848
|
|
2849 06/20/96 robertl@dgii.com */
|
|
2850 {
|
442
|
2851 extern char **_environ;
|
428
|
2852 if ((unsigned) environ == 0)
|
1315
|
2853 environ = _environ;
|
428
|
2854 }
|
|
2855 #endif /* _SCO_DS */
|
|
2856 vol_envp = environ;
|
|
2857 }
|
456
|
2858 #if defined (RUN_TIME_REMAP) && ! defined (PDUMP)
|
428
|
2859 else
|
|
2860 /* obviously no-one uses this because where it was before initialized was
|
|
2861 *always* true */
|
|
2862 run_time_remap (argv[0]);
|
|
2863 #endif
|
|
2864
|
|
2865 #ifdef DOUG_LEA_MALLOC
|
|
2866 if (initialized && (malloc_state_ptr != NULL))
|
|
2867 {
|
|
2868 int rc = malloc_set_state (malloc_state_ptr);
|
|
2869 if (rc != 0)
|
|
2870 {
|
442
|
2871 stderr_out ("malloc_set_state failed, rc = %d\n", rc);
|
428
|
2872 abort ();
|
|
2873 }
|
|
2874 #if 0
|
|
2875 free (malloc_state_ptr);
|
|
2876 #endif
|
|
2877 /* mmap works in glibc-2.1, glibc-2.0 (Non-Mule only) and Linux libc5 */
|
1303
|
2878 #if (defined (__GLIBC__) && __GLIBC_MINOR__ >= 1) || \
|
|
2879 defined (_NO_MALLOC_WARNING_) || \
|
|
2880 (defined (__GLIBC__) && __GLIBC_MINOR__ < 1 && !defined (MULE)) || \
|
|
2881 defined (DEBUG_DOUG_LEA_MALLOC)
|
428
|
2882 mallopt (M_MMAP_MAX, 64);
|
|
2883 #endif
|
|
2884 #ifdef REL_ALLOC
|
|
2885 r_alloc_reinit ();
|
|
2886 #endif
|
|
2887 }
|
|
2888 #endif /* DOUG_LEA_MALLOC */
|
|
2889
|
1315
|
2890 run_temacs_argc = -2;
|
428
|
2891
|
|
2892 main_1 (vol_argc, vol_argv, vol_envp, restarted);
|
442
|
2893
|
|
2894 #ifdef _MSC_VER
|
|
2895 }
|
|
2896 /* VC++ documentation says that
|
|
2897 GetExceptionCode() cannot be called inside the filter itself. */
|
|
2898 __except (mswindows_handle_hardware_exceptions (GetExceptionCode ())) {}
|
|
2899 #endif
|
|
2900
|
1204
|
2901 RETURN_NOT_REACHED (0);
|
428
|
2902 }
|
|
2903
|
|
2904
|
771
|
2905 /************************************************************************/
|
|
2906 /* dumping XEmacs (to a new EXE file) */
|
|
2907 /************************************************************************/
|
|
2908
|
|
2909 #ifndef CANNOT_DUMP
|
|
2910
|
1204
|
2911 #if !defined (PDUMP) || !defined (SYSTEM_MALLOC)
|
|
2912 extern Char_Binary my_edata[];
|
428
|
2913 #endif
|
771
|
2914
|
|
2915 extern void disable_free_hook (void);
|
|
2916
|
|
2917 DEFUN ("dump-emacs", Fdump_emacs, 2, 2, 0, /*
|
|
2918 Dump current state of XEmacs into executable file FILENAME.
|
|
2919 Take symbols from SYMFILE (presumably the file you executed to run XEmacs).
|
|
2920 This is used in the file `loadup.el' when building XEmacs.
|
|
2921
|
|
2922 Remember to set `command-line-processed' to nil before dumping
|
|
2923 if you want the dumped XEmacs to process its command line
|
|
2924 and announce itself normally when it is run.
|
428
|
2925 */
|
771
|
2926 (filename, symfile))
|
428
|
2927 {
|
|
2928 /* This function can GC */
|
771
|
2929 struct gcpro gcpro1, gcpro2;
|
|
2930 int opurify;
|
|
2931
|
|
2932 GCPRO2 (filename, symfile);
|
|
2933
|
|
2934 #ifdef FREE_CHECKING
|
|
2935 Freally_free (Qnil);
|
|
2936
|
|
2937 /* When we're dumping, we can't use the debugging free() */
|
|
2938 disable_free_hook ();
|
|
2939 #endif
|
|
2940
|
|
2941 CHECK_STRING (filename);
|
|
2942 filename = Fexpand_file_name (filename, Qnil);
|
|
2943 if (!NILP (symfile))
|
428
|
2944 {
|
771
|
2945 CHECK_STRING (symfile);
|
|
2946 if (XSTRING_LENGTH (symfile) > 0)
|
|
2947 symfile = Fexpand_file_name (symfile, Qnil);
|
|
2948 else
|
|
2949 symfile = Qnil;
|
428
|
2950 }
|
|
2951
|
771
|
2952 opurify = purify_flag;
|
|
2953 purify_flag = 0;
|
|
2954
|
1303
|
2955 #if defined (HEAP_IN_DATA) && !defined (PDUMP)
|
771
|
2956 report_sheap_usage (1);
|
|
2957 #endif
|
|
2958
|
|
2959 clear_message ();
|
|
2960
|
|
2961 fflush (stderr);
|
|
2962 fflush (stdout);
|
|
2963
|
|
2964 disksave_object_finalization ();
|
|
2965 release_breathing_space ();
|
|
2966
|
|
2967 /* Tell malloc where start of impure now is */
|
|
2968 /* Also arrange for warnings when nearly out of space. */
|
|
2969 #ifndef SYSTEM_MALLOC
|
|
2970 memory_warnings (my_edata, malloc_warning);
|
|
2971 #endif
|
|
2972
|
814
|
2973 garbage_collect_1 ();
|
|
2974
|
|
2975 #ifdef PDUMP
|
|
2976 pdump ();
|
|
2977 #elif defined (WIN32_NATIVE)
|
|
2978 unexec (XSTRING_DATA (filename),
|
|
2979 STRINGP (symfile) ? XSTRING_DATA (symfile) : 0,
|
|
2980 (uintptr_t) my_edata, 0, 0);
|
|
2981 #else
|
771
|
2982 {
|
|
2983 Extbyte *filename_ext;
|
|
2984 Extbyte *symfile_ext;
|
|
2985
|
|
2986 LISP_STRING_TO_EXTERNAL (filename, filename_ext, Qfile_name);
|
|
2987
|
|
2988 if (STRINGP (symfile))
|
|
2989 LISP_STRING_TO_EXTERNAL (symfile, symfile_ext, Qfile_name);
|
|
2990 else
|
|
2991 symfile_ext = 0;
|
|
2992
|
814
|
2993 # ifdef DOUG_LEA_MALLOC
|
771
|
2994 malloc_state_ptr = malloc_get_state ();
|
814
|
2995 # endif
|
771
|
2996 /* here we break our rule that the filename conversion should
|
|
2997 be performed at the actual time that the system call is made.
|
|
2998 It's a whole lot easier to do the conversion here than to
|
|
2999 modify all the unexec routines to ensure that filename
|
|
3000 conversion is applied everywhere. Don't worry about memory
|
|
3001 leakage because this call only happens once. */
|
|
3002 unexec (filename_ext, symfile_ext, (uintptr_t) my_edata, 0, 0);
|
814
|
3003 # ifdef DOUG_LEA_MALLOC
|
771
|
3004 free (malloc_state_ptr);
|
814
|
3005 # endif
|
771
|
3006 }
|
814
|
3007 #endif /* not PDUMP, not WIN32_NATIVE */
|
771
|
3008
|
|
3009 purify_flag = opurify;
|
|
3010
|
814
|
3011 UNGCPRO;
|
771
|
3012 return Qnil;
|
|
3013 }
|
|
3014
|
|
3015 #endif /* not CANNOT_DUMP */
|
|
3016
|
|
3017
|
|
3018 /************************************************************************/
|
|
3019 /* exiting XEmacs (intended or not) */
|
|
3020 /************************************************************************/
|
|
3021
|
|
3022 /* Ben's capsule summary about expected and unexpected exits from XEmacs.
|
|
3023
|
|
3024 Expected exits occur when the user directs XEmacs to exit, for example
|
|
3025 by pressing the close button on the only frame in XEmacs, or by typing
|
|
3026 C-x C-c. This runs `save-buffers-kill-emacs', which saves any necessary
|
|
3027 buffers, and then exits using the primitive `kill-emacs'.
|
|
3028
|
|
3029 However, unexpected exits occur in a few different ways:
|
|
3030
|
|
3031 -- a memory access violation or other hardware-generated exception
|
|
3032 occurs. This is the worst possible problem to deal with, because
|
|
3033 the fault can occur while XEmacs is in any state whatsoever, even
|
|
3034 quite unstable ones. As a result, we need to be *extremely* careful
|
|
3035 what we do.
|
|
3036 -- we are using one X display (or if we've used more, we've closed the
|
|
3037 others already), and some hardware or other problem happens and
|
|
3038 suddenly we've lost our connection to the display. In this situation,
|
|
3039 things are not so dire as in the last one; our code itself isn't
|
|
3040 trashed, so we can continue execution as normal, after having set
|
|
3041 things up so that we can exit at the appropriate time. Our exit
|
|
3042 still needs to be of the emergency nature; we have no displays, so
|
|
3043 any attempts to use them will fail. We simply want to auto-save
|
|
3044 (the single most important thing to do during shut-down), do minimal
|
|
3045 cleanup of stuff that has an independent existence outside of XEmacs,
|
|
3046 and exit.
|
|
3047
|
|
3048 Currently, both unexpected exit scenarios described above set
|
|
3049 preparing_for_armageddon to indicate that nonessential and possibly
|
|
3050 dangerous things should not be done, specifically:
|
|
3051
|
|
3052 -- no garbage collection.
|
|
3053 -- no hooks are run.
|
|
3054 -- no messages of any sort from autosaving.
|
|
3055 -- autosaving tries harder, ignoring certain failures.
|
|
3056 -- existing frames are not deleted.
|
|
3057
|
|
3058 (Also, all places that set preparing_for_armageddon also
|
|
3059 set dont_check_for_quit. This happens separately because it's
|
|
3060 also necessary to set other variables to make absolutely sure
|
|
3061 no quitting happens.)
|
|
3062
|
|
3063 In the first scenario above (the access violation), we also set
|
|
3064 fatal_error_in_progress. This causes more things to not happen:
|
|
3065
|
|
3066 -- assertion failures do not abort.
|
|
3067 -- printing code does not do code conversion or gettext when
|
|
3068 printing to stdout/stderr.
|
|
3069 */
|
|
3070
|
|
3071 /* ------------------------------- */
|
|
3072 /* low-level debugging functions */
|
|
3073 /* ------------------------------- */
|
|
3074
|
|
3075 #if defined (WIN32_NATIVE) && defined (DEBUG_XEMACS)
|
|
3076 #define debugging_breakpoint() DebugBreak ()
|
|
3077 #else
|
|
3078 #define debugging_breakpoint()
|
|
3079 #endif
|
|
3080
|
|
3081 void
|
|
3082 debug_break (void)
|
|
3083 {
|
|
3084 debugging_breakpoint ();
|
|
3085 }
|
|
3086
|
1315
|
3087 #ifdef WIN32_ANY
|
771
|
3088
|
|
3089 /* Return whether all bytes in the specified memory block can be read. */
|
|
3090 int
|
|
3091 debug_can_access_memory (void *ptr, Bytecount len)
|
|
3092 {
|
|
3093 return !IsBadReadPtr (ptr, len);
|
|
3094 }
|
|
3095
|
1315
|
3096 #else /* !WIN32_ANY */
|
771
|
3097
|
|
3098 /* #### There must be a better way!!!! */
|
|
3099
|
|
3100 static JMP_BUF memory_error_jump;
|
|
3101
|
|
3102 static SIGTYPE
|
|
3103 debug_memory_error (int signum)
|
|
3104 {
|
|
3105 EMACS_REESTABLISH_SIGNAL (signum, debug_memory_error);
|
|
3106 EMACS_UNBLOCK_SIGNAL (signum);
|
|
3107 LONGJMP (memory_error_jump, 1);
|
|
3108 }
|
|
3109
|
|
3110 /* Return whether all bytes in the specified memory block can be read. */
|
|
3111 int
|
|
3112 debug_can_access_memory (void *ptr, Bytecount len)
|
|
3113 {
|
|
3114 /* Use volatile to protect variables from being clobbered by longjmp. */
|
|
3115 SIGTYPE (*volatile old_sigbus) (int);
|
|
3116 SIGTYPE (*volatile old_sigsegv) (int);
|
|
3117 volatile int old_errno = errno;
|
|
3118 volatile int retval = 1;
|
|
3119
|
|
3120 if (!SETJMP (memory_error_jump))
|
|
3121 {
|
|
3122 old_sigbus =
|
|
3123 (SIGTYPE (*) (int)) EMACS_SIGNAL (SIGBUS, debug_memory_error);
|
|
3124 old_sigsegv =
|
|
3125 (SIGTYPE (*) (int)) EMACS_SIGNAL (SIGSEGV, debug_memory_error);
|
|
3126
|
|
3127 if (len > 1)
|
|
3128 /* If we can, try to avoid problems with super-optimizing compilers
|
|
3129 that might decide that memcmp (ptr, ptr, len) can be optimized
|
|
3130 away since its result is always 1. */
|
|
3131 memcmp (ptr, (char *) ptr + 1, len - 1);
|
|
3132 else
|
|
3133 memcmp (ptr, ptr, len);
|
|
3134 }
|
|
3135 else
|
|
3136 retval = 0;
|
|
3137 EMACS_SIGNAL (SIGBUS, old_sigbus);
|
|
3138 EMACS_SIGNAL (SIGSEGV, old_sigsegv);
|
|
3139 errno = old_errno;
|
854
|
3140
|
771
|
3141 return retval;
|
|
3142 }
|
|
3143
|
1315
|
3144 #endif /* WIN32_ANY */
|
771
|
3145
|
|
3146 #ifdef DEBUG_XEMACS
|
|
3147
|
|
3148 DEFUN ("force-debugging-signal", Fforce_debugging_signal, 0, 1, 0, /*
|
|
3149 Cause XEmacs to enter the debugger.
|
|
3150 On some systems, there may be no way to do this gracefully; if so,
|
|
3151 nothing happens unless ABORT is non-nil, in which case XEmacs will
|
|
3152 abort() -- a sure-fire way to immediately get back to the debugger,
|
|
3153 but also a sure-fire way to kill XEmacs (and dump core on Unix
|
|
3154 systems)!
|
|
3155 */
|
|
3156 (abort_))
|
|
3157 {
|
|
3158 debugging_breakpoint ();
|
|
3159 if (!NILP (abort_))
|
|
3160 abort ();
|
|
3161 return Qnil;
|
|
3162 }
|
|
3163
|
|
3164 #endif /* DEBUG_XEMACS */
|
|
3165
|
|
3166 /* ------------------------------- */
|
|
3167 /* some helper functions */
|
|
3168 /* ------------------------------- */
|
|
3169
|
|
3170 static void
|
|
3171 ensure_no_quitting_from_now_on (void)
|
|
3172 {
|
|
3173 /* make sure no quitting from now on!! */
|
|
3174 dont_check_for_quit = 1;
|
|
3175 Vinhibit_quit = Qt;
|
|
3176 Vquit_flag = Qnil;
|
|
3177 }
|
|
3178
|
442
|
3179 #ifdef HAVE_MS_WINDOWS
|
771
|
3180 static void
|
|
3181 pause_so_user_can_read_messages (int allow_further)
|
|
3182 {
|
|
3183 static int already_paused;
|
|
3184
|
1315
|
3185 if (already_paused)
|
771
|
3186 return;
|
|
3187 if (!allow_further)
|
|
3188 already_paused = 1;
|
442
|
3189 /* If we displayed a message on the console, then we must allow the
|
|
3190 user to see this message. This may be unnecessary, but can't hurt,
|
|
3191 and we can't necessarily check arg; e.g. xemacs --help kills with
|
|
3192 argument 0. */
|
1315
|
3193 if (mswindows_message_outputted &&
|
|
3194 /* noninteractive, we always show the box. Else,
|
|
3195 do it when there is not yet an initial frame -- in such case,
|
|
3196 XEmacs will just die immediately and we wouldn't see anything. */
|
|
3197 (noninteractive || NILP (Fselected_frame (Qnil))))
|
771
|
3198 Fmswindows_message_box
|
|
3199 (build_msg_string ("Messages outputted. XEmacs is exiting."),
|
|
3200 Qnil, Qnil);
|
|
3201 }
|
442
|
3202 #endif
|
|
3203
|
826
|
3204 #ifdef WIN32_NATIVE
|
|
3205
|
|
3206 static DWORD CALLBACK
|
|
3207 wait_for_termination_signal (LPVOID handle)
|
|
3208 {
|
|
3209 HANDLE hevent = (HANDLE) handle;
|
|
3210 WaitForSingleObject (hevent, INFINITE);
|
|
3211 ExitProcess (0);
|
|
3212 return 0; /* not reached */
|
|
3213 }
|
|
3214
|
|
3215 #endif
|
771
|
3216 /* -------------------------------- */
|
|
3217 /* a (more-or-less) normal shutdown */
|
|
3218 /* -------------------------------- */
|
428
|
3219
|
|
3220 /* Perform an orderly shutdown of XEmacs. Autosave any modified
|
|
3221 buffers, kill any child processes, clean up the terminal modes (if
|
|
3222 we're in the foreground), and other stuff like that. Don't perform
|
|
3223 any redisplay; this may be called when XEmacs is shutting down in
|
|
3224 the background, or after its X connection has died.
|
|
3225
|
|
3226 If SIG is a signal number, print a message for it.
|
|
3227
|
442
|
3228 This is called by fatal signal handlers and Fkill_emacs. It used to
|
|
3229 be called by X protocol error handlers, but instead they now call
|
|
3230 Fkill_emacs. */
|
771
|
3231
|
428
|
3232 static void
|
442
|
3233 shut_down_emacs (int sig, Lisp_Object stuff, int no_auto_save)
|
428
|
3234 {
|
|
3235 /* This function can GC */
|
|
3236 /* Prevent running of hooks and other non-essential stuff
|
|
3237 from now on. */
|
|
3238 preparing_for_armageddon = 1;
|
|
3239
|
442
|
3240 ensure_no_quitting_from_now_on ();
|
428
|
3241
|
|
3242 #ifdef QUANTIFY
|
|
3243 quantify_stop_recording_data ();
|
|
3244 #endif /* QUANTIFY */
|
|
3245
|
|
3246 /* This is absolutely the most important thing to do, so make sure
|
|
3247 we do it now, before anything else. We might have crashed and
|
|
3248 be in a weird inconsistent state, and potentially anything could
|
|
3249 set off another protection fault and cause us to bail out
|
|
3250 immediately. */
|
442
|
3251 /* Steve writes the following:
|
|
3252
|
|
3253 [[I'm not removing the code entirely, yet. We have run up against
|
428
|
3254 a spate of problems in diagnosing crashes due to crashes within
|
|
3255 crashes. It has very definitely been determined that code called
|
|
3256 during auto-saving cannot work if XEmacs crashed inside of GC.
|
|
3257 We already auto-save on an itimer so there cannot be too much
|
|
3258 unsaved stuff around, and if we get better crash reports we might
|
442
|
3259 be able to get more problems fixed so I'm disabling this. -slb]]
|
|
3260
|
|
3261 and DISABLES AUTO-SAVING ENTIRELY during crashes! Way way bad idea.
|
|
3262
|
|
3263 Instead let's just be more intelligent about avoiding crashing
|
|
3264 when possible, esp. nested crashes.
|
|
3265 */
|
|
3266 if (!no_auto_save)
|
|
3267 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */
|
428
|
3268
|
|
3269 fflush (stdout);
|
|
3270 reset_all_consoles ();
|
|
3271 if (sig && sig != SIGTERM)
|
|
3272 {
|
442
|
3273 if (sig == -1)
|
|
3274 stderr_out ("\nFatal error.\n\n");
|
|
3275 else
|
|
3276 stderr_out ("\nFatal error (%d).\n\n", sig);
|
428
|
3277 stderr_out
|
|
3278 ("Your files have been auto-saved.\n"
|
1204
|
3279 "Use `M-x recover-session' to recover them.\n"
|
|
3280 "\n"
|
|
3281 "Your version of XEmacs was distributed with a PROBLEMS file that may describe\n"
|
|
3282 "your crash, and with luck a workaround. Please check it first, but do report\n"
|
|
3283 "the crash anyway.\n\n"
|
428
|
3284 #ifdef INFODOCK
|
1204
|
3285 "Please report this bug by selecting `Report-Bug' in the InfoDock menu, or\n"
|
|
3286 "(last resort) by emailing `crashes@xemacs.org' -- note that this is for XEmacs\n"
|
|
3287 "in general, not just Infodock."
|
428
|
3288 #else
|
1204
|
3289 "Please report this bug by invoking M-x report-emacs-bug, or by selecting\n"
|
|
3290 "`Send Bug Report' from the Help menu. If that won't work, send ordinary\n"
|
|
3291 "email to `crashes@xemacs.org'."
|
|
3292 #endif
|
|
3293 " *MAKE SURE* to include this entire output\n"
|
|
3294 "from this crash, especially including the Lisp backtrace, as well as the\n"
|
|
3295 "XEmacs configuration from M-x describe-installation (or equivalently, the\n"
|
|
3296 "file `Installation' in the top of the build tree).\n"
|
|
3297 #ifdef _MSC_VER
|
|
3298 "\n"
|
|
3299 "If you are fortunate enough to have some sort of debugging aid installed\n"
|
|
3300 "on your system, for example Visual C++, and you can get a C stack backtrace,\n"
|
|
3301 "*please* include it, as it will make our life far easier.\n"
|
|
3302 "\n"
|
|
3303 #else
|
|
3304 "\n"
|
|
3305 "*Please* try *hard* to obtain a C stack backtrace; without it, we are unlikely\n"
|
|
3306 "to be able to analyze the problem. Locate the core file produced as a result\n"
|
|
3307 "of this crash (often called `core' or `core.<process-id>', and located in\n"
|
|
3308 "the directory in which you started XEmacs or your home directory), and type\n"
|
|
3309 "\n"
|
|
3310 " gdb "
|
442
|
3311 #endif
|
|
3312 );
|
|
3313 #ifndef _MSC_VER
|
428
|
3314 {
|
442
|
3315 const char *name;
|
428
|
3316 char *dir = 0;
|
|
3317
|
|
3318 /* Now try to determine the actual path to the executable,
|
|
3319 to try to make the backtrace-determination process as foolproof
|
|
3320 as possible. */
|
|
3321 if (STRINGP (Vinvocation_name))
|
|
3322 name = (char *) XSTRING_DATA (Vinvocation_name);
|
|
3323 else
|
|
3324 name = "xemacs";
|
|
3325 if (STRINGP (Vinvocation_directory))
|
|
3326 dir = (char *) XSTRING_DATA (Vinvocation_directory);
|
|
3327 if (!dir || dir[0] != '/')
|
|
3328 stderr_out ("`which %s`", name);
|
|
3329 else if (dir[strlen (dir) - 1] != '/')
|
|
3330 stderr_out ("%s/%s", dir, name);
|
|
3331 else
|
|
3332 stderr_out ("%s%s", dir, name);
|
|
3333 }
|
|
3334 stderr_out
|
1097
|
3335 (" core\n"
|
|
3336 "\n"
|
1204
|
3337 "then type `where' at the debugger prompt. No GDB on your system? You may\n"
|
|
3338 "have DBX, or XDB, or SDB. (Ask your system administrator if you need help.)\n"
|
|
3339 "If no core file was produced, enable them (often with `ulimit -c unlimited')\n"
|
|
3340 "in case of future recurrance of the crash.\n");
|
442
|
3341 #endif /* _MSC_VER */
|
428
|
3342 }
|
|
3343
|
|
3344 stuff_buffered_input (stuff);
|
|
3345
|
|
3346 kill_buffer_processes (Qnil);
|
|
3347
|
|
3348 #ifdef CLASH_DETECTION
|
|
3349 unlock_all_files ();
|
|
3350 #endif
|
|
3351
|
|
3352 #ifdef TOOLTALK
|
|
3353 tt_session_quit (tt_default_session ());
|
|
3354 #if 0
|
|
3355 /* The following crashes when built on X11R5 and run on X11R6 */
|
|
3356 tt_close ();
|
|
3357 #endif
|
|
3358 #endif /* TOOLTALK */
|
|
3359 }
|
|
3360
|
771
|
3361 /* Dumping apparently isn't supported by versions of GCC >= 2.8. */
|
|
3362 /* The following needs conditionalization on whether either XEmacs or */
|
|
3363 /* various system shared libraries have been built and linked with */
|
|
3364 /* GCC >= 2.8. -slb */
|
1303
|
3365 #if defined (GNU_MALLOC)
|
771
|
3366 static void
|
|
3367 voodoo_free_hook (void *mem)
|
|
3368 {
|
|
3369 /* Disable all calls to free() when XEmacs is exiting and it doesn't */
|
|
3370 /* matter. */
|
|
3371 __free_hook =
|
|
3372 #ifdef __GNUC__ /* prototype of __free_hook varies with glibc version */
|
|
3373 (__typeof__ (__free_hook))
|
440
|
3374 #endif
|
771
|
3375 voodoo_free_hook;
|
|
3376 }
|
|
3377 #endif /* GNU_MALLOC */
|
|
3378
|
|
3379 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /*
|
|
3380 Exit the XEmacs job and kill it. Ask for confirmation, without argument.
|
|
3381 If ARG is an integer, return ARG as the exit program code.
|
|
3382 If ARG is a string, stuff it as keyboard input.
|
|
3383
|
|
3384 The value of `kill-emacs-hook', if not void,
|
|
3385 is a list of functions (of no args),
|
|
3386 all of which are called before XEmacs is actually killed.
|
428
|
3387 */
|
771
|
3388 (arg))
|
428
|
3389 {
|
|
3390 /* This function can GC */
|
771
|
3391 struct gcpro gcpro1;
|
|
3392
|
|
3393 GCPRO1 (arg);
|
|
3394
|
|
3395 if (feof (stdin))
|
|
3396 arg = Qt;
|
|
3397
|
|
3398 if (!preparing_for_armageddon && !noninteractive)
|
|
3399 run_hook (Qkill_emacs_hook);
|
|
3400
|
|
3401 ensure_no_quitting_from_now_on ();
|
|
3402
|
|
3403 if (!preparing_for_armageddon)
|
428
|
3404 {
|
771
|
3405 Lisp_Object concons, nextcons;
|
|
3406
|
|
3407 /* Normally, go ahead and delete all the consoles now.
|
|
3408 Some unmentionably lame window systems (MS Wwwww...... eek,
|
|
3409 I can't even say it) don't properly clean up after themselves,
|
|
3410 and even for those that do, it might be cleaner this way.
|
|
3411 If we're going down, however, we don't do this (might
|
|
3412 be too dangerous), and if we get a crash somewhere within
|
|
3413 this loop, we'll still autosave and won't try this again. */
|
|
3414
|
|
3415 LIST_LOOP_DELETING (concons, nextcons, Vconsole_list)
|
|
3416 {
|
|
3417 /* There is very little point in deleting the stream console.
|
|
3418 It uses stdio, which should flush any buffered output and
|
|
3419 something can only go wrong. -slb */
|
|
3420 /* I changed my mind. There's a stupid hack in close to add
|
|
3421 a trailing newline. */
|
|
3422 /*if (!CONSOLE_STREAM_P (XCONSOLE (XCAR (concons))))*/
|
|
3423 delete_console_internal (XCONSOLE (XCAR (concons)), 1, 1, 0);
|
|
3424 }
|
428
|
3425 }
|
|
3426
|
|
3427 UNGCPRO;
|
|
3428
|
771
|
3429 #ifdef HAVE_MS_WINDOWS
|
|
3430 pause_so_user_can_read_messages (1);
|
428
|
3431 #endif
|
854
|
3432
|
771
|
3433 shut_down_emacs (0, STRINGP (arg) ? arg : Qnil, 0);
|
|
3434
|
1303
|
3435 #if defined (GNU_MALLOC)
|
771
|
3436 __free_hook =
|
|
3437 #ifdef __GNUC__ /* prototype of __free_hook varies with glibc version */
|
|
3438 (__typeof__ (__free_hook))
|
|
3439 #endif
|
|
3440 voodoo_free_hook;
|
428
|
3441 #endif
|
771
|
3442
|
|
3443 exit (INTP (arg) ? XINT (arg) : 0);
|
|
3444 /* NOTREACHED */
|
|
3445 return Qnil; /* I'm sick of the compiler warning */
|
428
|
3446 }
|
|
3447
|
771
|
3448 /* -------------------------------- */
|
|
3449 /* abnormal shutdowns: GP faults */
|
|
3450 /* -------------------------------- */
|
|
3451
|
814
|
3452 /* This is somewhat ad-hoc ... figure out whether the user is developing
|
|
3453 XEmacs, which means (under MS Windows) they have a system debugger
|
|
3454 installed that catches GP faults in any application and lets them open
|
|
3455 up MS Dev Studio and start debugging the application -- similar to
|
|
3456 producing a core dump and then going back with a debugger to investigate
|
|
3457 the core dump, except that the program is still running. When this is
|
|
3458 installed, it's better not to "pause so user gets messages" because the
|
|
3459 debugger will pause anyway; and in case we're currently with a menu
|
|
3460 popped up or somewhere else inside of an internal modal loop, we will
|
|
3461 get wedged when we output the "pause". (It seems that the two modal
|
|
3462 loops will fight each other and the return key will never be passed to
|
|
3463 the "pause" handler so that XEmacs's GPF handler can return, resignal
|
|
3464 the GPF, and properly go into the debugger.) */
|
|
3465 #if defined (ERROR_CHECK_TYPES) || defined (ERROR_CHECK_TEXT) || defined (ERROR_CHECK_GC) || defined (ERROR_CHECK_STRUCTURES)
|
|
3466 #define USER_IS_DEVELOPING_XEMACS
|
|
3467 #endif
|
|
3468
|
854
|
3469
|
771
|
3470 /* Handle bus errors, illegal instruction, etc: actual implementation. */
|
|
3471 static void
|
|
3472 guts_of_fatal_error_signal (int sig)
|
428
|
3473 {
|
771
|
3474 fatal_error_in_progress++;
|
|
3475 inhibit_non_essential_printing_operations = 1;
|
|
3476 preparing_for_armageddon = 1;
|
|
3477
|
|
3478 ensure_no_quitting_from_now_on ();
|
|
3479
|
|
3480 /* Only try auto-saving first time through. If we crash in auto-saving,
|
|
3481 don't do it again. */
|
|
3482 if (fatal_error_in_progress == 1)
|
428
|
3483 {
|
771
|
3484 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */
|
|
3485 /* Do this so that the variable has the same value of 2 regardless of
|
|
3486 whether we made it through auto-saving correctly. */
|
|
3487 fatal_error_in_progress++;
|
428
|
3488 }
|
771
|
3489 else if (fatal_error_in_progress == 2)
|
|
3490 stderr_out ("WARNING: Unable to auto-save your files properly.\n"
|
|
3491 "Some or all may in fact have been auto-saved.\n"
|
|
3492 "\n");
|
|
3493
|
|
3494 /* Now, reset our signal handler, so the next time, we just die.
|
|
3495 Don't do this before auto-saving. */
|
|
3496 if (sig >= 0)
|
|
3497 EMACS_SIGNAL (sig, SIG_DFL);
|
|
3498
|
|
3499 /* Keep in mind that there's more than one signal that we can crash
|
|
3500 on. */
|
|
3501 /* If fatal error occurs in code below, avoid infinite recursion. */
|
|
3502 if (fatal_error_in_progress <= 2)
|
|
3503 {
|
|
3504 shut_down_emacs (sig, Qnil, 1);
|
|
3505 stderr_out ("\nLisp backtrace follows:\n\n");
|
|
3506 debug_backtrace ();
|
|
3507 # if 0 /* This is evil, rarely useful, and causes grief in some cases. */
|
|
3508 /* Check for Sun-style stack printing via /proc */
|
|
3509 {
|
|
3510 const Char_ASCII *pstack = "/usr/proc/bin/pstack";
|
|
3511 if (access (pstack, X_OK) == 0)
|
|
3512 {
|
|
3513 Char_ASCII buf[100];
|
|
3514 stderr_out ("\nC backtrace follows:\n"
|
|
3515 "(A real debugger may provide better information)\n\n");
|
|
3516 sprintf (buf, "%s %d >&2", pstack, (int)getpid());
|
|
3517 system (buf);
|
|
3518 }
|
|
3519 }
|
|
3520 # endif
|
814
|
3521 #if defined (HAVE_MS_WINDOWS) && !defined (USER_IS_DEVELOPING_XEMACS)
|
771
|
3522 pause_so_user_can_read_messages (0);
|
|
3523 #endif
|
|
3524 }
|
428
|
3525 }
|
|
3526
|
771
|
3527 /* This is called when a fatal signal (SIGBUS aka "bus error", SIGSEGV aka
|
|
3528 "segmentation violation", SIGILL aka "illegal instruction", and many
|
|
3529 others) is sent to the program. This generally happens under Unix,
|
|
3530 not MS Windows. */
|
|
3531 SIGTYPE
|
|
3532 fatal_error_signal (int sig)
|
428
|
3533 {
|
771
|
3534 /* Unblock the signal so that if the same signal gets sent in the
|
|
3535 code below, we avoid a deadlock. */
|
|
3536 EMACS_UNBLOCK_SIGNAL (sig);
|
|
3537
|
|
3538 guts_of_fatal_error_signal (sig);
|
|
3539
|
|
3540 /* Signal the same code; this time it will really be fatal. */
|
|
3541 #ifdef WIN32_NATIVE
|
|
3542 raise (sig);
|
|
3543 #else
|
|
3544 kill (qxe_getpid (), sig);
|
|
3545 #endif
|
|
3546 SIGRETURN;
|
428
|
3547 }
|
|
3548
|
771
|
3549 #ifdef _MSC_VER
|
|
3550
|
|
3551 #define STATUS_ASSERTION_FAILURE 0xE0000001
|
|
3552
|
|
3553 static DWORD
|
|
3554 mswindows_handle_hardware_exceptions_1 (void)
|
428
|
3555 {
|
793
|
3556 inhibit_non_essential_printing_operations = 1;
|
|
3557 preparing_for_armageddon = 1;
|
814
|
3558 #if !defined (USER_IS_DEVELOPING_XEMACS)
|
771
|
3559 pause_so_user_can_read_messages (0);
|
814
|
3560 #endif
|
771
|
3561 return EXCEPTION_EXECUTE_HANDLER;
|
428
|
3562 }
|
|
3563
|
771
|
3564 /* This is called under MS Windows when an exception (this encompasses both
|
|
3565 user-defined exceptions and hardware exceptions such as GP faults aka
|
|
3566 SIGBUS or SIGSEGV) is triggered. */
|
|
3567
|
|
3568 static DWORD
|
|
3569 mswindows_handle_hardware_exceptions (DWORD code)
|
428
|
3570 {
|
771
|
3571 if (code != STATUS_ACCESS_VIOLATION && code != STATUS_ILLEGAL_INSTRUCTION
|
|
3572 && code != STATUS_PRIVILEGED_INSTRUCTION
|
|
3573 && code != STATUS_DATATYPE_MISALIGNMENT
|
|
3574 && code != STATUS_ASSERTION_FAILURE)
|
|
3575 return EXCEPTION_CONTINUE_SEARCH;
|
|
3576
|
|
3577 /* I don't know if this filter is still wrapped in the outer __try, but
|
|
3578 it doesn't hurt to have another one, and it lets us control more
|
|
3579 exactly what we really want to do in such a situation. What we do is
|
|
3580 pause, if we haven't already done so, so that the user can see what's
|
|
3581 output. This is critical because otherwise the output is gone. */
|
|
3582 __try
|
|
3583 {
|
|
3584 guts_of_fatal_error_signal (-1);
|
|
3585 }
|
|
3586 /* VC++ documentation says that
|
|
3587 GetExceptionCode() cannot be called inside the filter itself. */
|
|
3588
|
|
3589 /* __except (mswindows_handle_hardware_exceptions (GetExceptionCode ())) {}
|
|
3590
|
|
3591 The line above is original. Unfortunately, when an error is tripped
|
|
3592 inside of the handler (e.g. during Fbacktrace()), and the handler for
|
|
3593 the handler is invoked, it correctly notices that something is amiss
|
|
3594 and it should just return -- but it returns EXCEPTION_CONTINUE_SEARCH,
|
|
3595 which causes the debugger to be invoked debugging the handler code in
|
|
3596 this function -- and WITH THE STACK UNWOUND so that you see main()
|
|
3597 calling mswindows_handle_hardware_exceptions(), calling Fbacktrace(),
|
|
3598 and a crash a couple of frames in -- AND NO SIGN OF THE ORIGINAL CRASH!
|
|
3599
|
|
3600 There's some real weirdness going on in the stack handling -- unlike
|
|
3601 in Unix, where further crashes just keep adding to the stack, it seems
|
|
3602 that under the structured-exception-handling, the stack can actually
|
|
3603 bounce back and forth between the full stack at the location of the
|
|
3604 exception and the unwound stack at the place where the __try clause was
|
|
3605 established. I don't completely understand it. What I do know is that
|
|
3606 returning EXCEPTION_EXECUTE_HANDLER on nested crash has the effect of
|
|
3607 aborting execution of the handler and going back to the outer filter
|
|
3608 function, which returns EXCEPTION_CONTINUE_SEARCH and everything is
|
|
3609 hunky-dorey -- your debugger sees a crash at the right location with
|
|
3610 the right stack.
|
|
3611
|
|
3612 I'm leaving in the trickier Unix-like code in the handler; someone who
|
|
3613 understands better than me how the stack works in these handlers could
|
|
3614 fix it up more. As it is, it works pretty well, so I'm not likely to
|
|
3615 touch it more. --ben
|
|
3616 */
|
|
3617
|
|
3618 __except (mswindows_handle_hardware_exceptions_1 ()) {}
|
|
3619
|
|
3620 /* pretend we didn't handle this, so that the debugger is invoked and/or
|
|
3621 the normal GPF box appears. */
|
|
3622 return EXCEPTION_CONTINUE_SEARCH;
|
428
|
3623 }
|
|
3624
|
771
|
3625 #endif /* _MSC_VER */
|
|
3626
|
|
3627 /* -------------------------------------- */
|
|
3628 /* abnormal shutdowns: assertion failures */
|
|
3629 /* -------------------------------------- */
|
428
|
3630
|
|
3631 /* This flag is useful to define if you're under a debugger; this way, you
|
|
3632 can put a breakpoint of assert_failed() and debug multiple problems
|
|
3633 in one session without having to recompile. */
|
|
3634 /* #define ASSERTIONS_DONT_ABORT */
|
|
3635
|
|
3636 #ifdef USE_ASSERTIONS
|
|
3637 /* This highly dubious kludge ... shut up Jamie, I'm tired of your slagging. */
|
|
3638
|
771
|
3639 /* Nonzero if handling an assertion failure. (Bumped by one each time
|
|
3640 we recursively hit such a failure.) */
|
442
|
3641 static int in_assert_failed;
|
771
|
3642
|
442
|
3643 static const char *assert_failed_file;
|
|
3644 static int assert_failed_line;
|
|
3645 static const char *assert_failed_expr;
|
|
3646
|
|
3647 #ifdef fprintf
|
|
3648 #undef fprintf
|
|
3649 #endif
|
|
3650
|
771
|
3651 /* This is called when an assert() fails or when abort() is called -- both
|
|
3652 of those are defined in the preprocessor to an expansion involving
|
|
3653 assert_failed(). */
|
442
|
3654 void
|
|
3655 assert_failed (const char *file, int line, const char *expr)
|
428
|
3656 {
|
442
|
3657 /* If we're already crashing, let's not crash again. This might be
|
|
3658 critical to getting auto-saving working properly. */
|
|
3659 if (fatal_error_in_progress)
|
|
3660 return;
|
|
3661
|
|
3662 /* We are extremely paranoid so we sensibly deal with recursive
|
|
3663 assertion failures. */
|
|
3664 in_assert_failed++;
|
771
|
3665 inhibit_non_essential_printing_operations = 1;
|
442
|
3666
|
|
3667 if (in_assert_failed >= 4)
|
|
3668 _exit (-1);
|
|
3669 else if (in_assert_failed == 3)
|
|
3670 {
|
771
|
3671 debugging_breakpoint ();
|
442
|
3672 _exit (-1);
|
|
3673 }
|
|
3674 else if (in_assert_failed == 2)
|
|
3675 {
|
771
|
3676 /* Ultra-paranoia. stderr_out() tries very hard not to do
|
|
3677 anything during assertion failures that might trigger more
|
|
3678 failures; but we might have messed up somewhere. fprintf was
|
|
3679 undeffed above, in case it was encapsulated. */
|
442
|
3680 fprintf (stderr,
|
|
3681 "Fatal error: recursive assertion failure, "
|
|
3682 "file %s, line %d, %s\n",
|
|
3683 file, line, expr);
|
|
3684 fprintf (stderr,
|
|
3685 "Original assertion failure: file %s, line %d, %s\n",
|
|
3686 assert_failed_file, assert_failed_line, assert_failed_expr);
|
|
3687 }
|
|
3688 else
|
|
3689 {
|
|
3690 assert_failed_file = file;
|
|
3691 assert_failed_line = line;
|
|
3692 assert_failed_expr = expr;
|
|
3693
|
771
|
3694 stderr_out ("\nFatal error: assertion failed, file %s, line %d, %s\n",
|
|
3695 file, line, expr);
|
442
|
3696 }
|
|
3697
|
771
|
3698 /* Enable the following if you want a breakpoint right away to the
|
|
3699 debugger, without the whole shutdown processing first. This can be
|
|
3700 useful if you're afraid the shutdown processing will modify state that
|
|
3701 you're trying to debug (generally fairly unlikely); but you then don't
|
|
3702 get the auto-save behavior, which may be extremely important if you
|
|
3703 were in the middle of doing something */
|
|
3704 /* debugging_breakpoint (); */
|
442
|
3705 #if !defined (ASSERTIONS_DONT_ABORT)
|
771
|
3706 #ifdef _MSC_VER
|
|
3707 /* Calling abort() directly just seems to exit, in a way we can't
|
1303
|
3708 trap. (#### The docs say it does raise (SIGABRT), which we should be
|
771
|
3709 able to trap. Perhaps we're messing up somewhere? Or perhaps MS is
|
|
3710 messed up.)
|
|
3711
|
|
3712 So, instead we cause an exception and enter into the structured
|
|
3713 exception-handling mechanism, which is just like what happens when a
|
|
3714 GPF occurs, and is cleaner anyway. (If we entered into one of the
|
|
3715 signal handlers, a crash in there would enter anyway into the
|
|
3716 structured exception stuff, and you'd get some weird mixture. Cleaner
|
|
3717 to keep it all in the expected way.)
|
|
3718 */
|
|
3719 /* Either of the following work in terms of causing an exception. The
|
|
3720 second one looks cleaner but you get an odd message about "Unknown
|
|
3721 software exception ..." without the obvious "OK to terminate", "Cancel
|
|
3722 to debug"; instead, you just get OK/Cancel, which in fact do those
|
|
3723 same things. */
|
|
3724 * ((int *) 0) = 666;
|
|
3725 /* RaiseException (STATUS_ASSERTION_FAILURE, EXCEPTION_NONCONTINUABLE, 0,
|
|
3726 0); */
|
|
3727 #else
|
|
3728 really_abort ();
|
|
3729 #endif /* _MSC_VER */
|
|
3730 #endif /* !defined (ASSERTIONS_DONT_ABORT) */
|
|
3731 inhibit_non_essential_printing_operations = 0;
|
442
|
3732 in_assert_failed = 0;
|
428
|
3733 }
|
|
3734 #endif /* USE_ASSERTIONS */
|
|
3735
|
771
|
3736 /* -------------------------------------- */
|
|
3737 /* low-memory notification */
|
|
3738 /* -------------------------------------- */
|
|
3739
|
|
3740 #ifdef SIGDANGER
|
|
3741
|
|
3742 /* Handler for SIGDANGER. */
|
|
3743 SIGTYPE
|
|
3744 memory_warning_signal (int sig)
|
|
3745 {
|
|
3746 /* #### bad bad bad; this function shouldn't do anything except
|
|
3747 set a flag, or weird corruption could happen. */
|
|
3748 EMACS_SIGNAL (sig, memory_warning_signal);
|
|
3749
|
|
3750 malloc_warning
|
|
3751 (GETTEXT ("Operating system warns that virtual memory is running low.\n"));
|
|
3752
|
|
3753 /* It might be unsafe to call do_auto_save now. */
|
|
3754 force_auto_save_soon ();
|
|
3755 }
|
|
3756 #endif /* SIGDANGER */
|
|
3757
|
|
3758
|
|
3759 /************************************************************************/
|
|
3760 /* Miscellaneous */
|
|
3761 /************************************************************************/
|
|
3762
|
|
3763 DEFUN ("noninteractive", Fnoninteractive, 0, 0, 0, /*
|
|
3764 Non-nil return value means XEmacs is running without interactive terminal.
|
528
|
3765 */
|
771
|
3766 ())
|
528
|
3767 {
|
771
|
3768 return noninteractive ? Qt : Qnil;
|
528
|
3769 }
|
|
3770
|
428
|
3771 #ifdef QUANTIFY
|
|
3772 DEFUN ("quantify-start-recording-data", Fquantify_start_recording_data,
|
|
3773 0, 0, "", /*
|
|
3774 Start recording Quantify data.
|
|
3775 */
|
|
3776 ())
|
|
3777 {
|
|
3778 quantify_start_recording_data ();
|
|
3779 return Qnil;
|
|
3780 }
|
|
3781
|
|
3782 DEFUN ("quantify-stop-recording-data", Fquantify_stop_recording_data,
|
|
3783 0, 0, "", /*
|
|
3784 Stop recording Quantify data.
|
|
3785 */
|
|
3786 ())
|
|
3787 {
|
|
3788 quantify_stop_recording_data ();
|
|
3789 return Qnil;
|
|
3790 }
|
|
3791
|
|
3792 DEFUN ("quantify-clear-data", Fquantify_clear_data, 0, 0, "", /*
|
|
3793 Clear all Quantify data.
|
|
3794 */
|
|
3795 ())
|
|
3796 {
|
|
3797 quantify_clear_data ();
|
|
3798 return Qnil;
|
|
3799 }
|
|
3800 #endif /* QUANTIFY */
|
|
3801
|
|
3802 void
|
|
3803 syms_of_emacs (void)
|
|
3804 {
|
|
3805 #ifndef CANNOT_DUMP
|
|
3806 DEFSUBR (Fdump_emacs);
|
|
3807 #endif /* !CANNOT_DUMP */
|
|
3808
|
|
3809 DEFSUBR (Frun_emacs_from_temacs);
|
|
3810 DEFSUBR (Frunning_temacs_p);
|
1315
|
3811 DEFSUBR (Femacs_run_status);
|
428
|
3812 DEFSUBR (Finvocation_name);
|
|
3813 DEFSUBR (Finvocation_directory);
|
|
3814 DEFSUBR (Fkill_emacs);
|
|
3815 DEFSUBR (Fnoninteractive);
|
|
3816
|
528
|
3817 #ifdef DEBUG_XEMACS
|
|
3818 DEFSUBR (Fforce_debugging_signal);
|
|
3819 #endif
|
|
3820
|
428
|
3821 #ifdef QUANTIFY
|
|
3822 DEFSUBR (Fquantify_start_recording_data);
|
|
3823 DEFSUBR (Fquantify_stop_recording_data);
|
|
3824 DEFSUBR (Fquantify_clear_data);
|
|
3825 #endif /* QUANTIFY */
|
|
3826
|
563
|
3827 DEFSYMBOL (Qkill_emacs_hook);
|
|
3828 DEFSYMBOL (Qsave_buffers_kill_emacs);
|
1315
|
3829
|
|
3830 DEFSYMBOL (Qtemacs);
|
|
3831 DEFSYMBOL (Qdumping);
|
|
3832 DEFSYMBOL (Qrestarted);
|
|
3833 DEFSYMBOL (Qpdump);
|
|
3834 DEFSYMBOL (Qbatch);
|
428
|
3835 }
|
|
3836
|
776
|
3837 /* Yuck! These variables may get set from command-line options when
|
|
3838 dumping; if we don't clear them, they will still be on once the dumped
|
|
3839 XEmacs reloads. (not an issue with pdump, as we kludge around this in
|
|
3840 main_1().) */
|
|
3841
|
|
3842 void
|
|
3843 zero_out_command_line_status_vars (void)
|
|
3844 {
|
|
3845 vanilla_inhibiting = 0;
|
|
3846 inhibit_early_packages = 0;
|
|
3847 inhibit_all_packages = 0;
|
|
3848 inhibit_autoloads = 0;
|
|
3849 debug_paths = 0;
|
|
3850 #ifndef INHIBIT_SITE_LISP
|
|
3851 inhibit_site_lisp = 0;
|
|
3852 #else
|
|
3853 inhibit_site_lisp = 1;
|
|
3854 #endif
|
|
3855 #ifndef INHIBIT_SITE_MODULES
|
|
3856 inhibit_site_modules = 0;
|
|
3857 #else
|
|
3858 inhibit_site_modules = 1;
|
|
3859 #endif
|
|
3860 }
|
|
3861
|
428
|
3862 void
|
|
3863 vars_of_emacs (void)
|
|
3864 {
|
|
3865 DEFVAR_BOOL ("suppress-early-error-handler-backtrace",
|
|
3866 &suppress_early_error_handler_backtrace /*
|
|
3867 Non-nil means early error handler shouldn't print a backtrace.
|
|
3868 */ );
|
|
3869
|
|
3870 DEFVAR_LISP ("command-line-args", &Vcommand_line_args /*
|
|
3871 Args passed by shell to XEmacs, as a list of strings.
|
|
3872 */ );
|
|
3873
|
|
3874 DEFVAR_LISP ("invocation-name", &Vinvocation_name /*
|
|
3875 The program name that was used to run XEmacs.
|
|
3876 Any directory names are omitted.
|
|
3877 */ );
|
|
3878
|
|
3879 DEFVAR_LISP ("invocation-directory", &Vinvocation_directory /*
|
|
3880 The directory in which the XEmacs executable was found, to run it.
|
|
3881 The value is simply the program name if that directory's name is not known.
|
|
3882 */ );
|
|
3883
|
|
3884 DEFVAR_LISP ("invocation-path", &Vinvocation_path /*
|
|
3885 The path in which the XEmacs executable was found, to run it.
|
|
3886 The value is simply the value of environment variable PATH on startup
|
|
3887 if XEmacs was found there.
|
|
3888 */ );
|
|
3889
|
|
3890 #if 0 /* FSFmacs */
|
776
|
3891 xxDEFVAR_LISP ("installation-directory", &Vinstallation_directory /*
|
|
3892 A directory within which to look for the `lib-src' and `etc' directories.
|
|
3893 This is non-nil when we can't find those directories in their standard
|
|
3894 installed locations, but we can find them ear where the XEmacs executable
|
|
3895 was found.
|
|
3896 */ );
|
428
|
3897 #endif
|
|
3898
|
|
3899 DEFVAR_LISP ("system-type", &Vsystem_type /*
|
|
3900 Symbol indicating type of operating system you are using.
|
|
3901 */ );
|
|
3902 Vsystem_type = intern (SYSTEM_TYPE);
|
771
|
3903 Fprovide (Vsystem_type);
|
428
|
3904
|
|
3905 #ifndef EMACS_CONFIGURATION
|
|
3906 # define EMACS_CONFIGURATION "UNKNOWN"
|
|
3907 #endif
|
|
3908 DEFVAR_LISP ("system-configuration", &Vsystem_configuration /*
|
|
3909 String naming the configuration XEmacs was built for.
|
|
3910 */ );
|
|
3911 Vsystem_configuration = build_string (EMACS_CONFIGURATION);
|
|
3912
|
|
3913 #ifndef EMACS_CONFIG_OPTIONS
|
|
3914 # define EMACS_CONFIG_OPTIONS "UNKNOWN"
|
|
3915 #endif
|
|
3916 DEFVAR_LISP ("system-configuration-options", &Vsystem_configuration_options /*
|
|
3917 String containing the configuration options XEmacs was built with.
|
|
3918 */ );
|
|
3919 Vsystem_configuration_options = build_string (EMACS_CONFIG_OPTIONS);
|
|
3920
|
|
3921 DEFVAR_LISP ("emacs-major-version", &Vemacs_major_version /*
|
|
3922 Major version number of this version of Emacs, as an integer.
|
|
3923 Warning: this variable did not exist in Emacs versions earlier than:
|
|
3924 FSF Emacs: 19.23
|
|
3925 XEmacs: 19.10
|
|
3926 */ );
|
|
3927 Vemacs_major_version = make_int (EMACS_MAJOR_VERSION);
|
|
3928
|
|
3929 DEFVAR_LISP ("emacs-minor-version", &Vemacs_minor_version /*
|
|
3930 Minor version number of this version of Emacs, as an integer.
|
|
3931 Warning: this variable did not exist in Emacs versions earlier than:
|
|
3932 FSF Emacs: 19.23
|
|
3933 XEmacs: 19.10
|
|
3934 */ );
|
|
3935 Vemacs_minor_version = make_int (EMACS_MINOR_VERSION);
|
|
3936
|
|
3937 DEFVAR_LISP ("emacs-patch-level", &Vemacs_patch_level /*
|
|
3938 The patch level of this version of Emacs, as an integer.
|
|
3939 The value is non-nil if this version of XEmacs is part of a series of
|
|
3940 stable XEmacsen, but has bug fixes applied.
|
|
3941 Warning: this variable does not exist in FSF Emacs or in XEmacs versions
|
|
3942 earlier than 21.1.1
|
|
3943 */ );
|
|
3944 #ifdef EMACS_PATCH_LEVEL
|
|
3945 Vemacs_patch_level = make_int (EMACS_PATCH_LEVEL);
|
|
3946 #else
|
|
3947 Vemacs_patch_level = Qnil;
|
|
3948 #endif
|
|
3949
|
|
3950 DEFVAR_LISP ("emacs-beta-version", &Vemacs_beta_version /*
|
|
3951 Beta number of this version of Emacs, as an integer.
|
|
3952 The value is nil if this is an officially released version of XEmacs.
|
|
3953 Warning: this variable does not exist in FSF Emacs or in XEmacs versions
|
|
3954 earlier than 20.3.
|
|
3955 */ );
|
|
3956 #ifdef EMACS_BETA_VERSION
|
|
3957 Vemacs_beta_version = make_int (EMACS_BETA_VERSION);
|
|
3958 #else
|
|
3959 Vemacs_beta_version = Qnil;
|
|
3960 #endif
|
|
3961
|
|
3962 #ifdef INFODOCK
|
|
3963 DEFVAR_LISP ("infodock-major-version", &Vinfodock_major_version /*
|
|
3964 Major version number of this InfoDock release.
|
|
3965 */ );
|
|
3966 Vinfodock_major_version = make_int (INFODOCK_MAJOR_VERSION);
|
|
3967
|
|
3968 DEFVAR_LISP ("infodock-minor-version", &Vinfodock_minor_version /*
|
|
3969 Minor version number of this InfoDock release.
|
|
3970 */ );
|
|
3971 Vinfodock_minor_version = make_int (INFODOCK_MINOR_VERSION);
|
|
3972
|
|
3973 DEFVAR_LISP ("infodock-build-version", &Vinfodock_build_version /*
|
|
3974 Build version of this InfoDock release.
|
|
3975 */ );
|
|
3976 Vinfodock_build_version = make_int (INFODOCK_BUILD_VERSION);
|
|
3977 #endif
|
|
3978
|
|
3979 DEFVAR_LISP ("xemacs-codename", &Vxemacs_codename /*
|
|
3980 Codename of this version of Emacs (a string).
|
|
3981 */ );
|
|
3982 #ifndef XEMACS_CODENAME
|
|
3983 #define XEMACS_CODENAME "Noname"
|
|
3984 #endif
|
|
3985 Vxemacs_codename = build_string (XEMACS_CODENAME);
|
|
3986
|
975
|
3987 DEFVAR_LISP ("xemacs-extra-name", &Vxemacs_extra_name /*
|
|
3988 Extra string to maybe put into the version string.
|
|
3989
|
|
3990 Usually used to denote an XEmacs built from a CVS checkout between
|
|
3991 releases. In that case its value would be \"(+CVS)\".
|
|
3992 */ );
|
|
3993 #ifdef XEMACS_EXTRA_NAME
|
|
3994 Vxemacs_extra_name = build_string (XEMACS_EXTRA_NAME);
|
|
3995 #endif
|
|
3996
|
442
|
3997 /* Lisp variables which contain command line flags.
|
|
3998
|
|
3999 The portable dumper stomps on these; they must be saved and restored
|
|
4000 if they are processed before the call to pdump_load() in main_1().
|
|
4001 */
|
428
|
4002 DEFVAR_BOOL ("noninteractive", &noninteractive1 /*
|
|
4003 Non-nil means XEmacs is running without interactive terminal.
|
|
4004 */ );
|
|
4005
|
776
|
4006 DEFVAR_BOOL ("vanilla-inhibiting", &vanilla_inhibiting /*
|
|
4007 Set to non-nil when the user-init and site-start files should not be loaded.
|
|
4008 */ );
|
|
4009
|
428
|
4010 DEFVAR_BOOL ("inhibit-early-packages", &inhibit_early_packages /*
|
|
4011 Set to non-nil when the early packages should not be respected at startup.
|
|
4012 */ );
|
|
4013
|
776
|
4014 DEFVAR_BOOL ("inhibit-all-packages", &inhibit_all_packages /*
|
|
4015 Set to non-nil when the no packages should not be respected at startup.
|
|
4016 XEmacs will utterly ignore the packages -- not in load-path, not set up as
|
|
4017 autoloads, nothing.
|
|
4018 */ );
|
|
4019
|
428
|
4020 DEFVAR_BOOL ("inhibit-autoloads", &inhibit_autoloads /*
|
|
4021 Set to non-nil when autoloads should not be loaded at startup.
|
|
4022 */ );
|
|
4023
|
|
4024 DEFVAR_BOOL ("debug-paths", &debug_paths /*
|
|
4025 Set to non-nil when debug information about paths should be printed.
|
|
4026 */ );
|
|
4027
|
|
4028 DEFVAR_BOOL ("inhibit-site-lisp", &inhibit_site_lisp /*
|
|
4029 Set to non-nil when the site-lisp should not be searched at startup.
|
|
4030 */ );
|
|
4031 #ifdef INHIBIT_SITE_LISP
|
|
4032 inhibit_site_lisp = 1;
|
|
4033 #endif
|
|
4034
|
|
4035 DEFVAR_BOOL ("inhibit-site-modules", &inhibit_site_modules /*
|
|
4036 Set to non-nil when site-modules should not be searched at startup.
|
|
4037 */ );
|
|
4038 #ifdef INHIBIT_SITE_MODULES
|
|
4039 inhibit_site_modules = 1;
|
|
4040 #endif
|
|
4041
|
|
4042 DEFVAR_INT ("emacs-priority", &emacs_priority /*
|
|
4043 Priority for XEmacs to run at.
|
|
4044 This value is effective only if set before XEmacs is dumped,
|
|
4045 and only if the XEmacs executable is installed with setuid to permit
|
|
4046 it to change priority. (XEmacs sets its uid back to the real uid.)
|
|
4047 Currently, you need to define SET_EMACS_PRIORITY in `config.h'
|
|
4048 before you compile XEmacs, to enable the code for this feature.
|
|
4049 */ );
|
|
4050 emacs_priority = 0;
|
|
4051
|
|
4052 DEFVAR_CONST_LISP ("internal-error-checking", &Vinternal_error_checking /*
|
|
4053 Internal error checking built-in into this instance of XEmacs.
|
|
4054 This is a list of symbols, initialized at build-time. Legal symbols
|
|
4055 are:
|
|
4056
|
|
4057 extents - check extents prior to each extent change;
|
800
|
4058 types - check types strictly;
|
428
|
4059 malloc - check operation of malloc;
|
|
4060 gc - check garbage collection;
|
800
|
4061 text - check text and buffer positions;
|
|
4062 display - check redisplay structure consistency;
|
|
4063 glyphs - check glyph structure consistency;
|
|
4064 byte-code - check byte-code consistency;.
|
|
4065 structures - check other structure consistency.
|
442
|
4066
|
|
4067 quick-build - user has requested the "quick-build" configure option.
|
428
|
4068 */ );
|
|
4069 Vinternal_error_checking = Qnil;
|
|
4070 #ifdef ERROR_CHECK_EXTENTS
|
|
4071 Vinternal_error_checking = Fcons (intern ("extents"),
|
|
4072 Vinternal_error_checking);
|
|
4073 #endif
|
800
|
4074 #ifdef ERROR_CHECK_TYPES
|
|
4075 Vinternal_error_checking = Fcons (intern ("types"),
|
428
|
4076 Vinternal_error_checking);
|
|
4077 #endif
|
|
4078 #ifdef ERROR_CHECK_MALLOC
|
|
4079 Vinternal_error_checking = Fcons (intern ("malloc"),
|
|
4080 Vinternal_error_checking);
|
|
4081 #endif
|
|
4082 #ifdef ERROR_CHECK_GC
|
|
4083 Vinternal_error_checking = Fcons (intern ("gc"),
|
|
4084 Vinternal_error_checking);
|
|
4085 #endif
|
800
|
4086 #ifdef ERROR_CHECK_TEXT
|
|
4087 Vinternal_error_checking = Fcons (intern ("text"),
|
|
4088 Vinternal_error_checking);
|
|
4089 #endif
|
|
4090 #ifdef ERROR_CHECK_DISPLAY
|
|
4091 Vinternal_error_checking = Fcons (intern ("display"),
|
|
4092 Vinternal_error_checking);
|
|
4093 #endif
|
|
4094 #ifdef ERROR_CHECK_GLYPHS
|
|
4095 Vinternal_error_checking = Fcons (intern ("glyphs"),
|
|
4096 Vinternal_error_checking);
|
|
4097 #endif
|
|
4098 #ifdef ERROR_CHECK_BYTE_CODE
|
|
4099 Vinternal_error_checking = Fcons (intern ("byte-code"),
|
|
4100 Vinternal_error_checking);
|
|
4101 #endif
|
|
4102 #ifdef ERROR_CHECK_STRUCTURES
|
|
4103 Vinternal_error_checking = Fcons (intern ("structures"),
|
428
|
4104 Vinternal_error_checking);
|
|
4105 #endif
|
442
|
4106 #ifdef QUICK_BUILD
|
|
4107 Vinternal_error_checking = Fcons (intern ("quick-build"),
|
|
4108 Vinternal_error_checking);
|
|
4109 #endif
|
428
|
4110
|
438
|
4111 DEFVAR_CONST_LISP ("mail-lock-methods", &Vmail_lock_methods /*
|
|
4112 Mail spool locking methods supported by this instance of XEmacs.
|
|
4113 This is a list of symbols. Each of the symbols is one of the
|
|
4114 following: dot, lockf, flock, locking, mmdf.
|
|
4115 */ );
|
|
4116 {
|
|
4117 Vmail_lock_methods = Qnil;
|
|
4118 Vmail_lock_methods = Fcons (intern ("dot"), Vmail_lock_methods);
|
|
4119 #ifdef HAVE_LOCKF
|
|
4120 Vmail_lock_methods = Fcons (intern ("lockf"), Vmail_lock_methods);
|
|
4121 #endif
|
|
4122 #ifdef HAVE_FLOCK
|
|
4123 Vmail_lock_methods = Fcons (intern ("flock"), Vmail_lock_methods);
|
|
4124 #endif
|
|
4125 #ifdef HAVE_MMDF
|
|
4126 Vmail_lock_methods = Fcons (intern ("mmdf"), Vmail_lock_methods);
|
|
4127 #endif
|
|
4128 #ifdef HAVE_LOCKING
|
|
4129 Vmail_lock_methods = Fcons (intern ("locking"), Vmail_lock_methods);
|
|
4130 #endif
|
|
4131 }
|
442
|
4132
|
438
|
4133 DEFVAR_CONST_LISP ("configure-mail-lock-method", &Vconfigure_mail_lock_method /*
|
|
4134 Mail spool locking method suggested by configure. This is one
|
|
4135 of the symbols in MAIL-LOCK-METHODS.
|
|
4136 */ );
|
|
4137 {
|
1303
|
4138 #if defined (MAIL_LOCK_FLOCK) && defined (HAVE_FLOCK)
|
771
|
4139 Vconfigure_mail_lock_method = intern ("flock");
|
1303
|
4140 #elif defined (MAIL_LOCK_LOCKF) && defined (HAVE_LOCKF)
|
771
|
4141 Vconfigure_mail_lock_method = intern ("lockf");
|
1303
|
4142 #elif defined (MAIL_LOCK_MMDF) && defined (HAVE_MMDF)
|
771
|
4143 Vconfigure_mail_lock_method = intern ("mmdf");
|
1303
|
4144 #elif defined (MAIL_LOCK_LOCKING) && defined (HAVE_LOCKING)
|
771
|
4145 Vconfigure_mail_lock_method = intern ("locking");
|
438
|
4146 #else
|
771
|
4147 Vconfigure_mail_lock_method = intern ("dot");
|
438
|
4148 #endif
|
|
4149 }
|
428
|
4150 }
|
|
4151
|
|
4152 void
|
|
4153 complex_vars_of_emacs (void)
|
|
4154 {
|
|
4155 /* This is all related to path searching. */
|
|
4156
|
|
4157 DEFVAR_LISP ("emacs-program-name", &Vemacs_program_name /*
|
|
4158 *Name of the Emacs variant.
|
|
4159 For example, this may be \"xemacs\" or \"infodock\".
|
|
4160 This is mainly meant for use in path searching.
|
|
4161 */ );
|
771
|
4162 Vemacs_program_name = build_ext_string (PATH_PROGNAME, Qfile_name);
|
428
|
4163
|
|
4164 DEFVAR_LISP ("emacs-program-version", &Vemacs_program_version /*
|
|
4165 *Version of the Emacs variant.
|
444
|
4166 This typically has the form NN.NN-bNN.
|
428
|
4167 This is mainly meant for use in path searching.
|
|
4168 */ );
|
771
|
4169 Vemacs_program_version = build_ext_string (PATH_VERSION, Qfile_name);
|
428
|
4170
|
|
4171 DEFVAR_LISP ("exec-path", &Vexec_path /*
|
|
4172 *List of directories to search programs to run in subprocesses.
|
|
4173 Each element is a string (directory name) or nil (try default directory).
|
|
4174 */ );
|
|
4175 Vexec_path = Qnil;
|
|
4176
|
|
4177 DEFVAR_LISP ("exec-directory", &Vexec_directory /*
|
|
4178 *Directory of architecture-dependent files that come with XEmacs,
|
|
4179 especially executable programs intended for XEmacs to invoke.
|
|
4180 */ );
|
|
4181 Vexec_directory = Qnil;
|
|
4182
|
|
4183 DEFVAR_LISP ("configure-exec-directory", &Vconfigure_exec_directory /*
|
|
4184 For internal use by the build procedure only.
|
444
|
4185 configure's idea of what `exec-directory' will be.
|
428
|
4186 */ );
|
|
4187 #ifdef PATH_EXEC
|
|
4188 Vconfigure_exec_directory = Ffile_name_as_directory
|
771
|
4189 (build_ext_string (PATH_EXEC, Qfile_name));
|
428
|
4190 #else
|
|
4191 Vconfigure_exec_directory = Qnil;
|
|
4192 #endif
|
|
4193
|
|
4194 DEFVAR_LISP ("lisp-directory", &Vlisp_directory /*
|
|
4195 *Directory of core Lisp files that come with XEmacs.
|
|
4196 */ );
|
|
4197 Vlisp_directory = Qnil;
|
|
4198
|
|
4199 DEFVAR_LISP ("configure-lisp-directory", &Vconfigure_lisp_directory /*
|
|
4200 For internal use by the build procedure only.
|
444
|
4201 configure's idea of what `lisp-directory' will be.
|
428
|
4202 */ );
|
|
4203 #ifdef PATH_LOADSEARCH
|
|
4204 Vconfigure_lisp_directory = Ffile_name_as_directory
|
771
|
4205 (build_ext_string (PATH_LOADSEARCH, Qfile_name));
|
428
|
4206 #else
|
|
4207 Vconfigure_lisp_directory = Qnil;
|
|
4208 #endif
|
|
4209
|
460
|
4210 DEFVAR_LISP ("mule-lisp-directory", &Vmule_lisp_directory /*
|
|
4211 *Directory of Mule Lisp files that come with XEmacs.
|
|
4212 */ );
|
|
4213 Vmule_lisp_directory = Qnil;
|
|
4214
|
|
4215 DEFVAR_LISP ("configure-mule-lisp-directory", &Vconfigure_mule_lisp_directory /*
|
|
4216 For internal use by the build procedure only.
|
|
4217 configure's idea of what `mule-lisp-directory' will be.
|
|
4218 */ );
|
|
4219 #ifdef PATH_MULELOADSEARCH
|
|
4220 Vconfigure_mule_lisp_directory = Ffile_name_as_directory
|
|
4221 (build_string ((char *) PATH_MULELOADSEARCH));
|
|
4222 #else
|
|
4223 Vconfigure_mule_lisp_directory = Qnil;
|
|
4224 #endif
|
|
4225
|
428
|
4226 DEFVAR_LISP ("module-directory", &Vmodule_directory /*
|
|
4227 *Directory of core dynamic modules that come with XEmacs.
|
|
4228 */ );
|
|
4229 Vmodule_directory = Qnil;
|
|
4230
|
|
4231 DEFVAR_LISP ("configure-module-directory", &Vconfigure_module_directory /*
|
|
4232 For internal use by the build procedure only.
|
444
|
4233 configure's idea of what `module-directory' will be.
|
428
|
4234 */ );
|
|
4235 #ifdef PATH_MODULESEARCH
|
|
4236 Vconfigure_module_directory = Ffile_name_as_directory
|
771
|
4237 (build_ext_string (PATH_MODULESEARCH, Qfile_name));
|
428
|
4238 #else
|
|
4239 Vconfigure_module_directory = Qnil;
|
|
4240 #endif
|
|
4241
|
|
4242 DEFVAR_LISP ("configure-package-path", &Vconfigure_package_path /*
|
|
4243 For internal use by the build procedure only.
|
|
4244 configure's idea of what the package path will be.
|
|
4245 */ );
|
|
4246 #ifdef PATH_PACKAGEPATH
|
771
|
4247 Vconfigure_package_path = split_external_path (PATH_PACKAGEPATH);
|
428
|
4248 #else
|
|
4249 Vconfigure_package_path = Qnil;
|
|
4250 #endif
|
|
4251
|
|
4252 DEFVAR_LISP ("data-directory", &Vdata_directory /*
|
|
4253 *Directory of architecture-independent files that come with XEmacs,
|
|
4254 intended for XEmacs to use.
|
|
4255 Use of this variable in new code is almost never correct. See the
|
442
|
4256 functions `locate-data-file' and `locate-data-directory' and the variable
|
|
4257 `data-directory-list'.
|
428
|
4258 */ );
|
|
4259 Vdata_directory = Qnil;
|
|
4260
|
|
4261 DEFVAR_LISP ("configure-data-directory", &Vconfigure_data_directory /*
|
|
4262 For internal use by the build procedure only.
|
444
|
4263 configure's idea of what `data-directory' will be.
|
428
|
4264 */ );
|
|
4265 #ifdef PATH_DATA
|
|
4266 Vconfigure_data_directory = Ffile_name_as_directory
|
771
|
4267 (build_ext_string (PATH_DATA, Qfile_name));
|
428
|
4268 #else
|
|
4269 Vconfigure_data_directory = Qnil;
|
|
4270 #endif
|
|
4271
|
|
4272 DEFVAR_LISP ("data-directory-list", &Vdata_directory_list /*
|
|
4273 *List of directories of architecture-independent files that come with XEmacs
|
|
4274 or were installed as packages, and are intended for XEmacs to use.
|
|
4275 */ );
|
|
4276 Vdata_directory_list = Qnil;
|
|
4277
|
|
4278 DEFVAR_LISP ("site-directory", &Vsite_directory /*
|
|
4279 *Directory of site-specific Lisp files that come with XEmacs.
|
|
4280 */ );
|
|
4281 Vsite_directory = Qnil;
|
|
4282
|
|
4283 DEFVAR_LISP ("configure-site-directory", &Vconfigure_site_directory /*
|
|
4284 For internal use by the build procedure only.
|
444
|
4285 configure's idea of what `site-directory' will be.
|
428
|
4286 */ );
|
|
4287 #ifdef PATH_SITE
|
|
4288 Vconfigure_site_directory = Ffile_name_as_directory
|
771
|
4289 (build_ext_string (PATH_SITE, Qfile_name));
|
428
|
4290 #else
|
|
4291 Vconfigure_site_directory = Qnil;
|
|
4292 #endif
|
|
4293
|
|
4294 DEFVAR_LISP ("site-module-directory", &Vsite_module_directory /*
|
|
4295 *Directory of site-specific loadable modules that come with XEmacs.
|
|
4296 */ );
|
|
4297 Vsite_module_directory = Qnil;
|
|
4298
|
|
4299 DEFVAR_LISP ("configure-site-module-directory", &Vconfigure_site_module_directory /*
|
|
4300 For internal use by the build procedure only.
|
444
|
4301 configure's idea of what `site-directory' will be.
|
428
|
4302 */ );
|
|
4303 #ifdef PATH_SITE_MODULES
|
|
4304 Vconfigure_site_module_directory = Ffile_name_as_directory
|
771
|
4305 (build_ext_string (PATH_SITE_MODULES, Qfile_name));
|
428
|
4306 #else
|
|
4307 Vconfigure_site_module_directory = Qnil;
|
|
4308 #endif
|
|
4309
|
|
4310 DEFVAR_LISP ("doc-directory", &Vdoc_directory /*
|
|
4311 *Directory containing the DOC file that comes with XEmacs.
|
444
|
4312 This is usually the same as `exec-directory'.
|
428
|
4313 */ );
|
|
4314 Vdoc_directory = Qnil;
|
|
4315
|
|
4316 DEFVAR_LISP ("configure-doc-directory", &Vconfigure_doc_directory /*
|
|
4317 For internal use by the build procedure only.
|
444
|
4318 configure's idea of what `doc-directory' will be.
|
428
|
4319 */ );
|
|
4320 #ifdef PATH_DOC
|
|
4321 Vconfigure_doc_directory = Ffile_name_as_directory
|
771
|
4322 (build_ext_string (PATH_DOC, Qfile_name));
|
428
|
4323 #else
|
|
4324 Vconfigure_doc_directory = Qnil;
|
|
4325 #endif
|
|
4326
|
|
4327 DEFVAR_LISP ("configure-exec-prefix-directory", &Vconfigure_exec_prefix_directory /*
|
|
4328 For internal use by the build procedure only.
|
444
|
4329 configure's idea of what `exec-prefix-directory' will be.
|
428
|
4330 */ );
|
|
4331 #ifdef PATH_EXEC_PREFIX
|
|
4332 Vconfigure_exec_prefix_directory = Ffile_name_as_directory
|
771
|
4333 (build_ext_string (PATH_EXEC_PREFIX, Qfile_name));
|
428
|
4334 #else
|
|
4335 Vconfigure_exec_prefix_directory = Qnil;
|
|
4336 #endif
|
|
4337
|
|
4338 DEFVAR_LISP ("configure-prefix-directory", &Vconfigure_prefix_directory /*
|
|
4339 For internal use by the build procedure only.
|
444
|
4340 configure's idea of what `prefix-directory' will be.
|
428
|
4341 */ );
|
|
4342 #ifdef PATH_PREFIX
|
|
4343 Vconfigure_prefix_directory = Ffile_name_as_directory
|
771
|
4344 (build_ext_string (PATH_PREFIX, Qfile_name));
|
428
|
4345 #else
|
|
4346 Vconfigure_prefix_directory = Qnil;
|
|
4347 #endif
|
|
4348
|
|
4349 DEFVAR_LISP ("configure-info-directory", &Vconfigure_info_directory /*
|
|
4350 For internal use by the build procedure only.
|
|
4351 This is the name of the directory in which the build procedure installed
|
|
4352 Emacs's info files; the default value for Info-default-directory-list
|
|
4353 includes this.
|
|
4354 */ );
|
|
4355 #ifdef PATH_INFO
|
|
4356 Vconfigure_info_directory =
|
771
|
4357 Ffile_name_as_directory (build_ext_string (PATH_INFO, Qfile_name));
|
428
|
4358 #else
|
|
4359 Vconfigure_info_directory = Qnil;
|
|
4360 #endif
|
|
4361
|
|
4362 DEFVAR_LISP ("configure-info-path", &Vconfigure_info_path /*
|
|
4363 The configured initial path for info documentation.
|
|
4364 */ );
|
|
4365 #ifdef PATH_INFOPATH
|
771
|
4366 Vconfigure_info_path = split_external_path (PATH_INFOPATH);
|
428
|
4367 #else
|
|
4368 Vconfigure_info_path = Qnil;
|
|
4369 #endif
|
|
4370 }
|
|
4371
|
1303
|
4372 #if defined (__sgi) && !defined (PDUMP)
|
428
|
4373 /* This is so tremendously ugly I'd puke. But then, it works.
|
|
4374 * The target is to override the static constructor from the
|
442
|
4375 * libiflPNG.so library which is masquerading as libz, and
|
428
|
4376 * cores on us when re-started from the dumped executable.
|
|
4377 * This will have to go for 21.1 -- OG.
|
|
4378 */
|
446
|
4379 void __sti__iflPNGFile_c___ (void);
|
|
4380 void
|
|
4381 __sti__iflPNGFile_c___ (void)
|
428
|
4382 {
|
|
4383 }
|
|
4384
|
|
4385 #endif
|
771
|
4386
|
|
4387 #undef abort /* Get access to the real version of abort. We put this all
|
|
4388 the way at the end to make sure that all calls to abort()
|
|
4389 anywhere in the above code go through assert_failed(). */
|
|
4390
|
|
4391 void
|
|
4392 really_abort (void)
|
|
4393 {
|
|
4394 abort ();
|
|
4395 }
|