From 05d3cd45e5991ee8275ca870d17b28b17ca34c87 Mon Sep 17 00:00:00 2001
From: Chris Elliott <biol75@york.ac.uk>
Date: Wed, 7 May 2003 13:18:45 +0000
Subject: [PATCH] update for digital mars - resolve externals in shell and
 winsock libs

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20528 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 distrib/msw/tmake/sc.t      | 13 +++++--------
 lib/_sc/shell32_sc.def      |  5 +++++
 samples/mdi/makefile.sc     |  2 +-
 samples/minimal/makefile.sc | 38 +++----------------------------------
 src/makesc.env              |  7 ++++---
 src/msw/gdiimage.cpp        |  9 ---------
 src/msw/makefile.sc         | 14 +++++---------
 src/msw/mimetype.cpp        |  9 +--------
 src/msw/ole/dataobj.cpp     |  6 ------
 src/msw/utils.cpp           |  5 +----
 src/msw/window.cpp          | 10 +---------
 11 files changed, 26 insertions(+), 92 deletions(-)

diff --git a/distrib/msw/tmake/sc.t b/distrib/msw/tmake/sc.t
index 83efb90ed6..4fd0c2003d 100644
--- a/distrib/msw/tmake/sc.t
+++ b/distrib/msw/tmake/sc.t
@@ -93,7 +93,7 @@ MSWOBJS = #$ ExpandList("WXMSWOBJS");
 # Add $(NONESSENTIALOBJS) if wanting generic dialogs, PostScript etc.
 OBJECTS = $(COMMONOBJS) $(GENERICOBJS) $(MSWOBJS) $(HTMLOBJS) 
 
-all: MAKEARCHDIR MAKEWINSOCKLIB $(LIBTARGET) zlib png jpeg tiff regex
+all: MAKEARCHDIR MAKELIBS $(LIBTARGET) zlib png jpeg tiff regex
 
 MAKEARCHDIR:
     @if not exist $(MSWINCDIR)\setup.h copy $(MSWINCDIR)\setup0.h $(MSWINCDIR)\setup.h
@@ -101,13 +101,10 @@ MAKEARCHDIR:
     @if not exist $(ARCHINCDIR)\wx\setup.h mkdir $(ARCHINCDIR)\wx
     @if not exist $(ARCHINCDIR)\wx\setup.h copy $(MSWINCDIR)\setup.h $(ARCHINCDIR)\wx\setup.h
 
-MAKEWINSOCKLIB:
-      if not exist $(WINSOCKLIB) implib  /s $(WINSOCKLIB) $(WINDIR)\system32\wsock32.dll
-##    implib /system /v /suffix /Ic:\wx\dm\include\win32 $(WINSOCKLIB) $(WINDIR)\system32\wsock32.dll
-##  bug here on win98 no system32 ??
-##  implib doesn't work anyway
-##    implib  /s $(WINSOCKLIB) $(WINDIR)\system32\winsock.dll
-##@if not exist $(WINSOCKLIB)  
+#build our own copies of missing libraries
+MAKELIBS:
+      implib  /s $(LIBDIR)\$(SHELLLIB) $(LIBDIR)\$(SC_SUFFIX)\$(SHELLLIB).def
+      implib  /s $(LIBDIR)\$(WINSOCKLIB) $(LIBDIR)\$(SC_SUFFIX)\$(WINSOCKLIB).def
 
 $(LIBTARGET): $(OBJECTS)
 	-del $(LIBTARGET)
diff --git a/lib/_sc/shell32_sc.def b/lib/_sc/shell32_sc.def
index d51faa60fc..2d990962b5 100644
--- a/lib/_sc/shell32_sc.def
+++ b/lib/_sc/shell32_sc.def
@@ -4,4 +4,9 @@ SUBSYSTEM WINDOWS
 EXPORTS
     _ExtractIconA@12 = ExtractIconA
     _ExtractIconExA@20 = ExtractIconExA
+    _DragQueryPoint@8 = DragQueryPoint
+    _DragFinish@4 = DragFinish
+    _DragQueryFileA@16 = DragQueryFileA
+    _DragAcceptFiles@8 = DragAcceptFiles
+
 
diff --git a/samples/mdi/makefile.sc b/samples/mdi/makefile.sc
index f8bbfdfd9d..0cf34bd381 100644
--- a/samples/mdi/makefile.sc
+++ b/samples/mdi/makefile.sc
@@ -1,4 +1,4 @@
-# Symantec C++ makefile 
+# Digital Mars / Symantec C++ makefile 
 WXDIR = ..\..
 TARGET=mdi
 include $(WXDIR)\src\makeprog.sc 
