diff options
| author | Fabrice Popineau | 2012-09-30 23:36:42 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2012-09-30 23:36:42 +0200 |
| commit | 62aba0d4973c5cba7ac7c387bbe133e0e3061c5c (patch) | |
| tree | 19fa592c7c48ffdbd0ebae36de7f516f8c749226 /src | |
| parent | e7a2937b11bffc9ac24936e9f46201ce2abf38cc (diff) | |
| download | emacs-62aba0d4973c5cba7ac7c387bbe133e0e3061c5c.tar.gz emacs-62aba0d4973c5cba7ac7c387bbe133e0e3061c5c.zip | |
Support x64 build on MS-Windows with MSVC.
src/w32term.h (SCROLL_BAR_PACK, SCROLL_BAR_UNPACK): Define for x64.
(SET_SCROLL_BAR_W32_WINDOW): Cast ID to intptr_t, for
compatibility with x64.
src/w32term.c (w32_draw_underwave): Don't use GCC extensions for
defining an XRectangle structure.
src/w32proc.c (RVA_TO_PTR, w32_executable_type): Fix pointer
arithmetics for compatibility with x64.
src/w32menu.c (add_menu_item): Use UINT_PTR instead of UINT, for
compatibility with x64.
src/w32heap.h: Adjust prototypes and declarations.
src/w32heap.c (RVA_TO_PTR, allocate_heap, sbrk, init_heap)
(round_heap): Use DWORD_PTR, ptrdiff_t and size_t instead of
DWORD, long, and unsigned long, for compatibility with x64.
(allocate_heap) [_WIN64]: Reserve 32GB of memory.
(sbrk): Argument is now of type ptrdiff_t.
src/w32fns.c (HMONITOR): Condition declaration on _WIN32_WINNT being
less than 0x0500.
(w32_msg_pump): Use WPARAM type for 'result'.
src/w32.c (init_environment, get_emacs_configuration): Support AMD64
architecture.
(init_ntproc): Cast arguments of _open_osfhandle to intptr_t, for
compatibility with x64.
src/vm-limit.c (lim_data): Now size_t.
(check_memory_limits): Adjust prototypes of real_morecore and
__morecore to receive argument of type ptrdiff_t. Use size_t for
five_percent and data_size.
src/unexw32.c: Use DWORD_PTR instead of DWORD for file-scope
variables, for compatibility with x64.
(rva_to_section, offset_to_section, relocate_offset)
(OFFSET_TO_RVA, RVA_TO_OFFSET, RVA_TO_SECTION_OFFSET)
(PTR_TO_RVA, RVA_TO_PTR, OFFSET_TO_PTR, get_section_info)
(copy_executable_and_dump_data): Use DWORD_PTR instead of DWORD
for compatibility with x64.
src/sysdep.c (STDERR_FILENO): Define if not already defined.
src/ralloc.c (real_morecore): Argument type is now ptrdiff_t.
(__morecore): Argument type is now ptrdiff_t.
(ROUNDUP, MEM_ROUNDUP): Use size_t instead of 'unsigned long'.
(relinquish): Use ptrdiff_t type for 'excess'.
(r_alloc_sbrk): Argument type is now ptrdiff_t.
src/makefile.w32-in (HEAPSIZE): Get value from EMACS_HEAPSIZE.
(bootstrap-temacs-CMD, bootstrap-temacs-SH): Use $(EMACS_PURESIZE)
instead of a literal number.
src/gmalloc.c [WINDOWSNT]: Include w32heap.h.
(min): Define only if not already defined.
src/frame.c (x_report_frame_params): Use EMACS_UINT for the return
value of FRAME_X_WINDOW, to fit a 64-bit pointer on 64-bit Windows
hosts.
src/image.c (x_bitmap_pixmap): Return ptrdiff_t, not int, since
'bitmaps' is a pointer.
src/dispextern.h (x_bitmap_pixmap): Adjust prototype.
src/alloc.c (gdb_make_enums_visible): Now conditional on __GNUC__.
nt/makefile.w32-in ($(TRES)): Use $(EMACS_MANIFEST).
nt/inc/sys/socket.h: Don't map Winsock error codes to standard ones
that are already defined.
nt/inc/ms-w32.h (EMACS_INT, EMACS_UINT, EMACS_INT_MAX, PRIuMAX)
(pI, _INTPTR) [_MSC_VER]: Fix definitions for MSVC.
[_MSC_VER]: Add pragmas to suppress some MSVC warnings.
nt/preprep.c (pfnCheckSumMappedFile, rva_to_section)
(offset_to_section, relocate_offset, OFFSET_TO_RVA)
(RVA_TO_OFFSET, RVA_TO_SECTION_OFFSET, PTR_TO_RVA)
(OFFSET_TO_PTR, ROUND_UP, ROUND_DOWN)
(copy_executable_and_move_sections, ADJUST_IMPORT_RVA, main): Use
DWORD_PTR instead of DWORD for compatibility with x64.
nt/nmake.defs: Support AMD64.
(EMACS_HEAPSIZE, EMACS_PURESIZE, EMACS_MANIFEST): New macros.
nt/gmake.defs: (EMACS_HEAPSIZE, EMACS_PURESIZE, EMACS_MANIFEST):
New macros.
nt/addsection.c (pfnCheckSumMappedFile, rva_to_section)
(offset_to_section, relocate_offset, OFFSET_TO_RVA)
(RVA_TO_OFFSET, RVA_TO_SECTION_OFFSET, PTR_TO_RVA)
(OFFSET_TO_PTR, ROUND_UP, ROUND_DOWN)
(copy_executable_and_add_section, main): Use DWORD_PTR instead of
DWORD, for compatibility with x64.
nt/emacs-x64.manifest: New file.
nt/emacs-x86.manifest: Renamed from emacs.manifest.
lib-src/ntlib.c (gettimeofday): Copy from src/w32.c. lib/gettime.
needs this function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 72 | ||||
| -rw-r--r-- | src/alloc.c | 5 | ||||
| -rw-r--r-- | src/dispextern.h | 2 | ||||
| -rw-r--r-- | src/frame.c | 10 | ||||
| -rw-r--r-- | src/gmalloc.c | 6 | ||||
| -rw-r--r-- | src/image.c | 4 | ||||
| -rw-r--r-- | src/makefile.w32-in | 6 | ||||
| -rw-r--r-- | src/ralloc.c | 16 | ||||
| -rw-r--r-- | src/sysdep.c | 3 | ||||
| -rw-r--r-- | src/unexw32.c | 46 | ||||
| -rw-r--r-- | src/vm-limit.c | 12 | ||||
| -rw-r--r-- | src/w32.c | 20 | ||||
| -rw-r--r-- | src/w32fns.c | 6 | ||||
| -rw-r--r-- | src/w32heap.c | 44 | ||||
| -rw-r--r-- | src/w32heap.h | 12 | ||||
| -rw-r--r-- | src/w32menu.c | 10 | ||||
| -rw-r--r-- | src/w32proc.c | 4 | ||||
| -rw-r--r-- | src/w32term.c | 8 | ||||
| -rw-r--r-- | src/w32term.h | 14 |
19 files changed, 207 insertions, 93 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 257333a3f98..be6ebd33ea6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,75 @@ | |||
| 1 | 2012-09-30 Fabrice Popineau <fabrice.popineau@supelec.fr> | ||
| 2 | |||
| 3 | Support x64 build on MS-Windows. | ||
| 4 | * w32term.h (SCROLL_BAR_PACK, SCROLL_BAR_UNPACK): Define for x64. | ||
| 5 | (SET_SCROLL_BAR_W32_WINDOW): Cast ID to intptr_t, for | ||
| 6 | compatibility with x64. | ||
| 7 | |||
| 8 | * w32term.c (w32_draw_underwave): Don't use GCC extensions for | ||
| 9 | defining an XRectangle structure. | ||
| 10 | |||
| 11 | * w32proc.c (RVA_TO_PTR, w32_executable_type): Fix pointer | ||
| 12 | arithmetics for compatibility with x64. | ||
| 13 | |||
| 14 | * w32menu.c (add_menu_item): Use UINT_PTR instead of UINT, for | ||
| 15 | compatibility with x64. | ||
| 16 | |||
| 17 | * w32heap.h: Adjust prototypes and declarations. | ||
| 18 | |||
| 19 | * w32heap.c (RVA_TO_PTR, allocate_heap, sbrk, init_heap) | ||
| 20 | (round_heap): Use DWORD_PTR, ptrdiff_t and size_t instead of | ||
| 21 | DWORD, long, and unsigned long, for compatibility with x64. | ||
| 22 | (allocate_heap) [_WIN64]: Reserve 32GB of memory. | ||
| 23 | (sbrk): Argument is now of type ptrdiff_t. | ||
| 24 | |||
| 25 | * w32fns.c (HMONITOR): Condition declaration on _WIN32_WINNT being | ||
| 26 | less than 0x0500. | ||
| 27 | (w32_msg_pump): Use WPARAM type for 'result'. | ||
| 28 | |||
| 29 | * w32.c (init_environment, get_emacs_configuration): Support AMD64 | ||
| 30 | architecture. | ||
| 31 | (init_ntproc): Cast arguments of _open_osfhandle to intptr_t, for | ||
| 32 | compatibility with x64. | ||
| 33 | |||
| 34 | * vm-limit.c (lim_data): Now size_t. | ||
| 35 | (check_memory_limits): Adjust prototypes of real_morecore and | ||
| 36 | __morecore to receive argument of type ptrdiff_t. Use size_t for | ||
| 37 | five_percent and data_size. | ||
| 38 | |||
| 39 | * unexw32.c: Use DWORD_PTR instead of DWORD for file-scope | ||
| 40 | variables, for compatibility with x64. | ||
| 41 | (rva_to_section, offset_to_section, relocate_offset) | ||
| 42 | (OFFSET_TO_RVA, RVA_TO_OFFSET, RVA_TO_SECTION_OFFSET) | ||
| 43 | (PTR_TO_RVA, RVA_TO_PTR, OFFSET_TO_PTR, get_section_info) | ||
| 44 | (copy_executable_and_dump_data): Use DWORD_PTR instead of DWORD | ||
| 45 | for compatibility with x64. | ||
| 46 | |||
| 47 | * sysdep.c (STDERR_FILENO): Define if not already defined. | ||
| 48 | |||
| 49 | * ralloc.c (real_morecore): Argument type is now ptrdiff_t. | ||
| 50 | (__morecore): Argument type is now ptrdiff_t. | ||
| 51 | (ROUNDUP, MEM_ROUNDUP): Use size_t instead of 'unsigned long'. | ||
| 52 | (relinquish): Use ptrdiff_t type for 'excess'. | ||
| 53 | (r_alloc_sbrk): Argument type is now ptrdiff_t. | ||
| 54 | |||
| 55 | * makefile.w32-in (HEAPSIZE): Get value from EMACS_HEAPSIZE. | ||
| 56 | (bootstrap-temacs-CMD, bootstrap-temacs-SH): Use $(EMACS_PURESIZE) | ||
| 57 | instead of a literal number. | ||
| 58 | |||
| 59 | * gmalloc.c [WINDOWSNT]: Include w32heap.h. | ||
| 60 | (min): Define only if not already defined. | ||
| 61 | |||
| 62 | * frame.c (x_report_frame_params): Use EMACS_UINT for the return | ||
| 63 | value of FRAME_X_WINDOW, to fit a 64-bit pointer on 64-bit Windows | ||
| 64 | hosts. | ||
| 65 | |||
| 66 | * image.c (x_bitmap_pixmap): Return ptrdiff_t, not int, since | ||
| 67 | 'bitmaps' is a pointer. | ||
| 68 | |||
| 69 | * dispextern.h (x_bitmap_pixmap): Adjust prototype. | ||
| 70 | |||
| 71 | * alloc.c (gdb_make_enums_visible): Now conditional on __GNUC__. | ||
| 72 | |||
| 1 | 2012-09-30 Paul Eggert <eggert@cs.ucla.edu> | 73 | 2012-09-30 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 74 | ||
| 3 | file-attributes has a new optional arg FOLLOW-SYMLINKS. | 75 | file-attributes has a new optional arg FOLLOW-SYMLINKS. |
diff --git a/src/alloc.c b/src/alloc.c index df166b4924a..9278f226b69 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -74,6 +74,7 @@ extern void *sbrk (); | |||
| 74 | #endif | 74 | #endif |
| 75 | #ifdef WINDOWSNT | 75 | #ifdef WINDOWSNT |
| 76 | #include "w32.h" | 76 | #include "w32.h" |
| 77 | #include "w32heap.h" /* for sbrk */ | ||
| 77 | #endif | 78 | #endif |
| 78 | 79 | ||
| 79 | #ifdef DOUG_LEA_MALLOC | 80 | #ifdef DOUG_LEA_MALLOC |
| @@ -6607,7 +6608,8 @@ The time is in seconds as a floating point value. */); | |||
| 6607 | /* When compiled with GCC, GDB might say "No enum type named | 6608 | /* When compiled with GCC, GDB might say "No enum type named |
| 6608 | pvec_type" if we don't have at least one symbol with that type, and | 6609 | pvec_type" if we don't have at least one symbol with that type, and |
| 6609 | then xbacktrace could fail. Similarly for the other enums and | 6610 | then xbacktrace could fail. Similarly for the other enums and |
| 6610 | their values. */ | 6611 | their values. Some non-GCC compilers don't like these constructs. */ |
| 6612 | #ifdef __GNUC__ | ||
| 6611 | union | 6613 | union |
| 6612 | { | 6614 | { |
| 6613 | enum CHARTAB_SIZE_BITS CHARTAB_SIZE_BITS; | 6615 | enum CHARTAB_SIZE_BITS CHARTAB_SIZE_BITS; |
| @@ -6627,3 +6629,4 @@ union | |||
| 6627 | enum lsb_bits lsb_bits; | 6629 | enum lsb_bits lsb_bits; |
| 6628 | #endif | 6630 | #endif |
| 6629 | } const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0}; | 6631 | } const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0}; |
| 6632 | #endif /* __GNUC__ */ | ||
diff --git a/src/dispextern.h b/src/dispextern.h index 3c42d7abb9d..f1ea8e97ee8 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3157,7 +3157,7 @@ extern unsigned row_hash (struct glyph_row *); | |||
| 3157 | 3157 | ||
| 3158 | extern int x_bitmap_height (struct frame *, ptrdiff_t); | 3158 | extern int x_bitmap_height (struct frame *, ptrdiff_t); |
| 3159 | extern int x_bitmap_width (struct frame *, ptrdiff_t); | 3159 | extern int x_bitmap_width (struct frame *, ptrdiff_t); |
| 3160 | extern int x_bitmap_pixmap (struct frame *, ptrdiff_t); | 3160 | extern ptrdiff_t x_bitmap_pixmap (struct frame *, ptrdiff_t); |
| 3161 | extern void x_reference_bitmap (struct frame *, ptrdiff_t); | 3161 | extern void x_reference_bitmap (struct frame *, ptrdiff_t); |
| 3162 | extern ptrdiff_t x_create_bitmap_from_data (struct frame *, char *, | 3162 | extern ptrdiff_t x_create_bitmap_from_data (struct frame *, char *, |
| 3163 | unsigned int, unsigned int); | 3163 | unsigned int, unsigned int); |
diff --git a/src/frame.c b/src/frame.c index 4bcacef39c5..33bbe0ad704 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -3030,7 +3030,7 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr) | |||
| 3030 | { | 3030 | { |
| 3031 | char buf[16]; | 3031 | char buf[16]; |
| 3032 | Lisp_Object tem; | 3032 | Lisp_Object tem; |
| 3033 | unsigned long w; | 3033 | EMACS_UINT w; |
| 3034 | 3034 | ||
| 3035 | /* Represent negative positions (off the top or left screen edge) | 3035 | /* Represent negative positions (off the top or left screen edge) |
| 3036 | in a way that Fmodify_frame_parameters will understand correctly. */ | 3036 | in a way that Fmodify_frame_parameters will understand correctly. */ |
| @@ -3067,17 +3067,17 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr) | |||
| 3067 | MS-Windows it returns a value whose type is HANDLE, which is | 3067 | MS-Windows it returns a value whose type is HANDLE, which is |
| 3068 | actually a pointer. Explicit casting avoids compiler | 3068 | actually a pointer. Explicit casting avoids compiler |
| 3069 | warnings. */ | 3069 | warnings. */ |
| 3070 | w = (unsigned long) FRAME_X_WINDOW (f); | 3070 | w = (EMACS_UINT) FRAME_X_WINDOW (f); |
| 3071 | store_in_alist (alistptr, Qwindow_id, | 3071 | store_in_alist (alistptr, Qwindow_id, |
| 3072 | make_formatted_string (buf, "%lu", w)); | 3072 | make_formatted_string (buf, "%"pMu, w)); |
| 3073 | #ifdef HAVE_X_WINDOWS | 3073 | #ifdef HAVE_X_WINDOWS |
| 3074 | #ifdef USE_X_TOOLKIT | 3074 | #ifdef USE_X_TOOLKIT |
| 3075 | /* Tooltip frame may not have this widget. */ | 3075 | /* Tooltip frame may not have this widget. */ |
| 3076 | if (FRAME_X_OUTPUT (f)->widget) | 3076 | if (FRAME_X_OUTPUT (f)->widget) |
| 3077 | #endif | 3077 | #endif |
| 3078 | w = (unsigned long) FRAME_OUTER_WINDOW (f); | 3078 | w = (EMACS_UINT) FRAME_OUTER_WINDOW (f); |
| 3079 | store_in_alist (alistptr, Qouter_window_id, | 3079 | store_in_alist (alistptr, Qouter_window_id, |
| 3080 | make_formatted_string (buf, "%lu", w)); | 3080 | make_formatted_string (buf, "%"pMu, w)); |
| 3081 | #endif | 3081 | #endif |
| 3082 | store_in_alist (alistptr, Qicon_name, f->icon_name); | 3082 | store_in_alist (alistptr, Qicon_name, f->icon_name); |
| 3083 | FRAME_SAMPLE_VISIBILITY (f); | 3083 | FRAME_SAMPLE_VISIBILITY (f); |
diff --git a/src/gmalloc.c b/src/gmalloc.c index 78d6934755b..9eb9610ab23 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c | |||
| @@ -36,6 +36,10 @@ Fifth Floor, Boston, MA 02110-1301, USA. | |||
| 36 | #include <pthread.h> | 36 | #include <pthread.h> |
| 37 | #endif | 37 | #endif |
| 38 | 38 | ||
| 39 | #ifdef WINDOWSNT | ||
| 40 | #include <w32heap.h> /* for sbrk */ | ||
| 41 | #endif | ||
| 42 | |||
| 39 | #ifdef __cplusplus | 43 | #ifdef __cplusplus |
| 40 | extern "C" | 44 | extern "C" |
| 41 | { | 45 | { |
| @@ -1289,7 +1293,9 @@ Fifth Floor, Boston, MA 02110-1301, USA. | |||
| 1289 | The author may be reached (Email) at the address mike@ai.mit.edu, | 1293 | The author may be reached (Email) at the address mike@ai.mit.edu, |
| 1290 | or (US mail) as Mike Haertel c/o Free Software Foundation. */ | 1294 | or (US mail) as Mike Haertel c/o Free Software Foundation. */ |
| 1291 | 1295 | ||
| 1296 | #ifndef min | ||
| 1292 | #define min(A, B) ((A) < (B) ? (A) : (B)) | 1297 | #define min(A, B) ((A) < (B) ? (A) : (B)) |
| 1298 | #endif | ||
| 1293 | 1299 | ||
| 1294 | /* On Cygwin the dumped emacs may try to realloc storage allocated in | 1300 | /* On Cygwin the dumped emacs may try to realloc storage allocated in |
| 1295 | the static heap. We just malloc space in the new heap and copy the | 1301 | the static heap. We just malloc space in the new heap and copy the |
diff --git a/src/image.c b/src/image.c index 7901b95f236..91eeb91920c 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -186,11 +186,11 @@ x_bitmap_width (FRAME_PTR f, ptrdiff_t id) | |||
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) | 188 | #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) |
| 189 | int | 189 | ptrdiff_t |
| 190 | x_bitmap_pixmap (FRAME_PTR f, ptrdiff_t id) | 190 | x_bitmap_pixmap (FRAME_PTR f, ptrdiff_t id) |
| 191 | { | 191 | { |
| 192 | /* HAVE_NTGUI needs the explicit cast here. */ | 192 | /* HAVE_NTGUI needs the explicit cast here. */ |
| 193 | return (int) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; | 193 | return (ptrdiff_t) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; |
| 194 | } | 194 | } |
| 195 | #endif | 195 | #endif |
| 196 | 196 | ||
diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 3d1464cc742..5509f7d3afc 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in | |||
| @@ -25,7 +25,7 @@ ALL = emacs | |||
| 25 | EMACSLOADPATH=$(CURDIR)/../lisp | 25 | EMACSLOADPATH=$(CURDIR)/../lisp |
| 26 | 26 | ||
| 27 | # Size in MBs of the static heap in temacs.exe. | 27 | # Size in MBs of the static heap in temacs.exe. |
| 28 | HEAPSIZE = 27 | 28 | HEAPSIZE = $(EMACS_HEAPSIZE) |
| 29 | 29 | ||
| 30 | LOCAL_FLAGS = -Demacs=1 -I../lib -I../nt/inc -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS) | 30 | LOCAL_FLAGS = -Demacs=1 -I../lib -I../nt/inc -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS) |
| 31 | 31 | ||
| @@ -247,10 +247,10 @@ bootstrap: bootstrap-emacs | |||
| 247 | # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as | 247 | # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as |
| 248 | # this can break with GNU Make 3.81 and later if sh.exe is used. | 248 | # this can break with GNU Make 3.81 and later if sh.exe is used. |
| 249 | bootstrap-temacs-CMD: | 249 | bootstrap-temacs-CMD: |
| 250 | $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(ESC_CFLAGS) -DPURESIZE=5000000$(ARGQUOTE) | 250 | $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(ESC_CFLAGS) -DPURESIZE=$(EMACS_PURESIZE)$(ARGQUOTE) |
| 251 | 251 | ||
| 252 | bootstrap-temacs-SH: | 252 | bootstrap-temacs-SH: |
| 253 | $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(CFLAGS) -DPURESIZE=5000000$(ARGQUOTE) | 253 | $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(CFLAGS) -DPURESIZE=$(EMACS_PURESIZE)$(ARGQUOTE) |
| 254 | 254 | ||
| 255 | bootstrap-temacs: | 255 | bootstrap-temacs: |
| 256 | $(MAKE) $(MFLAGS) bootstrap-temacs-$(SHELLTYPE) | 256 | $(MAKE) $(MFLAGS) bootstrap-temacs-$(SHELLTYPE) |
diff --git a/src/ralloc.c b/src/ralloc.c index ab91baae5b5..9422215b54f 100644 --- a/src/ralloc.c +++ b/src/ralloc.c | |||
| @@ -72,7 +72,7 @@ static void r_alloc_init (void); | |||
| 72 | /* Declarations for working with the malloc, ralloc, and system breaks. */ | 72 | /* Declarations for working with the malloc, ralloc, and system breaks. */ |
| 73 | 73 | ||
| 74 | /* Function to set the real break value. */ | 74 | /* Function to set the real break value. */ |
| 75 | POINTER (*real_morecore) (long int); | 75 | POINTER (*real_morecore) (ptrdiff_t); |
| 76 | 76 | ||
| 77 | /* The break value, as seen by malloc. */ | 77 | /* The break value, as seen by malloc. */ |
| 78 | static POINTER virtual_break_value; | 78 | static POINTER virtual_break_value; |
| @@ -91,18 +91,18 @@ static int extra_bytes; | |||
| 91 | /* Macros for rounding. Note that rounding to any value is possible | 91 | /* Macros for rounding. Note that rounding to any value is possible |
| 92 | by changing the definition of PAGE. */ | 92 | by changing the definition of PAGE. */ |
| 93 | #define PAGE (getpagesize ()) | 93 | #define PAGE (getpagesize ()) |
| 94 | #define ROUNDUP(size) (((unsigned long int) (size) + page_size - 1) \ | 94 | #define ROUNDUP(size) (((size_t) (size) + page_size - 1) \ |
| 95 | & ~(page_size - 1)) | 95 | & ~((size_t)page_size - 1)) |
| 96 | 96 | ||
| 97 | #define MEM_ALIGN sizeof (double) | 97 | #define MEM_ALIGN sizeof (double) |
| 98 | #define MEM_ROUNDUP(addr) (((unsigned long int)(addr) + MEM_ALIGN - 1) \ | 98 | #define MEM_ROUNDUP(addr) (((size_t)(addr) + MEM_ALIGN - 1) \ |
| 99 | & ~(MEM_ALIGN - 1)) | 99 | & ~((size_t)MEM_ALIGN - 1)) |
| 100 | 100 | ||
| 101 | /* The hook `malloc' uses for the function which gets more space | 101 | /* The hook `malloc' uses for the function which gets more space |
| 102 | from the system. */ | 102 | from the system. */ |
| 103 | 103 | ||
| 104 | #ifndef SYSTEM_MALLOC | 104 | #ifndef SYSTEM_MALLOC |
| 105 | extern POINTER (*__morecore) (long int); | 105 | extern POINTER (*__morecore) (ptrdiff_t); |
| 106 | #endif | 106 | #endif |
| 107 | 107 | ||
| 108 | 108 | ||
| @@ -308,7 +308,7 @@ static void | |||
| 308 | relinquish (void) | 308 | relinquish (void) |
| 309 | { | 309 | { |
| 310 | register heap_ptr h; | 310 | register heap_ptr h; |
| 311 | long excess = 0; | 311 | ptrdiff_t excess = 0; |
| 312 | 312 | ||
| 313 | /* Add the amount of space beyond break_value | 313 | /* Add the amount of space beyond break_value |
| 314 | in all heaps which have extend beyond break_value at all. */ | 314 | in all heaps which have extend beyond break_value at all. */ |
| @@ -752,7 +752,7 @@ free_bloc (bloc_ptr bloc) | |||
| 752 | GNU malloc package. */ | 752 | GNU malloc package. */ |
| 753 | 753 | ||
| 754 | static POINTER | 754 | static POINTER |
| 755 | r_alloc_sbrk (long int size) | 755 | r_alloc_sbrk (ptrdiff_t size) |
| 756 | { | 756 | { |
| 757 | register bloc_ptr b; | 757 | register bloc_ptr b; |
| 758 | POINTER address; | 758 | POINTER address; |
diff --git a/src/sysdep.c b/src/sysdep.c index b7ddafdcea7..efebb49870c 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -54,6 +54,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 54 | #ifdef WINDOWSNT | 54 | #ifdef WINDOWSNT |
| 55 | #define read sys_read | 55 | #define read sys_read |
| 56 | #define write sys_write | 56 | #define write sys_write |
| 57 | #ifndef STDERR_FILENO | ||
| 58 | #define STDERR_FILENO fileno(GetStdHandle(STD_ERROR_HANDLE)) | ||
| 59 | #endif | ||
| 57 | #include <windows.h> | 60 | #include <windows.h> |
| 58 | #endif /* not WINDOWSNT */ | 61 | #endif /* not WINDOWSNT */ |
| 59 | 62 | ||
diff --git a/src/unexw32.c b/src/unexw32.c index 52b2ec4bf2b..f8e755cbd2e 100644 --- a/src/unexw32.c +++ b/src/unexw32.c | |||
| @@ -67,18 +67,18 @@ void dump_bss_and_heap (file_data *p_infile, file_data *p_outfile); | |||
| 67 | /* Cached info about the .data section in the executable. */ | 67 | /* Cached info about the .data section in the executable. */ |
| 68 | PIMAGE_SECTION_HEADER data_section; | 68 | PIMAGE_SECTION_HEADER data_section; |
| 69 | PCHAR data_start = 0; | 69 | PCHAR data_start = 0; |
| 70 | DWORD data_size = 0; | 70 | DWORD_PTR data_size = 0; |
| 71 | 71 | ||
| 72 | /* Cached info about the .bss section in the executable. */ | 72 | /* Cached info about the .bss section in the executable. */ |
| 73 | PIMAGE_SECTION_HEADER bss_section; | 73 | PIMAGE_SECTION_HEADER bss_section; |
| 74 | PCHAR bss_start = 0; | 74 | PCHAR bss_start = 0; |
| 75 | DWORD bss_size = 0; | 75 | DWORD_PTR bss_size = 0; |
| 76 | DWORD extra_bss_size = 0; | 76 | DWORD_PTR extra_bss_size = 0; |
| 77 | /* bss data that is static might be discontiguous from non-static. */ | 77 | /* bss data that is static might be discontiguous from non-static. */ |
| 78 | PIMAGE_SECTION_HEADER bss_section_static; | 78 | PIMAGE_SECTION_HEADER bss_section_static; |
| 79 | PCHAR bss_start_static = 0; | 79 | PCHAR bss_start_static = 0; |
| 80 | DWORD bss_size_static = 0; | 80 | DWORD_PTR bss_size_static = 0; |
| 81 | DWORD extra_bss_size_static = 0; | 81 | DWORD_PTR extra_bss_size_static = 0; |
| 82 | 82 | ||
| 83 | PIMAGE_SECTION_HEADER heap_section; | 83 | PIMAGE_SECTION_HEADER heap_section; |
| 84 | 84 | ||
| @@ -231,7 +231,7 @@ find_section (char * name, IMAGE_NT_HEADERS * nt_header) | |||
| 231 | /* Return pointer to section header for section containing the given | 231 | /* Return pointer to section header for section containing the given |
| 232 | relative virtual address. */ | 232 | relative virtual address. */ |
| 233 | IMAGE_SECTION_HEADER * | 233 | IMAGE_SECTION_HEADER * |
| 234 | rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header) | 234 | rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header) |
| 235 | { | 235 | { |
| 236 | PIMAGE_SECTION_HEADER section; | 236 | PIMAGE_SECTION_HEADER section; |
| 237 | int i; | 237 | int i; |
| @@ -246,7 +246,7 @@ rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header) | |||
| 246 | some very old exes (eg. gzip dated Dec 1993). Since | 246 | some very old exes (eg. gzip dated Dec 1993). Since |
| 247 | w32_executable_type relies on this function to work reliably, | 247 | w32_executable_type relies on this function to work reliably, |
| 248 | we need to cope with this. */ | 248 | we need to cope with this. */ |
| 249 | DWORD real_size = max (section->SizeOfRawData, | 249 | DWORD_PTR real_size = max (section->SizeOfRawData, |
| 250 | section->Misc.VirtualSize); | 250 | section->Misc.VirtualSize); |
| 251 | if (rva >= section->VirtualAddress | 251 | if (rva >= section->VirtualAddress |
| 252 | && rva < section->VirtualAddress + real_size) | 252 | && rva < section->VirtualAddress + real_size) |
| @@ -259,7 +259,7 @@ rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header) | |||
| 259 | /* Return pointer to section header for section containing the given | 259 | /* Return pointer to section header for section containing the given |
| 260 | offset in its raw data area. */ | 260 | offset in its raw data area. */ |
| 261 | IMAGE_SECTION_HEADER * | 261 | IMAGE_SECTION_HEADER * |
| 262 | offset_to_section (DWORD offset, IMAGE_NT_HEADERS * nt_header) | 262 | offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header) |
| 263 | { | 263 | { |
| 264 | PIMAGE_SECTION_HEADER section; | 264 | PIMAGE_SECTION_HEADER section; |
| 265 | int i; | 265 | int i; |
| @@ -279,8 +279,8 @@ offset_to_section (DWORD offset, IMAGE_NT_HEADERS * nt_header) | |||
| 279 | /* Return offset to an object in dst, given offset in src. We assume | 279 | /* Return offset to an object in dst, given offset in src. We assume |
| 280 | there is at least one section in both src and dst images, and that | 280 | there is at least one section in both src and dst images, and that |
| 281 | the some sections may have been added to dst (after sections in src). */ | 281 | the some sections may have been added to dst (after sections in src). */ |
| 282 | DWORD | 282 | DWORD_PTR |
| 283 | relocate_offset (DWORD offset, | 283 | relocate_offset (DWORD_PTR offset, |
| 284 | IMAGE_NT_HEADERS * src_nt_header, | 284 | IMAGE_NT_HEADERS * src_nt_header, |
| 285 | IMAGE_NT_HEADERS * dst_nt_header) | 285 | IMAGE_NT_HEADERS * dst_nt_header) |
| 286 | { | 286 | { |
| @@ -314,25 +314,25 @@ relocate_offset (DWORD offset, | |||
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | #define OFFSET_TO_RVA(offset, section) \ | 316 | #define OFFSET_TO_RVA(offset, section) \ |
| 317 | (section->VirtualAddress + ((DWORD)(offset) - section->PointerToRawData)) | 317 | (section->VirtualAddress + ((DWORD_PTR)(offset) - section->PointerToRawData)) |
| 318 | 318 | ||
| 319 | #define RVA_TO_OFFSET(rva, section) \ | 319 | #define RVA_TO_OFFSET(rva, section) \ |
| 320 | (section->PointerToRawData + ((DWORD)(rva) - section->VirtualAddress)) | 320 | (section->PointerToRawData + ((DWORD_PTR)(rva) - section->VirtualAddress)) |
| 321 | 321 | ||
| 322 | #define RVA_TO_SECTION_OFFSET(rva, section) \ | 322 | #define RVA_TO_SECTION_OFFSET(rva, section) \ |
| 323 | ((DWORD)(rva) - section->VirtualAddress) | 323 | ((DWORD_PTR)(rva) - section->VirtualAddress) |
| 324 | 324 | ||
| 325 | /* Convert address in executing image to RVA. */ | 325 | /* Convert address in executing image to RVA. */ |
| 326 | #define PTR_TO_RVA(ptr) ((DWORD)(ptr) - (DWORD) GetModuleHandle (NULL)) | 326 | #define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL)) |
| 327 | 327 | ||
| 328 | #define RVA_TO_PTR(var,section,filedata) \ | 328 | #define RVA_TO_PTR(var,section,filedata) \ |
| 329 | ((void *)(RVA_TO_OFFSET (var,section) + (filedata).file_base)) | 329 | ((DWORD_PTR)(RVA_TO_OFFSET (var,section) + (filedata).file_base)) |
| 330 | 330 | ||
| 331 | #define PTR_TO_OFFSET(ptr, pfile_data) \ | 331 | #define PTR_TO_OFFSET(ptr, pfile_data) \ |
| 332 | ((unsigned char *)(ptr) - (pfile_data)->file_base) | 332 | ((unsigned char *)(ptr) - (pfile_data)->file_base) |
| 333 | 333 | ||
| 334 | #define OFFSET_TO_PTR(offset, pfile_data) \ | 334 | #define OFFSET_TO_PTR(offset, pfile_data) \ |
| 335 | ((pfile_data)->file_base + (DWORD)(offset)) | 335 | ((pfile_data)->file_base + (DWORD_PTR)(offset)) |
| 336 | 336 | ||
| 337 | 337 | ||
| 338 | /* Flip through the executable and cache the info necessary for dumping. */ | 338 | /* Flip through the executable and cache the info necessary for dumping. */ |
| @@ -349,7 +349,7 @@ get_section_info (file_data *p_infile) | |||
| 349 | printf ("Unknown EXE header in %s...bailing.\n", p_infile->name); | 349 | printf ("Unknown EXE header in %s...bailing.\n", p_infile->name); |
| 350 | exit (1); | 350 | exit (1); |
| 351 | } | 351 | } |
| 352 | nt_header = (PIMAGE_NT_HEADERS) (((unsigned long) dos_header) + | 352 | nt_header = (PIMAGE_NT_HEADERS) (((DWORD_PTR) dos_header) + |
| 353 | dos_header->e_lfanew); | 353 | dos_header->e_lfanew); |
| 354 | if (nt_header == NULL) | 354 | if (nt_header == NULL) |
| 355 | { | 355 | { |
| @@ -488,7 +488,7 @@ copy_executable_and_dump_data (file_data *p_infile, | |||
| 488 | PIMAGE_NT_HEADERS dst_nt_header; | 488 | PIMAGE_NT_HEADERS dst_nt_header; |
| 489 | PIMAGE_SECTION_HEADER section; | 489 | PIMAGE_SECTION_HEADER section; |
| 490 | PIMAGE_SECTION_HEADER dst_section; | 490 | PIMAGE_SECTION_HEADER dst_section; |
| 491 | DWORD offset; | 491 | DWORD_PTR offset; |
| 492 | int i; | 492 | int i; |
| 493 | int be_verbose = GetEnvironmentVariable ("DEBUG_DUMP", NULL, 0) > 0; | 493 | int be_verbose = GetEnvironmentVariable ("DEBUG_DUMP", NULL, 0) > 0; |
| 494 | 494 | ||
| @@ -541,17 +541,17 @@ copy_executable_and_dump_data (file_data *p_infile, | |||
| 541 | Note that dst is updated implicitly by each COPY_CHUNK. */ | 541 | Note that dst is updated implicitly by each COPY_CHUNK. */ |
| 542 | 542 | ||
| 543 | dos_header = (PIMAGE_DOS_HEADER) p_infile->file_base; | 543 | dos_header = (PIMAGE_DOS_HEADER) p_infile->file_base; |
| 544 | nt_header = (PIMAGE_NT_HEADERS) (((unsigned long) dos_header) + | 544 | nt_header = (PIMAGE_NT_HEADERS) (((DWORD_PTR) dos_header) + |
| 545 | dos_header->e_lfanew); | 545 | dos_header->e_lfanew); |
| 546 | section = IMAGE_FIRST_SECTION (nt_header); | 546 | section = IMAGE_FIRST_SECTION (nt_header); |
| 547 | 547 | ||
| 548 | dst = (unsigned char *) p_outfile->file_base; | 548 | dst = (unsigned char *) p_outfile->file_base; |
| 549 | 549 | ||
| 550 | COPY_CHUNK ("Copying DOS header...", dos_header, | 550 | COPY_CHUNK ("Copying DOS header...", dos_header, |
| 551 | (DWORD) nt_header - (DWORD) dos_header, be_verbose); | 551 | (DWORD_PTR) nt_header - (DWORD_PTR) dos_header, be_verbose); |
| 552 | dst_nt_header = (PIMAGE_NT_HEADERS) dst; | 552 | dst_nt_header = (PIMAGE_NT_HEADERS) dst; |
| 553 | COPY_CHUNK ("Copying NT header...", nt_header, | 553 | COPY_CHUNK ("Copying NT header...", nt_header, |
| 554 | (DWORD) section - (DWORD) nt_header, be_verbose); | 554 | (DWORD_PTR) section - (DWORD_PTR) nt_header, be_verbose); |
| 555 | dst_section = (PIMAGE_SECTION_HEADER) dst; | 555 | dst_section = (PIMAGE_SECTION_HEADER) dst; |
| 556 | COPY_CHUNK ("Copying section table...", section, | 556 | COPY_CHUNK ("Copying section table...", section, |
| 557 | nt_header->FileHeader.NumberOfSections * sizeof (*section), | 557 | nt_header->FileHeader.NumberOfSections * sizeof (*section), |
| @@ -627,8 +627,8 @@ copy_executable_and_dump_data (file_data *p_infile, | |||
| 627 | } | 627 | } |
| 628 | if (section == heap_section) | 628 | if (section == heap_section) |
| 629 | { | 629 | { |
| 630 | DWORD heap_start = (DWORD) get_heap_start (); | 630 | DWORD_PTR heap_start = (DWORD_PTR) get_heap_start (); |
| 631 | DWORD heap_size = get_committed_heap_size (); | 631 | DWORD_PTR heap_size = get_committed_heap_size (); |
| 632 | 632 | ||
| 633 | /* Dump the used portion of the predump heap, adjusting the | 633 | /* Dump the used portion of the predump heap, adjusting the |
| 634 | section's size to the appropriate size. */ | 634 | section's size to the appropriate size. */ |
diff --git a/src/vm-limit.c b/src/vm-limit.c index 8de0acd1bb2..3020b84858a 100644 --- a/src/vm-limit.c +++ b/src/vm-limit.c | |||
| @@ -41,7 +41,7 @@ static void (*warn_function) (const char *); | |||
| 41 | static POINTER data_space_start; | 41 | static POINTER data_space_start; |
| 42 | 42 | ||
| 43 | /* Number of bytes of writable memory we can expect to be able to get. */ | 43 | /* Number of bytes of writable memory we can expect to be able to get. */ |
| 44 | static unsigned long lim_data; | 44 | static size_t lim_data; |
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | #if defined (HAVE_GETRLIMIT) && defined (RLIMIT_AS) | 47 | #if defined (HAVE_GETRLIMIT) && defined (RLIMIT_AS) |
| @@ -88,7 +88,7 @@ get_lim_data (void) | |||
| 88 | static void | 88 | static void |
| 89 | get_lim_data (void) | 89 | get_lim_data (void) |
| 90 | { | 90 | { |
| 91 | extern unsigned long reserved_heap_size; | 91 | extern size_t reserved_heap_size; |
| 92 | lim_data = reserved_heap_size; | 92 | lim_data = reserved_heap_size; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| @@ -166,13 +166,13 @@ static void | |||
| 166 | check_memory_limits (void) | 166 | check_memory_limits (void) |
| 167 | { | 167 | { |
| 168 | #ifdef REL_ALLOC | 168 | #ifdef REL_ALLOC |
| 169 | extern POINTER (*real_morecore) (long); | 169 | extern POINTER (*real_morecore) (ptrdiff_t); |
| 170 | #endif | 170 | #endif |
| 171 | extern POINTER (*__morecore) (long); | 171 | extern POINTER (*__morecore) (ptrdiff_t); |
| 172 | 172 | ||
| 173 | register POINTER cp; | 173 | register POINTER cp; |
| 174 | unsigned long five_percent; | 174 | size_t five_percent; |
| 175 | unsigned long data_size; | 175 | size_t data_size; |
| 176 | enum warnlevel new_warnlevel; | 176 | enum warnlevel new_warnlevel; |
| 177 | 177 | ||
| 178 | if (lim_data == 0) | 178 | if (lim_data == 0) |
| @@ -1738,7 +1738,8 @@ init_environment (char ** argv) | |||
| 1738 | /* FIXME: should use substring of get_emacs_configuration (). | 1738 | /* FIXME: should use substring of get_emacs_configuration (). |
| 1739 | But I don't think the Windows build supports alpha, mips etc | 1739 | But I don't think the Windows build supports alpha, mips etc |
| 1740 | anymore, so have taken the easy option for now. */ | 1740 | anymore, so have taken the easy option for now. */ |
| 1741 | else if (p && xstrcasecmp (p, "\\i386") == 0) | 1741 | else if (p && (xstrcasecmp (p, "\\i386") == 0 |
| 1742 | || xstrcasecmp (p, "\\AMD64") == 0)) | ||
| 1742 | { | 1743 | { |
| 1743 | *p = 0; | 1744 | *p = 0; |
| 1744 | p = strrchr (modname, '\\'); | 1745 | p = strrchr (modname, '\\'); |
| @@ -1886,7 +1887,16 @@ get_emacs_configuration (void) | |||
| 1886 | case PROCESSOR_INTEL_386: | 1887 | case PROCESSOR_INTEL_386: |
| 1887 | case PROCESSOR_INTEL_486: | 1888 | case PROCESSOR_INTEL_486: |
| 1888 | case PROCESSOR_INTEL_PENTIUM: | 1889 | case PROCESSOR_INTEL_PENTIUM: |
| 1890 | #ifdef _WIN64 | ||
| 1891 | arch = "amd64"; | ||
| 1892 | #else | ||
| 1889 | arch = "i386"; | 1893 | arch = "i386"; |
| 1894 | #endif | ||
| 1895 | break; | ||
| 1896 | #endif | ||
| 1897 | #ifdef PROCESSOR_AMD_X8664 | ||
| 1898 | case PROCESSOR_AMD_X8664: | ||
| 1899 | arch = "amd64"; | ||
| 1890 | break; | 1900 | break; |
| 1891 | #endif | 1901 | #endif |
| 1892 | 1902 | ||
| @@ -6646,19 +6656,19 @@ init_ntproc (int dumping) | |||
| 6646 | fclose (stderr); | 6656 | fclose (stderr); |
| 6647 | 6657 | ||
| 6648 | if (stdin_save != INVALID_HANDLE_VALUE) | 6658 | if (stdin_save != INVALID_HANDLE_VALUE) |
| 6649 | _open_osfhandle ((long) stdin_save, O_TEXT); | 6659 | _open_osfhandle ((intptr_t) stdin_save, O_TEXT); |
| 6650 | else | 6660 | else |
| 6651 | _open ("nul", O_TEXT | O_NOINHERIT | O_RDONLY); | 6661 | _open ("nul", O_TEXT | O_NOINHERIT | O_RDONLY); |
| 6652 | _fdopen (0, "r"); | 6662 | _fdopen (0, "r"); |
| 6653 | 6663 | ||
| 6654 | if (stdout_save != INVALID_HANDLE_VALUE) | 6664 | if (stdout_save != INVALID_HANDLE_VALUE) |
| 6655 | _open_osfhandle ((long) stdout_save, O_TEXT); | 6665 | _open_osfhandle ((intptr_t) stdout_save, O_TEXT); |
| 6656 | else | 6666 | else |
| 6657 | _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); | 6667 | _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); |
| 6658 | _fdopen (1, "w"); | 6668 | _fdopen (1, "w"); |
| 6659 | 6669 | ||
| 6660 | if (stderr_save != INVALID_HANDLE_VALUE) | 6670 | if (stderr_save != INVALID_HANDLE_VALUE) |
| 6661 | _open_osfhandle ((long) stderr_save, O_TEXT); | 6671 | _open_osfhandle ((intptr_t) stderr_save, O_TEXT); |
| 6662 | else | 6672 | else |
| 6663 | _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); | 6673 | _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); |
| 6664 | _fdopen (2, "w"); | 6674 | _fdopen (2, "w"); |
| @@ -6779,7 +6789,7 @@ serial_open (char *port) | |||
| 6779 | OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); | 6789 | OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); |
| 6780 | if (hnd == INVALID_HANDLE_VALUE) | 6790 | if (hnd == INVALID_HANDLE_VALUE) |
| 6781 | error ("Could not open %s", port); | 6791 | error ("Could not open %s", port); |
| 6782 | fd = (int) _open_osfhandle ((int) hnd, 0); | 6792 | fd = (int) _open_osfhandle ((intptr_t) hnd, 0); |
| 6783 | if (fd == -1) | 6793 | if (fd == -1) |
| 6784 | error ("Could not open %s", port); | 6794 | error ("Could not open %s", port); |
| 6785 | 6795 | ||
diff --git a/src/w32fns.c b/src/w32fns.c index b857e450476..6d5d6822354 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -137,7 +137,7 @@ struct MONITOR_INFO | |||
| 137 | }; | 137 | }; |
| 138 | 138 | ||
| 139 | /* Reportedly, MSVC does not have this in its headers. */ | 139 | /* Reportedly, MSVC does not have this in its headers. */ |
| 140 | #ifdef _MSC_VER | 140 | #if defined (_MSC_VER) && _WIN32_WINNT < 0x0500 |
| 141 | DECLARE_HANDLE(HMONITOR); | 141 | DECLARE_HANDLE(HMONITOR); |
| 142 | #endif | 142 | #endif |
| 143 | 143 | ||
| @@ -2252,7 +2252,7 @@ static void | |||
| 2252 | w32_msg_pump (deferred_msg * msg_buf) | 2252 | w32_msg_pump (deferred_msg * msg_buf) |
| 2253 | { | 2253 | { |
| 2254 | MSG msg; | 2254 | MSG msg; |
| 2255 | int result; | 2255 | WPARAM result; |
| 2256 | HWND focus_window; | 2256 | HWND focus_window; |
| 2257 | 2257 | ||
| 2258 | msh_mousewheel = RegisterWindowMessage (MSH_MOUSEWHEEL); | 2258 | msh_mousewheel = RegisterWindowMessage (MSH_MOUSEWHEEL); |
| @@ -2283,7 +2283,7 @@ w32_msg_pump (deferred_msg * msg_buf) | |||
| 2283 | /* Reply is not expected. */ | 2283 | /* Reply is not expected. */ |
| 2284 | break; | 2284 | break; |
| 2285 | case WM_EMACS_SETKEYBOARDLAYOUT: | 2285 | case WM_EMACS_SETKEYBOARDLAYOUT: |
| 2286 | result = (int) ActivateKeyboardLayout ((HKL) msg.wParam, 0); | 2286 | result = (WPARAM) ActivateKeyboardLayout ((HKL) msg.wParam, 0); |
| 2287 | if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, | 2287 | if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, |
| 2288 | result, 0)) | 2288 | result, 0)) |
| 2289 | emacs_abort (); | 2289 | emacs_abort (); |
diff --git a/src/w32heap.c b/src/w32heap.c index dc65198f90b..8b9b19ea35d 100644 --- a/src/w32heap.c +++ b/src/w32heap.c | |||
| @@ -26,7 +26,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 26 | #include "w32heap.h" | 26 | #include "w32heap.h" |
| 27 | #include "lisp.h" /* for VALMASK */ | 27 | #include "lisp.h" /* for VALMASK */ |
| 28 | 28 | ||
| 29 | #define RVA_TO_PTR(rva) ((unsigned char *)((DWORD)(rva) + (DWORD)GetModuleHandle (NULL))) | 29 | #define RVA_TO_PTR(rva) ((unsigned char *)((DWORD_PTR)(rva) + (DWORD_PTR)GetModuleHandle (NULL))) |
| 30 | 30 | ||
| 31 | /* This gives us the page size and the size of the allocation unit on NT. */ | 31 | /* This gives us the page size and the size of the allocation unit on NT. */ |
| 32 | SYSTEM_INFO sysinfo_cache; | 32 | SYSTEM_INFO sysinfo_cache; |
| @@ -34,7 +34,7 @@ SYSTEM_INFO sysinfo_cache; | |||
| 34 | /* This gives us version, build, and platform identification. */ | 34 | /* This gives us version, build, and platform identification. */ |
| 35 | OSVERSIONINFO osinfo_cache; | 35 | OSVERSIONINFO osinfo_cache; |
| 36 | 36 | ||
| 37 | unsigned long syspage_mask = 0; | 37 | size_t syspage_mask = 0; |
| 38 | 38 | ||
| 39 | /* The major and minor versions of NT. */ | 39 | /* The major and minor versions of NT. */ |
| 40 | int w32_major_version; | 40 | int w32_major_version; |
| @@ -97,7 +97,7 @@ PIMAGE_SECTION_HEADER preload_heap_section; | |||
| 97 | unsigned char *data_region_base = NULL; | 97 | unsigned char *data_region_base = NULL; |
| 98 | unsigned char *data_region_end = NULL; | 98 | unsigned char *data_region_end = NULL; |
| 99 | unsigned char *real_data_region_end = NULL; | 99 | unsigned char *real_data_region_end = NULL; |
| 100 | unsigned long reserved_heap_size = 0; | 100 | size_t reserved_heap_size = 0; |
| 101 | 101 | ||
| 102 | /* The start of the data segment. */ | 102 | /* The start of the data segment. */ |
| 103 | unsigned char * | 103 | unsigned char * |
| @@ -121,16 +121,20 @@ allocate_heap (void) | |||
| 121 | the preload heap section up to the usable address limit. Since GNU | 121 | the preload heap section up to the usable address limit. Since GNU |
| 122 | malloc can handle gaps in the memory it gets from sbrk, we can | 122 | malloc can handle gaps in the memory it gets from sbrk, we can |
| 123 | simply set the sbrk pointer to the base of the new heap region. */ | 123 | simply set the sbrk pointer to the base of the new heap region. */ |
| 124 | unsigned long base = | 124 | DWORD_PTR base = |
| 125 | ROUND_UP ((RVA_TO_PTR (preload_heap_section->VirtualAddress) | 125 | ROUND_UP ((RVA_TO_PTR (preload_heap_section->VirtualAddress) |
| 126 | + preload_heap_section->Misc.VirtualSize), | 126 | + preload_heap_section->Misc.VirtualSize), |
| 127 | get_allocation_unit ()); | 127 | get_allocation_unit ()); |
| 128 | unsigned long end = 1 << VALBITS; /* 256MB */ | 128 | DWORD_PTR end = ((unsigned __int64)1) << VALBITS; /* 256MB */ |
| 129 | void *ptr = NULL; | 129 | void *ptr = NULL; |
| 130 | 130 | ||
| 131 | while (!ptr && (base < end)) | 131 | while (!ptr && (base < end)) |
| 132 | { | 132 | { |
| 133 | #ifdef _WIN64 | ||
| 134 | reserved_heap_size = min(end - base, 0x4000000000i64); /* Limit to 256Gb */ | ||
| 135 | #else | ||
| 133 | reserved_heap_size = end - base; | 136 | reserved_heap_size = end - base; |
| 137 | #endif | ||
| 134 | ptr = VirtualAlloc ((void *) base, | 138 | ptr = VirtualAlloc ((void *) base, |
| 135 | get_reserved_heap_size (), | 139 | get_reserved_heap_size (), |
| 136 | MEM_RESERVE, | 140 | MEM_RESERVE, |
| @@ -144,7 +148,11 @@ allocate_heap (void) | |||
| 144 | static char * | 148 | static char * |
| 145 | allocate_heap (void) | 149 | allocate_heap (void) |
| 146 | { | 150 | { |
| 147 | unsigned long size = 0x80000000; /* start by asking for 2GB */ | 151 | #ifdef _WIN64 |
| 152 | size_t size = 0x4000000000i64; /* start by asking for 32GB */ | ||
| 153 | #else | ||
| 154 | size_t size = 0x80000000; /* start by asking for 2GB */ | ||
| 155 | #endif | ||
| 148 | void *ptr = NULL; | 156 | void *ptr = NULL; |
| 149 | 157 | ||
| 150 | while (!ptr && size > 0x00100000) | 158 | while (!ptr && size > 0x00100000) |
| @@ -166,17 +174,17 @@ allocate_heap (void) | |||
| 166 | be the address of the _start_ (not end) of the new block in case of | 174 | be the address of the _start_ (not end) of the new block in case of |
| 167 | success, and zero (not -1) in case of failure. */ | 175 | success, and zero (not -1) in case of failure. */ |
| 168 | void * | 176 | void * |
| 169 | sbrk (unsigned long increment) | 177 | sbrk (ptrdiff_t increment) |
| 170 | { | 178 | { |
| 171 | void *result; | 179 | void *result; |
| 172 | long size = (long) increment; | 180 | ptrdiff_t size = increment; |
| 173 | 181 | ||
| 174 | result = data_region_end; | 182 | result = data_region_end; |
| 175 | 183 | ||
| 176 | /* If size is negative, shrink the heap by decommitting pages. */ | 184 | /* If size is negative, shrink the heap by decommitting pages. */ |
| 177 | if (size < 0) | 185 | if (size < 0) |
| 178 | { | 186 | { |
| 179 | int new_size; | 187 | ptrdiff_t new_size; |
| 180 | unsigned char *new_data_region_end; | 188 | unsigned char *new_data_region_end; |
| 181 | 189 | ||
| 182 | size = -size; | 190 | size = -size; |
| @@ -189,7 +197,7 @@ sbrk (unsigned long increment) | |||
| 189 | partial deallocation [cga]. */ | 197 | partial deallocation [cga]. */ |
| 190 | new_data_region_end = (data_region_end - size); | 198 | new_data_region_end = (data_region_end - size); |
| 191 | new_data_region_end = (unsigned char *) | 199 | new_data_region_end = (unsigned char *) |
| 192 | ((long) (new_data_region_end + syspage_mask) & ~syspage_mask); | 200 | ((DWORD_PTR) (new_data_region_end + syspage_mask) & ~syspage_mask); |
| 193 | new_size = real_data_region_end - new_data_region_end; | 201 | new_size = real_data_region_end - new_data_region_end; |
| 194 | real_data_region_end = new_data_region_end; | 202 | real_data_region_end = new_data_region_end; |
| 195 | if (new_size > 0) | 203 | if (new_size > 0) |
| @@ -220,7 +228,7 @@ sbrk (unsigned long increment) | |||
| 220 | /* We really only commit full pages, so record where | 228 | /* We really only commit full pages, so record where |
| 221 | the real end of committed memory is [cga]. */ | 229 | the real end of committed memory is [cga]. */ |
| 222 | real_data_region_end = (unsigned char *) | 230 | real_data_region_end = (unsigned char *) |
| 223 | ((long) (data_region_end + syspage_mask) & ~syspage_mask); | 231 | ((DWORD_PTR) (data_region_end + syspage_mask) & ~syspage_mask); |
| 224 | } | 232 | } |
| 225 | 233 | ||
| 226 | return result; | 234 | return result; |
| @@ -245,7 +253,7 @@ init_heap (void) | |||
| 245 | PIMAGE_NT_HEADERS nt_header; | 253 | PIMAGE_NT_HEADERS nt_header; |
| 246 | 254 | ||
| 247 | dos_header = (PIMAGE_DOS_HEADER) RVA_TO_PTR (0); | 255 | dos_header = (PIMAGE_DOS_HEADER) RVA_TO_PTR (0); |
| 248 | nt_header = (PIMAGE_NT_HEADERS) (((unsigned long) dos_header) + | 256 | nt_header = (PIMAGE_NT_HEADERS) (((DWORD_PTR) dos_header) + |
| 249 | dos_header->e_lfanew); | 257 | dos_header->e_lfanew); |
| 250 | preload_heap_section = find_section ("EMHEAP", nt_header); | 258 | preload_heap_section = find_section ("EMHEAP", nt_header); |
| 251 | 259 | ||
| @@ -261,7 +269,7 @@ init_heap (void) | |||
| 261 | #if !USE_LSB_TAG | 269 | #if !USE_LSB_TAG |
| 262 | /* Ensure that the addresses don't use the upper tag bits since | 270 | /* Ensure that the addresses don't use the upper tag bits since |
| 263 | the Lisp type goes there. */ | 271 | the Lisp type goes there. */ |
| 264 | if (((unsigned long) data_region_base & ~VALMASK) != 0) | 272 | if (((DWORD_PTR) data_region_base & ~VALMASK) != 0) |
| 265 | { | 273 | { |
| 266 | printf ("Error: The heap was allocated in upper memory.\n"); | 274 | printf ("Error: The heap was allocated in upper memory.\n"); |
| 267 | exit (1); | 275 | exit (1); |
| @@ -284,13 +292,13 @@ init_heap (void) | |||
| 284 | 292 | ||
| 285 | /* Round the heap up to the given alignment. */ | 293 | /* Round the heap up to the given alignment. */ |
| 286 | void | 294 | void |
| 287 | round_heap (unsigned long align) | 295 | round_heap (size_t align) |
| 288 | { | 296 | { |
| 289 | unsigned long needs_to_be; | 297 | DWORD_PTR needs_to_be; |
| 290 | unsigned long need_to_alloc; | 298 | DWORD_PTR need_to_alloc; |
| 291 | 299 | ||
| 292 | needs_to_be = (unsigned long) ROUND_UP (get_heap_end (), align); | 300 | needs_to_be = (DWORD_PTR) ROUND_UP (get_heap_end (), align); |
| 293 | need_to_alloc = needs_to_be - (unsigned long) get_heap_end (); | 301 | need_to_alloc = needs_to_be - (DWORD_PTR) get_heap_end (); |
| 294 | 302 | ||
| 295 | if (need_to_alloc) | 303 | if (need_to_alloc) |
| 296 | sbrk (need_to_alloc); | 304 | sbrk (need_to_alloc); |
diff --git a/src/w32heap.h b/src/w32heap.h index fda3c58bf01..aae4845b4cc 100644 --- a/src/w32heap.h +++ b/src/w32heap.h | |||
| @@ -24,8 +24,8 @@ 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)(p) + (align)-1) & ~((align)-1)) | 27 | #define ROUND_UP(p, align) (((DWORD_PTR)(p) + (align)-1) & ~((DWORD_PTR)(align)-1)) |
| 28 | #define ROUND_DOWN(p, align) ((DWORD)(p) & ~((align)-1)) | 28 | #define ROUND_DOWN(p, align) ((DWORD_PTR)(p) & ~((DWORD_PTR)(align)-1)) |
| 29 | 29 | ||
| 30 | /* | 30 | /* |
| 31 | * Heap related stuff. | 31 | * Heap related stuff. |
| @@ -42,7 +42,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |||
| 42 | 42 | ||
| 43 | extern unsigned char *get_data_start (void); | 43 | extern unsigned char *get_data_start (void); |
| 44 | extern unsigned char *get_data_end (void); | 44 | extern unsigned char *get_data_end (void); |
| 45 | extern unsigned long reserved_heap_size; | 45 | extern size_t reserved_heap_size; |
| 46 | extern SYSTEM_INFO sysinfo_cache; | 46 | extern SYSTEM_INFO sysinfo_cache; |
| 47 | extern OSVERSIONINFO osinfo_cache; | 47 | extern OSVERSIONINFO osinfo_cache; |
| 48 | extern BOOL using_dynamic_heap; | 48 | extern BOOL using_dynamic_heap; |
| @@ -58,13 +58,13 @@ enum { | |||
| 58 | extern int os_subtype; | 58 | extern int os_subtype; |
| 59 | 59 | ||
| 60 | /* Emulation of Unix sbrk(). */ | 60 | /* Emulation of Unix sbrk(). */ |
| 61 | extern void *sbrk (unsigned long size); | 61 | extern void *sbrk (ptrdiff_t size); |
| 62 | 62 | ||
| 63 | /* Initialize heap structures for sbrk on startup. */ | 63 | /* Initialize heap structures for sbrk on startup. */ |
| 64 | extern void init_heap (void); | 64 | extern void init_heap (void); |
| 65 | 65 | ||
| 66 | /* Round the heap to this size. */ | 66 | /* Round the heap to this size. */ |
| 67 | extern void round_heap (unsigned long size); | 67 | extern void round_heap (size_t size); |
| 68 | 68 | ||
| 69 | /* Cache system info, e.g., the NT page size. */ | 69 | /* Cache system info, e.g., the NT page size. */ |
| 70 | extern void cache_system_info (void); | 70 | extern void cache_system_info (void); |
| @@ -89,6 +89,6 @@ IMAGE_SECTION_HEADER * find_section (char * name, IMAGE_NT_HEADERS * nt_header); | |||
| 89 | 89 | ||
| 90 | /* Return pointer to section header for section containing the given | 90 | /* Return pointer to section header for section containing the given |
| 91 | relative virtual address. */ | 91 | relative virtual address. */ |
| 92 | IMAGE_SECTION_HEADER * rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header); | 92 | IMAGE_SECTION_HEADER * rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header); |
| 93 | 93 | ||
| 94 | #endif /* NTHEAP_H_ */ | 94 | #endif /* NTHEAP_H_ */ |
diff --git a/src/w32menu.c b/src/w32menu.c index fb1cb606940..0a10f1f0893 100644 --- a/src/w32menu.c +++ b/src/w32menu.c | |||
| @@ -1483,8 +1483,8 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item) | |||
| 1483 | 1483 | ||
| 1484 | utf8to16 (out_string, utf8_len, utf16_string); | 1484 | utf8to16 (out_string, utf8_len, utf16_string); |
| 1485 | return_value = unicode_append_menu (menu, fuFlags, | 1485 | return_value = unicode_append_menu (menu, fuFlags, |
| 1486 | item != NULL ? (UINT) item | 1486 | item != NULL ? (UINT_PTR) item |
| 1487 | : (UINT) wv->call_data, | 1487 | : (UINT_PTR) wv->call_data, |
| 1488 | utf16_string); | 1488 | utf16_string); |
| 1489 | if (!return_value) | 1489 | if (!return_value) |
| 1490 | { | 1490 | { |
| @@ -1496,7 +1496,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item) | |||
| 1496 | of minor importance compared with menus not working at all. */ | 1496 | of minor importance compared with menus not working at all. */ |
| 1497 | return_value = | 1497 | return_value = |
| 1498 | AppendMenu (menu, fuFlags, | 1498 | AppendMenu (menu, fuFlags, |
| 1499 | item != NULL ? (UINT) item: (UINT) wv->call_data, | 1499 | item != NULL ? (UINT_PTR) item: (UINT_PTR) wv->call_data, |
| 1500 | out_string); | 1500 | out_string); |
| 1501 | /* Don't use Unicode menus in future, unless this is Windows | 1501 | /* Don't use Unicode menus in future, unless this is Windows |
| 1502 | NT or later, where a failure of AppendMenuW does NOT mean | 1502 | NT or later, where a failure of AppendMenuW does NOT mean |
| @@ -1513,7 +1513,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item) | |||
| 1513 | return_value = | 1513 | return_value = |
| 1514 | AppendMenu (menu, | 1514 | AppendMenu (menu, |
| 1515 | fuFlags, | 1515 | fuFlags, |
| 1516 | item != NULL ? (UINT) item : (UINT) wv->call_data, | 1516 | item != NULL ? (UINT_PTR) item : (UINT_PTR) wv->call_data, |
| 1517 | out_string ); | 1517 | out_string ); |
| 1518 | } | 1518 | } |
| 1519 | 1519 | ||
| @@ -1550,7 +1550,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item) | |||
| 1550 | } | 1550 | } |
| 1551 | 1551 | ||
| 1552 | set_menu_item_info (menu, | 1552 | set_menu_item_info (menu, |
| 1553 | item != NULL ? (UINT) item : (UINT) wv->call_data, | 1553 | item != NULL ? (UINT_PTR) item : (UINT_PTR) wv->call_data, |
| 1554 | FALSE, &info); | 1554 | FALSE, &info); |
| 1555 | } | 1555 | } |
| 1556 | } | 1556 | } |
diff --git a/src/w32proc.c b/src/w32proc.c index d7c9edac746..fb872990bd0 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -62,7 +62,7 @@ extern BOOL WINAPI IsValidLocale (LCID, DWORD); | |||
| 62 | 62 | ||
| 63 | #define RVA_TO_PTR(var,section,filedata) \ | 63 | #define RVA_TO_PTR(var,section,filedata) \ |
| 64 | ((void *)((section)->PointerToRawData \ | 64 | ((void *)((section)->PointerToRawData \ |
| 65 | + ((DWORD)(var) - (section)->VirtualAddress) \ | 65 | + ((DWORD_PTR)(var) - (section)->VirtualAddress) \ |
| 66 | + (filedata).file_base)) | 66 | + (filedata).file_base)) |
| 67 | 67 | ||
| 68 | Lisp_Object Qhigh, Qlow; | 68 | Lisp_Object Qhigh, Qlow; |
| @@ -1190,7 +1190,7 @@ w32_executable_type (char * filename, | |||
| 1190 | if (dos_header->e_magic != IMAGE_DOS_SIGNATURE) | 1190 | if (dos_header->e_magic != IMAGE_DOS_SIGNATURE) |
| 1191 | goto unwind; | 1191 | goto unwind; |
| 1192 | 1192 | ||
| 1193 | nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew); | 1193 | nt_header = (PIMAGE_NT_HEADERS) ((unsigned char *) dos_header + dos_header->e_lfanew); |
| 1194 | 1194 | ||
| 1195 | if ((char *) nt_header > (char *) dos_header + executable.size) | 1195 | if ((char *) nt_header > (char *) dos_header + executable.size) |
| 1196 | { | 1196 | { |
diff --git a/src/w32term.c b/src/w32term.c index 5d5e572c475..1cc8bd2adef 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -102,7 +102,7 @@ struct w32_display_info *x_display_list; | |||
| 102 | Lisp_Object w32_display_name_list; | 102 | Lisp_Object w32_display_name_list; |
| 103 | 103 | ||
| 104 | 104 | ||
| 105 | #ifndef GLYPHSET | 105 | #if _WIN32_WINNT < 0x0500 |
| 106 | /* Pre Windows 2000, this was not available, but define it here so | 106 | /* Pre Windows 2000, this was not available, but define it here so |
| 107 | that Emacs compiled on such a platform will run on newer versions. */ | 107 | that Emacs compiled on such a platform will run on newer versions. */ |
| 108 | 108 | ||
| @@ -360,7 +360,11 @@ w32_draw_underwave (struct glyph_string *s, COLORREF color) | |||
| 360 | 360 | ||
| 361 | /* Find and set clipping rectangle */ | 361 | /* Find and set clipping rectangle */ |
| 362 | 362 | ||
| 363 | wave_clip = (XRectangle){ x0, y0, width, wave_height }; | 363 | wave_clip.x = x0; |
| 364 | wave_clip.y = y0; | ||
| 365 | wave_clip.width = width; | ||
| 366 | wave_clip.height = wave_height; | ||
| 367 | |||
| 364 | get_glyph_string_clip_rect (s, &w32_string_clip); | 368 | get_glyph_string_clip_rect (s, &w32_string_clip); |
| 365 | CONVERT_TO_XRECT (string_clip, w32_string_clip); | 369 | CONVERT_TO_XRECT (string_clip, w32_string_clip); |
| 366 | 370 | ||
diff --git a/src/w32term.h b/src/w32term.h index 5d756f435e4..5cfef5d1dea 100644 --- a/src/w32term.h +++ b/src/w32term.h | |||
| @@ -431,7 +431,15 @@ struct scroll_bar { | |||
| 431 | /* Turning a lisp vector value into a pointer to a struct scroll_bar. */ | 431 | /* Turning a lisp vector value into a pointer to a struct scroll_bar. */ |
| 432 | #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec)) | 432 | #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec)) |
| 433 | 433 | ||
| 434 | 434 | #ifdef _WIN64 | |
| 435 | /* Building a 64-bit C integer from two 32-bit lisp integers. */ | ||
| 436 | #define SCROLL_BAR_PACK(low, high) (XINT (high) << 32 | XINT (low)) | ||
| 437 | |||
| 438 | /* Setting two lisp integers to the low and high words of a 64-bit C int. */ | ||
| 439 | #define SCROLL_BAR_UNPACK(low, high, int64) \ | ||
| 440 | (XSETINT ((low), ((DWORDLONG)(int64)) & 0xffffffff), \ | ||
| 441 | XSETINT ((high), ((DWORDLONG)(int64) >> 32) & 0xffffffff)) | ||
| 442 | #else /* not _WIN64 */ | ||
| 435 | /* Building a 32-bit C integer from two 16-bit lisp integers. */ | 443 | /* Building a 32-bit C integer from two 16-bit lisp integers. */ |
| 436 | #define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low)) | 444 | #define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low)) |
| 437 | 445 | ||
| @@ -439,7 +447,7 @@ struct scroll_bar { | |||
| 439 | #define SCROLL_BAR_UNPACK(low, high, int32) \ | 447 | #define SCROLL_BAR_UNPACK(low, high, int32) \ |
| 440 | (XSETINT ((low), (int32) & 0xffff), \ | 448 | (XSETINT ((low), (int32) & 0xffff), \ |
| 441 | XSETINT ((high), ((int32) >> 16) & 0xffff)) | 449 | XSETINT ((high), ((int32) >> 16) & 0xffff)) |
| 442 | 450 | #endif /* not _WIN64 */ | |
| 443 | 451 | ||
| 444 | /* Extract the window id of the scroll bar from a struct scroll_bar. */ | 452 | /* Extract the window id of the scroll bar from a struct scroll_bar. */ |
| 445 | #define SCROLL_BAR_W32_WINDOW(ptr) \ | 453 | #define SCROLL_BAR_W32_WINDOW(ptr) \ |
| @@ -447,7 +455,7 @@ struct scroll_bar { | |||
| 447 | 455 | ||
| 448 | /* Store a window id in a struct scroll_bar. */ | 456 | /* Store a window id in a struct scroll_bar. */ |
| 449 | #define SET_SCROLL_BAR_W32_WINDOW(ptr, id) \ | 457 | #define SET_SCROLL_BAR_W32_WINDOW(ptr, id) \ |
| 450 | (SCROLL_BAR_UNPACK ((ptr)->w32_window_low, (ptr)->w32_window_high, (int) id)) | 458 | (SCROLL_BAR_UNPACK ((ptr)->w32_window_low, (ptr)->w32_window_high, (intptr_t) id)) |
| 451 | 459 | ||
| 452 | /* Extract the X widget of the scroll bar from a struct scroll_bar. */ | 460 | /* Extract the X widget of the scroll bar from a struct scroll_bar. */ |
| 453 | #define SCROLL_BAR_X_WIDGET(ptr) \ | 461 | #define SCROLL_BAR_X_WIDGET(ptr) \ |