[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnulib strftime imported into Emacs
From: |
Paul Eggert |
Subject: |
gnulib strftime imported into Emacs |
Date: |
Sun, 30 Jan 2011 15:43:04 -0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 |
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 <address@hidden>
+ 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 <address@hidden>
+
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 <address@hidden>
+
+ strftime: import from gnulib
+ * notes/copyright: strftime.c moved from src to lib.
+
2011-01-25 Glenn Morris <address@hidden>
* 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 <address@hidden>
+ 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 <strftime.h>, 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 <ctype.h>
+#include <strftime.h>
#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)
{