Fixes for 16-bit compilation

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4166 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 1999-10-24 19:50:17 +00:00
parent 2d93e1335c
commit 8fb3a512a8
18 changed files with 143 additions and 61 deletions

View File

@ -2,6 +2,11 @@
#! File: bcc.t
#! Purpose: tmake template file from which makefile.bcc is generated by running
#! tmake -t bcc wxwin.pro -o makefile.bcc
#!
#! TODO:
#! - resourc2.obj is not correctly generated (see list and target).
#! - cpp is incorrectly substituted into filenames containing 'obj'
#!
#! Author: Vadim Zeitlin
#! Created: 14.07.99
#! Version: $Id$
@ -36,7 +41,7 @@
}
#! special hack for Borland in 16 bits needs this file
$project{"WXCOMMONOBJS"} .= '${MSWDIR}\resourc2.cpp';
$project{"WXCOMMONOBJS"} .= '${MSWDIR}\resourc2.obj';
foreach $file (sort keys %wxMSW) {
#! don't take files not appropriate for 16-bit Windows
@ -140,7 +145,10 @@ wx: $(CFG) $(DUMMY).obj $(OBJECTS) $(PERIPH_TARGET) $(LIBTARGET)
$(LIBTARGET): $(DUMMY).obj $(OBJECTS) $(PERIPH_LIBS)
erase $(LIBTARGET)
tlib $(LIBTARGET) /P1024 @&&!
+$(OBJECTS:.obj =.obj +) +$(PERIPH_LIBS:.lib =.lib +)
+$(COMMONOBJS:.obj =.obj +)\
+$(GENERICOBJS:.obj =.obj +)\
+$(MSWOBJS:.obj =.obj +)\
+$(PERIPH_LIBS:.lib =.lib +)
!
dummy.obj: dummy.$(SRCSUFF) $(LOCALHEADERS) $(BASEHEADERS) $(WXDIR)\include\wx\wx.h

View File

@ -117,18 +117,7 @@ MSWOBJS = #$ ExpandList("WXMSWOBJS");
OBJECTS = $(COMMONOBJS) $(GENERICOBJS) $(MSWOBJS)
# Normal, static library
all: $(DUMMYOBJ) $(WXDIR)\lib\wx1.lib $(WXDIR)\lib\wx2.lib $(WXDIR)\lib\wx3.lib
# $(WXDIR)\lib\wx.lib: dummy.obj $(OBJECTS) $(PERIPH_LIBS)
# -erase $(LIBTARGET)
# lib /PAGESIZE:128 @<<
# $(LIBTARGET)
# y
# $(OBJECTS) $(PERIPH_LIBS)
# nul
# ;
# <<
all: $(DUMMYOBJ) $(WXDIR)\lib\wx1.lib $(WXDIR)\lib\wx2.lib $(WXDIR)\lib\wx3.lib $(WXDIR)\lib\wx4.lib
$(WXDIR)\lib\wx1.lib: $(COMMONOBJS) $(PERIPH_LIBS)
-erase $(WXDIR)\lib\wx1.lib
@ -150,12 +139,22 @@ nul
;
<<
$(WXDIR)\lib\wx3.lib: $(MSWOBJS)
$(WXDIR)\lib\wx3.lib: $(MSWOBJS1)
-erase $(WXDIR)\lib\wx3.lib
lib /PAGESIZE:128 @<<
$(WXDIR)\lib\wx3.lib
y
$(MSWOBJS)
$(MSWOBJS1)
nul
;
<<
$(WXDIR)\lib\wx4.lib: $(MSWOBJS2)
-erase $(WXDIR)\lib\wx4.lib
lib /PAGESIZE:128 @<<
$(WXDIR)\lib\wx4.lib
y
$(MSWOBJS2)
nul
;
<<

View File

@ -178,8 +178,8 @@ if necessary) that the project settings, especially the list of defined
symbols, struct packing, etc. are exactly the same for all items in
the project. After this, delete everything (including PCH) and recompile.
Visual C++ 1.5 compilation
--------------------------
Visual C++ 1.5 compilation (16-bit)
-----------------------------------
1. Make sure your WXWIN variable is set, and uses the FAT (short
name) form.
@ -215,7 +215,11 @@ Note (1): the wxWindows library and (some) samples compile in 16-bit mode
using makefile.bcc, but at present the wxWindows resource system is switched
off in this mode. See issues.txt for details.
Note (2): the wxWindows makefiles assume byte structure alignment. Please
Note (2): unfortunately most samples won't link in 16-bit mode,
because the automatic data segment exceeds 64K. The minimal
sample links and runs, however.
Note (3): the wxWindows makefiles assume byte structure alignment. Please
make sure that your own project or makefile settings use the
same alignment, or you could experience mysterious crashes. To
change the alignment, add a suitable option to the $(CFG) target code
@ -274,11 +278,12 @@ Metrowerks CodeWarrior compilation
Further project files for samples will be available in due
course.
NOTES:
You need CodeWarrior Pro 4 plus the patches to 4.1 from the
Note (1): you need CodeWarrior Pro 4 plus the patches to 4.1 from the
Metrowerks Web site.
Note (2): unfortunately these files are not yet up-to-date for the
current release.
Symantec C++ compilation
------------------------

