X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/11ee65afc20d41f1fc31fe2ead84b2203b4bfeb0..2bfa3d3e1fb347ba76bddf77f3e288049635821d:/src/emacs.c
diff --git a/src/emacs.c b/src/emacs.c
index 9d070bda51..bef3266f70 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -27,6 +27,7 @@ along with GNU Emacs. If not, see . */
#include
#include
#include
+#include
#include
@@ -80,6 +81,7 @@ along with GNU Emacs. If not, see . */
#include "composite.h"
#include "dispextern.h"
#include "syntax.h"
+#include "sysselect.h"
#include "systime.h"
#ifdef HAVE_GNUTLS
@@ -105,8 +107,9 @@ extern void moncontrol (int mode);
#include
#endif
-static const char emacs_version[] = VERSION;
+static const char emacs_version[] = PACKAGE_VERSION;
static const char emacs_copyright[] = COPYRIGHT;
+static const char emacs_bugreport[] = PACKAGE_BUGREPORT;
/* Empty lisp strings. To avoid having to build any others. */
Lisp_Object empty_unibyte_string, empty_multibyte_string;
@@ -135,7 +138,7 @@ static void *malloc_state_ptr;
/* From glibc, a routine that returns a copy of the malloc internal state. */
extern void *malloc_get_state (void);
/* From glibc, a routine that overwrites the malloc internal state. */
-extern int malloc_set_state (void*);
+extern int malloc_set_state (void *);
/* True if the MALLOC_CHECK_ environment variable was set while
dumping. Used to work around a bug in glibc's malloc. */
static bool malloc_using_checking;
@@ -163,10 +166,6 @@ bool running_asynch_code;
bool display_arg;
#endif
-/* An address near the bottom of the stack.
- Tells GC how to save a copy of the stack. */
-char *stack_bottom;
-
#if defined (DOUG_LEA_MALLOC) || defined (GNU_LINUX)
/* The address where the heap starts (from the first sbrk (0) call). */
static void *my_heap_start;
@@ -213,7 +212,7 @@ int initial_argc;
static void sort_args (int argc, char **argv);
static void syms_of_emacs (void);
-/* C89 needs each string be at most 509 characters, so the usage
+/* C99 needs each string to be at most 4095 characters, and the usage
strings below are split to not overflow this limit. */
static char const *const usage_message[] =
{ "\
@@ -324,7 +323,7 @@ abbreviation for a --option.\n\
Various environment variables and window system resources also affect\n\
the operation of Emacs. See the main documentation.\n\
\n\
-Report bugs to bug-gnu-emacs@gnu.org. First, please see the Bugs\n\
+Report bugs to " PACKAGE_BUGREPORT ". First, please see the Bugs\n\
section of the Emacs manual or the file BUGS.\n"
};
@@ -391,7 +390,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd)
{
register int i;
Lisp_Object name, dir, handler;
- ptrdiff_t count = SPECPDL_INDEX ();
+ dynwind_begin ();
Lisp_Object raw_name;
initial_argv = argv;
@@ -550,7 +549,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd)
= Fcons (build_unibyte_string (argv[i]), Vcommand_line_args);
}
- unbind_to (count, Qnil);
+ dynwind_end ();
}
DEFUN ("invocation-name", Finvocation_name, Sinvocation_name, 0, 0, 0,
@@ -668,9 +667,7 @@ malloc_initialize_hook (void)
}
malloc_set_state (malloc_state_ptr);
-#ifndef XMALLOC_OVERRUN_CHECK
free (malloc_state_ptr);
-#endif
}
else
{
@@ -703,10 +700,6 @@ close_output_streams (void)
int
main (int argc, char **argv)
{
-#if GC_MARK_STACK
- Lisp_Object dummy;
-#endif
- char stack_bottom_variable;
bool do_initial_setlocale;
bool dumping;
int skip_args = 0;
@@ -724,10 +717,6 @@ main (int argc, char **argv)
/* If we use --chdir, this records the original directory. */
char *original_pwd = 0;
-#if GC_MARK_STACK
- stack_base = &dummy;
-#endif
-
#ifdef G_SLICE_ALWAYS_MALLOC
/* This is used by the Cygwin build. It's not needed starting with
cygwin-1.7.24, but it doesn't do any harm. */
@@ -777,6 +766,10 @@ main (int argc, char **argv)
atexit (close_output_streams);
+ /* Override Guile's libgc configuration. */
+ xputenv ("GC_ALL_INTERIOR_POINTERS=1");
+ scm_init_guile ();
+
sort_args (argc, argv);
argc = 0;
while (argv[argc]) argc++;
@@ -901,9 +894,6 @@ main (int argc, char **argv)
}
#endif /* HAVE_SETRLIMIT and RLIMIT_STACK */
- /* Record (approximately) where the stack begins. */
- stack_bottom = &stack_bottom_variable;
-
clearerr (stdin);
#ifndef SYSTEM_MALLOC
@@ -1007,7 +997,7 @@ main (int argc, char **argv)
{
int i;
printf ("Usage: %s [OPTION-OR-FILENAME]...\n", argv[0]);
- for (i = 0; i < sizeof usage_message / sizeof *usage_message; i++)
+ for (i = 0; i < ARRAYELTS (usage_message); i++)
fputs (usage_message[i], stdout);
exit (0);
}
@@ -1169,6 +1159,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
if (!initialized)
{
init_alloc_once ();
+ init_fns_once ();
init_obarray ();
init_eval_once ();
init_charset_once ();
@@ -1375,7 +1366,8 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
xputenv ("LANG=C");
#endif
- init_buffer (); /* Init default directory of main buffer. */
+ /* Init buffer storage and default directory of main buffer. */
+ init_buffer (initialized);
init_callproc_1 (); /* Must precede init_cmdargs and init_sys_modes. */
@@ -1785,8 +1777,8 @@ sort_args (int argc, char **argv)
0 for an option that takes no arguments,
1 for an option that takes one argument, etc.
-1 for an ordinary non-option argument. */
- int *options = xnmalloc (argc, sizeof *options);
- int *priority = xnmalloc (argc, sizeof *priority);
+ int *options = xnmalloc_atomic (argc, sizeof *options);
+ int *priority = xnmalloc_atomic (argc, sizeof *priority);
int to = 1;
int incoming_used = 1;
int from;
@@ -1816,7 +1808,7 @@ sort_args (int argc, char **argv)
}
/* Look for a match with a known old-fashioned option. */
- for (i = 0; i < sizeof (standard_args) / sizeof (standard_args[0]); i++)
+ for (i = 0; i < ARRAYELTS (standard_args); i++)
if (!strcmp (argv[from], standard_args[i].name))
{
options[from] = standard_args[i].nargs;
@@ -1838,8 +1830,7 @@ sort_args (int argc, char **argv)
match = -1;
- for (i = 0;
- i < sizeof (standard_args) / sizeof (standard_args[0]); i++)
+ for (i = 0; i < ARRAYELTS (standard_args); i++)
if (standard_args[i].longname
&& !strncmp (argv[from], standard_args[i].longname,
thislen))
@@ -2080,7 +2071,7 @@ You must run Emacs in batch mode in order to dump it. */)
{
Lisp_Object tem;
Lisp_Object symbol;
- ptrdiff_t count = SPECPDL_INDEX ();
+ dynwind_begin ();
check_pure_size ();
@@ -2155,13 +2146,8 @@ You must run Emacs in batch mode in order to dump it. */)
malloc_state_ptr = malloc_get_state ();
#endif
-#ifdef USE_MMAP_FOR_BUFFERS
- mmap_set_vars (0);
-#endif
unexec (SSDATA (filename), !NILP (symfile) ? SSDATA (symfile) : 0);
-#ifdef USE_MMAP_FOR_BUFFERS
- mmap_set_vars (1);
-#endif
+
#ifdef DOUG_LEA_MALLOC
free (malloc_state_ptr);
#endif
@@ -2175,7 +2161,8 @@ You must run Emacs in batch mode in order to dump it. */)
Vpurify_flag = tem;
- return unbind_to (count, Qnil);
+ dynwind_end ();
+ return Qnil;
}
#endif /* not CANNOT_DUMP */
@@ -2415,22 +2402,13 @@ from the parent process and its tty file descriptors. */)
void
syms_of_emacs (void)
{
+#include "emacs.x"
+
DEFSYM (Qfile_name_handler_alist, "file-name-handler-alist");
DEFSYM (Qrisky_local_variable, "risky-local-variable");
DEFSYM (Qkill_emacs, "kill-emacs");
DEFSYM (Qkill_emacs_hook, "kill-emacs-hook");
-#ifndef CANNOT_DUMP
- defsubr (&Sdump_emacs);
-#endif
-
- defsubr (&Skill_emacs);
-
- defsubr (&Sinvocation_name);
- defsubr (&Sinvocation_directory);
- defsubr (&Sdaemonp);
- defsubr (&Sdaemon_initialized);
-
DEFVAR_LISP ("command-line-args", Vcommand_line_args,
doc: /* Args passed by shell to Emacs, as a list of strings.
Many arguments are deleted from the list as they are processed. */);
@@ -2460,6 +2438,12 @@ Emacs is running. */);
doc: /* String containing the configuration options Emacs was built with. */);
Vsystem_configuration_options = build_string (EMACS_CONFIG_OPTIONS);
+ DEFVAR_LISP ("system-configuration-features", Vsystem_configuration_features,
+ doc: /* String listing some of the main features this Emacs was compiled with.
+An element of the form \"FOO\" generally means that HAVE_FOO was
+defined during the build. */);
+ Vsystem_configuration_features = build_string (EMACS_CONFIG_FEATURES);
+
DEFVAR_BOOL ("noninteractive", noninteractive1,
doc: /* Non-nil means Emacs is running without interactive terminal. */);
@@ -2537,6 +2521,10 @@ This is nil during initialization. */);
doc: /* Version numbers of this version of Emacs. */);
Vemacs_version = build_string (emacs_version);
+ DEFVAR_LISP ("report-emacs-bug-address", Vreport_emacs_bug_address,
+ doc: /* Address of mailing list for GNU Emacs bugs. */);
+ Vreport_emacs_bug_address = build_string (emacs_bugreport);
+
DEFVAR_LISP ("dynamic-library-alist", Vdynamic_library_alist,
doc: /* Alist of dynamic libraries vs external files implementing them.
Each element is a list (LIBRARY FILE...), where the car is a symbol