commit 850bcb1e5850eeea9ab04bdca33e2df10d7ea7ce (HEAD, refs/remotes/origin/master) Author: Stefan Monnier Date: Mon May 23 20:25:28 2016 -0400 * lisp/progmodes/cc-mode.el: Add minor comments (c-change-expand-fl-region): Mark args as unused. diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 6a78992..de903b8 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -71,6 +71,19 @@ ;; ;; http://lists.sourceforge.net/mailman/listinfo/cc-mode-announce +;; Externally maintained major modes which use CC-mode's engine include: +;; - cuda-mode +;; - csharp-mode (https://github.com/josteink/csharp-mode) +;; - haxe-mode +;; - d-mode +;; - dart-mode +;; - cc-php-js-cs.el +;; - php-mode +;; - yang-mode +;; - math-mode (mathematica) +;; - unrealscript-mode +;; - groovy-mode + ;;; Code: ;; For Emacs < 22.2. @@ -1234,7 +1247,7 @@ Note that the style variables are always made local to the buffer." (backward-char)) ; back over (, [, <. (and (/= new-pos pos) new-pos))) -(defun c-change-expand-fl-region (beg end old-len) +(defun c-change-expand-fl-region (_beg _end _old-len) ;; Expand the region (c-new-BEG c-new-END) to an after-change font-lock ;; region. This will usually be the smallest sequence of whole lines ;; containing `c-new-BEG' and `c-new-END', but if `c-new-BEG' is in a @@ -1770,9 +1783,9 @@ Key bindings: (defvar awk-mode-map (let ((map (c-make-inherited-keymap))) ;; Add bindings which are only useful for awk. - (define-key map "#" 'self-insert-command) - (define-key map "/" 'self-insert-command) - (define-key map "*" 'self-insert-command) + (define-key map "#" 'self-insert-command);Overrides electric parent binding. + (define-key map "/" 'self-insert-command);Overrides electric parent binding. + (define-key map "*" 'self-insert-command);Overrides electric parent binding. (define-key map "\C-c\C-n" 'undefined) ; #if doesn't exist in awk. (define-key map "\C-c\C-p" 'undefined) (define-key map "\C-c\C-u" 'undefined) commit 276a6545ad48d6c2ffcf17929f896e6a964d993f Author: Stefan Monnier Date: Mon May 23 20:09:33 2016 -0400 * lisp/url/url-http.el: Use lexical-binding (url-http-simple-after-change-function): Use buffer-size rather than `nd'. (url-http-wait-for-headers-change-function): Remove unused var `content-length'. (url-http): Remove unused vars `host' and `port'. diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 88a11f3..306b36a 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -1,4 +1,4 @@ -;;; url-http.el --- HTTP retrieval routines +;;; url-http.el --- HTTP retrieval routines -*- lexical-binding:t -*- ;; Copyright (C) 1999, 2001, 2004-2016 Free Software Foundation, Inc. @@ -931,7 +931,7 @@ should be shown to the user." ;; ) ;; These unfortunately cannot be macros... please ignore them! -(defun url-http-idle-sentinel (proc why) +(defun url-http-idle-sentinel (proc _why) "Remove (now defunct) process PROC from the list of open connections." (maphash (lambda (key val) (if (memq proc val) @@ -969,12 +969,12 @@ should be shown to the user." ((url-http-parse-headers) (url-http-activate-callback)))))) -(defun url-http-simple-after-change-function (st nd length) +(defun url-http-simple-after-change-function (_st _nd _length) ;; Function used when we do NOT know how long the document is going to be ;; Just _very_ simple 'downloaded %d' type of info. - (url-lazy-message "Reading %s..." (file-size-human-readable nd))) + (url-lazy-message "Reading %s..." (file-size-human-readable (buffer-size)))) -(defun url-http-content-length-after-change-function (st nd length) +(defun url-http-content-length-after-change-function (_st nd _length) "Function used when we DO know how long the document is going to be. More sophisticated percentage downloaded, etc. Also does minimal parsing of HTTP headers and will actually cause @@ -1093,7 +1093,7 @@ the end of the document." (if (url-http-parse-headers) (url-http-activate-callback)))))))))) -(defun url-http-wait-for-headers-change-function (st nd length) +(defun url-http-wait-for-headers-change-function (_st nd _length) ;; This will wait for the headers to arrive and then splice in the ;; next appropriate after-change-function, etc. (url-http-debug "url-http-wait-for-headers-change-function (%s)" @@ -1101,7 +1101,8 @@ the end of the document." (let ((end-of-headers nil) (old-http nil) (process-buffer (current-buffer)) - (content-length nil)) + ;; (content-length nil) + ) (when (not (bobp)) (goto-char (point-min)) (if (and (looking-at ".*\n") ; have one line at least @@ -1242,8 +1243,8 @@ overriding the value of `url-gateway-method'. The return value of this function is the retrieval buffer." (cl-check-type url vector "Need a pre-parsed URL.") - (let* ((host (url-host (or url-using-proxy url))) - (port (url-port (or url-using-proxy url))) + (let* (;; (host (url-host (or url-using-proxy url))) + ;; (port (url-port (or url-using-proxy url))) (nsm-noninteractive (or url-request-noninteractive (and (boundp 'url-http-noninteractive) url-http-noninteractive))) @@ -1337,7 +1338,7 @@ The return value of this function is the retrieval buffer." url-https-default-port) (url-host url-current-object)))) -(defun url-https-proxy-after-change-function (st nd length) +(defun url-https-proxy-after-change-function (_st _nd _length) (let* ((process-buffer (current-buffer)) (proc (get-buffer-process process-buffer))) (goto-char (point-min)) @@ -1461,7 +1462,7 @@ The return value of this function is the retrieval buffer." (defalias 'url-http-file-readable-p 'url-http-file-exists-p) -(defun url-http-head-file-attributes (url &optional id-format) +(defun url-http-head-file-attributes (url &optional _id-format) (let ((buffer (url-http-head url))) (when buffer (prog1 @@ -1476,7 +1477,7 @@ The return value of this function is the retrieval buffer." nil nil nil) ;whether gid would change ; inode ; device. (kill-buffer buffer))))) -(declare-function url-dav-file-attributes "url-dav" (url &optional id-format)) +(declare-function url-dav-file-attributes "url-dav" (url &optional _id-format)) (defun url-http-file-attributes (url &optional id-format) (if (url-dav-supported-p url) commit 41214582455a6ad08098df14a5febd769622aab4 Author: Stefan Monnier Date: Mon May 23 19:57:46 2016 -0400 * lisp/widget.el (define-widget): Use `declare' (which does work now). (widget-plist-member): Mark as obsolete. diff --git a/lisp/widget.el b/lisp/widget.el index 2db645a..1574fb2 100644 --- a/lisp/widget.el +++ b/lisp/widget.el @@ -68,7 +68,6 @@ ;; :button-face-get :button-face :value-face :keymap :entry-from ;; :entry-to :help-echo :documentation-property :tab-order) -(put 'define-widget 'doc-string-elt 3) ;`declare' doesn't work in functions. (defun define-widget (name class doc &rest args) "Define a new widget type named NAME from CLASS. @@ -80,9 +79,10 @@ create identical widgets: * (widget-create NAME) -* (apply \\='widget-create CLASS ARGS) +* (apply #\\='widget-create CLASS ARGS) The third argument DOC is a documentation string for the widget." + (declare (doc-string 3)) ;; (unless (or (null doc) (stringp doc)) (error "widget documentation must be nil or a string.")) @@ -91,7 +91,7 @@ The third argument DOC is a documentation string for the widget." name) ;; This is used by external widget code (in W3, at least). -(defalias 'widget-plist-member 'plist-member) +(define-obsolete-function-alias 'widget-plist-member #'plist-member "26.1") ;;; The End. commit 5e17f509116e88998be5ac664907aa80ea39710a Author: Stefan Monnier Date: Mon May 23 15:12:24 2016 -0400 * lisp/image.el: Use lexical-binding (image-scaling-factor, imagemagick-types-inhibit) (imagemagick-enabled-types): Remove redundant :group. (image--get-image): Apply de-Morgan and use car-safe. (image-compute-scaling-factor): Use the argument. diff --git a/lisp/image.el b/lisp/image.el index 296d430..ad21936 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -1,4 +1,4 @@ -;;; image.el --- image API +;;; image.el --- image API -*- lexical-binding:t -*- ;; Copyright (C) 1998-2016 Free Software Foundation, Inc. @@ -123,7 +123,7 @@ value is used as a list of directories to search. Subdirectories are not automatically included in the search." :type '(repeat (choice directory variable)) - :initialize 'custom-initialize-delay) + :initialize #'custom-initialize-delay) (defcustom image-scaling-factor 'auto "When displaying images, apply this scaling factor before displaying. @@ -135,7 +135,6 @@ size), or the symbol `auto', which will compute a scaling factor based on the font pixel size." :type '(choice number (const :tag "Automatically compute" auto)) - :group 'image :version "25.2") ;; Map put into text properties on images. @@ -460,9 +459,8 @@ If VALUE is nil, PROPERTY is removed from IMAGE." (defun image-compute-scaling-factor (scaling) (cond - ((numberp image-scaling-factor) - image-scaling-factor) - ((eq image-scaling-factor 'auto) + ((numberp scaling) scaling) + ((eq scaling 'auto) (let ((width (/ (float (window-width nil t)) (window-width)))) ;; If we assume that a typical character is 10 pixels in width, ;; then we should scale all images according to how wide they @@ -471,7 +469,7 @@ If VALUE is nil, PROPERTY is removed from IMAGE." 1 (/ (float width) 10)))) (t - (error "Invalid scaling factor %s" image-scaling-factor)))) + (error "Invalid scaling factor %s" scaling)))) ;;;###autoload (defun put-image (image pos &optional string area) @@ -728,7 +726,7 @@ number, play until that number of seconds has elapsed." (if (setq timer (image-animate-timer image)) (cancel-timer timer)) (plist-put (cdr image) :animate-buffer (current-buffer)) - (run-with-timer 0.2 nil 'image-animate-timeout + (run-with-timer 0.2 nil #'image-animate-timeout image (or index 0) (car animation) 0 limit (+ (float-time) 0.2))))) @@ -739,7 +737,7 @@ number, play until that number of seconds has elapsed." (while tail (setq timer (car tail) tail (cdr tail)) - (if (and (eq (timer--function timer) 'image-animate-timeout) + (if (and (eq (timer--function timer) #'image-animate-timeout) (eq (car-safe (timer--args timer)) image)) (setq tail nil) (setq timer nil))) @@ -819,7 +817,7 @@ for the animation speed. A negative value means to animate in reverse." (if (numberp limit) (setq done (>= time-elapsed limit))) (unless done - (run-with-timer delay nil 'image-animate-timeout + (run-with-timer delay nil #'image-animate-timeout image n count time-elapsed limit (+ (float-time) delay)))))) @@ -907,12 +905,11 @@ has no effect." :type '(choice (const :tag "Support all ImageMagick types" nil) (const :tag "Disable all ImageMagick types" t) (repeat symbol)) - :initialize 'custom-initialize-default + :initialize #'custom-initialize-default :set (lambda (symbol value) (set-default symbol value) (imagemagick-register-types)) - :version "24.3" - :group 'image) + :version "24.3") (defcustom imagemagick-enabled-types '(3FR ART ARW AVS BMP BMP2 BMP3 CAL CALS CMYK CMYKA CR2 CRW @@ -945,12 +942,11 @@ has no effect." (repeat :tag "List of types" (choice (symbol :tag "type") (regexp :tag "regexp")))) - :initialize 'custom-initialize-default + :initialize #'custom-initialize-default :set (lambda (symbol value) (set-default symbol value) (imagemagick-register-types)) - :version "24.3" - :group 'image) + :version "24.3") (imagemagick-register-types) @@ -974,8 +970,7 @@ default is 20%." (defun image--get-image () (let ((image (get-text-property (point) 'display))) - (when (or (not (consp image)) - (not (eq (car image) 'image))) + (unless (eq (car-safe image) 'image) (error "No image under point")) image)) commit d5f42ab6f06e1d468c6b92f2c1ef7b4d5f97ff84 Author: Glenn Morris Date: Mon May 23 12:51:44 2016 -0400 * lisp/image.el (image--get-image): Remove nonsensical code. ; 1) put-image does not add a display property to its overlay ; 2) it does add a display text property ; 3) an overlay is not a cons whose car is 'image diff --git a/lisp/image.el b/lisp/image.el index e855d5e..296d430 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -973,13 +973,7 @@ default is 20%." 0.8))) (defun image--get-image () - (let ((image (or (get-text-property (point) 'display) - ;; `put-image' uses overlays, so find an image in - ;; the overlays. - (catch 'found - (dolist (o (overlays-at (point))) - (if (overlay-get o 'display) - (throw 'found o))))))) + (let ((image (get-text-property (point) 'display))) (when (or (not (consp image)) (not (eq (car image) 'image))) (error "No image under point")) commit 9c969e1f848e65b24e06d3919cde9a7ae668bfb8 Author: Glenn Morris Date: Mon May 23 12:48:19 2016 -0400 * lisp/image.el (image--get-image): Avoid requiring a library for one trivial operation. diff --git a/lisp/image.el b/lisp/image.el index e06cb6f..e855d5e 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -973,13 +973,13 @@ default is 20%." 0.8))) (defun image--get-image () - (require 'seq) (let ((image (or (get-text-property (point) 'display) ;; `put-image' uses overlays, so find an image in ;; the overlays. - (seq-find (lambda (overlay) - (overlay-get overlay 'display)) - (overlays-at (point)))))) + (catch 'found + (dolist (o (overlays-at (point))) + (if (overlay-get o 'display) + (throw 'found o))))))) (when (or (not (consp image)) (not (eq (car image) 'image))) (error "No image under point")) commit 918ef71538fd43049496e4370eba63e3096a4933 Author: Paul Eggert Date: Mon May 23 08:56:42 2016 -0700 Don’t use only last protocol from getaddrinfo Problem reported by Ken Brown in: http://lists.gnu.org/archive/html/emacs-devel/2016-05/msg00483.html * src/process.c (conv_addrinfo_to_lisp): New function. (connect_network_socket): Arg is now a list of addrinfos, not merely IP addresses. All uses changed. Use protocol from each addrinfo. (Fmake_network_process): Accumulate protocols into addrinfos rather than just using the last one found. (check_for_dns): Accumulate protocols here, too. * src/process.h (struct Lisp_Process): Remove ai_protocol; no longer needed. diff --git a/src/process.c b/src/process.c index d4bd19a..9ca3e594 100644 --- a/src/process.c +++ b/src/process.c @@ -2343,6 +2343,16 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, ptrdiff_t len) return address; } +/* Convert an internal struct addrinfo to a Lisp object. */ + +static Lisp_Object +conv_addrinfo_to_lisp (struct addrinfo *res) +{ + Lisp_Object protocol = make_number (res->ai_protocol); + eassert (XINT (protocol) == res->ai_protocol); + return Fcons (protocol, conv_sockaddr_to_lisp (res->ai_addr, res->ai_addrlen)); +} + /* Get family and required size for sockaddr structure to hold ADDRESS. */ @@ -3097,14 +3107,13 @@ finish_after_tls_connection (Lisp_Object proc) #endif static void -connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses, +connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, Lisp_Object use_external_socket_p) { ptrdiff_t count = SPECPDL_INDEX (); ptrdiff_t count1; int s = -1, outch, inch; int xerrno = 0; - Lisp_Object ip_address; int family; struct sockaddr *sa = NULL; int ret; @@ -3126,10 +3135,12 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses, count1 = SPECPDL_INDEX (); s = -1; - while (!NILP (ip_addresses)) + while (!NILP (addrinfos)) { - ip_address = XCAR (ip_addresses); - ip_addresses = XCDR (ip_addresses); + Lisp_Object addrinfo = XCAR (addrinfos); + addrinfos = XCDR (addrinfos); + int protocol = XINT (XCAR (addrinfo)); + Lisp_Object ip_address = XCDR (addrinfo); #ifdef WINDOWSNT retry_connect: @@ -3147,7 +3158,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses, int socktype = p->socktype | SOCK_CLOEXEC; if (p->is_non_blocking_client) socktype |= SOCK_NONBLOCK; - s = socket (family, socktype, p->ai_protocol); + s = socket (family, socktype, protocol); if (s < 0) { xerrno = errno; @@ -3624,10 +3635,10 @@ usage: (make-network-process &rest ARGS) */) Lisp_Object tem; Lisp_Object name, buffer, host, service, address; Lisp_Object filter, sentinel, use_external_socket_p; - Lisp_Object ip_addresses = Qnil; + Lisp_Object addrinfos = Qnil; int socktype; int family = -1; - int ai_protocol = 0; + enum { any_protocol = 0 }; #ifdef HAVE_GETADDRINFO_A struct gaicb *dns_request = NULL; #endif @@ -3680,7 +3691,7 @@ usage: (make-network-process &rest ARGS) */) if (!get_lisp_to_sockaddr_size (address, &family)) error ("Malformed :address"); - ip_addresses = list1 (address); + addrinfos = list1 (Fcons (make_number (any_protocol), address)); goto open_socket; } @@ -3744,7 +3755,7 @@ usage: (make-network-process &rest ARGS) */) CHECK_STRING (service); if (sizeof address_un.sun_path <= SBYTES (service)) error ("Service name too long"); - ip_addresses = list1 (service); + addrinfos = list1 (Fcons (make_number (any_protocol), service)); goto open_socket; } #endif @@ -3845,14 +3856,9 @@ usage: (make-network-process &rest ARGS) */) immediate_quit = 0; for (lres = res; lres; lres = lres->ai_next) - { - ip_addresses = Fcons (conv_sockaddr_to_lisp - (lres->ai_addr, lres->ai_addrlen), - ip_addresses); - ai_protocol = lres->ai_protocol; - } + addrinfos = Fcons (conv_addrinfo_to_lisp (lres), addrinfos); - ip_addresses = Fnreverse (ip_addresses); + addrinfos = Fnreverse (addrinfos); freeaddrinfo (res); @@ -3919,7 +3925,6 @@ usage: (make-network-process &rest ARGS) */) p->is_server = false; p->port = port; p->socktype = socktype; - p->ai_protocol = ai_protocol; #ifdef HAVE_GETADDRINFO_A p->dns_request = NULL; #endif @@ -3952,7 +3957,7 @@ usage: (make-network-process &rest ARGS) */) #ifdef HAVE_GETADDRINFO_A /* With async address resolution, the list of addresses is empty, so postpone connecting to the server. */ - if (!p->is_server && NILP (ip_addresses)) + if (!p->is_server && NILP (addrinfos)) { p->dns_request = dns_request; p->status = Qconnect; @@ -3960,7 +3965,7 @@ usage: (make-network-process &rest ARGS) */) } #endif - connect_network_socket (proc, ip_addresses, use_external_socket_p); + connect_network_socket (proc, addrinfos, use_external_socket_p); return proc; } @@ -4647,7 +4652,7 @@ static Lisp_Object check_for_dns (Lisp_Object proc) { struct Lisp_Process *p = XPROCESS (proc); - Lisp_Object ip_addresses = Qnil; + Lisp_Object addrinfos = Qnil; /* Sanity check. */ if (! p->dns_request) @@ -4663,13 +4668,9 @@ check_for_dns (Lisp_Object proc) struct addrinfo *res; for (res = p->dns_request->ar_result; res; res = res->ai_next) - { - ip_addresses = Fcons (conv_sockaddr_to_lisp - (res->ai_addr, res->ai_addrlen), - ip_addresses); - } + addrinfos = Fcons (conv_addrinfo_to_lisp (res), addrinfos); - ip_addresses = Fnreverse (ip_addresses); + addrinfos = Fnreverse (addrinfos); } /* The DNS lookup failed. */ else if (EQ (p->status, Qconnect)) @@ -4688,7 +4689,7 @@ check_for_dns (Lisp_Object proc) if (!EQ (p->status, Qconnect)) return Qnil; - return ip_addresses; + return addrinfos; } #endif /* HAVE_GETADDRINFO_A */ @@ -4871,9 +4872,9 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, /* Check for pending DNS requests. */ if (p->dns_request) { - Lisp_Object ip_addresses = check_for_dns (aproc); - if (!NILP (ip_addresses) && !EQ (ip_addresses, Qt)) - connect_network_socket (aproc, ip_addresses, Qnil); + Lisp_Object addrinfos = check_for_dns (aproc); + if (!NILP (addrinfos) && !EQ (addrinfos, Qt)) + connect_network_socket (aproc, addrinfos, Qnil); else retry_for_async = true; } diff --git a/src/process.h b/src/process.h index 20593f5..a5f690d 100644 --- a/src/process.h +++ b/src/process.h @@ -173,8 +173,6 @@ struct Lisp_Process int port; /* The socket type. */ int socktype; - /* The socket protocol. */ - int ai_protocol; #ifdef HAVE_GETADDRINFO_A /* Whether the socket is waiting for response from an asynchronous commit c6493c68f8fd6a5e6893eb3837a1a27f8d8a98a8 Author: Paul Eggert Date: Mon May 23 08:13:03 2016 -0700 Fix seq requirement that broke bootstrap * lisp/image.el (image--get-image): Require seq here, not at the top level, to avoid ‘(require seq) while preparing to dump’ while bootstrapping. Suggested by Tino Calancha in: http://lists.gnu.org/archive/html/emacs-devel/2016-05/msg00477.html diff --git a/lisp/image.el b/lisp/image.el index a6464f7..e06cb6f 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -25,8 +25,6 @@ ;;; Code: -(require 'seq) - (defgroup image () "Image support." :group 'multimedia) @@ -975,6 +973,7 @@ default is 20%." 0.8))) (defun image--get-image () + (require 'seq) (let ((image (or (get-text-property (point) 'display) ;; `put-image' uses overlays, so find an image in ;; the overlays. commit b6baa31e9d37451dbf49d5b9050a2fe0dffff570 Author: Glenn Morris Date: Sun May 22 17:20:48 2016 -0700 ; * test/lisp/mouse-tests.el: Standardize license notice. diff --git a/test/lisp/mouse-tests.el b/test/lisp/mouse-tests.el index 21abf38..204f5d3 100644 --- a/test/lisp/mouse-tests.el +++ b/test/lisp/mouse-tests.el @@ -1,21 +1,23 @@ ;;; mouse-tests.el --- unit tests for mouse.el -*- lexical-binding: t; -*- -;; Copyright (C) 2016 Free Software Foundation, Inc. +;; Copyright (C) 2016 Free Software Foundation, Inc. ;; Author: Philipp Stephani -;; This program is free software; you can redistribute it and/or modify +;; 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. -;; This program is distributed in the hope that it will be useful, +;; 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 this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: commit 2dc0ef29425b7ee4c6c13b832c2a11dfe26ebb35 Author: Nicolas Petton Date: Sun May 22 21:51:11 2016 +0200 Add missing dependencies to seq.el * lisp/emacs-lisp/find-func.el: * lisp/ibuffer.el: * lisp/image.el: Require seq. diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 7bc9663..71437ce 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -43,6 +43,8 @@ ;;; Code: +(require 'seq) + ;;; User variables: (defgroup find-function nil diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 704907a..dd2687c 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -36,6 +36,7 @@ (require 'dired)) (require 'font-core) +(require 'seq) (require 'ibuffer-loaddefs) ;; These come from ibuf-ext.el, which can not be require'd at compile time diff --git a/lisp/image.el b/lisp/image.el index 57cfc4e..a6464f7 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -25,6 +25,7 @@ ;;; Code: +(require 'seq) (defgroup image () "Image support." commit 848d487cd2aed4f26a53c6b65565bb03050614ce Author: Alp Aker Date: Sun May 22 14:14:19 2016 -0400 * src/process.c (SOCK_NONBLOCK): Fix typo. diff --git a/src/process.c b/src/process.c index fbb517d..d4bd19a 100644 --- a/src/process.c +++ b/src/process.c @@ -151,7 +151,7 @@ bool inhibit_sentinels; # define SOCK_CLOEXEC 0 #endif #ifndef SOCK_NONBLOCK -# define SOCK_NONBLOCk 0 +# define SOCK_NONBLOCK 0 #endif /* True if ERRNUM represents an error where the system call would commit 162bc021a1cb4d7f578d1635a55bb7c38084f044 Author: Etienne Prud’homme Date: Fri May 20 14:10:46 2016 -0400 Add completion of colors in CSS mode * lisp/textmodes/css-mode.el (css-value-class-alist): Add CSS colors from "CSS Color Module Level 3". * test/lisp/textmodes/css-mode-tests.el (css-test-property-values): Update test. diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index cf407ef..060af33 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -463,9 +463,8 @@ further value candidates, since that list would be infinite.") (bg-size length percentage "auto" "cover" "contain") (box "border-box" "padding-box" "content-box") (color - "aqua" "black" "blue" "fuchsia" "gray" "green" "lime" "maroon" - "navy" "olive" "orange" "purple" "red" "silver" "teal" "white" - "yellow" "transparent") + "rgb()" "rgba()" "hsl()" "hsla()" named-color "transparent" + "currentColor") (common-lig-values "common-ligatures" "no-common-ligatures") (contextual-alt-values "contextual" "no-contextual") (counter "counter()" "counters()") @@ -504,6 +503,36 @@ further value candidates, since that list would be infinite.") (line-width length "thin" "medium" "thick") (linear-gradient "linear-gradient()") (margin-width "auto" length percentage) + (named-color + "aliceblue" "antiquewhite" "aqua" "aquamarine" "azure" "beige" + "bisque" "black" "blanchedalmond" "blue" "blueviolet" "brown" + "burlywood" "cadetblue" "chartreuse" "chocolate" "coral" + "cornflowerblue" "cornsilk" "crimson" "cyan" "darkblue" + "darkcyan" "darkgoldenrod" "darkgray" "darkgreen" "darkkhaki" + "darkmagenta" "darkolivegreen" "darkorange" "darkorchid" + "darkred" "darksalmon" "darkseagreen" "darkslateblue" + "darkslategray" "darkturquoise" "darkviolet" "deeppink" + "deepskyblue" "dimgray" "dodgerblue" "firebrick" "floralwhite" + "forestgreen" "fuchsia" "gainsboro" "ghostwhite" "gold" + "goldenrod" "gray" "green" "greenyellow" "honeydew" "hotpink" + "indianred" "indigo" "ivory" "khaki" "lavender" "lavenderblush" + "lawngreen" "lemonchiffon" "lightblue" "lightcoral" "lightcyan" + "lightgoldenrodyellow" "lightgray" "lightgreen" "lightpink" + "lightsalmon" "lightseagreen" "lightskyblue" "lightslategray" + "lightsteelblue" "lightyellow" "lime" "limegreen" "linen" + "magenta" "maroon" "mediumaquamarine" "mediumblue" "mediumorchid" + "mediumpurple" "mediumseagreen" "mediumslateblue" + "mediumspringgreen" "mediumturquoise" "mediumvioletred" + "midnightblue" "mintcream" "mistyrose" "moccasin" "navajowhite" + "navy" "oldlace" "olive" "olivedrab" "orange" "orangered" + "orchid" "palegoldenrod" "palegreen" "paleturquoise" + "palevioletred" "papayawhip" "peachpuff" "peru" "pink" "plum" + "powderblue" "purple" "rebeccapurple" "red" "rosybrown" + "royalblue" "saddlebrown" "salmon" "sandybrown" "seagreen" + "seashell" "sienna" "silver" "skyblue" "slateblue" "slategray" + "snow" "springgreen" "steelblue" "tan" "teal" "thistle" "tomato" + "turquoise" "violet" "wheat" "white" "whitesmoke" "yellow" + "yellowgreen") (number "calc()") (numeric-figure-values "lining-nums" "oldstyle-nums") (numeric-fraction-values "diagonal-fractions" "stacked-fractions") diff --git a/test/lisp/textmodes/css-mode-tests.el b/test/lisp/textmodes/css-mode-tests.el index 80d678a..fd86fd2 100644 --- a/test/lisp/textmodes/css-mode-tests.el +++ b/test/lisp/textmodes/css-mode-tests.el @@ -58,7 +58,7 @@ ;; Check that the `color' property doesn't cause infinite recursion ;; because it refers to the value class of the same name. - (should (= (length (css--property-values "color")) 18))) + (should (= (length (css--property-values "color")) 147))) (ert-deftest css-test-property-value-cache () "Test that `css--property-value-cache' is in use." commit f2d03334814cff85013135366a46a85f3124f7f0 Author: Paul Eggert Date: Sat May 21 17:04:44 2016 -0700 Prefer SOCK_NONBLOCK to O_NONBLOCK * src/process.c (SOCK_NONBLOCK): Define to 0 if not already defined. (connect_network_socket): Create the socket with SOCK_NONBLOCK, to avoid an fcntl with O_NONBLOCK if SOCK_NONBLOCK works. Put the SOCK_DGRAM check a bit later, to keep the logic cleaner, as the order does not matter here. diff --git a/src/process.c b/src/process.c index 4bb3f0b..fbb517d 100644 --- a/src/process.c +++ b/src/process.c @@ -150,6 +150,9 @@ bool inhibit_sentinels; #ifndef SOCK_CLOEXEC # define SOCK_CLOEXEC 0 #endif +#ifndef SOCK_NONBLOCK +# define SOCK_NONBLOCk 0 +#endif /* True if ERRNUM represents an error where the system call would block if a blocking variant were used. */ @@ -3141,7 +3144,10 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses, s = socket_to_use; if (s < 0) { - s = socket (family, p->socktype | SOCK_CLOEXEC, p->ai_protocol); + int socktype = p->socktype | SOCK_CLOEXEC; + if (p->is_non_blocking_client) + socktype |= SOCK_NONBLOCK; + s = socket (family, socktype, p->ai_protocol); if (s < 0) { xerrno = errno; @@ -3149,12 +3155,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses, } } -#ifdef DATAGRAM_SOCKETS - if (!p->is_server && p->socktype == SOCK_DGRAM) - break; -#endif /* DATAGRAM_SOCKETS */ - - if (p->is_non_blocking_client) + if (p->is_non_blocking_client && ! (SOCK_NONBLOCK && socket_to_use < 0)) { ret = fcntl (s, F_SETFL, O_NONBLOCK); if (ret < 0) @@ -3166,6 +3167,11 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses, } } +#ifdef DATAGRAM_SOCKETS + if (!p->is_server && p->socktype == SOCK_DGRAM) + break; +#endif /* DATAGRAM_SOCKETS */ + /* Make us close S if quit. */ record_unwind_protect_int (close_file_unwind, s); commit e5015c5d9632a0bf685c093249ae4a7d3e825b13 Author: Alan Third Date: Sat May 21 21:04:39 2016 +0200 Fix bug#16856, cursor leaves garbage in fringe on OS X. * src/nsterm.m (ns_draw_window_cursor): Prevent the cursor from being drawn outside the text area. diff --git a/src/nsterm.m b/src/nsterm.m index b815d77..d79e4f4 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2873,9 +2873,8 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. r.size.height = h; r.size.width = w->phys_cursor_width; - /* TODO: only needed in rare cases with last-resort font in HELLO.. - should we do this more efficiently? */ - ns_clip_to_row (w, glyph_row, ANY_AREA, NO); /* do ns_focus(f, &r, 1); if remove */ + /* Prevent the cursor from being drawn outside the text area. */ + ns_clip_to_row (w, glyph_row, TEXT_AREA, NO); /* do ns_focus(f, &r, 1); if remove */ face = FACE_OPT_FROM_ID (f, phys_cursor_glyph->face_id); commit cb5af79249c2c9e21405e6237db11935b50dd1c5 Author: Eli Zaretskii Date: Sat May 21 20:06:33 2016 +0300 Fix compiler warnings in the MinGW build * configure.ac [mingw32]: Don't add -Wpointer-sign, and add -Wno-pointer-sign, to keep the noise level down. * nt/mingw-cfg.site (gl_cv_warn_c__Wredundant_decls): Disable -Wredundant-decls, as that produces a lot of noise due to redeclaration of time-related functions by gnulib. * nt/runemacs.c (set_user_model_id): Fix argument type of 'SetCurrentProcessExplicitAppUserModelID'. * src/image.c (x_create_bitmap_from_file) [HAVE_NTGUI]: Don't declare 'dpyinfo', as it is unused. (xpm_load): Fix warnings about pointer signedness. * src/w32proc.c (IsValidLocale, init_winsock): Remove redundant prototypes. (sys_spawnve): Avoid warnings about discarding 'const' qualifier. (sys_select): Provide prototype. (g_b_init_compare_string_w): Move declaration to file scope. * src/w32heap.c (dumped_data_commit): Now static. (FREEABLE_P): Avoid warnings about pointer comparison with integer. (mmap_realloc): Cast to 'char *' for arithmetics on void pointers. * src/w32console.c (ctrl_c_handler, sys_tputs, sys_tgetstr) (evalcost, cmputc, cmcheckmagic, cmcostinit, cmgoto, Wcm_clear): Provide prototypes. * src/w32.c (globals_of_w32, conv_sockaddr_to_lisp): Remove redundant prototypes. (w32_get_internal_run_time, map_w32_filename): Provide prototype. (init_environment, sys_ctime): Avoid warnings about discarding 'const' qualifier. Include utimens.h. (sys_ctime, sys_chdir, sys_creat, sys_fopen, sys_mkdir) (sys_open, sys_rename, sys_rmdir, is_slow_fs, term_winsock) (sys_close, sys_dup2, sys_read, sys_write, sys_localtime): Provide prototypes. (sys_rename_replace): Use %d to avoid compiler warnings. (_wsa_errlist): Make the message text 'const char *', to avoid compilation warnings. (dynlib_reset_last_error): Move prototype to file scope. (w32_get_resource): First argument is now 'const char *'. * src/w32uniscribe.c (syms_of_w32uniscribe): Provide prototype. (otf_features): Second argument is no 'const char *'. * src/w32term.c (free_frame_menubar, x_wm_set_size_hint) (x_set_window_size): Remove redundant prototypes. (XChangeGC, XGetGCValues, w32_draw_underwave) (w32_draw_rectangle, w32_shift_glyphs_for_insert, x_mouse_leave) (x_calc_absolute_position, x_destroy_window): Now static. (menubar_selection_callback): Move prototype to file scope. * src/w32font.c (g_b_init_get_glyph_outline_w): Remove redundant declaration. (w32_to_x_charset): Fix warnings about discarding 'const' qualifier. (w32font_full_name): Fix warnings about implicit conversion of 'float' to 'double'. * src/w32reg.c (w32_get_rdb_resource): Fix warnings about discarding 'const' qualifier. * src/w32menu.c (syms_of_w32menu, globals_of_w32menu) (set_frame_menubar): Remove redundant prototypes. (menubar_selection_callback, w32_menu_display_help): Provide prototypes. (simple_dialog_show): Avoid warnings about discarding 'const' qualifier. * src/w32fns.c (syms_of_w32fns, globals_of_w32fns) (free_frame_menubar, w32_strerror, x_set_menu_bar_lines) (x_set_tool_bar_lines, x_set_internal_border_width): Remove redundant prototypes. (current_popup_menu): Remove redundant declaration. (colormap_t): Member 'name' is now 'const char *'. (add_system_logical_colors_to_map): Fix signed/unsigned warnings. (x_decode_color, x_set_border_pixel) (x_clear_under_internal_border, x_set_name, hook_w32_key) (reset_w32_kbdhook_state, deliver_wm_chars, w32_backtrace): Now static. (w32_load_cursor, w32_key_to_modifier, map_keypad_keys) (w32_msg_worker, w32_last_error): Provide prototypes. (funhook, lookup_vk_code): Avoid warnings about missing parentheses. (x_default_font_parameter, Fw32_notification_notify): Avoid warnings about discarding 'const' qualifier. (Fx_create_frame): Avoid warnings about empty body of 'else'. (x_screen_planes): Ifdef away unused function. (Fx_show_tip): Remove unused variables. (Fw32_battery_status): Avoid warnings about implicit promotion from float to double. (Fw32_notification_notify): Initialize 'timeout'. * src/profiler.c (profiler_cpu_running) [HAVE_ITIMERSPEC]: Only define the TIMER_SETTIME_RUNNING value if it will be used. * src/w32notify.c (send_notifications): Ifdef away an empty if clause. Remove unused variable. (watch_end, watch_completion): Provide prototypes. * src/sound.c (sound_warning) [WINDOWSNT]: Don't define: unused. * src/callproc.c (child_setup, getenv_internal_1) [WINDOWSNT]: Fix warning with pointer signedness. * src/gnutls.c (gnutls_x509_crt_get_signature) (gnutls_alert_send_appropriate) [WINDOWSNT]: Don't define, and don't load them from the GnuTLS library, as they are no longer used. * src/process.c (DATAGRAM_CHAN_P) [!DATAGRAM_SOCKETS]: Don't define, as it's unused. * src/unexw32.c (open_input_file, open_output_file) (close_file_data): Remove redundant prototypes. (_start): provide prototype. (mainCRTStartup): Move prototype to file level. (find_section): Use type-cast to shut up compiler warnings. (offset_to_section, relocate_offset): Now static. (find_section): First argument is now a 'const char *'. (offset_to_section): Ifdef away, as it's unused. * src/w32heap.h (find_section): Adjust prototype. * src/dynlib.c (dynlib_reset_last_error): Provide prototype. * src/dired.c (directory_files_internal_w32_unwind): Avoid warnings about missing prototypes. (is_slow_fs) [WINDOWSNT]: Provide prototype at file level. (directory_files_internal) [WINDOWSNT]: Fix warnings about pointer signedness. * src/fileio.c (Ffile_writable_p, Ffile_regular_p) [WINDOWSNT]: Fix warnings about pointer signedness. * src/filelock.c (WTMP_FILE) [WINDOWSNT]: Don't define, it's unused. * src/sysdep.c (_getpid): Remove redundant prototype. (sys_subshell) [DOS_NT]: Don't define 'status', it's unused. [!MSDOS]: Don't define 'st', it's unused. (init_sys_modes) [DOS_NT]: Don't define 'terminal', it's unused. (str_collate) [WINDOWSNT]: Avoid warnings about pointer signedness. * src/keyboard.c (tty_read_avail_input) [WINDOWSNT]: Don't define n_to_read, as it is not used. (MAX_ENCODED_BYTES) [WINDOWSNT]: Don't define, as it's unused. * src/w32font.h (syms_of_w32font): Remove redundant prototype. * src/xfaces.c (x_display_info) [HAVE_NTGUI]: Remove unused macro. * src/term.c (init_tty) [DOS_NT]: Ifdef away variables that are not used by DOS_NT builds, to avoid compiler warnings. * src/menu.c (current_popup_menu) [HAVE_NTGUI]: Remove redundant declaration. * src/dispnew.c (init_display) [WINDOWSNT]: Use type-cast to shut up compiler warnings. * src/w32term.h (x_set_window_size, x_get_focus_frame) (x_make_frame_visible, x_make_frame_invisible, x_iconify_frame) (x_set_frame_alpha, x_activate_menubar, x_bitmap_icon) (x_free_frame_resources, x_real_positions) (display_x_get_resource): Remove redundant prototypes. * lib-src/ntlib.c (sys_ctime, sys_fopen, sys_chdir, mkostemp) (sys_rename, gettimeofday): Provide prototypes. * lib-src/ntlib.h (getuid, geteuid, mkostemp): Remove redundant declarations. * lib-src/emacsclient.c (w32_getenv): Argument is now 'const char *'. (xstrdup, w32_get_resource, w32_window_app, w32_execvp, ttyname) (close_winsock, initialize_sockets, w32_set_user_model_id) (w32_find_emacs_process, w32_give_focus) [WINDOWSNT]: Add prototypes. (w32_get_resource) [WINDOWSNT]: Fix a warning about signedness difference. (w32_set_user_model_id): Update prototype of SetCurrentProcessExplicitAppUserModelID to avoid compiler warnings. (start_daemon_and_retry_set_socket) [WINDOWSNT]: Use type-cast to shut up compiler warnings. * lib-src/etags.c (MAXPATHLEN) [WINDOWSNT]: Remove unused macro. diff --git a/configure.ac b/configure.ac index 22ec494..e88a3a9 100644 --- a/configure.ac +++ b/configure.ac @@ -967,6 +967,11 @@ AS_IF([test $gl_gcc_warnings = no], nw="$nw -Wcast-align" fi + # This causes too much noise in the MinGW build + if test $opsys = mingw32; then + nw="$nw -Wpointer-sign" + fi + gl_MANYWARN_ALL_GCC([ws]) gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw]) for w in $ws; do @@ -987,6 +992,11 @@ AS_IF([test $gl_gcc_warnings = no], gl_WARN_ADD([-Wno-unused-value]) fi + # This causes too much noise in the MinGW build + if test $opsys = mingw32; then + gl_WARN_ADD([-Wno-pointer-sign]) + fi + AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.]) AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks]) AH_VERBATIM([GNULIB_PORTCHECK_FORTIFY_SOURCE], diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index dd66d34..aab9c4b 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -39,7 +39,7 @@ along with GNU Emacs. If not, see . */ # define CLOSE_SOCKET closesocket # define INITIALIZE() (initialize_sockets ()) -char *w32_getenv (char *); +char *w32_getenv (const char *); #define egetenv(VAR) w32_getenv(VAR) #else /* !WINDOWSNT */ @@ -254,6 +254,7 @@ get_current_dir_name (void) #ifdef WINDOWSNT /* Like strdup but get a fatal error if memory is exhausted. */ +char *xstrdup (const char *); char * xstrdup (const char *s) @@ -269,11 +270,13 @@ xstrdup (const char *s) #define REG_ROOT "SOFTWARE\\GNU\\Emacs" +char *w32_get_resource (HKEY, const char *, LPDWORD); + /* Retrieve an environment variable from the Emacs subkeys of the registry. Return NULL if the variable was not found, or it was empty. This code is based on w32_get_resource (w32.c). */ char * -w32_get_resource (HKEY predefined, char *key, LPDWORD type) +w32_get_resource (HKEY predefined, const char *key, LPDWORD type) { HKEY hrootkey = NULL; char *result = NULL; @@ -285,7 +288,7 @@ w32_get_resource (HKEY predefined, char *key, LPDWORD type) { result = (char *) xmalloc (cbData); - if ((RegQueryValueEx (hrootkey, key, NULL, type, result, &cbData) != ERROR_SUCCESS) + if ((RegQueryValueEx (hrootkey, key, NULL, type, (LPBYTE)result, &cbData) != ERROR_SUCCESS) || (*result == 0)) { free (result); @@ -308,7 +311,7 @@ w32_get_resource (HKEY predefined, char *key, LPDWORD type) environment variables in the registry if they don't appear in the environment. */ char * -w32_getenv (char *envvar) +w32_getenv (const char *envvar) { char *value; DWORD dwType; @@ -356,6 +359,7 @@ w32_getenv (char *envvar) return NULL; } +int w32_window_app (void); int w32_window_app (void) @@ -383,11 +387,13 @@ w32_window_app (void) predictably bad results. By contrast, POSIX execvp passes the arguments directly into the argv array of the child process. */ +int w32_execvp (const char *, char **); +extern int execvp (const char*, char **); + int w32_execvp (const char *path, char **argv) { int i; - extern int execvp (const char*, char **); /* Required to allow a .BAT script as alternate editor. */ argv[0] = (char *) alternate_editor; @@ -407,7 +413,8 @@ w32_execvp (const char *path, char **argv) #define execvp w32_execvp /* Emulation of ttyname for Windows. */ -char * +const char *ttyname (int); +const char * ttyname (int fd) { return "CONOUT$"; @@ -852,6 +859,7 @@ file_name_absolute_p (const char *filename) #ifdef WINDOWSNT /* Wrapper to make WSACleanup a cdecl, as required by atexit. */ +void __cdecl close_winsock (void); void __cdecl close_winsock (void) { @@ -859,6 +867,7 @@ close_winsock (void) } /* Initialize the WinSock2 library. */ +void initialize_sockets (void); void initialize_sockets (void) { @@ -1380,11 +1389,13 @@ set_socket (int no_exit_if_error) FARPROC set_fg; /* Pointer to AllowSetForegroundWindow. */ FARPROC get_wc; /* Pointer to RealGetWindowClassA. */ +void w32_set_user_model_id (void); + void w32_set_user_model_id (void) { HMODULE shell; - HRESULT (WINAPI * set_user_model) (wchar_t * id); + HRESULT (WINAPI * set_user_model) (const wchar_t * id); /* On Windows 7 and later, we need to set the user model ID to associate emacsclient launched files with Emacs frames @@ -1407,6 +1418,8 @@ w32_set_user_model_id (void) } } +BOOL CALLBACK w32_find_emacs_process (HWND, LPARAM); + BOOL CALLBACK w32_find_emacs_process (HWND hWnd, LPARAM lParam) { @@ -1433,6 +1446,7 @@ w32_find_emacs_process (HWND hWnd, LPARAM lParam) /* Search for a window of class "Emacs" and owned by a process with process id = emacs_pid. If found, allow it to grab the focus. */ +void w32_give_focus (void); void w32_give_focus (void) @@ -1526,7 +1540,7 @@ start_daemon_and_retry_set_socket (void) it is ready to accept client connections, by asserting an event whose name is known to the daemon (defined by nt/inc/ms-w32.h). */ - if (!CreateProcess (NULL, "emacs --daemon", NULL, NULL, FALSE, + if (!CreateProcess (NULL, (LPSTR)"emacs --daemon", NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { char* msg = NULL; @@ -1548,7 +1562,7 @@ start_daemon_and_retry_set_socket (void) if ((wait_result = WaitForSingleObject (w32_daemon_event, INFINITE)) != WAIT_OBJECT_0) { - char *msg = NULL; + const char *msg = NULL; switch (wait_result) { diff --git a/lib-src/etags.c b/lib-src/etags.c index 570d217..1c85a79 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -112,7 +112,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; #ifdef WINDOWSNT # include -# define MAXPATHLEN _MAX_PATH # undef HAVE_NTGUI # undef DOS_NT # define DOS_NT diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c index 4b25796..2ace218 100644 --- a/lib-src/ntlib.c +++ b/lib-src/ntlib.c @@ -34,6 +34,12 @@ along with GNU Emacs. If not, see . */ #include "ntlib.h" +char *sys_ctime (const time_t *); +FILE *sys_fopen (const char *, const char *); +int sys_chdir (const char *); +int mkostemp (char *, int); +int sys_rename (const char *, const char *); + /* MinGW64 defines _TIMEZONE_DEFINED and defines 'struct timespec' in its system headers. */ #ifndef _TIMEZONE_DEFINED @@ -44,6 +50,8 @@ struct timezone }; #endif +void gettimeofday (struct timeval *, struct timezone *); + #define MAXPATHLEN _MAX_PATH /* Emulate sleep...we could have done this with a define, but that diff --git a/lib-src/ntlib.h b/lib-src/ntlib.h index b49da79..4849dcc 100644 --- a/lib-src/ntlib.h +++ b/lib-src/ntlib.h @@ -34,15 +34,12 @@ char *getwd (char *dir); int getppid (void); char * getlogin (void); char * cuserid (char * s); -unsigned getuid (void); -unsigned geteuid (void); unsigned getegid (void); unsigned getgid (void); int setuid (unsigned uid); int setregid (unsigned rgid, unsigned gid); char * getpass (const char * prompt); int fchown (int fd, unsigned uid, unsigned gid); -int mkostemp (char * template, int flags); /* redirect or undo interceptions created by config.h */ #undef access diff --git a/nt/mingw-cfg.site b/nt/mingw-cfg.site index 9d63008..f3c8f81 100644 --- a/nt/mingw-cfg.site +++ b/nt/mingw-cfg.site @@ -129,3 +129,5 @@ gl_cv_func_stat_file_slash=yes ac_cv_func_random=yes # Implemented in w32.c as sys_putenv gl_cv_func_svid_putenv=yes +# GCC warnings that produce too much noise +gl_cv_warn_c__Wredundant_decls=no diff --git a/nt/runemacs.c b/nt/runemacs.c index b5e16c0..9edf148 100644 --- a/nt/runemacs.c +++ b/nt/runemacs.c @@ -203,7 +203,7 @@ void set_user_model_id (void) { HMODULE shell; - HRESULT (WINAPI * set_user_model) (wchar_t * id); + HRESULT (WINAPI * set_user_model) (const wchar_t * id); /* On Windows 7 and later, we need to set the user model ID to associate emacsclient launched files with Emacs frames diff --git a/src/callproc.c b/src/callproc.c index 3a40626..0729782 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1295,7 +1295,7 @@ child_setup (int in, int out, int err, char **new_argv, bool set_pgrp, #ifdef WINDOWSNT prepare_standard_handles (in, out, err, handles); - set_process_dir (SDATA (current_dir)); + set_process_dir (SSDATA (current_dir)); /* Spawn the child. (See w32proc.c:sys_spawnve). */ cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env); reset_standard_handles (in, out, err, handles); @@ -1342,7 +1342,7 @@ getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value, && SBYTES (entry) >= varlen #ifdef WINDOWSNT /* NT environment variables are case insensitive. */ - && ! strnicmp (SDATA (entry), var, varlen) + && ! strnicmp (SSDATA (entry), var, varlen) #else /* not WINDOWSNT */ && ! memcmp (SDATA (entry), var, varlen) #endif /* not WINDOWSNT */ diff --git a/src/dired.c b/src/dired.c index 5d0e327..2dffbb7 100644 --- a/src/dired.c +++ b/src/dired.c @@ -47,6 +47,10 @@ along with GNU Emacs. If not, see . */ #include "msdos.h" /* for fstatat */ #endif +#ifdef WINDOWSNT +extern int is_slow_fs (const char *); +#endif + static ptrdiff_t scmp (const char *, const char *, ptrdiff_t); static Lisp_Object file_attributes (int, char const *, Lisp_Object); @@ -98,7 +102,7 @@ open_directory (Lisp_Object dirname, int *fdp) } #ifdef WINDOWSNT -void +static void directory_files_internal_w32_unwind (Lisp_Object arg) { Vw32_get_true_file_attributes = arg; @@ -206,8 +210,6 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, #ifdef WINDOWSNT if (attrs) { - extern int is_slow_fs (const char *); - /* Do this only once to avoid doing it (in w32.c:stat) for each file in the directory, when we call Ffile_attributes below. */ record_unwind_protect (directory_files_internal_w32_unwind, @@ -217,7 +219,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, { /* w32.c:stat will notice these bindings and avoid calling GetDriveType for each file. */ - if (is_slow_fs (SDATA (dirfilename))) + if (is_slow_fs (SSDATA (dirfilename))) Vw32_get_true_file_attributes = Qnil; else Vw32_get_true_file_attributes = Qt; diff --git a/src/dispnew.c b/src/dispnew.c index 4cc908a..82d0b76 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6042,7 +6042,7 @@ init_display (void) fatal ("standard input is not a tty"); #ifdef WINDOWSNT - terminal_type = "w32console"; + terminal_type = (char *)"w32console"; #else terminal_type = getenv ("TERM"); #endif diff --git a/src/dynlib.c b/src/dynlib.c index 64f688c..ada5837 100644 --- a/src/dynlib.c +++ b/src/dynlib.c @@ -52,6 +52,7 @@ typedef BOOL (WINAPI *GetModuleHandleExA_Proc) (DWORD,LPCSTR,HMODULE*); /* This needs to be called at startup to countermand any non-zero values recorded by temacs. */ +void dynlib_reset_last_error (void); void dynlib_reset_last_error (void) { diff --git a/src/fileio.c b/src/fileio.c index d931808..9da0bf0 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2542,7 +2542,7 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0, /* The read-only attribute of the parent directory doesn't affect whether a file or directory can be created within it. Some day we should check ACLs though, which do affect this. */ - return file_directory_p (SDATA (dir)) ? Qt : Qnil; + return file_directory_p (SSDATA (dir)) ? Qt : Qnil; #else return check_writable (SSDATA (dir), W_OK | X_OK) ? Qt : Qnil; #endif @@ -2773,7 +2773,7 @@ See `file-symlink-p' to distinguish symlinks. */) /* Tell stat to use expensive method to get accurate info. */ Vw32_get_true_file_attributes = Qt; - result = stat (SDATA (absname), &st); + result = stat (SSDATA (absname), &st); Vw32_get_true_file_attributes = tem; if (result < 0) diff --git a/src/filelock.c b/src/filelock.c index 6201718..2f92e0f 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -65,7 +65,7 @@ along with GNU Emacs. If not, see . */ #define BOOT_TIME_FILE "/var/run/random-seed" #endif -#ifndef WTMP_FILE +#if !defined WTMP_FILE && !defined WINDOWSNT #define WTMP_FILE "/var/log/wtmp" #endif diff --git a/src/gnutls.c b/src/gnutls.c index c7efbcc..8ee066f 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -55,7 +55,6 @@ DEF_DLL_FN (gnutls_alert_description_t, gnutls_alert_get, (gnutls_session_t)); DEF_DLL_FN (const char *, gnutls_alert_get_name, (gnutls_alert_description_t)); -DEF_DLL_FN (int, gnutls_alert_send_appropriate, (gnutls_session_t, int)); DEF_DLL_FN (int, gnutls_anon_allocate_client_credentials, (gnutls_anon_client_credentials_t *)); DEF_DLL_FN (void, gnutls_anon_free_client_credentials, @@ -156,8 +155,6 @@ DEF_DLL_FN (int, gnutls_x509_crt_get_subject_unique_id, (gnutls_x509_crt_t, char *, size_t *)); DEF_DLL_FN (int, gnutls_x509_crt_get_signature_algorithm, (gnutls_x509_crt_t)); -DEF_DLL_FN (int, gnutls_x509_crt_get_signature, - (gnutls_x509_crt_t, char *, size_t *)); DEF_DLL_FN (int, gnutls_x509_crt_get_key_id, (gnutls_x509_crt_t, unsigned int, unsigned char *, size_t *_size)); DEF_DLL_FN (const char*, gnutls_sec_param_get_name, (gnutls_sec_param_t)); @@ -192,7 +189,6 @@ init_gnutls_functions (void) LOAD_DLL_FN (library, gnutls_alert_get); LOAD_DLL_FN (library, gnutls_alert_get_name); - LOAD_DLL_FN (library, gnutls_alert_send_appropriate); LOAD_DLL_FN (library, gnutls_anon_allocate_client_credentials); LOAD_DLL_FN (library, gnutls_anon_free_client_credentials); LOAD_DLL_FN (library, gnutls_bye); @@ -255,7 +251,6 @@ init_gnutls_functions (void) LOAD_DLL_FN (library, gnutls_x509_crt_get_issuer_unique_id); LOAD_DLL_FN (library, gnutls_x509_crt_get_subject_unique_id); LOAD_DLL_FN (library, gnutls_x509_crt_get_signature_algorithm); - LOAD_DLL_FN (library, gnutls_x509_crt_get_signature); LOAD_DLL_FN (library, gnutls_x509_crt_get_key_id); LOAD_DLL_FN (library, gnutls_sec_param_get_name); LOAD_DLL_FN (library, gnutls_sign_get_name); @@ -282,7 +277,6 @@ init_gnutls_functions (void) # define gnutls_alert_get fn_gnutls_alert_get # define gnutls_alert_get_name fn_gnutls_alert_get_name -# define gnutls_alert_send_appropriate fn_gnutls_alert_send_appropriate # define gnutls_anon_allocate_client_credentials fn_gnutls_anon_allocate_client_credentials # define gnutls_anon_free_client_credentials fn_gnutls_anon_free_client_credentials # define gnutls_bye fn_gnutls_bye @@ -343,7 +337,6 @@ init_gnutls_functions (void) # define gnutls_x509_crt_get_key_id fn_gnutls_x509_crt_get_key_id # define gnutls_x509_crt_get_pk_algorithm fn_gnutls_x509_crt_get_pk_algorithm # define gnutls_x509_crt_get_serial fn_gnutls_x509_crt_get_serial -# define gnutls_x509_crt_get_signature fn_gnutls_x509_crt_get_signature # define gnutls_x509_crt_get_signature_algorithm fn_gnutls_x509_crt_get_signature_algorithm # define gnutls_x509_crt_get_subject_unique_id fn_gnutls_x509_crt_get_subject_unique_id # define gnutls_x509_crt_get_version fn_gnutls_x509_crt_get_version diff --git a/src/image.c b/src/image.c index 22bbc35..c1f25aa 100644 --- a/src/image.c +++ b/src/image.c @@ -270,12 +270,12 @@ x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsi ptrdiff_t x_create_bitmap_from_file (struct frame *f, Lisp_Object file) { - Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); - #ifdef HAVE_NTGUI return -1; /* W32_TODO : bitmap support */ #endif /* HAVE_NTGUI */ + Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); + #ifdef HAVE_NS ptrdiff_t id; void *bitmap = ns_image_from_file (file); @@ -3677,7 +3677,7 @@ xpm_load (struct frame *f, struct image *img) #endif /* XpmReadFileToPixmap is not available in the Windows port of libxpm. But XpmReadFileToImage almost does what we want. */ - rc = XpmReadFileToImage (&hdc, SDATA (file), + rc = XpmReadFileToImage (&hdc, SSDATA (file), &xpm_image, &xpm_mask, &attrs); #else @@ -3701,7 +3701,7 @@ xpm_load (struct frame *f, struct image *img) #ifdef HAVE_NTGUI /* XpmCreatePixmapFromBuffer is not available in the Windows port of libxpm. But XpmCreateImageFromBuffer almost does what we want. */ - rc = XpmCreateImageFromBuffer (&hdc, SDATA (buffer), + rc = XpmCreateImageFromBuffer (&hdc, SSDATA (buffer), &xpm_image, &xpm_mask, &attrs); #else diff --git a/src/keyboard.c b/src/keyboard.c index ef2e278..2b5d514 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2193,8 +2193,8 @@ read_decoded_event_from_main_queue (struct timespec *end_time, Lisp_Object prev_event, bool *used_mouse_menu) { -#define MAX_ENCODED_BYTES 16 #ifndef WINDOWSNT +#define MAX_ENCODED_BYTES 16 Lisp_Object events[MAX_ENCODED_BYTES]; int n = 0; #endif @@ -6898,7 +6898,10 @@ tty_read_avail_input (struct terminal *terminal, the kbd_buffer can really hold. That may prevent loss of characters on some systems when input is stuffed at us. */ unsigned char cbuf[KBD_BUFFER_SIZE - 1]; - int n_to_read, i; +#ifndef WINDOWSNT + int n_to_read; +#endif + int i; struct tty_display_info *tty = terminal->display_info.tty; int nread = 0; #ifdef subprocesses diff --git a/src/menu.c b/src/menu.c index 737f2b5..e3d943e 100644 --- a/src/menu.c +++ b/src/menu.c @@ -47,7 +47,6 @@ along with GNU Emacs. If not, see . */ # else /* !NTGUI_UNICODE */ extern AppendMenuW_Proc unicode_append_menu; # endif /* NTGUI_UNICODE */ -extern HMENU current_popup_menu; #endif /* HAVE_NTGUI */ #include "menu.h" diff --git a/src/process.c b/src/process.c index 3e5b83d..4bb3f0b 100644 --- a/src/process.c +++ b/src/process.c @@ -316,7 +316,6 @@ static struct sockaddr_and_len { XPROCESS (proc)->infd >= 0 && \ datagram_address[XPROCESS (proc)->infd].sa != 0) #else -#define DATAGRAM_CHAN_P(chan) (0) #define DATAGRAM_CONN_P(proc) (0) #endif diff --git a/src/profiler.c b/src/profiler.c index 844c1f2..07e21ae 100644 --- a/src/profiler.c +++ b/src/profiler.c @@ -201,7 +201,12 @@ static bool profiler_timer_ok; /* Status of sampling profiler. */ static enum profiler_cpu_running - { NOT_RUNNING, TIMER_SETTIME_RUNNING, SETITIMER_RUNNING } + { NOT_RUNNING, +#ifdef HAVE_ITIMERSPEC + TIMER_SETTIME_RUNNING, +#endif + SETITIMER_RUNNING + } profiler_cpu_running; /* Hash-table log of CPU profiler. */ diff --git a/src/sound.c b/src/sound.c index b9a794b..8671d4a 100644 --- a/src/sound.c +++ b/src/sound.c @@ -316,6 +316,7 @@ sound_perror (const char *msg) } +#ifndef WINDOWSNT /* Display a warning message. */ static void @@ -323,6 +324,7 @@ sound_warning (const char *msg) { message1 (msg); } +#endif /* !WINDOWSNT */ /* Parse sound specification SOUND, and fill ATTRS with what is diff --git a/src/sysdep.c b/src/sysdep.c index 53affbf..a99c208 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -107,7 +107,6 @@ along with GNU Emacs. If not, see . */ /* In process.h which conflicts with the local copy. */ #define _P_WAIT 0 int _cdecl _spawnlp (int, const char *, const char *, ...); -int _cdecl _getpid (void); /* The following is needed for O_CLOEXEC, F_SETFD, FD_CLOEXEC, and several prototypes of functions called below. */ #include @@ -507,15 +506,16 @@ void sys_subshell (void) { #ifdef DOS_NT /* Demacs 1.1.2 91/10/20 Manabu Higashida */ - int st; #ifdef MSDOS + int st; char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS. */ #else char oldwd[MAX_UTF8_PATH]; -#endif +#endif /* MSDOS */ +#else /* !DOS_NT */ + int status; #endif pid_t pid; - int status; struct save_signal saved_handlers[5]; char *str = SSDATA (encode_current_directory ()); @@ -938,7 +938,9 @@ void init_sys_modes (struct tty_display_info *tty_out) { struct emacs_tty tty; +#ifndef DOS_NT Lisp_Object terminal; +#endif Vtty_erase_char = Qnil; @@ -3915,7 +3917,7 @@ str_collate (Lisp_Object s1, Lisp_Object s2, int res, err = errno; errno = 0; - res = w32_compare_strings (SDATA (s1), SDATA (s2), loc, !NILP (ignore_case)); + res = w32_compare_strings (SSDATA (s1), SSDATA (s2), loc, !NILP (ignore_case)); if (errno) error ("Invalid string for collation: %s", strerror (errno)); diff --git a/src/term.c b/src/term.c index 07cc3a9..df583cb 100644 --- a/src/term.c +++ b/src/term.c @@ -3913,13 +3913,15 @@ dissociate_if_controlling_tty (int fd) struct terminal * init_tty (const char *name, const char *terminal_type, bool must_succeed) { + struct tty_display_info *tty = NULL; + struct terminal *terminal = NULL; +#ifndef DOS_NT char *area; char **address = &area; int status; - struct tty_display_info *tty = NULL; - struct terminal *terminal = NULL; sigset_t oldset; bool ctty = false; /* True if asked to open controlling tty. */ +#endif if (!terminal_type) maybe_fatal (must_succeed, 0, @@ -3928,8 +3930,10 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed) if (name == NULL) name = DEV_TTY; +#ifndef DOS_NT if (!strcmp (name, DEV_TTY)) ctty = 1; +#endif /* If we already have a terminal on the given device, use that. If all such terminals are suspended, create a new one instead. */ diff --git a/src/unexw32.c b/src/unexw32.c index 15aa726..f4183dc 100644 --- a/src/unexw32.c +++ b/src/unexw32.c @@ -50,10 +50,6 @@ extern char *my_begbss_static; /* Basically, our "initialized" flag. */ BOOL using_dynamic_heap = FALSE; -int open_input_file (file_data *p_file, char *name); -int open_output_file (file_data *p_file, char *name, unsigned long size); -void close_file_data (file_data *p_file); - void get_section_info (file_data *p_file); void copy_executable_and_dump_data (file_data *, file_data *); void dump_bss_and_heap (file_data *p_infile, file_data *p_outfile); @@ -81,14 +77,17 @@ DWORD_PTR extra_bss_size_static = 0; #define _start __start #endif +extern void mainCRTStartup (void); + /* Startup code for running on NT. When we are running as the dumped version, we need to bootstrap our heap and .bss section into our address space before we can actually hand off control to the startup code supplied by NT (primarily because that code relies upon malloc ()). */ +void _start (void); + void _start (void) { - extern void mainCRTStartup (void); #if 1 /* Give us a way to debug problems with crashes on startup when @@ -205,7 +204,7 @@ close_file_data (file_data *p_file) /* Return pointer to section header for named section. */ IMAGE_SECTION_HEADER * -find_section (char * name, IMAGE_NT_HEADERS * nt_header) +find_section (const char * name, IMAGE_NT_HEADERS * nt_header) { PIMAGE_SECTION_HEADER section; int i; @@ -214,7 +213,7 @@ find_section (char * name, IMAGE_NT_HEADERS * nt_header) for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++) { - if (strcmp (section->Name, name) == 0) + if (strcmp ((char *)section->Name, name) == 0) return section; section++; } @@ -249,9 +248,10 @@ rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header) return NULL; } +#if 0 /* unused */ /* Return pointer to section header for section containing the given offset in its raw data area. */ -IMAGE_SECTION_HEADER * +static IMAGE_SECTION_HEADER * offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header) { PIMAGE_SECTION_HEADER section; @@ -268,11 +268,12 @@ offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header) } return NULL; } +#endif /* Return offset to an object in dst, given offset in src. We assume there is at least one section in both src and dst images, and that the some sections may have been added to dst (after sections in src). */ -DWORD_PTR +static DWORD_PTR relocate_offset (DWORD_PTR offset, IMAGE_NT_HEADERS * src_nt_header, IMAGE_NT_HEADERS * dst_nt_header) @@ -306,9 +307,6 @@ relocate_offset (DWORD_PTR offset, (dst_section->PointerToRawData - src_section->PointerToRawData); } -#define OFFSET_TO_RVA(offset, section) \ - ((section)->VirtualAddress + ((DWORD_PTR)(offset) - (section)->PointerToRawData)) - #define RVA_TO_OFFSET(rva, section) \ ((section)->PointerToRawData + ((DWORD_PTR)(rva) - (section)->VirtualAddress)) @@ -318,15 +316,20 @@ relocate_offset (DWORD_PTR offset, /* Convert address in executing image to RVA. */ #define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL)) -#define RVA_TO_PTR(var,section,filedata) \ - ((unsigned char *)(RVA_TO_OFFSET (var,section) + (filedata).file_base)) - #define PTR_TO_OFFSET(ptr, pfile_data) \ ((unsigned char *)(ptr) - (pfile_data)->file_base) #define OFFSET_TO_PTR(offset, pfile_data) \ ((pfile_data)->file_base + (DWORD_PTR)(offset)) +#if 0 /* unused */ +#define OFFSET_TO_RVA(offset, section) \ + ((section)->VirtualAddress + ((DWORD_PTR)(offset) - (section)->PointerToRawData)) + +#define RVA_TO_PTR(var,section,filedata) \ + ((unsigned char *)(RVA_TO_OFFSET (var,section) + (filedata).file_base)) +#endif + /* Flip through the executable and cache the info necessary for dumping. */ void diff --git a/src/w32.c b/src/w32.c index 94aa7d8..442ce79 100644 --- a/src/w32.c +++ b/src/w32.c @@ -66,6 +66,24 @@ along with GNU Emacs. If not, see . */ #undef localtime +char *sys_ctime (const time_t *); +int sys_chdir (const char *); +int sys_creat (const char *, int); +FILE *sys_fopen (const char *, const char *); +int sys_mkdir (const char *); +int sys_open (const char *, int, int); +int sys_rename (char const *, char const *); +int sys_rmdir (const char *); +int sys_close (int); +int sys_dup2 (int, int); +int sys_read (int, char *, unsigned int); +int sys_write (int, const void *, unsigned int); +struct tm *sys_localtime (const time_t *); + +#ifdef HAVE_MODULES +extern void dynlib_reset_last_error (void); +#endif + #include "lisp.h" #include "epaths.h" /* for PATH_EXEC */ @@ -227,6 +245,7 @@ typedef struct _REPARSE_DATA_BUFFER { #include #include +#include /* for fdutimens */ #include "w32.h" #include @@ -246,7 +265,6 @@ typedef struct _REPARSE_DATA_BUFFER { typedef HRESULT (WINAPI * ShGetFolderPath_fn) (IN HWND, IN int, IN HANDLE, IN DWORD, OUT char *); -void globals_of_w32 (void); static DWORD get_rid (PSID); static int is_symlink (const char *); static char * chase_symlinks (const char *); @@ -512,6 +530,8 @@ static Lisp_Object ltime (ULONGLONG); /* Get total user and system times for get-internal-run-time. Returns a list of integers if the times are provided by the OS (NT derivatives), otherwise it returns the result of current-time. */ +Lisp_Object w32_get_internal_run_time (void); + Lisp_Object w32_get_internal_run_time (void) { @@ -2491,7 +2511,7 @@ sys_putenv (char *str) #define REG_ROOT "SOFTWARE\\GNU\\Emacs" LPBYTE -w32_get_resource (char *key, LPDWORD lpdwtype) +w32_get_resource (const char *key, LPDWORD lpdwtype) { LPBYTE lpvalue; HKEY hrootkey = NULL; @@ -2600,8 +2620,8 @@ init_environment (char ** argv) static const struct env_entry { - char * name; - char * def_value; + const char * name; + const char * def_value; } dflt_envvars[] = { /* If the default value is NULL, we will use the value from the @@ -2761,14 +2781,14 @@ init_environment (char ** argv) { /* If not found in any directory, use the default as the last resort. */ - lpval = env_vars[i].def_value; + lpval = (char *)env_vars[i].def_value; dwType = REG_EXPAND_SZ; } } while (*pstart); } else { - lpval = env_vars[i].def_value; + lpval = (char *)env_vars[i].def_value; dwType = REG_EXPAND_SZ; } if (strcmp (env_vars[i].name, "HOME") == 0 && !appdata) @@ -2786,7 +2806,7 @@ init_environment (char ** argv) if (dwType == REG_EXPAND_SZ) ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof (buf1)); else if (dwType == REG_SZ) - strcpy (buf1, lpval); + strcpy (buf1, (char *)lpval); if (dwType == REG_EXPAND_SZ || dwType == REG_SZ) { _snprintf (buf2, sizeof (buf2)-1, "%s=%s", env_vars[i].name, @@ -2961,7 +2981,7 @@ char * sys_ctime (const time_t *t) { char *str = (char *) ctime (t); - return (str ? str : "Sun Jan 01 00:00:00 1970"); + return (str ? str : (char *)"Sun Jan 01 00:00:00 1970"); } /* Emulate sleep...we could have done this with a define, but that @@ -3225,6 +3245,8 @@ is_fat_volume (const char * name, const char ** pPath) /* Convert all slashes in a filename to backslashes, and map filename to a valid 8.3 name if necessary. The result is a pointer to a static buffer, so CAVEAT EMPTOR! */ +const char *map_w32_filename (const char *, const char **); + const char * map_w32_filename (const char * name, const char ** pPath) { @@ -4430,7 +4452,7 @@ sys_rename_replace (const char *oldname, const char *newname, BOOL force) { /* Force temp name to require a manufactured 8.3 alias - this seems to make the second rename work properly. */ - sprintf (p, "_.%s.%u", o, i); + sprintf (p, "_.%s.%d", o, i); i++; result = rename (oldname_a, temp_a); } @@ -4858,6 +4880,8 @@ get_file_owner_and_group (PSECURITY_DESCRIPTOR psd, struct stat *st) } /* Return non-zero if NAME is a potentially slow filesystem. */ +int is_slow_fs (const char *); + int is_slow_fs (const char *name) { @@ -7215,6 +7239,8 @@ BOOL (WINAPI *pfn_SetHandleInformation) (HANDLE object, DWORD mask, DWORD flags) HANDLE winsock_lib; static int winsock_inuse; +BOOL term_winsock (void); + BOOL term_winsock (void) { @@ -7372,7 +7398,7 @@ check_errno (void) /* Extend strerror to handle the winsock-specific error codes. */ struct { int errnum; - char * msg; + const char * msg; } _wsa_errlist[] = { {WSAEINTR , "Interrupted function call"}, {WSAEBADF , "Bad file descriptor"}, @@ -7456,7 +7482,7 @@ sys_strerror (int error_no) for (i = 0; _wsa_errlist[i].errnum >= 0; i++) if (_wsa_errlist[i].errnum == error_no) - return _wsa_errlist[i].msg; + return (char *)_wsa_errlist[i].msg; sprintf (unknown_msg, "Unidentified error: %d", error_no); return unknown_msg; @@ -8905,8 +8931,6 @@ sys_write (int fd, const void * buffer, unsigned int count) /* Emulation of SIOCGIFCONF and getifaddrs, see process.c. */ -extern Lisp_Object conv_sockaddr_to_lisp (struct sockaddr *, ptrdiff_t); - /* Return information about network interface IFNAME, or about all interfaces (if IFNAME is nil). */ static Lisp_Object @@ -9619,7 +9643,6 @@ globals_of_w32 (void) w32_unicode_filenames = 1; #ifdef HAVE_MODULES - extern void dynlib_reset_last_error (void); dynlib_reset_last_error (); #endif diff --git a/src/w32.h b/src/w32.h index 42a1c42..702bb52 100644 --- a/src/w32.h +++ b/src/w32.h @@ -162,7 +162,7 @@ extern void reset_standard_handles (int in, int out, int err, HANDLE handles[4]); /* Return the string resource associated with KEY of type TYPE. */ -extern LPBYTE w32_get_resource (char * key, LPDWORD type); +extern LPBYTE w32_get_resource (const char * key, LPDWORD type); extern void release_listen_threads (void); extern void init_ntproc (int); diff --git a/src/w32console.c b/src/w32console.c index 82ba4b1..98343a6 100644 --- a/src/w32console.c +++ b/src/w32console.c @@ -35,6 +35,10 @@ along with GNU Emacs. If not, see . */ #include "w32common.h" /* for os_subtype */ #include "w32inevt.h" +#ifdef WINDOWSNT +#include "w32.h" /* for syms_of_ntterm */ +#endif + static void w32con_move_cursor (struct frame *f, int row, int col); static void w32con_clear_to_end (struct frame *f); static void w32con_clear_frame (struct frame *f); @@ -67,6 +71,8 @@ int w32_console_unicode_input; someone hits ^C in a 'suspended' session (child shell). Also ignore Ctrl-Break signals. */ +BOOL ctrl_c_handler (unsigned long); + BOOL ctrl_c_handler (unsigned long type) { @@ -509,11 +515,15 @@ w32con_update_end (struct frame * f) stubs from termcap.c ***********************************************************************/ +void sys_tputs (char *, int, int (*) (int)); + void sys_tputs (char *str, int nlines, int (*outfun) (int)) { } +char *sys_tgetstr (char *, char **); + char * sys_tgetstr (char *cap, char **area) { @@ -528,33 +538,45 @@ sys_tgetstr (char *cap, char **area) struct tty_display_info *current_tty = NULL; int cost = 0; +int evalcost (int); + int evalcost (int c) { return c; } +int cmputc (int); + int cmputc (int c) { return c; } +void cmcheckmagic (struct tty_display_info *); + void cmcheckmagic (struct tty_display_info *tty) { } +void cmcostinit (struct tty_display_info *); + void cmcostinit (struct tty_display_info *tty) { } +void cmgoto (struct tty_display_info *, int, int); + void cmgoto (struct tty_display_info *tty, int row, int col) { } +void Wcm_clear (struct tty_display_info *); + void Wcm_clear (struct tty_display_info *tty) { diff --git a/src/w32fns.c b/src/w32fns.c index 7a1f84a..fa45b47 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -74,15 +74,10 @@ along with GNU Emacs. If not, see . */ #define FOF_NO_CONNECTED_ELEMENTS 0x2000 #endif -void syms_of_w32fns (void); -void globals_of_w32fns (void); - -extern void free_frame_menubar (struct frame *); extern int w32_console_toggle_lock_key (int, Lisp_Object); extern void w32_menu_display_help (HWND, HMENU, UINT, UINT); extern void w32_free_menu_strings (HWND); extern const char *map_w32_filename (const char *, const char **); -extern char * w32_strerror (int error_no); #ifndef IDC_HAND #define IDC_HAND MAKEINTRESOURCE(32649) @@ -222,7 +217,6 @@ static HWND w32_visible_system_caret_hwnd; static int w32_unicode_gui; /* From w32menu.c */ -extern HMENU current_popup_menu; int menubar_in_use = 0; /* From w32uniscribe.c */ @@ -365,10 +359,7 @@ void x_set_cursor_type (struct frame *, Lisp_Object, Lisp_Object); void x_set_icon_type (struct frame *, Lisp_Object, Lisp_Object); void x_set_icon_name (struct frame *, Lisp_Object, Lisp_Object); void x_explicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); -void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); void x_set_title (struct frame *, Lisp_Object, Lisp_Object); -void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object); -void x_set_internal_border_width (struct frame *f, Lisp_Object, Lisp_Object); /* Store the screen positions of frame F into XPTR and YPTR. @@ -491,7 +482,7 @@ if the entry is new. */) /* The default colors for the w32 color map */ typedef struct colormap_t { - char *name; + const char *name; COLORREF colorref; } colormap_t; @@ -829,7 +820,7 @@ add_system_logical_colors_to_map (Lisp_Object *system_colors) NULL, NULL, (LPBYTE)color_buffer, &color_size) == ERROR_SUCCESS) { - int r, g, b; + unsigned r, g, b; if (sscanf (color_buffer, " %u %u %u", &r, &g, &b) == 3) *system_colors = Fcons (Fcons (build_string (full_name_buffer), make_number (RGB (r, g, b))), @@ -1244,7 +1235,7 @@ w32_defined_color (struct frame *f, const char *color, XColor *color_def, If F is not a color screen, return DEF (default) regardless of what ARG says. */ -int +static int x_decode_color (struct frame *f, Lisp_Object arg, int def) { XColor cdef; @@ -1527,7 +1518,7 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) Note that this does not fully take effect if done before F has a window. */ -void +static void x_set_border_pixel (struct frame *f, int pix) { @@ -1638,7 +1629,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) #endif } -void +static void x_clear_under_internal_border (struct frame *f) { int border = FRAME_INTERNAL_BORDER_WIDTH (f); @@ -1864,7 +1855,7 @@ w32_set_title_bar_text (struct frame *f, Lisp_Object name) suggesting a new name, which lisp code should override; if F->explicit_name is set, ignore the new name; otherwise, set it. */ -void +static void x_set_name (struct frame *f, Lisp_Object name, bool explicit) { /* Make sure that requests from lisp code override requests from @@ -1969,6 +1960,8 @@ x_set_scroll_bar_default_height (struct frame *f) /* Subroutines for creating a frame. */ +Cursor w32_load_cursor (LPCTSTR); + Cursor w32_load_cursor (LPCTSTR name) { @@ -2189,8 +2182,8 @@ funhook (int code, WPARAM w, LPARAM l) can prevent this by setting the w32-pass-[lr]window-to-system variable to NIL. */ - if (hs->vkCode == VK_LWIN && !NILP (Vw32_pass_lwindow_to_system) || - hs->vkCode == VK_RWIN && !NILP (Vw32_pass_rwindow_to_system)) + if (hs->vkCode == (VK_LWIN && !NILP (Vw32_pass_lwindow_to_system)) || + (hs->vkCode == VK_RWIN && !NILP (Vw32_pass_rwindow_to_system))) { /* Not prevented - Simulate the keypress to the system. */ memset (inputs, 0, sizeof (inputs)); @@ -2236,8 +2229,8 @@ funhook (int code, WPARAM w, LPARAM l) /* Some other key was pressed while a captured Win key is down. This is either an Emacs registered hotkey combination, or a system hotkey. */ - if (kbdhook.lwindown && kbdhook.lwin_hooked[hs->vkCode] || - kbdhook.rwindown && kbdhook.rwin_hooked[hs->vkCode]) + if ((kbdhook.lwindown && kbdhook.lwin_hooked[hs->vkCode]) || + (kbdhook.rwindown && kbdhook.rwin_hooked[hs->vkCode])) { /* Hooked Win-x combination, do not pass the keypress to Windows. */ kbdhook.suppress_lone = 1; @@ -2375,7 +2368,7 @@ remove_w32_kbdhook (void) /* Mark a specific key combination as hooked, preventing it to be handled by the system. */ -void +static void hook_w32_key (int hook, int modifier, int vkey) { char *tbl = NULL; @@ -2445,7 +2438,7 @@ check_w32_winkey_state (int vkey) leaves the Win key(s) "down" from the hook's point of view - the keyup event is never seen. Thus, this function must be called when the system is locked. */ -void +static void reset_w32_kbdhook_state (void) { kbdhook.lwindown = 0; @@ -2652,6 +2645,7 @@ modifier_set (int vkey) /* Convert between the modifier bits W32 uses and the modifier bits Emacs uses. */ +unsigned int w32_key_to_modifier (int); unsigned int w32_key_to_modifier (int key) @@ -2750,6 +2744,8 @@ w32_get_key_modifiers (unsigned int wparam, unsigned int lparam) return mods; } +unsigned int map_keypad_keys (unsigned int, unsigned int); + unsigned int map_keypad_keys (unsigned int virt_key, unsigned int extended) { @@ -3122,6 +3118,8 @@ cancel_all_deferred_msgs (void) PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0); } +DWORD WINAPI w32_msg_worker (void *); + DWORD WINAPI w32_msg_worker (void *arg) { @@ -3340,7 +3338,7 @@ get_wm_chars (HWND aWnd, int *buf, int buflen, int ignore_ctrl, int ctrl, Be ready to treat the case when this delivers WM_(SYS)DEADCHAR. */ static int after_deadkey = -1; -int +static int deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam, UINT lParam, int legacy_alt_meta) { @@ -5267,7 +5265,7 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms) if (!STRINGP (font)) { int i; - static char *names[] + static const char *names[] = { "Courier New-10", "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1", "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1", @@ -5610,8 +5608,10 @@ This function is an internal primitive--use `make-frame' instead. */) else if (! NILP (visibility)) x_make_frame_visible (f); else - /* Must have been Qnil. */ - ; + { + /* Must have been Qnil. */ + ; + } } /* Initialize `default-minibuffer-frame' in case this is the first @@ -6154,11 +6154,13 @@ SOUND is nil to use the normal beep. */) return sound; } +#if 0 /* unused */ int x_screen_planes (register struct frame *f) { return FRAME_DISPLAY_INFO (f)->n_planes; } +#endif /* Return the display structure for the display named NAME. Open a new connection if necessary. */ @@ -6886,12 +6888,12 @@ A tooltip's maximum size is specified by `x-max-tooltip-size'. Text larger than the specified size is clipped. */) (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy) { - struct frame *f, *tip_f; + struct frame *tip_f; struct window *w; int root_x, root_y; struct buffer *old_buffer; struct text_pos pos; - int i, width, height; + int width, height; int old_windows_or_buffers_changed = windows_or_buffers_changed; ptrdiff_t count = SPECPDL_INDEX (); ptrdiff_t count_1; @@ -6900,7 +6902,7 @@ Text larger than the specified size is clipped. */) specbind (Qinhibit_redisplay, Qt); CHECK_STRING (string); - f = decode_window_system_frame (frame); + decode_window_system_frame (frame); if (NILP (timeout)) timeout = make_number (5); else @@ -8032,8 +8034,8 @@ lookup_vk_code (char *key) /* Alphanumerics map to themselves. */ if (key[1] == 0) { - if (key[0] >= 'A' && key[0] <= 'Z' || - key[0] >= '0' && key[0] <= '9') + if ((key[0] >= 'A' && key[0] <= 'Z') + || (key[0] >= '0' && key[0] <= '9')) return key[0]; if (key[0] >= 'a' && key[0] <= 'z') return toupper(key[0]); @@ -8667,7 +8669,7 @@ The following %-sequences are provided: else { long m; - float h; + double h; char buffer[16]; snprintf (buffer, 16, "%ld", seconds_left); seconds = build_string (buffer); @@ -8968,6 +8970,8 @@ w32_strerror (int error_no) /* For convenience when debugging. (You cannot call GetLastError directly from GDB: it will crash, because it uses the __stdcall calling convention, not the _cdecl convention assumed by GDB.) */ +DWORD w32_last_error (void); + DWORD w32_last_error (void) { @@ -9618,7 +9622,7 @@ usage: (w32-notification-notify &rest PARAMS) */) EMACS_INT retval; char *icon, *tip, *title, *msg; enum NI_Severity severity; - unsigned timeout; + unsigned timeout = 0; if (nargs == 0) return Qnil; @@ -9630,14 +9634,14 @@ usage: (w32-notification-notify &rest PARAMS) */) if (STRINGP (lres)) icon = SSDATA (ENCODE_FILE (Fexpand_file_name (lres, Qnil))); else - icon = ""; + icon = (char *)""; /* Tip. */ lres = Fplist_get (arg_plist, QCtip); if (STRINGP (lres)) tip = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1)); else - tip = "Emacs notification"; + tip = (char *)"Emacs notification"; /* Severity. */ lres = Fplist_get (arg_plist, QClevel); @@ -9657,14 +9661,14 @@ usage: (w32-notification-notify &rest PARAMS) */) if (STRINGP (lres)) title = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1)); else - title = ""; + title = (char *)""; /* Notification body text. */ lres = Fplist_get (arg_plist, QCbody); if (STRINGP (lres)) msg = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1)); else - msg = ""; + msg = (char *)""; /* Do it! */ retval = add_tray_notification (f, icon, tip, severity, timeout, title, msg); @@ -10254,7 +10258,7 @@ typedef USHORT (WINAPI * CaptureStackBackTrace_proc) (ULONG, ULONG, PVOID *, #define BACKTRACE_LIMIT_MAX 62 -int +static int w32_backtrace (void **buffer, int limit) { static CaptureStackBackTrace_proc s_pfn_CaptureStackBackTrace = NULL; diff --git a/src/w32font.c b/src/w32font.c index 018e657..b8884a5 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -102,7 +102,6 @@ static void list_all_matching_fonts (struct font_callback_data *); static BOOL g_b_init_get_outline_metrics_w; static BOOL g_b_init_get_text_metrics_w; static BOOL g_b_init_get_glyph_outline_w; -static BOOL g_b_init_get_glyph_outline_w; static BOOL g_b_init_get_char_width_32_w; typedef UINT (WINAPI * GetOutlineTextMetricsW_Proc) ( @@ -1688,7 +1687,7 @@ w32_to_x_charset (int fncharset, char *matching) /* Handle startup case of w32-charset-info-alist not being set up yet. */ if (NILP (Vw32_charset_info_alist)) - return "iso8859-1"; + return (char *)"iso8859-1"; charset_type = Qw32_charset_ansi; break; case DEFAULT_CHARSET: @@ -2355,7 +2354,7 @@ w32font_full_name (LOGFONT * font, Lisp_Object font_obj, { if (outline) { - float pointsize = height * 72.0 / one_w32_display_info.resy; + double pointsize = height * 72.0 / one_w32_display_info.resy; /* Round to nearest half point. floor is used, since round is not supported in MS library. */ pointsize = floor (pointsize * 2 + 0.5) / 2; diff --git a/src/w32font.h b/src/w32font.h index 728ad8b..0e2d0f7 100644 --- a/src/w32font.h +++ b/src/w32font.h @@ -84,7 +84,6 @@ int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec); Lisp_Object intern_font_name (char *); -extern void syms_of_w32font (void); extern void globals_of_w32font (void); #endif diff --git a/src/w32heap.c b/src/w32heap.c index 6643b43..658a8a5 100644 --- a/src/w32heap.c +++ b/src/w32heap.c @@ -189,7 +189,7 @@ free_fn the_free_fn; claims for new memory. Before dumping, we allocate space from the fixed size dumped_data[] array. */ -NTSTATUS NTAPI +static NTSTATUS NTAPI dumped_data_commit (PVOID Base, PVOID *CommitAddress, PSIZE_T CommitSize) { /* This is used before dumping. @@ -323,9 +323,9 @@ init_heap (void) /* FREEABLE_P checks if the block can be safely freed. */ #define FREEABLE_P(addr) \ - ((unsigned char *)(addr) > 0 \ - && ((unsigned char *)(addr) < dumped_data \ - || (unsigned char *)(addr) >= dumped_data + DUMPED_HEAP_SIZE)) + ((DWORD_PTR)(unsigned char *)(addr) > 0 \ + && ((unsigned char *)(addr) < dumped_data \ + || (unsigned char *)(addr) >= dumped_data + DUMPED_HEAP_SIZE)) void * malloc_after_dump (size_t size) @@ -708,7 +708,7 @@ mmap_realloc (void **var, size_t nbytes) if (memInfo.RegionSize < nbytes) { memset (&m2, 0, sizeof (m2)); - if (VirtualQuery (*var + memInfo.RegionSize, &m2, sizeof(m2)) == 0) + if (VirtualQuery ((char *)*var + memInfo.RegionSize, &m2, sizeof(m2)) == 0) DebPrint (("mmap_realloc: VirtualQuery error = %ld\n", GetLastError ())); /* If there is enough room in the current reserved area, then @@ -778,7 +778,7 @@ mmap_realloc (void **var, size_t nbytes) } /* We still can decommit pages. */ - if (VirtualFree (*var + nbytes + get_page_size(), + if (VirtualFree ((char *)*var + nbytes + get_page_size(), memInfo.RegionSize - nbytes - get_page_size(), MEM_DECOMMIT) == 0) DebPrint (("mmap_realloc: VirtualFree error %ld\n", GetLastError ())); diff --git a/src/w32heap.h b/src/w32heap.h index 523bceb..4f2d6c8 100644 --- a/src/w32heap.h +++ b/src/w32heap.h @@ -61,10 +61,10 @@ int open_output_file (file_data *p_file, char *name, unsigned long size); void close_file_data (file_data *p_file); /* Return pointer to section header for named section. */ -IMAGE_SECTION_HEADER * find_section (char * name, IMAGE_NT_HEADERS * nt_header); +IMAGE_SECTION_HEADER * find_section (const char *, IMAGE_NT_HEADERS *); /* Return pointer to section header for section containing the given relative virtual address. */ -IMAGE_SECTION_HEADER * rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header); +IMAGE_SECTION_HEADER * rva_to_section (DWORD_PTR, IMAGE_NT_HEADERS *); #endif /* NTHEAP_H_ */ diff --git a/src/w32menu.c b/src/w32menu.c index d9ab8f5..fecbf33 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -60,9 +60,6 @@ along with GNU Emacs. If not, see . */ HMENU current_popup_menu; -void syms_of_w32menu (void); -void globals_of_w32menu (void); - typedef BOOL (WINAPI * GetMenuItemInfoA_Proc) ( IN HMENU, IN UINT, @@ -91,8 +88,6 @@ AppendMenuW_Proc unicode_append_menu = NULL; MessageBoxW_Proc unicode_message_box = NULL; #endif /* NTGUI_UNICODE */ -void set_frame_menubar (struct frame *, bool, bool); - #ifdef HAVE_DIALOGS static Lisp_Object w32_dialog_show (struct frame *, Lisp_Object, Lisp_Object, char **); #else @@ -172,6 +167,7 @@ x_activate_menubar (struct frame *f) when the user makes a selection. Figure out what the user chose and put the appropriate events into the keyboard buffer. */ +void menubar_selection_callback (struct frame *, void *); void menubar_selection_callback (struct frame *f, void * client_data) @@ -1111,7 +1107,7 @@ simple_dialog_show (struct frame *f, Lisp_Object contents, Lisp_Object header) } else { - text = L""; + text = (WCHAR *)L""; } if (NILP (header)) @@ -1465,6 +1461,8 @@ fill_in_menu (HMENU menu, widget_value *wv) /* Display help string for currently pointed to menu item. Not supported on NT 3.51 and earlier, as GetMenuItemInfo is not available. */ +void w32_menu_display_help (HWND, HMENU, UINT, UINT); + void w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags) { diff --git a/src/w32notify.c b/src/w32notify.c index 54d9bcc..d4a113a 100644 --- a/src/w32notify.c +++ b/src/w32notify.c @@ -123,7 +123,6 @@ static Lisp_Object watch_list; static void send_notifications (struct notifications_set *ns) { - int done = 0; struct frame *f = SELECTED_FRAME (); /* We add the current notification set to the linked list. Use the @@ -153,8 +152,10 @@ send_notifications (struct notifications_set *ns) /* When we are running in batch mode, there's no one to send a message, so we just signal the data is available and hope sys_select will be called soon and will read the data. */ +#if 0 else if (FRAME_INITIAL_P (f) && noninteractive) ; +#endif } /* An APC routine to cancel outstanding directory watch. Invoked by @@ -162,6 +163,8 @@ send_notifications (struct notifications_set *ns) thread that issued the ReadDirectoryChangesW call can call CancelIo to cancel that. (CancelIoEx is only available since Vista, so we cannot use it on XP.) */ +VOID CALLBACK watch_end (ULONG_PTR); + VOID CALLBACK watch_end (ULONG_PTR arg) { @@ -175,6 +178,8 @@ watch_end (ULONG_PTR arg) read by ReadDirectoryChangesW. Called by the OS when the thread which issued the asynchronous ReadDirectoryChangesW call is in the "alertable state", i.e. waiting inside SleepEx call. */ +VOID CALLBACK watch_completion (DWORD, DWORD, OVERLAPPED *); + VOID CALLBACK watch_completion (DWORD status, DWORD bytes_ret, OVERLAPPED *io_info) { diff --git a/src/w32proc.c b/src/w32proc.c index 4a6f786..11a121f 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -45,11 +45,6 @@ along with GNU Emacs. If not, see . */ #undef kill #include -#if defined(__GNUC__) && !defined(__MINGW64__) -/* This definition is missing from mingw.org headers, but not MinGW64 - headers. */ -extern BOOL WINAPI IsValidLocale (LCID, DWORD); -#endif #ifdef HAVE_LANGINFO_CODESET #include @@ -70,6 +65,10 @@ extern BOOL WINAPI IsValidLocale (LCID, DWORD); + ((DWORD_PTR)(var) - (section)->VirtualAddress) \ + (filedata).file_base)) +extern BOOL g_b_init_compare_string_w; +int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, + struct timespec *, void *); + /* Signal handlers...SIG_DFL == 0 so this is initialized correctly. */ static signal_handler sig_handlers[NSIG]; @@ -1728,7 +1727,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp) are not expanded if we run the program directly without a shell. Some extra whitespace characters need quoting in Cygwin/MSYS programs, so this list is conditionally modified below. */ - char *sepchars = " \t*?"; + const char *sepchars = " \t*?"; /* This is for native w32 apps; modified below for Cygwin/MSUS apps. */ char escape_char = '\\'; char cmdname_a[MAX_PATH]; @@ -2815,7 +2814,6 @@ set_process_dir (char * dir) /* From w32.c */ extern HANDLE winsock_lib; extern BOOL term_winsock (void); -extern BOOL init_winsock (int load_now); DEFUN ("w32-has-winsock", Fw32_has_winsock, Sw32_has_winsock, 0, 1, 0, doc: /* Test for presence of the Windows socket library `winsock'. @@ -3522,7 +3520,6 @@ w32_compare_strings (const char *s1, const char *s2, char *locname, LCID lcid = GetThreadLocale (); wchar_t *string1_w, *string2_w; int val, needed; - extern BOOL g_b_init_compare_string_w; static CompareStringW_Proc pCompareStringW; DWORD flags = 0; diff --git a/src/w32reg.c b/src/w32reg.c index a873818..25d6bb8 100644 --- a/src/w32reg.c +++ b/src/w32reg.c @@ -56,9 +56,9 @@ along with GNU Emacs. If not, see . */ */ static char * -w32_get_rdb_resource (char *rdb, const char *resource) +w32_get_rdb_resource (const char *rdb, const char *resource) { - char *value = rdb; + char *value = (char *)rdb; int len = strlen (resource); while (*value) diff --git a/src/w32select.c b/src/w32select.c index a29f5f6..a38a42c 100644 --- a/src/w32select.c +++ b/src/w32select.c @@ -76,6 +76,7 @@ along with GNU Emacs. If not, see . */ #include "lisp.h" #include "w32common.h" /* os_subtype */ #include "w32term.h" /* for all of the w32 includes */ +#include "w32select.h" #include "keyboard.h" /* for waiting_for_input */ #include "blockinput.h" #include "coding.h" diff --git a/src/w32term.c b/src/w32term.c index 14a43c1..c16c8f4 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -83,8 +83,6 @@ static int any_help_event_p; extern unsigned int msh_mousewheel; -extern void free_frame_menubar (struct frame *); - extern int w32_codepage_for_font (char *fontname); extern Cursor w32_load_cursor (LPCTSTR name); @@ -178,9 +176,7 @@ static void w32_define_cursor (Window, Cursor); void x_lower_frame (struct frame *); void x_scroll_bar_clear (struct frame *); -void x_wm_set_size_hint (struct frame *, long, bool); void x_raise_frame (struct frame *); -void x_set_window_size (struct frame *, bool, int, int, bool); void x_wm_set_window_state (struct frame *, int); void x_wm_set_icon_pixmap (struct frame *, int); static void w32_initialize (void); @@ -248,7 +244,7 @@ record_event (char *locus, int type) #endif /* 0 */ -void +static void XChangeGC (void *ignore, XGCValues *gc, unsigned long mask, XGCValues *xgcv) { @@ -270,12 +266,14 @@ XCreateGC (void *ignore, Window window, unsigned long mask, XGCValues *xgcv) return gc; } -void +#if 0 /* unused for now, see x_draw_image_glyph_string below */ +static void XGetGCValues (void *ignore, XGCValues *gc, unsigned long mask, XGCValues *xgcv) { XChangeGC (ignore, xgcv, mask, gc); } +#endif static void w32_set_clip_rectangle (HDC hdc, RECT *rect) @@ -321,7 +319,7 @@ w32_restore_glyph_string_clip (struct glyph_string *s) */ -void +static void w32_draw_underwave (struct glyph_string *s, COLORREF color) { int wave_height = 3, wave_length = 2; @@ -384,7 +382,7 @@ w32_draw_underwave (struct glyph_string *s, COLORREF color) } /* Draw a hollow rectangle at the specified position. */ -void +static void w32_draw_rectangle (HDC hdc, XGCValues *gc, int x, int y, int width, int height) { @@ -2579,7 +2577,7 @@ x_draw_glyph_string (struct glyph_string *s) /* Shift display to make room for inserted glyphs. */ -void +static void w32_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, int shift_by) { @@ -2876,13 +2874,15 @@ w32_detect_focus_change (struct w32_display_info *dpyinfo, W32Msg *event, } +#if 0 /* unused */ /* Handle an event saying the mouse has moved out of an Emacs frame. */ -void +static void x_mouse_leave (struct w32_display_info *dpyinfo) { x_new_focus_frame (dpyinfo, dpyinfo->w32_focus_event_frame); } +#endif /* The focus has changed, or we have redirected a frame's focus to another frame (this happens when a frame uses a surrogate @@ -4550,6 +4550,8 @@ static char dbcs_lead = 0; recursively with different messages by the system. */ +extern void menubar_selection_callback (struct frame *, void *); + static int w32_read_socket (struct terminal *terminal, struct input_event *hold_quit) @@ -5281,8 +5283,6 @@ w32_read_socket (struct terminal *terminal, if (f) { - extern void menubar_selection_callback - (struct frame *f, void * client_data); menubar_selection_callback (f, (void *)msg.msg.wParam); } @@ -5899,7 +5899,7 @@ xim_close_dpy (dpyinfo) /* Calculate the absolute position in frame F from its current recorded position values and gravity. */ -void +static void x_calc_absolute_position (struct frame *f) { int flags = f->size_hint_flags; @@ -6575,7 +6575,7 @@ x_free_frame_resources (struct frame *f) /* Destroy the window of frame F. */ -void +static void x_destroy_window (struct frame *f) { struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); diff --git a/src/w32term.h b/src/w32term.h index 8585c81..e134da5 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -230,25 +230,14 @@ extern struct frame *x_window_to_frame (struct w32_display_info *, HWND); struct w32_display_info *x_display_info_for_name (Lisp_Object); -Lisp_Object display_x_get_resource (struct w32_display_info *, - Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object); - /* also defined in xterm.h XXX: factor out to common header */ extern struct w32_display_info *w32_term_init (Lisp_Object, char *, char *); extern int w32_defined_color (struct frame *f, const char *color, XColor *color_def, bool alloc_p); -extern void x_set_window_size (struct frame *f, bool change_gravity, - int width, int height, bool pixelwise); extern int x_display_pixel_height (struct w32_display_info *); extern int x_display_pixel_width (struct w32_display_info *); -extern Lisp_Object x_get_focus_frame (struct frame *); -extern void x_make_frame_visible (struct frame *f); -extern void x_make_frame_invisible (struct frame *f); -extern void x_iconify_frame (struct frame *f); -extern void x_set_frame_alpha (struct frame *f); extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); extern void x_set_tool_bar_lines (struct frame *f, Lisp_Object value, @@ -256,19 +245,12 @@ extern void x_set_tool_bar_lines (struct frame *f, extern void x_set_internal_border_width (struct frame *f, Lisp_Object value, Lisp_Object oldval); -extern void x_activate_menubar (struct frame *); -extern bool x_bitmap_icon (struct frame *, Lisp_Object); extern void initialize_frame_menubar (struct frame *); -extern void x_free_frame_resources (struct frame *); -extern void x_real_positions (struct frame *, int *, int *); /* w32inevt.c */ extern int w32_kbd_patch_key (KEY_EVENT_RECORD *event, int cpId); extern int w32_kbd_mods_to_emacs (DWORD mods, WORD key); - -extern Lisp_Object x_get_focus_frame (struct frame *); - /* w32console.c */ extern void w32con_hide_cursor (void); extern void w32con_show_cursor (void); diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index ddca5f5..5f91b50 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -50,7 +50,7 @@ static int CALLBACK ALIGN_STACK add_opentype_font_name_to_list (ENUMLOGFONTEX *, NEWTEXTMETRICEX *, DWORD, LPARAM); /* Used by uniscribe_otf_capability. */ -static Lisp_Object otf_features (HDC context, char *table); +static Lisp_Object otf_features (HDC context, const char *table); static int memq_no_quit (Lisp_Object elt, Lisp_Object list) @@ -1042,7 +1042,7 @@ uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec) } static Lisp_Object -otf_features (HDC context, char *table) +otf_features (HDC context, const char *table) { Lisp_Object script_list = Qnil; unsigned short scriptlist_table, n_scripts, feature_table; @@ -1166,6 +1166,8 @@ struct font_driver uniscribe_font_driver = /* Note that this should be called at every startup, not just when dumping, as it needs to test for the existence of the Uniscribe library. */ +void syms_of_w32uniscribe (void); + void syms_of_w32uniscribe (void) { diff --git a/src/xfaces.c b/src/xfaces.c index c42e553..93d1c47 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -221,7 +221,6 @@ along with GNU Emacs. If not, see . */ #include TERM_HEADER #include "fontset.h" #ifdef HAVE_NTGUI -#define x_display_info w32_display_info #define GCGraphicsExposures 0 #endif /* HAVE_NTGUI */ commit 99848b37d2c3e14c0af45fc6da437a806aa58a80 Author: Eli Zaretskii Date: Sat May 21 12:35:08 2016 +0300 Fix 'vertical-motion' and 'posn-at-point' under 'visual-line-mode' * src/xdisp.c (move_it_in_display_line_to): Don't assume we can wrap on a whitespace character if it's followed by another whitespace character. When returning under WORD_WRAP for a screen line that is continued, restore to wrap point when atpos/atx position would be displayed on the next screen line due to line-wrap. (Bug#23570) diff --git a/src/xdisp.c b/src/xdisp.c index 10a0cf2..e78d3d6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -8810,6 +8810,8 @@ move_it_in_display_line_to (struct it *it, ? WINDOW_LEFT_FRINGE_WIDTH (it->w) : WINDOW_RIGHT_FRINGE_WIDTH (it->w))))) { + bool moved_forward = false; + if (/* IT->hpos == 0 means the very first glyph doesn't fit on the line, e.g. a wide image. */ it->hpos == 0 @@ -8828,16 +8830,37 @@ move_it_in_display_line_to (struct it *it, now that we know it fits in this row. */ if (BUFFER_POS_REACHED_P ()) { + bool can_wrap = true; + + /* If we are at a whitespace character + that barely fits on this screen line, + but the next character is also + whitespace, we cannot wrap here. */ + if (it->line_wrap == WORD_WRAP + && wrap_it.sp >= 0 + && may_wrap + && IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) + { + struct it tem_it; + void *tem_data = NULL; + + SAVE_IT (tem_it, *it, tem_data); + set_iterator_to_next (it, true); + if (get_next_display_element (it) + && IT_DISPLAYING_WHITESPACE (it)) + can_wrap = false; + RESTORE_IT (it, &tem_it, tem_data); + } if (it->line_wrap != WORD_WRAP || wrap_it.sp < 0 - /* If we've just found whitespace to - wrap, effectively ignore the - previous wrap point -- it is no - longer relevant, but we won't - have an opportunity to update it, - since we've reached the edge of - this screen line. */ - || (may_wrap + /* If we've just found whitespace + where we can wrap, effectively + ignore the previous wrap point -- + it is no longer relevant, but we + won't have an opportunity to + update it, since we've reached + the edge of this screen line. */ + || (may_wrap && can_wrap && IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))) { it->hpos = hpos_before_this_char; @@ -8880,6 +8903,7 @@ move_it_in_display_line_to (struct it *it, result = MOVE_POS_MATCH_OR_ZV; break; } + moved_forward = true; if (BUFFER_POS_REACHED_P ()) { if (ITERATOR_AT_END_OF_LINE_P (it)) @@ -8907,7 +8931,14 @@ move_it_in_display_line_to (struct it *it, longer relevant, but we won't have an opportunity to update it, since we are done with this screen line. */ - if (may_wrap && IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) + if (may_wrap && IT_OVERFLOW_NEWLINE_INTO_FRINGE (it) + /* If the character after the one which set the + may_wrap flag is also whitespace, we can't + wrap here, since the screen line cannot be + wrapped in the middle of whitespace. + Therefore, wrap_it _is_ relevant in that + case. */ + && !(moved_forward && IT_DISPLAYING_WHITESPACE (it))) { /* If we've found TO_X, go back there, as we now know the last word fits on this screen line. */ @@ -9088,9 +9119,18 @@ move_it_in_display_line_to (struct it *it, #undef BUFFER_POS_REACHED_P - /* If we scanned beyond to_pos and didn't find a point to wrap at, - restore the saved iterator. */ - if (atpos_it.sp >= 0) + /* If we scanned beyond TO_POS, restore the saved iterator either to + the wrap point (if found), or to atpos/atx location. We decide which + data to use to restore the saved iterator state by their X coordinates, + since buffer positions might increase non-monotonically with screen + coordinates due to bidi reordering. */ + if (result == MOVE_LINE_CONTINUED + && it->line_wrap == WORD_WRAP + && wrap_it.sp >= 0 + && ((atpos_it.sp >= 0 && wrap_it.current_x < atpos_it.current_x) + || (atx_it.sp >= 0 && wrap_it.current_x < atx_it.current_x))) + RESTORE_IT (it, &wrap_it, wrap_data); + else if (atpos_it.sp >= 0) RESTORE_IT (it, &atpos_it, atpos_data); else if (atx_it.sp >= 0) RESTORE_IT (it, &atx_it, atx_data);