View File

@ -244,7 +244,12 @@ public:
void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const
{ DoGetClippingBox(x, y, w, h); }
void GetClippingBox(wxRect& rect) const
{ DoGetClippingBox(&rect.x, &rect.y, &rect.width, &rect.height); }
{
// Necessary to use intermediate variables for 16-bit compilation
wxCoord x, y, w, h;
DoGetClippingBox(&x, &y, &w, &h);
rect.x = x; rect.y = y; rect.width = w; rect.height = h;
}
// text extent
// -----------

View File

@ -1607,6 +1607,16 @@ typedef unsigned short WORD;
#endif
typedef WXHWND WXWidget;
#if defined(__BORLANDC__) && !defined(__WIN32__)
#ifndef LPTSTR
#define LPTSTR LPSTR
#endif
#ifndef LPCTSTR
#define LPCTSTR LPSTR
#endif
#endif
#endif // MSW
#ifdef __WXMOTIF__

View File

@ -9,6 +9,9 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CURICO_H_
#define _WX_CURICO_H_
HICON ReadIconFile( wxChar *szFileName, HINSTANCE hInst,
int *W = 0, int *H = 0);
HCURSOR ReadCursorFile( wxChar *szFileName, HINSTANCE hInst,
@ -20,3 +23,6 @@ HICON CursorToIcon( wxChar *szFileName, HINSTANCE hInst,
HCURSOR MakeCursorFromBitmap(HINSTANCE hInst, HBITMAP hBitmap, POINT *pPoint);
HICON MakeIconFromBitmap(HINSTANCE hInst, HBITMAP hBitmap);
#endif

View File

@ -1,3 +1,17 @@
/////////////////////////////////////////////////////////////////////////////
// Name: curicop.h
// Purpose: Private routines for cursor/icon handling
// Author: Various
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CURICOP_H_
#define _WX_CURICOP_H_
// PRIVATE STUFF FOLLOWS UNTIL END
// Header signatures for various resources
@ -61,3 +75,5 @@ typedef struct tagICONFILERES ICONFILERES;
HANDLE ReadIcon( wxChar *szFileName, int *W = 0, int *H = 0);
HICON MakeIcon( HANDLE hDIB, HINSTANCE hInst);
#endif

View File

@ -9,6 +9,9 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DIB_H_
#define _WX_DIB_H_
// Save (device dependent) wxBitmap as a DIB
bool wxSaveBitmap(wxChar *filename, wxBitmap *bitmap, wxColourMap *colourmap = NULL);
@ -24,3 +27,5 @@ HANDLE wxReadDIB2(LPTSTR lpFileName);
LPSTR wxFindDIBBits (LPSTR lpbi);
HPALETTE wxMakeDIBPalette(LPBITMAPINFOHEADER lpInfo);
#endif

View File

@ -397,15 +397,15 @@
#endif
#if defined(__WXMSW__) && defined(__WATCOMC__)
#undef wxUSE_ODBC
#define wxUSE_ODBC 0
#undef wxUSE_LIBJPEG
#define wxUSE_LIBJPEG 0
#endif
#if defined(__WXMSW__) && !defined(__WIN32__)
#undef wxUSE_SOCKETS
#define wxUSE_SOCKETS 0
#undef wxUSE_THREADS
#define wxUSE_THREADS 0

View File

@ -293,6 +293,8 @@ bool wxCustomDataObject::SetData(size_t size, const void *buf)
// some common dnd related code
// ============================================================================
#if wxUSE_DRAG_AND_DROP
#include "wx/dnd.h"
// ----------------------------------------------------------------------------
@ -331,3 +333,5 @@ wxDragResult wxFileDropTarget::OnData(wxCoord x, wxCoord y, wxDragResult def)
return OnDropFiles(x, y, dobj->GetFilenames()) ? def : wxDragNone;
}
#endif

View File

@ -20,7 +20,7 @@
WXDIR = $(WXWIN)
WXINC = $(WXDIR)\include
WXLIB=$(WXDIR)\lib\wx1.lib $(WXDIR)\lib\wx2.lib $(WXDIR)\lib\wx3.lib
WXLIB=$(WXDIR)\lib\wx1.lib $(WXDIR)\lib\wx2.lib $(WXDIR)\lib\wx3.lib $(WXDIR)\lib\wx4.lib
# Suffixes
OBJSUFF=obj

View File

@ -342,7 +342,7 @@ bool wxFont::RealizeResource()
case wxFONTENCODING_CP1250:
charset = ANSI_CHARSET;
break;
#if !defined(__WIN16__)
case wxFONTENCODING_ISO8859_2:
case wxFONTENCODING_CP1252:
charset = EASTEUROPE_CHARSET;
@ -377,6 +377,7 @@ bool wxFont::RealizeResource()
case wxFONTENCODING_ISO8859_11:
charset = THAI_CHARSET;
break;
#endif // BC++ 16-bit
case wxFONTENCODING_CP437:
charset = OEM_CHARSET;

View File

@ -176,7 +176,7 @@ COMMONOBJS = \
$(MSWDIR)\wxexpr.obj \
$(MSWDIR)\zipstrm.obj \
$(MSWDIR)\zstream.obj \
${MSWDIR}\resourc2.cpp
${MSWDIR}\resourc2.obj
MSWOBJS = $(MSWDIR)\accel.obj \
$(MSWDIR)\app.obj \
@ -263,9 +263,14 @@ wx: $(CFG) $(DUMMY).obj $(OBJECTS) $(PERIPH_TARGET) $(LIBTARGET)
$(LIBTARGET): $(DUMMY).obj $(OBJECTS) $(PERIPH_LIBS)
erase $(LIBTARGET)
tlib $(LIBTARGET) /P1024 @&&!
+$(OBJECTS:.obj =.obj +) +$(PERIPH_LIBS:.lib =.lib +)
+$(COMMONOBJS:.obj =.obj +)\
+$(GENERICOBJS:.obj =.obj +)\
+$(MSWOBJS:.obj =.obj +)\
+$(PERIPH_LIBS:.lib =.lib +)
!
#+$(OBJECTS:.obj =.obj +)
dummy.obj: dummy.$(SRCSUFF) $(LOCALHEADERS) $(BASEHEADERS) $(WXDIR)\include\wx\wx.h
dummydll.obj: dummydll.$(SRCSUFF) $(LOCALHEADERS) $(BASEHEADERS) $(WXDIR)\include\wx\wx.h
@ -349,7 +354,7 @@ $(MSWDIR)\frame.obj: $(MSWDIR)\frame.$(SRCSUFF)
$(MSWDIR)\gaugemsw.obj: $(MSWDIR)\gaugemsw.$(SRCSUFF)
$(MSWDIR)\gdiobj.obj: $(MSWDIR)\gdi$(SRCSUFF).obj
$(MSWDIR)\gdiobj.obj: $(MSWDIR)\gdiobj.$(SRCSUFF)
$(MSWDIR)\gsocket.obj: $(MSWDIR)\gsocket.c
@ -464,7 +469,7 @@ $(MSWDIR)\dcbase.obj: $(COMMDIR)\dcbase.$(SRCSUFF)
$(MSWDIR)\dlgcmn.obj: $(COMMDIR)\dlgcmn.$(SRCSUFF)
$(MSWDIR)\dobjcmn.obj: $(COMMDIR)\d$(SRCSUFF)cmn.obj
$(MSWDIR)\dobjcmn.obj: $(COMMDIR)\dobjcmn.$(SRCSUFF)
$(MSWDIR)\docmdi.obj: $(COMMDIR)\docmdi.$(SRCSUFF)
@ -530,9 +535,9 @@ $(MSWDIR)\module.obj: $(COMMDIR)\module.$(SRCSUFF)
$(MSWDIR)\mstream.obj: $(COMMDIR)\mstream.$(SRCSUFF)
$(MSWDIR)\object.obj: $(COMMDIR)\$(SRCSUFF)ect.obj
$(MSWDIR)\object.obj: $(COMMDIR)\object.$(SRCSUFF)
$(MSWDIR)\objstrm.obj: $(COMMDIR)\$(SRCSUFF)strm.obj
$(MSWDIR)\objstrm.obj: $(COMMDIR)\objstrm.$(SRCSUFF)
$(MSWDIR)\paper.obj: $(COMMDIR)\paper.$(SRCSUFF)
@ -590,9 +595,7 @@ $(MSWDIR)\zipstrm.obj: $(COMMDIR)\zipstrm.$(SRCSUFF)
$(MSWDIR)\zstream.obj: $(COMMDIR)\zstream.$(SRCSUFF)
${MSWDIR}\resourc2.cpp: ${COMMDIR}\resourc2.cpp
${MSWDIR}\resourc2.obj: ${COMMDIR}\resourc2.$(SRCSUFF)
########################################################
# Generic objects (not always compiled, depending on

View File

@ -165,7 +165,7 @@ COMMONOBJS = \
$(COMMDIR)\zipstrm.obj \
$(COMMDIR)\zstream.obj
MSWOBJS = $(MSWDIR)\accel.obj \
MSWOBJS1 = $(MSWDIR)\accel.obj \
$(MSWDIR)\app.obj \
$(MSWDIR)\bitmap.obj \
$(MSWDIR)\bmpbuttn.obj \
@ -215,8 +215,9 @@ MSWOBJS = $(MSWDIR)\accel.obj \
$(MSWDIR)\nativdlg.obj \
$(MSWDIR)\ownerdrw.obj \
$(MSWDIR)\palette.obj \
$(MSWDIR)\pen.obj \
$(MSWDIR)\penwin.obj \
$(MSWDIR)\pen.obj
MSWOBJS2 = $(MSWDIR)\penwin.obj \
$(MSWDIR)\printdlg.obj \
$(MSWDIR)\printwin.obj \
$(MSWDIR)\radiobox.obj \
@ -245,22 +246,12 @@ MSWOBJS = $(MSWDIR)\accel.obj \
# $(OLEDIR)\xpmhand \
# $(OLEDIR)\pnghand \
OBJECTS = $(COMMONOBJS) $(GENERICOBJS) $(MSWOBJS)
OBJECTS = $(COMMONOBJS) $(GENERICOBJS) $(MSWOBJS1) $(MSWOBJS2)
# Normal, static library
all: $(DUMMYOBJ) $(WXDIR)\lib\wx1.lib $(WXDIR)\lib\wx2.lib $(WXDIR)\lib\wx3.lib
all: $(DUMMYOBJ) $(WXDIR)\lib\wx1.lib $(WXDIR)\lib\wx2.lib $(WXDIR)\lib\wx3.lib $(WXDIR)\lib\wx4.lib
# $(WXDIR)\lib\wx.lib: dummy.obj $(OBJECTS) $(PERIPH_LIBS)
# -erase $(LIBTARGET)
# lib /PAGESIZE:128 @<<
# $(LIBTARGET)
# y
# $(OBJECTS) $(PERIPH_LIBS)
# nul
# ;
# <<
$(WXDIR)\lib\wx1.lib: $(COMMONOBJS) $(PERIPH_LIBS)
-erase $(WXDIR)\lib\wx1.lib
lib /PAGESIZE:128 @<<
@ -281,12 +272,22 @@ nul
;
<<
$(WXDIR)\lib\wx3.lib: $(MSWOBJS)
$(WXDIR)\lib\wx3.lib: $(MSWOBJS1)
-erase $(WXDIR)\lib\wx3.lib
lib /PAGESIZE:128 @<<
$(WXDIR)\lib\wx3.lib
y
$(MSWOBJS)
$(MSWOBJS1)
nul
;
<<
$(WXDIR)\lib\wx4.lib: $(MSWOBJS2)
-erase $(WXDIR)\lib\wx4.lib
lib /PAGESIZE:128 @<<
$(WXDIR)\lib\wx4.lib
y
$(MSWOBJS2)
nul
;
<<
@ -477,9 +478,9 @@ $(MSWDIR)/gdiobj.obj: $*.$(SRCSUFF)
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
$(MSWDIR)/gsocket.obj: $*.$(SRCSUFF)
$(MSWDIR)/gsocket.obj: $*.c
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
$(CPPFLAGS2) /Fo$@ /c $*.c
<<
$(MSWDIR)/helpwin.obj: $*.$(SRCSUFF)

View File

@ -143,7 +143,7 @@ COMMONOBJS = \
MSWOBJS = $(MSWDIR)\accel.obj \
$(MSWDIR)\app.obj \
$(MSWDIR)\automtn.obj \
$(MSWDIR)\ole\automtn.obj \
$(MSWDIR)\bitmap.obj \
$(MSWDIR)\bmpbuttn.obj \
$(MSWDIR)\brush.obj \
@ -172,8 +172,8 @@ MSWOBJS = $(MSWDIR)\accel.obj \
$(MSWDIR)\dibutils.obj \
$(MSWDIR)\dirdlg.obj \
$(MSWDIR)\dragimag.obj \
$(MSWDIR)\dropsrc.obj \
$(MSWDIR)\droptgt.obj \
$(MSWDIR)\ole\dropsrc.obj \
$(MSWDIR)\ole\droptgt.obj \
$(MSWDIR)\filedlg.obj \
$(MSWDIR)\font.obj \
$(MSWDIR)\fontdlg.obj \
@ -194,7 +194,7 @@ MSWOBJS = $(MSWDIR)\accel.obj \
$(MSWDIR)\minifram.obj \
$(MSWDIR)\msgdlg.obj \
$(MSWDIR)\nativdlg.obj \
$(MSWDIR)\oleutils.obj \
$(MSWDIR)\ole\oleutils.obj \
$(MSWDIR)\ownerdrw.obj \
$(MSWDIR)\palette.obj \
$(MSWDIR)\pen.obj \
@ -227,7 +227,7 @@ MSWOBJS = $(MSWDIR)\accel.obj \
$(MSWDIR)\tooltip.obj \
$(MSWDIR)\utils.obj \
$(MSWDIR)\utilsexc.obj \
$(MSWDIR)\uuid.obj \
$(MSWDIR)\ole\uuid.obj \
$(MSWDIR)\wave.obj \
$(MSWDIR)\window.obj \
$(MSWDIR)\xpmhand.obj

View File

@ -261,7 +261,14 @@ void wxMenu::Append(wxMenuItem *pItem)
{
// menu is just a normal string (passed in data parameter)
flags |= MF_STRING;
// Don't know what the correct cast should be, but it doesn't
// compile in BC++/16-bit without this cast.
#if !defined(__WIN32__)
pData = (char*) (const char*) label;
#else
pData = label;
#endif
}
if ( !::AppendMenu(GetHmenu(), flags, id, pData) )

View File

@ -203,7 +203,13 @@ void wxMenuItem::SetName(const wxString& strName)
#endif //owner drawn
{
flagsOld |= MF_STRING;
// Don't know what the correct cast should be, but it doesn't
// compile in BC++/16-bit without this cast.
#if !defined(__WIN32__)
data = (char*) (const char*) strName;
#else
data = strName;
#endif
}
if ( ::ModifyMenu(hMenu, id,

View File

@ -482,7 +482,13 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn)
bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
{
if (file != wxT(""))
// Don't know what the correct cast should be, but it doesn't
// compile in BC++/16-bit without this cast.
#if !defined(__WIN32__)
return (WritePrivateProfileString((const char*) section, (const char*) entry, (const char*) value, (const char*) file) != 0);
#else
return (WritePrivateProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)value, (LPCTSTR)WXSTRINGCAST file) != 0);
#endif
else
return (WriteProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)WXSTRINGCAST value) != 0);
}