emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110458: Code cleanup for cygw32


From: Daniel Colascione
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110458: Code cleanup for cygw32
Date: Mon, 08 Oct 2012 04:53:18 -0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110458
committer: Daniel Colascione <address@hidden>
branch nick: cyg
timestamp: Mon 2012-10-08 04:53:18 -0800
message:
  Code cleanup for cygw32
added:
  src/w32common.h
modified:
  src/ChangeLog
  src/Makefile.in
  src/cygw32.c
  src/cygw32.h
  src/emacs.c
  src/unexcw.c
  src/unexw32.c
  src/w32.c
  src/w32console.c
  src/w32fns.c
  src/w32heap.c
  src/w32heap.h
  src/w32menu.c
  src/w32proc.c
  src/w32select.c
  src/w32select.h
  src/w32term.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-10-08 12:21:04 +0000
+++ b/src/ChangeLog     2012-10-08 12:53:18 +0000
@@ -11,6 +11,59 @@
 
 2012-10-08  Daniel Colascione  <address@hidden>
 
+       * w32term.h (WM_EMACS_BRINGTOTOP, WM_EMACS_INPUT_READY)
+       (WM_EMACS_END): Change WM_EMACS_BRINGTOTOP from 22 to 21 to close
+       accidental message numbering hole.  Change other messages to
+       match.
+
+       * w32select.h (HAVE_W32SELECT): Remove.
+
+       * w32select.c, w32proc.c, w32menu.c, w32console.c, w32.c: Include
+       w32common.h instead of w32heap.h
+
+       * w32heap.h (ROUND_UP, ROUND_DOWN, get_page_size)
+       (get_allocation_unit, get_processor_type, get_w32_major_version)
+       (get_w32_minor_version, sysinfo_cache, osinfo_cache)
+       (w32_major_version, w32_minor_version, w32_build_number, OS_9X)
+       (OS_NT, os_subtype, cache_system_info): Move declarations to
+       w32common.
+
+       * w32heap.c: Include w32common.h.
+       (sysinfo_cache, syspage_mask, osinfo_cache, w32_major_version)
+       (w32_minor_version, w32_build_number, w32_subtype): Remove
+       duplicate definitions.
+
+       * w32fns.c: Include w32common.h; include w32heap.h only in
+       WINDOWSNT.
+
+       (Fx_file_dialog): Clarify comment on GetOpenFileName structure.
+       Use `report_file_error' instead of `error' in order to better
+       inform users of what went wrong.  Increase NTGUI_UNICODE file
+       dialog box file name length to 32k, the maximum allowed by the NT
+       kernel.
+
+       * w32common.h: New file.
+       (ROUND_UP, ROUND_DOWN, get_page_size)
+       (get_allocation_unit, get_processor_type, get_w32_major_version)
+       (get_w32_minor_version, sysinfo_cache, osinfo_cache)
+       (w32_major_version, w32_minor_version, w32_build_number, OS_9X)
+       (OS_NT, os_subtype, cache_system_info): Move here.
+
+       * unexw32.c, unexcw.c: Include w32common.h.
+
+       * emacs.c (main): Use (defined (WINDOWSNT) || defined
+       HAVE_NTGUI) instead of removed HAVE_W32SELECT to decide whether
+       to call syms_of_w32select.
+
+       * cygw32.h: Remove obsolete EXFUN declarations.
+
+       * cygw32.c (Qutf_16_le): Rename to Qutf_16le.
+
+       * Makefile.in (SOME_MACHINE_OBJECTS): Reverse accidental removal
+       of w32inevt.o from SOME_MACHINE_OBJECTS.
+
+2012-10-08  Daniel Colascione  <address@hidden>
+
        * image.c: Permanent fix for JPEG compilation issue --- limit
        jpeglib `boolean' redefinition to Cygwin builds.
 

=== modified file 'src/Makefile.in'
--- a/src/Makefile.in   2012-10-07 22:31:58 +0000
+++ b/src/Makefile.in   2012-10-08 12:53:18 +0000
@@ -357,7 +357,7 @@
   xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
   fontset.o dbusbind.o cygw32.o \
   nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
-  w32.o w32console.o w32fns.o w32heap.o \
+  w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
   w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \
   w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \
   xsettings.o xgselect.o termcap.o

=== modified file 'src/cygw32.c'
--- a/src/cygw32.c      2012-10-08 09:41:04 +0000
+++ b/src/cygw32.c      2012-10-08 12:53:18 +0000
@@ -22,7 +22,7 @@
 #include "buffer.h"
 #include <unistd.h>
 #include <fcntl.h>
-static Lisp_Object Qutf_16_le;
+static Lisp_Object Qutf_16le;
 
 static Lisp_Object
 fchdir_unwind (Lisp_Object dir_fd)
@@ -117,13 +117,13 @@
       str = Fsubstring (str, make_number (0), make_number (-1));
     }
 
-  return code_convert_string_norecord (str, Qutf_16_le, 0);
+  return code_convert_string_norecord (str, Qutf_16le, 0);
 }
 
 wchar_t *
 to_unicode (Lisp_Object str, Lisp_Object *buf)
 {
-  *buf = code_convert_string_norecord (str, Qutf_16_le, 1);
+  *buf = code_convert_string_norecord (str, Qutf_16le, 1);
   /* We need to make a another copy (in addition to the one made by
      code_convert_string_norecord) to ensure that the final string is
      _doubly_ zero terminated --- that is, that the string is
@@ -163,7 +163,7 @@
 syms_of_cygw32 (void)
 {
   /* No, not utf-16-le: that one has a BOM.  */
-  DEFSYM (Qutf_16_le, "utf-16le");
+  DEFSYM (Qutf_16le, "utf-16le");
   defsubr (&Scygwin_convert_path_from_windows);
   defsubr (&Scygwin_convert_path_to_windows);
 }

=== modified file 'src/cygw32.h'
--- a/src/cygw32.h      2012-10-08 09:52:25 +0000
+++ b/src/cygw32.h      2012-10-08 12:53:18 +0000
@@ -46,11 +46,6 @@
    object, to a multi-byte Emacs string, and return it.  */
 extern Lisp_Object from_unicode (Lisp_Object str);
 
-/* *** Path conversion. *** */
-
-EXFUN (Fcygwin_convert_path_to_windows, 2);
-EXFUN (Fcygwin_convert_path_from_windows, 2);
-
 /* *** Misc *** */
 extern void syms_of_cygw32 (void);
 extern char * w32_strerror (int error_no);

=== modified file 'src/emacs.c'
--- a/src/emacs.c       2012-10-08 10:01:59 +0000
+++ b/src/emacs.c       2012-10-08 12:53:18 +0000
@@ -1415,9 +1415,9 @@
       syms_of_fontset ();
 #endif /* HAVE_NTGUI */
 
-#ifdef HAVE_W32SELECT
+#if defined (WINDOWSNT) || defined (HAVE_NTGUI)
       syms_of_w32select ();
-#endif /* HAVE_W32SELECT */
+#endif /* WINDOWSNT || HAVE_NTGUI */
 
 #ifdef MSDOS
       syms_of_xmenu ();
@@ -1465,9 +1465,10 @@
       globals_of_w32menu ();
 #endif  /* HAVE_NTGUI */
 
-#ifdef HAVE_W32SELECT
+#if defined (WINDOWSNT) || defined (HAVE_NTGUI)
       globals_of_w32select ();
-#endif /* HAVE_W32SELECT */
+#endif /* WINDOWSNT || HAVE_NTGUI */
+
     }
 
   init_charset ();

=== modified file 'src/unexcw.c'
--- a/src/unexcw.c      2012-09-15 07:06:56 +0000
+++ b/src/unexcw.c      2012-10-08 12:53:18 +0000
@@ -20,6 +20,7 @@
 
 #include <config.h>
 #include "unexec.h"
+#include "w32common.h"
 
 #include <lisp.h>
 #include <stdio.h>

=== modified file 'src/unexw32.c'
--- a/src/unexw32.c     2012-10-07 22:31:58 +0000
+++ b/src/unexw32.c     2012-10-08 12:53:18 +0000
@@ -22,6 +22,7 @@
 
 #include <config.h>
 #include "unexec.h"
+#include "w32common.h"
 
 #include <stdio.h>
 #include <fcntl.h>

=== modified file 'src/w32.c'
--- a/src/w32.c 2012-10-07 22:31:58 +0000
+++ b/src/w32.c 2012-10-08 12:53:18 +0000
@@ -173,6 +173,7 @@
 
 #include "w32.h"
 #include "ndir.h"
+#include "w32common.h"
 #include "w32heap.h"
 #include "systime.h"
 #include "dispextern.h"                /* for xstrcasecmp */

=== added file 'src/w32common.h'
--- a/src/w32common.h   1970-01-01 00:00:00 +0000
+++ b/src/w32common.h   2012-10-08 12:53:18 +0000
@@ -0,0 +1,53 @@
+/* Common functions for Microsoft Windows builds of Emacs
+   Copyright (C) 2012 Free Software Foundation, Inc.
+
+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/>.
+   
+*/
+
+#ifndef W32COMMON_H
+#define W32COMMON_H
+
+#include <windows.h>
+
+#define ROUND_UP(p, align)   (((DWORD_PTR)(p) + (align)-1) & 
~((DWORD_PTR)(align)-1))
+#define ROUND_DOWN(p, align) ((DWORD_PTR)(p) & ~((DWORD_PTR)(align)-1))
+
+#define get_page_size()                        sysinfo_cache.dwPageSize
+#define get_allocation_unit()          sysinfo_cache.dwAllocationGranularity
+#define get_processor_type()           sysinfo_cache.dwProcessorType
+#define get_w32_major_version()        w32_major_version
+#define get_w32_minor_version()        w32_minor_version
+
+extern SYSTEM_INFO    sysinfo_cache;
+extern OSVERSIONINFO  osinfo_cache;
+extern unsigned long  syspage_mask;
+
+extern int           w32_major_version;
+extern int           w32_minor_version;
+extern int           w32_build_number;
+
+enum {
+  OS_9X = 1,
+  OS_NT
+};
+
+extern int os_subtype;
+
+/* Cache system info, e.g., the NT page size.  */
+extern void cache_system_info (void);
+
+#endif /* W32COMMON_H */

=== modified file 'src/w32console.c'
--- a/src/w32console.c  2012-09-17 12:07:36 +0000
+++ b/src/w32console.c  2012-10-08 12:53:18 +0000
@@ -37,7 +37,7 @@
 #include "termchar.h"
 #include "dispextern.h"
 #include "w32term.h"
-#include "w32heap.h"   /* for os_subtype */
+#include "w32common.h" /* for os_subtype */
 #include "w32inevt.h"
 
 /* from window.c */

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2012-10-08 11:19:35 +0000
+++ b/src/w32fns.c      2012-10-08 12:53:18 +0000
@@ -45,7 +45,11 @@
 #include "systime.h"
 #include "termhooks.h"
 
+#include "w32common.h"
+
+#ifdef WINDOWSNT
 #include "w32heap.h"
+#endif /* WINDOWSNT */
 
 #if CYGWIN
 #include "cygw32.h"
@@ -6111,7 +6115,7 @@
   } new_file_details;
 
 #ifdef NTGUI_UNICODE
-  wchar_t filename_buf[MAX_PATH + 1];
+  wchar_t filename_buf[32*1024 + 1]; // NT kernel maximum
   OPENFILENAMEW * file_details = &new_file_details.details;
 #else /* not NTGUI_UNICODE */
   char filename_buf[MAX_PATH + 1];
@@ -6173,11 +6177,12 @@
     unixtodos_filename (SDATA (filename));
 #endif /* NTGUI_UNICODE */
 
-    /* Fill in the structure for the call to GetOpenFileName below.  For
-       NTGUI_UNICODE builds (which run only on NT), we just use the
-       actual size of the structure.  For non-NTGUI_UNICODE builds, we
-       tell the OS we're using an old version of the structure if it's not
-       new enough to support the newer version.  */
+    /* Fill in the structure for the call to GetOpenFileName below.
+       For NTGUI_UNICODE builds (which run only on NT), we just use
+       the actual size of the structure.  For non-NTGUI_UNICODE
+       builds, we tell the OS we're using an old version of the
+       structure if the OS isn't new enough to support the newer
+       version.  */
     memset (&new_file_details, 0, sizeof (new_file_details));
 
     if (w32_major_version > 4 && w32_major_version < 95)
@@ -6187,7 +6192,7 @@
 
     /* Set up the inout parameter for the selected file name.  */
     if (SBYTES (filename) + 1 > sizeof (filename_buf))
-      error ("filename too long");
+      report_file_error ("filename too long", default_filename);
 
     memcpy (filename_buf, SDATA (filename), SBYTES (filename) + 1);
     file_details->lpstrFile = filename_buf;

=== modified file 'src/w32heap.c'
--- a/src/w32heap.c     2012-10-08 08:18:01 +0000
+++ b/src/w32heap.c     2012-10-08 12:53:18 +0000
@@ -23,26 +23,12 @@
 #include <config.h>
 #include <stdio.h>
 
+#include "w32common.h"
 #include "w32heap.h"
 #include "lisp.h"  /* for VALMASK */
 
 #define RVA_TO_PTR(rva) ((unsigned char *)((DWORD_PTR)(rva) + 
(DWORD_PTR)GetModuleHandle (NULL)))
 
-/* This gives us the page size and the size of the allocation unit on NT.  */
-SYSTEM_INFO sysinfo_cache;
-
-/* This gives us version, build, and platform identification.  */
-extern unsigned long syspage_mask;
-OSVERSIONINFO osinfo_cache;
-
-/* The major and minor versions of NT.  */
-int w32_major_version;
-int w32_minor_version;
-int w32_build_number;
-
-/* Distinguish between Windows NT and Windows 95.  */
-int os_subtype;
-
 /* Emulate getpagesize.  */
 int
 getpagesize (void)

=== modified file 'src/w32heap.h'
--- a/src/w32heap.h     2012-09-30 21:36:42 +0000
+++ b/src/w32heap.h     2012-10-08 12:53:18 +0000
@@ -24,9 +24,6 @@
 
 #include <windows.h>
 
-#define ROUND_UP(p, align)   (((DWORD_PTR)(p) + (align)-1) & 
~((DWORD_PTR)(align)-1))
-#define ROUND_DOWN(p, align) ((DWORD_PTR)(p) & ~((DWORD_PTR)(align)-1))
-
 /*
  * Heap related stuff.
  */
@@ -34,28 +31,11 @@
 #define get_committed_heap_size()      (get_data_end () - get_data_start ())
 #define get_heap_start()               get_data_start ()
 #define get_heap_end()                 get_data_end ()
-#define get_page_size()                        sysinfo_cache.dwPageSize
-#define get_allocation_unit()          sysinfo_cache.dwAllocationGranularity
-#define get_processor_type()           sysinfo_cache.dwProcessorType
-#define get_w32_major_version()        w32_major_version
-#define get_w32_minor_version()        w32_minor_version
 
 extern unsigned char *get_data_start (void);
 extern unsigned char *get_data_end (void);
 extern size_t         reserved_heap_size;
-extern SYSTEM_INFO    sysinfo_cache;
-extern OSVERSIONINFO  osinfo_cache;
 extern BOOL          using_dynamic_heap;
-extern int           w32_major_version;
-extern int           w32_minor_version;
-extern int           w32_build_number;
-
-enum {
-  OS_9X = 1,
-  OS_NT
-};
-
-extern int os_subtype;
 
 /* Emulation of Unix sbrk().  */
 extern void *sbrk (ptrdiff_t size);
@@ -66,9 +46,6 @@
 /* Round the heap to this size.  */
 extern void round_heap (size_t size);
 
-/* Cache system info, e.g., the NT page size.  */
-extern void cache_system_info (void);
-
 /* ----------------------------------------------------------------- */
 /* Useful routines for manipulating memory-mapped files. */
 

=== modified file 'src/w32menu.c'
--- a/src/w32menu.c     2012-10-07 22:31:58 +0000
+++ b/src/w32menu.c     2012-10-08 12:53:18 +0000
@@ -56,7 +56,7 @@
 
 #include "dispextern.h"
 
-#include "w32heap.h"   /* for osinfo_cache */
+#include "w32common.h" /* for osinfo_cache */
 
 #undef HAVE_DIALOGS /* TODO: Implement native dialogs.  */
 

=== modified file 'src/w32proc.c'
--- a/src/w32proc.c     2012-10-07 22:31:58 +0000
+++ b/src/w32proc.c     2012-10-08 12:53:18 +0000
@@ -51,6 +51,7 @@
 
 #include "lisp.h"
 #include "w32.h"
+#include "w32common.h"
 #include "w32heap.h"
 #include "systime.h"
 #include "syswait.h"

=== modified file 'src/w32select.c'
--- a/src/w32select.c   2012-10-07 22:31:58 +0000
+++ b/src/w32select.c   2012-10-08 12:53:18 +0000
@@ -75,7 +75,7 @@
 #include <config.h>
 #include "lisp.h"
 #include "w32term.h"   /* for all of the w32 includes */
-#include "w32heap.h"   /* os_subtype */
+#include "w32common.h" /* os_subtype */
 #include "blockinput.h"
 #include "charset.h"
 #include "coding.h"

=== modified file 'src/w32select.h'
--- a/src/w32select.h   2012-09-17 11:57:03 +0000
+++ b/src/w32select.h   2012-10-08 12:53:18 +0000
@@ -21,8 +21,6 @@
 #define W32SELECT_H
 #include <windows.h>
 
-#define HAVE_W32SELECT 1
-
 extern void syms_of_w32select (void);
 extern void globals_of_w32select (void);
 extern void term_w32select (void);

=== modified file 'src/w32term.h'
--- a/src/w32term.h     2012-10-07 22:31:58 +0000
+++ b/src/w32term.h     2012-10-08 12:53:18 +0000
@@ -619,9 +619,9 @@
 #define WM_EMACS_HIDE_CARET            (WM_EMACS_START + 18)
 #define WM_EMACS_SETCURSOR             (WM_EMACS_START + 19)
 #define WM_EMACS_PAINT                 (WM_EMACS_START + 20)
-#define WM_EMACS_BRINGTOTOP            (WM_EMACS_START + 22)
-#define WM_EMACS_INPUT_READY           (WM_EMACS_START + 23)
-#define WM_EMACS_END                   (WM_EMACS_START + 24)
+#define WM_EMACS_BRINGTOTOP            (WM_EMACS_START + 21)
+#define WM_EMACS_INPUT_READY           (WM_EMACS_START + 22)
+#define WM_EMACS_END                   (WM_EMACS_START + 23)
 
 #define WND_FONTWIDTH_INDEX    (0)
 #define WND_LINEHEIGHT_INDEX   (4)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]