summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/Makefile.in31
-rw-r--r--lib-src/be_resources.cc144
-rw-r--r--lib-src/emacsclient.c27
-rw-r--r--lib-src/etags.c9
-rw-r--r--lib-src/make-docfile.c466
-rw-r--r--lib-src/ntlib.c13
6 files changed, 205 insertions, 485 deletions
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index f5d9db932ab..835b6016541 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -27,7 +27,9 @@ EMACSOPT = -batch --no-site-file --no-site-lisp
# ==================== Things 'configure' will edit ====================
CC=@CC@
+CXX=@CXX@
CFLAGS=@CFLAGS@
+CXXFLAGS=@CXXFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
@@ -130,6 +132,11 @@ MKDIR_P = @MKDIR_P@
# ========================== Lists of Files ===========================
+## Haiku build-time support
+HAVE_BE_APP=@HAVE_BE_APP@
+HAIKU_LIBS=@HAIKU_LIBS@
+HAIKU_CFLAGS=@HAIKU_CFLAGS@
+
# emacsclientw.exe for MinGW, empty otherwise
CLIENTW = @CLIENTW@
@@ -143,7 +150,11 @@ UTILITIES = hexl${EXEEXT} \
$(if $(with_mailutils), , movemail${EXEEXT}) \
$(and $(use_gamedir), update-game-score${EXEEXT})
+ifeq ($(HAVE_BE_APP),yes)
+DONT_INSTALL= make-docfile${EXEEXT} make-fingerprint${EXEEXT} be-resources
+else
DONT_INSTALL= make-docfile${EXEEXT} make-fingerprint${EXEEXT}
+endif
# Like UTILITIES, but they're not system-dependent, and should not be
# deleted by the distclean target.
@@ -232,6 +243,10 @@ WINDRES = @WINDRES@
## Some systems define this to request special libraries.
LIBS_SYSTEM = @LIBS_SYSTEM@
+# Flags that could be in WARN_CFLAGS, but are invalid for C++.
+NON_CXX_CFLAGS = -Wmissing-prototypes -Wnested-externs -Wold-style-definition \
+ -Wstrict-prototypes -Wno-override-init
+
BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-I. -I../src -I../lib \
@@ -240,6 +255,9 @@ BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
+ALL_CXXFLAGS = $(filter-out ${NON_CXX_CFLAGS},${BASE_CFLAGS}) \
+ ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS} ${HAIKU_CFLAGS}
+
# Configuration files for .o files to depend on.
config_h = ../src/config.h $(srcdir)/../src/conf_post.h
@@ -279,8 +297,8 @@ maybe-blessmail: $(BLESSMAIL_TARGET)
## up if chown or chgrp fails, as the package responsible for
## installing Emacs can fix this problem later.
$(DESTDIR)${archlibdir}: all
- @echo
- @echo "Installing utilities run internally by Emacs."
+ $(info $ )
+ $(info Installing utilities run internally by Emacs.)
umask 022 && ${MKDIR_P} "$(DESTDIR)${archlibdir}"
exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd` && \
if [ "$$exp_archlibdir" != "`/bin/pwd`" ]; then \
@@ -321,8 +339,8 @@ $(DESTDIR)${archlibdir}: all
.PHONY: bootstrap-clean check tags
install: $(DESTDIR)${archlibdir}
- @echo
- @echo "Installing utilities for users to run."
+ $(info $ )
+ $(info Installing utilities for users to run.)
umask 022 && ${MKDIR_P} "$(DESTDIR)${bindir}"
for file in ${INSTALLABLES} ; do \
$(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} \
@@ -357,7 +375,7 @@ bootstrap-clean maintainer-clean: distclean
## Test the contents of the directory.
check:
- @echo "We don't have any tests for the lib-src/ directory yet."
+ $(info We don't have any tests for the lib-src/ directory yet.)
tagsfiles = $(wildcard ${srcdir}/*.[ch])
@@ -409,6 +427,9 @@ emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
$(LOADLIBES) \
$(LIB_WSOCK32) $(LIB_EACCESS) $(LIBS_ECLIENT) -o $@
+be-resources: ${srcdir}/be_resources.cc ${config_h}
+ $(AM_V_CXXLD)$(CXX) ${ALL_CXXFLAGS} ${HAIKU_LIBS} $< -o $@
+
NTINC = ${srcdir}/../nt/inc
NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \
$(NTINC)/stdint.h $(NTINC)/pwd.h $(NTINC)/sys/time.h $(NTINC)/stdbool.h \
diff --git a/lib-src/be_resources.cc b/lib-src/be_resources.cc
new file mode 100644
index 00000000000..e6a14f037b6
--- /dev/null
+++ b/lib-src/be_resources.cc
@@ -0,0 +1,144 @@
+/* Haiku window system support
+ Copyright (C) 2021 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include <cstdio>
+#include <cstring>
+#include <cstdlib>
+
+#include <SupportDefs.h>
+#include <Path.h>
+#include <AppFileInfo.h>
+#include <TranslationUtils.h>
+#include <Application.h>
+#include <Catalog.h>
+#include <Roster.h>
+
+using namespace std;
+
+static void
+be_perror (status_t code, char *arg)
+{
+ if (code != B_OK)
+ {
+ switch (code)
+ {
+ case B_BAD_VALUE:
+ fprintf (stderr, "%s: Bad value\n", arg);
+ break;
+ case B_ENTRY_NOT_FOUND:
+ fprintf (stderr, "%s: Not found\n", arg);
+ break;
+ case B_PERMISSION_DENIED:
+ fprintf (stderr, "%s: Permission denied\n", arg);
+ break;
+ case B_NO_MEMORY:
+ fprintf (stderr, "%s: No memory\n", arg);
+ break;
+ case B_LINK_LIMIT:
+ fprintf (stderr, "%s: Link limit reached\n", arg);
+ break;
+ case B_BUSY:
+ fprintf (stderr, "%s: Busy\n", arg);
+ break;
+ case B_NO_MORE_FDS:
+ fprintf (stderr, "%s: No more file descriptors\n", arg);
+ break;
+ case B_FILE_ERROR:
+ fprintf (stderr, "%s: File error\n", arg);
+ break;
+ default:
+ fprintf (stderr, "%s: Unknown error\n", arg);
+ }
+ }
+ else
+ {
+ abort ();
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ BApplication app ("application/x-vnd.GNU-emacs-resource-helper");
+ BFile file;
+ BBitmap *icon;
+ BAppFileInfo info;
+ status_t code;
+ struct version_info vinfo;
+ char *v = strdup (PACKAGE_VERSION);
+
+ if (argc != 3)
+ {
+ printf ("be-resources ICON FILE: make FILE appropriate for Emacs.\n");
+ return EXIT_FAILURE;
+ }
+
+ code = file.SetTo (argv[2], B_READ_WRITE);
+ if (code != B_OK)
+ {
+ be_perror (code, argv[2]);
+ return EXIT_FAILURE;
+ }
+ code = info.SetTo (&file);
+ if (code != B_OK)
+ {
+ be_perror (code, argv[2]);
+ return EXIT_FAILURE;
+ }
+ code = info.SetAppFlags (B_EXCLUSIVE_LAUNCH | B_ARGV_ONLY);
+ if (code != B_OK)
+ {
+ be_perror (code, argv[2]);
+ return EXIT_FAILURE;
+ }
+
+ icon = BTranslationUtils::GetBitmapFile (argv[1], NULL);
+
+ if (!icon)
+ {
+ be_perror (B_ERROR, argv[1]);
+ return EXIT_FAILURE;
+ }
+
+ info.SetIcon (icon, B_MINI_ICON);
+ info.SetIcon (icon, B_LARGE_ICON);
+ info.SetSignature ("application/x-vnd.GNU-emacs");
+
+ v = strtok (v, ".");
+ vinfo.major = atoi (v);
+
+ v = strtok (NULL, ".");
+ vinfo.middle = atoi (v);
+
+ v = strtok (NULL, ".");
+ vinfo.minor = v ? atoi (v) : 0;
+
+ vinfo.variety = 0;
+ vinfo.internal = 0;
+
+ strncpy ((char *) &vinfo.short_info, PACKAGE_VERSION,
+ sizeof vinfo.short_info - 1);
+ strncpy ((char *) &vinfo.long_info, PACKAGE_STRING,
+ sizeof vinfo.long_info - 1);
+
+ info.SetVersionInfo (&vinfo, B_APP_VERSION_KIND);
+
+ return EXIT_SUCCESS;
+}
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index d11fd88c45e..7769e015edc 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -116,6 +116,9 @@ static bool eval;
/* True means open a new frame. --create-frame etc. */
static bool create_frame;
+/* True means reuse a frame if it already exists. */
+static bool reuse_frame;
+
/* The display on which Emacs should work. --display. */
static char const *display;
@@ -165,6 +168,7 @@ static struct option const longopts[] =
{ "tty", no_argument, NULL, 't' },
{ "nw", no_argument, NULL, 't' },
{ "create-frame", no_argument, NULL, 'c' },
+ { "reuse-frame", no_argument, NULL, 'r' },
{ "alternate-editor", required_argument, NULL, 'a' },
{ "frame-parameters", required_argument, NULL, 'F' },
#ifdef SOCKETS_IN_FILE_SYSTEM
@@ -551,6 +555,11 @@ decode_options (int argc, char **argv)
create_frame = true;
break;
+ case 'r':
+ create_frame = true;
+ reuse_frame = true;
+ break;
+
case 'p':
parent_id = optarg;
create_frame = true;
@@ -594,9 +603,16 @@ decode_options (int argc, char **argv)
alt_display = "ns";
#elif defined (HAVE_NTGUI)
alt_display = "w32";
+#elif defined (HAVE_HAIKU)
+ alt_display = "be";
#endif
+#ifdef HAVE_PGTK
+ display = egetenv ("WAYLAND_DISPLAY");
+ alt_display = egetenv ("DISPLAY");
+#else
display = egetenv ("DISPLAY");
+#endif
}
if (!display)
@@ -647,6 +663,8 @@ The following OPTIONS are accepted:\n\
-nw, -t, --tty Open a new Emacs frame on the current terminal\n\
-c, --create-frame Create a new frame instead of trying to\n\
use the current Emacs frame\n\
+-r, --reuse-frame Create a new frame if none exists, otherwise\n\
+ use the current Emacs frame\n\
", "\
-F ALIST, --frame-parameters=ALIST\n\
Set the parameters of a new frame\n\
@@ -1744,8 +1762,9 @@ start_daemon_and_retry_set_socket (void)
}
/* Try connecting, the daemon should have started by now. */
- message (true,
- "Emacs daemon should have started, trying to connect again\n");
+ if (!quiet)
+ message (true,
+ "Emacs daemon should have started, trying to connect again\n");
}
else if (dpid < 0)
{
@@ -1836,7 +1855,7 @@ start_daemon_and_retry_set_socket (void)
/* Try connecting, the daemon should have started by now. */
/* It's just a progress message, so don't pop a dialog if this is
emacsclientw. */
- if (!w32_window_app ())
+ if (!quiet && !w32_window_app ())
message (true,
"Emacs daemon should have started, trying to connect again\n");
#endif /* WINDOWSNT */
@@ -1940,7 +1959,7 @@ main (int argc, char **argv)
if (nowait)
send_to_emacs (emacs_socket, "-nowait ");
- if (!create_frame)
+ if (!create_frame || reuse_frame)
send_to_emacs (emacs_socket, "-current-frame ");
if (display)
diff --git a/lib-src/etags.c b/lib-src/etags.c
index bd4d4fcf53a..71f3464661c 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -5773,7 +5773,7 @@ static void
TEX_decode_env (const char *evarname, const char *defenv)
{
const char *env, *p;
- ptrdiff_t len;
+ ptrdiff_t len = 1;
/* Append default string to environment. */
env = getenv (evarname);
@@ -5782,8 +5782,13 @@ TEX_decode_env (const char *evarname, const char *defenv)
else
env = concat (env, defenv, "");
+ /* If the environment variable doesn't start with a colon, increase
+ the length of the token table. */
+ if (*env != ':')
+ len++;
+
/* Allocate a token table */
- for (len = 1, p = env; (p = strchr (p, ':')); )
+ for (p = env; (p = strchr (p, ':')); )
if (*++p)
len++;
TEX_toktab = xnew (len, linebuffer);
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index d17c28be90b..913aa69aacc 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
-/* The arguments given to this program are all the C and Lisp source files
- of GNU Emacs. .elc and .el and .c files are allowed.
+/* The arguments given to this program are all the C files
+ of GNU Emacs. .c files are allowed.
A .o file can also be specified; the .c file it was made from is used.
This helps the makefile pass the correct list of files.
Option -d DIR means change to DIR before looking for files.
@@ -62,13 +62,9 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
Similarly, msdos defines this as sys_chdir, but we're not linking with the
file where that function is defined. */
#undef chdir
-#define IS_SLASH(c) ((c) == '/' || (c) == '\\' || (c) == ':')
-#else /* not DOS_NT */
-#define IS_SLASH(c) ((c) == '/')
#endif /* not DOS_NT */
static void scan_file (char *filename);
-static void scan_lisp_file (const char *filename, const char *mode);
static void scan_c_file (char *filename, const char *mode);
static void scan_c_stream (FILE *infile);
static void start_globals (void);
@@ -238,16 +234,9 @@ put_filename (char *filename)
static void
scan_file (char *filename)
{
- ptrdiff_t len = strlen (filename);
-
if (!generate_globals)
put_filename (filename);
- if (len > 4 && !strcmp (filename + len - 4, ".elc"))
- scan_lisp_file (filename, "rb");
- else if (len > 3 && !strcmp (filename + len - 3, ".el"))
- scan_lisp_file (filename, "r");
- else
- scan_c_file (filename, "r");
+ scan_c_file (filename, "r");
}
static void
@@ -1225,453 +1214,4 @@ scan_c_stream (FILE *infile)
fatal ("read error");
}
-/* Read a file of Lisp code, compiled or interpreted.
- Looks for
- (defun NAME ARGS DOCSTRING ...)
- (defmacro NAME ARGS DOCSTRING ...)
- (defsubst NAME ARGS DOCSTRING ...)
- (autoload (quote NAME) FILE DOCSTRING ...)
- (defvar NAME VALUE DOCSTRING)
- (defconst NAME VALUE DOCSTRING)
- (fset (quote NAME) (make-byte-code ... DOCSTRING ...))
- (fset (quote NAME) #[... DOCSTRING ...])
- (defalias (quote NAME) #[... DOCSTRING ...])
- (custom-declare-variable (quote NAME) VALUE DOCSTRING ...)
- starting in column zero.
- (quote NAME) may appear as 'NAME as well.
-
- We also look for #@LENGTH CONTENTS^_ at the beginning of the line.
- When we find that, we save it for the following defining-form,
- and we use that instead of reading a doc string within that defining-form.
-
- For defvar, defconst, and fset we skip to the docstring with a kludgy
- formatting convention: all docstrings must appear on the same line as the
- initial open-paren (the one in column zero) and must contain a backslash
- and a newline immediately after the initial double-quote. No newlines
- must appear between the beginning of the form and the first double-quote.
- For defun, defmacro, and autoload, we know how to skip over the
- arglist, but the doc string must still have a backslash and newline
- immediately after the double quote.
- The only source files that must follow this convention are preloaded
- uncompiled ones like loaddefs.el; aside from that, it is always the .elc
- file that we should look at, and they are no problem because byte-compiler
- output follows this convention.
- The NAME and DOCSTRING are output.
- NAME is preceded by `F' for a function or `V' for a variable.
- An entry is output only if DOCSTRING has \ newline just after the opening ".
- */
-
-static void
-skip_white (FILE *infile)
-{
- int c;
- do
- c = getc (infile);
- while (c_isspace (c));
-
- ungetc (c, infile);
-}
-
-static void
-read_lisp_symbol (FILE *infile, char *buffer)
-{
- int c;
- char *fillp = buffer;
-
- skip_white (infile);
- while (true)
- {
- c = getc (infile);
- if (c == '\\')
- {
- c = getc (infile);
- if (c < 0)
- return;
- *fillp++ = c;
- }
- else if (c_isspace (c) || c == '(' || c == ')' || c < 0)
- {
- ungetc (c, infile);
- *fillp = 0;
- break;
- }
- else
- *fillp++ = c;
- }
-
- if (! buffer[0])
- fprintf (stderr, "## expected a symbol, got '%c'\n", c);
-
- skip_white (infile);
-}
-
-static bool
-search_lisp_doc_at_eol (FILE *infile)
-{
- int c = 0, c1 = 0, c2 = 0;
-
- /* Skip until the end of line; remember two previous chars. */
- while (c != '\n' && c != '\r' && c != EOF)
- {
- c2 = c1;
- c1 = c;
- c = getc (infile);
- }
-
- /* If two previous characters were " and \,
- this is a doc string. Otherwise, there is none. */
- if (c2 != '"' || c1 != '\\')
- {
-#ifdef DEBUG
- fprintf (stderr, "## non-docstring found\n");
-#endif
- ungetc (c, infile);
- return false;
- }
- return true;
-}
-
-#define DEF_ELISP_FILE(fn) { #fn, sizeof(#fn) - 1 }
-
-static void
-scan_lisp_file (const char *filename, const char *mode)
-{
- FILE *infile;
- int c;
- char *saved_string = 0;
- /* These are the only files that are loaded uncompiled, and must
- follow the conventions of the doc strings expected by this
- function. These conventions are automatically followed by the
- byte compiler when it produces the .elc files. */
- static struct {
- const char *fn;
- int fl;
- } const uncompiled[] = {
- DEF_ELISP_FILE (loaddefs.el),
- DEF_ELISP_FILE (loadup.el),
- DEF_ELISP_FILE (charprop.el),
- DEF_ELISP_FILE (cp51932.el),
- DEF_ELISP_FILE (eucjp-ms.el)
- };
- int i;
- int flen = strlen (filename);
-
- if (generate_globals)
- fatal ("scanning lisp file when -g specified");
- if (flen > 3 && !strcmp (filename + flen - 3, ".el"))
- {
- bool match = false;
- for (i = 0; i < sizeof (uncompiled) / sizeof (uncompiled[0]); i++)
- {
- if (uncompiled[i].fl <= flen
- && !strcmp (filename + flen - uncompiled[i].fl, uncompiled[i].fn)
- && (flen == uncompiled[i].fl
- || IS_SLASH (filename[flen - uncompiled[i].fl - 1])))
- {
- match = true;
- break;
- }
- }
- if (!match)
- fatal ("uncompiled lisp file %s is not supported", filename);
- }
-
- infile = fopen (filename, mode);
- if (infile == NULL)
- {
- perror (filename);
- exit (EXIT_FAILURE);
- }
-
- c = '\n';
- while (!feof (infile))
- {
- char buffer[BUFSIZ];
- char type;
-
- /* If not at end of line, skip till we get to one. */
- if (c != '\n' && c != '\r')
- {
- c = getc (infile);
- continue;
- }
- /* Skip the line break. */
- while (c == '\n' || c == '\r')
- c = getc (infile);
- /* Detect a dynamic doc string and save it for the next expression. */
- if (c == '#')
- {
- c = getc (infile);
- if (c == '@')
- {
- ptrdiff_t length = 0;
- ptrdiff_t i;
-
- /* Read the length. */
- while ((c = getc (infile),
- c_isdigit (c)))
- {
- if (INT_MULTIPLY_WRAPV (length, 10, &length)
- || INT_ADD_WRAPV (length, c - '0', &length)
- || SIZE_MAX < length)
- memory_exhausted ();
- }
-
- if (length <= 1)
- fatal ("invalid dynamic doc string length");
-
- if (c != ' ')
- fatal ("space not found after dynamic doc string length");
-
- /* The next character is a space that is counted in the length
- but not part of the doc string.
- We already read it, so just ignore it. */
- length--;
-
- /* Read in the contents. */
- free (saved_string);
- saved_string = xmalloc (length);
- for (i = 0; i < length; i++)
- saved_string[i] = getc (infile);
- /* The last character is a ^_.
- That is needed in the .elc file
- but it is redundant in DOC. So get rid of it here. */
- saved_string[length - 1] = 0;
- /* Skip the line break. */
- while (c == '\n' || c == '\r')
- c = getc (infile);
- /* Skip the following line. */
- while (! (c == '\n' || c == '\r' || c < 0))
- c = getc (infile);
- }
- continue;
- }
-
- if (c != '(')
- continue;
-
- read_lisp_symbol (infile, buffer);
-
- if (! strcmp (buffer, "defun")
- || ! strcmp (buffer, "defmacro")
- || ! strcmp (buffer, "defsubst"))
- {
- type = 'F';
- read_lisp_symbol (infile, buffer);
-
- /* Skip the arguments: either "nil" or a list in parens. */
-
- c = getc (infile);
- if (c == 'n') /* nil */
- {
- if ((c = getc (infile)) != 'i'
- || (c = getc (infile)) != 'l')
- {
- fprintf (stderr, "## unparsable arglist in %s (%s)\n",
- buffer, filename);
- continue;
- }
- }
- else if (c != '(')
- {
- fprintf (stderr, "## unparsable arglist in %s (%s)\n",
- buffer, filename);
- continue;
- }
- else
- while (! (c == ')' || c < 0))
- c = getc (infile);
- skip_white (infile);
-
- /* If the next three characters aren't `dquote bslash newline'
- then we're not reading a docstring.
- */
- if ((c = getc (infile)) != '"'
- || (c = getc (infile)) != '\\'
- || ((c = getc (infile)) != '\n' && c != '\r'))
- {
-#ifdef DEBUG
- fprintf (stderr, "## non-docstring in %s (%s)\n",
- buffer, filename);
-#endif
- continue;
- }
- }
-
- /* defcustom can only occur in uncompiled Lisp files. */
- else if (! strcmp (buffer, "defvar")
- || ! strcmp (buffer, "defconst")
- || ! strcmp (buffer, "defcustom"))
- {
- type = 'V';
- read_lisp_symbol (infile, buffer);
-
- if (saved_string == 0)
- if (!search_lisp_doc_at_eol (infile))
- continue;
- }
-
- else if (! strcmp (buffer, "custom-declare-variable")
- || ! strcmp (buffer, "defvaralias")
- )
- {
- type = 'V';
-
- c = getc (infile);
- if (c == '\'')
- read_lisp_symbol (infile, buffer);
- else
- {
- if (c != '(')
- {
- fprintf (stderr,
- "## unparsable name in custom-declare-variable in %s\n",
- filename);
- continue;
- }
- read_lisp_symbol (infile, buffer);
- if (strcmp (buffer, "quote"))
- {
- fprintf (stderr,
- "## unparsable name in custom-declare-variable in %s\n",
- filename);
- continue;
- }
- read_lisp_symbol (infile, buffer);
- c = getc (infile);
- if (c != ')')
- {
- fprintf (stderr,
- "## unparsable quoted name in custom-declare-variable in %s\n",
- filename);
- continue;
- }
- }
-
- if (saved_string == 0)
- if (!search_lisp_doc_at_eol (infile))
- continue;
- }
-
- else if (! strcmp (buffer, "fset") || ! strcmp (buffer, "defalias"))
- {
- type = 'F';
-
- c = getc (infile);
- if (c == '\'')
- read_lisp_symbol (infile, buffer);
- else
- {
- if (c != '(')
- {
- fprintf (stderr, "## unparsable name in fset in %s\n",
- filename);
- continue;
- }
- read_lisp_symbol (infile, buffer);
- if (strcmp (buffer, "quote"))
- {
- fprintf (stderr, "## unparsable name in fset in %s\n",
- filename);
- continue;
- }
- read_lisp_symbol (infile, buffer);
- c = getc (infile);
- if (c != ')')
- {
- fprintf (stderr,
- "## unparsable quoted name in fset in %s\n",
- filename);
- continue;
- }
- }
-
- if (saved_string == 0)
- if (!search_lisp_doc_at_eol (infile))
- continue;
- }
-
- else if (! strcmp (buffer, "autoload"))
- {
- type = 'F';
- c = getc (infile);
- if (c == '\'')
- read_lisp_symbol (infile, buffer);
- else
- {
- if (c != '(')
- {
- fprintf (stderr, "## unparsable name in autoload in %s\n",
- filename);
- continue;
- }
- read_lisp_symbol (infile, buffer);
- if (strcmp (buffer, "quote"))
- {
- fprintf (stderr, "## unparsable name in autoload in %s\n",
- filename);
- continue;
- }
- read_lisp_symbol (infile, buffer);
- c = getc (infile);
- if (c != ')')
- {
- fprintf (stderr,
- "## unparsable quoted name in autoload in %s\n",
- filename);
- continue;
- }
- }
- skip_white (infile);
- c = getc (infile);
- if (c != '\"')
- {
- fprintf (stderr, "## autoload of %s unparsable (%s)\n",
- buffer, filename);
- continue;
- }
- read_c_string_or_comment (infile, 0, false, 0);
-
- if (saved_string == 0)
- if (!search_lisp_doc_at_eol (infile))
- continue;
- }
-
-#ifdef DEBUG
- else if (! strcmp (buffer, "if")
- || ! strcmp (buffer, "byte-code"))
- continue;
-#endif
-
- else
- {
-#ifdef DEBUG
- fprintf (stderr, "## unrecognized top-level form, %s (%s)\n",
- buffer, filename);
-#endif
- continue;
- }
-
- /* At this point, we should either use the previous dynamic doc string in
- saved_string or gobble a doc string from the input file.
- In the latter case, the opening quote (and leading backslash-newline)
- have already been read. */
-
- printf ("\037%c%s\n", type, buffer);
- if (saved_string)
- {
- fputs (saved_string, stdout);
- /* Don't use one dynamic doc string twice. */
- free (saved_string);
- saved_string = 0;
- }
- else
- read_c_string_or_comment (infile, 1, false, 0);
- }
- free (saved_string);
- if (ferror (infile) || fclose (infile) != 0)
- fatal ("%s: read error", filename);
-}
-
-
/* make-docfile.c ends here */
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index ccf827cf526..c8bcf742fea 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -20,14 +20,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
-/* Temporary workaround for compilation problems with MinGW64 GCC 11.
- The funky #ifdef's are to avoid warnings about unused macros. */
-#define _GL_ATTRIBUTE_MALLOC
-#define _GL_ATTRIBUTE_DEALLOC_FREE
-#ifdef _GL_ATTRIBUTE_MALLOC
-#endif
-#ifdef _GL_ATTRIBUTE_DEALLOC_FREE
-#endif
+#define DEFER_MS_W32_H
+#include <config.h>
#include <windows.h>
#include <stdlib.h>
@@ -296,9 +290,6 @@ is_exec (const char * name)
stricmp (p, ".cmd") == 0));
}
-/* FIXME? This is in configure.ac now - is this still needed? */
-#define IS_DIRECTORY_SEP(x) ((x) == '/' || (x) == '\\')
-
/* We need stat/fsfat below because nt/inc/sys/stat.h defines struct
stat that is incompatible with the MS run-time libraries. */
int