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
|
359
|
985 #ifdef HAVE_XIM
|
|
986 #ifdef XIM_XLIB
|
|
987 syms_of_input_method_xlib ();
|
|
988 #endif
|
|
989 #endif /* HAVE_XIM */
|
0
|
990 #endif /* HAVE_X_WINDOWS */
|
|
991
|
213
|
992 #ifdef HAVE_MS_WINDOWS
|
|
993 syms_of_console_mswindows ();
|
|
994 syms_of_device_mswindows ();
|
|
995 syms_of_event_mswindows ();
|
|
996 syms_of_frame_mswindows ();
|
|
997 syms_of_objects_mswindows ();
|
221
|
998 syms_of_select_mswindows ();
|
267
|
999 syms_of_glyphs_mswindows ();
|
231
|
1000 #ifdef HAVE_MENUBARS
|
|
1001 syms_of_menubar_mswindows ();
|
|
1002 #endif
|
276
|
1003 #ifdef HAVE_SCROLLBARS
|
|
1004 syms_of_scrollbar_mswindows ();
|
|
1005 #endif
|
263
|
1006 #ifdef HAVE_MSW_C_DIRED
|
|
1007 syms_of_dired_mswindows ();
|
209
|
1008 #endif
|
347
|
1009 #ifdef WINDOWSNT
|
|
1010 syms_of_ntproc ();
|
|
1011 #endif
|
263
|
1012 #endif /* HAVE_MS_WINDOWS */
|
209
|
1013
|
70
|
1014 #ifdef MULE
|
|
1015 syms_of_mule ();
|
|
1016 syms_of_mule_ccl ();
|
|
1017 syms_of_mule_charset ();
|
259
|
1018 #endif
|
|
1019 #ifdef FILE_CODING
|
347
|
1020 syms_of_file_coding ();
|
259
|
1021 #endif
|
|
1022 #ifdef MULE
|
70
|
1023 #ifdef HAVE_WNN
|
|
1024 syms_of_mule_wnn ();
|
|
1025 #endif
|
|
1026 #ifdef HAVE_CANNA
|
|
1027 syms_of_mule_canna ();
|
|
1028 #endif /* HAVE_CANNA */
|
|
1029 #endif /* MULE */
|
|
1030
|
0
|
1031 #ifdef SYMS_SYSTEM
|
|
1032 SYMS_SYSTEM;
|
|
1033 #endif
|
|
1034
|
|
1035 #ifdef SYMS_MACHINE
|
|
1036 SYMS_MACHINE;
|
|
1037 #endif
|
|
1038
|
|
1039 #ifdef EMACS_BTL
|
163
|
1040 syms_of_btl ();
|
0
|
1041 #endif
|
|
1042
|
269
|
1043 /*
|
267
|
1044 #if defined (GNU_MALLOC) && \
|
|
1045 defined (ERROR_CHECK_MALLOC) && \
|
|
1046 !defined (HAVE_LIBMCHECK)
|
269
|
1047 */
|
267
|
1048 /* Prior to XEmacs 21, this was `#if 0'ed out. -slb */
|
269
|
1049 #if defined (LOSING_GCC_DESTRUCTOR_FREE_BUG)
|
0
|
1050 syms_of_free_hook ();
|
|
1051 #endif
|
|
1052
|
|
1053 #ifdef TOOLTALK
|
|
1054 syms_of_tooltalk ();
|
|
1055 #endif
|
|
1056
|
|
1057 #ifdef SUNPRO
|
|
1058 syms_of_sunpro ();
|
|
1059 #endif
|
|
1060
|
259
|
1061 #ifdef HAVE_LDAP
|
|
1062 syms_of_eldap ();
|
|
1063 #endif
|
|
1064
|
0
|
1065 /* Now create the subtypes for the types that have them.
|
|
1066 We do this before the vars_*() because more symbols
|
|
1067 may get initialized here. */
|
|
1068
|
|
1069 /* Now initialize the console types and associated symbols.
|
|
1070 Other than the first function below, the functions may
|
|
1071 make exactly the following function/macro calls:
|
|
1072
|
|
1073 INITIALIZE_CONSOLE_TYPE()
|
|
1074 CONSOLE_HAS_METHOD()
|
|
1075
|
|
1076 For any given console type, the former macro must be called
|
|
1077 before the any calls to the latter macro. */
|
|
1078
|
|
1079 console_type_create ();
|
|
1080
|
|
1081 console_type_create_stream ();
|
|
1082
|
|
1083 #ifdef HAVE_TTY
|
|
1084 console_type_create_tty ();
|
|
1085 console_type_create_device_tty ();
|
|
1086 console_type_create_frame_tty ();
|
|
1087 console_type_create_objects_tty ();
|
|
1088 console_type_create_redisplay_tty ();
|
|
1089 #endif
|
|
1090
|
|
1091 #ifdef HAVE_X_WINDOWS
|
|
1092 console_type_create_x ();
|
|
1093 console_type_create_device_x ();
|
|
1094 console_type_create_frame_x ();
|
|
1095 console_type_create_glyphs_x ();
|
|
1096 #ifdef HAVE_MENUBARS
|
|
1097 console_type_create_menubar_x ();
|
|
1098 #endif
|
|
1099 console_type_create_objects_x ();
|
|
1100 console_type_create_redisplay_x ();
|
|
1101 #ifdef HAVE_SCROLLBARS
|
|
1102 console_type_create_scrollbar_x ();
|
|
1103 #endif
|
|
1104 #ifdef HAVE_TOOLBARS
|
|
1105 console_type_create_toolbar_x ();
|
|
1106 #endif
|
284
|
1107 #ifdef HAVE_DIALOGS
|
|
1108 console_type_create_dialog_x ();
|
|
1109 #endif
|
0
|
1110 #endif /* HAVE_X_WINDOWS */
|
|
1111
|
213
|
1112 #ifdef HAVE_MS_WINDOWS
|
|
1113 console_type_create_mswindows ();
|
|
1114 console_type_create_device_mswindows ();
|
|
1115 console_type_create_frame_mswindows ();
|
|
1116 console_type_create_objects_mswindows ();
|
|
1117 console_type_create_redisplay_mswindows ();
|
267
|
1118 console_type_create_glyphs_mswindows ();
|
225
|
1119 # ifdef HAVE_SCROLLBARS
|
|
1120 console_type_create_scrollbar_mswindows ();
|
|
1121 # endif
|
231
|
1122 #ifdef HAVE_MENUBARS
|
|
1123 console_type_create_menubar_mswindows ();
|
|
1124 #endif
|
276
|
1125 #ifdef HAVE_TOOLBARS
|
|
1126 console_type_create_toolbar_mswindows ();
|
|
1127 #endif
|
286
|
1128 #ifdef HAVE_DIALOGS
|
|
1129 console_type_create_dialog_mswindows ();
|
|
1130 #endif
|
209
|
1131 #endif
|
|
1132
|
0
|
1133 /* Now initialize the specifier types and associated symbols.
|
|
1134 Other than the first function below, the functions may
|
|
1135 make exactly the following function/macro calls:
|
|
1136
|
|
1137 INITIALIZE_SPECIFIER_TYPE()
|
|
1138 SPECIFIER_HAS_METHOD()
|
|
1139
|
|
1140 For any given specifier type, the former macro must be called
|
|
1141 before the any calls to the latter macro. */
|
|
1142
|
|
1143 specifier_type_create ();
|
|
1144
|
|
1145 specifier_type_create_image ();
|
|
1146 specifier_type_create_objects ();
|
|
1147 #ifdef HAVE_TOOLBARS
|
|
1148 specifier_type_create_toolbar ();
|
|
1149 #endif
|
|
1150
|
|
1151 /* Now initialize the structure types and associated symbols.
|
|
1152 Other than the first function below, the functions may
|
|
1153 make exactly the following function/macro calls:
|
|
1154
|
|
1155 define_structure_type()
|
|
1156 define_structure_type_keyword()
|
|
1157
|
|
1158 */
|
|
1159
|
|
1160 structure_type_create ();
|
|
1161
|
70
|
1162 structure_type_create_chartab ();
|
0
|
1163 structure_type_create_faces ();
|
|
1164 structure_type_create_rangetab ();
|
223
|
1165 structure_type_create_hashtable ();
|
0
|
1166
|
|
1167 /* Now initialize the image instantiator formats and associated symbols.
|
|
1168 Other than the first function below, the functions may
|
|
1169 make exactly the following function/macro calls:
|
|
1170
|
|
1171 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT()
|
|
1172 IIFORMAT_HAS_METHOD()
|
|
1173 IIFORMAT_VALID_KEYWORD()
|
|
1174
|
|
1175 For any given image instantiator format, the first macro must be
|
|
1176 called before the any calls to the other macros. */
|
|
1177
|
|
1178 image_instantiator_format_create ();
|
280
|
1179 image_instantiator_format_create_glyphs_eimage ();
|
0
|
1180 #ifdef HAVE_X_WINDOWS
|
|
1181 image_instantiator_format_create_glyphs_x ();
|
|
1182 #endif /* HAVE_X_WINDOWS */
|
267
|
1183 #ifdef HAVE_MS_WINDOWS
|
|
1184 image_instantiator_format_create_glyphs_mswindows ();
|
|
1185 #endif /* HAVE_MSWINDOWS_WINDOWS */
|
0
|
1186
|
|
1187 /* Now initialize the lstream types and associated symbols.
|
|
1188 Other than the first function below, the functions may
|
|
1189 make exactly the following function/macro calls:
|
|
1190
|
|
1191 LSTREAM_HAS_METHOD()
|
|
1192
|
|
1193 */
|
|
1194
|
|
1195 lstream_type_create ();
|
259
|
1196 #ifdef FILE_CODING
|
347
|
1197 lstream_type_create_file_coding ();
|
70
|
1198 #endif
|
278
|
1199 #if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT)
|
274
|
1200 lstream_type_create_mswindows_selectable ();
|
|
1201 #endif
|
|
1202
|
263
|
1203 /* Initialize processes implementation.
|
|
1204 The functions may make exactly the following function/macro calls:
|
|
1205
|
|
1206 PROCESS_HAS_METHOD()
|
|
1207 */
|
|
1208 #ifdef HAVE_UNIX_PROCESSES
|
|
1209 process_type_create_unix ();
|
|
1210 #endif
|
|
1211 #ifdef HAVE_WIN32_PROCESSES
|
274
|
1212 process_type_create_nt ();
|
263
|
1213 #endif
|
|
1214
|
0
|
1215 /* Now initialize most variables.
|
|
1216
|
|
1217 These functions may do exactly the following:
|
|
1218
|
|
1219 DEFVAR_INT()
|
|
1220 DEFVAR_LISP()
|
|
1221 DEFVAR_BOOL()
|
|
1222 DEFER_GETTEXT()
|
|
1223 Dynarr_*()
|
|
1224 Blocktype_*()
|
|
1225 staticpro()
|
|
1226 Fprovide(symbol)
|
|
1227 intern()
|
|
1228 pure_put()
|
|
1229 xmalloc()
|
|
1230 defsymbol(), if it's absolutely necessary and you're sure that
|
|
1231 the symbol isn't referenced anywhere else in the initialization
|
|
1232 code
|
|
1233 Fset() on a symbol that is unbound
|
|
1234 assigning a symbol or constant value to a variable
|
|
1235 using a global variable that has been initialized
|
|
1236 earlier on in the same function
|
|
1237
|
|
1238 Any of the object-creating functions on alloc.c: e.g.
|
|
1239
|
|
1240 make_pure_*()
|
|
1241 Fpurecopy()
|
|
1242 make_string()
|
|
1243 build_string()
|
|
1244 make_vector()
|
|
1245 make_int()
|
|
1246 make_extent()
|
|
1247 alloc_lcrecord()
|
|
1248 Fcons()
|
|
1249 listN()
|
|
1250 make_opaque_ptr()
|
|
1251 make_opaque_long()
|
|
1252
|
|
1253 perhaps a few others.
|
|
1254 */
|
|
1255
|
|
1256 /* Now allow Fprovide() statements to be made. */
|
|
1257 init_provide_once ();
|
|
1258
|
|
1259 vars_of_abbrev ();
|
|
1260 vars_of_alloc ();
|
136
|
1261 #ifdef HAVE_X_WINDOWS
|
|
1262 vars_of_balloon_x ();
|
|
1263 #endif
|
0
|
1264 vars_of_buffer ();
|
|
1265 vars_of_bytecode ();
|
|
1266 vars_of_callint ();
|
|
1267 vars_of_callproc ();
|
347
|
1268 vars_of_chartab ();
|
0
|
1269 vars_of_cmdloop ();
|
|
1270 vars_of_cmds ();
|
|
1271 vars_of_console ();
|
|
1272 vars_of_data ();
|
|
1273 #ifdef DEBUG_XEMACS
|
|
1274 vars_of_debug ();
|
|
1275 #endif
|
|
1276 vars_of_console_stream ();
|
|
1277 vars_of_device ();
|
|
1278 #ifdef HAVE_DIALOGS
|
|
1279 vars_of_dialog ();
|
|
1280 #endif
|
|
1281 vars_of_dired ();
|
|
1282 vars_of_doc ();
|
284
|
1283 #ifdef HAVE_DRAGNDROP
|
|
1284 vars_of_dragdrop ();
|
|
1285 #endif
|
0
|
1286 vars_of_editfns ();
|
|
1287 vars_of_elhash ();
|
|
1288 vars_of_emacs ();
|
|
1289 vars_of_eval ();
|
|
1290 vars_of_event_stream ();
|
|
1291 vars_of_events ();
|
|
1292 vars_of_extents ();
|
|
1293 vars_of_faces ();
|
|
1294 vars_of_fileio ();
|
|
1295 #ifdef CLASH_DETECTION
|
|
1296 vars_of_filelock ();
|
|
1297 #endif
|
|
1298 vars_of_floatfns ();
|
|
1299 vars_of_font_lock ();
|
|
1300 vars_of_frame ();
|
|
1301 vars_of_glyphs ();
|
280
|
1302 vars_of_glyphs_eimage ();
|
0
|
1303 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
|
|
1304 vars_of_gui ();
|
|
1305 #endif
|
|
1306 vars_of_indent ();
|
|
1307 vars_of_insdel ();
|
|
1308 vars_of_intl ();
|
70
|
1309 #ifdef HAVE_XIM
|
|
1310 #ifdef XIM_MOTIF
|
|
1311 vars_of_input_method_motif ();
|
|
1312 #else /* XIM_XLIB */
|
|
1313 vars_of_input_method_xlib ();
|
|
1314 #endif
|
|
1315 #endif /* HAVE_XIM */
|
0
|
1316 vars_of_keymap ();
|
|
1317 vars_of_lread ();
|
|
1318 vars_of_lstream ();
|
|
1319 vars_of_macros ();
|
|
1320 vars_of_md5 ();
|
|
1321 #ifdef HAVE_DATABASE
|
272
|
1322 vars_of_database ();
|
0
|
1323 #endif
|
|
1324 #ifdef HAVE_MENUBARS
|
|
1325 vars_of_menubar ();
|
|
1326 #endif
|
|
1327 vars_of_minibuf ();
|
347
|
1328 #ifdef WINDOWSNT
|
|
1329 vars_of_ntproc ();
|
|
1330 #endif
|
0
|
1331 vars_of_objects ();
|
|
1332 vars_of_print ();
|
263
|
1333
|
0
|
1334 #ifndef NO_SUBPROCESSES
|
|
1335 vars_of_process ();
|
263
|
1336 #ifdef HAVE_UNIX_PROCESSES
|
|
1337 vars_of_process_unix ();
|
0
|
1338 #endif
|
263
|
1339 #ifdef HAVE_WIN32_PROCESSES
|
274
|
1340 vars_of_process_nt ();
|
263
|
1341 #endif
|
|
1342 #endif
|
|
1343
|
0
|
1344 vars_of_profile ();
|
255
|
1345 #if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC)
|
0
|
1346 vars_of_ralloc ();
|
|
1347 #endif /* HAVE_MMAP && REL_ALLOC */
|
|
1348 vars_of_redisplay ();
|
|
1349 #ifdef HAVE_SCROLLBARS
|
|
1350 vars_of_scrollbar ();
|
|
1351 #endif
|
|
1352 vars_of_search ();
|
|
1353 vars_of_sound ();
|
|
1354 vars_of_specifier ();
|
|
1355 vars_of_symbols ();
|
|
1356 vars_of_syntax ();
|
|
1357 #ifdef HAVE_TOOLBARS
|
|
1358 vars_of_toolbar ();
|
|
1359 #endif
|
|
1360 vars_of_undo ();
|
|
1361 vars_of_window ();
|
|
1362
|
|
1363 #ifdef HAVE_TTY
|
|
1364 vars_of_console_tty ();
|
|
1365 vars_of_event_tty ();
|
|
1366 vars_of_frame_tty ();
|
|
1367 vars_of_objects_tty ();
|
|
1368 #endif
|
|
1369
|
|
1370 #ifdef HAVE_X_WINDOWS
|
|
1371 vars_of_device_x ();
|
|
1372 #ifdef HAVE_DIALOGS
|
|
1373 vars_of_dialog_x ();
|
|
1374 #endif
|
|
1375 vars_of_event_Xt ();
|
|
1376 vars_of_frame_x ();
|
|
1377 vars_of_glyphs_x ();
|
|
1378 #ifdef HAVE_MENUBARS
|
|
1379 vars_of_menubar_x ();
|
|
1380 #endif
|
|
1381 vars_of_objects_x ();
|
|
1382 vars_of_xselect ();
|
|
1383 #ifdef HAVE_SCROLLBARS
|
|
1384 vars_of_scrollbar_x ();
|
|
1385 #endif
|
|
1386 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
|
|
1387 vars_of_gui_x ();
|
|
1388 #endif
|
|
1389 #endif
|
|
1390
|
213
|
1391 #ifdef HAVE_MS_WINDOWS
|
|
1392 vars_of_device_mswindows ();
|
|
1393 vars_of_console_mswindows ();
|
|
1394 vars_of_event_mswindows ();
|
|
1395 vars_of_frame_mswindows ();
|
|
1396 vars_of_objects_mswindows ();
|
221
|
1397 vars_of_select_mswindows ();
|
267
|
1398 vars_of_glyphs_mswindows ();
|
225
|
1399 #ifdef HAVE_SCROLLBARS
|
|
1400 vars_of_scrollbar_mswindows ();
|
|
1401 #endif
|
231
|
1402 #ifdef HAVE_MENUBARS
|
|
1403 vars_of_menubar_mswindows ();
|
|
1404 #endif
|
263
|
1405 #ifdef HAVE_MSW_C_DIRED
|
|
1406 vars_of_dired_mswindows ();
|
209
|
1407 #endif
|
286
|
1408 #ifdef HAVE_DIALOGS
|
|
1409 vars_of_dialog_mswindows ();
|
|
1410 #endif
|
263
|
1411 #endif /* HAVE_MS_WINDOWS */
|
209
|
1412
|
70
|
1413 #ifdef MULE
|
|
1414 vars_of_mule ();
|
347
|
1415 vars_of_mule_ccl ();
|
70
|
1416 vars_of_mule_charset ();
|
259
|
1417 #endif
|
|
1418 #ifdef FILE_CODING
|
347
|
1419 vars_of_file_coding ();
|
259
|
1420 #endif
|
|
1421 #ifdef MULE
|
70
|
1422 #ifdef HAVE_WNN
|
|
1423 vars_of_mule_wnn ();
|
|
1424 #endif
|
|
1425 #ifdef HAVE_CANNA
|
|
1426 vars_of_mule_canna ();
|
|
1427 #endif /* HAVE_CANNA */
|
|
1428 #endif /* MULE */
|
|
1429
|
0
|
1430 #ifdef TOOLTALK
|
|
1431 vars_of_tooltalk ();
|
|
1432 #endif
|
|
1433
|
|
1434 #ifdef SUNPRO
|
|
1435 vars_of_sunpro ();
|
|
1436 #endif
|
|
1437
|
259
|
1438 #ifdef HAVE_LDAP
|
|
1439 vars_of_eldap ();
|
|
1440 #endif
|
|
1441
|
0
|
1442 /* Now initialize any specifier variables. We do this later
|
|
1443 because it has some dependence on the vars initialized
|
|
1444 above.
|
|
1445
|
|
1446 These functions should *only* initialize specifier variables,
|
|
1447 and may make use of the following functions/macros in addition
|
|
1448 to the ones listed above:
|
|
1449
|
|
1450 DEFVAR_SPECIFIER()
|
|
1451 Fmake_specifier()
|
|
1452 set_specifier_fallback()
|
|
1453 set_specifier_caching()
|
|
1454 */
|
|
1455
|
|
1456 specifier_vars_of_glyphs ();
|
|
1457 #ifdef HAVE_MENUBARS
|
|
1458 specifier_vars_of_menubar ();
|
|
1459 #endif
|
|
1460 specifier_vars_of_redisplay ();
|
|
1461 #ifdef HAVE_SCROLLBARS
|
|
1462 specifier_vars_of_scrollbar ();
|
|
1463 #endif
|
|
1464 #ifdef HAVE_TOOLBARS
|
|
1465 specifier_vars_of_toolbar ();
|
|
1466 #endif
|
|
1467 specifier_vars_of_window ();
|
|
1468
|
|
1469 /* Now comes all the rest of the variables that couldn't
|
|
1470 be handled above. There may be dependencies on variables
|
|
1471 initialized above, and dependencies between one complex_vars_()
|
|
1472 function and another. */
|
|
1473
|
|
1474 /* Calls Fmake_range_table(). */
|
|
1475 complex_vars_of_regex ();
|
|
1476 /* Calls Fmake_range_table(). */
|
|
1477 complex_vars_of_search ();
|
|
1478
|
|
1479 /* Calls make_lisp_hashtable(). */
|
|
1480 complex_vars_of_extents ();
|
163
|
1481
|
0
|
1482 /* Depends on hashtables and specifiers. */
|
|
1483 complex_vars_of_faces ();
|
|
1484
|
70
|
1485 #ifdef MULE
|
|
1486 /* These two depend on hashtables and various variables declared
|
|
1487 earlier. The second may also depend on the first. */
|
|
1488 complex_vars_of_mule_charset ();
|
259
|
1489 #endif
|
|
1490 #if defined(FILE_CODING)
|
347
|
1491 complex_vars_of_file_coding ();
|
70
|
1492 #endif
|
|
1493
|
0
|
1494 /* This calls allocate_glyph(), which creates specifiers
|
|
1495 and also relies on a variable (Vthe_nothing_vector) initialized
|
70
|
1496 above. It also calls make_ext_string(), which under Mule
|
|
1497 could require that the charsets be initialized. */
|
0
|
1498 complex_vars_of_glyphs ();
|
|
1499
|
175
|
1500 /* These rely on the glyphs just created in the previous function,
|
|
1501 and call Fadd_spec_to_specifier(), which relies on various
|
0
|
1502 variables initialized above. */
|
|
1503 #ifdef HAVE_X_WINDOWS
|
|
1504 complex_vars_of_glyphs_x ();
|
|
1505 #endif
|
267
|
1506 #ifdef HAVE_MS_WINDOWS
|
|
1507 complex_vars_of_glyphs_mswindows ();
|
|
1508 #endif
|
0
|
1509
|
|
1510 /* This calls Fmake_glyph_internal(). */
|
|
1511 complex_vars_of_alloc ();
|
|
1512
|
|
1513 /* This calls Fmake_glyph_internal(). */
|
|
1514 #ifdef HAVE_MENUBARS
|
|
1515 complex_vars_of_menubar ();
|
|
1516 #endif
|
|
1517
|
|
1518 /* This calls Fmake_glyph_internal(). */
|
|
1519 #ifdef HAVE_SCROLLBARS
|
|
1520 complex_vars_of_scrollbar ();
|
|
1521 #endif
|
|
1522
|
|
1523 /* This calls allocate_glyph(). */
|
|
1524 complex_vars_of_frame ();
|
|
1525
|
70
|
1526 /* This calls Fcopy_category_table() under Mule, which calls who
|
|
1527 knows what. */
|
|
1528 complex_vars_of_chartab ();
|
|
1529
|
0
|
1530 /* This calls set_string_char(), which (under Mule) depends on the
|
|
1531 charsets being initialized. */
|
|
1532 complex_vars_of_casetab ();
|
|
1533
|
|
1534 /* This calls Fcopy_syntax_table(), which relies on char tables. */
|
|
1535 complex_vars_of_syntax ();
|
|
1536
|
|
1537 /* This initializes buffer-local variables, sets things up so
|
|
1538 that buffers can be created, and creates a couple of basic
|
|
1539 buffers. This depends on Vstandard_syntax_table and
|
|
1540 Vstandard_category_table (initialized in the previous
|
|
1541 functions), as well as a whole horde of variables that may
|
|
1542 have been initialized above. */
|
|
1543 complex_vars_of_buffer ();
|
|
1544
|
|
1545 /* This initializes console-local variables. */
|
|
1546 complex_vars_of_console ();
|
|
1547
|
|
1548 /* This creates a couple more buffers, and depends on the
|
|
1549 previous function. */
|
|
1550 complex_vars_of_minibuf ();
|
|
1551
|
|
1552 /* These two might call Ffile_name_as_directory(), which
|
|
1553 might depend on all sorts of things; I'm not sure. */
|
267
|
1554 complex_vars_of_emacs ();
|
|
1555
|
0
|
1556 #ifdef CLASH_DETECTION
|
|
1557 complex_vars_of_filelock ();
|
|
1558 #endif /* CLASH_DETECTION */
|
|
1559
|
|
1560 /* This creates a couple of basic keymaps and depends on Lisp
|
|
1561 hashtables and Ffset() (both of which depend on some variables
|
|
1562 initialized in the vars_of_*() section) and possibly other
|
|
1563 stuff. */
|
|
1564 complex_vars_of_keymap ();
|
175
|
1565 /* Calls Fmake_hashtable() and creates a keymap */
|
|
1566 complex_vars_of_event_stream ();
|
0
|
1567
|
|
1568 if (always_gc) /* purification debugging hack */
|
|
1569 garbage_collect_1 ();
|
|
1570 }
|
|
1571
|
|
1572 /* CONGRATULATIONS!!! We have successfully initialized the Lisp
|
|
1573 engine. */
|
|
1574
|
|
1575 if (initialized)
|
|
1576 {
|
|
1577 /* Stuff that needs to be reset at run time. Order below should
|
|
1578 not matter. */
|
|
1579 reinit_alloc ();
|
|
1580 reinit_eval ();
|
70
|
1581 #ifdef MULE_REGEXP
|
|
1582 reinit_mule_category ();
|
|
1583 #endif
|
0
|
1584 }
|
|
1585
|
|
1586 /* Now do further initialization/setup of stuff that is not needed by the
|
|
1587 syms_of_() routines. This involves stuff that only is enabled in
|
|
1588 an interactive run (redisplay, user input, etc.) and stuff that is
|
|
1589 not needed until we start loading Lisp code (the reader). A lot
|
|
1590 of this stuff involves querying the current environment and needs
|
|
1591 to be done both at dump time and at run time. */
|
|
1592
|
288
|
1593 init_initial_directory(); /* get the directory to use for the
|
|
1594 "*scratch*" buffer, etc. */
|
|
1595
|
|
1596 #ifdef WINDOWSNT
|
|
1597 /*
|
|
1598 * For Win32, call init_environment() now, so that environment/registry
|
|
1599 * variables will be properly entered into Vprocess_envonment.
|
|
1600 */
|
|
1601 init_environment();
|
|
1602 #endif
|
|
1603
|
0
|
1604 init_callproc (); /* Set up the process environment (so that egetenv
|
|
1605 works), the basic directory variables
|
|
1606 (exec-directory and so on), and stuff
|
|
1607 related to subprocesses. This should be
|
|
1608 first because many of the functions below
|
|
1609 call egetenv() to get environment variables. */
|
|
1610 init_lread (); /* Set up the Lisp reader. */
|
|
1611 #ifdef MSDOS
|
|
1612 /* Call early 'cause init_environment needs it. */
|
|
1613 init_dosfns ();
|
|
1614 /* Set defaults for several environment variables. */
|
|
1615 init_environment (argc, argv, skip_args);
|
|
1616 #endif
|
|
1617 init_cmdargs (argc, argv, skip_args); /* Create list Vcommand_line_args */
|
288
|
1618 init_buffer (); /* Set default directory of *scratch* buffer */
|
195
|
1619
|
|
1620 #ifdef WINDOWSNT
|
|
1621 init_ntproc();
|
|
1622 #endif
|
|
1623
|
0
|
1624 init_redisplay (); /* Determine terminal type.
|
|
1625 init_sys_modes uses results */
|
|
1626 init_event_stream (); /* Set up so we can get user input. */
|
|
1627 init_macros (); /* set up so we can run macros. */
|
|
1628 init_editfns (); /* Determine the name of the user we're running as */
|
|
1629 init_xemacs_process (); /* set up for calling subprocesses */
|
|
1630 #ifdef SUNPRO
|
|
1631 init_sunpro (); /* Set up Sunpro usage tracking */
|
|
1632 #endif
|
|
1633 #if defined (HAVE_NATIVE_SOUND) && defined (hp9000s800)
|
|
1634 init_hpplay ();
|
|
1635 #endif
|
|
1636 #ifdef HAVE_TTY
|
|
1637 init_device_tty ();
|
|
1638 #endif
|
|
1639 init_console_stream (); /* Create the first console */
|
|
1640
|
173
|
1641 /* try to get the actual pathname of the exec file we are running */
|
233
|
1642 if (!restart)
|
0
|
1643 {
|
|
1644 Vinvocation_name = Fcar (Vcommand_line_args);
|
233
|
1645 if (XSTRING_DATA(Vinvocation_name)[0] == '-')
|
|
1646 {
|
|
1647 /* XEmacs as a login shell, oh goody! */
|
|
1648 Vinvocation_name = build_string(getenv("SHELL"));
|
|
1649 }
|
0
|
1650 Vinvocation_directory = Vinvocation_name;
|
|
1651
|
|
1652 if (!NILP (Ffile_name_directory (Vinvocation_name)))
|
269
|
1653 {
|
|
1654 /* invocation-name includes a directory component -- presumably it
|
|
1655 is relative to cwd, not $PATH */
|
|
1656 Vinvocation_directory = Fexpand_file_name (Vinvocation_name,
|
|
1657 Qnil);
|
|
1658 Vinvocation_path = Qnil;
|
|
1659 }
|
0
|
1660 else
|
269
|
1661 {
|
|
1662 Vinvocation_path = decode_env_path ("PATH", NULL);
|
|
1663 locate_file (Vinvocation_path, Vinvocation_name, EXEC_SUFFIXES,
|
|
1664 &Vinvocation_directory, X_OK);
|
|
1665 }
|
0
|
1666
|
|
1667 if (NILP (Vinvocation_directory))
|
|
1668 Vinvocation_directory = Vinvocation_name;
|
|
1669
|
|
1670 Vinvocation_name = Ffile_name_nondirectory (Vinvocation_directory);
|
|
1671 Vinvocation_directory = Ffile_name_directory (Vinvocation_directory);
|
|
1672 }
|
|
1673
|
265
|
1674 #if defined(HAVE_SHLIB) && !defined(WINDOWSNT)
|
|
1675 /* This is Unix only. MS Windows NT has a library call that does
|
|
1676 The Right Thing on that system. Rumor has it, this must be
|
|
1677 called for GNU dld in temacs and xemacs. */
|
|
1678 {
|
|
1679 char *buf = (char *)alloca (XSTRING_LENGTH (Vinvocation_directory)
|
|
1680 + XSTRING_LENGTH (Vinvocation_name)
|
|
1681 + 2);
|
|
1682 sprintf (buf, "%s/%s", XSTRING_DATA(Vinvocation_directory),
|
|
1683 XSTRING_DATA(Vinvocation_name));
|
|
1684
|
|
1685 /* All we can do is cry if an error happens, so ignore it. */
|
|
1686 (void)dll_init(buf);
|
|
1687 }
|
|
1688 #endif
|
|
1689
|
0
|
1690 #if defined (LOCALTIME_CACHE) && defined (HAVE_TZSET)
|
|
1691 /* sun's localtime() has a bug. it caches the value of the time
|
|
1692 zone rather than looking it up every time. Since localtime() is
|
|
1693 called to bolt the undumping time into the undumped emacs, this
|
|
1694 results in localtime() ignoring the TZ environment variable.
|
|
1695 This flushes the new TZ value into localtime(). */
|
|
1696 tzset ();
|
|
1697 #endif /* LOCALTIME_CACHE and TZSET */
|
|
1698
|
|
1699 load_me = Qnil;
|
|
1700 if (!initialized)
|
|
1701 {
|
|
1702 /* Handle -l loadup-and-dump, args passed by Makefile. */
|
|
1703 if (argc > 2 + skip_args && !strcmp (argv[1 + skip_args], "-l"))
|
80
|
1704 load_me = build_string (argv[2 + skip_args]);
|
239
|
1705 #if 0 /* CANNOT_DUMP - this can never be right in XEmacs --andyp */
|
0
|
1706 /* Unless next switch is -nl, load "loadup.el" first thing. */
|
|
1707 if (!(argc > 1 + skip_args && !strcmp (argv[1 + skip_args], "-nl")))
|
|
1708 load_me = build_string ("loadup.el");
|
|
1709 #endif /* CANNOT_DUMP */
|
|
1710 }
|
|
1711
|
|
1712 #ifdef QUANTIFY
|
|
1713 if (initialized)
|
|
1714 quantify_start_recording_data ();
|
|
1715 #endif /* QUANTIFY */
|
|
1716
|
|
1717 initialized = 1;
|
|
1718
|
|
1719 /* This never returns. */
|
|
1720 initial_command_loop (load_me);
|
|
1721 /* NOTREACHED */
|
|
1722 }
|
|
1723
|
20
|
1724
|
16
|
1725 /* Sort the args so we can find the most important ones
|
|
1726 at the beginning of argv. */
|
|
1727
|
|
1728 /* First, here's a table of all the standard options. */
|
|
1729
|
|
1730 struct standard_args
|
|
1731 {
|
|
1732 CONST char * CONST name;
|
|
1733 CONST char * CONST longname;
|
|
1734 int priority;
|
|
1735 int nargs;
|
|
1736 };
|
|
1737
|
|
1738 static struct standard_args standard_args[] =
|
|
1739 {
|
|
1740 /* Handled by main_1 above: */
|
|
1741 { "-nl", "--no-shared-memory", 100, 0 },
|
|
1742 { "-t", "--terminal", 95, 1 },
|
|
1743 { "-nw", "--no-windows", 90, 0 },
|
|
1744 { "-batch", "--batch", 85, 0 },
|
276
|
1745 { "-debug-paths", "--debug-paths", 82, 0 },
|
16
|
1746 { "-help", "--help", 80, 0 },
|
|
1747 { "-version", "--version", 75, 0 },
|
|
1748 { "-V", 0, 75, 0 },
|
|
1749 { "-d", "--display", 80, 1 },
|
|
1750 { "-display", 0, 80, 1 },
|
|
1751 { "-NXHost", 0, 79, 0 },
|
|
1752 { "-MachLaunch", 0, 79, 0},
|
|
1753
|
|
1754 /* Handled by command-line-early in startup.el: */
|
|
1755 { "-q", "--no-init-file", 50, 0 },
|
|
1756 { "-unmapped", 0, 50, 0 },
|
|
1757 { "-no-init-file", 0, 50, 0 },
|
207
|
1758 { "-vanilla", "--vanilla", 50, 0 },
|
239
|
1759 { "-no-autoloads", "--no-autoloads", 50, 0 },
|
16
|
1760 { "-no-site-file", "--no-site-file", 40, 0 },
|
276
|
1761 { "-no-early-packages", "--no-early-packages", 35, 0 },
|
16
|
1762 { "-u", "--user", 30, 1 },
|
|
1763 { "-user", 0, 30, 1 },
|
|
1764 { "-debug-init", "--debug-init", 20, 0 },
|
276
|
1765 { "-debug-paths", "--debug-paths", 20, 0 },
|
16
|
1766
|
|
1767 /* Xt options: */
|
|
1768 { "-i", "--icon-type", 15, 0 },
|
|
1769 { "-itype", 0, 15, 0 },
|
|
1770 { "-iconic", "--iconic", 15, 0 },
|
|
1771 { "-bg", "--background-color", 10, 1 },
|
|
1772 { "-background", 0, 10, 1 },
|
|
1773 { "-fg", "--foreground-color", 10, 1 },
|
|
1774 { "-foreground", 0, 10, 1 },
|
|
1775 { "-bd", "--border-color", 10, 1 },
|
|
1776 { "-bw", "--border-width", 10, 1 },
|
|
1777 { "-ib", "--internal-border", 10, 1 },
|
|
1778 { "-ms", "--mouse-color", 10, 1 },
|
|
1779 { "-cr", "--cursor-color", 10, 1 },
|
|
1780 { "-fn", "--font", 10, 1 },
|
|
1781 { "-font", 0, 10, 1 },
|
|
1782 { "-g", "--geometry", 10, 1 },
|
|
1783 { "-geometry", 0, 10, 1 },
|
|
1784 { "-T", "--title", 10, 1 },
|
|
1785 { "-title", 0, 10, 1 },
|
|
1786 { "-name", "--name", 10, 1 },
|
|
1787 { "-xrm", "--xrm", 10, 1 },
|
|
1788 { "-r", "--reverse-video", 5, 0 },
|
|
1789 { "-rv", 0, 5, 0 },
|
|
1790 { "-reverse", 0, 5, 0 },
|
|
1791 { "-hb", "--horizontal-scroll-bars", 5, 0 },
|
|
1792 { "-vb", "--vertical-scroll-bars", 5, 0 },
|
163
|
1793
|
16
|
1794 /* These have the same priority as ordinary file name args,
|
|
1795 so they are not reordered with respect to those. */
|
|
1796 { "-L", "--directory", 0, 1 },
|
|
1797 { "-directory", 0, 0, 1 },
|
|
1798 { "-l", "--load", 0, 1 },
|
|
1799 { "-load", 0, 0, 1 },
|
|
1800 { "-f", "--funcall", 0, 1 },
|
|
1801 { "-funcall", 0, 0, 1 },
|
|
1802 { "-eval", "--eval", 0, 1 },
|
|
1803 { "-insert", "--insert", 0, 1 },
|
|
1804 /* This should be processed after ordinary file name args and the like. */
|
|
1805 { "-kill", "--kill", -10, 0 },
|
|
1806 };
|
|
1807
|
|
1808 /* Reorder the elements of ARGV (assumed to have ARGC elements)
|
|
1809 so that the highest priority ones come first.
|
|
1810 Do not change the order of elements of equal priority.
|
|
1811 If an option takes an argument, keep it and its argument together. */
|
|
1812
|
|
1813 static void
|
|
1814 sort_args (int argc, char **argv)
|
|
1815 {
|
185
|
1816 char **new = xnew_array (char *, argc);
|
16
|
1817 /* For each element of argv,
|
|
1818 the corresponding element of options is:
|
|
1819 0 for an option that takes no arguments,
|
|
1820 1 for an option that takes one argument, etc.
|
|
1821 -1 for an ordinary non-option argument. */
|
185
|
1822 int *options = xnew_array (int, argc);
|
|
1823 int *priority = xnew_array (int, argc);
|
16
|
1824 int to = 1;
|
|
1825 int from;
|
|
1826 int i;
|
78
|
1827 int end_of_options_p = 0;
|
16
|
1828
|
|
1829 /* Categorize all the options,
|
|
1830 and figure out which argv elts are option arguments. */
|
|
1831 for (from = 1; from < argc; from++)
|
|
1832 {
|
|
1833 options[from] = -1;
|
|
1834 priority[from] = 0;
|
78
|
1835 /* Pseudo options "--" and "run-temacs" indicate end of options */
|
|
1836 if (!strcmp (argv[from], "--") ||
|
|
1837 !strcmp (argv[from], "run-temacs"))
|
|
1838 end_of_options_p = 1;
|
|
1839 if (!end_of_options_p && argv[from][0] == '-')
|
16
|
1840 {
|
|
1841 int match, thislen;
|
|
1842 char *equals;
|
|
1843
|
|
1844 /* Look for a match with a known old-fashioned option. */
|
|
1845 for (i = 0; i < countof (standard_args); i++)
|
|
1846 if (!strcmp (argv[from], standard_args[i].name))
|
|
1847 {
|
|
1848 options[from] = standard_args[i].nargs;
|
|
1849 priority[from] = standard_args[i].priority;
|
|
1850 if (from + standard_args[i].nargs >= argc)
|
|
1851 fatal ("Option `%s' requires an argument\n", argv[from]);
|
|
1852 from += standard_args[i].nargs;
|
|
1853 goto done;
|
|
1854 }
|
|
1855
|
|
1856 /* Look for a match with a known long option.
|
|
1857 MATCH is -1 if no match so far, -2 if two or more matches so far,
|
|
1858 >= 0 (the table index of the match) if just one match so far. */
|
|
1859 if (argv[from][1] == '-')
|
|
1860 {
|
|
1861 match = -1;
|
|
1862 thislen = strlen (argv[from]);
|
|
1863 equals = strchr (argv[from], '=');
|
|
1864 if (equals != 0)
|
|
1865 thislen = equals - argv[from];
|
|
1866
|
|
1867 for (i = 0; i < countof (standard_args); i++)
|
|
1868 if (standard_args[i].longname
|
|
1869 && !strncmp (argv[from], standard_args[i].longname,
|
|
1870 thislen))
|
|
1871 {
|
|
1872 if (match == -1)
|
|
1873 match = i;
|
|
1874 else
|
|
1875 match = -2;
|
|
1876 }
|
|
1877
|
|
1878 /* If we found exactly one match, use that. */
|
|
1879 if (match >= 0)
|
|
1880 {
|
|
1881 options[from] = standard_args[match].nargs;
|
|
1882 priority[from] = standard_args[match].priority;
|
|
1883 /* If --OPTION=VALUE syntax is used,
|
|
1884 this option uses just one argv element. */
|
|
1885 if (equals != 0)
|
|
1886 options[from] = 0;
|
|
1887 if (from + options[from] >= argc)
|
|
1888 fatal ("Option `%s' requires an argument\n", argv[from]);
|
|
1889 from += options[from];
|
|
1890 }
|
|
1891 }
|
|
1892 done: ;
|
|
1893 }
|
|
1894 }
|
|
1895
|
|
1896 /* Copy the arguments, in order of decreasing priority, to NEW. */
|
|
1897 new[0] = argv[0];
|
|
1898 while (to < argc)
|
|
1899 {
|
|
1900 int best = -1;
|
|
1901 int best_priority = -9999;
|
|
1902
|
|
1903 /* Find the highest priority remaining option.
|
|
1904 If several have equal priority, take the first of them. */
|
|
1905 for (from = 1; from < argc; from++)
|
|
1906 {
|
|
1907 if (argv[from] != 0 && priority[from] > best_priority)
|
|
1908 {
|
|
1909 best_priority = priority[from];
|
|
1910 best = from;
|
|
1911 }
|
|
1912 /* Skip option arguments--they are tied to the options. */
|
|
1913 if (options[from] > 0)
|
|
1914 from += options[from];
|
|
1915 }
|
163
|
1916
|
16
|
1917 if (best < 0)
|
|
1918 abort ();
|
|
1919
|
|
1920 /* Copy the highest priority remaining option, with its args, to NEW. */
|
|
1921 new[to++] = argv[best];
|
|
1922 for (i = 0; i < options[best]; i++)
|
|
1923 new[to++] = argv[best + i + 1];
|
|
1924
|
|
1925 /* Clear out this option in ARGV. */
|
|
1926 argv[best] = 0;
|
|
1927 for (i = 0; i < options[best]; i++)
|
|
1928 argv[best + i + 1] = 0;
|
|
1929 }
|
|
1930
|
|
1931 memcpy (argv, new, sizeof (char *) * argc);
|
|
1932 }
|
|
1933
|
0
|
1934 static JMP_BUF run_temacs_catch;
|
|
1935
|
|
1936 static int run_temacs_argc;
|
|
1937 static char **run_temacs_argv;
|
|
1938 static char *run_temacs_args;
|
272
|
1939 static size_t run_temacs_argv_size;
|
|
1940 static size_t run_temacs_args_size;
|
0
|
1941
|
20
|
1942 DEFUN ("running-temacs-p", Frunning_temacs_p, 0, 0, 0, /*
|
0
|
1943 True if running temacs. This means we are in the dumping stage.
|
|
1944 This is false during normal execution of the `xemacs' program, and
|
|
1945 becomes false once `run-emacs-from-temacs' is run.
|
20
|
1946 */
|
|
1947 ())
|
0
|
1948 {
|
|
1949 return run_temacs_argc >= 0 ? Qt : Qnil;
|
|
1950 }
|
|
1951
|
20
|
1952 DEFUN ("run-emacs-from-temacs", Frun_emacs_from_temacs, 0, MANY, 0, /*
|
0
|
1953 Do not call this. It will reinitialize your XEmacs. You'll be sorry.
|
20
|
1954 */
|
0
|
1955 /* If this function is called from startup.el, it will be possible to run
|
|
1956 temacs as an editor using 'temacs -batch -l loadup.el run-temacs', instead
|
|
1957 of having to dump an emacs and then run that (when debugging emacs itself,
|
20
|
1958 this can be much faster)). [Actually, the speed difference isn't that
|
0
|
1959 much as long as your filesystem is local, and you don't end up with
|
|
1960 a dumped version in case you want to rerun it. This function is most
|
|
1961 useful when used as part of the `make all-elc' command. --ben]
|
185
|
1962 This will "restart" emacs with the specified command-line arguments.
|
0
|
1963 */
|
70
|
1964 (int nargs, Lisp_Object *args))
|
0
|
1965 {
|
|
1966 int ac;
|
259
|
1967 CONST Extbyte *wampum;
|
0
|
1968 int namesize;
|
|
1969 int total_len;
|
|
1970 Lisp_Object orig_invoc_name = Fcar (Vcommand_line_args);
|
259
|
1971 CONST Extbyte **wampum_all = alloca_array (CONST Extbyte *, nargs);
|
185
|
1972 int *wampum_all_len = alloca_array (int, nargs);
|
0
|
1973
|
|
1974 assert (!gc_in_progress);
|
|
1975
|
|
1976 if (run_temacs_argc < 0)
|
|
1977 error ("I've lost my temacs-hood.");
|
|
1978
|
|
1979 /* Need to convert the orig_invoc_name and all of the arguments
|
|
1980 to external format. */
|
163
|
1981
|
0
|
1982 GET_STRING_EXT_DATA_ALLOCA (orig_invoc_name, FORMAT_OS, wampum,
|
|
1983 namesize);
|
|
1984 namesize++;
|
|
1985
|
|
1986 for (ac = 0, total_len = namesize; ac < nargs; ac++)
|
|
1987 {
|
|
1988 CHECK_STRING (args[ac]);
|
|
1989 GET_STRING_EXT_DATA_ALLOCA (args[ac], FORMAT_OS,
|
|
1990 wampum_all[ac],
|
|
1991 wampum_all_len[ac]);
|
|
1992 wampum_all_len[ac]++;
|
|
1993 total_len += wampum_all_len[ac];
|
|
1994 }
|
|
1995 DO_REALLOC (run_temacs_args, run_temacs_args_size, total_len, char);
|
343
|
1996 DO_REALLOC (run_temacs_argv, run_temacs_argv_size, nargs+2, char *);
|
0
|
1997
|
|
1998 memcpy (run_temacs_args, wampum, namesize);
|
|
1999 run_temacs_argv [0] = run_temacs_args;
|
|
2000 for (ac = 0; ac < nargs; ac++)
|
|
2001 {
|
|
2002 memcpy (run_temacs_args + namesize,
|
|
2003 wampum_all[ac], wampum_all_len[ac]);
|
|
2004 run_temacs_argv [ac + 1] = run_temacs_args + namesize;
|
|
2005 namesize += wampum_all_len[ac];
|
|
2006 }
|
|
2007 run_temacs_argv [nargs + 1] = 0;
|
|
2008 catchlist = NULL; /* Important! Otherwise free_cons() calls in
|
|
2009 condition_case_unwind() may lead to GC death. */
|
|
2010 unbind_to (0, Qnil); /* this closes loadup.el */
|
|
2011 purify_flag = 0;
|
|
2012 run_temacs_argc = nargs + 1;
|
251
|
2013 #ifdef REPORT_PURE_USAGE
|
0
|
2014 report_pure_usage (1, 0);
|
207
|
2015 #else
|
|
2016 report_pure_usage (0, 0);
|
|
2017 #endif
|
0
|
2018 LONGJMP (run_temacs_catch, 1);
|
|
2019 return Qnil; /* not reached; warning suppression */
|
|
2020 }
|
|
2021
|
|
2022 /* ARGSUSED */
|
163
|
2023 int
|
0
|
2024 main (int argc, char **argv, char **envp)
|
|
2025 {
|
16
|
2026 int volatile vol_argc = argc;
|
|
2027 char ** volatile vol_argv = argv;
|
|
2028 char ** volatile vol_envp = envp;
|
233
|
2029 /* This is hairy. We need to compute where the XEmacs binary was invoked */
|
|
2030 /* from because temacs initialization requires it to find the lisp */
|
|
2031 /* directories. The code that recomputes the path is guarded by the */
|
|
2032 /* restarted flag. There are three possible paths I've found so far */
|
|
2033 /* through this: */
|
|
2034 /* temacs -- When running temacs for basic build stuff, the first main_1 */
|
|
2035 /* will be the only one invoked. It must compute the path else there */
|
|
2036 /* will be a very ugly bomb in startup.el (can't find obvious location */
|
|
2037 /* for doc-directory data-directory, etc.). */
|
|
2038 /* temacs w/ run-temacs on the command line -- This is run to bytecompile */
|
|
2039 /* all the out of date dumped lisp. It will execute both of the main_1 */
|
|
2040 /* calls and the second one must not touch the first computation because */
|
|
2041 /* argc/argv are hosed the second time through. */
|
|
2042 /* xemacs -- Only the second main_1 is executed. The invocation path must */
|
|
2043 /* computed but this only matters when running in place or when running */
|
|
2044 /* as a login shell. */
|
|
2045 /* As a bonus for straightening this out, XEmacs can now be run in place */
|
|
2046 /* as a login shell. This never used to work. */
|
|
2047 /* As another bonus, we can now guarantee that */
|
|
2048 /* (concat invocation-directory invocation-name) contains the filename */
|
|
2049 /* of the XEmacs binary we are running. This can now be used in a */
|
|
2050 /* definite test for out of date dumped files. -slb */
|
|
2051 int restarted = 0;
|
0
|
2052 #ifdef QUANTIFY
|
|
2053 quantify_stop_recording_data ();
|
|
2054 quantify_clear_data ();
|
|
2055 #endif /* QUANTIFY */
|
|
2056
|
272
|
2057 suppress_early_error_handler_backtrace = 0;
|
0
|
2058 lim_data = 0; /* force reinitialization of this variable */
|
|
2059
|
78
|
2060 /* Lisp_Object must fit in a word; check VALBITS and GCTYPEBITS */
|
|
2061 assert (sizeof (Lisp_Object) == sizeof (void *));
|
|
2062
|
255
|
2063 #ifdef LINUX_SBRK_BUG
|
|
2064 sbrk (1);
|
|
2065 #endif
|
|
2066
|
0
|
2067 if (!initialized)
|
78
|
2068 {
|
255
|
2069 #ifdef DOUG_LEA_MALLOC
|
|
2070 mallopt (M_MMAP_MAX, 0);
|
|
2071 #endif
|
78
|
2072 run_temacs_argc = 0;
|
|
2073 if (! SETJMP (run_temacs_catch))
|
233
|
2074 {
|
|
2075 main_1 (vol_argc, vol_argv, vol_envp, 0);
|
|
2076 }
|
78
|
2077 /* run-emacs-from-temacs called */
|
233
|
2078 restarted = 1;
|
78
|
2079 vol_argc = run_temacs_argc;
|
|
2080 vol_argv = run_temacs_argv;
|
0
|
2081 #ifdef _SCO_DS
|
78
|
2082 /* This makes absolutely no sense to anyone involved. There are
|
|
2083 several people using this stuff. We've compared versions on
|
|
2084 everything we can think of. We can find no difference.
|
|
2085 However, on both my systems environ is a plain old global
|
|
2086 variable initialized to zero. _environ is the one that
|
|
2087 contains pointers to the actual environment.
|
163
|
2088
|
78
|
2089 Since we can't figure out the difference (and we're hours
|
|
2090 away from a release), this takes a very cowardly approach and
|
|
2091 is bracketed with both a system specific preprocessor test
|
|
2092 and a runtime "do you have this problem" test
|
163
|
2093
|
78
|
2094 06/20/96 robertl@dgii.com */
|
|
2095 {
|
363
|
2096 extern char **_environ;
|
78
|
2097 if ((unsigned) environ == 0)
|
|
2098 environ=_environ;
|
|
2099 }
|
16
|
2100 #endif /* _SCO_DS */
|
80
|
2101 vol_envp = environ;
|
|
2102 }
|
272
|
2103 #ifdef RUN_TIME_REMAP
|
|
2104 else
|
|
2105 /* obviously no-one uses this because where it was before initalized was
|
|
2106 *always* true */
|
245
|
2107 run_time_remap (argv[0]);
|
|
2108 #endif
|
|
2109
|
255
|
2110 #ifdef DOUG_LEA_MALLOC
|
|
2111 if (initialized && (malloc_state_ptr != NULL))
|
|
2112 {
|
272
|
2113 int rc = malloc_set_state (malloc_state_ptr);
|
|
2114 if (rc != 0)
|
|
2115 {
|
|
2116 fprintf (stderr, "malloc_set_state failed, rc = %d\n", rc);
|
|
2117 abort ();
|
|
2118 }
|
255
|
2119 #if 0
|
|
2120 free (malloc_state_ptr);
|
|
2121 #endif
|
259
|
2122 /* mmap works in glibc-2.1, glibc-2.0 (Non-Mule only) and Linux libc5 */
|
|
2123 #if (defined(__GLIBC__) && __GLIBC_MINOR__ >= 1) || \
|
|
2124 defined(_NO_MALLOC_WARNING_) || \
|
|
2125 (defined(__GLIBC__) && __GLIBC_MINOR__ < 1 && !defined(MULE)) || \
|
|
2126 defined(DEBUG_DOUG_LEA_MALLOC)
|
255
|
2127 mallopt (M_MMAP_MAX, 64);
|
|
2128 #endif
|
|
2129 #ifdef REL_ALLOC
|
|
2130 r_alloc_reinit ();
|
|
2131 #endif
|
|
2132 }
|
272
|
2133 #endif /* DOUG_LEA_MALLOC */
|
255
|
2134
|
0
|
2135 run_temacs_argc = -1;
|
|
2136
|
233
|
2137 main_1 (vol_argc, vol_argv, vol_envp, restarted);
|
163
|
2138 return 0; /* unreached */
|
0
|
2139 }
|
|
2140
|
|
2141
|
272
|
2142 /* Dumping apparently isn't supported by versions of GCC >= 2.8. */
|
|
2143 /* The following needs conditionalization on whether either XEmacs or */
|
|
2144 /* various system shared libraries have been built and linked with */
|
|
2145 /* GCC >= 2.8. -slb */
|
|
2146 #if defined(GNU_MALLOC)
|
|
2147 static void
|
|
2148 voodoo_free_hook(void *mem)
|
|
2149 {
|
|
2150 /* Disable all calls to free() when XEmacs is exiting and it doesn't */
|
|
2151 /* matter. */
|
|
2152 __free_hook = voodoo_free_hook;
|
|
2153 }
|
|
2154 #endif
|
|
2155
|
20
|
2156 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /*
|
0
|
2157 Exit the XEmacs job and kill it. Ask for confirmation, without argument.
|
|
2158 If ARG is an integer, return ARG as the exit program code.
|
|
2159 If ARG is a string, stuff it as keyboard input.
|
|
2160
|
|
2161 The value of `kill-emacs-hook', if not void,
|
|
2162 is a list of functions (of no args),
|
|
2163 all of which are called before XEmacs is actually killed.
|
20
|
2164 */
|
|
2165 (arg))
|
0
|
2166 {
|
|
2167 /* This function can GC */
|
|
2168 struct gcpro gcpro1;
|
|
2169
|
|
2170 GCPRO1 (arg);
|
|
2171
|
|
2172 if (feof (stdin))
|
|
2173 arg = Qt;
|
|
2174
|
|
2175 if (!preparing_for_armageddon && !noninteractive)
|
|
2176 run_hook (Qkill_emacs_hook);
|
|
2177
|
|
2178 /* make sure no quitting from now on!! */
|
|
2179 dont_check_for_quit = 1;
|
|
2180 Vinhibit_quit = Qt;
|
|
2181
|
|
2182 if (!preparing_for_armageddon)
|
|
2183 {
|
267
|
2184 Lisp_Object concons, nextcons;
|
0
|
2185
|
|
2186 /* Normally, go ahead and delete all the consoles now.
|
|
2187 Some unmentionably lame window systems (MS Wwwww...... eek,
|
|
2188 I can't even say it) don't properly clean up after themselves,
|
|
2189 and even for those that do, it might be cleaner this way.
|
|
2190 If we're going down, however, we don't do this (might
|
|
2191 be too dangerous), and if we get a crash somewhere within
|
|
2192 this loop, we'll still autosave and won't try this again. */
|
267
|
2193
|
|
2194 LIST_LOOP_DELETING(concons, nextcons, Vconsole_list)
|
|
2195 {
|
|
2196 /* There is very little point in deleting the stream console.
|
|
2197 It uses stdio, which should flush any buffered output and
|
|
2198 something can only go wrong. -slb */
|
|
2199 /* I changed my mind. There's a stupid hack in close to add
|
|
2200 a trailing newline. */
|
|
2201 /*if (!CONSOLE_STREAM_P (XCONSOLE (XCAR (concons))))*/
|
|
2202 delete_console_internal (XCONSOLE (XCAR (concons)), 1, 1, 0);
|
|
2203 }
|
0
|
2204 }
|
|
2205
|
|
2206 UNGCPRO;
|
|
2207
|
|
2208 shut_down_emacs (0, ((STRINGP (arg)) ? arg : Qnil));
|
|
2209
|
272
|
2210 #if defined(GNU_MALLOC)
|
|
2211 __free_hook = voodoo_free_hook;
|
|
2212 #endif
|
|
2213
|
207
|
2214 exit ((INTP (arg)) ? XINT (arg) : 0);
|
0
|
2215 /* NOTREACHED */
|
|
2216 return Qnil; /* I'm sick of the compiler warning */
|
|
2217 }
|
|
2218
|
|
2219 /* Perform an orderly shutdown of XEmacs. Autosave any modified
|
|
2220 buffers, kill any child processes, clean up the terminal modes (if
|
|
2221 we're in the foreground), and other stuff like that. Don't perform
|
|
2222 any redisplay; this may be called when XEmacs is shutting down in
|
|
2223 the background, or after its X connection has died.
|
|
2224
|
|
2225 If SIG is a signal number, print a message for it.
|
|
2226
|
|
2227 This is called by fatal signal handlers, X protocol error handlers,
|
|
2228 and Fkill_emacs. */
|
|
2229 static void
|
|
2230 shut_down_emacs (int sig, Lisp_Object stuff)
|
|
2231 {
|
|
2232 /* This function can GC */
|
|
2233 /* Prevent running of hooks and other non-essential stuff
|
|
2234 from now on. */
|
|
2235 preparing_for_armageddon = 1;
|
|
2236
|
|
2237 /* In case frames or windows are screwed up, avoid assertion
|
|
2238 failures here */
|
|
2239 Vinhibit_quit = Qt;
|
|
2240
|
|
2241 #ifdef QUANTIFY
|
|
2242 quantify_stop_recording_data ();
|
|
2243 #endif /* QUANTIFY */
|
|
2244
|
263
|
2245 #if 0
|
0
|
2246 /* This is absolutely the most important thing to do, so make sure
|
|
2247 we do it now, before anything else. We might have crashed and
|
|
2248 be in a weird inconsistent state, and potentially anything could
|
|
2249 set off another protection fault and cause us to bail out
|
|
2250 immediately. */
|
263
|
2251 /* I'm not removing the code entirely, yet. We have run up against
|
|
2252 a spate of problems in diagnosing crashes due to crashes within
|
|
2253 crashes. It has very definitely been determined that code called
|
|
2254 during auto-saving cannot work if XEmacs crashed inside of GC.
|
|
2255 We already auto-save on an itimer so there cannot be too much
|
|
2256 unsaved stuff around, and if we get better crash reports we might
|
|
2257 be able to get more problems fixed so I'm disabling this. -slb */
|
0
|
2258 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */
|
263
|
2259 #endif
|
0
|
2260
|
|
2261 fflush (stdout);
|
|
2262 reset_all_consoles ();
|
|
2263 if (sig && sig != SIGTERM)
|
|
2264 {
|
|
2265 stderr_out ("\nFatal error (%d).\n", sig);
|
|
2266 stderr_out
|
|
2267 ("Your files have been auto-saved.\n"
|
|
2268 "Use `M-x recover-session' to recover them.\n"
|
|
2269 "\n"
|
359
|
2270 "If you have access to the PROBLEMS file that came with your\n"
|
|
2271 "version of XEmacs, please check to see if your crash is described\n"
|
|
2272 "there, as there may be a workaround available.\n"
|
282
|
2273 #ifdef INFODOCK
|
359
|
2274 "Otherwise, please report this bug by selecting `Report-Bug'\n"
|
|
2275 "in the InfoDock menu.\n"
|
282
|
2276 #else
|
359
|
2277 "Otherwise, please report this bug by running the send-pr\n"
|
|
2278 "script included with XEmacs, or selecting `Send Bug Report'\n"
|
|
2279 "from the help menu.\n"
|
126
|
2280 "As a last resort send ordinary email to `crashes@xemacs.org'.\n"
|
282
|
2281 #endif
|
|
2282 "*MAKE SURE* to include the information in the command\n"
|
|
2283 "M-x describe-installation.\n"
|
2
|
2284 "\n"
|
0
|
2285 "If at all possible, *please* try to obtain a C stack backtrace;\n"
|
|
2286 "it will help us immensely in determining what went wrong.\n"
|
|
2287 "To do this, locate the core file that was produced as a result\n"
|
|
2288 "of this crash (it's usually called `core' and is located in the\n"
|
282
|
2289 "directory in which you started the editor, or maybe in your home\n"
|
0
|
2290 "directory), and type\n"
|
|
2291 "\n"
|
|
2292 " gdb ");
|
|
2293 {
|
2
|
2294 CONST char *name;
|
0
|
2295 char *dir = 0;
|
|
2296
|
|
2297 /* Now try to determine the actual path to the executable,
|
|
2298 to try to make the backtrace-determination process as foolproof
|
|
2299 as possible. */
|
|
2300 if (GC_STRINGP (Vinvocation_name))
|
14
|
2301 name = (char *) XSTRING_DATA (Vinvocation_name);
|
0
|
2302 else
|
|
2303 name = "xemacs";
|
|
2304 if (GC_STRINGP (Vinvocation_directory))
|
14
|
2305 dir = (char *) XSTRING_DATA (Vinvocation_directory);
|
0
|
2306 if (!dir || dir[0] != '/')
|
|
2307 stderr_out ("`which %s`", name);
|
|
2308 else if (dir[strlen (dir) - 1] != '/')
|
|
2309 stderr_out ("%s/%s", dir, name);
|
|
2310 else
|
|
2311 stderr_out ("%s%s", dir, name);
|
|
2312 }
|
|
2313 stderr_out
|
|
2314 (" core\n\n"
|
|
2315 "then type `where' when the debugger prompt comes up.\n"
|
|
2316 "(If you don't have GDB on your system, you might have DBX,\n"
|
|
2317 "or XDB, or SDB. A similar procedure should work for all of\n"
|
|
2318 "these. Ask your system administrator if you need more help.)\n");
|
|
2319 }
|
|
2320
|
|
2321 stuff_buffered_input (stuff);
|
|
2322
|
|
2323 kill_buffer_processes (Qnil);
|
|
2324
|
|
2325 #ifdef CLASH_DETECTION
|
|
2326 unlock_all_files ();
|
|
2327 #endif
|
|
2328
|
|
2329 #ifdef TOOLTALK
|
|
2330 tt_session_quit (tt_default_session ());
|
2
|
2331 #if 0
|
|
2332 /* The following crashes when built on X11R5 and run on X11R6 */
|
0
|
2333 tt_close ();
|
|
2334 #endif
|
2
|
2335 #endif /* TOOLTALK */
|
0
|
2336
|
|
2337 }
|
|
2338
|
|
2339
|
|
2340 #ifndef CANNOT_DUMP
|
|
2341 /* Nothing like this can be implemented on an Apollo.
|
|
2342 What a loss! */
|
|
2343
|
2
|
2344 extern char my_edata[];
|
0
|
2345
|
|
2346 #ifdef HAVE_SHM
|
|
2347
|
20
|
2348 DEFUN ("dump-emacs-data", Fdump_emacs_data, 1, 1, 0, /*
|
0
|
2349 Dump current state of XEmacs into data file FILENAME.
|
|
2350 This function exists on systems that use HAVE_SHM.
|
20
|
2351 */
|
|
2352 (intoname))
|
0
|
2353 {
|
|
2354 /* This function can GC */
|
|
2355 int opurify;
|
|
2356 struct gcpro gcpro1;
|
|
2357 GCPRO1 (intoname);
|
|
2358
|
|
2359 CHECK_STRING (intoname);
|
|
2360 intoname = Fexpand_file_name (intoname, Qnil);
|
|
2361
|
|
2362 opurify = purify_flag;
|
|
2363 purify_flag = 0;
|
|
2364
|
|
2365 fflush (stderr);
|
|
2366 fflush (stdout);
|
|
2367
|
|
2368 disksave_object_finalization ();
|
|
2369 release_breathing_space ();
|
|
2370
|
|
2371 /* Tell malloc where start of impure now is */
|
|
2372 /* Also arrange for warnings when nearly out of space. */
|
|
2373 #ifndef SYSTEM_MALLOC
|
173
|
2374 memory_warnings (my_edata, malloc_warning);
|
0
|
2375 #endif
|
|
2376 UNGCPRO;
|
14
|
2377 map_out_data (XSTRING_DATA (intoname));
|
0
|
2378
|
|
2379 purify_flag = opurify;
|
|
2380
|
|
2381 return Qnil;
|
|
2382 }
|
|
2383
|
|
2384 #else /* not HAVE_SHM */
|
272
|
2385 extern void disable_free_hook (void);
|
0
|
2386
|
20
|
2387 DEFUN ("dump-emacs", Fdump_emacs, 2, 2, 0, /*
|
0
|
2388 Dump current state of XEmacs into executable file FILENAME.
|
|
2389 Take symbols from SYMFILE (presumably the file you executed to run XEmacs).
|
|
2390 This is used in the file `loadup.el' when building XEmacs.
|
|
2391
|
|
2392 Remember to set `command-line-processed' to nil before dumping
|
|
2393 if you want the dumped XEmacs to process its command line
|
|
2394 and announce itself normally when it is run.
|
20
|
2395 */
|
|
2396 (intoname, symname))
|
0
|
2397 {
|
|
2398 /* This function can GC */
|
|
2399 struct gcpro gcpro1, gcpro2;
|
|
2400 int opurify;
|
|
2401
|
|
2402 GCPRO2 (intoname, symname);
|
|
2403
|
|
2404 #ifdef FREE_CHECKING
|
|
2405 Freally_free (Qnil);
|
|
2406
|
|
2407 /* When we're dumping, we can't use the debugging free() */
|
274
|
2408 disable_free_hook ();
|
272
|
2409 #endif
|
|
2410 #if 1 /* martin */
|
0
|
2411 #endif
|
|
2412
|
|
2413 CHECK_STRING (intoname);
|
|
2414 intoname = Fexpand_file_name (intoname, Qnil);
|
|
2415 if (!NILP (symname))
|
|
2416 {
|
|
2417 CHECK_STRING (symname);
|
14
|
2418 if (XSTRING_LENGTH (symname) > 0)
|
0
|
2419 symname = Fexpand_file_name (symname, Qnil);
|
|
2420 else
|
|
2421 symname = Qnil;
|
|
2422 }
|
|
2423
|
|
2424 opurify = purify_flag;
|
|
2425 purify_flag = 0;
|
|
2426
|
207
|
2427 #ifdef DEBUG_XEMACS
|
0
|
2428 report_pure_usage (1, 1);
|
207
|
2429 #else
|
|
2430 report_pure_usage (0, 1);
|
|
2431 #endif
|
0
|
2432
|
|
2433 fflush (stderr);
|
|
2434 fflush (stdout);
|
|
2435
|
|
2436 disksave_object_finalization ();
|
|
2437 release_breathing_space ();
|
|
2438
|
|
2439 /* Tell malloc where start of impure now is */
|
|
2440 /* Also arrange for warnings when nearly out of space. */
|
|
2441 #ifndef SYSTEM_MALLOC
|
173
|
2442 memory_warnings (my_edata, malloc_warning);
|
0
|
2443 #endif
|
|
2444
|
|
2445 UNGCPRO;
|
|
2446
|
|
2447 #if defined (MSDOS) && defined (EMX)
|
|
2448 {
|
14
|
2449 int fd = open ((char *) XSTRING_DATA (intoname),
|
0
|
2450 O_WRONLY|O_CREAT|O_TRUNC, S_IREAD|S_IWRITE);
|
|
2451 if (!fd) {
|
14
|
2452 error ("Failure operating on %s", XSTRING_DATA (intoname));
|
0
|
2453 } else {
|
|
2454 _core (fd);
|
|
2455 close (fd);
|
|
2456 }
|
|
2457 }
|
|
2458 #else /* not MSDOS and EMX */
|
|
2459 {
|
272
|
2460 char *intoname_ext;
|
|
2461 char *symname_ext;
|
0
|
2462
|
|
2463 GET_C_STRING_FILENAME_DATA_ALLOCA (intoname, intoname_ext);
|
|
2464 if (STRINGP (symname))
|
|
2465 GET_C_STRING_FILENAME_DATA_ALLOCA (symname, symname_ext);
|
|
2466 else
|
|
2467 symname_ext = 0;
|
272
|
2468
|
|
2469 garbage_collect_1 ();
|
255
|
2470 #ifdef DOUG_LEA_MALLOC
|
272
|
2471 malloc_state_ptr = malloc_get_state ();
|
|
2472 #endif
|
|
2473 /* here we break our rule that the filename conversion should
|
|
2474 be performed at the actual time that the system call is made.
|
|
2475 It's a whole lot easier to do the conversion here than to
|
|
2476 modify all the unexec routines to ensure that filename
|
|
2477 conversion is applied everywhere. Don't worry about memory
|
|
2478 leakage because this call only happens once. */
|
|
2479 unexec (intoname_ext, symname_ext, (uintptr_t) my_edata, 0, 0);
|
255
|
2480 #ifdef DOUG_LEA_MALLOC
|
|
2481 free (malloc_state_ptr);
|
|
2482 #endif
|
0
|
2483 }
|
|
2484 #endif /* not MSDOS and EMX */
|
|
2485
|
|
2486 purify_flag = opurify;
|
|
2487
|
|
2488 return Qnil;
|
|
2489 }
|
|
2490
|
|
2491 #endif /* not HAVE_SHM */
|
|
2492
|
|
2493 #endif /* not CANNOT_DUMP */
|
|
2494
|
|
2495 #ifndef SEPCHAR
|
|
2496 #define SEPCHAR ':'
|
|
2497 #endif
|
|
2498
|
284
|
2499 /* Split STRING into a list of substrings. The substrings are the
|
|
2500 parts of original STRING separated by SEPCHAR. */
|
|
2501 static Lisp_Object
|
|
2502 split_string_by_emchar_1 (CONST Bufbyte *string, Bytecount size,
|
|
2503 Emchar sepchar)
|
265
|
2504 {
|
284
|
2505 Lisp_Object result = Qnil;
|
|
2506 CONST Bufbyte *end = string + size;
|
|
2507
|
|
2508 while (1)
|
|
2509 {
|
|
2510 CONST Bufbyte *p = string;
|
|
2511 while (p < end)
|
|
2512 {
|
|
2513 if (charptr_emchar (p) == sepchar)
|
|
2514 break;
|
|
2515 INC_CHARPTR (p);
|
|
2516 }
|
|
2517 result = Fcons (make_string (string, p - string), result);
|
|
2518 if (p < end)
|
|
2519 {
|
|
2520 string = p;
|
|
2521 INC_CHARPTR (string); /* skip sepchar */
|
|
2522 }
|
|
2523 else
|
|
2524 break;
|
|
2525 }
|
|
2526 return Fnreverse (result);
|
265
|
2527 }
|
|
2528
|
284
|
2529 /* The same as the above, except PATH is an external C string (it is
|
|
2530 converted as FORMAT_FILENAME), and sepchar is hardcoded to SEPCHAR
|
|
2531 (':' or whatever). */
|
0
|
2532 Lisp_Object
|
177
|
2533 decode_path (CONST char *path)
|
0
|
2534 {
|
284
|
2535 int len;
|
|
2536 Bufbyte *newpath;
|
|
2537 if (!path)
|
|
2538 return Qnil;
|
|
2539
|
|
2540 GET_C_CHARPTR_INT_FILENAME_DATA_ALLOCA (path, newpath);
|
|
2541
|
321
|
2542 len = strlen ((const char *) newpath);
|
284
|
2543 /* #### Does this make sense? It certainly does for
|
|
2544 decode_env_path(), but it looks dubious here. Does any code
|
|
2545 depend on decode_path("") returning nil instead of an empty
|
|
2546 string? */
|
|
2547 if (!len)
|
|
2548 return Qnil;
|
|
2549
|
|
2550 return split_string_by_emchar_1 (newpath, (Bytecount)len, SEPCHAR);
|
0
|
2551 }
|
|
2552
|
177
|
2553 Lisp_Object
|
|
2554 decode_env_path (CONST char *evarname, CONST char *default_)
|
|
2555 {
|
284
|
2556 CONST char *path = 0;
|
177
|
2557 if (evarname)
|
284
|
2558 path = egetenv (evarname);
|
177
|
2559 if (!path)
|
|
2560 path = default_;
|
284
|
2561 return decode_path (path);
|
|
2562 }
|
|
2563
|
|
2564 /* Ben thinks this function should not exist or be exported to Lisp.
|
|
2565 We use it to define split-path-string in subr.el (not!). */
|
|
2566
|
|
2567 DEFUN ("split-string-by-char", Fsplit_string_by_char, 1, 2, 0, /*
|
|
2568 Split STRING into a list of substrings originally separated by SEPCHAR.
|
|
2569 */
|
|
2570 (string, sepchar))
|
|
2571 {
|
|
2572 CHECK_STRING (string);
|
|
2573 CHECK_CHAR (sepchar);
|
|
2574 return split_string_by_emchar_1 (XSTRING_DATA (string),
|
|
2575 XSTRING_LENGTH (string),
|
|
2576 XCHAR (sepchar));
|
177
|
2577 }
|
|
2578
|
284
|
2579 /* #### This was supposed to be in subr.el, but is used VERY early in
|
|
2580 the bootstrap process, so it goes here. Damn. */
|
|
2581
|
|
2582 DEFUN ("split-path", Fsplit_path, 1, 1, 0, /*
|
|
2583 Explode a search path into a list of strings.
|
|
2584 The path components are separated with the characters specified
|
|
2585 with `path-separator'.
|
|
2586 */
|
|
2587 (path))
|
|
2588 {
|
|
2589 CHECK_STRING (path);
|
|
2590
|
|
2591 while (!STRINGP (Vpath_separator)
|
|
2592 || (XSTRING_CHAR_LENGTH (Vpath_separator) != 1))
|
|
2593 Vpath_separator = signal_simple_continuable_error
|
|
2594 ("`path-separator' should be set to a single-character string",
|
|
2595 Vpath_separator);
|
|
2596
|
|
2597 return (split_string_by_emchar_1
|
|
2598 (XSTRING_DATA (path), XSTRING_LENGTH (path),
|
|
2599 charptr_emchar (XSTRING_DATA (Vpath_separator))));
|
|
2600 }
|
|
2601
|
20
|
2602 DEFUN ("noninteractive", Fnoninteractive, 0, 0, 0, /*
|
0
|
2603 Non-nil return value means XEmacs is running without interactive terminal.
|
20
|
2604 */
|
|
2605 ())
|
0
|
2606 {
|
173
|
2607 return noninteractive ? Qt : Qnil;
|
0
|
2608 }
|
|
2609
|
|
2610 /* This flag is useful to define if you're under a debugger; this way, you
|
|
2611 can put a breakpoint of assert_failed() and debug multiple problems
|
|
2612 in one session without having to recompile. */
|
|
2613 /* #define ASSERTIONS_DONT_ABORT */
|
|
2614
|
70
|
2615 #ifdef USE_ASSERTIONS
|
0
|
2616 /* This highly dubious kludge ... shut up Jamie, I'm tired of your slagging. */
|
|
2617
|
|
2618 DOESNT_RETURN
|
|
2619 assert_failed (CONST char *file, int line, CONST char *expr)
|
|
2620 {
|
|
2621 stderr_out ("Fatal error: assertion failed, file %s, line %d, %s\n",
|
|
2622 file, line, expr);
|
|
2623 #undef abort /* avoid infinite #define loop... */
|
272
|
2624 #if defined (WINDOWSNT) && defined (DEBUG_XEMACS)
|
227
|
2625 DebugBreak ();
|
|
2626 #elif !defined (ASSERTIONS_DONT_ABORT)
|
0
|
2627 abort ();
|
|
2628 #endif
|
|
2629 }
|
70
|
2630 #endif /* USE_ASSERTIONS */
|
0
|
2631
|
|
2632 #ifdef QUANTIFY
|
280
|
2633 DEFUN ("quantify-start-recording-data", Fquantify_start_recording_data,
|
|
2634 0, 0, 0, /*
|
0
|
2635 Start recording Quantify data.
|
20
|
2636 */
|
|
2637 ())
|
0
|
2638 {
|
|
2639 quantify_start_recording_data ();
|
|
2640 return Qnil;
|
|
2641 }
|
|
2642
|
280
|
2643 DEFUN ("quantify-stop-recording-data", Fquantify_stop_recording_data,
|
|
2644 0, 0, 0, /*
|
0
|
2645 Stop recording Quantify data.
|
20
|
2646 */
|
|
2647 ())
|
0
|
2648 {
|
|
2649 quantify_stop_recording_data ();
|
|
2650 return Qnil;
|
|
2651 }
|
|
2652
|
20
|
2653 DEFUN ("quantify-clear-data", Fquantify_clear_data, 0, 0, 0, /*
|
0
|
2654 Clear all Quantify data.
|
20
|
2655 */
|
|
2656 ())
|
0
|
2657 {
|
|
2658 quantify_clear_data ();
|
|
2659 return Qnil;
|
|
2660 }
|
|
2661 #endif /* QUANTIFY */
|
|
2662
|
|
2663 void
|
|
2664 syms_of_emacs (void)
|
|
2665 {
|
|
2666 #ifndef CANNOT_DUMP
|
|
2667 #ifdef HAVE_SHM
|
20
|
2668 DEFSUBR (Fdump_emacs_data);
|
0
|
2669 #else
|
20
|
2670 DEFSUBR (Fdump_emacs);
|
0
|
2671 #endif
|
|
2672 #endif /* !CANNOT_DUMP */
|
|
2673
|
20
|
2674 DEFSUBR (Frun_emacs_from_temacs);
|
|
2675 DEFSUBR (Frunning_temacs_p);
|
|
2676 DEFSUBR (Finvocation_name);
|
|
2677 DEFSUBR (Finvocation_directory);
|
|
2678 DEFSUBR (Fkill_emacs);
|
|
2679 DEFSUBR (Fnoninteractive);
|
0
|
2680
|
|
2681 #ifdef QUANTIFY
|
20
|
2682 DEFSUBR (Fquantify_start_recording_data);
|
|
2683 DEFSUBR (Fquantify_stop_recording_data);
|
|
2684 DEFSUBR (Fquantify_clear_data);
|
0
|
2685 #endif /* QUANTIFY */
|
|
2686
|
284
|
2687 DEFSUBR (Fsplit_string_by_char);
|
|
2688 DEFSUBR (Fsplit_path); /* #### */
|
265
|
2689
|
0
|
2690 defsymbol (&Qkill_emacs_hook, "kill-emacs-hook");
|
|
2691 defsymbol (&Qsave_buffers_kill_emacs, "save-buffers-kill-emacs");
|
|
2692 }
|
|
2693
|
|
2694 void
|
|
2695 vars_of_emacs (void)
|
|
2696 {
|
|
2697 DEFVAR_BOOL ("suppress-early-error-handler-backtrace",
|
272
|
2698 &suppress_early_error_handler_backtrace /*
|
|
2699 Non-nil means early error handler shouldn't print a backtrace.
|
0
|
2700 */ );
|
|
2701
|
|
2702 DEFVAR_LISP ("command-line-args", &Vcommand_line_args /*
|
|
2703 Args passed by shell to XEmacs, as a list of strings.
|
|
2704 */ );
|
|
2705
|
|
2706 DEFVAR_LISP ("invocation-name", &Vinvocation_name /*
|
|
2707 The program name that was used to run XEmacs.
|
|
2708 Any directory names are omitted.
|
|
2709 */ );
|
|
2710
|
|
2711 DEFVAR_LISP ("invocation-directory", &Vinvocation_directory /*
|
|
2712 The directory in which the XEmacs executable was found, to run it.
|
|
2713 The value is simply the program name if that directory's name is not known.
|
|
2714 */ );
|
|
2715
|
269
|
2716 DEFVAR_LISP ("invocation-path", &Vinvocation_path /*
|
|
2717 The path in which the XEmacs executable was found, to run it.
|
|
2718 The value is simply the value of environment variable PATH on startup
|
|
2719 if XEmacs was found there.
|
|
2720 */ );
|
|
2721
|
0
|
2722 #if 0 /* FSFmacs */
|
|
2723 xxDEFVAR_LISP ("installation-directory", &Vinstallation_directory,
|
|
2724 "A directory within which to look for the `lib-src' and `etc' directories.\n"
|
|
2725 "This is non-nil when we can't find those directories in their standard\n"
|
|
2726 "installed locations, but we can find them\n"
|
|
2727 "near where the XEmacs executable was found.");
|
|
2728 #endif
|
|
2729
|
|
2730 DEFVAR_LISP ("system-type", &Vsystem_type /*
|
272
|
2731 Symbol indicating type of operating system you are using.
|
0
|
2732 */ );
|
|
2733 Vsystem_type = intern (SYSTEM_TYPE);
|
169
|
2734 Fprovide (intern(SYSTEM_TYPE));
|
0
|
2735
|
|
2736 #ifndef EMACS_CONFIGURATION
|
|
2737 # define EMACS_CONFIGURATION "UNKNOWN"
|
|
2738 #endif
|
|
2739 DEFVAR_LISP ("system-configuration", &Vsystem_configuration /*
|
272
|
2740 String naming the configuration XEmacs was built for.
|
0
|
2741 */ );
|
|
2742 Vsystem_configuration = Fpurecopy (build_string (EMACS_CONFIGURATION));
|
|
2743
|
175
|
2744 #ifndef EMACS_CONFIG_OPTIONS
|
|
2745 # define EMACS_CONFIG_OPTIONS "UNKNOWN"
|
|
2746 #endif
|
|
2747 DEFVAR_LISP ("system-configuration-options", &Vsystem_configuration_options /*
|
|
2748 String containing the configuration options XEmacs was built with.
|
|
2749 */ );
|
|
2750 Vsystem_configuration_options = Fpurecopy (build_string
|
|
2751 (EMACS_CONFIG_OPTIONS));
|
|
2752
|
165
|
2753 DEFVAR_LISP ("emacs-major-version", &Vemacs_major_version /*
|
|
2754 Major version number of this version of Emacs, as an integer.
|
|
2755 Warning: this variable did not exist in Emacs versions earlier than:
|
|
2756 FSF Emacs: 19.23
|
|
2757 XEmacs: 19.10
|
|
2758 */ );
|
|
2759 Vemacs_major_version = make_int (EMACS_MAJOR_VERSION);
|
|
2760
|
|
2761 DEFVAR_LISP ("emacs-minor-version", &Vemacs_minor_version /*
|
|
2762 Minor version number of this version of Emacs, as an integer.
|
|
2763 Warning: this variable did not exist in Emacs versions earlier than:
|
|
2764 FSF Emacs: 19.23
|
|
2765 XEmacs: 19.10
|
|
2766 */ );
|
|
2767 Vemacs_minor_version = make_int (EMACS_MINOR_VERSION);
|
|
2768
|
343
|
2769 DEFVAR_LISP ("emacs-patch-level", &Vemacs_patch_level /*
|
|
2770 The patch level of this version of Emacs, as an integer.
|
|
2771 The value is non-nil if this version of XEmacs is part of a series of
|
|
2772 stable XEmacsen, but has bug fixes applied.
|
|
2773 Warning: this variable does not exist in FSF Emacs or in XEmacs versions
|
|
2774 earlier than 21.1.1
|
|
2775 */ );
|
|
2776 #ifdef EMACS_PATCH_LEVEL
|
|
2777 Vemacs_patch_level = make_int (EMACS_PATCH_LEVEL);
|
|
2778 #else
|
|
2779 Vemacs_patch_level = Qnil;
|
|
2780 #endif
|
|
2781
|
|
2782 DEFVAR_LISP ("emacs-beta-version", &Vemacs_beta_version /*
|
163
|
2783 Beta number of this version of Emacs, as an integer.
|
|
2784 The value is nil if this is an officially released version of XEmacs.
|
|
2785 Warning: this variable does not exist in FSF Emacs or in XEmacs versions
|
|
2786 earlier than 20.3.
|
|
2787 */ );
|
165
|
2788 #ifdef EMACS_BETA_VERSION
|
|
2789 Vemacs_beta_version = make_int (EMACS_BETA_VERSION);
|
|
2790 #else
|
|
2791 Vemacs_beta_version = Qnil;
|
163
|
2792 #endif
|
|
2793
|
278
|
2794 #ifdef INFODOCK
|
|
2795 DEFVAR_LISP ("infodock-major-version", &Vinfodock_major_version /*
|
|
2796 Major version number of this InfoDock release.
|
|
2797 */ );
|
|
2798 Vinfodock_major_version = make_int (INFODOCK_MAJOR_VERSION);
|
|
2799
|
|
2800 DEFVAR_LISP ("infodock-minor-version", &Vinfodock_minor_version /*
|
|
2801 Minor version number of this InfoDock release.
|
|
2802 */ );
|
|
2803 Vinfodock_minor_version = make_int (INFODOCK_MINOR_VERSION);
|
|
2804
|
|
2805 DEFVAR_LISP ("infodock-build-version", &Vinfodock_build_version /*
|
|
2806 Build version of this InfoDock release.
|
|
2807 */ );
|
|
2808 Vinfodock_build_version = make_int (INFODOCK_BUILD_VERSION);
|
|
2809 #endif
|
|
2810
|
163
|
2811 DEFVAR_LISP ("xemacs-codename", &Vxemacs_codename /*
|
|
2812 Codename of this version of Emacs (a string).
|
|
2813 */ );
|
|
2814 #ifndef XEMACS_CODENAME
|
165
|
2815 #define XEMACS_CODENAME "Noname"
|
163
|
2816 #endif
|
|
2817 Vxemacs_codename = Fpurecopy (build_string (XEMACS_CODENAME));
|
|
2818
|
0
|
2819 DEFVAR_BOOL ("noninteractive", &noninteractive1 /*
|
|
2820 Non-nil means XEmacs is running without interactive terminal.
|
|
2821 */ );
|
|
2822
|
276
|
2823 DEFVAR_BOOL ("inhibit-early-packages", &inhibit_early_packages /*
|
|
2824 Set to non-nil when the early packages should not be respected at startup.
|
|
2825 */ );
|
|
2826
|
|
2827 DEFVAR_BOOL ("inhibit-autoloads", &inhibit_autoloads /*
|
|
2828 Set to non-nil when autoloads should not be loaded at startup.
|
|
2829 */ );
|
|
2830
|
|
2831 DEFVAR_BOOL ("debug-paths", &debug_paths /*
|
|
2832 Set to non-nil when debug information about paths should be printed.
|
207
|
2833 */ );
|
|
2834
|
267
|
2835 DEFVAR_BOOL ("inhibit-site-lisp", &inhibit_site_lisp /*
|
|
2836 Set to non-nil when the site-lisp should not be searched at startup.
|
|
2837 */ );
|
269
|
2838 #ifdef INHIBIT_SITE_LISP
|
|
2839 inhibit_site_lisp = 1;
|
|
2840 #endif
|
267
|
2841
|
0
|
2842 DEFVAR_INT ("emacs-priority", &emacs_priority /*
|
|
2843 Priority for XEmacs to run at.
|
|
2844 This value is effective only if set before XEmacs is dumped,
|
|
2845 and only if the XEmacs executable is installed with setuid to permit
|
|
2846 it to change priority. (XEmacs sets its uid back to the real uid.)
|
|
2847 Currently, you need to define SET_EMACS_PRIORITY in `config.h'
|
|
2848 before you compile XEmacs, to enable the code for this feature.
|
|
2849 */ );
|
|
2850 emacs_priority = 0;
|
163
|
2851
|
276
|
2852 DEFVAR_CONST_LISP ("internal-error-checking", &Vinternal_error_checking /*
|
|
2853 Internal error checking built-in into this instance of XEmacs.
|
|
2854 This is a list of symbols, initialized at build-time. Legal symbols
|
|
2855 are:
|
|
2856
|
|
2857 extents - check extents prior to each extent change;
|
|
2858 typecheck - check types strictly, aborting in case of error;
|
|
2859 malloc - check operation of malloc;
|
|
2860 gc - check garbage collection;
|
|
2861 bufpos - check buffer positions.
|
|
2862 */ );
|
|
2863 Vinternal_error_checking = Qnil;
|
|
2864 #ifdef ERROR_CHECK_EXTENTS
|
|
2865 Vinternal_error_checking = Fcons (intern ("extents"),
|
|
2866 Vinternal_error_checking);
|
|
2867 #endif
|
|
2868 #ifdef ERROR_CHECK_TYPECHECK
|
|
2869 Vinternal_error_checking = Fcons (intern ("typecheck"),
|
|
2870 Vinternal_error_checking);
|
|
2871 #endif
|
|
2872 #ifdef ERROR_CHECK_MALLOC
|
|
2873 Vinternal_error_checking = Fcons (intern ("malloc"),
|
|
2874 Vinternal_error_checking);
|
|
2875 #endif
|
|
2876 #ifdef ERROR_CHECK_GC
|
|
2877 Vinternal_error_checking = Fcons (intern ("gc"),
|
|
2878 Vinternal_error_checking);
|
|
2879 #endif
|
|
2880 #ifdef ERROR_CHECK_BUFPOS
|
|
2881 Vinternal_error_checking = Fcons (intern ("bufpos"),
|
|
2882 Vinternal_error_checking);
|
|
2883 #endif
|
|
2884 Vinternal_error_checking = Fpurecopy (Vinternal_error_checking);
|
284
|
2885
|
|
2886 DEFVAR_LISP ("path-separator", &Vpath_separator /*
|
|
2887 The directory separator in search paths, as a string.
|
|
2888 */ );
|
|
2889 {
|
|
2890 char c = SEPCHAR;
|
|
2891 Vpath_separator = make_string ((Bufbyte *)&c, 1);
|
|
2892 }
|
0
|
2893 }
|
267
|
2894
|
|
2895 void
|
|
2896 complex_vars_of_emacs (void)
|
|
2897 {
|
280
|
2898 /* This is all related to path searching. */
|
|
2899
|
|
2900 DEFVAR_LISP ("emacs-program-name", &Vemacs_program_name /*
|
|
2901 *Name of the Emacs variant.
|
|
2902 For example, this may be \"xemacs\" or \"infodock\".
|
|
2903 This is mainly meant for use in path searching.
|
|
2904 */ );
|
|
2905 Vemacs_program_name = build_string ((char *) PATH_PROGNAME);
|
|
2906
|
|
2907 DEFVAR_LISP ("emacs-program-version", &Vemacs_program_version /*
|
|
2908 *Version of the Emacs variant.
|
|
2909 This typically has the form XX.XX[-bXX].
|
|
2910 This is mainly meant for use in path searching.
|
|
2911 */ );
|
|
2912 Vemacs_program_version = build_string ((char *) PATH_VERSION);
|
|
2913
|
267
|
2914 DEFVAR_LISP ("exec-path", &Vexec_path /*
|
|
2915 *List of directories to search programs to run in subprocesses.
|
|
2916 Each element is a string (directory name) or nil (try default directory).
|
|
2917 */ );
|
|
2918 Vexec_path = Qnil;
|
|
2919
|
|
2920 DEFVAR_LISP ("exec-directory", &Vexec_directory /*
|
|
2921 *Directory of architecture-dependent files that come with XEmacs,
|
|
2922 especially executable programs intended for XEmacs to invoke.
|
|
2923 */ );
|
|
2924 Vexec_directory = Qnil;
|
|
2925
|
276
|
2926 DEFVAR_LISP ("configure-exec-directory", &Vconfigure_exec_directory /*
|
|
2927 For internal use by the build procedure only.
|
|
2928 configure's idea of what EXEC-DIRECTORY will be.
|
|
2929 */ );
|
|
2930 #ifdef PATH_EXEC
|
|
2931 Vconfigure_exec_directory = Ffile_name_as_directory
|
|
2932 (build_string ((char *) PATH_EXEC));
|
|
2933 #else
|
|
2934 Vconfigure_exec_directory = Qnil;
|
|
2935 #endif
|
|
2936
|
|
2937 DEFVAR_LISP ("lisp-directory", &Vlisp_directory /*
|
|
2938 *Directory of core Lisp files that come with XEmacs.
|
|
2939 */ );
|
|
2940 Vlisp_directory = Qnil;
|
|
2941
|
267
|
2942 DEFVAR_LISP ("configure-lisp-directory", &Vconfigure_lisp_directory /*
|
276
|
2943 For internal use by the build procedure only.
|
|
2944 configure's idea of what LISP-DIRECTORY will be.
|
267
|
2945 */ );
|
|
2946 #ifdef PATH_LOADSEARCH
|
|
2947 Vconfigure_lisp_directory = Ffile_name_as_directory
|
|
2948 (build_string ((char *) PATH_LOADSEARCH));
|
|
2949 #else
|
|
2950 Vconfigure_lisp_directory = Qnil;
|
|
2951 #endif
|
|
2952
|
|
2953 DEFVAR_LISP ("configure-package-path", &Vconfigure_package_path /*
|
|
2954 For internal use by the build procedure only.
|
278
|
2955 configure's idea of what the package path will be.
|
267
|
2956 */ );
|
|
2957 #ifdef PATH_PACKAGEPATH
|
|
2958 Vconfigure_package_path = decode_path (PATH_PACKAGEPATH);
|
|
2959 #else
|
|
2960 Vconfigure_package_path = Qnil;
|
|
2961 #endif
|
|
2962
|
|
2963 DEFVAR_LISP ("data-directory", &Vdata_directory /*
|
|
2964 *Directory of architecture-independent files that come with XEmacs,
|
|
2965 intended for XEmacs to use.
|
|
2966 Use of this variable in new code is almost never correct. See the
|
|
2967 function `locate-data-directory' and the variable `data-directory-list'.
|
|
2968 */ );
|
|
2969 Vdata_directory = Qnil;
|
|
2970
|
|
2971 DEFVAR_LISP ("configure-data-directory", &Vconfigure_data_directory /*
|
|
2972 For internal use by the build procedure only.
|
|
2973 configure's idea of what DATA-DIRECTORY will be.
|
|
2974 */ );
|
|
2975 #ifdef PATH_DATA
|
|
2976 Vconfigure_data_directory = Ffile_name_as_directory
|
|
2977 (build_string ((char *) PATH_DATA));
|
|
2978 #else
|
|
2979 Vconfigure_data_directory = Qnil;
|
|
2980 #endif
|
|
2981
|
|
2982 DEFVAR_LISP ("data-directory-list", &Vdata_directory_list /*
|
|
2983 *List of directories of architecture-independent files that come with XEmacs
|
|
2984 or were installed as packages, and are intended for XEmacs to use.
|
|
2985 */ );
|
|
2986 Vdata_directory_list = Qnil;
|
|
2987
|
|
2988 #ifdef CLASH_DETECTION
|
|
2989 DEFVAR_LISP ("configure-lock-directory", &Vconfigure_lock_directory /*
|
|
2990 For internal use by the build procedure only.
|
|
2991 configure's idea of what LOCK-DIRECTORY will be.
|
|
2992 */ );
|
|
2993 #ifdef PATH_LOCK
|
|
2994 Vconfigure_lock_directory = Ffile_name_as_directory
|
|
2995 (build_string ((char *) PATH_LOCK));
|
|
2996 #else
|
|
2997 Vconfigure_lock_directory = Qnil;
|
|
2998 #endif
|
|
2999 #endif /* CLASH_DETECTION */
|
|
3000
|
276
|
3001 DEFVAR_LISP ("site-directory", &Vsite_directory /*
|
|
3002 *Directory of site-specific Lisp files that come with XEmacs.
|
|
3003 */ );
|
|
3004 Vsite_directory = Qnil;
|
|
3005
|
267
|
3006 DEFVAR_LISP ("configure-site-directory", &Vconfigure_site_directory /*
|
|
3007 For internal use by the build procedure only.
|
|
3008 configure's idea of what SITE-DIRECTORY will be.
|
|
3009 */ );
|
|
3010 #ifdef PATH_SITE
|
|
3011 Vconfigure_site_directory = Ffile_name_as_directory
|
|
3012 (build_string ((char *) PATH_SITE));
|
|
3013 #else
|
|
3014 Vconfigure_site_directory = Qnil;
|
|
3015 #endif
|
|
3016
|
|
3017 DEFVAR_LISP ("doc-directory", &Vdoc_directory /*
|
|
3018 *Directory containing the DOC file that comes with XEmacs.
|
|
3019 This is usually the same as exec-directory.
|
|
3020 */ );
|
|
3021 Vdoc_directory = Qnil;
|
|
3022
|
|
3023 DEFVAR_LISP ("configure-doc-directory", &Vconfigure_doc_directory /*
|
|
3024 For internal use by the build procedure only.
|
|
3025 configure's idea of what DOC-DIRECTORY will be.
|
|
3026 */ );
|
|
3027 #ifdef PATH_DOC
|
|
3028 Vconfigure_doc_directory = Ffile_name_as_directory
|
|
3029 (build_string ((char *) PATH_DOC));
|
|
3030 #else
|
|
3031 Vconfigure_doc_directory = Qnil;
|
|
3032 #endif
|
|
3033
|
278
|
3034 DEFVAR_LISP ("configure-exec-prefix-directory", &Vconfigure_exec_prefix_directory /*
|
|
3035 For internal use by the build procedure only.
|
|
3036 configure's idea of what EXEC-PREFIX-DIRECTORY will be.
|
|
3037 */ );
|
|
3038 #ifdef PATH_EXEC_PREFIX
|
|
3039 Vconfigure_exec_prefix_directory = Ffile_name_as_directory
|
|
3040 (build_string ((char *) PATH_EXEC_PREFIX));
|
|
3041 #else
|
|
3042 Vconfigure_exec_prefix_directory = Qnil;
|
|
3043 #endif
|
|
3044
|
267
|
3045 DEFVAR_LISP ("configure-prefix-directory", &Vconfigure_prefix_directory /*
|
|
3046 For internal use by the build procedure only.
|
|
3047 configure's idea of what PREFIX-DIRECTORY will be.
|
|
3048 */ );
|
|
3049 #ifdef PATH_PREFIX
|
|
3050 Vconfigure_prefix_directory = Ffile_name_as_directory
|
|
3051 (build_string ((char *) PATH_PREFIX));
|
|
3052 #else
|
|
3053 Vconfigure_prefix_directory = Qnil;
|
|
3054 #endif
|
|
3055
|
|
3056 DEFVAR_LISP ("configure-info-directory", &Vconfigure_info_directory /*
|
|
3057 For internal use by the build procedure only.
|
|
3058 This is the name of the directory in which the build procedure installed
|
|
3059 Emacs's info files; the default value for Info-default-directory-list
|
|
3060 includes this.
|
|
3061 */ );
|
|
3062 #ifdef PATH_INFO
|
|
3063 Vconfigure_info_directory =
|
|
3064 Ffile_name_as_directory (build_string (PATH_INFO));
|
|
3065 #else
|
|
3066 Vconfigure_info_directory = Qnil;
|
|
3067 #endif
|
|
3068
|
|
3069 DEFVAR_LISP ("configure-info-path", &Vconfigure_info_path /*
|
|
3070 The configured initial path for info documentation.
|
|
3071 */ );
|
|
3072 #ifdef PATH_INFOPATH
|
|
3073 Vconfigure_info_path = decode_path (PATH_INFOPATH);
|
|
3074 #else
|
|
3075 Vconfigure_info_path = Qnil;
|
|
3076 #endif
|
|
3077 }
|
298
|
3078
|
|
3079 #ifdef __sgi
|
|
3080 /* This is so tremendously ugly I'd puke. But then, it works.
|
|
3081 * The target is to override the static constructor from the
|
|
3082 * libiflPNG.so library which is maskerading as libz, and
|
|
3083 * cores on us when re-started from the dumped executable.
|
|
3084 * This will have to go for 21.1 -- OG.
|
|
3085 */
|
335
|
3086 void __sti__iflPNGFile_c___(void);
|
298
|
3087 void __sti__iflPNGFile_c___()
|
|
3088 {
|
|
3089 }
|
|
3090
|
|
3091 #endif
|