WinHugs: Fix Heap Size option
Neil Mitchell <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.cvs.hugs |
|---|---|
| Message-ID | <[email protected]> |
Hi, The heap size option was not wired up at all, now it is. Thanks Neil _______________________________________________ Cvs-hugs mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-hugs
heapsize_option.patch
(application/octet-stream, 1.5 KB)
Index: src/winhugs/DlgOptions.c
===================================================================
RCS file: /cvs/hugs98/src/winhugs/DlgOptions.c,v
retrieving revision 1.5
diff -u -r1.5 DlgOptions.c
--- src/winhugs/DlgOptions.c 7 Sep 2005 12:10:36 -0000 1.5
+++ src/winhugs/DlgOptions.c 4 Oct 2005 14:10:00 -0000
@@ -232,6 +232,8 @@
/////////////////////////////////////////////////////////////////////
// OPTRUNTIME related code
+#define HeapSizeMax 1000
+#define HeapSizeMin 1
int Heap2Mb(int heap){return max(1, heap * 8 / (1024 * 1024));}
int Mb2Heap(int mb){return (mb * 1024 * 1024) / 8;}
@@ -241,8 +243,8 @@
switch (msg) {
case WM_INITDIALOG:
// heapSize is 8 byte cells
- SetDlgItemInt(hDlg, txtHeapSize, Heap2Mb(heapSize), FALSE);
- SendDlgItemMessage(hDlg, spnHeapSize, UDM_SETRANGE, 0, MAKELONG(1000,1));
+ SetDlgItemInt(hDlg, txtHeapSize, Heap2Mb(hpSize), FALSE);
+ SendDlgItemMessage(hDlg, spnHeapSize, UDM_SETRANGE, 0, MAKELONG(HeapSizeMax,HeapSizeMin));
SetDlgItemBool(hDlg, chkUserShow, useShow);
SetDlgItemBool(hDlg, chkPrintStats, showStats);
@@ -253,6 +255,10 @@
case WM_NOTIFY:
if (((NMHDR*) lParam)->code == PSN_APPLY) {
// apply here
+ int NewHeapSize = GetDlgItemInt(hDlg, txtHeapSize, NULL, FALSE);
+ if (NewHeapSize >= HeapSizeMin && NewHeapSize <= HeapSizeMax)
+ hpSize = Mb2Heap(NewHeapSize);
+
useShow = GetDlgItemBool(hDlg, chkUserShow);
showStats = GetDlgItemBool(hDlg, chkPrintStats);
addType = GetDlgItemBool(hDlg, chkPrintType);