0
|
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.
|
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Mule 2.0, FSF 19.28. */
|
|
24
|
|
25 /* Note: It is necessary to specify <config.h> and not "config.h" in
|
|
26 order for the --srcdir type of compilation to work properly.
|
|
27 Otherwise the config.h from the srcdir, rather than the one from
|
|
28 the build dir, will be used. */
|
|
29
|
|
30 #include <config.h>
|
|
31 #include "lisp.h"
|
|
32
|
|
33 #include "backtrace.h" /* run-emacs-from-temacs needs this */
|
|
34 #include "buffer.h"
|
|
35 #include "commands.h"
|
|
36 #include "console.h"
|
|
37 #include "process.h"
|
|
38 #include "sysdep.h"
|
|
39
|
|
40 #include <setjmp.h>
|
|
41 #include "syssignal.h" /* Always include before systty.h */
|
|
42 #include "systty.h"
|
|
43 #include "sysfile.h"
|
|
44 #include "systime.h"
|
|
45
|
272
|
46 #ifdef HAVE_SHLIB
|
|
47 #include "sysdll.h"
|
|
48 #endif
|
|
49
|
14
|
50 #if defined (HAVE_LOCALE_H) && \
|
|
51 (defined (I18N2) || defined (I18N3) || defined (I18N4))
|
0
|
52 #include <locale.h>
|
|
53 #endif
|
|
54
|
|
55 #ifdef TOOLTALK
|
149
|
56 #include TT_C_H_PATH
|
0
|
57 #endif
|
|
58
|
|
59 #ifdef APOLLO
|
|
60 #ifndef APOLLO_SR10
|
|
61 #include <default_acl.h>
|
|
62 #endif
|
|
63 #endif
|
|
64
|
251
|
65 #if defined (WINDOWSNT)
|
227
|
66 #include <windows.h>
|
|
67 #endif
|
|
68
|
179
|
69 /* For PATH_EXEC */
|
272
|
70 #include <paths.h>
|
0
|
71
|
257
|
72 #if !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC
|
94
|
73 extern void *(*__malloc_hook)(size_t);
|
|
74 extern void *(*__realloc_hook)(void *, size_t);
|
|
75 extern void (*__free_hook)(void *);
|
257
|
76 #endif /* not SYSTEM_MALLOC && not DOUG_LEA_MALLOC */
|
94
|
77
|
0
|
78 /* Command line args from shell, as list of strings */
|
|
79 Lisp_Object Vcommand_line_args;
|
|
80
|
|
81 /* Set nonzero after XEmacs has started up the first time.
|
|
82 Prevents reinitialization of the Lisp world and keymaps
|
|
83 on subsequent starts. */
|
|
84 int initialized;
|
|
85
|
255
|
86 #ifdef DOUG_LEA_MALLOC
|
|
87 # include <malloc.h>
|
|
88 /* Preserves a pointer to the memory allocated that copies that
|
|
89 static data inside glibc's malloc. */
|
272
|
90 static void *malloc_state_ptr;
|
|
91 #endif /* DOUG_LEA_MALLOC */
|
|
92
|
|
93 # ifdef REL_ALLOC
|
|
94 void r_alloc_reinit (void);
|
|
95 # endif
|
255
|
96
|
0
|
97 /* Variable whose value is symbol giving operating system type. */
|
|
98 Lisp_Object Vsystem_type;
|
|
99
|
|
100 /* Variable whose value is string giving configuration built for. */
|
|
101 Lisp_Object Vsystem_configuration;
|
163
|
102
|
175
|
103 /* Variable whose value is string containing the configuration options
|
|
104 XEmacs was built with. */
|
|
105 Lisp_Object Vsystem_configuration_options;
|
|
106
|
165
|
107 /* Version numbers and strings */
|
|
108 Lisp_Object Vemacs_major_version;
|
|
109 Lisp_Object Vemacs_minor_version;
|
343
|
110 Lisp_Object Vemacs_patch_level;
|
165
|
111 Lisp_Object Vemacs_beta_version;
|
|
112 Lisp_Object Vxemacs_codename;
|
278
|
113 #ifdef INFODOCK
|
|
114 Lisp_Object Vinfodock_major_version;
|
|
115 Lisp_Object Vinfodock_minor_version;
|
|
116 Lisp_Object Vinfodock_build_version;
|
|
117 #endif
|
165
|
118
|
269
|
119 /* The path under which XEmacs was invoked. */
|
|
120 Lisp_Object Vinvocation_path;
|
|
121
|
0
|
122 /* The name under which XEmacs was invoked, with any leading directory
|
|
123 names discarded. */
|
|
124 Lisp_Object Vinvocation_name;
|
|
125
|
|
126 /* The directory name from which XEmacs was invoked. */
|
|
127 Lisp_Object Vinvocation_directory;
|
|
128
|
|
129 #if 0 /* FSFmacs */
|
|
130 /* The directory name in which to find subdirs such as lisp and etc.
|
|
131 nil means get them only from PATH_LOADSEARCH. */
|
|
132 Lisp_Object Vinstallation_directory;
|
|
133 #endif
|
|
134
|
280
|
135 Lisp_Object Vemacs_program_name, Vemacs_program_version;
|
276
|
136 Lisp_Object Vexec_path;
|
|
137 Lisp_Object Vexec_directory, Vconfigure_exec_directory;
|
|
138 Lisp_Object Vlisp_directory, Vconfigure_lisp_directory;
|
267
|
139 Lisp_Object Vconfigure_package_path;
|
|
140 Lisp_Object Vdata_directory, Vconfigure_data_directory;
|
|
141 Lisp_Object Vdoc_directory, Vconfigure_doc_directory;
|
|
142 Lisp_Object Vconfigure_lock_directory;
|
|
143 Lisp_Object Vdata_directory_list;
|
|
144 Lisp_Object Vinfo_directory, Vconfigure_info_directory;
|
|
145 Lisp_Object Vsite_directory, Vconfigure_site_directory;
|
|
146 Lisp_Object Vconfigure_info_path;
|
276
|
147 Lisp_Object Vinternal_error_checking;
|
284
|
148 Lisp_Object Vpath_separator;
|
267
|
149
|
|
150 /* The default base directory XEmacs is installed under. */
|
278
|
151 Lisp_Object Vconfigure_exec_prefix_directory, Vconfigure_prefix_directory;
|
267
|
152
|
0
|
153 /* If nonzero, set XEmacs to run at this priority. This is also used
|
|
154 in child_setup and sys_suspend to make sure subshells run at normal
|
|
155 priority. */
|
|
156 int emacs_priority;
|
|
157
|
|
158 /* If non-zero a filter or a sentinel is running. Tested to save the match
|
|
159 data on the first attempt to change it inside asynchronous code. */
|
|
160 int running_asynch_code;
|
|
161
|
|
162 /* If non-zero, a window-system was specified on the command line. */
|
|
163 int display_arg;
|
|
164
|
|
165 /* Type of display specified. We cannot use a Lisp symbol here because
|
|
166 Lisp symbols may not initialized at the time that we set this
|
|
167 variable. */
|
|
168 CONST char *display_use;
|
|
169
|
|
170 /* If non-zero, then the early error handler will only print the error
|
|
171 message and exit. */
|
272
|
172 int suppress_early_error_handler_backtrace;
|
0
|
173
|
|
174 /* An address near the bottom of the stack.
|
|
175 Tells GC how to save a copy of the stack. */
|
|
176 char *stack_bottom;
|
|
177
|
|
178 #ifdef USG_SHARED_LIBRARIES
|
|
179 /* If nonzero, this is the place to put the end of the writable segment
|
|
180 at startup. */
|
|
181
|
165
|
182 uintptr_t bss_end = 0;
|
0
|
183 #endif
|
|
184
|
|
185 /* Number of bytes of writable memory we can expect to be able to get */
|
|
186 unsigned int lim_data;
|
|
187
|
|
188 /* Nonzero means running XEmacs without interactive terminal. */
|
|
189
|
|
190 int noninteractive;
|
|
191
|
|
192 /* Value of Lisp variable `noninteractive'.
|
|
193 Normally same as C variable `noninteractive'
|
|
194 but nothing terrible happens if user sets this one. */
|
|
195
|
|
196 int noninteractive1;
|
|
197
|
267
|
198 /* Nonzero means don't perform site-lisp searches at startup */
|
|
199 int inhibit_site_lisp;
|
|
200
|
276
|
201 /* Nonzero means don't respect early packages at startup */
|
|
202 int inhibit_early_packages;
|
|
203
|
|
204 /* Nonzero means don't load package autoloads at startup */
|
|
205 int inhibit_autoloads;
|
|
206
|
|
207 /* Nonzero means print debug information about path searching */
|
|
208 int debug_paths;
|
235
|
209
|
0
|
210 /* Save argv and argc. */
|
|
211 char **initial_argv;
|
|
212 int initial_argc;
|
|
213
|
16
|
214 static void sort_args (int argc, char **argv);
|
|
215
|
0
|
216 extern int always_gc; /* hack */
|
|
217
|
|
218 Lisp_Object Qkill_emacs_hook;
|
|
219 Lisp_Object Qsave_buffers_kill_emacs;
|
|
220
|
|
221
|
|
222 /* Signal code for the fatal signal that was received */
|
|
223 static int fatal_error_code;
|
|
224
|
|
225 /* Nonzero if handling a fatal error already */
|
|
226 static int fatal_error_in_progress;
|
|
227
|
|
228 static void shut_down_emacs (int sig, Lisp_Object stuff);
|
|
229
|
|
230 /* Handle bus errors, illegal instruction, etc. */
|
|
231 SIGTYPE
|
|
232 fatal_error_signal (int sig)
|
|
233 {
|
|
234 fatal_error_code = sig;
|
|
235 signal (sig, SIG_DFL);
|
|
236 /* Unblock the signal so that if the same signal gets sent in the
|
|
237 code below, we avoid a deadlock. */
|
|
238 EMACS_UNBLOCK_SIGNAL (fatal_error_code);
|
|
239
|
|
240 /* If fatal error occurs in code below, avoid infinite recursion. */
|
|
241 if (! fatal_error_in_progress)
|
|
242 {
|
187
|
243 fatal_error_in_progress = dont_check_for_quit = 1;
|
0
|
244 shut_down_emacs (sig, Qnil);
|
280
|
245 stderr_out ("\nLisp backtrace follows:\n\n");
|
|
246 Fbacktrace (Qexternal_debugging_output, Qt);
|
110
|
247 # if 0 /* This is evil, rarely useful, and causes grief in some cases. */
|
0
|
248 /* Check for Sun-style stack printing via /proc */
|
|
249 {
|
2
|
250 CONST char *pstack = "/usr/proc/bin/pstack";
|
280
|
251 if (access (pstack, X_OK) == 0)
|
0
|
252 {
|
|
253 char buf[100];
|
280
|
254 stderr_out ("\nC backtrace follows:\n"
|
0
|
255 "(A real debugger may provide better information)\n\n");
|
280
|
256 sprintf (buf, "%s %d >&2", pstack, (int)getpid());
|
|
257 system (buf);
|
0
|
258 }
|
|
259 }
|
110
|
260 # endif
|
0
|
261 }
|
|
262 /* Signal the same code; this time it will really be fatal. */
|
|
263 kill (getpid (), fatal_error_code);
|
|
264 SIGRETURN;
|
|
265 }
|
|
266
|
|
267
|
|
268 DOESNT_RETURN
|
|
269 fatal (CONST char *fmt, ...)
|
|
270 {
|
|
271 va_list args;
|
|
272 va_start (args, fmt);
|
|
273
|
|
274 fprintf (stderr, "\nXEmacs: ");
|
|
275 vfprintf (stderr, GETTEXT (fmt), args);
|
|
276 fprintf (stderr, "\n");
|
|
277
|
|
278 va_end (args);
|
|
279 fflush (stderr);
|
|
280 exit (1);
|
|
281 }
|
|
282
|
|
283 /* #### The following two functions should be replaced with
|
|
284 calls to emacs_doprnt_*() functions, with STREAM set to send out
|
|
285 to stdout or stderr. This is the only way to ensure that
|
|
286 I18N3 works properly (many implementations of the *printf()
|
|
287 functions, including the ones included in glibc, do not implement
|
|
288 the %###$ argument-positioning syntax). */
|
|
289
|
|
290 /* exactly equivalent to fprintf (stderr, fmt, ...) except that it calls
|
|
291 GETTEXT on the format string. */
|
|
292
|
|
293 int
|
|
294 stderr_out (CONST char *fmt, ...)
|
|
295 {
|
|
296 int retval;
|
|
297 va_list args;
|
|
298 va_start (args, fmt);
|
|
299
|
|
300 retval = vfprintf (stderr, GETTEXT (fmt), args);
|
|
301
|
|
302 va_end (args);
|
|
303 /* fflush (stderr); */
|
|
304 return retval;
|
|
305 }
|
|
306
|
|
307 /* exactly equivalent to fprintf (stdout, fmt, ...) except that it calls
|
|
308 GETTEXT on the format string. */
|
|
309
|
|
310 int
|
|
311 stdout_out (CONST char *fmt, ...)
|
|
312 {
|
|
313 int retval;
|
|
314 va_list args;
|
|
315 va_start (args, fmt);
|
|
316
|
|
317 retval = vfprintf (stdout, GETTEXT (fmt), args);
|
|
318
|
|
319 va_end (args);
|
|
320 return retval;
|
|
321 }
|
|
322
|
|
323 #ifdef SIGDANGER
|
|
324
|
|
325 /* Handler for SIGDANGER. */
|
|
326 SIGTYPE
|
|
327 memory_warning_signal (int sig)
|
|
328 {
|
|
329 /* #### bad bad bad; this function shouldn't do anything except
|
|
330 set a flag, or weird corruption could happen. */
|
|
331 signal (sig, memory_warning_signal);
|
|
332
|
|
333 malloc_warning
|
|
334 (GETTEXT ("Operating system warns that virtual memory is running low.\n"));
|
|
335
|
|
336 /* It might be unsafe to call do_auto_save now. */
|
|
337 force_auto_save_soon ();
|
|
338 }
|
14
|
339 #endif /* SIGDANGER */
|
0
|
340
|
|
341 /* Code for dealing with Lisp access to the Unix command line */
|
|
342
|
|
343 static Lisp_Object
|
|
344 make_arg_list_1 (int argc, char **argv, int skip_args)
|
|
345 {
|
|
346 Lisp_Object result = Qnil;
|
|
347 REGISTER int i;
|
|
348
|
|
349 for (i = argc - 1; i >= 0; i--)
|
|
350 {
|
|
351 if (i == 0 || i > skip_args)
|
235
|
352 {
|
239
|
353 #ifdef WINDOWSNT
|
235
|
354 if (i == 0)
|
|
355 {
|
|
356 /* Do not trust to what crt0 has stuffed into argv[0] */
|
|
357 char full_exe_path [MAX_PATH];
|
|
358 GetModuleFileName (NULL, full_exe_path, MAX_PATH);
|
|
359 result = Fcons (build_ext_string (full_exe_path, FORMAT_FILENAME),
|
|
360 result);
|
265
|
361 #if defined(HAVE_SHLIB)
|
|
362 (void)dll_init(full_exe_path);
|
|
363 #endif
|
235
|
364 }
|
|
365 else
|
|
366 #endif
|
|
367 result = Fcons (build_ext_string (argv [i], FORMAT_FILENAME), result);
|
|
368 }
|
0
|
369 }
|
|
370 return result;
|
|
371 }
|
|
372
|
|
373 Lisp_Object
|
|
374 make_arg_list (int argc, char **argv)
|
|
375 {
|
|
376 return make_arg_list_1 (argc, argv, 0);
|
|
377 }
|
|
378
|
|
379 /* Calling functions are also responsible for calling free_argc_argv
|
|
380 when they are done with the generated list. */
|
|
381 void
|
|
382 make_argc_argv (Lisp_Object argv_list, int *argc, char ***argv)
|
|
383 {
|
|
384 Lisp_Object next;
|
|
385 int n = XINT (Flength (argv_list));
|
|
386 REGISTER int i;
|
|
387 *argv = (char**) xmalloc ((n+1) * sizeof (char*));
|
|
388
|
|
389 for (i = 0, next = argv_list; i < n; i++, next = XCDR (next))
|
|
390 {
|
|
391 CONST char *temp;
|
|
392 CHECK_STRING (XCAR (next));
|
163
|
393
|
0
|
394 GET_C_STRING_EXT_DATA_ALLOCA (XCAR (next), FORMAT_OS, temp);
|
|
395 (*argv) [i] = xstrdup (temp);
|
|
396 }
|
|
397 (*argv) [n] = 0;
|
|
398 *argc = i;
|
|
399 }
|
|
400
|
|
401 void
|
|
402 free_argc_argv (char **argv)
|
|
403 {
|
|
404 int elt = 0;
|
|
405
|
|
406 while (argv[elt])
|
|
407 {
|
|
408 xfree (argv[elt]);
|
|
409 elt++;
|
|
410 }
|
|
411 xfree (argv);
|
|
412 }
|
|
413
|
|
414 static void
|
|
415 init_cmdargs (int argc, char **argv, int skip_args)
|
|
416 {
|
|
417 initial_argv = argv;
|
|
418 initial_argc = argc;
|
|
419
|
|
420 Vcommand_line_args = make_arg_list_1 (argc, argv, skip_args);
|
|
421 }
|
|
422
|
20
|
423 DEFUN ("invocation-name", Finvocation_name, 0, 0, 0, /*
|
0
|
424 Return the program name that was used to run XEmacs.
|
|
425 Any directory names are omitted.
|
20
|
426 */
|
|
427 ())
|
0
|
428 {
|
|
429 return Fcopy_sequence (Vinvocation_name);
|
|
430 }
|
|
431
|
20
|
432 DEFUN ("invocation-directory", Finvocation_directory, 0, 0, 0, /*
|
16
|
433 Return the directory name in which the Emacs executable was located.
|
20
|
434 */
|
|
435 ())
|
16
|
436 {
|
|
437 return Fcopy_sequence (Vinvocation_directory);
|
|
438 }
|
|
439
|
0
|
440
|
|
441 #ifdef I18N4
|
|
442 /* #### - don't know why I18N4 on SunOS/JLE
|
|
443 can't deal with this. It's a potential
|
|
444 bug that needs to be looked at. */
|
|
445 # undef RUN_TIME_REMAP
|
|
446 #endif
|
|
447
|
70
|
448 #if defined (MULE) && defined (MSDOS) && defined (EMX)
|
|
449 /* Setup all of files be input/output'ed with binary translation mdoe. */
|
|
450 asm (" .text");
|
|
451 asm ("L_setbinmode:");
|
|
452 asm (" movl $1, __fmode_bin");
|
|
453 asm (" ret");
|
|
454 asm (" .stabs \"___CTOR_LIST__\", 23, 0, 0, L_setbinmode");
|
|
455 #endif
|
|
456
|
16
|
457 /* Test whether the next argument in ARGV matches SSTR or a prefix of
|
|
458 LSTR (at least MINLEN characters). If so, then if VALPTR is non-null
|
|
459 (the argument is supposed to have a value) store in *VALPTR either
|
|
460 the next argument or the portion of this one after the equal sign.
|
|
461 ARGV is read starting at position *SKIPPTR; this index is advanced
|
|
462 by the number of arguments used.
|
|
463
|
|
464 Too bad we can't just use getopt for all of this, but we don't have
|
|
465 enough information to do it right. */
|
|
466
|
|
467 static int
|
|
468 argmatch (char **argv, int argc, char *sstr, char *lstr,
|
|
469 int minlen, char **valptr, int *skipptr)
|
|
470 {
|
173
|
471 char *p = NULL;
|
16
|
472 int arglen;
|
|
473 char *arg;
|
|
474
|
|
475 /* Don't access argv[argc]; give up in advance. */
|
|
476 if (argc <= *skipptr + 1)
|
|
477 return 0;
|
|
478
|
|
479 arg = argv[*skipptr+1];
|
|
480 if (arg == NULL)
|
|
481 return 0;
|
|
482 if (strcmp (arg, sstr) == 0)
|
|
483 {
|
|
484 if (valptr != NULL)
|
|
485 {
|
|
486 *valptr = argv[*skipptr+2];
|
|
487 *skipptr += 2;
|
|
488 }
|
|
489 else
|
|
490 *skipptr += 1;
|
|
491 return 1;
|
|
492 }
|
|
493 arglen = (valptr != NULL && (p = strchr (arg, '=')) != NULL
|
|
494 ? p - arg : strlen (arg));
|
|
495 if (lstr == 0 || arglen < minlen || strncmp (arg, lstr, arglen) != 0)
|
|
496 return 0;
|
|
497 else if (valptr == NULL)
|
|
498 {
|
|
499 *skipptr += 1;
|
|
500 return 1;
|
|
501 }
|
|
502 else if (p != NULL)
|
|
503 {
|
|
504 *valptr = p+1;
|
|
505 *skipptr += 1;
|
|
506 return 1;
|
|
507 }
|
|
508 else if (argv[*skipptr+2] != NULL)
|
|
509 {
|
|
510 *valptr = argv[*skipptr+2];
|
|
511 *skipptr += 2;
|
|
512 return 1;
|
|
513 }
|
|
514 else
|
|
515 {
|
|
516 return 0;
|
|
517 }
|
|
518 }
|
|
519
|
163
|
520 /* Make stack traces always identify version + configuration */
|
177
|
521 #define main_1 STACK_TRACE_EYE_CATCHER
|
163
|
522
|
0
|
523 static DOESNT_RETURN
|
233
|
524 main_1 (int argc, char **argv, char **envp, int restart)
|
0
|
525 {
|
|
526 char stack_bottom_variable;
|
|
527 int skip_args = 0;
|
|
528 Lisp_Object load_me;
|
|
529 int inhibit_window_system;
|
98
|
530 #ifdef NeXT
|
|
531 extern int malloc_cookie;
|
|
532 #endif
|
0
|
533
|
357
|
534 #if (!defined (SYSTEM_MALLOC) && !defined (HAVE_LIBMCHECK) \
|
|
535 && !defined (DOUG_LEA_MALLOC))
|
163
|
536 /* Make sure that any libraries we link against haven't installed a
|
94
|
537 hook for a gmalloc of a potentially incompatible version. */
|
267
|
538 /* If we're using libmcheck, the hooks have already been initialized, */
|
|
539 /* don't touch them. -slb */
|
94
|
540 __malloc_hook = NULL;
|
|
541 __realloc_hook = NULL;
|
|
542 __free_hook = NULL;
|
357
|
543 #endif /* not SYSTEM_MALLOC or HAVE_LIBMCHECK or DOUG_LEA_MALLOC */
|
94
|
544
|
16
|
545 noninteractive = 0;
|
|
546
|
0
|
547 #ifdef NeXT
|
|
548 /* 19-Jun-1995 -baw
|
|
549 * NeXT secret magic, ripped from Emacs-for-NS by Carl Edman
|
14
|
550 * <cedman@princeton.edu>. Note that even Carl doesn't know what this
|
0
|
551 * does; it was provided by NeXT, and it presumable makes NS's mallocator
|
|
552 * work with dumping. But malloc_jumpstart() and malloc_freezedry() in
|
|
553 * unexnext.c are both completely undocumented, even in NS header files!
|
|
554 * But hey, it solves all NS related memory problems, so who's
|
16
|
555 * complaining? */
|
272
|
556 if (initialized && malloc_jumpstart (malloc_cookie) != 0)
|
|
557 fprintf (stderr, "malloc jumpstart failed!\n");
|
0
|
558 #endif /* NeXT */
|
|
559
|
269
|
560 /*
|
267
|
561 #if defined (GNU_MALLOC) && \
|
|
562 defined (ERROR_CHECK_MALLOC) && \
|
|
563 !defined (HAVE_LIBMCHECK)
|
269
|
564 */
|
|
565 #if defined(LOSING_GCC_DESTRUCTOR_FREE_BUG)
|
|
566 /* Prior to XEmacs 21, this was `#if 0'ed out. */
|
|
567 /* I'm enabling this because it is the only reliable way I've found to */
|
|
568 /* prevent a very annoying problem where GCC will attempt to free(3) */
|
|
569 /* memory at exit() and cause a coredump. */
|
267
|
570 init_free_hook ();
|
0
|
571 #endif
|
|
572
|
16
|
573 sort_args (argc, argv);
|
|
574
|
0
|
575 /* Map in shared memory, if we are using that. */
|
|
576 #ifdef HAVE_SHM
|
16
|
577 if (argmatch (argv, argc, "-nl", "--no-shared-memory", 6, NULL, &skip_args))
|
0
|
578 {
|
|
579 map_in_data (0);
|
|
580 /* The shared memory was just restored, which clobbered this. */
|
|
581 skip_args = 1;
|
|
582 }
|
|
583 else
|
|
584 {
|
|
585 map_in_data (1);
|
|
586 /* The shared memory was just restored, which clobbered this. */
|
|
587 skip_args = 0;
|
|
588 }
|
16
|
589 #endif /* HAVE_SHM */
|
0
|
590
|
|
591 #if (defined (MSDOS) && defined (EMX)) || defined (WIN32) || defined (_SCO_DS)
|
|
592 environ = envp;
|
|
593 #endif
|
|
594
|
|
595 /* Record (approximately) where the stack begins. */
|
|
596 stack_bottom = &stack_bottom_variable;
|
|
597
|
|
598 #ifdef USG_SHARED_LIBRARIES
|
|
599 if (bss_end)
|
|
600 brk ((void *) bss_end);
|
|
601 #endif
|
|
602
|
|
603 clearerr (stdin);
|
|
604
|
|
605 #ifdef APOLLO
|
|
606 #ifndef APOLLO_SR10
|
|
607 /* If USE_DOMAIN_ACLS environment variable exists,
|
|
608 use ACLs rather than UNIX modes. */
|
|
609 if (egetenv ("USE_DOMAIN_ACLS"))
|
|
610 default_acl (USE_DEFACL);
|
|
611 #endif
|
|
612 #endif /* APOLLO */
|
|
613
|
|
614 #if defined (HAVE_MMAP) && defined (REL_ALLOC)
|
|
615 /* ralloc can only be used if using the GNU memory allocator. */
|
|
616 init_ralloc ();
|
314
|
617 #elif defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC)
|
|
618 if (initialized)
|
|
619 init_ralloc();
|
0
|
620 #endif
|
|
621
|
|
622 #ifdef HAVE_SOCKS
|
|
623 if (initialized)
|
|
624 SOCKSinit (argv[0]);
|
|
625 #endif /* HAVE_SOCKS */
|
|
626
|
|
627 #ifndef SYSTEM_MALLOC
|
|
628 if (!initialized)
|
16
|
629 /* Arrange to get warning messages as memory fills up. */
|
|
630 memory_warnings (0, malloc_warning);
|
0
|
631 #endif /* not SYSTEM_MALLOC */
|
|
632
|
|
633 #ifdef MSDOS
|
|
634 /* We do all file input/output as binary files. When we need to translate
|
|
635 newlines, we do that manually. */
|
|
636 _fmode = O_BINARY;
|
16
|
637 (stdin) ->_flag &= ~_IOTEXT;
|
0
|
638 (stdout)->_flag &= ~_IOTEXT;
|
|
639 (stderr)->_flag &= ~_IOTEXT;
|
|
640 #endif /* MSDOS */
|
|
641
|
|
642 #ifdef SET_EMACS_PRIORITY
|
|
643 if (emacs_priority != 0)
|
|
644 nice (-emacs_priority);
|
|
645 setuid (getuid ());
|
|
646 #endif /* SET_EMACS_PRIORITY */
|
|
647
|
|
648 #ifdef EXTRA_INITIALIZE
|
|
649 EXTRA_INITIALIZE;
|
|
650 #endif
|
|
651
|
|
652 #ifdef HAVE_WINDOW_SYSTEM
|
|
653 inhibit_window_system = 0;
|
|
654 #else
|
|
655 inhibit_window_system = 1;
|
|
656 #endif
|
|
657
|
|
658 /* Handle the -t switch, which specifies filename to use as terminal */
|
16
|
659 {
|
|
660 char *term;
|
|
661 if (argmatch (argv, argc, "-t", "--terminal", 4, &term, &skip_args))
|
|
662 {
|
|
663 close (0);
|
|
664 close (1);
|
251
|
665 if (open (term, O_RDWR | OPEN_BINARY, 2) < 0)
|
16
|
666 fatal ("%s: %s", term, strerror (errno));
|
|
667 dup (0);
|
|
668 if (! isatty (0))
|
|
669 fatal ("%s: not a tty", term);
|
163
|
670
|
100
|
671 #if 0
|
16
|
672 stderr_out ("Using %s", ttyname (0));
|
100
|
673 #endif
|
|
674 stderr_out ("Using %s", term);
|
16
|
675 inhibit_window_system = 1; /* -t => -nw */
|
|
676 }
|
|
677 }
|
0
|
678
|
16
|
679 /* Handle -nw switch */
|
|
680 if (argmatch (argv, argc, "-nw", "--no-windows", 6, NULL, &skip_args))
|
|
681 inhibit_window_system = 1;
|
0
|
682
|
|
683 /* Handle the -batch switch, which means don't do interactive display. */
|
16
|
684 if (argmatch (argv, argc, "-batch", "--batch", 5, NULL, &skip_args))
|
235
|
685 {
|
237
|
686 #if 0 /* I don't think this is correct. */
|
276
|
687 inhibit_autoloads = 1;
|
237
|
688 #endif
|
235
|
689 noninteractive = 1;
|
|
690 }
|
70
|
691
|
276
|
692 if (argmatch (argv, argc, "-debug-paths", "--debug-paths",
|
|
693 11, NULL, &skip_args))
|
|
694 debug_paths = 1;
|
|
695
|
|
696 /* Partially handle -no-autoloads, -no-early-packages and -vanilla. Packages */
|
239
|
697 /* are searched prior to the rest of the command line being parsed in */
|
|
698 /* startup.el */
|
276
|
699 if (argmatch (argv, argc, "-no-early-packages", "--no-early-packages",
|
235
|
700 6, NULL, &skip_args))
|
207
|
701 {
|
276
|
702 inhibit_early_packages = 1;
|
207
|
703 skip_args--;
|
|
704 }
|
235
|
705 if (argmatch (argv, argc, "-vanilla", "--vanilla",
|
|
706 7, NULL, &skip_args))
|
|
707 {
|
276
|
708 inhibit_early_packages = 1;
|
239
|
709 skip_args--;
|
|
710 }
|
|
711
|
|
712 if (argmatch (argv, argc, "-no-autoloads", "--no-autoloads",
|
|
713 7, NULL, &skip_args))
|
|
714 {
|
|
715 /* Inhibit everything */
|
276
|
716 inhibit_autoloads = 1;
|
|
717 skip_args--;
|
|
718 }
|
|
719
|
|
720 if (argmatch (argv, argc, "-debug-paths", "--debug-paths",
|
|
721 6, NULL, &skip_args))
|
|
722 {
|
|
723 debug_paths = 1;
|
235
|
724 skip_args--;
|
|
725 }
|
|
726
|
207
|
727
|
0
|
728 /* Partially handle the -version and -help switches: they imply -batch,
|
16
|
729 but are not removed from the list. */
|
215
|
730 if (argmatch (argv, argc, "-help", "--help", 3, NULL, &skip_args))
|
16
|
731 noninteractive = 1, skip_args--;
|
0
|
732
|
16
|
733 if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args) ||
|
|
734 argmatch (argv, argc, "-V", 0, 2, NULL, &skip_args))
|
|
735 noninteractive = 1, skip_args--;
|
163
|
736
|
0
|
737 /* Now, figure out which type of console is our first console. */
|
|
738
|
|
739 display_arg = 0;
|
|
740
|
|
741 if (noninteractive)
|
|
742 display_use = "stream";
|
|
743 else
|
|
744 display_use = "tty";
|
|
745
|
|
746 #ifndef HAVE_TTY
|
|
747 if (inhibit_window_system)
|
|
748 fatal ("Sorry, this XEmacs was not compiled with TTY support");
|
|
749 #endif
|
|
750
|
|
751 #ifdef HAVE_WINDOW_SYSTEM
|
|
752 /* Stupid kludge to catch command-line display spec. We can't
|
16
|
753 handle this argument entirely in window-system-dependent code
|
|
754 because we don't even know which window-system-dependent code
|
0
|
755 to run until we've recognized this argument. */
|
|
756 if (!inhibit_window_system && !noninteractive)
|
|
757 {
|
16
|
758 #ifdef HAVE_X_WINDOWS
|
|
759 char *dpy = 0;
|
|
760 int count_before = skip_args;
|
163
|
761
|
16
|
762 if (argmatch (argv, argc, "-d", "--display", 3, &dpy, &skip_args) ||
|
|
763 argmatch (argv, argc, "-display", 0, 3, &dpy, &skip_args))
|
|
764 {
|
|
765 display_arg = 1;
|
|
766 display_use = "x";
|
|
767 }
|
|
768 /* If we have the form --display=NAME,
|
|
769 convert it into -d name.
|
|
770 This requires inserting a new element into argv. */
|
|
771 if (dpy != 0 && skip_args - count_before == 1)
|
0
|
772 {
|
16
|
773 char **new = (char **) xmalloc (sizeof (char *) * (argc + 2));
|
|
774 int j;
|
|
775
|
|
776 for (j = 0; j < count_before + 1; j++)
|
|
777 new[j] = argv[j];
|
|
778 new[count_before + 1] = "-d";
|
|
779 new[count_before + 2] = dpy;
|
|
780 for (j = count_before + 2; j <argc; j++)
|
|
781 new[j + 1] = argv[j];
|
|
782 argv = new;
|
|
783 argc++;
|
0
|
784 }
|
16
|
785 /* Change --display to -d, when its arg is separate. */
|
|
786 else if (dpy != 0 && skip_args > count_before
|
|
787 && argv[count_before + 1][1] == '-')
|
|
788 argv[count_before + 1] = "-d";
|
0
|
789
|
16
|
790 /* Don't actually discard this arg. */
|
|
791 skip_args = count_before;
|
|
792
|
|
793 /* If there is a non-empty environment var DISPLAY, set
|
|
794 `display_use', but not `display_arg', which is only to be set
|
|
795 if the display was specified on the command line. */
|
|
796 if ((dpy = getenv ("DISPLAY")) && dpy[0])
|
0
|
797 display_use = "x";
|
163
|
798
|
16
|
799 #endif /* HAVE_X_WINDOWS */
|
213
|
800 #ifdef HAVE_MS_WINDOWS
|
263
|
801 if (strcmp(display_use, "x") != 0)
|
213
|
802 display_use = "mswindows";
|
|
803 #endif /* HAVE_MS_WINDOWS */
|
0
|
804 }
|
|
805 #endif /* HAVE_WINDOW_SYSTEM */
|
|
806
|
|
807 noninteractive1 = noninteractive;
|
|
808
|
|
809 /****** Now initialize everything *******/
|
|
810
|
|
811 /* First, do really basic environment initialization -- catching signals
|
|
812 and the like. These functions have no dependence on any part of
|
|
813 the Lisp engine and need to be done both at dump time and at run time. */
|
|
814
|
|
815 init_signals_very_early ();
|
|
816 init_data_very_early (); /* Catch math errors. */
|
|
817 #ifdef LISP_FLOAT_TYPE
|
|
818 init_floatfns_very_early (); /* Catch floating-point math errors. */
|
|
819 #endif
|
|
820 init_process_times_very_early (); /* Initialize our process timers.
|
|
821 As early as possible, of course,
|
|
822 so we can be fairly accurate. */
|
|
823 init_intl_very_early (); /* set up the locale and domain for gettext and
|
|
824 such. */
|
|
825
|
|
826 /* Now initialize the Lisp engine and the like. Done only during
|
|
827 dumping. No dependence on anything that may be in the user's
|
|
828 environment when the dumped XEmacs is run.
|
|
829
|
|
830 We try to do things in an order that minimizes the non-obvious
|
|
831 dependencies between functions. */
|
|
832
|
|
833 if (!initialized)
|
|
834 {
|
|
835 /* Initialize things so that new Lisp objects
|
|
836 can be created and objects can be staticpro'd.
|
|
837 Must be basically the very first thing done
|
|
838 because pretty much all of the initialization
|
|
839 routines below create new objects. */
|
|
840 init_alloc_once_early ();
|
|
841
|
|
842 /* Initialize Qnil, Qt, Qunbound, and the
|
|
843 obarray. After this, symbols can be
|
|
844 interned. This depends on init_alloc_once(). */
|
|
845 init_symbols_once_early ();
|
|
846
|
|
847 /* Declare the basic symbols pertaining to errors,
|
|
848 So that deferror() can be called. */
|
|
849 init_errors_once_early ();
|
|
850
|
|
851 /* Make sure that opaque pointers can be created. */
|
|
852 init_opaque_once_early ();
|
|
853
|
|
854 /* Now declare all the symbols and define all the Lisp primitives.
|
|
855
|
|
856 The *only* thing that the syms_of_*() functions are allowed to do
|
|
857 is call one of the following three functions:
|
|
858
|
|
859 defsymbol()
|
16
|
860 defsubr() (i.e. DEFSUBR)
|
0
|
861 deferror()
|
|
862 defkeyword()
|
|
863
|
|
864 Order does not matter in these functions.
|
|
865 */
|
|
866
|
|
867 syms_of_abbrev ();
|
|
868 syms_of_alloc ();
|
136
|
869 #ifdef HAVE_X_WINDOWS
|
|
870 syms_of_balloon_x ();
|
|
871 #endif
|
0
|
872 syms_of_buffer ();
|
|
873 syms_of_bytecode ();
|
|
874 syms_of_callint ();
|
|
875 syms_of_callproc ();
|
|
876 syms_of_casefiddle ();
|
|
877 syms_of_casetab ();
|
70
|
878 syms_of_chartab ();
|
0
|
879 syms_of_cmdloop ();
|
|
880 syms_of_cmds ();
|
|
881 syms_of_console ();
|
|
882 syms_of_data ();
|
|
883 #ifdef DEBUG_XEMACS
|
|
884 syms_of_debug ();
|
|
885 #endif /* DEBUG_XEMACS */
|
|
886 syms_of_device ();
|
|
887 #ifdef HAVE_DIALOGS
|
|
888 syms_of_dialog ();
|
|
889 #endif
|
|
890 syms_of_dired ();
|
245
|
891 #ifdef HAVE_SHLIB
|
265
|
892 syms_of_dll ();
|
245
|
893 #endif
|
0
|
894 syms_of_doc ();
|
|
895 syms_of_editfns ();
|
|
896 syms_of_elhash ();
|
|
897 syms_of_emacs ();
|
|
898 syms_of_eval ();
|
282
|
899 #ifdef HAVE_DRAGNDROP
|
|
900 syms_of_dragdrop ();
|
|
901 #endif
|
0
|
902 syms_of_event_stream ();
|
|
903 syms_of_events ();
|
|
904 syms_of_extents ();
|
|
905 syms_of_faces ();
|
|
906 syms_of_fileio ();
|
|
907 #ifdef CLASH_DETECTION
|
|
908 syms_of_filelock ();
|
|
909 #endif /* CLASH_DETECTION */
|
|
910 syms_of_floatfns ();
|
|
911 syms_of_fns ();
|
|
912 syms_of_font_lock ();
|
|
913 syms_of_frame ();
|
|
914 syms_of_general ();
|
|
915 syms_of_glyphs ();
|
280
|
916 syms_of_glyphs_eimage ();
|
0
|
917 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
|
|
918 syms_of_gui ();
|
|
919 #endif
|
|
920 syms_of_indent ();
|
|
921 syms_of_intl ();
|
|
922 syms_of_keymap ();
|
|
923 syms_of_lread ();
|
|
924 syms_of_macros ();
|
|
925 syms_of_marker ();
|
|
926 syms_of_md5 ();
|
|
927 #ifdef HAVE_DATABASE
|
272
|
928 syms_of_database ();
|
0
|
929 #endif
|
|
930 #ifdef HAVE_MENUBARS
|
|
931 syms_of_menubar ();
|
|
932 #endif
|
|
933 syms_of_minibuf ();
|
|
934 syms_of_objects ();
|
|
935 syms_of_print ();
|
|
936 #if !defined (NO_SUBPROCESSES)
|
|
937 syms_of_process ();
|
286
|
938 #ifdef HAVE_WIN32_PROCESSES
|
|
939 syms_of_process_nt ();
|
|
940 #endif
|
0
|
941 #endif
|
|
942 syms_of_profile ();
|
255
|
943 #if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC)
|
0
|
944 syms_of_ralloc ();
|
|
945 #endif /* HAVE_MMAP && REL_ALLOC */
|
|
946 syms_of_rangetab ();
|
|
947 syms_of_redisplay ();
|
|
948 syms_of_search ();
|
|
949 syms_of_signal ();
|
|
950 syms_of_sound ();
|
|
951 syms_of_specifier ();
|
|
952 syms_of_symbols ();
|
|
953 syms_of_syntax ();
|
|
954 #ifdef HAVE_SCROLLBARS
|
|
955 syms_of_scrollbar ();
|
|
956 #endif
|
|
957 #ifdef HAVE_TOOLBARS
|
|
958 syms_of_toolbar ();
|
|
959 #endif
|
|
960 syms_of_undo ();
|
195
|
961 syms_of_widget ();
|
0
|
962 syms_of_window ();
|
195
|
963
|
0
|
964 #ifdef HAVE_TTY
|
|
965 syms_of_console_tty ();
|
|
966 syms_of_device_tty ();
|
|
967 syms_of_objects_tty ();
|
|
968 #endif
|
|
969 #ifdef HAVE_X_WINDOWS
|
|
970 syms_of_device_x ();
|
|
971 #ifdef HAVE_DIALOGS
|
|
972 syms_of_dialog_x ();
|
|
973 #endif
|
|
974 syms_of_event_Xt ();
|
|
975 syms_of_frame_x ();
|
|
976 syms_of_glyphs_x ();
|
|
977 syms_of_objects_x ();
|
|
978 #ifdef HAVE_MENUBARS
|
|
979 syms_of_menubar_x ();
|
|
980 #endif
|
|
981 syms_of_xselect ();
|
|
982 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
|
|
983 syms_of_gui_x ();
|
|
984 #endif
|
|
985 #endif /* HAVE_X_WINDOWS */
|
|
986
|
213
|
987 #ifdef HAVE_MS_WINDOWS
|
|
988 syms_of_console_mswindows ();
|
|
989 syms_of_device_mswindows ();
|
|
990 syms_of_event_mswindows ();
|
|
991 syms_of_frame_mswindows ();
|
|
992 syms_of_objects_mswindows ();
|
221
|
993 syms_of_select_mswindows ();
|
267
|
994 syms_of_glyphs_mswindows ();
|
231
|
995 #ifdef HAVE_MENUBARS
|
|
996 syms_of_menubar_mswindows ();
|
|
997 #endif
|
276
|
998 #ifdef HAVE_SCROLLBARS
|
|
999 syms_of_scrollbar_mswindows ();
|
|
1000 #endif
|
263
|
1001 #ifdef HAVE_MSW_C_DIRED
|
|
1002 syms_of_dired_mswindows ();
|
209
|
1003 #endif
|
347
|
1004 #ifdef WINDOWSNT
|
|
1005 syms_of_ntproc ();
|
|
1006 #endif
|
263
|
1007 #endif /* HAVE_MS_WINDOWS */
|
209
|
1008
|
70
|
1009 #ifdef MULE
|
|
1010 syms_of_mule ();
|
|
1011 syms_of_mule_ccl ();
|
|
1012 syms_of_mule_charset ();
|
259
|
1013 #endif
|
|
1014 #ifdef FILE_CODING
|
347
|
1015 syms_of_file_coding ();
|
259
|
1016 #endif
|
|
1017 #ifdef MULE
|
70
|
1018 #ifdef HAVE_WNN
|
|
1019 syms_of_mule_wnn ();
|
|
1020 #endif
|
|
1021 #ifdef HAVE_CANNA
|
|
1022 syms_of_mule_canna ();
|
|
1023 #endif /* HAVE_CANNA */
|
|
1024 #endif /* MULE */
|
|
1025
|
0
|
1026 #ifdef SYMS_SYSTEM
|
|
1027 SYMS_SYSTEM;
|
|
1028 #endif
|
|
1029
|
|
1030 #ifdef SYMS_MACHINE
|
|
1031 SYMS_MACHINE;
|
|
1032 #endif
|
|
1033
|
|
1034 #ifdef EMACS_BTL
|
163
|
1035 syms_of_btl ();
|
0
|
1036 #endif
|
|
1037
|
269
|
1038 /*
|
267
|
1039 #if defined (GNU_MALLOC) && \
|
|
1040 defined (ERROR_CHECK_MALLOC) && \
|
|
1041 !defined (HAVE_LIBMCHECK)
|
269
|
1042 */
|
267
|
1043 /* Prior to XEmacs 21, this was `#if 0'ed out. -slb */
|
269
|
1044 #if defined (LOSING_GCC_DESTRUCTOR_FREE_BUG)
|
0
|
1045 syms_of_free_hook ();
|
|
1046 #endif
|
|
1047
|
|
1048 #ifdef TOOLTALK
|
|
1049 syms_of_tooltalk ();
|
|
1050 #endif
|
|
1051
|
|
1052 #ifdef SUNPRO
|
|
1053 syms_of_sunpro ();
|
|
1054 #endif
|
|
1055
|
259
|
1056 #ifdef HAVE_LDAP
|
|
1057 syms_of_eldap ();
|
|
1058 #endif
|
|
1059
|
0
|
1060 /* Now create the subtypes for the types that have them.
|
|
1061 We do this before the vars_*() because more symbols
|
|
1062 may get initialized here. */
|
|
1063
|
|
1064 /* Now initialize the console types and associated symbols.
|
|
1065 Other than the first function below, the functions may
|
|
1066 make exactly the following function/macro calls:
|
|
1067
|
|
1068 INITIALIZE_CONSOLE_TYPE()
|
|
1069 CONSOLE_HAS_METHOD()
|
|
1070
|
|
1071 For any given console type, the former macro must be called
|
|
1072 before the any calls to the latter macro. */
|
|
1073
|
|
1074 console_type_create ();
|
|
1075
|
|
1076 console_type_create_stream ();
|
|
1077
|
|
1078 #ifdef HAVE_TTY
|
|
1079 console_type_create_tty ();
|
|
1080 console_type_create_device_tty ();
|
|
1081 console_type_create_frame_tty ();
|
|
1082 console_type_create_objects_tty ();
|
|
1083 console_type_create_redisplay_tty ();
|
|
1084 #endif
|
|
1085
|
|
1086 #ifdef HAVE_X_WINDOWS
|
|
1087 console_type_create_x ();
|
|
1088 console_type_create_device_x ();
|
|
1089 console_type_create_frame_x ();
|
|
1090 console_type_create_glyphs_x ();
|
|
1091 #ifdef HAVE_MENUBARS
|
|
1092 console_type_create_menubar_x ();
|
|
1093 #endif
|
|
1094 console_type_create_objects_x ();
|
|
1095 console_type_create_redisplay_x ();
|
|
1096 #ifdef HAVE_SCROLLBARS
|
|
1097 console_type_create_scrollbar_x ();
|
|
1098 #endif
|
|
1099 #ifdef HAVE_TOOLBARS
|
|
1100 console_type_create_toolbar_x ();
|
|
1101 #endif
|
284
|
1102 #ifdef HAVE_DIALOGS
|
|
1103 console_type_create_dialog_x ();
|
|
1104 #endif
|
0
|
1105 #endif /* HAVE_X_WINDOWS */
|
|
1106
|
213
|
1107 #ifdef HAVE_MS_WINDOWS
|
|
1108 console_type_create_mswindows ();
|
|
1109 console_type_create_device_mswindows ();
|
|
1110 console_type_create_frame_mswindows ();
|
|
1111 console_type_create_objects_mswindows ();
|
|
1112 console_type_create_redisplay_mswindows ();
|
267
|
1113 console_type_create_glyphs_mswindows ();
|
225
|
1114 # ifdef HAVE_SCROLLBARS
|
|
1115 console_type_create_scrollbar_mswindows ();
|
|
1116 # endif
|
231
|
1117 #ifdef HAVE_MENUBARS
|
|
1118 console_type_create_menubar_mswindows ();
|
|
1119 #endif
|
276
|
1120 #ifdef HAVE_TOOLBARS
|
|
1121 console_type_create_toolbar_mswindows ();
|
|
1122 #endif
|
286
|
1123 #ifdef HAVE_DIALOGS
|
|
1124 console_type_create_dialog_mswindows ();
|
|
1125 #endif
|
209
|
1126 #endif
|
|
1127
|
0
|
1128 /* Now initialize the specifier types and associated symbols.
|
|
1129 Other than the first function below, the functions may
|
|
1130 make exactly the following function/macro calls:
|
|
1131
|
|
1132 INITIALIZE_SPECIFIER_TYPE()
|
|
1133 SPECIFIER_HAS_METHOD()
|
|
1134
|
|
1135 For any given specifier type, the former macro must be called
|
|
1136 before the any calls to the latter macro. */
|
|
1137
|
|
1138 specifier_type_create ();
|
|
1139
|
|
1140 specifier_type_create_image ();
|
|
1141 specifier_type_create_objects ();
|
|
1142 #ifdef HAVE_TOOLBARS
|
|
1143 specifier_type_create_toolbar ();
|
|
1144 #endif
|
|
1145
|
|
1146 /* Now initialize the structure types and associated symbols.
|
|
1147 Other than the first function below, the functions may
|
|
1148 make exactly the following function/macro calls:
|
|
1149
|
|
1150 define_structure_type()
|
|
1151 define_structure_type_keyword()
|
|
1152
|
|
1153 */
|
|
1154
|
|
1155 structure_type_create ();
|
|
1156
|
70
|
1157 structure_type_create_chartab ();
|
0
|
1158 structure_type_create_faces ();
|
|
1159 structure_type_create_rangetab ();
|
223
|
1160 structure_type_create_hashtable ();
|
0
|
1161
|
|
1162 /* Now initialize the image instantiator formats and associated symbols.
|
|
1163 Other than the first function below, the functions may
|
|
1164 make exactly the following function/macro calls:
|
|
1165
|
|
1166 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT()
|
|
1167 IIFORMAT_HAS_METHOD()
|
|
1168 IIFORMAT_VALID_KEYWORD()
|
|
1169
|
|
1170 For any given image instantiator format, the first macro must be
|
|
1171 called before the any calls to the other macros. */
|
|
1172
|
|
1173 image_instantiator_format_create ();
|
280
|
1174 image_instantiator_format_create_glyphs_eimage ();
|
0
|
1175 #ifdef HAVE_X_WINDOWS
|
|
1176 image_instantiator_format_create_glyphs_x ();
|
|
1177 #endif /* HAVE_X_WINDOWS */
|
267
|
1178 #ifdef HAVE_MS_WINDOWS
|
|
1179 image_instantiator_format_create_glyphs_mswindows ();
|
|
1180 #endif /* HAVE_MSWINDOWS_WINDOWS */
|
0
|
1181
|
|
1182 /* Now initialize the lstream types and associated symbols.
|
|
1183 Other than the first function below, the functions may
|
|
1184 make exactly the following function/macro calls:
|
|
1185
|
|
1186 LSTREAM_HAS_METHOD()
|
|
1187
|
|
1188 */
|
|
1189
|
|
1190 lstream_type_create ();
|
259
|
1191 #ifdef FILE_CODING
|
347
|
1192 lstream_type_create_file_coding ();
|
70
|
1193 #endif
|
278
|
1194 #if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT)
|
274
|
1195 lstream_type_create_mswindows_selectable ();
|
|
1196 #endif
|
|
1197
|
263
|
1198 /* Initialize processes implementation.
|
|
1199 The functions may make exactly the following function/macro calls:
|
|
1200
|
|
1201 PROCESS_HAS_METHOD()
|
|
1202 */
|
|
1203 #ifdef HAVE_UNIX_PROCESSES
|
|
1204 process_type_create_unix ();
|
|
1205 #endif
|
|
1206 #ifdef HAVE_WIN32_PROCESSES
|
274
|
1207 process_type_create_nt ();
|
263
|
1208 #endif
|
|
1209
|
0
|
1210 /* Now initialize most variables.
|
|
1211
|
|
1212 These functions may do exactly the following:
|
|
1213
|
|
1214 DEFVAR_INT()
|
|
1215 DEFVAR_LISP()
|
|
1216 DEFVAR_BOOL()
|
|
1217 DEFER_GETTEXT()
|
|
1218 Dynarr_*()
|
|
1219 Blocktype_*()
|
|
1220 staticpro()
|
|
1221 Fprovide(symbol)
|
|
1222 intern()
|
|
1223 pure_put()
|
|
1224 xmalloc()
|
|
1225 defsymbol(), if it's absolutely necessary and you're sure that
|
|
1226 the symbol isn't referenced anywhere else in the initialization
|
|
1227 code
|
|
1228 Fset() on a symbol that is unbound
|
|
1229 assigning a symbol or constant value to a variable
|
|
1230 using a global variable that has been initialized
|
|
1231 earlier on in the same function
|
|
1232
|
|
1233 Any of the object-creating functions on alloc.c: e.g.
|
|
1234
|
|
1235 make_pure_*()
|
|
1236 Fpurecopy()
|
|
1237 make_string()
|
|
1238 build_string()
|
|
1239 make_vector()
|
|
1240 make_int()
|
|
1241 make_extent()
|
|
1242 alloc_lcrecord()
|
|
1243 Fcons()
|
|
1244 listN()
|
|
1245 make_opaque_ptr()
|
|
1246 make_opaque_long()
|
|
1247
|
|
1248 perhaps a few others.
|
|
1249 */
|
|
1250
|
|
1251 /* Now allow Fprovide() statements to be made. */
|
|
1252 init_provide_once ();
|
|
1253
|
|
1254 vars_of_abbrev ();
|
|
1255 vars_of_alloc ();
|
136
|
1256 #ifdef HAVE_X_WINDOWS
|
|
1257 vars_of_balloon_x ();
|
|
1258 #endif
|
0
|
1259 vars_of_buffer ();
|
|
1260 vars_of_bytecode ();
|
|
1261 vars_of_callint ();
|
|
1262 vars_of_callproc ();
|
347
|
1263 vars_of_chartab ();
|
0
|
1264 vars_of_cmdloop ();
|
|
1265 vars_of_cmds ();
|
|
1266 vars_of_console ();
|
|
1267 vars_of_data ();
|
|
1268 #ifdef DEBUG_XEMACS
|
|
1269 vars_of_debug ();
|
|
1270 #endif
|
|
1271 vars_of_console_stream ();
|
|
1272 vars_of_device ();
|
|
1273 #ifdef HAVE_DIALOGS
|
|
1274 vars_of_dialog ();
|
|
1275 #endif
|
|
1276 vars_of_dired ();
|
|
1277 vars_of_doc ();
|
284
|
1278 #ifdef HAVE_DRAGNDROP
|
|
1279 vars_of_dragdrop ();
|
|
1280 #endif
|
0
|
1281 vars_of_editfns ();
|
|
1282 vars_of_elhash ();
|
|
1283 vars_of_emacs ();
|
|
1284 vars_of_eval ();
|
|
1285 vars_of_event_stream ();
|
|
1286 vars_of_events ();
|
|
1287 vars_of_extents ();
|
|
1288 vars_of_faces ();
|
|
1289 vars_of_fileio ();
|
|
1290 #ifdef CLASH_DETECTION
|
|
1291 vars_of_filelock ();
|
|
1292 #endif
|
|
1293 vars_of_floatfns ();
|
|
1294 vars_of_font_lock ();
|
|
1295 vars_of_frame ();
|
|
1296 vars_of_glyphs ();
|
280
|
1297 vars_of_glyphs_eimage ();
|
0
|
1298 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
|
|
1299 vars_of_gui ();
|
|
1300 #endif
|
|
1301 vars_of_indent ();
|
|
1302 vars_of_insdel ();
|
|
1303 vars_of_intl ();
|
70
|
1304 #ifdef HAVE_XIM
|
|
1305 #ifdef XIM_MOTIF
|
|
1306 vars_of_input_method_motif ();
|
|
1307 #else /* XIM_XLIB */
|
|
1308 vars_of_input_method_xlib ();
|
|
1309 #endif
|
|
1310 #endif /* HAVE_XIM */
|
0
|
1311 vars_of_keymap ();
|
|
1312 vars_of_lread ();
|
|
1313 vars_of_lstream ();
|
|
1314 vars_of_macros ();
|
|
1315 vars_of_md5 ();
|
|
1316 #ifdef HAVE_DATABASE
|
272
|
1317 vars_of_database ();
|
0
|
1318 #endif
|
|
1319 #ifdef HAVE_MENUBARS
|
|
1320 vars_of_menubar ();
|
|
1321 #endif
|
|
1322 vars_of_minibuf ();
|
347
|
1323 #ifdef WINDOWSNT
|
|
1324 vars_of_ntproc ();
|
|
1325 #endif
|
0
|
1326 vars_of_objects ();
|
|
1327 vars_of_print ();
|
263
|
1328
|
0
|
1329 #ifndef NO_SUBPROCESSES
|
|
1330 vars_of_process ();
|
263
|
1331 #ifdef HAVE_UNIX_PROCESSES
|
|
1332 vars_of_process_unix ();
|
0
|
1333 #endif
|
263
|
1334 #ifdef HAVE_WIN32_PROCESSES
|
274
|
1335 vars_of_process_nt ();
|
263
|
1336 #endif
|
|
1337 #endif
|
|
1338
|
0
|
1339 vars_of_profile ();
|
255
|
1340 #if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC)
|
0
|
1341 vars_of_ralloc ();
|
|
1342 #endif /* HAVE_MMAP && REL_ALLOC */
|
|
1343 vars_of_redisplay ();
|
|
1344 #ifdef HAVE_SCROLLBARS
|
|
1345 vars_of_scrollbar ();
|
|
1346 #endif
|
|
1347 vars_of_search ();
|
|
1348 vars_of_sound ();
|
|
1349 vars_of_specifier ();
|
|
1350 vars_of_symbols ();
|
|
1351 vars_of_syntax ();
|
|
1352 #ifdef HAVE_TOOLBARS
|
|
1353 vars_of_toolbar ();
|
|
1354 #endif
|
|
1355 vars_of_undo ();
|
|
1356 vars_of_window ();
|
|
1357
|
|
1358 #ifdef HAVE_TTY
|
|
1359 vars_of_console_tty ();
|
|
1360 vars_of_event_tty ();
|
|
1361 vars_of_frame_tty ();
|
|
1362 vars_of_objects_tty ();
|
|
1363 #endif
|
|
1364
|
|
1365 #ifdef HAVE_X_WINDOWS
|
|
1366 vars_of_device_x ();
|
|
1367 #ifdef HAVE_DIALOGS
|
|
1368 vars_of_dialog_x ();
|
|
1369 #endif
|
|
1370 vars_of_event_Xt ();
|
|
1371 vars_of_frame_x ();
|
|
1372 vars_of_glyphs_x ();
|
|
1373 #ifdef HAVE_MENUBARS
|
|
1374 vars_of_menubar_x ();
|
|
1375 #endif
|
|
1376 vars_of_objects_x ();
|
|
1377 vars_of_xselect ();
|
|
1378 #ifdef HAVE_SCROLLBARS
|
|
1379 vars_of_scrollbar_x ();
|
|
1380 #endif
|
|
1381 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
|
|
1382 vars_of_gui_x ();
|
|
1383 #endif
|
|
1384 #endif
|
|
1385
|
213
|
1386 #ifdef HAVE_MS_WINDOWS
|
|
1387 vars_of_device_mswindows ();
|
|
1388 vars_of_console_mswindows ();
|
|
1389 vars_of_event_mswindows ();
|
|
1390 vars_of_frame_mswindows ();
|
|
1391 vars_of_objects_mswindows ();
|
221
|
1392 vars_of_select_mswindows ();
|
267
|
1393 vars_of_glyphs_mswindows ();
|
225
|
1394 #ifdef HAVE_SCROLLBARS
|
|
1395 vars_of_scrollbar_mswindows ();
|
|
1396 #endif
|
231
|
1397 #ifdef HAVE_MENUBARS
|
|
1398 vars_of_menubar_mswindows ();
|
|
1399 #endif
|
263
|
1400 #ifdef HAVE_MSW_C_DIRED
|
|
1401 vars_of_dired_mswindows ();
|
209
|
1402 #endif
|
286
|
1403 #ifdef HAVE_DIALOGS
|
|
1404 vars_of_dialog_mswindows ();
|
|
1405 #endif
|
263
|
1406 #endif /* HAVE_MS_WINDOWS */
|
209
|
1407
|
70
|
1408 #ifdef MULE
|
|
1409 vars_of_mule ();
|
347
|
1410 vars_of_mule_ccl ();
|
70
|
1411 vars_of_mule_charset ();
|
259
|
1412 #endif
|
|
1413 #ifdef FILE_CODING
|
347
|
1414 vars_of_file_coding ();
|
259
|
1415 #endif
|
|
1416 #ifdef MULE
|
70
|
1417 #ifdef HAVE_WNN
|
|
1418 vars_of_mule_wnn ();
|
|
1419 #endif
|
|
1420 #ifdef HAVE_CANNA
|
|
1421 vars_of_mule_canna ();
|
|
1422 #endif /* HAVE_CANNA */
|
|
1423 #endif /* MULE */
|
|
1424
|
0
|
1425 #ifdef TOOLTALK
|
|
1426 vars_of_tooltalk ();
|
|
1427 #endif
|
|
1428
|
|
1429 #ifdef SUNPRO
|
|
1430 vars_of_sunpro ();
|
|
1431 #endif
|
|
1432
|
259
|
1433 #ifdef HAVE_LDAP
|
|
1434 vars_of_eldap ();
|
|
1435 #endif
|
|
1436
|
0
|
1437 /* Now initialize any specifier variables. We do this later
|
|
1438 because it has some dependence on the vars initialized
|
|
1439 above.
|
|
1440
|
|
1441 These functions should *only* initialize specifier variables,
|
|
1442 and may make use of the following functions/macros in addition
|
|
1443 to the ones listed above:
|
|
1444
|
|
1445 DEFVAR_SPECIFIER()
|
|
1446 Fmake_specifier()
|
|
1447 set_specifier_fallback()
|
|
1448 set_specifier_caching()
|
|
1449 */
|
|
1450
|
|
1451 specifier_vars_of_glyphs ();
|
|
1452 #ifdef HAVE_MENUBARS
|
|
1453 specifier_vars_of_menubar ();
|
|
1454 #endif
|
|
1455 specifier_vars_of_redisplay ();
|
|
1456 #ifdef HAVE_SCROLLBARS
|
|
1457 specifier_vars_of_scrollbar ();
|
|
1458 #endif
|
|
1459 #ifdef HAVE_TOOLBARS
|
|
1460 specifier_vars_of_toolbar ();
|
|
1461 #endif
|
|
1462 specifier_vars_of_window ();
|
|
1463
|
|
1464 /* Now comes all the rest of the variables that couldn't
|
|
1465 be handled above. There may be dependencies on variables
|
|
1466 initialized above, and dependencies between one complex_vars_()
|
|
1467 function and another. */
|
|
1468
|
|
1469 /* Calls Fmake_range_table(). */
|
|
1470 complex_vars_of_regex ();
|
|
1471 /* Calls Fmake_range_table(). */
|
|
1472 complex_vars_of_search ();
|
|
1473
|
|
1474 /* Calls make_lisp_hashtable(). */
|
|
1475 complex_vars_of_extents ();
|
163
|
1476
|
0
|
1477 /* Depends on hashtables and specifiers. */
|
|
1478 complex_vars_of_faces ();
|
|
1479
|
70
|
1480 #ifdef MULE
|
|
1481 /* These two depend on hashtables and various variables declared
|
|
1482 earlier. The second may also depend on the first. */
|
|
1483 complex_vars_of_mule_charset ();
|
259
|
1484 #endif
|
|
1485 #if defined(FILE_CODING)
|
347
|
1486 complex_vars_of_file_coding ();
|
70
|
1487 #endif
|
|
1488
|
0
|
1489 /* This calls allocate_glyph(), which creates specifiers
|
|
1490 and also relies on a variable (Vthe_nothing_vector) initialized
|
70
|
1491 above. It also calls make_ext_string(), which under Mule
|
|
1492 could require that the charsets be initialized. */
|
0
|
1493 complex_vars_of_glyphs ();
|
|
1494
|
175
|
1495 /* These rely on the glyphs just created in the previous function,
|
|
1496 and call Fadd_spec_to_specifier(), which relies on various
|
0
|
1497 variables initialized above. */
|
|
1498 #ifdef HAVE_X_WINDOWS
|
|
1499 complex_vars_of_glyphs_x ();
|
|
1500 #endif
|
267
|
1501 #ifdef HAVE_MS_WINDOWS
|
|
1502 complex_vars_of_glyphs_mswindows ();
|
|
1503 #endif
|
0
|
1504
|
|
1505 /* This calls Fmake_glyph_internal(). */
|
|
1506 complex_vars_of_alloc ();
|
|
1507
|
|
1508 /* This calls Fmake_glyph_internal(). */
|
|
1509 #ifdef HAVE_MENUBARS
|
|
1510 complex_vars_of_menubar ();
|
|
1511 #endif
|
|
1512
|
|
1513 /* This calls Fmake_glyph_internal(). */
|
|
1514 #ifdef HAVE_SCROLLBARS
|
|
1515 complex_vars_of_scrollbar ();
|
|
1516 #endif
|
|
1517
|
|
1518 /* This calls allocate_glyph(). */
|
|
1519 complex_vars_of_frame ();
|
|
1520
|
70
|
1521 /* This calls Fcopy_category_table() under Mule, which calls who
|
|
1522 knows what. */
|
|
1523 complex_vars_of_chartab ();
|
|
1524
|
0
|
1525 /* This calls set_string_char(), which (under Mule) depends on the
|
|
1526 charsets being initialized. */
|
|
1527 complex_vars_of_casetab ();
|
|
1528
|
|
1529 /* This calls Fcopy_syntax_table(), which relies on char tables. */
|
|
1530 complex_vars_of_syntax ();
|
|
1531
|
|
1532 /* This initializes buffer-local variables, sets things up so
|
|
1533 that buffers can be created, and creates a couple of basic
|
|
1534 buffers. This depends on Vstandard_syntax_table and
|
|
1535 Vstandard_category_table (initialized in the previous
|
|
1536 functions), as well as a whole horde of variables that may
|
|
1537 have been initialized above. */
|
|
1538 complex_vars_of_buffer ();
|
|
1539
|
|
1540 /* This initializes console-local variables. */
|
|
1541 complex_vars_of_console ();
|
|
1542
|
|
1543 /* This creates a couple more buffers, and depends on the
|
|
1544 previous function. */
|
|
1545 complex_vars_of_minibuf ();
|
|
1546
|
|
1547 /* These two might call Ffile_name_as_directory(), which
|
|
1548 might depend on all sorts of things; I'm not sure. */
|
267
|
1549 complex_vars_of_emacs ();
|
|
1550
|
0
|
1551 #ifdef CLASH_DETECTION
|
|
1552 complex_vars_of_filelock ();
|
|
1553 #endif /* CLASH_DETECTION */
|
|
1554
|
|
1555 /* This creates a couple of basic keymaps and depends on Lisp
|
|
1556 hashtables and Ffset() (both of which depend on some variables
|
|
1557 initialized in the vars_of_*() section) and possibly other
|
|
1558 stuff. */
|
|
1559 complex_vars_of_keymap ();
|
175
|
1560 /* Calls Fmake_hashtable() and creates a keymap */
|
|
1561 complex_vars_of_event_stream ();
|
0
|
1562
|
|
1563 if (always_gc) /* purification debugging hack */
|
|
1564 garbage_collect_1 ();
|
|
1565 }
|
|
1566
|
|
1567 /* CONGRATULATIONS!!! We have successfully initialized the Lisp
|
|
1568 engine. */
|
|
1569
|
|
1570 if (initialized)
|
|
1571 {
|
|
1572 /* Stuff that needs to be reset at run time. Order below should
|
|
1573 not matter. */
|
|
1574 reinit_alloc ();
|
|
1575 reinit_eval ();
|
70
|
1576 #ifdef MULE_REGEXP
|
|
1577 reinit_mule_category ();
|
|
1578 #endif
|
0
|
1579 }
|
|
1580
|
|
1581 /* Now do further initialization/setup of stuff that is not needed by the
|
|
1582 syms_of_() routines. This involves stuff that only is enabled in
|
|
1583 an interactive run (redisplay, user input, etc.) and stuff that is
|
|
1584 not needed until we start loading Lisp code (the reader). A lot
|
|
1585 of this stuff involves querying the current environment and needs
|
|
1586 to be done both at dump time and at run time. */
|
|
1587
|
288
|
1588 init_initial_directory(); /* get the directory to use for the
|
|
1589 "*scratch*" buffer, etc. */
|
|
1590
|
|
1591 #ifdef WINDOWSNT
|
|
1592 /*
|
|
1593 * For Win32, call init_environment() now, so that environment/registry
|
|
1594 * variables will be properly entered into Vprocess_envonment.
|
|
1595 */
|
|
1596 init_environment();
|
|
1597 #endif
|
|
1598
|
0
|
1599 init_callproc (); /* Set up the process environment (so that egetenv
|
|
1600 works), the basic directory variables
|
|
1601 (exec-directory and so on), and stuff
|
|
1602 related to subprocesses. This should be
|
|
1603 first because many of the functions below
|
|
1604 call egetenv() to get environment variables. */
|
|
1605 init_lread (); /* Set up the Lisp reader. */
|
|
1606 #ifdef MSDOS
|
|
1607 /* Call early 'cause init_environment needs it. */
|
|
1608 init_dosfns ();
|
|
1609 /* Set defaults for several environment variables. */
|
|
1610 init_environment (argc, argv, skip_args);
|
|
1611 #endif
|
|
1612 init_cmdargs (argc, argv, skip_args); /* Create list Vcommand_line_args */
|
288
|
1613 init_buffer (); /* Set default directory of *scratch* buffer */
|
195
|
1614
|
|
1615 #ifdef WINDOWSNT
|
|
1616 init_ntproc();
|
|
1617 #endif
|
|
1618
|
0
|
1619 init_redisplay (); /* Determine terminal type.
|
|
1620 init_sys_modes uses results */
|
|
1621 init_event_stream (); /* Set up so we can get user input. */
|
|
1622 init_macros (); /* set up so we can run macros. */
|
|
1623 init_editfns (); /* Determine the name of the user we're running as */
|
|
1624 init_xemacs_process (); /* set up for calling subprocesses */
|
|
1625 #ifdef SUNPRO
|
|
1626 init_sunpro (); /* Set up Sunpro usage tracking */
|
|
1627 #endif
|
|
1628 #if defined (HAVE_NATIVE_SOUND) && defined (hp9000s800)
|
|
1629 init_hpplay ();
|
|
1630 #endif
|
|
1631 #ifdef HAVE_TTY
|
|
1632 init_device_tty ();
|
|
1633 #endif
|
|
1634 init_console_stream (); /* Create the first console */
|
|
1635
|
173
|
1636 /* try to get the actual pathname of the exec file we are running */
|
233
|
1637 if (!restart)
|
0
|
1638 {
|
|
1639 Vinvocation_name = Fcar (Vcommand_line_args);
|
233
|
1640 if (XSTRING_DATA(Vinvocation_name)[0] == '-')
|
|
1641 {
|
|
1642 /* XEmacs as a login shell, oh goody! */
|
|
1643 Vinvocation_name = build_string(getenv("SHELL"));
|
|
1644 }
|
0
|
1645 Vinvocation_directory = Vinvocation_name;
|
|
1646
|
|
1647 if (!NILP (Ffile_name_directory (Vinvocation_name)))
|
269
|
1648 {
|
|
1649 /* invocation-name includes a directory component -- presumably it
|
|
1650 is relative to cwd, not $PATH */
|
|
1651 Vinvocation_directory = Fexpand_file_name (Vinvocation_name,
|
|
1652 Qnil);
|
|
1653 Vinvocation_path = Qnil;
|
|
1654 }
|
0
|
1655 else
|
269
|
1656 {
|
|
1657 Vinvocation_path = decode_env_path ("PATH", NULL);
|
|
1658 locate_file (Vinvocation_path, Vinvocation_name, EXEC_SUFFIXES,
|
|
1659 &Vinvocation_directory, X_OK);
|
|
1660 }
|
0
|
1661
|
|
1662 if (NILP (Vinvocation_directory))
|
|
1663 Vinvocation_directory = Vinvocation_name;
|
|
1664
|
|
1665 Vinvocation_name = Ffile_name_nondirectory (Vinvocation_directory);
|
|
1666 Vinvocation_directory = Ffile_name_directory (Vinvocation_directory);
|
|
1667 }
|
|
1668
|
265
|
1669 #if defined(HAVE_SHLIB) && !defined(WINDOWSNT)
|
|
1670 /* This is Unix only. MS Windows NT has a library call that does
|
|
1671 The Right Thing on that system. Rumor has it, this must be
|
|
1672 called for GNU dld in temacs and xemacs. */
|
|
1673 {
|
|
1674 char *buf = (char *)alloca (XSTRING_LENGTH (Vinvocation_directory)
|
|
1675 + XSTRING_LENGTH (Vinvocation_name)
|
|
1676 + 2);
|
|
1677 sprintf (buf, "%s/%s", XSTRING_DATA(Vinvocation_directory),
|
|
1678 XSTRING_DATA(Vinvocation_name));
|
|
1679
|
|
1680 /* All we can do is cry if an error happens, so ignore it. */
|
|
1681 (void)dll_init(buf);
|
|
1682 }
|
|
1683 #endif
|
|
1684
|
0
|
1685 #if defined (LOCALTIME_CACHE) && defined (HAVE_TZSET)
|
|
1686 /* sun's localtime() has a bug. it caches the value of the time
|
|
1687 zone rather than looking it up every time. Since localtime() is
|
|
1688 called to bolt the undumping time into the undumped emacs, this
|
|
1689 results in localtime() ignoring the TZ environment variable.
|
|
1690 This flushes the new TZ value into localtime(). */
|
|
1691 tzset ();
|
|
1692 #endif /* LOCALTIME_CACHE and TZSET */
|
|
1693
|
|
1694 load_me = Qnil;
|
|
1695 if (!initialized)
|
|
1696 {
|
|
1697 /* Handle -l loadup-and-dump, args passed by Makefile. */
|
|
1698 if (argc > 2 + skip_args && !strcmp (argv[1 + skip_args], "-l"))
|
80
|
1699 load_me = build_string (argv[2 + skip_args]);
|
239
|
1700 #if 0 /* CANNOT_DUMP - this can never be right in XEmacs --andyp */
|
0
|
1701 /* Unless next switch is -nl, load "loadup.el" first thing. */
|
|
1702 if (!(argc > 1 + skip_args && !strcmp (argv[1 + skip_args], "-nl")))
|
|
1703 load_me = build_string ("loadup.el");
|
|
1704 #endif /* CANNOT_DUMP */
|
|
1705 }
|
|
1706
|
|
1707 #ifdef QUANTIFY
|
|
1708 if (initialized)
|
|
1709 quantify_start_recording_data ();
|
|
1710 #endif /* QUANTIFY */
|
|
1711
|
|
1712 initialized = 1;
|
|
1713
|
|
1714 /* This never returns. */
|
|
1715 initial_command_loop (load_me);
|
|
1716 /* NOTREACHED */
|
|
1717 }
|
|
1718
|
20
|
1719
|
16
|
1720 /* Sort the args so we can find the most important ones
|
|
1721 at the beginning of argv. */
|
|
1722
|
|
1723 /* First, here's a table of all the standard options. */
|
|
1724
|
|
1725 struct standard_args
|
|
1726 {
|
|
1727 CONST char * CONST name;
|
|
1728 CONST char * CONST longname;
|
|
1729 int priority;
|
|
1730 int nargs;
|
|
1731 };
|
|
1732
|
|
1733 static struct standard_args standard_args[] =
|
|
1734 {
|
|
1735 /* Handled by main_1 above: */
|
|
1736 { "-nl", "--no-shared-memory", 100, 0 },
|
|
1737 { "-t", "--terminal", 95, 1 },
|
|
1738 { "-nw", "--no-windows", 90, 0 },
|
|
1739 { "-batch", "--batch", 85, 0 },
|
276
|
1740 { "-debug-paths", "--debug-paths", 82, 0 },
|
16
|
1741 { "-help", "--help", 80, 0 },
|
|
1742 { "-version", "--version", 75, 0 },
|
|
1743 { "-V", 0, 75, 0 },
|
|
1744 { "-d", "--display", 80, 1 },
|
|
1745 { "-display", 0, 80, 1 },
|
|
1746 { "-NXHost", 0, 79, 0 },
|
|
1747 { "-MachLaunch", 0, 79, 0},
|
|
1748
|
|
1749 /* Handled by command-line-early in startup.el: */
|
|
1750 { "-q", "--no-init-file", 50, 0 },
|
|
1751 { "-unmapped", 0, 50, 0 },
|
|
1752 { "-no-init-file", 0, 50, 0 },
|
207
|
1753 { "-vanilla", "--vanilla", 50, 0 },
|
239
|
1754 { "-no-autoloads", "--no-autoloads", 50, 0 },
|
16
|
1755 { "-no-site-file", "--no-site-file", 40, 0 },
|
276
|
1756 { "-no-early-packages", "--no-early-packages", 35, 0 },
|
16
|
1757 { "-u", "--user", 30, 1 },
|
|
1758 { "-user", 0, 30, 1 },
|
|
1759 { "-debug-init", "--debug-init", 20, 0 },
|
276
|
1760 { "-debug-paths", "--debug-paths", 20, 0 },
|
16
|
1761
|
|
1762 /* Xt options: */
|
|
1763 { "-i", "--icon-type", 15, 0 },
|
|
1764 { "-itype", 0, 15, 0 },
|
|
1765 { "-iconic", "--iconic", 15, 0 },
|
|
1766 { "-bg", "--background-color", 10, 1 },
|
|
1767 { "-background", 0, 10, 1 },
|
|
1768 { "-fg", "--foreground-color", 10, 1 },
|
|
1769 { "-foreground", 0, 10, 1 },
|
|
1770 { "-bd", "--border-color", 10, 1 },
|
|
1771 { "-bw", "--border-width", 10, 1 },
|
|
1772 { "-ib", "--internal-border", 10, 1 },
|
|
1773 { "-ms", "--mouse-color", 10, 1 },
|
|
1774 { "-cr", "--cursor-color", 10, 1 },
|
|
1775 { "-fn", "--font", 10, 1 },
|
|
1776 { "-font", 0, 10, 1 },
|
|
1777 { "-g", "--geometry", 10, 1 },
|
|
1778 { "-geometry", 0, 10, 1 },
|
|
1779 { "-T", "--title", 10, 1 },
|
|
1780 { "-title", 0, 10, 1 },
|
|
1781 { "-name", "--name", 10, 1 },
|
|
1782 { "-xrm", "--xrm", 10, 1 },
|
|
1783 { "-r", "--reverse-video", 5, 0 },
|
|
1784 { "-rv", 0, 5, 0 },
|
|
1785 { "-reverse", 0, 5, 0 },
|
|
1786 { "-hb", "--horizontal-scroll-bars", 5, 0 },
|
|
1787 { "-vb", "--vertical-scroll-bars", 5, 0 },
|
163
|
1788
|
16
|
1789 /* These have the same priority as ordinary file name args,
|
|
1790 so they are not reordered with respect to those. */
|
|
1791 { "-L", "--directory", 0, 1 },
|
|
1792 { "-directory", 0, 0, 1 },
|
|
1793 { "-l", "--load", 0, 1 },
|
|
1794 { "-load", 0, 0, 1 },
|
|
1795 { "-f", "--funcall", 0, 1 },
|
|
1796 { "-funcall", 0, 0, 1 },
|
|
1797 { "-eval", "--eval", 0, 1 },
|
|
1798 { "-insert", "--insert", 0, 1 },
|
|
1799 /* This should be processed after ordinary file name args and the like. */
|
|
1800 { "-kill", "--kill", -10, 0 },
|
|
1801 };
|
|
1802
|
|
1803 /* Reorder the elements of ARGV (assumed to have ARGC elements)
|
|
1804 so that the highest priority ones come first.
|
|
1805 Do not change the order of elements of equal priority.
|
|
1806 If an option takes an argument, keep it and its argument together. */
|
|
1807
|
|
1808 static void
|
|
1809 sort_args (int argc, char **argv)
|
|
1810 {
|
185
|
1811 char **new = xnew_array (char *, argc);
|
16
|
1812 /* For each element of argv,
|
|
1813 the corresponding element of options is:
|
|
1814 0 for an option that takes no arguments,
|
|
1815 1 for an option that takes one argument, etc.
|
|
1816 -1 for an ordinary non-option argument. */
|
185
|
1817 int *options = xnew_array (int, argc);
|
|
1818 int *priority = xnew_array (int, argc);
|
16
|
1819 int to = 1;
|
|
1820 int from;
|
|
1821 int i;
|
78
|
1822 int end_of_options_p = 0;
|
16
|
1823
|
|
1824 /* Categorize all the options,
|
|
1825 and figure out which argv elts are option arguments. */
|
|
1826 for (from = 1; from < argc; from++)
|
|
1827 {
|
|
1828 options[from] = -1;
|
|
1829 priority[from] = 0;
|
78
|
1830 /* Pseudo options "--" and "run-temacs" indicate end of options */
|
|
1831 if (!strcmp (argv[from], "--") ||
|
|
1832 !strcmp (argv[from], "run-temacs"))
|
|
1833 end_of_options_p = 1;
|
|
1834 if (!end_of_options_p && argv[from][0] == '-')
|
16
|
1835 {
|
|
1836 int match, thislen;
|
|
1837 char *equals;
|
|
1838
|
|
1839 /* Look for a match with a known old-fashioned option. */
|
|
1840 for (i = 0; i < countof (standard_args); i++)
|
|
1841 if (!strcmp (argv[from], standard_args[i].name))
|
|
1842 {
|
|
1843 options[from] = standard_args[i].nargs;
|
|
1844 priority[from] = standard_args[i].priority;
|
|
1845 if (from + standard_args[i].nargs >= argc)
|
|
1846 fatal ("Option `%s' requires an argument\n", argv[from]);
|
|
1847 from += standard_args[i].nargs;
|
|
1848 goto done;
|
|
1849 }
|
|
1850
|
|
1851 /* Look for a match with a known long option.
|
|
1852 MATCH is -1 if no match so far, -2 if two or more matches so far,
|
|
1853 >= 0 (the table index of the match) if just one match so far. */
|
|
1854 if (argv[from][1] == '-')
|
|
1855 {
|
|
1856 match = -1;
|
|
1857 thislen = strlen (argv[from]);
|
|
1858 equals = strchr (argv[from], '=');
|
|
1859 if (equals != 0)
|
|
1860 thislen = equals - argv[from];
|
|
1861
|
|
1862 for (i = 0; i < countof (standard_args); i++)
|
|
1863 if (standard_args[i].longname
|
|
1864 && !strncmp (argv[from], standard_args[i].longname,
|
|
1865 thislen))
|
|
1866 {
|
|
1867 if (match == -1)
|
|
1868 match = i;
|
|
1869 else
|
|
1870 match = -2;
|
|
1871 }
|
|
1872
|
|
1873 /* If we found exactly one match, use that. */
|
|
1874 if (match >= 0)
|
|
1875 {
|
|
1876 options[from] = standard_args[match].nargs;
|
|
1877 priority[from] = standard_args[match].priority;
|
|
1878 /* If --OPTION=VALUE syntax is used,
|
|
1879 this option uses just one argv element. */
|
|
1880 if (equals != 0)
|
|
1881 options[from] = 0;
|
|
1882 if (from + options[from] >= argc)
|
|
1883 fatal ("Option `%s' requires an argument\n", argv[from]);
|
|
1884 from += options[from];
|
|
1885 }
|
|
1886 }
|
|
1887 done: ;
|
|
1888 }
|
|
1889 }
|
|
1890
|
|
1891 /* Copy the arguments, in order of decreasing priority, to NEW. */
|
|
1892 new[0] = argv[0];
|
|
1893 while (to < argc)
|
|
1894 {
|
|
1895 int best = -1;
|
|
1896 int best_priority = -9999;
|
|
1897
|
|
1898 /* Find the highest priority remaining option.
|
|
1899 If several have equal priority, take the first of them. */
|
|
1900 for (from = 1; from < argc; from++)
|
|
1901 {
|
|
1902 if (argv[from] != 0 && priority[from] > best_priority)
|
|
1903 {
|
|
1904 best_priority = priority[from];
|
|
1905 best = from;
|
|
1906 }
|
|
1907 /* Skip option arguments--they are tied to the options. */
|
|
1908 if (options[from] > 0)
|
|
1909 from += options[from];
|
|
1910 }
|
163
|
1911
|
16
|
1912 if (best < 0)
|
|
1913 abort ();
|
|
1914
|
|
1915 /* Copy the highest priority remaining option, with its args, to NEW. */
|
|
1916 new[to++] = argv[best];
|
|
1917 for (i = 0; i < options[best]; i++)
|
|
1918 new[to++] = argv[best + i + 1];
|
|
1919
|
|
1920 /* Clear out this option in ARGV. */
|
|
1921 argv[best] = 0;
|
|
1922 for (i = 0; i < options[best]; i++)
|
|
1923 argv[best + i + 1] = 0;
|
|
1924 }
|
|
1925
|
|
1926 memcpy (argv, new, sizeof (char *) * argc);
|
|
1927 }
|
|
1928
|
0
|
1929 static JMP_BUF run_temacs_catch;
|
|
1930
|
|
1931 static int run_temacs_argc;
|
|
1932 static char **run_temacs_argv;
|
|
1933 static char *run_temacs_args;
|
272
|
1934 static size_t run_temacs_argv_size;
|
|
1935 static size_t run_temacs_args_size;
|
0
|
1936
|
20
|
1937 DEFUN ("running-temacs-p", Frunning_temacs_p, 0, 0, 0, /*
|
0
|
1938 True if running temacs. This means we are in the dumping stage.
|
|
1939 This is false during normal execution of the `xemacs' program, and
|
|
1940 becomes false once `run-emacs-from-temacs' is run.
|
20
|
1941 */
|
|
1942 ())
|
0
|
1943 {
|
|
1944 return run_temacs_argc >= 0 ? Qt : Qnil;
|
|
1945 }
|
|
1946
|
20
|
1947 DEFUN ("run-emacs-from-temacs", Frun_emacs_from_temacs, 0, MANY, 0, /*
|
0
|
1948 Do not call this. It will reinitialize your XEmacs. You'll be sorry.
|
20
|
1949 */
|
0
|
1950 /* If this function is called from startup.el, it will be possible to run
|
|
1951 temacs as an editor using 'temacs -batch -l loadup.el run-temacs', instead
|
|
1952 of having to dump an emacs and then run that (when debugging emacs itself,
|
20
|
1953 this can be much faster)). [Actually, the speed difference isn't that
|
0
|
1954 much as long as your filesystem is local, and you don't end up with
|
|
1955 a dumped version in case you want to rerun it. This function is most
|
|
1956 useful when used as part of the `make all-elc' command. --ben]
|
185
|
1957 This will "restart" emacs with the specified command-line arguments.
|
0
|
1958 */
|
70
|
1959 (int nargs, Lisp_Object *args))
|
0
|
1960 {
|
|
1961 int ac;
|
259
|
1962 CONST Extbyte *wampum;
|
0
|
1963 int namesize;
|
|
1964 int total_len;
|
|
1965 Lisp_Object orig_invoc_name = Fcar (Vcommand_line_args);
|
259
|
1966 CONST Extbyte **wampum_all = alloca_array (CONST Extbyte *, nargs);
|
185
|
1967 int *wampum_all_len = alloca_array (int, nargs);
|
0
|
1968
|
|
1969 assert (!gc_in_progress);
|
|
1970
|
|
1971 if (run_temacs_argc < 0)
|
|
1972 error ("I've lost my temacs-hood.");
|
|
1973
|
|
1974 /* Need to convert the orig_invoc_name and all of the arguments
|
|
1975 to external format. */
|
163
|
1976
|
0
|
1977 GET_STRING_EXT_DATA_ALLOCA (orig_invoc_name, FORMAT_OS, wampum,
|
|
1978 namesize);
|
|
1979 namesize++;
|
|
1980
|
|
1981 for (ac = 0, total_len = namesize; ac < nargs; ac++)
|
|
1982 {
|
|
1983 CHECK_STRING (args[ac]);
|
|
1984 GET_STRING_EXT_DATA_ALLOCA (args[ac], FORMAT_OS,
|
|
1985 wampum_all[ac],
|
|
1986 wampum_all_len[ac]);
|
|
1987 wampum_all_len[ac]++;
|
|
1988 total_len += wampum_all_len[ac];
|
|
1989 }
|
|
1990 DO_REALLOC (run_temacs_args, run_temacs_args_size, total_len, char);
|
343
|
1991 DO_REALLOC (run_temacs_argv, run_temacs_argv_size, nargs+2, char *);
|
0
|
1992
|
|
1993 memcpy (run_temacs_args, wampum, namesize);
|
|
1994 run_temacs_argv [0] = run_temacs_args;
|
|
1995 for (ac = 0; ac < nargs; ac++)
|
|
1996 {
|
|
1997 memcpy (run_temacs_args + namesize,
|
|
1998 wampum_all[ac], wampum_all_len[ac]);
|
|
1999 run_temacs_argv [ac + 1] = run_temacs_args + namesize;
|
|
2000 namesize += wampum_all_len[ac];
|
|
2001 }
|
|
2002 run_temacs_argv [nargs + 1] = 0;
|
|
2003 catchlist = NULL; /* Important! Otherwise free_cons() calls in
|
|
2004 condition_case_unwind() may lead to GC death. */
|
|
2005 unbind_to (0, Qnil); /* this closes loadup.el */
|
|
2006 purify_flag = 0;
|
|
2007 run_temacs_argc = nargs + 1;
|
251
|
2008 #ifdef REPORT_PURE_USAGE
|
0
|
2009 report_pure_usage (1, 0);
|
207
|
2010 #else
|
|
2011 report_pure_usage (0, 0);
|
|
2012 #endif
|
0
|
2013 LONGJMP (run_temacs_catch, 1);
|
|
2014 return Qnil; /* not reached; warning suppression */
|
|
2015 }
|
|
2016
|
|
2017 /* ARGSUSED */
|
163
|
2018 int
|
0
|
2019 main (int argc, char **argv, char **envp)
|
|
2020 {
|
16
|
2021 int volatile vol_argc = argc;
|
|
2022 char ** volatile vol_argv = argv;
|
|
2023 char ** volatile vol_envp = envp;
|
233
|
2024 /* This is hairy. We need to compute where the XEmacs binary was invoked */
|
|
2025 /* from because temacs initialization requires it to find the lisp */
|
|
2026 /* directories. The code that recomputes the path is guarded by the */
|
|
2027 /* restarted flag. There are three possible paths I've found so far */
|
|
2028 /* through this: */
|
|
2029 /* temacs -- When running temacs for basic build stuff, the first main_1 */
|
|
2030 /* will be the only one invoked. It must compute the path else there */
|
|
2031 /* will be a very ugly bomb in startup.el (can't find obvious location */
|
|
2032 /* for doc-directory data-directory, etc.). */
|
|
2033 /* temacs w/ run-temacs on the command line -- This is run to bytecompile */
|
|
2034 /* all the out of date dumped lisp. It will execute both of the main_1 */
|
|
2035 /* calls and the second one must not touch the first computation because */
|
|
2036 /* argc/argv are hosed the second time through. */
|
|
2037 /* xemacs -- Only the second main_1 is executed. The invocation path must */
|
|
2038 /* computed but this only matters when running in place or when running */
|
|
2039 /* as a login shell. */
|
|
2040 /* As a bonus for straightening this out, XEmacs can now be run in place */
|
|
2041 /* as a login shell. This never used to work. */
|
|
2042 /* As another bonus, we can now guarantee that */
|
|
2043 /* (concat invocation-directory invocation-name) contains the filename */
|
|
2044 /* of the XEmacs binary we are running. This can now be used in a */
|
|
2045 /* definite test for out of date dumped files. -slb */
|
|
2046 int restarted = 0;
|
0
|
2047 #ifdef QUANTIFY
|
|
2048 quantify_stop_recording_data ();
|
|
2049 quantify_clear_data ();
|
|
2050 #endif /* QUANTIFY */
|
|
2051
|
272
|
2052 suppress_early_error_handler_backtrace = 0;
|
0
|
2053 lim_data = 0; /* force reinitialization of this variable */
|
|
2054
|
78
|
2055 /* Lisp_Object must fit in a word; check VALBITS and GCTYPEBITS */
|
|
2056 assert (sizeof (Lisp_Object) == sizeof (void *));
|
|
2057
|
255
|
2058 #ifdef LINUX_SBRK_BUG
|
|
2059 sbrk (1);
|
|
2060 #endif
|
|
2061
|
0
|
2062 if (!initialized)
|
78
|
2063 {
|
255
|
2064 #ifdef DOUG_LEA_MALLOC
|
|
2065 mallopt (M_MMAP_MAX, 0);
|
|
2066 #endif
|
78
|
2067 run_temacs_argc = 0;
|
|
2068 if (! SETJMP (run_temacs_catch))
|
233
|
2069 {
|
|
2070 main_1 (vol_argc, vol_argv, vol_envp, 0);
|
|
2071 }
|
78
|
2072 /* run-emacs-from-temacs called */
|
233
|
2073 restarted = 1;
|
78
|
2074 vol_argc = run_temacs_argc;
|
|
2075 vol_argv = run_temacs_argv;
|
0
|
2076 #ifdef _SCO_DS
|
78
|
2077 /* This makes absolutely no sense to anyone involved. There are
|
|
2078 several people using this stuff. We've compared versions on
|
|
2079 everything we can think of. We can find no difference.
|
|
2080 However, on both my systems environ is a plain old global
|
|
2081 variable initialized to zero. _environ is the one that
|
|
2082 contains pointers to the actual environment.
|
163
|
2083
|
78
|
2084 Since we can't figure out the difference (and we're hours
|
|
2085 away from a release), this takes a very cowardly approach and
|
|
2086 is bracketed with both a system specific preprocessor test
|
|
2087 and a runtime "do you have this problem" test
|
163
|
2088
|
78
|
2089 06/20/96 robertl@dgii.com */
|
|
2090 {
|
|
2091 extern char *_environ;
|
|
2092 if ((unsigned) environ == 0)
|
|
2093 environ=_environ;
|
|
2094 }
|
16
|
2095 #endif /* _SCO_DS */
|
80
|
2096 vol_envp = environ;
|
|
2097 }
|
272
|
2098 #ifdef RUN_TIME_REMAP
|
|
2099 else
|
|
2100 /* obviously no-one uses this because where it was before initalized was
|
|
2101 *always* true */
|
245
|
2102 run_time_remap (argv[0]);
|
|
2103 #endif
|
|
2104
|
255
|
2105 #ifdef DOUG_LEA_MALLOC
|
|
2106 if (initialized && (malloc_state_ptr != NULL))
|
|
2107 {
|
272
|
2108 int rc = malloc_set_state (malloc_state_ptr);
|
|
2109 if (rc != 0)
|
|
2110 {
|
|
2111 fprintf (stderr, "malloc_set_state failed, rc = %d\n", rc);
|
|
2112 abort ();
|
|
2113 }
|
255
|
2114 #if 0
|
|
2115 free (malloc_state_ptr);
|
|
2116 #endif
|
259
|
2117 /* mmap works in glibc-2.1, glibc-2.0 (Non-Mule only) and Linux libc5 */
|
|
2118 #if (defined(__GLIBC__) && __GLIBC_MINOR__ >= 1) || \
|
|
2119 defined(_NO_MALLOC_WARNING_) || \
|
|
2120 (defined(__GLIBC__) && __GLIBC_MINOR__ < 1 && !defined(MULE)) || \
|
|
2121 defined(DEBUG_DOUG_LEA_MALLOC)
|
255
|
2122 mallopt (M_MMAP_MAX, 64);
|
|
2123 #endif
|
|
2124 #ifdef REL_ALLOC
|
|
2125 r_alloc_reinit ();
|
|
2126 #endif
|
|
2127 }
|
272
|
2128 #endif /* DOUG_LEA_MALLOC */
|
255
|
2129
|
0
|
2130 run_temacs_argc = -1;
|
|
2131
|
233
|
2132 main_1 (vol_argc, vol_argv, vol_envp, restarted);
|
163
|
2133 return 0; /* unreached */
|
0
|
2134 }
|
|
2135
|
|
2136
|
272
|
2137 /* Dumping apparently isn't supported by versions of GCC >= 2.8. */
|
|
2138 /* The following needs conditionalization on whether either XEmacs or */
|
|
2139 /* various system shared libraries have been built and linked with */
|
|
2140 /* GCC >= 2.8. -slb */
|
|
2141 #if defined(GNU_MALLOC)
|
|
2142 static void
|
|
2143 voodoo_free_hook(void *mem)
|
|
2144 {
|
|
2145 /* Disable all calls to free() when XEmacs is exiting and it doesn't */
|
|
2146 /* matter. */
|
|
2147 __free_hook = voodoo_free_hook;
|
|
2148 }
|
|
2149 #endif
|
|
2150
|
20
|
2151 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /*
|
0
|
2152 Exit the XEmacs job and kill it. Ask for confirmation, without argument.
|
|
2153 If ARG is an integer, return ARG as the exit program code.
|
|
2154 If ARG is a string, stuff it as keyboard input.
|
|
2155
|
|
2156 The value of `kill-emacs-hook', if not void,
|
|
2157 is a list of functions (of no args),
|
|
2158 all of which are called before XEmacs is actually killed.
|
20
|
2159 */
|
|
2160 (arg))
|
0
|
2161 {
|
|
2162 /* This function can GC */
|
|
2163 struct gcpro gcpro1;
|
|
2164
|
|
2165 GCPRO1 (arg);
|
|
2166
|
|
2167 if (feof (stdin))
|
|
2168 arg = Qt;
|
|
2169
|
|
2170 if (!preparing_for_armageddon && !noninteractive)
|
|
2171 run_hook (Qkill_emacs_hook);
|
|
2172
|
|
2173 /* make sure no quitting from now on!! */
|
|
2174 dont_check_for_quit = 1;
|
|
2175 Vinhibit_quit = Qt;
|
|
2176
|
|
2177 if (!preparing_for_armageddon)
|
|
2178 {
|
267
|
2179 Lisp_Object concons, nextcons;
|
0
|
2180
|
|
2181 /* Normally, go ahead and delete all the consoles now.
|
|
2182 Some unmentionably lame window systems (MS Wwwww...... eek,
|
|
2183 I can't even say it) don't properly clean up after themselves,
|
|
2184 and even for those that do, it might be cleaner this way.
|
|
2185 If we're going down, however, we don't do this (might
|
|
2186 be too dangerous), and if we get a crash somewhere within
|
|
2187 this loop, we'll still autosave and won't try this again. */
|
267
|
2188
|
|
2189 LIST_LOOP_DELETING(concons, nextcons, Vconsole_list)
|
|
2190 {
|
|
2191 /* There is very little point in deleting the stream console.
|
|
2192 It uses stdio, which should flush any buffered output and
|
|
2193 something can only go wrong. -slb */
|
|
2194 /* I changed my mind. There's a stupid hack in close to add
|
|
2195 a trailing newline. */
|
|
2196 /*if (!CONSOLE_STREAM_P (XCONSOLE (XCAR (concons))))*/
|
|
2197 delete_console_internal (XCONSOLE (XCAR (concons)), 1, 1, 0);
|
|
2198 }
|
0
|
2199 }
|
|
2200
|
|
2201 UNGCPRO;
|
|
2202
|
|
2203 shut_down_emacs (0, ((STRINGP (arg)) ? arg : Qnil));
|
|
2204
|
272
|
2205 #if defined(GNU_MALLOC)
|
|
2206 __free_hook = voodoo_free_hook;
|
|
2207 #endif
|
|
2208
|
207
|
2209 exit ((INTP (arg)) ? XINT (arg) : 0);
|
0
|
2210 /* NOTREACHED */
|
|
2211 return Qnil; /* I'm sick of the compiler warning */
|
|
2212 }
|
|
2213
|
|
2214 /* Perform an orderly shutdown of XEmacs. Autosave any modified
|
|
2215 buffers, kill any child processes, clean up the terminal modes (if
|
|
2216 we're in the foreground), and other stuff like that. Don't perform
|
|
2217 any redisplay; this may be called when XEmacs is shutting down in
|
|
2218 the background, or after its X connection has died.
|
|
2219
|
|
2220 If SIG is a signal number, print a message for it.
|
|
2221
|
|
2222 This is called by fatal signal handlers, X protocol error handlers,
|
|
2223 and Fkill_emacs. */
|
|
2224 static void
|
|
2225 shut_down_emacs (int sig, Lisp_Object stuff)
|
|
2226 {
|
|
2227 /* This function can GC */
|
|
2228 /* Prevent running of hooks and other non-essential stuff
|
|
2229 from now on. */
|
|
2230 preparing_for_armageddon = 1;
|
|
2231
|
|
2232 /* In case frames or windows are screwed up, avoid assertion
|
|
2233 failures here */
|
|
2234 Vinhibit_quit = Qt;
|
|
2235
|
|
2236 #ifdef QUANTIFY
|
|
2237 quantify_stop_recording_data ();
|
|
2238 #endif /* QUANTIFY */
|
|
2239
|
263
|
2240 #if 0
|
0
|
2241 /* This is absolutely the most important thing to do, so make sure
|
|
2242 we do it now, before anything else. We might have crashed and
|
|
2243 be in a weird inconsistent state, and potentially anything could
|
|
2244 set off another protection fault and cause us to bail out
|
|
2245 immediately. */
|
263
|
2246 /* I'm not removing the code entirely, yet. We have run up against
|
|
2247 a spate of problems in diagnosing crashes due to crashes within
|
|
2248 crashes. It has very definitely been determined that code called
|
|
2249 during auto-saving cannot work if XEmacs crashed inside of GC.
|
|
2250 We already auto-save on an itimer so there cannot be too much
|
|
2251 unsaved stuff around, and if we get better crash reports we might
|
|
2252 be able to get more problems fixed so I'm disabling this. -slb */
|
0
|
2253 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */
|
263
|
2254 #endif
|
0
|
2255
|
|
2256 fflush (stdout);
|
|
2257 reset_all_consoles ();
|
|
2258 if (sig && sig != SIGTERM)
|
|
2259 {
|
|
2260 stderr_out ("\nFatal error (%d).\n", sig);
|
|
2261 stderr_out
|
|
2262 ("Your files have been auto-saved.\n"
|
|
2263 "Use `M-x recover-session' to recover them.\n"
|
|
2264 "\n"
|
282
|
2265 #ifdef INFODOCK
|
|
2266 "Please report this bug by selecting `Report-Bug' in the InfoDock\n"
|
|
2267 "menu.\n"
|
|
2268 #else
|
126
|
2269 "Please report this bug by running the send-pr script included\n"
|
|
2270 "with XEmacs, or selecting `Send Bug Report' from the help menu.\n"
|
|
2271 "As a last resort send ordinary email to `crashes@xemacs.org'.\n"
|
282
|
2272 #endif
|
|
2273 "*MAKE SURE* to include the information in the command\n"
|
|
2274 "M-x describe-installation.\n"
|
2
|
2275 "\n"
|
0
|
2276 "If at all possible, *please* try to obtain a C stack backtrace;\n"
|
|
2277 "it will help us immensely in determining what went wrong.\n"
|
|
2278 "To do this, locate the core file that was produced as a result\n"
|
|
2279 "of this crash (it's usually called `core' and is located in the\n"
|
282
|
2280 "directory in which you started the editor, or maybe in your home\n"
|
0
|
2281 "directory), and type\n"
|
|
2282 "\n"
|
|
2283 " gdb ");
|
|
2284 {
|
2
|
2285 CONST char *name;
|
0
|
2286 char *dir = 0;
|
|
2287
|
|
2288 /* Now try to determine the actual path to the executable,
|
|
2289 to try to make the backtrace-determination process as foolproof
|
|
2290 as possible. */
|
|
2291 if (GC_STRINGP (Vinvocation_name))
|
14
|
2292 name = (char *) XSTRING_DATA (Vinvocation_name);
|
0
|
2293 else
|
|
2294 name = "xemacs";
|
|
2295 if (GC_STRINGP (Vinvocation_directory))
|
14
|
2296 dir = (char *) XSTRING_DATA (Vinvocation_directory);
|
0
|
2297 if (!dir || dir[0] != '/')
|
|
2298 stderr_out ("`which %s`", name);
|
|
2299 else if (dir[strlen (dir) - 1] != '/')
|
|
2300 stderr_out ("%s/%s", dir, name);
|
|
2301 else
|
|
2302 stderr_out ("%s%s", dir, name);
|
|
2303 }
|
|
2304 stderr_out
|
|
2305 (" core\n\n"
|
|
2306 "then type `where' when the debugger prompt comes up.\n"
|
|
2307 "(If you don't have GDB on your system, you might have DBX,\n"
|
|
2308 "or XDB, or SDB. A similar procedure should work for all of\n"
|
|
2309 "these. Ask your system administrator if you need more help.)\n");
|
|
2310 }
|
|
2311
|
|
2312 stuff_buffered_input (stuff);
|
|
2313
|
|
2314 kill_buffer_processes (Qnil);
|
|
2315
|
|
2316 #ifdef CLASH_DETECTION
|
|
2317 unlock_all_files ();
|
|
2318 #endif
|
|
2319
|
|
2320 #ifdef TOOLTALK
|
|
2321 tt_session_quit (tt_default_session ());
|
2
|
2322 #if 0
|
|
2323 /* The following crashes when built on X11R5 and run on X11R6 */
|
0
|
2324 tt_close ();
|
|
2325 #endif
|
2
|
2326 #endif /* TOOLTALK */
|
0
|
2327
|
|
2328 }
|
|
2329
|
|
2330
|
|
2331 #ifndef CANNOT_DUMP
|
|
2332 /* Nothing like this can be implemented on an Apollo.
|
|
2333 What a loss! */
|
|
2334
|
2
|
2335 extern char my_edata[];
|
0
|
2336
|
|
2337 #ifdef HAVE_SHM
|
|
2338
|
20
|
2339 DEFUN ("dump-emacs-data", Fdump_emacs_data, 1, 1, 0, /*
|
0
|
2340 Dump current state of XEmacs into data file FILENAME.
|
|
2341 This function exists on systems that use HAVE_SHM.
|
20
|
2342 */
|
|
2343 (intoname))
|
0
|
2344 {
|
|
2345 /* This function can GC */
|
|
2346 int opurify;
|
|
2347 struct gcpro gcpro1;
|
|
2348 GCPRO1 (intoname);
|
|
2349
|
|
2350 CHECK_STRING (intoname);
|
|
2351 intoname = Fexpand_file_name (intoname, Qnil);
|
|
2352
|
|
2353 opurify = purify_flag;
|
|
2354 purify_flag = 0;
|
|
2355
|
|
2356 fflush (stderr);
|
|
2357 fflush (stdout);
|
|
2358
|
|
2359 disksave_object_finalization ();
|
|
2360 release_breathing_space ();
|
|
2361
|
|
2362 /* Tell malloc where start of impure now is */
|
|
2363 /* Also arrange for warnings when nearly out of space. */
|
|
2364 #ifndef SYSTEM_MALLOC
|
173
|
2365 memory_warnings (my_edata, malloc_warning);
|
0
|
2366 #endif
|
|
2367 UNGCPRO;
|
14
|
2368 map_out_data (XSTRING_DATA (intoname));
|
0
|
2369
|
|
2370 purify_flag = opurify;
|
|
2371
|
|
2372 return Qnil;
|
|
2373 }
|
|
2374
|
|
2375 #else /* not HAVE_SHM */
|
272
|
2376 extern void disable_free_hook (void);
|
0
|
2377
|
20
|
2378 DEFUN ("dump-emacs", Fdump_emacs, 2, 2, 0, /*
|
0
|
2379 Dump current state of XEmacs into executable file FILENAME.
|
|
2380 Take symbols from SYMFILE (presumably the file you executed to run XEmacs).
|
|
2381 This is used in the file `loadup.el' when building XEmacs.
|
|
2382
|
|
2383 Remember to set `command-line-processed' to nil before dumping
|
|
2384 if you want the dumped XEmacs to process its command line
|
|
2385 and announce itself normally when it is run.
|
20
|
2386 */
|
|
2387 (intoname, symname))
|
0
|
2388 {
|
|
2389 /* This function can GC */
|
|
2390 struct gcpro gcpro1, gcpro2;
|
|
2391 int opurify;
|
|
2392
|
|
2393 GCPRO2 (intoname, symname);
|
|
2394
|
|
2395 #ifdef FREE_CHECKING
|
|
2396 Freally_free (Qnil);
|
|
2397
|
|
2398 /* When we're dumping, we can't use the debugging free() */
|
274
|
2399 disable_free_hook ();
|
272
|
2400 #endif
|
|
2401 #if 1 /* martin */
|
0
|
2402 #endif
|
|
2403
|
|
2404 CHECK_STRING (intoname);
|
|
2405 intoname = Fexpand_file_name (intoname, Qnil);
|
|
2406 if (!NILP (symname))
|
|
2407 {
|
|
2408 CHECK_STRING (symname);
|
14
|
2409 if (XSTRING_LENGTH (symname) > 0)
|
0
|
2410 symname = Fexpand_file_name (symname, Qnil);
|
|
2411 else
|
|
2412 symname = Qnil;
|
|
2413 }
|
|
2414
|
|
2415 opurify = purify_flag;
|
|
2416 purify_flag = 0;
|
|
2417
|
207
|
2418 #ifdef DEBUG_XEMACS
|
0
|
2419 report_pure_usage (1, 1);
|
207
|
2420 #else
|
|
2421 report_pure_usage (0, 1);
|
|
2422 #endif
|
0
|
2423
|
|
2424 fflush (stderr);
|
|
2425 fflush (stdout);
|
|
2426
|
|
2427 disksave_object_finalization ();
|
|
2428 release_breathing_space ();
|
|
2429
|
|
2430 /* Tell malloc where start of impure now is */
|
|
2431 /* Also arrange for warnings when nearly out of space. */
|
|
2432 #ifndef SYSTEM_MALLOC
|
173
|
2433 memory_warnings (my_edata, malloc_warning);
|
0
|
2434 #endif
|
|
2435
|
|
2436 UNGCPRO;
|
|
2437
|
|
2438 #if defined (MSDOS) && defined (EMX)
|
|
2439 {
|
14
|
2440 int fd = open ((char *) XSTRING_DATA (intoname),
|
0
|
2441 O_WRONLY|O_CREAT|O_TRUNC, S_IREAD|S_IWRITE);
|
|
2442 if (!fd) {
|
14
|
2443 error ("Failure operating on %s", XSTRING_DATA (intoname));
|
0
|
2444 } else {
|
|
2445 _core (fd);
|
|
2446 close (fd);
|
|
2447 }
|
|
2448 }
|
|
2449 #else /* not MSDOS and EMX */
|
|
2450 {
|
272
|
2451 char *intoname_ext;
|
|
2452 char *symname_ext;
|
0
|
2453
|
|
2454 GET_C_STRING_FILENAME_DATA_ALLOCA (intoname, intoname_ext);
|
|
2455 if (STRINGP (symname))
|
|
2456 GET_C_STRING_FILENAME_DATA_ALLOCA (symname, symname_ext);
|
|
2457 else
|
|
2458 symname_ext = 0;
|
272
|
2459
|
|
2460 garbage_collect_1 ();
|
255
|
2461 #ifdef DOUG_LEA_MALLOC
|
272
|
2462 malloc_state_ptr = malloc_get_state ();
|
|
2463 #endif
|
|
2464 /* here we break our rule that the filename conversion should
|
|
2465 be performed at the actual time that the system call is made.
|
|
2466 It's a whole lot easier to do the conversion here than to
|
|
2467 modify all the unexec routines to ensure that filename
|
|
2468 conversion is applied everywhere. Don't worry about memory
|
|
2469 leakage because this call only happens once. */
|
|
2470 unexec (intoname_ext, symname_ext, (uintptr_t) my_edata, 0, 0);
|
255
|
2471 #ifdef DOUG_LEA_MALLOC
|
|
2472 free (malloc_state_ptr);
|
|
2473 #endif
|
0
|
2474 }
|
|
2475 #endif /* not MSDOS and EMX */
|
|
2476
|
|
2477 purify_flag = opurify;
|
|
2478
|
|
2479 return Qnil;
|
|
2480 }
|
|
2481
|
|
2482 #endif /* not HAVE_SHM */
|
|
2483
|
|
2484 #endif /* not CANNOT_DUMP */
|
|
2485
|
|
2486 #ifndef SEPCHAR
|
|
2487 #define SEPCHAR ':'
|
|
2488 #endif
|
|
2489
|
284
|
2490 /* Split STRING into a list of substrings. The substrings are the
|
|
2491 parts of original STRING separated by SEPCHAR. */
|
|
2492 static Lisp_Object
|
|
2493 split_string_by_emchar_1 (CONST Bufbyte *string, Bytecount size,
|
|
2494 Emchar sepchar)
|
265
|
2495 {
|
284
|
2496 Lisp_Object result = Qnil;
|
|
2497 CONST Bufbyte *end = string + size;
|
|
2498
|
|
2499 while (1)
|
|
2500 {
|
|
2501 CONST Bufbyte *p = string;
|
|
2502 while (p < end)
|
|
2503 {
|
|
2504 if (charptr_emchar (p) == sepchar)
|
|
2505 break;
|
|
2506 INC_CHARPTR (p);
|
|
2507 }
|
|
2508 result = Fcons (make_string (string, p - string), result);
|
|
2509 if (p < end)
|
|
2510 {
|
|
2511 string = p;
|
|
2512 INC_CHARPTR (string); /* skip sepchar */
|
|
2513 }
|
|
2514 else
|
|
2515 break;
|
|
2516 }
|
|
2517 return Fnreverse (result);
|
265
|
2518 }
|
|
2519
|
284
|
2520 /* The same as the above, except PATH is an external C string (it is
|
|
2521 converted as FORMAT_FILENAME), and sepchar is hardcoded to SEPCHAR
|
|
2522 (':' or whatever). */
|
0
|
2523 Lisp_Object
|
177
|
2524 decode_path (CONST char *path)
|
0
|
2525 {
|
284
|
2526 int len;
|
|
2527 Bufbyte *newpath;
|
|
2528 if (!path)
|
|
2529 return Qnil;
|
|
2530
|
|
2531 GET_C_CHARPTR_INT_FILENAME_DATA_ALLOCA (path, newpath);
|
|
2532
|
321
|
2533 len = strlen ((const char *) newpath);
|
284
|
2534 /* #### Does this make sense? It certainly does for
|
|
2535 decode_env_path(), but it looks dubious here. Does any code
|
|
2536 depend on decode_path("") returning nil instead of an empty
|
|
2537 string? */
|
|
2538 if (!len)
|
|
2539 return Qnil;
|
|
2540
|
|
2541 return split_string_by_emchar_1 (newpath, (Bytecount)len, SEPCHAR);
|
0
|
2542 }
|
|
2543
|
177
|
2544 Lisp_Object
|
|
2545 decode_env_path (CONST char *evarname, CONST char *default_)
|
|
2546 {
|
284
|
2547 CONST char *path = 0;
|
177
|
2548 if (evarname)
|
284
|
2549 path = egetenv (evarname);
|
177
|
2550 if (!path)
|
|
2551 path = default_;
|
284
|
2552 return decode_path (path);
|
|
2553 }
|
|
2554
|
|
2555 /* Ben thinks this function should not exist or be exported to Lisp.
|
|
2556 We use it to define split-path-string in subr.el (not!). */
|
|
2557
|
|
2558 DEFUN ("split-string-by-char", Fsplit_string_by_char, 1, 2, 0, /*
|
|
2559 Split STRING into a list of substrings originally separated by SEPCHAR.
|
|
2560 */
|
|
2561 (string, sepchar))
|
|
2562 {
|
|
2563 CHECK_STRING (string);
|
|
2564 CHECK_CHAR (sepchar);
|
|
2565 return split_string_by_emchar_1 (XSTRING_DATA (string),
|
|
2566 XSTRING_LENGTH (string),
|
|
2567 XCHAR (sepchar));
|
177
|
2568 }
|
|
2569
|
284
|
2570 /* #### This was supposed to be in subr.el, but is used VERY early in
|
|
2571 the bootstrap process, so it goes here. Damn. */
|
|
2572
|
|
2573 DEFUN ("split-path", Fsplit_path, 1, 1, 0, /*
|
|
2574 Explode a search path into a list of strings.
|
|
2575 The path components are separated with the characters specified
|
|
2576 with `path-separator'.
|
|
2577 */
|
|
2578 (path))
|
|
2579 {
|
|
2580 CHECK_STRING (path);
|
|
2581
|
|
2582 while (!STRINGP (Vpath_separator)
|
|
2583 || (XSTRING_CHAR_LENGTH (Vpath_separator) != 1))
|
|
2584 Vpath_separator = signal_simple_continuable_error
|
|
2585 ("`path-separator' should be set to a single-character string",
|
|
2586 Vpath_separator);
|
|
2587
|
|
2588 return (split_string_by_emchar_1
|
|
2589 (XSTRING_DATA (path), XSTRING_LENGTH (path),
|
|
2590 charptr_emchar (XSTRING_DATA (Vpath_separator))));
|
|
2591 }
|
|
2592
|
20
|
2593 DEFUN ("noninteractive", Fnoninteractive, 0, 0, 0, /*
|
0
|
2594 Non-nil return value means XEmacs is running without interactive terminal.
|
20
|
2595 */
|
|
2596 ())
|
0
|
2597 {
|
173
|
2598 return noninteractive ? Qt : Qnil;
|
0
|
2599 }
|
|
2600
|
|
2601 /* This flag is useful to define if you're under a debugger; this way, you
|
|
2602 can put a breakpoint of assert_failed() and debug multiple problems
|
|
2603 in one session without having to recompile. */
|
|
2604 /* #define ASSERTIONS_DONT_ABORT */
|
|
2605
|
70
|
2606 #ifdef USE_ASSERTIONS
|
0
|
2607 /* This highly dubious kludge ... shut up Jamie, I'm tired of your slagging. */
|
|
2608
|
|
2609 DOESNT_RETURN
|
|
2610 assert_failed (CONST char *file, int line, CONST char *expr)
|
|
2611 {
|
|
2612 stderr_out ("Fatal error: assertion failed, file %s, line %d, %s\n",
|
|
2613 file, line, expr);
|
|
2614 #undef abort /* avoid infinite #define loop... */
|
272
|
2615 #if defined (WINDOWSNT) && defined (DEBUG_XEMACS)
|
227
|
2616 DebugBreak ();
|
|
2617 #elif !defined (ASSERTIONS_DONT_ABORT)
|
0
|
2618 abort ();
|
|
2619 #endif
|
|
2620 }
|
70
|
2621 #endif /* USE_ASSERTIONS */
|
0
|
2622
|
|
2623 #ifdef QUANTIFY
|
280
|
2624 DEFUN ("quantify-start-recording-data", Fquantify_start_recording_data,
|
|
2625 0, 0, 0, /*
|
0
|
2626 Start recording Quantify data.
|
20
|
2627 */
|
|
2628 ())
|
0
|
2629 {
|
|
2630 quantify_start_recording_data ();
|
|
2631 return Qnil;
|
|
2632 }
|
|
2633
|
280
|
2634 DEFUN ("quantify-stop-recording-data", Fquantify_stop_recording_data,
|
|
2635 0, 0, 0, /*
|
0
|
2636 Stop recording Quantify data.
|
20
|
2637 */
|
|
2638 ())
|
0
|
2639 {
|
|
2640 quantify_stop_recording_data ();
|
|
2641 return Qnil;
|
|
2642 }
|
|
2643
|
20
|
2644 DEFUN ("quantify-clear-data", Fquantify_clear_data, 0, 0, 0, /*
|
0
|
2645 Clear all Quantify data.
|
20
|
2646 */
|
|
2647 ())
|
0
|
2648 {
|
|
2649 quantify_clear_data ();
|
|
2650 return Qnil;
|
|
2651 }
|
|
2652 #endif /* QUANTIFY */
|
|
2653
|
|
2654 void
|
|
2655 syms_of_emacs (void)
|
|
2656 {
|
|
2657 #ifndef CANNOT_DUMP
|
|
2658 #ifdef HAVE_SHM
|
20
|
2659 DEFSUBR (Fdump_emacs_data);
|
0
|
2660 #else
|
20
|
2661 DEFSUBR (Fdump_emacs);
|
0
|
2662 #endif
|
|
2663 #endif /* !CANNOT_DUMP */
|
|
2664
|
20
|
2665 DEFSUBR (Frun_emacs_from_temacs);
|
|
2666 DEFSUBR (Frunning_temacs_p);
|
|
2667 DEFSUBR (Finvocation_name);
|
|
2668 DEFSUBR (Finvocation_directory);
|
|
2669 DEFSUBR (Fkill_emacs);
|
|
2670 DEFSUBR (Fnoninteractive);
|
0
|
2671
|
|
2672 #ifdef QUANTIFY
|
20
|
2673 DEFSUBR (Fquantify_start_recording_data);
|
|
2674 DEFSUBR (Fquantify_stop_recording_data);
|
|
2675 DEFSUBR (Fquantify_clear_data);
|
0
|
2676 #endif /* QUANTIFY */
|
|
2677
|
284
|
2678 DEFSUBR (Fsplit_string_by_char);
|
|
2679 DEFSUBR (Fsplit_path); /* #### */
|
265
|
2680
|
0
|
2681 defsymbol (&Qkill_emacs_hook, "kill-emacs-hook");
|
|
2682 defsymbol (&Qsave_buffers_kill_emacs, "save-buffers-kill-emacs");
|
|
2683 }
|
|
2684
|
|
2685 void
|
|
2686 vars_of_emacs (void)
|
|
2687 {
|
|
2688 DEFVAR_BOOL ("suppress-early-error-handler-backtrace",
|
272
|
2689 &suppress_early_error_handler_backtrace /*
|
|
2690 Non-nil means early error handler shouldn't print a backtrace.
|
0
|
2691 */ );
|
|
2692
|
|
2693 DEFVAR_LISP ("command-line-args", &Vcommand_line_args /*
|
|
2694 Args passed by shell to XEmacs, as a list of strings.
|
|
2695 */ );
|
|
2696
|
|
2697 DEFVAR_LISP ("invocation-name", &Vinvocation_name /*
|
|
2698 The program name that was used to run XEmacs.
|
|
2699 Any directory names are omitted.
|
|
2700 */ );
|
|
2701
|
|
2702 DEFVAR_LISP ("invocation-directory", &Vinvocation_directory /*
|
|
2703 The directory in which the XEmacs executable was found, to run it.
|
|
2704 The value is simply the program name if that directory's name is not known.
|
|
2705 */ );
|
|
2706
|
269
|
2707 DEFVAR_LISP ("invocation-path", &Vinvocation_path /*
|
|
2708 The path in which the XEmacs executable was found, to run it.
|
|
2709 The value is simply the value of environment variable PATH on startup
|
|
2710 if XEmacs was found there.
|
|
2711 */ );
|
|
2712
|
0
|
2713 #if 0 /* FSFmacs */
|
|
2714 xxDEFVAR_LISP ("installation-directory", &Vinstallation_directory,
|
|
2715 "A directory within which to look for the `lib-src' and `etc' directories.\n"
|
|
2716 "This is non-nil when we can't find those directories in their standard\n"
|
|
2717 "installed locations, but we can find them\n"
|
|
2718 "near where the XEmacs executable was found.");
|
|
2719 #endif
|
|
2720
|
|
2721 DEFVAR_LISP ("system-type", &Vsystem_type /*
|
272
|
2722 Symbol indicating type of operating system you are using.
|
0
|
2723 */ );
|
|
2724 Vsystem_type = intern (SYSTEM_TYPE);
|
169
|
2725 Fprovide (intern(SYSTEM_TYPE));
|
0
|
2726
|
|
2727 #ifndef EMACS_CONFIGURATION
|
|
2728 # define EMACS_CONFIGURATION "UNKNOWN"
|
|
2729 #endif
|
|
2730 DEFVAR_LISP ("system-configuration", &Vsystem_configuration /*
|
272
|
2731 String naming the configuration XEmacs was built for.
|
0
|
2732 */ );
|
|
2733 Vsystem_configuration = Fpurecopy (build_string (EMACS_CONFIGURATION));
|
|
2734
|
175
|
2735 #ifndef EMACS_CONFIG_OPTIONS
|
|
2736 # define EMACS_CONFIG_OPTIONS "UNKNOWN"
|
|
2737 #endif
|
|
2738 DEFVAR_LISP ("system-configuration-options", &Vsystem_configuration_options /*
|
|
2739 String containing the configuration options XEmacs was built with.
|
|
2740 */ );
|
|
2741 Vsystem_configuration_options = Fpurecopy (build_string
|
|
2742 (EMACS_CONFIG_OPTIONS));
|
|
2743
|
165
|
2744 DEFVAR_LISP ("emacs-major-version", &Vemacs_major_version /*
|
|
2745 Major version number of this version of Emacs, as an integer.
|
|
2746 Warning: this variable did not exist in Emacs versions earlier than:
|
|
2747 FSF Emacs: 19.23
|
|
2748 XEmacs: 19.10
|
|
2749 */ );
|
|
2750 Vemacs_major_version = make_int (EMACS_MAJOR_VERSION);
|
|
2751
|
|
2752 DEFVAR_LISP ("emacs-minor-version", &Vemacs_minor_version /*
|
|
2753 Minor version number of this version of Emacs, as an integer.
|
|
2754 Warning: this variable did not exist in Emacs versions earlier than:
|
|
2755 FSF Emacs: 19.23
|
|
2756 XEmacs: 19.10
|
|
2757 */ );
|
|
2758 Vemacs_minor_version = make_int (EMACS_MINOR_VERSION);
|
|
2759
|
343
|
2760 DEFVAR_LISP ("emacs-patch-level", &Vemacs_patch_level /*
|
|
2761 The patch level of this version of Emacs, as an integer.
|
|
2762 The value is non-nil if this version of XEmacs is part of a series of
|
|
2763 stable XEmacsen, but has bug fixes applied.
|
|
2764 Warning: this variable does not exist in FSF Emacs or in XEmacs versions
|
|
2765 earlier than 21.1.1
|
|
2766 */ );
|
|
2767 #ifdef EMACS_PATCH_LEVEL
|
|
2768 Vemacs_patch_level = make_int (EMACS_PATCH_LEVEL);
|
|
2769 #else
|
|
2770 Vemacs_patch_level = Qnil;
|
|
2771 #endif
|
|
2772
|
|
2773 DEFVAR_LISP ("emacs-beta-version", &Vemacs_beta_version /*
|
163
|
2774 Beta number of this version of Emacs, as an integer.
|
|
2775 The value is nil if this is an officially released version of XEmacs.
|
|
2776 Warning: this variable does not exist in FSF Emacs or in XEmacs versions
|
|
2777 earlier than 20.3.
|
|
2778 */ );
|
165
|
2779 #ifdef EMACS_BETA_VERSION
|
|
2780 Vemacs_beta_version = make_int (EMACS_BETA_VERSION);
|
|
2781 #else
|
|
2782 Vemacs_beta_version = Qnil;
|
163
|
2783 #endif
|
|
2784
|
278
|
2785 #ifdef INFODOCK
|
|
2786 DEFVAR_LISP ("infodock-major-version", &Vinfodock_major_version /*
|
|
2787 Major version number of this InfoDock release.
|
|
2788 */ );
|
|
2789 Vinfodock_major_version = make_int (INFODOCK_MAJOR_VERSION);
|
|
2790
|
|
2791 DEFVAR_LISP ("infodock-minor-version", &Vinfodock_minor_version /*
|
|
2792 Minor version number of this InfoDock release.
|
|
2793 */ );
|
|
2794 Vinfodock_minor_version = make_int (INFODOCK_MINOR_VERSION);
|
|
2795
|
|
2796 DEFVAR_LISP ("infodock-build-version", &Vinfodock_build_version /*
|
|
2797 Build version of this InfoDock release.
|
|
2798 */ );
|
|
2799 Vinfodock_build_version = make_int (INFODOCK_BUILD_VERSION);
|
|
2800 #endif
|
|
2801
|
163
|
2802 DEFVAR_LISP ("xemacs-codename", &Vxemacs_codename /*
|
|
2803 Codename of this version of Emacs (a string).
|
|
2804 */ );
|
|
2805 #ifndef XEMACS_CODENAME
|
165
|
2806 #define XEMACS_CODENAME "Noname"
|
163
|
2807 #endif
|
|
2808 Vxemacs_codename = Fpurecopy (build_string (XEMACS_CODENAME));
|
|
2809
|
0
|
2810 DEFVAR_BOOL ("noninteractive", &noninteractive1 /*
|
|
2811 Non-nil means XEmacs is running without interactive terminal.
|
|
2812 */ );
|
|
2813
|
276
|
2814 DEFVAR_BOOL ("inhibit-early-packages", &inhibit_early_packages /*
|
|
2815 Set to non-nil when the early packages should not be respected at startup.
|
|
2816 */ );
|
|
2817
|
|
2818 DEFVAR_BOOL ("inhibit-autoloads", &inhibit_autoloads /*
|
|
2819 Set to non-nil when autoloads should not be loaded at startup.
|
|
2820 */ );
|
|
2821
|
|
2822 DEFVAR_BOOL ("debug-paths", &debug_paths /*
|
|
2823 Set to non-nil when debug information about paths should be printed.
|
207
|
2824 */ );
|
|
2825
|
267
|
2826 DEFVAR_BOOL ("inhibit-site-lisp", &inhibit_site_lisp /*
|
|
2827 Set to non-nil when the site-lisp should not be searched at startup.
|
|
2828 */ );
|
269
|
2829 #ifdef INHIBIT_SITE_LISP
|
|
2830 inhibit_site_lisp = 1;
|
|
2831 #endif
|
267
|
2832
|
0
|
2833 DEFVAR_INT ("emacs-priority", &emacs_priority /*
|
|
2834 Priority for XEmacs to run at.
|
|
2835 This value is effective only if set before XEmacs is dumped,
|
|
2836 and only if the XEmacs executable is installed with setuid to permit
|
|
2837 it to change priority. (XEmacs sets its uid back to the real uid.)
|
|
2838 Currently, you need to define SET_EMACS_PRIORITY in `config.h'
|
|
2839 before you compile XEmacs, to enable the code for this feature.
|
|
2840 */ );
|
|
2841 emacs_priority = 0;
|
163
|
2842
|
276
|
2843 DEFVAR_CONST_LISP ("internal-error-checking", &Vinternal_error_checking /*
|
|
2844 Internal error checking built-in into this instance of XEmacs.
|
|
2845 This is a list of symbols, initialized at build-time. Legal symbols
|
|
2846 are:
|
|
2847
|
|
2848 extents - check extents prior to each extent change;
|
|
2849 typecheck - check types strictly, aborting in case of error;
|
|
2850 malloc - check operation of malloc;
|
|
2851 gc - check garbage collection;
|
|
2852 bufpos - check buffer positions.
|
|
2853 */ );
|
|
2854 Vinternal_error_checking = Qnil;
|
|
2855 #ifdef ERROR_CHECK_EXTENTS
|
|
2856 Vinternal_error_checking = Fcons (intern ("extents"),
|
|
2857 Vinternal_error_checking);
|
|
2858 #endif
|
|
2859 #ifdef ERROR_CHECK_TYPECHECK
|
|
2860 Vinternal_error_checking = Fcons (intern ("typecheck"),
|
|
2861 Vinternal_error_checking);
|
|
2862 #endif
|
|
2863 #ifdef ERROR_CHECK_MALLOC
|
|
2864 Vinternal_error_checking = Fcons (intern ("malloc"),
|
|
2865 Vinternal_error_checking);
|
|
2866 #endif
|
|
2867 #ifdef ERROR_CHECK_GC
|
|
2868 Vinternal_error_checking = Fcons (intern ("gc"),
|
|
2869 Vinternal_error_checking);
|
|
2870 #endif
|
|
2871 #ifdef ERROR_CHECK_BUFPOS
|
|
2872 Vinternal_error_checking = Fcons (intern ("bufpos"),
|
|
2873 Vinternal_error_checking);
|
|
2874 #endif
|
|
2875 Vinternal_error_checking = Fpurecopy (Vinternal_error_checking);
|
284
|
2876
|
|
2877 DEFVAR_LISP ("path-separator", &Vpath_separator /*
|
|
2878 The directory separator in search paths, as a string.
|
|
2879 */ );
|
|
2880 {
|
|
2881 char c = SEPCHAR;
|
|
2882 Vpath_separator = make_string ((Bufbyte *)&c, 1);
|
|
2883 }
|
0
|
2884 }
|
267
|
2885
|
|
2886 void
|
|
2887 complex_vars_of_emacs (void)
|
|
2888 {
|
280
|
2889 /* This is all related to path searching. */
|
|
2890
|
|
2891 DEFVAR_LISP ("emacs-program-name", &Vemacs_program_name /*
|
|
2892 *Name of the Emacs variant.
|
|
2893 For example, this may be \"xemacs\" or \"infodock\".
|
|
2894 This is mainly meant for use in path searching.
|
|
2895 */ );
|
|
2896 Vemacs_program_name = build_string ((char *) PATH_PROGNAME);
|
|
2897
|
|
2898 DEFVAR_LISP ("emacs-program-version", &Vemacs_program_version /*
|
|
2899 *Version of the Emacs variant.
|
|
2900 This typically has the form XX.XX[-bXX].
|
|
2901 This is mainly meant for use in path searching.
|
|
2902 */ );
|
|
2903 Vemacs_program_version = build_string ((char *) PATH_VERSION);
|
|
2904
|
267
|
2905 DEFVAR_LISP ("exec-path", &Vexec_path /*
|
|
2906 *List of directories to search programs to run in subprocesses.
|
|
2907 Each element is a string (directory name) or nil (try default directory).
|
|
2908 */ );
|
|
2909 Vexec_path = Qnil;
|
|
2910
|
|
2911 DEFVAR_LISP ("exec-directory", &Vexec_directory /*
|
|
2912 *Directory of architecture-dependent files that come with XEmacs,
|
|
2913 especially executable programs intended for XEmacs to invoke.
|
|
2914 */ );
|
|
2915 Vexec_directory = Qnil;
|
|
2916
|
276
|
2917 DEFVAR_LISP ("configure-exec-directory", &Vconfigure_exec_directory /*
|
|
2918 For internal use by the build procedure only.
|
|
2919 configure's idea of what EXEC-DIRECTORY will be.
|
|
2920 */ );
|
|
2921 #ifdef PATH_EXEC
|
|
2922 Vconfigure_exec_directory = Ffile_name_as_directory
|
|
2923 (build_string ((char *) PATH_EXEC));
|
|
2924 #else
|
|
2925 Vconfigure_exec_directory = Qnil;
|
|
2926 #endif
|
|
2927
|
|
2928 DEFVAR_LISP ("lisp-directory", &Vlisp_directory /*
|
|
2929 *Directory of core Lisp files that come with XEmacs.
|
|
2930 */ );
|
|
2931 Vlisp_directory = Qnil;
|
|
2932
|
267
|
2933 DEFVAR_LISP ("configure-lisp-directory", &Vconfigure_lisp_directory /*
|
276
|
2934 For internal use by the build procedure only.
|
|
2935 configure's idea of what LISP-DIRECTORY will be.
|
267
|
2936 */ );
|
|
2937 #ifdef PATH_LOADSEARCH
|
|
2938 Vconfigure_lisp_directory = Ffile_name_as_directory
|
|
2939 (build_string ((char *) PATH_LOADSEARCH));
|
|
2940 #else
|
|
2941 Vconfigure_lisp_directory = Qnil;
|
|
2942 #endif
|
|
2943
|
|
2944 DEFVAR_LISP ("configure-package-path", &Vconfigure_package_path /*
|
|
2945 For internal use by the build procedure only.
|
278
|
2946 configure's idea of what the package path will be.
|
267
|
2947 */ );
|
|
2948 #ifdef PATH_PACKAGEPATH
|
|
2949 Vconfigure_package_path = decode_path (PATH_PACKAGEPATH);
|
|
2950 #else
|
|
2951 Vconfigure_package_path = Qnil;
|
|
2952 #endif
|
|
2953
|
|
2954 DEFVAR_LISP ("data-directory", &Vdata_directory /*
|
|
2955 *Directory of architecture-independent files that come with XEmacs,
|
|
2956 intended for XEmacs to use.
|
|
2957 Use of this variable in new code is almost never correct. See the
|
|
2958 function `locate-data-directory' and the variable `data-directory-list'.
|
|
2959 */ );
|
|
2960 Vdata_directory = Qnil;
|
|
2961
|
|
2962 DEFVAR_LISP ("configure-data-directory", &Vconfigure_data_directory /*
|
|
2963 For internal use by the build procedure only.
|
|
2964 configure's idea of what DATA-DIRECTORY will be.
|
|
2965 */ );
|
|
2966 #ifdef PATH_DATA
|
|
2967 Vconfigure_data_directory = Ffile_name_as_directory
|
|
2968 (build_string ((char *) PATH_DATA));
|
|
2969 #else
|
|
2970 Vconfigure_data_directory = Qnil;
|
|
2971 #endif
|
|
2972
|
|
2973 DEFVAR_LISP ("data-directory-list", &Vdata_directory_list /*
|
|
2974 *List of directories of architecture-independent files that come with XEmacs
|
|
2975 or were installed as packages, and are intended for XEmacs to use.
|
|
2976 */ );
|
|
2977 Vdata_directory_list = Qnil;
|
|
2978
|
|
2979 #ifdef CLASH_DETECTION
|
|
2980 DEFVAR_LISP ("configure-lock-directory", &Vconfigure_lock_directory /*
|
|
2981 For internal use by the build procedure only.
|
|
2982 configure's idea of what LOCK-DIRECTORY will be.
|
|
2983 */ );
|
|
2984 #ifdef PATH_LOCK
|
|
2985 Vconfigure_lock_directory = Ffile_name_as_directory
|
|
2986 (build_string ((char *) PATH_LOCK));
|
|
2987 #else
|
|
2988 Vconfigure_lock_directory = Qnil;
|
|
2989 #endif
|
|
2990 #endif /* CLASH_DETECTION */
|
|
2991
|
276
|
2992 DEFVAR_LISP ("site-directory", &Vsite_directory /*
|
|
2993 *Directory of site-specific Lisp files that come with XEmacs.
|
|
2994 */ );
|
|
2995 Vsite_directory = Qnil;
|
|
2996
|
267
|
2997 DEFVAR_LISP ("configure-site-directory", &Vconfigure_site_directory /*
|
|
2998 For internal use by the build procedure only.
|
|
2999 configure's idea of what SITE-DIRECTORY will be.
|
|
3000 */ );
|
|
3001 #ifdef PATH_SITE
|
|
3002 Vconfigure_site_directory = Ffile_name_as_directory
|
|
3003 (build_string ((char *) PATH_SITE));
|
|
3004 #else
|
|
3005 Vconfigure_site_directory = Qnil;
|
|
3006 #endif
|
|
3007
|
|
3008 DEFVAR_LISP ("doc-directory", &Vdoc_directory /*
|
|
3009 *Directory containing the DOC file that comes with XEmacs.
|
|
3010 This is usually the same as exec-directory.
|
|
3011 */ );
|
|
3012 Vdoc_directory = Qnil;
|
|
3013
|
|
3014 DEFVAR_LISP ("configure-doc-directory", &Vconfigure_doc_directory /*
|
|
3015 For internal use by the build procedure only.
|
|
3016 configure's idea of what DOC-DIRECTORY will be.
|
|
3017 */ );
|
|
3018 #ifdef PATH_DOC
|
|
3019 Vconfigure_doc_directory = Ffile_name_as_directory
|
|
3020 (build_string ((char *) PATH_DOC));
|
|
3021 #else
|
|
3022 Vconfigure_doc_directory = Qnil;
|
|
3023 #endif
|
|
3024
|
278
|
3025 DEFVAR_LISP ("configure-exec-prefix-directory", &Vconfigure_exec_prefix_directory /*
|
|
3026 For internal use by the build procedure only.
|
|
3027 configure's idea of what EXEC-PREFIX-DIRECTORY will be.
|
|
3028 */ );
|
|
3029 #ifdef PATH_EXEC_PREFIX
|
|
3030 Vconfigure_exec_prefix_directory = Ffile_name_as_directory
|
|
3031 (build_string ((char *) PATH_EXEC_PREFIX));
|
|
3032 #else
|
|
3033 Vconfigure_exec_prefix_directory = Qnil;
|
|
3034 #endif
|
|
3035
|
267
|
3036 DEFVAR_LISP ("configure-prefix-directory", &Vconfigure_prefix_directory /*
|
|
3037 For internal use by the build procedure only.
|
|
3038 configure's idea of what PREFIX-DIRECTORY will be.
|
|
3039 */ );
|
|
3040 #ifdef PATH_PREFIX
|
|
3041 Vconfigure_prefix_directory = Ffile_name_as_directory
|
|
3042 (build_string ((char *) PATH_PREFIX));
|
|
3043 #else
|
|
3044 Vconfigure_prefix_directory = Qnil;
|
|
3045 #endif
|
|
3046
|
|
3047 DEFVAR_LISP ("configure-info-directory", &Vconfigure_info_directory /*
|
|
3048 For internal use by the build procedure only.
|
|
3049 This is the name of the directory in which the build procedure installed
|
|
3050 Emacs's info files; the default value for Info-default-directory-list
|
|
3051 includes this.
|
|
3052 */ );
|
|
3053 #ifdef PATH_INFO
|
|
3054 Vconfigure_info_directory =
|
|
3055 Ffile_name_as_directory (build_string (PATH_INFO));
|
|
3056 #else
|
|
3057 Vconfigure_info_directory = Qnil;
|
|
3058 #endif
|
|
3059
|
|
3060 DEFVAR_LISP ("configure-info-path", &Vconfigure_info_path /*
|
|
3061 The configured initial path for info documentation.
|
|
3062 */ );
|
|
3063 #ifdef PATH_INFOPATH
|
|
3064 Vconfigure_info_path = decode_path (PATH_INFOPATH);
|
|
3065 #else
|
|
3066 Vconfigure_info_path = Qnil;
|
|
3067 #endif
|
|
3068 }
|
298
|
3069
|
|
3070 #ifdef __sgi
|
|
3071 /* This is so tremendously ugly I'd puke. But then, it works.
|
|
3072 * The target is to override the static constructor from the
|
|
3073 * libiflPNG.so library which is maskerading as libz, and
|
|
3074 * cores on us when re-started from the dumped executable.
|
|
3075 * This will have to go for 21.1 -- OG.
|
|
3076 */
|
335
|
3077 void __sti__iflPNGFile_c___(void);
|
298
|
3078 void __sti__iflPNGFile_c___()
|
|
3079 {
|
|
3080 }
|
|
3081
|
|
3082 #endif
|