comparison src/emacs.c @ 207:e45d5e7c476e r20-4b2

Import from CVS: tag r20-4b2
author cvs
date Mon, 13 Aug 2007 10:03:52 +0200
parents a2f645c6b9f8
children 41ff10fd062f
comparison
equal deleted inserted replaced
206:d3e9274cbc4e 207:e45d5e7c476e
50 50
51 #ifdef TOOLTALK 51 #ifdef TOOLTALK
52 #include TT_C_H_PATH 52 #include TT_C_H_PATH
53 #endif 53 #endif
54 54
55 #ifdef VMS
56 #include <ssdef.h>
57 #endif
58
59 #ifdef APOLLO 55 #ifdef APOLLO
60 #ifndef APOLLO_SR10 56 #ifndef APOLLO_SR10
61 #include <default_acl.h> 57 #include <default_acl.h>
62 #endif 58 #endif
63 #endif 59 #endif
155 /* Value of Lisp variable `noninteractive'. 151 /* Value of Lisp variable `noninteractive'.
156 Normally same as C variable `noninteractive' 152 Normally same as C variable `noninteractive'
157 but nothing terrible happens if user sets this one. */ 153 but nothing terrible happens if user sets this one. */
158 154
159 int noninteractive1; 155 int noninteractive1;
156
157 /* Nonzero means don't perform package searches at startup */
158 int inhibit_package_init;
160 159
161 /* Save argv and argc. */ 160 /* Save argv and argc. */
162 char **initial_argv; 161 char **initial_argv;
163 int initial_argc; 162 int initial_argc;
164 163
208 system(buf); 207 system(buf);
209 } 208 }
210 } 209 }
211 # endif 210 # endif
212 } 211 }
213 #ifdef VMS
214 LIB$STOP (SS$_ABORT);
215 #else
216 /* Signal the same code; this time it will really be fatal. */ 212 /* Signal the same code; this time it will really be fatal. */
217 kill (getpid (), fatal_error_code); 213 kill (getpid (), fatal_error_code);
218 #endif /* not VMS */
219 SIGRETURN; 214 SIGRETURN;
220 } 215 }
221 216
222 217
223 DOESNT_RETURN 218 DOESNT_RETURN
517 /* The shared memory was just restored, which clobbered this. */ 512 /* The shared memory was just restored, which clobbered this. */
518 skip_args = 0; 513 skip_args = 0;
519 } 514 }
520 #endif /* HAVE_SHM */ 515 #endif /* HAVE_SHM */
521 516
522 #ifdef VMS
523 /* If -map specified, map the data file in */
524 if (argc > 2 && ! strcmp (argv[1], "-map"))
525 {
526 skip_args = 2;
527 mapin_data (argv[2]);
528 }
529
530 #ifdef LINK_CRTL_SHARE
531 #ifdef SHAREABLE_LIB_BUG
532 /* Bletcherous shared libraries! */
533 if (!stdin) stdin = fdopen (0, "r");
534 if (!stdout) stdout = fdopen (1, "w");
535 if (!stderr) stderr = fdopen (2, "w");
536 if (!environ) environ = envp;
537 #endif /* SHAREABLE_LIB_BUG */
538 #endif /* LINK_CRTL_SHARE */
539 #endif /* VMS */
540 #if (defined (MSDOS) && defined (EMX)) || defined (WIN32) || defined (_SCO_DS) 517 #if (defined (MSDOS) && defined (EMX)) || defined (WIN32) || defined (_SCO_DS)
541 environ = envp; 518 environ = envp;
542 #endif 519 #endif
543 520
544 /* Record (approximately) where the stack begins. */ 521 /* Record (approximately) where the stack begins. */
632 inhibit_window_system = 1; 609 inhibit_window_system = 1;
633 610
634 /* Handle the -batch switch, which means don't do interactive display. */ 611 /* Handle the -batch switch, which means don't do interactive display. */
635 if (argmatch (argv, argc, "-batch", "--batch", 5, NULL, &skip_args)) 612 if (argmatch (argv, argc, "-batch", "--batch", 5, NULL, &skip_args))
636 noninteractive = 1; 613 noninteractive = 1;
614
615 /* Partially handle -no-packages and -vanilla. Packages are searched */
616 /* prior to the rest of the command line being parsed in startup.el */
617 if (argmatch (argv, argc, "-no-packages", "--no-packages",
618 6, NULL, &skip_args) ||
619 argmatch (argv, argc, "-vanilla", "--vanilla",
620 7, NULL, &skip_args))
621 {
622 inhibit_package_init = 1;
623 skip_args--;
624 }
637 625
638 /* Partially handle the -version and -help switches: they imply -batch, 626 /* Partially handle the -version and -help switches: they imply -batch,
639 but are not removed from the list. */ 627 but are not removed from the list. */
640 if (argmatch (argv, argc, "-help", "--help", 3, NULL, &skip_args) || 628 if (argmatch (argv, argc, "-help", "--help", 3, NULL, &skip_args) ||
641 argmatch (argv, argc, "-?", 0, 2, NULL, &skip_args) || 629 argmatch (argv, argc, "-?", 0, 2, NULL, &skip_args) ||
1395 #ifdef WINDOWSNT 1383 #ifdef WINDOWSNT
1396 init_environment(); 1384 init_environment();
1397 init_ntproc(); 1385 init_ntproc();
1398 #endif 1386 #endif
1399 1387
1400 #ifdef VMS
1401 init_vms_input (); /* init_redisplay calls get_tty_device_size,
1402 that needs this */
1403 #endif /* VMS */
1404 init_redisplay (); /* Determine terminal type. 1388 init_redisplay (); /* Determine terminal type.
1405 init_sys_modes uses results */ 1389 init_sys_modes uses results */
1406 #ifdef VMS
1407 init_vmsproc ();
1408 init_vmsfns ();
1409 #endif /* VMS */
1410 init_event_stream (); /* Set up so we can get user input. */ 1390 init_event_stream (); /* Set up so we can get user input. */
1411 init_macros (); /* set up so we can run macros. */ 1391 init_macros (); /* set up so we can run macros. */
1412 init_editfns (); /* Determine the name of the user we're running as */ 1392 init_editfns (); /* Determine the name of the user we're running as */
1413 init_xemacs_process (); /* set up for calling subprocesses */ 1393 init_xemacs_process (); /* set up for calling subprocesses */
1414 #ifdef SUNPRO 1394 #ifdef SUNPRO
1496 1476
1497 static struct standard_args standard_args[] = 1477 static struct standard_args standard_args[] =
1498 { 1478 {
1499 /* Handled by main_1 above: */ 1479 /* Handled by main_1 above: */
1500 { "-nl", "--no-shared-memory", 100, 0 }, 1480 { "-nl", "--no-shared-memory", 100, 0 },
1501 #ifdef VMS
1502 { "-map", "--map-data", 100, 0 },
1503 #endif
1504 { "-t", "--terminal", 95, 1 }, 1481 { "-t", "--terminal", 95, 1 },
1505 { "-nw", "--no-windows", 90, 0 }, 1482 { "-nw", "--no-windows", 90, 0 },
1506 { "-batch", "--batch", 85, 0 }, 1483 { "-batch", "--batch", 85, 0 },
1507 { "-help", "--help", 80, 0 }, 1484 { "-help", "--help", 80, 0 },
1508 { "-flags", "--flags", 80, 0 }, 1485 { "-flags", "--flags", 80, 0 },
1517 1494
1518 /* Handled by command-line-early in startup.el: */ 1495 /* Handled by command-line-early in startup.el: */
1519 { "-q", "--no-init-file", 50, 0 }, 1496 { "-q", "--no-init-file", 50, 0 },
1520 { "-unmapped", 0, 50, 0 }, 1497 { "-unmapped", 0, 50, 0 },
1521 { "-no-init-file", 0, 50, 0 }, 1498 { "-no-init-file", 0, 50, 0 },
1499 { "-vanilla", "--vanilla", 50, 0 },
1522 { "-no-site-file", "--no-site-file", 40, 0 }, 1500 { "-no-site-file", "--no-site-file", 40, 0 },
1501 { "-no-packages", "--no-packages", 35, 0 },
1523 { "-u", "--user", 30, 1 }, 1502 { "-u", "--user", 30, 1 },
1524 { "-user", 0, 30, 1 }, 1503 { "-user", 0, 30, 1 },
1525 { "-debug-init", "--debug-init", 20, 0 }, 1504 { "-debug-init", "--debug-init", 20, 0 },
1526 1505
1527 /* Xt options: */ 1506 /* Xt options: */
1770 catchlist = NULL; /* Important! Otherwise free_cons() calls in 1749 catchlist = NULL; /* Important! Otherwise free_cons() calls in
1771 condition_case_unwind() may lead to GC death. */ 1750 condition_case_unwind() may lead to GC death. */
1772 unbind_to (0, Qnil); /* this closes loadup.el */ 1751 unbind_to (0, Qnil); /* this closes loadup.el */
1773 purify_flag = 0; 1752 purify_flag = 0;
1774 run_temacs_argc = nargs + 1; 1753 run_temacs_argc = nargs + 1;
1754 #ifdef DEBUG_XEMACS
1775 report_pure_usage (1, 0); 1755 report_pure_usage (1, 0);
1756 #else
1757 report_pure_usage (0, 0);
1758 #endif
1776 LONGJMP (run_temacs_catch, 1); 1759 LONGJMP (run_temacs_catch, 1);
1777 return Qnil; /* not reached; warning suppression */ 1760 return Qnil; /* not reached; warning suppression */
1778 } 1761 }
1779 1762
1780 /* ARGSUSED */ 1763 /* ARGSUSED */
1875 1858
1876 UNGCPRO; 1859 UNGCPRO;
1877 1860
1878 shut_down_emacs (0, ((STRINGP (arg)) ? arg : Qnil)); 1861 shut_down_emacs (0, ((STRINGP (arg)) ? arg : Qnil));
1879 1862
1880 exit ((INTP (arg)) ? XINT (arg) 1863 exit ((INTP (arg)) ? XINT (arg) : 0);
1881 #ifdef VMS
1882 : 1
1883 #else
1884 : 0
1885 #endif
1886 );
1887 /* NOTREACHED */ 1864 /* NOTREACHED */
1888 return Qnil; /* I'm sick of the compiler warning */ 1865 return Qnil; /* I'm sick of the compiler warning */
1889 } 1866 }
1890 1867
1891 /* Perform an orderly shutdown of XEmacs. Autosave any modified 1868 /* Perform an orderly shutdown of XEmacs. Autosave any modified
1990 /* The following crashes when built on X11R5 and run on X11R6 */ 1967 /* The following crashes when built on X11R5 and run on X11R6 */
1991 tt_close (); 1968 tt_close ();
1992 #endif 1969 #endif
1993 #endif /* TOOLTALK */ 1970 #endif /* TOOLTALK */
1994 1971
1995 #ifdef VMS
1996 kill_vms_processes ();
1997 #endif
1998 } 1972 }
1999 1973
2000 1974
2001 #ifndef CANNOT_DUMP 1975 #ifndef CANNOT_DUMP
2002 /* Nothing like this can be implemented on an Apollo. 1976 /* Nothing like this can be implemented on an Apollo.
2081 } 2055 }
2082 2056
2083 opurify = purify_flag; 2057 opurify = purify_flag;
2084 purify_flag = 0; 2058 purify_flag = 0;
2085 2059
2060 #ifdef DEBUG_XEMACS
2086 report_pure_usage (1, 1); 2061 report_pure_usage (1, 1);
2062 #else
2063 report_pure_usage (0, 1);
2064 #endif
2087 2065
2088 fflush (stderr); 2066 fflush (stderr);
2089 fflush (stdout); 2067 fflush (stdout);
2090 2068
2091 disksave_object_finalization (); 2069 disksave_object_finalization ();
2092 release_breathing_space (); 2070 release_breathing_space ();
2093 2071
2094 #ifdef VMS
2095 mapout_data (XSTRING_DATA (intoname));
2096 #else
2097 /* Tell malloc where start of impure now is */ 2072 /* Tell malloc where start of impure now is */
2098 /* Also arrange for warnings when nearly out of space. */ 2073 /* Also arrange for warnings when nearly out of space. */
2099 #ifndef SYSTEM_MALLOC 2074 #ifndef SYSTEM_MALLOC
2100 memory_warnings (my_edata, malloc_warning); 2075 memory_warnings (my_edata, malloc_warning);
2101 #endif 2076 #endif
2132 unexec ((char *) intoname_ext, (char *) symname_ext, 2107 unexec ((char *) intoname_ext, (char *) symname_ext,
2133 (uintptr_t) my_edata, 2108 (uintptr_t) my_edata,
2134 0, 0); 2109 0, 0);
2135 } 2110 }
2136 #endif /* not MSDOS and EMX */ 2111 #endif /* not MSDOS and EMX */
2137 #endif /* not VMS */
2138 2112
2139 purify_flag = opurify; 2113 purify_flag = opurify;
2140 2114
2141 return Qnil; 2115 return Qnil;
2142 } 2116 }
2377 2351
2378 DEFVAR_BOOL ("noninteractive", &noninteractive1 /* 2352 DEFVAR_BOOL ("noninteractive", &noninteractive1 /*
2379 Non-nil means XEmacs is running without interactive terminal. 2353 Non-nil means XEmacs is running without interactive terminal.
2380 */ ); 2354 */ );
2381 2355
2356 DEFVAR_BOOL ("inhibit-package-init", &inhibit_package_init /*
2357 Set to non-nil when the package-path should not be searched at startup.
2358 */ );
2359
2382 DEFVAR_INT ("emacs-priority", &emacs_priority /* 2360 DEFVAR_INT ("emacs-priority", &emacs_priority /*
2383 Priority for XEmacs to run at. 2361 Priority for XEmacs to run at.
2384 This value is effective only if set before XEmacs is dumped, 2362 This value is effective only if set before XEmacs is dumped,
2385 and only if the XEmacs executable is installed with setuid to permit 2363 and only if the XEmacs executable is installed with setuid to permit
2386 it to change priority. (XEmacs sets its uid back to the real uid.) 2364 it to change priority. (XEmacs sets its uid back to the real uid.)