diff --git a/samples/minimal/makefile.sc b/samples/minimal/makefile.sc
index 5f574ba91e..22741778a7 100644
--- a/samples/minimal/makefile.sc
+++ b/samples/minimal/makefile.sc
@@ -1,36 +1,4 @@
-# Symantec C++ makefile
-
-WXDIR = $(WXWIN)
-WXLIB = $(WXDIR)\lib\wx.lib
-INCDIR = $(WXDIR)\include
-INCLUDE=$(INCDIR)
+# Digital Mars / Symantec C++ makefile 
+WXDIR = ..\..
 TARGET=minimal
-
-include $(WXDIR)\src\makesc.env
-
-minimal.exe: minimal.obj 
-	link $(LDFLAGS) $*, $@, $*, $(LIBS)
-    
-
-sc32.def:
-     echo EXETYPE NT > sc32.def
-     echo SUBSYSTEM WINDOWS >> sc32.def
-
-sc16.def:
-     echo NAME $(TARGET) > sc16.def
-     echo EXETYPE WINDOWS >> sc16.def
-     echo STUB         'WINSTUB.EXE' >> sc16.def
-     echo CODE         PRELOAD MOVEABLE DISCARDABLE >> sc16.def
-     echo DATA         PRELOAD MOVEABLE MULTIPLE >> sc16.def
-     echo HEAPSIZE     1024 >> sc16.def
-     echo STACKSIZE    8192 >> sc16.def
-
-clean:
-    -del *.obj
-	-del *.exe
-	-del *.res
-	-del *.map
-	-del *.rws
-    -del sc32.def
-    -del sc16.def
-
+include $(WXDIR)\src\makeprog.sc 
diff --git a/src/makesc.env b/src/makesc.env
index e69463dfe7..11c7bbe736 100644
--- a/src/makesc.env
+++ b/src/makesc.env
@@ -8,8 +8,9 @@ MSWINCDIR = $(WXDIR)\include\wx\msw
 ARCHINCDIR = $(WXDIR)\lib\$(SC_SUFFIX)
 LIBDIR = $(WXDIR)\lib
 WXLIB = wx$(SC_SUFFIX).lib
-WINSOCKLIB = $(LIBDIR)\winsock$(SC_SUFFIX).lib
-SUPPORTLIBS = png$(SC_SUFFIX) tiff$(SC_SUFFIX) jpeg$(SC_SUFFIX) zlib$(SC_SUFFIX)
+WINSOCKLIB = wsock32$(SC_SUFFIX)
+SHELLLIB = shell32$(SC_SUFFIX)
+SUPPORTLIBS = png$(SC_SUFFIX) tiff$(SC_SUFFIX) jpeg$(SC_SUFFIX) zlib$(SC_SUFFIX) $(SHELLLIB) $(WINSOCKLIB)
 
 SRCSUFF = cpp
 OBJSUFF = obj
@@ -28,7 +29,7 @@ RC=rcc
 CFLAGS = -o -mn -W -H -D__NT__ -DWIN32 -D__WIN32__ -D__WIN95__ -D__WINDOWS__ -D__WXMSW__ -D__SC__ -D__WXDEBUG__ $(EXTRACPPFLAGS)
 LINKER = link
 LDFLAGS = $(EXTRALDFLAGS)
-LIBS=$(WXLIB) $(EXTRALIBS) $(SUPPORTLIBS) advapi32 comctl32 comdlg32 ctl3d32 gc  gdi32 kernel32 ole32 oleaut32 snn user32 uuid $(WINSOCKLIB)
+LIBS=$(WXLIB) $(EXTRALIBS) $(SUPPORTLIBS) advapi32 comctl32 comdlg32 ctl3d32 gc  gdi32 kernel32 ole32 oleaut32 snn user32 uuid 
 DEFFILE=sc32.def
 
 .$(SRCSUFF).obj:
diff --git a/src/msw/gdiimage.cpp b/src/msw/gdiimage.cpp
index 7d04d9be55..1e7606bcbe 100644
--- a/src/msw/gdiimage.cpp
+++ b/src/msw/gdiimage.cpp
@@ -373,14 +373,6 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon,
                                 long WXUNUSED(flags),
                                 int desiredWidth, int desiredHeight)
 {
-#ifdef __DIGITALMARS__
-//FIXME __DIGITALMARS__ April 2003 CE
-    // why no ExtractIcon in library
-            wxLogTrace(_T("iconload"),
-                   _T("Returning false from wxICOFileHandler::Load because of DigitalMars compiler bug"));
-
-    return false;
-#else
     icon->UnRef();
 
     // actual size
@@ -483,7 +475,6 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon,
     icon->SetSize(size.x, size.y);
 
     return icon->Ok();
-#endif // Digitalmars
 }
 
 bool wxICOResourceHandler::LoadIcon(wxIcon *icon,
diff --git a/src/msw/makefile.sc b/src/msw/makefile.sc
index 4ebcda518a..f82064a06f 100644
--- a/src/msw/makefile.sc
+++ b/src/msw/makefile.sc
@@ -322,7 +322,7 @@ MSWOBJS = $(MSWDIR)\accel.obj \
 # Add $(NONESSENTIALOBJS) if wanting generic dialogs, PostScript etc.
 OBJECTS = $(COMMONOBJS) $(GENERICOBJS) $(MSWOBJS) $(HTMLOBJS) 
 
-all: MAKEARCHDIR MAKEWINSOCKLIB $(LIBTARGET) zlib png jpeg tiff regex
+all: MAKEARCHDIR MAKELIBS $(LIBTARGET) zlib png jpeg tiff regex
 
 MAKEARCHDIR:
     @if not exist $(MSWINCDIR)\setup.h copy $(MSWINCDIR)\setup0.h $(MSWINCDIR)\setup.h
@@ -330,14 +330,10 @@ MAKEARCHDIR:
     @if not exist $(ARCHINCDIR)\wx\setup.h mkdir $(ARCHINCDIR)\wx
     @if not exist $(ARCHINCDIR)\wx\setup.h copy $(MSWINCDIR)\setup.h $(ARCHINCDIR)\wx\setup.h
 
-MAKEWINSOCKLIB:
-      implib  /s $(WINSOCKLIB) $(WINDIR)\system32\wsock32.dll
-##      implib /system /v /suffix /Ic:\wx\dm\include\win32 $(WINSOCKLIB) $(WINDIR)\system32\winsock.dll
-##    implib /system /v /suffix /Ic:\wx\dm\include\win32 $(WINSOCKLIB) $(WINDIR)\system32\wsock32.dll
-##  bug here on win98 no system32 ??
-##  implib doesn't work anyway
-##    implib  /s $(WINSOCKLIB) $(WINDIR)\system32\winsock.dll
-##@if not exist $(WINSOCKLIB)  
+#build our own copies of missing libraries
+MAKELIBS:
+      implib  /s $(LIBDIR)\$(SHELLLIB) $(LIBDIR)\$(SC_SUFFIX)\$(SHELLLIB).def
+      implib  /s $(LIBDIR)\$(WINSOCKLIB) $(LIBDIR)\$(SC_SUFFIX)\$(WINSOCKLIB).def
 
 $(LIBTARGET): $(OBJECTS)
 	-del $(LIBTARGET)
diff --git a/src/msw/mimetype.cpp b/src/msw/mimetype.cpp
index 1d504dd974..6ce8557e4e 100644
--- a/src/msw/mimetype.cpp
+++ b/src/msw/mimetype.cpp
@@ -366,16 +366,9 @@ bool wxFileTypeImpl::GetIcon(wxIcon *icon,
             wxString strExpPath = wxExpandEnvVars(strFullPath);
             // here we need C based counting!
             int nIndex = wxAtoi(strIndex);
-#ifdef __DIGITALMARS__
-//FIXME __DIGITALMARS__ April 2003 CE
-    // why no ExtractIcon in library
-            wxLogTrace(_T("wxFileTypeImpl::GetIcon"),
-                   _T("Returning false from wxFileTypeImpl::GetIcon because of DigitalMars compiler bug"));
-            HICON hIcon = 0 ;
-#else
 
             HICON hIcon = ExtractIcon(GetModuleHandle(NULL), strExpPath, nIndex);
-#endif
+
             switch ( (int)hIcon ) {
                 case 0: // means no icons were found
                 case 1: // means no such file or it wasn't a DLL/EXE/OCX/ICO/...
diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp
index b5c4b6f593..7ecdb81d3b 100644
--- a/src/msw/ole/dataobj.cpp
+++ b/src/msw/ole/dataobj.cpp
@@ -973,12 +973,6 @@ bool wxBitmapDataObject::SetData(const wxDataFormat& format,
 
 bool wxFileDataObject::SetData(size_t WXUNUSED(size), const void *pData)
 {
-//FIX ME  __DIGITALMARS__   
-#if defined (__DIGITALMARS__)
-    //DragQueryFile not in any library
-    wxLogDebug(wxT("In wxFileDataObject::SetData code not executed - no Digital Mars library "));
-    return FALSE;
-#endif
     m_filenames.Empty();
 
     // the documentation states that the first member of DROPFILES structure is
diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp
index 5b083fbd03..b70c622689 100644
--- a/src/msw/utils.cpp
+++ b/src/msw/utils.cpp
@@ -180,9 +180,7 @@ bool wxGetFullHostName(wxChar *buf, int maxSize)
     // shouldn't use winsock.dll (a.k.a. ws2_32.dll) at all so only use this
     // code if we link with it anyhow
 #if wxUSE_SOCKETS
-    //FIXME __DIGITALMARS__ why is using sockets not properly turned off in setup.h ??
-    // find which library should contain sockets for Digital Mars CE April 2003
-#ifndef __DIGITALMARS__
+
     WSADATA wsa;
     if ( WSAStartup(MAKEWORD(1, 1), &wsa) == 0 )
     {
@@ -218,7 +216,6 @@ bool wxGetFullHostName(wxChar *buf, int maxSize)
             return TRUE;
         }
     }
-#endif //__DIGITALMARS__
 
 #endif // wxUSE_SOCKETS
 
diff --git a/src/msw/window.cpp b/src/msw/window.cpp
index a3e8a83329..4167197fda 100644
--- a/src/msw/window.cpp
+++ b/src/msw/window.cpp
@@ -1415,12 +1415,10 @@ void wxWindowMSW::Update()
 // drag and drop
 // ---------------------------------------------------------------------------
 
-//FIXME __DIGITALMARS__ does not honor drag drop in setup.h
 
 #if wxUSE_DRAG_AND_DROP
 void wxWindowMSW::SetDropTarget(wxDropTarget *pDropTarget)
 {
-#ifndef __DIGITALMARS__
     if ( m_dropTarget != 0 ) {
         m_dropTarget->Revoke(m_hWnd);
         delete m_dropTarget;
@@ -1429,7 +1427,6 @@ void wxWindowMSW::SetDropTarget(wxDropTarget *pDropTarget)
     m_dropTarget = pDropTarget;
     if ( m_dropTarget != 0 )
         m_dropTarget->Register(m_hWnd);
-#endif //  __DIGITALMARS__
 }
 #endif // wxUSE_DRAG_AND_DROP
 
@@ -1437,11 +1434,9 @@ void wxWindowMSW::SetDropTarget(wxDropTarget *pDropTarget)
 // DragAcceptFiles in parallel with SetDropTarget.
 void wxWindowMSW::DragAcceptFiles(bool accept)
 {
-#ifndef __DIGITALMARS__
     HWND hWnd = GetHwnd();
     if ( hWnd )
         ::DragAcceptFiles(hWnd, (BOOL)accept);
-#endif
 }
 
 // ----------------------------------------------------------------------------
@@ -3246,7 +3241,6 @@ bool wxWindowMSW::HandleDestroy()
 
     // delete our drop target if we've got one
 #if wxUSE_DRAG_AND_DROP
-#ifndef __DIGITALMARS__    
     if ( m_dropTarget != NULL )
     {
         m_dropTarget->Revoke(m_hWnd);
@@ -3254,7 +3248,6 @@ bool wxWindowMSW::HandleDestroy()
         delete m_dropTarget;
         m_dropTarget = NULL;
     }
-#endif  //#ifndef __DIGITALMARS__
 #endif // wxUSE_DRAG_AND_DROP
 
     // WM_DESTROY handled
@@ -3368,8 +3361,7 @@ bool wxWindowMSW::HandleInitDialog(WXHWND WXUNUSED(hWndFocus))
 
 bool wxWindowMSW::HandleDropFiles(WXWPARAM wParam)
 {
-//FIX ME  __DIGITALMARS__   
-#if defined (__WXMICROWIN__) || defined (__DIGITALMARS__)
+#if defined (__WXMICROWIN__) 
     return FALSE;
 #else // __WXMICROWIN__
     HDROP hFilesInfo = (HDROP) wParam;
-- 
2.50.0

