aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2012-10-08 15:36:06 +0200
committerEli Zaretskii2012-10-08 15:36:06 +0200
commiteb3abb6141b91f4d940233979d7538ba4c3d1976 (patch)
tree3202ce162039907f092f425f03d8a044ef5cb204 /src
parent7014794467aac02be3a935a093e1bfb8ad410c12 (diff)
parent15c720a3607ccbac1a5ff4bd10810f9342db0ad1 (diff)
downloademacs-eb3abb6141b91f4d940233979d7538ba4c3d1976.tar.gz
emacs-eb3abb6141b91f4d940233979d7538ba4c3d1976.zip
Merge from trunk after addition of w32common.h.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog60
-rw-r--r--src/Makefile.in2
-rw-r--r--src/cygw32.c8
-rw-r--r--src/cygw32.h5
-rw-r--r--src/emacs.c9
-rw-r--r--src/makefile.w32-in13
-rw-r--r--src/unexcw.c1
-rw-r--r--src/unexw32.c1
-rw-r--r--src/w32.c1
-rw-r--r--src/w32common.h53
-rw-r--r--src/w32console.c2
-rw-r--r--src/w32fns.c19
-rw-r--r--src/w32heap.c16
-rw-r--r--src/w32heap.h23
-rw-r--r--src/w32menu.c2
-rw-r--r--src/w32notify.c2
-rw-r--r--src/w32proc.c1
-rw-r--r--src/w32select.c2
-rw-r--r--src/w32select.h2
19 files changed, 153 insertions, 69 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 30db50fbcc8..d0670d05af3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -4,6 +4,13 @@
4 (W32TERM_H): Add $(ATIMER_H) and $(FRAME_H). 4 (W32TERM_H): Add $(ATIMER_H) and $(FRAME_H).
5 ($(BLD)/emacs.$(O), $(BLD)/w32console.$(O)): Update dependencies. 5 ($(BLD)/emacs.$(O), $(BLD)/w32console.$(O)): Update dependencies.
6 (GLOBAL_SOURCES): Add cygw32.c. 6 (GLOBAL_SOURCES): Add cygw32.c.
7 ($(BLD)/unexw32.$(O)):
8 ($(BLD)/w32.$(O)):
9 ($(BLD)/w32console.$(O)):
10 ($(BLD)/w32fns.$(O)):
11 ($(BLD)/w32heap.$(O)):
12 ($(BLD)/w32menu.$(O)):
13 ($(BLD)/w32proc.$(O)): Add w32common.h.
7 14
8 * w32fns.c (w32_color_map_lookup, x_to_w32_color): Argument is now 15 * w32fns.c (w32_color_map_lookup, x_to_w32_color): Argument is now
9 'const char *'. 16 'const char *'.
@@ -11,6 +18,59 @@
11 18
122012-10-08 Daniel Colascione <dancol@dancol.org> 192012-10-08 Daniel Colascione <dancol@dancol.org>
13 20
21 * w32term.h (WM_EMACS_BRINGTOTOP, WM_EMACS_INPUT_READY)
22 (WM_EMACS_END): Change WM_EMACS_BRINGTOTOP from 22 to 21 to close
23 accidental message numbering hole. Change other messages to
24 match.
25
26 * w32select.h (HAVE_W32SELECT): Remove.
27
28 * w32select.c, w32proc.c, w32menu.c, w32console.c, w32.c: Include
29 w32common.h instead of w32heap.h
30
31 * w32heap.h (ROUND_UP, ROUND_DOWN, get_page_size)
32 (get_allocation_unit, get_processor_type, get_w32_major_version)
33 (get_w32_minor_version, sysinfo_cache, osinfo_cache)
34 (w32_major_version, w32_minor_version, w32_build_number, OS_9X)
35 (OS_NT, os_subtype, cache_system_info): Move declarations to
36 w32common.
37
38 * w32heap.c: Include w32common.h.
39 (sysinfo_cache, syspage_mask, osinfo_cache, w32_major_version)
40 (w32_minor_version, w32_build_number, w32_subtype): Remove
41 duplicate definitions.
42
43 * w32fns.c: Include w32common.h; include w32heap.h only in
44 WINDOWSNT.
45
46 (Fx_file_dialog): Clarify comment on GetOpenFileName structure.
47 Use `report_file_error' instead of `error' in order to better
48 inform users of what went wrong. Increase NTGUI_UNICODE file
49 dialog box file name length to 32k, the maximum allowed by the NT
50 kernel.
51
52 * w32common.h: New file.
53 (ROUND_UP, ROUND_DOWN, get_page_size)
54 (get_allocation_unit, get_processor_type, get_w32_major_version)
55 (get_w32_minor_version, sysinfo_cache, osinfo_cache)
56 (w32_major_version, w32_minor_version, w32_build_number, OS_9X)
57 (OS_NT, os_subtype, cache_system_info): Move here.
58
59 * unexw32.c, unexcw.c: Include w32common.h.
60
61 * emacs.c (main): Use (defined (WINDOWSNT) || defined
62 HAVE_NTGUI) instead of removed HAVE_W32SELECT to decide whether
63 to call syms_of_w32select.
64
65 * cygw32.h: Remove obsolete EXFUN declarations.
66
67 * cygw32.c (Qutf_16_le): Rename to Qutf_16le.
68
69 * Makefile.in (SOME_MACHINE_OBJECTS): Reverse accidental removal
70 of w32inevt.o from SOME_MACHINE_OBJECTS.
71
722012-10-08 Daniel Colascione <dancol@dancol.org>
73
14 * image.c: Permanent fix for JPEG compilation issue --- limit 74 * image.c: Permanent fix for JPEG compilation issue --- limit
15 jpeglib `boolean' redefinition to Cygwin builds. 75 jpeglib `boolean' redefinition to Cygwin builds.
16 76
diff --git a/src/Makefile.in b/src/Makefile.in
index e704f2f5c0c..c24e421bbbc 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -357,7 +357,7 @@ SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
357 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ 357 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
358 fontset.o dbusbind.o cygw32.o \ 358 fontset.o dbusbind.o cygw32.o \
359 nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \ 359 nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
360 w32.o w32console.o w32fns.o w32heap.o \ 360 w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
361 w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \ 361 w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \
362 w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \ 362 w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \
363 xsettings.o xgselect.o termcap.o 363 xsettings.o xgselect.o termcap.o
diff --git a/src/cygw32.c b/src/cygw32.c
index ab7ee91a138..c45a45648e9 100644
--- a/src/cygw32.c
+++ b/src/cygw32.c
@@ -22,7 +22,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22#include "buffer.h" 22#include "buffer.h"
23#include <unistd.h> 23#include <unistd.h>
24#include <fcntl.h> 24#include <fcntl.h>
25static Lisp_Object Qutf_16_le; 25static Lisp_Object Qutf_16le;
26 26
27static Lisp_Object 27static Lisp_Object
28fchdir_unwind (Lisp_Object dir_fd) 28fchdir_unwind (Lisp_Object dir_fd)
@@ -117,13 +117,13 @@ from_unicode (Lisp_Object str)
117 str = Fsubstring (str, make_number (0), make_number (-1)); 117 str = Fsubstring (str, make_number (0), make_number (-1));
118 } 118 }
119 119
120 return code_convert_string_norecord (str, Qutf_16_le, 0); 120 return code_convert_string_norecord (str, Qutf_16le, 0);
121} 121}
122 122
123wchar_t * 123wchar_t *
124to_unicode (Lisp_Object str, Lisp_Object *buf) 124to_unicode (Lisp_Object str, Lisp_Object *buf)
125{ 125{
126 *buf = code_convert_string_norecord (str, Qutf_16_le, 1); 126 *buf = code_convert_string_norecord (str, Qutf_16le, 1);
127 /* We need to make a another copy (in addition to the one made by 127 /* We need to make a another copy (in addition to the one made by
128 code_convert_string_norecord) to ensure that the final string is 128 code_convert_string_norecord) to ensure that the final string is
129 _doubly_ zero terminated --- that is, that the string is 129 _doubly_ zero terminated --- that is, that the string is
@@ -163,7 +163,7 @@ void
163syms_of_cygw32 (void) 163syms_of_cygw32 (void)
164{ 164{
165 /* No, not utf-16-le: that one has a BOM. */ 165 /* No, not utf-16-le: that one has a BOM. */
166 DEFSYM (Qutf_16_le, "utf-16le"); 166 DEFSYM (Qutf_16le, "utf-16le");
167 defsubr (&Scygwin_convert_path_from_windows); 167 defsubr (&Scygwin_convert_path_from_windows);
168 defsubr (&Scygwin_convert_path_to_windows); 168 defsubr (&Scygwin_convert_path_to_windows);
169} 169}
diff --git a/src/cygw32.h b/src/cygw32.h
index 22b6f5692da..78e77a9a141 100644
--- a/src/cygw32.h
+++ b/src/cygw32.h
@@ -46,11 +46,6 @@ extern wchar_t *to_unicode (Lisp_Object str, Lisp_Object *buf);
46 object, to a multi-byte Emacs string, and return it. */ 46 object, to a multi-byte Emacs string, and return it. */
47extern Lisp_Object from_unicode (Lisp_Object str); 47extern Lisp_Object from_unicode (Lisp_Object str);
48 48
49/* *** Path conversion. *** */
50
51EXFUN (Fcygwin_convert_path_to_windows, 2);
52EXFUN (Fcygwin_convert_path_from_windows, 2);
53
54/* *** Misc *** */ 49/* *** Misc *** */
55extern void syms_of_cygw32 (void); 50extern void syms_of_cygw32 (void);
56extern char * w32_strerror (int error_no); 51extern char * w32_strerror (int error_no);
diff --git a/src/emacs.c b/src/emacs.c
index 2e3c880fb53..1d416984d2d 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1415,9 +1415,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1415 syms_of_fontset (); 1415 syms_of_fontset ();
1416#endif /* HAVE_NTGUI */ 1416#endif /* HAVE_NTGUI */
1417 1417
1418#ifdef HAVE_W32SELECT 1418#if defined (WINDOWSNT) || defined (HAVE_NTGUI)
1419 syms_of_w32select (); 1419 syms_of_w32select ();
1420#endif /* HAVE_W32SELECT */ 1420#endif /* WINDOWSNT || HAVE_NTGUI */
1421 1421
1422#ifdef MSDOS 1422#ifdef MSDOS
1423 syms_of_xmenu (); 1423 syms_of_xmenu ();
@@ -1466,9 +1466,10 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1466 globals_of_w32menu (); 1466 globals_of_w32menu ();
1467#endif /* HAVE_NTGUI */ 1467#endif /* HAVE_NTGUI */
1468 1468
1469#ifdef HAVE_W32SELECT 1469#if defined (WINDOWSNT) || defined (HAVE_NTGUI)
1470 globals_of_w32select (); 1470 globals_of_w32select ();
1471#endif /* HAVE_W32SELECT */ 1471#endif /* WINDOWSNT || HAVE_NTGUI */
1472
1472 } 1473 }
1473 1474
1474 init_charset (); 1475 init_charset ();
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 5fc5b6ece46..29b7925f1b9 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -1173,6 +1173,7 @@ $(BLD)/w32.$(O) : \
1173 $(SRC)/w32.c \ 1173 $(SRC)/w32.c \
1174 $(SRC)/ndir.h \ 1174 $(SRC)/ndir.h \
1175 $(SRC)/w32.h \ 1175 $(SRC)/w32.h \
1176 $(SRC)/w32common.h \
1176 $(SRC)/w32heap.h \ 1177 $(SRC)/w32heap.h \
1177 $(NT_INC)/pwd.h \ 1178 $(NT_INC)/pwd.h \
1178 $(NT_INC)/sys/file.h \ 1179 $(NT_INC)/sys/file.h \
@@ -1191,6 +1192,7 @@ $(BLD)/w32.$(O) : \
1191$(BLD)/w32heap.$(O) : \ 1192$(BLD)/w32heap.$(O) : \
1192 $(SRC)/w32heap.c \ 1193 $(SRC)/w32heap.c \
1193 $(SRC)/w32heap.h \ 1194 $(SRC)/w32heap.h \
1195 $(SRC)/w32common.h \
1194 $(CONFIG_H) \ 1196 $(CONFIG_H) \
1195 $(LISP_H) 1197 $(LISP_H)
1196 1198
@@ -1213,6 +1215,7 @@ $(BLD)/w32proc.$(O) : \
1213 $(SRC)/w32proc.c \ 1215 $(SRC)/w32proc.c \
1214 $(SRC)/syswait.h \ 1216 $(SRC)/syswait.h \
1215 $(SRC)/w32.h \ 1217 $(SRC)/w32.h \
1218 $(SRC)/w32common.h \
1216 $(SRC)/w32heap.h \ 1219 $(SRC)/w32heap.h \
1217 $(NT_INC)/nl_types.h \ 1220 $(NT_INC)/nl_types.h \
1218 $(NT_INC)/sys/file.h \ 1221 $(NT_INC)/sys/file.h \
@@ -1230,7 +1233,7 @@ $(BLD)/w32console.$(O) : \
1230 $(SRC)/w32console.c \ 1233 $(SRC)/w32console.c \
1231 $(SRC)/disptab.h \ 1234 $(SRC)/disptab.h \
1232 $(SRC)/termchar.h \ 1235 $(SRC)/termchar.h \
1233 $(SRC)/w32heap.h \ 1236 $(SRC)/w32common.h \
1234 $(SRC)/w32inevt.h \ 1237 $(SRC)/w32inevt.h \
1235 $(CHARACTER_H) \ 1238 $(CHARACTER_H) \
1236 $(CODING_H) \ 1239 $(CODING_H) \
@@ -1468,6 +1471,7 @@ $(BLD)/undo.$(O) : \
1468$(BLD)/unexw32.$(O) : \ 1471$(BLD)/unexw32.$(O) : \
1469 $(SRC)/unexw32.c \ 1472 $(SRC)/unexw32.c \
1470 $(SRC)/unexec.h \ 1473 $(SRC)/unexec.h \
1474 $(SRC)/w32common.h \
1471 $(SRC)/w32heap.h \ 1475 $(SRC)/w32heap.h \
1472 $(CONFIG_H) 1476 $(CONFIG_H)
1473 1477
@@ -1554,6 +1558,7 @@ $(BLD)/w32fns.$(O) : \
1554 $(SRC)/epaths.h \ 1558 $(SRC)/epaths.h \
1555 $(SRC)/fontset.h \ 1559 $(SRC)/fontset.h \
1556 $(SRC)/w32.h \ 1560 $(SRC)/w32.h \
1561 $(SRC)/w32common.h \
1557 $(SRC)/w32heap.h \ 1562 $(SRC)/w32heap.h \
1558 $(BUFFER_H) \ 1563 $(BUFFER_H) \
1559 $(CCL_H) \ 1564 $(CCL_H) \
@@ -1577,7 +1582,7 @@ $(BLD)/w32menu.$(O) : \
1577 $(SRC)/w32menu.c \ 1582 $(SRC)/w32menu.c \
1578 $(SRC)/blockinput.h \ 1583 $(SRC)/blockinput.h \
1579 $(SRC)/keymap.h \ 1584 $(SRC)/keymap.h \
1580 $(SRC)/w32heap.h \ 1585 $(SRC)/w32common.h \
1581 $(BUFFER_H) \ 1586 $(BUFFER_H) \
1582 $(CHARACTER_H) \ 1587 $(CHARACTER_H) \
1583 $(CHARSET_H) \ 1588 $(CHARSET_H) \
@@ -1627,7 +1632,7 @@ $(BLD)/w32select.$(O) : \
1627 $(SRC)/w32select.c \ 1632 $(SRC)/w32select.c \
1628 $(SRC)/blockinput.h \ 1633 $(SRC)/blockinput.h \
1629 $(SRC)/composite.h \ 1634 $(SRC)/composite.h \
1630 $(SRC)/w32heap.h \ 1635 $(SRC)/w32common.h \
1631 $(CHARSET_H) \ 1636 $(CHARSET_H) \
1632 $(CODING_H) \ 1637 $(CODING_H) \
1633 $(CONFIG_H) \ 1638 $(CONFIG_H) \
@@ -1682,7 +1687,7 @@ $(BLD)/w32uniscribe.$(O) : \
1682 1687
1683$(BLD)/w32notify.$(O) : \ 1688$(BLD)/w32notify.$(O) : \
1684 $(SRC)/w32notify.c \ 1689 $(SRC)/w32notify.c \
1685 $(SRC)/w32heap.h \ 1690 $(SRC)/w32common.h \
1686 $(CODING_H) \ 1691 $(CODING_H) \
1687 $(CONFIG_H) \ 1692 $(CONFIG_H) \
1688 $(FRAME_H) \ 1693 $(FRAME_H) \
diff --git a/src/unexcw.c b/src/unexcw.c
index 96c4b4a9aec..8c5d574530d 100644
--- a/src/unexcw.c
+++ b/src/unexcw.c
@@ -20,6 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21#include <config.h> 21#include <config.h>
22#include "unexec.h" 22#include "unexec.h"
23#include "w32common.h"
23 24
24#include <lisp.h> 25#include <lisp.h>
25#include <stdio.h> 26#include <stdio.h>
diff --git a/src/unexw32.c b/src/unexw32.c
index d57378b2421..82671d0f120 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -22,6 +22,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 22
23#include <config.h> 23#include <config.h>
24#include "unexec.h" 24#include "unexec.h"
25#include "w32common.h"
25 26
26#include <stdio.h> 27#include <stdio.h>
27#include <fcntl.h> 28#include <fcntl.h>
diff --git a/src/w32.c b/src/w32.c
index 85210cb8e4c..b50cd13517d 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -173,6 +173,7 @@ typedef struct _REPARSE_DATA_BUFFER {
173 173
174#include "w32.h" 174#include "w32.h"
175#include "ndir.h" 175#include "ndir.h"
176#include "w32common.h"
176#include "w32heap.h" 177#include "w32heap.h"
177#include "systime.h" 178#include "systime.h"
178#include "dispextern.h" /* for xstrcasecmp */ 179#include "dispextern.h" /* for xstrcasecmp */
diff --git a/src/w32common.h b/src/w32common.h
new file mode 100644
index 00000000000..50724e5553c
--- /dev/null
+++ b/src/w32common.h
@@ -0,0 +1,53 @@
1/* Common functions for Microsoft Windows builds of Emacs
2 Copyright (C) 2012 Free Software Foundation, Inc.
3
4This file is part of GNU Emacs.
5
6GNU Emacs is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11GNU Emacs is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
18
19*/
20
21#ifndef W32COMMON_H
22#define W32COMMON_H
23
24#include <windows.h>
25
26#define ROUND_UP(p, align) (((DWORD_PTR)(p) + (align)-1) & ~((DWORD_PTR)(align)-1))
27#define ROUND_DOWN(p, align) ((DWORD_PTR)(p) & ~((DWORD_PTR)(align)-1))
28
29#define get_page_size() sysinfo_cache.dwPageSize
30#define get_allocation_unit() sysinfo_cache.dwAllocationGranularity
31#define get_processor_type() sysinfo_cache.dwProcessorType
32#define get_w32_major_version() w32_major_version
33#define get_w32_minor_version() w32_minor_version
34
35extern SYSTEM_INFO sysinfo_cache;
36extern OSVERSIONINFO osinfo_cache;
37extern unsigned long syspage_mask;
38
39extern int w32_major_version;
40extern int w32_minor_version;
41extern int w32_build_number;
42
43enum {
44 OS_9X = 1,
45 OS_NT
46};
47
48extern int os_subtype;
49
50/* Cache system info, e.g., the NT page size. */
51extern void cache_system_info (void);
52
53#endif /* W32COMMON_H */
diff --git a/src/w32console.c b/src/w32console.c
index 5a44d3748a2..f0574689bf1 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -37,7 +37,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
37#include "termchar.h" 37#include "termchar.h"
38#include "dispextern.h" 38#include "dispextern.h"
39#include "w32term.h" 39#include "w32term.h"
40#include "w32heap.h" /* for os_subtype */ 40#include "w32common.h" /* for os_subtype */
41#include "w32inevt.h" 41#include "w32inevt.h"
42 42
43/* from window.c */ 43/* from window.c */
diff --git a/src/w32fns.c b/src/w32fns.c
index 5833a59497d..6eb12ee917e 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -45,7 +45,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
45#include "systime.h" 45#include "systime.h"
46#include "termhooks.h" 46#include "termhooks.h"
47 47
48#include "w32common.h"
49
50#ifdef WINDOWSNT
48#include "w32heap.h" 51#include "w32heap.h"
52#endif /* WINDOWSNT */
49 53
50#if CYGWIN 54#if CYGWIN
51#include "cygw32.h" 55#include "cygw32.h"
@@ -6114,7 +6118,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
6114 } new_file_details; 6118 } new_file_details;
6115 6119
6116#ifdef NTGUI_UNICODE 6120#ifdef NTGUI_UNICODE
6117 wchar_t filename_buf[MAX_PATH + 1]; 6121 wchar_t filename_buf[32*1024 + 1]; // NT kernel maximum
6118 OPENFILENAMEW * file_details = &new_file_details.details; 6122 OPENFILENAMEW * file_details = &new_file_details.details;
6119#else /* not NTGUI_UNICODE */ 6123#else /* not NTGUI_UNICODE */
6120 char filename_buf[MAX_PATH + 1]; 6124 char filename_buf[MAX_PATH + 1];
@@ -6176,11 +6180,12 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
6176 unixtodos_filename (SDATA (filename)); 6180 unixtodos_filename (SDATA (filename));
6177#endif /* NTGUI_UNICODE */ 6181#endif /* NTGUI_UNICODE */
6178 6182
6179 /* Fill in the structure for the call to GetOpenFileName below. For 6183 /* Fill in the structure for the call to GetOpenFileName below.
6180 NTGUI_UNICODE builds (which run only on NT), we just use the 6184 For NTGUI_UNICODE builds (which run only on NT), we just use
6181 actual size of the structure. For non-NTGUI_UNICODE builds, we 6185 the actual size of the structure. For non-NTGUI_UNICODE
6182 tell the OS we're using an old version of the structure if it's not 6186 builds, we tell the OS we're using an old version of the
6183 new enough to support the newer version. */ 6187 structure if the OS isn't new enough to support the newer
6188 version. */
6184 memset (&new_file_details, 0, sizeof (new_file_details)); 6189 memset (&new_file_details, 0, sizeof (new_file_details));
6185 6190
6186 if (w32_major_version > 4 && w32_major_version < 95) 6191 if (w32_major_version > 4 && w32_major_version < 95)
@@ -6190,7 +6195,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
6190 6195
6191 /* Set up the inout parameter for the selected file name. */ 6196 /* Set up the inout parameter for the selected file name. */
6192 if (SBYTES (filename) + 1 > sizeof (filename_buf)) 6197 if (SBYTES (filename) + 1 > sizeof (filename_buf))
6193 error ("filename too long"); 6198 report_file_error ("filename too long", default_filename);
6194 6199
6195 memcpy (filename_buf, SDATA (filename), SBYTES (filename) + 1); 6200 memcpy (filename_buf, SDATA (filename), SBYTES (filename) + 1);
6196 file_details->lpstrFile = filename_buf; 6201 file_details->lpstrFile = filename_buf;
diff --git a/src/w32heap.c b/src/w32heap.c
index 0ff473fb0a8..311e1064434 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -23,26 +23,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23#include <config.h> 23#include <config.h>
24#include <stdio.h> 24#include <stdio.h>
25 25
26#include "w32common.h"
26#include "w32heap.h" 27#include "w32heap.h"
27#include "lisp.h" /* for VALMASK */ 28#include "lisp.h" /* for VALMASK */
28 29
29#define RVA_TO_PTR(rva) ((unsigned char *)((DWORD_PTR)(rva) + (DWORD_PTR)GetModuleHandle (NULL))) 30#define RVA_TO_PTR(rva) ((unsigned char *)((DWORD_PTR)(rva) + (DWORD_PTR)GetModuleHandle (NULL)))
30 31
31/* This gives us the page size and the size of the allocation unit on NT. */
32SYSTEM_INFO sysinfo_cache;
33
34/* This gives us version, build, and platform identification. */
35extern unsigned long syspage_mask;
36OSVERSIONINFO osinfo_cache;
37
38/* The major and minor versions of NT. */
39int w32_major_version;
40int w32_minor_version;
41int w32_build_number;
42
43/* Distinguish between Windows NT and Windows 95. */
44int os_subtype;
45
46/* Emulate getpagesize. */ 32/* Emulate getpagesize. */
47int 33int
48getpagesize (void) 34getpagesize (void)
diff --git a/src/w32heap.h b/src/w32heap.h
index aae4845b4cc..1630864875f 100644
--- a/src/w32heap.h
+++ b/src/w32heap.h
@@ -24,9 +24,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24 24
25#include <windows.h> 25#include <windows.h>
26 26
27#define ROUND_UP(p, align) (((DWORD_PTR)(p) + (align)-1) & ~((DWORD_PTR)(align)-1))
28#define ROUND_DOWN(p, align) ((DWORD_PTR)(p) & ~((DWORD_PTR)(align)-1))
29
30/* 27/*
31 * Heap related stuff. 28 * Heap related stuff.
32 */ 29 */
@@ -34,28 +31,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
34#define get_committed_heap_size() (get_data_end () - get_data_start ()) 31#define get_committed_heap_size() (get_data_end () - get_data_start ())
35#define get_heap_start() get_data_start () 32#define get_heap_start() get_data_start ()
36#define get_heap_end() get_data_end () 33#define get_heap_end() get_data_end ()
37#define get_page_size() sysinfo_cache.dwPageSize
38#define get_allocation_unit() sysinfo_cache.dwAllocationGranularity
39#define get_processor_type() sysinfo_cache.dwProcessorType
40#define get_w32_major_version() w32_major_version
41#define get_w32_minor_version() w32_minor_version
42 34
43extern unsigned char *get_data_start (void); 35extern unsigned char *get_data_start (void);
44extern unsigned char *get_data_end (void); 36extern unsigned char *get_data_end (void);
45extern size_t reserved_heap_size; 37extern size_t reserved_heap_size;
46extern SYSTEM_INFO sysinfo_cache;
47extern OSVERSIONINFO osinfo_cache;
48extern BOOL using_dynamic_heap; 38extern BOOL using_dynamic_heap;
49extern int w32_major_version;
50extern int w32_minor_version;
51extern int w32_build_number;
52
53enum {
54 OS_9X = 1,
55 OS_NT
56};
57
58extern int os_subtype;
59 39
60/* Emulation of Unix sbrk(). */ 40/* Emulation of Unix sbrk(). */
61extern void *sbrk (ptrdiff_t size); 41extern void *sbrk (ptrdiff_t size);
@@ -66,9 +46,6 @@ extern void init_heap (void);
66/* Round the heap to this size. */ 46/* Round the heap to this size. */
67extern void round_heap (size_t size); 47extern void round_heap (size_t size);
68 48
69/* Cache system info, e.g., the NT page size. */
70extern void cache_system_info (void);
71
72/* ----------------------------------------------------------------- */ 49/* ----------------------------------------------------------------- */
73/* Useful routines for manipulating memory-mapped files. */ 50/* Useful routines for manipulating memory-mapped files. */
74 51
diff --git a/src/w32menu.c b/src/w32menu.c
index 40ee82d42d5..36bf9574fdc 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -56,7 +56,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
56 56
57#include "dispextern.h" 57#include "dispextern.h"
58 58
59#include "w32heap.h" /* for osinfo_cache */ 59#include "w32common.h" /* for osinfo_cache */
60 60
61#undef HAVE_DIALOGS /* TODO: Implement native dialogs. */ 61#undef HAVE_DIALOGS /* TODO: Implement native dialogs. */
62 62
diff --git a/src/w32notify.c b/src/w32notify.c
index 1de4f4a7d8c..05c918d8ac8 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -75,7 +75,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
75 75
76#include "lisp.h" 76#include "lisp.h"
77#include "w32term.h" /* for enter_crit/leave_crit and WM_EMACS_FILENOTIFY */ 77#include "w32term.h" /* for enter_crit/leave_crit and WM_EMACS_FILENOTIFY */
78#include "w32heap.h" /* for OS version data */ 78#include "w32common.h" /* for OS version data */
79#include "w32.h" /* for w32_strerror */ 79#include "w32.h" /* for w32_strerror */
80#include "coding.h" 80#include "coding.h"
81#include "keyboard.h" 81#include "keyboard.h"
diff --git a/src/w32proc.c b/src/w32proc.c
index 7d0039d0d5e..7e8183b0e82 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -51,6 +51,7 @@ extern BOOL WINAPI IsValidLocale (LCID, DWORD);
51 51
52#include "lisp.h" 52#include "lisp.h"
53#include "w32.h" 53#include "w32.h"
54#include "w32common.h"
54#include "w32heap.h" 55#include "w32heap.h"
55#include "systime.h" 56#include "systime.h"
56#include "syswait.h" 57#include "syswait.h"
diff --git a/src/w32select.c b/src/w32select.c
index 1690c3b7824..ee0e6d16b11 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -75,7 +75,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
75#include <config.h> 75#include <config.h>
76#include "lisp.h" 76#include "lisp.h"
77#include "w32term.h" /* for all of the w32 includes */ 77#include "w32term.h" /* for all of the w32 includes */
78#include "w32heap.h" /* os_subtype */ 78#include "w32common.h" /* os_subtype */
79#include "blockinput.h" 79#include "blockinput.h"
80#include "charset.h" 80#include "charset.h"
81#include "coding.h" 81#include "coding.h"
diff --git a/src/w32select.h b/src/w32select.h
index 6924d4d51ae..e895c3d9bf2 100644
--- a/src/w32select.h
+++ b/src/w32select.h
@@ -21,8 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21#define W32SELECT_H 21#define W32SELECT_H
22#include <windows.h> 22#include <windows.h>
23 23
24#define HAVE_W32SELECT 1
25
26extern void syms_of_w32select (void); 24extern void syms_of_w32select (void);
27extern void globals_of_w32select (void); 25extern void globals_of_w32select (void);
28extern void term_w32select (void); 26extern void term_w32select (void);