Mercurial > hg > xemacs-beta
comparison src/emacs.c @ 380:8626e4521993 r21-2-5
Import from CVS: tag r21-2-5
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:07:10 +0200 |
parents | d883f39b8495 |
children | bbff43aa5eb7 |
comparison
equal
deleted
inserted
replaced
379:76b7d63099ad | 380:8626e4521993 |
---|---|
33 #include "backtrace.h" /* run-emacs-from-temacs needs this */ | 33 #include "backtrace.h" /* run-emacs-from-temacs needs this */ |
34 #include "buffer.h" | 34 #include "buffer.h" |
35 #include "commands.h" | 35 #include "commands.h" |
36 #include "console.h" | 36 #include "console.h" |
37 #include "process.h" | 37 #include "process.h" |
38 #include "redisplay.h" | |
38 #include "sysdep.h" | 39 #include "sysdep.h" |
39 | 40 |
40 #include <setjmp.h> | |
41 #include "syssignal.h" /* Always include before systty.h */ | 41 #include "syssignal.h" /* Always include before systty.h */ |
42 #include "systty.h" | 42 #include "systty.h" |
43 #include "sysfile.h" | 43 #include "sysfile.h" |
44 #include "systime.h" | 44 #include "systime.h" |
45 | |
46 #ifdef QUANTIFY | |
47 #include <quantify.h> | |
48 #endif | |
45 | 49 |
46 #ifdef HAVE_SHLIB | 50 #ifdef HAVE_SHLIB |
47 #include "sysdll.h" | 51 #include "sysdll.h" |
48 #endif | 52 #endif |
49 | 53 |
209 /* Save argv and argc. */ | 213 /* Save argv and argc. */ |
210 char **initial_argv; | 214 char **initial_argv; |
211 int initial_argc; | 215 int initial_argc; |
212 | 216 |
213 static void sort_args (int argc, char **argv); | 217 static void sort_args (int argc, char **argv); |
214 | |
215 extern int always_gc; /* hack */ | |
216 | 218 |
217 Lisp_Object Qkill_emacs_hook; | 219 Lisp_Object Qkill_emacs_hook; |
218 Lisp_Object Qsave_buffers_kill_emacs; | 220 Lisp_Object Qsave_buffers_kill_emacs; |
219 | 221 |
220 | 222 |
443 bug that needs to be looked at. */ | 445 bug that needs to be looked at. */ |
444 # undef RUN_TIME_REMAP | 446 # undef RUN_TIME_REMAP |
445 #endif | 447 #endif |
446 | 448 |
447 #if defined (MULE) && defined (MSDOS) && defined (EMX) | 449 #if defined (MULE) && defined (MSDOS) && defined (EMX) |
448 /* Setup all of files be input/output'ed with binary translation mdoe. */ | 450 /* Setup all of files be input/output'ed with binary translation mode. */ |
449 asm (" .text"); | 451 asm (" .text"); |
450 asm ("L_setbinmode:"); | 452 asm ("L_setbinmode:"); |
451 asm (" movl $1, __fmode_bin"); | 453 asm (" movl $1, __fmode_bin"); |
452 asm (" ret"); | 454 asm (" ret"); |
453 asm (" .stabs \"___CTOR_LIST__\", 23, 0, 0, L_setbinmode"); | 455 asm (" .stabs \"___CTOR_LIST__\", 23, 0, 0, L_setbinmode"); |
517 } | 519 } |
518 | 520 |
519 /* Make stack traces always identify version + configuration */ | 521 /* Make stack traces always identify version + configuration */ |
520 #define main_1 STACK_TRACE_EYE_CATCHER | 522 #define main_1 STACK_TRACE_EYE_CATCHER |
521 | 523 |
522 static DOESNT_RETURN | 524 /* This function is not static, so that the compiler is less likely to |
525 inline it, which would make it not show up in stack traces. */ | |
526 DECLARE_DOESNT_RETURN (main_1 (int, char **, char **, int)); | |
527 DOESNT_RETURN | |
523 main_1 (int argc, char **argv, char **envp, int restart) | 528 main_1 (int argc, char **argv, char **envp, int restart) |
524 { | 529 { |
525 char stack_bottom_variable; | 530 char stack_bottom_variable; |
526 int skip_args = 0; | 531 int skip_args = 0; |
527 Lisp_Object load_me; | 532 Lisp_Object load_me; |
892 syms_of_doc (); | 897 syms_of_doc (); |
893 syms_of_editfns (); | 898 syms_of_editfns (); |
894 syms_of_elhash (); | 899 syms_of_elhash (); |
895 syms_of_emacs (); | 900 syms_of_emacs (); |
896 syms_of_eval (); | 901 syms_of_eval (); |
902 #ifdef HAVE_X_WINDOWS | |
903 syms_of_event_Xt (); | |
904 #endif | |
897 #ifdef HAVE_DRAGNDROP | 905 #ifdef HAVE_DRAGNDROP |
898 syms_of_dragdrop (); | 906 syms_of_dragdrop (); |
899 #endif | 907 #endif |
900 syms_of_event_stream (); | 908 syms_of_event_stream (); |
901 syms_of_events (); | 909 syms_of_events (); |
962 #ifdef HAVE_TTY | 970 #ifdef HAVE_TTY |
963 syms_of_console_tty (); | 971 syms_of_console_tty (); |
964 syms_of_device_tty (); | 972 syms_of_device_tty (); |
965 syms_of_objects_tty (); | 973 syms_of_objects_tty (); |
966 #endif | 974 #endif |
975 | |
967 #ifdef HAVE_X_WINDOWS | 976 #ifdef HAVE_X_WINDOWS |
968 syms_of_device_x (); | 977 syms_of_device_x (); |
969 #ifdef HAVE_DIALOGS | 978 #ifdef HAVE_DIALOGS |
970 syms_of_dialog_x (); | 979 syms_of_dialog_x (); |
971 #endif | 980 #endif |
972 syms_of_event_Xt (); | |
973 syms_of_frame_x (); | 981 syms_of_frame_x (); |
974 syms_of_glyphs_x (); | 982 syms_of_glyphs_x (); |
975 syms_of_objects_x (); | 983 syms_of_objects_x (); |
976 #ifdef HAVE_MENUBARS | 984 #ifdef HAVE_MENUBARS |
977 syms_of_menubar_x (); | 985 syms_of_menubar_x (); |
983 #endif /* HAVE_X_WINDOWS */ | 991 #endif /* HAVE_X_WINDOWS */ |
984 | 992 |
985 #ifdef HAVE_MS_WINDOWS | 993 #ifdef HAVE_MS_WINDOWS |
986 syms_of_console_mswindows (); | 994 syms_of_console_mswindows (); |
987 syms_of_device_mswindows (); | 995 syms_of_device_mswindows (); |
988 syms_of_event_mswindows (); | |
989 syms_of_frame_mswindows (); | 996 syms_of_frame_mswindows (); |
990 syms_of_objects_mswindows (); | 997 syms_of_objects_mswindows (); |
991 syms_of_select_mswindows (); | 998 syms_of_select_mswindows (); |
992 syms_of_glyphs_mswindows (); | 999 syms_of_glyphs_mswindows (); |
993 #ifdef HAVE_MENUBARS | 1000 #ifdef HAVE_MENUBARS |
1022 SYMS_SYSTEM; | 1029 SYMS_SYSTEM; |
1023 #endif | 1030 #endif |
1024 | 1031 |
1025 #ifdef SYMS_MACHINE | 1032 #ifdef SYMS_MACHINE |
1026 SYMS_MACHINE; | 1033 SYMS_MACHINE; |
1027 #endif | |
1028 | |
1029 #ifdef EMACS_BTL | |
1030 syms_of_btl (); | |
1031 #endif | 1034 #endif |
1032 | 1035 |
1033 /* | 1036 /* |
1034 #if defined (GNU_MALLOC) && \ | 1037 #if defined (GNU_MALLOC) && \ |
1035 defined (ERROR_CHECK_MALLOC) && \ | 1038 defined (ERROR_CHECK_MALLOC) && \ |
1150 structure_type_create (); | 1153 structure_type_create (); |
1151 | 1154 |
1152 structure_type_create_chartab (); | 1155 structure_type_create_chartab (); |
1153 structure_type_create_faces (); | 1156 structure_type_create_faces (); |
1154 structure_type_create_rangetab (); | 1157 structure_type_create_rangetab (); |
1155 structure_type_create_hashtable (); | 1158 structure_type_create_hash_table (); |
1156 | 1159 |
1157 /* Now initialize the image instantiator formats and associated symbols. | 1160 /* Now initialize the image instantiator formats and associated symbols. |
1158 Other than the first function below, the functions may | 1161 Other than the first function below, the functions may |
1159 make exactly the following function/macro calls: | 1162 make exactly the following function/macro calls: |
1160 | 1163 |
1187 lstream_type_create_mule_coding (); | 1190 lstream_type_create_mule_coding (); |
1188 #endif | 1191 #endif |
1189 #if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT) | 1192 #if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT) |
1190 lstream_type_create_mswindows_selectable (); | 1193 lstream_type_create_mswindows_selectable (); |
1191 #endif | 1194 #endif |
1192 | 1195 |
1193 /* Initialize processes implementation. | 1196 /* Initialize processes implementation. |
1194 The functions may make exactly the following function/macro calls: | 1197 The functions may make exactly the following function/macro calls: |
1195 | 1198 |
1196 PROCESS_HAS_METHOD() | 1199 PROCESS_HAS_METHOD() |
1197 */ | 1200 */ |
1274 #endif | 1277 #endif |
1275 vars_of_editfns (); | 1278 vars_of_editfns (); |
1276 vars_of_elhash (); | 1279 vars_of_elhash (); |
1277 vars_of_emacs (); | 1280 vars_of_emacs (); |
1278 vars_of_eval (); | 1281 vars_of_eval (); |
1282 | |
1283 #ifdef HAVE_X_WINDOWS | |
1284 vars_of_event_Xt (); | |
1285 #endif | |
1286 #if defined(HAVE_TTY) && (defined (DEBUG_TTY_EVENT_STREAM) || !defined (HAVE_X_WINDOWS)) | |
1287 vars_of_event_tty (); | |
1288 #endif | |
1289 #ifdef HAVE_MS_WINDOWS | |
1290 vars_of_event_mswindows (); | |
1291 #endif | |
1279 vars_of_event_stream (); | 1292 vars_of_event_stream (); |
1293 | |
1280 vars_of_events (); | 1294 vars_of_events (); |
1281 vars_of_extents (); | 1295 vars_of_extents (); |
1282 vars_of_faces (); | 1296 vars_of_faces (); |
1283 vars_of_fileio (); | 1297 vars_of_fileio (); |
1284 vars_of_floatfns (); | 1298 vars_of_floatfns (); |
1343 vars_of_undo (); | 1357 vars_of_undo (); |
1344 vars_of_window (); | 1358 vars_of_window (); |
1345 | 1359 |
1346 #ifdef HAVE_TTY | 1360 #ifdef HAVE_TTY |
1347 vars_of_console_tty (); | 1361 vars_of_console_tty (); |
1348 vars_of_event_tty (); | |
1349 vars_of_frame_tty (); | 1362 vars_of_frame_tty (); |
1350 vars_of_objects_tty (); | 1363 vars_of_objects_tty (); |
1351 #endif | 1364 #endif |
1352 | 1365 |
1353 #ifdef HAVE_X_WINDOWS | 1366 #ifdef HAVE_X_WINDOWS |
1354 vars_of_device_x (); | 1367 vars_of_device_x (); |
1355 #ifdef HAVE_DIALOGS | 1368 #ifdef HAVE_DIALOGS |
1356 vars_of_dialog_x (); | 1369 vars_of_dialog_x (); |
1357 #endif | 1370 #endif |
1358 vars_of_event_Xt (); | |
1359 vars_of_frame_x (); | 1371 vars_of_frame_x (); |
1360 vars_of_glyphs_x (); | 1372 vars_of_glyphs_x (); |
1361 #ifdef HAVE_MENUBARS | 1373 #ifdef HAVE_MENUBARS |
1362 vars_of_menubar_x (); | 1374 vars_of_menubar_x (); |
1363 #endif | 1375 #endif |
1372 #endif | 1384 #endif |
1373 | 1385 |
1374 #ifdef HAVE_MS_WINDOWS | 1386 #ifdef HAVE_MS_WINDOWS |
1375 vars_of_device_mswindows (); | 1387 vars_of_device_mswindows (); |
1376 vars_of_console_mswindows (); | 1388 vars_of_console_mswindows (); |
1377 vars_of_event_mswindows (); | |
1378 vars_of_frame_mswindows (); | 1389 vars_of_frame_mswindows (); |
1379 vars_of_objects_mswindows (); | 1390 vars_of_objects_mswindows (); |
1380 vars_of_select_mswindows (); | 1391 vars_of_select_mswindows (); |
1381 vars_of_glyphs_mswindows (); | 1392 vars_of_glyphs_mswindows (); |
1382 #ifdef HAVE_SCROLLBARS | 1393 #ifdef HAVE_SCROLLBARS |
1456 /* Calls Fmake_range_table(). */ | 1467 /* Calls Fmake_range_table(). */ |
1457 complex_vars_of_regex (); | 1468 complex_vars_of_regex (); |
1458 /* Calls Fmake_range_table(). */ | 1469 /* Calls Fmake_range_table(). */ |
1459 complex_vars_of_search (); | 1470 complex_vars_of_search (); |
1460 | 1471 |
1461 /* Calls make_lisp_hashtable(). */ | 1472 /* Calls make_lisp_hash_table(). */ |
1462 complex_vars_of_extents (); | 1473 complex_vars_of_extents (); |
1463 | 1474 |
1464 /* Depends on hashtables and specifiers. */ | 1475 /* Depends on hash tables and specifiers. */ |
1465 complex_vars_of_faces (); | 1476 complex_vars_of_faces (); |
1466 | 1477 |
1467 #ifdef MULE | 1478 #ifdef MULE |
1468 /* These two depend on hashtables and various variables declared | 1479 /* These two depend on hash tables and various variables declared |
1469 earlier. The second may also depend on the first. */ | 1480 earlier. The second may also depend on the first. */ |
1470 complex_vars_of_mule_charset (); | 1481 complex_vars_of_mule_charset (); |
1471 #endif | 1482 #endif |
1472 #if defined(FILE_CODING) | 1483 #if defined(FILE_CODING) |
1473 complex_vars_of_mule_coding (); | 1484 complex_vars_of_mule_coding (); |
1534 /* These two might call Ffile_name_as_directory(), which | 1545 /* These two might call Ffile_name_as_directory(), which |
1535 might depend on all sorts of things; I'm not sure. */ | 1546 might depend on all sorts of things; I'm not sure. */ |
1536 complex_vars_of_emacs (); | 1547 complex_vars_of_emacs (); |
1537 | 1548 |
1538 /* This creates a couple of basic keymaps and depends on Lisp | 1549 /* This creates a couple of basic keymaps and depends on Lisp |
1539 hashtables and Ffset() (both of which depend on some variables | 1550 hash tables and Ffset() (both of which depend on some variables |
1540 initialized in the vars_of_*() section) and possibly other | 1551 initialized in the vars_of_*() section) and possibly other |
1541 stuff. */ | 1552 stuff. */ |
1542 complex_vars_of_keymap (); | 1553 complex_vars_of_keymap (); |
1543 /* Calls Fmake_hashtable() and creates a keymap */ | 1554 |
1555 /* Calls make_lisp_hash_table() and creates a keymap */ | |
1544 complex_vars_of_event_stream (); | 1556 complex_vars_of_event_stream (); |
1545 | 1557 |
1546 if (always_gc) /* purification debugging hack */ | 1558 #ifdef ERROR_CHECK_GC |
1547 garbage_collect_1 (); | 1559 { |
1560 extern int always_gc; | |
1561 if (always_gc) /* purification debugging hack */ | |
1562 garbage_collect_1 (); | |
1563 } | |
1564 #endif | |
1548 } | 1565 } |
1549 | 1566 |
1550 /* CONGRATULATIONS!!! We have successfully initialized the Lisp | 1567 /* CONGRATULATIONS!!! We have successfully initialized the Lisp |
1551 engine. */ | 1568 engine. */ |
1552 | 1569 |
1572 "*scratch*" buffer, etc. */ | 1589 "*scratch*" buffer, etc. */ |
1573 | 1590 |
1574 #ifdef WINDOWSNT | 1591 #ifdef WINDOWSNT |
1575 /* | 1592 /* |
1576 * For Win32, call init_environment() now, so that environment/registry | 1593 * For Win32, call init_environment() now, so that environment/registry |
1577 * variables will be properly entered into Vprocess_envonment. | 1594 * variables will be properly entered into Vprocess_environment. |
1578 */ | 1595 */ |
1579 init_environment(); | 1596 init_environment(); |
1580 #endif | 1597 #endif |
1581 | 1598 |
1582 init_callproc (); /* Set up the process environment (so that egetenv | 1599 init_callproc (); /* Set up the process environment (so that egetenv |
1655 called for GNU dld in temacs and xemacs. */ | 1672 called for GNU dld in temacs and xemacs. */ |
1656 { | 1673 { |
1657 char *buf = (char *)alloca (XSTRING_LENGTH (Vinvocation_directory) | 1674 char *buf = (char *)alloca (XSTRING_LENGTH (Vinvocation_directory) |
1658 + XSTRING_LENGTH (Vinvocation_name) | 1675 + XSTRING_LENGTH (Vinvocation_name) |
1659 + 2); | 1676 + 2); |
1660 sprintf (buf, "%s/%s", XSTRING_DATA(Vinvocation_directory), | 1677 sprintf (buf, "%s/%s", XSTRING_DATA (Vinvocation_directory), |
1661 XSTRING_DATA(Vinvocation_name)); | 1678 XSTRING_DATA (Vinvocation_name)); |
1662 | 1679 |
1663 /* All we can do is cry if an error happens, so ignore it. */ | 1680 /* All we can do is cry if an error happens, so ignore it. */ |
1664 (void)dll_init(buf); | 1681 (void) dll_init (buf); |
1665 } | 1682 } |
1666 #endif | 1683 #endif |
1667 | 1684 |
1668 #if defined (LOCALTIME_CACHE) && defined (HAVE_TZSET) | 1685 #if defined (LOCALTIME_CACHE) && defined (HAVE_TZSET) |
1669 /* sun's localtime() has a bug. it caches the value of the time | 1686 /* sun's localtime() has a bug. it caches the value of the time |
1789 If an option takes an argument, keep it and its argument together. */ | 1806 If an option takes an argument, keep it and its argument together. */ |
1790 | 1807 |
1791 static void | 1808 static void |
1792 sort_args (int argc, char **argv) | 1809 sort_args (int argc, char **argv) |
1793 { | 1810 { |
1794 char **new = xnew_array (char *, argc); | 1811 char **new_argv = xnew_array (char *, argc); |
1795 /* For each element of argv, | 1812 /* For each element of argv, |
1796 the corresponding element of options is: | 1813 the corresponding element of options is: |
1797 0 for an option that takes no arguments, | 1814 0 for an option that takes no arguments, |
1798 1 for an option that takes one argument, etc. | 1815 1 for an option that takes one argument, etc. |
1799 -1 for an ordinary non-option argument. */ | 1816 -1 for an ordinary non-option argument. */ |
1869 } | 1886 } |
1870 done: ; | 1887 done: ; |
1871 } | 1888 } |
1872 } | 1889 } |
1873 | 1890 |
1874 /* Copy the arguments, in order of decreasing priority, to NEW. */ | 1891 /* Copy the arguments, in order of decreasing priority, to NEW_ARGV. */ |
1875 new[0] = argv[0]; | 1892 new_argv[0] = argv[0]; |
1876 while (to < argc) | 1893 while (to < argc) |
1877 { | 1894 { |
1878 int best = -1; | 1895 int best = -1; |
1879 int best_priority = -9999; | 1896 int best_priority = -9999; |
1880 | 1897 |
1893 } | 1910 } |
1894 | 1911 |
1895 if (best < 0) | 1912 if (best < 0) |
1896 abort (); | 1913 abort (); |
1897 | 1914 |
1898 /* Copy the highest priority remaining option, with its args, to NEW. */ | 1915 /* Copy the highest priority remaining option, with its args, to NEW_ARGV. */ |
1899 new[to++] = argv[best]; | 1916 new_argv[to++] = argv[best]; |
1900 for (i = 0; i < options[best]; i++) | 1917 for (i = 0; i < options[best]; i++) |
1901 new[to++] = argv[best + i + 1]; | 1918 new_argv[to++] = argv[best + i + 1]; |
1902 | 1919 |
1903 /* Clear out this option in ARGV. */ | 1920 /* Clear out this option in ARGV. */ |
1904 argv[best] = 0; | 1921 argv[best] = 0; |
1905 for (i = 0; i < options[best]; i++) | 1922 for (i = 0; i < options[best]; i++) |
1906 argv[best + i + 1] = 0; | 1923 argv[best + i + 1] = 0; |
1907 } | 1924 } |
1908 | 1925 |
1909 memcpy (argv, new, sizeof (char *) * argc); | 1926 memcpy (argv, new_argv, sizeof (char *) * argc); |
1927 xfree (new_argv); | |
1928 xfree (options); | |
1929 xfree (priority); | |
1910 } | 1930 } |
1911 | 1931 |
1912 static JMP_BUF run_temacs_catch; | 1932 static JMP_BUF run_temacs_catch; |
1913 | 1933 |
1914 static int run_temacs_argc; | 1934 static int run_temacs_argc; |
1936 this can be much faster)). [Actually, the speed difference isn't that | 1956 this can be much faster)). [Actually, the speed difference isn't that |
1937 much as long as your filesystem is local, and you don't end up with | 1957 much as long as your filesystem is local, and you don't end up with |
1938 a dumped version in case you want to rerun it. This function is most | 1958 a dumped version in case you want to rerun it. This function is most |
1939 useful when used as part of the `make all-elc' command. --ben] | 1959 useful when used as part of the `make all-elc' command. --ben] |
1940 This will "restart" emacs with the specified command-line arguments. | 1960 This will "restart" emacs with the specified command-line arguments. |
1941 */ | 1961 |
1962 Martin thinks this function is most useful when using debugging | |
1963 tools like Purify or tcov that get confused by XEmacs' dumping. */ | |
1942 (int nargs, Lisp_Object *args)) | 1964 (int nargs, Lisp_Object *args)) |
1943 { | 1965 { |
1944 int ac; | 1966 int ac; |
1945 CONST Extbyte *wampum; | 1967 CONST Extbyte *wampum; |
1946 int namesize; | 1968 int namesize; |
1986 catchlist = NULL; /* Important! Otherwise free_cons() calls in | 2008 catchlist = NULL; /* Important! Otherwise free_cons() calls in |
1987 condition_case_unwind() may lead to GC death. */ | 2009 condition_case_unwind() may lead to GC death. */ |
1988 unbind_to (0, Qnil); /* this closes loadup.el */ | 2010 unbind_to (0, Qnil); /* this closes loadup.el */ |
1989 purify_flag = 0; | 2011 purify_flag = 0; |
1990 run_temacs_argc = nargs + 1; | 2012 run_temacs_argc = nargs + 1; |
2013 #if 0 | |
1991 #ifdef REPORT_PURE_USAGE | 2014 #ifdef REPORT_PURE_USAGE |
1992 report_pure_usage (1, 0); | 2015 report_pure_usage (1, 0); |
1993 #else | 2016 #else |
1994 report_pure_usage (0, 0); | 2017 report_pure_usage (0, 0); |
1995 #endif | 2018 #endif |
2019 #endif /* 0 */ | |
1996 LONGJMP (run_temacs_catch, 1); | 2020 LONGJMP (run_temacs_catch, 1); |
1997 return Qnil; /* not reached; warning suppression */ | 2021 return Qnil; /* not reached; warning suppression */ |
1998 } | 2022 } |
1999 | 2023 |
2000 /* ARGSUSED */ | 2024 /* ARGSUSED */ |
2002 main (int argc, char **argv, char **envp) | 2026 main (int argc, char **argv, char **envp) |
2003 { | 2027 { |
2004 int volatile vol_argc = argc; | 2028 int volatile vol_argc = argc; |
2005 char ** volatile vol_argv = argv; | 2029 char ** volatile vol_argv = argv; |
2006 char ** volatile vol_envp = envp; | 2030 char ** volatile vol_envp = envp; |
2007 /* This is hairy. We need to compute where the XEmacs binary was invoked */ | 2031 /* This is hairy. We need to compute where the XEmacs binary was invoked |
2008 /* from because temacs initialization requires it to find the lisp */ | 2032 from because temacs initialization requires it to find the lisp |
2009 /* directories. The code that recomputes the path is guarded by the */ | 2033 directories. The code that recomputes the path is guarded by the |
2010 /* restarted flag. There are three possible paths I've found so far */ | 2034 restarted flag. There are three possible paths I've found so far |
2011 /* through this: */ | 2035 through this: |
2012 /* temacs -- When running temacs for basic build stuff, the first main_1 */ | 2036 |
2013 /* will be the only one invoked. It must compute the path else there */ | 2037 temacs -- When running temacs for basic build stuff, the first main_1 |
2014 /* will be a very ugly bomb in startup.el (can't find obvious location */ | 2038 will be the only one invoked. It must compute the path else there |
2015 /* for doc-directory data-directory, etc.). */ | 2039 will be a very ugly bomb in startup.el (can't find obvious location |
2016 /* temacs w/ run-temacs on the command line -- This is run to bytecompile */ | 2040 for doc-directory data-directory, etc.). |
2017 /* all the out of date dumped lisp. It will execute both of the main_1 */ | 2041 |
2018 /* calls and the second one must not touch the first computation because */ | 2042 temacs w/ run-temacs on the command line -- This is run to bytecompile |
2019 /* argc/argv are hosed the second time through. */ | 2043 all the out of date dumped lisp. It will execute both of the main_1 |
2020 /* xemacs -- Only the second main_1 is executed. The invocation path must */ | 2044 calls and the second one must not touch the first computation because |
2021 /* computed but this only matters when running in place or when running */ | 2045 argc/argv are hosed the second time through. |
2022 /* as a login shell. */ | 2046 |
2023 /* As a bonus for straightening this out, XEmacs can now be run in place */ | 2047 xemacs -- Only the second main_1 is executed. The invocation path must |
2024 /* as a login shell. This never used to work. */ | 2048 computed but this only matters when running in place or when running |
2025 /* As another bonus, we can now guarantee that */ | 2049 as a login shell. |
2026 /* (concat invocation-directory invocation-name) contains the filename */ | 2050 |
2027 /* of the XEmacs binary we are running. This can now be used in a */ | 2051 As a bonus for straightening this out, XEmacs can now be run in place |
2028 /* definite test for out of date dumped files. -slb */ | 2052 as a login shell. This never used to work. |
2053 | |
2054 As another bonus, we can now guarantee that | |
2055 (concat invocation-directory invocation-name) contains the filename | |
2056 of the XEmacs binary we are running. This can now be used in a | |
2057 definite test for out of date dumped files. -slb */ | |
2029 int restarted = 0; | 2058 int restarted = 0; |
2030 #ifdef QUANTIFY | 2059 #ifdef QUANTIFY |
2031 quantify_stop_recording_data (); | 2060 quantify_stop_recording_data (); |
2032 quantify_clear_data (); | 2061 quantify_clear_data (); |
2033 #endif /* QUANTIFY */ | 2062 #endif /* QUANTIFY */ |
2078 #endif /* _SCO_DS */ | 2107 #endif /* _SCO_DS */ |
2079 vol_envp = environ; | 2108 vol_envp = environ; |
2080 } | 2109 } |
2081 #ifdef RUN_TIME_REMAP | 2110 #ifdef RUN_TIME_REMAP |
2082 else | 2111 else |
2083 /* obviously no-one uses this because where it was before initalized was | 2112 /* obviously no-one uses this because where it was before initialized was |
2084 *always* true */ | 2113 *always* true */ |
2085 run_time_remap (argv[0]); | 2114 run_time_remap (argv[0]); |
2086 #endif | 2115 #endif |
2087 | 2116 |
2088 #ifdef DOUG_LEA_MALLOC | 2117 #ifdef DOUG_LEA_MALLOC |
2447 /* here we break our rule that the filename conversion should | 2476 /* here we break our rule that the filename conversion should |
2448 be performed at the actual time that the system call is made. | 2477 be performed at the actual time that the system call is made. |
2449 It's a whole lot easier to do the conversion here than to | 2478 It's a whole lot easier to do the conversion here than to |
2450 modify all the unexec routines to ensure that filename | 2479 modify all the unexec routines to ensure that filename |
2451 conversion is applied everywhere. Don't worry about memory | 2480 conversion is applied everywhere. Don't worry about memory |
2452 leakage because this call only happens once. */ | 2481 leakage because this call only happens once. */ |
2453 unexec (intoname_ext, symname_ext, (uintptr_t) my_edata, 0, 0); | 2482 unexec (intoname_ext, symname_ext, (uintptr_t) my_edata, 0, 0); |
2454 #ifdef DOUG_LEA_MALLOC | 2483 #ifdef DOUG_LEA_MALLOC |
2455 free (malloc_state_ptr); | 2484 free (malloc_state_ptr); |
2456 #endif | 2485 #endif |
2457 } | 2486 } |
2458 #endif /* not MSDOS and EMX */ | 2487 #endif /* not MSDOS and EMX */ |
2459 | 2488 |
2460 purify_flag = opurify; | 2489 purify_flag = opurify; |
2603 } | 2632 } |
2604 #endif /* USE_ASSERTIONS */ | 2633 #endif /* USE_ASSERTIONS */ |
2605 | 2634 |
2606 #ifdef QUANTIFY | 2635 #ifdef QUANTIFY |
2607 DEFUN ("quantify-start-recording-data", Fquantify_start_recording_data, | 2636 DEFUN ("quantify-start-recording-data", Fquantify_start_recording_data, |
2608 0, 0, 0, /* | 2637 0, 0, "", /* |
2609 Start recording Quantify data. | 2638 Start recording Quantify data. |
2610 */ | 2639 */ |
2611 ()) | 2640 ()) |
2612 { | 2641 { |
2613 quantify_start_recording_data (); | 2642 quantify_start_recording_data (); |
2614 return Qnil; | 2643 return Qnil; |
2615 } | 2644 } |
2616 | 2645 |
2617 DEFUN ("quantify-stop-recording-data", Fquantify_stop_recording_data, | 2646 DEFUN ("quantify-stop-recording-data", Fquantify_stop_recording_data, |
2618 0, 0, 0, /* | 2647 0, 0, "", /* |
2619 Stop recording Quantify data. | 2648 Stop recording Quantify data. |
2620 */ | 2649 */ |
2621 ()) | 2650 ()) |
2622 { | 2651 { |
2623 quantify_stop_recording_data (); | 2652 quantify_stop_recording_data (); |
2624 return Qnil; | 2653 return Qnil; |
2625 } | 2654 } |
2626 | 2655 |
2627 DEFUN ("quantify-clear-data", Fquantify_clear_data, 0, 0, 0, /* | 2656 DEFUN ("quantify-clear-data", Fquantify_clear_data, 0, 0, "", /* |
2628 Clear all Quantify data. | 2657 Clear all Quantify data. |
2629 */ | 2658 */ |
2630 ()) | 2659 ()) |
2631 { | 2660 { |
2632 quantify_clear_data (); | 2661 quantify_clear_data (); |
2855 | 2884 |
2856 void | 2885 void |
2857 complex_vars_of_emacs (void) | 2886 complex_vars_of_emacs (void) |
2858 { | 2887 { |
2859 /* This is all related to path searching. */ | 2888 /* This is all related to path searching. */ |
2860 | 2889 |
2861 DEFVAR_LISP ("emacs-program-name", &Vemacs_program_name /* | 2890 DEFVAR_LISP ("emacs-program-name", &Vemacs_program_name /* |
2862 *Name of the Emacs variant. | 2891 *Name of the Emacs variant. |
2863 For example, this may be \"xemacs\" or \"infodock\". | 2892 For example, this may be \"xemacs\" or \"infodock\". |
2864 This is mainly meant for use in path searching. | 2893 This is mainly meant for use in path searching. |
2865 */ ); | 2894 */ ); |