From 762b15be8c7925c661e839fa41d46189513dfda6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 24 Apr 2011 12:00:03 +0300 Subject: [PATCH] Fallout from resurrecting doprnt. src/doc.c (get_doc_string): Improve the format passed to `error'. src/doprnt.c (doprnt): Improve commentary. src/term.c (init_tty) [MSDOS]: Fix 1st argument to maybe_fatal. src/Makefile.in (TAGS): Depend on $(M_FILE) and $(S_FILE), and scan them with etags. src/makefile.w32-in (TAGS): Depend on $(CURDIR)/m/intel386.h and $(CURDIR)/s/ms-w32.h. (TAGS-gmake): Scan $(CURDIR)/m/intel386.h and $(CURDIR)/s/ms-w32.h. --- src/ChangeLog | 12 ++++++++++++ src/Makefile.in | 4 ++-- src/doc.c | 4 +++- src/doprnt.c | 33 +++++++++++++++++++++++++++++++-- src/makefile.w32-in | 4 ++-- src/term.c | 4 ++-- 6 files changed, 52 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 537acb712b9..478a5aa2512 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,19 @@ 2011-04-24 Eli Zaretskii + * doc.c (get_doc_string): Improve the format passed to `error'. + + * doprnt.c (doprnt): Improve commentary. + + * term.c (init_tty) [MSDOS]: Fix 1st argument to maybe_fatal. + + * Makefile.in (TAGS): Depend on $(M_FILE) and $(S_FILE), and scan + them with etags. + * makefile.w32-in (globals.h): Add a dummy recipe, to make any changes in globals.h immediately force recompilation. + (TAGS): Depend on $(CURDIR)/m/intel386.h and + $(CURDIR)/s/ms-w32.h. + (TAGS-gmake): Scan $(CURDIR)/m/intel386.h and $(CURDIR)/s/ms-w32.h. * character.c (Fchar_direction): Function deleted. (syms_of_character): Don't defsubr it. diff --git a/src/Makefile.in b/src/Makefile.in index e1195968f7f..8b596430cf5 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -748,10 +748,10 @@ extraclean: distclean ctagsfiles1 = [xyzXYZ]*.[hcm] ctagsfiles2 = [a-wA-W]*.[hcm] -TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) +TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(M_FILE) $(S_FILE) ../lib-src/etags --include=TAGS-LISP --include=$(lwlibdir)/TAGS \ --regex='/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \ - $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) + $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(M_FILE) $(S_FILE) frc: TAGS-LISP: frc $(MAKE) -f $(lispdir)/Makefile TAGS-LISP ETAGS=../lib-src/etags diff --git a/src/doc.c b/src/doc.c index 354aff84979..4b75deaba5c 100644 --- a/src/doc.c +++ b/src/doc.c @@ -253,7 +253,9 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition) else if (c == '_') *to++ = 037; else - error ("Invalid data in documentation file -- ^A followed by code 0%o", c); + error ("\ +Invalid data in documentation file -- %c followed by code %03o", + 1, (unsigned)c); } else *to++ = *from++; diff --git a/src/doprnt.c b/src/doprnt.c index f182529b801..f124db13221 100644 --- a/src/doprnt.c +++ b/src/doprnt.c @@ -1,6 +1,6 @@ /* Output like sprintf to a buffer of specified size. - Also takes args differently: pass one pointer to an array of strings - in addition to the format string which is separate. + Also takes args differently: pass one pointer to the end + of the format string in addition to the format string itself. Copyright (C) 1985, 2001-2011 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -18,6 +18,35 @@ 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 . */ +/* If you think about replacing this with some similar standard C function of + the printf family (such as vsnprintf), please note that this function + supports the following Emacs-specific features: + + . For %c conversions, it produces a string with the multibyte representation + of the (`int') argument, suitable for display in an Emacs buffer. + + . For %s and %c, when field width is specified (e.g., %25s), it accounts for + the diplay width of each character, according to char-width-table. That + is, it does not assume that each character takes one column on display. + + . If the size of the buffer is not enough to produce the formatted string in + its entirety, it makes sure that truncation does not chop the last + character in the middle of its multibyte sequence, producing an invalid + sequence. + + . It accepts a pointer to the end of the format string, so the format string + could include embedded null characters. + + . It signals an error if the length of the formatted string is about to + overflow MOST_POSITIVE_FIXNUM, to avoid producing strings longer than what + Emacs can handle. + + OTOH, this function supports only a small subset of the standard C formatted + output facilities. E.g., %u and %ll are not supported, and precision is + largely ignored except for converting floating-point values. However, this + is okay, as this function is supposed to be called from `error' and similar + functions, and thus does not need to support features beyond those in + `Fformat', which is used by `error' on the Lisp level. */ #include #include diff --git a/src/makefile.w32-in b/src/makefile.w32-in index eebc4006bc3..0dd06b7efc3 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -330,7 +330,7 @@ cleanall: clean ## ## This works only with GNU Make. -TAGS: $(OBJ0) $(OBJ1) $(OBJ2) +TAGS: $(OBJ0) $(OBJ1) $(OBJ2) $(CURDIR)/m/intel386.h $(CURDIR)/s/ms-w32.h $(MAKE) $(MFLAGS) TAGS-$(MAKETYPE) TAGS-LISP: $(OBJ0) $(OBJ1) $(OBJ2) @@ -344,7 +344,7 @@ TAGS-gmake: $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ1)) ../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \ $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ2)) \ - $(CURDIR)/*.h + $(CURDIR)/*.h $(CURDIR)/m/intel386.h $(CURDIR)/s/ms-w32.h TAGS-nmake: echo This target is not supported with NMake diff --git a/src/term.c b/src/term.c index cae83f4d269..28709138a17 100644 --- a/src/term.c +++ b/src/term.c @@ -3121,7 +3121,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) terminal = create_terminal (); #ifdef MSDOS if (been_here > 0) - maybe_fatal (1, 0, "Attempt to create another terminal %s", "", + maybe_fatal (0, 0, "Attempt to create another terminal %s", "", name, ""); been_here = 1; tty = &the_only_display_info; @@ -3627,7 +3627,7 @@ vfatal (const char *str, va_list ap) /* Auxiliary error-handling function for init_tty. Delete TERMINAL, then call error or fatal with str1 or str2, - respectively, according to MUST_SUCCEED. */ + respectively, according to whether MUST_SUCCEED is zero or not. */ static void maybe_fatal (int must_succeed, struct terminal *terminal, -- 2.11.4.GIT