comparison src/emacs.c @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 7d59cb494b73
children a86b2b5e0111
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
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 "redisplay.h"
39 #include "frame.h"
39 #include "sysdep.h" 40 #include "sysdep.h"
40 41
41 #include "syssignal.h" /* Always include before systty.h */ 42 #include "syssignal.h" /* Always include before systty.h */
42 #include "systty.h" 43 #include "systty.h"
43 #include "sysfile.h" 44 #include "sysfile.h"
58 59
59 #ifdef TOOLTALK 60 #ifdef TOOLTALK
60 #include TT_C_H_PATH 61 #include TT_C_H_PATH
61 #endif 62 #endif
62 63
63 #ifdef APOLLO
64 #ifndef APOLLO_SR10
65 #include <default_acl.h>
66 #endif
67 #endif
68
69 #if defined (WINDOWSNT) 64 #if defined (WINDOWSNT)
70 #include <windows.h> 65 #include <windows.h>
71 #endif 66 #endif
72 67
73 /* For PATH_EXEC */ 68 /* For PATH_EXEC */
74 #include <paths.h> 69 #include <paths.h>
75 70
76 #if !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC 71 #ifdef HEAP_IN_DATA
72 void report_sheap_usage (int die_if_pure_storage_exceeded);
73 #endif
74
75 #if !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC)
77 extern void *(*__malloc_hook)(size_t); 76 extern void *(*__malloc_hook)(size_t);
78 extern void *(*__realloc_hook)(void *, size_t); 77 extern void *(*__realloc_hook)(void *, size_t);
79 extern void (*__free_hook)(void *); 78 extern void (*__free_hook)(void *);
80 #endif /* not SYSTEM_MALLOC && not DOUG_LEA_MALLOC */ 79 #endif /* not SYSTEM_MALLOC && not DOUG_LEA_MALLOC */
81 80
109 Lisp_Object Vsystem_configuration_options; 108 Lisp_Object Vsystem_configuration_options;
110 109
111 /* Version numbers and strings */ 110 /* Version numbers and strings */
112 Lisp_Object Vemacs_major_version; 111 Lisp_Object Vemacs_major_version;
113 Lisp_Object Vemacs_minor_version; 112 Lisp_Object Vemacs_minor_version;
113 Lisp_Object Vemacs_patch_level;
114 Lisp_Object Vemacs_beta_version; 114 Lisp_Object Vemacs_beta_version;
115 Lisp_Object Vxemacs_codename; 115 Lisp_Object Vxemacs_codename;
116 #ifdef INFODOCK 116 #ifdef INFODOCK
117 Lisp_Object Vinfodock_major_version; 117 Lisp_Object Vinfodock_major_version;
118 Lisp_Object Vinfodock_minor_version; 118 Lisp_Object Vinfodock_minor_version;
144 Lisp_Object Vconfigure_package_path; 144 Lisp_Object Vconfigure_package_path;
145 Lisp_Object Vdata_directory, Vconfigure_data_directory; 145 Lisp_Object Vdata_directory, Vconfigure_data_directory;
146 Lisp_Object Vdoc_directory, Vconfigure_doc_directory; 146 Lisp_Object Vdoc_directory, Vconfigure_doc_directory;
147 Lisp_Object Vconfigure_lock_directory; 147 Lisp_Object Vconfigure_lock_directory;
148 Lisp_Object Vdata_directory_list; 148 Lisp_Object Vdata_directory_list;
149 Lisp_Object Vinfo_directory, Vconfigure_info_directory; 149 Lisp_Object Vconfigure_info_directory;
150 Lisp_Object Vsite_directory, Vconfigure_site_directory; 150 Lisp_Object Vsite_directory, Vconfigure_site_directory;
151 Lisp_Object Vconfigure_info_path; 151 Lisp_Object Vconfigure_info_path;
152 Lisp_Object Vinternal_error_checking; 152 Lisp_Object Vinternal_error_checking;
153 Lisp_Object Vmail_lock_methods, Vconfigure_mail_lock_method;
153 Lisp_Object Vpath_separator; 154 Lisp_Object Vpath_separator;
154 155
155 /* The default base directory XEmacs is installed under. */ 156 /* The default base directory XEmacs is installed under. */
156 Lisp_Object Vconfigure_exec_prefix_directory, Vconfigure_prefix_directory; 157 Lisp_Object Vconfigure_exec_prefix_directory, Vconfigure_prefix_directory;
157 158
168 int display_arg; 169 int display_arg;
169 170
170 /* Type of display specified. We cannot use a Lisp symbol here because 171 /* Type of display specified. We cannot use a Lisp symbol here because
171 Lisp symbols may not initialized at the time that we set this 172 Lisp symbols may not initialized at the time that we set this
172 variable. */ 173 variable. */
173 CONST char *display_use; 174 const char *display_use;
174 175
175 /* If non-zero, then the early error handler will only print the error 176 /* If non-zero, then the early error handler will only print the error
176 message and exit. */ 177 message and exit. */
177 int suppress_early_error_handler_backtrace; 178 int suppress_early_error_handler_backtrace;
178 179
214 215
215 /* Nonzero means print debug information about path searching */ 216 /* Nonzero means print debug information about path searching */
216 int debug_paths; 217 int debug_paths;
217 218
218 /* Save argv and argc. */ 219 /* Save argv and argc. */
219 char **initial_argv; 220 static char **initial_argv;
220 int initial_argc; 221 static int initial_argc;
221 222
222 static void sort_args (int argc, char **argv); 223 static void sort_args (int argc, char **argv);
223 224
224 Lisp_Object Qkill_emacs_hook; 225 Lisp_Object Qkill_emacs_hook;
225 Lisp_Object Qsave_buffers_kill_emacs; 226 Lisp_Object Qsave_buffers_kill_emacs;
227
228 extern Lisp_Object Vlisp_EXEC_SUFFIXES;
226 229
227 230
228 /* Signal code for the fatal signal that was received */ 231 /* Signal code for the fatal signal that was received */
229 static int fatal_error_code; 232 static int fatal_error_code;
230 233
251 stderr_out ("\nLisp backtrace follows:\n\n"); 254 stderr_out ("\nLisp backtrace follows:\n\n");
252 Fbacktrace (Qexternal_debugging_output, Qt); 255 Fbacktrace (Qexternal_debugging_output, Qt);
253 # if 0 /* This is evil, rarely useful, and causes grief in some cases. */ 256 # if 0 /* This is evil, rarely useful, and causes grief in some cases. */
254 /* Check for Sun-style stack printing via /proc */ 257 /* Check for Sun-style stack printing via /proc */
255 { 258 {
256 CONST char *pstack = "/usr/proc/bin/pstack"; 259 const char *pstack = "/usr/proc/bin/pstack";
257 if (access (pstack, X_OK) == 0) 260 if (access (pstack, X_OK) == 0)
258 { 261 {
259 char buf[100]; 262 char buf[100];
260 stderr_out ("\nC backtrace follows:\n" 263 stderr_out ("\nC backtrace follows:\n"
261 "(A real debugger may provide better information)\n\n"); 264 "(A real debugger may provide better information)\n\n");
270 SIGRETURN; 273 SIGRETURN;
271 } 274 }
272 275
273 276
274 DOESNT_RETURN 277 DOESNT_RETURN
275 fatal (CONST char *fmt, ...) 278 fatal (const char *fmt, ...)
276 { 279 {
277 va_list args; 280 va_list args;
278 va_start (args, fmt); 281 va_start (args, fmt);
279 282
280 fprintf (stderr, "\nXEmacs: "); 283 fprintf (stderr, "\nXEmacs: ");
295 298
296 /* exactly equivalent to fprintf (stderr, fmt, ...) except that it calls 299 /* exactly equivalent to fprintf (stderr, fmt, ...) except that it calls
297 GETTEXT on the format string. */ 300 GETTEXT on the format string. */
298 301
299 int 302 int
300 stderr_out (CONST char *fmt, ...) 303 stderr_out (const char *fmt, ...)
301 { 304 {
302 int retval; 305 int retval;
303 va_list args; 306 va_list args;
304 va_start (args, fmt); 307 va_start (args, fmt);
305 308
312 315
313 /* exactly equivalent to fprintf (stdout, fmt, ...) except that it calls 316 /* exactly equivalent to fprintf (stdout, fmt, ...) except that it calls
314 GETTEXT on the format string. */ 317 GETTEXT on the format string. */
315 318
316 int 319 int
317 stdout_out (CONST char *fmt, ...) 320 stdout_out (const char *fmt, ...)
318 { 321 {
319 int retval; 322 int retval;
320 va_list args; 323 va_list args;
321 va_start (args, fmt); 324 va_start (args, fmt);
322 325
360 if (i == 0) 363 if (i == 0)
361 { 364 {
362 /* Do not trust to what crt0 has stuffed into argv[0] */ 365 /* Do not trust to what crt0 has stuffed into argv[0] */
363 char full_exe_path [MAX_PATH]; 366 char full_exe_path [MAX_PATH];
364 GetModuleFileName (NULL, full_exe_path, MAX_PATH); 367 GetModuleFileName (NULL, full_exe_path, MAX_PATH);
365 result = Fcons (build_ext_string (full_exe_path, FORMAT_FILENAME), 368 result = Fcons (build_ext_string (full_exe_path, Qfile_name),
366 result); 369 result);
367 #if defined(HAVE_SHLIB) 370 #if defined(HAVE_SHLIB)
368 (void)dll_init(full_exe_path); 371 (void)dll_init(full_exe_path);
369 #endif 372 #endif
370 } 373 }
371 else 374 else
372 #endif 375 #endif
373 result = Fcons (build_ext_string (argv [i], FORMAT_FILENAME), result); 376 result = Fcons (build_ext_string (argv [i], Qfile_name),
377 result);
374 } 378 }
375 } 379 }
376 return result; 380 return result;
377 } 381 }
378 382
392 REGISTER int i; 396 REGISTER int i;
393 *argv = (char**) xmalloc ((n+1) * sizeof (char*)); 397 *argv = (char**) xmalloc ((n+1) * sizeof (char*));
394 398
395 for (i = 0, next = argv_list; i < n; i++, next = XCDR (next)) 399 for (i = 0, next = argv_list; i < n; i++, next = XCDR (next))
396 { 400 {
397 CONST char *temp; 401 const char *temp;
398 CHECK_STRING (XCAR (next)); 402 CHECK_STRING (XCAR (next));
399 403
400 GET_C_STRING_EXT_DATA_ALLOCA (XCAR (next), FORMAT_OS, temp); 404 TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (next),
405 C_STRING_ALLOCA, temp,
406 Qnative);
401 (*argv) [i] = xstrdup (temp); 407 (*argv) [i] = xstrdup (temp);
402 } 408 }
403 (*argv) [n] = 0; 409 (*argv) [n] = 0;
404 *argc = i; 410 *argc = i;
405 } 411 }
538 int inhibit_window_system; 544 int inhibit_window_system;
539 #ifdef NeXT 545 #ifdef NeXT
540 extern int malloc_cookie; 546 extern int malloc_cookie;
541 #endif 547 #endif
542 548
543 #if !defined(SYSTEM_MALLOC) && !defined(HAVE_LIBMCHECK) 549 #if (!defined (SYSTEM_MALLOC) && !defined (HAVE_LIBMCHECK) \
550 && !defined (DOUG_LEA_MALLOC))
544 /* Make sure that any libraries we link against haven't installed a 551 /* Make sure that any libraries we link against haven't installed a
545 hook for a gmalloc of a potentially incompatible version. */ 552 hook for a gmalloc of a potentially incompatible version. */
546 /* If we're using libmcheck, the hooks have already been initialized, */ 553 /* If we're using libmcheck, the hooks have already been initialized, */
547 /* don't touch them. -slb */ 554 /* don't touch them. -slb */
548 __malloc_hook = NULL; 555 __malloc_hook = NULL;
549 __realloc_hook = NULL; 556 __realloc_hook = NULL;
550 __free_hook = NULL; 557 __free_hook = NULL;
551 #endif /* not SYSTEM_MALLOC */ 558 #endif /* not SYSTEM_MALLOC or HAVE_LIBMCHECK or DOUG_LEA_MALLOC */
552 559
553 noninteractive = 0; 560 noninteractive = 0;
554 561
555 #ifdef NeXT 562 #ifdef NeXT
556 /* 19-Jun-1995 -baw 563 /* 19-Jun-1995 -baw
607 if (bss_end) 614 if (bss_end)
608 brk ((void *) bss_end); 615 brk ((void *) bss_end);
609 #endif 616 #endif
610 617
611 clearerr (stdin); 618 clearerr (stdin);
612
613 #ifdef APOLLO
614 #ifndef APOLLO_SR10
615 /* If USE_DOMAIN_ACLS environment variable exists,
616 use ACLs rather than UNIX modes. */
617 if (egetenv ("USE_DOMAIN_ACLS"))
618 default_acl (USE_DEFACL);
619 #endif
620 #endif /* APOLLO */
621 619
622 #if defined (HAVE_MMAP) && defined (REL_ALLOC) 620 #if defined (HAVE_MMAP) && defined (REL_ALLOC)
623 /* ralloc can only be used if using the GNU memory allocator. */ 621 /* ralloc can only be used if using the GNU memory allocator. */
624 init_ralloc (); 622 init_ralloc ();
625 #elif defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC) 623 #elif defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC)
846 environment when the dumped XEmacs is run. 844 environment when the dumped XEmacs is run.
847 845
848 We try to do things in an order that minimizes the non-obvious 846 We try to do things in an order that minimizes the non-obvious
849 dependencies between functions. */ 847 dependencies between functions. */
850 848
849 /* purify_flag 1 is correct even if CANNOT_DUMP.
850 * loadup.el will set to nil at end. */
851
852 purify_flag = 0;
853 #ifdef PDUMP
854 if (restart)
855 initialized = 1;
856 else {
857 initialized = pdump_load ();
858 purify_flag = !initialized;
859 }
860 #else
861 if (!initialized)
862 purify_flag = 1;
863 #endif
864
851 if (!initialized) 865 if (!initialized)
852 { 866 {
853 /* Initialize things so that new Lisp objects 867 /* Initialize things so that new Lisp objects
854 can be created and objects can be staticpro'd. 868 can be created and objects can be staticpro'd.
855 Must be basically the very first thing done 869 Must be basically the very first thing done
882 Order does not matter in these functions. 896 Order does not matter in these functions.
883 */ 897 */
884 898
885 syms_of_abbrev (); 899 syms_of_abbrev ();
886 syms_of_alloc (); 900 syms_of_alloc ();
887 #ifdef HAVE_X_WINDOWS
888 syms_of_balloon_x ();
889 #endif
890 syms_of_buffer (); 901 syms_of_buffer ();
891 syms_of_bytecode (); 902 syms_of_bytecode ();
892 syms_of_callint (); 903 syms_of_callint ();
893 syms_of_callproc (); 904 syms_of_callproc ();
894 syms_of_casefiddle (); 905 syms_of_casefiddle ();
898 syms_of_cmds (); 909 syms_of_cmds ();
899 syms_of_console (); 910 syms_of_console ();
900 syms_of_data (); 911 syms_of_data ();
901 #ifdef DEBUG_XEMACS 912 #ifdef DEBUG_XEMACS
902 syms_of_debug (); 913 syms_of_debug ();
914 syms_of_tests ();
903 #endif /* DEBUG_XEMACS */ 915 #endif /* DEBUG_XEMACS */
904 syms_of_device (); 916 syms_of_device ();
905 #ifdef HAVE_DIALOGS 917 #ifdef HAVE_DIALOGS
906 syms_of_dialog (); 918 syms_of_dialog ();
907 #endif 919 #endif
934 syms_of_glyphs_eimage (); 946 syms_of_glyphs_eimage ();
935 syms_of_glyphs_widget (); 947 syms_of_glyphs_widget ();
936 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) 948 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
937 syms_of_gui (); 949 syms_of_gui ();
938 #endif 950 #endif
951 syms_of_gutter ();
939 syms_of_indent (); 952 syms_of_indent ();
940 syms_of_intl (); 953 syms_of_intl ();
941 syms_of_keymap (); 954 syms_of_keymap ();
942 syms_of_lread (); 955 syms_of_lread ();
943 syms_of_macros (); 956 syms_of_macros ();
966 syms_of_ralloc (); 979 syms_of_ralloc ();
967 #endif /* HAVE_MMAP && REL_ALLOC */ 980 #endif /* HAVE_MMAP && REL_ALLOC */
968 syms_of_rangetab (); 981 syms_of_rangetab ();
969 syms_of_redisplay (); 982 syms_of_redisplay ();
970 syms_of_search (); 983 syms_of_search ();
984 syms_of_select ();
971 syms_of_signal (); 985 syms_of_signal ();
972 syms_of_sound (); 986 syms_of_sound ();
973 syms_of_specifier (); 987 syms_of_specifier ();
974 syms_of_symbols (); 988 syms_of_symbols ();
975 syms_of_syntax (); 989 syms_of_syntax ();
988 syms_of_device_tty (); 1002 syms_of_device_tty ();
989 syms_of_objects_tty (); 1003 syms_of_objects_tty ();
990 #endif 1004 #endif
991 1005
992 #ifdef HAVE_X_WINDOWS 1006 #ifdef HAVE_X_WINDOWS
1007 syms_of_balloon_x ();
993 syms_of_device_x (); 1008 syms_of_device_x ();
994 #ifdef HAVE_DIALOGS 1009 #ifdef HAVE_DIALOGS
995 syms_of_dialog_x (); 1010 syms_of_dialog_x ();
996 #endif 1011 #endif
997 syms_of_frame_x (); 1012 syms_of_frame_x ();
998 syms_of_glyphs_x (); 1013 syms_of_glyphs_x ();
999 syms_of_objects_x (); 1014 syms_of_objects_x ();
1000 #ifdef HAVE_MENUBARS 1015 #ifdef HAVE_MENUBARS
1001 syms_of_menubar_x (); 1016 syms_of_menubar_x ();
1002 #endif 1017 #endif
1003 syms_of_xselect (); 1018 syms_of_select_x ();
1004 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) 1019 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
1005 syms_of_gui_x (); 1020 syms_of_gui_x ();
1006 #endif 1021 #endif
1022 #ifdef HAVE_XIM
1023 #ifdef XIM_XLIB
1024 syms_of_input_method_xlib ();
1025 #endif
1026 #endif /* HAVE_XIM */
1007 #endif /* HAVE_X_WINDOWS */ 1027 #endif /* HAVE_X_WINDOWS */
1008 1028
1009 #ifdef HAVE_MS_WINDOWS 1029 #ifdef HAVE_MS_WINDOWS
1010 syms_of_console_mswindows (); 1030 syms_of_console_mswindows ();
1011 syms_of_device_mswindows (); 1031 syms_of_device_mswindows ();
1012 syms_of_frame_mswindows (); 1032 syms_of_frame_mswindows ();
1013 syms_of_objects_mswindows (); 1033 syms_of_objects_mswindows ();
1014 syms_of_select_mswindows (); 1034 syms_of_select_mswindows ();
1015 syms_of_glyphs_mswindows (); 1035 syms_of_glyphs_mswindows ();
1036 syms_of_gui_mswindows ();
1016 #ifdef HAVE_MENUBARS 1037 #ifdef HAVE_MENUBARS
1017 syms_of_menubar_mswindows (); 1038 syms_of_menubar_mswindows ();
1018 #endif 1039 #endif
1019 #ifdef HAVE_SCROLLBARS 1040 #ifdef HAVE_SCROLLBARS
1020 syms_of_scrollbar_mswindows (); 1041 syms_of_scrollbar_mswindows ();
1021 #endif 1042 #endif
1022 #ifdef HAVE_MSW_C_DIRED 1043 #ifdef HAVE_MSW_C_DIRED
1023 syms_of_dired_mswindows (); 1044 syms_of_dired_mswindows ();
1045 #endif
1046 #ifdef WINDOWSNT
1047 syms_of_ntproc ();
1024 #endif 1048 #endif
1025 #endif /* HAVE_MS_WINDOWS */ 1049 #endif /* HAVE_MS_WINDOWS */
1026 1050
1027 #ifdef MULE 1051 #ifdef MULE
1028 syms_of_mule (); 1052 syms_of_mule ();
1029 syms_of_mule_ccl (); 1053 syms_of_mule_ccl ();
1030 syms_of_mule_charset (); 1054 syms_of_mule_charset ();
1031 #endif 1055 #endif
1032 #ifdef FILE_CODING 1056 #ifdef FILE_CODING
1033 syms_of_mule_coding (); 1057 syms_of_file_coding ();
1034 #endif 1058 #endif
1035 #ifdef MULE 1059 #ifdef MULE
1036 #ifdef HAVE_WNN 1060 #ifdef HAVE_WNN
1037 syms_of_mule_wnn (); 1061 syms_of_mule_wnn ();
1038 #endif 1062 #endif
1069 1093
1070 #ifdef HAVE_LDAP 1094 #ifdef HAVE_LDAP
1071 syms_of_eldap (); 1095 syms_of_eldap ();
1072 #endif 1096 #endif
1073 1097
1098 #ifdef HAVE_GPM
1099 syms_of_gpmevent ();
1100 #endif
1101
1074 /* Now create the subtypes for the types that have them. 1102 /* Now create the subtypes for the types that have them.
1075 We do this before the vars_*() because more symbols 1103 We do this before the vars_*() because more symbols
1076 may get initialized here. */ 1104 may get initialized here. */
1077 1105
1078 /* Now initialize the console types and associated symbols. 1106 /* Now initialize the console types and associated symbols.
1100 #ifdef HAVE_X_WINDOWS 1128 #ifdef HAVE_X_WINDOWS
1101 console_type_create_x (); 1129 console_type_create_x ();
1102 console_type_create_device_x (); 1130 console_type_create_device_x ();
1103 console_type_create_frame_x (); 1131 console_type_create_frame_x ();
1104 console_type_create_glyphs_x (); 1132 console_type_create_glyphs_x ();
1133 console_type_create_select_x ();
1105 #ifdef HAVE_MENUBARS 1134 #ifdef HAVE_MENUBARS
1106 console_type_create_menubar_x (); 1135 console_type_create_menubar_x ();
1107 #endif 1136 #endif
1108 console_type_create_objects_x (); 1137 console_type_create_objects_x ();
1109 console_type_create_redisplay_x (); 1138 console_type_create_redisplay_x ();
1123 console_type_create_device_mswindows (); 1152 console_type_create_device_mswindows ();
1124 console_type_create_frame_mswindows (); 1153 console_type_create_frame_mswindows ();
1125 console_type_create_objects_mswindows (); 1154 console_type_create_objects_mswindows ();
1126 console_type_create_redisplay_mswindows (); 1155 console_type_create_redisplay_mswindows ();
1127 console_type_create_glyphs_mswindows (); 1156 console_type_create_glyphs_mswindows ();
1157 console_type_create_select_mswindows ();
1128 # ifdef HAVE_SCROLLBARS 1158 # ifdef HAVE_SCROLLBARS
1129 console_type_create_scrollbar_mswindows (); 1159 console_type_create_scrollbar_mswindows ();
1130 # endif 1160 # endif
1131 #ifdef HAVE_MENUBARS 1161 #ifdef HAVE_MENUBARS
1132 console_type_create_menubar_mswindows (); 1162 console_type_create_menubar_mswindows ();
1150 before the any calls to the latter macro. */ 1180 before the any calls to the latter macro. */
1151 1181
1152 specifier_type_create (); 1182 specifier_type_create ();
1153 1183
1154 specifier_type_create_image (); 1184 specifier_type_create_image ();
1185 specifier_type_create_gutter ();
1155 specifier_type_create_objects (); 1186 specifier_type_create_objects ();
1156 #ifdef HAVE_TOOLBARS 1187 #ifdef HAVE_TOOLBARS
1157 specifier_type_create_toolbar (); 1188 specifier_type_create_toolbar ();
1158 #endif 1189 #endif
1159 1190
1185 called before the any calls to the other macros. */ 1216 called before the any calls to the other macros. */
1186 1217
1187 image_instantiator_format_create (); 1218 image_instantiator_format_create ();
1188 image_instantiator_format_create_glyphs_eimage (); 1219 image_instantiator_format_create_glyphs_eimage ();
1189 image_instantiator_format_create_glyphs_widget (); 1220 image_instantiator_format_create_glyphs_widget ();
1221 #ifdef HAVE_TTY
1222 image_instantiator_format_create_glyphs_tty ();
1223 #endif
1190 #ifdef HAVE_X_WINDOWS 1224 #ifdef HAVE_X_WINDOWS
1191 image_instantiator_format_create_glyphs_x (); 1225 image_instantiator_format_create_glyphs_x ();
1192 #endif /* HAVE_X_WINDOWS */ 1226 #endif /* HAVE_X_WINDOWS */
1193 #ifdef HAVE_MS_WINDOWS 1227 #ifdef HAVE_MS_WINDOWS
1194 image_instantiator_format_create_glyphs_mswindows (); 1228 image_instantiator_format_create_glyphs_mswindows ();
1202 1236
1203 */ 1237 */
1204 1238
1205 lstream_type_create (); 1239 lstream_type_create ();
1206 #ifdef FILE_CODING 1240 #ifdef FILE_CODING
1207 lstream_type_create_mule_coding (); 1241 lstream_type_create_file_coding ();
1208 #endif 1242 #endif
1209 #if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT) 1243 #if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT)
1210 lstream_type_create_mswindows_selectable (); 1244 lstream_type_create_mswindows_selectable ();
1211 #endif 1245 #endif
1212 1246
1233 Dynarr_*() 1267 Dynarr_*()
1234 Blocktype_*() 1268 Blocktype_*()
1235 staticpro() 1269 staticpro()
1236 Fprovide(symbol) 1270 Fprovide(symbol)
1237 intern() 1271 intern()
1238 pure_put() 1272 Fput()
1239 xmalloc() 1273 xmalloc()
1240 defsymbol(), if it's absolutely necessary and you're sure that 1274 defsymbol(), if it's absolutely necessary and you're sure that
1241 the symbol isn't referenced anywhere else in the initialization 1275 the symbol isn't referenced anywhere else in the initialization
1242 code 1276 code
1243 Fset() on a symbol that is unbound 1277 Fset() on a symbol that is unbound
1246 earlier on in the same function 1280 earlier on in the same function
1247 1281
1248 Any of the object-creating functions on alloc.c: e.g. 1282 Any of the object-creating functions on alloc.c: e.g.
1249 1283
1250 make_pure_*() 1284 make_pure_*()
1251 Fpurecopy()
1252 make_string() 1285 make_string()
1253 build_string() 1286 build_string()
1254 make_vector() 1287 make_vector()
1255 make_int() 1288 make_int()
1256 make_extent() 1289 make_extent()
1257 alloc_lcrecord() 1290 alloc_lcrecord()
1258 Fcons() 1291 Fcons()
1259 listN() 1292 listN()
1260 make_opaque_ptr() 1293 make_opaque_ptr()
1261 make_opaque_long()
1262 1294
1263 perhaps a few others. 1295 perhaps a few others.
1264 */ 1296 */
1265 1297
1266 /* Now allow Fprovide() statements to be made. */ 1298 /* Now allow Fprovide() statements to be made. */
1267 init_provide_once (); 1299 init_provide_once ();
1268 1300
1301 /* Do that before any specifier creation (esp. vars_of_glyphs()) */
1302 vars_of_specifier ();
1303
1269 vars_of_abbrev (); 1304 vars_of_abbrev ();
1270 vars_of_alloc (); 1305 vars_of_alloc ();
1271 #ifdef HAVE_X_WINDOWS
1272 vars_of_balloon_x ();
1273 #endif
1274 vars_of_buffer (); 1306 vars_of_buffer ();
1275 vars_of_bytecode (); 1307 vars_of_bytecode ();
1276 vars_of_callint (); 1308 vars_of_callint ();
1277 vars_of_callproc (); 1309 vars_of_callproc ();
1310 vars_of_chartab ();
1278 vars_of_cmdloop (); 1311 vars_of_cmdloop ();
1279 vars_of_cmds (); 1312 vars_of_cmds ();
1280 vars_of_console (); 1313 vars_of_console ();
1281 vars_of_data (); 1314 vars_of_data ();
1282 #ifdef DEBUG_XEMACS 1315 #ifdef DEBUG_XEMACS
1283 vars_of_debug (); 1316 vars_of_debug ();
1317 vars_of_tests ();
1284 #endif 1318 #endif
1285 vars_of_console_stream (); 1319 vars_of_console_stream ();
1286 vars_of_device (); 1320 vars_of_device ();
1287 #ifdef HAVE_DIALOGS 1321 #ifdef HAVE_DIALOGS
1288 vars_of_dialog (); 1322 vars_of_dialog ();
1319 vars_of_glyphs_eimage (); 1353 vars_of_glyphs_eimage ();
1320 vars_of_glyphs_widget (); 1354 vars_of_glyphs_widget ();
1321 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) 1355 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
1322 vars_of_gui (); 1356 vars_of_gui ();
1323 #endif 1357 #endif
1358 vars_of_gutter ();
1324 vars_of_indent (); 1359 vars_of_indent ();
1325 vars_of_insdel (); 1360 vars_of_insdel ();
1326 vars_of_intl (); 1361 vars_of_intl ();
1327 #ifdef HAVE_XIM 1362 #ifdef HAVE_XIM
1328 #ifdef XIM_MOTIF 1363 #ifdef XIM_MOTIF
1344 #endif 1379 #endif
1345 vars_of_minibuf (); 1380 vars_of_minibuf ();
1346 #ifdef HAVE_SHLIB 1381 #ifdef HAVE_SHLIB
1347 vars_of_module (); 1382 vars_of_module ();
1348 #endif 1383 #endif
1384 #ifdef WINDOWSNT
1385 vars_of_nt ();
1386 vars_of_ntproc ();
1387 #endif
1349 vars_of_objects (); 1388 vars_of_objects ();
1350 vars_of_print (); 1389 vars_of_print ();
1351 1390
1352 #ifndef NO_SUBPROCESSES 1391 #ifndef NO_SUBPROCESSES
1353 vars_of_process (); 1392 vars_of_process ();
1366 vars_of_redisplay (); 1405 vars_of_redisplay ();
1367 #ifdef HAVE_SCROLLBARS 1406 #ifdef HAVE_SCROLLBARS
1368 vars_of_scrollbar (); 1407 vars_of_scrollbar ();
1369 #endif 1408 #endif
1370 vars_of_search (); 1409 vars_of_search ();
1410 vars_of_select ();
1371 vars_of_sound (); 1411 vars_of_sound ();
1372 vars_of_specifier ();
1373 vars_of_symbols (); 1412 vars_of_symbols ();
1374 vars_of_syntax (); 1413 vars_of_syntax ();
1375 #ifdef HAVE_TOOLBARS 1414 #ifdef HAVE_TOOLBARS
1376 vars_of_toolbar (); 1415 vars_of_toolbar ();
1377 #endif 1416 #endif
1383 vars_of_frame_tty (); 1422 vars_of_frame_tty ();
1384 vars_of_objects_tty (); 1423 vars_of_objects_tty ();
1385 #endif 1424 #endif
1386 1425
1387 #ifdef HAVE_X_WINDOWS 1426 #ifdef HAVE_X_WINDOWS
1427 vars_of_balloon_x ();
1388 vars_of_device_x (); 1428 vars_of_device_x ();
1389 #ifdef HAVE_DIALOGS 1429 #ifdef HAVE_DIALOGS
1390 vars_of_dialog_x (); 1430 vars_of_dialog_x ();
1391 #endif 1431 #endif
1392 vars_of_frame_x (); 1432 vars_of_frame_x ();
1393 vars_of_glyphs_x (); 1433 vars_of_glyphs_x ();
1394 #ifdef HAVE_MENUBARS 1434 #ifdef HAVE_MENUBARS
1395 vars_of_menubar_x (); 1435 vars_of_menubar_x ();
1396 #endif 1436 #endif
1397 vars_of_objects_x (); 1437 vars_of_objects_x ();
1398 vars_of_xselect (); 1438 vars_of_select_x ();
1399 #ifdef HAVE_SCROLLBARS 1439 #ifdef HAVE_SCROLLBARS
1400 vars_of_scrollbar_x (); 1440 vars_of_scrollbar_x ();
1401 #endif 1441 #endif
1402 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) 1442 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
1403 vars_of_gui_x (); 1443 vars_of_gui_x ();
1404 #endif 1444 #endif
1405 #endif 1445 #endif /* HAVE_X_WINDOWS */
1406 1446
1407 #ifdef HAVE_MS_WINDOWS 1447 #ifdef HAVE_MS_WINDOWS
1408 vars_of_device_mswindows (); 1448 vars_of_device_mswindows ();
1409 vars_of_console_mswindows (); 1449 vars_of_console_mswindows ();
1410 vars_of_frame_mswindows (); 1450 vars_of_frame_mswindows ();
1425 #endif 1465 #endif
1426 #endif /* HAVE_MS_WINDOWS */ 1466 #endif /* HAVE_MS_WINDOWS */
1427 1467
1428 #ifdef MULE 1468 #ifdef MULE
1429 vars_of_mule (); 1469 vars_of_mule ();
1470 vars_of_mule_ccl ();
1430 vars_of_mule_charset (); 1471 vars_of_mule_charset ();
1431 #endif 1472 #endif
1432 #ifdef FILE_CODING 1473 #ifdef FILE_CODING
1433 vars_of_mule_coding (); 1474 vars_of_file_coding ();
1434 #endif 1475 #endif
1435 #ifdef MULE 1476 #ifdef MULE
1436 #ifdef HAVE_WNN 1477 #ifdef HAVE_WNN
1437 vars_of_mule_wnn (); 1478 vars_of_mule_wnn ();
1438 #endif 1479 #endif
1449 vars_of_sunpro (); 1490 vars_of_sunpro ();
1450 #endif 1491 #endif
1451 1492
1452 #ifdef HAVE_LDAP 1493 #ifdef HAVE_LDAP
1453 vars_of_eldap (); 1494 vars_of_eldap ();
1495 #endif
1496
1497 #ifdef HAVE_GPM
1498 vars_of_gpmevent ();
1454 #endif 1499 #endif
1455 1500
1456 /* Now initialize any specifier variables. We do this later 1501 /* Now initialize any specifier variables. We do this later
1457 because it has some dependence on the vars initialized 1502 because it has some dependence on the vars initialized
1458 above. 1503 above.
1466 set_specifier_fallback() 1511 set_specifier_fallback()
1467 set_specifier_caching() 1512 set_specifier_caching()
1468 */ 1513 */
1469 1514
1470 specifier_vars_of_glyphs (); 1515 specifier_vars_of_glyphs ();
1516 specifier_vars_of_gutter ();
1471 #ifdef HAVE_MENUBARS 1517 #ifdef HAVE_MENUBARS
1472 specifier_vars_of_menubar (); 1518 specifier_vars_of_menubar ();
1473 #endif 1519 #endif
1474 specifier_vars_of_redisplay (); 1520 specifier_vars_of_redisplay ();
1475 #ifdef HAVE_SCROLLBARS 1521 #ifdef HAVE_SCROLLBARS
1499 #ifdef MULE 1545 #ifdef MULE
1500 /* These two depend on hash tables and various variables declared 1546 /* These two depend on hash tables and various variables declared
1501 earlier. The second may also depend on the first. */ 1547 earlier. The second may also depend on the first. */
1502 complex_vars_of_mule_charset (); 1548 complex_vars_of_mule_charset ();
1503 #endif 1549 #endif
1504 #if defined(FILE_CODING) 1550 #ifdef FILE_CODING
1505 complex_vars_of_mule_coding (); 1551 complex_vars_of_file_coding ();
1506 #endif 1552 #endif
1507 1553
1508 /* This calls allocate_glyph(), which creates specifiers 1554 /* This calls allocate_glyph(), which creates specifiers
1509 and also relies on a variable (Vthe_nothing_vector) initialized 1555 and also relies on a variable (Vthe_nothing_vector) initialized
1510 above. It also calls make_ext_string(), which under Mule 1556 above. It also calls make_ext_string(), which under Mule
1581 extern int always_gc; 1627 extern int always_gc;
1582 if (always_gc) /* purification debugging hack */ 1628 if (always_gc) /* purification debugging hack */
1583 garbage_collect_1 (); 1629 garbage_collect_1 ();
1584 } 1630 }
1585 #endif 1631 #endif
1632 #ifdef PDUMP
1633 } else if (!restart) {
1634 reinit_alloc_once_early ();
1635 reinit_symbols_once_early ();
1636 reinit_opaque_once_early ();
1637
1638 reinit_console_type_create_stream ();
1639 #ifdef HAVE_TTY
1640 reinit_console_type_create_tty ();
1641 #endif
1642 #ifdef HAVE_X_WINDOWS
1643 reinit_console_type_create_x ();
1644 reinit_console_type_create_device_x ();
1645 #endif
1646 #ifdef HAVE_MS_WINDOWS
1647 reinit_console_type_create_mswindows ();
1648 #endif
1649
1650 reinit_specifier_type_create ();
1651 reinit_specifier_type_create_image ();
1652 reinit_specifier_type_create_gutter ();
1653 reinit_specifier_type_create_objects ();
1654 #ifdef HAVE_TOOLBARS
1655 reinit_specifier_type_create_toolbar ();
1656 #endif
1657
1658 structure_type_create ();
1659
1660 structure_type_create_chartab ();
1661 structure_type_create_faces ();
1662 structure_type_create_rangetab ();
1663 structure_type_create_hash_table ();
1664
1665 lstream_type_create ();
1666 #ifdef FILE_CODING
1667 lstream_type_create_file_coding ();
1668 #endif
1669 #if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT)
1670 lstream_type_create_mswindows_selectable ();
1671 #endif
1672 #ifdef HAVE_UNIX_PROCESSES
1673 process_type_create_unix ();
1674 #endif
1675 #ifdef HAVE_WIN32_PROCESSES
1676 process_type_create_nt ();
1677 #endif
1678
1679 reinit_vars_of_buffer ();
1680 reinit_vars_of_console ();
1681 #ifdef DEBUG_XEMACS
1682 reinit_vars_of_debug ();
1683 #endif
1684 reinit_vars_of_device ();
1685 reinit_vars_of_eval ();
1686 #ifdef HAVE_X_WINDOWS
1687 reinit_vars_of_event_Xt ();
1688 #endif
1689 #if defined(HAVE_TTY) && (defined (DEBUG_TTY_EVENT_STREAM) || !defined (HAVE_X_WINDOWS))
1690 reinit_vars_of_event_tty ();
1691 #endif
1692 #ifdef HAVE_MS_WINDOWS
1693 reinit_vars_of_event_mswindows ();
1694 #endif
1695 reinit_vars_of_event_stream ();
1696 reinit_vars_of_events ();
1697 reinit_vars_of_extents ();
1698 reinit_vars_of_font_lock ();
1699 reinit_vars_of_glyphs ();
1700 reinit_vars_of_glyphs_widget ();
1701 reinit_vars_of_insdel ();
1702 reinit_vars_of_lread ();
1703 reinit_vars_of_lstream ();
1704 reinit_vars_of_minibuf ();
1705 #ifdef HAVE_SHLIB
1706 reinit_vars_of_module ();
1707 #endif
1708 reinit_vars_of_objects ();
1709 reinit_vars_of_print ();
1710 reinit_vars_of_redisplay ();
1711 reinit_vars_of_search ();
1712 reinit_vars_of_undo ();
1713 reinit_vars_of_window ();
1714
1715 #ifdef HAVE_MS_WINDOWS
1716 reinit_vars_of_frame_mswindows ();
1717 #endif
1718
1719 #ifdef HAVE_X_WINDOWS
1720 reinit_vars_of_device_x ();
1721 #ifdef HAVE_SCROLLBARS
1722 reinit_vars_of_scrollbar_x ();
1723 #endif
1724 #ifdef HAVE_MENUBARS
1725 reinit_vars_of_menubar_x ();
1726 #endif
1727 reinit_vars_of_select_x ();
1728 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
1729 reinit_vars_of_gui_x ();
1730 #endif
1731 #endif /* HAVE_X_WINDOWS */
1732
1733 #if defined(MULE) && defined(HAVE_WNN)
1734 reinit_vars_of_mule_wnn ();
1735 #endif
1736
1737 reinit_complex_vars_of_buffer ();
1738 reinit_complex_vars_of_console ();
1739 reinit_complex_vars_of_minibuf ();
1740 #endif /* PDUMP */
1586 } 1741 }
1742
1587 1743
1588 /* CONGRATULATIONS!!! We have successfully initialized the Lisp 1744 /* CONGRATULATIONS!!! We have successfully initialized the Lisp
1589 engine. */ 1745 engine. */
1590 1746
1591 if (initialized) 1747 if (initialized)
1637 init_ntproc(); 1793 init_ntproc();
1638 #endif 1794 #endif
1639 1795
1640 init_redisplay (); /* Determine terminal type. 1796 init_redisplay (); /* Determine terminal type.
1641 init_sys_modes uses results */ 1797 init_sys_modes uses results */
1798 init_frame ();
1642 init_event_stream (); /* Set up so we can get user input. */ 1799 init_event_stream (); /* Set up so we can get user input. */
1643 init_macros (); /* set up so we can run macros. */ 1800 init_macros (); /* set up so we can run macros. */
1644 init_editfns (); /* Determine the name of the user we're running as */ 1801 init_editfns (); /* Determine the name of the user we're running as */
1645 init_xemacs_process (); /* set up for calling subprocesses */ 1802 init_xemacs_process (); /* set up for calling subprocesses */
1646 #ifdef SUNPRO 1803 #ifdef SUNPRO
1674 Vinvocation_path = Qnil; 1831 Vinvocation_path = Qnil;
1675 } 1832 }
1676 else 1833 else
1677 { 1834 {
1678 Vinvocation_path = decode_env_path ("PATH", NULL); 1835 Vinvocation_path = decode_env_path ("PATH", NULL);
1679 locate_file (Vinvocation_path, Vinvocation_name, EXEC_SUFFIXES, 1836 locate_file (Vinvocation_path, Vinvocation_name,
1837 Vlisp_EXEC_SUFFIXES,
1680 &Vinvocation_directory, X_OK); 1838 &Vinvocation_directory, X_OK);
1681 } 1839 }
1682 1840
1683 if (NILP (Vinvocation_directory)) 1841 if (NILP (Vinvocation_directory))
1684 Vinvocation_directory = Vinvocation_name; 1842 Vinvocation_directory = Vinvocation_name;
1743 1901
1744 /* First, here's a table of all the standard options. */ 1902 /* First, here's a table of all the standard options. */
1745 1903
1746 struct standard_args 1904 struct standard_args
1747 { 1905 {
1748 CONST char * CONST name; 1906 const char * const name;
1749 CONST char * CONST longname; 1907 const char * const longname;
1750 int priority; 1908 int priority;
1751 int nargs; 1909 int nargs;
1752 }; 1910 };
1753 1911
1754 static struct standard_args standard_args[] = 1912 static struct standard_args standard_args[] =
1983 Martin thinks this function is most useful when using debugging 2141 Martin thinks this function is most useful when using debugging
1984 tools like Purify or tcov that get confused by XEmacs' dumping. */ 2142 tools like Purify or tcov that get confused by XEmacs' dumping. */
1985 (int nargs, Lisp_Object *args)) 2143 (int nargs, Lisp_Object *args))
1986 { 2144 {
1987 int ac; 2145 int ac;
1988 CONST Extbyte *wampum; 2146 const Extbyte *wampum;
1989 int namesize; 2147 int namesize;
1990 int total_len; 2148 int total_len;
1991 Lisp_Object orig_invoc_name = Fcar (Vcommand_line_args); 2149 Lisp_Object orig_invoc_name = Fcar (Vcommand_line_args);
1992 CONST Extbyte **wampum_all = alloca_array (CONST Extbyte *, nargs); 2150 const Extbyte **wampum_all = alloca_array (const Extbyte *, nargs);
1993 int *wampum_all_len = alloca_array (int, nargs); 2151 int *wampum_all_len = alloca_array (int, nargs);
1994 2152
1995 assert (!gc_in_progress); 2153 assert (!gc_in_progress);
1996 2154
1997 if (run_temacs_argc < 0) 2155 if (run_temacs_argc < 0)
1998 error ("I've lost my temacs-hood."); 2156 error ("I've lost my temacs-hood.");
1999 2157
2000 /* Need to convert the orig_invoc_name and all of the arguments 2158 /* Need to convert the orig_invoc_name and all of the arguments
2001 to external format. */ 2159 to external format. */
2002 2160
2003 GET_STRING_EXT_DATA_ALLOCA (orig_invoc_name, FORMAT_OS, wampum, 2161 TO_EXTERNAL_FORMAT (LISP_STRING, orig_invoc_name,
2004 namesize); 2162 ALLOCA, (wampum, namesize),
2163 Qnative);
2005 namesize++; 2164 namesize++;
2006 2165
2007 for (ac = 0, total_len = namesize; ac < nargs; ac++) 2166 for (ac = 0, total_len = namesize; ac < nargs; ac++)
2008 { 2167 {
2009 CHECK_STRING (args[ac]); 2168 CHECK_STRING (args[ac]);
2010 GET_STRING_EXT_DATA_ALLOCA (args[ac], FORMAT_OS, 2169 TO_EXTERNAL_FORMAT (LISP_STRING, args[ac],
2011 wampum_all[ac], 2170 ALLOCA, (wampum_all[ac], wampum_all_len[ac]),
2012 wampum_all_len[ac]); 2171 Qnative);
2013 wampum_all_len[ac]++; 2172 wampum_all_len[ac]++;
2014 total_len += wampum_all_len[ac]; 2173 total_len += wampum_all_len[ac];
2015 } 2174 }
2016 DO_REALLOC (run_temacs_args, run_temacs_args_size, total_len, char); 2175 DO_REALLOC (run_temacs_args, run_temacs_args_size, total_len, char);
2017 DO_REALLOC (run_temacs_argv, run_temacs_argv_size, nargs+1, char *); 2176 DO_REALLOC (run_temacs_argv, run_temacs_argv_size, nargs+2, char *);
2018 2177
2019 memcpy (run_temacs_args, wampum, namesize); 2178 memcpy (run_temacs_args, wampum, namesize);
2020 run_temacs_argv [0] = run_temacs_args; 2179 run_temacs_argv [0] = run_temacs_args;
2021 for (ac = 0; ac < nargs; ac++) 2180 for (ac = 0; ac < nargs; ac++)
2022 { 2181 {
2029 catchlist = NULL; /* Important! Otherwise free_cons() calls in 2188 catchlist = NULL; /* Important! Otherwise free_cons() calls in
2030 condition_case_unwind() may lead to GC death. */ 2189 condition_case_unwind() may lead to GC death. */
2031 unbind_to (0, Qnil); /* this closes loadup.el */ 2190 unbind_to (0, Qnil); /* this closes loadup.el */
2032 purify_flag = 0; 2191 purify_flag = 0;
2033 run_temacs_argc = nargs + 1; 2192 run_temacs_argc = nargs + 1;
2034 #if 0 2193 #ifdef HEAP_IN_DATA
2035 #ifdef REPORT_PURE_USAGE 2194 report_sheap_usage (0);
2036 report_pure_usage (1, 0); 2195 #endif
2037 #else
2038 report_pure_usage (0, 0);
2039 #endif
2040 #endif /* 0 */
2041 LONGJMP (run_temacs_catch, 1); 2196 LONGJMP (run_temacs_catch, 1);
2042 return Qnil; /* not reached; warning suppression */ 2197 return Qnil; /* not reached; warning suppression */
2043 } 2198 }
2044 2199
2045 /* ARGSUSED */ 2200 /* ARGSUSED */
2175 static void 2330 static void
2176 voodoo_free_hook (void *mem) 2331 voodoo_free_hook (void *mem)
2177 { 2332 {
2178 /* Disable all calls to free() when XEmacs is exiting and it doesn't */ 2333 /* Disable all calls to free() when XEmacs is exiting and it doesn't */
2179 /* matter. */ 2334 /* matter. */
2180 __free_hook = voodoo_free_hook; 2335 __free_hook =
2181 } 2336 #ifdef __GNUC__ /* prototype of __free_hook varies with glibc version */
2182 #endif 2337 (__typeof__ (__free_hook))
2338 #endif
2339 voodoo_free_hook;
2340 }
2341 #endif /* GNU_MALLOC */
2183 2342
2184 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /* 2343 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /*
2185 Exit the XEmacs job and kill it. Ask for confirmation, without argument. 2344 Exit the XEmacs job and kill it. Ask for confirmation, without argument.
2186 If ARG is an integer, return ARG as the exit program code. 2345 If ARG is an integer, return ARG as the exit program code.
2187 If ARG is a string, stuff it as keyboard input. 2346 If ARG is a string, stuff it as keyboard input.
2231 } 2390 }
2232 } 2391 }
2233 2392
2234 UNGCPRO; 2393 UNGCPRO;
2235 2394
2236 shut_down_emacs (0, ((STRINGP (arg)) ? arg : Qnil)); 2395 shut_down_emacs (0, STRINGP (arg) ? arg : Qnil);
2237 2396
2238 #if defined(GNU_MALLOC) 2397 #if defined(GNU_MALLOC)
2239 __free_hook = voodoo_free_hook; 2398 __free_hook =
2240 #endif 2399 #ifdef __GNUC__ /* prototype of __free_hook varies with glibc version */
2241 2400 (__typeof__ (__free_hook))
2242 exit ((INTP (arg)) ? XINT (arg) : 0); 2401 #endif
2402 voodoo_free_hook;
2403 #endif
2404
2405 exit (INTP (arg) ? XINT (arg) : 0);
2243 /* NOTREACHED */ 2406 /* NOTREACHED */
2244 return Qnil; /* I'm sick of the compiler warning */ 2407 return Qnil; /* I'm sick of the compiler warning */
2245 } 2408 }
2246 2409
2247 /* Perform an orderly shutdown of XEmacs. Autosave any modified 2410 /* Perform an orderly shutdown of XEmacs. Autosave any modified
2293 stderr_out ("\nFatal error (%d).\n", sig); 2456 stderr_out ("\nFatal error (%d).\n", sig);
2294 stderr_out 2457 stderr_out
2295 ("Your files have been auto-saved.\n" 2458 ("Your files have been auto-saved.\n"
2296 "Use `M-x recover-session' to recover them.\n" 2459 "Use `M-x recover-session' to recover them.\n"
2297 "\n" 2460 "\n"
2461 "If you have access to the PROBLEMS file that came with your\n"
2462 "version of XEmacs, please check to see if your crash is described\n"
2463 "there, as there may be a workaround available.\n"
2298 #ifdef INFODOCK 2464 #ifdef INFODOCK
2299 "Please report this bug by selecting `Report-Bug' in the InfoDock\n" 2465 "Otherwise, please report this bug by selecting `Report-Bug'\n"
2300 "menu.\n" 2466 "in the InfoDock menu.\n"
2301 #else 2467 #else
2302 "Please report this bug by running the send-pr script included\n" 2468 "Otherwise, please report this bug by running the send-pr\n"
2303 "with XEmacs, or selecting `Send Bug Report' from the help menu.\n" 2469 "script included with XEmacs, or selecting `Send Bug Report'\n"
2470 "from the help menu.\n"
2304 "As a last resort send ordinary email to `crashes@xemacs.org'.\n" 2471 "As a last resort send ordinary email to `crashes@xemacs.org'.\n"
2305 #endif 2472 #endif
2306 "*MAKE SURE* to include the information in the command\n" 2473 "*MAKE SURE* to include the information in the command\n"
2307 "M-x describe-installation.\n" 2474 "M-x describe-installation.\n"
2308 "\n" 2475 "\n"
2313 "directory in which you started the editor, or maybe in your home\n" 2480 "directory in which you started the editor, or maybe in your home\n"
2314 "directory), and type\n" 2481 "directory), and type\n"
2315 "\n" 2482 "\n"
2316 " gdb "); 2483 " gdb ");
2317 { 2484 {
2318 CONST char *name; 2485 const char *name;
2319 char *dir = 0; 2486 char *dir = 0;
2320 2487
2321 /* Now try to determine the actual path to the executable, 2488 /* Now try to determine the actual path to the executable,
2322 to try to make the backtrace-determination process as foolproof 2489 to try to make the backtrace-determination process as foolproof
2323 as possible. */ 2490 as possible. */
2324 if (GC_STRINGP (Vinvocation_name)) 2491 if (STRINGP (Vinvocation_name))
2325 name = (char *) XSTRING_DATA (Vinvocation_name); 2492 name = (char *) XSTRING_DATA (Vinvocation_name);
2326 else 2493 else
2327 name = "xemacs"; 2494 name = "xemacs";
2328 if (GC_STRINGP (Vinvocation_directory)) 2495 if (STRINGP (Vinvocation_directory))
2329 dir = (char *) XSTRING_DATA (Vinvocation_directory); 2496 dir = (char *) XSTRING_DATA (Vinvocation_directory);
2330 if (!dir || dir[0] != '/') 2497 if (!dir || dir[0] != '/')
2331 stderr_out ("`which %s`", name); 2498 stderr_out ("`which %s`", name);
2332 else if (dir[strlen (dir) - 1] != '/') 2499 else if (dir[strlen (dir) - 1] != '/')
2333 stderr_out ("%s/%s", dir, name); 2500 stderr_out ("%s/%s", dir, name);
2360 2527
2361 } 2528 }
2362 2529
2363 2530
2364 #ifndef CANNOT_DUMP 2531 #ifndef CANNOT_DUMP
2365 /* Nothing like this can be implemented on an Apollo. 2532
2366 What a loss! */ 2533 #if !defined(PDUMP) || !defined(SYSTEM_MALLOC)
2367
2368 extern char my_edata[]; 2534 extern char my_edata[];
2535 #endif
2369 2536
2370 #ifdef HAVE_SHM 2537 #ifdef HAVE_SHM
2371 2538
2372 DEFUN ("dump-emacs-data", Fdump_emacs_data, 1, 1, 0, /* 2539 DEFUN ("dump-emacs-data", Fdump_emacs_data, 1, 1, 0, /*
2373 Dump current state of XEmacs into data file FILENAME. 2540 Dump current state of XEmacs into data file FILENAME.
2444 } 2611 }
2445 2612
2446 opurify = purify_flag; 2613 opurify = purify_flag;
2447 purify_flag = 0; 2614 purify_flag = 0;
2448 2615
2449 #ifdef DEBUG_XEMACS 2616 #ifdef HEAP_IN_DATA
2450 report_pure_usage (1, 1); 2617 report_sheap_usage (1);
2451 #else 2618 #endif
2452 report_pure_usage (0, 1); 2619
2453 #endif 2620 clear_message ();
2454 2621
2455 fflush (stderr); 2622 fflush (stderr);
2456 fflush (stdout); 2623 fflush (stdout);
2457 2624
2458 disksave_object_finalization (); 2625 disksave_object_finalization ();
2480 #else /* not MSDOS and EMX */ 2647 #else /* not MSDOS and EMX */
2481 { 2648 {
2482 char *intoname_ext; 2649 char *intoname_ext;
2483 char *symname_ext; 2650 char *symname_ext;
2484 2651
2485 GET_C_STRING_FILENAME_DATA_ALLOCA (intoname, intoname_ext); 2652 TO_EXTERNAL_FORMAT (LISP_STRING, intoname,
2653 C_STRING_ALLOCA, intoname_ext,
2654 Qfile_name);
2655
2486 if (STRINGP (symname)) 2656 if (STRINGP (symname))
2487 GET_C_STRING_FILENAME_DATA_ALLOCA (symname, symname_ext); 2657 TO_EXTERNAL_FORMAT (LISP_STRING, symname,
2658 C_STRING_ALLOCA, symname_ext,
2659 Qfile_name);
2488 else 2660 else
2489 symname_ext = 0; 2661 symname_ext = 0;
2490 2662
2491 garbage_collect_1 (); 2663 garbage_collect_1 ();
2664
2665 #ifdef PDUMP
2666 pdump ();
2667 #else
2668
2492 #ifdef DOUG_LEA_MALLOC 2669 #ifdef DOUG_LEA_MALLOC
2493 malloc_state_ptr = malloc_get_state (); 2670 malloc_state_ptr = malloc_get_state ();
2494 #endif 2671 #endif
2495 /* here we break our rule that the filename conversion should 2672 /* here we break our rule that the filename conversion should
2496 be performed at the actual time that the system call is made. 2673 be performed at the actual time that the system call is made.
2500 leakage because this call only happens once. */ 2677 leakage because this call only happens once. */
2501 unexec (intoname_ext, symname_ext, (uintptr_t) my_edata, 0, 0); 2678 unexec (intoname_ext, symname_ext, (uintptr_t) my_edata, 0, 0);
2502 #ifdef DOUG_LEA_MALLOC 2679 #ifdef DOUG_LEA_MALLOC
2503 free (malloc_state_ptr); 2680 free (malloc_state_ptr);
2504 #endif 2681 #endif
2682 #endif /* not PDUMP */
2505 } 2683 }
2506 #endif /* not MSDOS and EMX */ 2684 #endif /* not MSDOS and EMX */
2507 2685
2508 purify_flag = opurify; 2686 purify_flag = opurify;
2509 2687
2519 #endif 2697 #endif
2520 2698
2521 /* Split STRING into a list of substrings. The substrings are the 2699 /* Split STRING into a list of substrings. The substrings are the
2522 parts of original STRING separated by SEPCHAR. */ 2700 parts of original STRING separated by SEPCHAR. */
2523 static Lisp_Object 2701 static Lisp_Object
2524 split_string_by_emchar_1 (CONST Bufbyte *string, Bytecount size, 2702 split_string_by_emchar_1 (const Bufbyte *string, Bytecount size,
2525 Emchar sepchar) 2703 Emchar sepchar)
2526 { 2704 {
2527 Lisp_Object result = Qnil; 2705 Lisp_Object result = Qnil;
2528 CONST Bufbyte *end = string + size; 2706 const Bufbyte *end = string + size;
2529 2707
2530 while (1) 2708 while (1)
2531 { 2709 {
2532 CONST Bufbyte *p = string; 2710 const Bufbyte *p = string;
2533 while (p < end) 2711 while (p < end)
2534 { 2712 {
2535 if (charptr_emchar (p) == sepchar) 2713 if (charptr_emchar (p) == sepchar)
2536 break; 2714 break;
2537 INC_CHARPTR (p); 2715 INC_CHARPTR (p);
2547 } 2725 }
2548 return Fnreverse (result); 2726 return Fnreverse (result);
2549 } 2727 }
2550 2728
2551 /* The same as the above, except PATH is an external C string (it is 2729 /* The same as the above, except PATH is an external C string (it is
2552 converted as FORMAT_FILENAME), and sepchar is hardcoded to SEPCHAR 2730 converted using Qfile_name), and sepchar is hardcoded to SEPCHAR
2553 (':' or whatever). */ 2731 (':' or whatever). */
2554 Lisp_Object 2732 Lisp_Object
2555 decode_path (CONST char *path) 2733 decode_path (const char *path)
2556 { 2734 {
2557 int len; 2735 Bytecount newlen;
2558 Bufbyte *newpath; 2736 Bufbyte *newpath;
2559 if (!path) 2737 if (!path)
2560 return Qnil; 2738 return Qnil;
2561 2739
2562 GET_C_CHARPTR_INT_FILENAME_DATA_ALLOCA (path, newpath); 2740 TO_INTERNAL_FORMAT (C_STRING, path, ALLOCA, (newpath, newlen), Qfile_name);
2563 2741
2564 len = strlen ((const char *) newpath);
2565 /* #### Does this make sense? It certainly does for 2742 /* #### Does this make sense? It certainly does for
2566 decode_env_path(), but it looks dubious here. Does any code 2743 decode_env_path(), but it looks dubious here. Does any code
2567 depend on decode_path("") returning nil instead of an empty 2744 depend on decode_path("") returning nil instead of an empty
2568 string? */ 2745 string? */
2569 if (!len) 2746 if (!newlen)
2570 return Qnil; 2747 return Qnil;
2571 2748
2572 return split_string_by_emchar_1 (newpath, (Bytecount)len, SEPCHAR); 2749 return split_string_by_emchar_1 (newpath, newlen, SEPCHAR);
2573 } 2750 }
2574 2751
2575 Lisp_Object 2752 Lisp_Object
2576 decode_env_path (CONST char *evarname, CONST char *default_) 2753 decode_env_path (const char *evarname, const char *default_)
2577 { 2754 {
2578 CONST char *path = 0; 2755 const char *path = 0;
2579 if (evarname) 2756 if (evarname)
2580 path = egetenv (evarname); 2757 path = egetenv (evarname);
2581 if (!path) 2758 if (!path)
2582 path = default_; 2759 path = default_;
2583 return decode_path (path); 2760 return decode_path (path);
2636 2813
2637 #ifdef USE_ASSERTIONS 2814 #ifdef USE_ASSERTIONS
2638 /* This highly dubious kludge ... shut up Jamie, I'm tired of your slagging. */ 2815 /* This highly dubious kludge ... shut up Jamie, I'm tired of your slagging. */
2639 2816
2640 DOESNT_RETURN 2817 DOESNT_RETURN
2641 assert_failed (CONST char *file, int line, CONST char *expr) 2818 assert_failed (const char *file, int line, const char *expr)
2642 { 2819 {
2643 stderr_out ("Fatal error: assertion failed, file %s, line %d, %s\n", 2820 stderr_out ("Fatal error: assertion failed, file %s, line %d, %s\n",
2644 file, line, expr); 2821 file, line, expr);
2645 #undef abort /* avoid infinite #define loop... */ 2822 #undef abort /* avoid infinite #define loop... */
2646 #if defined (WINDOWSNT) && defined (DEBUG_XEMACS) 2823 #if defined (WINDOWSNT) && defined (DEBUG_XEMACS)
2759 # define EMACS_CONFIGURATION "UNKNOWN" 2936 # define EMACS_CONFIGURATION "UNKNOWN"
2760 #endif 2937 #endif
2761 DEFVAR_LISP ("system-configuration", &Vsystem_configuration /* 2938 DEFVAR_LISP ("system-configuration", &Vsystem_configuration /*
2762 String naming the configuration XEmacs was built for. 2939 String naming the configuration XEmacs was built for.
2763 */ ); 2940 */ );
2764 Vsystem_configuration = Fpurecopy (build_string (EMACS_CONFIGURATION)); 2941 Vsystem_configuration = build_string (EMACS_CONFIGURATION);
2765 2942
2766 #ifndef EMACS_CONFIG_OPTIONS 2943 #ifndef EMACS_CONFIG_OPTIONS
2767 # define EMACS_CONFIG_OPTIONS "UNKNOWN" 2944 # define EMACS_CONFIG_OPTIONS "UNKNOWN"
2768 #endif 2945 #endif
2769 DEFVAR_LISP ("system-configuration-options", &Vsystem_configuration_options /* 2946 DEFVAR_LISP ("system-configuration-options", &Vsystem_configuration_options /*
2770 String containing the configuration options XEmacs was built with. 2947 String containing the configuration options XEmacs was built with.
2771 */ ); 2948 */ );
2772 Vsystem_configuration_options = Fpurecopy (build_string 2949 Vsystem_configuration_options = build_string (EMACS_CONFIG_OPTIONS);
2773 (EMACS_CONFIG_OPTIONS));
2774 2950
2775 DEFVAR_LISP ("emacs-major-version", &Vemacs_major_version /* 2951 DEFVAR_LISP ("emacs-major-version", &Vemacs_major_version /*
2776 Major version number of this version of Emacs, as an integer. 2952 Major version number of this version of Emacs, as an integer.
2777 Warning: this variable did not exist in Emacs versions earlier than: 2953 Warning: this variable did not exist in Emacs versions earlier than:
2778 FSF Emacs: 19.23 2954 FSF Emacs: 19.23
2786 FSF Emacs: 19.23 2962 FSF Emacs: 19.23
2787 XEmacs: 19.10 2963 XEmacs: 19.10
2788 */ ); 2964 */ );
2789 Vemacs_minor_version = make_int (EMACS_MINOR_VERSION); 2965 Vemacs_minor_version = make_int (EMACS_MINOR_VERSION);
2790 2966
2791 DEFVAR_LISP ("emacs-beta-version", &Vemacs_beta_version /* 2967 DEFVAR_LISP ("emacs-patch-level", &Vemacs_patch_level /*
2968 The patch level of this version of Emacs, as an integer.
2969 The value is non-nil if this version of XEmacs is part of a series of
2970 stable XEmacsen, but has bug fixes applied.
2971 Warning: this variable does not exist in FSF Emacs or in XEmacs versions
2972 earlier than 21.1.1
2973 */ );
2974 #ifdef EMACS_PATCH_LEVEL
2975 Vemacs_patch_level = make_int (EMACS_PATCH_LEVEL);
2976 #else
2977 Vemacs_patch_level = Qnil;
2978 #endif
2979
2980 DEFVAR_LISP ("emacs-beta-version", &Vemacs_beta_version /*
2792 Beta number of this version of Emacs, as an integer. 2981 Beta number of this version of Emacs, as an integer.
2793 The value is nil if this is an officially released version of XEmacs. 2982 The value is nil if this is an officially released version of XEmacs.
2794 Warning: this variable does not exist in FSF Emacs or in XEmacs versions 2983 Warning: this variable does not exist in FSF Emacs or in XEmacs versions
2795 earlier than 20.3. 2984 earlier than 20.3.
2796 */ ); 2985 */ );
2821 Codename of this version of Emacs (a string). 3010 Codename of this version of Emacs (a string).
2822 */ ); 3011 */ );
2823 #ifndef XEMACS_CODENAME 3012 #ifndef XEMACS_CODENAME
2824 #define XEMACS_CODENAME "Noname" 3013 #define XEMACS_CODENAME "Noname"
2825 #endif 3014 #endif
2826 Vxemacs_codename = Fpurecopy (build_string (XEMACS_CODENAME)); 3015 Vxemacs_codename = build_string (XEMACS_CODENAME);
2827 3016
2828 DEFVAR_BOOL ("noninteractive", &noninteractive1 /* 3017 DEFVAR_BOOL ("noninteractive", &noninteractive1 /*
2829 Non-nil means XEmacs is running without interactive terminal. 3018 Non-nil means XEmacs is running without interactive terminal.
2830 */ ); 3019 */ );
2831 3020
2895 #endif 3084 #endif
2896 #ifdef ERROR_CHECK_BUFPOS 3085 #ifdef ERROR_CHECK_BUFPOS
2897 Vinternal_error_checking = Fcons (intern ("bufpos"), 3086 Vinternal_error_checking = Fcons (intern ("bufpos"),
2898 Vinternal_error_checking); 3087 Vinternal_error_checking);
2899 #endif 3088 #endif
2900 Vinternal_error_checking = Fpurecopy (Vinternal_error_checking); 3089
3090 DEFVAR_CONST_LISP ("mail-lock-methods", &Vmail_lock_methods /*
3091 Mail spool locking methods supported by this instance of XEmacs.
3092 This is a list of symbols. Each of the symbols is one of the
3093 following: dot, lockf, flock, locking, mmdf.
3094 */ );
3095 {
3096 Vmail_lock_methods = Qnil;
3097 Vmail_lock_methods = Fcons (intern ("dot"), Vmail_lock_methods);
3098 #ifdef HAVE_LOCKF
3099 Vmail_lock_methods = Fcons (intern ("lockf"), Vmail_lock_methods);
3100 #endif
3101 #ifdef HAVE_FLOCK
3102 Vmail_lock_methods = Fcons (intern ("flock"), Vmail_lock_methods);
3103 #endif
3104 #ifdef HAVE_MMDF
3105 Vmail_lock_methods = Fcons (intern ("mmdf"), Vmail_lock_methods);
3106 #endif
3107 #ifdef HAVE_LOCKING
3108 Vmail_lock_methods = Fcons (intern ("locking"), Vmail_lock_methods);
3109 #endif
3110 }
3111
3112 DEFVAR_CONST_LISP ("configure-mail-lock-method", &Vconfigure_mail_lock_method /*
3113 Mail spool locking method suggested by configure. This is one
3114 of the symbols in MAIL-LOCK-METHODS.
3115 */ );
3116 {
3117 #if defined(MAIL_LOCK_FLOCK) && defined(HAVE_FLOCK)
3118 Vconfigure_mail_lock_method = intern("flock");
3119 #elif defined(MAIL_LOCK_LOCKF) && defined(HAVE_LOCKF)
3120 Vconfigure_mail_lock_method = intern("lockf");
3121 #elif defined(MAIL_LOCK_MMDF) && defined(HAVE_MMDF)
3122 Vconfigure_mail_lock_method = intern("mmdf");
3123 #elif defined(MAIL_LOCK_LOCKING) && defined(HAVE_LOCKING)
3124 Vconfigure_mail_lock_method = intern("locking");
3125 #else
3126 Vconfigure_mail_lock_method = intern("dot");
3127 #endif
3128 }
2901 3129
2902 DEFVAR_LISP ("path-separator", &Vpath_separator /* 3130 DEFVAR_LISP ("path-separator", &Vpath_separator /*
2903 The directory separator in search paths, as a string. 3131 The directory separator in search paths, as a string.
2904 */ ); 3132 */ );
2905 { 3133 {
3122 #else 3350 #else
3123 Vconfigure_info_path = Qnil; 3351 Vconfigure_info_path = Qnil;
3124 #endif 3352 #endif
3125 } 3353 }
3126 3354
3127 #ifdef __sgi 3355 #if defined(__sgi) && !defined(PDUMP)
3128 /* This is so tremendously ugly I'd puke. But then, it works. 3356 /* This is so tremendously ugly I'd puke. But then, it works.
3129 * The target is to override the static constructor from the 3357 * The target is to override the static constructor from the
3130 * libiflPNG.so library which is maskerading as libz, and 3358 * libiflPNG.so library which is maskerading as libz, and
3131 * cores on us when re-started from the dumped executable. 3359 * cores on us when re-started from the dumped executable.
3132 * This will have to go for 21.1 -- OG. 3360 * This will have to go for 21.1 -- OG.