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