some changes to make compiler happier (function protos to avoid warnings)
authorClaus Gittinger <cg@exept.de>
Wed, 20 Apr 2016 15:48:53 +0200
changeset 7303 67a76c07b757
parent 7302 bc00d96fd11f
child 7304 3d6e5fa20cb0
child 7311 9ca5a89f4805
some changes to make compiler happier (function protos to avoid warnings)
WinWorkstation.st
--- a/WinWorkstation.st	Wed Apr 20 11:52:46 2016 +0200
+++ b/WinWorkstation.st	Wed Apr 20 15:48:53 2016 +0200
@@ -77,6 +77,7 @@
 #define xxBEEP_IN_WINTHREAD    /* */
 #define xxKEEP_STD_CURSORS     /* not useful - those are allocated only once, in any case */
 #define xxHANDLE_VIEWGRAVITY   /* not yet working */
+#define HANDLE_DEVICE_EVENTS
 #define COMPRESS_WINDOWPOSCHANGED
 
 #define USE_DRAW_MUTEX
@@ -185,11 +186,19 @@
 # define NOCRYPT
 # define NOMCX
 # define WIN32_LEAN_AND_MEAN
+# ifndef _WIN32_WINNT
+#  define _WIN32_WINNT 0x0500    /* need this to get certain defines from winuser.h (WM_NCXBUTTONDOWN) */
+# endif
 # include <windows.h>
 # include <shellapi.h>
+# ifdef HANDLE_DEVICE_EVENTS
+#  include <dbt.h>
+# endif
 # include <sys\timeb.h>
 # include <dir.h>
-#else
+
+#else
+
 # define _USERENTRY /**/
 # define NOATOM
 # define NOGDICAPMASKS
@@ -203,8 +212,13 @@
 # define NOCRYPT
 # define NOMCX
 # define WIN32_LEAN_AND_MEAN
-# define _WIN32_WINNT 0x0500    /* need this to get certain defines from winuser.h (WM_NCXBUTTONDOWN) */
+# ifndef _WIN32_WINNT
+#  define _WIN32_WINNT 0x0500    /* need this to get certain defines from winuser.h (WM_NCXBUTTONDOWN) */
+# endif
 # include <windows.h>
+# ifdef HANDLE_DEVICE_EVENTS
+#  include <dbt.h>
+# endif
 # include <shellapi.h>
 # include <sys\timeb.h>
 #endif
@@ -591,6 +605,8 @@
 # define UNHANDLED_EVENT_PRINTFIF(flag, x)    /* */
 #endif
 
+extern void __internalError(char *);
+
 /* # define EVENT_PRINTF(x)        { printf x;} */
 
 #define INFOFPRINTF(__x__)                 \
@@ -1193,8 +1209,7 @@
 #ifdef DEBUG_DELETEOBJECT
 
 static int
