diff options
author | Marc Laukien <marc@zeroc.com> | 2001-09-15 08:13:54 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-09-15 08:13:54 +0000 |
commit | 4cada81a1bf05eb8ea49b09b53fc09deb843bc46 (patch) | |
tree | a2a4f20406a6c841cbc2bc3629c19842f4bc6702 /cpp | |
parent | missing .depend (diff) | |
download | ice-4cada81a1bf05eb8ea49b09b53fc09deb843bc46.tar.bz2 ice-4cada81a1bf05eb8ea49b09b53fc09deb843bc46.tar.xz ice-4cada81a1bf05eb8ea49b09b53fc09deb843bc46.zip |
started with phonebook demo
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/demo/Freeze/Makefile | 22 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/.depend | 4 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/Client.cpp | 60 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/Makefile | 48 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/PhoneBook.ice | 44 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/PhoneBookI.cpp | 177 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/PhoneBookI.h | 66 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/Server.cpp | 59 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/config | 2 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/phonebookC.dsp | 155 | ||||
-rw-r--r-- | cpp/demo/Freeze/phonebook/phonebookS.dsp | 163 | ||||
-rw-r--r-- | cpp/demo/Ice/Makefile | 5 | ||||
-rw-r--r-- | cpp/demo/Makefile | 3 | ||||
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 2 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 47 | ||||
-rw-r--r-- | cpp/src/slice2cpp/GenUtil.cpp | 10 |
16 files changed, 828 insertions, 39 deletions
diff --git a/cpp/demo/Freeze/Makefile b/cpp/demo/Freeze/Makefile new file mode 100644 index 00000000000..fbb867b7b89 --- /dev/null +++ b/cpp/demo/Freeze/Makefile @@ -0,0 +1,22 @@ +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +top_srcdir = ../.. + +include $(top_srcdir)/config/Make.rules + +SUBDIRS = phonebook + +$(EVERYTHING):: + @for subdir in $(SUBDIRS); \ + do \ + echo "making $@ in $$subdir"; \ + ( cd $$subdir && $(MAKE) $@ ) || exit 1; \ + done diff --git a/cpp/demo/Freeze/phonebook/.depend b/cpp/demo/Freeze/phonebook/.depend new file mode 100644 index 00000000000..da5a1821954 --- /dev/null +++ b/cpp/demo/Freeze/phonebook/.depend @@ -0,0 +1,4 @@ +PhoneBook.o: PhoneBook.cpp PhoneBook.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/IceUtil/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Shared.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/LocalObject.h ../../../include/Ice/LocalException.h +Client.o: Client.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/IceUtil/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h PhoneBook.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +PhoneBookI.o: PhoneBookI.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/IceUtil/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h PhoneBookI.h ../../../include/IceUtil/IceUtil.h ../../../include/IceUtil/Functional.h ../../../include/IceUtil/Handle.h PhoneBook.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +Server.o: Server.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/IceUtil/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h PhoneBookI.h ../../../include/IceUtil/IceUtil.h ../../../include/IceUtil/Functional.h ../../../include/IceUtil/Handle.h PhoneBook.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h diff --git a/cpp/demo/Freeze/phonebook/Client.cpp b/cpp/demo/Freeze/phonebook/Client.cpp new file mode 100644 index 00000000000..4c54ca32eb2 --- /dev/null +++ b/cpp/demo/Freeze/phonebook/Client.cpp @@ -0,0 +1,60 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <PhoneBook.h> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + Ice::PropertiesPtr properties = communicator->getProperties(); + std::string ref = properties->getProperty("PhoneBook.PhoneBook"); + Ice::ObjectPrx base = communicator->stringToProxy(ref); + + PhoneBookPrx phoneBook = PhoneBookPrx::checkedCast(base); + + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + Ice::PropertiesPtr properties = Ice::createPropertiesFromFile(argc, argv, "config"); + communicator = Ice::initializeWithProperties(properties); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/demo/Freeze/phonebook/Makefile b/cpp/demo/Freeze/phonebook/Makefile new file mode 100644 index 00000000000..069124ce66e --- /dev/null +++ b/cpp/demo/Freeze/phonebook/Makefile @@ -0,0 +1,48 @@ +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +top_srcdir = ../../.. + +CLIENT = client +SERVER = server + +TARGETS = $(CLIENT) $(SERVER) + +OBJS = PhoneBook.o + +COBJS = Client.o + +SOBJS = PhoneBookI.o \ + Server.o + +SRCS = $(OBJS:.o=.cpp) \ + $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := -I. $(CPPFLAGS) + +$(CLIENT): $(OBJS) $(COBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) + +$(SERVER): $(OBJS) $(SOBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS) + +PhoneBook.h PhoneBook.cpp: PhoneBook.ice $(SLICE) + rm -f PhoneBook.h PhoneBook.cpp + $(SLICE) PhoneBook.ice + +clean:: + rm -f PhoneBook.h PhoneBook.cpp + +include .depend diff --git a/cpp/demo/Freeze/phonebook/PhoneBook.ice b/cpp/demo/Freeze/phonebook/PhoneBook.ice new file mode 100644 index 00000000000..3650f3bf03e --- /dev/null +++ b/cpp/demo/Freeze/phonebook/PhoneBook.ice @@ -0,0 +1,44 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef PHONE_BOOK_ICE +#define PHONE_BOOK_ICE + +class Entry +{ + wstring getName(); + void setName(wstring name); + + wstring getAddress(); + void setAddress(wstring address); + + string getNumber(); + void setNumber(string number); + + void destroy(); + + wstring _name; + wstring _address; + string _number; +}; + +sequence<Entry*> Entries; +sequence<string> EntryIdentities; +dictionary<wstring, EntryIdentities> EntryIdentitiesDict; + +class PhoneBook +{ + Entry* createEntry(); + Entries findEntries(wstring name); + + EntryIdentitiesDict _entryIdentitiesDict; +}; + +#endif diff --git a/cpp/demo/Freeze/phonebook/PhoneBookI.cpp b/cpp/demo/Freeze/phonebook/PhoneBookI.cpp new file mode 100644 index 00000000000..40e51a1cb49 --- /dev/null +++ b/cpp/demo/Freeze/phonebook/PhoneBookI.cpp @@ -0,0 +1,177 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <PhoneBookI.h> +#include <sstream> + +using namespace std; +using namespace Ice; + +EntryI::EntryI(const string& identity, const ObjectAdapterPtr& adapter, const PhoneBookIPtr& phoneBook) : + _identity(identity), + _adapter(adapter), + _phoneBook(phoneBook) +{ + __setNoDelete(true); + + try + { + EntryPrx self = EntryPrx::uncheckedCast(_adapter->add(this, _identity)); + } + catch(...) + { + __setNoDelete(false); + throw; + } + + __setNoDelete(false); +} + +EntryI::~EntryI() +{ +} + +wstring +EntryI::getName() +{ + JTCSyncT<JTCMutex> sync(*this); + return _name; +} + +void +EntryI::setName(const wstring& name) +{ + JTCSyncT<JTCMutex> sync(*this); + _phoneBook->move(_identity, _name, name); + _name = name; +} + +wstring +EntryI::getAddress() +{ + JTCSyncT<JTCMutex> sync(*this); + return _address; +} + +void +EntryI::setAddress(const wstring& address) +{ + JTCSyncT<JTCMutex> sync(*this); + _address = address; +} + +string +EntryI::getNumber() +{ + JTCSyncT<JTCMutex> sync(*this); + return _number; +} + +void +EntryI::setNumber(string number) +{ + JTCSyncT<JTCMutex> sync(*this); + _number = number; +} + +void +EntryI::destroy() +{ + JTCSyncT<JTCMutex> sync(*this); + _adapter->remove(_identity); + _phoneBook->remove(_identity, _name); +} + +PhoneBookI::PhoneBookI(const ObjectAdapterPtr& adapter) : + _adapter(adapter), + _nextEntryIdentity(0) +{ +} + +PhoneBookI::~PhoneBookI() +{ +} + +EntryPrx +PhoneBookI::createEntry() +{ + JTCSyncT<JTCRecursiveMutex> sync(*this); + + ostringstream s; + s << _nextEntryIdentity++; + string identity = s.str(); + + add(identity, L""); + + return EntryPrx::uncheckedCast(_adapter->createProxy(identity)); +} + +class IdentityToEntry +{ +public: + + IdentityToEntry(const ObjectAdapterPtr& adapter) : + _adapter(adapter) + { + } + + EntryPrx operator()(const string& identity) + { + return EntryPrx::uncheckedCast(_adapter->createProxy(identity)); + } + +private: + + ObjectAdapterPtr _adapter; +}; + +Entries +PhoneBookI::findEntries(const wstring& name) +{ + JTCSyncT<JTCRecursiveMutex> sync(*this); + + EntryIdentitiesDict::iterator p = _entryIdentitiesDict.find(name); + if (p != _entryIdentitiesDict.end()) + { + Entries entries; + transform(p->second.begin(), p->second.end(), back_inserter(entries), IdentityToEntry(_adapter)); + return entries; + } + else + { + return Entries(); + } +} + +void +PhoneBookI::add(const string& identity, const wstring& name) +{ + JTCSyncT<JTCRecursiveMutex> sync(*this); + _entryIdentitiesDict[name].push_back(identity); +} + +void +PhoneBookI::remove(const string& identity, const wstring& name) +{ + JTCSyncT<JTCRecursiveMutex> sync(*this); + EntryIdentitiesDict::iterator p = _entryIdentitiesDict.find(name); + assert(p != _entryIdentitiesDict.end()); + p->second.erase(remove_if(p->second.begin(), p->second.end(), bind2nd(equal_to<string>(), identity)), + p->second.end()); +} + +void +PhoneBookI::move(const string& identity, const wstring& oldName, const wstring& newName) +{ + JTCSyncT<JTCRecursiveMutex> sync(*this); + remove(identity, oldName); + add(identity, newName); +} diff --git a/cpp/demo/Freeze/phonebook/PhoneBookI.h b/cpp/demo/Freeze/phonebook/PhoneBookI.h new file mode 100644 index 00000000000..f3379984468 --- /dev/null +++ b/cpp/demo/Freeze/phonebook/PhoneBookI.h @@ -0,0 +1,66 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef PHONE_BOOK_I_H +#define PHONE_BOOK_I_H + +#include <Ice/Ice.h> +#include <IceUtil/IceUtil.h> +#include <PhoneBook.h> + +class PhoneBookI; +typedef IceUtil::Handle<PhoneBookI> PhoneBookIPtr; + +class EntryI : public Entry, public JTCMutex +{ +public: + + EntryI(const std::string& identity, const Ice::ObjectAdapterPtr&, const PhoneBookIPtr&); + ~EntryI(); + + virtual std::wstring getName(); + virtual void setName(const std::wstring&); + + virtual std::wstring getAddress(); + virtual void setAddress(const std::wstring&); + + virtual std::string getNumber(); + virtual void setNumber(std::string); + + virtual void destroy(); + +private: + + std::string _identity; + Ice::ObjectAdapterPtr _adapter; + PhoneBookIPtr _phoneBook; +}; + +class PhoneBookI : public PhoneBook, public JTCRecursiveMutex +{ +public: + + PhoneBookI(const Ice::ObjectAdapterPtr&); + ~PhoneBookI(); + + virtual EntryPrx createEntry(); + virtual Entries findEntries(const std::wstring&); + + void add(const std::string&, const std::wstring&); + void remove(const std::string&, const std::wstring&); + void move(const std::string&, const std::wstring&, const std::wstring&); + +private: + + Ice::ObjectAdapterPtr _adapter; + Ice::Long _nextEntryIdentity; +}; + +#endif diff --git a/cpp/demo/Freeze/phonebook/Server.cpp b/cpp/demo/Freeze/phonebook/Server.cpp new file mode 100644 index 00000000000..cff1e1a6b00 --- /dev/null +++ b/cpp/demo/Freeze/phonebook/Server.cpp @@ -0,0 +1,59 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <PhoneBookI.h> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("PhoneBookAdapter"); + Ice::ObjectPtr object = new PhoneBookI(adapter); + adapter->add(object, "phonebook"); + adapter->activate(); + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + Ice::PropertiesPtr properties = Ice::createPropertiesFromFile(argc, argv, "config"); + communicator = Ice::initializeWithProperties(properties); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/demo/Freeze/phonebook/config b/cpp/demo/Freeze/phonebook/config new file mode 100644 index 00000000000..a21b5308810 --- /dev/null +++ b/cpp/demo/Freeze/phonebook/config @@ -0,0 +1,2 @@ +PhoneBook.Ping=ping:tcp -p 10000 +Ice.Adapter.PhoneBookAdapter.Endpoints=tcp -p 10000 diff --git a/cpp/demo/Freeze/phonebook/phonebookC.dsp b/cpp/demo/Freeze/phonebook/phonebookC.dsp new file mode 100644 index 00000000000..eebcac5662c --- /dev/null +++ b/cpp/demo/Freeze/phonebook/phonebookC.dsp @@ -0,0 +1,155 @@ +# Microsoft Developer Studio Project File - Name="phonebookC" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=phonebookC - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "phonebookC.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "phonebookC.mak" CFG="phonebookC - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "phonebookC - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "phonebookC - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "phonebookC - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /Ze /W3 /GR /GX /O2 /I "." /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c
+# SUBTRACT CPP /Fr
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ws2_32.lib jtc.lib /nologo /subsystem:console /machine:I386 /out:"client.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "phonebookC - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /Ze /W3 /Gm /GR /GX /Zi /Od /I "." /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /GZ /c
+# SUBTRACT CPP /Fr
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ws2_32.lib jtcd.lib /nologo /subsystem:console /debug /machine:I386 /out:"client.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "phonebookC - Win32 Release"
+# Name "phonebookC - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\PhoneBook.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\PhoneBook.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\PhoneBook.ice
+
+!IF "$(CFG)" == "phonebookC - Win32 Release"
+
+USERDEP__HELLO="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\PhoneBook.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe PhoneBook.ice \
+
+
+"PhoneBook.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"PhoneBook.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "phonebookC - Win32 Debug"
+
+USERDEP__HELLO="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\PhoneBook.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe PhoneBook.ice \
+
+
+"PhoneBook.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"PhoneBook.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/demo/Freeze/phonebook/phonebookS.dsp b/cpp/demo/Freeze/phonebook/phonebookS.dsp new file mode 100644 index 00000000000..4caaabec614 --- /dev/null +++ b/cpp/demo/Freeze/phonebook/phonebookS.dsp @@ -0,0 +1,163 @@ +# Microsoft Developer Studio Project File - Name="phonebookS" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=phonebookS - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "phonebookS.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "phonebookS.mak" CFG="phonebookS - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "phonebookS - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "phonebookS - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "phonebookS - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /Ze /W3 /GR /GX /O2 /I "." /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c
+# SUBTRACT CPP /Fr
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ws2_32.lib jtc.lib /nologo /subsystem:console /machine:I386 /out:"server.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "phonebookS - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /Ze /W3 /Gm /GR /GX /Zi /Od /I "." /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /GZ /c
+# SUBTRACT CPP /Fr
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ws2_32.lib jtcd.lib /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "phonebookS - Win32 Release"
+# Name "phonebookS - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\PhoneBook.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\PhoneBookI.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Server.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\PhoneBook.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\PhoneBookI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\PhoneBook.ice
+
+!IF "$(CFG)" == "phonebookS - Win32 Release"
+
+USERDEP__HELLO="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\PhoneBook.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe PhoneBook.ice \
+
+
+"PhoneBook.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"PhoneBook.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "phonebookS - Win32 Debug"
+
+USERDEP__HELLO="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\PhoneBook.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe PhoneBook.ice \
+
+
+"PhoneBook.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"PhoneBook.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/demo/Ice/Makefile b/cpp/demo/Ice/Makefile index 3e00ee4df3a..8f92a54afc2 100644 --- a/cpp/demo/Ice/Makefile +++ b/cpp/demo/Ice/Makefile @@ -12,7 +12,10 @@ top_srcdir = ../.. include $(top_srcdir)/config/Make.rules -SUBDIRS = hello value latency pickle +SUBDIRS = hello \ + value \ + latency \ + pickle $(EVERYTHING):: @for subdir in $(SUBDIRS); \ diff --git a/cpp/demo/Makefile b/cpp/demo/Makefile index 0027b52197d..505eb0ccbb5 100644 --- a/cpp/demo/Makefile +++ b/cpp/demo/Makefile @@ -12,7 +12,8 @@ top_srcdir = .. include $(top_srcdir)/config/Make.rules -SUBDIRS = Ice +SUBDIRS = Ice \ + Freeze $(EVERYTHING):: @for subdir in $(SUBDIRS); \ diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 5c294a40684..5e187eca9be 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -100,7 +100,7 @@ Slice::Contained::scope() { string::size_type idx = _scoped.rfind("::"); assert(idx != string::npos); - return string(_scoped, 0, idx); + return string(_scoped, 0, idx + 2); } string diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 9f1643335ac..a27b87f263f 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -350,18 +350,14 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) { string scoped = p->scoped(); string scope = p->scope(); - if (scope.size()) - { - scope.erase(0, 2); - } H << sp; H << nl << "class __U__" << name << " { };"; H << nl << _dllExport << "void __write(::IceInternal::Stream*, const " << name << "&, __U__" << name << ");"; H << nl << _dllExport << "void __read(::IceInternal::Stream*, " << name << "&, __U__" << name << ");"; C << sp; - C << nl << "void" << nl << scope << "::__write(::IceInternal::Stream* __os, const " << scoped << "& v, ::" - << scope << "::__U__" << name << ')'; + C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::Stream* __os, const " << scoped + << "& v, " << scope << "__U__" << name << ')'; C << sb; C << nl << "__os->write(::Ice::Int(v.size()));"; C << nl << scoped << "::const_iterator p;"; @@ -371,8 +367,8 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << eb; C << eb; C << sp; - C << nl << "void" << nl << scope << "::__read(::IceInternal::Stream* __is, " << scoped << "& v, ::" << scope - << "::__U__" << name << ')'; + C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::Stream* __is, " << scoped + << "& v, " << scope << "__U__" << name << ')'; C << sb; C << nl << "::Ice::Int sz;"; C << nl << "__is->read(sz);"; @@ -414,18 +410,14 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) string scoped = p->scoped(); string scope = p->scope(); - if (scope.size()) - { - scope.erase(0, 2); - } H << sp; H << nl << "class __U__" << name << " { };"; H << nl << _dllExport << "void __write(::IceInternal::Stream*, const " << name << "&, __U__" << name << ");"; H << nl << _dllExport << "void __read(::IceInternal::Stream*, " << name << "&, __U__" << name << ");"; C << sp; - C << nl << "void" << nl << scope << "::__write(::IceInternal::Stream* __os, const " << scoped << "& v, ::" - << scope << "::__U__" << name << ')'; + C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::Stream* __os, const " << scoped + << "& v, " << scope << "__U__" << name << ')'; C << sb; C << nl << "__os->write(::Ice::Int(v.size()));"; C << nl << scoped << "::const_iterator p;"; @@ -436,8 +428,8 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << eb; C << eb; C << sp; - C << nl << "void" << nl << scope << "::__read(::IceInternal::Stream* __is, " << scoped << "& v, ::" << scope - << "::__U__" << name << ')'; + C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::Stream* __is, " << scoped + << "& v, " << scope << "__U__" << name << ')'; C << sb; C << nl << "::Ice::Int sz;"; C << nl << "__is->read(sz);"; @@ -472,10 +464,6 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) string scoped = p->scoped(); string scope = p->scope(); - if (scope.size()) - { - scope.erase(0, 2); - } int sz = enumerators.size(); @@ -483,7 +471,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) H << nl << _dllExport << "void __write(::IceInternal::Stream*, " << name << ");"; H << nl << _dllExport << "void __read(::IceInternal::Stream*, " << name << "&);"; C << sp; - C << nl << "void" << nl << scope << "::__write(::IceInternal::Stream* __os, " << scoped << " v)"; + C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::Stream* __os, " << scoped << " v)"; C << sb; if (sz <= 0x7f) { @@ -503,7 +491,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) } C << eb; C << sp; - C << nl << "void" << nl << scope << "::__read(::IceInternal::Stream* __is, " << scoped << "& v)"; + C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::Stream* __is, " << scoped << "& v)"; C << sb; if (sz <= 0x7f) { @@ -788,7 +776,8 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << nl << "while (true)"; C << sb; C << nl << "::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase = __getDelegate();"; - C << nl << "::IceDelegate" << scope << "* __del = dynamic_cast< ::IceDelegate" << scope << "*>(__delBase.get());"; + C << nl << "::IceDelegate" << scope.substr(0, scope.size() - 2) << "* __del = dynamic_cast< ::IceDelegate" + << scope.substr(0, scope.size() - 2) << "*>(__delBase.get());"; C << nl << "try"; C << sb; C << nl; @@ -1070,7 +1059,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) { string name = p->name(); string scoped = p->scoped(); - string scope = p->scope(); +// string scope = p->scope(); TypePtr ret = p->returnType(); string retS = returnTypeToString(ret); @@ -1734,7 +1723,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) { H << nl << exp2 << "::IceInternal::DispatchStatus ___" << name << "(::IceInternal::Incoming&);"; C << sp; - C << nl << "::IceInternal::DispatchStatus" << nl << scope.substr(2) << "::___" << name + C << nl << "::IceInternal::DispatchStatus" << nl << scope.substr(2) << "___" << name << "(::IceInternal::Incoming& __in)"; C << sb; if (!inParams.empty()) @@ -1938,18 +1927,14 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p) string scoped = p->scoped(); string scope = p->scope(); - if (scope.size()) - { - scope.erase(0, 2); - } C << sp; - C << nl << "void" << nl << scope << "::__write(::IceInternal::Stream* __os, const " << scoped << "Prx& v)"; + C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::Stream* __os, const " << scoped << "Prx& v)"; C << sb; C << nl << "__os->write(::Ice::ObjectPrx(v));"; C << eb; C << sp; - C << nl << "void" << nl << scope << "::__read(::IceInternal::Stream* __is, " << scoped << "Prx& v)"; + C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::Stream* __is, " << scoped << "Prx& v)"; C << sb; C << nl << "::Ice::ObjectPrx proxy;"; C << nl << "__is->read(proxy);"; diff --git a/cpp/src/slice2cpp/GenUtil.cpp b/cpp/src/slice2cpp/GenUtil.cpp index 9fa50d2553c..96c480a89d3 100644 --- a/cpp/src/slice2cpp/GenUtil.cpp +++ b/cpp/src/slice2cpp/GenUtil.cpp @@ -303,8 +303,8 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& } else { - out << nl << seq->scope() << "::__" << func << stream << ", " << param << ", " << seq->scope() - << "::__U__" << seq->name() << "());"; + out << nl << seq->scope() << "__" << func << stream << ", " << param << ", " << seq->scope() + << "__U__" << seq->name() << "());"; } return; } @@ -312,8 +312,8 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& DictionaryPtr dict = DictionaryPtr::dynamicCast(type); if (dict) { - out << nl << dict->scope() << "::__" << func << stream << ", " << param << ", " << dict->scope() - << "::__U__" << dict->name() << "());"; + out << nl << dict->scope() << "__" << func << stream << ", " << param << ", " << dict->scope() + << "__U__" << dict->name() << "());"; return; } @@ -328,7 +328,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& constructed = proxy->_class(); } - out << nl << constructed->scope() << "::__" << func << stream << ", " << param << ");"; + out << nl << constructed->scope() << "__" << func << stream << ", " << param << ");"; } void |