diff options
63 files changed, 1064 insertions, 1891 deletions
diff --git a/ChangeLog b/ChangeLog index 86aa8222f10..fb223292cfc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-05-17 Paul Eggert <eggert@cs.ucla.edu> + + * lib/gnulib.mk: + * lib/intprops.h: + * lib/unistd.in.h: + * m4/inttypes.m4: + * m4/stdint.m4: + * m4/unistd_h.m4: Sync from gnulib. + 2011-05-14 Glenn Morris <rgm@gnu.org> * configure.in: Treat failure to find an X toolkit the same way we treat @@ -705,8 +705,8 @@ directory of the Emacs distribution. in `./lib-src' to their final destinations, as selected in `./src/epaths.h'. Strictly speaking, not all of the executables in `./lib-src' need be copied. -- The programs `fakemail', `hexl', `movemail', `profile', `rcs2log', - and `vcdiff' are used by Emacs; they do need to be copied. +- The programs `hexl', `movemail', `profile', `rcs2log', and `vcdiff' + are used by Emacs; they do need to be copied. - The programs `etags', `ctags', `emacsclient', and `rcs-checkin' are intended to be run by users; they are handled below. - The programs `make-docfile' and `test-distrib' were diff --git a/autogen/Makefile.in b/autogen/Makefile.in index 16b2aeb92a0..b8b06d5ffd5 100644 --- a/autogen/Makefile.in +++ b/autogen/Makefile.in @@ -48,7 +48,6 @@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/gnulib.mk COPYING @gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36_TRUE@am__append_1 = gettext.h -@gl_GNULIB_ENABLED_verify_TRUE@am__append_2 = verify.h subdir = lib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ @@ -83,10 +82,10 @@ ARFLAGS = cru libgnu_a_AR = $(AR) $(ARFLAGS) am__DEPENDENCIES_1 = am__libgnu_a_SOURCES_DIST = allocator.c careadlinkat.c dtoastr.c \ - gettext.h ignore-value.h verify.h + gettext.h am__objects_1 = am_libgnu_a_OBJECTS = allocator.$(OBJEXT) careadlinkat.$(OBJEXT) \ - dtoastr.$(OBJEXT) $(am__objects_1) $(am__objects_1) + dtoastr.$(OBJEXT) $(am__objects_1) libgnu_a_OBJECTS = $(am_libgnu_a_OBJECTS) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -208,6 +207,7 @@ GNULIB_GETS = @GNULIB_GETS@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ GNULIB_GRANTPT = @GNULIB_GRANTPT@ +GNULIB_GROUP_MEMBER = @GNULIB_GROUP_MEMBER@ GNULIB_IMAXABS = @GNULIB_IMAXABS@ GNULIB_IMAXDIV = @GNULIB_IMAXDIV@ GNULIB_LCHMOD = @GNULIB_LCHMOD@ @@ -354,6 +354,7 @@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_GRANTPT = @HAVE_GRANTPT@ +HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_LCHMOD = @HAVE_LCHMOD@ HAVE_LCHOWN = @HAVE_LCHOWN@ @@ -737,13 +738,13 @@ BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) inttypes.h \ EXTRA_DIST = allocator.h $(top_srcdir)/./arg-nonnull.h \ $(top_srcdir)/./c++defs.h careadlinkat.h md5.c md5.h dosname.h \ ftoastr.c ftoastr.h filemode.c filemode.h getloadavg.c \ - getopt.c getopt.in.h getopt1.c getopt_int.h intprops.h \ - inttypes.in.h lstat.c mktime-internal.h mktime.c readlink.c \ - stat.c stdarg.in.h stdbool.in.h stddef.in.h stdint.in.h \ - stdio.in.h stdlib.in.h strftime.c strftime.h strtol.c \ - strtoul.c strtoull.c strtoimax.c strtoumax.c symlink.c \ - sys_stat.in.h time.in.h time_r.c unistd.in.h \ - $(top_srcdir)/./warn-on-use.h + getopt.c getopt.in.h getopt1.c getopt_int.h ignore-value.h \ + intprops.h inttypes.in.h lstat.c mktime-internal.h mktime.c \ + readlink.c stat.c stdarg.in.h stdbool.in.h stddef.in.h \ + stdint.in.h stdio.in.h stdlib.in.h strftime.c strftime.h \ + strtol.c strtoul.c strtoull.c strtoimax.c strtoumax.c \ + symlink.c sys_stat.in.h time.in.h time_r.c unistd.in.h \ + verify.h $(top_srcdir)/./warn-on-use.h MOSTLYCLEANDIRS = sys MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ c++defs.h c++defs.h-t getopt.h getopt.h-t inttypes.h \ @@ -754,7 +755,7 @@ MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ noinst_LIBRARIES = libgnu.a DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src libgnu_a_SOURCES = allocator.c careadlinkat.c dtoastr.c \ - $(am__append_1) ignore-value.h $(am__append_2) + $(am__append_1) libgnu_a_LIBADD = $(gl_LIBOBJS) libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) EXTRA_libgnu_a_SOURCES = md5.c ftoastr.c filemode.c getloadavg.c \ @@ -1499,6 +1500,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ + -e 's|@''GNULIB_GROUP_MEMBER''@|$(GNULIB_GROUP_MEMBER)|g' \ -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \ -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \ @@ -1537,6 +1539,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ + -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ diff --git a/autogen/configure b/autogen/configure index e4edf2851ae..b3051c9558e 100755 --- a/autogen/configure +++ b/autogen/configure @@ -947,6 +947,7 @@ HAVE_PIPE HAVE_LINKAT HAVE_LINK HAVE_LCHOWN +HAVE_GROUP_MEMBER HAVE_GETPAGESIZE HAVE_GETLOGIN HAVE_GETHOSTNAME @@ -984,6 +985,7 @@ GNULIB_LSEEK GNULIB_LINKAT GNULIB_LINK GNULIB_LCHOWN +GNULIB_GROUP_MEMBER GNULIB_GETUSERSHELL GNULIB_GETPAGESIZE GNULIB_GETLOGIN_R @@ -14390,6 +14392,7 @@ _ACEOF GNULIB_GETLOGIN_R=0; GNULIB_GETPAGESIZE=0; GNULIB_GETUSERSHELL=0; + GNULIB_GROUP_MEMBER=0; GNULIB_LCHOWN=0; GNULIB_LINK=0; GNULIB_LINKAT=0; @@ -14427,6 +14430,7 @@ _ACEOF HAVE_GETHOSTNAME=1; HAVE_GETLOGIN=1; HAVE_GETPAGESIZE=1; + HAVE_GROUP_MEMBER=1; HAVE_LCHOWN=1; HAVE_LINK=1; HAVE_LINKAT=1; @@ -15923,6 +15927,81 @@ fi UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_inttypes_h='<'inttypes.h'>' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <inttypes.h>" >&5 +$as_echo_n "checking absolute name of <inttypes.h>... " >&6; } +if test "${gl_cv_next_inttypes_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_inttypes_h = yes; then + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <inttypes.h> + +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_inttypes_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/inttypes.h#{ + s#.*"\(.*/inttypes.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_inttypes_h='<'inttypes.h'>' + fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_inttypes_h" >&5 +$as_echo "$gl_cv_next_inttypes_h" >&6; } + fi + NEXT_INTTYPES_H=$gl_cv_next_inttypes_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'inttypes.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_inttypes_h + fi + NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H=$gl_next_as_first_directive + + + + + + + + +$as_echo "#define GL_TRIGGER_STDC_LIMIT_MACROS 1" >>confdefs.h + + + + + + GNULIB_FCHMODAT=0; GNULIB_FSTATAT=0; GNULIB_FUTIMENS=0; @@ -17214,80 +17293,6 @@ fi - - - - - - - - - - - if test $gl_cv_have_include_next = yes; then - gl_cv_next_inttypes_h='<'inttypes.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <inttypes.h>" >&5 -$as_echo_n "checking absolute name of <inttypes.h>... " >&6; } -if test "${gl_cv_next_inttypes_h+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - if test $ac_cv_header_inttypes_h = yes; then - - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <inttypes.h> - -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_inttypes_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/inttypes.h#{ - s#.*"\(.*/inttypes.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_inttypes_h='<'inttypes.h'>' - fi - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_inttypes_h" >&5 -$as_echo "$gl_cv_next_inttypes_h" >&6; } - fi - NEXT_INTTYPES_H=$gl_cv_next_inttypes_h - - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'inttypes.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_inttypes_h - fi - NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H=$gl_next_as_first_directive - - - - - - - - -$as_echo "#define GL_TRIGGER_STDC_LIMIT_MACROS 1" >>confdefs.h - - - - - - - - if test $ac_cv_func_lstat = yes; then if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then @@ -18076,717 +18081,6 @@ $as_echo "$gl_cv_next_stddef_h" >&6; } - if test $ac_cv_type_long_long_int = yes; then - HAVE_LONG_LONG_INT=1 - else - HAVE_LONG_LONG_INT=0 - fi - - - if test $ac_cv_type_unsigned_long_long_int = yes; then - HAVE_UNSIGNED_LONG_LONG_INT=1 - else - HAVE_UNSIGNED_LONG_LONG_INT=0 - fi - - - - if test $ac_cv_header_wchar_h = yes; then - HAVE_WCHAR_H=1 - else - HAVE_WCHAR_H=0 - fi - - - if test $ac_cv_header_inttypes_h = yes; then - HAVE_INTTYPES_H=1 - else - HAVE_INTTYPES_H=0 - fi - - - if test $ac_cv_header_sys_types_h = yes; then - HAVE_SYS_TYPES_H=1 - else - HAVE_SYS_TYPES_H=0 - fi - - - - - - - - - - - - if test $gl_cv_have_include_next = yes; then - gl_cv_next_stdint_h='<'stdint.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <stdint.h>" >&5 -$as_echo_n "checking absolute name of <stdint.h>... " >&6; } -if test "${gl_cv_next_stdint_h+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - if test $ac_cv_header_stdint_h = yes; then - - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdint.h> - -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - gl_cv_next_stdint_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/stdint.h#{ - s#.*"\(.*/stdint.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_stdint_h='<'stdint.h'>' - fi - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdint_h" >&5 -$as_echo "$gl_cv_next_stdint_h" >&6; } - fi - NEXT_STDINT_H=$gl_cv_next_stdint_h - - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'stdint.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_stdint_h - fi - NEXT_AS_FIRST_DIRECTIVE_STDINT_H=$gl_next_as_first_directive - - - - - if test $ac_cv_header_stdint_h = yes; then - HAVE_STDINT_H=1 - else - HAVE_STDINT_H=0 - fi - - - if test $ac_cv_header_stdint_h = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h conforms to C99" >&5 -$as_echo_n "checking whether stdint.h conforms to C99... " >&6; } -if test "${gl_cv_header_working_stdint_h+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - gl_cv_header_working_stdint_h=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ -#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ -#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ -#include <stdint.h> -/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ -#if !(defined WCHAR_MIN && defined WCHAR_MAX) -#error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>" -#endif - - - /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ - #include <stddef.h> - #include <signal.h> - #if HAVE_WCHAR_H - # include <stdio.h> - # include <time.h> - # include <wchar.h> - #endif - - -#ifdef INT8_MAX -int8_t a1 = INT8_MAX; -int8_t a1min = INT8_MIN; -#endif -#ifdef INT16_MAX -int16_t a2 = INT16_MAX; -int16_t a2min = INT16_MIN; -#endif -#ifdef INT32_MAX -int32_t a3 = INT32_MAX; -int32_t a3min = INT32_MIN; -#endif -#ifdef INT64_MAX -int64_t a4 = INT64_MAX; -int64_t a4min = INT64_MIN; -#endif -#ifdef UINT8_MAX -uint8_t b1 = UINT8_MAX; -#else -typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; -#endif -#ifdef UINT16_MAX -uint16_t b2 = UINT16_MAX; -#endif -#ifdef UINT32_MAX -uint32_t b3 = UINT32_MAX; -#endif -#ifdef UINT64_MAX -uint64_t b4 = UINT64_MAX; -#endif -int_least8_t c1 = INT8_C (0x7f); -int_least8_t c1max = INT_LEAST8_MAX; -int_least8_t c1min = INT_LEAST8_MIN; -int_least16_t c2 = INT16_C (0x7fff); -int_least16_t c2max = INT_LEAST16_MAX; -int_least16_t c2min = INT_LEAST16_MIN; -int_least32_t c3 = INT32_C (0x7fffffff); -int_least32_t c3max = INT_LEAST32_MAX; -int_least32_t c3min = INT_LEAST32_MIN; -int_least64_t c4 = INT64_C (0x7fffffffffffffff); -int_least64_t c4max = INT_LEAST64_MAX; -int_least64_t c4min = INT_LEAST64_MIN; -uint_least8_t d1 = UINT8_C (0xff); -uint_least8_t d1max = UINT_LEAST8_MAX; -uint_least16_t d2 = UINT16_C (0xffff); -uint_least16_t d2max = UINT_LEAST16_MAX; -uint_least32_t d3 = UINT32_C (0xffffffff); -uint_least32_t d3max = UINT_LEAST32_MAX; -uint_least64_t d4 = UINT64_C (0xffffffffffffffff); -uint_least64_t d4max = UINT_LEAST64_MAX; -int_fast8_t e1 = INT_FAST8_MAX; -int_fast8_t e1min = INT_FAST8_MIN; -int_fast16_t e2 = INT_FAST16_MAX; -int_fast16_t e2min = INT_FAST16_MIN; -int_fast32_t e3 = INT_FAST32_MAX; -int_fast32_t e3min = INT_FAST32_MIN; -int_fast64_t e4 = INT_FAST64_MAX; -int_fast64_t e4min = INT_FAST64_MIN; -uint_fast8_t f1 = UINT_FAST8_MAX; -uint_fast16_t f2 = UINT_FAST16_MAX; -uint_fast32_t f3 = UINT_FAST32_MAX; -uint_fast64_t f4 = UINT_FAST64_MAX; -#ifdef INTPTR_MAX -intptr_t g = INTPTR_MAX; -intptr_t gmin = INTPTR_MIN; -#endif -#ifdef UINTPTR_MAX -uintptr_t h = UINTPTR_MAX; -#endif -intmax_t i = INTMAX_MAX; -uintmax_t j = UINTMAX_MAX; - -#include <limits.h> /* for CHAR_BIT */ -#define TYPE_MINIMUM(t) \ - ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) -#define TYPE_MAXIMUM(t) \ - ((t) ((t) 0 < (t) -1 \ - ? (t) -1 \ - : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) -struct s { - int check_PTRDIFF: - PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) - && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) - ? 1 : -1; - /* Detect bug in FreeBSD 6.0 / ia64. */ - int check_SIG_ATOMIC: - SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) - && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) - ? 1 : -1; - int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; - int check_WCHAR: - WCHAR_MIN == TYPE_MINIMUM (wchar_t) - && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) - ? 1 : -1; - /* Detect bug in mingw. */ - int check_WINT: - WINT_MIN == TYPE_MINIMUM (wint_t) - && WINT_MAX == TYPE_MAXIMUM (wint_t) - ? 1 : -1; - - /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ - int check_UINT8_C: - (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; - int check_UINT16_C: - (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; - - /* Detect bugs in OpenBSD 3.9 stdint.h. */ -#ifdef UINT8_MAX - int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; -#endif -#ifdef UINT16_MAX - int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; -#endif -#ifdef UINT32_MAX - int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; -#endif -#ifdef UINT64_MAX - int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; -#endif - int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; - int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; - int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; - int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; - int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; - int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; - int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; - int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; - int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; - int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; - int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; -}; - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if test "$cross_compiling" = yes; then : - gl_cv_header_working_stdint_h=yes - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ -#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ -#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ -#include <stdint.h> - - - /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ - #include <stddef.h> - #include <signal.h> - #if HAVE_WCHAR_H - # include <stdio.h> - # include <time.h> - # include <wchar.h> - #endif - - -#include <stdio.h> -#include <string.h> -#define MVAL(macro) MVAL1(macro) -#define MVAL1(expression) #expression -static const char *macro_values[] = - { -#ifdef INT8_MAX - MVAL (INT8_MAX), -#endif -#ifdef INT16_MAX - MVAL (INT16_MAX), -#endif -#ifdef INT32_MAX - MVAL (INT32_MAX), -#endif -#ifdef INT64_MAX - MVAL (INT64_MAX), -#endif -#ifdef UINT8_MAX - MVAL (UINT8_MAX), -#endif -#ifdef UINT16_MAX - MVAL (UINT16_MAX), -#endif -#ifdef UINT32_MAX - MVAL (UINT32_MAX), -#endif -#ifdef UINT64_MAX - MVAL (UINT64_MAX), -#endif - NULL - }; - -int -main () -{ - - const char **mv; - for (mv = macro_values; *mv != NULL; mv++) - { - const char *value = *mv; - /* Test whether it looks like a cast expression. */ - if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 - || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 - || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 - || strncmp (value, "((int)"/*)*/, 6) == 0 - || strncmp (value, "((signed short)"/*)*/, 15) == 0 - || strncmp (value, "((signed char)"/*)*/, 14) == 0) - return mv - macro_values + 1; - } - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_header_working_stdint_h=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_stdint_h" >&5 -$as_echo "$gl_cv_header_working_stdint_h" >&6; } - fi - if test "$gl_cv_header_working_stdint_h" = yes; then - STDINT_H= - else - for ac_header in sys/inttypes.h sys/bitypes.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - if test $ac_cv_header_sys_inttypes_h = yes; then - HAVE_SYS_INTTYPES_H=1 - else - HAVE_SYS_INTTYPES_H=0 - fi - - if test $ac_cv_header_sys_bitypes_h = yes; then - HAVE_SYS_BITYPES_H=1 - else - HAVE_SYS_BITYPES_H=0 - fi - - - - - if test $APPLE_UNIVERSAL_BUILD = 0; then - - - for gltype in ptrdiff_t size_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 -$as_echo_n "checking for bit size of $gltype... " >&6; } -if { as_var=gl_cv_bitsizeof_${gltype}; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " - /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ - #include <stddef.h> - #include <signal.h> - #if HAVE_WCHAR_H - # include <stdio.h> - # include <time.h> - # include <wchar.h> - #endif - -#include <limits.h>"; then : - -else - result=unknown -fi - - eval gl_cv_bitsizeof_${gltype}=\$result - -fi -eval ac_res=\$gl_cv_bitsizeof_${gltype} - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval result=\$gl_cv_bitsizeof_${gltype} - if test $result = unknown; then - result=0 - fi - GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - cat >>confdefs.h <<_ACEOF -#define BITSIZEOF_${GLTYPE} $result -_ACEOF - - eval BITSIZEOF_${GLTYPE}=\$result - done - - - fi - - - for gltype in sig_atomic_t wchar_t wint_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 -$as_echo_n "checking for bit size of $gltype... " >&6; } -if { as_var=gl_cv_bitsizeof_${gltype}; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " - /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ - #include <stddef.h> - #include <signal.h> - #if HAVE_WCHAR_H - # include <stdio.h> - # include <time.h> - # include <wchar.h> - #endif - -#include <limits.h>"; then : - -else - result=unknown -fi - - eval gl_cv_bitsizeof_${gltype}=\$result - -fi -eval ac_res=\$gl_cv_bitsizeof_${gltype} - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval result=\$gl_cv_bitsizeof_${gltype} - if test $result = unknown; then - result=0 - fi - GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - cat >>confdefs.h <<_ACEOF -#define BITSIZEOF_${GLTYPE} $result -_ACEOF - - eval BITSIZEOF_${GLTYPE}=\$result - done - - - - - for gltype in sig_atomic_t wchar_t wint_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gltype is signed" >&5 -$as_echo_n "checking whether $gltype is signed... " >&6; } -if { as_var=gl_cv_type_${gltype}_signed; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ - #include <stddef.h> - #include <signal.h> - #if HAVE_WCHAR_H - # include <stdio.h> - # include <time.h> - # include <wchar.h> - #endif - - int verify[2 * (($gltype) -1 < ($gltype) 0) - 1]; -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - result=yes -else - result=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval gl_cv_type_${gltype}_signed=\$result - -fi -eval ac_res=\$gl_cv_type_${gltype}_signed - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval result=\$gl_cv_type_${gltype}_signed - GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - if test "$result" = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_SIGNED_${GLTYPE} 1 -_ACEOF - - eval HAVE_SIGNED_${GLTYPE}=1 - else - eval HAVE_SIGNED_${GLTYPE}=0 - fi - done - - - gl_cv_type_ptrdiff_t_signed=yes - gl_cv_type_size_t_signed=no - if test $APPLE_UNIVERSAL_BUILD = 0; then - - - for gltype in ptrdiff_t size_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 -$as_echo_n "checking for $gltype integer literal suffix... " >&6; } -if { as_var=gl_cv_type_${gltype}_suffix; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval gl_cv_type_${gltype}_suffix=no - eval result=\$gl_cv_type_${gltype}_signed - if test "$result" = yes; then - glsufu= - else - glsufu=u - fi - for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do - case $glsuf in - '') gltype1='int';; - l) gltype1='long int';; - ll) gltype1='long long int';; - i64) gltype1='__int64';; - u) gltype1='unsigned int';; - ul) gltype1='unsigned long int';; - ull) gltype1='unsigned long long int';; - ui64)gltype1='unsigned __int64';; - esac - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ - #include <stddef.h> - #include <signal.h> - #if HAVE_WCHAR_H - # include <stdio.h> - # include <time.h> - # include <wchar.h> - #endif - - extern $gltype foo; - extern $gltype1 foo; -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval gl_cv_type_${gltype}_suffix=\$glsuf -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" != no && break - done -fi -eval ac_res=\$gl_cv_type_${gltype}_suffix - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" = no && result= - eval ${GLTYPE}_SUFFIX=\$result - cat >>confdefs.h <<_ACEOF -#define ${GLTYPE}_SUFFIX $result -_ACEOF - - done - - - fi - - - for gltype in sig_atomic_t wchar_t wint_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 -$as_echo_n "checking for $gltype integer literal suffix... " >&6; } -if { as_var=gl_cv_type_${gltype}_suffix; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval gl_cv_type_${gltype}_suffix=no - eval result=\$gl_cv_type_${gltype}_signed - if test "$result" = yes; then - glsufu= - else - glsufu=u - fi - for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do - case $glsuf in - '') gltype1='int';; - l) gltype1='long int';; - ll) gltype1='long long int';; - i64) gltype1='__int64';; - u) gltype1='unsigned int';; - ul) gltype1='unsigned long int';; - ull) gltype1='unsigned long long int';; - ui64)gltype1='unsigned __int64';; - esac - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ - #include <stddef.h> - #include <signal.h> - #if HAVE_WCHAR_H - # include <stdio.h> - # include <time.h> - # include <wchar.h> - #endif - - extern $gltype foo; - extern $gltype1 foo; -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval gl_cv_type_${gltype}_suffix=\$glsuf -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" != no && break - done -fi -eval ac_res=\$gl_cv_type_${gltype}_suffix - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" = no && result= - eval ${GLTYPE}_SUFFIX=\$result - cat >>confdefs.h <<_ACEOF -#define ${GLTYPE}_SUFFIX $result -_ACEOF - - done - - - - STDINT_H=stdint.h - fi - - if test -n "$STDINT_H"; then - GL_GENERATE_STDINT_H_TRUE= - GL_GENERATE_STDINT_H_FALSE='#' -else - GL_GENERATE_STDINT_H_TRUE='#' - GL_GENERATE_STDINT_H_FALSE= -fi - - - - @@ -21778,10 +21072,6 @@ if test -z "${GL_GENERATE_STDDEF_H_TRUE}" && test -z "${GL_GENERATE_STDDEF_H_FAL as_fn_error "conditional \"GL_GENERATE_STDDEF_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${GL_GENERATE_STDINT_H_TRUE}" && test -z "${GL_GENERATE_STDINT_H_FALSE}"; then - as_fn_error "conditional \"GL_GENERATE_STDINT_H\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${gl_GNULIB_ENABLED_dosname_TRUE}" && test -z "${gl_GNULIB_ENABLED_dosname_FALSE}"; then as_fn_error "conditional \"gl_GNULIB_ENABLED_dosname\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index ec0e3b51a01..1f236ef4206 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,7 @@ +2011-05-18 Glenn Morris <rgm@gnu.org> + + * ack.texi (Acknowledgments): Remove fakemail.c. + 2011-05-17 Chong Yidong <cyd@stupidchicken.com> Fixes for fitting text into 7x9 printed manual. diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi index debe7149cb5..e554c71703f 100644 --- a/doc/emacs/ack.texi +++ b/doc/emacs/ack.texi @@ -1016,7 +1016,7 @@ Markus Rost wrote @file{cus-test.el}, a testing framework for customize. @item Guillermo J.@: Rozas wrote @file{scheme.el}, a mode for editing Scheme and -DSSSL code, and @file{fakemail.c}, an interface to the System V mailer. +DSSSL code. @item Ivar Rummelhoff wrote @file{winner.el}, which records recent window diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 8376dbaa7ca..917ebf0d675 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,14 @@ +2011-05-18 Teodor Zlatanov <tzz@lifelogs.com> + + * gnus.texi (Gnus Registry Setup): Rename from "Setup". + (Store custom flags and keywords): Mention + `gnus-registry-user-format-function-M' and + `gnus-registry-user-format-function-M2'. + +2011-05-17 Paul Eggert <eggert@cs.ucla.edu> + + * texinfo.tex: Sync from gnulib, version 2011-05-11.16. + 2011-05-17 Glenn Morris <rgm@gnu.org> * gnus.texi (Face): Fix typo. diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 931a9bedb39..a6b79237f08 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -25906,15 +25906,15 @@ of all messages matching a particular set of criteria. @end enumerate @menu -* Setup:: +* Gnus Registry Setup:: * Fancy splitting to parent:: * Registry Article Refer Method:: * Store custom flags and keywords:: * Store arbitrary data:: @end menu -@node Setup -@subsection Setup +@node Gnus Registry Setup +@subsection Gnus Registry Setup Fortunately, setting up the Gnus registry is pretty easy: @@ -26086,6 +26086,21 @@ Call this function to mark an article with a custom registry mark. It will offer the available marks for completion. @end defun +You can use @code{defalias} to install a summary line formatting +function that will show the registry marks. There are two flavors of +this function, either showing the marks as single characters, using +their @code{:char} property, or showing the marks as full strings. + +@lisp +;; show the marks as single characters (see the :char property in +;; `gnus-registry-marks'): +;; (defalias 'gnus-user-format-function-M 'gnus-registry-user-format-function-M) + +;; show the marks by name (see `gnus-registry-marks'): +;; (defalias 'gnus-user-format-function-M 'gnus-registry-user-format-function-M2) +@end lisp + + @node Store arbitrary data @subsection Store arbitrary data diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index 9f64511ea28..47837c938c8 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2011-03-25.11} +\def\texinfoversion{2011-05-11.16} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -8424,7 +8424,7 @@ directory should work if nowhere else does.} % % Latin1 (ISO-8859-1) character definitions. \def\latonechardefs{% - \gdef^^a0{~} + \gdef^^a0{\tie} \gdef^^a1{\exclamdown} \gdef^^a2{\missingcharmsg{CENT SIGN}} \gdef^^a3{{\pounds}} @@ -8546,7 +8546,7 @@ directory should work if nowhere else does.} % Latin2 (ISO-8859-2) character definitions. \def\lattwochardefs{% - \gdef^^a0{~} + \gdef^^a0{\tie} \gdef^^a1{\ogonek{A}} \gdef^^a2{\u{}} \gdef^^a3{\L} @@ -9395,6 +9395,8 @@ directory should work if nowhere else does.} \message{and turning on texinfo input format.} +\def^^L{\par} % remove \outer, so ^L can appear in an @comment + % DEL is a comment character, in case @c does not suffice. \catcode`\^^? = 14 @@ -278,6 +278,10 @@ to enable a minor-mode is deprecated. Instead, use "eval: (minor-mode)". ** The standalone programs lib-src/digest-doc and sorted-doc have been replaced with Lisp commands `doc-file-to-man' and `doc-file-to-info'. +--- +** The standalone program `fakemail' has been removed. +If you need it, feedmail.el ought to provide a superset of the functionality. + ** The variable `focus-follows-mouse' now always defaults to nil. @@ -473,6 +477,10 @@ See the variable `appt-warning-time-regexp'. *** New function `diary-hebrew-birthday'. --- +*** Elements of `calendar-day-abbrev-array' and `calendar-month-abbrev-array' +may no longer be nil, but must all be strings. + +--- *** The obsolete (since Emacs 22.1) method of enabling the appt package by adding appt-make-list to diary-hook has been removed. Use appt-activate. diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index c4a2df5bdbf..27dc3a14d48 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,11 @@ +2011-05-18 Glenn Morris <rgm@gnu.org> + + * fakemail.c: Remove file. + * makefile.w32-in ($(BLD)/fakemail.exe, fakemail) + ($(BLD)/fakemail.$(O)): Remove. + * Makefile.in (UTILITIES): Remove fakemail${EXEEXT}. + (fakemail${EXEEXT}): Remove rule. + 2011-04-24 Teodor Zlatanov <tzz@lifelogs.com> * makefile.w32-in (obj): Add gnutls.o. diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index 36366a4d2e7..1c2018dbbc9 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -117,8 +117,8 @@ STAMP_INST_SCRIPTS = stamp-rcs-checkin stamp-grep-changelog # Things that Emacs runs internally, or during the build process, # which should not be installed in bindir. -UTILITIES = profile${EXEEXT} movemail${EXEEXT} fakemail${EXEEXT} \ - hexl${EXEEXT} update-game-score${EXEEXT} +UTILITIES = profile${EXEEXT} movemail${EXEEXT} hexl${EXEEXT} \ + update-game-score${EXEEXT} DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT} @@ -353,9 +353,6 @@ movemail.o: ${srcdir}/movemail.c ../src/config.h pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h ../src/config.h $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c -fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h - $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail - emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \ -DVERSION="\"${version}\"" \ diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c deleted file mode 100644 index 435512125ff..00000000000 --- a/lib-src/fakemail.c +++ /dev/null @@ -1,744 +0,0 @@ -/* sendmail-like interface to /bin/mail for system V, - Copyright (C) 1985, 1994, 1999, 2001-2011 Free Software Foundation, Inc. - -Author: Bill Rozas <jinx@martigny.ai.mit.edu> -(according to ack.texi) - -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 <http://www.gnu.org/licenses/>. */ - - -#define _XOPEN_SOURCE 500 /* for cuserid */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#if defined (BSD_SYSTEM) && !defined (USE_FAKEMAIL) -/* This program isnot used in BSD, so just avoid loader complaints. */ -int -main (void) -{ - return 0; -} -#else /* not BSD 4.2 (or newer) */ -#ifdef MSDOS -int -main () -{ - return 0; -} -#else /* not MSDOS */ -/* This conditional contains all the rest of the file. */ - -/* These are defined in config in some versions. */ - -#ifdef static -#undef static -#endif - -#ifdef WINDOWSNT -#include "ntlib.h" -#endif - -#include <stdio.h> -#include <string.h> -#include <ctype.h> -#include <time.h> -#include <pwd.h> -#include <stdlib.h> - -/* This is to declare cuserid. */ -#include <unistd.h> - -/* Type definitions */ - -#define boolean int -#define true 1 -#define false 0 - -#define TM_YEAR_BASE 1900 - -/* Nonzero if TM_YEAR is a struct tm's tm_year value that causes - asctime to have well-defined behavior. */ -#ifndef TM_YEAR_IN_ASCTIME_RANGE -# define TM_YEAR_IN_ASCTIME_RANGE(tm_year) \ - (1000 - TM_YEAR_BASE <= (tm_year) && (tm_year) <= 9999 - TM_YEAR_BASE) -#endif - -/* Various lists */ - -struct line_record -{ - char *string; - struct line_record *continuation; -}; -typedef struct line_record *line_list; - -struct header_record -{ - line_list text; - struct header_record *next; - struct header_record *previous; -}; -typedef struct header_record *header; - -struct stream_record -{ - FILE *handle; - int (*action)(FILE *); - struct stream_record *rest_streams; -}; -typedef struct stream_record *stream_list; - -/* A `struct linebuffer' is a structure which holds a line of text. - * `readline' reads a line from a stream into a linebuffer - * and works regardless of the length of the line. - */ - -struct linebuffer -{ - long size; - char *buffer; -}; - -struct linebuffer lb; - -#define new_list() \ - ((line_list) xmalloc (sizeof (struct line_record))) -#define new_header() \ - ((header) xmalloc (sizeof (struct header_record))) -#define new_stream() \ - ((stream_list) xmalloc (sizeof (struct stream_record))) -#define alloc_string(nchars) \ - ((char *) xmalloc ((nchars) + 1)) - -/* Global declarations */ - -#define BUFLEN 1024 -#define KEYWORD_SIZE 256 -#define FROM_PREFIX "From" -#define MY_NAME "fakemail" -#define NIL ((line_list) NULL) -#define INITIAL_LINE_SIZE 200 - -#ifndef MAIL_PROGRAM_NAME -#define MAIL_PROGRAM_NAME "/bin/mail" -#endif - -static const char *my_name; -static char *the_date; -static char *the_user; -static line_list file_preface; -static stream_list the_streams; -static boolean no_problems = true; - -static void fatal (const char *s1) NO_RETURN; - -#ifdef CURRENT_USER -static struct passwd *my_entry; -#define cuserid(s) \ -(my_entry = getpwuid (((int) geteuid ())), \ - my_entry->pw_name) -#endif - -/* Utilities */ - -/* Print error message. `s1' is printf control string, `s2' is arg for it. */ - -static void -error (const char *s1, const char *s2) -{ - printf ("%s: ", my_name); - printf (s1, s2); - printf ("\n"); - no_problems = false; -} - -/* Print error message and exit. */ - -static void -fatal (const char *s1) -{ - error ("%s", s1); - exit (EXIT_FAILURE); -} - -/* Like malloc but get fatal error if memory is exhausted. */ - -static void * -xmalloc (size_t size) -{ - void *result = malloc (size); - if (! result) - fatal ("virtual memory exhausted"); - return result; -} - -static void * -xrealloc (void *ptr, size_t size) -{ - void *result = realloc (ptr, size); - if (! result) - fatal ("virtual memory exhausted"); - return result; -} - -/* Initialize a linebuffer for use */ - -static void -init_linebuffer (struct linebuffer *linebuffer) -{ - linebuffer->size = INITIAL_LINE_SIZE; - linebuffer->buffer = ((char *) xmalloc (INITIAL_LINE_SIZE)); -} - -/* Read a line of text from `stream' into `linebuffer'. - Return the length of the line. */ - -static long -readline (struct linebuffer *linebuffer, FILE *stream) -{ - char *buffer = linebuffer->buffer; - char *p = linebuffer->buffer; - char *end = p + linebuffer->size; - - while (true) - { - int c = getc (stream); - if (p == end) - { - linebuffer->size *= 2; - buffer = (char *) xrealloc (buffer, linebuffer->size); - p = buffer + (p - linebuffer->buffer); - end = buffer + linebuffer->size; - linebuffer->buffer = buffer; - } - if (c < 0 || c == '\n') - { - *p = 0; - break; - } - *p++ = c; - } - - return p - buffer; -} - -/* Extract a colon-terminated keyword from the string FIELD. - Return that keyword as a string stored in a static buffer. - Store the address of the rest of the string into *REST. - - If there is no keyword, return NULL and don't alter *REST. */ - -static char * -get_keyword (register char *field, char **rest) -{ - static char keyword[KEYWORD_SIZE]; - register char *ptr; - register int c; - - ptr = &keyword[0]; - c = (unsigned char) *field++; - if (isspace (c) || c == ':') - return ((char *) NULL); - *ptr++ = (islower (c) ? toupper (c) : c); - while (((c = (unsigned char) *field++) != ':') && ! isspace (c)) - *ptr++ = (islower (c) ? toupper (c) : c); - *ptr++ = '\0'; - while (isspace (c)) - c = (unsigned char) *field++; - if (c != ':') - return ((char *) NULL); - *rest = field; - return &keyword[0]; -} - -/* Nonzero if the string FIELD starts with a colon-terminated keyword. */ - -static boolean -has_keyword (char *field) -{ - char *ignored; - return (get_keyword (field, &ignored) != ((char *) NULL)); -} - -/* Store the string FIELD, followed by any lines in THE_LIST, - into the buffer WHERE. - Concatenate lines, putting just a space between them. - Delete everything contained in parentheses. - When a recipient name contains <...>, we discard - everything except what is inside the <...>. - - We don't pay attention to overflowing WHERE; - the caller has to make it big enough. */ - -static char * -add_field (line_list the_list, register char *field, register char *where) -{ - register char c; - while (true) - { - char *this_recipient_where; - int in_quotes = 0; - - *where++ = ' '; - this_recipient_where = where; - - while ((c = *field++) != '\0') - { - if (c == '\\') - *where++ = c; - else if (c == '"') - { - in_quotes = ! in_quotes; - *where++ = c; - } - else if (in_quotes) - *where++ = c; - else if (c == '(') - { - while (*field && *field != ')') ++field; - if (! (*field++)) break; /* no close */ - continue; - } - else if (c == ',') - { - *where++ = ' '; - /* When we get to the end of one recipient, - don't discard it if the next one has <...>. */ - this_recipient_where = where; - } - else if (c == '<') - /* Discard everything we got before the `<'. */ - where = this_recipient_where; - else if (c == '>') - /* Discard the rest of this name that follows the `>'. */ - { - while (*field && *field != ',') ++field; - if (! (*field++)) break; /* no comma */ - continue; - } - else - *where++ = c; - } - if (the_list == NIL) break; - field = the_list->string; - the_list = the_list->continuation; - } - return where; -} - -static line_list -make_file_preface (void) -{ - char *the_string, *temp; - long idiotic_interface; - struct tm *tm; - long prefix_length; - long user_length; - long date_length; - line_list result; - - prefix_length = strlen (FROM_PREFIX); - time (&idiotic_interface); - /* Convert to a string, checking for out-of-range time stamps. - Don't use 'ctime', as that might dump core if the hardware clock - is set to a bizarre value. */ - tm = localtime (&idiotic_interface); - if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) - && (the_date = asctime (tm)))) - fatal ("current time is out of range"); - /* the_date has an unwanted newline at the end */ - date_length = strlen (the_date) - 1; - the_date[date_length] = '\0'; - temp = cuserid ((char *) NULL); - user_length = strlen (temp); - the_user = alloc_string (user_length + 1); - strcpy (the_user, temp); - the_string = alloc_string (3 + prefix_length - + user_length - + date_length); - temp = the_string; - strcpy (temp, FROM_PREFIX); - temp = &temp[prefix_length]; - *temp++ = ' '; - strcpy (temp, the_user); - temp = &temp[user_length]; - *temp++ = ' '; - strcpy (temp, the_date); - result = new_list (); - result->string = the_string; - result->continuation = ((line_list) NULL); - return result; -} - -static void -write_line_list (register line_list the_list, FILE *the_stream) -{ - for ( ; - the_list != ((line_list) NULL) ; - the_list = the_list->continuation) - { - fputs (the_list->string, the_stream); - putc ('\n', the_stream); - } - return; -} - -static int -close_the_streams (void) -{ - register stream_list rem; - for (rem = the_streams; - rem != ((stream_list) NULL); - rem = rem->rest_streams) - if (no_problems && (*rem->action) (rem->handle) != 0) - error ("output error", NULL); - the_streams = ((stream_list) NULL); - return (no_problems ? EXIT_SUCCESS : EXIT_FAILURE); -} - -static void -add_a_stream (FILE *the_stream, int (*closing_action) (FILE *)) -{ - stream_list old = the_streams; - the_streams = new_stream (); - the_streams->handle = the_stream; - the_streams->action = closing_action; - the_streams->rest_streams = old; - return; -} - -static int -my_fclose (FILE *the_file) -{ - putc ('\n', the_file); - fflush (the_file); - if (ferror (the_file)) - return EOF; - return fclose (the_file); -} - -static boolean -open_a_file (char *name) -{ - FILE *the_stream = fopen (name, "a"); - if (the_stream != ((FILE *) NULL)) - { - add_a_stream (the_stream, my_fclose); - if (the_user == ((char *) NULL)) - file_preface = make_file_preface (); - write_line_list (file_preface, the_stream); - return true; - } - return false; -} - -static void -put_string (char *s) -{ - register stream_list rem; - for (rem = the_streams; - rem != ((stream_list) NULL); - rem = rem->rest_streams) - fputs (s, rem->handle); - return; -} - -static void -put_line (const char *string) -{ - register stream_list rem; - for (rem = the_streams; - rem != ((stream_list) NULL); - rem = rem->rest_streams) - { - const char *s = string; - int column = 0; - - /* Divide STRING into lines. */ - while (*s != 0) - { - const char *breakpos; - - /* Find the last char that fits. */ - for (breakpos = s; *breakpos && column < 78; ++breakpos) - { - if (*breakpos == '\t') - column += 8; - else - column++; - } - /* If we didn't reach end of line, break the line. */ - if (*breakpos) - { - /* Back up to just after the last comma that fits. */ - while (breakpos != s && breakpos[-1] != ',') --breakpos; - - if (breakpos == s) - { - /* If no comma fits, move past the first address anyway. */ - while (*breakpos != 0 && *breakpos != ',') ++breakpos; - if (*breakpos != 0) - /* Include the comma after it. */ - ++breakpos; - } - } - /* Output that much, then break the line. */ - fwrite (s, 1, breakpos - s, rem->handle); - column = 8; - - /* Skip whitespace and prepare to print more addresses. */ - s = breakpos; - while (*s == ' ' || *s == '\t') ++s; - if (*s != 0) - fputs ("\n\t", rem->handle); - } - putc ('\n', rem->handle); - } - return; -} - -#define mail_error error - -/* Handle an FCC field. FIELD is the text of the first line (after - the header name), and THE_LIST holds the continuation lines if any. - Call open_a_file for each file. */ - -static void -setup_files (register line_list the_list, register char *field) -{ - register char *start; - register char c; - while (true) - { - while (((c = *field) != '\0') - && (c == ' ' - || c == '\t' - || c == ',')) - field += 1; - if (c != '\0') - { - start = field; - while (((c = *field) != '\0') - && c != ' ' - && c != '\t' - && c != ',') - field += 1; - *field = '\0'; - if (!open_a_file (start)) - mail_error ("Could not open file %s", start); - *field = c; - if (c != '\0') continue; - } - if (the_list == ((line_list) NULL)) - return; - field = the_list->string; - the_list = the_list->continuation; - } -} - -/* Compute the total size of all recipient names stored in THE_HEADER. - The result says how big to make the buffer to pass to parse_header. */ - -static int -args_size (header the_header) -{ - register header old = the_header; - register line_list rem; - register int size = 0; - do - { - char *field; - register char *keyword = get_keyword (the_header->text->string, &field); - if ((strcmp (keyword, "TO") == 0) - || (strcmp (keyword, "CC") == 0) - || (strcmp (keyword, "BCC") == 0)) - { - size += 1 + strlen (field); - for (rem = the_header->text->continuation; - rem != NIL; - rem = rem->continuation) - size += 1 + strlen (rem->string); - } - the_header = the_header->next; - } while (the_header != old); - return size; -} - -/* Scan the header described by the lists THE_HEADER, - and put all recipient names into the buffer WHERE. - Precede each recipient name with a space. - - Also, if the header has any FCC fields, call setup_files for each one. */ - -static void -parse_header (header the_header, register char *where) -{ - register header old = the_header; - do - { - char *field; - register char *keyword = get_keyword (the_header->text->string, &field); - if (strcmp (keyword, "TO") == 0) - where = add_field (the_header->text->continuation, field, where); - else if (strcmp (keyword, "CC") == 0) - where = add_field (the_header->text->continuation, field, where); - else if (strcmp (keyword, "BCC") == 0) - { - where = add_field (the_header->text->continuation, field, where); - the_header->previous->next = the_header->next; - the_header->next->previous = the_header->previous; - } - else if (strcmp (keyword, "FCC") == 0) - setup_files (the_header->text->continuation, field); - the_header = the_header->next; - } while (the_header != old); - *where = '\0'; - return; -} - -/* Read lines from the input until we get a blank line. - Create a list of `header' objects, one for each header field, - each of which points to a list of `line_list' objects, - one for each line in that field. - Continuation lines are grouped in the headers they continue. */ - -static header -read_header (void) -{ - register header the_header = ((header) NULL); - register line_list *next_line = ((line_list *) NULL); - - init_linebuffer (&lb); - - do - { - long length; - register char *line; - - readline (&lb, stdin); - line = lb.buffer; - length = strlen (line); - if (length == 0) break; - - if (has_keyword (line)) - { - register header old = the_header; - the_header = new_header (); - if (old == ((header) NULL)) - { - the_header->next = the_header; - the_header->previous = the_header; - } - else - { - the_header->previous = old; - the_header->next = old->next; - old->next = the_header; - } - next_line = &(the_header->text); - } - - if (next_line == ((line_list *) NULL)) - { - /* Not a valid header */ - exit (EXIT_FAILURE); - } - *next_line = new_list (); - (*next_line)->string = alloc_string (length); - strcpy (((*next_line)->string), line); - next_line = &((*next_line)->continuation); - *next_line = NIL; - - } while (true); - - if (! the_header) - fatal ("input message has no header"); - return the_header->next; -} - -static void -write_header (header the_header) -{ - register header old = the_header; - do - { - register line_list the_list; - for (the_list = the_header->text; - the_list != NIL; - the_list = the_list->continuation) - put_line (the_list->string); - the_header = the_header->next; - } while (the_header != old); - put_line (""); - return; -} - -int -main (int argc, char **argv) -{ - char *command_line; - header the_header; - long name_length; - const char *mail_program_name; - char buf[BUFLEN + 1]; - register int size; - FILE *the_pipe; - - mail_program_name = getenv ("FAKEMAILER"); - if (!(mail_program_name && *mail_program_name)) - mail_program_name = MAIL_PROGRAM_NAME; - name_length = strlen (mail_program_name); - - my_name = MY_NAME; - the_streams = ((stream_list) NULL); - the_date = ((char *) NULL); - the_user = ((char *) NULL); - - the_header = read_header (); - command_line = alloc_string (name_length + args_size (the_header)); - strcpy (command_line, mail_program_name); - parse_header (the_header, &command_line[name_length]); - - the_pipe = popen (command_line, "w"); - if (the_pipe == ((FILE *) NULL)) - fatal ("cannot open pipe to real mailer"); - - add_a_stream (the_pipe, pclose); - - write_header (the_header); - - /* Dump the message itself */ - - while (!feof (stdin)) - { - size = fread (buf, 1, BUFLEN, stdin); - buf[size] = '\0'; - put_string (buf); - } - - if (no_problems && (ferror (stdin) || fclose (stdin) != 0)) - error ("input error", NULL); - - exit (close_the_streams ()); -} - -#endif /* not MSDOS */ -#endif /* not BSD 4.2 (or newer) */ - - -/* fakemail.c ends here */ diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in index 38d453d5259..0e203d18bd2 100644 --- a/lib-src/makefile.w32-in +++ b/lib-src/makefile.w32-in @@ -31,8 +31,6 @@ $(BLD)/make-docfile.exe: $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O) $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O) $(LIBS) $(BLD)/hexl.exe: $(BLD)/hexl.$(O) $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/hexl.$(O) $(LIBS) -$(BLD)/fakemail.exe: $(BLD)/fakemail.$(O) $(BLD)/ntlib.$(O) - $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/fakemail.$(O) $(BLD)/ntlib.$(O) $(LIBS) $(BLD)/test-distrib.exe: $(BLD)/test-distrib.$(O) $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/test-distrib.$(O) $(LIBS) @@ -42,7 +40,6 @@ etags: stamp_BLD $(BLD)/etags.exe ebrowse: stamp_BLD $(BLD)/ebrowse.exe hexl: stamp_BLD $(BLD)/hexl.exe movemail: stamp_BLD $(BLD)/movemail.exe -fakemail: stamp_BLD $(BLD)/fakemail.exe emacsclient: stamp_BLD $(BLD)/emacsclient.exe $(BLD)/emacsclientw.exe test-distrib: stamp_BLD $(BLD)/test-distrib.exe @@ -406,14 +403,6 @@ $(BLD)/etags.$(O) : \ $(SRC)/ntlib.h \ $(EMACS_ROOT)/lib/getopt.h -$(BLD)/fakemail.$(O) : \ - $(SRC)/fakemail.c \ - $(SRC)/ntlib.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/m/intel386.h \ - $(EMACS_ROOT)/lib-src/../src/config.h \ - $(EMACS_ROOT)/nt/inc/pwd.h - $(BLD)/getdate.$(O) : \ $(SRC)/getdate.c \ $(EMACS_ROOT)/src/s/ms-w32.h \ @@ -483,7 +472,7 @@ $(BLD)/timer.$(O) : \ # The following dependencies are for supporting parallel builds, where # we must make sure $(BLD) exists before any compilation starts. # -$(BLD)/make-docfile.$(O) $(BLD)/hexl.$(O) $(BLD)/fakemail.$(O): stamp_BLD +$(BLD)/make-docfile.$(O) $(BLD)/hexl.$(O): stamp_BLD $(BLD)/test-distrib.$(O) $(MOVEMAILOBJS): stamp_BLD diff --git a/lib/gnulib.mk b/lib/gnulib.mk index 1466e430a4c..495e6918a45 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk @@ -167,7 +167,8 @@ endif ## begin gnulib module ignore-value -libgnu_a_SOURCES += ignore-value.h + +EXTRA_DIST += ignore-value.h ## end gnulib module ignore-value @@ -779,6 +780,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ + -e 's|@''GNULIB_GROUP_MEMBER''@|$(GNULIB_GROUP_MEMBER)|g' \ -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \ -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \ @@ -817,6 +819,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ + -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ @@ -883,9 +886,10 @@ EXTRA_DIST += unistd.in.h ## begin gnulib module verify if gl_GNULIB_ENABLED_verify -libgnu_a_SOURCES += verify.h endif +EXTRA_DIST += verify.h + ## end gnulib module verify ## begin gnulib module warn-on-use diff --git a/lib/intprops.h b/lib/intprops.h index 58b1b3fbf44..a84bd6af531 100644 --- a/lib/intprops.h +++ b/lib/intprops.h @@ -17,70 +17,298 @@ /* Written by Paul Eggert. */ -#ifndef GL_INTPROPS_H -# define GL_INTPROPS_H +#ifndef _GL_INTPROPS_H +#define _GL_INTPROPS_H -# include <limits.h> +#include <limits.h> + +/* Return a integer value, converted to the same type as the integer + expression E after integer type promotion. V is the unconverted value. + E should not have side effects. */ +#define _GL_INT_CONVERT(e, v) ((e) - (e) + (v)) /* The extra casts in the following macros work around compiler bugs, e.g., in Cray C 5.0.3.0. */ /* True if the arithmetic type T is an integer type. bool counts as an integer. */ -# define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) +#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) /* True if negative values of the signed integer type T use two's complement, ones' complement, or signed magnitude representation, respectively. Much GNU code assumes two's complement, but some people like to be portable to all possible C hosts. */ -# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) -# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) -# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) +#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) +#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) +#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) + +/* True if the signed integer expression E uses two's complement. */ +#define _GL_INT_TWOS_COMPLEMENT(e) (~ _GL_INT_CONVERT (e, 0) == -1) /* True if the arithmetic type T is signed. */ -# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) +#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) + +/* Return 1 if the integer expression E, after integer promotion, has + a signed type. E should not have side effects. */ +#define _GL_INT_SIGNED(e) (_GL_INT_CONVERT (e, -1) < 0) -/* The maximum and minimum values for the integer type T. These + +/* Minimum and maximum values for integer types and expressions. These macros have undefined behavior if T is signed and has padding bits. If this is a problem for you, please let us know how to fix it for your host. */ -# define TYPE_MINIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) 0 \ - : TYPE_SIGNED_MAGNITUDE (t) \ - ? ~ (t) 0 \ + +/* The maximum and minimum values for the integer type T. */ +#define TYPE_MINIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) 0 \ + : TYPE_SIGNED_MAGNITUDE (t) \ + ? ~ (t) 0 \ : ~ TYPE_MAXIMUM (t))) -# define TYPE_MAXIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) -1 \ +#define TYPE_MAXIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) -1 \ : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) -/* Return zero if T can be determined to be an unsigned type. - Otherwise, return 1. - When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a - tighter bound. Otherwise, it overestimates the true bound by one byte - when applied to unsigned types of size 2, 4, 16, ... bytes. - The symbol signed_type_or_expr__ is private to this header file. */ -# if __GNUC__ >= 2 -# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t)) -# else -# define signed_type_or_expr__(t) 1 -# endif +/* The maximum and minimum values for the type of the expression E, + after integer promotion. E should not have side effects. */ +#define _GL_INT_MINIMUM(e) \ + (_GL_INT_SIGNED (e) \ + ? - _GL_INT_TWOS_COMPLEMENT (e) - _GL_SIGNED_INT_MAXIMUM (e) \ + : _GL_INT_CONVERT (e, 0)) +#define _GL_INT_MAXIMUM(e) \ + (_GL_INT_SIGNED (e) \ + ? _GL_SIGNED_INT_MAXIMUM (e) \ + : _GL_INT_CONVERT (e, -1)) +#define _GL_SIGNED_INT_MAXIMUM(e) \ + (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1) + + +/* Return 1 if the __typeof__ keyword works. This could be done by + 'configure', but for now it's easier to do it by hand. */ +#if 2 <= __GNUC__ || 0x5110 <= __SUNPRO_C +# define _GL_HAVE___TYPEOF__ 1 +#else +# define _GL_HAVE___TYPEOF__ 0 +#endif + +/* Return 1 if the integer type or expression T might be signed. Return 0 + if it is definitely unsigned. This macro does not evaluate its argument, + and expands to an integer constant expression. */ +#if _GL_HAVE___TYPEOF__ +# define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED (__typeof__ (t)) +#else +# define _GL_SIGNED_TYPE_OR_EXPR(t) 1 +#endif /* Bound on length of the string representing an unsigned integer value representable in B bits. log10 (2.0) < 146/485. The smallest value of B where this bound is not tight is 2621. */ -# define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485) +#define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485) /* Bound on length of the string representing an integer type or expression T. Subtract 1 for the sign bit if T is signed, and then add 1 more for - a minus sign if needed. */ -# define INT_STRLEN_BOUND(t) \ - (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) \ - + signed_type_or_expr__ (t)) + a minus sign if needed. + + Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 0 when its argument is + signed, this macro may overestimate the true bound by one byte when + applied to unsigned types of size 2, 4, 16, ... bytes. */ +#define INT_STRLEN_BOUND(t) \ + (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT \ + - _GL_SIGNED_TYPE_OR_EXPR (t)) \ + + _GL_SIGNED_TYPE_OR_EXPR (t)) /* Bound on buffer size needed to represent an integer type or expression T, including the terminating null. */ -# define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) +#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) + + +/* Range overflow checks. + + The INT_<op>_RANGE_OVERFLOW macros return 1 if the corresponding C + operators might not yield numerically correct answers due to + arithmetic overflow. They do not rely on undefined or + implementation-defined behavior. Their implementations are simple + and straightforward, but they are a bit harder to use than the + INT_<op>_OVERFLOW macros described below. + + Example usage: + + long int i = ...; + long int j = ...; + if (INT_MULTIPLY_RANGE_OVERFLOW (i, j, LONG_MIN, LONG_MAX)) + printf ("multiply would overflow"); + else + printf ("product is %ld", i * j); + + Restrictions on *_RANGE_OVERFLOW macros: + + These macros do not check for all possible numerical problems or + undefined or unspecified behavior: they do not check for division + by zero, for bad shift counts, or for shifting negative numbers. + + These macros may evaluate their arguments zero or multiple times, + so the arguments should not have side effects. The arithmetic + arguments (including the MIN and MAX arguments) must be of the same + integer type after the usual arithmetic conversions, and the type + must have minimum value MIN and maximum MAX. Unsigned types should + use a zero MIN of the proper type. + + These macros are tuned for constant MIN and MAX. For commutative + operations such as A + B, they are also tuned for constant B. */ + +/* Return 1 if A + B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_ADD_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? (a) < (min) - (b) \ + : (max) - (b) < (a)) + +/* Return 1 if A - B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? (max) + (b) < (a) \ + : (a) < (min) + (b)) + +/* Return 1 if - A would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_NEGATE_RANGE_OVERFLOW(a, min, max) \ + ((min) < 0 \ + ? (a) < - (max) \ + : 0 < (a)) + +/* Return 1 if A * B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? ((a) < 0 \ + ? (a) < (max) / (b) \ + : (b) < -1 && (min) / (b) < (a)) \ + : (0 < (b) \ + && ((a) < 0 \ + ? (a) < (min) / (b) \ + : (max) / (b) < (a)))) + +/* Return 1 if A / B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Do not check for division by zero. */ +#define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max) \ + ((min) < 0 && (b) == -1 && (a) < - (max)) + +/* Return 1 if A % B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Do not check for division by zero. + Mathematically, % should never overflow, but on x86-like hosts + INT_MIN % -1 traps, and the C standard permits this, so treat this + as an overflow too. */ +#define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max) \ + INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max) + +/* Return 1 if A << B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Here, MIN and MAX are for A only, and B need + not be of the same type as the other arguments. The C standard says that + behavior is undefined for shifts unless 0 <= B < wordwidth, and that when + A is negative then A << B has undefined behavior and A >> B has + implementation-defined behavior, but do not check these other + restrictions. */ +#define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max) \ + ((a) < 0 \ + ? (a) < (min) >> (b) \ + : (max) >> (b) < (a)) + + +/* The _GL*_OVERFLOW macros have the same restrictions as the + *_RANGE_OVERFLOW macros, except that they do not assume that operands + (e.g., A and B) have the same type as MIN and MAX. Instead, they assume + that the result (e.g., A + B) has that type. */ +#define _GL_ADD_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? (b) <= (a) + (b) \ + : (b) < 0 ? (a) <= (a) + (b) \ + : (a) + (b) < (b)) +#define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? 1 \ + : (b) < 0 ? (a) - (b) <= (a) \ + : (a) < (b)) +#define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ + (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \ + || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max)) +#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? (b) == _GL_INT_CONVERT (min, -1) && (a) < - (max) \ + : (a) < 0 ? (b) <= (a) + (b) - 1 \ + : (b) < 0 && (a) + (b) <= (a)) +#define _GL_REMAINDER_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? (b) == _GL_INT_CONVERT (min, -1) && (a) < - (max) \ + : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \ + : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max)) + +/* Return a nonzero value if A is a mathematical multiple of B, where + A is unsigned, B is negative, and MAX is the maximum value of A's + type. A's type must be the same as (A % B)'s type. Normally (A % + -B == 0) suffices, but things get tricky if -B would overflow. */ +#define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max) \ + (((b) < -_GL_SIGNED_INT_MAXIMUM (b) \ + ? (_GL_SIGNED_INT_MAXIMUM (b) == (max) \ + ? (a) \ + : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1)) \ + : (a) % - (b)) \ + == 0) + + +/* Integer overflow checks. + + The INT_<op>_OVERFLOW macros return 1 if the corresponding C operators + might not yield numerically correct answers due to arithmetic overflow. + They work correctly on all known practical hosts, and do not rely + on undefined behavior due to signed arithmetic overflow. + + Example usage: + + long int i = ...; + long int j = ...; + if (INT_MULTIPLY_OVERFLOW (i, j)) + printf ("multiply would overflow"); + else + printf ("product is %ld", i * j); + + These macros do not check for all possible numerical problems or + undefined or unspecified behavior: they do not check for division + by zero, for bad shift counts, or for shifting negative numbers. + + These macros may evaluate their arguments zero or multiple times, so the + arguments should not have side effects. + + These macros are tuned for their last argument being a constant. + + Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B, + A % B, and A << B would overflow, respectively. */ + +#define INT_ADD_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) +#define INT_SUBTRACT_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) +#define INT_NEGATE_OVERFLOW(a) \ + INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) +#define INT_MULTIPLY_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW) +#define INT_DIVIDE_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW) +#define INT_REMAINDER_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW) +#define INT_LEFT_SHIFT_OVERFLOW(a, b) \ + INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \ + _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) + +/* Return 1 if the expression A <op> B would overflow, + where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test, + assuming MIN and MAX are the minimum and maximum for the result type. + + This macro assumes that A | B is a valid integer if both A and B are, + which is true of all known practical hosts. If this is a problem + for you, please let us know how to fix it for your host. */ +#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \ + op_result_overflow (a, b, \ + _GL_INT_MINIMUM ((a) | (b)), \ + _GL_INT_MAXIMUM ((a) | (b))) -#endif /* GL_INTPROPS_H */ +#endif /* _GL_INTPROPS_H */ diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 3b58d0f42a5..59dd5709877 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -871,6 +871,22 @@ _GL_WARN_ON_USE (endusershell, "endusershell is unportable - " #endif +#if @GNULIB_GROUP_MEMBER@ +/* Determine whether group id is in calling user's group list. */ +# if !@HAVE_GROUP_MEMBER@ +_GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); +# endif +_GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); +_GL_CXXALIASWARN (group_member); +#elif defined GNULIB_POSIXCHECK +# undef group_member +# if HAVE_RAW_DECL_GROUP_MEMBER +_GL_WARN_ON_USE (group_member, "group_member is unportable - " + "use gnulib module group-member for portability"); +# endif +#endif + + #if @GNULIB_LCHOWN@ /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE to GID (if GID is not -1). Do not follow symbolic links. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 844fcaad833..15bd4b190b2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,42 @@ +2011-05-18 Michael Albinus <michael.albinus@gmx.de> + + * net/tramp.el (tramp-process-actions): Set "first-password-request" + property for the correct connection in case of multihops. + +2011-05-18 Glenn Morris <rgm@gnu.org> + + * emacs-lisp/authors.el (authors-fixed-entries): Remove fakemail.c. + * mail/sendmail.el (sendmail-program): Fall back to just "sendmail". + + Rationalize calendar handling of day and month abbrev-arrays. + * calendar/calendar.el (calendar-customized-p): New function. + (calendar-abbrev-construct, calendar-make-alist): Change what it does. + (calendar-day-name-array, calendar-month-name-array): Doc fix. + Add :set function. + (calendar-abbrev-length, calendar-day-abbrev-array) + (calendar-month-abbrev-array): Make defcustoms, with appropriate :set. + (calendar-day-abbrev-array, calendar-month-abbrev-array): + Elements may no longer be nil. + (calendar-day-name, calendar-month-name): + Update for changed nature of abbrev arrays. + * calendar/diary-lib.el (diary-name-pattern): + Update for changed nature of abbrev arrays. + (diary-mark-entries-1): Update calendar-make-alist calls. + (diary-font-lock-date-forms): Doc fix for changed abbrev arrays. + * calendar/cal-html.el (cal-html-day-abbrev-array): + Simply inherit from calendar-day-abbrev-array. + +2011-05-17 Stefan Monnier <monnier@iro.umontreal.ca> + + * progmodes/grep.el (grep-mode): Disable default + compilation-directory-matcher setting (bug#8684). + +2011-05-17 Michael Albinus <michael.albinus@gmx.de> + + * net/tramp.el (tramp-handle-insert-file-contents): Use "dd" + instead of "head" and "tail". There were problems with SunOS 5.9, + and it performs better. + 2011-05-17 Glenn Morris <rgm@gnu.org> * mail/mail-utils.el (mail-dont-reply-to): Silence compiler. @@ -75,7 +114,7 @@ (feedmail-debug-sit-for, feedmail-queue-express-hook): New options. (feedmail-sender-line, feedmail-from-line) (feedmail-fiddle-headers-upwardly, feedmail-enable-spray) - (feedmail-spray-this-address, ) + (feedmail-spray-this-address) (feedmail-spray-address-fiddle-plex-list) (feedmail-queue-use-send-time-for-date) (feedmail-queue-use-send-time-for-message-id) @@ -160,20 +199,20 @@ 2011-05-13 Ulf Jasper <ulf.jasper@web.de> - * net/newst-treeview.el (newsticker-treeview-face): Changed default + * net/newst-treeview.el (newsticker-treeview-face): Change default family from helvetica to sans. - (newsticker-treeview-tool-bar-map): Moved tool-bar icons to + (newsticker-treeview-tool-bar-map): Move tool-bar icons to etc/images/newsticker. - * net/newst-reader.el (newsticker-feed-face): Changed default + * net/newst-reader.el (newsticker-feed-face): Change default family from helvetica to sans. * net/newst-plainview.el (newsticker-new-item-face) (newsticker-old-item-face, newsticker-immortal-item-face) (newsticker-obsolete-item-face, newsticker-date-face) - (newsticker-statistics-face): Changed default family from + (newsticker-statistics-face): Change default family from helvetica to sans. - (newsticker--plainview-tool-bar-map): Moved tool-bar icons to + (newsticker--plainview-tool-bar-map): Move tool-bar icons to etc/images/newsticker. * net/newst-backend.el (newsticker--do-run-auto-mark-filter), @@ -304,7 +343,7 @@ * textmodes/reftex-dcr.el (reftex-view-crossref): at at -> at a 2011-05-10 Glenn Morris <rgm@gnu.org> - Stefan Monnier <monnier@iro.umontreal.ca> + Stefan Monnier <monnier@iro.umontreal.ca> * files.el (hack-one-local-variable-eval-safep): Consider "eval: (foo-mode)" to be safe. (Bug#8613) diff --git a/lisp/calendar/cal-html.el b/lisp/calendar/cal-html.el index bcc19ccda0b..580b953170c 100644 --- a/lisp/calendar/cal-html.el +++ b/lisp/calendar/cal-html.el @@ -54,11 +54,16 @@ :type 'integer :group 'calendar-html) -(defcustom cal-html-day-abbrev-array - (calendar-abbrev-construct calendar-day-abbrev-array - calendar-day-name-array) +(defcustom cal-html-day-abbrev-array calendar-day-abbrev-array "Array of seven strings for abbreviated day names (starting with Sunday)." - :type '(vector string string string string string string string) + :set-after '(calendar-day-abbrev-array) + :type '(vector (string :tag "Sun") + (string :tag "Mon") + (string :tag "Tue") + (string :tag "Wed") + (string :tag "Thu") + (string :tag "Fri") + (string :tag "Sat")) :group 'calendar-html) (defcustom cal-html-css-default diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index e81eb554458..fa19d1ffe14 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -2034,18 +2034,40 @@ is a string to insert in the minibuffer before reading." value)) -(defvar calendar-abbrev-length 3 - "*Length of abbreviations to be used for day and month names. -See also `calendar-day-abbrev-array' and `calendar-month-abbrev-array'.") +(defun calendar-customized-p (symbol) + "Return non-nil if SYMBOL has been customized." + (and (default-boundp symbol) + (let ((standard (get symbol 'standard-value))) + (and standard + (not (equal (eval (car standard)) (default-value symbol))))))) + +(defun calendar-abbrev-construct (full) + "From sequence FULL, return a vector of abbreviations. +Each abbreviation is no longer than `calendar-abbrev-length' characters." + (apply 'vector (mapcar + (lambda (f) + (substring f 0 (min calendar-abbrev-length (length f)))) + full))) -;; FIXME does it have to start from Sunday? (defcustom calendar-day-name-array ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"] - "Array of capitalized strings giving, in order, the day names. + "Array of capitalized strings giving, in order from Sunday, the day names. The first two characters of each string will be used to head the -day columns in the calendar. See also the variable -`calendar-day-abbrev-array'." +day columns in the calendar. +If you change this without using customize after the calendar has loaded, +then you may also want to change `calendar-day-abbrev-array'." :group 'calendar + :initialize 'custom-initialize-default + :set (lambda (symbol value) + (let ((dcustomized (calendar-customized-p 'calendar-day-abbrev-array)) + (hcustomized (calendar-customized-p 'cal-html-day-abbrev-array))) + (set symbol value) + (or dcustomized + (setq calendar-day-abbrev-array + (calendar-abbrev-construct calendar-day-name-array))) + (and (not hcustomized) + (boundp 'cal-html-day-abbrev-array) + (setq cal-html-day-abbrev-array calendar-day-abbrev-array)))) :type '(vector (string :tag "Sunday") (string :tag "Monday") (string :tag "Tuesday") @@ -2054,23 +2076,74 @@ day columns in the calendar. See also the variable (string :tag "Friday") (string :tag "Saturday"))) -(defvar calendar-day-abbrev-array - [nil nil nil nil nil nil nil] - "*Array of capitalized strings giving the abbreviated day names. +(defcustom calendar-abbrev-length 3 + "Default length of abbreviations to use for day and month names. +If you change this without using customize after the calendar has loaded, +then you may also want to change `calendar-day-abbrev-array' and +`calendar-month-abbrev-array'." + :group 'calendar + :initialize 'custom-initialize-default + :set (lambda (symbol value) + (let ((dcustomized (calendar-customized-p 'calendar-day-abbrev-array)) + (mcustomized (calendar-customized-p + 'calendar-month-abbrev-array)) + (hcustomized (calendar-customized-p 'cal-html-day-abbrev-array))) + (set symbol value) + (or dcustomized + (setq calendar-day-abbrev-array + (calendar-abbrev-construct calendar-day-name-array))) + (or mcustomized + (setq calendar-month-abbrev-array + (calendar-abbrev-construct calendar-month-name-array))) + (and (not hcustomized) + (boundp 'cal-html-day-abbrev-array) + (setq cal-html-day-abbrev-array calendar-day-abbrev-array)))) + :type 'integer) + +(defcustom calendar-day-abbrev-array + (calendar-abbrev-construct calendar-day-name-array) + "Array of capitalized strings giving the abbreviated day names. The order should be the same as that of the full names specified in `calendar-day-name-array'. These abbreviations may be used instead of the full names in the diary file. Do not include a trailing `.' in the strings specified in this variable, though -you may use such in the diary file. If any element of this array -is nil, then the abbreviation will be constructed as the first -`calendar-abbrev-length' characters of the corresponding full name.") +you may use such in the diary file. By default, each string is +the first `calendar-abbrev-length' characters of the corresponding +full name." + :group 'calendar + :initialize 'custom-initialize-default + :set-after '(calendar-abbrev-length calendar-day-name-array) + :set (lambda (symbol value) + (let ((hcustomized (calendar-customized-p 'cal-html-day-abbrev-array))) + (set symbol value) + (and (not hcustomized) + (boundp 'cal-html-day-abbrev-array) + (setq cal-html-day-abbrev-array calendar-day-abbrev-array)))) + :type '(vector (string :tag "Sun") + (string :tag "Mon") + (string :tag "Tue") + (string :tag "Wed") + (string :tag "Thu") + (string :tag "Fri") + (string :tag "Sat")) + ;; Made defcustom, changed defaults from nil nil... + :version "24.1") (defcustom calendar-month-name-array ["January" "February" "March" "April" "May" "June" "July" "August" "September" "October" "November" "December"] "Array of capitalized strings giving, in order, the month names. -See also the variable `calendar-month-abbrev-array'." +If you change this without using customize after the calendar has loaded, +then you may also want to change `calendar-month-abbrev-array'." :group 'calendar + :initialize 'custom-initialize-default + :set (lambda (symbol value) + (let ((mcustomized (calendar-customized-p + 'calendar-month-abbrev-array))) + (set symbol value) + (or mcustomized + (setq calendar-month-abbrev-array + (calendar-abbrev-construct calendar-month-name-array))))) :type '(vector (string :tag "January") (string :tag "February") (string :tag "March") @@ -2084,46 +2157,54 @@ See also the variable `calendar-month-abbrev-array'." (string :tag "November") (string :tag "December"))) -(defvar calendar-month-abbrev-array - [nil nil nil nil nil nil nil nil nil nil nil nil] - "*Array of capitalized strings giving the abbreviated month names. +(defcustom calendar-month-abbrev-array + (calendar-abbrev-construct calendar-month-name-array) + "Array of capitalized strings giving the abbreviated month names. The order should be the same as that of the full names specified in `calendar-month-name-array'. These abbreviations are used in the calendar menu entries, and can also be used in the diary file. Do not include a trailing `.' in the strings specified in -this variable, though you may use such in the diary file. If any -element of this array is nil, then the abbreviation will be -constructed as the first `calendar-abbrev-length' characters of the -corresponding full name.") - -(defun calendar-make-alist (sequence &optional start-index filter abbrevs) - "Make an assoc list corresponding to SEQUENCE. -Each element of sequence will be associated with an integer, starting -from 1, or from START-INDEX if that is non-nil. If a sequence ABBREVS -is supplied, the function `calendar-abbrev-construct' is used to -construct abbreviations corresponding to the elements in SEQUENCE. -Each abbreviation is entered into the alist with the same -association index as the full name it represents. -If FILTER is provided, apply it to each key in the alist." - (let ((index 0) - (offset (or start-index 1)) - (aseq (if abbrevs (calendar-abbrev-construct abbrevs sequence))) - (aseqp (if abbrevs (calendar-abbrev-construct abbrevs sequence - 'period))) - alist elem) - (dotimes (i (length sequence) (reverse alist)) - (setq index (+ i offset) - elem (elt sequence i) - alist - (cons (cons (if filter (funcall filter elem) elem) index) alist)) - (if aseq - (setq elem (elt aseq i) - alist (cons (cons (if filter (funcall filter elem) elem) - index) alist))) - (if aseqp - (setq elem (elt aseqp i) - alist (cons (cons (if filter (funcall filter elem) elem) - index) alist)))))) +this variable, though you may use such in the diary file. By +default, each string is the first ``calendar-abbrev-length' +characters of the corresponding full name." + :group 'calendar + :set-after '(calendar-abbrev-length calendar-month-name-array) + :type '(vector (string :tag "Jan") + (string :tag "Feb") + (string :tag "Mar") + (string :tag "Apr") + (string :tag "May") + (string :tag "Jun") + (string :tag "Jul") + (string :tag "Aug") + (string :tag "Sep") + (string :tag "Oct") + (string :tag "Nov") + (string :tag "Dec")) + ;; Made defcustom, changed defaults from nil nil... + :version "24.1") + +(defun calendar-make-alist (sequence &optional start-index filter + &rest sequences) + "Return an association list corresponding to SEQUENCE. +Associates each element of SEQUENCE with an incremented integer, +starting from START-INDEX (default 1). Applies the function FILTER, +if provided, to each key in the alist. Repeats the process, with +indices starting from START-INDEX each time, for any remaining +arguments SEQUENCES." + (or start-index (setq start-index 1)) + (let (index alist) + (mapc (lambda (seq) + (setq index start-index) + (mapc (lambda (elem) + (setq alist (cons + (cons (if filter (funcall filter elem) elem) + index) + alist) + index (1+ index))) + seq)) + (append (list sequence) sequences)) + (reverse alist))) (defun calendar-read-date (&optional noday) "Prompt for Gregorian date. Return a list (month day year). @@ -2162,23 +2243,6 @@ Negative years are interpreted as years BC; -1 being 1 BC, and so on." (+ (* 12 (- yr2 yr1)) (- mon2 mon1))) -(defun calendar-abbrev-construct (abbrev full &optional period) - "Internal calendar function to return a complete abbreviation array. -ABBREV is an array of abbreviations, FULL the corresponding array -of full names. The return value is the ABBREV array, with any nil -elements replaced by the first three characters taken from the -corresponding element of FULL. If optional argument PERIOD is non-nil, -each element returned has a final `.' character." - (let (elem array name) - (dotimes (i (length full)) - (setq name (aref full i) - elem (or (aref abbrev i) - (substring name 0 - (min calendar-abbrev-length (length name)))) - elem (format "%s%s" elem (if period "." "")) - array (append array (list elem)))) - (vconcat array))) - (defvar calendar-font-lock-keywords `((,(concat (regexp-opt (mapcar 'identity calendar-month-name-array) t) " -?[0-9]+") @@ -2204,10 +2268,7 @@ be an integer in the range 0 to 6 corresponding to the day of the week. Day names are taken from the variable `calendar-day-name-array', unless the optional argument ABBREV is non-nil, in which case the variable `calendar-day-abbrev-array' is used." - (aref (if abbrev - (calendar-abbrev-construct calendar-day-abbrev-array - calendar-day-name-array) - calendar-day-name-array) + (aref (if abbrev calendar-day-abbrev-array calendar-day-name-array) (if absolute date (calendar-day-of-week date)))) (defun calendar-month-name (month &optional abbrev) @@ -2216,10 +2277,7 @@ Months are numbered from one. Month names are taken from the variable `calendar-month-name-array', unless the optional argument ABBREV is non-nil, in which case `calendar-month-abbrev-array' is used." - (aref (if abbrev - (calendar-abbrev-construct calendar-month-abbrev-array - calendar-month-name-array) - calendar-month-name-array) + (aref (if abbrev calendar-month-abbrev-array calendar-month-name-array) (1- month))) (defun calendar-day-of-week (date) diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 62da7579d50..f21247e9c93 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -1250,19 +1250,15 @@ should ensure that all relevant variables are set. (defun diary-name-pattern (string-array &optional abbrev-array paren) "Return a regexp matching the strings in the array STRING-ARRAY. -If the optional argument ABBREV-ARRAY is present, then the function -`calendar-abbrev-construct' is used to construct abbreviations from the -two supplied arrays. The returned regexp will then also match these -abbreviations, with or without final `.' characters. If the optional -argument PAREN is non-nil, the regexp is surrounded by parentheses." +If the optional argument ABBREV-ARRAY is present, the regexp +also matches the supplied abbreviations, with or without final `.' +characters. If the optional argument PAREN is non-nil, surrounds +the regexp with parentheses." (regexp-opt (append string-array + abbrev-array (if abbrev-array - (calendar-abbrev-construct abbrev-array - string-array)) - (if abbrev-array - (calendar-abbrev-construct abbrev-array - string-array - 'period)) + (mapcar (lambda (e) (format "%s." e)) + abbrev-array)) nil) paren)) @@ -1363,7 +1359,11 @@ function that converts absolute dates to dates of the appropriate type. " (cdr (assoc-string dd-name (calendar-make-alist calendar-day-name-array - 0 nil calendar-day-abbrev-array) t)) marks) + 0 nil calendar-day-abbrev-array + (mapcar (lambda (e) + (format "%s." e)) + calendar-day-abbrev-array)) + t)) marks) (if mm-name (setq mm (if (string-equal mm-name "*") 0 @@ -1372,7 +1372,11 @@ function that converts absolute dates to dates of the appropriate type. " (if months (calendar-make-alist months) (calendar-make-alist calendar-month-name-array - 1 nil calendar-month-abbrev-array)) t))))) + 1 nil calendar-month-abbrev-array + (mapcar (lambda (e) + (format "%s." e)) + calendar-month-abbrev-array))) + t))))) (funcall markfunc mm dd yy marks)))))))) ;;;###cal-autoload @@ -2307,11 +2311,10 @@ Prefix argument ARG makes the entry nonmarking." (defun diary-font-lock-date-forms (month-array &optional symbol abbrev-array) "Create font-lock patterns for `diary-date-forms' using MONTH-ARRAY. -If given, optional SYMBOL must be a prefix to entries. -If optional ABBREV-ARRAY is present, the abbreviations constructed -from this array by the function `calendar-abbrev-construct' are -matched (with or without a final `.'), in addition to the full month -names." +If given, optional SYMBOL must be a prefix to entries. If +optional ABBREV-ARRAY is present, also matches the abbreviations +from this array (with or without a final `.'), in addition to the +full month names." (let ((dayname (diary-name-pattern calendar-day-name-array calendar-day-abbrev-array t)) (monthname (format "\\(%s\\|\\*\\)" diff --git a/lisp/emacs-lisp/authors.el b/lisp/emacs-lisp/authors.el index 163af883334..596b32f24c3 100644 --- a/lisp/emacs-lisp/authors.el +++ b/lisp/emacs-lisp/authors.el @@ -437,7 +437,7 @@ Changes to files in this list are not listed.") ;; No longer distributed. ;;; "vmspaths.h" "build.com" "compile.com" "kepteditor.com" "precomp.com" ;;; "vmsproc.el" :wrote "logout.com" "mailemacs.com") - ("Guillermo J. Rozas" :wrote "fakemail.c") +;;; ("Guillermo J. Rozas" :wrote "fakemail.c") ("Wolfgang Rupprecht" :changed "lisp-mode.el" "loadup.el" "sort.el" "alloc.c" "callint.c" ;; config.in renamed from config.h.in; ecrt0.c from crt0.c. diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 068093159e3..66f30f03eff 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,13 @@ +2011-05-18 Teodor Zlatanov <tzz@lifelogs.com> + + * gnus-registry.el (gnus-registry-user-format-function-M): + Use `mapconcat'. + (gnus-registry-user-format-function-M2): Use to see the full text of + the marks. Make "," the mark text separator. + + * nntp.el (nntp-send-authinfo): Use the "force" token for NNTP + authentication with auth-source. + 2011-05-17 Glenn Morris <rgm@gnu.org> * gnus-group.el (gnus-import-other-newsrc-file): diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index 25d84b11d41..e0efbaf4f30 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el @@ -57,6 +57,16 @@ ;; You should also consider using the nnregistry backend to look up ;; articles. See the Gnus manual for more information. +;; Finally, you can put %uM in your summary line format to show the +;; registry marks if you do this: + +;; show the marks as single characters (see the :char property in +;; `gnus-registry-marks'): +;; (defalias 'gnus-user-format-function-M 'gnus-registry-user-format-function-M) + +;; show the marks by name (see `gnus-registry-marks'): +;; (defalias 'gnus-user-format-function-M 'gnus-registry-user-format-function-M2) + ;; TODO: ;; - get the correct group on spool actions @@ -887,22 +897,26 @@ Uses `gnus-registry-marks' to find what shortcuts to install." nil (cons "Registry Marks" gnus-registry-misc-menus)))))) -;;; use like this: -;;; (defalias 'gnus-user-format-function-M -;;; 'gnus-registry-user-format-function-M) +;; use like this: +;; (defalias 'gnus-user-format-function-M 'gnus-registry-user-format-function-M) (defun gnus-registry-user-format-function-M (headers) + "Show the marks for an article by the :char property" + (let* ((id (mail-header-message-id headers)) + (marks (when id (gnus-registry-get-id-key id 'mark)))) + (mapconcat (lambda (mark) + (plist-get + (cdr-safe + (assoc mark gnus-registry-marks)) + :char)) + marks ""))) + +;; use like this: +;; (defalias 'gnus-user-format-function-M 'gnus-registry-user-format-function-M2) +(defun gnus-registry-user-format-function-M2 (headers) + "Show the marks for an article by name" (let* ((id (mail-header-message-id headers)) (marks (when id (gnus-registry-get-id-key id 'mark)))) - (apply 'concat (mapcar (lambda (mark) - (let ((c - (plist-get - (cdr-safe - (assoc mark gnus-registry-marks)) - :char))) - (if c - (list c) - nil))) - marks)))) + (mapconcat (lambda (mark) (symbol-name mark)) marks ","))) (defun gnus-registry-read-mark () "Read a mark name from the user with completion." diff --git a/lisp/gnus/nntp.el b/lisp/gnus/nntp.el index cdd12abbc06..a8ffc6576ca 100644 --- a/lisp/gnus/nntp.el +++ b/lisp/gnus/nntp.el @@ -1227,17 +1227,20 @@ If SEND-IF-FORCE, only send authinfo to the server if the (require 'netrc) (let* ((list (netrc-parse nntp-authinfo-file)) (alist (netrc-machine list nntp-address "nntp")) - (force (or (netrc-get alist "force") nntp-authinfo-force)) (auth-info (nth 0 (auth-source-search :max 1 ;; TODO: allow the virtual server name too :host nntp-address :port '("119" "nntp")))) (auth-user (plist-get auth-info :user)) + (auth-force (plist-get auth-info :force)) (auth-passwd (plist-get auth-info :secret)) (auth-passwd (if (functionp auth-passwd) (funcall auth-passwd) auth-passwd)) + (force (or (netrc-get alist "force") + nntp-authinfo-force + auth-force)) (user (or ;; this is preferred to netrc-* auth-user diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el index 3ef8a6c4955..b86bdb178f6 100644 --- a/lisp/mail/feedmail.el +++ b/lisp/mail/feedmail.el @@ -13,9 +13,8 @@ ;; A replacement for parts of Emacs' sendmail.el (specifically, ;; it's what handles your outgoing mail after you hit C-c C-c in mail ;; mode). See below for a list of additional features, including the -;; ability to queue messages for later sending. If you are using -;; fakemail as a subprocess, you can switch to feedmail and eliminate -;; the use of fakemail. +;; ability to queue messages for later sending. This replaces +;; the standalone fakemail program that used to be distributed with Emacs. ;; feedmail works with recent versions of Emacs (20.x series) and ;; XEmacs (tested with 20.4 and later betas). It probably no longer @@ -90,12 +89,11 @@ ;; This code does in elisp a superset of the stuff that used to be done ;; by the separate program "fakemail" for processing outbound email. ;; In other words, it takes over after you hit "C-c C-c" in mail mode. -;; By appropriate setting of options, you can still use "fakemail", -;; or you can even revert to sendmail (which is not too popular -;; locally). See the variables at the top of the elisp for how to -;; achieve these effects (there are more features than in this bullet -;; list, so trolling through the variable and function doc strings may -;; be worth your while): +;; By appropriate setting of options, you can even revert to sendmail +;; (which is not too popular locally). See the variables at the top +;; of the elisp for how to achieve these effects (there are more +;; features than in this bullet list, so trolling through the variable +;; and function doc strings may be worth your while): ;; ;; --- you can park outgoing messages into a disk-based queue and ;; stimulate sending them all later (handy for laptop users); diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index ed4270d484c..bbb02d7b978 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -48,9 +48,9 @@ ((file-exists-p "/usr/sbin/sendmail") "/usr/sbin/sendmail") ((file-exists-p "/usr/lib/sendmail") "/usr/lib/sendmail") ((file-exists-p "/usr/ucblib/sendmail") "/usr/ucblib/sendmail") - (t "fakemail"))) ; in lib-src, to interface to /bin/mail + (t "sendmail"))) "Program used to send messages." - :version "24.1" ; added executable-find + :version "24.1" ; add executable-find, remove fakemail :group 'mail :type 'file) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 693e082ecc8..537ccf6da6a 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2838,16 +2838,16 @@ User is always nil." v (cond ((and beg end) - (format "tail -c +%d %s | head -c +%d >%s" - (1+ beg) (tramp-shell-quote-argument localname) + (format "dd bs=1 skip=%d if=%s count=%d of=%s" + beg (tramp-shell-quote-argument localname) (- end beg) remote-copy)) (beg - (format "tail -c +%d %s >%s" - (1+ beg) (tramp-shell-quote-argument localname) + (format "dd bs=1 skip=%d if=%s of=%s" + beg (tramp-shell-quote-argument localname) remote-copy)) (end - (format "head -c +%d %s >%s" - (1+ end) (tramp-shell-quote-argument localname) + (format "dd bs=1 count=%d if=%s of=%s" + end (tramp-shell-quote-argument localname) remote-copy))))) ;; `insert-file-contents-literally' takes care to avoid @@ -3105,8 +3105,13 @@ set, is the starting point of the region to be deleted in the connection buffer." ;; Preserve message for `progress-reporter'. (tramp-compat-with-temp-message "" - ;; Enable auth-source and password-cache. - (tramp-set-connection-property vec "first-password-request" t) + ;; Enable auth-source and password-cache. We must use + ;; tramp-current-* variables in case we have several hops. + (tramp-set-connection-property + (tramp-dissect-file-name + (tramp-make-tramp-file-name + tramp-current-method tramp-current-user tramp-current-host "")) + "first-password-request" t) (save-restriction (let (exit) (while (not exit) @@ -3544,16 +3549,16 @@ Invokes `password-read' if available, `read-passwd' else." ;; Try with Tramp's current method. (if (fboundp 'auth-source-search) (setq auth-info - (tramp-compat-funcall - 'auth-source-search - :max 1 - :user (or tramp-current-user t) - :host tramp-current-host - :port tramp-current-method) - auth-passwd (plist-get (nth 0 auth-info) :secret) - auth-passwd (if (functionp auth-passwd) - (funcall auth-passwd) - auth-passwd)) + (tramp-compat-funcall + 'auth-source-search + :max 1 + :user (or tramp-current-user t) + :host tramp-current-host + :port tramp-current-method) + auth-passwd (plist-get (nth 0 auth-info) :secret) + auth-passwd (if (functionp auth-passwd) + (funcall auth-passwd) + auth-passwd)) (tramp-compat-funcall 'auth-source-user-or-password "password" tramp-current-host tramp-current-method))) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 143220ad28a..3b819a149b2 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -698,6 +698,7 @@ This function is called from `compilation-filter-hook'." grep-hit-face) (set (make-local-variable 'compilation-error-regexp-alist) grep-regexp-alist) + (set (make-local-variable 'compilation-directory-matcher) nil) (set (make-local-variable 'compilation-process-setup-function) 'grep-process-setup) (set (make-local-variable 'compilation-disable-input) t) diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 index 1e81990bda2..cc027a417fa 100644 --- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 @@ -1,4 +1,4 @@ -# inttypes.m4 serial 23 +# inttypes.m4 serial 24 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -13,7 +13,7 @@ AC_DEFUN([gl_INTTYPES_H], gl_INTTYPES_PRI_SCN ]) -AC_DEFUN([gl_INTTYPES_INCOMPLETE], +AC_DEFUN_ONCE([gl_INTTYPES_INCOMPLETE], [ AC_REQUIRE([gl_STDINT_H]) AC_CHECK_HEADERS_ONCE([inttypes.h]) diff --git a/m4/stdint.m4 b/m4/stdint.m4 index dff37fe1bf9..c75e95722a5 100644 --- a/m4/stdint.m4 +++ b/m4/stdint.m4 @@ -1,4 +1,4 @@ -# stdint.m4 serial 40 +# stdint.m4 serial 41 dnl Copyright (C) 2001-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert and Bruno Haible. dnl Test whether <stdint.h> is supported or must be substituted. -AC_DEFUN([gl_STDINT_H], +AC_DEFUN_ONCE([gl_STDINT_H], [ AC_PREREQ([2.59])dnl diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index eeb3360b058..fb6fe077265 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 55 +# unistd_h.m4 serial 56 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -36,8 +36,8 @@ AC_DEFUN([gl_UNISTD_H], ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat fsync ftruncate getcwd getdomainname getdtablesize getgroups gethostname getlogin getlogin_r getpagesize getusershell setusershell - endusershell lchown link linkat lseek pipe pipe2 pread pwrite readlink - readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat + endusershell group_member lchown link linkat lseek pipe pipe2 pread pwrite + readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat usleep]) ]) @@ -72,6 +72,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) + GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER]) GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) @@ -110,6 +111,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) + HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER]) HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) HAVE_LINK=1; AC_SUBST([HAVE_LINK]) HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) diff --git a/nt/ChangeLog b/nt/ChangeLog index 6de2b15fced..7198ba767cb 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,7 @@ +2011-05-17 Eli Zaretskii <eliz@gnu.org> + + * README.W32: Add information about GnuTLS libraries. + 2011-05-09 Eli Zaretskii <eliz@gnu.org> * config.nt [_MSC_VER] (va_copy): Replacement for the MS compiler. diff --git a/nt/README.W32 b/nt/README.W32 index 4e26ef1c8d7..4a3f7c41e9e 100644 --- a/nt/README.W32 +++ b/nt/README.W32 @@ -147,6 +147,15 @@ See the end of the file for license conditions. unreliable under Windows. See nt/INSTALL in the src distribution if you wish to compile Emacs with SVG support. +* GnuTLS support + + In order to support GnuTLS at runtime, Emacs must be able to find + the relevant DLLs during startup; failure to do so is not an error, + but GnuTLS won't be available to the running session. + + You can get pre-built binaries (including any required DLL and the + gnutls.h file) and an installer at http://josefsson.org/gnutls4win/. + * Uninstalling Emacs If you should need to uninstall Emacs, simply delete all the files diff --git a/src/ChangeLog b/src/ChangeLog index fd6f42acb91..372bf383fb8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,114 @@ (BACKWARD_CHAR): Wrap the arg STOP by parenthesis. (find_automatic_composition): Mostly rewrite for efficiency. +2011-05-18 Juanma Barranquero <lekktu@gmail.com> + + * makefile.w32-in: Update dependencies. + +2011-05-18 Christoph Scholtes <cschol2112@googlemail.com> + + * menu.c: Include limits.h (fixes the MS-Windows build broken by + revision 104625). + +2011-05-18 Paul Eggert <eggert@cs.ucla.edu> + + Fix some integer overflow issues, such as string length overflow. + + * insdel.c (count_size_as_multibyte): Check for string overflow. + + * character.c (lisp_string_width): Check for string overflow. + Use EMACS_INT, not int, for string indexes and lengths; in + particular, 2nd arg is now EMACS_INT, not int. Do not crash if + the resulting string length overflows an EMACS_INT; instead, + report a string overflow if no precision given. When checking for + precision exhaustion, use a check that cannot possibly have + integer overflow. (Bug#8675) + * character.h (lisp_string_width): Adjust to new signature. + + * alloc.c (string_overflow): New function. + (Fmake_string): Use it. This doesn't change behavior, but saves + a few bytes and will simplify future changes. + * character.c (string_escape_byte8): Likewise. + * lisp.h (string_overflow): New decl. + + Fixups, following up to the user-interface timestamp change. + * nsterm.m (last_mouse_movement_time, ns_mouse_position): Use Time + for UI timestamps, instead of unsigned long. + * msdos.c (mouse_get_pos): Likewise. + * w32inevt.c (movement_time, w32_console_mouse_position): Likewise. + * w32gui.h (Time): Define by including "systime.h" rather than by + declaring it ourselves. (Bug#8664) + + * dispextern.h (struct image): Don't assume time_t <= unsigned long. + * image.c (clear_image_cache): Likewise. + + * term.c (term_mouse_position): Don't assume time_t wraparound. + + Be more systematic about user-interface timestamps. + Before, the code sometimes used 'Time', sometimes 'unsigned long', + and sometimes 'EMACS_UINT', to represent these timestamps. This + change causes it to use 'Time' uniformly, as that's what X uses. + This makes the code easier to follow, and makes it easier to catch + integer overflow bugs such as Bug#8664. + * frame.c (Fmouse_position, Fmouse_pixel_position): + Use Time, not unsigned long, for user-interface timestamps. + * keyboard.c (last_event_timestamp, kbd_buffer_get_event): Likewise. + (button_down_time, make_lispy_position, make_lispy_movement): Likewise. + * keyboard.h (last_event_timestamp): Likewise. + * menu.c (Fx_popup_menu) [!HAVE_X_WINDOWS]: Likewise. + * menu.h (xmenu_show): Likewise. + * term.c (term_mouse_position): Likewise. + * termhooks.h (struct input_event.timestamp): Likewise. + (struct terminal.mouse_position_hook): Likewise. + * xmenu.c (create_and_show_popup_menu, xmenu_show): Likewise. + * xterm.c (XTmouse_position, x_scroll_bar_report_motion): Likewise. + * systime.h (Time): New decl. Pull it in from <X11/X.h> if + HAVE_X_WINDOWS, otherwise define it as unsigned long, which is + what it was before. + * menu.h, termhooks.h: Include "systime.h", for Time. + + * keyboard.c (make_lispy_event): Fix problem in integer overflow. + Don't assume that the difference between two unsigned long values + can fit into an integer. At this point, we know button_down_time + <= event->timestamp, so the difference must be nonnegative, so + there's no need to cast the result if double-click-time is + nonnegative, as it should be; check that it's nonnegative, just in + case. This bug is triggered when events are more than 2**31 ms + apart (about 25 days). (Bug#8664) + + * xselect.c (last_event_timestamp): Remove duplicate decl. + (x_own_selection): Remove needless cast to unsigned long. + + * xmenu.c (set_frame_menubar): Use int, not EMACS_UINT, for indexes + that always fit in int. Use a sentinel instead of a counter, to + avoid a temp and to allay GCC's concerns about possible int overflow. + * frame.h (struct frame): Use int for menu_bar_items_used + instead of EMACS_INT, since it always fits in int. + + * menu.c (grow_menu_items): Check for int overflow. + + * xmenu.c (set_frame_menubar): Don't mishandle vectors with no nils. + + * xterm.c: Use EMACS_INT for Emacs modifiers, and int for X modifiers. + Before, the code was not consistent. These values cannot exceed + 2**31 - 1 so there's no need to make them unsigned. + (x_x_to_emacs_modifiers): Accept int and return EMACS_INT. + (x_emacs_to_x_modifiers): Accept EMACS_INT and return int. + (x_x_to_emacs_modifiers, x_emacs_to_x_modifiers): Reject non-integers + as modifiers. + * xterm.h (x_x_to_emacs_modifiers): Adjust to signature change. + + * lisp.h (XINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_INT. + (XUINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_UINT. + Otherwise, GCC 4.6.0 warns about printf (pI, XINT (...)), + presumably because the widths might not match. + + * window.c (size_window): Avoid needless test at loop start. + +2011-05-18 Courtney Bane <emacs-bugs-7626@cbane.org> (tiny change) + + * term.c (Fresume_tty): Restore hooks before reinitializing (bug#8687). + 2011-05-12 Drew Adams <drew.adams@oracle.com> * textprop.c (Fprevious_single_char_property_change): Doc fix (bug#8655). @@ -14,8 +122,8 @@ `width' to `bar_area_x' and `bar_area_width', respectively. (x_scroll_run): Take account of fringe background extension. - * xterm.c (x_draw_fringe_bitmap) [USE_TOOLKIT_SCROLL_BARS]: Rename - local vars `left' and `width' to `bar_area_x' and + * xterm.c (x_draw_fringe_bitmap) [USE_TOOLKIT_SCROLL_BARS]: + Rename local vars `left' and `width' to `bar_area_x' and `bar_area_width', respectively. (x_scroll_run) [USE_TOOLKIT_SCROLL_BARS]: Take account of fringe background extension. @@ -132,8 +240,8 @@ * dbusbind.c: Do not use XPNTR on a value that may be an integer. Reported by Stefan Monnier in <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00919.html>. - (xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages): Use - SYMBOLP-guarded XSYMBOL, not XPNTR. + (xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages): + Use SYMBOLP-guarded XSYMBOL, not XPNTR. * lisp.h (EMACS_INTPTR): Remove. All uses changed to intptr_t. (EMACS_UINTPTR): Likewise, with uintptr_t. @@ -319,8 +427,8 @@ * callproc.c: Indentation fixup. * sysdep.c (wait_for_termination_1): Make static. - (wait_for_termination, interruptible_wait_for_termination): Move - after wait_for_termination_1. + (wait_for_termination, interruptible_wait_for_termination): + Move after wait_for_termination_1. 2011-05-01 Lars Magne Ingebrigtsen <larsi@gnus.org> @@ -436,8 +544,8 @@ (emacs_gnutls_write): Don't use uninitialized rtnval if nbyte <= 0. * lisp.h: Fix a problem with aliasing and vector headers. (Bug#8546) - GCC 4.6.0 optimizes based on type-based alias analysis. For - example, if b is of type struct buffer * and v of type struct + GCC 4.6.0 optimizes based on type-based alias analysis. + For example, if b is of type struct buffer * and v of type struct Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size != &v->size, and therefore "v->size = 1; b->size = 2; return v->size;" must therefore return 1. This assumption is incorrect @@ -457,8 +565,8 @@ (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR. (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE, since Lisp_Subr is a special case (no "next" field). - (ASIZE): Now uses header.size rather than size. All - previous uses of XVECTOR (foo)->size replaced to use this macro, + (ASIZE): Now uses header.size rather than size. + All previous uses of XVECTOR (foo)->size replaced to use this macro, to avoid the hassle of writing XVECTOR (foo)->header.size. (struct vectorlike_header): New type. (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the @@ -507,7 +615,7 @@ Break out the floating-point parsing into a new function string_to_number, so that Fstring_to_number parses floating point numbers consistently with the Lisp reader. - (digit_to_number): Moved here from data.c. Make it static inline. + (digit_to_number): Move here from data.c. Make it static inline. (E_CHAR, EXP_INT): Remove, replacing with ... (E_EXP): New macro, to solve the "1.0e+" problem mentioned below. (string_to_number): New function, replacing isfloat_string. @@ -744,8 +852,8 @@ Fix doprnt so it could be used again safely in `verror'. (Bug#8435) * doprnt.c: Include limits.h. (SIZE_MAX): New macro. - (doprnt): Return a size_t value. 2nd arg is now size_t. Many - local variables are now size_t instead of int or unsigned. + (doprnt): Return a size_t value. 2nd arg is now size_t. + Many local variables are now size_t instead of int or unsigned. Improve overflow protection. Support `l' modifier for integer conversions. Support %l conversion. Don't assume an EMACS_INT argument for integer conversions and for %c. @@ -946,8 +1054,8 @@ * syntax.c (update_syntax_table): Declare 2nd argument EMACS_INT. - * textprop.c (verify_interval_modification, interval_of): Declare - arguments EMACS_INT. + * textprop.c (verify_interval_modification, interval_of): + Declare arguments EMACS_INT. * intervals.c (adjust_intervals_for_insertion): Declare arguments EMACS_INT. @@ -1198,8 +1306,8 @@ (free_realized_fontset) #if-0 the body, which does nothing. (face_suitable_for_char_p): #if-0, as it's never called. * fontset.h (face_suitable_for_char_p): Remove decl. - * xfaces.c (face_at_string_position): Use - FACE_SUITABLE_FOR_ASCII_CHAR_P, not FACE_SUITABLE_FOR_CHAR_P, + * xfaces.c (face_at_string_position): + Use FACE_SUITABLE_FOR_ASCII_CHAR_P, not FACE_SUITABLE_FOR_CHAR_P, since 0 is always ASCII. * fns.c (weak_hash_tables): Now static. @@ -1308,8 +1416,8 @@ (last_point_position_window): Remove decls. * keyboard.c: Make these variables static. - * coding.h (coding, code_convert_region, encode_coding_gap): Remove - decls. + * coding.h (coding, code_convert_region, encode_coding_gap): + Remove decls. * coding.c (Vsjis_coding_system, Vbig5_coding_system): (iso_code_class, detect_coding, code_convert_region): Now static. (encode_coding_gap): Remove; unused. @@ -1340,7 +1448,7 @@ exported only to the debugger. * atimer.c (alarm_signal_handler, run_all_atimers): Now static. - * atimer.h (run_all_atimers): Removed; not exported. + * atimer.h (run_all_atimers): Remove; not exported. font.c: Make copy_font_spec and merge_font_spec ordinary C functions. * font.c (copy_font_spec): Rename from Fcopy_font_spec, since it @@ -1595,8 +1703,8 @@ 2011-04-09 Chong Yidong <cyd@stupidchicken.com> - * ftfont.c (get_adstyle_property, ftfont_pattern_entity): Use - unsigned char, to match FcChar8 type definition. + * ftfont.c (get_adstyle_property, ftfont_pattern_entity): + Use unsigned char, to match FcChar8 type definition. * xterm.c (handle_one_xevent): * xmenu.c (create_and_show_popup_menu): @@ -1669,8 +1777,8 @@ 2011-04-06 Chong Yidong <cyd@stupidchicken.com> - * process.c (Flist_processes): Removed to Lisp. - (list_processes_1): Deleted. + * process.c (Flist_processes): Remove to Lisp. + (list_processes_1): Delete. 2011-04-06 Eli Zaretskii <eliz@gnu.org> @@ -1928,8 +2036,8 @@ * callint.c (Fcall_interactively): Preserve lexical-binding mode for interactive spec. - * bytecode.c (Bstack_ref, Bstack_set, Bstack_set2, BdiscardN): New - byte-codes. + * bytecode.c (Bstack_ref, Bstack_set, Bstack_set2, BdiscardN): + New byte-codes. (exec_byte_code): New function extracted from Fbyte_code to handle new calling convention for byte-code-functions. Add new byte-codes. @@ -1944,8 +2052,8 @@ 2011-03-31 Eli Zaretskii <eliz@gnu.org> * xdisp.c (SCROLL_LIMIT): New macro. - (try_scrolling): Use it when setting scroll_limit. Limit - scrolling to 100 screen lines. + (try_scrolling): Use it when setting scroll_limit. + Limit scrolling to 100 screen lines. (redisplay_window): Even when falling back on "recentering", position point in the window according to scroll-conservatively, scroll-margin, and scroll-*-aggressively variables. (Bug#6671) diff --git a/src/alloc.c b/src/alloc.c index 0bce83bfae7..71ab54bcab5 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2174,6 +2174,11 @@ compact_small_strings (void) current_sblock = tb; } +void +string_overflow (void) +{ + error ("Maximum string size exceeded"); +} DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0, doc: /* Return a newly created string of length LENGTH, with INIT in each element. @@ -2206,7 +2211,7 @@ INIT must be an integer that represents a character. */) EMACS_INT string_len = XINT (length); if (string_len > MOST_POSITIVE_FIXNUM / len) - error ("Maximum string size exceeded"); + string_overflow (); nbytes = len * string_len; val = make_uninit_multibyte_string (string_len, nbytes); p = SDATA (val); diff --git a/src/character.c b/src/character.c index 64ea2625abb..b9595f97ec7 100644 --- a/src/character.c +++ b/src/character.c @@ -35,6 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <sys/types.h> #include <setjmp.h> +#include <intprops.h> #include "lisp.h" #include "character.h" #include "buffer.h" @@ -404,7 +405,7 @@ strwidth (const char *str, EMACS_INT len) in *NCHARS and *NBYTES respectively. */ EMACS_INT -lisp_string_width (Lisp_Object string, int precision, +lisp_string_width (Lisp_Object string, EMACS_INT precision, EMACS_INT *nchars, EMACS_INT *nbytes) { EMACS_INT len = SCHARS (string); @@ -419,7 +420,7 @@ lisp_string_width (Lisp_Object string, int precision, while (i < len) { - int chars, bytes, thiswidth; + EMACS_INT chars, bytes, thiswidth; Lisp_Object val; int cmp_id; EMACS_INT ignore, end; @@ -437,7 +438,11 @@ lisp_string_width (Lisp_Object string, int precision, int c; if (multibyte) - c = STRING_CHAR_AND_LENGTH (str + i_byte, bytes); + { + int cbytes; + c = STRING_CHAR_AND_LENGTH (str + i_byte, cbytes); + bytes = cbytes; + } else c = str[i_byte], bytes = 1; chars = 1; @@ -455,8 +460,14 @@ lisp_string_width (Lisp_Object string, int precision, } } - if (precision > 0 - && (width + thiswidth > precision)) + if (precision <= 0) + { +#ifdef emacs + if (INT_ADD_OVERFLOW (width, thiswidth)) + string_overflow (); +#endif + } + else if (precision - width < thiswidth) { *nchars = i; *nbytes = i_byte; @@ -465,7 +476,7 @@ lisp_string_width (Lisp_Object string, int precision, i += chars; i_byte += bytes; width += thiswidth; - } + } if (precision > 0) { @@ -672,7 +683,7 @@ parse_str_to_multibyte (const unsigned char *str, EMACS_INT len) } -/* Convert unibyte text at STR of NBYTES bytes to a multibyte text +/* Convert unibyte text at STR of BYTES bytes to a multibyte text that contains the same single-byte characters. It actually converts all 8-bit characters to multibyte forms. It is assured that we can use LEN bytes at STR as a work area and that is @@ -823,7 +834,7 @@ string_escape_byte8 (Lisp_Object string) { if ((MOST_POSITIVE_FIXNUM - nchars) / 3 < byte8_count || (MOST_POSITIVE_FIXNUM - nbytes) / 2 < byte8_count) - error ("Maximum string size exceeded"); + string_overflow (); /* Convert 2-byte sequence of byte8 chars to 4-byte octal. */ val = make_uninit_multibyte_string (nchars + byte8_count * 3, @@ -832,7 +843,8 @@ string_escape_byte8 (Lisp_Object string) else { if ((MOST_POSITIVE_FIXNUM - nchars) / 3 < byte8_count) - error ("Maximum string size exceeded"); + string_overflow (); + /* Convert 1-byte sequence of byte8 chars to 4-byte octal. */ val = make_uninit_string (nbytes + byte8_count * 3); } diff --git a/src/character.h b/src/character.h index 864882db7f6..5877d145d9e 100644 --- a/src/character.h +++ b/src/character.h @@ -612,7 +612,7 @@ extern EMACS_INT str_to_unibyte (const unsigned char *, unsigned char *, extern EMACS_INT strwidth (const char *, EMACS_INT); extern EMACS_INT c_string_width (const unsigned char *, EMACS_INT, int, EMACS_INT *, EMACS_INT *); -extern EMACS_INT lisp_string_width (Lisp_Object, int, +extern EMACS_INT lisp_string_width (Lisp_Object, EMACS_INT, EMACS_INT *, EMACS_INT *); extern Lisp_Object Qcharacterp; diff --git a/src/dispextern.h b/src/dispextern.h index 72e23e6642a..77c45cf2fc6 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2709,7 +2709,7 @@ struct image { /* The time in seconds at which the image was last displayed. Set in prepare_image_for_display. */ - unsigned long timestamp; + time_t timestamp; /* Pixmaps of the image. */ Pixmap pixmap, mask; diff --git a/src/fns.c b/src/fns.c index 47ded456c6e..16dc0fe0de2 100644 --- a/src/fns.c +++ b/src/fns.c @@ -457,10 +457,10 @@ concat (size_t nargs, Lisp_Object *args, Lisp_Object prev; int some_multibyte; /* When we make a multibyte string, we can't copy text properties - while concatinating each string because the length of resulting - string can't be decided until we finish the whole concatination. + while concatenating each string because the length of resulting + string can't be decided until we finish the whole concatenation. So, we record strings that have text properties to be copied - here, and copy the text properties after the concatination. */ + here, and copy the text properties after the concatenation. */ struct textprop_rec *textprops = NULL; /* Number of elements in textprops. */ int num_textprops = 0; @@ -704,7 +704,7 @@ concat (size_t nargs, Lisp_Object *args, make_number (0), make_number (SCHARS (this)), Qnil); - /* If successive arguments have properites, be sure that the + /* If successive arguments have properties, be sure that the value of `composition' property be the copy. */ if (last_to_end == textprops[argnum].to) make_composition_value_copy (props); @@ -2076,7 +2076,7 @@ internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int return compare_window_configurations (o1, o2, 0); /* Aside from them, only true vectors, char-tables, compiled - functions, and fonts (font-spec, font-entity, font-ojbect) + functions, and fonts (font-spec, font-entity, font-object) are sensible to compare, so eliminate the others now. */ if (size & PSEUDOVECTOR_FLAG) { @@ -2782,7 +2782,7 @@ ITEM should be one of the following: `months', returning a 12-element vector of month names (locale items MON_n); `paper', returning a list (WIDTH HEIGHT) for the default paper size, - both measured in milimeters (locale items PAPER_WIDTH, PAPER_HEIGHT). + both measured in millimeters (locale items PAPER_WIDTH, PAPER_HEIGHT). If the system can't provide such information through a call to `nl_langinfo', or if ITEM isn't from the list above, return nil. diff --git a/src/frame.c b/src/frame.c index b106c568e48..ce92a83b86c 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1631,7 +1631,7 @@ and returns whatever that function returns. */) enum scroll_bar_part party_dummy; Lisp_Object x, y, retval; int col, row; - unsigned long long_dummy; + Time long_dummy; struct gcpro gcpro1; f = SELECTED_FRAME (); @@ -1676,7 +1676,7 @@ and nil for X and Y. */) Lisp_Object lispy_dummy; enum scroll_bar_part party_dummy; Lisp_Object x, y; - unsigned long long_dummy; + Time long_dummy; f = SELECTED_FRAME (); x = y = Qnil; diff --git a/src/frame.h b/src/frame.h index e73370340f1..db57b1be980 100644 --- a/src/frame.h +++ b/src/frame.h @@ -192,7 +192,7 @@ struct frame struct face_cache *face_cache; /* Number of elements in `menu_bar_vector' that have meaningful data. */ - EMACS_INT menu_bar_items_used; + int menu_bar_items_used; /* A buffer to hold the frame's name. We can't use the Lisp string's pointer (`name', above) because it might get relocated. */ diff --git a/src/image.c b/src/image.c index 23da03b6264..2562d79a782 100644 --- a/src/image.c +++ b/src/image.c @@ -1523,7 +1523,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter) { /* Free cache based on timestamp. */ EMACS_TIME t; - unsigned long old; + time_t old; int delay, nimages = 0; for (i = 0; i < c->used; ++i) diff --git a/src/insdel.c b/src/insdel.c index 2662858c2a1..de9e8aa570a 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -20,6 +20,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <setjmp.h> + +#include <intprops.h> + #include "lisp.h" #include "intervals.h" #include "buffer.h" @@ -581,14 +584,19 @@ count_size_as_multibyte (const unsigned char *ptr, EMACS_INT nbytes) for (i = 0; i < nbytes; i++) { unsigned int c = *ptr++; + int n; if (ASCII_CHAR_P (c)) - outgoing_nbytes++; + n = 1; else { c = BYTE8_TO_CHAR (c); - outgoing_nbytes += CHAR_BYTES (c); + n = CHAR_BYTES (c); } + + if (INT_ADD_OVERFLOW (outgoing_nbytes, n)) + string_overflow (); + outgoing_nbytes += n; } return outgoing_nbytes; diff --git a/src/keyboard.c b/src/keyboard.c index a94456fce2e..c471a91ebfb 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -238,7 +238,7 @@ Lisp_Object internal_last_event_frame; /* The timestamp of the last input event we received from the X server. X Windows wants this for selection ownership. */ -unsigned long last_event_timestamp; +Time last_event_timestamp; static Lisp_Object Qx_set_selection, Qhandle_switch_frame; Lisp_Object QPRIMARY; @@ -4085,7 +4085,7 @@ kbd_buffer_get_event (KBOARD **kbp, Lisp_Object bar_window; enum scroll_bar_part part; Lisp_Object x, y; - unsigned long t; + Time t; *kbp = current_kboard; /* Note that this uses F to determine which terminal to look at. @@ -5088,7 +5088,7 @@ static Lisp_Object button_down_location; static int last_mouse_button; static int last_mouse_x; static int last_mouse_y; -static unsigned long button_down_time; +static Time button_down_time; /* The number of clicks in this multiple-click. */ @@ -5099,7 +5099,7 @@ static int double_click_count; static Lisp_Object make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, - unsigned long t) + Time t) { enum window_part part; Lisp_Object posn = Qnil; @@ -5556,9 +5556,9 @@ make_lispy_event (struct input_event *event) && (eabs (XINT (event->y) - last_mouse_y) <= fuzz) && button_down_time != 0 && (EQ (Vdouble_click_time, Qt) - || (INTEGERP (Vdouble_click_time) - && ((int)(event->timestamp - button_down_time) - < XINT (Vdouble_click_time))))); + || (NATNUMP (Vdouble_click_time) + && (event->timestamp - button_down_time + < XFASTINT (Vdouble_click_time))))); } last_mouse_button = button; @@ -5742,9 +5742,9 @@ make_lispy_event (struct input_event *event) && (eabs (XINT (event->y) - last_mouse_y) <= fuzz) && button_down_time != 0 && (EQ (Vdouble_click_time, Qt) - || (INTEGERP (Vdouble_click_time) - && ((int)(event->timestamp - button_down_time) - < XINT (Vdouble_click_time))))); + || (NATNUMP (Vdouble_click_time) + && (event->timestamp - button_down_time + < XFASTINT (Vdouble_click_time))))); if (is_double) { double_click_count++; @@ -5987,7 +5987,7 @@ make_lispy_event (struct input_event *event) static Lisp_Object make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part, - Lisp_Object x, Lisp_Object y, unsigned long t) + Lisp_Object x, Lisp_Object y, Time t) { /* Is it a scroll bar movement? */ if (frame && ! NILP (bar_window)) diff --git a/src/keyboard.h b/src/keyboard.h index 1f5cbd23639..802c99edb5e 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -16,7 +16,7 @@ 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 <http://www.gnu.org/licenses/>. */ -#include "systime.h" /* for EMACS_TIME */ +#include "systime.h" /* for EMACS_TIME, Time */ #include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ /* Lisp fields in struct keyboard are hidden from most code and accessed @@ -459,7 +459,7 @@ extern Lisp_Object Qevent_symbol_element_mask; /* The timestamp of the last input event we received from the X server. X Windows wants this for selection ownership. */ -extern unsigned long last_event_timestamp; +extern Time last_event_timestamp; extern int quit_char; diff --git a/src/lisp.h b/src/lisp.h index 66f5c962be8..b6bf2bdb502 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -470,8 +470,8 @@ enum pvec_type #define XHASH(a) ((a).i) #define XTYPE(a) ((enum Lisp_Type) (a).u.type) -#define XINT(a) ((a).s.val) -#define XUINT(a) ((a).u.val) +#define XINT(a) ((EMACS_INT) (a).s.val) +#define XUINT(a) ((EMACS_UINT) (a).u.val) #ifdef USE_LSB_TAG @@ -2710,6 +2710,7 @@ EXFUN (Fmake_vector, 2); EXFUN (Fvector, MANY); EXFUN (Fmake_symbol, 1); EXFUN (Fmake_marker, 0); +extern void string_overflow (void) NO_RETURN; EXFUN (Fmake_string, 2); extern Lisp_Object build_string (const char *); extern Lisp_Object make_string (const char *, EMACS_INT); diff --git a/src/makefile.w32-in b/src/makefile.w32-in index e19a19645f9..71c4fa4c0ac 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -397,6 +397,7 @@ PROCESS_H = $(SRC)/process.h \ $(BLD)/alloc.$(O) : \ $(SRC)/alloc.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(PROCESS_H) \ @@ -432,12 +433,14 @@ $(BLD)/atimer.$(O) : \ $(BLD)/bidi.$(O) : \ $(SRC)/bidi.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(SRC)/bidimirror.h \ $(SRC)/biditype.h \ $(SRC)/buffer.h \ $(SRC)/character.h \ $(SRC)/dispextern.h \ + $(SRC)/systime.h \ $(SRC)/w32gui.h $(BLD)/buffer.$(O) : \ @@ -468,11 +471,13 @@ $(BLD)/buffer.$(O) : \ $(BLD)/bytecode.$(O) : \ $(SRC)/bytecode.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(SRC)/buffer.h \ $(SRC)/character.h \ $(SRC)/dispextern.h \ $(SRC)/syntax.h \ + $(SRC)/systime.h \ $(SRC)/w32gui.h \ $(SRC)/window.h @@ -496,6 +501,7 @@ $(BLD)/callint.$(O) : \ $(BLD)/callproc.$(O) : \ $(SRC)/callproc.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ @@ -560,6 +566,7 @@ $(BLD)/ccl.$(O) : \ $(BLD)/character.$(O) : \ $(SRC)/character.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/lib/intprops.h \ $(LISP_H) \ $(SRC)/buffer.h \ $(SRC)/character.h \ @@ -609,6 +616,7 @@ $(BLD)/cmds.$(O) : \ $(BLD)/coding.$(O) : \ $(SRC)/coding.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(SRC)/buffer.h \ $(SRC)/ccl.h \ @@ -618,6 +626,7 @@ $(BLD)/coding.$(O) : \ $(SRC)/composite.h \ $(SRC)/dispextern.h \ $(SRC)/frame.h \ + $(SRC)/systime.h \ $(SRC)/termhooks.h \ $(SRC)/w32gui.h \ $(SRC)/window.h @@ -625,6 +634,7 @@ $(BLD)/coding.$(O) : \ $(BLD)/composite.$(O) : \ $(SRC)/composite.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(SRC)/buffer.h \ $(SRC)/ccl.h \ @@ -635,6 +645,7 @@ $(BLD)/composite.$(O) : \ $(SRC)/font.h \ $(SRC)/frame.h \ $(SRC)/intervals.h \ + $(SRC)/systime.h \ $(SRC)/termhooks.h \ $(SRC)/w32gui.h \ $(SRC)/window.h @@ -684,6 +695,7 @@ $(BLD)/dired.$(O) : \ $(BLD)/dispnew.$(O) : \ $(SRC)/dispnew.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(PROCESS_H) \ @@ -758,6 +770,7 @@ $(BLD)/editfns.$(O) : \ $(BLD)/emacs.$(O) : \ $(SRC)/emacs.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ @@ -873,6 +886,7 @@ $(BLD)/fns.$(O) : \ $(BLD)/font.$(O) : \ $(SRC)/font.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(SRC)/buffer.h \ $(SRC)/ccl.h \ @@ -883,6 +897,7 @@ $(BLD)/font.$(O) : \ $(SRC)/font.h \ $(SRC)/fontset.h \ $(SRC)/frame.h \ + $(SRC)/systime.h \ $(SRC)/w32gui.h \ $(SRC)/w32term.h \ $(SRC)/window.h @@ -961,6 +976,7 @@ $(BLD)/gmalloc.$(O) : \ $(BLD)/gnutls.$(O) : \ $(SRC)/gnutls.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/unistd.h \ $(LISP_H) \ $(PROCESS_H) \ $(SRC)/w32.h @@ -1015,6 +1031,7 @@ $(BLD)/insdel.$(O) : \ $(SRC)/insdel.c \ $(CONFIG_H) \ $(EMACS_ROOT)/nt/inc/sys/time.h \ + $(EMACS_ROOT)/lib/intprops.h \ $(LISP_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ @@ -1048,6 +1065,7 @@ $(BLD)/intervals.$(O) : \ $(BLD)/keyboard.$(O) : \ $(SRC)/keyboard.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ @@ -1198,6 +1216,7 @@ $(BLD)/w32.$(O) : \ $(CONFIG_H) \ $(EMACS_ROOT)/nt/inc/grp.h \ $(EMACS_ROOT)/nt/inc/pwd.h \ + $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ $(EMACS_ROOT)/nt/inc/sys/socket.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ @@ -1243,6 +1262,7 @@ $(BLD)/w32proc.$(O) : \ $(CONFIG_H) \ $(EMACS_ROOT)/nt/inc/langinfo.h \ $(EMACS_ROOT)/nt/inc/nl_types.h \ + $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ @@ -1262,6 +1282,7 @@ $(BLD)/w32proc.$(O) : \ $(BLD)/w32console.$(O) : \ $(SRC)/w32console.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(SRC)/character.h \ $(SRC)/coding.h \ @@ -1269,6 +1290,7 @@ $(BLD)/w32console.$(O) : \ $(SRC)/dispextern.h \ $(SRC)/disptab.h \ $(SRC)/frame.h \ + $(SRC)/systime.h \ $(SRC)/termchar.h \ $(SRC)/termhooks.h \ $(SRC)/w32gui.h \ @@ -1277,6 +1299,7 @@ $(BLD)/w32console.$(O) : \ $(BLD)/print.$(O) : \ $(SRC)/print.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(EMACS_ROOT)/lib/ftoastr.h \ $(EMACS_ROOT)/lib/intprops.h \ @@ -1305,6 +1328,7 @@ $(BLD)/process.$(O) : \ $(SRC)/process.c \ $(CONFIG_H) \ $(EMACS_ROOT)/nt/inc/netdb.h \ + $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/arpa/inet.h \ $(EMACS_ROOT)/nt/inc/netinet/in.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ @@ -1414,6 +1438,7 @@ $(BLD)/sound.$(O) : \ $(BLD)/syntax.$(O) : \ $(SRC)/syntax.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(SRC)/buffer.h \ $(SRC)/category.h \ @@ -1425,6 +1450,7 @@ $(BLD)/syntax.$(O) : \ $(SRC)/keymap.h \ $(SRC)/regex.h \ $(SRC)/syntax.h \ + $(SRC)/systime.h \ $(SRC)/w32gui.h $(BLD)/sysdep.$(O) : \ @@ -1433,6 +1459,7 @@ $(BLD)/sysdep.$(O) : \ $(EMACS_ROOT)/nt/inc/grp.h \ $(EMACS_ROOT)/nt/inc/netdb.h \ $(EMACS_ROOT)/nt/inc/pwd.h \ + $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/socket.h \ @@ -1513,11 +1540,13 @@ $(BLD)/terminal.$(O) : \ $(BLD)/textprop.$(O) : \ $(SRC)/textprop.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(SRC)/buffer.h \ $(SRC)/composite.h \ $(SRC)/dispextern.h \ $(SRC)/intervals.h \ + $(SRC)/systime.h \ $(SRC)/w32gui.h \ $(SRC)/window.h @@ -1530,10 +1559,12 @@ $(BLD)/tparam.$(O) : \ $(BLD)/undo.$(O) : \ $(SRC)/undo.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(SRC)/buffer.h \ $(SRC)/commands.h \ $(SRC)/dispextern.h \ + $(SRC)/systime.h \ $(SRC)/w32gui.h \ $(SRC)/window.h @@ -1577,6 +1608,7 @@ $(BLD)/window.$(O) : \ $(BLD)/xdisp.$(O) : \ $(SRC)/xdisp.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(PROCESS_H) \ @@ -1689,6 +1721,7 @@ $(BLD)/w32menu.$(O) : \ $(BLD)/w32term.$(O) : \ $(SRC)/w32term.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ @@ -1768,6 +1801,7 @@ $(BLD)/w32xfns.$(O) : \ $(BLD)/w32font.$(O) : \ $(SRC)/w32font.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(SRC)/ccl.h \ $(SRC)/character.h \ @@ -1778,6 +1812,7 @@ $(BLD)/w32font.$(O) : \ $(SRC)/font.h \ $(SRC)/fontset.h \ $(SRC)/frame.h \ + $(SRC)/systime.h \ $(SRC)/w32font.h \ $(SRC)/w32gui.h \ $(SRC)/w32term.h @@ -1785,6 +1820,7 @@ $(BLD)/w32font.$(O) : \ $(BLD)/w32uniscribe.$(O) : \ $(SRC)/w32uniscribe.c \ $(CONFIG_H) \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ $(LISP_H) \ $(SRC)/ccl.h \ $(SRC)/character.h \ @@ -1794,6 +1830,7 @@ $(BLD)/w32uniscribe.$(O) : \ $(SRC)/font.h \ $(SRC)/fontset.h \ $(SRC)/frame.h \ + $(SRC)/systime.h \ $(SRC)/w32font.h \ $(SRC)/w32gui.h \ $(SRC)/w32term.h diff --git a/src/menu.c b/src/menu.c index 7a3edcb6f4f..e4338f349f6 100644 --- a/src/menu.c +++ b/src/menu.c @@ -21,6 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <stdio.h> #include <setjmp.h> +#include <limits.h> /* for INT_MAX */ #include "lisp.h" #include "keyboard.h" @@ -176,6 +177,8 @@ save_menu_items (void) static void grow_menu_items (void) { + if ((INT_MAX - MENU_ITEMS_PANE_LENGTH) / 2 < menu_items_allocated) + memory_full (); menu_items_allocated *= 2; menu_items = larger_vector (menu_items, menu_items_allocated, Qnil); } @@ -1145,13 +1148,13 @@ no quit occurs and `x-popup-menu' returns nil. */) #else /* not HAVE_X_WINDOWS */ Lisp_Object bar_window; enum scroll_bar_part part; - unsigned long time; + Time time; void (*mouse_position_hook) (struct frame **, int, Lisp_Object *, enum scroll_bar_part *, Lisp_Object *, Lisp_Object *, - unsigned long *) = + Time *) = FRAME_TERMINAL (new_f)->mouse_position_hook; if (mouse_position_hook) diff --git a/src/menu.h b/src/menu.h index c3978dae8eb..451401b42d5 100644 --- a/src/menu.h +++ b/src/menu.h @@ -19,6 +19,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MENU_H #define MENU_H +#include "systime.h" /* for Time */ + extern void x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval); @@ -48,6 +50,5 @@ extern Lisp_Object w32_menu_show (FRAME_PTR, int, int, int, int, extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, int, int, Lisp_Object, const char **); extern Lisp_Object xmenu_show (FRAME_PTR, int, int, int, int, - Lisp_Object, const char **, EMACS_UINT); + Lisp_Object, const char **, Time); #endif /* MENU_H */ - diff --git a/src/msdos.c b/src/msdos.c index 3dc586e42f5..73804df55cc 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -287,7 +287,7 @@ mouse_button_depressed (int b, int *xp, int *yp) void mouse_get_pos (FRAME_PTR *f, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, - unsigned long *time) + Time *time) { int ix, iy; Lisp_Object frame, tail; diff --git a/src/nsterm.m b/src/nsterm.m index c4756dc83cd..ac9c44a57a9 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -158,7 +158,7 @@ long context_menu_value = 0; /* display update */ NSPoint last_mouse_motion_position; static NSRect last_mouse_glyph; -static unsigned long last_mouse_movement_time = 0; +static Time last_mouse_movement_time = 0; static Lisp_Object last_mouse_motion_frame; static EmacsScroller *last_mouse_scroll_bar = nil; static struct frame *ns_updating_frame; @@ -1789,7 +1789,7 @@ note_mouse_movement (struct frame *frame, float x, float y) static void ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, - unsigned long *time) + Time *time) /* -------------------------------------------------------------------------- External (hook): inform emacs about mouse position and hit parts. If a scrollbar is being dragged, set bar_window, part, x, y, time. @@ -6531,5 +6531,3 @@ baseline level. The default value is nil. */); /* Tell emacs about this window system. */ Fprovide (intern ("ns"), Qnil); } - - diff --git a/src/systime.h b/src/systime.h index cb1ea230f7d..db43b26dc5e 100644 --- a/src/systime.h +++ b/src/systime.h @@ -30,6 +30,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #endif #endif +#ifdef HAVE_X_WINDOWS +# include <X11/X.h> +#else +typedef unsigned long Time; +#endif + #ifdef HAVE_TZNAME #ifndef tzname /* For SGI. */ extern char *tzname[]; /* RS6000 and others want it this way. */ diff --git a/src/term.c b/src/term.c index c68228cc51a..9205719b5f4 100644 --- a/src/term.c +++ b/src/term.c @@ -2595,6 +2595,7 @@ frame's terminal). */) FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1); } + set_tty_hooks (t); init_sys_modes (t->display_info.tty); { @@ -2698,9 +2699,10 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event) static void term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, - Lisp_Object *y, unsigned long *timeptr) + Lisp_Object *y, Time *timeptr) { struct timeval now; + Time sec, usec; *fp = SELECTED_FRAME (); (*fp)->mouse_moved = 0; @@ -2711,7 +2713,9 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, XSETINT (*x, last_mouse_x); XSETINT (*y, last_mouse_y); gettimeofday(&now, 0); - *timeptr = (now.tv_sec * 1000) + (now.tv_usec / 1000); + sec = now.tv_sec; + usec = now.tv_usec; + *timeptr = (sec * 1000) + (usec / 1000); } /* Prepare a mouse-event in *RESULT for placement in the input queue. diff --git a/src/termhooks.h b/src/termhooks.h index 3a49b49aede..34e1364effd 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -20,6 +20,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Miscellanea. */ +#include "systime.h" /* for Time */ + struct glyph; struct frame; @@ -233,7 +235,7 @@ struct input_event int modifiers; /* See enum below for interpretation. */ Lisp_Object x, y; - unsigned long timestamp; + Time timestamp; /* This is padding just to put the frame_or_window field past the size of struct selection_input_event. */ @@ -463,7 +465,7 @@ struct terminal enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, - unsigned long *); + Time *); /* The window system handling code should set this if the mouse has moved since the last call to the mouse_position_hook. Calling that diff --git a/src/w32gui.h b/src/w32gui.h index 936709af181..2ba9cb53e22 100644 --- a/src/w32gui.h +++ b/src/w32gui.h @@ -20,6 +20,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define EMACS_W32GUI_H #include <windows.h> +#include "systime.h" /* for Time */ + /* Local memory management for menus. */ #define local_heap (GetProcessHeap ()) #define local_alloc(n) (HeapAlloc (local_heap, HEAP_ZERO_MEMORY, (n))) @@ -47,7 +49,6 @@ typedef char * XrmDatabase; typedef XGCValues * GC; typedef COLORREF Color; -typedef DWORD Time; typedef HWND Window; typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */ typedef HCURSOR Cursor; @@ -147,4 +148,3 @@ typedef struct { #endif /* EMACS_W32GUI_H */ - diff --git a/src/w32inevt.c b/src/w32inevt.c index 465f5ccb70f..fddde61663f 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -45,7 +45,7 @@ extern HANDLE keyboard_handle; /* Info for last mouse motion */ static COORD movement_pos; -static DWORD movement_time; +static Time movement_time; /* from w32fns.c */ extern unsigned int map_keypad_keys (unsigned int, unsigned int); @@ -544,7 +544,7 @@ w32_console_mouse_position (FRAME_PTR *f, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, - unsigned long *time) + Time *time) { BLOCK_INPUT; @@ -756,4 +756,3 @@ w32_console_read_socket (struct terminal *terminal, UNBLOCK_INPUT; return ret; } - diff --git a/src/w32menu.c b/src/w32menu.c index ca763b553cf..e2f6de7f0c8 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -146,7 +146,7 @@ otherwise it is "Question". */) FRAME_PTR new_f = SELECTED_FRAME (); Lisp_Object bar_window; enum scroll_bar_part part; - unsigned long time; + Time time; Lisp_Object x, y; (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time); diff --git a/src/window.c b/src/window.c index 4dbee41c5f4..bc9f31e03e8 100644 --- a/src/window.c +++ b/src/window.c @@ -3094,11 +3094,14 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs Lisp_Object last_child; int child_size; - for (child = *forward; !NILP (child); child = c->next) + child = *forward; + do { c = XWINDOW (child); last_child = child; + child = c->next; } + while (!NILP (child)); child_size = WINDOW_TOTAL_SIZE (c, width_p); size_window (last_child, size - old_size + child_size, diff --git a/src/xmenu.c b/src/xmenu.c index 2a4359fa84a..7d7515a8f25 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -240,7 +240,7 @@ for instance using the window manager, then this produces a quit and FRAME_PTR new_f = SELECTED_FRAME (); Lisp_Object bar_window; enum scroll_bar_part part; - unsigned long time; + Time time; Lisp_Object x, y; (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time); @@ -922,7 +922,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) #endif Lisp_Object items; widget_value *wv, *first_wv, *prev_wv = 0; - EMACS_UINT i, last_i = 0; + int i; int *submenu_start, *submenu_end; int *submenu_top_level_items, *submenu_n_panes; @@ -966,7 +966,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) Lisp_Object *previous_items = (Lisp_Object *) alloca (previous_menu_items_used * sizeof (Lisp_Object)); - EMACS_UINT subitems; + int subitems; /* If we are making a new widget, its contents are empty, do always reinitialize them. */ @@ -1012,7 +1012,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) menu_items = f->menu_bar_vector; menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; subitems = ASIZE (items) / 4; - submenu_start = (int *) alloca (subitems * sizeof (int)); + submenu_start = (int *) alloca ((subitems + 1) * sizeof (int)); submenu_end = (int *) alloca (subitems * sizeof (int)); submenu_n_panes = (int *) alloca (subitems * sizeof (int)); submenu_top_level_items = (int *) alloca (subitems * sizeof (int)); @@ -1021,8 +1021,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) { Lisp_Object key, string, maps; - last_i = i; - key = XVECTOR (items)->contents[4 * i]; string = XVECTOR (items)->contents[4 * i + 1]; maps = XVECTOR (items)->contents[4 * i + 2]; @@ -1039,6 +1037,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) submenu_end[i] = menu_items_used; } + submenu_start[i] = -1; finish_menu_items (); /* Convert menu_items into widget_value trees @@ -1052,7 +1051,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) wv->help = Qnil; first_wv = wv; - for (i = 0; i < last_i; i++) + for (i = 0; 0 <= submenu_start[i]; i++) { menu_items_n_panes = submenu_n_panes[i]; wv = digest_single_submenu (submenu_start[i], submenu_end[i], @@ -1421,7 +1420,8 @@ pop_down_menu (Lisp_Object arg) menu pops down. menu_item_selection will be set to the selection. */ static void -create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, int for_click, EMACS_UINT timestamp) +create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, + int for_click, Time timestamp) { int i; GtkWidget *menu; @@ -1465,7 +1465,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, i gtk_widget_show_all (menu); gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, - timestamp > 0 ? timestamp : gtk_get_current_event_time()); + timestamp ? timestamp : gtk_get_current_event_time ()); record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); @@ -1525,7 +1525,7 @@ pop_down_menu (Lisp_Object arg) menu_item_selection will be set to the selection. */ static void create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, - int x, int y, int for_click, EMACS_UINT timestamp) + int x, int y, int for_click, Time timestamp) { int i; Arg av[2]; @@ -1599,7 +1599,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, Lisp_Object xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, - Lisp_Object title, const char **error_name, EMACS_UINT timestamp) + Lisp_Object title, const char **error_name, Time timestamp) { int i; widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; @@ -2242,7 +2242,7 @@ pop_down_menu (Lisp_Object arg) Lisp_Object xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, - Lisp_Object title, const char **error_name, EMACS_UINT timestamp) + Lisp_Object title, const char **error_name, Time timestamp) { Window root; XMenu *menu; diff --git a/src/xselect.c b/src/xselect.c index f11fc40fce8..3ddd4c54b49 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -121,10 +121,6 @@ static Lisp_Object Qforeign_selection; #define SELECTION_QUANTUM(dpy) ((XMaxRequestSize(dpy) << 2) - 100) -/* The timestamp of the last input event Emacs received from the X server. */ -/* Defined in keyboard.c. */ -extern unsigned long last_event_timestamp; - /* This is an association list whose elements are of the form ( SELECTION-NAME SELECTION-VALUE SELECTION-TIMESTAMP FRAME) SELECTION-NAME is a lisp symbol, whose name is the name of an X Atom. @@ -356,7 +352,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value) Lisp_Object selection_data; Lisp_Object prev_value; - selection_time = long_to_cons ((unsigned long) timestamp); + selection_time = long_to_cons (timestamp); selection_data = list4 (selection_name, selection_value, selection_time, selected_frame); prev_value = assq_no_quit (selection_name, Vselection_alist); diff --git a/src/xterm.c b/src/xterm.c index 2352f51cfb7..64030a3151d 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -342,7 +342,7 @@ static struct scroll_bar *x_window_to_scroll_bar (Display *, Window); static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *, enum scroll_bar_part *, Lisp_Object *, Lisp_Object *, - unsigned long *); + Time *); static void x_handle_net_wm_state (struct frame *, XPropertyEvent *); static void x_check_fullscreen (struct frame *); static void x_check_expected_move (struct frame *, int, int); @@ -3637,23 +3637,23 @@ x_find_modifier_meanings (struct x_display_info *dpyinfo) /* Convert between the modifier bits X uses and the modifier bits Emacs uses. */ -unsigned int -x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, unsigned int state) +EMACS_INT +x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, int state) { - EMACS_UINT mod_meta = meta_modifier; - EMACS_UINT mod_alt = alt_modifier; - EMACS_UINT mod_hyper = hyper_modifier; - EMACS_UINT mod_super = super_modifier; + EMACS_INT mod_meta = meta_modifier; + EMACS_INT mod_alt = alt_modifier; + EMACS_INT mod_hyper = hyper_modifier; + EMACS_INT mod_super = super_modifier; Lisp_Object tem; tem = Fget (Vx_alt_keysym, Qmodifier_value); - if (! EQ (tem, Qnil)) mod_alt = XUINT (tem); + if (INTEGERP (tem)) mod_alt = XINT (tem); tem = Fget (Vx_meta_keysym, Qmodifier_value); - if (! EQ (tem, Qnil)) mod_meta = XUINT (tem); + if (INTEGERP (tem)) mod_meta = XINT (tem); tem = Fget (Vx_hyper_keysym, Qmodifier_value); - if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem); + if (INTEGERP (tem)) mod_hyper = XINT (tem); tem = Fget (Vx_super_keysym, Qmodifier_value); - if (! EQ (tem, Qnil)) mod_super = XUINT (tem); + if (INTEGERP (tem)) mod_super = XINT (tem); return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0) @@ -3664,24 +3664,24 @@ x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, unsigned int state) | ((state & dpyinfo->hyper_mod_mask) ? mod_hyper : 0)); } -static unsigned int -x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, unsigned int state) +static int +x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, EMACS_INT state) { - EMACS_UINT mod_meta = meta_modifier; - EMACS_UINT mod_alt = alt_modifier; - EMACS_UINT mod_hyper = hyper_modifier; - EMACS_UINT mod_super = super_modifier; + int mod_meta = meta_modifier; + int mod_alt = alt_modifier; + int mod_hyper = hyper_modifier; + int mod_super = super_modifier; Lisp_Object tem; tem = Fget (Vx_alt_keysym, Qmodifier_value); - if (! EQ (tem, Qnil)) mod_alt = XUINT (tem); + if (INTEGERP (tem)) mod_alt = XINT (tem); tem = Fget (Vx_meta_keysym, Qmodifier_value); - if (! EQ (tem, Qnil)) mod_meta = XUINT (tem); + if (INTEGERP (tem)) mod_meta = XINT (tem); tem = Fget (Vx_hyper_keysym, Qmodifier_value); - if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem); + if (INTEGERP (tem)) mod_hyper = XINT (tem); tem = Fget (Vx_super_keysym, Qmodifier_value); - if (! EQ (tem, Qnil)) mod_super = XUINT (tem); + if (INTEGERP (tem)) mod_super = XINT (tem); return ( ((state & mod_alt) ? dpyinfo->alt_mod_mask : 0) @@ -3827,7 +3827,7 @@ redo_mouse_highlight (void) static void XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, - long unsigned int *timestamp) + Time *timestamp) { FRAME_PTR f1; @@ -5562,7 +5562,7 @@ x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event) static void x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, - Lisp_Object *y, long unsigned int *timestamp) + Lisp_Object *y, Time *timestamp) { struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); Window w = bar->x_window; diff --git a/src/xterm.h b/src/xterm.h index fbd638fe73b..1b90b6d8ff4 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -989,8 +989,7 @@ extern void x_mouse_leave (struct x_display_info *); #ifdef USE_X_TOOLKIT extern int x_dispatch_event (XEvent *, Display *); #endif -extern unsigned int x_x_to_emacs_modifiers (struct x_display_info *, - unsigned); +extern EMACS_INT x_x_to_emacs_modifiers (struct x_display_info *, int); extern int x_display_pixel_height (struct x_display_info *); extern int x_display_pixel_width (struct x_display_info *); |