# HG changeset patch # User John Donoghue # Date 1391823218 18000 # Node ID 598f4d2af02ed198fde6b5e044de141e4a9a175e # Parent 92fdb983b35175283e50cacb302a0b00dc5b0a08 Add patch for win64 gnuplot * src/gnuplot-2-win64.patch: New file * dist-files.mk: add /gnuplot-2-win64.patch. diff -r 92fdb983b351 -r 598f4d2af02e dist-files.mk --- a/dist-files.mk Fri Feb 07 14:30:07 2014 -0500 +++ b/dist-files.mk Fri Feb 07 20:33:38 2014 -0500 @@ -114,6 +114,7 @@ glpk.mk \ gmp.mk \ gnuplot-1-fixes.patch \ + gnuplot-2-win64.patch \ gnuplot.mk \ gnutls-1-fixes.patch \ gnutls-2-ldadd.patch \ diff -r 92fdb983b351 -r 598f4d2af02e src/gnuplot-2-win64.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gnuplot-2-win64.patch Fri Feb 07 20:33:38 2014 -0500 @@ -0,0 +1,413 @@ +diff -urN gnuplot-4.6.4.orig/src/internal.c gnuplot-4.6.4/src/internal.c +--- gnuplot-4.6.4.orig/src/internal.c 2014-02-07 20:11:05.000000000 -0500 ++++ gnuplot-4.6.4/src/internal.c 2014-02-07 20:11:47.000000000 -0500 +@@ -58,12 +58,13 @@ + + static enum DATA_TYPES sprintf_specifier __PROTO((const char *format)); + +- ++#ifndef _WIN64 + int + GP_MATHERR( STRUCT_EXCEPTION_P_X ) + { + return (undefined = TRUE); /* don't print error message */ + } ++#endif + + #define BAD_DEFAULT default: int_error(NO_CARET, "internal error : type neither INT or CMPLX"); return; + +diff -urN gnuplot-4.6.4.orig/src/win/wgnuplot.exe.manifest64 gnuplot-4.6.4/src/win/wgnuplot.exe.manifest64 +--- gnuplot-4.6.4.orig/src/win/wgnuplot.exe.manifest64 1969-12-31 19:00:00.000000000 -0500 ++++ gnuplot-4.6.4/src/win/wgnuplot.exe.manifest64 2014-02-07 20:11:47.000000000 -0500 +@@ -0,0 +1,22 @@ ++ ++ ++ ++Famous scientific plotting package. ++ ++ ++ ++ ++ ++ +diff -urN gnuplot-4.6.4.orig/src/win/wgnuplot.rc gnuplot-4.6.4/src/win/wgnuplot.rc +--- gnuplot-4.6.4.orig/src/win/wgnuplot.rc 2014-02-07 20:11:36.000000000 -0500 ++++ gnuplot-4.6.4/src/win/wgnuplot.rc 2014-02-07 20:11:47.000000000 -0500 +@@ -3,8 +3,12 @@ + #include "wgnuplib.rc" + + #ifndef NO_MANIFEST ++#ifdef _WIN64 ++CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "wgnuplot.exe.manifest64" ++#else + CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "wgnuplot.exe.manifest" + #endif ++#endif + + #ifdef MSRC + /* using Microsoft RC.EXE */ +diff -urN gnuplot-4.6.4.orig/src/win/wgraph.c gnuplot-4.6.4/src/win/wgraph.c +--- gnuplot-4.6.4.orig/src/win/wgraph.c 2014-02-07 20:11:05.000000000 -0500 ++++ gnuplot-4.6.4/src/win/wgraph.c 2014-02-07 20:11:47.000000000 -0500 +@@ -433,8 +433,13 @@ + NULL, NULL, lpgw->hInstance, lpgw); + + if (lpgw->hWndGraph) ++#ifdef _WIN64 ++ SetClassLongPtr(lpgw->hWndGraph, GCLP_HICON, ++ (LONG_PTR) LoadIcon(lpgw->hInstance, "GRPICON")); ++#else + SetClassLong(lpgw->hWndGraph, GCL_HICON, + (LONG) LoadIcon(lpgw->hInstance, "GRPICON")); ++#endif + + lpgw->hStatusbar = CreateWindowEx(0, STATUSCLASSNAME, (LPSTR)NULL, + WS_CHILD | SBARS_SIZEGRIP, +@@ -571,7 +576,11 @@ + /* modify the system menu to have the new items we want */ + sysmenu = GetSystemMenu(lpgw->hWndGraph,0); + AppendMenu(sysmenu, MF_SEPARATOR, 0, NULL); ++#ifdef _WIN64 ++ AppendMenu(sysmenu, MF_POPUP, (UINT_PTR)lpgw->hPopMenu, "&Options"); ++#else + AppendMenu(sysmenu, MF_POPUP, (UINT)lpgw->hPopMenu, "&Options"); ++#endif + AppendMenu(sysmenu, MF_STRING, M_ABOUT, "&About"); + + #ifndef WGP_CONSOLE +@@ -2622,13 +2631,17 @@ + } + + pr.hdcPrn = printer; ++#ifdef _WIN64 ++ SetWindowLongPtr(hwnd, 4, (LONG_PTR)((GP_LPPRINT)&pr)); ++#else + SetWindowLong(hwnd, 4, (LONG)((GP_LPPRINT)&pr)); ++#endif + PrintRegister((GP_LPPRINT)&pr); + + EnableWindow(hwnd, FALSE); + pr.bUserAbort = FALSE; + pr.hDlgPrint = CreateDialogParam(hdllInstance, "CancelDlgBox", +- hwnd, PrintDlgProc, (LPARAM)lpgw->Title); ++ hwnd, PrintDlgProc, (LPARAM)lpgw->Title); + SetAbortProc(printer, PrintAbortProc); + + memset(&docInfo, 0, sizeof(DOCINFO)); +@@ -2879,7 +2892,11 @@ + + #define LS_DEFLINE 2 + typedef struct tagLS { ++#ifdef _WIN64 ++ LONG_PTR widtype; ++#else + int widtype; ++#endif + int wid; + HWND hwnd; + int pen; /* current pen number */ +@@ -2941,7 +2958,11 @@ + int i; + UINT pen; + LPLOGPEN plpm, plpc; ++#ifdef _WIN64 ++ lpls = (LPLS)GetWindowLongPtr(GetParent(hdlg), 4); ++#else + lpls = (LPLS)GetWindowLong(GetParent(hdlg), 4); ++#endif + + switch (wmsg) { + case WM_INITDIALOG: +@@ -3121,7 +3142,11 @@ + BOOL status = FALSE; + LS ls; + ++#ifdef _WIN64 ++ SetWindowLongPtr(lpgw->hWndGraph, 4, (LONG_PTR)((LPLS)&ls)); ++#else + SetWindowLong(lpgw->hWndGraph, 4, (LONG)((LPLS)&ls)); ++#endif + _fmemcpy(&ls.colorpen, &lpgw->colorpen, (WGNUMPENS + 2) * sizeof(LOGPEN)); + _fmemcpy(&ls.monopen, &lpgw->monopen, (WGNUMPENS + 2) * sizeof(LOGPEN)); + +@@ -3202,7 +3227,11 @@ + static unsigned int last_modifier_mask = -99; + #endif + ++#ifdef _WIN64 ++ lpgw = (LPGW)GetWindowLongPtr(hwnd, 0); ++#else + lpgw = (LPGW)GetWindowLong(hwnd, 0); ++#endif + + #ifdef USE_MOUSE + /* mouse events first */ +@@ -3716,7 +3745,11 @@ + return FALSE; + case WM_CREATE: + lpgw = ((CREATESTRUCT *)lParam)->lpCreateParams; ++#ifdef _WIN64 ++ SetWindowLongPtr(hwnd, 0, (LONG_PTR)lpgw); ++#else + SetWindowLong(hwnd, 0, (LONG)lpgw); ++#endif + lpgw->hWndGraph = hwnd; + hdc = GetDC(hwnd); + MakePens(lpgw, hdc); +diff -urN gnuplot-4.6.4.orig/src/win/winmain.c gnuplot-4.6.4/src/win/winmain.c +--- gnuplot-4.6.4.orig/src/win/winmain.c 2014-02-07 20:11:05.000000000 -0500 ++++ gnuplot-4.6.4/src/win/winmain.c 2014-02-07 20:16:45.000000000 -0500 +@@ -553,7 +553,12 @@ + if (TextInit(&textwin)) + exit(1); + textwin.hIcon = LoadIcon(hInstance, "TEXTICON"); ++ ++#ifdef _WIN64 ++ SetClassLongPtr(textwin.hWndParent, GCLP_HICON, (LONG_PTR)textwin.hIcon); ++#else + SetClassLong(textwin.hWndParent, GCL_HICON, (DWORD)textwin.hIcon); ++#endif + /* Note: we want to know whether this is an interactive session so that we can + * decide whether or not to write status information to stderr. The old test + * for this was to see if (argc > 1) but the addition of optional command line +diff -urN gnuplot-4.6.4.orig/src/win/wmenu.c gnuplot-4.6.4/src/win/wmenu.c +--- gnuplot-4.6.4.orig/src/win/wmenu.c 2014-02-07 20:11:05.000000000 -0500 ++++ gnuplot-4.6.4/src/win/wmenu.c 2014-02-07 20:11:47.000000000 -0500 +@@ -827,8 +827,13 @@ + goto errorcleanup; + } + hMenu[nMenuLevel] = CreateMenu(); ++#ifdef _WIN64 ++ AppendMenu(hMenu[nMenuLevel > 0 ? nMenuLevel-1 : 0], ++ MF_STRING | MF_POPUP, (UINT_PTR)hMenu[nMenuLevel], (LPCSTR)buf); ++#else + AppendMenu(hMenu[nMenuLevel > 0 ? nMenuLevel-1 : 0], + MF_STRING | MF_POPUP, (UINT)hMenu[nMenuLevel], (LPCSTR)buf); ++#endif + } + else if (!lstrcmpi(buf,"[EndMenu]")) { + if (nMenuLevel > 0) +@@ -1047,7 +1052,11 @@ + { + LPTW lptw; + LPMW lpmw; ++#ifdef _WIN64 ++ lptw = (LPTW)GetWindowLongPtr(GetParent(hDlg), 0); ++#else + lptw = (LPTW)GetWindowLong(GetParent(hDlg), 0); ++#endif + lpmw = lptw->lpmw; + + switch( message) { +diff -urN gnuplot-4.6.4.orig/src/win/wpause.c gnuplot-4.6.4/src/win/wpause.c +--- gnuplot-4.6.4.orig/src/win/wpause.c 2014-02-07 20:11:05.000000000 -0500 ++++ gnuplot-4.6.4/src/win/wpause.c 2014-02-07 20:18:08.000000000 -0500 +@@ -207,7 +207,11 @@ + LPPW lppw; + int cxChar, cyChar, middle; + ++#ifdef _WIN64 ++ lppw = (LPPW)GetWindowLongPtr(hwnd, 0); ++#else + lppw = (LPPW)GetWindowLong(hwnd, 0); ++#endif + + switch(message) { + case WM_KEYDOWN: +@@ -251,7 +255,11 @@ + ws_opts |= WS_VISIBLE; + /* HBB 981202 HMENU sysmenu = GetSystemMenu(hwnd, FALSE); */ + lppw = ((CREATESTRUCT *)lParam)->lpCreateParams; ++#ifdef _WIN64 ++ SetWindowLongPtr(hwnd, 0, (LONG_PTR)lppw); ++#else + SetWindowLong(hwnd, 0, (LONG)lppw); ++#endif + lppw->hWndPause = hwnd; + hdc = GetDC(hwnd); + SelectObject(hdc, GetStockObject(SYSTEM_FONT)); +@@ -273,10 +281,17 @@ + 8*cxChar, 7*cyChar/4, + hwnd, (HMENU)IDCANCEL, + ((LPCREATESTRUCT) lParam)->hInstance, NULL); ++#ifdef _WIN64 ++ lppw->lpfnOK = (WNDPROC) GetWindowLongPtr(lppw->hOK, GWLP_WNDPROC); ++ SetWindowLongPtr(lppw->hOK, GWLP_WNDPROC, (LONG_PTR)PauseButtonProc); ++ lppw->lpfnCancel = (WNDPROC) GetWindowLongPtr(lppw->hCancel, GWLP_WNDPROC); ++ SetWindowLongPtr(lppw->hCancel, GWLP_WNDPROC, (LONG_PTR)PauseButtonProc); ++#else + lppw->lpfnOK = (WNDPROC) GetWindowLong(lppw->hOK, GWL_WNDPROC); + SetWindowLong(lppw->hOK, GWL_WNDPROC, (LONG)PauseButtonProc); + lppw->lpfnCancel = (WNDPROC) GetWindowLong(lppw->hCancel, GWL_WNDPROC); + SetWindowLong(lppw->hCancel, GWL_WNDPROC, (LONG)PauseButtonProc); ++#endif + if (GetParent(hwnd)) + EnableWindow(GetParent(hwnd),FALSE); + #if 0 /* HBB 981203 */ +@@ -308,7 +323,11 @@ + { + LPPW lppw; + LONG n = GetWindowLong(hwnd, GWL_ID); ++#ifdef _WIN64 ++ lppw = (LPPW)GetWindowLongPtr(GetParent(hwnd), 0); ++#else + lppw = (LPPW)GetWindowLong(GetParent(hwnd), 0); ++#endif + switch(message) { + case WM_KEYDOWN: + switch(wParam) { +diff -urN gnuplot-4.6.4.orig/src/win/wprinter.c gnuplot-4.6.4/src/win/wprinter.c +--- gnuplot-4.6.4.orig/src/win/wprinter.c 2014-02-07 20:11:05.000000000 -0500 ++++ gnuplot-4.6.4/src/win/wprinter.c 2014-02-07 20:22:04.000000000 -0500 +@@ -63,15 +63,17 @@ + + GP_LPPRINT prlist = NULL; + +-BOOL CALLBACK PrintSizeDlgProc(HWND hdlg, UINT wmsg, WPARAM wparam, LPARAM lparam); + static GP_LPPRINT PrintFind(HDC hdc); + +- + BOOL CALLBACK + PrintSizeDlgProc(HWND hdlg, UINT wmsg, WPARAM wparam, LPARAM lparam) + { + char buf[8]; ++#ifdef _WIN64 ++ GP_LPPRINT lpr = (GP_LPPRINT)GetWindowLongPtr(GetParent(hdlg), 4); ++#else + GP_LPPRINT lpr = (GP_LPPRINT)GetWindowLong(GetParent(hdlg), 4); ++#endif + + switch (wmsg) { + case WM_INITDIALOG: +@@ -146,7 +148,11 @@ + BOOL status = FALSE; + GP_PRINT pr; + ++#ifdef _WIN64 ++ SetWindowLongPtr(hwnd, 4, (LONG_PTR)&pr); ++#else + SetWindowLong(hwnd, 4, (LONG)&pr); ++#endif + pr.poff.x = 0; + pr.poff.y = 0; + pr.psize.x = GetDeviceCaps(printer, HORZSIZE); +@@ -219,7 +225,11 @@ + PrintDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) + { + GP_LPPRINT lpr; ++#ifdef _WIN64 ++ lpr = (GP_LPPRINT) GetWindowLongPtr(GetParent(hDlg), 4); ++#else + lpr = (GP_LPPRINT)GetWindowLong(GetParent(hDlg), 4); ++#endif + /* FIXME: cause of crash in bug #3544949. No idea yet as to why this could happen, though. */ + if (lpr == NULL) + return FALSE; +@@ -240,7 +250,6 @@ + return FALSE; + } + +- + BOOL CALLBACK + PrintAbortProc(HDC hdcPrn, int code) + { +@@ -292,7 +301,12 @@ + printer = pd.hDC; + if (printer != (HDC)NULL) { + pr.hdcPrn = printer; ++ ++#ifdef _WIN64 ++ SetWindowLongPtr(hwnd, 4, (LONG_PTR)((GP_LPPRINT)&pr)); ++#else + SetWindowLong(hwnd, 4, (LONG)((GP_LPPRINT)&pr)); ++#endif + PrintRegister((GP_LPPRINT)&pr); + if ( (buf = malloc(4096+2)) != (char *)NULL ) { + bufcount = (WORD *)buf; +diff -urN gnuplot-4.6.4.orig/src/win/wtext.c gnuplot-4.6.4/src/win/wtext.c +--- gnuplot-4.6.4.orig/src/win/wtext.c 2014-02-07 20:11:05.000000000 -0500 ++++ gnuplot-4.6.4/src/win/wtext.c 2014-02-07 20:11:47.000000000 -0500 +@@ -287,7 +287,11 @@ + + sysmenu = GetSystemMenu(lptw->hWndParent,0); /* get the sysmenu */ + AppendMenu(sysmenu, MF_SEPARATOR, 0, NULL); ++#ifdef _WIN64 ++ AppendMenu(sysmenu, MF_POPUP, (UINT_PTR)lptw->hPopMenu, "&Options"); ++#else + AppendMenu(sysmenu, MF_POPUP, (UINT)lptw->hPopMenu, "&Options"); ++#endif + AppendMenu(sysmenu, MF_STRING, M_ABOUT, "&About"); + + if (lptw->lpmw) +@@ -1020,7 +1024,11 @@ + HDC hdc; + LPTW lptw; + ++#ifdef _WIN64 ++ lptw = (LPTW)GetWindowLongPtr(hwnd, 0); ++#else + lptw = (LPTW)GetWindowLong(hwnd, 0); ++#endif + + switch(message) { + case WM_SYSCOMMAND: +@@ -1098,7 +1106,11 @@ + TEXTMETRIC tm; + + lptw = ((CREATESTRUCT *)lParam)->lpCreateParams; ++#ifdef _WIN64 ++ SetWindowLongPtr(hwnd, 0, (LONG_PTR)lptw); ++#else + SetWindowLong(hwnd, 0, (LONG)lptw); ++#endif + lptw->hWndParent = hwnd; + /* get character size */ + TextMakeFont(lptw); +@@ -1195,7 +1207,11 @@ + int nYinc, nXinc; + LPTW lptw; + ++#ifdef _WIN64 ++ lptw = (LPTW)GetWindowLongPtr(hwnd, 0); ++#else + lptw = (LPTW)GetWindowLong(hwnd, 0); ++#endif + + switch(message) { + case WM_SETFOCUS: +@@ -1864,7 +1880,11 @@ + } + case WM_CREATE: + lptw = ((CREATESTRUCT *)lParam)->lpCreateParams; ++#ifdef _WIN64 ++ SetWindowLongPtr(hwnd, 0, (LONG_PTR)lptw); ++#else + SetWindowLong(hwnd, 0, (LONG)lptw); ++#endif + lptw->hWndText = hwnd; + break; + case WM_DESTROY: +@@ -2149,7 +2169,11 @@ + case WM_DRAWITEM: + { + LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam; ++#ifdef _WIN64 ++ DrawIcon(lpdis->hDC, 0, 0, (HICON)GetClassLongPtr(GetParent(hDlg), GCLP_HICON)); ++#else + DrawIcon(lpdis->hDC, 0, 0, (HICON)GetClassLong(GetParent(hDlg), GCL_HICON)); ++#endif + return FALSE; + } + case WM_COMMAND: