From: Julian Smart Date: Mon, 7 Sep 1998 07:58:29 +0000 (+0000) Subject: Made wxSocket compile using makefiles; #ifdefed out <<, >> operators in stream.cpp X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/fcc6dddd1f1da49f94767ff148eaa3f1d3ca9367?hp=d3904ceb9a02934a8d1ab7034f368b103a699d99 Made wxSocket compile using makefiles; #ifdefed out <<, >> operators in stream.cpp for USE_SERIALL; included io.h for VC++ in socket.cpp git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp index f5059c9579..4ed0d3555c 100644 --- a/distrib/msw/generic.rsp +++ b/distrib/msw/generic.rsp @@ -291,6 +291,15 @@ samples/dynamic/*.bmp samples/dynamic/*.rc samples/dynamic/*.wav +samples/wxsocket/*.cpp +samples/wxsocket/*.h +samples/wxsocket/*.def +samples/wxsocket/makefile* +samples/wxsocket/*.xbm +samples/wxsocket/*.xpm +samples/wxsocket/*.ico +samples/wxsocket/*.rc + samples/bombs/*.cpp samples/bombs/*.h samples/bombs/*.def diff --git a/include/wx/stream.h b/include/wx/stream.h index 428dbaab1f..e23ef48a58 100644 --- a/include/wx/stream.h +++ b/include/wx/stream.h @@ -99,7 +99,9 @@ class WXDLLEXPORT wxInputStream { wxInputStream& operator>>(int& i); wxInputStream& operator>>(long& i); wxInputStream& operator>>(float& i); +#if USE_SERIAL wxInputStream& operator>>(wxObject *& obj); +#endif wxInputStream& operator>>(unsigned char& c) { return operator>>((char&)c); } wxInputStream& operator>>(unsigned short& i) { return operator>>((short&)i); } @@ -150,7 +152,9 @@ class WXDLLEXPORT wxOutputStream { wxOutputStream& operator<<(int i); wxOutputStream& operator<<(long i); wxOutputStream& operator<<(double f); +#if USE_SERIAL wxOutputStream& operator<<(wxObject& obj); +#endif wxOutputStream& operator<<(float f) { return operator<<((double)f); } wxOutputStream& operator<<(unsigned char c) { return operator<<((char)c); } diff --git a/samples/wxsocket/client.rc b/samples/wxsocket/client.rc index fbba8add6c..f1579f657d 100644 --- a/samples/wxsocket/client.rc +++ b/samples/wxsocket/client.rc @@ -1,3 +1,3 @@ mondrian ICON mondrian.ico conn_icn ICON connect.ico -#include "wx.rc" +#include "wx/msw/wx.rc" diff --git a/samples/wxsocket/makefile.nt b/samples/wxsocket/makefile.nt index 06defd3923..4bd3188caa 100644 --- a/samples/wxsocket/makefile.nt +++ b/samples/wxsocket/makefile.nt @@ -7,21 +7,24 @@ # "%W% %G%" # # Makefile : Builds wxSock library for Windows NT / Win95 -!include <..\..\..\src\ntwxwin.mak> + +EXTRALIBS=wsock32.lib + +!include <..\..\src\ntwxwin.mak> # Change WXDIR or WXWIN to wherever wxWindows is found #WXWIN = $(WX) -WXDIR = $(WXWIN) -WXINC = $(WXDIR)\include\msw - -WXSOCKDIR = $(WXDIR)\contrib\wxsock -WXSOCKINC = $(WXSOCKDIR) -WXSOCKLIB = $(WXSOCKDIR)\lib\wxsock.lib $(WXSOCKDIR)\lib\zlib.lib -INC=-I$(WXBASEINC) -I$(WXINC) -I$(WXSOCKINC) +#WXDIR = $(WXWIN) +#WXINC = $(WXDIR)\include\msw -WXLIB = $(WXDIR)\lib\wx.lib +#WXSOCKDIR = $(WXDIR)\contrib\wxsock +#WXSOCKINC = $(WXSOCKDIR) +#WXSOCKLIB = $(WXSOCKDIR)\lib\wxsock.lib $(WXSOCKDIR)\lib\zlib.lib -LIBS=$(WXSOCKLIB) wsock32.lib $(LIBS) +#INC=-I$(WXBASEINC) -I$(WXINC) # -I$(WXSOCKINC) +#WXLIB = $(WXDIR)\lib\wx.lib +#LIBS=$(WXSOCKLIB) wsock32.lib $(LIBS) +#LIBS=$(WXSOCKLIB) wsock32.lib $(LIBS) #LIBS=$(WXLIB) $(WXSTRINGLIB) oldnames libw llibcew llibce commdlg shell all: client.exe server.exe @@ -31,19 +34,19 @@ wx: nmake -f makefile.nt cd $(ITSYDIR) -client.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) $(WXSTRINGLIB) client.obj\ +client.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) client.obj\ client.res $(link) -out:client.exe $(LINKFLAGS) $(DUMMYOBJ) client.obj \ client.res $(LIBS) -server.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) $(WXSTRINGLIB) server.obj +server.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) server.obj $(link) -out:server.exe $(LINKFLAGS) $(DUMMYOBJ) server.obj $(LIBS) client.obj: client.$(SRCSUFF) $(cc) $(CPPFLAGS2) /c /Tp $*.$(SRCSUFF) -client.res: client.rc $(WXDIR)\include\msw\wx.rc - $(rc) -r /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa -fo$@ client.rc +client.res: client.rc $(WXDIR)\include\wx\msw\wx.rc + $(rc) -r /i$(WXDIR)\include -fo$@ client.rc server.obj: server.$(SRCSUFF) diff --git a/samples/wxsocket/server.rc b/samples/wxsocket/server.rc index 44854d6660..b289ec6ad9 100644 --- a/samples/wxsocket/server.rc +++ b/samples/wxsocket/server.rc @@ -1,4 +1,4 @@ mondrian ICON "mondrian.ico" conn_icn ICON "connect.ico" -#include "wx.rc" +#include "wx/msw/wx.rc" diff --git a/src/common/http.cpp b/src/common/http.cpp index 4f90e220e9..dd848b7a05 100644 --- a/src/common/http.cpp +++ b/src/common/http.cpp @@ -13,6 +13,16 @@ #pragma implementation "http.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#endif + #include #include #include "wx/string.h" @@ -22,10 +32,6 @@ #include "wx/protocol/http.h" #include "wx/sckstrm.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxHTTP, wxProtocol) IMPLEMENT_PROTOCOL(wxHTTP, "http", "80", TRUE) diff --git a/src/common/objstrm.cpp b/src/common/objstrm.cpp index 2bb34f1c59..b7beef3b71 100644 --- a/src/common/objstrm.cpp +++ b/src/common/objstrm.cpp @@ -12,6 +12,20 @@ #pragma implementation "objstrm.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/defs.h" +#include "wx/setup.h" +#endif + +#if USE_SERIAL + #include "wx/object.h" #include "wx/objstrm.h" #include "wx/datstrm.h" @@ -310,3 +324,6 @@ wxObject *wxObjectInputStream::LoadObject() return object; } + +#endif + diff --git a/src/common/protocol.cpp b/src/common/protocol.cpp index 21df7e8997..b9cbcb8634 100644 --- a/src/common/protocol.cpp +++ b/src/common/protocol.cpp @@ -13,19 +13,20 @@ #pragma implementation "protocol.h" #endif -#ifdef WXPREC -#include -#else +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP #include #endif #include "wx/protocol/protocol.h" #include "wx/url.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - ///////////////////////////////////////////////////////////////// // wxProtoInfo ///////////////////////////////////////////////////////////////// diff --git a/src/common/sckaddr.cpp b/src/common/sckaddr.cpp index 55a9521b6e..90117044f7 100644 --- a/src/common/sckaddr.cpp +++ b/src/common/sckaddr.cpp @@ -13,6 +13,16 @@ #pragma implementation "sckaddr.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#endif + #include #include #include @@ -42,10 +52,6 @@ #include "wx/sckaddr.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - #define CHECK_ADDRTYPE(var, type) #if !USE_SHARED_LIBRARY diff --git a/src/common/sckfile.cpp b/src/common/sckfile.cpp index b1e60ae4eb..41686d09d8 100644 --- a/src/common/sckfile.cpp +++ b/src/common/sckfile.cpp @@ -11,15 +11,22 @@ #ifdef __GNUG__ #pragma implementation "sckfile.h" #endif -#include -#include -#include -#include "wx/protocol/file.h" + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif +#ifndef WX_PRECOMP +#endif + +#include +#include +#include +#include "wx/protocol/file.h" + #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol) IMPLEMENT_PROTOCOL(wxFileProto, "file", NULL, FALSE) diff --git a/src/common/sckipc.cpp b/src/common/sckipc.cpp index 55fcb3104b..4532de83a8 100644 --- a/src/common/sckipc.cpp +++ b/src/common/sckipc.cpp @@ -13,15 +13,19 @@ #pragma implementation "sckipc.h" #endif -#include -#include +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" -#ifdef WXPREC -#include -#else -#include +#ifdef __BORLANDC__ +#pragma hdrstop #endif +#ifndef WX_PRECOMP +#endif + +#include +#include + #include "wx/socket.h" #include "wx/sckipc.h" diff --git a/src/common/sckstrm.cpp b/src/common/sckstrm.cpp index c0846c46aa..9224fe1765 100644 --- a/src/common/sckstrm.cpp +++ b/src/common/sckstrm.cpp @@ -12,6 +12,16 @@ #pragma implementation "sckstrm.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#endif + #include "wx/stream.h" #include "wx/socket.h" #include "wx/sckstrm.h" diff --git a/src/common/socket.cpp b/src/common/socket.cpp index f880c2d6e5..aa8a18a6b5 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -15,6 +15,13 @@ #pragma implementation "socket.cpp" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + ///////////////////////////////////////////////////////////////////////////// // wxWindows headers ///////////////////////////////////////////////////////////////////////////// @@ -52,6 +59,10 @@ #include #include +#ifdef _MSC_VER +#include +#endif + #if defined(__WXMOTIF__) || defined(__WXXT__) #include @@ -75,10 +86,6 @@ #include "wx/sckaddr.h" #include "wx/socket.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - ///////////////////////////////////////////////////////////////////////////// // Some patch ///// BEGIN ///////////////////////////////////////////////////////////////////////////// diff --git a/src/common/stream.cpp b/src/common/stream.cpp index d546ab473f..1b0e66c82e 100644 --- a/src/common/stream.cpp +++ b/src/common/stream.cpp @@ -363,12 +363,14 @@ wxInputStream& wxInputStream::operator>>(float& f) return *this; } +#if USE_SERIAL wxInputStream& wxInputStream::operator>>(wxObject *& obj) { wxObjectInputStream obj_s(*this); obj = obj_s.LoadObject(); return *this; } +#endif off_t wxInputStream::SeekI(off_t pos, wxSeekMode mode) { @@ -542,12 +544,14 @@ wxOutputStream& wxOutputStream::operator<<(double f) return Write(strfloat, strfloat.Len()); } +#if USE_SERIAL wxOutputStream& wxOutputStream::operator<<(wxObject& obj) { wxObjectOutputStream obj_s(*this); obj_s.SaveObject(obj); return *this; } +#endif // ---------------------------------------------------------------------------- // wxStream diff --git a/src/common/tokenzr.cpp b/src/common/tokenzr.cpp index eb99237711..9fb4a54380 100644 --- a/src/common/tokenzr.cpp +++ b/src/common/tokenzr.cpp @@ -13,6 +13,16 @@ #pragma implementation "tokenzr.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#endif + #include "wx/object.h" #include "wx/string.h" #include "wx/tokenzr.h" diff --git a/src/common/url.cpp b/src/common/url.cpp index 39ad2b6d93..180511941c 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -12,6 +12,17 @@ #ifdef __GNUG__ #pragma implementation "url.h" #endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#endif + #include #include @@ -23,10 +34,6 @@ // wxSocket header #include "wx/url.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - #if !USE_SHARED_LIBRARY IMPLEMENT_CLASS(wxProtoInfo, wxObject) IMPLEMENT_CLASS(wxURL, wxObject) @@ -133,7 +140,7 @@ bool wxURL::PrepHost(wxString& url) { int pos, pos2; - if ((url[0UL] != '/') || (url[1UL] != '/')) + if ((url.GetChar(0) != '/') || (url.GetChar(1) != '/')) return FALSE; url = url(2, url.Length()); diff --git a/src/msw/makefile.nt b/src/msw/makefile.nt index 90c5eabfb6..cb546731b9 100644 --- a/src/msw/makefile.nt +++ b/src/msw/makefile.nt @@ -108,7 +108,16 @@ COMMONOBJS = \ $(COMMDIR)\hash.obj \ $(COMMDIR)\list.obj \ $(COMMDIR)\string.obj \ + $(COMMDIR)\socket.obj \ + $(COMMDIR)\sckaddr.obj \ + $(COMMDIR)\sckfile.obj \ + $(COMMDIR)\sckipc.obj \ + $(COMMDIR)\sckstrm.obj \ + $(COMMDIR)\url.obj \ + $(COMMDIR)\http.obj \ + $(COMMDIR)\protocol.obj \ $(COMMDIR)\time.obj \ + $(COMMDIR)\tokenzr.obj \ $(COMMDIR)\wxexpr.obj \ $(COMMDIR)\y_tab.obj \ $(COMMDIR)\extended.obj \ @@ -118,6 +127,7 @@ COMMONOBJS = \ $(COMMDIR)\zstream.obj \ $(COMMDIR)\stream.obj \ $(COMMDIR)\datstrm.obj \ + $(COMMDIR)\objstrm.obj \ $(COMMDIR)\wincmn.obj MSWOBJS = \ @@ -914,6 +924,51 @@ $(COMMDIR)/string.obj: $*.$(SRCSUFF) $(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ << +$(COMMDIR)/socket.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ +<< + +$(COMMDIR)/sckaddr.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ +<< + +$(COMMDIR)/sckfile.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ +<< + +$(COMMDIR)/sckipc.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ +<< + +$(COMMDIR)/sckstrm.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ +<< + +$(COMMDIR)/url.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ +<< + +$(COMMDIR)/http.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ +<< + +$(COMMDIR)/protocol.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ +<< + +$(COMMDIR)/tokenzr.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ +<< + $(COMMDIR)/matrix.obj: $*.$(SRCSUFF) cl @<< $(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ @@ -959,9 +1014,14 @@ $(COMMDIR)\datstrm.obj: $*.$(SRCSUFF) $(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ << +$(COMMDIR)\objstrm.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ +<< + $(COMMDIR)/extended.obj: $*.c cl @<< -$(CPPFLAGS2) /c /Tp $*.c /Fo$@ +$(CPPFLAGS2) /c $*.c /Fo$@ << $(COMMDIR)/process.obj: $*.$(SRCSUFF)