Mercurial > hg > xemacs-beta
comparison src/emacs.c @ 1315:70921960b980
[xemacs-hg @ 2003-02-20 08:19:28 by ben]
check in makefile fixes et al
Makefile.in.in: Major surgery. Move all stuff related to building anything in the
src/ directory into src/. Simplify the dependencies -- everything
in src/ is dependent on the single entry `src' in MAKE_SUBDIRS.
Remove weirdo targets like `all-elc[s]', dump-elc[s], etc.
mule/mule-msw-init.el: Removed.
Delete this file.
mule/mule-win32-init.el: New file, with stuff from mule-msw-init.el -- not just for MS Windows
native, boys and girls!
bytecomp.el: Change code inserted to catch trying to load a Mule-only .elc
file in a non-Mule XEmacs. Formerly you got the rather cryptic
"The required feature `mule' cannot be provided". Now you get
"Loading this file requires Mule support".
finder.el: Remove dependency on which directory this function is invoked
from.
update-elc.el: Don't mess around with ../src/BYTECOMPILE_CHANGE. Now that
Makefile.in.in and xemacs.mak are in sync, both of them use
NEEDTODUMP and the other one isn't used.
dumped-lisp.el: Rewrite in terms of `list' and `nconc' instead of assemble-list, so
we can have arbitrary forms, not just `when-feature'.
very-early-lisp.el: Nuke this file.
finder-inf.el, packages.el, update-elc.el, update-elc-2.el, loadup.el, make-docfile.el: Eliminate references to very-early-lisp.
msw-glyphs.el: Comment clarification.
xemacs.mak: Add macros DO_TEMACS, DO_XEMACS, and a few others; this macro
section is now completely in sync with src/Makefile.in.in. Copy
check-features, load-shadows, and rebuilding finder-inf.el from
src/Makefile.in.in. The main build/dump/recompile process is now
synchronized with src/Makefile.in.in. Change `WARNING' to `NOTE'
and `error checking' to `error-checking' TO avoid tripping
faux warnings and errors in the VC++ IDE.
Makefile.in.in: Major surgery. Move all stuff related to building anything in the
src/ directory from top-level Makefile.in.in to here. Simplify
the dependencies. Rearrange into logical subsections.
Synchronize the main compile/dump/build-elcs section with
xemacs.mak, which is already clean and in good working order.
Remove weirdo targets like `all-elc[s]', dump-elc[s], etc. Add
additional levels of macros \(e.g. DO_TEMACS, DO_XEMACS,
TEMACS_BATCH, XEMACS_BATCH, XEMACS_BATCH_PACKAGES) to factor out
duplicated stuff. Clean up handling of "HEAP_IN_DATA" (Cygwin) so
it doesn't need to ignore the return value from dumping. Add
.NO_PARALLEL since various aspects of building and dumping must be
serialized but do not always have dependencies between them
(this is impossible in some cases). Everything related to src/
now gets built in one pass in this directory by just running
`make' (except the Makefiles themselves and config.h, paths.h,
Emacs.ad.h, and other generated .h files).
console.c: Update list of possibly valid console types.
emacs.c: Rationalize the specifying and handling of the type of the first
frame. This was originally prompted by a workspace in which I got
GTK to compile under C++ and in the process fixed it so it could
coexist with X in the same build -- hence, a combined
TTY/X/MS-Windows/GTK build is now possible under Cygwin. (However,
you can't simultaneously *display* more than one kind of device
connection -- but getting that to work is not that difficult.
Perhaps a project for a bored grad student. I (ben) would do it
but don't see the use.) To make sense of this, I added new
switches that can be used to specifically indicate the window
system: -x [aka --use-x], -tty \[aka --use-tty], -msw [aka
--use-ms-windows], -gtk [aka --use-gtk], and -gnome [aka
--use-gnome, same as --use-gtk]. -nw continues as an alias for
-tty. When none have been given, XEmacs checks for other
parameters implying particular device types (-t -> tty, -display
-> x [or should it have same treatment as DISPLAY below?]), and
has ad-hoc logic afterwards: if env var DISPLAY is set, use x (or
gtk? perhaps should check whether gnome is running), else MS
Windows if it exsits, else TTY if it exists, else stream, and you
must be running in batch mode. This also fixes an existing bug
whereby compiling with no x, no mswin, no tty, when running non-
interactively (e.g. to dump) I get "sorry, must have TTY support".
emacs.c: Turn on Vstack_trace_on_error so that errors are debuggable even
when occurring extremely early in reinitialization.
emacs.c: Try to make sure that the user can see message output under
Windows (i.e. it doesn't just disappear right away) regardless of
when it occurs, e.g. in the middle of creating the first frame.
emacs.c: Define new function `emacs-run-status', indicating whether XEmacs
is noninteractive or interactive, whether raw,
post-dump/pdump-load or run-temacs, whether we are dumping,
whether pdump is in effect.
event-stream.c: It's "mommas are fat", not "momas are fat".
Fix other typo.
event-stream.c: Conditionalize in_menu_callback check on HAVE_MENUBARS,
because it won't exist on w/o menubar support,
lisp.h: More hackery on RETURN_NOT_REACHED. Cygwin v3.2 DOES complain here
if RETURN_NOT_REACHED() is blank, as it is for GCC 2.5+. So make it
blank only for GCC 2.5 through 2.999999999999999.
Declare Vstack_trace_on_error.
profile.c: Need to include "profile.h" to fix warnings.
sheap.c: Don't fatal() when need to rerun Make, just stderr_out() and exit(0).
That way we can distinguish between a dumping failing expectedly
(due to lack of stack space, triggering another dump) and unexpectedly,
in which case, we want to stop building. (or go on, if -K is given)
syntax.c, syntax.h: Use ints where they belong, and enum syntaxcode's where they belong,
and fix warnings thereby.
syntax.h: Fix crash caused by an edge condition in the syntax-cache macros.
text.h: Spacing fixes.
xmotif.h: New file, to get around shadowing warnings.
EmacsManager.c, event-Xt.c, glyphs-x.c, gui-x.c, input-method-motif.c, xmmanagerp.h, xmprimitivep.h: Include xmotif.h.
alloc.c: Conditionalize in_malloc on ERROR_CHECK_MALLOC.
config.h.in, file-coding.h, fileio.c, getloadavg.c, select-x.c, signal.c, sysdep.c, sysfile.h, systime.h, text.c, unicode.c: Eliminate HAVE_WIN32_CODING_SYSTEMS, use WIN32_ANY instead.
Replace defined (WIN32_NATIVE) || defined (CYGWIN) with WIN32_ANY.
lisp.h: More futile attempts to walk and chew gum at the same time when
dealing with subr's that don't return.
author | ben |
---|---|
date | Thu, 20 Feb 2003 08:19:44 +0000 |
parents | f99d3d25df86 |
children | 4542b72c005e |
comparison
equal
deleted
inserted
replaced
1314:15a91d7ae2d1 | 1315:70921960b980 |
---|---|
1 /* XEmacs -- Fully extensible Emacs, running on Unix and other platforms. | 1 /* XEmacs -- Fully extensible Emacs, running on Unix and other platforms. |
2 Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994 | 2 Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994 |
3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
4 Copyright (C) 1995 Sun Microsystems, Inc. | 4 Copyright (C) 1995 Sun Microsystems, Inc. |
5 Copyright (C) 2000, 2001, 2002 Ben Wing. | 5 Copyright (C) 2000, 2001, 2002, 2003 Ben Wing. |
6 | 6 |
7 This file is part of XEmacs. | 7 This file is part of XEmacs. |
8 | 8 |
9 XEmacs is free software; you can redistribute it and/or modify it | 9 XEmacs is free software; you can redistribute it and/or modify it |
10 under the terms of the GNU General Public License as published by the | 10 under the terms of the GNU General Public License as published by the |
266 | 266 |
267 #ifdef TOOLTALK | 267 #ifdef TOOLTALK |
268 #include TT_C_H_FILE | 268 #include TT_C_H_FILE |
269 #endif | 269 #endif |
270 | 270 |
271 #if defined (WIN32_NATIVE) || defined (CYGWIN) | 271 #ifdef WIN32_ANY |
272 #include "console-msw.h" | 272 #include "console-msw.h" |
273 #endif | 273 #endif |
274 | 274 |
275 /* For PATH_EXEC */ | 275 /* For PATH_EXEC */ |
276 #include <paths.h> | 276 #include <paths.h> |
463 | 463 |
464 static void sort_args (int argc, char **argv); | 464 static void sort_args (int argc, char **argv); |
465 | 465 |
466 Lisp_Object Qkill_emacs_hook; | 466 Lisp_Object Qkill_emacs_hook; |
467 Lisp_Object Qsave_buffers_kill_emacs; | 467 Lisp_Object Qsave_buffers_kill_emacs; |
468 | |
469 Lisp_Object Qtemacs, Qdumping, Qrestarted, Qpdump, Qbatch; | |
468 | 470 |
469 /* Nonzero if handling a fatal error already. */ | 471 /* Nonzero if handling a fatal error already. */ |
470 int fatal_error_in_progress; | 472 int fatal_error_in_progress; |
471 | 473 |
472 /* Nonzero means we're going down, so we better not run any hooks | 474 /* Nonzero means we're going down, so we better not run any hooks |
676 { | 678 { |
677 return 0; | 679 return 0; |
678 } | 680 } |
679 } | 681 } |
680 | 682 |
683 static void | |
684 check_compatible_window_system (char *must) | |
685 { | |
686 if (display_use && strcmp (display_use, must)) | |
687 fatal ("Incompatible window system type `%s': `%s' already specified", | |
688 must, display_use); | |
689 display_use = must; | |
690 } | |
691 | |
681 | 692 |
682 /************************************************************************/ | 693 /************************************************************************/ |
683 /* main and friends: XEmacs startup */ | 694 /* main and friends: XEmacs startup */ |
684 /************************************************************************/ | 695 /************************************************************************/ |
685 | 696 |
701 main_1 (int argc, Extbyte **argv, Extbyte **envp, int restart) | 712 main_1 (int argc, Extbyte **argv, Extbyte **envp, int restart) |
702 { | 713 { |
703 char stack_bottom_variable; | 714 char stack_bottom_variable; |
704 int skip_args = 0; | 715 int skip_args = 0; |
705 Lisp_Object load_me; | 716 Lisp_Object load_me; |
706 int inhibit_window_system; | |
707 #ifdef NeXT | 717 #ifdef NeXT |
708 extern int malloc_cookie; | 718 extern int malloc_cookie; |
709 #endif | 719 #endif |
710 | 720 |
711 /* !!#### Under MS Windows, this should all be rewritten to deal with | 721 /* !!#### Under MS Windows, this should all be rewritten to deal with |
728 __realloc_hook = NULL; | 738 __realloc_hook = NULL; |
729 __free_hook = NULL; | 739 __free_hook = NULL; |
730 #endif /* not SYSTEM_MALLOC or HAVE_LIBMCHECK or DOUG_LEA_MALLOC */ | 740 #endif /* not SYSTEM_MALLOC or HAVE_LIBMCHECK or DOUG_LEA_MALLOC */ |
731 | 741 |
732 noninteractive = 0; | 742 noninteractive = 0; |
743 display_use = 0; | |
733 inhibit_non_essential_printing_operations = 1; | 744 inhibit_non_essential_printing_operations = 1; |
734 | 745 |
735 #ifdef NeXT | 746 #ifdef NeXT |
736 /* 19-Jun-1995 -baw | 747 /* 19-Jun-1995 -baw |
737 * NeXT secret magic, ripped from Emacs-for-NS by Carl Edman | 748 * NeXT secret magic, ripped from Emacs-for-NS by Carl Edman |
801 | 812 |
802 #ifdef EXTRA_INITIALIZE | 813 #ifdef EXTRA_INITIALIZE |
803 EXTRA_INITIALIZE; | 814 EXTRA_INITIALIZE; |
804 #endif | 815 #endif |
805 | 816 |
806 #ifdef HAVE_WINDOW_SYSTEM | |
807 inhibit_window_system = 0; | |
808 #else | |
809 inhibit_window_system = 1; | |
810 #endif | |
811 | |
812 /* NOTE NOTE NOTE: Keep the following args in sync with the big list of | 817 /* NOTE NOTE NOTE: Keep the following args in sync with the big list of |
813 arguments below in standard_args[], with the help text in startup.el, | 818 arguments below in standard_args[], with the help text in startup.el, |
814 and with the list of non-clobbered variables near where pdump_load() | 819 and with the list of non-clobbered variables near where pdump_load() |
815 is called! */ | 820 is called! */ |
816 | 821 |
824 printf ("Portable dumper not configured; -sd just forces exit.\n"); | 829 printf ("Portable dumper not configured; -sd just forces exit.\n"); |
825 #endif | 830 #endif |
826 exit (0); | 831 exit (0); |
827 } | 832 } |
828 | 833 |
829 /* Handle the -t switch, which specifies filename to use as terminal */ | |
830 { | |
831 Extbyte *term; | |
832 if (argmatch (argv, argc, "-t", "--terminal", 0, &term, &skip_args)) | |
833 { | |
834 retry_close (0); | |
835 retry_close (1); | |
836 if (open (term, O_RDWR | OPEN_BINARY, 2) < 0) | |
837 fatal ("%s: %s", term, strerror (errno)); | |
838 dup (0); | |
839 if (! isatty (0)) | |
840 fatal ("%s: not a tty", term); | |
841 | |
842 #if 0 | |
843 stderr_out ("Using %s", ttyname (0)); | |
844 #endif | |
845 stderr_out ("Using %s", term); | |
846 inhibit_window_system = 1; /* -t => -nw */ | |
847 } | |
848 } | |
849 | |
850 /* Handle the --no-dump-file/-nd switch, which means don't load the dump | 834 /* Handle the --no-dump-file/-nd switch, which means don't load the dump |
851 file (ignored when not using pdump) */ | 835 file (ignored when not using pdump) */ |
852 if (argmatch (argv, argc, "-nd", "--no-dump-file", 0, NULL, &skip_args)) | 836 if (argmatch (argv, argc, "-nd", "--no-dump-file", 0, NULL, &skip_args)) |
853 nodumpfile = 1; | 837 nodumpfile = 1; |
854 | |
855 /* Handle -nw switch */ | |
856 if (argmatch (argv, argc, "-nw", "--no-windows", 0, NULL, &skip_args)) | |
857 inhibit_window_system = 1; | |
858 | 838 |
859 /* Handle the -batch switch, which means don't do interactive display. */ | 839 /* Handle the -batch switch, which means don't do interactive display. */ |
860 if (argmatch (argv, argc, "-batch", "--batch", 0, NULL, &skip_args)) | 840 if (argmatch (argv, argc, "-batch", "--batch", 0, NULL, &skip_args)) |
861 { | 841 { |
862 #if 0 /* I don't think this is correct. */ | 842 #if 0 /* I don't think this is correct. */ |
948 argmatch (argv, argc, "-V", 0, 2, NULL, &skip_args)) | 928 argmatch (argv, argc, "-V", 0, 2, NULL, &skip_args)) |
949 noninteractive = 1, skip_args--; | 929 noninteractive = 1, skip_args--; |
950 | 930 |
951 /* Now, figure out which type of console is our first console. */ | 931 /* Now, figure out which type of console is our first console. */ |
952 | 932 |
953 display_arg = 0; | |
954 | |
955 if (noninteractive) | 933 if (noninteractive) |
956 display_use = "stream"; | 934 display_use = "stream"; |
957 else | 935 |
958 display_use = "tty"; | 936 if (argmatch (argv, argc, "-nw", "--no-windows", 0, NULL, &skip_args) || |
959 | 937 argmatch (argv, argc, "-tty", "--use-tty", 0, NULL, &skip_args)) |
938 { | |
939 check_compatible_window_system ("tty"); | |
960 #ifndef HAVE_TTY | 940 #ifndef HAVE_TTY |
961 if (inhibit_window_system) | 941 fatal ("Sorry, this XEmacs was not compiled with TTY support"); |
962 fatal ("Sorry, this XEmacs was not compiled with TTY support"); | 942 #endif |
963 #endif | 943 } |
964 | 944 |
965 #ifdef HAVE_WINDOW_SYSTEM | 945 if (argmatch (argv, argc, "-x", "--use-x", 0, NULL, &skip_args)) |
946 { | |
947 check_compatible_window_system ("x"); | |
948 #ifndef HAVE_X_WINDOWS | |
949 fatal ("Sorry, this XEmacs was not compiled with X support"); | |
950 #endif | |
951 } | |
952 | |
953 if (argmatch (argv, argc, "-gtk", "--use-gtk", 0, NULL, &skip_args) || | |
954 argmatch (argv, argc, "-gnome", "--use-gnome", 0, NULL, &skip_args)) | |
955 { | |
956 check_compatible_window_system ("gtk"); | |
957 #ifndef HAVE_GTK | |
958 fatal ("Sorry, this XEmacs was not compiled with GTK support"); | |
959 #endif | |
960 } | |
961 | |
962 if (argmatch (argv, argc, "-msw", "--use-ms-windows", 0, NULL, &skip_args)) | |
963 { | |
964 check_compatible_window_system ("mswindows"); | |
965 #ifndef HAVE_MS_WINDOWS | |
966 fatal ("Sorry, this XEmacs was not compiled with MS Windows support"); | |
967 #endif | |
968 } | |
969 | |
970 /* Handle other switches implying particular window systems: */ | |
971 | |
972 /* Handle the -t switch, which specifies filename to use as terminal */ | |
973 { | |
974 Extbyte *term; | |
975 if (argmatch (argv, argc, "-t", "--terminal", 0, &term, &skip_args)) | |
976 { | |
977 check_compatible_window_system ("tty"); | |
978 #ifndef HAVE_TTY | |
979 fatal ("Sorry, this XEmacs was not compiled with TTY support"); | |
980 #endif | |
981 | |
982 retry_close (0); | |
983 retry_close (1); | |
984 if (open (term, O_RDWR | OPEN_BINARY, 2) < 0) | |
985 fatal ("%s: %s", term, strerror (errno)); | |
986 dup (0); | |
987 if (! isatty (0)) | |
988 fatal ("%s: not a tty", term); | |
989 | |
990 #if 0 | |
991 stderr_out ("Using %s", ttyname (0)); | |
992 #endif | |
993 stderr_out ("Using %s", term); | |
994 } | |
995 } | |
996 | |
966 /* Stupid kludge to catch command-line display spec. We can't | 997 /* Stupid kludge to catch command-line display spec. We can't |
967 handle this argument entirely in window-system-dependent code | 998 handle this argument entirely in window-system-dependent code |
968 because we don't even know which window-system-dependent code | 999 because we don't even know which window-system-dependent code |
969 to run until we've recognized this argument. */ | 1000 to run until we've recognized this argument. */ |
970 if (!inhibit_window_system && !noninteractive) | 1001 { |
971 { | |
972 #ifdef HAVE_X_WINDOWS | 1002 #ifdef HAVE_X_WINDOWS |
973 char *dpy = 0; | 1003 char *dpy = 0; |
974 int count_before = skip_args; | 1004 int count_before = skip_args; |
975 | 1005 |
976 if (argmatch (argv, argc, "-d", "--display", 3, &dpy, &skip_args) || | 1006 if (argmatch (argv, argc, "-d", "--display", 3, &dpy, &skip_args) || |
977 argmatch (argv, argc, "-display", 0, 3, &dpy, &skip_args)) | 1007 argmatch (argv, argc, "-display", 0, 3, &dpy, &skip_args)) |
978 { | 1008 { |
979 display_arg = 1; | 1009 check_compatible_window_system ("x"); |
980 display_use = "x"; | 1010 display_arg = 1; |
981 } | 1011 } |
982 /* If we have the form --display=NAME, | 1012 /* If we have the form --display=NAME, |
983 convert it into -d name. | 1013 convert it into -d name. |
984 This requires inserting a new element into argv. */ | 1014 This requires inserting a new element into argv. */ |
985 if (dpy != 0 && skip_args - count_before == 1) | 1015 if (dpy != 0 && skip_args - count_before == 1) |
986 { | 1016 { |
1001 && argv[count_before + 1][1] == '-') | 1031 && argv[count_before + 1][1] == '-') |
1002 argv[count_before + 1] = "-d"; | 1032 argv[count_before + 1] = "-d"; |
1003 | 1033 |
1004 /* Don't actually discard this arg. */ | 1034 /* Don't actually discard this arg. */ |
1005 skip_args = count_before; | 1035 skip_args = count_before; |
1006 | 1036 #endif /* HAVE_X_WINDOWS */ |
1007 /* If there is a non-empty environment var DISPLAY, set | 1037 } |
1008 `display_use', but not `display_arg', which is only to be set | 1038 |
1009 if the display was specified on the command line. */ | 1039 /* If no switch telling us which window system to use, try other |
1040 possibilities: */ | |
1041 | |
1042 #if defined (HAVE_X_WINDOWS) || defined (HAVE_GTK) | |
1043 if (!display_use) | |
1044 { | |
1045 char *dpy; | |
1046 /* If there is a non-empty environment var DISPLAY, assume X or GTK, | |
1047 but don't set `display_arg', which is only to be set if the | |
1048 display was specified on the command line. */ | |
1010 if ((dpy = getenv ("DISPLAY")) && dpy[0]) | 1049 if ((dpy = getenv ("DISPLAY")) && dpy[0]) |
1050 #ifdef HAVE_X_WINDOWS | |
1051 /* #### Who gets precedence? X or GTK? For the moment, GTK support is | |
1052 unstable so use X. Maybe eventually we will switch this. */ | |
1011 display_use = "x"; | 1053 display_use = "x"; |
1012 | 1054 #else |
1013 #endif /* HAVE_X_WINDOWS */ | 1055 display_use = "gtk"; |
1014 #ifdef HAVE_GTK | 1056 #endif |
1015 { | 1057 } |
1016 char *dpy = getenv ("DISPLAY"); | 1058 #endif /* defined (HAVE_X_WINDOWS) || defined (HAVE_GTK) */ |
1017 if (dpy && dpy[0]) | 1059 |
1018 display_use = "gtk"; | |
1019 } | |
1020 #endif | |
1021 #ifdef HAVE_MS_WINDOWS | 1060 #ifdef HAVE_MS_WINDOWS |
1022 if (strcmp (display_use, "x") != 0) | 1061 if (!display_use) |
1023 display_use = "mswindows"; | 1062 display_use = "mswindows"; |
1024 #endif /* HAVE_MS_WINDOWS */ | 1063 #endif /* HAVE_MS_WINDOWS */ |
1025 } | 1064 |
1026 #endif /* HAVE_WINDOW_SYSTEM */ | 1065 #ifdef HAVE_TTY |
1066 if (!display_use) | |
1067 display_use = "tty"; | |
1068 #endif /* HAVE_MS_WINDOWS */ | |
1069 | |
1070 if (!display_use) | |
1071 fatal ("No window systems and no TTY's in this XEmacs: Must specify " | |
1072 "-batch"); | |
1027 | 1073 |
1028 noninteractive1 = noninteractive; | 1074 noninteractive1 = noninteractive; |
1029 | 1075 |
1030 /****** Now initialize everything *******/ | 1076 /****** Now initialize everything *******/ |
1031 | 1077 |
1067 init_floatfns_very_early (); /* Catch floating-point math errors. */ | 1113 init_floatfns_very_early (); /* Catch floating-point math errors. */ |
1068 init_process_times_very_early (); /* Initialize our process timers. | 1114 init_process_times_very_early (); /* Initialize our process timers. |
1069 As early as possible, of course, | 1115 As early as possible, of course, |
1070 so we can be fairly accurate. */ | 1116 so we can be fairly accurate. */ |
1071 | 1117 |
1072 #ifdef HAVE_WIN32_CODING_SYSTEMS | 1118 #ifdef WIN32_ANY |
1073 init_win32_very_early (); | 1119 init_win32_very_early (); |
1074 #endif | 1120 #endif |
1075 #ifdef HAVE_MS_WINDOWS | 1121 #ifdef HAVE_MS_WINDOWS |
1076 /* Depends on XEUNICODE_P, only accurate after the previous call */ | 1122 /* Depends on XEUNICODE_P, only accurate after the previous call */ |
1077 init_mswindows_dde_very_early (); /* DDE needs to be initialized early so | 1123 init_mswindows_dde_very_early (); /* DDE needs to be initialized early so |
1135 debug_paths = debug_paths_save; | 1181 debug_paths = debug_paths_save; |
1136 inhibit_site_lisp = inhibit_site_lisp_save; | 1182 inhibit_site_lisp = inhibit_site_lisp_save; |
1137 inhibit_site_modules = inhibit_site_modules_save; | 1183 inhibit_site_modules = inhibit_site_modules_save; |
1138 | 1184 |
1139 if (initialized) | 1185 if (initialized) |
1140 run_temacs_argc = -1; | 1186 run_temacs_argc = restart ? -2 : -1; |
1141 else | 1187 else |
1142 purify_flag = 1; | 1188 purify_flag = 1; |
1143 } | 1189 } |
1144 #else | 1190 #else |
1145 if (!initialized) | 1191 if (!initialized) |
1371 #endif /* HAVE_MS_WINDOWS */ | 1417 #endif /* HAVE_MS_WINDOWS */ |
1372 #ifdef WIN32_NATIVE | 1418 #ifdef WIN32_NATIVE |
1373 syms_of_dired_mswindows (); | 1419 syms_of_dired_mswindows (); |
1374 syms_of_nt (); | 1420 syms_of_nt (); |
1375 #endif | 1421 #endif |
1376 #if defined (WIN32_NATIVE) || defined (CYGWIN) | 1422 #ifdef WIN32_ANY |
1377 syms_of_win32 (); | 1423 syms_of_win32 (); |
1378 #endif | 1424 #endif |
1379 | 1425 |
1380 syms_of_file_coding (); | 1426 syms_of_file_coding (); |
1381 syms_of_unicode (); | 1427 syms_of_unicode (); |
1389 #ifdef HAVE_CANNA | 1435 #ifdef HAVE_CANNA |
1390 syms_of_mule_canna (); | 1436 syms_of_mule_canna (); |
1391 #endif /* HAVE_CANNA */ | 1437 #endif /* HAVE_CANNA */ |
1392 #endif /* MULE */ | 1438 #endif /* MULE */ |
1393 | 1439 |
1394 #ifdef HAVE_WIN32_CODING_SYSTEMS | 1440 #ifdef WIN32_ANY |
1395 syms_of_intl_win32 (); | 1441 syms_of_intl_win32 (); |
1396 #endif | 1442 #endif |
1397 | 1443 |
1398 #ifdef SYMS_SYSTEM | 1444 #ifdef SYMS_SYSTEM |
1399 SYMS_SYSTEM; | 1445 SYMS_SYSTEM; |
1554 For any given coding system type, the former macro must be called | 1600 For any given coding system type, the former macro must be called |
1555 before the any calls to the latter macro. */ | 1601 before the any calls to the latter macro. */ |
1556 | 1602 |
1557 coding_system_type_create (); | 1603 coding_system_type_create (); |
1558 coding_system_type_create_unicode (); | 1604 coding_system_type_create_unicode (); |
1559 #ifdef HAVE_WIN32_CODING_SYSTEMS | 1605 #ifdef WIN32_ANY |
1560 coding_system_type_create_intl_win32 (); | 1606 coding_system_type_create_intl_win32 (); |
1561 #endif | 1607 #endif |
1562 #ifdef MULE | 1608 #ifdef MULE |
1563 coding_system_type_create_mule_coding (); | 1609 coding_system_type_create_mule_coding (); |
1564 #endif | 1610 #endif |
1749 vars_of_gui (); | 1795 vars_of_gui (); |
1750 vars_of_gutter (); | 1796 vars_of_gutter (); |
1751 vars_of_indent (); | 1797 vars_of_indent (); |
1752 vars_of_insdel (); | 1798 vars_of_insdel (); |
1753 vars_of_intl (); | 1799 vars_of_intl (); |
1754 #ifdef HAVE_WIN32_CODING_SYSTEMS | 1800 #ifdef WIN32_ANY |
1755 vars_of_intl_win32 (); | 1801 vars_of_intl_win32 (); |
1756 #endif | 1802 #endif |
1757 #ifdef HAVE_XIM | 1803 #ifdef HAVE_XIM |
1758 #ifdef XIM_MOTIF | 1804 #ifdef XIM_MOTIF |
1759 vars_of_input_method_motif (); | 1805 vars_of_input_method_motif (); |
1811 #ifdef HAVE_TOOLBARS | 1857 #ifdef HAVE_TOOLBARS |
1812 vars_of_toolbar (); | 1858 vars_of_toolbar (); |
1813 #endif | 1859 #endif |
1814 vars_of_undo (); | 1860 vars_of_undo (); |
1815 vars_of_window (); | 1861 vars_of_window (); |
1816 #if defined (WIN32_NATIVE) || defined (CYGWIN) | 1862 #ifdef WIN32_ANY |
1817 vars_of_win32 (); | 1863 vars_of_win32 (); |
1818 #endif | 1864 #endif |
1819 | 1865 |
1820 #ifdef HAVE_TTY | 1866 #ifdef HAVE_TTY |
1821 vars_of_console_tty (); | 1867 vars_of_console_tty (); |
1965 vars_of_(), but lots of lots of code gets called and it's easily | 2011 vars_of_(), but lots of lots of code gets called and it's easily |
1966 possible that it could get changed to require being a | 2012 possible that it could get changed to require being a |
1967 complex_vars_of_(), for example if a charset appears anywhere, | 2013 complex_vars_of_(), for example if a charset appears anywhere, |
1968 then we suddenly have dependence on the previous call. */ | 2014 then we suddenly have dependence on the previous call. */ |
1969 complex_vars_of_file_coding (); | 2015 complex_vars_of_file_coding (); |
1970 #ifdef HAVE_WIN32_CODING_SYSTEMS | 2016 #ifdef WIN32_ANY |
1971 complex_vars_of_intl_win32 (); | 2017 complex_vars_of_intl_win32 (); |
1972 #endif | 2018 #endif |
1973 | 2019 |
1974 /* Depends on specifiers. */ | 2020 /* Depends on specifiers. */ |
1975 complex_vars_of_faces (); | 2021 complex_vars_of_faces (); |
2087 | 2133 |
2088 structure_type_create (); | 2134 structure_type_create (); |
2089 | 2135 |
2090 reinit_coding_system_type_create (); | 2136 reinit_coding_system_type_create (); |
2091 reinit_coding_system_type_create_unicode (); | 2137 reinit_coding_system_type_create_unicode (); |
2092 #ifdef HAVE_WIN32_CODING_SYSTEMS | 2138 #ifdef WIN32_ANY |
2093 reinit_coding_system_type_create_intl_win32 (); | 2139 reinit_coding_system_type_create_intl_win32 (); |
2094 #endif | 2140 #endif |
2095 #ifdef MULE | 2141 #ifdef MULE |
2096 reinit_coding_system_type_create_mule_coding (); | 2142 reinit_coding_system_type_create_mule_coding (); |
2097 #endif | 2143 #endif |
2203 not needed until we start loading Lisp code (the reader). A lot | 2249 not needed until we start loading Lisp code (the reader). A lot |
2204 of this stuff involves querying the current environment and needs | 2250 of this stuff involves querying the current environment and needs |
2205 to be done both at dump time and at run time. Some will be done | 2251 to be done both at dump time and at run time. Some will be done |
2206 only at run time, by querying the `initialized' variable. */ | 2252 only at run time, by querying the `initialized' variable. */ |
2207 | 2253 |
2208 #if defined (WIN32_NATIVE) || defined (CYGWIN) | 2254 #ifdef WIN32_ANY |
2209 init_intl_win32 (); /* Under Windows, determine whether we use Unicode | 2255 init_intl_win32 (); /* Under Windows, determine whether we use Unicode |
2210 or ANSI to call the system routines -- i.e. | 2256 or ANSI to call the system routines -- i.e. |
2211 determine what the coding system `mswindows-tstr' | 2257 determine what the coding system `mswindows-tstr' |
2212 is aliased to */ | 2258 is aliased to */ |
2213 #endif | 2259 #endif |
2256 init_macros (); /* set up so we can run macros. */ | 2302 init_macros (); /* set up so we can run macros. */ |
2257 init_editfns (); /* Determine the name of the user we're running as */ | 2303 init_editfns (); /* Determine the name of the user we're running as */ |
2258 #ifdef SUNPRO | 2304 #ifdef SUNPRO |
2259 init_sunpro (); /* Set up Sunpro usage tracking */ | 2305 init_sunpro (); /* Set up Sunpro usage tracking */ |
2260 #endif | 2306 #endif |
2261 #if defined (WIN32_NATIVE) || defined (CYGWIN) | 2307 #ifdef WIN32_ANY |
2262 init_win32 (); | 2308 init_win32 (); |
2263 #endif | 2309 #endif |
2264 #if defined (HAVE_NATIVE_SOUND) && defined (hp9000s800) | 2310 #if defined (HAVE_NATIVE_SOUND) && defined (hp9000s800) |
2265 init_hpplay (); | 2311 init_hpplay (); |
2266 #endif | 2312 #endif |
2372 static const struct standard_args standard_args[] = | 2418 static const struct standard_args standard_args[] = |
2373 { | 2419 { |
2374 /* Handled by main_1 above: Each must have its own priority and must be | 2420 /* Handled by main_1 above: Each must have its own priority and must be |
2375 in the order mentioned in main_1. */ | 2421 in the order mentioned in main_1. */ |
2376 { "-sd", "--show-dump-id", 105, 0 }, | 2422 { "-sd", "--show-dump-id", 105, 0 }, |
2377 { "-t", "--terminal", 100, 1 }, | |
2378 { "-nd", "--no-dump-file", 95, 0 }, | 2423 { "-nd", "--no-dump-file", 95, 0 }, |
2379 { "-nw", "--no-windows", 90, 0 }, | |
2380 { "-batch", "--batch", 88, 0 }, | 2424 { "-batch", "--batch", 88, 0 }, |
2381 #ifdef WIN32_NATIVE | 2425 #ifdef WIN32_NATIVE |
2382 { "-mswindows-termination-handle", 0, 84, 1 }, | 2426 { "-mswindows-termination-handle", 0, 84, 1 }, |
2383 { "-nuni", "--no-unicode-lib-calls", 83, 0 }, | 2427 { "-nuni", "--no-unicode-lib-calls", 83, 0 }, |
2384 #endif /* WIN32_NATIVE */ | 2428 #endif /* WIN32_NATIVE */ |
2389 { "-vanilla", "--vanilla", 76, 0 }, | 2433 { "-vanilla", "--vanilla", 76, 0 }, |
2390 { "-no-autoloads", "--no-autoloads", 74, 0 }, | 2434 { "-no-autoloads", "--no-autoloads", 74, 0 }, |
2391 { "-help", "--help", 72, 0 }, | 2435 { "-help", "--help", 72, 0 }, |
2392 { "-version", "--version", 70, 0 }, | 2436 { "-version", "--version", 70, 0 }, |
2393 { "-V", 0, 68, 0 }, | 2437 { "-V", 0, 68, 0 }, |
2394 { "-d", "--display", 66, 1 }, | 2438 { "-nw", "--no-windows", 66, 0 }, |
2395 { "-display", 0, 64, 1 }, | 2439 { "-tty", "--use-tty", 65, 0 }, |
2440 { "-x", "--use-x", 64, 0 }, | |
2441 { "-gtk", "--use-gtk", 63, 0 }, | |
2442 { "-gnome", "--use-gnome", 62, 0 }, | |
2443 { "-msw", "--use-ms-windows", 61, 0 }, | |
2444 { "-t", "--terminal", 58, 1 }, | |
2445 { "-d", "--display", 57, 1 }, | |
2446 { "-display", 0, 56, 1 }, | |
2396 | 2447 |
2397 /* Handled by command-line-early in startup.el: */ | 2448 /* Handled by command-line-early in startup.el: */ |
2398 { "-q", "--no-init-file", 50, 0 }, | 2449 { "-q", "--no-init-file", 50, 0 }, |
2399 { "-no-init-file", 0, 50, 0 }, | 2450 { "-no-init-file", 0, 50, 0 }, |
2400 { "-no-site-file", "--no-site-file", 50, 0 }, | 2451 { "-no-site-file", "--no-site-file", 50, 0 }, |
2558 } | 2609 } |
2559 | 2610 |
2560 if (best < 0) | 2611 if (best < 0) |
2561 abort (); | 2612 abort (); |
2562 | 2613 |
2563 /* Copy the highest priority remaining option, with its args, to NEW_ARGV. */ | 2614 /* Copy the highest priority remaining option, with its args, to |
2615 NEW_ARGV. */ | |
2564 new_argv[to++] = argv[best]; | 2616 new_argv[to++] = argv[best]; |
2565 for (i = 0; i < options[best]; i++) | 2617 for (i = 0; i < options[best]; i++) |
2566 new_argv[to++] = argv[best + i + 1]; | 2618 new_argv[to++] = argv[best + i + 1]; |
2567 | 2619 |
2568 /* Clear out this option in ARGV. */ | 2620 /* Clear out this option in ARGV. */ |
2583 becomes false once `run-emacs-from-temacs' is run. | 2635 becomes false once `run-emacs-from-temacs' is run. |
2584 */ | 2636 */ |
2585 ()) | 2637 ()) |
2586 { | 2638 { |
2587 return run_temacs_argc >= 0 ? Qt : Qnil; | 2639 return run_temacs_argc >= 0 ? Qt : Qnil; |
2640 } | |
2641 | |
2642 DEFUN ("emacs-run-status", Femacs_run_status, 0, 0, 0, /* | |
2643 Plist of values indicating the current run status of this XEmacs. | |
2644 Currently defined values: | |
2645 | |
2646 `temacs' | |
2647 If non-nil, we are running a "raw temacs" (no dump data is present | |
2648 and `run-emacs-from-temacs' not called). (same as `running-temacs-p') | |
2649 | |
2650 `dumping' | |
2651 If non-nil, we are in the process of creating dump data. (same as | |
2652 `purify-flag') | |
2653 | |
2654 `restarted' | |
2655 If non-nil, `run-emacs-from-temacs' was called. | |
2656 | |
2657 `pdump' | |
2658 If non-nil, we were compiled with pdump (portable dumping) support. | |
2659 | |
2660 `batch' | |
2661 If non-nil, we are running non-interactively. (same as `noninteractive') | |
2662 */ | |
2663 ()) | |
2664 { | |
2665 Lisp_Object plist = Qnil; | |
2666 | |
2667 #define ADD_PLIST(key, val) plist = Fcons (val, Fcons (key, plist)) | |
2668 if (run_temacs_argc >= 0) | |
2669 ADD_PLIST (Qtemacs, Qt); | |
2670 if (purify_flag) | |
2671 ADD_PLIST (Qdumping, Qt); | |
2672 if (run_temacs_argc == -2) | |
2673 ADD_PLIST (Qrestarted, Qt); | |
2674 #ifdef PDUMP | |
2675 ADD_PLIST (Qpdump, Qt); | |
2676 #endif | |
2677 if (noninteractive) | |
2678 ADD_PLIST (Qbatch, Qt); | |
2679 | |
2680 #undef ADD_PLIST | |
2681 return Fnreverse (plist); | |
2588 } | 2682 } |
2589 | 2683 |
2590 DEFUN ("run-emacs-from-temacs", Frun_emacs_from_temacs, 0, MANY, 0, /* | 2684 DEFUN ("run-emacs-from-temacs", Frun_emacs_from_temacs, 0, MANY, 0, /* |
2591 Do not call this. It will reinitialize your XEmacs. You'll be sorry. | 2685 Do not call this. It will reinitialize your XEmacs. You'll be sorry. |
2592 */ | 2686 */ |
2652 purify_flag = 0; | 2746 purify_flag = 0; |
2653 run_temacs_argc = nargs + 1; | 2747 run_temacs_argc = nargs + 1; |
2654 #if defined (HEAP_IN_DATA) && !defined (PDUMP) | 2748 #if defined (HEAP_IN_DATA) && !defined (PDUMP) |
2655 report_sheap_usage (0); | 2749 report_sheap_usage (0); |
2656 #endif | 2750 #endif |
2751 | |
2752 /* run-temacs usually only occurs as a result of building, and in all such | |
2753 cases we want a backtrace, even if it occurs very early. */ | |
2754 if (NILP (Vstack_trace_on_error)) | |
2755 Vstack_trace_on_error = Qt; | |
2756 | |
2657 LONGJMP (run_temacs_catch, 1); | 2757 LONGJMP (run_temacs_catch, 1); |
2658 RETURN_NOT_REACHED (Qnil); | 2758 RETURN_NOT_REACHED (Qnil); |
2659 } | 2759 } |
2660 | 2760 |
2661 /* ARGSUSED */ | 2761 /* ARGSUSED */ |
2748 | 2848 |
2749 06/20/96 robertl@dgii.com */ | 2849 06/20/96 robertl@dgii.com */ |
2750 { | 2850 { |
2751 extern char **_environ; | 2851 extern char **_environ; |
2752 if ((unsigned) environ == 0) | 2852 if ((unsigned) environ == 0) |
2753 environ=_environ; | 2853 environ = _environ; |
2754 } | 2854 } |
2755 #endif /* _SCO_DS */ | 2855 #endif /* _SCO_DS */ |
2756 vol_envp = environ; | 2856 vol_envp = environ; |
2757 } | 2857 } |
2758 #if defined (RUN_TIME_REMAP) && ! defined (PDUMP) | 2858 #if defined (RUN_TIME_REMAP) && ! defined (PDUMP) |
2785 r_alloc_reinit (); | 2885 r_alloc_reinit (); |
2786 #endif | 2886 #endif |
2787 } | 2887 } |
2788 #endif /* DOUG_LEA_MALLOC */ | 2888 #endif /* DOUG_LEA_MALLOC */ |
2789 | 2889 |
2790 run_temacs_argc = -1; | 2890 run_temacs_argc = -2; |
2791 | 2891 |
2792 main_1 (vol_argc, vol_argv, vol_envp, restarted); | 2892 main_1 (vol_argc, vol_argv, vol_envp, restarted); |
2793 | 2893 |
2794 #ifdef _MSC_VER | 2894 #ifdef _MSC_VER |
2795 } | 2895 } |
2982 debug_break (void) | 3082 debug_break (void) |
2983 { | 3083 { |
2984 debugging_breakpoint (); | 3084 debugging_breakpoint (); |
2985 } | 3085 } |
2986 | 3086 |
2987 #if defined (WIN32_NATIVE) || defined (CYGWIN) | 3087 #ifdef WIN32_ANY |
2988 | 3088 |
2989 /* Return whether all bytes in the specified memory block can be read. */ | 3089 /* Return whether all bytes in the specified memory block can be read. */ |
2990 int | 3090 int |
2991 debug_can_access_memory (void *ptr, Bytecount len) | 3091 debug_can_access_memory (void *ptr, Bytecount len) |
2992 { | 3092 { |
2993 return !IsBadReadPtr (ptr, len); | 3093 return !IsBadReadPtr (ptr, len); |
2994 } | 3094 } |
2995 | 3095 |
2996 #else /* !(defined (WIN32_NATIVE) || defined (CYGWIN)) */ | 3096 #else /* !WIN32_ANY */ |
2997 | 3097 |
2998 /* #### There must be a better way!!!! */ | 3098 /* #### There must be a better way!!!! */ |
2999 | 3099 |
3000 static JMP_BUF memory_error_jump; | 3100 static JMP_BUF memory_error_jump; |
3001 | 3101 |
3039 errno = old_errno; | 3139 errno = old_errno; |
3040 | 3140 |
3041 return retval; | 3141 return retval; |
3042 } | 3142 } |
3043 | 3143 |
3044 #endif /* defined (WIN32_NATIVE) || defined (CYGWIN) */ | 3144 #endif /* WIN32_ANY */ |
3045 | 3145 |
3046 #ifdef DEBUG_XEMACS | 3146 #ifdef DEBUG_XEMACS |
3047 | 3147 |
3048 DEFUN ("force-debugging-signal", Fforce_debugging_signal, 0, 1, 0, /* | 3148 DEFUN ("force-debugging-signal", Fforce_debugging_signal, 0, 1, 0, /* |
3049 Cause XEmacs to enter the debugger. | 3149 Cause XEmacs to enter the debugger. |
3080 static void | 3180 static void |
3081 pause_so_user_can_read_messages (int allow_further) | 3181 pause_so_user_can_read_messages (int allow_further) |
3082 { | 3182 { |
3083 static int already_paused; | 3183 static int already_paused; |
3084 | 3184 |
3085 if (already_paused || !noninteractive) | 3185 if (already_paused) |
3086 return; | 3186 return; |
3087 if (!allow_further) | 3187 if (!allow_further) |
3088 already_paused = 1; | 3188 already_paused = 1; |
3089 /* If we displayed a message on the console, then we must allow the | 3189 /* If we displayed a message on the console, then we must allow the |
3090 user to see this message. This may be unnecessary, but can't hurt, | 3190 user to see this message. This may be unnecessary, but can't hurt, |
3091 and we can't necessarily check arg; e.g. xemacs --help kills with | 3191 and we can't necessarily check arg; e.g. xemacs --help kills with |
3092 argument 0. */ | 3192 argument 0. */ |
3093 if (mswindows_message_outputted) | 3193 if (mswindows_message_outputted && |
3194 /* noninteractive, we always show the box. Else, | |
3195 do it when there is not yet an initial frame -- in such case, | |
3196 XEmacs will just die immediately and we wouldn't see anything. */ | |
3197 (noninteractive || NILP (Fselected_frame (Qnil)))) | |
3094 Fmswindows_message_box | 3198 Fmswindows_message_box |
3095 (build_msg_string ("Messages outputted. XEmacs is exiting."), | 3199 (build_msg_string ("Messages outputted. XEmacs is exiting."), |
3096 Qnil, Qnil); | 3200 Qnil, Qnil); |
3097 } | 3201 } |
3098 #endif | 3202 #endif |
3702 DEFSUBR (Fdump_emacs); | 3806 DEFSUBR (Fdump_emacs); |
3703 #endif /* !CANNOT_DUMP */ | 3807 #endif /* !CANNOT_DUMP */ |
3704 | 3808 |
3705 DEFSUBR (Frun_emacs_from_temacs); | 3809 DEFSUBR (Frun_emacs_from_temacs); |
3706 DEFSUBR (Frunning_temacs_p); | 3810 DEFSUBR (Frunning_temacs_p); |
3811 DEFSUBR (Femacs_run_status); | |
3707 DEFSUBR (Finvocation_name); | 3812 DEFSUBR (Finvocation_name); |
3708 DEFSUBR (Finvocation_directory); | 3813 DEFSUBR (Finvocation_directory); |
3709 DEFSUBR (Fkill_emacs); | 3814 DEFSUBR (Fkill_emacs); |
3710 DEFSUBR (Fnoninteractive); | 3815 DEFSUBR (Fnoninteractive); |
3711 | 3816 |
3719 DEFSUBR (Fquantify_clear_data); | 3824 DEFSUBR (Fquantify_clear_data); |
3720 #endif /* QUANTIFY */ | 3825 #endif /* QUANTIFY */ |
3721 | 3826 |
3722 DEFSYMBOL (Qkill_emacs_hook); | 3827 DEFSYMBOL (Qkill_emacs_hook); |
3723 DEFSYMBOL (Qsave_buffers_kill_emacs); | 3828 DEFSYMBOL (Qsave_buffers_kill_emacs); |
3829 | |
3830 DEFSYMBOL (Qtemacs); | |
3831 DEFSYMBOL (Qdumping); | |
3832 DEFSYMBOL (Qrestarted); | |
3833 DEFSYMBOL (Qpdump); | |
3834 DEFSYMBOL (Qbatch); | |
3724 } | 3835 } |
3725 | 3836 |
3726 /* Yuck! These variables may get set from command-line options when | 3837 /* Yuck! These variables may get set from command-line options when |
3727 dumping; if we don't clear them, they will still be on once the dumped | 3838 dumping; if we don't clear them, they will still be on once the dumped |
3728 XEmacs reloads. (not an issue with pdump, as we kludge around this in | 3839 XEmacs reloads. (not an issue with pdump, as we kludge around this in |