diff options
79 files changed, 2338 insertions, 90 deletions
diff --git a/INSTALL.REPO b/INSTALL.REPO index 3431ee480bf..61b16340d35 100644 --- a/INSTALL.REPO +++ b/INSTALL.REPO | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | Copyright (C) 2002-2015 Free Software Foundation, Inc. | ||
| 2 | See the end of the file for license conditions. | ||
| 3 | |||
| 4 | |||
| 1 | Building and Installing Emacs from the Repository | 5 | Building and Installing Emacs from the Repository |
| 2 | 6 | ||
| 3 | Simply run 'make'. This should work if your files are freshly checked | 7 | Simply run 'make'. This should work if your files are freshly checked |
diff --git a/admin/notes/lel-TODO b/admin/notes/lel-TODO new file mode 100644 index 00000000000..c59e9200dfa --- /dev/null +++ b/admin/notes/lel-TODO | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | Some lisp/emacs-lisp/ Features and Where They Are Documented | ||
| 2 | |||
| 3 | Copyright (C) 2007-2015 Free Software Foundation, Inc. | ||
| 4 | See the end of the file for license conditions. | ||
| 5 | |||
| 6 | |||
| 7 | * Status Key | ||
| 8 | - -- as yet unknown | ||
| 9 | n/a -- not applicable (internal, uninteresting, etc) | ||
| 10 | obsolete -- an obsolete feature, to be removed in future | ||
| 11 | todo -- not documented but should be | ||
| 12 | NODE -- documented in or under info node NODE | ||
| 13 | |||
| 14 | |||
| 15 | * Features | ||
| 16 | advice (elisp) Advising Functions | ||
| 17 | advice-preload n/a | ||
| 18 | assoc - | ||
| 19 | authors - | ||
| 20 | autoload (elisp) Autoload | ||
| 21 | avl-tree - | ||
| 22 | backquote n/a | ||
| 23 | benchmark n/a | ||
| 24 | bindat (elisp) Byte Packing | ||
| 25 | byte-compile (elisp) Byte Compilation | ||
| 26 | byte-opt - | ||
| 27 | bytecomp (elisp) Compilation Functions | ||
| 28 | checkdoc (elisp) Documentation Tips | ||
| 29 | cl (cl) | ||
| 30 | cl-compat n/a | ||
| 31 | cl-specs n/a | ||
| 32 | copyright - | ||
| 33 | crm - | ||
| 34 | cust-print (elisp) Printing in Edebug | ||
| 35 | debug (elisp) Debugger | ||
| 36 | derived (elisp) Derived Modes | ||
| 37 | disass (elisp) Disassembly | ||
| 38 | easy-mmode (elisp) Defining Minor Modes | ||
| 39 | easymenu - | ||
| 40 | edebug (elisp) Edebug | ||
| 41 | eldoc - | ||
| 42 | elint - | ||
| 43 | elp n/a | ||
| 44 | ewoc (elisp) Separated Rendering | ||
| 45 | find-func - | ||
| 46 | find-gc - | ||
| 47 | generic (elisp) Generic Modes | ||
| 48 | gulp n/a | ||
| 49 | helper - | ||
| 50 | levents obsolete | ||
| 51 | lisp-float-type - | ||
| 52 | lisp-mnt - | ||
| 53 | lisp-mode n/a | ||
| 54 | lmenu obsolete | ||
| 55 | lucid obsolete | ||
| 56 | macroexp (elisp) Expansion | ||
| 57 | pp (emacs) Program Indent | ||
| 58 | re-builder - | ||
| 59 | regexp-opt (elisp) Regexp Functions | ||
| 60 | regi - | ||
| 61 | ring (elisp) Rings | ||
| 62 | rx - | ||
| 63 | shadow - | ||
| 64 | sregex obsolete | ||
| 65 | syntax (elisp) Position Parse | ||
| 66 | testcover - | ||
| 67 | timer (elisp) Timers | ||
| 68 | tq (elisp) Transaction Queues | ||
| 69 | trace - | ||
| 70 | unsafep (elisp) Function Safety | ||
| 71 | warnings (elisp) Warnings | ||
| 72 | |||
| 73 | |||
| 74 | * Above list created using default directory lisp/emacs-lisp/ with | ||
| 75 | (shell-command | ||
| 76 | "sed '/^(provide '\\''/!d;s// /;s/).*//' *.el | sort | uniq") | ||
| 77 | |||
| 78 | |||
| 79 | * How to use this file to improve Emacs | ||
| 80 | (loop | ||
| 81 | (let* ((feature (choose-one Features)) | ||
| 82 | (status (feature-status feature))) | ||
| 83 | (if (or (eq '- status) (not (verify status))) | ||
| 84 | (update feature (current-docs feature)) | ||
| 85 | (case status | ||
| 86 | (todo (let (doc patch feedback) | ||
| 87 | (while (not (grok feature)) | ||
| 88 | (or (play-with feature) | ||
| 89 | (grep feature Internet) | ||
| 90 | (grep feature (wisdom-maybe "emacs-devel")))) | ||
| 91 | (setq doc (write-documentation feature) | ||
| 92 | patch (diff (current-docs) doc)) | ||
| 93 | (while (not (and (correct doc) | ||
| 94 | (well-placed doc) | ||
| 95 | (well-formed patch))) | ||
| 96 | (setq doc (revise doc) | ||
| 97 | patch (diff (current-docs) doc)) | ||
| 98 | feedback (wisdom-maybe "emacs-devel" patch)) | ||
| 99 | (when (install patch) | ||
| 100 | (when (update feature (current-docs feature)) | ||
| 101 | (job-well-done user-login-name))))) | ||
| 102 | (n/a (job-well-done user-login-name)))))) | ||
| 103 | |||
| 104 | |||
| 105 | * Etc | ||
| 106 | |||
| 107 | This file is part of GNU Emacs. | ||
| 108 | |||
| 109 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 110 | it under the terms of the GNU General Public License as published by | ||
| 111 | the Free Software Foundation, either version 3 of the License, or | ||
| 112 | (at your option) any later version. | ||
| 113 | |||
| 114 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 115 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 116 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 117 | GNU General Public License for more details. | ||
| 118 | |||
| 119 | You should have received a copy of the GNU General Public License | ||
| 120 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 121 | |||
| 122 | Local variables: | ||
| 123 | mode: outline | ||
| 124 | End: | ||
diff --git a/doc/man/grep-changelog.1 b/doc/man/grep-changelog.1 new file mode 100644 index 00000000000..1a08c6c8bf0 --- /dev/null +++ b/doc/man/grep-changelog.1 | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | .\" -*- nroff -*- | ||
| 2 | .\" See section COPYING for copyright and redistribution information. | ||
| 3 | .TH grep-changelog 1 | ||
| 4 | .SH NAME | ||
| 5 | grep-changelog \- print ChangeLog entries matching criteria | ||
| 6 | .SH SYNOPSIS | ||
| 7 | .B grep-changelog | ||
| 8 | .RI [ options ] | ||
| 9 | .RI [ CHANGELOG .\|.\|.] | ||
| 10 | .SH DESCRIPTION | ||
| 11 | .B grep-changelog | ||
| 12 | searches the named | ||
| 13 | .IR CHANGELOG s | ||
| 14 | (by default files matching the regular expressions | ||
| 15 | .B ChangeLog | ||
| 16 | and | ||
| 17 | .BR "ChangeLog\e.[0-9]+" ) | ||
| 18 | for entries matching the specified criteria. At least one option or | ||
| 19 | file must be specified. This program is distributed with | ||
| 20 | .BR "GNU Emacs" . | ||
| 21 | .PP | ||
| 22 | .SH OPTIONS | ||
| 23 | The program accepts unambiguous abbreviations for option names. | ||
| 24 | .TP | ||
| 25 | .B \-\-author=AUTHOR | ||
| 26 | Print entries whose author matches regular expression | ||
| 27 | .IR AUTHOR . | ||
| 28 | .TP | ||
| 29 | .B \-\-text=TEXT | ||
| 30 | Print entries whose text matches regular expression | ||
| 31 | .IR TEXT . | ||
| 32 | .TP | ||
| 33 | .B \-\-exclude=TEXT | ||
| 34 | Exclude entries matching regular expression | ||
| 35 | .IR TEXT . | ||
| 36 | .TP | ||
| 37 | .B \-\-from\-date=YYYY\-MM\-DD | ||
| 38 | Only consider entries made on or after the given date. | ||
| 39 | ChangeLog date entries not in the | ||
| 40 | \*(lqYYYY\-MM\-DD\*(rq format are never matched. | ||
| 41 | .TP | ||
| 42 | .B \-\-to\-date=YYYY\-MM\-DD | ||
| 43 | Only consider entries made on or before the given date. | ||
| 44 | .TP | ||
| 45 | .B \-\-rcs\-log | ||
| 46 | Print output in a format suitable for RCS log entries. | ||
| 47 | This format removes author lines, leading spaces, and file names. | ||
| 48 | .TP | ||
| 49 | .B \-\-with\-date | ||
| 50 | In RCS log format, print short dates. | ||
| 51 | .TP | ||
| 52 | .B \-\-reverse | ||
| 53 | Show matches in reverse order. | ||
| 54 | .TP | ||
| 55 | .B \-\-version | ||
| 56 | Display version information. | ||
| 57 | .TP | ||
| 58 | .B \-\-help | ||
| 59 | Display basic usage information. | ||
| 60 | . | ||
| 61 | .SH COPYING | ||
| 62 | Copyright | ||
| 63 | .if t \(co | ||
| 64 | .if n (C) | ||
| 65 | 2008-2015 Free Software Foundation, Inc. | ||
| 66 | .PP | ||
| 67 | Permission is granted to make and distribute verbatim copies of this | ||
| 68 | document provided the copyright notice and this permission notice are | ||
| 69 | preserved on all copies. | ||
| 70 | .PP | ||
| 71 | Permission is granted to copy and distribute modified versions of | ||
| 72 | this document under the conditions for verbatim copying, provided that | ||
| 73 | the entire resulting derived work is distributed under the terms of | ||
| 74 | a permission notice identical to this one. | ||
| 75 | .PP | ||
| 76 | Permission is granted to copy and distribute translations of this | ||
| 77 | document into another language, under the above conditions for | ||
| 78 | modified versions, except that this permission notice may be stated | ||
| 79 | in a translation approved by the Free Software Foundation. | ||
| 80 | . | ||
diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index 8c1865d78a5..fd9f6f543e0 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | @copying | 8 | @copying |
| 9 | This file documents the GNU Emacs Web Wowser (EWW) package. | 9 | This file documents the GNU Emacs Web Wowser (EWW) package. |
| 10 | 10 | ||
| 11 | Copyright @copyright{} 2014-2015 Free Software Foundation, Inc. | 11 | Copyright @copyright{} 2014--2015 Free Software Foundation, Inc. |
| 12 | 12 | ||
| 13 | @quotation | 13 | @quotation |
| 14 | Permission is granted to copy, distribute and/or modify this document | 14 | Permission is granted to copy, distribute and/or modify this document |
diff --git a/doc/misc/info.texi b/doc/misc/info.texi index 0e2e64f2356..759956d21dc 100644 --- a/doc/misc/info.texi +++ b/doc/misc/info.texi | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | This file describes how to use Info, the menu-driven GNU | 15 | This file describes how to use Info, the menu-driven GNU |
| 16 | documentation system. | 16 | documentation system. |
| 17 | 17 | ||
| 18 | Copyright @copyright{} 1989, 1992, 1996--2014 Free Software Foundation, Inc. | 18 | Copyright @copyright{} 1989, 1992, 1996--2015 Free Software Foundation, Inc. |
| 19 | 19 | ||
| 20 | @quotation | 20 | @quotation |
| 21 | Permission is granted to copy, distribute and/or modify this document | 21 | Permission is granted to copy, distribute and/or modify this document |
diff --git a/etc/CONTRIBUTE b/etc/CONTRIBUTE new file mode 100644 index 00000000000..92b4c9e4ce2 --- /dev/null +++ b/etc/CONTRIBUTE | |||
| @@ -0,0 +1,227 @@ | |||
| 1 | Copyright (C) 2006-2015 Free Software Foundation, Inc. | ||
| 2 | See end for license conditions. | ||
| 3 | |||
| 4 | |||
| 5 | Contributing to Emacs | ||
| 6 | |||
| 7 | Emacs is a collaborative project and we encourage contributions from | ||
| 8 | anyone and everyone. If you want to contribute in the way that will | ||
| 9 | help us most, we recommend (1) fixing reported bugs and (2) | ||
| 10 | implementing the feature ideas in etc/TODO. However, if you think of | ||
| 11 | new features to add, please suggest them too -- we might like your | ||
| 12 | idea. Porting to new platforms is also useful, when there is a new | ||
| 13 | platform, but that is not common nowadays. | ||
| 14 | |||
| 15 | For documentation on how to develop Emacs changes, refer to the Emacs | ||
| 16 | Manual and the Emacs Lisp Reference Manual (both included in the Emacs | ||
| 17 | distribution). The web pages in http://www.gnu.org/software/emacs | ||
| 18 | contain additional information. | ||
| 19 | |||
| 20 | You may also want to submit your change so that can be considered for | ||
| 21 | inclusion in a future version of Emacs (see below). | ||
| 22 | |||
| 23 | If you don't feel up to hacking Emacs, there are many other ways to | ||
| 24 | help. You can answer questions on the mailing lists, write | ||
| 25 | documentation, find and report bugs, check if existing bug reports | ||
| 26 | are fixed in newer versions of Emacs, contribute to the Emacs web | ||
| 27 | pages, or develop a package that works with Emacs. | ||
| 28 | |||
| 29 | Here are some style and legal conventions for contributors to Emacs: | ||
| 30 | |||
| 31 | |||
| 32 | * Coding Standards | ||
| 33 | |||
| 34 | Contributed code should follow the GNU Coding Standards. | ||
| 35 | |||
| 36 | If it doesn't, we'll need to find someone to fix the code before we | ||
| 37 | can use it. | ||
| 38 | |||
| 39 | Emacs has certain additional style and coding conventions. | ||
| 40 | |||
| 41 | Ref: http://www.gnu.org/prep/standards/ | ||
| 42 | Ref: GNU Coding Standards Info Manual | ||
| 43 | Ref: The "Tips" Appendix in the Emacs Lisp Reference. | ||
| 44 | |||
| 45 | |||
| 46 | * Copyright Assignment | ||
| 47 | |||
| 48 | The FSF (Free Software Foundation) is the copyright holder for GNU Emacs. | ||
| 49 | The FSF is a nonprofit with a worldwide mission to promote computer | ||
| 50 | user freedom and to defend the rights of all free software users. | ||
| 51 | For general information, see the website http://www.fsf.org/ . | ||
| 52 | |||
| 53 | Generally speaking, for non-trivial contributions to GNU Emacs we | ||
| 54 | require that the copyright be assigned to the FSF. For the reasons | ||
| 55 | behind this, see: http://www.gnu.org/licenses/why-assign.html . | ||
| 56 | |||
| 57 | Copyright assignment is a simple process. Residents of some countries | ||
| 58 | can do it entirely electronically. We can help you get started, and | ||
| 59 | answer any questions you may have (or point you to the people with the | ||
| 60 | answers), at the emacs-devel@gnu.org mailing list. | ||
| 61 | |||
| 62 | (Please note: general discussion about why some GNU projects ask | ||
| 63 | for a copyright assignment is off-topic for emacs-devel. | ||
| 64 | See gnu-misc-discuss instead.) | ||
| 65 | |||
| 66 | A copyright disclaimer is also a possibility, but we prefer an assignment. | ||
| 67 | Note that the disclaimer, like an assignment, involves you sending | ||
| 68 | signed paperwork to the FSF (simply saying "this is in the public domain" | ||
| 69 | is not enough). Also, a disclaimer cannot be applied to future work, it | ||
| 70 | has to be repeated each time you want to send something new. | ||
| 71 | |||
| 72 | We can accept small changes (roughly, fewer than 15 lines) without | ||
| 73 | an assignment. This is a cumulative limit (e.g. three separate 5 line | ||
| 74 | patches) over all your contributions. | ||
| 75 | |||
| 76 | * Getting the Source Code | ||
| 77 | |||
| 78 | The latest version of the Emacs source code can be downloaded from the | ||
| 79 | Savannah web site. It is important to write your patch based on the | ||
| 80 | latest version. If you start from an older version, your patch may be | ||
| 81 | outdated (so that maintainers will have a hard time applying it), or | ||
| 82 | changes in Emacs may have made your patch unnecessary. | ||
| 83 | |||
| 84 | After you have downloaded the repository source, you should read the file | ||
| 85 | INSTALL.REPO for build instructions (they differ to some extent from a | ||
| 86 | normal build). | ||
| 87 | |||
| 88 | Ref: http://savannah.gnu.org/projects/emacs | ||
| 89 | |||
| 90 | |||
| 91 | * Submitting Patches | ||
| 92 | |||
| 93 | Every patch must have several pieces of information before we | ||
| 94 | can properly evaluate it. | ||
| 95 | |||
| 96 | When you have all these pieces, bundle them up in a mail message and | ||
| 97 | send it to the developers. Sending it to bug-gnu-emacs@gnu.org | ||
| 98 | (which is the bug/feature list) is recommended, because that list | ||
| 99 | is coupled to a tracking system that makes it easier to locate patches. | ||
| 100 | If your patch is not complete and you think it needs more discussion, | ||
| 101 | you might want to send it to emacs-devel@gnu.org instead. If you | ||
| 102 | revise your patch, send it as a followup to the initial topic. | ||
| 103 | |||
| 104 | ** Description | ||
| 105 | |||
| 106 | For bug fixes, a description of the bug and how your patch fixes it. | ||
| 107 | |||
| 108 | For new features, a description of the feature and your implementation. | ||
| 109 | |||
| 110 | ** ChangeLog | ||
| 111 | |||
| 112 | A ChangeLog entry as plaintext (separate from the patch). | ||
| 113 | |||
| 114 | See the existing ChangeLog files for format and content. Note that, | ||
| 115 | unlike some other projects, we do require ChangeLogs also for | ||
| 116 | documentation, i.e. Texinfo files. | ||
| 117 | |||
| 118 | Ref: "Change Log Concepts" node of the GNU Coding Standards Info | ||
| 119 | Manual, for how to write good log entries. | ||
| 120 | |||
| 121 | When using git, commit messages should use ChangeLog format, with a | ||
| 122 | single short line explaining the change, then an empty line, then | ||
| 123 | unindented ChangeLog entries. (Essentially, a commit message should | ||
| 124 | be a duplicate of what the patch adds to the ChangeLog files. We are | ||
| 125 | planning to automate this better, to avoid the duplication.) | ||
| 126 | |||
| 127 | ** The patch itself. | ||
| 128 | |||
| 129 | If you are accessing the Emacs repository, make sure your copy is | ||
| 130 | up-to-date (e.g. with 'git pull'). You can commit your changes | ||
| 131 | to a private branch and generate a patch from the master version | ||
| 132 | by using | ||
| 133 | git format-patch master | ||
| 134 | Or you can leave your changes uncommitted and use | ||
| 135 | git diff | ||
| 136 | With no repository, you can use | ||
| 137 | diff -u OLD NEW | ||
| 138 | |||
| 139 | ** Mail format. | ||
| 140 | |||
| 141 | We prefer to get the patches as plain text, either inline (be careful | ||
| 142 | your mail client does not change line breaks) or as MIME attachments. | ||
| 143 | |||
| 144 | ** Please reread your patch before submitting it. | ||
| 145 | |||
| 146 | ** Do not mix changes. | ||
| 147 | |||
| 148 | If you send several unrelated changes together, we will ask you to | ||
| 149 | separate them so we can consider each of the changes by itself. | ||
| 150 | |||
| 151 | ** Do not make formatting changes. | ||
| 152 | |||
| 153 | Making cosmetic formatting changes (indentation, etc) makes it harder | ||
| 154 | to see what you have really changed. | ||
| 155 | |||
| 156 | |||
| 157 | * Coding style and conventions. | ||
| 158 | |||
| 159 | ** Mandatory reading: | ||
| 160 | |||
| 161 | The "Tips and Conventions" Appendix of the Emacs Lisp Reference. | ||
| 162 | |||
| 163 | ** Avoid using `defadvice' or `eval-after-load' for Lisp code to be | ||
| 164 | included in Emacs. | ||
| 165 | |||
| 166 | ** Remove all trailing whitespace in all source and text files. | ||
| 167 | |||
| 168 | ** Use ?\s instead of ? in Lisp code for a space character. | ||
| 169 | |||
| 170 | |||
| 171 | * Supplemental information for Emacs Developers. | ||
| 172 | |||
| 173 | ** Write access to the Emacs repository. | ||
| 174 | |||
| 175 | Once you become a frequent contributor to Emacs, we can consider | ||
| 176 | giving you write access to the version-control repository. | ||
| 177 | |||
| 178 | |||
| 179 | ** Emacs Mailing lists. | ||
| 180 | |||
| 181 | Discussion about Emacs development takes place on emacs-devel@gnu.org. | ||
| 182 | |||
| 183 | Bug reports and fixes, feature requests and implementations should be | ||
| 184 | sent to bug-gnu-emacs@gnu.org, the bug/feature list. This is coupled | ||
| 185 | to the tracker at http://debbugs.gnu.org . | ||
| 186 | |||
| 187 | You can subscribe to the mailing lists, or see the list archives, | ||
| 188 | by following links from http://savannah.gnu.org/mail/?group=emacs . | ||
| 189 | |||
| 190 | ** Document your changes. | ||
| 191 | |||
| 192 | Any change that matters to end-users should have a NEWS entry. | ||
| 193 | |||
| 194 | Think about whether your change requires updating the documentation | ||
| 195 | (both manuals and doc-strings). If you know it does not, mark the NEWS | ||
| 196 | entry with "---". If you know that *all* the necessary documentation | ||
| 197 | updates have been made, mark the entry with "+++". Otherwise do not mark it. | ||
| 198 | |||
| 199 | ** Understanding Emacs Internals. | ||
| 200 | |||
| 201 | The best way to understand Emacs Internals is to read the code, | ||
| 202 | but the nodes "Tips" and "GNU Emacs Internals" in the Appendix | ||
| 203 | of the Emacs Lisp Reference Manual may also help. | ||
| 204 | |||
| 205 | The file etc/DEBUG describes how to debug Emacs bugs. | ||
| 206 | |||
| 207 | |||
| 208 | |||
| 209 | This file is part of GNU Emacs. | ||
| 210 | |||
| 211 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 212 | it under the terms of the GNU General Public License as published by | ||
| 213 | the Free Software Foundation, either version 3 of the License, or | ||
| 214 | (at your option) any later version. | ||
| 215 | |||
| 216 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 217 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 218 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 219 | GNU General Public License for more details. | ||
| 220 | |||
| 221 | You should have received a copy of the GNU General Public License | ||
| 222 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 223 | |||
| 224 | Local variables: | ||
| 225 | mode: outline | ||
| 226 | paragraph-separate: "[ ]*$" | ||
| 227 | end: | ||
diff --git a/etc/refcards/emacsver.tex b/etc/refcards/emacsver.tex new file mode 100644 index 00000000000..8b6e8c41e8b --- /dev/null +++ b/etc/refcards/emacsver.tex | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | %% This file is not generated by configure, because then the provided | ||
| 2 | %% pdf files would always appear out-of-date. | ||
| 3 | \def\versionemacs{24} % major version of emacs | ||
| 4 | \def\year{2015} % latest copyright year | ||
diff --git a/lib-src/grep-changelog b/lib-src/grep-changelog new file mode 100755 index 00000000000..3e08734d7e9 --- /dev/null +++ b/lib-src/grep-changelog | |||
| @@ -0,0 +1,265 @@ | |||
| 1 | #! /usr/bin/perl | ||
| 2 | |||
| 3 | # Copyright (C) 1999-2015 Free Software Foundation, Inc. | ||
| 4 | # | ||
| 5 | # This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | # GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | # it under the terms of the GNU General Public License as published by | ||
| 9 | # the Free Software Foundation, either version 3 of the License, or | ||
| 10 | # (at your option) any later version. | ||
| 11 | |||
| 12 | # GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | # GNU General Public License for more details. | ||
| 16 | |||
| 17 | # You should have received a copy of the GNU General Public License | ||
| 18 | # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | |||
| 20 | |||
| 21 | # Extract entries from ChangeLogs matching specified criteria. | ||
| 22 | # Optionally format the resulting output to a form suitable for RCS | ||
| 23 | # logs, like they are used in Emacs, for example. In this format, | ||
| 24 | # author lines, leading spaces, and file names are removed. | ||
| 25 | |||
| 26 | require 5; | ||
| 27 | use strict; | ||
| 28 | |||
| 29 | # Parse command line options. | ||
| 30 | |||
| 31 | use vars qw($author $regexp $exclude $from_date $to_date | ||
| 32 | $rcs_log $with_date $version $help $reverse | ||
| 33 | @entries); | ||
| 34 | |||
| 35 | use Getopt::Long; | ||
| 36 | |||
| 37 | my $result; | ||
| 38 | |||
| 39 | if (@ARGV == 0) { | ||
| 40 | |||
| 41 | # No arguments cannot possibly mean "show everything"!! | ||
| 42 | $result = 0; | ||
| 43 | |||
| 44 | } else { | ||
| 45 | |||
| 46 | $result = GetOptions ("author=s" => \$author, | ||
| 47 | "text=s" => \$regexp, | ||
| 48 | "exclude=s" => \$exclude, | ||
| 49 | "from-date=s" => \$from_date, | ||
| 50 | "to-date=s" => \$to_date, | ||
| 51 | "rcs-log" => \$rcs_log, | ||
| 52 | "with-date" => \$with_date, | ||
| 53 | "reverse!" => \$reverse, | ||
| 54 | "version" => \$version, | ||
| 55 | "help" => \$help); | ||
| 56 | |||
| 57 | # If date options are specified, check that they have the format | ||
| 58 | # YYYY-MM-DD. | ||
| 59 | |||
| 60 | $result = 0 if $from_date && $from_date !~ /^\d\d\d\d-\d\d-\d\d$/; | ||
| 61 | $result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/; | ||
| 62 | } | ||
| 63 | |||
| 64 | # Print usage information and exit when necessary. | ||
| 65 | |||
| 66 | if ($result == 0 || $help) { | ||
| 67 | print <<USAGE; | ||
| 68 | |||
| 69 | Usage: $0 [options] [CHANGELOG...] | ||
| 70 | |||
| 71 | Print entries in ChangeLogs matching various criteria. | ||
| 72 | Valid options are: | ||
| 73 | |||
| 74 | --author=AUTHOR Match entries whose author line matches | ||
| 75 | regular expression AUTHOR | ||
| 76 | --text=TEXT Match entries whose text matches regular | ||
| 77 | expression TEXT | ||
| 78 | --exclude=TEXT Exclude entries matching TEXT | ||
| 79 | --from-date=YYYY-MM-DD Match entries not older than given date | ||
| 80 | --to-date=YYYY-MM-DD Match entries not younger than given date | ||
| 81 | --rcs-log Format output suitable for RCS log entries | ||
| 82 | --with-date Print short date line in RCS log | ||
| 83 | --reverse Show entries in reverse (chronological) order | ||
| 84 | --version Print version info | ||
| 85 | --help Print this help | ||
| 86 | |||
| 87 | If no CHANGELOG is specified scan the files "ChangeLog" and | ||
| 88 | "ChangeLog.N+" in the current directory. Old-style dates in ChangeLogs | ||
| 89 | are not recognized. | ||
| 90 | USAGE | ||
| 91 | exit !$help; | ||
| 92 | } | ||
| 93 | |||
| 94 | # Print version info and exit if `--version' was specified. | ||
| 95 | |||
| 96 | if ($version) { | ||
| 97 | print "0.3\n"; | ||
| 98 | exit 0; | ||
| 99 | } | ||
| 100 | |||
| 101 | |||
| 102 | # Value is non-zero if HEADER matches according to command line | ||
| 103 | # options specified, i.e. it matches $author, and its date is in | ||
| 104 | # the range $from_date <= date <= $to_date. | ||
| 105 | |||
| 106 | sub header_match_p { | ||
| 107 | my $header = shift; | ||
| 108 | |||
| 109 | return 0 unless $header; | ||
| 110 | |||
| 111 | # No match if AUTHOR-regexp specified and doesn't match. | ||
| 112 | return 0 if $author && $header !~ /$author/; | ||
| 113 | |||
| 114 | # Check that the date of the entry matches if date options | ||
| 115 | # `--from-date' and/or `--to-date' were specified . Old-style | ||
| 116 | # dates in ChangeLogs are not recognized, and never match. | ||
| 117 | if ($from_date || $to_date) { | ||
| 118 | if ($header =~ /^(\d\d\d\d-\d\d-\d\d)/) { | ||
| 119 | my $date = $1; | ||
| 120 | return 0 if $from_date && $date lt $from_date; | ||
| 121 | return 0 if $to_date && $date gt $to_date; | ||
| 122 | } else { | ||
| 123 | # Don't bother recognizing old-style dates. | ||
| 124 | return 0; | ||
| 125 | } | ||
| 126 | } | ||
| 127 | |||
| 128 | return 1; | ||
| 129 | } | ||
| 130 | |||
| 131 | |||
| 132 | # Value is non-zero if ENTRY matches the criteria specified on the | ||
| 133 | # command line, i.e. it matches $regexp, and it doesn't match | ||
| 134 | # $exclude. | ||
| 135 | |||
| 136 | sub entry_match_p { | ||
| 137 | my $entry = shift; | ||
| 138 | |||
| 139 | return 0 unless $entry; | ||
| 140 | |||
| 141 | if ($regexp) { | ||
| 142 | return 1 if ($entry =~ /$regexp/ | ||
| 143 | && (!$exclude || $entry !~ $exclude)); | ||
| 144 | } else { | ||
| 145 | return 1 if !$exclude || $entry !~ $exclude; | ||
| 146 | } | ||
| 147 | |||
| 148 | return 0; | ||
| 149 | } | ||
| 150 | |||
| 151 | |||
| 152 | # Print HEADER and/or ENTRY in a format suitable for what was | ||
| 153 | # specified on the command line. If $rcs_log is specified, author | ||
| 154 | # lines are not printed, and leading spaces and file names are removed | ||
| 155 | # from ChangeLog entries. | ||
| 156 | |||
| 157 | sub print_log { | ||
| 158 | my ($header, $entry) = @_; | ||
| 159 | my $output = ''; | ||
| 160 | |||
| 161 | if ($rcs_log) { | ||
| 162 | # Remove leading whitespace from entry. | ||
| 163 | $entry =~ s/^\s+//mg; | ||
| 164 | # Remove file name parts. | ||
| 165 | $entry =~ s/^\*.*\(/(/mg; | ||
| 166 | # Remove file name parts, 2. | ||
| 167 | $entry =~ s/^\*.*://mg; | ||
| 168 | if ($with_date) { | ||
| 169 | $header =~ /(\d\d\d\d-\d\d-\d\d)/; | ||
| 170 | $output = "!changelog-date $1\n"; | ||
| 171 | } | ||
| 172 | $output .= $entry; | ||
| 173 | } else { | ||
| 174 | $output .= $header . $entry; | ||
| 175 | } | ||
| 176 | |||
| 177 | if ($reverse) { | ||
| 178 | push @entries, $output; | ||
| 179 | } else { | ||
| 180 | print $output; | ||
| 181 | } | ||
| 182 | } | ||
| 183 | |||
| 184 | # Scan LOG for matching entries, and print them to standard output. | ||
| 185 | |||
| 186 | sub parse_changelog { | ||
| 187 | my $log = shift; | ||
| 188 | my $entry = undef; | ||
| 189 | my $header = undef; | ||
| 190 | |||
| 191 | @entries = () if $reverse; | ||
| 192 | |||
| 193 | # Open the ChangeLog. | ||
| 194 | open (IN, "< $log") || die "Cannot open $log: $!"; | ||
| 195 | |||
| 196 | while (defined(my $line = <IN>)) { | ||
| 197 | if ($line =~ /^\S/) { | ||
| 198 | # Line is an author-line. Print previous entry if | ||
| 199 | # it matches. | ||
| 200 | print_log ($header, $entry) | ||
| 201 | if header_match_p ($header) && entry_match_p ($entry); | ||
| 202 | |||
| 203 | $entry = ""; | ||
| 204 | $header = $line; | ||
| 205 | |||
| 206 | # Add empty lines below the header. | ||
| 207 | while (defined($line = <IN>) && $line =~ /^\s*$/) { | ||
| 208 | $header = "$header$line"; | ||
| 209 | } | ||
| 210 | } | ||
| 211 | |||
| 212 | last unless defined $line; | ||
| 213 | |||
| 214 | if ($line =~ /^\s*\*/) { | ||
| 215 | # LINE is the first line of a ChangeLog entry. Print | ||
| 216 | # previous entry if it matches. | ||
| 217 | print_log ($header, $entry) | ||
| 218 | if header_match_p ($header) && entry_match_p ($entry); | ||
| 219 | $entry = $line; | ||
| 220 | } else { | ||
| 221 | # Add LINE to the current entry. | ||
| 222 | $entry = "$entry$line"; | ||
| 223 | } | ||
| 224 | } | ||
| 225 | |||
| 226 | # Print last entry if it matches. | ||
| 227 | print_log ($header, $entry) | ||
| 228 | if header_match_p ($header) && entry_match_p ($entry); | ||
| 229 | |||
| 230 | close IN; | ||
| 231 | |||
| 232 | if ($reverse) { | ||
| 233 | for (my $entry = @entries; $entry; $entry--) { | ||
| 234 | print $entries[$entry-1]; | ||
| 235 | } | ||
| 236 | } | ||
| 237 | } | ||
| 238 | |||
| 239 | |||
| 240 | # Main program. Process ChangeLogs. | ||
| 241 | |||
| 242 | # If files were specified on the command line, parse those files in the | ||
| 243 | # order supplied by the user; otherwise parse default files ChangeLog and | ||
| 244 | # ChangeLog.NNN according to $reverse. | ||
| 245 | unless (@ARGV > 0) { | ||
| 246 | @ARGV = ("ChangeLog"); | ||
| 247 | |||
| 248 | push @ARGV, | ||
| 249 | map {"ChangeLog.$_"} | ||
| 250 | sort {$b <=> $a} | ||
| 251 | map {/\.(\d+)$/; $1} | ||
| 252 | do { | ||
| 253 | opendir D, '.'; | ||
| 254 | grep /^ChangeLog\.\d+$/, readdir D; | ||
| 255 | }; | ||
| 256 | |||
| 257 | @ARGV = reverse @ARGV if $reverse; | ||
| 258 | } | ||
| 259 | |||
| 260 | while (defined (my $log = shift @ARGV)) { | ||
| 261 | parse_changelog ($log) if -f $log; | ||
| 262 | } | ||
| 263 | |||
| 264 | |||
| 265 | # grep-changelog ends here. | ||
diff --git a/lib-src/test-distrib.c b/lib-src/test-distrib.c new file mode 100644 index 00000000000..6a12201b894 --- /dev/null +++ b/lib-src/test-distrib.c | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | /* test-distrib.c --- testing distribution of nonprinting chars | ||
| 2 | |||
| 3 | Copyright (C) 1987, 1993-1995, 1999, 2001-2015 Free Software Foundation, | ||
| 4 | Inc. | ||
| 5 | |||
| 6 | This file is part of GNU Emacs. | ||
| 7 | |||
| 8 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 9 | it under the terms of the GNU General Public License as published by | ||
| 10 | the Free Software Foundation, either version 3 of the License, or | ||
| 11 | (at your option) any later version. | ||
| 12 | |||
| 13 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | GNU General Public License for more details. | ||
| 17 | |||
| 18 | You should have received a copy of the GNU General Public License | ||
| 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 20 | |||
| 21 | |||
| 22 | #include <config.h> | ||
| 23 | #include <stdio.h> | ||
| 24 | #include <fcntl.h> | ||
| 25 | #include <unistd.h> | ||
| 26 | |||
| 27 | /* Break string in two parts to avoid buggy C compilers that ignore characters | ||
| 28 | after nulls in strings. */ | ||
| 29 | |||
| 30 | static char string1[] = "Testing distribution of nonprinting chars:\n\ | ||
| 31 | Should be 0177: \177 Should be 0377: \377 Should be 0212: \212.\n\ | ||
| 32 | Should be 0000: "; | ||
| 33 | |||
| 34 | static char string2[] = ".\n\ | ||
| 35 | This file is read by the `test-distribution' program.\n\ | ||
| 36 | If you change it, you will make that program fail.\n"; | ||
| 37 | |||
| 38 | /* Like `read' but keeps trying until it gets SIZE bytes or reaches eof. */ | ||
| 39 | static int | ||
| 40 | cool_read (int fd, char *buf, size_t size) | ||
| 41 | { | ||
| 42 | ssize_t num; | ||
| 43 | ssize_t sofar = 0; | ||
| 44 | |||
| 45 | while (1) | ||
| 46 | { | ||
| 47 | if ((num = read (fd, buf + sofar, size - sofar)) == 0) | ||
| 48 | return sofar; | ||
| 49 | else if (num < 0) | ||
| 50 | return num; | ||
| 51 | sofar += num; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | int | ||
| 56 | main (int argc, char **argv) | ||
| 57 | { | ||
| 58 | int fd; | ||
| 59 | char buf[300]; | ||
| 60 | |||
| 61 | if (argc != 2) | ||
| 62 | { | ||
| 63 | fprintf (stderr, "Usage: %s testfile\n", argv[0]); | ||
| 64 | exit (EXIT_FAILURE); | ||
| 65 | } | ||
| 66 | fd = open (argv[1], O_RDONLY); | ||
| 67 | if (fd < 0) | ||
| 68 | { | ||
| 69 | perror (argv[1]); | ||
| 70 | exit (EXIT_FAILURE); | ||
| 71 | } | ||
| 72 | if (cool_read (fd, buf, sizeof string1) != sizeof string1 || | ||
| 73 | strcmp (buf, string1) || | ||
| 74 | cool_read (fd, buf, sizeof string2) != sizeof string2 - 1 || | ||
| 75 | strncmp (buf, string2, sizeof string2 - 1)) | ||
| 76 | { | ||
| 77 | fprintf (stderr, "Data in file `%s' has been damaged.\n\ | ||
| 78 | Most likely this means that many nonprinting characters\n\ | ||
| 79 | have been corrupted in the files of Emacs, and it will not work.\n", | ||
| 80 | argv[1]); | ||
| 81 | exit (EXIT_FAILURE); | ||
| 82 | } | ||
| 83 | close (fd); | ||
| 84 | return EXIT_SUCCESS; | ||
| 85 | } | ||
| 86 | |||
| 87 | |||
| 88 | /* test-distrib.c ends here */ | ||
diff --git a/lib/alloca.in.h b/lib/alloca.in.h index 906fe92379d..b41c3934ad4 100644 --- a/lib/alloca.in.h +++ b/lib/alloca.in.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* Memory allocation on the stack. | 1 | /* Memory allocation on the stack. |
| 2 | 2 | ||
| 3 | Copyright (C) 1995, 1999, 2001-2004, 2006-2015 Free Software Foundation, | 3 | Copyright (C) 1995, 1999, 2001-2004, 2006-2015 Free Software |
| 4 | Inc. | 4 | Foundation, Inc. |
| 5 | 5 | ||
| 6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | under the terms of the GNU General Public License as published | 7 | under the terms of the GNU General Public License as published |
diff --git a/lib/binary-io.h b/lib/binary-io.h index f5b66c79095..84780032b2a 100644 --- a/lib/binary-io.h +++ b/lib/binary-io.h | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* Binary mode I/O. | 1 | /* Binary mode I/O. |
| 2 | Copyright (C) 2001, 2003, 2005, 2008-2015 Free Software Foundation, Inc. | 2 | Copyright (C) 2001, 2003, 2005, 2008-2015 Free Software Foundation, |
| 3 | Inc. | ||
| 3 | 4 | ||
| 4 | This program is free software: you can redistribute it and/or modify | 5 | This program is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/c-ctype.h b/lib/c-ctype.h index 47644731782..53c443a38cd 100644 --- a/lib/c-ctype.h +++ b/lib/c-ctype.h | |||
| @@ -5,7 +5,8 @@ | |||
| 5 | <ctype.h> functions' behaviour depends on the current locale set via | 5 | <ctype.h> functions' behaviour depends on the current locale set via |
| 6 | setlocale. | 6 | setlocale. |
| 7 | 7 | ||
| 8 | Copyright (C) 2000-2003, 2006, 2008-2015 Free Software Foundation, Inc. | 8 | Copyright (C) 2000-2003, 2006, 2008-2015 Free Software Foundation, |
| 9 | Inc. | ||
| 9 | 10 | ||
| 10 | This program is free software; you can redistribute it and/or modify | 11 | This program is free software; you can redistribute it and/or modify |
| 11 | it under the terms of the GNU General Public License as published by | 12 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c index 6deb6d1236d..dbf17b2dcda 100644 --- a/lib/c-strcasecmp.c +++ b/lib/c-strcasecmp.c | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* c-strcasecmp.c -- case insensitive string comparator in C locale | 1 | /* c-strcasecmp.c -- case insensitive string comparator in C locale |
| 2 | Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software Foundation, Inc. | 2 | Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software |
| 3 | Foundation, Inc. | ||
| 3 | 4 | ||
| 4 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c index b98e36838ca..580ea237729 100644 --- a/lib/c-strncasecmp.c +++ b/lib/c-strncasecmp.c | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* c-strncasecmp.c -- case insensitive string comparator in C locale | 1 | /* c-strncasecmp.c -- case insensitive string comparator in C locale |
| 2 | Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software Foundation, Inc. | 2 | Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software |
| 3 | Foundation, Inc. | ||
| 3 | 4 | ||
| 4 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index f2f5da23a38..3b3153e81ca 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* Read symbolic links into a buffer without size limitation, relative to fd. | 1 | /* Read symbolic links into a buffer without size limitation, relative to fd. |
| 2 | 2 | ||
| 3 | Copyright (C) 2001, 2003-2004, 2007, 2009-2015 Free Software Foundation, | 3 | Copyright (C) 2001, 2003-2004, 2007, 2009-2015 Free Software |
| 4 | Inc. | 4 | Foundation, Inc. |
| 5 | 5 | ||
| 6 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/close-stream.c b/lib/close-stream.c index 6e3d8658d58..1c4e74c1b64 100644 --- a/lib/close-stream.c +++ b/lib/close-stream.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* Close a stream, with nicer error checking than fclose's. | 1 | /* Close a stream, with nicer error checking than fclose's. |
| 2 | 2 | ||
| 3 | Copyright (C) 1998-2002, 2004, 2006-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 1998-2002, 2004, 2006-2015 Free Software Foundation, |
| 4 | Inc. | ||
| 4 | 5 | ||
| 5 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/dosname.h b/lib/dosname.h index 893baf6ccf3..25aba132b38 100644 --- a/lib/dosname.h +++ b/lib/dosname.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* File names on MS-DOS/Windows systems. | 1 | /* File names on MS-DOS/Windows systems. |
| 2 | 2 | ||
| 3 | Copyright (C) 2000-2001, 2004-2006, 2009-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2000-2001, 2004-2006, 2009-2015 Free Software |
| 4 | Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/dup2.c b/lib/dup2.c index 0e13214c825..94406dff481 100644 --- a/lib/dup2.c +++ b/lib/dup2.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* Duplicate an open file descriptor to a specified file descriptor. | 1 | /* Duplicate an open file descriptor to a specified file descriptor. |
| 2 | 2 | ||
| 3 | Copyright (C) 1999, 2004-2007, 2009-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 1999, 2004-2007, 2009-2015 Free Software Foundation, |
| 4 | Inc. | ||
| 4 | 5 | ||
| 5 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/filemode.h b/lib/filemode.h index ff0460a5e07..805bc5a24d9 100644 --- a/lib/filemode.h +++ b/lib/filemode.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* Make a string describing file modes. | 1 | /* Make a string describing file modes. |
| 2 | 2 | ||
| 3 | Copyright (C) 1998-1999, 2003, 2006, 2009-2015 Free Software Foundation, | 3 | Copyright (C) 1998-1999, 2003, 2006, 2009-2015 Free Software |
| 4 | Inc. | 4 | Foundation, Inc. |
| 5 | 5 | ||
| 6 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/fpending.c b/lib/fpending.c index c4b4a519611..05e84d34e41 100644 --- a/lib/fpending.c +++ b/lib/fpending.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* fpending.c -- return the number of pending output bytes on a stream | 1 | /* fpending.c -- return the number of pending output bytes on a stream |
| 2 | Copyright (C) 2000, 2004, 2006-2007, 2009-2015 Free Software Foundation, | 2 | Copyright (C) 2000, 2004, 2006-2007, 2009-2015 Free Software |
| 3 | Inc. | 3 | Foundation, Inc. |
| 4 | 4 | ||
| 5 | This program is free software: you can redistribute it and/or modify | 5 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/fpending.h b/lib/fpending.h index 5a1b2ad9442..19442821ad8 100644 --- a/lib/fpending.h +++ b/lib/fpending.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* Declare __fpending. | 1 | /* Declare __fpending. |
| 2 | 2 | ||
| 3 | Copyright (C) 2000, 2003, 2005-2006, 2009-2015 Free Software Foundation, | 3 | Copyright (C) 2000, 2003, 2005-2006, 2009-2015 Free Software |
| 4 | Inc. | 4 | Foundation, Inc. |
| 5 | 5 | ||
| 6 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/getgroups.c b/lib/getgroups.c index 5563dfb4280..a7f0f9e2a29 100644 --- a/lib/getgroups.c +++ b/lib/getgroups.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* provide consistent interface to getgroups for systems that don't allow N==0 | 1 | /* provide consistent interface to getgroups for systems that don't allow N==0 |
| 2 | 2 | ||
| 3 | Copyright (C) 1996, 1999, 2003, 2006-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 1996, 1999, 2003, 2006-2015 Free Software Foundation, |
| 4 | Inc. | ||
| 4 | 5 | ||
| 5 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/getloadavg.c b/lib/getloadavg.c index 0cbca265b29..119a32b4408 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* Get the system load averages. | 1 | /* Get the system load averages. |
| 2 | 2 | ||
| 3 | Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2015 Free Software | 3 | Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2015 Free |
| 4 | Foundation, Inc. | 4 | Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | NOTE: The canonical source of this file is maintained with gnulib. | 6 | NOTE: The canonical source of this file is maintained with gnulib. |
| 7 | Bugs can be reported to bug-gnulib@gnu.org. | 7 | Bugs can be reported to bug-gnulib@gnu.org. |
diff --git a/lib/getopt.in.h b/lib/getopt.in.h index 9248f76ec8b..168863123ab 100644 --- a/lib/getopt.in.h +++ b/lib/getopt.in.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Declarations for getopt. | 1 | /* Declarations for getopt. |
| 2 | Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2015 Free Software | 2 | Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2015 Free |
| 3 | Foundation, Inc. | 3 | Software Foundation, Inc. |
| 4 | This file is part of the GNU C Library. | 4 | This file is part of the GNU C Library. |
| 5 | 5 | ||
| 6 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
diff --git a/lib/getopt1.c b/lib/getopt1.c index 2b1feb6eadb..60760ea2f9c 100644 --- a/lib/getopt1.c +++ b/lib/getopt1.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* getopt_long and getopt_long_only entry points for GNU getopt. | 1 | /* getopt_long and getopt_long_only entry points for GNU getopt. |
| 2 | Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2015 Free Software | 2 | Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2015 Free |
| 3 | Foundation, Inc. | 3 | Software Foundation, Inc. |
| 4 | This file is part of the GNU C Library. | 4 | This file is part of the GNU C Library. |
| 5 | 5 | ||
| 6 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
diff --git a/lib/getopt_int.h b/lib/getopt_int.h index e893a6e133f..89c896a72b7 100644 --- a/lib/getopt_int.h +++ b/lib/getopt_int.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Internal declarations for getopt. | 1 | /* Internal declarations for getopt. |
| 2 | Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2015 Free Software | 2 | Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2015 Free |
| 3 | Foundation, Inc. | 3 | Software Foundation, Inc. |
| 4 | This file is part of the GNU C Library. | 4 | This file is part of the GNU C Library. |
| 5 | 5 | ||
| 6 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
diff --git a/lib/gettext.h b/lib/gettext.h index 599a14ec1b3..c10c702631b 100644 --- a/lib/gettext.h +++ b/lib/gettext.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Convenience header for conditional use of GNU <libintl.h>. | 1 | /* Convenience header for conditional use of GNU <libintl.h>. |
| 2 | Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2015 Free Software | 2 | Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2015 Free |
| 3 | Foundation, Inc. | 3 | Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/gettime.c b/lib/gettime.c index 1c47e3b2995..3786231d938 100644 --- a/lib/gettime.c +++ b/lib/gettime.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* gettime -- get the system clock | 1 | /* gettime -- get the system clock |
| 2 | 2 | ||
| 3 | Copyright (C) 2002, 2004-2007, 2009-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2002, 2004-2007, 2009-2015 Free Software Foundation, |
| 4 | Inc. | ||
| 4 | 5 | ||
| 5 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c index e0e2e696d04..ff6940c05af 100644 --- a/lib/gettimeofday.c +++ b/lib/gettimeofday.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* Provide gettimeofday for systems that don't have it or for which it's broken. | 1 | /* Provide gettimeofday for systems that don't have it or for which it's broken. |
| 2 | 2 | ||
| 3 | Copyright (C) 2001-2003, 2005-2007, 2009-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2001-2003, 2005-2007, 2009-2015 Free Software |
| 4 | Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/group-member.c b/lib/group-member.c index 23074e4f693..a60fae93597 100644 --- a/lib/group-member.c +++ b/lib/group-member.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* group-member.c -- determine whether group id is in calling user's group list | 1 | /* group-member.c -- determine whether group id is in calling user's group list |
| 2 | 2 | ||
| 3 | Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2015 Free Software | 3 | Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2015 Free |
| 4 | Foundation, Inc. | 4 | Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* Functions to compute MD5 message digest of files or memory blocks. | 1 | /* Functions to compute MD5 message digest of files or memory blocks. |
| 2 | according to the definition of MD5 in RFC 1321 from April 1992. | 2 | according to the definition of MD5 in RFC 1321 from April 1992. |
| 3 | Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2015 Free Software | 3 | Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2015 Free |
| 4 | Foundation, Inc. | 4 | Software Foundation, Inc. |
| 5 | This file is part of the GNU C Library. | 5 | This file is part of the GNU C Library. |
| 6 | 6 | ||
| 7 | This program is free software; you can redistribute it and/or modify it | 7 | This program is free software; you can redistribute it and/or modify it |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* Declaration of functions and data types used for MD5 sum computing | 1 | /* Declaration of functions and data types used for MD5 sum computing |
| 2 | library functions. | 2 | library functions. |
| 3 | Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2015 Free Software | 3 | Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2015 Free |
| 4 | Foundation, Inc. | 4 | Software Foundation, Inc. |
| 5 | This file is part of the GNU C Library. | 5 | This file is part of the GNU C Library. |
| 6 | 6 | ||
| 7 | This program is free software; you can redistribute it and/or modify it | 7 | This program is free software; you can redistribute it and/or modify it |
diff --git a/lib/memrchr.c b/lib/memrchr.c index 3827208d800..45402776c42 100644 --- a/lib/memrchr.c +++ b/lib/memrchr.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* memrchr -- find the last occurrence of a byte in a memory block | 1 | /* memrchr -- find the last occurrence of a byte in a memory block |
| 2 | 2 | ||
| 3 | Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2015 Free Software | 3 | Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2015 Free |
| 4 | Foundation, Inc. | 4 | Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | Based on strlen implementation by Torbjorn Granlund (tege@sics.se), | 6 | Based on strlen implementation by Torbjorn Granlund (tege@sics.se), |
| 7 | with help from Dan Sahlin (dan@sics.se) and | 7 | with help from Dan Sahlin (dan@sics.se) and |
diff --git a/lib/sha1.c b/lib/sha1.c index 4411ceec863..90faa4e4357 100644 --- a/lib/sha1.c +++ b/lib/sha1.c | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | /* sha1.c - Functions to compute SHA1 message digest of files or | 1 | /* sha1.c - Functions to compute SHA1 message digest of files or |
| 2 | memory blocks according to the NIST specification FIPS-180-1. | 2 | memory blocks according to the NIST specification FIPS-180-1. |
| 3 | 3 | ||
| 4 | Copyright (C) 2000-2001, 2003-2006, 2008-2015 Free Software Foundation, Inc. | 4 | Copyright (C) 2000-2001, 2003-2006, 2008-2015 Free Software |
| 5 | Foundation, Inc. | ||
| 5 | 6 | ||
| 6 | This program is free software; you can redistribute it and/or modify it | 7 | This program is free software; you can redistribute it and/or modify it |
| 7 | under the terms of the GNU General Public License as published by the | 8 | under the terms of the GNU General Public License as published by the |
diff --git a/lib/sig2str.c b/lib/sig2str.c index 58154daac05..0966dd525ae 100644 --- a/lib/sig2str.c +++ b/lib/sig2str.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* sig2str.c -- convert between signal names and numbers | 1 | /* sig2str.c -- convert between signal names and numbers |
| 2 | 2 | ||
| 3 | Copyright (C) 2002, 2004, 2006, 2009-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2002, 2004, 2006, 2009-2015 Free Software Foundation, |
| 4 | Inc. | ||
| 4 | 5 | ||
| 5 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/stdarg.in.h b/lib/stdarg.in.h new file mode 100644 index 00000000000..5239f51af76 --- /dev/null +++ b/lib/stdarg.in.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /* Substitute for and wrapper around <stdarg.h>. | ||
| 2 | Copyright (C) 2008-2015 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This program is free software; you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation; either version 3, or (at your option) | ||
| 7 | any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | ||
| 16 | |||
| 17 | #ifndef _@GUARD_PREFIX@_STDARG_H | ||
| 18 | |||
| 19 | #if __GNUC__ >= 3 | ||
| 20 | @PRAGMA_SYSTEM_HEADER@ | ||
| 21 | #endif | ||
| 22 | @PRAGMA_COLUMNS@ | ||
| 23 | |||
| 24 | /* The include_next requires a split double-inclusion guard. */ | ||
| 25 | #@INCLUDE_NEXT@ @NEXT_STDARG_H@ | ||
| 26 | |||
| 27 | #ifndef _@GUARD_PREFIX@_STDARG_H | ||
| 28 | #define _@GUARD_PREFIX@_STDARG_H | ||
| 29 | |||
| 30 | #ifndef va_copy | ||
| 31 | # define va_copy(a,b) ((a) = (b)) | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #endif /* _@GUARD_PREFIX@_STDARG_H */ | ||
| 35 | #endif /* _@GUARD_PREFIX@_STDARG_H */ | ||
diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h new file mode 100644 index 00000000000..64a17618255 --- /dev/null +++ b/lib/stdbool.in.h | |||
| @@ -0,0 +1,132 @@ | |||
| 1 | /* Copyright (C) 2001-2003, 2006-2015 Free Software Foundation, Inc. | ||
| 2 | Written by Bruno Haible <haible@clisp.cons.org>, 2001. | ||
| 3 | |||
| 4 | This program is free software; you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation; either version 3, or (at your option) | ||
| 7 | any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | ||
| 16 | |||
| 17 | #ifndef _GL_STDBOOL_H | ||
| 18 | #define _GL_STDBOOL_H | ||
| 19 | |||
| 20 | /* ISO C 99 <stdbool.h> for platforms that lack it. */ | ||
| 21 | |||
| 22 | /* Usage suggestions: | ||
| 23 | |||
| 24 | Programs that use <stdbool.h> should be aware of some limitations | ||
| 25 | and standards compliance issues. | ||
| 26 | |||
| 27 | Standards compliance: | ||
| 28 | |||
| 29 | - <stdbool.h> must be #included before 'bool', 'false', 'true' | ||
| 30 | can be used. | ||
| 31 | |||
| 32 | - You cannot assume that sizeof (bool) == 1. | ||
| 33 | |||
| 34 | - Programs should not undefine the macros bool, true, and false, | ||
| 35 | as C99 lists that as an "obsolescent feature". | ||
| 36 | |||
| 37 | Limitations of this substitute, when used in a C89 environment: | ||
| 38 | |||
| 39 | - <stdbool.h> must be #included before the '_Bool' type can be used. | ||
| 40 | |||
| 41 | - You cannot assume that _Bool is a typedef; it might be a macro. | ||
| 42 | |||
| 43 | - Bit-fields of type 'bool' are not supported. Portable code | ||
| 44 | should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'. | ||
| 45 | |||
| 46 | - In C99, casts and automatic conversions to '_Bool' or 'bool' are | ||
| 47 | performed in such a way that every nonzero value gets converted | ||
| 48 | to 'true', and zero gets converted to 'false'. This doesn't work | ||
| 49 | with this substitute. With this substitute, only the values 0 and 1 | ||
| 50 | give the expected result when converted to _Bool' or 'bool'. | ||
| 51 | |||
| 52 | - C99 allows the use of (_Bool)0.0 in constant expressions, but | ||
| 53 | this substitute cannot always provide this property. | ||
| 54 | |||
| 55 | Also, it is suggested that programs use 'bool' rather than '_Bool'; | ||
| 56 | this isn't required, but 'bool' is more common. */ | ||
| 57 | |||
| 58 | |||
| 59 | /* 7.16. Boolean type and values */ | ||
| 60 | |||
| 61 | /* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same | ||
| 62 | definitions below, but temporarily we have to #undef them. */ | ||
| 63 | #if defined __BEOS__ && !defined __HAIKU__ | ||
| 64 | # include <OS.h> /* defines bool but not _Bool */ | ||
| 65 | # undef false | ||
| 66 | # undef true | ||
| 67 | #endif | ||
| 68 | |||
| 69 | #ifdef __cplusplus | ||
| 70 | # define _Bool bool | ||
| 71 | # define bool bool | ||
| 72 | #else | ||
| 73 | # if defined __BEOS__ && !defined __HAIKU__ | ||
| 74 | /* A compiler known to have 'bool'. */ | ||
| 75 | /* If the compiler already has both 'bool' and '_Bool', we can assume they | ||
| 76 | are the same types. */ | ||
| 77 | # if !@HAVE__BOOL@ | ||
| 78 | typedef bool _Bool; | ||
| 79 | # endif | ||
| 80 | # else | ||
| 81 | # if !defined __GNUC__ | ||
| 82 | /* If @HAVE__BOOL@: | ||
| 83 | Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when | ||
| 84 | the built-in _Bool type is used. See | ||
| 85 | http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html | ||
| 86 | http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html | ||
| 87 | http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html | ||
| 88 | Similar bugs are likely with other compilers as well; this file | ||
| 89 | wouldn't be used if <stdbool.h> was working. | ||
| 90 | So we override the _Bool type. | ||
| 91 | If !@HAVE__BOOL@: | ||
| 92 | Need to define _Bool ourselves. As 'signed char' or as an enum type? | ||
| 93 | Use of a typedef, with SunPRO C, leads to a stupid | ||
| 94 | "warning: _Bool is a keyword in ISO C99". | ||
| 95 | Use of an enum type, with IRIX cc, leads to a stupid | ||
| 96 | "warning(1185): enumerated type mixed with another type". | ||
| 97 | Even the existence of an enum type, without a typedef, | ||
| 98 | "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. | ||
| 99 | The only benefit of the enum, debuggability, is not important | ||
| 100 | with these compilers. So use 'signed char' and no enum. */ | ||
| 101 | # define _Bool signed char | ||
| 102 | # else | ||
| 103 | /* With this compiler, trust the _Bool type if the compiler has it. */ | ||
| 104 | # if !@HAVE__BOOL@ | ||
| 105 | /* For the sake of symbolic names in gdb, define true and false as | ||
| 106 | enum constants, not only as macros. | ||
| 107 | It is tempting to write | ||
| 108 | typedef enum { false = 0, true = 1 } _Bool; | ||
| 109 | so that gdb prints values of type 'bool' symbolically. But then | ||
| 110 | values of type '_Bool' might promote to 'int' or 'unsigned int' | ||
| 111 | (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' | ||
| 112 | (see ISO C 99 6.3.1.1.(2)). So add a negative value to the | ||
| 113 | enum; this ensures that '_Bool' promotes to 'int'. */ | ||
| 114 | typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; | ||
| 115 | # endif | ||
| 116 | # endif | ||
| 117 | # endif | ||
| 118 | # define bool _Bool | ||
| 119 | #endif | ||
| 120 | |||
| 121 | /* The other macros must be usable in preprocessor directives. */ | ||
| 122 | #ifdef __cplusplus | ||
| 123 | # define false false | ||
| 124 | # define true true | ||
| 125 | #else | ||
| 126 | # define false 0 | ||
| 127 | # define true 1 | ||
| 128 | #endif | ||
| 129 | |||
| 130 | #define __bool_true_false_are_defined 1 | ||
| 131 | |||
| 132 | #endif /* _GL_STDBOOL_H */ | ||
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 428a119188c..490be4629fa 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* A GNU-like <stdlib.h>. | 1 | /* A GNU-like <stdlib.h>. |
| 2 | 2 | ||
| 3 | Copyright (C) 1995, 2001-2004, 2006-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 1995, 2001-2004, 2006-2015 Free Software Foundation, |
| 4 | Inc. | ||
| 4 | 5 | ||
| 5 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/strftime.c b/lib/strftime.c index 2426aae7052..fdb87b50f18 100644 --- a/lib/strftime.c +++ b/lib/strftime.c | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | /* Copyright (C) 1991-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc. | 1 | /* Copyright (C) 1991-2001, 2003-2007, 2009-2015 Free Software |
| 2 | * Foundation, Inc. | ||
| 2 | 3 | ||
| 3 | NOTE: The canonical source of this file is maintained with the GNU C Library. | 4 | NOTE: The canonical source of this file is maintained with the GNU C Library. |
| 4 | Bugs can be reported to bug-glibc@prep.ai.mit.edu. | 5 | Bugs can be reported to bug-glibc@prep.ai.mit.edu. |
diff --git a/lib/strtoimax.c b/lib/strtoimax.c index 8ff65cee4bc..6575c8719ca 100644 --- a/lib/strtoimax.c +++ b/lib/strtoimax.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* Convert string representation of a number into an intmax_t value. | 1 | /* Convert string representation of a number into an intmax_t value. |
| 2 | 2 | ||
| 3 | Copyright (C) 1999, 2001-2004, 2006, 2009-2015 Free Software Foundation, | 3 | Copyright (C) 1999, 2001-2004, 2006, 2009-2015 Free Software |
| 4 | Inc. | 4 | Foundation, Inc. |
| 5 | 5 | ||
| 6 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/strtol.c b/lib/strtol.c index 1bc143985db..56b38af224e 100644 --- a/lib/strtol.c +++ b/lib/strtol.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* Convert string representation of a number into an integer value. | 1 | /* Convert string representation of a number into an integer value. |
| 2 | 2 | ||
| 3 | Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2015 Free Software | 3 | Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2015 Free |
| 4 | Foundation, Inc. | 4 | Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | NOTE: The canonical source of this file is maintained with the GNU C | 6 | NOTE: The canonical source of this file is maintained with the GNU C |
| 7 | Library. Bugs can be reported to bug-glibc@gnu.org. | 7 | Library. Bugs can be reported to bug-glibc@gnu.org. |
diff --git a/lib/strtoll.c b/lib/strtoll.c index d7123491f3b..e91cc29a010 100644 --- a/lib/strtoll.c +++ b/lib/strtoll.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Function to parse a 'long long int' from text. | 1 | /* Function to parse a 'long long int' from text. |
| 2 | Copyright (C) 1995-1997, 1999, 2001, 2009-2015 Free Software Foundation, | 2 | Copyright (C) 1995-1997, 1999, 2001, 2009-2015 Free Software |
| 3 | Inc. | 3 | Foundation, Inc. |
| 4 | This file is part of the GNU C Library. | 4 | This file is part of the GNU C Library. |
| 5 | 5 | ||
| 6 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
diff --git a/lib/strtoull.c b/lib/strtoull.c index 5cd2554c719..4d5e4335538 100644 --- a/lib/strtoull.c +++ b/lib/strtoull.c | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* Function to parse an 'unsigned long long int' from text. | 1 | /* Function to parse an 'unsigned long long int' from text. |
| 2 | Copyright (C) 1995-1997, 1999, 2009-2015 Free Software Foundation, Inc. | 2 | Copyright (C) 1995-1997, 1999, 2009-2015 Free Software Foundation, |
| 3 | Inc. | ||
| 3 | NOTE: The canonical source of this file is maintained with the GNU C | 4 | NOTE: The canonical source of this file is maintained with the GNU C |
| 4 | Library. Bugs can be reported to bug-glibc@gnu.org. | 5 | Library. Bugs can be reported to bug-glibc@gnu.org. |
| 5 | 6 | ||
diff --git a/lib/tempname.c b/lib/tempname.c index 088b224ab96..55fad942219 100644 --- a/lib/tempname.c +++ b/lib/tempname.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* tempname.c - generate the name of a temporary file. | 1 | /* tempname.c - generate the name of a temporary file. |
| 2 | 2 | ||
| 3 | Copyright (C) 1991-2003, 2005-2007, 2009-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 1991-2003, 2005-2007, 2009-2015 Free Software |
| 4 | Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/time_r.c b/lib/time_r.c index 0b512de99fe..222705bf898 100644 --- a/lib/time_r.c +++ b/lib/time_r.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* Reentrant time functions like localtime_r. | 1 | /* Reentrant time functions like localtime_r. |
| 2 | 2 | ||
| 3 | Copyright (C) 2003, 2006-2007, 2010-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2003, 2006-2007, 2010-2015 Free Software Foundation, |
| 4 | Inc. | ||
| 4 | 5 | ||
| 5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lib/unsetenv.c b/lib/unsetenv.c index 87f41d59a50..80810e78538 100644 --- a/lib/unsetenv.c +++ b/lib/unsetenv.c | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | /* Copyright (C) 1992, 1995-2002, 2005-2015 Free Software Foundation, Inc. | 1 | /* Copyright (C) 1992, 1995-2002, 2005-2015 Free Software Foundation, |
| 2 | Inc. | ||
| 2 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
| 3 | 4 | ||
| 4 | This program is free software: you can redistribute it and/or modify | 5 | This program is free software: you can redistribute it and/or modify |
diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h index f0e9778f738..397a04bd0d1 100644 --- a/lib/xalloc-oversized.h +++ b/lib/xalloc-oversized.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* xalloc-oversized.h -- memory allocation size checking | 1 | /* xalloc-oversized.h -- memory allocation size checking |
| 2 | 2 | ||
| 3 | Copyright (C) 1990-2000, 2003-2004, 2006-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 1990-2000, 2003-2004, 2006-2015 Free Software |
| 4 | Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/lisp/gnus/gnus-setup.el b/lisp/gnus/gnus-setup.el new file mode 100644 index 00000000000..86b3bffcd4a --- /dev/null +++ b/lisp/gnus/gnus-setup.el | |||
| @@ -0,0 +1,191 @@ | |||
| 1 | ;;; gnus-setup.el --- Initialization & Setup for Gnus 5 | ||
| 2 | |||
| 3 | ;; Copyright (C) 1995-1996, 2000-2015 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Steven L. Baur <steve@miranova.com> | ||
| 6 | ;; Keywords: news | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 13 | ;; (at your option) any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 22 | |||
| 23 | ;;; Commentary: | ||
| 24 | ;; My head is starting to spin with all the different mail/news packages. | ||
| 25 | ;; Stop The Madness! | ||
| 26 | |||
| 27 | ;; Given that Emacs Lisp byte codes may be diverging, it is probably best | ||
| 28 | ;; not to byte compile this, and just arrange to have the .el loaded out | ||
| 29 | ;; of .emacs. | ||
| 30 | |||
| 31 | ;;; Code: | ||
| 32 | |||
| 33 | (eval-when-compile (require 'cl)) | ||
| 34 | |||
| 35 | (defvar gnus-use-installed-gnus t | ||
| 36 | "*If non-nil use installed version of Gnus.") | ||
| 37 | |||
| 38 | (defvar gnus-use-installed-mailcrypt (featurep 'xemacs) | ||
| 39 | "*If non-nil use installed version of mailcrypt.") | ||
| 40 | |||
| 41 | (defvar gnus-emacs-lisp-directory (if (featurep 'xemacs) | ||
| 42 | "/usr/local/lib/xemacs/" | ||
| 43 | "/usr/local/share/emacs/") | ||
| 44 | "Directory where Emacs site lisp is located.") | ||
| 45 | |||
| 46 | (defvar gnus-gnus-lisp-directory (concat gnus-emacs-lisp-directory | ||
| 47 | "gnus/lisp/") | ||
| 48 | "Directory where Gnus Emacs lisp is found.") | ||
| 49 | |||
| 50 | (defvar gnus-mailcrypt-lisp-directory (concat gnus-emacs-lisp-directory | ||
| 51 | "site-lisp/mailcrypt/") | ||
| 52 | "Directory where Mailcrypt Emacs Lisp is found.") | ||
| 53 | |||
| 54 | (defvar gnus-bbdb-lisp-directory (concat gnus-emacs-lisp-directory | ||
| 55 | "site-lisp/bbdb/") | ||
| 56 | "Directory where Big Brother Database is found.") | ||
| 57 | |||
| 58 | (defvar gnus-use-mhe nil | ||
| 59 | "Set this if you want to use MH-E for mail reading.") | ||
| 60 | (defvar gnus-use-rmail nil | ||
| 61 | "Set this if you want to use RMAIL for mail reading.") | ||
| 62 | (defvar gnus-use-sendmail nil | ||
| 63 | "Set this if you want to use SENDMAIL for mail reading.") | ||
| 64 | (defvar gnus-use-vm nil | ||
| 65 | "Set this if you want to use the VM package for mail reading.") | ||
| 66 | (defvar gnus-use-sc nil | ||
| 67 | "Set this if you want to use Supercite.") | ||
| 68 | (defvar gnus-use-mailcrypt t | ||
| 69 | "Set this if you want to use Mailcrypt for dealing with PGP messages.") | ||
| 70 | (defvar gnus-use-bbdb nil | ||
| 71 | "Set this if you want to use the Big Brother DataBase.") | ||
| 72 | |||
| 73 | (when (and (not gnus-use-installed-gnus) | ||
| 74 | (null (member gnus-gnus-lisp-directory load-path))) | ||
| 75 | (push gnus-gnus-lisp-directory load-path)) | ||
| 76 | |||
| 77 | ;;; We can't do this until we know where Gnus is. | ||
| 78 | (require 'message) | ||
| 79 | |||
| 80 | ;;; Mailcrypt by | ||
| 81 | ;;; Jin Choi <jin@atype.com> | ||
| 82 | ;;; Patrick LoPresti <patl@lcs.mit.edu> | ||
| 83 | |||
| 84 | (when gnus-use-mailcrypt | ||
| 85 | (when (and (not gnus-use-installed-mailcrypt) | ||
| 86 | (null (member gnus-mailcrypt-lisp-directory load-path))) | ||
| 87 | (setq load-path (cons gnus-mailcrypt-lisp-directory load-path))) | ||
| 88 | (autoload 'mc-install-write-mode "mailcrypt" nil t) | ||
| 89 | (autoload 'mc-install-read-mode "mailcrypt" nil t) | ||
| 90 | ;;; (add-hook 'message-mode-hook 'mc-install-write-mode) | ||
| 91 | ;;; (add-hook 'gnus-summary-mode-hook 'mc-install-read-mode) | ||
| 92 | (when gnus-use-mhe | ||
| 93 | (add-hook 'mh-folder-mode-hook 'mc-install-read-mode) | ||
| 94 | (add-hook 'mh-letter-mode-hook 'mc-install-write-mode))) | ||
| 95 | |||
| 96 | ;;; BBDB by | ||
| 97 | ;;; Jamie Zawinski <jwz@lucid.com> | ||
| 98 | |||
| 99 | (when gnus-use-bbdb | ||
| 100 | ;; bbdb will never be installed with emacs. | ||
| 101 | (when (null (member gnus-bbdb-lisp-directory load-path)) | ||
| 102 | (setq load-path (cons gnus-bbdb-lisp-directory load-path))) | ||
| 103 | (autoload 'bbdb "bbdb-com" | ||
| 104 | "Insidious Big Brother Database" t) | ||
| 105 | (autoload 'bbdb-name "bbdb-com" | ||
| 106 | "Insidious Big Brother Database" t) | ||
| 107 | (autoload 'bbdb-company "bbdb-com" | ||
| 108 | "Insidious Big Brother Database" t) | ||
| 109 | (autoload 'bbdb-net "bbdb-com" | ||
| 110 | "Insidious Big Brother Database" t) | ||
| 111 | (autoload 'bbdb-notes "bbdb-com" | ||
| 112 | "Insidious Big Brother Database" t) | ||
| 113 | |||
| 114 | (when gnus-use-vm | ||
| 115 | (autoload 'bbdb-insinuate-vm "bbdb-vm" | ||
| 116 | "Hook BBDB into VM" t)) | ||
| 117 | |||
| 118 | (when gnus-use-rmail | ||
| 119 | (autoload 'bbdb-insinuate-rmail "bbdb-rmail" | ||
| 120 | "Hook BBDB into RMAIL" t) | ||
| 121 | (add-hook 'rmail-mode-hook 'bbdb-insinuate-rmail)) | ||
| 122 | |||
| 123 | (when gnus-use-mhe | ||
| 124 | (autoload 'bbdb-insinuate-mh "bbdb-mh" | ||
| 125 | "Hook BBDB into MH-E" t) | ||
| 126 | (add-hook 'mh-folder-mode-hook 'bbdb-insinuate-mh)) | ||
| 127 | |||
| 128 | (autoload 'bbdb-insinuate-gnus "bbdb-gnus" | ||
| 129 | "Hook BBDB into Gnus" t) | ||
| 130 | (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus) | ||
| 131 | |||
| 132 | (when gnus-use-sendmail | ||
| 133 | (autoload 'bbdb-insinuate-sendmail "bbdb" | ||
| 134 | "Insidious Big Brother Database" t) | ||
| 135 | (add-hook 'mail-setup-hook 'bbdb-insinuate-sendmail) | ||
| 136 | (add-hook 'message-setup-hook 'bbdb-insinuate-sendmail))) | ||
| 137 | |||
| 138 | (when gnus-use-sc | ||
| 139 | (add-hook 'mail-citation-hook 'sc-cite-original) | ||
| 140 | (setq message-cite-function 'sc-cite-original)) | ||
| 141 | |||
| 142 | ;;;### (autoloads (gnus gnus-slave gnus-no-server) "gnus" "lisp/gnus.el" (12473 2137)) | ||
| 143 | ;;; Generated autoloads from lisp/gnus.el | ||
| 144 | |||
| 145 | ;; Don't redo this if autoloads already exist | ||
| 146 | (unless (fboundp 'gnus) | ||
| 147 | (autoload 'gnus-slave-no-server "gnus" "\ | ||
| 148 | Read network news as a slave without connecting to local server." t nil) | ||
| 149 | |||
| 150 | (autoload 'gnus-no-server "gnus" "\ | ||
| 151 | Read network news. | ||
| 152 | If ARG is a positive number, Gnus will use that as the | ||
| 153 | startup level. If ARG is nil, Gnus will be started at level 2. | ||
| 154 | If ARG is non-nil and not a positive number, Gnus will | ||
| 155 | prompt the user for the name of an NNTP server to use. | ||
| 156 | As opposed to `gnus', this command will not connect to the local server." t nil) | ||
| 157 | |||
| 158 | (autoload 'gnus-slave "gnus" "\ | ||
| 159 | Read news as a slave." t nil) | ||
| 160 | |||
| 161 | (autoload 'gnus "gnus" "\ | ||
| 162 | Read network news. | ||
| 163 | If ARG is non-nil and a positive number, Gnus will use that as the | ||
| 164 | startup level. If ARG is non-nil and not a positive number, Gnus will | ||
| 165 | prompt the user for the name of an NNTP server to use." t nil) | ||
| 166 | |||
| 167 | ;;;*** | ||
| 168 | |||
| 169 | ;;; These have moved out of gnus.el into other files. | ||
| 170 | ;;; FIX FIX FIX: should other things be in gnus-setup? or these not in it? | ||
| 171 | (autoload 'gnus-update-format "gnus-spec" "\ | ||
| 172 | Update the format specification near point." t nil) | ||
| 173 | |||
| 174 | (autoload 'gnus-fetch-group "gnus-group" "\ | ||
| 175 | Start Gnus if necessary and enter GROUP. | ||
| 176 | Returns whether the fetching was successful or not." t nil) | ||
| 177 | |||
| 178 | (defalias 'gnus-batch-kill 'gnus-batch-score) | ||
| 179 | |||
| 180 | (autoload 'gnus-batch-score "gnus-kill" "\ | ||
| 181 | Run batched scoring. | ||
| 182 | Usage: emacs -batch -l gnus -f gnus-batch-score <newsgroups> ... | ||
| 183 | Newsgroups is a list of strings in Bnews format. If you want to score | ||
| 184 | the comp hierarchy, you'd say \"comp.all\". If you would not like to | ||
| 185 | score the alt hierarchy, you'd say \"!alt.all\"." t nil)) | ||
| 186 | |||
| 187 | (provide 'gnus-setup) | ||
| 188 | |||
| 189 | (run-hooks 'gnus-setup-load-hook) | ||
| 190 | |||
| 191 | ;;; gnus-setup.el ends here | ||
diff --git a/lisp/progmodes/cap-words.el b/lisp/progmodes/cap-words.el new file mode 100644 index 00000000000..94e865db62b --- /dev/null +++ b/lisp/progmodes/cap-words.el | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | ;;; cap-words.el --- minor mode for motion in CapitalizedWordIdentifiers | ||
| 2 | |||
| 3 | ;; Copyright (C) 2002-2015 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Dave Love <fx@gnu.org> | ||
| 6 | ;; Keywords: languages | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 13 | ;; (at your option) any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 22 | |||
| 23 | ;;; Commentary: | ||
| 24 | |||
| 25 | ;; Provides Capitalized Words minor mode for word movement in | ||
| 26 | ;; identifiers CapitalizedLikeThis. | ||
| 27 | |||
| 28 | ;; Note that the same effect could be obtained by frobbing the | ||
| 29 | ;; category of upper case characters to produce word boundaries, but | ||
| 30 | ;; the necessary processing isn't done for ASCII characters. | ||
| 31 | |||
| 32 | ;; Fixme: This doesn't work properly for mouse double clicks. | ||
| 33 | |||
| 34 | ;;; Code: | ||
| 35 | |||
| 36 | (defun capitalized-find-word-boundary (pos limit) | ||
| 37 | "Function for use in `find-word-boundary-function-table'. | ||
| 38 | Looks for word boundaries before capitals." | ||
| 39 | (save-excursion | ||
| 40 | (goto-char pos) | ||
| 41 | (let (case-fold-search) | ||
| 42 | (if (<= pos limit) | ||
| 43 | ;; Fixme: Are these regexps the best? | ||
| 44 | (or (and (re-search-forward "\\=.\\w*[[:upper:]]" | ||
| 45 | limit t) | ||
| 46 | (progn (backward-char) | ||
| 47 | t)) | ||
| 48 | (re-search-forward "\\>" limit t)) | ||
| 49 | (or (re-search-backward "[[:upper:]]\\w*\\=" limit t) | ||
| 50 | (re-search-backward "\\<" limit t)))) | ||
| 51 | (point))) | ||
| 52 | |||
| 53 | |||
| 54 | (defconst capitalized-find-word-boundary-function-table | ||
| 55 | (let ((tab (make-char-table nil))) | ||
| 56 | (set-char-table-range tab t #'capitalized-find-word-boundary) | ||
| 57 | tab) | ||
| 58 | "Assigned to `find-word-boundary-function-table' in Capitalized Words mode.") | ||
| 59 | |||
| 60 | ;;;###autoload | ||
| 61 | (define-minor-mode capitalized-words-mode | ||
| 62 | "Toggle Capitalized Words mode. | ||
| 63 | With a prefix argument ARG, enable Capitalized Words mode if ARG | ||
| 64 | is positive, and disable it otherwise. If called from Lisp, | ||
| 65 | enable the mode if ARG is omitted or nil. | ||
| 66 | |||
| 67 | Capitalized Words mode is a buffer-local minor mode. When | ||
| 68 | enabled, a word boundary occurs immediately before an uppercase | ||
| 69 | letter in a symbol. This is in addition to all the normal | ||
| 70 | boundaries given by the syntax and category tables. There is no | ||
| 71 | restriction to ASCII. | ||
| 72 | |||
| 73 | E.g. the beginning of words in the following identifier are as marked: | ||
| 74 | |||
| 75 | capitalizedWorDD | ||
| 76 | ^ ^ ^^ | ||
| 77 | |||
| 78 | Note that these word boundaries only apply for word motion and | ||
| 79 | marking commands such as \\[forward-word]. This mode does not affect word | ||
| 80 | boundaries found by regexp matching (`\\>', `\\w' &c). | ||
| 81 | |||
| 82 | This style of identifiers is common in environments like Java ones, | ||
| 83 | where underscores aren't trendy enough. Capitalization rules are | ||
| 84 | sometimes part of the language, e.g. Haskell, which may thus encourage | ||
| 85 | such a style. It is appropriate to add `capitalized-words-mode' to | ||
| 86 | the mode hook for programming language modes in which you encounter | ||
| 87 | variables like this, e.g. `java-mode-hook'. It's unlikely to cause | ||
| 88 | trouble if such identifiers aren't used. | ||
| 89 | |||
| 90 | See also `glasses-mode' and `studlify-word'. | ||
| 91 | Obsoletes `c-forward-into-nomenclature'." | ||
| 92 | nil " Caps" nil :group 'programming | ||
| 93 | (set (make-local-variable 'find-word-boundary-function-table) | ||
| 94 | capitalized-find-word-boundary-function-table)) | ||
| 95 | |||
| 96 | (provide 'cap-words) | ||
| 97 | |||
| 98 | ;;; cap-words.el ends here | ||
diff --git a/lisp/w32-common-fns.el b/lisp/w32-common-fns.el new file mode 100644 index 00000000000..1e4e9fe5bb1 --- /dev/null +++ b/lisp/w32-common-fns.el | |||
| @@ -0,0 +1,134 @@ | |||
| 1 | ;;; w32-common-fns.el --- Lisp routines for Windows and Cygwin-w32 | ||
| 2 | |||
| 3 | ;; Copyright (C) 1994, 2001-2015 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | ;; it under the terms of the GNU General Public License as published by | ||
| 9 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 10 | ;; (at your option) any later version. | ||
| 11 | |||
| 12 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | ;; GNU General Public License for more details. | ||
| 16 | |||
| 17 | ;; You should have received a copy of the GNU General Public License | ||
| 18 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | |||
| 20 | ;;; Commentary: | ||
| 21 | ;;; | ||
| 22 | ;;; This file contains functions that are used by both native NT Emacs | ||
| 23 | ;;; and Cygwin Emacs compiled to use the native Windows widget | ||
| 24 | ;;; library. | ||
| 25 | |||
| 26 | (declare-function x-server-version "w32fns.c" (&optional terminal)) | ||
| 27 | |||
| 28 | (defun w32-version () | ||
| 29 | "Return the MS-Windows version numbers. | ||
| 30 | The value is a list of three integers: the major and minor version | ||
| 31 | numbers, and the build number." | ||
| 32 | (x-server-version)) | ||
| 33 | |||
| 34 | (defun w32-using-nt () | ||
| 35 | "Return non-nil if running on a Windows NT descendant. | ||
| 36 | That includes all Windows systems except for 9X/Me." | ||
| 37 | (getenv "SystemRoot")) | ||
| 38 | |||
| 39 | (declare-function w32-get-clipboard-data "w32select.c") | ||
| 40 | (declare-function w32-set-clipboard-data "w32select.c") | ||
| 41 | (declare-function x-server-version "w32fns.c" (&optional display)) | ||
| 42 | |||
| 43 | ;;; Fix interface to (X-specific) mouse.el | ||
| 44 | (defun x-set-selection (type data) | ||
| 45 | "Make an X selection of type TYPE and value DATA. | ||
| 46 | The argument TYPE (nil means `PRIMARY') says which selection, and | ||
| 47 | DATA specifies the contents. TYPE must be a symbol. \(It can also | ||
| 48 | be a string, which stands for the symbol with that name, but this | ||
| 49 | is considered obsolete.) DATA may be a string, a symbol, an | ||
| 50 | integer (or a cons of two integers or list of two integers). | ||
| 51 | |||
| 52 | The selection may also be a cons of two markers pointing to the same buffer, | ||
| 53 | or an overlay. In these cases, the selection is considered to be the text | ||
| 54 | between the markers *at whatever time the selection is examined*. | ||
| 55 | Thus, editing done in the buffer after you specify the selection | ||
| 56 | can alter the effective value of the selection. | ||
| 57 | |||
| 58 | The data may also be a vector of valid non-vector selection values. | ||
| 59 | |||
| 60 | The return value is DATA. | ||
| 61 | |||
| 62 | Interactively, this command sets the primary selection. Without | ||
| 63 | prefix argument, it reads the selection in the minibuffer. With | ||
| 64 | prefix argument, it uses the text of the region as the selection value. | ||
| 65 | |||
| 66 | Note that on MS-Windows, primary and secondary selections set by Emacs | ||
| 67 | are not available to other programs." | ||
| 68 | (put 'x-selections (or type 'PRIMARY) data)) | ||
| 69 | |||
| 70 | (defun x-get-selection (&optional type _data-type) | ||
| 71 | "Return the value of an X Windows selection. | ||
| 72 | The argument TYPE (default `PRIMARY') says which selection, | ||
| 73 | and the argument DATA-TYPE (default `STRING') says | ||
| 74 | how to convert the data. | ||
| 75 | |||
| 76 | TYPE may be any symbol \(but nil stands for `PRIMARY'). However, | ||
| 77 | only a few symbols are commonly used. They conventionally have | ||
| 78 | all upper-case names. The most often used ones, in addition to | ||
| 79 | `PRIMARY', are `SECONDARY' and `CLIPBOARD'. | ||
| 80 | |||
| 81 | DATA-TYPE is usually `STRING', but can also be one of the symbols | ||
| 82 | in `selection-converter-alist', which see. This argument is | ||
| 83 | ignored on MS-Windows and MS-DOS." | ||
| 84 | (get 'x-selections (or type 'PRIMARY))) | ||
| 85 | |||
| 86 | ;; x-selection-owner-p is used in simple.el | ||
| 87 | (defun x-selection-owner-p (&optional selection _terminal) | ||
| 88 | "" ; placeholder for doc.c | ||
| 89 | (and (memq selection '(nil PRIMARY SECONDARY)) | ||
| 90 | (get 'x-selections (or selection 'PRIMARY)))) | ||
| 91 | |||
| 92 | ;; The "Windows" keys on newer keyboards bring up the Start menu | ||
| 93 | ;; whether you want it or not - make Emacs ignore these keystrokes | ||
| 94 | ;; rather than beep. | ||
| 95 | (global-set-key [lwindow] 'ignore) | ||
| 96 | (global-set-key [rwindow] 'ignore) | ||
| 97 | |||
| 98 | (defvar w32-charset-info-alist) ; w32font.c | ||
| 99 | |||
| 100 | |||
| 101 | ;;;; Selections | ||
| 102 | |||
| 103 | ;; We keep track of the last text selected here, so we can check the | ||
| 104 | ;; current selection against it, and avoid passing back our own text | ||
| 105 | ;; from x-selection-value. | ||
| 106 | (defvar x-last-selected-text nil) | ||
| 107 | (defvar x-select-enable-clipboard) | ||
| 108 | |||
| 109 | (defun x-get-selection-value () | ||
| 110 | "Return the value of the current selection. | ||
| 111 | Consult the selection. Treat empty strings as if they were unset." | ||
| 112 | (if x-select-enable-clipboard | ||
| 113 | (let (text) | ||
| 114 | ;; Don't die if x-get-selection signals an error. | ||
| 115 | (with-demoted-errors "w32-get-clipboard-data:%s" | ||
| 116 | (setq text (w32-get-clipboard-data))) | ||
| 117 | (if (string= text "") (setq text nil)) | ||
| 118 | (cond | ||
| 119 | ((not text) nil) | ||
| 120 | ((eq text x-last-selected-text) nil) | ||
| 121 | ((string= text x-last-selected-text) | ||
| 122 | ;; Record the newer string, so subsequent calls can use the 'eq' test. | ||
| 123 | (setq x-last-selected-text text) | ||
| 124 | nil) | ||
| 125 | (t | ||
| 126 | (setq x-last-selected-text text)))))) | ||
| 127 | |||
| 128 | (defalias 'x-selection-value 'x-get-selection-value) | ||
| 129 | |||
| 130 | ;; Arrange for the kill and yank functions to set and check the clipboard. | ||
| 131 | (setq interprogram-cut-function 'x-select-text) | ||
| 132 | (setq interprogram-paste-function 'x-get-selection-value) | ||
| 133 | |||
| 134 | (provide 'w32-common-fns) | ||
diff --git a/m4/alloca.m4 b/m4/alloca.m4 index 8408bed2882..e89f19bf697 100644 --- a/m4/alloca.m4 +++ b/m4/alloca.m4 | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | # alloca.m4 serial 14 | 1 | # alloca.m4 serial 14 |
| 2 | dnl Copyright (C) 2002-2004, 2006-2007, 2009-2015 Free Software Foundation, | 2 | dnl Copyright (C) 2002-2004, 2006-2007, 2009-2015 Free Software |
| 3 | dnl Inc. | 3 | dnl Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/m4/dup2.m4 b/m4/dup2.m4 index 0354c6ad478..bae6d01cd53 100644 --- a/m4/dup2.m4 +++ b/m4/dup2.m4 | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #serial 20 | 1 | #serial 20 |
| 2 | dnl Copyright (C) 2002, 2005, 2007, 2009-2015 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2005, 2007, 2009-2015 Free Software Foundation, |
| 3 | dnl Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/m4/filemode.m4 b/m4/filemode.m4 index e2a195c04ef..343719a5d56 100644 --- a/m4/filemode.m4 +++ b/m4/filemode.m4 | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | # filemode.m4 serial 8 | 1 | # filemode.m4 serial 8 |
| 2 | dnl Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, |
| 3 | dnl Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/m4/getgroups.m4 b/m4/getgroups.m4 index 16e72c7bf3c..8989a5ce430 100644 --- a/m4/getgroups.m4 +++ b/m4/getgroups.m4 | |||
| @@ -3,7 +3,8 @@ | |||
| 3 | dnl From Jim Meyering. | 3 | dnl From Jim Meyering. |
| 4 | dnl A wrapper around AC_FUNC_GETGROUPS. | 4 | dnl A wrapper around AC_FUNC_GETGROUPS. |
| 5 | 5 | ||
| 6 | # Copyright (C) 1996-1997, 1999-2004, 2008-2015 Free Software Foundation, Inc. | 6 | # Copyright (C) 1996-1997, 1999-2004, 2008-2015 Free Software |
| 7 | # Foundation, Inc. | ||
| 7 | # | 8 | # |
| 8 | # This file is free software; the Free Software Foundation | 9 | # This file is free software; the Free Software Foundation |
| 9 | # gives unlimited permission to copy and/or distribute it, | 10 | # gives unlimited permission to copy and/or distribute it, |
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4 index 1234ba9fe2b..4844ae37a15 100644 --- a/m4/getloadavg.m4 +++ b/m4/getloadavg.m4 | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | # Check for getloadavg. | 1 | # Check for getloadavg. |
| 2 | 2 | ||
| 3 | # Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2015 Free Software | 3 | # Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2015 Free |
| 4 | # Foundation, Inc. | 4 | # Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | # This file is free software; the Free Software Foundation | 6 | # This file is free software; the Free Software Foundation |
| 7 | # gives unlimited permission to copy and/or distribute it, | 7 | # gives unlimited permission to copy and/or distribute it, |
diff --git a/m4/gettime.m4 b/m4/gettime.m4 index cd499ff5d79..175e482050a 100644 --- a/m4/gettime.m4 +++ b/m4/gettime.m4 | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | # gettime.m4 serial 8 | 1 | # gettime.m4 serial 8 |
| 2 | dnl Copyright (C) 2002, 2004-2006, 2009-2015 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2004-2006, 2009-2015 Free Software Foundation, |
| 3 | dnl Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4 index ce246e18bc2..95317d3c1e8 100644 --- a/m4/gettimeofday.m4 +++ b/m4/gettimeofday.m4 | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | # serial 21 | 1 | # serial 21 |
| 2 | 2 | ||
| 3 | # Copyright (C) 2001-2003, 2005, 2007, 2009-2015 Free Software Foundation, Inc. | 3 | # Copyright (C) 2001-2003, 2005, 2007, 2009-2015 Free Software |
| 4 | # Foundation, Inc. | ||
| 4 | # This file is free software; the Free Software Foundation | 5 | # This file is free software; the Free Software Foundation |
| 5 | # gives unlimited permission to copy and/or distribute it, | 6 | # gives unlimited permission to copy and/or distribute it, |
| 6 | # with or without modifications, as long as this notice is preserved. | 7 | # with or without modifications, as long as this notice is preserved. |
diff --git a/m4/group-member.m4 b/m4/group-member.m4 index 526a67a895b..b18e95bead2 100644 --- a/m4/group-member.m4 +++ b/m4/group-member.m4 | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | # serial 14 | 1 | # serial 14 |
| 2 | 2 | ||
| 3 | # Copyright (C) 1999-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc. | 3 | # Copyright (C) 1999-2001, 2003-2007, 2009-2015 Free Software |
| 4 | # Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | # This file is free software; the Free Software Foundation | 6 | # This file is free software; the Free Software Foundation |
| 6 | # gives unlimited permission to copy and/or distribute it, | 7 | # gives unlimited permission to copy and/or distribute it, |
diff --git a/m4/memrchr.m4 b/m4/memrchr.m4 index f3f74b82cc0..bac0a7a95a0 100644 --- a/m4/memrchr.m4 +++ b/m4/memrchr.m4 | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | # memrchr.m4 serial 10 | 1 | # memrchr.m4 serial 10 |
| 2 | dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software Foundation, | 2 | dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software |
| 3 | dnl Inc. | 3 | dnl Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/m4/mktime.m4 b/m4/mktime.m4 index 3f0e1eee440..aa1b98564e0 100644 --- a/m4/mktime.m4 +++ b/m4/mktime.m4 | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | # serial 25 | 1 | # serial 25 |
| 2 | dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software Foundation, | 2 | dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software |
| 3 | dnl Inc. | 3 | dnl Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/m4/pathmax.m4 b/m4/pathmax.m4 index 0e3db7a237b..ee4ed0b1799 100644 --- a/m4/pathmax.m4 +++ b/m4/pathmax.m4 | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | # pathmax.m4 serial 10 | 1 | # pathmax.m4 serial 10 |
| 2 | dnl Copyright (C) 2002-2003, 2005-2006, 2009-2015 Free Software Foundation, | 2 | dnl Copyright (C) 2002-2003, 2005-2006, 2009-2015 Free Software |
| 3 | dnl Inc. | 3 | dnl Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/m4/sig2str.m4 b/m4/sig2str.m4 index 71cfa4b2bfa..f9b2e118907 100644 --- a/m4/sig2str.m4 +++ b/m4/sig2str.m4 | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | # serial 7 | 1 | # serial 7 |
| 2 | dnl Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, |
| 3 | dnl Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/m4/ssize_t.m4 b/m4/ssize_t.m4 index 25bd4514343..06d3b60eeac 100644 --- a/m4/ssize_t.m4 +++ b/m4/ssize_t.m4 | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | # ssize_t.m4 serial 5 (gettext-0.18.2) | 1 | # ssize_t.m4 serial 5 (gettext-0.18.2) |
| 2 | dnl Copyright (C) 2001-2003, 2006, 2010-2015 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2003, 2006, 2010-2015 Free Software Foundation, |
| 3 | dnl Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/m4/st_dm_mode.m4 b/m4/st_dm_mode.m4 index 6543bf625b5..df69a8413c6 100644 --- a/m4/st_dm_mode.m4 +++ b/m4/st_dm_mode.m4 | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | # serial 6 | 1 | # serial 6 |
| 2 | 2 | ||
| 3 | # Copyright (C) 1998-1999, 2001, 2009-2015 Free Software Foundation, Inc. | 3 | # Copyright (C) 1998-1999, 2001, 2009-2015 Free Software Foundation, |
| 4 | # Inc. | ||
| 4 | # This file is free software; the Free Software Foundation | 5 | # This file is free software; the Free Software Foundation |
| 5 | # gives unlimited permission to copy and/or distribute it, | 6 | # gives unlimited permission to copy and/or distribute it, |
| 6 | # with or without modifications, as long as this notice is preserved. | 7 | # with or without modifications, as long as this notice is preserved. |
diff --git a/m4/stat-time.m4 b/m4/stat-time.m4 index 9c8ceec1893..c7cacaa494f 100644 --- a/m4/stat-time.m4 +++ b/m4/stat-time.m4 | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | # Checks for stat-related time functions. | 1 | # Checks for stat-related time functions. |
| 2 | 2 | ||
| 3 | # Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2015 Free Software | 3 | # Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2015 Free |
| 4 | # Foundation, Inc. | 4 | # Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | # This file is free software; the Free Software Foundation | 6 | # This file is free software; the Free Software Foundation |
| 7 | # gives unlimited permission to copy and/or distribute it, | 7 | # gives unlimited permission to copy and/or distribute it, |
diff --git a/m4/stdarg.m4 b/m4/stdarg.m4 new file mode 100644 index 00000000000..d208eb35e43 --- /dev/null +++ b/m4/stdarg.m4 | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | # stdarg.m4 serial 6 | ||
| 2 | dnl Copyright (C) 2006, 2008-2015 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | dnl From Bruno Haible. | ||
| 8 | dnl Provide a working va_copy in combination with <stdarg.h>. | ||
| 9 | |||
| 10 | AC_DEFUN([gl_STDARG_H], | ||
| 11 | [ | ||
| 12 | STDARG_H='' | ||
| 13 | NEXT_STDARG_H='<stdarg.h>' | ||
| 14 | AC_MSG_CHECKING([for va_copy]) | ||
| 15 | AC_CACHE_VAL([gl_cv_func_va_copy], [ | ||
| 16 | AC_COMPILE_IFELSE( | ||
| 17 | [AC_LANG_PROGRAM( | ||
| 18 | [[#include <stdarg.h>]], | ||
| 19 | [[ | ||
| 20 | #ifndef va_copy | ||
| 21 | void (*func) (va_list, va_list) = va_copy; | ||
| 22 | #endif | ||
| 23 | ]])], | ||
| 24 | [gl_cv_func_va_copy=yes], | ||
| 25 | [gl_cv_func_va_copy=no])]) | ||
| 26 | AC_MSG_RESULT([$gl_cv_func_va_copy]) | ||
| 27 | if test $gl_cv_func_va_copy = no; then | ||
| 28 | dnl Provide a substitute. | ||
| 29 | dnl Usually a simple definition in <config.h> is enough. Not so on AIX 5 | ||
| 30 | dnl with some versions of the /usr/vac/bin/cc compiler. It has an <stdarg.h> | ||
| 31 | dnl which does '#undef va_copy', leading to a missing va_copy symbol. For | ||
| 32 | dnl this platform, we use an <stdarg.h> substitute. But we cannot use this | ||
| 33 | dnl approach on other platforms, because <stdarg.h> often defines only | ||
| 34 | dnl preprocessor macros and gl_ABSOLUTE_HEADER, gl_CHECK_NEXT_HEADERS do | ||
| 35 | dnl not work in this situation. | ||
| 36 | AC_EGREP_CPP([vaccine], | ||
| 37 | [#if defined _AIX && !defined __GNUC__ | ||
| 38 | AIX vaccine | ||
| 39 | #endif | ||
| 40 | ], [gl_aixcc=yes], [gl_aixcc=no]) | ||
| 41 | if test $gl_aixcc = yes; then | ||
| 42 | dnl Provide a substitute <stdarg.h> file. | ||
| 43 | STDARG_H=stdarg.h | ||
| 44 | gl_NEXT_HEADERS([stdarg.h]) | ||
| 45 | dnl Fallback for the case when <stdarg.h> contains only macro definitions. | ||
| 46 | if test "$gl_cv_next_stdarg_h" = '""'; then | ||
| 47 | gl_cv_next_stdarg_h='"///usr/include/stdarg.h"' | ||
| 48 | NEXT_STDARG_H="$gl_cv_next_stdarg_h" | ||
| 49 | fi | ||
| 50 | else | ||
| 51 | dnl Provide a substitute in <config.h>, either __va_copy or as a simple | ||
| 52 | dnl assignment. | ||
| 53 | gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [ | ||
| 54 | AC_COMPILE_IFELSE( | ||
| 55 | [AC_LANG_PROGRAM( | ||
| 56 | [[#include <stdarg.h>]], | ||
| 57 | [[ | ||
| 58 | #ifndef __va_copy | ||
| 59 | error, bail out | ||
| 60 | #endif | ||
| 61 | ]])], | ||
| 62 | [gl_cv_func___va_copy=yes], | ||
| 63 | [gl_cv_func___va_copy=no])]) | ||
| 64 | if test $gl_cv_func___va_copy = yes; then | ||
| 65 | AC_DEFINE([va_copy], [__va_copy], | ||
| 66 | [Define as a macro for copying va_list variables.]) | ||
| 67 | else | ||
| 68 | AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed. */ | ||
| 69 | #define gl_va_copy(a,b) ((a) = (b))]) | ||
| 70 | AC_DEFINE([va_copy], [gl_va_copy], | ||
| 71 | [Define as a macro for copying va_list variables.]) | ||
| 72 | fi | ||
| 73 | fi | ||
| 74 | fi | ||
| 75 | AC_SUBST([STDARG_H]) | ||
| 76 | AM_CONDITIONAL([GL_GENERATE_STDARG_H], [test -n "$STDARG_H"]) | ||
| 77 | AC_SUBST([NEXT_STDARG_H]) | ||
| 78 | ]) | ||
diff --git a/m4/stdbool.m4 b/m4/stdbool.m4 new file mode 100644 index 00000000000..7273b822465 --- /dev/null +++ b/m4/stdbool.m4 | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | # Check for stdbool.h that conforms to C99. | ||
| 2 | |||
| 3 | dnl Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc. | ||
| 4 | dnl This file is free software; the Free Software Foundation | ||
| 5 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 6 | dnl with or without modifications, as long as this notice is preserved. | ||
| 7 | |||
| 8 | #serial 5 | ||
| 9 | |||
| 10 | # Prepare for substituting <stdbool.h> if it is not supported. | ||
| 11 | |||
| 12 | AC_DEFUN([AM_STDBOOL_H], | ||
| 13 | [ | ||
| 14 | AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) | ||
| 15 | |||
| 16 | # Define two additional variables used in the Makefile substitution. | ||
| 17 | |||
| 18 | if test "$ac_cv_header_stdbool_h" = yes; then | ||
| 19 | STDBOOL_H='' | ||
| 20 | else | ||
| 21 | STDBOOL_H='stdbool.h' | ||
| 22 | fi | ||
| 23 | AC_SUBST([STDBOOL_H]) | ||
| 24 | AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) | ||
| 25 | |||
| 26 | if test "$ac_cv_type__Bool" = yes; then | ||
| 27 | HAVE__BOOL=1 | ||
| 28 | else | ||
| 29 | HAVE__BOOL=0 | ||
| 30 | fi | ||
| 31 | AC_SUBST([HAVE__BOOL]) | ||
| 32 | ]) | ||
| 33 | |||
| 34 | # AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. | ||
| 35 | AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) | ||
| 36 | |||
| 37 | # This version of the macro is needed in autoconf <= 2.68. | ||
| 38 | |||
| 39 | AC_DEFUN([AC_CHECK_HEADER_STDBOOL], | ||
| 40 | [AC_CACHE_CHECK([for stdbool.h that conforms to C99], | ||
| 41 | [ac_cv_header_stdbool_h], | ||
| 42 | [AC_COMPILE_IFELSE( | ||
| 43 | [AC_LANG_PROGRAM( | ||
| 44 | [[ | ||
| 45 | #include <stdbool.h> | ||
| 46 | #ifndef bool | ||
| 47 | "error: bool is not defined" | ||
| 48 | #endif | ||
| 49 | #ifndef false | ||
| 50 | "error: false is not defined" | ||
| 51 | #endif | ||
| 52 | #if false | ||
| 53 | "error: false is not 0" | ||
| 54 | #endif | ||
| 55 | #ifndef true | ||
| 56 | "error: true is not defined" | ||
| 57 | #endif | ||
| 58 | #if true != 1 | ||
| 59 | "error: true is not 1" | ||
| 60 | #endif | ||
| 61 | #ifndef __bool_true_false_are_defined | ||
| 62 | "error: __bool_true_false_are_defined is not defined" | ||
| 63 | #endif | ||
| 64 | |||
| 65 | struct s { _Bool s: 1; _Bool t; } s; | ||
| 66 | |||
| 67 | char a[true == 1 ? 1 : -1]; | ||
| 68 | char b[false == 0 ? 1 : -1]; | ||
| 69 | char c[__bool_true_false_are_defined == 1 ? 1 : -1]; | ||
| 70 | char d[(bool) 0.5 == true ? 1 : -1]; | ||
| 71 | /* See body of main program for 'e'. */ | ||
| 72 | char f[(_Bool) 0.0 == false ? 1 : -1]; | ||
| 73 | char g[true]; | ||
| 74 | char h[sizeof (_Bool)]; | ||
| 75 | char i[sizeof s.t]; | ||
| 76 | enum { j = false, k = true, l = false * true, m = true * 256 }; | ||
| 77 | /* The following fails for | ||
| 78 | HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ | ||
| 79 | _Bool n[m]; | ||
| 80 | char o[sizeof n == m * sizeof n[0] ? 1 : -1]; | ||
| 81 | char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; | ||
| 82 | /* Catch a bug in an HP-UX C compiler. See | ||
| 83 | http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html | ||
| 84 | http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html | ||
| 85 | */ | ||
| 86 | _Bool q = true; | ||
| 87 | _Bool *pq = &q; | ||
| 88 | ]], | ||
| 89 | [[ | ||
| 90 | bool e = &s; | ||
| 91 | *pq |= q; | ||
| 92 | *pq |= ! q; | ||
| 93 | /* Refer to every declared value, to avoid compiler optimizations. */ | ||
| 94 | return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l | ||
| 95 | + !m + !n + !o + !p + !q + !pq); | ||
| 96 | ]])], | ||
| 97 | [ac_cv_header_stdbool_h=yes], | ||
| 98 | [ac_cv_header_stdbool_h=no])]) | ||
| 99 | AC_CHECK_TYPES([_Bool]) | ||
| 100 | ]) | ||
diff --git a/m4/strftime.m4 b/m4/strftime.m4 index 4557626ae08..dafcbaa733b 100644 --- a/m4/strftime.m4 +++ b/m4/strftime.m4 | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | # serial 33 | 1 | # serial 33 |
| 2 | 2 | ||
| 3 | # Copyright (C) 1996-1997, 1999-2007, 2009-2015 Free Software Foundation, Inc. | 3 | # Copyright (C) 1996-1997, 1999-2007, 2009-2015 Free Software |
| 4 | # Foundation, Inc. | ||
| 4 | # | 5 | # |
| 5 | # This file is free software; the Free Software Foundation | 6 | # This file is free software; the Free Software Foundation |
| 6 | # gives unlimited permission to copy and/or distribute it, | 7 | # gives unlimited permission to copy and/or distribute it, |
diff --git a/m4/strtoimax.m4 b/m4/strtoimax.m4 index fde732aa90a..7662cf8b372 100644 --- a/m4/strtoimax.m4 +++ b/m4/strtoimax.m4 | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | # strtoimax.m4 serial 14 | 1 | # strtoimax.m4 serial 14 |
| 2 | dnl Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation, |
| 3 | dnl Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/m4/strtoll.m4 b/m4/strtoll.m4 index 666f44a6ba2..43365e140d8 100644 --- a/m4/strtoll.m4 +++ b/m4/strtoll.m4 | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | # strtoll.m4 serial 7 | 1 | # strtoll.m4 serial 7 |
| 2 | dnl Copyright (C) 2002, 2004, 2006, 2008-2015 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2004, 2006, 2008-2015 Free Software Foundation, |
| 3 | dnl Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/m4/strtoull.m4 b/m4/strtoull.m4 index 4267bd72569..982286259bd 100644 --- a/m4/strtoull.m4 +++ b/m4/strtoull.m4 | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | # strtoull.m4 serial 7 | 1 | # strtoull.m4 serial 7 |
| 2 | dnl Copyright (C) 2002, 2004, 2006, 2008-2015 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2004, 2006, 2008-2015 Free Software Foundation, |
| 3 | dnl Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/m4/strtoumax.m4 b/m4/strtoumax.m4 index 5312ef4d518..d9d7893f1fb 100644 --- a/m4/strtoumax.m4 +++ b/m4/strtoumax.m4 | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | # strtoumax.m4 serial 12 | 1 | # strtoumax.m4 serial 12 |
| 2 | dnl Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation, |
| 3 | dnl Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
diff --git a/m4/time_h.m4 b/m4/time_h.m4 index 0f0b7d9a2ac..03579a3ae37 100644 --- a/m4/time_h.m4 +++ b/m4/time_h.m4 | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | # Configure a more-standard replacement for <time.h>. | 1 | # Configure a more-standard replacement for <time.h>. |
| 2 | 2 | ||
| 3 | # Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc. | 3 | # Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software |
| 4 | # Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | # serial 8 | 6 | # serial 8 |
| 6 | 7 | ||
diff --git a/m4/timespec.m4 b/m4/timespec.m4 index 06b3533e42f..e5dc48d8ec4 100644 --- a/m4/timespec.m4 +++ b/m4/timespec.m4 | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #serial 15 | 1 | #serial 15 |
| 2 | 2 | ||
| 3 | # Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc. | 3 | # Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software |
| 4 | # Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | # This file is free software; the Free Software Foundation | 6 | # This file is free software; the Free Software Foundation |
| 6 | # gives unlimited permission to copy and/or distribute it, | 7 | # gives unlimited permission to copy and/or distribute it, |
diff --git a/m4/utimbuf.m4 b/m4/utimbuf.m4 index 7c33ae94923..fae96f1a2da 100644 --- a/m4/utimbuf.m4 +++ b/m4/utimbuf.m4 | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | # serial 9 | 1 | # serial 9 |
| 2 | 2 | ||
| 3 | # Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2015 Free Software Foundation, | 3 | # Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2015 Free Software |
| 4 | # Inc. | 4 | # Foundation, Inc. |
| 5 | # | 5 | # |
| 6 | # This file is free software; the Free Software Foundation | 6 | # This file is free software; the Free Software Foundation |
| 7 | # gives unlimited permission to copy and/or distribute it, | 7 | # gives unlimited permission to copy and/or distribute it, |
diff --git a/nt/addsection.c b/nt/addsection.c new file mode 100644 index 00000000000..61b2fda6640 --- /dev/null +++ b/nt/addsection.c | |||
| @@ -0,0 +1,544 @@ | |||
| 1 | /* Add an uninitialized data section to an executable. | ||
| 2 | Copyright (C) 1999, 2001-2015 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This file is part of GNU Emacs. | ||
| 5 | |||
| 6 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation, either version 3 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | |||
| 19 | |||
| 20 | Andrew Innes <andrewi@harlequin.co.uk> 04-Jan-1999 | ||
| 21 | based on code from unexw32.c | ||
| 22 | */ | ||
| 23 | |||
| 24 | #include <stdlib.h> | ||
| 25 | #include <stdio.h> | ||
| 26 | #include <fcntl.h> | ||
| 27 | #include <time.h> | ||
| 28 | #if defined(__GNUC__) && !defined(MINGW_W64) | ||
| 29 | #define _ANONYMOUS_UNION | ||
| 30 | #define _ANONYMOUS_STRUCT | ||
| 31 | #endif | ||
| 32 | #include <windows.h> | ||
| 33 | |||
| 34 | /* Include relevant definitions from IMAGEHLP.H, which can be found | ||
| 35 | in \\win32sdk\mstools\samples\image\include\imagehlp.h. */ | ||
| 36 | |||
| 37 | PIMAGE_NT_HEADERS | ||
| 38 | (__stdcall * pfnCheckSumMappedFile) (PVOID BaseAddress, | ||
| 39 | DWORD_PTR FileLength, | ||
| 40 | PDWORD_PTR HeaderSum, | ||
| 41 | PDWORD_PTR CheckSum); | ||
| 42 | |||
| 43 | #undef min | ||
| 44 | #undef max | ||
| 45 | #define min(x, y) (((x) < (y)) ? (x) : (y)) | ||
| 46 | #define max(x, y) (((x) > (y)) ? (x) : (y)) | ||
| 47 | |||
| 48 | |||
| 49 | /* File handling. */ | ||
| 50 | |||
| 51 | typedef struct file_data { | ||
| 52 | const char *name; | ||
| 53 | unsigned long size; | ||
| 54 | HANDLE file; | ||
| 55 | HANDLE file_mapping; | ||
| 56 | unsigned char *file_base; | ||
| 57 | } file_data; | ||
| 58 | |||
| 59 | int | ||
| 60 | open_input_file (file_data *p_file, const char *filename) | ||
| 61 | { | ||
| 62 | HANDLE file; | ||
| 63 | HANDLE file_mapping; | ||
| 64 | void *file_base; | ||
| 65 | unsigned long size, upper_size; | ||
| 66 | |||
| 67 | file = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ, NULL, | ||
| 68 | OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); | ||
| 69 | if (file == INVALID_HANDLE_VALUE) | ||
| 70 | return FALSE; | ||
| 71 | |||
| 72 | size = GetFileSize (file, &upper_size); | ||
| 73 | file_mapping = CreateFileMapping (file, NULL, PAGE_READONLY, | ||
| 74 | 0, size, NULL); | ||
| 75 | if (!file_mapping) | ||
| 76 | return FALSE; | ||
| 77 | |||
| 78 | file_base = MapViewOfFile (file_mapping, FILE_MAP_READ, 0, 0, size); | ||
| 79 | if (file_base == 0) | ||
| 80 | return FALSE; | ||
| 81 | |||
| 82 | p_file->name = filename; | ||
| 83 | p_file->size = size; | ||
| 84 | p_file->file = file; | ||
| 85 | p_file->file_mapping = file_mapping; | ||
| 86 | p_file->file_base = file_base; | ||
| 87 | |||
| 88 | return TRUE; | ||
| 89 | } | ||
| 90 | |||
| 91 | int | ||
| 92 | open_output_file (file_data *p_file, const char *filename, unsigned long size) | ||
| 93 | { | ||
| 94 | HANDLE file; | ||
| 95 | HANDLE file_mapping; | ||
| 96 | void *file_base; | ||
| 97 | |||
| 98 | file = CreateFile (filename, GENERIC_READ | GENERIC_WRITE, 0, NULL, | ||
| 99 | CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); | ||
| 100 | if (file == INVALID_HANDLE_VALUE) | ||
| 101 | return FALSE; | ||
| 102 | |||
| 103 | file_mapping = CreateFileMapping (file, NULL, PAGE_READWRITE, | ||
| 104 | 0, size, NULL); | ||
| 105 | if (!file_mapping) | ||
| 106 | return FALSE; | ||
| 107 | |||
| 108 | file_base = MapViewOfFile (file_mapping, FILE_MAP_WRITE, 0, 0, size); | ||
| 109 | if (file_base == 0) | ||
| 110 | return FALSE; | ||
| 111 | |||
| 112 | p_file->name = filename; | ||
| 113 | p_file->size = size; | ||
| 114 | p_file->file = file; | ||
| 115 | p_file->file_mapping = file_mapping; | ||
| 116 | p_file->file_base = file_base; | ||
| 117 | |||
| 118 | return TRUE; | ||
| 119 | } | ||
| 120 | |||
| 121 | /* Close the system structures associated with the given file. */ | ||
| 122 | void | ||
| 123 | close_file_data (file_data *p_file) | ||
| 124 | { | ||
| 125 | UnmapViewOfFile (p_file->file_base); | ||
| 126 | CloseHandle (p_file->file_mapping); | ||
| 127 | /* For the case of output files, set final size. */ | ||
| 128 | SetFilePointer (p_file->file, p_file->size, NULL, FILE_BEGIN); | ||
| 129 | SetEndOfFile (p_file->file); | ||
| 130 | CloseHandle (p_file->file); | ||
| 131 | } | ||
| 132 | |||
| 133 | |||
| 134 | /* Routines to manipulate NT executable file sections. */ | ||
| 135 | |||
| 136 | unsigned long | ||
| 137 | get_unrounded_section_size (PIMAGE_SECTION_HEADER p_section) | ||
| 138 | { | ||
| 139 | /* The true section size, before rounding, for an initialized data or | ||
| 140 | code section. (Supposedly some linkers swap the meaning of these | ||
| 141 | two values.) */ | ||
| 142 | return min (p_section->SizeOfRawData, | ||
| 143 | p_section->Misc.VirtualSize); | ||
| 144 | } | ||
| 145 | |||
| 146 | /* Return pointer to section header for named section. */ | ||
| 147 | IMAGE_SECTION_HEADER * | ||
| 148 | find_section (const char *name, IMAGE_NT_HEADERS *nt_header) | ||
| 149 | { | ||
| 150 | PIMAGE_SECTION_HEADER section; | ||
| 151 | int i; | ||
| 152 | |||
| 153 | section = IMAGE_FIRST_SECTION (nt_header); | ||
| 154 | |||
| 155 | for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++) | ||
| 156 | { | ||
| 157 | if (strcmp (section->Name, name) == 0) | ||
| 158 | return section; | ||
| 159 | section++; | ||
| 160 | } | ||
| 161 | return NULL; | ||
| 162 | } | ||
| 163 | |||
| 164 | /* Return pointer to section header for section containing the given | ||
| 165 | relative virtual address. */ | ||
| 166 | IMAGE_SECTION_HEADER * | ||
| 167 | rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header) | ||
| 168 | { | ||
| 169 | PIMAGE_SECTION_HEADER section; | ||
| 170 | int i; | ||
| 171 | |||
| 172 | section = IMAGE_FIRST_SECTION (nt_header); | ||
| 173 | |||
| 174 | for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++) | ||
| 175 | { | ||
| 176 | /* Some linkers (eg. the NT SDK linker I believe) swapped the | ||
| 177 | meaning of these two values - or rather, they ignored | ||
| 178 | VirtualSize entirely and always set it to zero. This affects | ||
| 179 | some very old exes (eg. gzip dated Dec 1993). Since | ||
| 180 | w32_executable_type relies on this function to work reliably, | ||
| 181 | we need to cope with this. */ | ||
| 182 | DWORD_PTR real_size = max (section->SizeOfRawData, | ||
| 183 | section->Misc.VirtualSize); | ||
| 184 | if (rva >= section->VirtualAddress | ||
| 185 | && rva < section->VirtualAddress + real_size) | ||
| 186 | return section; | ||
| 187 | section++; | ||
| 188 | } | ||
| 189 | return NULL; | ||
| 190 | } | ||
| 191 | |||
| 192 | /* Return pointer to section header for section containing the given | ||
| 193 | offset in its raw data area. */ | ||
| 194 | IMAGE_SECTION_HEADER * | ||
| 195 | offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header) | ||
| 196 | { | ||
| 197 | PIMAGE_SECTION_HEADER section; | ||
| 198 | int i; | ||
| 199 | |||
| 200 | section = IMAGE_FIRST_SECTION (nt_header); | ||
| 201 | |||
| 202 | for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++) | ||
| 203 | { | ||
| 204 | if (offset >= section->PointerToRawData | ||
| 205 | && offset < section->PointerToRawData + section->SizeOfRawData) | ||
| 206 | return section; | ||
| 207 | section++; | ||
| 208 | } | ||
| 209 | return NULL; | ||
| 210 | } | ||
| 211 | |||
| 212 | /* Return offset to an object in dst, given offset in src. We assume | ||
| 213 | there is at least one section in both src and dst images, and that | ||
| 214 | the some sections may have been added to dst (after sections in src). */ | ||
| 215 | static DWORD_PTR | ||
| 216 | relocate_offset (DWORD_PTR offset, | ||
| 217 | IMAGE_NT_HEADERS * src_nt_header, | ||
| 218 | IMAGE_NT_HEADERS * dst_nt_header) | ||
| 219 | { | ||
| 220 | PIMAGE_SECTION_HEADER src_section = IMAGE_FIRST_SECTION (src_nt_header); | ||
| 221 | PIMAGE_SECTION_HEADER dst_section = IMAGE_FIRST_SECTION (dst_nt_header); | ||
| 222 | int i = 0; | ||
| 223 | |||
| 224 | while (offset >= src_section->PointerToRawData) | ||
| 225 | { | ||
| 226 | if (offset < src_section->PointerToRawData + src_section->SizeOfRawData) | ||
| 227 | break; | ||
| 228 | i++; | ||
| 229 | if (i == src_nt_header->FileHeader.NumberOfSections) | ||
| 230 | { | ||
| 231 | /* Handle offsets after the last section. */ | ||
| 232 | dst_section = IMAGE_FIRST_SECTION (dst_nt_header); | ||
| 233 | dst_section += dst_nt_header->FileHeader.NumberOfSections - 1; | ||
| 234 | while (dst_section->PointerToRawData == 0) | ||
| 235 | dst_section--; | ||
| 236 | while (src_section->PointerToRawData == 0) | ||
| 237 | src_section--; | ||
| 238 | return offset | ||
| 239 | + (dst_section->PointerToRawData + dst_section->SizeOfRawData) | ||
| 240 | - (src_section->PointerToRawData + src_section->SizeOfRawData); | ||
| 241 | } | ||
| 242 | src_section++; | ||
| 243 | dst_section++; | ||
| 244 | } | ||
| 245 | return offset + | ||
| 246 | (dst_section->PointerToRawData - src_section->PointerToRawData); | ||
| 247 | } | ||
| 248 | |||
| 249 | #define OFFSET_TO_RVA(offset, section) \ | ||
| 250 | (section->VirtualAddress + ((DWORD_PTR)(offset) - section->PointerToRawData)) | ||
| 251 | |||
| 252 | #define RVA_TO_OFFSET(rva, section) \ | ||
| 253 | (section->PointerToRawData + ((DWORD_PTR)(rva) - section->VirtualAddress)) | ||
| 254 | |||
| 255 | #define RVA_TO_SECTION_OFFSET(rva, section) \ | ||
| 256 | ((DWORD_PTR)(rva) - section->VirtualAddress) | ||
| 257 | |||
| 258 | /* Convert address in executing image to RVA. */ | ||
| 259 | #define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL)) | ||
| 260 | |||
| 261 | #define PTR_TO_OFFSET(ptr, pfile_data) \ | ||
| 262 | ((unsigned const char *)(ptr) - (pfile_data)->file_base) | ||
| 263 | |||
| 264 | #define OFFSET_TO_PTR(offset, pfile_data) \ | ||
| 265 | ((pfile_data)->file_base + (DWORD_PTR)(offset)) | ||
| 266 | |||
| 267 | #define ROUND_UP(p, align) \ | ||
| 268 | (((DWORD_PTR)(p) + (align)-1) & ~((DWORD_PTR)(align)-1)) | ||
| 269 | #define ROUND_DOWN(p, align) ((DWORD_PTR)(p) & ~((DWORD_PTR)(align)-1)) | ||
| 270 | |||
| 271 | |||
| 272 | static void | ||
| 273 | copy_executable_and_add_section (file_data *p_infile, | ||
| 274 | file_data *p_outfile, | ||
| 275 | const char *new_section_name, | ||
| 276 | DWORD_PTR new_section_size) | ||
| 277 | { | ||
| 278 | unsigned char *dst; | ||
| 279 | PIMAGE_DOS_HEADER dos_header; | ||
| 280 | PIMAGE_NT_HEADERS nt_header; | ||
| 281 | PIMAGE_NT_HEADERS dst_nt_header; | ||
| 282 | PIMAGE_SECTION_HEADER section; | ||
| 283 | PIMAGE_SECTION_HEADER dst_section; | ||
| 284 | DWORD_PTR offset; | ||
| 285 | int i; | ||
| 286 | int be_verbose = GetEnvironmentVariable ("DEBUG_DUMP", NULL, 0) > 0; | ||
| 287 | |||
| 288 | #define COPY_CHUNK(message, src, size, verbose) \ | ||
| 289 | do { \ | ||
| 290 | unsigned const char *s = (void *)(src); \ | ||
| 291 | unsigned long count = (size); \ | ||
| 292 | if (verbose) \ | ||
| 293 | { \ | ||
| 294 | printf ("%s\n", (message)); \ | ||
| 295 | printf ("\t0x%08x Offset in input file.\n", s - p_infile->file_base); \ | ||
| 296 | printf ("\t0x%08x Offset in output file.\n", dst - p_outfile->file_base); \ | ||
| 297 | printf ("\t0x%08x Size in bytes.\n", count); \ | ||
| 298 | } \ | ||
| 299 | memcpy (dst, s, count); \ | ||
| 300 | dst += count; \ | ||
| 301 | } while (0) | ||
| 302 | |||
| 303 | #define DST_TO_OFFSET() PTR_TO_OFFSET (dst, p_outfile) | ||
| 304 | #define ROUND_UP_DST_AND_ZERO(align) \ | ||
| 305 | do { \ | ||
| 306 | unsigned char *newdst = p_outfile->file_base \ | ||
| 307 | + ROUND_UP (DST_TO_OFFSET (), (align)); \ | ||
| 308 | /* Zero the alignment slop; it may actually initialize real data. */ \ | ||
| 309 | memset (dst, 0, newdst - dst); \ | ||
| 310 | dst = newdst; \ | ||
| 311 | } while (0) | ||
| 312 | |||
| 313 | /* Copy the source image sequentially, ie. section by section after | ||
| 314 | copying the headers and section table, to simplify the process of | ||
| 315 | adding an extra section table entry (which might force the raw | ||
| 316 | section data to be relocated). | ||
| 317 | |||
| 318 | Note that dst is updated implicitly by each COPY_CHUNK. */ | ||
| 319 | |||
| 320 | dos_header = (PIMAGE_DOS_HEADER) p_infile->file_base; | ||
| 321 | nt_header = (PIMAGE_NT_HEADERS) (((unsigned char *) dos_header) + | ||
| 322 | dos_header->e_lfanew); | ||
| 323 | section = IMAGE_FIRST_SECTION (nt_header); | ||
| 324 | |||
| 325 | dst = (unsigned char *) p_outfile->file_base; | ||
| 326 | |||
| 327 | COPY_CHUNK ("Copying DOS header...", dos_header, | ||
| 328 | (DWORD_PTR) nt_header - (DWORD_PTR) dos_header, be_verbose); | ||
| 329 | dst_nt_header = (PIMAGE_NT_HEADERS) dst; | ||
| 330 | COPY_CHUNK ("Copying NT header...", nt_header, | ||
| 331 | (DWORD_PTR) section - (DWORD_PTR) nt_header, be_verbose); | ||
| 332 | dst_section = (PIMAGE_SECTION_HEADER) dst; | ||
| 333 | COPY_CHUNK ("Copying section table...", section, | ||
| 334 | nt_header->FileHeader.NumberOfSections * sizeof (*section), | ||
| 335 | be_verbose); | ||
| 336 | |||
| 337 | /* To improve the efficiency of demand loading, make the file | ||
| 338 | alignment match the section alignment (VC++ 6.0 does this by | ||
| 339 | default anyway). */ | ||
| 340 | dst_nt_header->OptionalHeader.FileAlignment = | ||
| 341 | dst_nt_header->OptionalHeader.SectionAlignment; | ||
| 342 | |||
| 343 | /* Add an uninitialized data section at the end, of the specified name | ||
| 344 | and virtual size. */ | ||
| 345 | if (find_section (new_section_name, nt_header) == NULL) | ||
| 346 | /* Leave room for extra section table entry; filled in below. */ | ||
| 347 | dst += sizeof (*section); | ||
| 348 | else | ||
| 349 | new_section_name = NULL; | ||
| 350 | |||
| 351 | /* Align the first section's raw data area, and set the header size | ||
| 352 | field accordingly. */ | ||
| 353 | ROUND_UP_DST_AND_ZERO (dst_nt_header->OptionalHeader.FileAlignment); | ||
| 354 | dst_nt_header->OptionalHeader.SizeOfHeaders = DST_TO_OFFSET (); | ||
| 355 | |||
| 356 | for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++) | ||
| 357 | { | ||
| 358 | char msg[100]; | ||
| 359 | /* Windows section names are fixed 8-char strings, only | ||
| 360 | zero-terminated if the name is shorter than 8 characters. */ | ||
| 361 | sprintf (msg, "Copying raw data for %.8s...", section->Name); | ||
| 362 | |||
| 363 | /* Update the file-relative offset for this section's raw data (if | ||
| 364 | it has any) in case things have been relocated; we will update | ||
| 365 | the other offsets below once we know where everything is. */ | ||
| 366 | if (dst_section->PointerToRawData) | ||
| 367 | dst_section->PointerToRawData = DST_TO_OFFSET (); | ||
| 368 | |||
| 369 | /* Can always copy the original raw data. */ | ||
| 370 | COPY_CHUNK | ||
| 371 | (msg, OFFSET_TO_PTR (section->PointerToRawData, p_infile), | ||
| 372 | section->SizeOfRawData, be_verbose); | ||
| 373 | |||
| 374 | /* Round up the raw data size to the new alignment. */ | ||
| 375 | dst_section->SizeOfRawData = | ||
| 376 | ROUND_UP (dst_section->SizeOfRawData, | ||
| 377 | dst_nt_header->OptionalHeader.FileAlignment); | ||
| 378 | |||
| 379 | /* Align the next section's raw data area. */ | ||
| 380 | ROUND_UP_DST_AND_ZERO (dst_nt_header->OptionalHeader.FileAlignment); | ||
| 381 | |||
| 382 | section++; | ||
| 383 | dst_section++; | ||
| 384 | } | ||
| 385 | |||
| 386 | /* Add the extra section entry (which adds no raw data). */ | ||
| 387 | if (new_section_name != NULL) | ||
| 388 | { | ||
| 389 | dst_nt_header->FileHeader.NumberOfSections++; | ||
| 390 | dst_nt_header->OptionalHeader.SizeOfImage += new_section_size; | ||
| 391 | strncpy (dst_section->Name, new_section_name, sizeof (dst_section->Name)); | ||
| 392 | dst_section->VirtualAddress = | ||
| 393 | section[-1].VirtualAddress | ||
| 394 | + ROUND_UP (section[-1].Misc.VirtualSize, | ||
| 395 | dst_nt_header->OptionalHeader.SectionAlignment); | ||
| 396 | dst_section->Misc.VirtualSize = new_section_size; | ||
| 397 | dst_section->PointerToRawData = 0; | ||
| 398 | dst_section->SizeOfRawData = 0; | ||
| 399 | dst_section->Characteristics = | ||
| 400 | IMAGE_SCN_CNT_UNINITIALIZED_DATA | ||
| 401 | | IMAGE_SCN_MEM_READ | ||
| 402 | | IMAGE_SCN_MEM_WRITE; | ||
| 403 | } | ||
| 404 | |||
| 405 | /* Copy remainder of source image. */ | ||
| 406 | section--; | ||
| 407 | offset = ROUND_UP (section->PointerToRawData + section->SizeOfRawData, | ||
| 408 | nt_header->OptionalHeader.FileAlignment); | ||
| 409 | COPY_CHUNK | ||
| 410 | ("Copying remainder of executable...", | ||
| 411 | OFFSET_TO_PTR (offset, p_infile), | ||
| 412 | p_infile->size - offset, be_verbose); | ||
| 413 | |||
| 414 | /* Final size for new image. */ | ||
| 415 | p_outfile->size = DST_TO_OFFSET (); | ||
| 416 | |||
| 417 | /* Now patch up remaining file-relative offsets. */ | ||
| 418 | section = IMAGE_FIRST_SECTION (nt_header); | ||
| 419 | dst_section = IMAGE_FIRST_SECTION (dst_nt_header); | ||
| 420 | |||
| 421 | #define ADJUST_OFFSET(var) \ | ||
| 422 | do { \ | ||
| 423 | if ((var) != 0) \ | ||
| 424 | (var) = relocate_offset ((var), nt_header, dst_nt_header); \ | ||
| 425 | } while (0) | ||
| 426 | |||
| 427 | dst_nt_header->OptionalHeader.SizeOfInitializedData = 0; | ||
| 428 | dst_nt_header->OptionalHeader.SizeOfUninitializedData = 0; | ||
| 429 | for (i = 0; i < dst_nt_header->FileHeader.NumberOfSections; i++) | ||
| 430 | { | ||
| 431 | /* Recompute data sizes for completeness. */ | ||
| 432 | if (dst_section[i].Characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA) | ||
| 433 | dst_nt_header->OptionalHeader.SizeOfInitializedData += | ||
| 434 | ROUND_UP (dst_section[i].Misc.VirtualSize, dst_nt_header->OptionalHeader.FileAlignment); | ||
| 435 | else if (dst_section[i].Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA) | ||
| 436 | dst_nt_header->OptionalHeader.SizeOfUninitializedData += | ||
| 437 | ROUND_UP (dst_section[i].Misc.VirtualSize, dst_nt_header->OptionalHeader.FileAlignment); | ||
| 438 | |||
| 439 | ADJUST_OFFSET (dst_section[i].PointerToLinenumbers); | ||
| 440 | } | ||
| 441 | |||
| 442 | ADJUST_OFFSET (dst_nt_header->FileHeader.PointerToSymbolTable); | ||
| 443 | |||
| 444 | /* Update offsets in debug directory entries. */ | ||
| 445 | { | ||
| 446 | IMAGE_DATA_DIRECTORY debug_dir = | ||
| 447 | dst_nt_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG]; | ||
| 448 | PIMAGE_DEBUG_DIRECTORY debug_entry; | ||
| 449 | |||
| 450 | section = rva_to_section (debug_dir.VirtualAddress, dst_nt_header); | ||
| 451 | if (section) | ||
| 452 | { | ||
| 453 | debug_entry = (PIMAGE_DEBUG_DIRECTORY) | ||
| 454 | (RVA_TO_OFFSET (debug_dir.VirtualAddress, section) + p_outfile->file_base); | ||
| 455 | debug_dir.Size /= sizeof (IMAGE_DEBUG_DIRECTORY); | ||
| 456 | |||
| 457 | for (i = 0; i < debug_dir.Size; i++, debug_entry++) | ||
| 458 | ADJUST_OFFSET (debug_entry->PointerToRawData); | ||
| 459 | } | ||
| 460 | } | ||
| 461 | } | ||
| 462 | |||
| 463 | |||
| 464 | int | ||
| 465 | main (int argc, char **argv) | ||
| 466 | { | ||
| 467 | file_data in_file, out_file; | ||
| 468 | char out_filename[MAX_PATH], in_filename[MAX_PATH]; | ||
| 469 | unsigned long size; | ||
| 470 | PIMAGE_DOS_HEADER dos_header; | ||
| 471 | PIMAGE_NT_HEADERS nt_header; | ||
| 472 | |||
| 473 | #define OLD_NAME argv[1] | ||
| 474 | #define NEW_NAME argv[2] | ||
| 475 | #define SECTION_NAME argv[3] | ||
| 476 | #define SECTION_SIZE argv[4] | ||
| 477 | |||
| 478 | strcpy (in_filename, OLD_NAME); | ||
| 479 | strcpy (out_filename, NEW_NAME); | ||
| 480 | |||
| 481 | printf ("Dumping from %s\n", in_filename); | ||
| 482 | printf (" to %s\n", out_filename); | ||
| 483 | |||
| 484 | /* Open the undumped executable file. */ | ||
| 485 | if (!open_input_file (&in_file, in_filename)) | ||
| 486 | { | ||
| 487 | printf ("Failed to open %s (%d)...bailing.\n", | ||
| 488 | in_filename, GetLastError ()); | ||
| 489 | exit (1); | ||
| 490 | } | ||
| 491 | dos_header = (PIMAGE_DOS_HEADER) in_file.file_base; | ||
| 492 | nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew); | ||
| 493 | /* Allow for expansion due to increasing file align to section align. | ||
| 494 | We can overestimate here, since close_file_data will update the | ||
| 495 | size exactly. */ | ||
| 496 | size = in_file.size | ||
| 497 | + nt_header->OptionalHeader.SectionAlignment | ||
| 498 | * nt_header->FileHeader.NumberOfSections; | ||
| 499 | if (!open_output_file (&out_file, out_filename, size)) | ||
| 500 | { | ||
| 501 | printf ("Failed to open %s (%d)...bailing.\n", | ||
| 502 | out_filename, GetLastError ()); | ||
| 503 | exit (1); | ||
| 504 | } | ||
| 505 | |||
| 506 | copy_executable_and_add_section (&in_file, &out_file, | ||
| 507 | SECTION_NAME, | ||
| 508 | atoi (SECTION_SIZE) * 1024 * 1024); | ||
| 509 | |||
| 510 | /* Patch up header fields; profiler is picky about this. */ | ||
| 511 | { | ||
| 512 | HANDLE hImagehelp = LoadLibrary ("imagehlp.dll"); | ||
| 513 | DWORD_PTR headersum; | ||
| 514 | DWORD_PTR checksum; | ||
| 515 | |||
| 516 | dos_header = (PIMAGE_DOS_HEADER) out_file.file_base; | ||
| 517 | nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew); | ||
| 518 | |||
| 519 | nt_header->OptionalHeader.CheckSum = 0; | ||
| 520 | // nt_header->FileHeader.TimeDateStamp = time (NULL); | ||
| 521 | // dos_header->e_cp = size / 512; | ||
| 522 | // nt_header->OptionalHeader.SizeOfImage = size; | ||
| 523 | |||
| 524 | pfnCheckSumMappedFile = (void *) GetProcAddress (hImagehelp, "CheckSumMappedFile"); | ||
| 525 | if (pfnCheckSumMappedFile) | ||
| 526 | { | ||
| 527 | // nt_header->FileHeader.TimeDateStamp = time (NULL); | ||
| 528 | pfnCheckSumMappedFile (out_file.file_base, | ||
| 529 | out_file.size, | ||
| 530 | &headersum, | ||
| 531 | &checksum); | ||
| 532 | nt_header->OptionalHeader.CheckSum = checksum; | ||
| 533 | } | ||
| 534 | FreeLibrary (hImagehelp); | ||
| 535 | } | ||
| 536 | |||
| 537 | close_file_data (&in_file); | ||
| 538 | close_file_data (&out_file); | ||
| 539 | |||
| 540 | return 0; | ||
| 541 | } | ||
| 542 | |||
| 543 | /* eof */ | ||
| 544 | |||
diff --git a/src/insdel.c b/src/insdel.c index 3b5b520aac8..80650be25ae 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | /* Buffer insertion/deletion and gap motion for GNU Emacs. | 1 | /* Buffer insertion/deletion and gap motion for GNU Emacs. |
| 2 | 2 | Copyright (C) 1985-1986, 1993-1995, 1997-2015 Free Software | |
| 3 | Copyright (C) 1985-1986, 1993-1995, 1997-2015 Free Software Foundation, | 3 | Foundation, Inc. |
| 4 | Inc. | ||
| 5 | 4 | ||
| 6 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 7 | 6 | ||
diff --git a/src/w32heap.c b/src/w32heap.c index d5a9dae0aa4..ee0eb161502 100644 --- a/src/w32heap.c +++ b/src/w32heap.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Heap management routines for GNU Emacs on the Microsoft Windows | 1 | /* Heap management routines for GNU Emacs on the Microsoft Windows API. |
| 2 | API. Copyright (C) 1994, 2001-2015 Free Software Foundation, Inc. | 2 | Copyright (C) 1994, 2001-2015 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
diff --git a/test/automated/package-x-test.el b/test/automated/package-x-test.el new file mode 100644 index 00000000000..70c9d96fde8 --- /dev/null +++ b/test/automated/package-x-test.el | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | ;;; package-test.el --- Tests for the Emacs package system | ||
| 2 | |||
| 3 | ;; Copyright (C) 2013-2015 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Daniel Hackney <dan@haxney.org> | ||
| 6 | ;; Version: 1.0 | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 13 | ;; (at your option) any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 22 | |||
| 23 | ;;; Commentary: | ||
| 24 | |||
| 25 | ;; You may want to run this from a separate Emacs instance from your | ||
| 26 | ;; main one, because a bug in the code below could mess with your | ||
| 27 | ;; installed packages. | ||
| 28 | |||
| 29 | ;; Run this in a clean Emacs session using: | ||
| 30 | ;; | ||
| 31 | ;; $ emacs -Q --batch -L . -l package-x-test.el -f ert-run-tests-batch-and-exit | ||
| 32 | |||
| 33 | ;;; Code: | ||
| 34 | |||
| 35 | (require 'package-x) | ||
| 36 | (require 'ert) | ||
| 37 | (require 'cl-lib) | ||
| 38 | (eval-when-compile (require 'package-test)) | ||
| 39 | |||
| 40 | ;; package-test is not normally in `load-path', so temporarily set | ||
| 41 | ;; `load-path' to contain the current directory. | ||
| 42 | (let ((load-path (append (list (file-name-directory (or load-file-name | ||
| 43 | buffer-file-name))) | ||
| 44 | load-path))) | ||
| 45 | (require 'package-test)) | ||
| 46 | |||
| 47 | (defvar package-x-test--single-archive-entry-1-3 | ||
| 48 | (cons 'simple-single | ||
| 49 | (package-make-ac-desc '(1 3) nil | ||
| 50 | "A single-file package with no dependencies" | ||
| 51 | 'single | ||
| 52 | '((:url . "http://doodles.au")))) | ||
| 53 | "Expected contents of the archive entry from the \"simple-single\" package.") | ||
| 54 | |||
| 55 | (defvar package-x-test--single-archive-entry-1-4 | ||
| 56 | (cons 'simple-single | ||
| 57 | (package-make-ac-desc '(1 4) nil | ||
| 58 | "A single-file package with no dependencies" | ||
| 59 | 'single | ||
| 60 | nil)) | ||
| 61 | "Expected contents of the archive entry from the updated \"simple-single\" package.") | ||
| 62 | |||
| 63 | (ert-deftest package-x-test-upload-buffer () | ||
| 64 | "Test creating an \"archive-contents\" file" | ||
| 65 | (with-package-test (:basedir "data/package" | ||
| 66 | :file "simple-single-1.3.el" | ||
| 67 | :upload-base t) | ||
| 68 | (package-upload-buffer) | ||
| 69 | (should (file-exists-p (expand-file-name "archive-contents" | ||
| 70 | package-archive-upload-base))) | ||
| 71 | (should (file-exists-p (expand-file-name "simple-single-1.3.el" | ||
| 72 | package-archive-upload-base))) | ||
| 73 | (should (file-exists-p (expand-file-name "simple-single-readme.txt" | ||
| 74 | package-archive-upload-base))) | ||
| 75 | |||
| 76 | (let (archive-contents) | ||
| 77 | (with-temp-buffer | ||
| 78 | (insert-file-contents | ||
| 79 | (expand-file-name "archive-contents" | ||
| 80 | package-archive-upload-base)) | ||
| 81 | (setq archive-contents | ||
| 82 | (package-read-from-string | ||
| 83 | (buffer-substring (point-min) (point-max))))) | ||
| 84 | (should (equal archive-contents | ||
| 85 | (list 1 package-x-test--single-archive-entry-1-3)))))) | ||
| 86 | |||
| 87 | (ert-deftest package-x-test-upload-new-version () | ||
| 88 | "Test uploading a new version of a package" | ||
| 89 | (with-package-test (:basedir "data/package" | ||
| 90 | :file "simple-single-1.3.el" | ||
| 91 | :upload-base t) | ||
| 92 | (package-upload-buffer) | ||
| 93 | (with-temp-buffer | ||
| 94 | (insert-file-contents "newer-versions/simple-single-1.4.el") | ||
| 95 | (package-upload-buffer)) | ||
| 96 | |||
| 97 | (let (archive-contents) | ||
| 98 | (with-temp-buffer | ||
| 99 | (insert-file-contents | ||
| 100 | (expand-file-name "archive-contents" | ||
| 101 | package-archive-upload-base)) | ||
| 102 | (setq archive-contents | ||
| 103 | (package-read-from-string | ||
| 104 | (buffer-substring (point-min) (point-max))))) | ||
| 105 | (should (equal archive-contents | ||
| 106 | (list 1 package-x-test--single-archive-entry-1-4)))))) | ||
| 107 | |||
| 108 | (provide 'package-x-test) | ||
| 109 | |||
| 110 | ;;; package-x-test.el ends here | ||