Merge from trunk
authorDaniel Colascione <dancol@dancol.org>
Mon, 17 Sep 2012 12:07:36 +0000 (04:07 -0800)
committerDaniel Colascione <dancol@dancol.org>
Mon, 17 Sep 2012 12:07:36 +0000 (04:07 -0800)
33 files changed:
1  2 
configure.ac
lisp/frame.el
lisp/loadup.el
lisp/simple.el
lisp/startup.el
src/Makefile.in
src/conf_post.h
src/dispextern.h
src/emacs.c
src/font.c
src/font.h
src/fontset.c
src/frame.c
src/frame.h
src/image.c
src/keyboard.c
src/keyboard.h
src/menu.c
src/process.c
src/w32.c
src/w32console.c
src/w32fns.c
src/w32font.c
src/w32heap.c
src/w32inevt.c
src/w32menu.c
src/w32proc.c
src/w32select.c
src/w32term.c
src/w32xfns.c
src/window.c
src/xdisp.c
src/xfaces.c

diff --cc configure.ac
@@@ -1567,32 -1551,7 +1553,31 @@@ AC_SUBST(ns_self_contained
  AC_SUBST(NS_OBJ)
  AC_SUBST(NS_OBJC_OBJ)
  AC_SUBST(LIB_STANDARD)
- AC_SUBST_FILE(ns_frag)
  
 +HAVE_W32=no
 +W32_OBJ=
 +W32_LIBS=
 +if test "${with_w32}" != no; then
 +  if test "${opsys}" != "cygwin"; then
 +    AC_MSG_ERROR([Using w32 with an autotools build is only supported for Cygwin.])
 +  fi
 +  AC_CHECK_HEADER([windows.h], [HAVE_W32=yes],
 +                  [AC_MSG_ERROR([`--with-w32' was specified, but windows.h
 +                  cannot be found.])])
 +  AC_DEFINE(HAVE_NTGUI, 1, [Define to use native Windows GUI.])
 +  W32_OBJ="w32fns.o w32menu.o w32reg.o w32font.o w32term.o"
 +  W32_OBJ="$W32_OBJ w32xfns.o w32select.o w32uniscribe.o"
 +  W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32"
 +  W32_LIBS="$W32_LIBS -lusp10 -lcomctl32 -lwinspool"
 +fi
 +AC_SUBST(W32_OBJ)
 +AC_SUBST(W32_LIBS)
 +
 +if test "${HAVE_W32}" = "yes"; then
 +  window_system=w32
 +  with_xft=no
 +fi
 +
  ## $window_system is now set to the window system we will
  ## ultimately use.
  
diff --cc lisp/frame.el
Simple merge
diff --cc lisp/loadup.el
Simple merge
diff --cc lisp/simple.el
Simple merge
diff --cc lisp/startup.el
Simple merge
diff --cc src/Makefile.in
Simple merge
diff --cc src/conf_post.h
Simple merge
Simple merge
diff --cc src/emacs.c
@@@ -161,27 -148,11 +159,27 @@@ static void *my_heap_start
  static uprintmax_t heap_bss_diff;
  #endif
  
- /* Nonzero means running Emacs without interactive terminal.  */
- int noninteractive;
 +/* To run as a daemon under Cocoa or Windows, we must do a fork+exec,
 +   not a simple fork.
 +
 +   On Cocoa, CoreFoundation lib fails in forked process:
 +   http://developer.apple.com/ReleaseNotes/
 +   CoreFoundation/CoreFoundation.html)
 +
 +   On Windows, a Cygwin fork child cannot access the USER subsystem.
 +
 +   We mark being in the exec'd process by a daemon name argument of
 +   form "--daemon=\nFD0,FD1\nNAME" where FD are the pipe file descriptors,
 +   NAME is the original daemon name, if any. */
 +#if defined (NS_IMPL_COCOA) || defined (HAVE_NTGUI)
 +# define DAEMON_MUST_EXEC
 +#endif
 +
+ /* True means running Emacs without interactive terminal.  */
+ bool noninteractive;
  
- /* Nonzero means remove site-lisp directories from load-path.  */
int no_site_lisp;
+ /* True means remove site-lisp directories from load-path.  */
bool no_site_lisp;
  
  /* Name for the server started by the daemon.*/
  static char *daemon_name;
@@@ -707,13 -682,14 +709,14 @@@ main (int argc, char **argv
  #ifdef HAVE_SETRLIMIT
    struct rlimit rlim;
  #endif
-   int no_loadup = 0;
+   bool no_loadup = 0;
    char *junk = 0;
    char *dname_arg = 0;
 -#ifdef NS_IMPL_COCOA
 +#ifdef DAEMON_MUST_EXEC
    char dname_arg2[80];
 -#endif
 +#endif /* DAEMON_MUST_EXEC */
    char *ch_to_dir;
+   struct sigaction fatal_error_action;
  
  #if GC_MARK_STACK
    stack_base = &dummy;
diff --cc src/font.c
Simple merge
diff --cc src/font.h
Simple merge
diff --cc src/fontset.c
Simple merge
diff --cc src/frame.c
Simple merge
diff --cc src/frame.h
Simple merge
diff --cc src/image.c
@@@ -573,9 -568,7 +572,8 @@@ static void x_laplace (struct frame *, 
  static void x_emboss (struct frame *, struct image *);
  static int x_build_heuristic_mask (struct frame *, struct image *,
                                     Lisp_Object);
 -#ifdef HAVE_NTGUI
 +#ifdef WINDOWSNT
 +extern Lisp_Object Vlibrary_cache;
  #define CACHE_IMAGE_TYPE(type, status) \
    do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0)
  #else
@@@ -5526,11 -5512,20 +5524,20 @@@ init_png_functions (Lisp_Object librari
  #define fn_png_set_longjmp_fn         png_set_longjmp_fn
  #endif /* libpng version >= 1.5 */
  
 -#endif /* HAVE_NTGUI */
 +#endif /* WINDOWSNT */
  
+ /* Possibly inefficient/inexact substitutes for _setjmp and _longjmp.
+    Do not use sys_setjmp, as PNG supports only jmp_buf.  The _longjmp
+    substitute may munge the signal mask, but that should be OK here.
+    MinGW (MS-Windows) uses _setjmp and defines setjmp to _setjmp in
+    the system header setjmp.h; don't mess up that.  */
+ #ifndef HAVE__SETJMP
+ # define _setjmp(j) setjmp (j)
+ # define _longjmp longjmp
+ #endif
  
  #if (PNG_LIBPNG_VER < 10500)
- #define PNG_LONGJMP(ptr) (longjmp ((ptr)->jmpbuf, 1))
+ #define PNG_LONGJMP(ptr) (_longjmp ((ptr)->jmpbuf, 1))
  #define PNG_JMPBUF(ptr) ((ptr)->jmpbuf)
  #else
  /* In libpng version 1.5, the jmpbuf member is hidden. (Bug#7908)  */
diff --cc src/keyboard.c
@@@ -3828,13 -3790,17 +3790,17 @@@ kbd_buffer_get_event (KBOARD **kbp
  #ifdef subprocesses
    if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE/4)
      {
 -      /* Start reading input again, we have processed enough so we can
 -         accept new events again.  */
 +      /* Start reading input again because we have processed enough to
 +         be able to accept new events again.  */
        unhold_keyboard_input ();
- #ifdef SIGIO
+ #ifdef USABLE_SIGIO
        if (!noninteractive)
-         signal (SIGIO, input_available_signal);
- #endif /* SIGIO */
+       {
+         struct sigaction action;
+         emacs_sigaction_init (&action, deliver_input_available_signal);
+         sigaction (SIGIO, &action, 0);
+       }
+ #endif
        start_polling ();
      }
  #endif        /* subprocesses */
diff --cc src/keyboard.h
Simple merge
diff --cc src/menu.c
Simple merge
diff --cc src/process.c
Simple merge
diff --cc src/w32.c
+++ b/src/w32.c
@@@ -31,8 -31,8 +31,7 @@@ along with GNU Emacs.  If not, see <htt
  #include <sys/file.h>
  #include <sys/time.h>
  #include <sys/utime.h>
 -#include <mbstring.h> /* for _mbspbrk */
  #include <math.h>
- #include <setjmp.h>
  #include <time.h>
  
  /* must include CRT headers *before* config.h */
Simple merge
diff --cc src/w32fns.c
Simple merge
diff --cc src/w32font.c
Simple merge
diff --cc src/w32heap.c
Simple merge
diff --cc src/w32inevt.c
Simple merge
diff --cc src/w32menu.c
Simple merge
diff --cc src/w32proc.c
Simple merge
diff --cc src/w32select.c
Simple merge
diff --cc src/w32term.c
Simple merge
diff --cc src/w32xfns.c
@@@ -19,8 -19,6 +19,7 @@@ along with GNU Emacs.  If not, see <htt
  #include <config.h>
  #include <signal.h>
  #include <stdio.h>
- #include <setjmp.h>
 +
  #include "lisp.h"
  #include "keyboard.h"
  #include "frame.h"
diff --cc src/window.c
Simple merge
diff --cc src/xdisp.c
Simple merge
diff --cc src/xfaces.c
Simple merge