diff --git a/INSTALL.REPO b/INSTALL.REPO index 3431ee480bf..61b16340d35 100644 --- a/INSTALL.REPO +++ b/INSTALL.REPO @@ -1,3 +1,7 @@ +Copyright (C) 2002-2015 Free Software Foundation, Inc. +See the end of the file for license conditions. + + Building and Installing Emacs from the Repository 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 @@ +Some lisp/emacs-lisp/ Features and Where They Are Documented + +Copyright (C) 2007-2015 Free Software Foundation, Inc. +See the end of the file for license conditions. + + +* Status Key + - -- as yet unknown + n/a -- not applicable (internal, uninteresting, etc) + obsolete -- an obsolete feature, to be removed in future + todo -- not documented but should be + NODE -- documented in or under info node NODE + + +* Features + advice (elisp) Advising Functions + advice-preload n/a + assoc - + authors - + autoload (elisp) Autoload + avl-tree - + backquote n/a + benchmark n/a + bindat (elisp) Byte Packing + byte-compile (elisp) Byte Compilation + byte-opt - + bytecomp (elisp) Compilation Functions + checkdoc (elisp) Documentation Tips + cl (cl) + cl-compat n/a + cl-specs n/a + copyright - + crm - + cust-print (elisp) Printing in Edebug + debug (elisp) Debugger + derived (elisp) Derived Modes + disass (elisp) Disassembly + easy-mmode (elisp) Defining Minor Modes + easymenu - + edebug (elisp) Edebug + eldoc - + elint - + elp n/a + ewoc (elisp) Separated Rendering + find-func - + find-gc - + generic (elisp) Generic Modes + gulp n/a + helper - + levents obsolete + lisp-float-type - + lisp-mnt - + lisp-mode n/a + lmenu obsolete + lucid obsolete + macroexp (elisp) Expansion + pp (emacs) Program Indent + re-builder - + regexp-opt (elisp) Regexp Functions + regi - + ring (elisp) Rings + rx - + shadow - + sregex obsolete + syntax (elisp) Position Parse + testcover - + timer (elisp) Timers + tq (elisp) Transaction Queues + trace - + unsafep (elisp) Function Safety + warnings (elisp) Warnings + + +* Above list created using default directory lisp/emacs-lisp/ with + (shell-command + "sed '/^(provide '\\''/!d;s// /;s/).*//' *.el | sort | uniq") + + +* How to use this file to improve Emacs + (loop + (let* ((feature (choose-one Features)) + (status (feature-status feature))) + (if (or (eq '- status) (not (verify status))) + (update feature (current-docs feature)) + (case status + (todo (let (doc patch feedback) + (while (not (grok feature)) + (or (play-with feature) + (grep feature Internet) + (grep feature (wisdom-maybe "emacs-devel")))) + (setq doc (write-documentation feature) + patch (diff (current-docs) doc)) + (while (not (and (correct doc) + (well-placed doc) + (well-formed patch))) + (setq doc (revise doc) + patch (diff (current-docs) doc)) + feedback (wisdom-maybe "emacs-devel" patch)) + (when (install patch) + (when (update feature (current-docs feature)) + (job-well-done user-login-name))))) + (n/a (job-well-done user-login-name)))))) + + +* Etc + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . + + Local variables: + mode: outline + 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 @@ +.\" -*- nroff -*- +.\" See section COPYING for copyright and redistribution information. +.TH grep-changelog 1 +.SH NAME +grep-changelog \- print ChangeLog entries matching criteria +.SH SYNOPSIS +.B grep-changelog +.RI [ options ] +.RI [ CHANGELOG .\|.\|.] +.SH DESCRIPTION +.B grep-changelog +searches the named +.IR CHANGELOG s +(by default files matching the regular expressions +.B ChangeLog +and +.BR "ChangeLog\e.[0-9]+" ) +for entries matching the specified criteria. At least one option or +file must be specified. This program is distributed with +.BR "GNU Emacs" . +.PP +.SH OPTIONS +The program accepts unambiguous abbreviations for option names. +.TP +.B \-\-author=AUTHOR +Print entries whose author matches regular expression +.IR AUTHOR . +.TP +.B \-\-text=TEXT +Print entries whose text matches regular expression +.IR TEXT . +.TP +.B \-\-exclude=TEXT +Exclude entries matching regular expression +.IR TEXT . +.TP +.B \-\-from\-date=YYYY\-MM\-DD +Only consider entries made on or after the given date. +ChangeLog date entries not in the +\*(lqYYYY\-MM\-DD\*(rq format are never matched. +.TP +.B \-\-to\-date=YYYY\-MM\-DD +Only consider entries made on or before the given date. +.TP +.B \-\-rcs\-log +Print output in a format suitable for RCS log entries. +This format removes author lines, leading spaces, and file names. +.TP +.B \-\-with\-date +In RCS log format, print short dates. +.TP +.B \-\-reverse +Show matches in reverse order. +.TP +.B \-\-version +Display version information. +.TP +.B \-\-help +Display basic usage information. +. +.SH COPYING +Copyright +.if t \(co +.if n (C) +2008-2015 Free Software Foundation, Inc. +.PP +Permission is granted to make and distribute verbatim copies of this +document provided the copyright notice and this permission notice are +preserved on all copies. +.PP +Permission is granted to copy and distribute modified versions of +this document under the conditions for verbatim copying, provided that +the entire resulting derived work is distributed under the terms of +a permission notice identical to this one. +.PP +Permission is granted to copy and distribute translations of this +document into another language, under the above conditions for +modified versions, except that this permission notice may be stated +in a translation approved by the Free Software Foundation. +. 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 @@ @copying This file documents the GNU Emacs Web Wowser (EWW) package. -Copyright @copyright{} 2014-2015 Free Software Foundation, Inc. +Copyright @copyright{} 2014--2015 Free Software Foundation, Inc. @quotation 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 @@ This file describes how to use Info, the menu-driven GNU documentation system. -Copyright @copyright{} 1989, 1992, 1996--2014 Free Software Foundation, Inc. +Copyright @copyright{} 1989, 1992, 1996--2015 Free Software Foundation, Inc. @quotation 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 @@ +Copyright (C) 2006-2015 Free Software Foundation, Inc. +See end for license conditions. + + + Contributing to Emacs + +Emacs is a collaborative project and we encourage contributions from +anyone and everyone. If you want to contribute in the way that will +help us most, we recommend (1) fixing reported bugs and (2) +implementing the feature ideas in etc/TODO. However, if you think of +new features to add, please suggest them too -- we might like your +idea. Porting to new platforms is also useful, when there is a new +platform, but that is not common nowadays. + +For documentation on how to develop Emacs changes, refer to the Emacs +Manual and the Emacs Lisp Reference Manual (both included in the Emacs +distribution). The web pages in http://www.gnu.org/software/emacs +contain additional information. + +You may also want to submit your change so that can be considered for +inclusion in a future version of Emacs (see below). + +If you don't feel up to hacking Emacs, there are many other ways to +help. You can answer questions on the mailing lists, write +documentation, find and report bugs, check if existing bug reports +are fixed in newer versions of Emacs, contribute to the Emacs web +pages, or develop a package that works with Emacs. + +Here are some style and legal conventions for contributors to Emacs: + + +* Coding Standards + +Contributed code should follow the GNU Coding Standards. + +If it doesn't, we'll need to find someone to fix the code before we +can use it. + +Emacs has certain additional style and coding conventions. + +Ref: http://www.gnu.org/prep/standards/ +Ref: GNU Coding Standards Info Manual +Ref: The "Tips" Appendix in the Emacs Lisp Reference. + + +* Copyright Assignment + +The FSF (Free Software Foundation) is the copyright holder for GNU Emacs. +The FSF is a nonprofit with a worldwide mission to promote computer +user freedom and to defend the rights of all free software users. +For general information, see the website http://www.fsf.org/ . + +Generally speaking, for non-trivial contributions to GNU Emacs we +require that the copyright be assigned to the FSF. For the reasons +behind this, see: http://www.gnu.org/licenses/why-assign.html . + +Copyright assignment is a simple process. Residents of some countries +can do it entirely electronically. We can help you get started, and +answer any questions you may have (or point you to the people with the +answers), at the emacs-devel@gnu.org mailing list. + +(Please note: general discussion about why some GNU projects ask +for a copyright assignment is off-topic for emacs-devel. +See gnu-misc-discuss instead.) + +A copyright disclaimer is also a possibility, but we prefer an assignment. +Note that the disclaimer, like an assignment, involves you sending +signed paperwork to the FSF (simply saying "this is in the public domain" +is not enough). Also, a disclaimer cannot be applied to future work, it +has to be repeated each time you want to send something new. + +We can accept small changes (roughly, fewer than 15 lines) without +an assignment. This is a cumulative limit (e.g. three separate 5 line +patches) over all your contributions. + +* Getting the Source Code + +The latest version of the Emacs source code can be downloaded from the +Savannah web site. It is important to write your patch based on the +latest version. If you start from an older version, your patch may be +outdated (so that maintainers will have a hard time applying it), or +changes in Emacs may have made your patch unnecessary. + +After you have downloaded the repository source, you should read the file +INSTALL.REPO for build instructions (they differ to some extent from a +normal build). + +Ref: http://savannah.gnu.org/projects/emacs + + +* Submitting Patches + +Every patch must have several pieces of information before we +can properly evaluate it. + +When you have all these pieces, bundle them up in a mail message and +send it to the developers. Sending it to bug-gnu-emacs@gnu.org +(which is the bug/feature list) is recommended, because that list +is coupled to a tracking system that makes it easier to locate patches. +If your patch is not complete and you think it needs more discussion, +you might want to send it to emacs-devel@gnu.org instead. If you +revise your patch, send it as a followup to the initial topic. + +** Description + +For bug fixes, a description of the bug and how your patch fixes it. + +For new features, a description of the feature and your implementation. + +** ChangeLog + +A ChangeLog entry as plaintext (separate from the patch). + +See the existing ChangeLog files for format and content. Note that, +unlike some other projects, we do require ChangeLogs also for +documentation, i.e. Texinfo files. + +Ref: "Change Log Concepts" node of the GNU Coding Standards Info +Manual, for how to write good log entries. + +When using git, commit messages should use ChangeLog format, with a +single short line explaining the change, then an empty line, then +unindented ChangeLog entries. (Essentially, a commit message should +be a duplicate of what the patch adds to the ChangeLog files. We are +planning to automate this better, to avoid the duplication.) + +** The patch itself. + +If you are accessing the Emacs repository, make sure your copy is +up-to-date (e.g. with 'git pull'). You can commit your changes +to a private branch and generate a patch from the master version +by using + git format-patch master +Or you can leave your changes uncommitted and use + git diff +With no repository, you can use + diff -u OLD NEW + +** Mail format. + +We prefer to get the patches as plain text, either inline (be careful +your mail client does not change line breaks) or as MIME attachments. + +** Please reread your patch before submitting it. + +** Do not mix changes. + +If you send several unrelated changes together, we will ask you to +separate them so we can consider each of the changes by itself. + +** Do not make formatting changes. + +Making cosmetic formatting changes (indentation, etc) makes it harder +to see what you have really changed. + + +* Coding style and conventions. + +** Mandatory reading: + +The "Tips and Conventions" Appendix of the Emacs Lisp Reference. + +** Avoid using `defadvice' or `eval-after-load' for Lisp code to be +included in Emacs. + +** Remove all trailing whitespace in all source and text files. + +** Use ?\s instead of ? in Lisp code for a space character. + + +* Supplemental information for Emacs Developers. + +** Write access to the Emacs repository. + +Once you become a frequent contributor to Emacs, we can consider +giving you write access to the version-control repository. + + +** Emacs Mailing lists. + +Discussion about Emacs development takes place on emacs-devel@gnu.org. + +Bug reports and fixes, feature requests and implementations should be +sent to bug-gnu-emacs@gnu.org, the bug/feature list. This is coupled +to the tracker at http://debbugs.gnu.org . + +You can subscribe to the mailing lists, or see the list archives, +by following links from http://savannah.gnu.org/mail/?group=emacs . + +** Document your changes. + +Any change that matters to end-users should have a NEWS entry. + +Think about whether your change requires updating the documentation +(both manuals and doc-strings). If you know it does not, mark the NEWS +entry with "---". If you know that *all* the necessary documentation +updates have been made, mark the entry with "+++". Otherwise do not mark it. + +** Understanding Emacs Internals. + +The best way to understand Emacs Internals is to read the code, +but the nodes "Tips" and "GNU Emacs Internals" in the Appendix +of the Emacs Lisp Reference Manual may also help. + +The file etc/DEBUG describes how to debug Emacs bugs. + + + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . + +Local variables: +mode: outline +paragraph-separate: "[ ]*$" +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 @@ +%% This file is not generated by configure, because then the provided +%% pdf files would always appear out-of-date. +\def\versionemacs{24} % major version of emacs +\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 @@ +#! /usr/bin/perl + +# Copyright (C) 1999-2015 Free Software Foundation, Inc. +# +# This file is part of GNU Emacs. + +# GNU Emacs is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GNU Emacs. If not, see . + + +# Extract entries from ChangeLogs matching specified criteria. +# Optionally format the resulting output to a form suitable for RCS +# logs, like they are used in Emacs, for example. In this format, +# author lines, leading spaces, and file names are removed. + +require 5; +use strict; + +# Parse command line options. + +use vars qw($author $regexp $exclude $from_date $to_date + $rcs_log $with_date $version $help $reverse + @entries); + +use Getopt::Long; + +my $result; + +if (@ARGV == 0) { + + # No arguments cannot possibly mean "show everything"!! + $result = 0; + +} else { + + $result = GetOptions ("author=s" => \$author, + "text=s" => \$regexp, + "exclude=s" => \$exclude, + "from-date=s" => \$from_date, + "to-date=s" => \$to_date, + "rcs-log" => \$rcs_log, + "with-date" => \$with_date, + "reverse!" => \$reverse, + "version" => \$version, + "help" => \$help); + + # If date options are specified, check that they have the format + # YYYY-MM-DD. + + $result = 0 if $from_date && $from_date !~ /^\d\d\d\d-\d\d-\d\d$/; + $result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/; +} + +# Print usage information and exit when necessary. + +if ($result == 0 || $help) { + print <)) { + if ($line =~ /^\S/) { + # Line is an author-line. Print previous entry if + # it matches. + print_log ($header, $entry) + if header_match_p ($header) && entry_match_p ($entry); + + $entry = ""; + $header = $line; + + # Add empty lines below the header. + while (defined($line = ) && $line =~ /^\s*$/) { + $header = "$header$line"; + } + } + + last unless defined $line; + + if ($line =~ /^\s*\*/) { + # LINE is the first line of a ChangeLog entry. Print + # previous entry if it matches. + print_log ($header, $entry) + if header_match_p ($header) && entry_match_p ($entry); + $entry = $line; + } else { + # Add LINE to the current entry. + $entry = "$entry$line"; + } + } + + # Print last entry if it matches. + print_log ($header, $entry) + if header_match_p ($header) && entry_match_p ($entry); + + close IN; + + if ($reverse) { + for (my $entry = @entries; $entry; $entry--) { + print $entries[$entry-1]; + } + } +} + + +# Main program. Process ChangeLogs. + +# If files were specified on the command line, parse those files in the +# order supplied by the user; otherwise parse default files ChangeLog and +# ChangeLog.NNN according to $reverse. +unless (@ARGV > 0) { + @ARGV = ("ChangeLog"); + + push @ARGV, + map {"ChangeLog.$_"} + sort {$b <=> $a} + map {/\.(\d+)$/; $1} + do { + opendir D, '.'; + grep /^ChangeLog\.\d+$/, readdir D; + }; + + @ARGV = reverse @ARGV if $reverse; +} + +while (defined (my $log = shift @ARGV)) { + parse_changelog ($log) if -f $log; +} + + +# 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 @@ +/* test-distrib.c --- testing distribution of nonprinting chars + +Copyright (C) 1987, 1993-1995, 1999, 2001-2015 Free Software Foundation, +Inc. + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . */ + + +#include +#include +#include +#include + +/* Break string in two parts to avoid buggy C compilers that ignore characters + after nulls in strings. */ + +static char string1[] = "Testing distribution of nonprinting chars:\n\ +Should be 0177: \177 Should be 0377: \377 Should be 0212: \212.\n\ +Should be 0000: "; + +static char string2[] = ".\n\ +This file is read by the `test-distribution' program.\n\ +If you change it, you will make that program fail.\n"; + +/* Like `read' but keeps trying until it gets SIZE bytes or reaches eof. */ +static int +cool_read (int fd, char *buf, size_t size) +{ + ssize_t num; + ssize_t sofar = 0; + + while (1) + { + if ((num = read (fd, buf + sofar, size - sofar)) == 0) + return sofar; + else if (num < 0) + return num; + sofar += num; + } +} + +int +main (int argc, char **argv) +{ + int fd; + char buf[300]; + + if (argc != 2) + { + fprintf (stderr, "Usage: %s testfile\n", argv[0]); + exit (EXIT_FAILURE); + } + fd = open (argv[1], O_RDONLY); + if (fd < 0) + { + perror (argv[1]); + exit (EXIT_FAILURE); + } + if (cool_read (fd, buf, sizeof string1) != sizeof string1 || + strcmp (buf, string1) || + cool_read (fd, buf, sizeof string2) != sizeof string2 - 1 || + strncmp (buf, string2, sizeof string2 - 1)) + { + fprintf (stderr, "Data in file `%s' has been damaged.\n\ +Most likely this means that many nonprinting characters\n\ +have been corrupted in the files of Emacs, and it will not work.\n", + argv[1]); + exit (EXIT_FAILURE); + } + close (fd); + return EXIT_SUCCESS; +} + + +/* 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 @@ /* Memory allocation on the stack. - Copyright (C) 1995, 1999, 2001-2004, 2006-2015 Free Software Foundation, - Inc. + Copyright (C) 1995, 1999, 2001-2004, 2006-2015 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it 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 @@ /* Binary mode I/O. - Copyright (C) 2001, 2003, 2005, 2008-2015 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2008-2015 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify 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 @@ functions' behaviour depends on the current locale set via setlocale. - Copyright (C) 2000-2003, 2006, 2008-2015 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2006, 2008-2015 Free Software Foundation, + Inc. This program is free software; you can redistribute it and/or modify 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 @@ /* c-strcasecmp.c -- case insensitive string comparator in C locale - Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify 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 @@ /* c-strncasecmp.c -- case insensitive string comparator in C locale - Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify 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 @@ /* Read symbolic links into a buffer without size limitation, relative to fd. - Copyright (C) 2001, 2003-2004, 2007, 2009-2015 Free Software Foundation, - Inc. + Copyright (C) 2001, 2003-2004, 2007, 2009-2015 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* Close a stream, with nicer error checking than fclose's. - Copyright (C) 1998-2002, 2004, 2006-2015 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004, 2006-2015 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* File names on MS-DOS/Windows systems. - Copyright (C) 2000-2001, 2004-2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2004-2006, 2009-2015 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* Duplicate an open file descriptor to a specified file descriptor. - Copyright (C) 1999, 2004-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2004-2007, 2009-2015 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* Make a string describing file modes. - Copyright (C) 1998-1999, 2003, 2006, 2009-2015 Free Software Foundation, - Inc. + Copyright (C) 1998-1999, 2003, 2006, 2009-2015 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* fpending.c -- return the number of pending output bytes on a stream - Copyright (C) 2000, 2004, 2006-2007, 2009-2015 Free Software Foundation, - Inc. + Copyright (C) 2000, 2004, 2006-2007, 2009-2015 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* Declare __fpending. - Copyright (C) 2000, 2003, 2005-2006, 2009-2015 Free Software Foundation, - Inc. + Copyright (C) 2000, 2003, 2005-2006, 2009-2015 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* provide consistent interface to getgroups for systems that don't allow N==0 - Copyright (C) 1996, 1999, 2003, 2006-2015 Free Software Foundation, Inc. + Copyright (C) 1996, 1999, 2003, 2006-2015 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* Get the system load averages. - Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2015 Free Software - Foundation, Inc. + Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2015 Free + Software Foundation, Inc. NOTE: The canonical source of this file is maintained with gnulib. 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 @@ /* Declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2015 Free Software - Foundation, Inc. + Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2015 Free + Software Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2015 Free Software - Foundation, Inc. + Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2015 Free + Software Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* Internal declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2015 Free Software - Foundation, Inc. + Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2015 Free + Software Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* Convenience header for conditional use of GNU . - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2015 Free Software - Foundation, Inc. + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2015 Free + Software Foundation, Inc. This program is free software; you can redistribute it and/or modify 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 @@ /* gettime -- get the system clock - Copyright (C) 2002, 2004-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2004-2007, 2009-2015 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* Provide gettimeofday for systems that don't have it or for which it's broken. - Copyright (C) 2001-2003, 2005-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2007, 2009-2015 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify 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 @@ /* group-member.c -- determine whether group id is in calling user's group list - Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2015 Free Software - Foundation, Inc. + Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2015 Free + Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/md5.c b/lib/md5.c index 30525dc85da..1a73b2a700c 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -1,7 +1,7 @@ /* Functions to compute MD5 message digest of files or memory blocks. according to the definition of MD5 in RFC 1321 from April 1992. - Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2015 Free Software - Foundation, Inc. + Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2015 Free + Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it diff --git a/lib/md5.h b/lib/md5.h index 43add999ef0..eb6fff66b57 100644 --- a/lib/md5.h +++ b/lib/md5.h @@ -1,7 +1,7 @@ /* Declaration of functions and data types used for MD5 sum computing library functions. - Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2015 Free Software - Foundation, Inc. + Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2015 Free + Software Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* memrchr -- find the last occurrence of a byte in a memory block - Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2015 Free Software - Foundation, Inc. + Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2015 Free + Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), 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 @@ /* sha1.c - Functions to compute SHA1 message digest of files or memory blocks according to the NIST specification FIPS-180-1. - Copyright (C) 2000-2001, 2003-2006, 2008-2015 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2003-2006, 2008-2015 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it 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 @@ /* sig2str.c -- convert between signal names and numbers - Copyright (C) 2002, 2004, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006, 2009-2015 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify 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 @@ +/* Substitute for and wrapper around . + Copyright (C) 2008-2015 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . */ + +#ifndef _@GUARD_PREFIX@_STDARG_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STDARG_H@ + +#ifndef _@GUARD_PREFIX@_STDARG_H +#define _@GUARD_PREFIX@_STDARG_H + +#ifndef va_copy +# define va_copy(a,b) ((a) = (b)) +#endif + +#endif /* _@GUARD_PREFIX@_STDARG_H */ +#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 @@ +/* Copyright (C) 2001-2003, 2006-2015 Free Software Foundation, Inc. + Written by Bruno Haible , 2001. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . */ + +#ifndef _GL_STDBOOL_H +#define _GL_STDBOOL_H + +/* ISO C 99 for platforms that lack it. */ + +/* Usage suggestions: + + Programs that use should be aware of some limitations + and standards compliance issues. + + Standards compliance: + + - must be #included before 'bool', 'false', 'true' + can be used. + + - You cannot assume that sizeof (bool) == 1. + + - Programs should not undefine the macros bool, true, and false, + as C99 lists that as an "obsolescent feature". + + Limitations of this substitute, when used in a C89 environment: + + - must be #included before the '_Bool' type can be used. + + - You cannot assume that _Bool is a typedef; it might be a macro. + + - Bit-fields of type 'bool' are not supported. Portable code + should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'. + + - In C99, casts and automatic conversions to '_Bool' or 'bool' are + performed in such a way that every nonzero value gets converted + to 'true', and zero gets converted to 'false'. This doesn't work + with this substitute. With this substitute, only the values 0 and 1 + give the expected result when converted to _Bool' or 'bool'. + + - C99 allows the use of (_Bool)0.0 in constant expressions, but + this substitute cannot always provide this property. + + Also, it is suggested that programs use 'bool' rather than '_Bool'; + this isn't required, but 'bool' is more common. */ + + +/* 7.16. Boolean type and values */ + +/* BeOS already #defines false 0, true 1. We use the same + definitions below, but temporarily we have to #undef them. */ +#if defined __BEOS__ && !defined __HAIKU__ +# include /* defines bool but not _Bool */ +# undef false +# undef true +#endif + +#ifdef __cplusplus +# define _Bool bool +# define bool bool +#else +# if defined __BEOS__ && !defined __HAIKU__ + /* A compiler known to have 'bool'. */ + /* If the compiler already has both 'bool' and '_Bool', we can assume they + are the same types. */ +# if !@HAVE__BOOL@ +typedef bool _Bool; +# endif +# else +# if !defined __GNUC__ + /* If @HAVE__BOOL@: + Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when + the built-in _Bool type is used. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + Similar bugs are likely with other compilers as well; this file + wouldn't be used if was working. + So we override the _Bool type. + If !@HAVE__BOOL@: + Need to define _Bool ourselves. As 'signed char' or as an enum type? + Use of a typedef, with SunPRO C, leads to a stupid + "warning: _Bool is a keyword in ISO C99". + Use of an enum type, with IRIX cc, leads to a stupid + "warning(1185): enumerated type mixed with another type". + Even the existence of an enum type, without a typedef, + "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. + The only benefit of the enum, debuggability, is not important + with these compilers. So use 'signed char' and no enum. */ +# define _Bool signed char +# else + /* With this compiler, trust the _Bool type if the compiler has it. */ +# if !@HAVE__BOOL@ + /* For the sake of symbolic names in gdb, define true and false as + enum constants, not only as macros. + It is tempting to write + typedef enum { false = 0, true = 1 } _Bool; + so that gdb prints values of type 'bool' symbolically. But then + values of type '_Bool' might promote to 'int' or 'unsigned int' + (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' + (see ISO C 99 6.3.1.1.(2)). So add a negative value to the + enum; this ensures that '_Bool' promotes to 'int'. */ +typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; +# endif +# endif +# endif +# define bool _Bool +#endif + +/* The other macros must be usable in preprocessor directives. */ +#ifdef __cplusplus +# define false false +# define true true +#else +# define false 0 +# define true 1 +#endif + +#define __bool_true_false_are_defined 1 + +#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 @@ /* A GNU-like . - Copyright (C) 1995, 2001-2004, 2006-2015 Free Software Foundation, Inc. + Copyright (C) 1995, 2001-2004, 2006-2015 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify 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 @@ -/* Copyright (C) 1991-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2001, 2003-2007, 2009-2015 Free Software + * Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. 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 @@ /* Convert string representation of a number into an intmax_t value. - Copyright (C) 1999, 2001-2004, 2006, 2009-2015 Free Software Foundation, - Inc. + Copyright (C) 1999, 2001-2004, 2006, 2009-2015 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* Convert string representation of a number into an integer value. - Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2015 Free Software - Foundation, Inc. + Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2015 Free + Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C 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 @@ /* Function to parse a 'long long int' from text. - Copyright (C) 1995-1997, 1999, 2001, 2009-2015 Free Software Foundation, - Inc. + Copyright (C) 1995-1997, 1999, 2001, 2009-2015 Free Software + Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* Function to parse an 'unsigned long long int' from text. - Copyright (C) 1995-1997, 1999, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1995-1997, 1999, 2009-2015 Free Software Foundation, + Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. 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 @@ /* tempname.c - generate the name of a temporary file. - Copyright (C) 1991-2003, 2005-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1991-2003, 2005-2007, 2009-2015 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* Reentrant time functions like localtime_r. - Copyright (C) 2003, 2006-2007, 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2010-2015 Free Software Foundation, + Inc. This program is free software; you can redistribute it and/or modify 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 @@ -/* Copyright (C) 1992, 1995-2002, 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995-2002, 2005-2015 Free Software Foundation, + Inc. This file is part of the GNU C Library. 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 @@ /* xalloc-oversized.h -- memory allocation size checking - Copyright (C) 1990-2000, 2003-2004, 2006-2015 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2015 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify 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 @@ +;;; gnus-setup.el --- Initialization & Setup for Gnus 5 + +;; Copyright (C) 1995-1996, 2000-2015 Free Software Foundation, Inc. + +;; Author: Steven L. Baur +;; Keywords: news + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: +;; My head is starting to spin with all the different mail/news packages. +;; Stop The Madness! + +;; Given that Emacs Lisp byte codes may be diverging, it is probably best +;; not to byte compile this, and just arrange to have the .el loaded out +;; of .emacs. + +;;; Code: + +(eval-when-compile (require 'cl)) + +(defvar gnus-use-installed-gnus t + "*If non-nil use installed version of Gnus.") + +(defvar gnus-use-installed-mailcrypt (featurep 'xemacs) + "*If non-nil use installed version of mailcrypt.") + +(defvar gnus-emacs-lisp-directory (if (featurep 'xemacs) + "/usr/local/lib/xemacs/" + "/usr/local/share/emacs/") + "Directory where Emacs site lisp is located.") + +(defvar gnus-gnus-lisp-directory (concat gnus-emacs-lisp-directory + "gnus/lisp/") + "Directory where Gnus Emacs lisp is found.") + +(defvar gnus-mailcrypt-lisp-directory (concat gnus-emacs-lisp-directory + "site-lisp/mailcrypt/") + "Directory where Mailcrypt Emacs Lisp is found.") + +(defvar gnus-bbdb-lisp-directory (concat gnus-emacs-lisp-directory + "site-lisp/bbdb/") + "Directory where Big Brother Database is found.") + +(defvar gnus-use-mhe nil + "Set this if you want to use MH-E for mail reading.") +(defvar gnus-use-rmail nil + "Set this if you want to use RMAIL for mail reading.") +(defvar gnus-use-sendmail nil + "Set this if you want to use SENDMAIL for mail reading.") +(defvar gnus-use-vm nil + "Set this if you want to use the VM package for mail reading.") +(defvar gnus-use-sc nil + "Set this if you want to use Supercite.") +(defvar gnus-use-mailcrypt t + "Set this if you want to use Mailcrypt for dealing with PGP messages.") +(defvar gnus-use-bbdb nil + "Set this if you want to use the Big Brother DataBase.") + +(when (and (not gnus-use-installed-gnus) + (null (member gnus-gnus-lisp-directory load-path))) + (push gnus-gnus-lisp-directory load-path)) + +;;; We can't do this until we know where Gnus is. +(require 'message) + +;;; Mailcrypt by +;;; Jin Choi +;;; Patrick LoPresti + +(when gnus-use-mailcrypt + (when (and (not gnus-use-installed-mailcrypt) + (null (member gnus-mailcrypt-lisp-directory load-path))) + (setq load-path (cons gnus-mailcrypt-lisp-directory load-path))) + (autoload 'mc-install-write-mode "mailcrypt" nil t) + (autoload 'mc-install-read-mode "mailcrypt" nil t) +;;; (add-hook 'message-mode-hook 'mc-install-write-mode) +;;; (add-hook 'gnus-summary-mode-hook 'mc-install-read-mode) + (when gnus-use-mhe + (add-hook 'mh-folder-mode-hook 'mc-install-read-mode) + (add-hook 'mh-letter-mode-hook 'mc-install-write-mode))) + +;;; BBDB by +;;; Jamie Zawinski + +(when gnus-use-bbdb + ;; bbdb will never be installed with emacs. + (when (null (member gnus-bbdb-lisp-directory load-path)) + (setq load-path (cons gnus-bbdb-lisp-directory load-path))) + (autoload 'bbdb "bbdb-com" + "Insidious Big Brother Database" t) + (autoload 'bbdb-name "bbdb-com" + "Insidious Big Brother Database" t) + (autoload 'bbdb-company "bbdb-com" + "Insidious Big Brother Database" t) + (autoload 'bbdb-net "bbdb-com" + "Insidious Big Brother Database" t) + (autoload 'bbdb-notes "bbdb-com" + "Insidious Big Brother Database" t) + + (when gnus-use-vm + (autoload 'bbdb-insinuate-vm "bbdb-vm" + "Hook BBDB into VM" t)) + + (when gnus-use-rmail + (autoload 'bbdb-insinuate-rmail "bbdb-rmail" + "Hook BBDB into RMAIL" t) + (add-hook 'rmail-mode-hook 'bbdb-insinuate-rmail)) + + (when gnus-use-mhe + (autoload 'bbdb-insinuate-mh "bbdb-mh" + "Hook BBDB into MH-E" t) + (add-hook 'mh-folder-mode-hook 'bbdb-insinuate-mh)) + + (autoload 'bbdb-insinuate-gnus "bbdb-gnus" + "Hook BBDB into Gnus" t) + (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus) + + (when gnus-use-sendmail + (autoload 'bbdb-insinuate-sendmail "bbdb" + "Insidious Big Brother Database" t) + (add-hook 'mail-setup-hook 'bbdb-insinuate-sendmail) + (add-hook 'message-setup-hook 'bbdb-insinuate-sendmail))) + +(when gnus-use-sc + (add-hook 'mail-citation-hook 'sc-cite-original) + (setq message-cite-function 'sc-cite-original)) + +;;;### (autoloads (gnus gnus-slave gnus-no-server) "gnus" "lisp/gnus.el" (12473 2137)) +;;; Generated autoloads from lisp/gnus.el + +;; Don't redo this if autoloads already exist +(unless (fboundp 'gnus) + (autoload 'gnus-slave-no-server "gnus" "\ +Read network news as a slave without connecting to local server." t nil) + + (autoload 'gnus-no-server "gnus" "\ +Read network news. +If ARG is a positive number, Gnus will use that as the +startup level. If ARG is nil, Gnus will be started at level 2. +If ARG is non-nil and not a positive number, Gnus will +prompt the user for the name of an NNTP server to use. +As opposed to `gnus', this command will not connect to the local server." t nil) + + (autoload 'gnus-slave "gnus" "\ +Read news as a slave." t nil) + + (autoload 'gnus "gnus" "\ +Read network news. +If ARG is non-nil and a positive number, Gnus will use that as the +startup level. If ARG is non-nil and not a positive number, Gnus will +prompt the user for the name of an NNTP server to use." t nil) + +;;;*** + +;;; These have moved out of gnus.el into other files. +;;; FIX FIX FIX: should other things be in gnus-setup? or these not in it? + (autoload 'gnus-update-format "gnus-spec" "\ +Update the format specification near point." t nil) + + (autoload 'gnus-fetch-group "gnus-group" "\ +Start Gnus if necessary and enter GROUP. +Returns whether the fetching was successful or not." t nil) + + (defalias 'gnus-batch-kill 'gnus-batch-score) + + (autoload 'gnus-batch-score "gnus-kill" "\ +Run batched scoring. +Usage: emacs -batch -l gnus -f gnus-batch-score ... +Newsgroups is a list of strings in Bnews format. If you want to score +the comp hierarchy, you'd say \"comp.all\". If you would not like to +score the alt hierarchy, you'd say \"!alt.all\"." t nil)) + +(provide 'gnus-setup) + +(run-hooks 'gnus-setup-load-hook) + +;;; 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 @@ +;;; cap-words.el --- minor mode for motion in CapitalizedWordIdentifiers + +;; Copyright (C) 2002-2015 Free Software Foundation, Inc. + +;; Author: Dave Love +;; Keywords: languages + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Provides Capitalized Words minor mode for word movement in +;; identifiers CapitalizedLikeThis. + +;; Note that the same effect could be obtained by frobbing the +;; category of upper case characters to produce word boundaries, but +;; the necessary processing isn't done for ASCII characters. + +;; Fixme: This doesn't work properly for mouse double clicks. + +;;; Code: + +(defun capitalized-find-word-boundary (pos limit) + "Function for use in `find-word-boundary-function-table'. +Looks for word boundaries before capitals." + (save-excursion + (goto-char pos) + (let (case-fold-search) + (if (<= pos limit) + ;; Fixme: Are these regexps the best? + (or (and (re-search-forward "\\=.\\w*[[:upper:]]" + limit t) + (progn (backward-char) + t)) + (re-search-forward "\\>" limit t)) + (or (re-search-backward "[[:upper:]]\\w*\\=" limit t) + (re-search-backward "\\<" limit t)))) + (point))) + + +(defconst capitalized-find-word-boundary-function-table + (let ((tab (make-char-table nil))) + (set-char-table-range tab t #'capitalized-find-word-boundary) + tab) + "Assigned to `find-word-boundary-function-table' in Capitalized Words mode.") + +;;;###autoload +(define-minor-mode capitalized-words-mode + "Toggle Capitalized Words mode. +With a prefix argument ARG, enable Capitalized Words mode if ARG +is positive, and disable it otherwise. If called from Lisp, +enable the mode if ARG is omitted or nil. + +Capitalized Words mode is a buffer-local minor mode. When +enabled, a word boundary occurs immediately before an uppercase +letter in a symbol. This is in addition to all the normal +boundaries given by the syntax and category tables. There is no +restriction to ASCII. + +E.g. the beginning of words in the following identifier are as marked: + + capitalizedWorDD + ^ ^ ^^ + +Note that these word boundaries only apply for word motion and +marking commands such as \\[forward-word]. This mode does not affect word +boundaries found by regexp matching (`\\>', `\\w' &c). + +This style of identifiers is common in environments like Java ones, +where underscores aren't trendy enough. Capitalization rules are +sometimes part of the language, e.g. Haskell, which may thus encourage +such a style. It is appropriate to add `capitalized-words-mode' to +the mode hook for programming language modes in which you encounter +variables like this, e.g. `java-mode-hook'. It's unlikely to cause +trouble if such identifiers aren't used. + +See also `glasses-mode' and `studlify-word'. +Obsoletes `c-forward-into-nomenclature'." + nil " Caps" nil :group 'programming + (set (make-local-variable 'find-word-boundary-function-table) + capitalized-find-word-boundary-function-table)) + +(provide 'cap-words) + +;;; 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 @@ +;;; w32-common-fns.el --- Lisp routines for Windows and Cygwin-w32 + +;; Copyright (C) 1994, 2001-2015 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: +;;; +;;; This file contains functions that are used by both native NT Emacs +;;; and Cygwin Emacs compiled to use the native Windows widget +;;; library. + +(declare-function x-server-version "w32fns.c" (&optional terminal)) + +(defun w32-version () + "Return the MS-Windows version numbers. +The value is a list of three integers: the major and minor version +numbers, and the build number." + (x-server-version)) + +(defun w32-using-nt () + "Return non-nil if running on a Windows NT descendant. +That includes all Windows systems except for 9X/Me." + (getenv "SystemRoot")) + +(declare-function w32-get-clipboard-data "w32select.c") +(declare-function w32-set-clipboard-data "w32select.c") +(declare-function x-server-version "w32fns.c" (&optional display)) + +;;; Fix interface to (X-specific) mouse.el +(defun x-set-selection (type data) + "Make an X selection of type TYPE and value DATA. +The argument TYPE (nil means `PRIMARY') says which selection, and +DATA specifies the contents. TYPE must be a symbol. \(It can also +be a string, which stands for the symbol with that name, but this +is considered obsolete.) DATA may be a string, a symbol, an +integer (or a cons of two integers or list of two integers). + +The selection may also be a cons of two markers pointing to the same buffer, +or an overlay. In these cases, the selection is considered to be the text +between the markers *at whatever time the selection is examined*. +Thus, editing done in the buffer after you specify the selection +can alter the effective value of the selection. + +The data may also be a vector of valid non-vector selection values. + +The return value is DATA. + +Interactively, this command sets the primary selection. Without +prefix argument, it reads the selection in the minibuffer. With +prefix argument, it uses the text of the region as the selection value. + +Note that on MS-Windows, primary and secondary selections set by Emacs +are not available to other programs." + (put 'x-selections (or type 'PRIMARY) data)) + +(defun x-get-selection (&optional type _data-type) + "Return the value of an X Windows selection. +The argument TYPE (default `PRIMARY') says which selection, +and the argument DATA-TYPE (default `STRING') says +how to convert the data. + +TYPE may be any symbol \(but nil stands for `PRIMARY'). However, +only a few symbols are commonly used. They conventionally have +all upper-case names. The most often used ones, in addition to +`PRIMARY', are `SECONDARY' and `CLIPBOARD'. + +DATA-TYPE is usually `STRING', but can also be one of the symbols +in `selection-converter-alist', which see. This argument is +ignored on MS-Windows and MS-DOS." + (get 'x-selections (or type 'PRIMARY))) + +;; x-selection-owner-p is used in simple.el +(defun x-selection-owner-p (&optional selection _terminal) + "" ; placeholder for doc.c + (and (memq selection '(nil PRIMARY SECONDARY)) + (get 'x-selections (or selection 'PRIMARY)))) + +;; The "Windows" keys on newer keyboards bring up the Start menu +;; whether you want it or not - make Emacs ignore these keystrokes +;; rather than beep. +(global-set-key [lwindow] 'ignore) +(global-set-key [rwindow] 'ignore) + +(defvar w32-charset-info-alist) ; w32font.c + + +;;;; Selections + +;; We keep track of the last text selected here, so we can check the +;; current selection against it, and avoid passing back our own text +;; from x-selection-value. +(defvar x-last-selected-text nil) +(defvar x-select-enable-clipboard) + +(defun x-get-selection-value () + "Return the value of the current selection. +Consult the selection. Treat empty strings as if they were unset." + (if x-select-enable-clipboard + (let (text) + ;; Don't die if x-get-selection signals an error. + (with-demoted-errors "w32-get-clipboard-data:%s" + (setq text (w32-get-clipboard-data))) + (if (string= text "") (setq text nil)) + (cond + ((not text) nil) + ((eq text x-last-selected-text) nil) + ((string= text x-last-selected-text) + ;; Record the newer string, so subsequent calls can use the 'eq' test. + (setq x-last-selected-text text) + nil) + (t + (setq x-last-selected-text text)))))) + +(defalias 'x-selection-value 'x-get-selection-value) + +;; Arrange for the kill and yank functions to set and check the clipboard. +(setq interprogram-cut-function 'x-select-text) +(setq interprogram-paste-function 'x-get-selection-value) + +(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 @@ # alloca.m4 serial 14 -dnl Copyright (C) 2002-2004, 2006-2007, 2009-2015 Free Software Foundation, -dnl Inc. +dnl Copyright (C) 2002-2004, 2006-2007, 2009-2015 Free Software +dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, 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 @@ #serial 20 -dnl Copyright (C) 2002, 2005, 2007, 2009-2015 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2005, 2007, 2009-2015 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, 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 @@ # filemode.m4 serial 8 -dnl Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, 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 @@ dnl From Jim Meyering. dnl A wrapper around AC_FUNC_GETGROUPS. -# Copyright (C) 1996-1997, 1999-2004, 2008-2015 Free Software Foundation, Inc. +# Copyright (C) 1996-1997, 1999-2004, 2008-2015 Free Software +# Foundation, Inc. # # This file is free software; the Free Software Foundation # 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 @@ # Check for getloadavg. -# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2015 Free Software -# Foundation, Inc. +# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2015 Free +# Software Foundation, Inc. # This file is free software; the Free Software Foundation # 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 @@ # gettime.m4 serial 8 -dnl Copyright (C) 2002, 2004-2006, 2009-2015 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2004-2006, 2009-2015 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, 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 @@ # serial 21 -# Copyright (C) 2001-2003, 2005, 2007, 2009-2015 Free Software Foundation, Inc. +# Copyright (C) 2001-2003, 2005, 2007, 2009-2015 Free Software +# Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # 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 @@ # serial 14 -# Copyright (C) 1999-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc. +# Copyright (C) 1999-2001, 2003-2007, 2009-2015 Free Software +# Foundation, Inc. # This file is free software; the Free Software Foundation # 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 @@ # memrchr.m4 serial 10 -dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software Foundation, -dnl Inc. +dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software +dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, 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 @@ # serial 25 -dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software Foundation, -dnl Inc. +dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software +dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, 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 @@ # pathmax.m4 serial 10 -dnl Copyright (C) 2002-2003, 2005-2006, 2009-2015 Free Software Foundation, -dnl Inc. +dnl Copyright (C) 2002-2003, 2005-2006, 2009-2015 Free Software +dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, 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 @@ # serial 7 -dnl Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, 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 @@ # ssize_t.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2001-2003, 2006, 2010-2015 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2003, 2006, 2010-2015 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, 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 @@ # serial 6 -# Copyright (C) 1998-1999, 2001, 2009-2015 Free Software Foundation, Inc. +# Copyright (C) 1998-1999, 2001, 2009-2015 Free Software Foundation, +# Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # 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 @@ # Checks for stat-related time functions. -# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2015 Free Software -# Foundation, Inc. +# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2015 Free +# Software Foundation, Inc. # This file is free software; the Free Software Foundation # 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 @@ +# stdarg.m4 serial 6 +dnl Copyright (C) 2006, 2008-2015 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. +dnl Provide a working va_copy in combination with . + +AC_DEFUN([gl_STDARG_H], +[ + STDARG_H='' + NEXT_STDARG_H='' + AC_MSG_CHECKING([for va_copy]) + AC_CACHE_VAL([gl_cv_func_va_copy], [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[ +#ifndef va_copy +void (*func) (va_list, va_list) = va_copy; +#endif + ]])], + [gl_cv_func_va_copy=yes], + [gl_cv_func_va_copy=no])]) + AC_MSG_RESULT([$gl_cv_func_va_copy]) + if test $gl_cv_func_va_copy = no; then + dnl Provide a substitute. + dnl Usually a simple definition in is enough. Not so on AIX 5 + dnl with some versions of the /usr/vac/bin/cc compiler. It has an + dnl which does '#undef va_copy', leading to a missing va_copy symbol. For + dnl this platform, we use an substitute. But we cannot use this + dnl approach on other platforms, because often defines only + dnl preprocessor macros and gl_ABSOLUTE_HEADER, gl_CHECK_NEXT_HEADERS do + dnl not work in this situation. + AC_EGREP_CPP([vaccine], + [#if defined _AIX && !defined __GNUC__ + AIX vaccine + #endif + ], [gl_aixcc=yes], [gl_aixcc=no]) + if test $gl_aixcc = yes; then + dnl Provide a substitute file. + STDARG_H=stdarg.h + gl_NEXT_HEADERS([stdarg.h]) + dnl Fallback for the case when contains only macro definitions. + if test "$gl_cv_next_stdarg_h" = '""'; then + gl_cv_next_stdarg_h='"///usr/include/stdarg.h"' + NEXT_STDARG_H="$gl_cv_next_stdarg_h" + fi + else + dnl Provide a substitute in , either __va_copy or as a simple + dnl assignment. + gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[ +#ifndef __va_copy +error, bail out +#endif + ]])], + [gl_cv_func___va_copy=yes], + [gl_cv_func___va_copy=no])]) + if test $gl_cv_func___va_copy = yes; then + AC_DEFINE([va_copy], [__va_copy], + [Define as a macro for copying va_list variables.]) + else + AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed. */ +#define gl_va_copy(a,b) ((a) = (b))]) + AC_DEFINE([va_copy], [gl_va_copy], + [Define as a macro for copying va_list variables.]) + fi + fi + fi + AC_SUBST([STDARG_H]) + AM_CONDITIONAL([GL_GENERATE_STDARG_H], [test -n "$STDARG_H"]) + AC_SUBST([NEXT_STDARG_H]) +]) 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 @@ +# Check for stdbool.h that conforms to C99. + +dnl Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +#serial 5 + +# Prepare for substituting if it is not supported. + +AC_DEFUN([AM_STDBOOL_H], +[ + AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) + + # Define two additional variables used in the Makefile substitution. + + if test "$ac_cv_header_stdbool_h" = yes; then + STDBOOL_H='' + else + STDBOOL_H='stdbool.h' + fi + AC_SUBST([STDBOOL_H]) + AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) + + if test "$ac_cv_type__Bool" = yes; then + HAVE__BOOL=1 + else + HAVE__BOOL=0 + fi + AC_SUBST([HAVE__BOOL]) +]) + +# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. +AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) + +# This version of the macro is needed in autoconf <= 2.68. + +AC_DEFUN([AC_CHECK_HEADER_STDBOOL], + [AC_CACHE_CHECK([for stdbool.h that conforms to C99], + [ac_cv_header_stdbool_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif + #ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" + #endif + + struct s { _Bool s: 1; _Bool t; } s; + + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + /* See body of main program for 'e'. */ + char f[(_Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + /* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ + _Bool q = true; + _Bool *pq = &q; + ]], + [[ + bool e = &s; + *pq |= q; + *pq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq); + ]])], + [ac_cv_header_stdbool_h=yes], + [ac_cv_header_stdbool_h=no])]) + AC_CHECK_TYPES([_Bool]) +]) 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 @@ # serial 33 -# Copyright (C) 1996-1997, 1999-2007, 2009-2015 Free Software Foundation, Inc. +# Copyright (C) 1996-1997, 1999-2007, 2009-2015 Free Software +# Foundation, Inc. # # This file is free software; the Free Software Foundation # 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 @@ # strtoimax.m4 serial 14 -dnl Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, 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 @@ # strtoll.m4 serial 7 -dnl Copyright (C) 2002, 2004, 2006, 2008-2015 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2004, 2006, 2008-2015 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, 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 @@ # strtoull.m4 serial 7 -dnl Copyright (C) 2002, 2004, 2006, 2008-2015 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2004, 2006, 2008-2015 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, 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 @@ # strtoumax.m4 serial 12 -dnl Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, 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 @@ # Configure a more-standard replacement for . -# Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc. +# Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software +# Foundation, Inc. # serial 8 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 @@ #serial 15 -# Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc. +# Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software +# Foundation, Inc. # This file is free software; the Free Software Foundation # 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 @@ # serial 9 -# Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2015 Free Software Foundation, -# Inc. +# Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2015 Free Software +# Foundation, Inc. # # This file is free software; the Free Software Foundation # 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 @@ +/* Add an uninitialized data section to an executable. + Copyright (C) 1999, 2001-2015 Free Software Foundation, Inc. + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . + + + Andrew Innes 04-Jan-1999 + based on code from unexw32.c +*/ + +#include +#include +#include +#include +#if defined(__GNUC__) && !defined(MINGW_W64) +#define _ANONYMOUS_UNION +#define _ANONYMOUS_STRUCT +#endif +#include + +/* Include relevant definitions from IMAGEHLP.H, which can be found + in \\win32sdk\mstools\samples\image\include\imagehlp.h. */ + +PIMAGE_NT_HEADERS +(__stdcall * pfnCheckSumMappedFile) (PVOID BaseAddress, + DWORD_PTR FileLength, + PDWORD_PTR HeaderSum, + PDWORD_PTR CheckSum); + +#undef min +#undef max +#define min(x, y) (((x) < (y)) ? (x) : (y)) +#define max(x, y) (((x) > (y)) ? (x) : (y)) + + +/* File handling. */ + +typedef struct file_data { + const char *name; + unsigned long size; + HANDLE file; + HANDLE file_mapping; + unsigned char *file_base; +} file_data; + +int +open_input_file (file_data *p_file, const char *filename) +{ + HANDLE file; + HANDLE file_mapping; + void *file_base; + unsigned long size, upper_size; + + file = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + if (file == INVALID_HANDLE_VALUE) + return FALSE; + + size = GetFileSize (file, &upper_size); + file_mapping = CreateFileMapping (file, NULL, PAGE_READONLY, + 0, size, NULL); + if (!file_mapping) + return FALSE; + + file_base = MapViewOfFile (file_mapping, FILE_MAP_READ, 0, 0, size); + if (file_base == 0) + return FALSE; + + p_file->name = filename; + p_file->size = size; + p_file->file = file; + p_file->file_mapping = file_mapping; + p_file->file_base = file_base; + + return TRUE; +} + +int +open_output_file (file_data *p_file, const char *filename, unsigned long size) +{ + HANDLE file; + HANDLE file_mapping; + void *file_base; + + file = CreateFile (filename, GENERIC_READ | GENERIC_WRITE, 0, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); + if (file == INVALID_HANDLE_VALUE) + return FALSE; + + file_mapping = CreateFileMapping (file, NULL, PAGE_READWRITE, + 0, size, NULL); + if (!file_mapping) + return FALSE; + + file_base = MapViewOfFile (file_mapping, FILE_MAP_WRITE, 0, 0, size); + if (file_base == 0) + return FALSE; + + p_file->name = filename; + p_file->size = size; + p_file->file = file; + p_file->file_mapping = file_mapping; + p_file->file_base = file_base; + + return TRUE; +} + +/* Close the system structures associated with the given file. */ +void +close_file_data (file_data *p_file) +{ + UnmapViewOfFile (p_file->file_base); + CloseHandle (p_file->file_mapping); + /* For the case of output files, set final size. */ + SetFilePointer (p_file->file, p_file->size, NULL, FILE_BEGIN); + SetEndOfFile (p_file->file); + CloseHandle (p_file->file); +} + + +/* Routines to manipulate NT executable file sections. */ + +unsigned long +get_unrounded_section_size (PIMAGE_SECTION_HEADER p_section) +{ + /* The true section size, before rounding, for an initialized data or + code section. (Supposedly some linkers swap the meaning of these + two values.) */ + return min (p_section->SizeOfRawData, + p_section->Misc.VirtualSize); +} + +/* Return pointer to section header for named section. */ +IMAGE_SECTION_HEADER * +find_section (const char *name, IMAGE_NT_HEADERS *nt_header) +{ + PIMAGE_SECTION_HEADER section; + int i; + + section = IMAGE_FIRST_SECTION (nt_header); + + for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++) + { + if (strcmp (section->Name, name) == 0) + return section; + section++; + } + return NULL; +} + +/* Return pointer to section header for section containing the given + relative virtual address. */ +IMAGE_SECTION_HEADER * +rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header) +{ + PIMAGE_SECTION_HEADER section; + int i; + + section = IMAGE_FIRST_SECTION (nt_header); + + for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++) + { + /* Some linkers (eg. the NT SDK linker I believe) swapped the + meaning of these two values - or rather, they ignored + VirtualSize entirely and always set it to zero. This affects + some very old exes (eg. gzip dated Dec 1993). Since + w32_executable_type relies on this function to work reliably, + we need to cope with this. */ + DWORD_PTR real_size = max (section->SizeOfRawData, + section->Misc.VirtualSize); + if (rva >= section->VirtualAddress + && rva < section->VirtualAddress + real_size) + return section; + section++; + } + return NULL; +} + +/* Return pointer to section header for section containing the given + offset in its raw data area. */ +IMAGE_SECTION_HEADER * +offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header) +{ + PIMAGE_SECTION_HEADER section; + int i; + + section = IMAGE_FIRST_SECTION (nt_header); + + for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++) + { + if (offset >= section->PointerToRawData + && offset < section->PointerToRawData + section->SizeOfRawData) + return section; + section++; + } + return NULL; +} + +/* Return offset to an object in dst, given offset in src. We assume + there is at least one section in both src and dst images, and that + the some sections may have been added to dst (after sections in src). */ +static DWORD_PTR +relocate_offset (DWORD_PTR offset, + IMAGE_NT_HEADERS * src_nt_header, + IMAGE_NT_HEADERS * dst_nt_header) +{ + PIMAGE_SECTION_HEADER src_section = IMAGE_FIRST_SECTION (src_nt_header); + PIMAGE_SECTION_HEADER dst_section = IMAGE_FIRST_SECTION (dst_nt_header); + int i = 0; + + while (offset >= src_section->PointerToRawData) + { + if (offset < src_section->PointerToRawData + src_section->SizeOfRawData) + break; + i++; + if (i == src_nt_header->FileHeader.NumberOfSections) + { + /* Handle offsets after the last section. */ + dst_section = IMAGE_FIRST_SECTION (dst_nt_header); + dst_section += dst_nt_header->FileHeader.NumberOfSections - 1; + while (dst_section->PointerToRawData == 0) + dst_section--; + while (src_section->PointerToRawData == 0) + src_section--; + return offset + + (dst_section->PointerToRawData + dst_section->SizeOfRawData) + - (src_section->PointerToRawData + src_section->SizeOfRawData); + } + src_section++; + dst_section++; + } + return offset + + (dst_section->PointerToRawData - src_section->PointerToRawData); +} + +#define OFFSET_TO_RVA(offset, section) \ + (section->VirtualAddress + ((DWORD_PTR)(offset) - section->PointerToRawData)) + +#define RVA_TO_OFFSET(rva, section) \ + (section->PointerToRawData + ((DWORD_PTR)(rva) - section->VirtualAddress)) + +#define RVA_TO_SECTION_OFFSET(rva, section) \ + ((DWORD_PTR)(rva) - section->VirtualAddress) + +/* Convert address in executing image to RVA. */ +#define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL)) + +#define PTR_TO_OFFSET(ptr, pfile_data) \ + ((unsigned const char *)(ptr) - (pfile_data)->file_base) + +#define OFFSET_TO_PTR(offset, pfile_data) \ + ((pfile_data)->file_base + (DWORD_PTR)(offset)) + +#define ROUND_UP(p, align) \ + (((DWORD_PTR)(p) + (align)-1) & ~((DWORD_PTR)(align)-1)) +#define ROUND_DOWN(p, align) ((DWORD_PTR)(p) & ~((DWORD_PTR)(align)-1)) + + +static void +copy_executable_and_add_section (file_data *p_infile, + file_data *p_outfile, + const char *new_section_name, + DWORD_PTR new_section_size) +{ + unsigned char *dst; + PIMAGE_DOS_HEADER dos_header; + PIMAGE_NT_HEADERS nt_header; + PIMAGE_NT_HEADERS dst_nt_header; + PIMAGE_SECTION_HEADER section; + PIMAGE_SECTION_HEADER dst_section; + DWORD_PTR offset; + int i; + int be_verbose = GetEnvironmentVariable ("DEBUG_DUMP", NULL, 0) > 0; + +#define COPY_CHUNK(message, src, size, verbose) \ + do { \ + unsigned const char *s = (void *)(src); \ + unsigned long count = (size); \ + if (verbose) \ + { \ + printf ("%s\n", (message)); \ + printf ("\t0x%08x Offset in input file.\n", s - p_infile->file_base); \ + printf ("\t0x%08x Offset in output file.\n", dst - p_outfile->file_base); \ + printf ("\t0x%08x Size in bytes.\n", count); \ + } \ + memcpy (dst, s, count); \ + dst += count; \ + } while (0) + +#define DST_TO_OFFSET() PTR_TO_OFFSET (dst, p_outfile) +#define ROUND_UP_DST_AND_ZERO(align) \ + do { \ + unsigned char *newdst = p_outfile->file_base \ + + ROUND_UP (DST_TO_OFFSET (), (align)); \ + /* Zero the alignment slop; it may actually initialize real data. */ \ + memset (dst, 0, newdst - dst); \ + dst = newdst; \ + } while (0) + + /* Copy the source image sequentially, ie. section by section after + copying the headers and section table, to simplify the process of + adding an extra section table entry (which might force the raw + section data to be relocated). + + Note that dst is updated implicitly by each COPY_CHUNK. */ + + dos_header = (PIMAGE_DOS_HEADER) p_infile->file_base; + nt_header = (PIMAGE_NT_HEADERS) (((unsigned char *) dos_header) + + dos_header->e_lfanew); + section = IMAGE_FIRST_SECTION (nt_header); + + dst = (unsigned char *) p_outfile->file_base; + + COPY_CHUNK ("Copying DOS header...", dos_header, + (DWORD_PTR) nt_header - (DWORD_PTR) dos_header, be_verbose); + dst_nt_header = (PIMAGE_NT_HEADERS) dst; + COPY_CHUNK ("Copying NT header...", nt_header, + (DWORD_PTR) section - (DWORD_PTR) nt_header, be_verbose); + dst_section = (PIMAGE_SECTION_HEADER) dst; + COPY_CHUNK ("Copying section table...", section, + nt_header->FileHeader.NumberOfSections * sizeof (*section), + be_verbose); + + /* To improve the efficiency of demand loading, make the file + alignment match the section alignment (VC++ 6.0 does this by + default anyway). */ + dst_nt_header->OptionalHeader.FileAlignment = + dst_nt_header->OptionalHeader.SectionAlignment; + + /* Add an uninitialized data section at the end, of the specified name + and virtual size. */ + if (find_section (new_section_name, nt_header) == NULL) + /* Leave room for extra section table entry; filled in below. */ + dst += sizeof (*section); + else + new_section_name = NULL; + + /* Align the first section's raw data area, and set the header size + field accordingly. */ + ROUND_UP_DST_AND_ZERO (dst_nt_header->OptionalHeader.FileAlignment); + dst_nt_header->OptionalHeader.SizeOfHeaders = DST_TO_OFFSET (); + + for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++) + { + char msg[100]; + /* Windows section names are fixed 8-char strings, only + zero-terminated if the name is shorter than 8 characters. */ + sprintf (msg, "Copying raw data for %.8s...", section->Name); + + /* Update the file-relative offset for this section's raw data (if + it has any) in case things have been relocated; we will update + the other offsets below once we know where everything is. */ + if (dst_section->PointerToRawData) + dst_section->PointerToRawData = DST_TO_OFFSET (); + + /* Can always copy the original raw data. */ + COPY_CHUNK + (msg, OFFSET_TO_PTR (section->PointerToRawData, p_infile), + section->SizeOfRawData, be_verbose); + + /* Round up the raw data size to the new alignment. */ + dst_section->SizeOfRawData = + ROUND_UP (dst_section->SizeOfRawData, + dst_nt_header->OptionalHeader.FileAlignment); + + /* Align the next section's raw data area. */ + ROUND_UP_DST_AND_ZERO (dst_nt_header->OptionalHeader.FileAlignment); + + section++; + dst_section++; + } + + /* Add the extra section entry (which adds no raw data). */ + if (new_section_name != NULL) + { + dst_nt_header->FileHeader.NumberOfSections++; + dst_nt_header->OptionalHeader.SizeOfImage += new_section_size; + strncpy (dst_section->Name, new_section_name, sizeof (dst_section->Name)); + dst_section->VirtualAddress = + section[-1].VirtualAddress + + ROUND_UP (section[-1].Misc.VirtualSize, + dst_nt_header->OptionalHeader.SectionAlignment); + dst_section->Misc.VirtualSize = new_section_size; + dst_section->PointerToRawData = 0; + dst_section->SizeOfRawData = 0; + dst_section->Characteristics = + IMAGE_SCN_CNT_UNINITIALIZED_DATA + | IMAGE_SCN_MEM_READ + | IMAGE_SCN_MEM_WRITE; + } + + /* Copy remainder of source image. */ + section--; + offset = ROUND_UP (section->PointerToRawData + section->SizeOfRawData, + nt_header->OptionalHeader.FileAlignment); + COPY_CHUNK + ("Copying remainder of executable...", + OFFSET_TO_PTR (offset, p_infile), + p_infile->size - offset, be_verbose); + + /* Final size for new image. */ + p_outfile->size = DST_TO_OFFSET (); + + /* Now patch up remaining file-relative offsets. */ + section = IMAGE_FIRST_SECTION (nt_header); + dst_section = IMAGE_FIRST_SECTION (dst_nt_header); + +#define ADJUST_OFFSET(var) \ + do { \ + if ((var) != 0) \ + (var) = relocate_offset ((var), nt_header, dst_nt_header); \ + } while (0) + + dst_nt_header->OptionalHeader.SizeOfInitializedData = 0; + dst_nt_header->OptionalHeader.SizeOfUninitializedData = 0; + for (i = 0; i < dst_nt_header->FileHeader.NumberOfSections; i++) + { + /* Recompute data sizes for completeness. */ + if (dst_section[i].Characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA) + dst_nt_header->OptionalHeader.SizeOfInitializedData += + ROUND_UP (dst_section[i].Misc.VirtualSize, dst_nt_header->OptionalHeader.FileAlignment); + else if (dst_section[i].Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA) + dst_nt_header->OptionalHeader.SizeOfUninitializedData += + ROUND_UP (dst_section[i].Misc.VirtualSize, dst_nt_header->OptionalHeader.FileAlignment); + + ADJUST_OFFSET (dst_section[i].PointerToLinenumbers); + } + + ADJUST_OFFSET (dst_nt_header->FileHeader.PointerToSymbolTable); + + /* Update offsets in debug directory entries. */ + { + IMAGE_DATA_DIRECTORY debug_dir = + dst_nt_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG]; + PIMAGE_DEBUG_DIRECTORY debug_entry; + + section = rva_to_section (debug_dir.VirtualAddress, dst_nt_header); + if (section) + { + debug_entry = (PIMAGE_DEBUG_DIRECTORY) + (RVA_TO_OFFSET (debug_dir.VirtualAddress, section) + p_outfile->file_base); + debug_dir.Size /= sizeof (IMAGE_DEBUG_DIRECTORY); + + for (i = 0; i < debug_dir.Size; i++, debug_entry++) + ADJUST_OFFSET (debug_entry->PointerToRawData); + } + } +} + + +int +main (int argc, char **argv) +{ + file_data in_file, out_file; + char out_filename[MAX_PATH], in_filename[MAX_PATH]; + unsigned long size; + PIMAGE_DOS_HEADER dos_header; + PIMAGE_NT_HEADERS nt_header; + +#define OLD_NAME argv[1] +#define NEW_NAME argv[2] +#define SECTION_NAME argv[3] +#define SECTION_SIZE argv[4] + + strcpy (in_filename, OLD_NAME); + strcpy (out_filename, NEW_NAME); + + printf ("Dumping from %s\n", in_filename); + printf (" to %s\n", out_filename); + + /* Open the undumped executable file. */ + if (!open_input_file (&in_file, in_filename)) + { + printf ("Failed to open %s (%d)...bailing.\n", + in_filename, GetLastError ()); + exit (1); + } + dos_header = (PIMAGE_DOS_HEADER) in_file.file_base; + nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew); + /* Allow for expansion due to increasing file align to section align. + We can overestimate here, since close_file_data will update the + size exactly. */ + size = in_file.size + + nt_header->OptionalHeader.SectionAlignment + * nt_header->FileHeader.NumberOfSections; + if (!open_output_file (&out_file, out_filename, size)) + { + printf ("Failed to open %s (%d)...bailing.\n", + out_filename, GetLastError ()); + exit (1); + } + + copy_executable_and_add_section (&in_file, &out_file, + SECTION_NAME, + atoi (SECTION_SIZE) * 1024 * 1024); + + /* Patch up header fields; profiler is picky about this. */ + { + HANDLE hImagehelp = LoadLibrary ("imagehlp.dll"); + DWORD_PTR headersum; + DWORD_PTR checksum; + + dos_header = (PIMAGE_DOS_HEADER) out_file.file_base; + nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew); + + nt_header->OptionalHeader.CheckSum = 0; +// nt_header->FileHeader.TimeDateStamp = time (NULL); +// dos_header->e_cp = size / 512; +// nt_header->OptionalHeader.SizeOfImage = size; + + pfnCheckSumMappedFile = (void *) GetProcAddress (hImagehelp, "CheckSumMappedFile"); + if (pfnCheckSumMappedFile) + { +// nt_header->FileHeader.TimeDateStamp = time (NULL); + pfnCheckSumMappedFile (out_file.file_base, + out_file.size, + &headersum, + &checksum); + nt_header->OptionalHeader.CheckSum = checksum; + } + FreeLibrary (hImagehelp); + } + + close_file_data (&in_file); + close_file_data (&out_file); + + return 0; +} + +/* eof */ + 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 @@ /* Buffer insertion/deletion and gap motion for GNU Emacs. - -Copyright (C) 1985-1986, 1993-1995, 1997-2015 Free Software Foundation, -Inc. + Copyright (C) 1985-1986, 1993-1995, 1997-2015 Free Software + Foundation, Inc. This file is part of GNU Emacs. 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 @@ -/* Heap management routines for GNU Emacs on the Microsoft Windows - API. Copyright (C) 1994, 2001-2015 Free Software Foundation, Inc. +/* Heap management routines for GNU Emacs on the Microsoft Windows API. + Copyright (C) 1994, 2001-2015 Free Software Foundation, Inc. This file is part of GNU Emacs. 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 @@ +;;; package-test.el --- Tests for the Emacs package system + +;; Copyright (C) 2013-2015 Free Software Foundation, Inc. + +;; Author: Daniel Hackney +;; Version: 1.0 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; You may want to run this from a separate Emacs instance from your +;; main one, because a bug in the code below could mess with your +;; installed packages. + +;; Run this in a clean Emacs session using: +;; +;; $ emacs -Q --batch -L . -l package-x-test.el -f ert-run-tests-batch-and-exit + +;;; Code: + +(require 'package-x) +(require 'ert) +(require 'cl-lib) +(eval-when-compile (require 'package-test)) + +;; package-test is not normally in `load-path', so temporarily set +;; `load-path' to contain the current directory. +(let ((load-path (append (list (file-name-directory (or load-file-name + buffer-file-name))) + load-path))) + (require 'package-test)) + +(defvar package-x-test--single-archive-entry-1-3 + (cons 'simple-single + (package-make-ac-desc '(1 3) nil + "A single-file package with no dependencies" + 'single + '((:url . "http://doodles.au")))) + "Expected contents of the archive entry from the \"simple-single\" package.") + +(defvar package-x-test--single-archive-entry-1-4 + (cons 'simple-single + (package-make-ac-desc '(1 4) nil + "A single-file package with no dependencies" + 'single + nil)) + "Expected contents of the archive entry from the updated \"simple-single\" package.") + +(ert-deftest package-x-test-upload-buffer () + "Test creating an \"archive-contents\" file" + (with-package-test (:basedir "data/package" + :file "simple-single-1.3.el" + :upload-base t) + (package-upload-buffer) + (should (file-exists-p (expand-file-name "archive-contents" + package-archive-upload-base))) + (should (file-exists-p (expand-file-name "simple-single-1.3.el" + package-archive-upload-base))) + (should (file-exists-p (expand-file-name "simple-single-readme.txt" + package-archive-upload-base))) + + (let (archive-contents) + (with-temp-buffer + (insert-file-contents + (expand-file-name "archive-contents" + package-archive-upload-base)) + (setq archive-contents + (package-read-from-string + (buffer-substring (point-min) (point-max))))) + (should (equal archive-contents + (list 1 package-x-test--single-archive-entry-1-3)))))) + +(ert-deftest package-x-test-upload-new-version () + "Test uploading a new version of a package" + (with-package-test (:basedir "data/package" + :file "simple-single-1.3.el" + :upload-base t) + (package-upload-buffer) + (with-temp-buffer + (insert-file-contents "newer-versions/simple-single-1.4.el") + (package-upload-buffer)) + + (let (archive-contents) + (with-temp-buffer + (insert-file-contents + (expand-file-name "archive-contents" + package-archive-upload-base)) + (setq archive-contents + (package-read-from-string + (buffer-substring (point-min) (point-max))))) + (should (equal archive-contents + (list 1 package-x-test--single-archive-entry-1-4)))))) + +(provide 'package-x-test) + +;;; package-x-test.el ends here