-_DeleteObject(o, lineNr)
-    HANDLE o;
+_DeleteObject(HANDLE o, int lineNr)
 {
     int r = DeleteObject(o);
 
@@ -1208,8 +1223,7 @@
 #endif
 
 static void
-_DeleteFont(f, lineNr)
-    HFONT f;
+_DeleteFont(HFONT f, int lineNr)
 {
 #ifdef CACHE_LAST_TMP_FONT
     if (f == __tmpDC_hfont) {
@@ -1221,8 +1235,7 @@
 }
 
 static int
-_DeleteBrush(br, lineNr)
-    HBRUSH br;
+_DeleteBrush(HBRUSH br, int lineNr)
 {
     int r;
 
@@ -1238,8 +1251,7 @@
 }
 
 static int
-_DeletePen(p, lineNr)
-    HPEN p;
+_DeletePen(HPEN p, int lineNr)
 {
     int r;
 
@@ -1257,8 +1269,7 @@
 #ifdef CACHE_PEN
 
 static int
-_DeletePenIfNotInCache(p, lineNr)
-    HPEN p;
+_DeletePenIfNotInCache(HPEN p, int lineNr)
 {
     int i, r;
 
@@ -1285,8 +1296,7 @@
 #ifdef CACHE_BRUSH
 
 static int
-_DeleteBrushIfNotInCache(br, lineNr)
-    HBRUSH br;
+_DeleteBrushIfNotInCache(HBRUSH br, int lineNr)
 {
     int i, r;
 
@@ -4526,6 +4536,13 @@
 	    UNHANDLED_EVENT_PRINTF(("WM_DEVICECHANGE\n"));
 	    break;
 
+	case DBT_DEVICEARRIVAL:
+	    UNHANDLED_EVENT_PRINTF(("DBT_DEVICEARRIVAL\n"));
+	    break;
+
+	case DBT_DEVICEREMOVECOMPLETE:
+	    UNHANDLED_EVENT_PRINTF(("DBT_DEVICEREMOVECOMPLETE\n"));
+	    break;
 #endif
 
 	default:
@@ -6672,7 +6689,7 @@
     "retrieve a windows system color.
      The styleSheet/View classes may use this to setup default colors"
 
-    ^ SystemColorValues at:aKey ifAbsentPut:[self primGetSystemColor:aKey].    
+    ^ SystemColorValues at:aKey ifAbsentPut:[self primGetSystemColor:aKey].
 
     "
      Display getSystemColor:#COLOR_WINDOW
@@ -7252,9 +7269,9 @@
     rgb isNil ifTrue:[ ^ nil ].
 
     ^ Color
-        redByte:((rgb bitShift:-16) bitAnd:16rFF)
-        greenByte:((rgb bitShift:-8) bitAnd:16rFF)
-        blueByte:(rgb bitAnd:16rFF)
+	redByte:((rgb bitShift:-16) bitAnd:16rFF)
+	greenByte:((rgb bitShift:-8) bitAnd:16rFF)
+	blueByte:(rgb bitAnd:16rFF)
 
     "
      Display getSystemColor:#COLOR_WINDOW
@@ -8304,7 +8321,7 @@
     int isTopWindow = 0, isNativeWindow = 0, isMDIChild = 0;
     localWindowInfo *lI;
     static createWindowInfo cwi;
-    static nextSequenceNr = 1;
+    static int nextSequenceNr = 1;
     unsigned char* cp;
     HBITMAP        xBitMap, maskBitmap;
     HICON          xIcon = (HICON)0;
@@ -11504,32 +11521,32 @@
     |anyChange|
 
     IgnoreSysColorChanges ifFalse:[
-        "/ first check, if there was really a change of any color that
-        "/ we are interested in
-        "/ (when exceed is running, we get plenty of those messages ...)
-
-        anyChange := false.
-        SystemColorValues copy keysAndValuesDo:[:eachKey :eachOldColor|
-            |newColor|
-
-            newColor := self primGetSystemColor:eachKey.
-            newColor ~= eachOldColor ifTrue:[
-                SystemColorValues at:eachKey put:newColor.
-                anyChange := true.
-            ].
-        ].
-        anyChange ifTrue:[
-            "/ TODO: this should go through the sensor ...
-            "/ ...and be handled as an event by the views thread.
-            SimpleView readStyleSheetAndUpdateAllStyleCaches.
-            aWindow withAllSubViewsDo:[:eachView |
-                eachView reinitStyle
-            ]
-        ]
+	"/ first check, if there was really a change of any color that
+	"/ we are interested in
+	"/ (when exceed is running, we get plenty of those messages ...)
+
+	anyChange := false.
+	SystemColorValues copy keysAndValuesDo:[:eachKey :eachOldColor|
+	    |newColor|
+
+	    newColor := self primGetSystemColor:eachKey.
+	    newColor ~= eachOldColor ifTrue:[
+		SystemColorValues at:eachKey put:newColor.
+		anyChange := true.
+	    ].
+	].
+	anyChange ifTrue:[
+	    "/ TODO: this should go through the sensor ...
+	    "/ ...and be handled as an event by the views thread.
+	    SimpleView readStyleSheetAndUpdateAllStyleCaches.
+	    aWindow withAllSubViewsDo:[:eachView |
+		eachView reinitStyle
+	    ]
+	]
     ]
 
     "
-        Display systemColorChange:StandardSystemView new
+	Display systemColorChange:StandardSystemView new
     "
 !
 
@@ -13622,7 +13639,8 @@
 	int avgWidth;
 	HGDIOBJ hFont;
 	HGDIOBJ prevFont;
-	TEXTMETRIC tmet;
+	// TEXTMETRIC tmet;
+	TEXTMETRICW tmet;
 	OBJ t;
 
 	hFont = _HGDIOBJVal(fontId);
@@ -14146,7 +14164,8 @@
     {
 	struct gcData *gcData = _GCDATA(aGCId);
 	HGDIOBJ prevFont, hFont;
-	TEXTMETRIC tmet;
+	// TEXTMETRIC tmet;
+	TEXTMETRICW tmet;
 
 	hFont = _HGDIOBJVal(aFontId);
 	if (gcData->hFont != hFont) {
@@ -14164,7 +14183,7 @@
 	    prevFont = SelectObject(__tmpDC, hFont);
 #endif
 
-	    GetTextMetrics(__tmpDC, &tmet);
+	    GetTextMetricsW(__tmpDC, &tmet);
 	    gcData->fontAscent = tmet.tmAscent;
 #ifdef SUPERDEBUG
 	    if (__debug__) {
@@ -14648,7 +14667,10 @@
 
     if (firstInstance) {
 	OSVERSIONINFO osvi;
-	WNDCLASS wc;
+	WNDCLASSW wc_stx;
+	WNDCLASSW wc_root;
+	WNDCLASSW wc_popup;
+	WNDCLASSW wc_dialog;
 	firstInstance = 0;
 	DPRINTF(("first create - registerClass\n"));
 
@@ -14693,76 +14715,76 @@
 	/*
 	 * register class: ST/X
 	 */
-	wc.style = 0
+	wc_stx.style = 0
 		   /* | CS_OWNDC */
 		   /* | CS_HREDRAW */
 		   /* | CS_VREDRAW */
 		  | CS_DBLCLKS;
-	wc.lpfnWndProc = (WNDPROC) MainWndProc;
-	wc.cbClsExtra = 0;
-	wc.cbWndExtra = N_WINDOW_PRIVATE;
-	wc.hInstance = (HANDLE) __getHInstance();
-	wc.hIcon = NULL;
-	wc.hCursor = 0;
-	wc.hbrBackground = 0;
-
-	wc.lpszMenuName =  NULL;
-	wc.lpszClassName = wapp_name;
-	RegisterClassW(&wc);
+	wc_stx.lpfnWndProc = (WNDPROC) MainWndProc;
+	wc_stx.cbClsExtra = 0;
+	wc_stx.cbWndExtra = N_WINDOW_PRIVATE;
+	wc_stx.hInstance = (HANDLE) __getHInstance();
+	wc_stx.hIcon = NULL;
+	wc_stx.hCursor = 0;
+	wc_stx.hbrBackground = 0;
+
+	wc_stx.lpszMenuName =  NULL;
+	wc_stx.lpszClassName = wapp_name;
+	RegisterClassW( (&wc_stx) );
 
 	/*
 	 * register class: ST/X:Root
 	 */
-	wc.style = 0;
-	wc.lpfnWndProc = (WNDPROC) MainWndProc;
-	wc.cbClsExtra = 0;
-	wc.cbWndExtra = N_WINDOW_PRIVATE;
-	wc.hInstance = (HANDLE) __getHInstance();
-	wc.hIcon = NULL;
-	wc.hCursor = 0;
-	wc.hbrBackground = GetStockObject(HOLLOW_BRUSH);
-
-	wc.lpszMenuName =  NULL;
-	wc.lpszClassName = wapp_nameRoot;
-	RegisterClassW(&wc);
+	wc_root.style = 0;
+	wc_root.lpfnWndProc = (WNDPROC) MainWndProc;
+	wc_root.cbClsExtra = 0;
+	wc_root.cbWndExtra = N_WINDOW_PRIVATE;
+	wc_root.hInstance = (HANDLE) __getHInstance();
+	wc_root.hIcon = NULL;
+	wc_root.hCursor = 0;
+	wc_root.hbrBackground = GetStockObject(HOLLOW_BRUSH);
+
+	wc_root.lpszMenuName =  NULL;
+	wc_root.lpszClassName = wapp_nameRoot;
+	RegisterClassW( (CONST WNDCLASSW *)(&wc_root) );
 
 	/*
 	 * register class: ST/X:Popup
 	 */
-	wc.style = CS_SAVEBITS;
+	wc_popup.style = CS_SAVEBITS;
 	if (__isWinXP) {
 #ifndef CS_DROPSHADOW
 # define CS_DROPSHADOW    0x020000
 #endif
-	    wc.style |= CS_DROPSHADOW;
-	}
-	wc.lpfnWndProc = (WNDPROC) MainWndProc;;
-	wc.cbClsExtra = 0;
-	wc.cbWndExtra = N_WINDOW_PRIVATE;
-	wc.hInstance = (HANDLE) __getHInstance();
-	wc.hIcon = NULL;
-	wc.hCursor = 0;
-	wc.hbrBackground = GetStockObject(HOLLOW_BRUSH);
-
-	wc.lpszMenuName =  NULL;
-	wc.lpszClassName = wapp_namePopup;
-	RegisterClassW(&wc);
+	    wc_popup.style |= CS_DROPSHADOW;
+	}
+	wc_popup.lpfnWndProc = (WNDPROC) MainWndProc;;
+	wc_popup.cbClsExtra = 0;
+	wc_popup.cbWndExtra = N_WINDOW_PRIVATE;
+	wc_popup.hInstance = (HANDLE) __getHInstance();
+	wc_popup.hIcon = NULL;
+	wc_popup.hCursor = 0;
+	wc_popup.hbrBackground = GetStockObject(HOLLOW_BRUSH);
+
+	wc_popup.lpszMenuName =  NULL;
+	wc_popup.lpszClassName = wapp_namePopup;
+	RegisterClassW( (CONST WNDCLASSW *)(&wc_popup) );
 
 	/*
 	 * register class: ST/X:Dialog
 	 */
-	wc.style = CS_SAVEBITS;
-	wc.lpfnWndProc = (WNDPROC) MainWndProc;;
-	wc.cbClsExtra = 0;
-	wc.cbWndExtra = N_WINDOW_PRIVATE;
-	wc.hInstance = (HANDLE) __getHInstance();
-	wc.hIcon = NULL;
-	wc.hCursor = 0;
-	wc.hbrBackground = GetStockObject(HOLLOW_BRUSH);
-
-	wc.lpszMenuName =  NULL;
-	wc.lpszClassName = wapp_nameDialog;
-	RegisterClassW(&wc);
+	wc_dialog.style = CS_SAVEBITS;
+	wc_dialog.lpfnWndProc = (WNDPROC) MainWndProc;;
+	wc_dialog.cbClsExtra = 0;
+	wc_dialog.cbWndExtra = N_WINDOW_PRIVATE;
+	wc_dialog.hInstance = (HANDLE) __getHInstance();
+	wc_dialog.hIcon = NULL;
+	wc_dialog.hCursor = 0;
+	wc_dialog.hbrBackground = GetStockObject(HOLLOW_BRUSH);
+
+	wc_dialog.lpszMenuName =  NULL;
+	wc_dialog.lpszClassName = wapp_nameDialog;
+	RegisterClassW( (CONST WNDCLASSW *)(&wc_dialog) );
 
 	/*
 	 * generate my events
@@ -15658,6 +15680,7 @@
     char filterBuffer[1024*4] = "\0";
     BOOL __rslt;
     jmp_buf exitJmpBuf;
+    extern void __setAtExitLongJmp(jmp_buf);
 
     if (__isExternalAddress(ownerId)) {
 	hWndOwner = _HWNDVal(ownerId);