aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorK. Handa2015-01-07 22:51:41 +0900
committerK. Handa2015-01-07 22:51:41 +0900
commit88bc8332eb14bcc4780fd3fe3dd4de2205c31dbf (patch)
tree18da116400703b67738bdbbd38cc4abf4c1e929f /lib-src
parent3f79d3131629f73da16ec121d2a0056f11b70e65 (diff)
parent95295df44cc2b6e0e2442aeff96b0fe2ceac405c (diff)
downloademacs-88bc8332eb14bcc4780fd3fe3dd4de2205c31dbf.tar.gz
emacs-88bc8332eb14bcc4780fd3fe3dd4de2205c31dbf.zip
Merge branch master of git.sv.gnu.org:/srv/git/emacs.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog53
-rw-r--r--lib-src/Makefile.in8
-rw-r--r--lib-src/ebrowse.c2
-rw-r--r--lib-src/emacsclient.c2
-rw-r--r--lib-src/etags.c2
-rw-r--r--lib-src/hexl.c2
-rw-r--r--lib-src/make-docfile.c294
-rw-r--r--lib-src/makefile.w32-in2
-rw-r--r--lib-src/movemail.c2
-rw-r--r--lib-src/ntlib.c2
-rw-r--r--lib-src/ntlib.h2
-rw-r--r--lib-src/pop.c2
-rw-r--r--lib-src/pop.h2
-rw-r--r--lib-src/profile.c2
-rwxr-xr-xlib-src/rcs2log4
-rw-r--r--lib-src/update-game-score.c2
16 files changed, 283 insertions, 100 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 07a72ecaf0d..9a1fc7a3e9f 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,38 @@
12015-01-05 Paul Eggert <eggert@cs.ucla.edu>
2
3 Use 0 for Qnil
4 * make-docfile.c (compare_globals): Consider 'nil' to be the least.
5
6 Compute C decls for DEFSYMs automatically
7 Fixes Bug#15880.
8 * make-docfile.c: Revamp to generate table of symbols, too.
9 Include <stdbool.h>.
10 (xstrdup): New function.
11 (main): Don't process the same file twice.
12 (SYMBOL): New constant in enum global_type.
13 (struct symbol): Turn 'value' member into a union, either v.value
14 for int or v.svalue for string. All uses changed.
15 (add_global): New arg svalue, which overrides value, so that globals
16 can have a string value.
17 (close_emacs_global): New arg num_symbols; all uses changed.
18 Output lispsym decl.
19 (write_globals): Output symbol globals too. Output more
20 ATTRIBUTE_CONST, now that Qnil etc. are C constants.
21 Output defsym_name table.
22 (scan_c_file): Move most of guts into ...
23 (scan_c_stream): ... new function. Scan for DEFSYMs and
24 record symbols found. Don't read past EOF if file doesn't
25 end in newline.
26
272015-01-04 Paul Eggert <eggert@cs.ucla.edu>
28
29 'temacs -nw' should not call missing functions
30 * make-docfile.c (write_globals):
31 Declare Fframe_windows_min_size with ATTRIBUTE_CONST, too. Sort.
32
33 Less 'make' chatter for lib-src
34 * Makefile.in (blessmail): Less 'make' chatter here.
35
12014-12-27 Eli Zaretskii <eliz@gnu.org> 362014-12-27 Eli Zaretskii <eliz@gnu.org>
2 37
3 * Makefile.in (etags_libs, ebrowse${EXEEXT}, profile${EXEEXT}) 38 * Makefile.in (etags_libs, ebrowse${EXEEXT}, profile${EXEEXT})
@@ -6,6 +41,17 @@
6 since GCC sometimes calls stpcpy when it sees strcpy, under 41 since GCC sometimes calls stpcpy when it sees strcpy, under
7 optimization switches. 42 optimization switches.
8 43
442014-12-25 Paul Eggert <eggert@cs.ucla.edu>
45
46 * ebrowse.c (sym_scope_1, operator_name, open_file):
47 * emacsclient.c (get_server_config, set_local_socket)
48 (start_daemon_and_retry_set_socket):
49 * etags.c (main, C_entries, relative_filename):
50 * pop.c (sendline):
51 * update-game-score.c (main):
52 Rewrite to avoid the need for strcat, typically by using stpcpy
53 and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms.
54
92014-12-14 Paul Eggert <eggert@cs.ucla.edu> 552014-12-14 Paul Eggert <eggert@cs.ucla.edu>
10 56
11 * etags.c (analyze_regex): Rename from analyse_regex. 57 * etags.c (analyze_regex): Rename from analyse_regex.
@@ -135,8 +181,7 @@
135 181
1362014-05-26 Paul Eggert <eggert@cs.ucla.edu> 1822014-05-26 Paul Eggert <eggert@cs.ucla.edu>
137 183
138 Fix rcs2log problems with CVS. 184 Fix rcs2log problems with CVS. Reported by Glenn Morris in
139 Problem reported by Glenn Morris in
140 <http://lists.gnu.org/archive/html/emacs-devel/2014-05/msg00277.html>. 185 <http://lists.gnu.org/archive/html/emacs-devel/2014-05/msg00277.html>.
141 Plus, fix some security and filename quoting problems. 186 Plus, fix some security and filename quoting problems.
142 * rcs2log (logdir): Prefer mktemp if available. 187 * rcs2log (logdir): Prefer mktemp if available.
@@ -3491,7 +3536,7 @@
34912004-04-17 Paul Eggert <eggert@gnu.org> 35362004-04-17 Paul Eggert <eggert@gnu.org>
3492 3537
3493 * rcs2log (Help): Clarify wording of the usage message. 3538 * rcs2log (Help): Clarify wording of the usage message.
3494 Problem reported by Alan Mackenzie in 3539 Reported by Alan Mackenzie in
3495 <http://mail.gnu.org/archive/html/bug-gnu-emacs/2004-04/msg00188.html>. 3540 <http://mail.gnu.org/archive/html/bug-gnu-emacs/2004-04/msg00188.html>.
3496 3541
34972004-04-07 Stefan Monnier <monnier@iro.umontreal.ca> 35422004-04-07 Stefan Monnier <monnier@iro.umontreal.ca>
@@ -8417,7 +8462,7 @@
8417;; coding: utf-8 8462;; coding: utf-8
8418;; End: 8463;; End:
8419 8464
8420 Copyright (C) 1988-1999, 2001-2014 Free Software Foundation, Inc. 8465 Copyright (C) 1988-1999, 2001-2015 Free Software Foundation, Inc.
8421 8466
8422 This file is part of GNU Emacs. 8467 This file is part of GNU Emacs.
8423 8468
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index 13a7a05156c..22a5ecad8d8 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -1,7 +1,7 @@
1### @configure_input@ 1### @configure_input@
2 2
3# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2014 3# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2015 Free Software
4# Free Software Foundation, Inc. 4# Foundation, Inc.
5 5
6# This file is part of GNU Emacs. 6# This file is part of GNU Emacs.
7 7
@@ -223,8 +223,8 @@ $(EXE_FILES): ../lib/libgnu.a
223## Only used if we need blessmail, but no harm in always defining. 223## Only used if we need blessmail, but no harm in always defining.
224## This makes the actual blessmail executable. 224## This makes the actual blessmail executable.
225blessmail: $(srcdir)/../lisp/mail/blessmail.el 225blessmail: $(srcdir)/../lisp/mail/blessmail.el
226 $(EMACS) $(EMACSOPT) -l $< 226 $(AM_V_GEN)$(EMACS) $(EMACSOPT) -l $<
227 chmod +x $@ 227 $(AM_V_at)chmod +x $@
228 228
229## This checks if we need to run blessmail. 229## This checks if we need to run blessmail.
230## Do not charge ahead and do it! Let the installer decide. 230## Do not charge ahead and do it! Let the installer decide.
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index b7431593c3e..d16c9ae54af 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -1,6 +1,6 @@
1/* ebrowse.c --- parsing files for the ebrowse C++ browser 1/* ebrowse.c --- parsing files for the ebrowse C++ browser
2 2
3Copyright (C) 1992-2014 Free Software Foundation, Inc. 3Copyright (C) 1992-2015 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index cfc321a1830..a04dda6408f 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1,6 +1,6 @@
1/* Client process that communicates with GNU Emacs acting as server. 1/* Client process that communicates with GNU Emacs acting as server.
2 2
3Copyright (C) 1986-1987, 1994, 1999-2014 Free Software Foundation, Inc. 3Copyright (C) 1986-1987, 1994, 1999-2015 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 78b3fed1128..dc2ced50933 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -28,7 +28,7 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
28IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 30
31Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2014 Free Software 31Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2015 Free Software
32Foundation, Inc. 32Foundation, Inc.
33 33
34This file is not considered part of GNU Emacs. 34This file is not considered part of GNU Emacs.
diff --git a/lib-src/hexl.c b/lib-src/hexl.c
index 51744ab08a2..490f72731b4 100644
--- a/lib-src/hexl.c
+++ b/lib-src/hexl.c
@@ -1,5 +1,5 @@
1/* Convert files for Emacs Hexl mode. 1/* Convert files for Emacs Hexl mode.
2 Copyright (C) 1989, 2001-2014 Free Software Foundation, Inc. 2 Copyright (C) 1989, 2001-2015 Free Software Foundation, Inc.
3 3
4Author: Keith Gabryelski 4Author: Keith Gabryelski
5(according to authors.el) 5(according to authors.el)
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 884b6c1001e..22c4bad2e3f 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -1,6 +1,6 @@
1/* Generate doc-string file for GNU Emacs from source files. 1/* Generate doc-string file for GNU Emacs from source files.
2 2
3Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2014 Free Software 3Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2015 Free Software
4Foundation, Inc. 4Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
@@ -36,6 +36,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
36 36
37#include <config.h> 37#include <config.h>
38 38
39#include <stdbool.h>
39#include <stdio.h> 40#include <stdio.h>
40#include <stdlib.h> /* config.h unconditionally includes this anyway */ 41#include <stdlib.h> /* config.h unconditionally includes this anyway */
41 42
@@ -63,6 +64,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
63static int scan_file (char *filename); 64static int scan_file (char *filename);
64static int scan_lisp_file (const char *filename, const char *mode); 65static int scan_lisp_file (const char *filename, const char *mode);
65static int scan_c_file (char *filename, const char *mode); 66static int scan_c_file (char *filename, const char *mode);
67static int scan_c_stream (FILE *infile);
66static void start_globals (void); 68static void start_globals (void);
67static void write_globals (void); 69static void write_globals (void);
68 70
@@ -106,6 +108,17 @@ xmalloc (unsigned int size)
106 return result; 108 return result;
107} 109}
108 110
111/* Like strdup, but get fatal error if memory is exhausted. */
112
113static char *
114xstrdup (char *s)
115{
116 char *result = strdup (s);
117 if (! result)
118 fatal ("virtual memory exhausted", 0);
119 return result;
120}
121
109/* Like realloc but get fatal error if memory is exhausted. */ 122/* Like realloc but get fatal error if memory is exhausted. */
110 123
111static void * 124static void *
@@ -123,7 +136,6 @@ main (int argc, char **argv)
123{ 136{
124 int i; 137 int i;
125 int err_count = 0; 138 int err_count = 0;
126 int first_infile;
127 139
128 progname = argv[0]; 140 progname = argv[0];
129 141
@@ -167,16 +179,21 @@ main (int argc, char **argv)
167 if (generate_globals) 179 if (generate_globals)
168 start_globals (); 180 start_globals ();
169 181
170 first_infile = i; 182 if (argc <= i)
171 for (; i < argc; i++) 183 scan_c_stream (stdin);
184 else
172 { 185 {
173 int j; 186 int first_infile = i;
174 /* Don't process one file twice. */ 187 for (; i < argc; i++)
175 for (j = first_infile; j < i; j++) 188 {
176 if (! strcmp (argv[i], argv[j])) 189 int j;
177 break; 190 /* Don't process one file twice. */
178 if (j == i) 191 for (j = first_infile; j < i; j++)
179 err_count += scan_file (argv[i]); 192 if (strcmp (argv[i], argv[j]) == 0)
193 break;
194 if (j == i)
195 err_count += scan_file (argv[i]);
196 }
180 } 197 }
181 198
182 if (err_count == 0 && generate_globals) 199 if (err_count == 0 && generate_globals)
@@ -528,13 +545,15 @@ write_c_args (char *func, char *buf, int minargs, int maxargs)
528} 545}
529 546
530/* The types of globals. These are sorted roughly in decreasing alignment 547/* The types of globals. These are sorted roughly in decreasing alignment
531 order to avoid allocation gaps, except that functions are last. */ 548 order to avoid allocation gaps, except that symbols and functions
549 are last. */
532enum global_type 550enum global_type
533{ 551{
534 INVALID, 552 INVALID,
535 LISP_OBJECT, 553 LISP_OBJECT,
536 EMACS_INTEGER, 554 EMACS_INTEGER,
537 BOOLEAN, 555 BOOLEAN,
556 SYMBOL,
538 FUNCTION 557 FUNCTION
539}; 558};
540 559
@@ -543,7 +562,11 @@ struct global
543{ 562{
544 enum global_type type; 563 enum global_type type;
545 char *name; 564 char *name;
546 int value; 565 union
566 {
567 int value;
568 char const *svalue;
569 } v;
547}; 570};
548 571
549/* All the variable names we saw while scanning C sources in `-g' 572/* All the variable names we saw while scanning C sources in `-g'
@@ -553,7 +576,7 @@ int num_globals_allocated;
553struct global *globals; 576struct global *globals;
554 577
555static void 578static void
556add_global (enum global_type type, char *name, int value) 579add_global (enum global_type type, char *name, int value, char const *svalue)
557{ 580{
558 /* Ignore the one non-symbol that can occur. */ 581 /* Ignore the one non-symbol that can occur. */
559 if (strcmp (name, "...")) 582 if (strcmp (name, "..."))
@@ -574,7 +597,10 @@ add_global (enum global_type type, char *name, int value)
574 597
575 globals[num_globals - 1].type = type; 598 globals[num_globals - 1].type = type;
576 globals[num_globals - 1].name = name; 599 globals[num_globals - 1].name = name;
577 globals[num_globals - 1].value = value; 600 if (svalue)
601 globals[num_globals - 1].v.svalue = svalue;
602 else
603 globals[num_globals - 1].v.value = value;
578 } 604 }
579} 605}
580 606
@@ -587,21 +613,58 @@ compare_globals (const void *a, const void *b)
587 if (ga->type != gb->type) 613 if (ga->type != gb->type)
588 return ga->type - gb->type; 614 return ga->type - gb->type;
589 615
616 /* Consider "nil" to be the least, so that aQnil is firat. That
617 way, Qnil's internal representation is zero, which is a bit faster. */
618 if (ga->type == SYMBOL)
619 {
620 bool a_nil = strcmp (ga->name, "Qnil") == 0;
621 bool b_nil = strcmp (gb->name, "Qnil") == 0;
622 if (a_nil | b_nil)
623 return b_nil - a_nil;
624 }
625
590 return strcmp (ga->name, gb->name); 626 return strcmp (ga->name, gb->name);
591} 627}
592 628
593static void 629static void
594close_emacs_globals (void) 630close_emacs_globals (int num_symbols)
595{ 631{
596 puts ("};"); 632 printf (("};\n"
597 puts ("extern struct emacs_globals globals;"); 633 "extern struct emacs_globals globals;\n"
634 "\n"
635 "#ifndef DEFINE_SYMBOLS\n"
636 "extern\n"
637 "#endif\n"
638 "struct Lisp_Symbol lispsym[%d];\n"),
639 num_symbols);
598} 640}
599 641
600static void 642static void
601write_globals (void) 643write_globals (void)
602{ 644{
603 int i, seen_defun = 0; 645 int i, j;
646 bool seen_defun = false;
647 int symnum = 0;
648 int num_symbols = 0;
604 qsort (globals, num_globals, sizeof (struct global), compare_globals); 649 qsort (globals, num_globals, sizeof (struct global), compare_globals);
650
651 j = 0;
652 for (i = 0; i < num_globals; i++)
653 {
654 while (i + 1 < num_globals
655 && strcmp (globals[i].name, globals[i + 1].name) == 0)
656 {
657 if (globals[i].type == FUNCTION
658 && globals[i].v.value != globals[i + 1].v.value)
659 error ("function '%s' defined twice with differing signatures",
660 globals[i].name);
661 i++;
662 }
663 num_symbols += globals[i].type == SYMBOL;
664 globals[j++] = globals[i];
665 }
666 num_globals = j;
667
605 for (i = 0; i < num_globals; ++i) 668 for (i = 0; i < num_globals; ++i)
606 { 669 {
607 char const *type = 0; 670 char const *type = 0;
@@ -617,12 +680,13 @@ write_globals (void)
617 case LISP_OBJECT: 680 case LISP_OBJECT:
618 type = "Lisp_Object"; 681 type = "Lisp_Object";
619 break; 682 break;
683 case SYMBOL:
620 case FUNCTION: 684 case FUNCTION:
621 if (!seen_defun) 685 if (!seen_defun)
622 { 686 {
623 close_emacs_globals (); 687 close_emacs_globals (num_symbols);
624 putchar ('\n'); 688 putchar ('\n');
625 seen_defun = 1; 689 seen_defun = true;
626 } 690 }
627 break; 691 break;
628 default: 692 default:
@@ -635,6 +699,13 @@ write_globals (void)
635 printf ("#define %s globals.f_%s\n", 699 printf ("#define %s globals.f_%s\n",
636 globals[i].name, globals[i].name); 700 globals[i].name, globals[i].name);
637 } 701 }
702 else if (globals[i].type == SYMBOL)
703 printf (("DEFINE_LISP_SYMBOL_BEGIN (%s)\n"
704 "#define a%s (&lispsym[%d])\n"
705 "#define %s make_lisp_symbol (a%s)\n"
706 "DEFINE_LISP_SYMBOL_END (a%s)\n\n"),
707 globals[i].name, globals[i].name, symnum++,
708 globals[i].name, globals[i].name, globals[i].name);
638 else 709 else
639 { 710 {
640 /* It would be nice to have a cleaner way to deal with these 711 /* It would be nice to have a cleaner way to deal with these
@@ -647,38 +718,65 @@ write_globals (void)
647 fputs ("_Noreturn ", stdout); 718 fputs ("_Noreturn ", stdout);
648 719
649 printf ("EXFUN (%s, ", globals[i].name); 720 printf ("EXFUN (%s, ", globals[i].name);
650 if (globals[i].value == -1) 721 if (globals[i].v.value == -1)
651 fputs ("MANY", stdout); 722 fputs ("MANY", stdout);
652 else if (globals[i].value == -2) 723 else if (globals[i].v.value == -2)
653 fputs ("UNEVALLED", stdout); 724 fputs ("UNEVALLED", stdout);
654 else 725 else
655 printf ("%d", globals[i].value); 726 printf ("%d", globals[i].v.value);
656 putchar (')'); 727 putchar (')');
657 728
658 /* It would be nice to have a cleaner way to deal with these 729 /* It would be nice to have a cleaner way to deal with these
659 special hacks, too. */ 730 special hacks, too. */
660 if (strcmp (globals[i].name, "Fbyteorder") == 0 731 if (strcmp (globals[i].name, "Fatom") == 0
661 || strcmp (globals[i].name, "Ftool_bar_height") == 0 732 || strcmp (globals[i].name, "Fbyteorder") == 0
733 || strcmp (globals[i].name, "Fcharacterp") == 0
734 || strcmp (globals[i].name, "Fchar_or_string_p") == 0
735 || strcmp (globals[i].name, "Fconsp") == 0
736 || strcmp (globals[i].name, "Feq") == 0
737 || strcmp (globals[i].name, "Fface_attribute_relative_p") == 0
738 || strcmp (globals[i].name, "Fframe_windows_min_size") == 0
739 || strcmp (globals[i].name, "Fgnutls_errorp") == 0
740 || strcmp (globals[i].name, "Fidentity") == 0
741 || strcmp (globals[i].name, "Fintegerp") == 0
742 || strcmp (globals[i].name, "Finteractive") == 0
743 || strcmp (globals[i].name, "Ffloatp") == 0
744 || strcmp (globals[i].name, "Flistp") == 0
662 || strcmp (globals[i].name, "Fmax_char") == 0 745 || strcmp (globals[i].name, "Fmax_char") == 0
663 || strcmp (globals[i].name, "Fidentity") == 0) 746 || strcmp (globals[i].name, "Fnatnump") == 0
747 || strcmp (globals[i].name, "Fnlistp") == 0
748 || strcmp (globals[i].name, "Fnull") == 0
749 || strcmp (globals[i].name, "Fnumberp") == 0
750 || strcmp (globals[i].name, "Fstringp") == 0
751 || strcmp (globals[i].name, "Fsymbolp") == 0
752 || strcmp (globals[i].name, "Ftool_bar_height") == 0
753 || strcmp (globals[i].name, "Fwindow__sanitize_window_sizes") == 0
754#ifndef WINDOWSNT
755 || strcmp (globals[i].name, "Fgnutls_available_p") == 0
756 || strcmp (globals[i].name, "Fzlib_available_p") == 0
757#endif
758 || 0)
664 fputs (" ATTRIBUTE_CONST", stdout); 759 fputs (" ATTRIBUTE_CONST", stdout);
665 760
666 puts (";"); 761 puts (";");
667 } 762 }
668
669 while (i + 1 < num_globals
670 && !strcmp (globals[i].name, globals[i + 1].name))
671 {
672 if (globals[i].type == FUNCTION
673 && globals[i].value != globals[i + 1].value)
674 error ("function '%s' defined twice with differing signatures",
675 globals[i].name);
676 ++i;
677 }
678 } 763 }
679 764
680 if (!seen_defun) 765 if (!seen_defun)
681 close_emacs_globals (); 766 close_emacs_globals (num_symbols);
767
768 puts ("#ifdef DEFINE_SYMBOLS");
769 puts ("static char const *const defsym_name[] = {");
770 for (int i = 0; i < num_globals; i++)
771 {
772 if (globals[i].type == SYMBOL)
773 printf ("\t\"%s\",\n", globals[i].v.svalue);
774 while (i + 1 < num_globals
775 && strcmp (globals[i].name, globals[i + 1].name) == 0)
776 i++;
777 }
778 puts ("};");
779 puts ("#endif");
682} 780}
683 781
684 782
@@ -691,9 +789,6 @@ static int
691scan_c_file (char *filename, const char *mode) 789scan_c_file (char *filename, const char *mode)
692{ 790{
693 FILE *infile; 791 FILE *infile;
694 register int c;
695 register int commas;
696 int minargs, maxargs;
697 int extension = filename[strlen (filename) - 1]; 792 int extension = filename[strlen (filename) - 1];
698 793
699 if (extension == 'o') 794 if (extension == 'o')
@@ -719,8 +814,15 @@ scan_c_file (char *filename, const char *mode)
719 814
720 /* Reset extension to be able to detect duplicate files. */ 815 /* Reset extension to be able to detect duplicate files. */
721 filename[strlen (filename) - 1] = extension; 816 filename[strlen (filename) - 1] = extension;
817 return scan_c_stream (infile);
818}
819
820static int
821scan_c_stream (FILE *infile)
822{
823 int commas, minargs, maxargs;
824 int c = '\n';
722 825
723 c = '\n';
724 while (!feof (infile)) 826 while (!feof (infile))
725 { 827 {
726 int doc_keyword = 0; 828 int doc_keyword = 0;
@@ -749,37 +851,53 @@ scan_c_file (char *filename, const char *mode)
749 if (c != 'F') 851 if (c != 'F')
750 continue; 852 continue;
751 c = getc (infile); 853 c = getc (infile);
752 if (c != 'V') 854 if (c == 'S')
753 continue;
754 c = getc (infile);
755 if (c != 'A')
756 continue;
757 c = getc (infile);
758 if (c != 'R')
759 continue;
760 c = getc (infile);
761 if (c != '_')
762 continue;
763
764 defvarflag = 1;
765
766 c = getc (infile);
767 defvarperbufferflag = (c == 'P');
768 if (generate_globals)
769 { 855 {
770 if (c == 'I') 856 c = getc (infile);
771 type = EMACS_INTEGER; 857 if (c != 'Y')
772 else if (c == 'L') 858 continue;
773 type = LISP_OBJECT; 859 c = getc (infile);
774 else if (c == 'B') 860 if (c != 'M')
775 type = BOOLEAN; 861 continue;
862 c = getc (infile);
863 if (c != ' ' && c != '\t' && c != '(')
864 continue;
865 type = SYMBOL;
776 } 866 }
867 else if (c == 'V')
868 {
869 c = getc (infile);
870 if (c != 'A')
871 continue;
872 c = getc (infile);
873 if (c != 'R')
874 continue;
875 c = getc (infile);
876 if (c != '_')
877 continue;
777 878
778 c = getc (infile); 879 defvarflag = 1;
779 /* We need to distinguish between DEFVAR_BOOL and 880
780 DEFVAR_BUFFER_DEFAULTS. */ 881 c = getc (infile);
781 if (generate_globals && type == BOOLEAN && c != 'O') 882 defvarperbufferflag = (c == 'P');
782 type = INVALID; 883 if (generate_globals)
884 {
885 if (c == 'I')
886 type = EMACS_INTEGER;
887 else if (c == 'L')
888 type = LISP_OBJECT;
889 else if (c == 'B')
890 type = BOOLEAN;
891 }
892
893 c = getc (infile);
894 /* We need to distinguish between DEFVAR_BOOL and
895 DEFVAR_BUFFER_DEFAULTS. */
896 if (generate_globals && type == BOOLEAN && c != 'O')
897 type = INVALID;
898 }
899 else
900 continue;
783 } 901 }
784 else if (c == 'D') 902 else if (c == 'D')
785 { 903 {
@@ -796,7 +914,7 @@ scan_c_file (char *filename, const char *mode)
796 914
797 if (generate_globals 915 if (generate_globals
798 && (!defvarflag || defvarperbufferflag || type == INVALID) 916 && (!defvarflag || defvarperbufferflag || type == INVALID)
799 && !defunflag) 917 && !defunflag && type != SYMBOL)
800 continue; 918 continue;
801 919
802 while (c != '(') 920 while (c != '(')
@@ -806,15 +924,19 @@ scan_c_file (char *filename, const char *mode)
806 c = getc (infile); 924 c = getc (infile);
807 } 925 }
808 926
809 /* Lisp variable or function name. */ 927 if (type != SYMBOL)
810 c = getc (infile); 928 {
811 if (c != '"') 929 /* Lisp variable or function name. */
812 continue; 930 c = getc (infile);
813 c = read_c_string_or_comment (infile, -1, 0, 0); 931 if (c != '"')
932 continue;
933 c = read_c_string_or_comment (infile, -1, 0, 0);
934 }
814 935
815 if (generate_globals) 936 if (generate_globals)
816 { 937 {
817 int i = 0; 938 int i = 0;
939 char const *svalue = 0;
818 940
819 /* Skip "," and whitespace. */ 941 /* Skip "," and whitespace. */
820 do 942 do
@@ -826,6 +948,8 @@ scan_c_file (char *filename, const char *mode)
826 /* Read in the identifier. */ 948 /* Read in the identifier. */
827 do 949 do
828 { 950 {
951 if (c < 0)
952 goto eof;
829 input_buffer[i++] = c; 953 input_buffer[i++] = c;
830 c = getc (infile); 954 c = getc (infile);
831 } 955 }
@@ -836,13 +960,27 @@ scan_c_file (char *filename, const char *mode)
836 name = xmalloc (i + 1); 960 name = xmalloc (i + 1);
837 memcpy (name, input_buffer, i + 1); 961 memcpy (name, input_buffer, i + 1);
838 962
963 if (type == SYMBOL)
964 {
965 do
966 c = getc (infile);
967 while (c == ' ' || c == '\t' || c == '\n' || c == '\r');
968 if (c != '"')
969 continue;
970 c = read_c_string_or_comment (infile, -1, 0, 0);
971 svalue = xstrdup (input_buffer);
972 }
973
839 if (!defunflag) 974 if (!defunflag)
840 { 975 {
841 add_global (type, name, 0); 976 add_global (type, name, 0, svalue);
842 continue; 977 continue;
843 } 978 }
844 } 979 }
845 980
981 if (type == SYMBOL)
982 continue;
983
846 /* DEFVAR_LISP ("name", addr, "doc") 984 /* DEFVAR_LISP ("name", addr, "doc")
847 DEFVAR_LISP ("name", addr /\* doc *\/) 985 DEFVAR_LISP ("name", addr /\* doc *\/)
848 DEFVAR_LISP ("name", addr, doc: /\* doc *\/) */ 986 DEFVAR_LISP ("name", addr, doc: /\* doc *\/) */
@@ -895,7 +1033,7 @@ scan_c_file (char *filename, const char *mode)
895 1033
896 if (generate_globals) 1034 if (generate_globals)
897 { 1035 {
898 add_global (FUNCTION, name, maxargs); 1036 add_global (FUNCTION, name, maxargs, 0);
899 continue; 1037 continue;
900 } 1038 }
901 1039
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in
index 773c89745e5..a81a011084f 100644
--- a/lib-src/makefile.w32-in
+++ b/lib-src/makefile.w32-in
@@ -1,5 +1,5 @@
1# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API. 1# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API.
2# Copyright (C) 2000-2014 Free Software Foundation, Inc. 2# Copyright (C) 2000-2015 Free Software Foundation, Inc.
3 3
4# This file is part of GNU Emacs. 4# This file is part of GNU Emacs.
5 5
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index b0196b309d8..5008c9b15f7 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -1,7 +1,7 @@
1/* movemail foo bar -- move file foo to file bar, 1/* movemail foo bar -- move file foo to file bar,
2 locking file foo the way /bin/mail respects. 2 locking file foo the way /bin/mail respects.
3 3
4Copyright (C) 1986, 1992-1994, 1996, 1999, 2001-2014 Free Software 4Copyright (C) 1986, 1992-1994, 1996, 1999, 2001-2015 Free Software
5Foundation, Inc. 5Foundation, Inc.
6 6
7This file is part of GNU Emacs. 7This file is part of GNU Emacs.
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index 23d7ba77b8e..7d9dff9904c 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -1,6 +1,6 @@
1/* Utility and Unix shadow routines for GNU Emacs support programs on NT. 1/* Utility and Unix shadow routines for GNU Emacs support programs on NT.
2 2
3Copyright (C) 1994, 2001-2014 Free Software Foundation, Inc. 3Copyright (C) 1994, 2001-2015 Free Software Foundation, Inc.
4 4
5Author: Geoff Voelker (voelker@cs.washington.edu) 5Author: Geoff Voelker (voelker@cs.washington.edu)
6Created: 10-8-94 6Created: 10-8-94
diff --git a/lib-src/ntlib.h b/lib-src/ntlib.h
index 40ef9fa982d..787a65d987f 100644
--- a/lib-src/ntlib.h
+++ b/lib-src/ntlib.h
@@ -1,5 +1,5 @@
1/* Utility and Unix shadow routines for GNU Emacs support programs on NT. 1/* Utility and Unix shadow routines for GNU Emacs support programs on NT.
2 Copyright (C) 1994, 2002-2014 Free Software Foundation, Inc. 2 Copyright (C) 1994, 2002-2015 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
diff --git a/lib-src/pop.c b/lib-src/pop.c
index 70011504a34..c6deaf73a2c 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -1,6 +1,6 @@
1/* pop.c: client routines for talking to a POP3-protocol post-office server 1/* pop.c: client routines for talking to a POP3-protocol post-office server
2 2
3Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2014 Free Software 3Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2015 Free Software
4Foundation, Inc. 4Foundation, Inc.
5 5
6Author: Jonathan Kamens <jik@security.ov.com> 6Author: Jonathan Kamens <jik@security.ov.com>
diff --git a/lib-src/pop.h b/lib-src/pop.h
index 51eaa8158af..cd8196939e2 100644
--- a/lib-src/pop.h
+++ b/lib-src/pop.h
@@ -1,5 +1,5 @@
1/* pop.h: Header file for the "pop.c" client POP3 protocol. 1/* pop.h: Header file for the "pop.c" client POP3 protocol.
2 Copyright (C) 1991, 1993, 2001-2014 Free Software Foundation, Inc. 2 Copyright (C) 1991, 1993, 2001-2015 Free Software Foundation, Inc.
3 3
4Author: Jonathan Kamens <jik@security.ov.com> 4Author: Jonathan Kamens <jik@security.ov.com>
5 5
diff --git a/lib-src/profile.c b/lib-src/profile.c
index e159a92e86d..ffaa2256567 100644
--- a/lib-src/profile.c
+++ b/lib-src/profile.c
@@ -1,5 +1,5 @@
1/* profile.c --- generate periodic events for profiling of Emacs Lisp code. 1/* profile.c --- generate periodic events for profiling of Emacs Lisp code.
2 Copyright (C) 1992, 1994, 1999, 2001-2014 Free Software Foundation, 2 Copyright (C) 1992, 1994, 1999, 2001-2015 Free Software Foundation,
3 Inc. 3 Inc.
4 4
5Author: Boaz Ben-Zvi <boaz@lcs.mit.edu> 5Author: Boaz Ben-Zvi <boaz@lcs.mit.edu>
diff --git a/lib-src/rcs2log b/lib-src/rcs2log
index 8dd9cdcf2bb..242760362e8 100755
--- a/lib-src/rcs2log
+++ b/lib-src/rcs2log
@@ -2,7 +2,7 @@
2 2
3# RCS to ChangeLog generator 3# RCS to ChangeLog generator
4 4
5# Copyright (C) 1992-1998, 2001-2014 Free Software Foundation, Inc. 5# Copyright (C) 1992-1998, 2001-2015 Free Software Foundation, Inc.
6 6
7# Author: Paul Eggert <eggert@twinsun.com> 7# Author: Paul Eggert <eggert@twinsun.com>
8 8
@@ -20,7 +20,7 @@
20# along with this program. If not, see <http://www.gnu.org/licenses/>. 20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21 21
22 22
23Copyright='Copyright (C) 2014 Free Software Foundation, Inc. 23Copyright='Copyright (C) 2015 Free Software Foundation, Inc.
24This program comes with NO WARRANTY, to the extent permitted by law. 24This program comes with NO WARRANTY, to the extent permitted by law.
25You may redistribute copies of this program 25You may redistribute copies of this program
26under the terms of the GNU General Public License. 26under the terms of the GNU General Public License.
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c
index b311001bd62..d3354af2783 100644
--- a/lib-src/update-game-score.c
+++ b/lib-src/update-game-score.c
@@ -1,6 +1,6 @@
1/* update-game-score.c --- Update a score file 1/* update-game-score.c --- Update a score file
2 2
3Copyright (C) 2002-2014 Free Software Foundation, Inc. 3Copyright (C) 2002-2015 Free Software Foundation, Inc.
4 4
5Author: Colin Walters <walters@debian.org> 5Author: Colin Walters <walters@debian.org>
6 6