From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: gnulib strftime imported into Emacs Date: Sun, 30 Jan 2011 15:43:04 -0800 Organization: UCLA Computer Science Department Message-ID: <4D45F788.1020101@cs.ucla.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1296431006 23551 80.91.229.12 (30 Jan 2011 23:43:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 30 Jan 2011 23:43:26 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 31 00:43:22 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PjgvR-000087-CX for ged-emacs-devel@m.gmane.org; Mon, 31 Jan 2011 00:43:21 +0100 Original-Received: from localhost ([127.0.0.1]:46076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PjgvQ-0000pe-So for ged-emacs-devel@m.gmane.org; Sun, 30 Jan 2011 18:43:20 -0500 Original-Received: from [140.186.70.92] (port=38295 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PjgvL-0000pM-KB for emacs-devel@gnu.org; Sun, 30 Jan 2011 18:43:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PjgvJ-0005hv-SF for emacs-devel@gnu.org; Sun, 30 Jan 2011 18:43:15 -0500 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:54970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PjgvJ-0005hj-Ac for emacs-devel@gnu.org; Sun, 30 Jan 2011 18:43:13 -0500 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 2A44539E80F0 for ; Sun, 30 Jan 2011 15:43:11 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UOeECtMgFZkg for ; Sun, 30 Jan 2011 15:43:09 -0800 (PST) Original-Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id B341339E80DC for ; Sun, 30 Jan 2011 15:43:09 -0800 (PST) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:135261 Archived-At: OK, since the Windows build works with the other gnulib modules, it's time to try the next one on the list, namely strftime. I committed to the trunk the following, which migrates Emacs to use an up-to-date strftime. This will let us add support for higher-resolution time stamps in format-time-string, among other things. In the patch quoted below, I omit the automatically generated files. For Windows I expect that HAVE_STDBOOL_H and HAVE__BOOL should be 1 in config.h. You no longer need to worry about HAVE_STRFTIME. Also, the build procedure needs to be modified to take into account the fact that strftime.c is now in lib, not in src. I don't see any major problems here, but I'm not a Windows expert. === modified file 'ChangeLog' --- ChangeLog 2011-01-30 19:22:02 +0000 +++ ChangeLog 2011-01-30 23:29:33 +0000 @@ -1,5 +1,21 @@ 2011-01-30 Paul Eggert + strftime: import from gnulib + * Makefile.in (GNULIB_MODULES): Add strftime. + * configure.in (AC_FUNC_STRFTIME, my_strftime): Remove; no longer + needed. + * aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4: + Regenerate. + * lib/strftime.c, lib/strftime.h, lib/stdbool.in.h: New files, + imported from gnulib. + * m4/strftime.m4, m4/stdbool.m4, m4/tm_gmtoff.m4: Likewise. + This incorporates many changes from gnulib, including simpler + handling of multibyte formats, porting to mingw32 and other + platforms, and support for higher-resolution time stamps. + Emacs does not yet use the higher-resolution interface. + +2011-01-30 Paul Eggert + gnulib: import mktime and move-if-change fixes from gnulib * configure: Regenerate from the following. === modified file 'Makefile.in' --- Makefile.in 2011-01-28 00:25:24 +0000 +++ Makefile.in 2011-01-30 22:41:19 +0000 @@ -330,7 +330,7 @@ # Update modules from gnulib, for maintainers, who should have it in # $(gnulib_srcdir) (relative to $(srcdir) and should have build tools # as per $(gnulib_srcdir)/DEPENDENCIES. -GNULIB_MODULES = dtoastr getopt-gnu mktime +GNULIB_MODULES = dtoastr getopt-gnu mktime strftime GNULIB_TOOL_FLAGS = \ --import --no-changelog --no-vc-files --makefile-name=gnulib.mk sync-from-gnulib: $(gnulib_srcdir) === modified file 'admin/ChangeLog' --- admin/ChangeLog 2011-01-25 05:10:02 +0000 +++ admin/ChangeLog 2011-01-30 23:29:52 +0000 @@ -1,3 +1,8 @@ +2011-01-30 Paul Eggert + + strftime: import from gnulib + * notes/copyright: strftime.c moved from src to lib. + 2011-01-25 Glenn Morris * bzrmerge.el (bzrmerge-skip-regexp): New variable. === modified file 'admin/notes/copyright' --- admin/notes/copyright 2011-01-25 04:08:28 +0000 +++ admin/notes/copyright 2011-01-30 22:41:19 +0000 @@ -635,7 +635,6 @@ src/gmalloc.c src/md5.c src/md5.h - src/strftime.c src/termcap.c src/tparam.c === modified file 'configure.in' --- configure.in 2011-01-25 04:08:28 +0000 +++ configure.in 2011-01-30 22:41:19 +0000 @@ -517,7 +517,7 @@ machine=hp800 opsys=hpux11 ## FIXME. Peter O'Gorman reports that dumping using unexelf.o doesn't ## work either: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6811 - CANNOT_DUMP=yes + CANNOT_DUMP=yes ;; hppa*-*-linux-gnu* ) @@ -2675,8 +2675,6 @@ gl_ASSERT_NO_GNULIB_TESTS gl_INIT -AC_FUNC_STRFTIME - # UNIX98 PTYs. AC_CHECK_FUNCS(grantpt) @@ -3528,8 +3526,6 @@ #endif #endif -#define my_strftime nstrftime /* for strftime.c */ - /* These default definitions are good for almost all machines. The exceptions override them in m/MACHINE.h. */ === modified file 'src/ChangeLog' --- src/ChangeLog 2011-01-30 22:22:58 +0000 +++ src/ChangeLog 2011-01-30 22:58:16 +0000 @@ -1,5 +1,15 @@ 2011-01-30 Paul Eggert + strftime: import from gnulib + * Makefile.in (obj): Remove strftime.o, as gnulib now does this for us. + * deps.mk (strftime.o): Remove. + * editfns.c: Include , supplied by gnulib. + (emacs_strftimeu): Remove decl. + (emacs_memftimeu): Use nstrftime (the gnulib name) rather than + emacs_strftimeu. + * config.in: Regenerate. + * strftime.c: Remove; we now use strftime from gnulib. + Use SSDATA when the context wants char *. * alloc.c, buffer.c, bytecode.c, callproc.c, dired.c: * dispnew.c, doc.c, editfns.c, emacs.c, fileio.c, filelock.c: === modified file 'src/Makefile.in' --- src/Makefile.in 2011-01-25 04:08:28 +0000 +++ src/Makefile.in 2011-01-30 22:41:20 +0000 @@ -353,7 +353,7 @@ syntax.o $(UNEXEC_OBJ) bytecode.o \ process.o gnutls.o callproc.o \ region-cache.o sound.o atimer.o \ - doprnt.o strftime.o intervals.o textprop.o composite.o md5.o xml.o \ + doprnt.o intervals.o textprop.o composite.o md5.o xml.o \ $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) ## Object files used on some machine or other. === modified file 'src/deps.mk' --- src/deps.mk 2011-01-25 04:08:28 +0000 +++ src/deps.mk 2011-01-30 22:41:20 +0000 @@ -168,7 +168,6 @@ $(INTERVALS_H) \ lisp.h $(config_h) sound.o: sound.c dispextern.h syssignal.h lisp.h $(config_h) atimer.h systime.h -strftime.o: strftime.c $(config_h) syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \ keymap.h regex.h $(INTERVALS_H) lisp.h $(config_h) sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \ === modified file 'src/editfns.c' --- src/editfns.c 2011-01-30 22:17:44 +0000 +++ src/editfns.c 2011-01-30 22:48:52 +0000 @@ -45,6 +45,7 @@ #endif #include +#include #include "intervals.h" #include "buffer.h" @@ -82,9 +83,6 @@ (1000 - TM_YEAR_BASE <= (tm_year) && (tm_year) <= 9999 - TM_YEAR_BASE) #endif -extern size_t emacs_strftimeu (char *, size_t, const char *, - const struct tm *, int); - #ifdef WINDOWSNT extern Lisp_Object w32_get_internal_run_time (void); #endif @@ -1556,8 +1554,8 @@ determine how many bytes would be written, use NULL for S and ((size_t) -1) for MAXSIZE. - This function behaves like emacs_strftimeu, except it allows null - bytes in FORMAT. */ + This function behaves like nstrftime, except it allows null + bytes in FORMAT and it does not support nanoseconds. */ static size_t emacs_memftimeu (char *s, size_t maxsize, const char *format, size_t format_len, const struct tm *tp, int ut) { @@ -1566,7 +1564,7 @@ /* Loop through all the null-terminated strings in the format argument. Normally there's just one null-terminated string, but there can be arbitrarily many, concatenated together, if the - format contains '\0' bytes. emacs_strftimeu stops at the first + format contains '\0' bytes. nstrftime stops at the first '\0' byte so we must invoke it separately for each such string. */ for (;;) { @@ -1576,7 +1574,7 @@ if (s) s[0] = '\1'; - result = emacs_strftimeu (s, maxsize, format, tp, ut); + result = nstrftime (s, maxsize, format, tp, ut, 0); if (s) {