From a56e547db6d68a578c9a45e02563e4af83f7d22a Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 4 Dec 2010 08:28:53 -0700 Subject: [PATCH] win64: racket/draw and racket/gui --- collects/mred/private/wx/win32/menu.rkt | 2 +- collects/mred/private/wx/win32/queue.rkt | 4 ++-- collects/mred/private/wx/win32/types.rkt | 16 ++++++++----- collects/mred/private/wx/win32/wndclass.rkt | 8 +++---- collects/racket/draw/private/libs.rkt | 13 ++++++++++- collects/racket/draw/unsafe/cairo.rkt | 7 +++++- collects/racket/draw/unsafe/glib.rkt | 3 +++ collects/racket/draw/unsafe/jpeg.rkt | 2 +- collects/racket/draw/unsafe/pango.rkt | 7 +++++- src/get-libs.rkt | 26 +++++++++++++++++++-- src/plot/build.bat | 2 ++ src/racket/src/string.c | 4 ++++ 12 files changed, 75 insertions(+), 19 deletions(-) create mode 100644 src/plot/build.bat diff --git a/collects/mred/private/wx/win32/menu.rkt b/collects/mred/private/wx/win32/menu.rkt index 0b93f5ce54..1686660a1a 100644 --- a/collects/mred/private/wx/win32/menu.rkt +++ b/collects/mred/private/wx/win32/menu.rkt @@ -150,7 +150,7 @@ (set! items (append items (list i))) (if submenu (AppendMenuW hmenu (bitwise-ior MF_POPUP MF_STRING) (send submenu get-hmenu) label) - (AppendMenuW hmenu (bitwise-ior MF_STRING) (cast id _long _pointer) label))))))) + (AppendMenuW hmenu (bitwise-ior MF_STRING) (cast id _intptr _pointer) label))))))) (define/public (append-separator) (atomically diff --git a/collects/mred/private/wx/win32/queue.rkt b/collects/mred/private/wx/win32/queue.rkt index e1c194c3bc..774aa77cbb 100644 --- a/collects/mred/private/wx/win32/queue.rkt +++ b/collects/mred/private/wx/win32/queue.rkt @@ -65,7 +65,7 @@ (define (message-dequeue es hwnd) ;; Called in the eventspace for hwnd: (let ([t (eventspace-extra-table es)] - [id (cast hwnd _HWND _long)]) + [id (cast hwnd _HWND _intptr)]) (atomically (hash-remove! t id)) (let ([msg (malloc-msg)]) (let loop () @@ -90,7 +90,7 @@ (define (queue-message-dequeue es hwnd) ;; in atomic mode (let ([t (eventspace-extra-table es)] - [id (cast hwnd _HWND _long)]) + [id (cast hwnd _HWND _intptr)]) (unless (hash-ref t id #f) (hash-set! t id #t) (queue-event es (lambda () (message-dequeue es hwnd)))))) diff --git a/collects/mred/private/wx/win32/types.rkt b/collects/mred/private/wx/win32/types.rkt index cc29d86469..2291992996 100644 --- a/collects/mred/private/wx/win32/types.rkt +++ b/collects/mred/private/wx/win32/types.rkt @@ -50,21 +50,25 @@ MAKELONG MAKELPARAM)) +(define win64? (equal? "win32\\x86_64" (path->string (system-library-subpath #f)))) +(define win_abi (if win64? #f 'stdcall)) + (define-syntax-rule (_wfun . a) - (_fun #:abi 'stdcall . a)) + (_fun #:abi win_abi . a)) (define _WORD _int16) (define _DWORD _int32) (define _UDWORD _uint32) (define _ATOM _int) -(define _WPARAM _long) -(define _LPARAM _long) -(define _LRESULT _long) +(define _UINT_PTR _uintptr) +(define _WPARAM _intptr) ; supposed to be _UINT_PTR, but we have some sign mismatch +(define _LONG_PTR _intptr) +(define _LPARAM _LONG_PTR) +(define _LRESULT _LONG_PTR) (define _BOOL (make-ctype _int (lambda (v) (if v 1 0)) (lambda (v) (not (zero? v))))) (define _UINT _uint) -(define _UINT_PTR _ulong) (define _BYTE _uint8) -(define _HRESULT _int32) +(define _HRESULT _long) (define _WCHAR _int16) (define _SIZE_T _long) (define _INT_PTR _intptr) diff --git a/collects/mred/private/wx/win32/wndclass.rkt b/collects/mred/private/wx/win32/wndclass.rkt index 378aa3be1c..8bcf8f4ddc 100644 --- a/collects/mred/private/wx/win32/wndclass.rkt +++ b/collects/mred/private/wx/win32/wndclass.rkt @@ -35,7 +35,7 @@ ;; call in atomic mode: (define (register-hwnd! hwnd) - (hash-set! all-hwnds (cast hwnd _pointer _long) #t) + (hash-set! all-hwnds (cast hwnd _pointer _intptr) #t) (let ([c (malloc-immobile-cell (vector #f #f #f))]) (void (SetWindowLongW hwnd GWLP_USERDATA c)))) @@ -60,7 +60,7 @@ (define (any-hwnd->wx hwnd) (and - (atomically (hash-ref all-hwnds (cast hwnd _pointer _long) #f)) + (atomically (hash-ref all-hwnds (cast hwnd _pointer _intptr) #f)) (let ([wx (hwnd->wx hwnd)]) (and wx (send wx is-hwnd? hwnd) @@ -78,7 +78,7 @@ ;; call in atomic mode: (define (can-unregister-hwnd? hwnd) - (hash-ref all-hwnds (cast hwnd _pointer _long) #f)) + (hash-ref all-hwnds (cast hwnd _pointer _intptr) #f)) ;; call in atomic mode: (define (unregister-hwnd! hwnd) @@ -86,7 +86,7 @@ (when c (free-immobile-cell c) (SetWindowLongW hwnd GWLP_USERDATA #f)) - (hash-remove! all-hwnds (cast hwnd _pointer _long)))) + (hash-remove! all-hwnds (cast hwnd _pointer _intptr)))) ;; ---------------------------------------- diff --git a/collects/racket/draw/private/libs.rkt b/collects/racket/draw/private/libs.rkt index efb0b268a3..446388cdd0 100644 --- a/collects/racket/draw/private/libs.rkt +++ b/collects/racket/draw/private/libs.rkt @@ -3,7 +3,18 @@ racket/runtime-path (for-syntax racket/base)) -(provide define-runtime-lib) +(provide define-runtime-lib + win64? + (for-syntax win64?)) + +(define win64? + (and (eq? 'windows (system-type)) + (equal? "win32\\x86_64" + (path->string (system-library-subpath #f))))) +(define-for-syntax win64? + (and (eq? 'windows (system-type)) + (equal? "win32\\x86_64" + (path->string (system-library-subpath #f))))) (define-syntax define-runtime-lib (syntax-rules (macosx unix windows ffi-lib) diff --git a/collects/racket/draw/unsafe/cairo.rkt b/collects/racket/draw/unsafe/cairo.rkt index 21d8956b08..81e15cd63f 100644 --- a/collects/racket/draw/unsafe/cairo.rkt +++ b/collects/racket/draw/unsafe/cairo.rkt @@ -14,9 +14,14 @@ (ffi-lib "libcairo.2.dylib")] [(windows) (ffi-lib "zlib1.dll") + (ffi-lib ,(if win64? + "libintl-8.dll" + "zlib1.dll")) (ffi-lib "libpng14-14.dll") (ffi-lib "libexpat-1.dll") - (ffi-lib "freetype6.dll") + (ffi-lib ,(if win64? + "libfreetype-6.dll" + "freetype6.dll")) (ffi-lib "libfontconfig-1.dll") (ffi-lib "libcairo-2.dll")]) diff --git a/collects/racket/draw/unsafe/glib.rkt b/collects/racket/draw/unsafe/glib.rkt index 2b3ae40af4..66bafde7c8 100644 --- a/collects/racket/draw/unsafe/glib.rkt +++ b/collects/racket/draw/unsafe/glib.rkt @@ -18,6 +18,9 @@ [(macosx) (ffi-lib "libgmodule-2.0.0.dylib")] [(windows) + (ffi-lib ,(if win64? + "libgthread-2.0-0.dll" + "libgmodule-2.0-0.dll")) (ffi-lib "libgmodule-2.0-0.dll")]) (define-runtime-lib gobj-lib diff --git a/collects/racket/draw/unsafe/jpeg.rkt b/collects/racket/draw/unsafe/jpeg.rkt index de8c4c78dc..08ebdf45c1 100644 --- a/collects/racket/draw/unsafe/jpeg.rkt +++ b/collects/racket/draw/unsafe/jpeg.rkt @@ -342,7 +342,7 @@ [jpeg_color_space _J_COLOR_SPACE] [comp_info _pointer] - + [quant_tbl _quant_tbl_t] [dc_huff_tbl_ptrs_1 _pointer] diff --git a/collects/racket/draw/unsafe/pango.rkt b/collects/racket/draw/unsafe/pango.rkt index 3101f1290e..873297050a 100644 --- a/collects/racket/draw/unsafe/pango.rkt +++ b/collects/racket/draw/unsafe/pango.rkt @@ -28,9 +28,14 @@ [(macosx) (ffi-lib "libpangocairo-1.0.0.dylib")] [(windows) + (ffi-lib ,(if win64? + "libintl-8.dll" + "libpangowin32-1.0-0.dll")) (ffi-lib "libpangowin32-1.0-0.dll") (ffi-lib "libexpat-1.dll") - (ffi-lib "freetype6.dll") + (ffi-lib ,(if win64? + "libfreetype-6.dll" + "freetype6.dll")) (ffi-lib "libfontconfig-1.dll") (ffi-lib "libpangoft2-1.0-0.dll") (ffi-lib "libpangocairo-1.0-0.dll")]) diff --git a/src/get-libs.rkt b/src/get-libs.rkt index bfbe14d8ee..9a26441348 100644 --- a/src/get-libs.rkt +++ b/src/get-libs.rkt @@ -20,7 +20,11 @@ [win32/i386 ["iconv.dll" 892928] ["libeay32.dll" 1089536] - ["ssleay32.dll" 237568]]] + ["ssleay32.dll" 237568]] + [win32/x86_64 + ["libiconv-2.dll" 1378028] + ["libeay32.dll" 1293824] + ["ssleay32.dll" 260608]]] ;; GUI Libraries [gui [i386-macosx @@ -90,7 +94,25 @@ ["libgio-2.0-0.dll" 669318] ["libwimp.dll" 69632] ["gtkrc" 1181]) - '())]])) + '())] + [win32/x86_64 + ["libjpeg-7.dll" 224768] + ["libcairo-2.dll" 1266147] + ["libpango-1.0-0.dll" 423199] + ["libexpat-1.dll" 263006] + ["libpng14-14.dll" 272473] + ["zlib1.dll" 191825] + ["libfreetype-6.dll" 633649] + ["libintl-8.dll" 240862] + ["libfontconfig-1.dll" 339943] + ["libglib-2.0-0.dll" 1267577] + ["libgobject-2.0-0.dll" 425888] + ["libgmodule-2.0-0.dll" 119538] + ["libpangocairo-1.0-0.dll" 185168] + ["libpangowin32-1.0-0.dll" 192656] + ["libpangoft2-1.0-0.dll" 1188615] + ["libplplot.dll" 248832] + ["libfit.dll" 69120]]])) (define-values [package dest-dir] (command-line #:args [package [dest-dir (current-directory)]] diff --git a/src/plot/build.bat b/src/plot/build.bat new file mode 100644 index 0000000000..a60b3ffa73 --- /dev/null +++ b/src/plot/build.bat @@ -0,0 +1,2 @@ +..\..\racket build.rkt libplplot plplot/dc_drv.c plplot/plcont.c plplot/plfill.c plplot/plmap.c plplot/plshade.c plplot/plwind.c plplot/pdfutils.c plplot/plcore.c plplot/plgridd.c plplot/plmeta.c plplot/plstripc.c plplot/plargs.c plplot/plctrl.c plplot/plhist.c plplot/plot3d.c plplot/plsym.c plplot/plbox.c plplot/plcvt.c plplot/plimage.c plplot/plpage.c plplot/pltick.c plplot/plbuf.c plplot/pldtik.c plplot/plline.c plplot/plsdef.c plplot/plvpor.c +..\..\racket build.rkt libfit fit/fit.c fit/matrix.c diff --git a/src/racket/src/string.c b/src/racket/src/string.c index f57699fae7..532c364b20 100644 --- a/src/racket/src/string.c +++ b/src/racket/src/string.c @@ -89,10 +89,14 @@ static void init_iconv() m = LoadLibraryW(scheme_get_dll_path(L"iconv.dll")); if (!m) m = LoadLibraryW(scheme_get_dll_path(L"libiconv.dll")); + if (!m) + m = LoadLibraryW(scheme_get_dll_path(L"libiconv-2.dll")); if (!m) m = LoadLibrary("iconv.dll"); if (!m) m = LoadLibrary("libiconv.dll"); + if (!m) + m = LoadLibrary("libiconv-2.dll"); if (m) { iconv = (iconv_proc_t)GetProcAddress(m, "libiconv"); iconv_open = (iconv_open_proc_t)GetProcAddress(m, "libiconv_open");