Fequal_including_properties fix
[bpt/emacs.git] / src / w32proc.c
index 7d4fb98..13fa24e 100644 (file)
@@ -1,5 +1,6 @@
 /* Process support for GNU Emacs on the Microsoft Windows API.
-   Copyright (C) 1992, 1995, 1999-2013 Free Software Foundation, Inc.
+
+Copyright (C) 1992, 1995, 1999-2014 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -42,8 +43,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #undef kill
 
 #include <windows.h>
-#ifdef __GNUC__
-/* This definition is missing from mingw32 headers. */
+#if defined(__GNUC__) && !defined(__MINGW64__)
+/* This definition is missing from mingw.org headers, but not MinGW64
+   headers. */
 extern BOOL WINAPI IsValidLocale (LCID, DWORD);
 #endif
 
@@ -564,7 +566,7 @@ init_timers (void)
 static int
 start_timer_thread (int which)
 {
-  DWORD exit_code;
+  DWORD exit_code, tid;
   HANDLE th;
   struct itimer_data *itimer =
     (which == ITIMER_REAL) ? &real_itimer : &prof_itimer;
@@ -602,7 +604,7 @@ start_timer_thread (int which)
      the way of threads we start to wait for subprocesses.  See also
      new_child below.  */
   itimer->timer_thread = CreateThread (NULL, 64 * 1024, timer_loop,
-                                      (void *)itimer, 0x00010000, NULL);
+                                      (void *)itimer, 0x00010000, &tid);
 
   if (!itimer->timer_thread)
     {
@@ -1065,7 +1067,7 @@ static char * process_dir;
 
 static BOOL
 create_child (char *exe, char *cmdline, char *env, int is_gui_app,
-             int * pPid, child_process *cp)
+             pid_t * pPid, child_process *cp)
 {
   STARTUPINFO start;
   SECURITY_ATTRIBUTES sec_attrs;
@@ -1592,7 +1594,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
       program = build_string (cmdname);
       full = Qnil;
       GCPRO1 (program);
-      openp (Vexec_path, program, Vexec_suffixes, &full, make_number (X_OK));
+      openp (Vexec_path, program, Vexec_suffixes, &full, make_number (X_OK), 0);
       UNGCPRO;
       if (NILP (full))
        {
@@ -1770,12 +1772,12 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
       if (need_quotes)
        {
          int escape_char_run = 0;
-         char * first;
-         char * last;
+         /* char * first; */
+         /* char * last; */
 
          p = *targ;
-         first = p;
-         last = p + strlen (p) - 1;
+         /* first = p; */
+         /* last = p + strlen (p) - 1; */
          *parg++ = '"';
 #if 0
          /* This version does not escape quotes if they occur at the
@@ -2247,10 +2249,9 @@ static BOOL CALLBACK
 find_child_console (HWND hwnd, LPARAM arg)
 {
   child_process * cp = (child_process *) arg;
-  DWORD thread_id;
   DWORD process_id;
 
-  thread_id = GetWindowThreadProcessId (hwnd, &process_id);
+  GetWindowThreadProcessId (hwnd, &process_id);
   if (process_id == cp->procinfo.dwProcessId)
     {
       char window_class[32];
@@ -3083,10 +3084,10 @@ The return value is a list of pairs of language id and layout id.  */)
     {
       while (--num_layouts >= 0)
        {
-         DWORD kl = (DWORD) layouts[num_layouts];
+         HKL kl = layouts[num_layouts];
 
-         obj = Fcons (Fcons (make_number (kl & 0xffff),
-                             make_number ((kl >> 16) & 0xffff)),
+         obj = Fcons (Fcons (make_number (LOWORD (kl)),
+                             make_number (HIWORD (kl))),
                       obj);
        }
     }
@@ -3101,10 +3102,10 @@ DEFUN ("w32-get-keyboard-layout", Fw32_get_keyboard_layout,
 The return value is the cons of the language id and the layout id.  */)
   (void)
 {
-  DWORD kl = (DWORD) GetKeyboardLayout (dwWindowsThreadId);
+  HKL kl = GetKeyboardLayout (dwWindowsThreadId);
 
-  return Fcons (make_number (kl & 0xffff),
-               make_number ((kl >> 16) & 0xffff));
+  return Fcons (make_number (LOWORD (kl)),
+               make_number (HIWORD (kl)));
 }
 
 
@@ -3115,14 +3116,14 @@ The keyboard layout setting affects interpretation of keyboard input.
 If successful, the new layout id is returned, otherwise nil.  */)
   (Lisp_Object layout)
 {
-  DWORD kl;
+  HKL kl;
 
   CHECK_CONS (layout);
   CHECK_NUMBER_CAR (layout);
   CHECK_NUMBER_CDR (layout);
 
 kl = (XINT (XCAR (layout)) & 0xffff)
-    | (XINT (XCDR (layout)) << 16);
kl = (HKL) ((XINT (XCAR (layout)) & 0xffff)
+            | (XINT (XCDR (layout)) << 16));
 
   /* Synchronize layout with input thread.  */
   if (dwWindowsThreadId)
@@ -3137,7 +3138,7 @@ If successful, the new layout id is returned, otherwise nil.  */)
            return Qnil;
        }
     }
-  else if (!ActivateKeyboardLayout ((HKL) kl, 0))
+  else if (!ActivateKeyboardLayout (kl, 0))
     return Qnil;
 
   return Fw32_get_keyboard_layout ();
@@ -3147,32 +3148,11 @@ If successful, the new layout id is returned, otherwise nil.  */)
 void
 syms_of_ntproc (void)
 {
+#include "w32proc.x"
+
   DEFSYM (Qhigh, "high");
   DEFSYM (Qlow, "low");
 
-  defsubr (&Sw32_has_winsock);
-  defsubr (&Sw32_unload_winsock);
-
-  defsubr (&Sw32_short_file_name);
-  defsubr (&Sw32_long_file_name);
-  defsubr (&Sw32_set_process_priority);
-  defsubr (&Sw32_get_locale_info);
-  defsubr (&Sw32_get_current_locale_id);
-  defsubr (&Sw32_get_default_locale_id);
-  defsubr (&Sw32_get_valid_locale_ids);
-  defsubr (&Sw32_set_current_locale);
-
-  defsubr (&Sw32_get_console_codepage);
-  defsubr (&Sw32_set_console_codepage);
-  defsubr (&Sw32_get_console_output_codepage);
-  defsubr (&Sw32_set_console_output_codepage);
-  defsubr (&Sw32_get_valid_codepages);
-  defsubr (&Sw32_get_codepage_charset);
-
-  defsubr (&Sw32_get_valid_keyboard_layouts);
-  defsubr (&Sw32_get_keyboard_layout);
-  defsubr (&Sw32_set_keyboard_layout);
-
   DEFVAR_LISP ("w32-quote-process-args", Vw32_quote_process_args,
               doc: /* Non-nil enables quoting of process arguments to ensure correct parsing.
 Because Windows does not directly pass argv arrays to child processes,