diff options
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 143 | ||||
| -rw-r--r-- | lib-src/Makefile.in | 13 | ||||
| -rw-r--r-- | lib-src/ebrowse.c | 3 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 225 | ||||
| -rw-r--r-- | lib-src/etags.c | 119 | ||||
| -rw-r--r-- | lib-src/make-docfile.c | 47 | ||||
| -rw-r--r-- | lib-src/makefile.w32-in | 66 | ||||
| -rw-r--r-- | lib-src/movemail.c | 34 | ||||
| -rw-r--r-- | lib-src/ntlib.c | 31 | ||||
| -rw-r--r-- | lib-src/pop.c | 2 | ||||
| -rw-r--r-- | lib-src/update-game-score.c | 2 |
11 files changed, 439 insertions, 246 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 35190fd2a8f..866e76ad24f 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,144 @@ +2012-12-11 Juanma Barranquero <lekktu@gmail.com> + + * makefile.w32-in (SYSWAIT_H): Update dependencies. + +2012-12-10 Eli Zaretskii <eliz@gnu.org> + + * makefile.w32-in (obj): Add w32notify.o. Add missing X and Unix + sources. + +2012-12-02 Kevin Ryde <user42@zip.com.au> + + * etags.c (Lisp_functions): Skip (defvar foo) declarations unless + the --declarations flag is enabled (Bug#5600). + (Lisp_help): Update. + (skip_name): New function. + +2012-12-01 Kevin Ryde <user42@zip.com.au> + + * etags.c (Perl_functions): Support "use constant" (Bug#5055). + +2012-11-27 Paul Eggert <eggert@cs.ucla.edu> + + Assume POSIX 1003.1-1988 or later for errno.h (Bug#12968). + * movemail.c (main): Assume EAGAIN and EBUSY. + +2012-11-23 Paul Eggert <eggert@cs.ucla.edu> + + movemail: treat EACCES etc. failures as permanent + * movemail.c (main): Treat any link failure other than EEXIST as a + permanent failure, not just EPERM. EACCES, for example. + +2012-11-21 Paul Eggert <eggert@cs.ucla.edu> + + Assume POSIX 1003.1-1988 or later for unistd.h (Bug#12945). + * emacsclient.c (getcwd): Remove decl. + (get_current_dir_name): Assume getcwd exists. + * etags.c (HAVE_GETCWD): Remove. + (getcwd): Remove decl. + (NO_LONG_OPTIONS): Remove this. All uses removed. + Emacs always has GNU getopt. + (etags_getcwd): Assume getcwd exists. + * movemail.c (F_OK, X_OK, W_OK, R_OK): Remove. + +2012-11-20 Paul Eggert <eggert@cs.ucla.edu> + + * emacsclient.c (handle_sigcont, handle_sigtstp): Use raise (sig) + rather than kill (getpid (), sig), as it's simpler and safer. + +2012-11-17 Juanma Barranquero <lekktu@gmail.com> + + * makefile.w32-in (SYSWAIT_H): New macro. + ($(BLD)/movemail.$(O)): Update dependencies. + +2012-11-17 Paul Eggert <eggert@cs.ucla.edu> + + Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881). + * movemail.c, update-game-score.c: Assume <fcntl.h> exists. + +2012-10-26 Glenn Morris <rgm@gnu.org> + + * Makefile.in (uninstall): No INSTALLABLES live in archlibdir. + + * Makefile.in (install, uninstall): Transformations should not be + applied to $EXEEXT. + +2012-10-23 Eli Zaretskii <eliz@gnu.org> + + * makefile.w32-in (lisp2): Add cp51932.el and eucjp-ms.el, to + follow src/lisp.mk. + +2012-10-21 Glenn Morris <rgm@gnu.org> + + * make-docfile.c (scan_lisp_file): Add cp51932.el and eucjp-ms.el. + +2012-10-20 Eli Zaretskii <eliz@gnu.org> + + * make-docfile.c (IS_SLASH, DEF_ELISP_FILE): New macros. + (scan_lisp_file): Only pass a .el file if its basename matches a + known file in its entirety. Use IS_SLASH and DEF_ELISP_FILE. + +2012-10-20 Andreas Schwab <schwab@linux-m68k.org> + + * make-docfile.c (scan_lisp_file): Add bounds checking. + +2012-10-20 Eli Zaretskii <eliz@gnu.org> + + Prevent silent omission of doc strings from uncompiled Lisp files. + * make-docfile.c (scan_lisp_file): Barf if called with a .el file + other than one of a small list of supported un-compiled files. + + * makefile.w32-in (lisp1, lisp2): Name .elc files wherever they + exist. (Bug#12395) + +2012-10-17 Eli Zaretskii <eliz@gnu.org> + + * ntlib.c: Include <mbstring.h>, to avoid compiler warning about + _mbspbrk. + +2012-10-08 Eli Zaretskii <eliz@gnu.org> + + * makefile.w32-in (obj): Add cygw32.o. + +2012-10-08 Daniel Colascione <dancol@dancol.org> + + * emacsclient.c: Include windows.h when HAVE_NTGUI. + (alt_display): New variable. We send the display held by this + variable when the primary display is either unsupported or not + present. + (longopts): Allow display everywhere. + (w32_set_user_model_id): Move lower in file, inside HAVE_NTGUI + section. + (decode_options): Use alt_display. Explain why. + (main): Retry connection with alt_display if connection with main + display fails. + +2012-10-01 Fabrice Popineau <fabrice.popineau@gmail.com> + + * make-docfile.c (write_globals): Special-case + Fexit_recursive_edit and Fabort_recursive_edit as well, as + functions that are _Noreturn, to be consistent with + src/keyboard.c. + +2012-09-30 Eli Zaretskii <eliz@gnu.org> + + * ntlib.c (gettimeofday): Copy from src/w32.c. lib/gettime.c + needs this function. + +2012-09-26 Juanma Barranquero <lekktu@gmail.com> + + * makefile.w32-in (obj): Add profiler.o. + +2012-09-17 Glenn Morris <rgm@gnu.org> + + * ebrowse.c (version): + * etags.c (print_version): Use COPYRIGHT. + +2012-09-11 Paul Eggert <eggert@cs.ucla.edu> + + * pop.c (socket_connection) [HAVE_GETADDRINFO]: + Prefer assignment to memcpy when either will do. + 2012-08-31 Andreas Schwab <schwab@linux-m68k.org> * etags.c (consider_token): Always zero-terminate token buffer. @@ -1028,7 +1169,7 @@ (Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes) (Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes) (Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help) - (Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help) + (Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help) (Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help) (Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help) (Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters) diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index c5acca28856..d271bb3a4fa 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -244,20 +244,21 @@ install: $(DESTDIR)${archlibdir} @echo "Installing utilities for users to run." umask 022; ${MKDIR_P} $(DESTDIR)${bindir} for file in ${INSTALLABLES} ; do \ - $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \ + $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \ done for file in ${INSTALLABLE_SCRIPTS} ; do \ $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \ done uninstall: - (cd $(DESTDIR)${bindir}; \ - for file in ${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \ + for file in ${INSTALLABLES}; do \ + rm -f $(DESTDIR)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \ + done + for file in ${INSTALLABLE_SCRIPTS}; do \ rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \ - done) + done if [ -d $(DESTDIR)${archlibdir} ]; then \ - (cd $(DESTDIR)${archlibdir} && \ - rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}) \ + (cd $(DESTDIR)${archlibdir} && rm -f ${UTILITIES} ${SCRIPTS}) \ fi mostlyclean: diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index f8569fe3747..056ed471fde 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c @@ -3516,8 +3516,7 @@ usage (int error) static _Noreturn void version (void) { - /* Makes it easier to update automatically. */ - char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundation, Inc."; + char emacs_copyright[] = COPYRIGHT; printf ("ebrowse %s\n", VERSION); puts (emacs_copyright); diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 07300dbf249..021ac6eb247 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -44,6 +44,10 @@ char *w32_getenv (char *); #else /* !WINDOWSNT */ +# ifdef HAVE_NTGUI +# include <windows.h> +# endif /* HAVE_NTGUI */ + # include "syswait.h" # ifdef HAVE_INET_SOCKETS @@ -84,10 +88,7 @@ char *w32_getenv (char *); -char *getenv (const char *), *getwd (char *); -#ifdef HAVE_GETCWD -char *(getcwd) (char *, size_t); -#endif +char *getenv (const char *); #ifndef VERSION #define VERSION "unspecified" @@ -140,6 +141,9 @@ int current_frame = 1; /* The display on which Emacs should work. --display. */ const char *display = NULL; +/* The alternate display we should try if Emacs does not support display. */ +const char *alt_display = NULL; + /* The parent window ID, if we are opening a frame via XEmbed. */ char *parent_id = NULL; @@ -182,9 +186,7 @@ struct option longopts[] = { "socket-name", required_argument, NULL, 's' }, #endif { "server-file", required_argument, NULL, 'f' }, -#ifndef WINDOWSNT { "display", required_argument, NULL, 'd' }, -#endif { "parent-id", required_argument, NULL, 'p' }, { 0, 0, 0, 0 } }; @@ -218,7 +220,7 @@ get_current_dir_name (void) char *buf; const char *pwd; struct stat dotstat, pwdstat; - /* If PWD is accurate, use it instead of calling getwd. PWD is + /* If PWD is accurate, use it instead of calling getcwd. PWD is sometimes a nicer name, and using it may avoid a fatal error if a parent directory is searchable but not readable. */ if ((pwd = egetenv ("PWD")) != 0 @@ -235,7 +237,6 @@ get_current_dir_name (void) buf = (char *) xmalloc (strlen (pwd) + 1); strcpy (buf, pwd); } -#ifdef HAVE_GETCWD else { size_t buf_size = 1024; @@ -262,20 +263,6 @@ get_current_dir_name (void) } } } -#else - else - { - /* We need MAXPATHLEN here. */ - buf = (char *) xmalloc (MAXPATHLEN + 1); - if (getwd (buf) == NULL) - { - int tmp_errno = errno; - free (buf); - errno = tmp_errno; - return NULL; - } - } -#endif return buf; } #endif @@ -385,32 +372,6 @@ w32_getenv (char *envvar) return NULL; } -void -w32_set_user_model_id (void) -{ - HMODULE shell; - HRESULT (WINAPI * set_user_model) (wchar_t * id); - - /* On Windows 7 and later, we need to set the user model ID - to associate emacsclient launched files with Emacs frames - in the UI. */ - shell = LoadLibrary ("shell32.dll"); - if (shell) - { - set_user_model - = (void *) GetProcAddress (shell, - "SetCurrentProcessExplicitAppUserModelID"); - /* If the function is defined, then we are running on Windows 7 - or newer, and the UI uses this to group related windows - together. Since emacs, runemacs, emacsclient are related, we - want them grouped even though the executables are different, - so we need to set a consistent ID between them. */ - if (set_user_model) - set_user_model (L"GNU.Emacs"); - - FreeLibrary (shell); - } -} int w32_window_app (void) @@ -605,16 +566,29 @@ decode_options (int argc, char **argv) Without the -c option, we used to set `display' to $DISPLAY by default, but this changed the default behavior and is sometimes inconvenient. So we force users to use "--display $DISPLAY" if - they want Emacs to connect to their current display. */ + they want Emacs to connect to their current display. + + Some window systems have a notion of default display not + reflected in the DISPLAY variable. If the user didn't give us an + explicit display, try this platform-specific after trying the + display in DISPLAY (if any). */ if (!current_frame && !tty && !display) { - display = egetenv ("DISPLAY"); -#ifdef NS_IMPL_COCOA - /* Under Cocoa, we don't really use displays the same way as in X, - so provide a dummy. */ - if (!display || strlen (display) == 0) - display = "ns"; + /* Set these here so we use a default_display only when the user + didn't give us an explicit display. */ +#if defined (NS_IMPL_COCOA) + alt_display = "ns"; +#elif defined (HAVE_NTGUI) + alt_display = "w32"; #endif + + display = egetenv ("DISPLAY"); + } + + if (!display) + { + display = alt_display; + alt_display = NULL; } /* A null-string display is invalid. */ @@ -1146,7 +1120,7 @@ handle_sigcont (int signalnum) else { /* We are in the background; cancel the continue. */ - kill (getpid (), SIGSTOP); + raise (SIGSTOP); } signal (signalnum, handle_sigcont); @@ -1173,7 +1147,7 @@ handle_sigtstp (int signalnum) sigprocmask (SIG_BLOCK, NULL, &set); sigdelset (&set, signalnum); signal (signalnum, SIG_DFL); - kill (getpid (), signalnum); + raise (signalnum); sigprocmask (SIG_SETMASK, &set, NULL); /* Let's the above signal through. */ signal (signalnum, handle_sigtstp); @@ -1415,10 +1389,37 @@ set_socket (int no_exit_if_error) exit (EXIT_FAILURE); } -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI FARPROC set_fg; /* Pointer to AllowSetForegroundWindow. */ FARPROC get_wc; /* Pointer to RealGetWindowClassA. */ +void +w32_set_user_model_id (void) +{ + HMODULE shell; + HRESULT (WINAPI * set_user_model) (wchar_t * id); + + /* On Windows 7 and later, we need to set the user model ID + to associate emacsclient launched files with Emacs frames + in the UI. */ + shell = LoadLibrary ("shell32.dll"); + if (shell) + { + set_user_model + = (void *) GetProcAddress (shell, + "SetCurrentProcessExplicitAppUserModelID"); + /* If the function is defined, then we are running on Windows 7 + or newer, and the UI uses this to group related windows + together. Since emacs, runemacs, emacsclient are related, we + want them grouped even though the executables are different, + so we need to set a consistent ID between them. */ + if (set_user_model) + set_user_model (L"GNU.Emacs"); + + FreeLibrary (shell); + } +} + BOOL CALLBACK w32_find_emacs_process (HWND hWnd, LPARAM lParam) { @@ -1467,7 +1468,7 @@ w32_give_focus (void) && (get_wc = GetProcAddress (user32, "RealGetWindowClassA"))) EnumWindows (w32_find_emacs_process, (LPARAM) 0); } -#endif +#endif /* HAVE_NTGUI */ /* Start the emacs daemon and try to connect to it. */ @@ -1537,11 +1538,13 @@ main (int argc, char **argv) main_argv = argv; progname = argv[0]; -#ifdef WINDOWSNT - /* On Windows 7 and later, we need to explicitly associate emacsclient - with emacs so the UI behaves sensibly. */ +#ifdef HAVE_NTGUI + /* On Windows 7 and later, we need to explicitly associate + emacsclient with emacs so the UI behaves sensibly. This + association does no harm if we're not actually connecting to an + Emacs using a window display. */ w32_set_user_model_id (); -#endif +#endif /* HAVE_NTGUI */ /* Process options. */ decode_options (argc, argv); @@ -1571,15 +1574,15 @@ main (int argc, char **argv) cwd = get_current_dir_name (); if (cwd == 0) { - /* getwd puts message in STRING if it fails. */ message (TRUE, "%s: %s\n", progname, "Cannot get current working directory"); fail (); } -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI + if (display && !strcmp (display, "w32")) w32_give_focus (); -#endif +#endif /* HAVE_NTGUI */ /* Send over our environment and current directory. */ if (!current_frame) @@ -1748,46 +1751,56 @@ main (int argc, char **argv) if (end_p != NULL) *end_p++ = '\0'; - if (strprefix ("-emacs-pid ", p)) - { - /* -emacs-pid PID: The process id of the Emacs process. */ - emacs_pid = strtol (p + strlen ("-emacs-pid"), NULL, 10); - } - else if (strprefix ("-window-system-unsupported ", p)) - { - /* -window-system-unsupported: Emacs was compiled without X - support. Try again on the terminal. */ - nowait = 0; - tty = 1; - goto retry; - } - else if (strprefix ("-print ", p)) - { - /* -print STRING: Print STRING on the terminal. */ - str = unquote_argument (p + strlen ("-print ")); - if (needlf) - printf ("\n"); - printf ("%s", str); - needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; - } - else if (strprefix ("-print-nonl ", p)) - { - /* -print-nonl STRING: Print STRING on the terminal. - Used to continue a preceding -print command. */ - str = unquote_argument (p + strlen ("-print-nonl ")); - printf ("%s", str); - needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; - } - else if (strprefix ("-error ", p)) - { - /* -error DESCRIPTION: Signal an error on the terminal. */ - str = unquote_argument (p + strlen ("-error ")); - if (needlf) - printf ("\n"); - fprintf (stderr, "*ERROR*: %s", str); - needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; - exit_status = EXIT_FAILURE; - } + if (strprefix ("-emacs-pid ", p)) + { + /* -emacs-pid PID: The process id of the Emacs process. */ + emacs_pid = strtol (p + strlen ("-emacs-pid"), NULL, 10); + } + else if (strprefix ("-window-system-unsupported ", p)) + { + /* -window-system-unsupported: Emacs was compiled without support + for whatever window system we tried. Try the alternate + display, or, failing that, try the terminal. */ + if (alt_display) + { + display = alt_display; + alt_display = NULL; + } + else + { + nowait = 0; + tty = 1; + } + + goto retry; + } + else if (strprefix ("-print ", p)) + { + /* -print STRING: Print STRING on the terminal. */ + str = unquote_argument (p + strlen ("-print ")); + if (needlf) + printf ("\n"); + printf ("%s", str); + needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; + } + else if (strprefix ("-print-nonl ", p)) + { + /* -print-nonl STRING: Print STRING on the terminal. + Used to continue a preceding -print command. */ + str = unquote_argument (p + strlen ("-print-nonl ")); + printf ("%s", str); + needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; + } + else if (strprefix ("-error ", p)) + { + /* -error DESCRIPTION: Signal an error on the terminal. */ + str = unquote_argument (p + strlen ("-error ")); + if (needlf) + printf ("\n"); + fprintf (stderr, "*ERROR*: %s", str); + needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; + exit_status = EXIT_FAILURE; + } #ifdef SIGSTOP else if (strprefix ("-suspend ", p)) { diff --git a/lib-src/etags.c b/lib-src/etags.c index e65082de534..d393c4d2e4a 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -123,19 +123,9 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; # undef HAVE_NTGUI # undef DOS_NT # define DOS_NT -# ifndef HAVE_GETCWD -# define HAVE_GETCWD -# endif /* undef HAVE_GETCWD */ -#else /* not WINDOWSNT */ -#endif /* !WINDOWSNT */ +#endif /* WINDOWSNT */ #include <unistd.h> -#ifndef HAVE_UNISTD_H -# if defined (HAVE_GETCWD) && !defined (WINDOWSNT) - extern char *getcwd (char *buf, size_t size); -# endif -#endif /* HAVE_UNISTD_H */ - #include <stdarg.h> #include <stdlib.h> #include <string.h> @@ -152,16 +142,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; # define assert(x) ((void) 0) #endif -#ifdef NO_LONG_OPTIONS /* define this if you don't have GNU getopt */ -# define NO_LONG_OPTIONS TRUE -# define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr) - extern char *optarg; - extern int optind, opterr; -#else -# define NO_LONG_OPTIONS FALSE -# include <getopt.h> -#endif /* NO_LONG_OPTIONS */ - +#include <getopt.h> #include <regex.h> /* Define CTAGS to make the program "ctags" compatible with the usual one. @@ -372,6 +353,7 @@ static void put_entries (node *); static char *concat (const char *, const char *, const char *); static char *skip_spaces (char *); static char *skip_non_spaces (char *); +static char *skip_name (char *); static char *savenstr (const char *, int); static char *savestr (const char *); static char *etags_strchr (const char *, int); @@ -638,7 +620,8 @@ static const char Lisp_help [] = "In Lisp code, any function defined with `defun', any variable\n\ defined with `defvar' or `defconst', and in general the first\n\ argument of any expression that starts with `(def' in column zero\n\ -is a tag."; +is a tag.\n\ +The `--declarations' option tags \"(defvar foo)\" constructs too."; static const char *Lua_suffixes [] = { "lua", "LUA", NULL }; @@ -836,8 +819,7 @@ etags --help --lang=ada."); static void print_version (void) { - /* Makes it easier to update automatically. */ - char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundation, Inc."; + char emacs_copyright[] = COPYRIGHT; printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION); puts (emacs_copyright); @@ -870,11 +852,7 @@ print_help (argument *argbuffer) printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ \n\ These are the options accepted by %s.\n", progname, progname); - if (NO_LONG_OPTIONS) - puts ("WARNING: long option names do not work with this executable,\n\ -as it is not linked with GNU getopt."); - else - puts ("You may use unambiguous abbreviations for the long option names."); + puts ("You may use unambiguous abbreviations for the long option names."); puts (" A - as file name means read names from stdin (one per line).\n\ Absolute names are stored in the output file as they are.\n\ Relative ones are stored relative to the output file's directory.\n"); @@ -1066,9 +1044,9 @@ main (int argc, char **argv) /* When the optstring begins with a '-' getopt_long does not rearrange the non-options arguments to be at the end, but leaves them alone. */ - optstring = concat (NO_LONG_OPTIONS ? "" : "-", - "ac:Cf:Il:o:r:RSVhH", - (CTAGS) ? "BxdtTuvw" : "Di:"); + optstring = concat ("-ac:Cf:Il:o:r:RSVhH", + (CTAGS) ? "BxdtTuvw" : "Di:", + ""); while ((opt = getopt_long (argc, argv, optstring, longopts, NULL)) != EOF) switch (opt) @@ -4293,6 +4271,7 @@ Asm_labels (FILE *inf) /* * Perl support * Perl sub names: /^sub[ \t\n]+[^ \t\n{]+/ + * /^use constant[ \t\n]+[^ \t\n{=,;]+/ * Perl variable names: /^(my|local).../ * Original code by Bart Robinson <lomew@cs.utah.edu> (1995) * Additions by Michael Ernst <mernst@alum.mit.edu> (1997) @@ -4315,9 +4294,10 @@ Perl_functions (FILE *inf) } else if (LOOKING_AT (cp, "sub")) { - char *pos; - char *sp = cp; + char *pos, *sp; + subr: + sp = cp; while (!notinname (*cp)) cp++; if (cp == sp) @@ -4340,8 +4320,21 @@ Perl_functions (FILE *inf) lb.buffer, cp - lb.buffer + 1, lineno, linecharno); free (name); } + } + else if (LOOKING_AT (cp, "use constant") + || LOOKING_AT (cp, "use constant::defer")) + { + /* For hash style multi-constant like + use constant { FOO => 123, + BAR => 456 }; + only the first FOO is picked up. Parsing across the value + expressions would be difficult in general, due to possible nested + hashes, here-documents, etc. */ + if (*cp == '{') + cp = skip_spaces (cp+1); + goto subr; } - else if (globals) /* only if we are tagging global vars */ + else if (globals) /* only if we are tagging global vars */ { /* Skip a qualifier, if any. */ bool qual = LOOKING_AT (cp, "my") || LOOKING_AT (cp, "local"); @@ -4756,6 +4749,19 @@ Lisp_functions (FILE *inf) if (dbp[0] != '(') continue; + /* "(defvar foo)" is a declaration rather than a definition. */ + if (! declarations) + { + char *p = dbp + 1; + if (LOOKING_AT (p, "defvar")) + { + p = skip_name (p); /* past var name */ + p = skip_spaces (p); + if (*p == ')') + continue; + } + } + if (strneq (dbp+1, "def", 3) || strneq (dbp+1, "DEF", 3)) { dbp = skip_non_spaces (dbp); @@ -6316,6 +6322,16 @@ skip_non_spaces (char *cp) return cp; } +/* Skip any chars in the "name" class.*/ +static char * +skip_name (char *cp) +{ + /* '\0' is a notinname() so loop stops there too */ + while (! notinname (*cp)) + cp++; + return cp; +} + /* Print error message and exit. */ void fatal (const char *s1, const char *s2) @@ -6334,8 +6350,8 @@ pfatal (const char *s1) static void suggest_asking_for_help (void) { - fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", - progname, NO_LONG_OPTIONS ? "-h" : "--help"); + fprintf (stderr, "\tTry `%s --help' for a complete list of options.\n", + progname); exit (EXIT_FAILURE); } @@ -6373,7 +6389,6 @@ concat (const char *s1, const char *s2, const char *s3) static char * etags_getcwd (void) { -#ifdef HAVE_GETCWD int bufsize = 200; char *path = xnew (bufsize, char); @@ -6388,34 +6403,6 @@ etags_getcwd (void) canonicalize_filename (path); return path; - -#else /* not HAVE_GETCWD */ -#if MSDOS - - char *p, path[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */ - - getwd (path); - - for (p = path; *p != '\0'; p++) - if (*p == '\\') - *p = '/'; - else - *p = lowcase (*p); - - return strdup (path); -#else /* not MSDOS */ - linebuffer path; - FILE *pipe; - - linebuffer_init (&path); - pipe = (FILE *) popen ("pwd 2>/dev/null", "r"); - if (pipe == NULL || readline_internal (&path, pipe) == 0) - pfatal ("pwd"); - pclose (pipe); - - return path.buffer; -#endif /* not MSDOS */ -#endif /* not HAVE_GETCWD */ } /* Return a newly allocated string containing the file name of FILE diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 2654387fb37..68e7029ee85 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -58,9 +58,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #undef chdir #define READ_TEXT "rt" #define READ_BINARY "rb" +#define IS_SLASH(c) ((c) == '/' || (c) == '\\' || (c) == ':') #else /* not DOS_NT */ #define READ_TEXT "r" #define READ_BINARY "r" +#define IS_SLASH(c) ((c) == '/') #endif /* not DOS_NT */ static int scan_file (char *filename); @@ -659,7 +661,9 @@ write_globals (void) special hacks. */ if (strcmp (globals[i].name, "Fthrow") == 0 || strcmp (globals[i].name, "Ftop_level") == 0 - || strcmp (globals[i].name, "Fkill_emacs") == 0) + || strcmp (globals[i].name, "Fkill_emacs") == 0 + || strcmp (globals[i].name, "Fexit_recursive_edit") == 0 + || strcmp (globals[i].name, "Fabort_recursive_edit") == 0) fprintf (outfile, "_Noreturn "); fprintf (outfile, "EXFUN (%s, ", globals[i].name); if (globals[i].value == -1) @@ -1023,9 +1027,9 @@ scan_c_file (char *filename, const char *mode) 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 and bindings.el; aside - from that, it is always the .elc file that we look at, and they are no - problem because byte-compiler output follows this convention. + 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 ". @@ -1096,15 +1100,50 @@ search_lisp_doc_at_eol (FILE *infile) return 1; } +#define DEF_ELISP_FILE(fn) { #fn, sizeof(#fn) - 1 } + static int scan_lisp_file (const char *filename, const char *mode) { FILE *infile; register 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; + size_t 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, match; + size_t flen = strlen (filename); if (generate_globals) fatal ("scanning lisp file when -g specified", 0); + if (flen > 3 && !strcmp (filename + flen - 3, ".el")) + { + for (i = 0, match = 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 = 1; + break; + } + } + if (!match) + fatal ("uncompiled lisp file %s is not supported", filename); + } infile = fopen (filename, mode); if (infile == NULL) diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in index 64974b88b6f..24be44e22f2 100644 --- a/lib-src/makefile.w32-in +++ b/lib-src/makefile.w32-in @@ -123,10 +123,13 @@ $(BLD)/profile.exe: $(PROFILEOBJS) # obj = dosfns.o msdos.o \ xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ - fontset.o menu.o \ - w32.o w32console.o w32fns.o w32heap.o w32inevt.o \ + fontset.o menu.o dbusbind.o cygw32.o \ + nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \ + w32.o w32console.o w32fns.o w32heap.o w32inevt.o w32notify.o \ w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \ - font.o w32font.o w32uniscribe.o \ + w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \ + xsettings.o xgselect.o termcap.o \ + font.o w32font.o w32uniscribe.o w32notify.o \ dispnew.o frame.o scroll.o xdisp.o window.o bidi.o \ charset.o coding.o category.o ccl.o character.o chartab.o \ cm.o term.o terminal.o xfaces.o \ @@ -140,7 +143,7 @@ obj = dosfns.o msdos.o \ process.o callproc.o unexw32.o \ region-cache.o sound.o atimer.o \ doprnt.o intervals.o textprop.o composite.o \ - gnutls.o xml.o + gnutls.o xml.o profiler.o # # These are the lisp files that are loaded up in loadup.el @@ -209,38 +212,40 @@ lisp1= \ $(lispsource)emacs-lisp/map-ynp.elc \ $(lispsource)menu-bar.elc \ $(lispsource)international/mule.elc \ - $(lispsource)international/mule-conf.el \ + $(lispsource)international/mule-conf.elc \ $(lispsource)international/mule-cmds.elc \ $(lispsource)international/characters.elc \ $(lispsource)international/charprop.el \ $(lispsource)case-table.elc lisp2 = \ - $(lispsource)language/chinese.el \ - $(lispsource)language/cyrillic.el \ - $(lispsource)language/indian.el \ - $(lispsource)language/sinhala.el \ - $(lispsource)language/english.el \ + $(lispsource)language/chinese.elc \ + $(lispsource)language/cyrillic.elc \ + $(lispsource)language/indian.elc \ + $(lispsource)language/sinhala.elc \ + $(lispsource)language/english.elc \ $(lispsource)language/ethiopic.elc \ $(lispsource)language/european.elc \ - $(lispsource)language/czech.el \ - $(lispsource)language/slovak.el \ - $(lispsource)language/romanian.el \ - $(lispsource)language/greek.el \ + $(lispsource)language/czech.elc \ + $(lispsource)language/slovak.elc \ + $(lispsource)language/romanian.elc \ + $(lispsource)language/greek.elc \ $(lispsource)language/hebrew.elc \ - $(lispsource)language/japanese.el \ - $(lispsource)language/korean.el \ - $(lispsource)language/lao.el \ - $(lispsource)language/cham.el \ - $(lispsource)language/tai-viet.el \ - $(lispsource)language/thai.el \ + $(lispsource)language/japanese.elc \ + $(lispsource)international/cp51932.el \ + $(lispsource)international/eucjp-ms.el \ + $(lispsource)language/korean.elc \ + $(lispsource)language/lao.elc \ + $(lispsource)language/cham.elc \ + $(lispsource)language/tai-viet.elc \ + $(lispsource)language/thai.elc \ $(lispsource)language/tibetan.elc \ - $(lispsource)language/vietnamese.el \ - $(lispsource)language/misc-lang.el \ - $(lispsource)language/utf-8-lang.el \ - $(lispsource)language/georgian.el \ - $(lispsource)language/khmer.el \ - $(lispsource)language/burmese.el \ + $(lispsource)language/vietnamese.elc \ + $(lispsource)language/misc-lang.elc \ + $(lispsource)language/utf-8-lang.elc \ + $(lispsource)language/georgian.elc \ + $(lispsource)language/khmer.elc \ + $(lispsource)language/burmese.elc \ $(lispsource)register.elc \ $(lispsource)replace.elc \ $(lispsource)simple.elc \ @@ -266,7 +271,7 @@ lisp2 = \ $(WINDOW_SUPPORT) \ $(lispsource)widget.elc \ $(lispsource)window.elc \ - $(lispsource)version.el + $(lispsource)version.elc # This is needed the first time we build the tree, since temacs.exe # does not exist yet, and the DOC rule needs it to rebuild DOC whenever @@ -372,6 +377,9 @@ NTLIB_H = $(LIB_SRC)/ntlib.h \ SYSTIME_H = $(SRC)/systime.h \ $(NT_INC)/sys/time.h \ $(GNU_LIB)/timespec.h +SYSWAIT_H = $(SRC)/syswait.h \ + $(NT_INC)/stdbool.h \ + $(NT_INC)/sys/wait.h $(BLD)/ctags.$(O) : \ $(LIB_SRC)/ctags.c \ @@ -417,14 +425,14 @@ $(BLD)/make-docfile.$(O) : \ $(BLD)/movemail.$(O) : \ $(LIB_SRC)/movemail.c \ $(LIB_SRC)/pop.h \ - $(SRC)/syswait.h \ $(NT_INC)/pwd.h \ $(NT_INC)/sys/file.h \ $(NT_INC)/sys/stat.h \ $(NT_INC)/unistd.h \ $(GNU_LIB)/getopt.h \ $(CONFIG_H) \ - $(NTLIB_H) + $(NTLIB_H) \ + $(SYSWAIT_H) $(BLD)/ntlib.$(O) : \ $(LIB_SRC)/ntlib.c \ diff --git a/lib-src/movemail.c b/lib-src/movemail.c index 32d32e69abf..f2b2484c8e3 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -65,9 +65,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <getopt.h> #include <unistd.h> -#ifdef HAVE_FCNTL_H #include <fcntl.h> -#endif #include <string.h> #include "syswait.h" #ifdef MAIL_USE_POP @@ -98,13 +96,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <fcntl.h> #endif /* WINDOWSNT */ -#ifndef F_OK -#define F_OK 0 -#define X_OK 1 -#define W_OK 2 -#define R_OK 4 -#endif - #ifdef WINDOWSNT #include <sys/locking.h> #endif @@ -337,11 +328,8 @@ main (int argc, char **argv) tem = link (tempname, lockname); -#ifdef EPERM - if (tem < 0 && errno == EPERM) - fatal ("Unable to create hard link between %s and %s", - tempname, lockname); -#endif + if (tem < 0 && errno != EEXIST) + pfatal_with_name (lockname); unlink (tempname); if (tem >= 0) @@ -442,22 +430,10 @@ main (int argc, char **argv) for certain failure codes. */ if (status < 0) { - if (++lockcount <= 5) + if (++lockcount <= 5 && (errno == EAGAIN || errno == EBUSY)) { -#ifdef EAGAIN - if (errno == EAGAIN) - { - sleep (1); - goto retry_lock; - } -#endif -#ifdef EBUSY - if (errno == EBUSY) - { - sleep (1); - goto retry_lock; - } -#endif + sleep (1); + goto retry_lock; } pfatal_with_name (inname); diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c index 2cc791fb56a..4e125eb6d73 100644 --- a/lib-src/ntlib.c +++ b/lib-src/ntlib.c @@ -29,9 +29,17 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <sys/stat.h> #include <errno.h> #include <ctype.h> +#include <sys/timeb.h> +#include <mbstring.h> #include "ntlib.h" +struct timezone +{ + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + #define MAXPATHLEN _MAX_PATH /* Emulate sleep...we could have done this with a define, but that @@ -202,6 +210,29 @@ getpass (const char * prompt) return NULL; } +/* This is needed because lib/gettime.c calls gettimeofday, which MSVC + doesn't have. Copied from w32.c. */ +void +gettimeofday (struct timeval *tv, struct timezone *tz) +{ + struct _timeb tb; + _ftime (&tb); + + tv->tv_sec = tb.time; + tv->tv_usec = tb.millitm * 1000L; + /* Implementation note: _ftime sometimes doesn't update the dstflag + according to the new timezone when the system timezone is + changed. We could fix that by using GetSystemTime and + GetTimeZoneInformation, but that doesn't seem necessary, since + Emacs always calls gettimeofday with the 2nd argument NULL (see + current_emacs_time). */ + if (tz) + { + tz->tz_minuteswest = tb.timezone; /* minutes west of Greenwich */ + tz->tz_dsttime = tb.dstflag; /* type of dst correction */ + } +} + int fchown (int fd, unsigned uid, unsigned gid) { diff --git a/lib-src/pop.c b/lib-src/pop.c index 74054e0e1b1..bfbcb8c9466 100644 --- a/lib-src/pop.c +++ b/lib-src/pop.c @@ -1083,7 +1083,7 @@ socket_connection (char *host, int flags) if (it->ai_addrlen == sizeof (addr)) { struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr; - memcpy (&addr.sin_addr, &in_a->sin_addr, sizeof (addr.sin_addr)); + addr.sin_addr = in_a->sin_addr; if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr))) break; } diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index 40397536fad..59cab61aa29 100644 --- a/lib-src/update-game-score.c +++ b/lib-src/update-game-score.c @@ -42,9 +42,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <time.h> #include <pwd.h> #include <ctype.h> -#ifdef HAVE_FCNTL_H #include <fcntl.h> -#endif #include <sys/stat.h> #include <getopt.h> |
