/* Fully extensible Emacs, running on Unix, intended for GNU.
- Copyright (C) 1985,86,87,93,94,95,97,98,1999,2001,02,03,2004
- Free Software Foundation, Inc.
+ Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999, 2001,
+ 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#ifdef WINDOWSNT
#include <fcntl.h>
+#include <windows.h> /* just for w32.h */
+#include "w32.h"
#endif
#include "lisp.h"
void (*fatal_error_signal_hook) P_ ((void));
+#ifdef HAVE_GTK_AND_PTHREAD
+/* When compiled with GTK and running under Gnome, multiple threads meay be
+ created. Keep track of our main thread to make sure signals are delivered
+ to it (see syssignal.h). */
+
+pthread_t main_thread;
+#endif
+
#ifdef SIGUSR1
SIGTYPE
{
struct input_event buf;
+ SIGNAL_THREAD_CHECK (sig);
bzero (&buf, sizeof buf);
buf.kind = USER_SIGNAL_EVENT;
buf.frame_or_window = selected_frame;
{
struct input_event buf;
+ SIGNAL_THREAD_CHECK (sig);
bzero (&buf, sizeof buf);
buf.kind = USER_SIGNAL_EVENT;
buf.code = 1;
fatal_error_signal (sig)
int sig;
{
+ SIGNAL_THREAD_CHECK (sig);
fatal_error_code = sig;
signal (sig, SIG_DFL);
int sig;
{
signal (sig, memory_warning_signal);
+ SIGNAL_THREAD_CHECK (sig);
malloc_warning ("Operating system warns that virtual memory is running low.\n");
They are decoded in the function command-line after we know
locale-coding-system. */
Vcommand_line_args
- = Fcons (make_unibyte_string (argv[i], strlen (argv[i])),
+ = Fcons (make_unibyte_string (argv[i], strlen (argv[i])),
Vcommand_line_args);
}
}
malloc_set_state (malloc_state_ptr);
+#ifndef XMALLOC_OVERRUN_CHECK
free (malloc_state_ptr);
+#endif
}
else
{
Also call realloc and free for consistency. */
free (realloc (malloc (4), 4));
+# ifndef SYNC_INPUT
/* Arrange to disable interrupt input inside malloc etc. */
uninterrupt_malloc ();
+# endif /* not SYNC_INPUT */
#endif /* not SYSTEM_MALLOC */
+#ifdef HAVE_GTK_AND_PTHREAD
+ main_thread = pthread_self ();
+#endif /* HAVE_GTK_AND_PTHREAD */
+
#if defined (MSDOS) || defined (WINDOWSNT)
/* We do all file input/output as binary files. When we need to translate
newlines, we do that manually. */
/* Handle the -batch switch, which means don't do interactive display. */
noninteractive = 0;
if (argmatch (argv, argc, "-batch", "--batch", 5, NULL, &skip_args))
- noninteractive = 1;
+ {
+ noninteractive = 1;
+ Vundo_outer_limit = Qnil;
+ }
if (argmatch (argv, argc, "-script", "--script", 3, &junk, &skip_args))
{
noninteractive = 1; /* Set batch mode. */
creates a full-fledge output_mac type frame. This does not
work correctly before syms_of_textprop, syms_of_macfns,
syms_of_ccl, syms_of_fontset, syms_of_xterm, syms_of_search,
- syms_of_frame, mac_initialize, and init_keyboard have already
+ syms_of_frame, mac_term_init, and init_keyboard have already
been called. */
syms_of_textprop ();
syms_of_macfns ();
syms_of_search ();
syms_of_frame ();
- mac_initialize ();
+ mac_term_init (build_string ("Mac"), NULL, NULL);
init_keyboard ();
#endif
#ifdef HAVE_NTGUI
globals_of_w32fns ();
globals_of_w32menu ();
+ globals_of_w32select ();
#endif /* HAVE_NTGUI */
}
bcopy (new, argv, sizeof (char *) * argc);
- free (options);
- free (new);
- free (priority);
+ xfree (options);
+ xfree (new);
+ xfree (priority);
}
\f
DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 1, "P",
memory_warnings (my_edata, malloc_warning);
#endif /* not WINDOWSNT */
#endif
+#if !defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT
+ /* Pthread may call malloc before main, and then we will get an endless
+ loop, because pthread_self (see alloc.c) calls malloc the first time
+ it is called on some systems. */
+ reset_malloc_hooks ();
+#endif
#ifdef DOUG_LEA_MALLOC
malloc_state_ptr = malloc_get_state ();
#endif
Many arguments are deleted from the list as they are processed. */);
DEFVAR_LISP ("system-type", &Vsystem_type,
- doc: /* Value is symbol indicating type of operating system you are using. */);
++ doc: /* Value is symbol indicating type of operating system you are using.
++Special values:
++ `gnu/linux' compiled for a GNU/Linux system.
++ `darwin' compiled for Darwin (GNU-Darwin, Mac OS X, ...).
++ `macos' compiled for Mac OS 9.
++ `ms-dos' compiled as an MS-DOS application.
++ `windows-nt' compiled as a native W32 application.
++ `cygwin' compiled using the Cygwin library.
++ `vax-vms' or `axp-vms': compiled for a (Open)VMS system.
++Anything else indicates some sort of Unix system. */);
Vsystem_type = intern (SYSTEM_TYPE);
DEFVAR_LISP ("system-configuration", &Vsystem_configuration,