summaryrefslogtreecommitdiff
path: root/src/emacs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emacs.c')
-rw-r--r--src/emacs.c69
1 files changed, 45 insertions, 24 deletions
diff --git a/src/emacs.c b/src/emacs.c
index 483e848f6db..7d07ec85029 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -83,7 +83,8 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include "charset.h"
#include "composite.h"
#include "dispextern.h"
-#include "regex.h"
+#include "ptr-bounds.h"
+#include "regex-emacs.h"
#include "sheap.h"
#include "syntax.h"
#include "sysselect.h"
@@ -93,10 +94,14 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include "getpagesize.h"
#include "gnutls.h"
-#if (defined PROFILING \
- && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__))
+#ifdef PROFILING
# include <sys/gmon.h>
extern void moncontrol (int mode);
+# ifdef __MINGW32__
+extern unsigned char etext asm ("etext");
+# else
+extern char etext;
+# endif
#endif
#ifdef HAVE_SETLOCALE
@@ -372,7 +377,7 @@ terminate_due_to_signal (int sig, int backtrace_limit)
totally_unblock_input ();
if (sig == SIGTERM || sig == SIGHUP || sig == SIGINT)
- Fkill_emacs (make_number (sig));
+ Fkill_emacs (make_fixnum (sig));
shut_down_emacs (sig, Qnil);
emacs_backtrace (backtrace_limit);
@@ -441,7 +446,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd)
{
Lisp_Object found;
int yes = openp (Vexec_path, Vinvocation_name,
- Vexec_suffixes, &found, make_number (X_OK), false);
+ Vexec_suffixes, &found, make_fixnum (X_OK), false);
if (yes == 1)
{
/* Add /: to the front of the name
@@ -841,9 +846,9 @@ main (int argc, char **argv)
{
rlim_t lim = rlim.rlim_cur;
- /* Approximate the amount regex.c needs per unit of
+ /* Approximate the amount regex-emacs.c needs per unit of
emacs_re_max_failures, then add 33% to cover the size of the
- smaller stacks that regex.c successively allocates and
+ smaller stacks that regex-emacs.c successively allocates and
discards on its way to the maximum. */
int min_ratio = 20 * sizeof (char *);
int ratio = min_ratio + min_ratio / 3;
@@ -882,7 +887,7 @@ main (int argc, char **argv)
lim = newlim;
}
}
- /* If the stack is big enough, let regex.c more of it before
+ /* If the stack is big enough, let regex-emacs.c more of it before
falling back to heap allocation. */
emacs_re_safe_alloca = max
(min (lim - extra, SIZE_MAX) * (min_ratio / ratio),
@@ -1264,6 +1269,10 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
running_asynch_code = 0;
init_random ();
+#if defined HAVE_JSON && !defined WINDOWSNT
+ init_json ();
+#endif
+
no_loadup
= argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args);
@@ -1544,9 +1553,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
#endif
#endif /* HAVE_X_WINDOWS */
-#ifdef HAVE_LIBXML2
syms_of_xml ();
-#endif
#ifdef HAVE_LCMS2
syms_of_lcms2 ();
@@ -1565,6 +1572,10 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
syms_of_fontset ();
#endif /* HAVE_NTGUI */
+#if defined HAVE_NTGUI || defined CYGWIN
+ syms_of_w32cygwinx ();
+#endif
+
#if defined WINDOWSNT || defined HAVE_NTGUI
syms_of_w32select ();
#endif
@@ -1612,6 +1623,10 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
syms_of_threads ();
syms_of_profiler ();
+#ifdef HAVE_JSON
+ syms_of_json ();
+#endif
+
keys_of_casefiddle ();
keys_of_cmds ();
keys_of_buffer ();
@@ -1691,23 +1706,15 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
GNU/Linux and MinGW. It might work on some other systems too.
Give it a try and tell us if it works on your system. To compile
for profiling, use the configure option --enable-profiling. */
-#if defined (__FreeBSD__) || defined (GNU_LINUX) || defined (__MINGW32__)
#ifdef PROFILING
if (initialized)
{
-#ifdef __MINGW32__
- extern unsigned char etext asm ("etext");
-#else
- extern char etext;
-#endif
-
atexit (_mcleanup);
monstartup ((uintptr_t) __executable_start, (uintptr_t) &etext);
}
else
moncontrol (0);
#endif
-#endif
initialized = 1;
@@ -2012,10 +2019,17 @@ all of which are called before Emacs is actually killed. */
{
int exit_code;
+#ifdef HAVE_LIBSYSTEMD
+ sd_notify(0, "STOPPING=1");
+#endif /* HAVE_LIBSYSTEMD */
+
/* Fsignal calls emacs_abort () if it sees that waiting_for_input is
set. */
waiting_for_input = 0;
- run_hook (Qkill_emacs_hook);
+ if (noninteractive)
+ safe_run_hooks (Qkill_emacs_hook);
+ else
+ run_hook (Qkill_emacs_hook);
#ifdef HAVE_X_WINDOWS
/* Transfer any clipboards we own to the clipboard manager. */
@@ -2038,10 +2052,10 @@ all of which are called before Emacs is actually killed. */
unlink (SSDATA (listfile));
}
- if (INTEGERP (arg))
- exit_code = (XINT (arg) < 0
- ? XINT (arg) | INT_MIN
- : XINT (arg) & INT_MAX);
+ if (FIXNUMP (arg))
+ exit_code = (XFIXNUM (arg) < 0
+ ? XFIXNUM (arg) | INT_MIN
+ : XFIXNUM (arg) & INT_MAX);
else
exit_code = EXIT_SUCCESS;
exit (exit_code);
@@ -2402,7 +2416,7 @@ decode_env_path (const char *evarname, const char *defalt, bool empty)
&& strncmp (path, emacs_dir_env, emacs_dir_len) == 0)
element = Fexpand_file_name (Fsubstring
(element,
- make_number (emacs_dir_len),
+ make_fixnum (emacs_dir_len),
Qnil),
build_unibyte_string (emacs_dir));
#endif
@@ -2469,6 +2483,13 @@ from the parent process and its tty file descriptors. */)
error ("This function can only be called after loading the init files");
#ifndef WINDOWSNT
+ if (daemon_type == 1)
+ {
+#ifdef HAVE_LIBSYSTEMD
+ sd_notify(0, "READY=1");
+#endif /* HAVE_LIBSYSTEMD */
+ }
+
if (daemon_type == 2)
{
int nfd;