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