diff options
Diffstat (limited to 'cpp/src')
44 files changed, 2426 insertions, 7040 deletions
diff --git a/cpp/src/Freeze/.depend b/cpp/src/Freeze/.depend index 2d8e7de007f..c3cd62c7b2e 100644 --- a/cpp/src/Freeze/.depend +++ b/cpp/src/Freeze/.depend @@ -24,27 +24,27 @@ TransactionHolder$(OBJEXT): TransactionHolder.cpp ../../include/Freeze/Transacti TransactionI$(OBJEXT): TransactionI.cpp ../Freeze/TransactionI.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Freeze/Transaction.h ../Freeze/ConnectionI.h ../../include/Freeze/Connection.h ../../include/Freeze/Initialize.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../../include/Freeze/EvictorF.h ../../include/Freeze/ConnectionF.h ../../include/Freeze/Index.h ../../include/Freeze/DB.h ../Freeze/SharedDbEnv.h ../../include/Freeze/Exception.h Transaction$(OBJEXT): Transaction.cpp ../../include/Freeze/Transaction.h ../../include/Ice/LocalObjectF.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/IceUtil/Iterator.h ../../include/IceUtil/ScopedArray.h ../../include/IceUtil/DisableWarnings.h Util$(OBJEXT): Util.cpp ../Freeze/Util.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../../include/Freeze/DB.h ../../include/Freeze/Exception.h -BackgroundSaveEvictor.cpp: ../../slice/Freeze/BackgroundSaveEvictor.ice ../../slice/Freeze/Evictor.ice ../../slice/Ice/ObjectAdapterF.ice ../../slice/Ice/ServantLocator.ice ../../slice/Ice/Current.ice ../../slice/Ice/ConnectionF.ice ../../slice/Ice/Identity.ice ../../slice/Freeze/Exception.ice -DB.cpp: ../../slice/Freeze/DB.ice -CatalogData.cpp: ../../slice/Freeze/CatalogData.ice -Connection.cpp: ../../slice/Freeze/Connection.ice ../../slice/Freeze/Transaction.ice ../../slice/Ice/CommunicatorF.ice -ConnectionF.cpp: ../../slice/Freeze/ConnectionF.ice -Exception.cpp: ../../slice/Freeze/Exception.ice -EvictorF.cpp: ../../slice/Freeze/EvictorF.ice -EvictorStorage.cpp: ../../slice/Freeze/EvictorStorage.ice ../../slice/Ice/Identity.ice -Evictor.cpp: ../../slice/Freeze/Evictor.ice ../../slice/Ice/ObjectAdapterF.ice ../../slice/Ice/ServantLocator.ice ../../slice/Ice/Current.ice ../../slice/Ice/ConnectionF.ice ../../slice/Ice/Identity.ice ../../slice/Freeze/Exception.ice -TransactionalEvictor.cpp: ../../slice/Freeze/TransactionalEvictor.ice ../../slice/Freeze/Evictor.ice ../../slice/Ice/ObjectAdapterF.ice ../../slice/Ice/ServantLocator.ice ../../slice/Ice/Current.ice ../../slice/Ice/ConnectionF.ice ../../slice/Ice/Identity.ice ../../slice/Freeze/Exception.ice -Transaction.cpp: ../../slice/Freeze/Transaction.ice +BackgroundSaveEvictor.cpp: ../../../slice/Freeze/BackgroundSaveEvictor.ice ../../../slice/Freeze/Evictor.ice ../../../slice/Ice/ObjectAdapterF.ice ../../../slice/Ice/ServantLocator.ice ../../../slice/Ice/Current.ice ../../../slice/Ice/ConnectionF.ice ../../../slice/Ice/Identity.ice ../../../slice/Freeze/Exception.ice +DB.cpp: ../../../slice/Freeze/DB.ice +CatalogData.cpp: ../../../slice/Freeze/CatalogData.ice +Connection.cpp: ../../../slice/Freeze/Connection.ice ../../../slice/Freeze/Transaction.ice ../../../slice/Ice/CommunicatorF.ice +ConnectionF.cpp: ../../../slice/Freeze/ConnectionF.ice +Exception.cpp: ../../../slice/Freeze/Exception.ice +EvictorF.cpp: ../../../slice/Freeze/EvictorF.ice +EvictorStorage.cpp: ../../../slice/Freeze/EvictorStorage.ice ../../../slice/Ice/Identity.ice +Evictor.cpp: ../../../slice/Freeze/Evictor.ice ../../../slice/Ice/ObjectAdapterF.ice ../../../slice/Ice/ServantLocator.ice ../../../slice/Ice/Current.ice ../../../slice/Ice/ConnectionF.ice ../../../slice/Ice/Identity.ice ../../../slice/Freeze/Exception.ice +TransactionalEvictor.cpp: ../../../slice/Freeze/TransactionalEvictor.ice ../../../slice/Freeze/Evictor.ice ../../../slice/Ice/ObjectAdapterF.ice ../../../slice/Ice/ServantLocator.ice ../../../slice/Ice/Current.ice ../../../slice/Ice/ConnectionF.ice ../../../slice/Ice/Identity.ice ../../../slice/Freeze/Exception.ice +Transaction.cpp: ../../../slice/Freeze/Transaction.ice PingObject.cpp: ../Freeze/PingObject.ice -../../slice/Freeze/BackgroundSaveEvictor.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Freeze/DB.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Freeze/CatalogData.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Freeze/Connection.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Freeze/ConnectionF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Freeze/Exception.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Freeze/EvictorF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Freeze/EvictorStorage.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Freeze/Evictor.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Freeze/TransactionalEvictor.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Freeze/Transaction.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Freeze/BackgroundSaveEvictor.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Freeze/DB.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Freeze/CatalogData.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Freeze/Connection.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Freeze/ConnectionF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Freeze/Exception.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Freeze/EvictorF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Freeze/EvictorStorage.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Freeze/Evictor.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Freeze/TransactionalEvictor.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Freeze/Transaction.ice: $(SLICE2CPP) $(SLICEPARSERLIB) ../Freeze/PingObject.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/src/Freeze/Makefile b/cpp/src/Freeze/Makefile index f4257c2040e..8258eff9bde 100644 --- a/cpp/src/Freeze/Makefile +++ b/cpp/src/Freeze/Makefile @@ -72,7 +72,7 @@ LINKWITH := $(BZIP2_RPATH_LINK) -lIce -lIceUtil $(DB_LIBS) $(HDIR)/Catalog.h Catalog.cpp: $(SLICE2FREEZE) $(SDIR)/CatalogData.ice rm -f $(HDIR)/Catalog.h Catalog.cpp $(SLICE2FREEZE) $(SLICE2CPPFLAGS) --dict Freeze::Catalog,string,Freeze::CatalogData \ - Catalog ../../slice/Freeze/CatalogData.ice + Catalog $(slicedir)/Freeze/CatalogData.ice mv Catalog.h $(HDIR)/Catalog.h clean:: diff --git a/cpp/src/Freeze/Makefile.mak b/cpp/src/Freeze/Makefile.mak index 401f28c9611..beb7d6a66ea 100644 --- a/cpp/src/Freeze/Makefile.mak +++ b/cpp/src/Freeze/Makefile.mak @@ -70,7 +70,7 @@ $(DLLNAME): $(OBJS) $(HDIR)/Catalog.h Catalog.cpp: $(SLICE2FREEZE) $(SDIR)/CatalogData.ice del /q $(HDIR)\Catalog.h Catalog.cpp $(SLICE2FREEZE) $(SLICE2CPPFLAGS) --dict Freeze::Catalog,string,Freeze::CatalogData \ - Catalog ../../slice/Freeze/CatalogData.ice + Catalog $(slicedir)/Freeze/CatalogData.ice move Catalog.h $(HDIR) clean:: @@ -79,7 +79,7 @@ clean:: clean:: del /q $(DLLNAME:.dll=.*) del /q DB.cpp $(HDIR)\DB.h - del /q BackgroundSaveEvictor.cpp $(HDIR)\BackgroundSaveEvictor.h + del /q BackgroundSaveEvictor.cpp $(HDIR)\BackgroundSaveEvictor.h del /q CatalogData.cpp $(HDIR)\CatalogData.h del /q Connection.cpp $(HDIR)\Connection.h del /q ConnectionF.cpp $(HDIR)\ConnectionF.h @@ -88,7 +88,7 @@ clean:: del /q Evictor.cpp $(HDIR)\Evictor.h del /q EvictorStorage.cpp $(HDIR)\EvictorStorage.h del /q Transaction.cpp $(HDIR)\Transaction.h - del /q TransactionalEvictor.cpp $(HDIR)\TransactionalEvictor.h + del /q TransactionalEvictor.cpp $(HDIR)\TransactionalEvictor.h del /q PingObject.cpp PingObject.h install:: all diff --git a/cpp/src/Freeze/MapI.cpp b/cpp/src/Freeze/MapI.cpp index ff8ffb916ee..390b4253ccb 100644 --- a/cpp/src/Freeze/MapI.cpp +++ b/cpp/src/Freeze/MapI.cpp @@ -1317,14 +1317,11 @@ Freeze::MapHelperI::close() _connection->unregisterMap(this); } _db = 0; - - for(IndexMap::iterator p = _indices.begin(); p != _indices.end(); ++p) - { - MapIndexBasePtr& indexBase = p->second; - indexBase->_impl = 0; - indexBase->_map = 0; - } + // + // We can't clear the indexBase as MapIndexI is using + // the first map's indexBase objects + // _indices.clear(); } diff --git a/cpp/src/Glacier2/.depend b/cpp/src/Glacier2/.depend index fd73224f51f..2c1cf451f59 100644 --- a/cpp/src/Glacier2/.depend +++ b/cpp/src/Glacier2/.depend @@ -14,17 +14,17 @@ FilterI$(OBJEXT): FilterI.cpp ../../include/Ice/Properties.h ../../include/Ice/L FilterManager$(OBJEXT): FilterManager.cpp ../../include/Ice/Communicator.h ../../include/Ice/LocalObjectF.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/CommunicatorF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/Logger.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/Ice/StringConverter.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/BuiltinSequences.h ../../include/IceUtil/IceUtil.h ../../include/IceUtil/AbstractMutex.h ../../include/IceUtil/Algorithm.h ../../include/IceUtil/ArgVector.h ../../include/IceUtil/Base64.h ../../include/IceUtil/Cache.h ../../include/IceUtil/CountDownLatch.h ../../include/IceUtil/CtrlCHandler.h ../../include/IceUtil/Functional.h ../../include/IceUtil/InputUtil.h ../../include/IceUtil/Iterator.h ../../include/IceUtil/MD5.h ../../include/IceUtil/Options.h ../../include/IceUtil/RecMutex.h ../../include/IceUtil/OutputUtil.h ../../include/IceUtil/RWRecMutex.h ../../include/IceUtil/Thread.h ../../include/IceUtil/Random.h ../../include/IceUtil/ScopedArray.h ../../include/IceUtil/StaticMutex.h ../../include/IceUtil/StringUtil.h ../../include/IceUtil/UUID.h ../../include/IceUtil/Timer.h ../Glacier2/FilterManager.h ../Glacier2/FilterI.h ../../include/Glacier2/Session.h ../../include/Ice/OutgoingAsync.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Glacier2/SSLInfo.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ServerBlobject$(OBJEXT): ServerBlobject.cpp ../Glacier2/ServerBlobject.h ../Glacier2/Blobject.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../Glacier2/RequestQueue.h ../../include/IceUtil/Thread.h SessionRouterI$(OBJEXT): SessionRouterI.cpp ../../include/Glacier2/PermissionsVerifier.h ../../include/Ice/LocalObjectF.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/CommunicatorF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/Ice/StringConverter.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Glacier2/SSLInfo.h ../../include/Ice/BuiltinSequences.h ../../include/Glacier2/Session.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../Glacier2/SessionRouterI.h ../../include/IceUtil/Thread.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/PropertiesF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../../include/Glacier2/PermissionsVerifierF.h ../../include/Glacier2/Router.h ../../include/IceUtil/DisableWarnings.h ../Glacier2/FilterManager.h ../Glacier2/FilterI.h ../Glacier2/RouterI.h ../Glacier2/ClientBlobject.h ../Glacier2/Blobject.h ../Glacier2/RequestQueue.h ../Glacier2/ServerBlobject.h ../../include/IceUtil/UUID.h ../../include/IceSSL/Plugin.h ../../include/Ice/Plugin.h ../Ice/Network.h -PermissionsVerifierF.cpp: ../../slice/Glacier2/PermissionsVerifierF.ice -PermissionsVerifier.cpp: ../../slice/Glacier2/PermissionsVerifier.ice ../../slice/Glacier2/SSLInfo.ice ../../slice/Ice/BuiltinSequences.ice -Router.cpp: ../../slice/Glacier2/Router.ice ../../slice/Ice/Router.ice ../../slice/Ice/BuiltinSequences.ice ../../slice/Glacier2/Session.ice ../../slice/Ice/Identity.ice ../../slice/Glacier2/SSLInfo.ice -RouterF.cpp: ../../slice/Glacier2/RouterF.ice -Session.cpp: ../../slice/Glacier2/Session.ice ../../slice/Ice/BuiltinSequences.ice ../../slice/Ice/Identity.ice ../../slice/Glacier2/SSLInfo.ice -SessionF.cpp: ../../slice/Glacier2/SessionF.ice -SSLInfo.cpp: ../../slice/Glacier2/SSLInfo.ice ../../slice/Ice/BuiltinSequences.ice -../../slice/Glacier2/PermissionsVerifierF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Glacier2/PermissionsVerifier.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Glacier2/Router.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Glacier2/RouterF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Glacier2/Session.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Glacier2/SessionF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Glacier2/SSLInfo.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +PermissionsVerifierF.cpp: ../../../slice/Glacier2/PermissionsVerifierF.ice +PermissionsVerifier.cpp: ../../../slice/Glacier2/PermissionsVerifier.ice ../../../slice/Glacier2/SSLInfo.ice ../../../slice/Ice/BuiltinSequences.ice +Router.cpp: ../../../slice/Glacier2/Router.ice ../../../slice/Ice/Router.ice ../../../slice/Ice/BuiltinSequences.ice ../../../slice/Glacier2/Session.ice ../../../slice/Ice/Identity.ice ../../../slice/Glacier2/SSLInfo.ice +RouterF.cpp: ../../../slice/Glacier2/RouterF.ice +Session.cpp: ../../../slice/Glacier2/Session.ice ../../../slice/Ice/BuiltinSequences.ice ../../../slice/Ice/Identity.ice ../../../slice/Glacier2/SSLInfo.ice +SessionF.cpp: ../../../slice/Glacier2/SessionF.ice +SSLInfo.cpp: ../../../slice/Glacier2/SSLInfo.ice ../../../slice/Ice/BuiltinSequences.ice +../../../slice/Glacier2/PermissionsVerifierF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Glacier2/PermissionsVerifier.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Glacier2/Router.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Glacier2/RouterF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Glacier2/Session.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Glacier2/SessionF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Glacier2/SSLInfo.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/src/Ice/.depend b/cpp/src/Ice/.depend index 05ec24abf47..569597da8fb 100644 --- a/cpp/src/Ice/.depend +++ b/cpp/src/Ice/.depend @@ -87,69 +87,69 @@ UdpTransceiver$(OBJEXT): UdpTransceiver.cpp ../Ice/UdpTransceiver.h ../../includ UnknownEndpointI$(OBJEXT): UnknownEndpointI.cpp ../Ice/UnknownEndpointI.h ../Ice/EndpointI.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/Endpoint.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/EndpointIF.h ../../include/Ice/InstanceF.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/AcceptorF.h ../../include/Ice/EndpointFactory.h ../../include/Ice/EndpointFactoryF.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/Ice/StringConverter.h ../../include/IceUtil/Unicode.h ../Ice/Instance.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/RecMutex.h ../../include/IceUtil/Timer.h ../../include/IceUtil/Thread.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/CommunicatorF.h ../../include/Ice/StatsF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../../include/Ice/ProxyFactoryF.h ../Ice/ThreadPoolF.h ../../include/Ice/ConnectionFactoryF.h ../../include/Ice/ConnectionMonitorF.h ../Ice/ObjectFactoryManagerF.h ../../include/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../../include/Ice/DynamicLibraryF.h ../../include/Ice/PluginF.h ../../include/Ice/Initialize.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/Ice/ConnectionIF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/LoggerF.h ../../include/Ice/BuiltinSequences.h ../Ice/SharedContext.h ../Ice/ImplicitContextI.h ../../include/Ice/ImplicitContext.h ../../include/Ice/LocalException.h ../../include/Ice/FacetMap.h ../../include/Ice/Process.h ../../include/Ice/Outgoing.h ../../include/Ice/OutgoingAsync.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/IceUtil/Base64.h DLLMain$(OBJEXT): DLLMain.cpp ../Ice/EventLoggerI.h ../../include/Ice/Logger.h ../../include/Ice/LocalObjectF.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../Ice/ImplicitContextI.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Service.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/PropertiesF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h EventLoggerI$(OBJEXT): EventLoggerI.cpp ../Ice/EventLoggerI.h ../../include/Ice/Logger.h ../../include/Ice/LocalObjectF.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../Ice/EventLoggerMsg.h ../../include/Ice/LocalException.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/CommunicatorF.h ../../include/Ice/BuiltinSequences.h ../Ice/Network.h ../../include/Ice/PropertiesF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/LoggerF.h ../../include/IceUtil/StaticMutex.h -BuiltinSequences.cpp: ../../slice/Ice/BuiltinSequences.ice -CommunicatorF.cpp: ../../slice/Ice/CommunicatorF.ice -Communicator.cpp: ../../slice/Ice/Communicator.ice ../../slice/Ice/LoggerF.ice ../../slice/Ice/StatsF.ice ../../slice/Ice/ObjectAdapterF.ice ../../slice/Ice/PropertiesF.ice ../../slice/Ice/ObjectFactoryF.ice ../../slice/Ice/RouterF.ice ../../slice/Ice/LocatorF.ice ../../slice/Ice/PluginF.ice ../../slice/Ice/ImplicitContextF.ice ../../slice/Ice/Current.ice ../../slice/Ice/ConnectionF.ice ../../slice/Ice/Identity.ice -ConnectionF.cpp: ../../slice/Ice/ConnectionF.ice -Connection.cpp: ../../slice/Ice/Connection.ice ../../slice/Ice/ObjectAdapterF.ice ../../slice/Ice/Identity.ice -Current.cpp: ../../slice/Ice/Current.ice ../../slice/Ice/ObjectAdapterF.ice ../../slice/Ice/ConnectionF.ice ../../slice/Ice/Identity.ice -Endpoint.cpp: ../../slice/Ice/Endpoint.ice -FacetMap.cpp: ../../slice/Ice/FacetMap.ice -Identity.cpp: ../../slice/Ice/Identity.ice -ImplicitContextF.cpp: ../../slice/Ice/ImplicitContextF.ice -ImplicitContext.cpp: ../../slice/Ice/ImplicitContext.ice ../../slice/Ice/LocalException.ice ../../slice/Ice/Identity.ice ../../slice/Ice/BuiltinSequences.ice ../../slice/Ice/Current.ice ../../slice/Ice/ObjectAdapterF.ice ../../slice/Ice/ConnectionF.ice -LocalException.cpp: ../../slice/Ice/LocalException.ice ../../slice/Ice/Identity.ice ../../slice/Ice/BuiltinSequences.ice -LocatorF.cpp: ../../slice/Ice/LocatorF.ice -Locator.cpp: ../../slice/Ice/Locator.ice ../../slice/Ice/Identity.ice ../../slice/Ice/ProcessF.ice -LoggerF.cpp: ../../slice/Ice/LoggerF.ice -Logger.cpp: ../../slice/Ice/Logger.ice -ObjectAdapterF.cpp: ../../slice/Ice/ObjectAdapterF.ice -ObjectAdapter.cpp: ../../slice/Ice/ObjectAdapter.ice ../../slice/Ice/CommunicatorF.ice ../../slice/Ice/ServantLocatorF.ice ../../slice/Ice/RouterF.ice ../../slice/Ice/LocatorF.ice ../../slice/Ice/Identity.ice ../../slice/Ice/FacetMap.ice -ObjectFactoryF.cpp: ../../slice/Ice/ObjectFactoryF.ice -ObjectFactory.cpp: ../../slice/Ice/ObjectFactory.ice -PluginF.cpp: ../../slice/Ice/PluginF.ice -Plugin.cpp: ../../slice/Ice/Plugin.ice ../../slice/Ice/LoggerF.ice -ProcessF.cpp: ../../slice/Ice/ProcessF.ice -Process.cpp: ../../slice/Ice/Process.ice -PropertiesF.cpp: ../../slice/Ice/PropertiesF.ice -Properties.cpp: ../../slice/Ice/Properties.ice ../../slice/Ice/BuiltinSequences.ice -RouterF.cpp: ../../slice/Ice/RouterF.ice -Router.cpp: ../../slice/Ice/Router.ice ../../slice/Ice/BuiltinSequences.ice -ServantLocatorF.cpp: ../../slice/Ice/ServantLocatorF.ice -ServantLocator.cpp: ../../slice/Ice/ServantLocator.ice ../../slice/Ice/ObjectAdapterF.ice ../../slice/Ice/Current.ice ../../slice/Ice/ConnectionF.ice ../../slice/Ice/Identity.ice -SliceChecksumDict.cpp: ../../slice/Ice/SliceChecksumDict.ice -StatsF.cpp: ../../slice/Ice/StatsF.ice -Stats.cpp: ../../slice/Ice/Stats.ice -../../slice/Ice/BuiltinSequences.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/CommunicatorF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/Communicator.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/ConnectionF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/Connection.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/Current.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/Endpoint.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/FacetMap.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/Identity.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/ImplicitContextF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/ImplicitContext.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/LocalException.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/LocatorF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/Locator.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/LoggerF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/Logger.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/ObjectAdapterF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/ObjectAdapter.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/ObjectFactoryF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/ObjectFactory.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/PluginF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/Plugin.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/ProcessF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/Process.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/PropertiesF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/Properties.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/RouterF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/Router.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/ServantLocatorF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/ServantLocator.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/SliceChecksumDict.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/StatsF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/Ice/Stats.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +BuiltinSequences.cpp: ../../../slice/Ice/BuiltinSequences.ice +CommunicatorF.cpp: ../../../slice/Ice/CommunicatorF.ice +Communicator.cpp: ../../../slice/Ice/Communicator.ice ../../../slice/Ice/LoggerF.ice ../../../slice/Ice/StatsF.ice ../../../slice/Ice/ObjectAdapterF.ice ../../../slice/Ice/PropertiesF.ice ../../../slice/Ice/ObjectFactoryF.ice ../../../slice/Ice/RouterF.ice ../../../slice/Ice/LocatorF.ice ../../../slice/Ice/PluginF.ice ../../../slice/Ice/ImplicitContextF.ice ../../../slice/Ice/Current.ice ../../../slice/Ice/ConnectionF.ice ../../../slice/Ice/Identity.ice +ConnectionF.cpp: ../../../slice/Ice/ConnectionF.ice +Connection.cpp: ../../../slice/Ice/Connection.ice ../../../slice/Ice/ObjectAdapterF.ice ../../../slice/Ice/Identity.ice +Current.cpp: ../../../slice/Ice/Current.ice ../../../slice/Ice/ObjectAdapterF.ice ../../../slice/Ice/ConnectionF.ice ../../../slice/Ice/Identity.ice +Endpoint.cpp: ../../../slice/Ice/Endpoint.ice +FacetMap.cpp: ../../../slice/Ice/FacetMap.ice +Identity.cpp: ../../../slice/Ice/Identity.ice +ImplicitContextF.cpp: ../../../slice/Ice/ImplicitContextF.ice +ImplicitContext.cpp: ../../../slice/Ice/ImplicitContext.ice ../../../slice/Ice/LocalException.ice ../../../slice/Ice/Identity.ice ../../../slice/Ice/BuiltinSequences.ice ../../../slice/Ice/Current.ice ../../../slice/Ice/ObjectAdapterF.ice ../../../slice/Ice/ConnectionF.ice +LocalException.cpp: ../../../slice/Ice/LocalException.ice ../../../slice/Ice/Identity.ice ../../../slice/Ice/BuiltinSequences.ice +LocatorF.cpp: ../../../slice/Ice/LocatorF.ice +Locator.cpp: ../../../slice/Ice/Locator.ice ../../../slice/Ice/Identity.ice ../../../slice/Ice/ProcessF.ice +LoggerF.cpp: ../../../slice/Ice/LoggerF.ice +Logger.cpp: ../../../slice/Ice/Logger.ice +ObjectAdapterF.cpp: ../../../slice/Ice/ObjectAdapterF.ice +ObjectAdapter.cpp: ../../../slice/Ice/ObjectAdapter.ice ../../../slice/Ice/CommunicatorF.ice ../../../slice/Ice/ServantLocatorF.ice ../../../slice/Ice/RouterF.ice ../../../slice/Ice/LocatorF.ice ../../../slice/Ice/Identity.ice ../../../slice/Ice/FacetMap.ice +ObjectFactoryF.cpp: ../../../slice/Ice/ObjectFactoryF.ice +ObjectFactory.cpp: ../../../slice/Ice/ObjectFactory.ice +PluginF.cpp: ../../../slice/Ice/PluginF.ice +Plugin.cpp: ../../../slice/Ice/Plugin.ice ../../../slice/Ice/LoggerF.ice +ProcessF.cpp: ../../../slice/Ice/ProcessF.ice +Process.cpp: ../../../slice/Ice/Process.ice +PropertiesF.cpp: ../../../slice/Ice/PropertiesF.ice +Properties.cpp: ../../../slice/Ice/Properties.ice ../../../slice/Ice/BuiltinSequences.ice +RouterF.cpp: ../../../slice/Ice/RouterF.ice +Router.cpp: ../../../slice/Ice/Router.ice ../../../slice/Ice/BuiltinSequences.ice +ServantLocatorF.cpp: ../../../slice/Ice/ServantLocatorF.ice +ServantLocator.cpp: ../../../slice/Ice/ServantLocator.ice ../../../slice/Ice/ObjectAdapterF.ice ../../../slice/Ice/Current.ice ../../../slice/Ice/ConnectionF.ice ../../../slice/Ice/Identity.ice +SliceChecksumDict.cpp: ../../../slice/Ice/SliceChecksumDict.ice +StatsF.cpp: ../../../slice/Ice/StatsF.ice +Stats.cpp: ../../../slice/Ice/Stats.ice +../../../slice/Ice/BuiltinSequences.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/CommunicatorF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/Communicator.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/ConnectionF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/Connection.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/Current.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/Endpoint.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/FacetMap.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/Identity.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/ImplicitContextF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/ImplicitContext.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/LocalException.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/LocatorF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/Locator.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/LoggerF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/Logger.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/ObjectAdapterF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/ObjectAdapter.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/ObjectFactoryF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/ObjectFactory.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/PluginF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/Plugin.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/ProcessF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/Process.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/PropertiesF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/Properties.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/RouterF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/Router.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/ServantLocatorF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/ServantLocator.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/SliceChecksumDict.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/StatsF.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/Ice/Stats.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp index 3ffadc78573..2a94e724f86 100644 --- a/cpp/src/Ice/BasicStream.cpp +++ b/cpp/src/Ice/BasicStream.cpp @@ -33,6 +33,7 @@ using namespace IceInternal; IceInternal::BasicStream::BasicStream(Instance* instance, bool unlimited) : IceInternal::Buffer(instance->messageSizeMax()), _instance(instance), + _closure(0), _currentReadEncaps(0), _currentWriteEncaps(0), _traceSlicing(-1), @@ -73,6 +74,20 @@ IceInternal::BasicStream::clear() delete _objectList; } +void* +IceInternal::BasicStream::closure() const +{ + return _closure; +} + +void* +IceInternal::BasicStream::closure(void* p) +{ + void* prev = _closure; + _closure = p; + return prev; +} + void IceInternal::BasicStream::swap(BasicStream& other) { @@ -80,6 +95,8 @@ IceInternal::BasicStream::swap(BasicStream& other) Buffer::swap(other); + std::swap(_closure, other._closure); + // // Swap is never called for BasicStreams that have more than one // encaps. diff --git a/cpp/src/Ice/Direct.cpp b/cpp/src/Ice/Direct.cpp index a70078d1948..df8ff0ef107 100644 --- a/cpp/src/Ice/Direct.cpp +++ b/cpp/src/Ice/Direct.cpp @@ -145,6 +145,10 @@ IceInternal::Direct::destroy() } adapter->decDirectCount(); + if(_userException.get()) + { + _userException->ice_throw(); + } } const ObjectPtr& @@ -152,4 +156,3 @@ IceInternal::Direct::servant() { return _servant; } - diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp index 84a78413c15..2510db8cffa 100644 --- a/cpp/src/Ice/Exception.cpp +++ b/cpp/src/Ice/Exception.cpp @@ -18,6 +18,25 @@ using namespace std; using namespace Ice; using namespace IceInternal; +namespace IceInternal +{ + +namespace Ex +{ + +void +throwUOE(const string& expectedType, const string& actualType) +{ + throw Ice::UnexpectedObjectException(__FILE__, __LINE__, + "expected element of type `" + expectedType + "' but received '" + actualType, + actualType, expectedType); +} + +} + +} + + bool Ice::UserException::__usesClasses() const { diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index 391515df1ad..07af1086aa8 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -406,6 +406,7 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) try { + bool finishedException = false; try { if(servantManager) @@ -420,27 +421,38 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) } if(_locator) { - _servant = _locator->locate(_current, _cookie); + try + { + _servant = _locator->locate(_current, _cookie); + } + catch(const UserException& ex) + { + _os.write(ex); + replyStatus = replyUserException; + } } } } - if(!_servant) + if(replyStatus == replyOK) { - if(servantManager && servantManager->hasServant(_current.id)) + if(!_servant) { - replyStatus = replyFacetNotExist; + if(servantManager && servantManager->hasServant(_current.id)) + { + replyStatus = replyFacetNotExist; + } + else + { + replyStatus = replyObjectNotExist; + } } else { - replyStatus = replyObjectNotExist; - } - } - else - { - dispatchStatus = _servant->__dispatch(*this, _current); - if(dispatchStatus == DispatchUserException) - { - replyStatus = replyUserException; + dispatchStatus = _servant->__dispatch(*this, _current); + if(dispatchStatus == DispatchUserException) + { + replyStatus = replyUserException; + } } } } @@ -448,15 +460,50 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) { if(_locator && _servant && dispatchStatus != DispatchAsync) { - _locator->finished(_current, _servant, _cookie); + try + { + _locator->finished(_current, _servant, _cookie); + } + catch(const UserException& ex) + { + // + // The operation may have already marshaled a reply; we must overwrite that reply. + // + _os.endWriteEncaps(); + _os.b.resize(headerSize + 5); // Byte following reply status. + _os.startWriteEncaps(); + _os.write(ex); + replyStatus = replyUserException; // Code below inserts the reply status. + finishedException = true; + } + catch(...) + { + throw; + } + } + if(!finishedException) + { + throw; } - - throw; } - if(_locator && _servant && dispatchStatus != DispatchAsync) + if(!finishedException && _locator && _servant && dispatchStatus != DispatchAsync) { - _locator->finished(_current, _servant, _cookie); + try + { + _locator->finished(_current, _servant, _cookie); + } + catch(const UserException& ex) + { + // + // The operation may have already marshaled a reply; we must overwrite that reply. + // + _os.endWriteEncaps(); + _os.b.resize(headerSize + 5); // Byte following reply status. + _os.startWriteEncaps(); + _os.write(ex); + replyStatus = replyUserException; // Code below inserts the reply status. + } } } catch(const std::exception& ex) diff --git a/cpp/src/Ice/IncomingAsync.cpp b/cpp/src/Ice/IncomingAsync.cpp index 0db1a4acaf6..c479c034399 100644 --- a/cpp/src/Ice/IncomingAsync.cpp +++ b/cpp/src/Ice/IncomingAsync.cpp @@ -138,7 +138,31 @@ IceInternal::IncomingAsync::__servantLocatorFinished() { if(_locator && _servant) { - _locator->finished(_current, _servant, _cookie); + try + { + _locator->finished(_current, _servant, _cookie); + } + catch(const UserException& ex) + { + // + // The operation may have already marshaled a reply; we must overwrite that reply. + // + if(_response) + { + _os.endWriteEncaps(); + _os.b.resize(headerSize + 4); // Reply status position. + _os.write(replyUserException); + _os.startWriteEncaps(); + _os.write(ex); + _os.endWriteEncaps(); + _connection->sendResponse(&_os, _compress); + } + else + { + _connection->sendNoResponse(); + } + return false; + } } return true; } diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index d2c70989e72..53c333ba5f8 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -33,6 +33,44 @@ IceInternal::LocalExceptionWrapper::LocalExceptionWrapper(const LocalExceptionWr _ex.reset(dynamic_cast<LocalException*>(ex.get()->ice_clone())); } +void +IceInternal::LocalExceptionWrapper::throwUnknownWrapper(const std::exception& ex) +{ + + const UserException* ue = dynamic_cast<const UserException*>(&ex); + if(ue) + { + stringstream s; + s << *ue; + throw LocalExceptionWrapper(UnknownUserException(__FILE__, __LINE__, s.str()), false); + } + + const LocalException* le = dynamic_cast<const LocalException*>(&ex); + if(le) + { +#if 0 + // + // Commented-out code makes local exceptions fully location transparent, + // but the Freeze evictor relies on them not being transparent. + // + if(dynamic_cast<const UnknownException*>(le) || + dynamic_cast<const ObjectNotExistException*>(le) || + dynamic_cast<const OperationNotExistException*>(le) || + dynamic_cast<const FacetNotExistException*>(le)) + { + throw LocalExceptionWrapper(*le, false); + } + stringstream s; + s << *le; + throw LocalExceptionWrapper(UnknownLocalException(__FILE__, __LINE__, s.str()), false); +#else + throw LocalExceptionWrapper(*le, false); +#endif + } + string msg = "std::exception: "; + throw LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, msg + ex.what()), false); +} + const LocalException* IceInternal::LocalExceptionWrapper::get() const { diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp index cb5e8ce95fc..8f282dcdb08 100644 --- a/cpp/src/Ice/PropertyNames.cpp +++ b/cpp/src/Ice/PropertyNames.cpp @@ -7,7 +7,7 @@ // // ********************************************************************** // -// Generated by makeprops.py from file ../config/PropertyNames.xml, Fri Oct 12 15:45:46 2007 +// Generated by makeprops.py from file ..\config\PropertyNames.xml, Mon Oct 29 16:59:13 2007 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -66,6 +66,7 @@ const IceInternal::Property IcePropsData[] = IceInternal::Property("Ice.Default.Router.CollocationOptimized", false, 0), IceInternal::Property("Ice.Default.Router.ThreadPerConnection", false, 0), IceInternal::Property("Ice.Default.Router", false, 0), + IceInternal::Property("Ice.EventLog.Source", false, 0), IceInternal::Property("Ice.GC.Interval", false, 0), IceInternal::Property("Ice.ImplicitContext", false, 0), IceInternal::Property("Ice.InitPlugins", false, 0), diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h index 9896f908a5a..337d21a566f 100644 --- a/cpp/src/Ice/PropertyNames.h +++ b/cpp/src/Ice/PropertyNames.h @@ -7,7 +7,7 @@ // // ********************************************************************** // -// Generated by makeprops.py from file ../config/PropertyNames.xml, Fri Oct 12 15:45:46 2007 +// Generated by makeprops.py from file ..\config\PropertyNames.xml, Mon Oct 29 16:59:13 2007 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index b902dedaad1..35ee8cae257 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -1354,16 +1354,29 @@ IceDelegateD::Ice::Object::ice_isA(const string& __id, const Context* context) { __direct.servant()->__collocDispatch(__direct); } + catch(const ::std::exception& __ex) + { + __direct.destroy(); + LocalExceptionWrapper::throwUnknownWrapper(__ex); + } catch(...) { __direct.destroy(); - throw; + throw UnknownException(__FILE__, __LINE__, "unknown c++ exception"); } __direct.destroy(); } - catch(const LocalException& __ex) + catch(const LocalExceptionWrapper&) + { + throw; + } + catch(const ::std::exception& __ex) + { + LocalExceptionWrapper::throwUnknownWrapper(__ex); + } + catch(...) { - throw LocalExceptionWrapper(__ex, false); + throw LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false); } return __result; } @@ -1399,16 +1412,29 @@ IceDelegateD::Ice::Object::ice_ping(const ::Ice::Context* context) { __direct.servant()->__collocDispatch(__direct); } + catch(const ::std::exception& __ex) + { + __direct.destroy(); + LocalExceptionWrapper::throwUnknownWrapper(__ex); + } catch(...) { __direct.destroy(); - throw; + throw UnknownException(__FILE__, __LINE__, "unknown c++ exception"); } __direct.destroy(); } - catch(const LocalException& __ex) + catch(const LocalExceptionWrapper&) + { + throw; + } + catch(const ::std::exception& __ex) + { + LocalExceptionWrapper::throwUnknownWrapper(__ex); + } + catch(...) { - throw LocalExceptionWrapper(__ex, false); + throw LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false); } } @@ -1449,16 +1475,29 @@ IceDelegateD::Ice::Object::ice_ids(const ::Ice::Context* context) { __direct.servant()->__collocDispatch(__direct); } + catch(const ::std::exception& __ex) + { + __direct.destroy(); + LocalExceptionWrapper::throwUnknownWrapper(__ex); + } catch(...) { __direct.destroy(); - throw; + throw UnknownException(__FILE__, __LINE__, "unknown c++ exception"); } __direct.destroy(); } - catch(const LocalException& __ex) + catch(const LocalExceptionWrapper&) + { + throw; + } + catch(const ::std::exception& __ex) + { + LocalExceptionWrapper::throwUnknownWrapper(__ex); + } + catch(...) { - throw LocalExceptionWrapper(__ex, false); + throw LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false); } return __result; } @@ -1500,16 +1539,29 @@ IceDelegateD::Ice::Object::ice_id(const ::Ice::Context* context) { __direct.servant()->__collocDispatch(__direct); } + catch(const ::std::exception& __ex) + { + __direct.destroy(); + LocalExceptionWrapper::throwUnknownWrapper(__ex); + } catch(...) { __direct.destroy(); - throw; + throw UnknownException(__FILE__, __LINE__, "unknown c++ exception"); } __direct.destroy(); } - catch(const LocalException& __ex) + catch(const LocalExceptionWrapper&) + { + throw; + } + catch(const ::std::exception& __ex) + { + LocalExceptionWrapper::throwUnknownWrapper(__ex); + } + catch(...) { - throw LocalExceptionWrapper(__ex, false); + throw LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false); } return __result; } diff --git a/cpp/src/Ice/Service.cpp b/cpp/src/Ice/Service.cpp index 155b2c68625..312a6914fc7 100755 --- a/cpp/src/Ice/Service.cpp +++ b/cpp/src/Ice/Service.cpp @@ -140,9 +140,9 @@ class SMEventLoggerI : public Ice::Logger { public: - SMEventLoggerI(const string& service) + SMEventLoggerI(const string& source) { - _source = RegisterEventSource(0, mangleService(service).c_str()); + _source = RegisterEventSource(0, mangleSource(source).c_str()); if(_source == 0) { SyscallException ex(__FILE__, __LINE__); @@ -156,13 +156,13 @@ public: assert(_source != 0); DeregisterEventSource(_source); } - + static void - addKeys(const string& service) + addKeys(const string& source) { HKEY hKey; DWORD d; - LONG err = RegCreateKeyEx(HKEY_LOCAL_MACHINE, createKey(service).c_str(), 0, "REG_SZ", + LONG err = RegCreateKeyEx(HKEY_LOCAL_MACHINE, createKey(source).c_str(), 0, "REG_SZ", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, &d); if(err != ERROR_SUCCESS) { @@ -189,7 +189,7 @@ public: // the "EventMessageFile" key should contain the path to this // DLL. // - err = RegSetValueEx(hKey, "EventMessageFile", 0, REG_EXPAND_SZ, + err = RegSetValueEx(hKey, "EventMessageFile", 0, REG_EXPAND_SZ, reinterpret_cast<unsigned char*>(path), static_cast<DWORD>(strlen(path) + 1)); if(err == ERROR_SUCCESS) { @@ -213,9 +213,9 @@ public: } static void - removeKeys(const string& theService) + removeKeys(const string& source) { - LONG err = RegDeleteKey(HKEY_LOCAL_MACHINE, createKey(theService).c_str()); + LONG err = RegDeleteKey(HKEY_LOCAL_MACHINE, createKey(source).c_str()); if(err != ERROR_SUCCESS) { SyscallException ex(__FILE__, __LINE__); @@ -285,14 +285,14 @@ public: { _module = module; } - + private: static string - mangleService(string name) + mangleSource(string name) { // - // The service name cannot contain backslashes. + // The source name cannot contain backslashes. // string::size_type pos = 0; while((pos = name.find('\\', pos)) != string::npos) @@ -310,7 +310,7 @@ private: // // HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application. // - return "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\" + mangleService(name); + return "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\" + mangleSource(name); } @@ -379,15 +379,32 @@ Ice::Service::interrupt() } int -Ice::Service::main(int& argc, char* argv[], const InitializationData& initData) +Ice::Service::main(int& argc, char* argv[], const InitializationData& initializationData) { _name = argv[0]; #ifdef _WIN32 + + // + // On Windows, we parse the properties here to extract Ice.EventLog.Source + // + InitializationData initData = initializationData; + if(initData.properties == 0) + { + initData.properties = createProperties(argc, argv, initData.properties, initData.stringConverter); + } + else + { + StringSeq options = argsToStringSeq(argc, argv); + options = initData.properties->parseIceCommandLineOptions(options); + stringSeqToArgs(options, argc, argv); + } + // // First check for the --service option. // string name; + string eventLogSource; int idx = 1; while(idx < argc) { @@ -408,7 +425,9 @@ Ice::Service::main(int& argc, char* argv[], const InitializationData& initData) _logger = getProcessLogger(); if(LoggerIPtr::dynamicCast(_logger)) { - _logger = new SMEventLoggerI(name); + string eventLogSource = initData.properties-> + getPropertyWithDefault("Ice.EventLog.Source", name); + _logger = new SMEventLoggerI(eventLogSource); setProcessLogger(_logger); } @@ -584,6 +603,9 @@ Ice::Service::main(int& argc, char* argv[], const InitializationData& initData) // // Check for --daemon, --noclose, --nochdir and --pidfile. // + + const InitializationData& initData = initializationData; + bool daemonize = false; bool closeFiles = true; bool changeDirectory = true; @@ -1939,7 +1961,7 @@ Ice::Service::runDaemon(int argc, char* argv[], const InitializationData& initDa assert(fd == 2); } } - + // // Write PID // diff --git a/cpp/src/Ice/StreamI.cpp b/cpp/src/Ice/StreamI.cpp index 989e98a9313..b0458637dfe 100644 --- a/cpp/src/Ice/StreamI.cpp +++ b/cpp/src/Ice/StreamI.cpp @@ -12,42 +12,32 @@ using namespace std; using namespace Ice; - -// -// BasicInputStream -// -IceInternal::BasicInputStream::BasicInputStream(IceInternal::Instance* instance, InputStream* in) : - BasicStream(instance), _in(in) -{ -} - -// -// BasicOutputStream -// -IceInternal::BasicOutputStream::BasicOutputStream(IceInternal::Instance* instance, OutputStream* out) : - BasicStream(instance), _out(out) -{ -} +using namespace IceInternal; // // InputStreamI // Ice::InputStreamI::InputStreamI(const Ice::CommunicatorPtr& communicator, const vector<Byte>& data) : - _communicator(communicator), _is(IceInternal::getInstance(communicator).get(), this) + _communicator(communicator) { - _is.writeBlob(data); - _is.i = _is.b.begin(); + _is = new BasicStream(getInstance(communicator).get()); + _is->closure(this); + _is->writeBlob(data); + _is->i = _is->b.begin(); } Ice::InputStreamI::InputStreamI(const Ice::CommunicatorPtr& communicator, const pair<const Byte*, const Byte*>& data) : - _communicator(communicator), _is(IceInternal::getInstance(communicator).get(), this) + _communicator(communicator) { - _is.writeBlob(data.first, data.second - data.first); - _is.i = _is.b.begin(); + _is = new BasicStream(getInstance(communicator).get()); + _is->closure(this); + _is->writeBlob(data.first, data.second - data.first); + _is->i = _is->b.begin(); } Ice::InputStreamI::~InputStreamI() { + delete _is; } CommunicatorPtr @@ -59,14 +49,14 @@ Ice::InputStreamI::communicator() const void Ice::InputStreamI::sliceObjects(bool b) { - _is.sliceObjects(b); + _is->sliceObjects(b); } bool Ice::InputStreamI::readBool() { bool v; - _is.read(v); + _is->read(v); return v; } @@ -74,21 +64,21 @@ vector<bool> Ice::InputStreamI::readBoolSeq() { vector<bool> v; - _is.read(v); + _is->read(v); return v; } bool* Ice::InputStreamI::readBoolSeq(pair<const bool*, const bool*>& p) { - return _is.read(p); + return _is->read(p); } Byte Ice::InputStreamI::readByte() { Byte v; - _is.read(v); + _is->read(v); return v; } @@ -96,7 +86,7 @@ vector<Byte> Ice::InputStreamI::readByteSeq() { pair<const Byte*, const Byte*> p; - _is.read(p); + _is->read(p); vector<Byte> v(p.first, p.second); return v; } @@ -104,14 +94,14 @@ Ice::InputStreamI::readByteSeq() void Ice::InputStreamI::readByteSeq(pair<const Byte*, const Byte*>& p) { - _is.read(p); + _is->read(p); } Short Ice::InputStreamI::readShort() { Short v; - _is.read(v); + _is->read(v); return v; } @@ -119,21 +109,21 @@ vector<Short> Ice::InputStreamI::readShortSeq() { vector<Short> v; - _is.read(v); + _is->read(v); return v; } Short* Ice::InputStreamI::readShortSeq(pair<const Short*, const Short*>& p) { - return _is.read(p); + return _is->read(p); } Int Ice::InputStreamI::readInt() { Int v; - _is.read(v); + _is->read(v); return v; } @@ -141,21 +131,21 @@ vector<Int> Ice::InputStreamI::readIntSeq() { vector<Int> v; - _is.read(v); + _is->read(v); return v; } Int* Ice::InputStreamI::readIntSeq(pair<const Int*, const Int*>& p) { - return _is.read(p); + return _is->read(p); } Long Ice::InputStreamI::readLong() { Long v; - _is.read(v); + _is->read(v); return v; } @@ -163,21 +153,21 @@ vector<Long> Ice::InputStreamI::readLongSeq() { vector<Long> v; - _is.read(v); + _is->read(v); return v; } Long* Ice::InputStreamI::readLongSeq(pair<const Long*, const Long*>& p) { - return _is.read(p); + return _is->read(p); } Float Ice::InputStreamI::readFloat() { Float v; - _is.read(v); + _is->read(v); return v; } @@ -185,21 +175,21 @@ vector<Float> Ice::InputStreamI::readFloatSeq() { vector<Float> v; - _is.read(v); + _is->read(v); return v; } Float* Ice::InputStreamI::readFloatSeq(pair<const Float*, const Float*>& p) { - return _is.read(p); + return _is->read(p); } Double Ice::InputStreamI::readDouble() { Double v; - _is.read(v); + _is->read(v); return v; } @@ -207,21 +197,21 @@ vector<Double> Ice::InputStreamI::readDoubleSeq() { vector<Double> v; - _is.read(v); + _is->read(v); return v; } Double* Ice::InputStreamI::readDoubleSeq(pair<const Double*, const Double*>& p) { - return _is.read(p); + return _is->read(p); } string Ice::InputStreamI::readString() { string v; - _is.read(v); + _is->read(v); return v; } @@ -229,7 +219,7 @@ vector<string> Ice::InputStreamI::readStringSeq() { vector<string> v; - _is.read(v); + _is->read(v); return v; } @@ -237,7 +227,7 @@ wstring Ice::InputStreamI::readWstring() { wstring v; - _is.read(v); + _is->read(v); return v; } @@ -245,7 +235,7 @@ vector<wstring> Ice::InputStreamI::readWstringSeq() { vector<wstring> v; - _is.read(v); + _is->read(v); return v; } @@ -253,7 +243,7 @@ Int Ice::InputStreamI::readSize() { Int sz; - _is.readSize(sz); + _is->readSize(sz); return sz; } @@ -261,7 +251,7 @@ ObjectPrx Ice::InputStreamI::readProxy() { Ice::ObjectPrx v; - _is.read(v); + _is->read(v); return v; } @@ -277,69 +267,78 @@ void Ice::InputStreamI::readObject(const ReadObjectCallbackPtr& cb) { _callbacks.push_back(cb); // Keep reference to callback. - _is.read(patchObject, cb.get()); + _is->read(patchObject, cb.get()); } string Ice::InputStreamI::readTypeId() { string id; - _is.readTypeId(id); + _is->readTypeId(id); return id; } void Ice::InputStreamI::throwException() { - _is.throwException(); + _is->throwException(); } void Ice::InputStreamI::startSlice() { - _is.startReadSlice(); + _is->startReadSlice(); } void Ice::InputStreamI::endSlice() { - _is.endReadSlice(); + _is->endReadSlice(); } void Ice::InputStreamI::startEncapsulation() { - _is.startReadEncaps(); + _is->startReadEncaps(); } void Ice::InputStreamI::endEncapsulation() { - _is.endReadEncaps(); + _is->endReadEncaps(); } void Ice::InputStreamI::skipSlice() { - _is.skipSlice(); + _is->skipSlice(); } void Ice::InputStreamI::readPendingObjects() { - _is.readPendingObjects(); + _is->readPendingObjects(); } // // OutputStreamI // -Ice::OutputStreamI::OutputStreamI(const Ice::CommunicatorPtr& communicator) : - _communicator(communicator), _os(IceInternal::getInstance(communicator).get(), this) +Ice::OutputStreamI::OutputStreamI(const Ice::CommunicatorPtr& communicator, BasicStream* os) : + _communicator(communicator), _os(os), _own(!os) { + if(!_os) + { + _os = new BasicStream(getInstance(communicator).get()); + } + _os->closure(this); } Ice::OutputStreamI::~OutputStreamI() { + if(_own) + { + delete _os; + } } CommunicatorPtr @@ -351,25 +350,25 @@ Ice::OutputStreamI::communicator() const void Ice::OutputStreamI::writeBool(bool v) { - _os.write(v); + _os->write(v); } void Ice::OutputStreamI::writeBoolSeq(const vector<bool>& v) { - _os.write(v); + _os->write(v); } void Ice::OutputStreamI::writeBoolSeq(const bool* begin, const bool* end) { - _os.write(begin, end); + _os->write(begin, end); } void Ice::OutputStreamI::writeByte(Byte v) { - _os.write(v); + _os->write(v); } void @@ -377,24 +376,24 @@ Ice::OutputStreamI::writeByteSeq(const vector<Byte>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeByteSeq(const Byte* begin, const Byte* end) { - _os.write(begin, end); + _os->write(begin, end); } void Ice::OutputStreamI::writeShort(Short v) { - _os.write(v); + _os->write(v); } void @@ -402,24 +401,24 @@ Ice::OutputStreamI::writeShortSeq(const vector<Short>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeShortSeq(const Short* begin, const Short* end) { - _os.write(begin, end); + _os->write(begin, end); } void Ice::OutputStreamI::writeInt(Int v) { - _os.write(v); + _os->write(v); } void @@ -427,24 +426,24 @@ Ice::OutputStreamI::writeIntSeq(const vector<Int>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeIntSeq(const Int* begin, const Int* end) { - _os.write(begin, end); + _os->write(begin, end); } void Ice::OutputStreamI::writeLong(Long v) { - _os.write(v); + _os->write(v); } void @@ -452,24 +451,24 @@ Ice::OutputStreamI::writeLongSeq(const vector<Long>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeLongSeq(const Long* begin, const Long* end) { - _os.write(begin, end); + _os->write(begin, end); } void Ice::OutputStreamI::writeFloat(Float v) { - _os.write(v); + _os->write(v); } void @@ -477,24 +476,24 @@ Ice::OutputStreamI::writeFloatSeq(const vector<Float>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeFloatSeq(const Float* begin, const Float* end) { - _os.write(begin, end); + _os->write(begin, end); } void Ice::OutputStreamI::writeDouble(Double v) { - _os.write(v); + _os->write(v); } void @@ -502,24 +501,24 @@ Ice::OutputStreamI::writeDoubleSeq(const vector<Double>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeDoubleSeq(const Double* begin, const Double* end) { - _os.write(begin, end); + _os->write(begin, end); } void Ice::OutputStreamI::writeString(const string& v) { - _os.write(v); + _os->write(v); } void @@ -527,18 +526,18 @@ Ice::OutputStreamI::writeStringSeq(const vector<string>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeWstring(const wstring& v) { - _os.write(v); + _os->write(v); } void @@ -546,105 +545,105 @@ Ice::OutputStreamI::writeWstringSeq(const vector<wstring>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeSize(Int sz) { - _os.writeSize(sz); + _os->writeSize(sz); } void Ice::OutputStreamI::writeProxy(const ObjectPrx& v) { - _os.write(v); + _os->write(v); } void Ice::OutputStreamI::writeObject(const ObjectPtr& v) { - _os.write(v); + _os->write(v); } void Ice::OutputStreamI::writeTypeId(const string& id) { - _os.writeTypeId(id); + _os->writeTypeId(id); } void Ice::OutputStreamI::writeException(const UserException& v) { - _os.write(v); + _os->write(v); } void Ice::OutputStreamI::startSlice() { - _os.startWriteSlice(); + _os->startWriteSlice(); } void Ice::OutputStreamI::endSlice() { - _os.endWriteSlice(); + _os->endWriteSlice(); } void Ice::OutputStreamI::startEncapsulation() { - _os.startWriteEncaps(); + _os->startWriteEncaps(); } void Ice::OutputStreamI::endEncapsulation() { - _os.endWriteEncaps(); + _os->endWriteEncaps(); } void Ice::OutputStreamI::writePendingObjects() { - _os.writePendingObjects(); + _os->writePendingObjects(); } void Ice::OutputStreamI::finished(vector<Byte>& bytes) { - vector<Byte>(_os.b.begin(), _os.b.end()).swap(bytes); + vector<Byte>(_os->b.begin(), _os->b.end()).swap(bytes); } // // ObjectReader // void -Ice::ObjectReader::__write(::IceInternal::BasicStream*) const +Ice::ObjectReader::__write(BasicStream*) const { assert(false); } void -Ice::ObjectReader::__read(::IceInternal::BasicStream* is, bool rid) +Ice::ObjectReader::__read(BasicStream* is, bool rid) { - IceInternal::BasicInputStream* bis = dynamic_cast<IceInternal::BasicInputStream*>(is); - assert(bis); - read(bis->_in, rid); + InputStreamI* stream = reinterpret_cast<InputStreamI*>(is->closure()); + assert(stream); + read(stream, rid); } void -Ice::ObjectReader::__write(const ::Ice::OutputStreamPtr&) const +Ice::ObjectReader::__write(const Ice::OutputStreamPtr&) const { assert(false); } void -Ice::ObjectReader::__read(const ::Ice::InputStreamPtr&, bool) +Ice::ObjectReader::__read(const Ice::InputStreamPtr&, bool) { assert(false); } @@ -653,27 +652,58 @@ Ice::ObjectReader::__read(const ::Ice::InputStreamPtr&, bool) // ObjectWriter // void -Ice::ObjectWriter::__write(::IceInternal::BasicStream* os) const +Ice::ObjectWriter::__write(BasicStream* os) const { - IceInternal::BasicOutputStream* bos = dynamic_cast<IceInternal::BasicOutputStream*>(os); - assert(bos); - write(bos->_out); + OutputStreamI* stream = reinterpret_cast<OutputStreamI*>(os->closure()); + assert(stream); + write(stream); } void -Ice::ObjectWriter::__read(::IceInternal::BasicStream*, bool) +Ice::ObjectWriter::__read(BasicStream*, bool) { assert(false); } void -Ice::ObjectWriter::__write(const ::Ice::OutputStreamPtr&) const +Ice::ObjectWriter::__write(const Ice::OutputStreamPtr&) const { assert(false); } void -Ice::ObjectWriter::__read(const ::Ice::InputStreamPtr&, bool) +Ice::ObjectWriter::__read(const Ice::InputStreamPtr&, bool) { assert(false); } + +// +// UserExceptionWriter +// +Ice::UserExceptionWriter::UserExceptionWriter(const Ice::CommunicatorPtr& communicator) : + _communicator(communicator) +{ +} + +Ice::UserExceptionWriter::~UserExceptionWriter() throw() +{ +} + +void +Ice::UserExceptionWriter::__write(BasicStream* os) const +{ + OutputStreamPtr stream = new OutputStreamI(_communicator, os); + write(stream); +} + +void +Ice::UserExceptionWriter::__read(BasicStream*, bool) +{ + assert(false); +} + +bool +Ice::UserExceptionWriter::__usesClasses() const +{ + return usesClasses(); +} diff --git a/cpp/src/Ice/StreamI.h b/cpp/src/Ice/StreamI.h index 70f5e8dd1c3..1f00533612d 100644 --- a/cpp/src/Ice/StreamI.h +++ b/cpp/src/Ice/StreamI.h @@ -13,48 +13,18 @@ #include <Ice/Stream.h> #include <Ice/BasicStream.h> -namespace IceInternal -{ - -// -// Subclass BasicStream in order to associate an InputStream with it. -// -class BasicInputStream : public BasicStream -{ -public: - - BasicInputStream(Instance*, Ice::InputStream*); - - Ice::InputStream* _in; -}; - -// -// Subclass BasicStream in order to associate an OutputStream with it. -// -class BasicOutputStream : public BasicStream -{ -public: - - BasicOutputStream(Instance*, Ice::OutputStream*); - - Ice::OutputStream* _out; -}; - -} - namespace Ice { // -// Implement InputStream as a wrapper around BasicInputStream. +// Implement InputStream as a wrapper around BasicStream. // class InputStreamI : public InputStream { public: - //InputStreamI(const IceInternal::InstancePtr&, const ::std::vector< ::Ice::Byte >&); - InputStreamI(const Ice::CommunicatorPtr&, const ::std::vector< ::Ice::Byte >&); - InputStreamI(const Ice::CommunicatorPtr&, const ::std::pair< const ::Ice::Byte*, const ::Ice::Byte* >&); + InputStreamI(const Ice::CommunicatorPtr&, const std::vector< Ice::Byte >&); + InputStreamI(const Ice::CommunicatorPtr&, const std::pair< const Ice::Byte*, const Ice::Byte* >&); virtual ~InputStreamI(); virtual Ice::CommunicatorPtr communicator() const; @@ -62,46 +32,46 @@ public: virtual void sliceObjects(bool); virtual bool readBool(); - virtual ::std::vector< bool > readBoolSeq(); - virtual bool* readBoolSeq(::std::pair<const bool*, const bool*>&); + virtual std::vector< bool > readBoolSeq(); + virtual bool* readBoolSeq(std::pair<const bool*, const bool*>&); - virtual ::Ice::Byte readByte(); - virtual ::std::vector< ::Ice::Byte > readByteSeq(); - virtual void readByteSeq(::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&); + virtual Ice::Byte readByte(); + virtual std::vector< Ice::Byte > readByteSeq(); + virtual void readByteSeq(std::pair<const Ice::Byte*, const Ice::Byte*>&); - virtual ::Ice::Short readShort(); - virtual ::std::vector< ::Ice::Short > readShortSeq(); - virtual ::Ice::Short* readShortSeq(::std::pair<const ::Ice::Short*, const ::Ice::Short*>&); + virtual Ice::Short readShort(); + virtual std::vector< Ice::Short > readShortSeq(); + virtual Ice::Short* readShortSeq(std::pair<const Ice::Short*, const Ice::Short*>&); - virtual ::Ice::Int readInt(); - virtual ::std::vector< ::Ice::Int > readIntSeq(); - virtual ::Ice::Int* readIntSeq(::std::pair<const ::Ice::Int*, const ::Ice::Int*>&); + virtual Ice::Int readInt(); + virtual std::vector< Ice::Int > readIntSeq(); + virtual Ice::Int* readIntSeq(std::pair<const Ice::Int*, const Ice::Int*>&); - virtual ::Ice::Long readLong(); - virtual ::std::vector< ::Ice::Long > readLongSeq(); - virtual ::Ice::Long* readLongSeq(::std::pair<const ::Ice::Long*, const ::Ice::Long*>&); + virtual Ice::Long readLong(); + virtual std::vector< Ice::Long > readLongSeq(); + virtual Ice::Long* readLongSeq(std::pair<const Ice::Long*, const Ice::Long*>&); - virtual ::Ice::Float readFloat(); - virtual ::std::vector< ::Ice::Float > readFloatSeq(); - virtual ::Ice::Float* readFloatSeq(::std::pair<const ::Ice::Float*, const ::Ice::Float*>&); + virtual Ice::Float readFloat(); + virtual std::vector< Ice::Float > readFloatSeq(); + virtual Ice::Float* readFloatSeq(std::pair<const Ice::Float*, const Ice::Float*>&); - virtual ::Ice::Double readDouble(); - virtual ::std::vector< ::Ice::Double > readDoubleSeq(); - virtual ::Ice::Double* readDoubleSeq(::std::pair<const ::Ice::Double*, const ::Ice::Double*>&); + virtual Ice::Double readDouble(); + virtual std::vector< Ice::Double > readDoubleSeq(); + virtual Ice::Double* readDoubleSeq(std::pair<const Ice::Double*, const Ice::Double*>&); - virtual ::std::string readString(); - virtual ::std::vector< ::std::string > readStringSeq(); + virtual std::string readString(); + virtual std::vector< std::string > readStringSeq(); - virtual ::std::wstring readWstring(); - virtual ::std::vector< ::std::wstring > readWstringSeq(); + virtual std::wstring readWstring(); + virtual std::vector< std::wstring > readWstringSeq(); - virtual ::Ice::Int readSize(); + virtual Ice::Int readSize(); - virtual ::Ice::ObjectPrx readProxy(); + virtual Ice::ObjectPrx readProxy(); - virtual void readObject(const ::Ice::ReadObjectCallbackPtr&); + virtual void readObject(const Ice::ReadObjectCallbackPtr&); - virtual ::std::string readTypeId(); + virtual std::string readTypeId(); virtual void throwException(); @@ -117,66 +87,65 @@ public: private: Ice::CommunicatorPtr _communicator; - IceInternal::BasicInputStream _is; - ::std::vector< ReadObjectCallbackPtr > _callbacks; + IceInternal::BasicStream* _is; + std::vector< ReadObjectCallbackPtr > _callbacks; }; // -// Implement OutputStream as a wrapper around BasicOutputStream. +// Implement OutputStream as a wrapper around BasicStream. // class OutputStreamI : public OutputStream { public: - //OutputStreamI(const IceInternal::InstancePtr&); - OutputStreamI(const Ice::CommunicatorPtr&); + OutputStreamI(const Ice::CommunicatorPtr&, IceInternal::BasicStream* = 0); virtual ~OutputStreamI(); virtual Ice::CommunicatorPtr communicator() const; virtual void writeBool(bool); - virtual void writeBoolSeq(const ::std::vector< bool >&); + virtual void writeBoolSeq(const std::vector< bool >&); virtual void writeBoolSeq(const bool*, const bool*); - virtual void writeByte(::Ice::Byte); - virtual void writeByteSeq(const ::std::vector< ::Ice::Byte >&); + virtual void writeByte(Ice::Byte); + virtual void writeByteSeq(const std::vector< Ice::Byte >&); virtual void writeByteSeq(const Ice::Byte*, const Ice::Byte*); - virtual void writeShort(::Ice::Short); - virtual void writeShortSeq(const ::std::vector< ::Ice::Short >&); + virtual void writeShort(Ice::Short); + virtual void writeShortSeq(const std::vector< Ice::Short >&); virtual void writeShortSeq(const Ice::Short*, const Ice::Short*); - virtual void writeInt(::Ice::Int); - virtual void writeIntSeq(const ::std::vector< ::Ice::Int >&); + virtual void writeInt(Ice::Int); + virtual void writeIntSeq(const std::vector< Ice::Int >&); virtual void writeIntSeq(const Ice::Int*, const Ice::Int*); - virtual void writeLong(::Ice::Long); - virtual void writeLongSeq(const ::std::vector< ::Ice::Long >&); + virtual void writeLong(Ice::Long); + virtual void writeLongSeq(const std::vector< Ice::Long >&); virtual void writeLongSeq(const Ice::Long*, const Ice::Long*); - virtual void writeFloat(::Ice::Float); - virtual void writeFloatSeq(const ::std::vector< ::Ice::Float >&); + virtual void writeFloat(Ice::Float); + virtual void writeFloatSeq(const std::vector< Ice::Float >&); virtual void writeFloatSeq(const Ice::Float*, const Ice::Float*); - virtual void writeDouble(::Ice::Double); - virtual void writeDoubleSeq(const ::std::vector< ::Ice::Double >&); + virtual void writeDouble(Ice::Double); + virtual void writeDoubleSeq(const std::vector< Ice::Double >&); virtual void writeDoubleSeq(const Ice::Double*, const Ice::Double*); - virtual void writeString(const ::std::string&); - virtual void writeStringSeq(const ::std::vector< ::std::string >&); + virtual void writeString(const std::string&); + virtual void writeStringSeq(const std::vector< std::string >&); - virtual void writeWstring(const ::std::wstring&); - virtual void writeWstringSeq(const ::std::vector< ::std::wstring >&); + virtual void writeWstring(const std::wstring&); + virtual void writeWstringSeq(const std::vector< std::wstring >&); - virtual void writeSize(::Ice::Int); + virtual void writeSize(Ice::Int); - virtual void writeProxy(const ::Ice::ObjectPrx&); + virtual void writeProxy(const Ice::ObjectPrx&); - virtual void writeObject(const ::Ice::ObjectPtr&); + virtual void writeObject(const Ice::ObjectPtr&); - virtual void writeTypeId(const ::std::string&); + virtual void writeTypeId(const std::string&); - virtual void writeException(const ::Ice::UserException&); + virtual void writeException(const Ice::UserException&); virtual void startSlice(); virtual void endSlice(); @@ -186,12 +155,13 @@ public: virtual void writePendingObjects(); - virtual void finished(::std::vector< ::Ice::Byte >&); + virtual void finished(std::vector< Ice::Byte >&); private: Ice::CommunicatorPtr _communicator; - IceInternal::BasicOutputStream _os; + IceInternal::BasicStream* _os; + bool _own; }; } diff --git a/cpp/src/IceBox/.depend b/cpp/src/IceBox/.depend index 08ef071fc57..d6ecce1b3c5 100644 --- a/cpp/src/IceBox/.depend +++ b/cpp/src/IceBox/.depend @@ -3,5 +3,5 @@ Exception$(OBJEXT): Exception.cpp ../../include/IceBox/IceBox.h ../../include/Ic ServiceManagerI$(OBJEXT): ServiceManagerI.cpp ../../include/IceUtil/DisableWarnings.h ../../include/IceUtil/Options.h ../../include/IceUtil/Config.h ../../include/IceUtil/RecMutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Handle.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../../include/Ice/DynamicLibrary.h ../../include/Ice/DynamicLibraryF.h ../../include/Ice/SliceChecksums.h ../../include/Ice/SliceChecksumDict.h ../IceBox/ServiceManagerI.h ../../include/IceBox/IceBox.h Service$(OBJEXT): Service.cpp ../../include/IceUtil/Options.h ../../include/IceUtil/Config.h ../../include/IceUtil/RecMutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Handle.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../../include/Ice/Service.h ../IceBox/ServiceManagerI.h ../../include/IceBox/IceBox.h ../../include/Ice/SliceChecksumDict.h ../../include/Ice/DynamicLibraryF.h Admin$(OBJEXT): Admin.cpp ../../include/Ice/Application.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../../include/Ice/SliceChecksums.h ../../include/Ice/SliceChecksumDict.h ../../include/IceUtil/Options.h ../../include/IceBox/IceBox.h -IceBox.cpp: ../../slice/IceBox/IceBox.ice ../../slice/Ice/BuiltinSequences.ice ../../slice/Ice/CommunicatorF.ice ../../slice/Ice/PropertiesF.ice ../../slice/Ice/SliceChecksumDict.ice -../../slice/IceBox/IceBox.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +IceBox.cpp: ../../../slice/IceBox/IceBox.ice ../../../slice/Ice/BuiltinSequences.ice ../../../slice/Ice/CommunicatorF.ice ../../../slice/Ice/PropertiesF.ice ../../../slice/Ice/SliceChecksumDict.ice +../../../slice/IceBox/IceBox.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/src/IceGrid/.depend b/cpp/src/IceGrid/.depend index 9ae6fec9d6c..9b79b29fe88 100644 --- a/cpp/src/IceGrid/.depend +++ b/cpp/src/IceGrid/.depend @@ -60,25 +60,25 @@ ReplicaSessionManager$(OBJEXT): ReplicaSessionManager.cpp ../../include/Ice/Ice. WellKnownObjectsManager$(OBJEXT): WellKnownObjectsManager.cpp ../../include/Glacier2/PermissionsVerifier.h ../../include/Ice/LocalObjectF.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/CommunicatorF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/Ice/StringConverter.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Glacier2/SSLInfo.h ../../include/Ice/BuiltinSequences.h ../IceGrid/WellKnownObjectsManager.h ../IceGrid/Internal.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Locator.h ../../include/Ice/Properties.h ../../include/Glacier2/Session.h ../../include/IceGrid/Admin.h ../../include/Ice/SliceChecksumDict.h ../../include/IceGrid/Exception.h ../../include/IceGrid/Descriptor.h ../../include/IceGrid/Observer.h ../../include/IceGrid/Registry.h ../../include/IceGrid/Session.h ../IceGrid/Database.h ../../include/Freeze/ConnectionF.h ../IceGrid/StringApplicationInfoDict.h ../../include/Freeze/Map.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/PropertiesF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/LocalException.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../../include/Freeze/DB.h ../../include/Freeze/Exception.h ../../include/Freeze/Connection.h ../../include/Freeze/Transaction.h ../IceGrid/IdentityObjectInfoDict.h ../IceGrid/StringAdapterInfoDict.h ../IceGrid/ServerCache.h ../../include/IceGrid/Query.h ../IceGrid/Allocatable.h ../../include/IceUtil/Timer.h ../../include/IceUtil/Thread.h ../IceGrid/Cache.h ../IceGrid/Util.h ../../include/IceUtil/StringUtil.h ../../include/IceUtil/Random.h ../IceGrid/TraceLevels.h ../IceGrid/NodeCache.h ../IceGrid/ReplicaCache.h ../../include/IceStorm/IceStorm.h ../IceGrid/ObjectCache.h ../IceGrid/AllocatableObjectCache.h ../IceGrid/AdapterCache.h ../IceGrid/Topics.h IceGridNode$(OBJEXT): IceGridNode.cpp ../../include/IceUtil/UUID.h ../../include/IceUtil/Config.h ../../include/IceUtil/Timer.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Thread.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../../include/Ice/Service.h ../IceGrid/Activator.h ../IceGrid/Internal.h ../../include/Glacier2/Session.h ../../include/Glacier2/SSLInfo.h ../../include/IceGrid/Admin.h ../../include/Ice/SliceChecksumDict.h ../../include/IceGrid/Exception.h ../../include/IceGrid/Descriptor.h ../../include/IceGrid/Observer.h ../../include/IceGrid/Registry.h ../../include/IceGrid/Session.h ../IceGrid/RegistryI.h ../../include/IceGrid/Query.h ../../include/IceGrid/Locator.h ../IceGrid/PlatformInfo.h ../IceGrid/ReplicaSessionManager.h ../IceGrid/SessionManager.h ../../include/Glacier2/PermissionsVerifierF.h ../../include/IceStorm/Service.h ../../include/IceBox/IceBox.h ../../include/IceStorm/IceStorm.h ../IceGrid/FileUserAccountMapperI.h ../../include/IceGrid/UserAccountMapper.h ../IceGrid/NodeI.h ../../include/IcePatch2/FileServer.h ../../include/IcePatch2/FileInfo.h ../IceGrid/FileCache.h ../IceGrid/NodeSessionManager.h ../IceGrid/TraceLevels.h ../IceGrid/DescriptorParser.h ../../include/IcePatch2/Util.h IceGridRegistry$(OBJEXT): IceGridRegistry.cpp ../../include/IceUtil/Options.h ../../include/IceUtil/Config.h ../../include/IceUtil/RecMutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Handle.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../../include/Ice/Service.h ../IceGrid/RegistryI.h ../../include/IceUtil/Timer.h ../../include/IceUtil/Thread.h ../../include/IceGrid/Registry.h ../../include/IceGrid/Exception.h ../../include/IceGrid/Session.h ../../include/Glacier2/Session.h ../../include/Glacier2/SSLInfo.h ../../include/IceGrid/Admin.h ../../include/Ice/SliceChecksumDict.h ../../include/IceGrid/Descriptor.h ../../include/IceGrid/Query.h ../../include/IceGrid/Locator.h ../IceGrid/Internal.h ../../include/IceGrid/Observer.h ../IceGrid/PlatformInfo.h ../IceGrid/ReplicaSessionManager.h ../IceGrid/SessionManager.h ../../include/Glacier2/PermissionsVerifierF.h ../../include/IceStorm/Service.h ../../include/IceBox/IceBox.h ../../include/IceStorm/IceStorm.h ../IceGrid/TraceLevels.h -Admin.cpp: ../../slice/IceGrid/Admin.ice ../../slice/Ice/Identity.ice ../../slice/Ice/BuiltinSequences.ice ../../slice/Ice/Properties.ice ../../slice/Ice/SliceChecksumDict.ice ../../slice/Glacier2/Session.ice ../../slice/Glacier2/SSLInfo.ice ../../slice/IceGrid/Exception.ice ../../slice/IceGrid/Descriptor.ice -Exception.cpp: ../../slice/IceGrid/Exception.ice ../../slice/Ice/Identity.ice ../../slice/Ice/BuiltinSequences.ice -FileParser.cpp: ../../slice/IceGrid/FileParser.ice ../../slice/IceGrid/Admin.ice ../../slice/Ice/Identity.ice ../../slice/Ice/BuiltinSequences.ice ../../slice/Ice/Properties.ice ../../slice/Ice/SliceChecksumDict.ice ../../slice/Glacier2/Session.ice ../../slice/Glacier2/SSLInfo.ice ../../slice/IceGrid/Exception.ice ../../slice/IceGrid/Descriptor.ice -Locator.cpp: ../../slice/IceGrid/Locator.ice ../../slice/Ice/Locator.ice ../../slice/Ice/Identity.ice ../../slice/Ice/ProcessF.ice -Query.cpp: ../../slice/IceGrid/Query.ice ../../slice/Ice/Identity.ice ../../slice/Ice/BuiltinSequences.ice ../../slice/IceGrid/Exception.ice -Registry.cpp: ../../slice/IceGrid/Registry.ice ../../slice/IceGrid/Exception.ice ../../slice/Ice/Identity.ice ../../slice/Ice/BuiltinSequences.ice ../../slice/IceGrid/Session.ice ../../slice/Glacier2/Session.ice ../../slice/Glacier2/SSLInfo.ice ../../slice/IceGrid/Admin.ice ../../slice/Ice/Properties.ice ../../slice/Ice/SliceChecksumDict.ice ../../slice/IceGrid/Descriptor.ice -Session.cpp: ../../slice/IceGrid/Session.ice ../../slice/Glacier2/Session.ice ../../slice/Ice/BuiltinSequences.ice ../../slice/Ice/Identity.ice ../../slice/Glacier2/SSLInfo.ice ../../slice/IceGrid/Exception.ice -Observer.cpp: ../../slice/IceGrid/Observer.ice ../../slice/Glacier2/Session.ice ../../slice/Ice/BuiltinSequences.ice ../../slice/Ice/Identity.ice ../../slice/Glacier2/SSLInfo.ice ../../slice/IceGrid/Exception.ice ../../slice/IceGrid/Descriptor.ice ../../slice/IceGrid/Admin.ice ../../slice/Ice/Properties.ice ../../slice/Ice/SliceChecksumDict.ice -Descriptor.cpp: ../../slice/IceGrid/Descriptor.ice ../../slice/Ice/Identity.ice ../../slice/Ice/BuiltinSequences.ice -UserAccountMapper.cpp: ../../slice/IceGrid/UserAccountMapper.ice -Internal.cpp: ../IceGrid/Internal.ice ../../slice/Ice/Identity.ice ../../slice/Ice/BuiltinSequences.ice ../../slice/Ice/ProcessF.ice ../../slice/Ice/Locator.ice ../../slice/Ice/Properties.ice ../../slice/Glacier2/Session.ice ../../slice/Glacier2/SSLInfo.ice ../../slice/IceGrid/Admin.ice ../../slice/Ice/SliceChecksumDict.ice ../../slice/IceGrid/Exception.ice ../../slice/IceGrid/Descriptor.ice ../../slice/IceGrid/Observer.ice ../../slice/IceGrid/Registry.ice ../../slice/IceGrid/Session.ice -../../slice/IceGrid/Admin.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/IceGrid/Exception.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/IceGrid/FileParser.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/IceGrid/Locator.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/IceGrid/Query.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/IceGrid/Registry.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/IceGrid/Session.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/IceGrid/Observer.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/IceGrid/Descriptor.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/IceGrid/UserAccountMapper.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +Admin.cpp: ../../../slice/IceGrid/Admin.ice ../../../slice/Ice/Identity.ice ../../../slice/Ice/BuiltinSequences.ice ../../../slice/Ice/Properties.ice ../../../slice/Ice/SliceChecksumDict.ice ../../../slice/Glacier2/Session.ice ../../../slice/Glacier2/SSLInfo.ice ../../../slice/IceGrid/Exception.ice ../../../slice/IceGrid/Descriptor.ice +Exception.cpp: ../../../slice/IceGrid/Exception.ice ../../../slice/Ice/Identity.ice ../../../slice/Ice/BuiltinSequences.ice +FileParser.cpp: ../../../slice/IceGrid/FileParser.ice ../../../slice/IceGrid/Admin.ice ../../../slice/Ice/Identity.ice ../../../slice/Ice/BuiltinSequences.ice ../../../slice/Ice/Properties.ice ../../../slice/Ice/SliceChecksumDict.ice ../../../slice/Glacier2/Session.ice ../../../slice/Glacier2/SSLInfo.ice ../../../slice/IceGrid/Exception.ice ../../../slice/IceGrid/Descriptor.ice +Locator.cpp: ../../../slice/IceGrid/Locator.ice ../../../slice/Ice/Locator.ice ../../../slice/Ice/Identity.ice ../../../slice/Ice/ProcessF.ice +Query.cpp: ../../../slice/IceGrid/Query.ice ../../../slice/Ice/Identity.ice ../../../slice/Ice/BuiltinSequences.ice ../../../slice/IceGrid/Exception.ice +Registry.cpp: ../../../slice/IceGrid/Registry.ice ../../../slice/IceGrid/Exception.ice ../../../slice/Ice/Identity.ice ../../../slice/Ice/BuiltinSequences.ice ../../../slice/IceGrid/Session.ice ../../../slice/Glacier2/Session.ice ../../../slice/Glacier2/SSLInfo.ice ../../../slice/IceGrid/Admin.ice ../../../slice/Ice/Properties.ice ../../../slice/Ice/SliceChecksumDict.ice ../../../slice/IceGrid/Descriptor.ice +Session.cpp: ../../../slice/IceGrid/Session.ice ../../../slice/Glacier2/Session.ice ../../../slice/Ice/BuiltinSequences.ice ../../../slice/Ice/Identity.ice ../../../slice/Glacier2/SSLInfo.ice ../../../slice/IceGrid/Exception.ice +Observer.cpp: ../../../slice/IceGrid/Observer.ice ../../../slice/Glacier2/Session.ice ../../../slice/Ice/BuiltinSequences.ice ../../../slice/Ice/Identity.ice ../../../slice/Glacier2/SSLInfo.ice ../../../slice/IceGrid/Exception.ice ../../../slice/IceGrid/Descriptor.ice ../../../slice/IceGrid/Admin.ice ../../../slice/Ice/Properties.ice ../../../slice/Ice/SliceChecksumDict.ice +Descriptor.cpp: ../../../slice/IceGrid/Descriptor.ice ../../../slice/Ice/Identity.ice ../../../slice/Ice/BuiltinSequences.ice +UserAccountMapper.cpp: ../../../slice/IceGrid/UserAccountMapper.ice +Internal.cpp: ../IceGrid/Internal.ice ../../../slice/Ice/Identity.ice ../../../slice/Ice/BuiltinSequences.ice ../../../slice/Ice/ProcessF.ice ../../../slice/Ice/Locator.ice ../../../slice/Ice/Properties.ice ../../../slice/Glacier2/Session.ice ../../../slice/Glacier2/SSLInfo.ice ../../../slice/IceGrid/Admin.ice ../../../slice/Ice/SliceChecksumDict.ice ../../../slice/IceGrid/Exception.ice ../../../slice/IceGrid/Descriptor.ice ../../../slice/IceGrid/Observer.ice ../../../slice/IceGrid/Registry.ice ../../../slice/IceGrid/Session.ice +../../../slice/IceGrid/Admin.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/IceGrid/Exception.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/IceGrid/FileParser.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/IceGrid/Locator.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/IceGrid/Query.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/IceGrid/Registry.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/IceGrid/Session.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/IceGrid/Observer.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/IceGrid/Descriptor.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/IceGrid/UserAccountMapper.ice: $(SLICE2CPP) $(SLICEPARSERLIB) ../IceGrid/Internal.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/src/IceGrid/Makefile b/cpp/src/IceGrid/Makefile index 4797a30ccba..2ac5cac452e 100644 --- a/cpp/src/IceGrid/Makefile +++ b/cpp/src/IceGrid/Makefile @@ -172,7 +172,7 @@ $(LOCAL_HDIR)/IdentityObjectInfoDict.h IdentityObjectInfoDict.cpp: $(SLICE2FREEZ rm -f IdentityObjectInfoDict.h IdentityObjectInfoDict.cpp $(SLICE2FREEZECMD) --dict IceGrid::IdentityObjectInfoDict,Ice::Identity,IceGrid::ObjectInfo \ --dict-index IceGrid::IdentityObjectInfoDict,type \ - IdentityObjectInfoDict ../../slice/Ice/Identity.ice $(LOCAL_SDIR)/Internal.ice + IdentityObjectInfoDict $(slicedir)/Ice/Identity.ice $(LOCAL_SDIR)/Internal.ice clean:: rm -f IdentityObjectInfoDict.h IdentityObjectInfoDict.cpp diff --git a/cpp/src/IceGrid/Makefile.mak b/cpp/src/IceGrid/Makefile.mak index 58b033ff7c7..cb3cdda02cc 100644 --- a/cpp/src/IceGrid/Makefile.mak +++ b/cpp/src/IceGrid/Makefile.mak @@ -182,7 +182,7 @@ IdentityObjectInfoDict.h IdentityObjectInfoDict.cpp: $(SLICE2FREEZE) del /q IdentityObjectInfoDict.h IdentityObjectInfoDict.cpp $(SLICE2FREEZECMD) --dict IceGrid::IdentityObjectInfoDict,Ice::Identity,IceGrid::ObjectInfo \ --dict-index IceGrid::IdentityObjectInfoDict,type \ - IdentityObjectInfoDict ..\..\slice\Ice\Identity.ice Internal.ice + IdentityObjectInfoDict $(slicedir)\Ice\Identity.ice Internal.ice StringAdapterInfoDict.h StringAdapterInfoDict.cpp: $(SLICE2FREEZE) del /q StringAdapterInfoDict.h StringAdapterInfoDict.cpp diff --git a/cpp/src/IcePatch2/.depend b/cpp/src/IcePatch2/.depend index a20d8adf588..16d4f61609a 100644 --- a/cpp/src/IcePatch2/.depend +++ b/cpp/src/IcePatch2/.depend @@ -7,7 +7,7 @@ Server$(OBJEXT): Server.cpp ../../include/IceUtil/Options.h ../../include/IceUti FileServerI$(OBJEXT): FileServerI.cpp ../../include/IceUtil/DisableWarnings.h ../../include/IceUtil/ScopedArray.h ../../include/IceUtil/Config.h ../../include/IceUtil/Unicode.h ../../include/IceUtil/Exception.h ../IcePatch2/FileServerI.h ../../include/IcePatch2/Util.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/IceUtil/Shared.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../../include/IcePatch2/FileInfo.h ../../include/IcePatch2/FileServer.h ./OS.h Client$(OBJEXT): Client.cpp ../../include/IceUtil/Options.h ../../include/IceUtil/Config.h ../../include/IceUtil/RecMutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Handle.h ../../include/Ice/Application.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../../include/IcePatch2/Util.h ../../include/IcePatch2/FileInfo.h ../../include/IcePatch2/ClientUtil.h ../../include/IceUtil/Thread.h ../../include/IcePatch2/FileServer.h Calc$(OBJEXT): Calc.cpp ../../include/IceUtil/Options.h ../../include/IceUtil/Config.h ../../include/IceUtil/RecMutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Unicode.h ../../include/IcePatch2/Util.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../../include/IcePatch2/FileInfo.h ./OS.h -FileInfo.cpp: ../../slice/IcePatch2/FileInfo.ice ../../slice/Ice/BuiltinSequences.ice -FileServer.cpp: ../../slice/IcePatch2/FileServer.ice ../../slice/IcePatch2/FileInfo.ice ../../slice/Ice/BuiltinSequences.ice -../../slice/IcePatch2/FileInfo.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -../../slice/IcePatch2/FileServer.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +FileInfo.cpp: ../../../slice/IcePatch2/FileInfo.ice ../../../slice/Ice/BuiltinSequences.ice +FileServer.cpp: ../../../slice/IcePatch2/FileServer.ice ../../../slice/IcePatch2/FileInfo.ice ../../../slice/Ice/BuiltinSequences.ice +../../../slice/IcePatch2/FileInfo.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +../../../slice/IcePatch2/FileServer.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/src/IceStorm/.depend b/cpp/src/IceStorm/.depend index 729725c51e3..d2ac7bf2a27 100644 --- a/cpp/src/IceStorm/.depend +++ b/cpp/src/IceStorm/.depend @@ -15,9 +15,9 @@ Admin$(OBJEXT): Admin.cpp ../../include/IceUtil/DisableWarnings.h ../../include/ Grammar$(OBJEXT): Grammar.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../IceStorm/Parser.h ../../include/IceStorm/IceStorm.h ../../include/Ice/SliceChecksumDict.h Scanner$(OBJEXT): Scanner.cpp ../../include/IceUtil/Config.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/IceUtil/Shared.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../IceStorm/Parser.h ../../include/IceStorm/IceStorm.h ../../include/Ice/SliceChecksumDict.h ../IceStorm/Grammar.h Parser$(OBJEXT): Parser.cpp ../../include/IceUtil/DisableWarnings.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyF.h ../../include/Ice/ObjectF.h ../../include/Ice/GCCountMap.h ../../include/Ice/GCShared.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/UndefSysMacros.h ../../include/Ice/PropertiesF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionIF.h ../../include/Ice/EndpointIF.h ../../include/Ice/Endpoint.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/ConnectionF.h ../../include/Ice/Identity.h ../../include/Ice/StreamF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../../include/Ice/StringConverter.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Protocol.h ../../include/IceUtil/Unicode.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ImplicitContextF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/FacetMap.h ../../include/Ice/ServantLocator.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/Ice/Connection.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../../include/Ice/Stream.h ../../include/Ice/ImplicitContext.h ../../include/Ice/Locator.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/ProcessF.h ../../include/Ice/Router.h ../../include/Ice/DispatchInterceptor.h ../../include/Ice/IconvStringConverter.h ../IceStorm/Parser.h ../../include/IceStorm/IceStorm.h ../../include/Ice/SliceChecksumDict.h -IceStorm.cpp: ../../slice/IceStorm/IceStorm.ice ../../slice/Ice/SliceChecksumDict.ice ../../slice/Ice/Identity.ice -IceStormInternal.cpp: ../IceStorm/IceStormInternal.ice ../../slice/IceStorm/IceStorm.ice ../../slice/Ice/SliceChecksumDict.ice ../../slice/Ice/Identity.ice ../../slice/Ice/Current.ice ../../slice/Ice/ObjectAdapterF.ice ../../slice/Ice/ConnectionF.ice ../../slice/Ice/BuiltinSequences.ice -LinkRecord.cpp: ../IceStorm/LinkRecord.ice ../../slice/Ice/Identity.ice -../../slice/IceStorm/IceStorm.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +IceStorm.cpp: ../../../slice/IceStorm/IceStorm.ice ../../../slice/Ice/SliceChecksumDict.ice ../../../slice/Ice/Identity.ice +IceStormInternal.cpp: ../IceStorm/IceStormInternal.ice ../../../slice/IceStorm/IceStorm.ice ../../../slice/Ice/SliceChecksumDict.ice ../../../slice/Ice/Identity.ice ../../../slice/Ice/Current.ice ../../../slice/Ice/ObjectAdapterF.ice ../../../slice/Ice/ConnectionF.ice ../../../slice/Ice/BuiltinSequences.ice +LinkRecord.cpp: ../IceStorm/LinkRecord.ice ../../../slice/Ice/Identity.ice +../../../slice/IceStorm/IceStorm.ice: $(SLICE2CPP) $(SLICEPARSERLIB) ../IceStorm/IceStormInternal.ice: $(SLICE2CPP) $(SLICEPARSERLIB) ../IceStorm/LinkRecord.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/src/Makefile b/cpp/src/Makefile index f10713a66e6..497ce1253e0 100644 --- a/cpp/src/Makefile +++ b/cpp/src/Makefile @@ -16,7 +16,6 @@ SUBDIRS = IceUtil \ Slice \ slice2cpp \ slice2cs \ - slice2vb \ slice2freeze \ slice2freezej \ slice2docbook \ diff --git a/cpp/src/Makefile.mak b/cpp/src/Makefile.mak index c4e20148afe..04cb6872dee 100644 --- a/cpp/src/Makefile.mak +++ b/cpp/src/Makefile.mak @@ -19,7 +19,6 @@ SUBDIRS = $(SUBDIRS) IceUtil \ Slice \ slice2cpp \ slice2cs \ - slice2vb \ slice2freeze \ slice2freezej \ slice2docbook \ @@ -39,6 +38,7 @@ SUBDIRS = $(SUBDIRS) IceUtil \ FreezeScript \ IceStorm \ IceGrid \ + iceserviceinstall \ ca $(EVERYTHING):: diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp index 4290a7a1b8b..ae9ed24bc11 100755 --- a/cpp/src/Slice/CsUtil.cpp +++ b/cpp/src/Slice/CsUtil.cpp @@ -416,7 +416,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out, if(isOutParam) { out << nl << "IceInternal.ParamPatcher<Ice.Object> " << param - << "_PP = new IceInternal.ParamPatcher<Ice.Object>();"; + << "_PP = new IceInternal.ParamPatcher<Ice.Object>(\"::Ice::Object\");"; out << nl << stream << ".readObject("; if(streamingAPI) { @@ -431,7 +431,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out, { out << "(Ice.ReadObjectCallback)"; } - out << "new Patcher__(" << patchParams << "));"; + out << "new Patcher__(\"::Ice::Object\", " << patchParams << "));"; } } break; @@ -494,9 +494,9 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out, { if(isOutParam) { - ContainedPtr contained = ContainedPtr::dynamicCast(type); out << nl << "IceInternal.ParamPatcher<" << typeToString(type) << ">" << param - << "_PP = new IceInternal.ParamPatcher<" << typeToString(type) << ">();"; + << "_PP = new IceInternal.ParamPatcher<" << typeToString(type) << ">(\"" + << cl->scoped() << "\");"; out << nl << stream << ".readObject("; if(streamingAPI) { @@ -511,7 +511,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out, { out << "(Ice.ReadObjectCallback)"; } - out << "new Patcher__(" << patchParams << "));"; + out << "new Patcher__(\"" << cl->scoped() << "\", " << patchParams << "));"; } } return; @@ -802,7 +802,8 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, { patcherName = "Sequence"; } - out << "new IceInternal." << patcherName << "Patcher<Ice.Object>(" << param << ", ix__));"; + out << "new IceInternal." << patcherName << "Patcher<Ice.Object>(\"::Ice::Object\", " + << param << ", ix__));"; } else { @@ -994,8 +995,9 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, { patcherName = "Sequence"; } + string scoped = ContainedPtr::dynamicCast(type)->scoped(); out << nl << "IceInternal." << patcherName << "Patcher<" << typeS << "> spx = new IceInternal." - << patcherName << "Patcher<" << typeS << ">(" << param << ", ix__);"; + << patcherName << "Patcher<" << typeS << ">(\"" << scoped << "\", " << param << ", ix__);"; out << nl << stream << ".readObject("; if(streamingAPI) { diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp index 8f27fb78708..a116b1a7a95 100644 --- a/cpp/src/Slice/JavaUtil.cpp +++ b/cpp/src/Slice/JavaUtil.cpp @@ -3442,6 +3442,17 @@ Slice::JavaGenerator::MetaDataVisitor::visitStructStart(const StructPtr& p) void Slice::JavaGenerator::MetaDataVisitor::visitOperation(const OperationPtr& p) { + if(p->hasMetaData("UserException")) + { + ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container()); + if(!cl->isLocal()) + { + cout << p->definitionContext()->filename() << ":" << p->line() + << ": warning: metadata directive `UserException' applies only to local operations " + << "but enclosing " << (cl->isInterface() ? "interface" : "class") << "`" << cl->name() + << "' is not local" << endl; + } + } StringList metaData = getMetaData(p); TypePtr returnType = p->returnType(); if(!metaData.empty()) diff --git a/cpp/src/iceserviceinstall/.depend b/cpp/src/iceserviceinstall/.depend new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/cpp/src/iceserviceinstall/.depend diff --git a/cpp/src/iceserviceinstall/Install.cpp b/cpp/src/iceserviceinstall/Install.cpp new file mode 100755 index 00000000000..336e4a3b820 --- /dev/null +++ b/cpp/src/iceserviceinstall/Install.cpp @@ -0,0 +1,202 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution.que +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <IceUtil/Options.h> +#include <ServiceInstaller.h> + +using namespace std; +using namespace Ice; + +class Install : public Application +{ +public: + virtual int run(int, char*[]); + + Install(); + + bool pauseEnabled() const; + bool debug() const; + +private: + + void usage() const; + + bool _debug; + bool _pauseEnabled; +}; + +int +main(int argc, char* argv[]) +{ + Install app; + int status = app.main(argc, argv); + + if(app.pauseEnabled() && (app.debug() || status != 0)) + { + system("pause"); + } + + return status; +} + +int +Install::run(int argc, char* argv[]) +{ + IceUtil::Options opts; + opts.addOpt("h", "help"); + opts.addOpt("v", "version"); + opts.addOpt("u", "uninstall"); + opts.addOpt("n", "nopause"); + + vector<string> propNames = IceServiceInstaller::getPropertyNames(); + + for(size_t i = 0; i < propNames.size(); ++i) + { + opts.addOpt("", propNames[i], IceUtil::Options::NeedArg); + } + + vector<string> commands; + try + { + commands = opts.parse(argc, argv); + } + catch(const IceUtil::BadOptException& e) + { + cerr << "Error:" << e.reason << endl; + usage(); + return EXIT_FAILURE; + } + + if(opts.isSet("help")) + { + usage(); + return EXIT_SUCCESS; + } + if(opts.isSet("version")) + { + cout << ICE_STRING_VERSION << endl; + return EXIT_SUCCESS; + } + + _pauseEnabled = !opts.isSet("nopause"); + + if(commands.size() != 2) + { + usage(); + return EXIT_FAILURE; + } + + int serviceType = -1; + for(int j = 0; j < IceServiceInstaller::serviceCount; ++j) + { + if(commands[0] == IceServiceInstaller::serviceTypeToLowerString(j)) + { + serviceType = j; + break; // for + } + } + + if(serviceType == -1) + { + cerr << "Invalid service " << commands[0] << endl; + return EXIT_FAILURE; + } + + string configFile = commands[1]; + + try + { + IceServiceInstaller installer(serviceType, configFile, communicator()); + + if(opts.isSet("uninstall")) + { + installer.uninstall(); + } + else + { + PropertiesPtr properties = communicator()->getProperties(); + + for(size_t j = 0; j < propNames.size(); ++j) + { + if(opts.isSet(propNames[j])) + { + properties->setProperty(propNames[j], opts.optArg(propNames[j])); + } + } + + _debug = properties->getPropertyAsInt("Debug") != 0; + + installer.install(properties); + } + } + catch(const string& msg) + { + cerr << "Error: " << msg << endl; + return EXIT_FAILURE; + } + catch(const Ice::Exception& ex) + { + cerr << "Error: " << ex << endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} + +Install::Install() : + _pauseEnabled(true), + _debug(false) +{ +} + +bool +Install::pauseEnabled() const +{ + return _pauseEnabled; +} + +bool +Install::debug() const +{ + return _debug; +} + +void +Install::usage() const +{ + cerr << "Usage: " << appName() + << " [options] service config-file [property] [property]\n"; + cerr << + "Options:\n" + "-h, --help Show this message.\n" + "-n, --nopause Do not call pause after displaying a message.\n" + "-v, --version Display the Ice version.\n" + "-u, --uninstall Uninstall the Windows service.\n" + "\n" + "service must be icegridregistry, icegridnode or glacier2router.\n" + "\n" + "config-file Path to the Ice configuration file for this service.\n" + "\n" + "Valid properties:\n" + "ImagePath Full path to <service>.exe. The default value is\n" + " <directory of " << appName() << ">\\<service>.exe\n" + "DisplayName Display name for the service\n" + "Description Description for the service\n" + "AutoStart When non 0, the service is started automatically when\n" + " the computer starts up. The default value is 1\n" + "ObjectName Account used to run the service. Defaults to\n" + " NT Authority\\LocalService\n" + "Password Password for ObjectName\n" + "DependOnRegistry When non 0, the service depends on the IceGrid registry\n" + " service (the IceGrid registry service name is computed\n" + " using Ice.Default.Locator in <config-file>).\n" + "EventLog The name of the EventLog used by this service;\n" + " the default is Application\n" + ; +} diff --git a/cpp/src/iceserviceinstall/Makefile.mak b/cpp/src/iceserviceinstall/Makefile.mak new file mode 100644 index 00000000000..ddd44e81f83 --- /dev/null +++ b/cpp/src/iceserviceinstall/Makefile.mak @@ -0,0 +1,115 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +#!define HAS_MSI_SDK + +top_srcdir = ..\.. + +LIBNAME = $(top_srcdir)\lib\iceserviceinstaller$(LIBSUFFIX).lib +DLLNAME = $(top_srcdir)\bin\iceserviceinstaller$(SOVERSION)$(LIBSUFFIX).dll + +TOOL = $(top_srcdir)\bin\iceserviceinstall.exe + +!ifdef BUILD_UTILS + +TARGETS = $(TOOL) + +!else + +TARGETS = $(LIBNAME) $(DLLNAME) + +!endif + +TOBJS = Install.obj + +OBJS = ServiceInstaller.obj \ +!ifdef HAS_MSI_SDK + MsiSupport.obj +!endif + +SRCS = $(TOBJS:.obj=.cpp) \ + $(OBJS:.obj=.cpp) + +!include $(top_srcdir)\config\Make.rules.mak + +CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN + +!ifdef HAS_MSI_SDK +LINKWITH = $(LIBS) msi.lib +!else +LINKWITH = $(LIBS) +!endif +TLINKWITH = $(LIBS) iceserviceinstaller$(LIBSUFFIX).lib + +!ifndef BUILD_UTILS + +CPPFLAGS = $(CPPFLAGS) -DICE_SERVICE_INSTALLER_API_EXPORTS + +!endif + +!if "$(CPP_COMPILER)" != "BCC2006" && "$(OPTIMIZE)" != "yes" +PDBFLAGS = /pdb:$(DLLNAME:.dll=.pdb) +TPDBFLAGS = /pdb:$(TOOL:.exe=.pdb) +!endif + +$(LIBNAME): $(DLLNAME) + +$(DLLNAME): $(OBJS) + $(LINK) $(LD_DLLFLAGS) $(PDBFLAGS) $(OBJS) $(PREOUT)$@ $(PRELIBS)$(LINKWITH) + move $(DLLNAME:.dll=.lib) $(LIBNAME) + @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ + $(MT) -nologo -manifest $@.manifest -outputresource:$@;#2 && del /q $@.manifest + @if exist $(DLLNAME:.dll=.exp) del /q $(DLLNAME:.dll=.exp) + +$(TOOL): $(TOBJS) + $(LINK) $(LD_EXEFLAGS) $(TPDBFLAGS) $(TOBJS) $(SETARGV) $(PREOUT)$@ $(PRELIBS)$(TLINKWITH) + @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ + $(MT) -nologo -manifest $@.manifest security.manifest -outputresource:$@;#1 && del /q $@.manifest + +!ifdef BUILD_UTILS + +clean:: + del /q $(TOOL:.exe=.*) + +install:: all + copy $(LIBNAME) $(install_libdir) + copy $(DLLNAME) $(install_bindir) + copy $(TOOL) $(install_bindir) + +!if "$(OPTIMIZE)" != "yes" + +!if "$(CPP_COMPILER)" == "BCC2006" + +install:: all + copy $(DLLNAME:.dll=.tds) $(install_bindir) + copy $(SVCDLLNAME:.dll=.tds) $(install_bindir) + copy $(TOOL:.exe=.tds) $(install_bindir) + +!else + +install:: all + copy $(DLLNAME:.dll=.pdb) $(install_bindir) + copy $(SVCDLLNAME:.dll=.pdb) $(install_bindir) + copy $(TOOL:.exe=.pdb) $(install_bindir) + +!endif + +!endif + +!else + +install:: all + +$(EVERYTHING):: + @$(MAKE) -nologo /f Makefile.mak BUILD_UTILS=1 $@ + +!endif + +!include .depend + diff --git a/cpp/src/iceserviceinstall/MsiSupport.cpp b/cpp/src/iceserviceinstall/MsiSupport.cpp new file mode 100755 index 00000000000..860e6425742 --- /dev/null +++ b/cpp/src/iceserviceinstall/MsiSupport.cpp @@ -0,0 +1,274 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <ServiceInstaller.h> +#include <Msiquery.h> + +// +// Provides the iceServiceInstall and iceServiceUninstall functions, +// to be called from MSI installers +// +// They both read MSI properties with the following format: +// <service>.<name> +// where <service> is one of the service types (see ServiceInstaller.h) +// and <name> is either "ConfigFile" or a property name (as provided +// by the IceServiceInstaller class). If there is no <service>.ConfigFile +// property, the service is skipped. +// +// Errors are logged using a custom MSI logger, that writes to the MSI +// log file +// + +using namespace std; +using namespace Ice; + +namespace +{ + +UINT serviceInstall(MSIHANDLE handle, bool install); + +} + +extern "C" +{ + +ICE_SERVICE_INSTALLER_API +UINT __stdcall iceServiceInstall(MSIHANDLE handle) +{ + return serviceInstall(handle, true); +} + +ICE_SERVICE_INSTALLER_API +UINT __stdcall iceServiceUninstall(MSIHANDLE handle) +{ + return serviceInstall(handle, false); +} + +} + +namespace +{ +// +// Custom MSI logger +// + +class MsiLogger : public Logger +{ +public: + + MsiLogger(MSIHANDLE); + + virtual void print(const string&); + virtual void trace(const string&, const string&); + virtual void warning(const string&); + virtual void error(const string&); + +private: + + void log(const string&, INSTALLMESSAGE); + + MSIHANDLE _handle; +}; + + +MsiLogger::MsiLogger(MSIHANDLE handle) : + _handle(handle) +{ +} + +void +MsiLogger::print(const string& msg) +{ + log(msg, INSTALLMESSAGE_INFO); +} + +void +MsiLogger::trace(const string& category, const string& msg) +{ + string s = "[ "; + if(!category.empty()) + { + s += category + ": "; + } + s += msg + " ]"; + + string::size_type idx = 0; + while((idx = s.find("\n", idx)) != string::npos) + { + s.insert(idx + 1, " "); + ++idx; + } + log(s, INSTALLMESSAGE_INFO); +} + +void +MsiLogger::warning(const string& msg) +{ + log(msg, INSTALLMESSAGE_WARNING); +} + +void +MsiLogger::error(const string& msg) +{ + log(msg, INSTALLMESSAGE_ERROR); +} + +void +MsiLogger::log(const string& msg, INSTALLMESSAGE installMessage) +{ + PMSIHANDLE rec = MsiCreateRecord(1); // would 0 be more correct? + + if(rec != 0) + { + if(MsiRecordSetString(rec, 0, msg.c_str()) == ERROR_SUCCESS) + { + MsiProcessMessage(_handle, installMessage, rec); + } + } +} + +UINT serviceInstall(MSIHANDLE handle, bool install) +{ + // + // Create an custom logger + // + LoggerPtr msiLogger = new MsiLogger(handle); + setProcessLogger(msiLogger); + CommunicatorPtr communicator = 0; + + UINT result = ERROR_SUCCESS; + + try + { + communicator = initialize(); + char buffer[4096]; + const DWORD maxBufferSize = 4096; + + UINT res = ERROR_SUCCESS; + string propName; + + if(install) + { + // + // Let's see if the xxx.ConfigFile property is defined + // + const vector<string> propertyNames = IceServiceInstaller::getPropertyNames(); + + for(int st = 0; st < IceServiceInstaller::serviceCount; ++st) + { + const string prefix = IceServiceInstaller::serviceTypeToString(st) + "."; + propName = prefix + "ConfigFile"; + + DWORD bufferSize = maxBufferSize; + res = MsiGetProperty(handle, propName.c_str(), buffer, &bufferSize); + + if(res == ERROR_SUCCESS) + { + if(bufferSize > 0) + { + IceServiceInstaller installer(st, buffer, communicator); + + // + // Retrieve properties + // + + PropertiesPtr properties = createProperties(); + + for(size_t i = 0; i < propertyNames.size(); ++i) + { + const string propName = prefix + propertyNames[i]; + + bufferSize = maxBufferSize; + res = MsiGetProperty(handle, propName.c_str(), buffer, &bufferSize); + + if(res != ERROR_SUCCESS) + { + { + Error error(msiLogger); + error << "Can't read MSI property " << propName; + } + communicator->destroy(); + return ERROR_INSTALL_FAILURE; + } + + if(bufferSize > 0) + { + properties->setProperty(propName, buffer); + } + } + + installer.install(properties); + } + } + else + { + break; // for + } + } + } + else + { + // + // uninstall in reverse order + // + + // + // Let's see if the xxx.ConfigFile property is defined + // + + for(int st = IceServiceInstaller::serviceCount; st >= 0; --st) + { + const string prefix = IceServiceInstaller::serviceTypeToString(st) + "."; + propName = prefix + "ConfigFile"; + + DWORD bufferSize = maxBufferSize; + res = MsiGetProperty(handle, propName.c_str(), buffer, &bufferSize); + + if(res == ERROR_SUCCESS) + { + if(bufferSize > 0) + { + IceServiceInstaller installer(st, buffer, communicator); + installer.uninstall(); + } + } + } + } + + if(res != ERROR_SUCCESS) + { + // + // Report error, fail + // + { + Error error(msiLogger); + error << "Cant' read MSI property " << propName; + } + + result = ERROR_INSTALL_FAILURE; + } + } + catch(const string& msg) + { + Error error(msiLogger); + error << msg; + } + catch(const Exception& ex) + { + Error error(msiLogger); + error << ex; + } + + if(communicator != 0) + { + communicator->destroy(); + } + return result; +} +} diff --git a/cpp/src/iceserviceinstall/ServiceInstaller.cpp b/cpp/src/iceserviceinstall/ServiceInstaller.cpp new file mode 100755 index 00000000000..8ed93fc16a2 --- /dev/null +++ b/cpp/src/iceserviceinstall/ServiceInstaller.cpp @@ -0,0 +1,908 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#define _WIN32_WINNT 0x0500 + +#if defined(_MSC_VER) && _MSC_VER >= 1400 +# define _CRT_SECURE_NO_DEPRECATE 1 // C4996 '<C function>' was declared deprecated +#endif + +#include <ServiceInstaller.h> +#include <sys/types.h> +#include <sys/stat.h> + +#include <Aclapi.h> + +#if defined(_MSC_VER) && _MSC_VER >= 1300 +// +// The VC6 headers don't include Sddl.h +// +#include <Sddl.h> +#endif + +using namespace std; +using namespace Ice; + +IceServiceInstaller::IceServiceInstaller(int serviceType, const string& configFile, + const CommunicatorPtr& communicator) : + _serviceType(serviceType), + _configFile(configFile), + _communicator(communicator), + _serviceProperties(createProperties()), + _sid(0), + _debug(false) +{ + + _serviceProperties->load(_configFile); + + // + // Compute _serviceName + // + _defaultLocator = LocatorPrx::uncheckedCast( + _communicator->stringToProxy( + _serviceProperties->getProperty("Ice.Default.Locator"))); + + if(_serviceType == icegridregistry) + { + _icegridInstanceName = + _serviceProperties->getPropertyWithDefault("IceGrid.InstanceName", "IceGrid"); + _serviceName = serviceTypeToLowerString(_serviceType) + "." + _icegridInstanceName; + } + else + { + if(_defaultLocator != 0) + { + _icegridInstanceName = _defaultLocator->ice_getIdentity().category; + } + + if(_serviceType == icegridnode) + { + if(_icegridInstanceName == "") + { + throw "Ice.Default.Locator must be set in " + _configFile; + } + _nodeName = _serviceProperties->getProperty("IceGrid.Node.Name"); + if(_nodeName == "") + { + throw "IceGrid.Node.Name must be set in " + _configFile; + } + _serviceName = serviceTypeToLowerString(_serviceType) + "." + _icegridInstanceName + "." + _nodeName; + } + else if(_serviceType == glacier2router) + { + _glacier2InstanceName = + _serviceProperties->getPropertyWithDefault("Glacier2.InstanceName", + "Glacier2"); + _serviceName = serviceTypeToLowerString(_serviceType) + "." + _glacier2InstanceName; + } + else + { + throw "Unknown service type"; + } + } +} + + +IceServiceInstaller::~IceServiceInstaller() +{ + free(_sid); +} + +void +IceServiceInstaller::install(const PropertiesPtr& properties) +{ + _debug = properties->getPropertyAsInt("Debug") != 0; + + initializeSid(properties->getPropertyWithDefault("ObjectName", + "NT Authority\\LocalService")); + + const string defaultDisplayName[] = + { + "IceGrid registry (" + _icegridInstanceName + ")", + "IceGrid node (" + _nodeName + " within " + _icegridInstanceName + ")", + "Glacier2 router (" + _glacier2InstanceName + ")" + }; + + const string defaultDescription[] = + { + "Location and deployment service for Ice applications", + "Starts and monitors Ice servers", + "Ice Firewall traversal service" + }; + + string displayName = properties->getPropertyWithDefault("DisplayName", + defaultDisplayName[_serviceType]); + + string description = properties->getPropertyWithDefault("Description", + defaultDescription[_serviceType]); + + string imagePath = properties->getProperty("ImagePath"); + + if(imagePath == "") + { + char buffer[MAX_PATH]; + DWORD size = GetModuleFileName(0, buffer, MAX_PATH); + if(size == 0) + { + throw "Can't get full path to self: " + formatMessage(GetLastError()); + } + imagePath = string(buffer, size); + imagePath.replace(imagePath.rfind('\\'), string::npos, "\\" + + serviceTypeToLowerString(_serviceType) + ".exe"); + } + if(!fileExists(imagePath)) + { + throw imagePath + ": not found"; + } + + string dependency; + + if(_serviceType == icegridregistry) + { + if(properties->getPropertyAsInt("DependOnRegistry") != 0) + { + throw "The IceGrid registry service can't depend on itself"; + } + + string registryDataDir = _serviceProperties->getProperty("IceGrid.Registry.Data"); + if(registryDataDir == "") + { + throw "IceGrid.Registry.Data must be set in " + _configFile; + } + if(!mkdir(registryDataDir)) + { + grantPermissions(registryDataDir, SE_FILE_OBJECT, true, true); + } + } + else if(_serviceType == icegridnode) + { + string nodeDataDir = _serviceProperties->getProperty("IceGrid.Node.Data"); + if(nodeDataDir == "") + { + throw "IceGrid.Node.Data must be set in " + _configFile; + } + if(!mkdir(nodeDataDir)) + { + grantPermissions(nodeDataDir, SE_FILE_OBJECT, true, true); + } + + grantPermissions( + "MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib", + SE_REGISTRY_KEY, true); + + if(properties->getPropertyAsInt("DependOnRegistry") != 0) + { + dependency = "icegridregistry." + _icegridInstanceName; + } + } + else if(_serviceType == glacier2router) + { + if(properties->getPropertyAsInt("DependOnRegistry") != 0) + { + if(_icegridInstanceName == "") + { + throw"Ice.Default.Locator must be set in " + _configFile + + " when DependOnRegistry is not zero"; + } + dependency = "icegridregistry." + _icegridInstanceName; + } + } + + grantPermissions(_configFile); + + string eventLog = properties->getProperty("EventLog"); + if(eventLog == "") + { + eventLog = "Application"; + } + else + { + addLog(eventLog); + } + + string eventLogSource = _serviceProperties->getPropertyWithDefault("Ice.EventLog.Source", _serviceName); + + addSource(eventLogSource, eventLog, getIceDLLPath(imagePath)); + + SC_HANDLE scm = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS); + if(scm == 0) + { + DWORD res = GetLastError(); + throw "Cannot open SCM: " + formatMessage(res); + } + + string deps = dependency; + + if(deps.empty()) + { + const string candidates[] = { "netprofm", "Nla" }; + const int candidatesLen = 2; + + for(int i = 0; i < candidatesLen; ++i) + { + SC_HANDLE service = OpenService(scm, candidates[i].c_str(), GENERIC_READ); + if(service != 0) + { + deps = candidates[i]; + CloseServiceHandle(service); + break; // for + } + } + } + + deps += '\0'; // must be double-null terminated + + // + // Get the full path of config file + // + char fullPath[MAX_PATH]; + if(GetFullPathName(_configFile.c_str(), MAX_PATH, fullPath, 0) > MAX_PATH) + { + throw "Could not compute the full path of " + _configFile; + } + + string command = "\"" + imagePath + "\" --service " + _serviceName + + " --Ice.Config=\"" + fullPath + "\""; + + bool autoStart = properties->getPropertyAsIntWithDefault("AutoStart", 1) != 0; + string password = properties->getProperty("Password"); + + SC_HANDLE service = CreateService( + scm, + _serviceName.c_str(), + displayName.c_str(), + SERVICE_ALL_ACCESS, + SERVICE_WIN32_OWN_PROCESS, + autoStart ? SERVICE_AUTO_START : SERVICE_DEMAND_START, + SERVICE_ERROR_NORMAL, + command.c_str(), + 0, + 0, + deps.c_str(), + _sidName.c_str(), + password.c_str()); + + if(service == 0) + { + DWORD res = GetLastError(); + CloseServiceHandle(scm); + throw "Cannot create service" + _serviceName + ": " + formatMessage(res); + } + + // + // Set description + // + + SERVICE_DESCRIPTION sd = { const_cast<char*>(description.c_str()) }; + + if(!ChangeServiceConfig2(service, SERVICE_CONFIG_DESCRIPTION, &sd)) + { + DWORD res = GetLastError(); + CloseServiceHandle(scm); + CloseServiceHandle(service); + throw "Cannot set description for service" + _serviceName + ": " + + formatMessage(res); + } + + CloseServiceHandle(scm); + CloseServiceHandle(service); +} + +void +IceServiceInstaller::uninstall() +{ + SC_HANDLE scm = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS); + if(scm == 0) + { + DWORD res = GetLastError(); + throw "Cannot open SCM: " + formatMessage(res); + } + + SC_HANDLE service = OpenService(scm, _serviceName.c_str(), SERVICE_ALL_ACCESS); + if(service == 0) + { + DWORD res = GetLastError(); + CloseServiceHandle(scm); + throw "Cannot open service '" + _serviceName + "': " + formatMessage(res); + } + + // + // Stop service first + // + SERVICE_STATUS serviceStatus; + if(!ControlService(service, SERVICE_CONTROL_STOP, &serviceStatus)) + { + DWORD res = GetLastError(); + if(res != ERROR_SERVICE_NOT_ACTIVE) + { + CloseServiceHandle(scm); + CloseServiceHandle(service); + throw "Cannot stop service '" + _serviceName + "': " + formatMessage(res); + } + } + + if(!DeleteService(service)) + { + DWORD res = GetLastError(); + CloseServiceHandle(scm); + CloseServiceHandle(service); + throw "Cannot delete service '" + _serviceName + "': " + formatMessage(res); + } + + CloseServiceHandle(scm); + CloseServiceHandle(service); + + string eventLogSource = _serviceProperties->getPropertyWithDefault("Ice.EventLog.Source", _serviceName); + string eventLog = removeSource(eventLogSource); + + if(eventLog != "Application") + { + removeLog(eventLog); + } +} + +/* static */ vector<string> +IceServiceInstaller::getPropertyNames() +{ + static const string propertyNames[] = { "ImagePath", "DisplayName", "ObjectName", "Password", + "Description", "DependOnRegistry", "Debug", "AutoStart", "EventLog" }; + + vector<string> result(propertyNames, propertyNames + 9); + + return result; +} + +/*static*/ string +IceServiceInstaller::serviceTypeToString(int serviceType) +{ + static const string serviceTypeArray[] = { "IceGridRegistry", "IceGridNode", "Glacier2Router" }; + + if(serviceType >=0 && serviceType < serviceCount) + { + return serviceTypeArray[serviceType]; + } + else + { + return "Unknown service"; + } +} + +/*static*/ string +IceServiceInstaller::serviceTypeToLowerString(int serviceType) +{ + static const string serviceTypeArray[] = { "icegridregistry", "icegridnode", "glacier2router" }; + + if(serviceType >=0 && serviceType < serviceCount) + { + return serviceTypeArray[serviceType]; + } + else + { + return "Unknown service"; + } +} + +void +IceServiceInstaller::initializeSid(const string& name) +{ + { + DWORD sidSize = 32; + _sid = static_cast<SID*>(malloc(sidSize)); + memset(_sid, 0, sidSize); + + DWORD domainNameSize = 32; + char* domainName = static_cast<char*>(malloc(domainNameSize)); + memset(domainName, 0, domainNameSize); + + SID_NAME_USE nameUse; + while(LookupAccountName(0, name.c_str(), _sid, &sidSize, domainName, &domainNameSize, &nameUse) == false) + { + DWORD res = GetLastError(); + + if(res == ERROR_INSUFFICIENT_BUFFER) + { + _sid = static_cast<SID*>(realloc(_sid, sidSize)); + memset(_sid, 0, sidSize); + domainName = static_cast<char*>(realloc(domainName, domainNameSize)); + memset(domainName, 0, domainNameSize); + } + else + { + free(_sid); + _sid = 0; + free(domainName); + + throw "Could not retrieve Security ID for " + name + ": " + + formatMessage(res); + } + } + free(domainName); + } + + // + // Now store in _sidName a 'normalized' name (for the CreateService call) + // + + if(name.find('\\') != string::npos) + { + // + // Keep this name; otherwise on XP, the localized name + // ("NT AUTHORITY\LOCAL SERVICE" in English) shows up in the Services + // snap-in instead of 'Local Service' (which is also a localized name, + // but looks nicer). + // + _sidName = name; + } + else + { + char accountName[1024]; + DWORD accountNameLen = 1024; + + char domainName[1024]; + DWORD domainLen = 1024; + + SID_NAME_USE nameUse; + if(LookupAccountSid(0, _sid, accountName, &accountNameLen, domainName, + &domainLen, &nameUse) == false) + { + DWORD res = GetLastError(); + throw "Could not retrieve full account name for " + name + ": " + + formatMessage(res); + } + + _sidName = string(domainName) + "\\" + accountName; + } + + if(_debug) + { + Trace trace(_communicator->getLogger(), "IceServiceInstaller"); + +#if defined(_MSC_VER) && _MSC_VER >= 1300 + char* sidString = 0; + ConvertSidToStringSid(_sid, &sidString); + trace << "SID: " << sidString << "; "; + LocalFree(sidString); +#endif + trace << "Full name: " << _sidName; + } +} + +bool +IceServiceInstaller::fileExists(const string& path) const +{ + struct _stat buffer = { 0 }; + int err = _stat(path.c_str(), &buffer); + + if(err == 0) + { + if((buffer.st_mode & _S_IFREG) == 0) + { + throw path + " is not a regular file"; + } + return true; + } + else + { + if(errno == ENOENT) + { + return false; + } + else + { + const char* msg = strerror(errno); + throw "Problem with " + path + ": " + msg; + } + } +} + +void +IceServiceInstaller::grantPermissions(const string& path, SE_OBJECT_TYPE type, bool inherit, bool fullControl) const +{ + // + // First retrieve the ACL for our file/directory/key + // + PACL acl = 0; + PACL newAcl = 0; + PSECURITY_DESCRIPTOR sd = 0; + DWORD res = GetNamedSecurityInfo(const_cast<char*>(path.c_str()), type, + DACL_SECURITY_INFORMATION, + 0, 0, &acl, 0, &sd); + if(res != ERROR_SUCCESS) + { + throw "Could not retrieve securify info for " + path + ": " + + formatMessage(res); + } + + try + { + // + // Now check if _sid can read this file/dir/key + // + TRUSTEE trustee; + BuildTrusteeWithSid(&trustee, _sid); + + ACCESS_MASK accessMask = 0; + res = GetEffectiveRightsFromAcl(acl, &trustee, &accessMask); + + if(res != ERROR_SUCCESS) + { + throw "Could not retrieve effective rights for " + _sidName + + " on " + path + ": " + formatMessage(res); + } + + bool done = false; + + if(type == SE_FILE_OBJECT) + { + if(fullControl) + { + done = (accessMask & READ_CONTROL) && (accessMask & SYNCHRONIZE) + && (accessMask & 0x1F) == 0x1F; + } + else + { + done = (accessMask & READ_CONTROL) && (accessMask & SYNCHRONIZE); + } + } + else + { + done = (accessMask & READ_CONTROL); + } + + if(done) + { + if(_debug) + { + Trace trace(_communicator->getLogger(), "IceServiceInstaller"); + trace << _sidName << " had already the desired permissions on " << path; + } + } + else + { + EXPLICIT_ACCESS ea = { 0 }; + + if(type == SE_FILE_OBJECT && fullControl) + { + ea.grfAccessPermissions = (accessMask | FILE_ALL_ACCESS); + } + else + { + ea.grfAccessPermissions = (accessMask | GENERIC_READ); + } + ea.grfAccessMode = GRANT_ACCESS; + if(inherit) + { + ea.grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT; + } + else + { + ea.grfInheritance = NO_INHERITANCE; + } + ea.Trustee = trustee; + + // + // Create new ACL + // + PACL newAcl = 0; + res = SetEntriesInAcl(1, &ea, acl, &newAcl); + if(res != ERROR_SUCCESS) + { + throw "Could not modify ACL for " + path + ": " + formatMessage(res); + } + + res = SetNamedSecurityInfo(const_cast<char*>(path.c_str()), type, + DACL_SECURITY_INFORMATION, + 0, 0, newAcl, 0); + if(res != ERROR_SUCCESS) + { + throw "Could not grant access to " + _sidName + + " on " + path + ": " + formatMessage(res); + } + + if(_debug) + { + Trace trace(_communicator->getLogger(), "IceServiceInstaller"); + trace << "Granted access on " << path << " to " << _sidName; + } + } + } + catch(...) + { + LocalFree(acl); + LocalFree(newAcl); + throw; + } + + LocalFree(acl); + LocalFree(newAcl); +} + +bool +IceServiceInstaller::mkdir(const string& path) const +{ + if(CreateDirectory(path.c_str(), 0) == 0) + { + DWORD res = GetLastError(); + if(res == ERROR_ALREADY_EXISTS) + { + return false; + } + else if(res == ERROR_PATH_NOT_FOUND) + { + string parentPath = path; + parentPath.erase(parentPath.rfind('\\')); + mkdir(parentPath); + return mkdir(path); + } + else + { + throw "Could not create directory " + path + ": " + formatMessage(res); + } + } + else + { + grantPermissions(path, SE_FILE_OBJECT, true, true); + return true; + } +} + +string +IceServiceInstaller::formatMessage(DWORD err) const +{ + ostringstream os; + char* msgBuf = 0; + DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + 0, + err, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + reinterpret_cast<char*>(&msgBuf), + 0, + 0); + + if(ok) + { + os << msgBuf; + LocalFree(msgBuf); + } + else + { + os << "unknown error"; + } + + return os.str(); +} + +void +IceServiceInstaller::addLog(const string& log) const +{ + // + // Create or open the corresponding registry key + // + + HKEY key = 0; + DWORD disposition = 0; + LONG res = RegCreateKeyEx(HKEY_LOCAL_MACHINE, createLog(log).c_str(), + 0, "REG_SZ", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, + &key, &disposition); + + if(res != ERROR_SUCCESS) + { + throw "Could not create new Event Log '" + log + "': " + formatMessage(res); + } + + res = RegCloseKey(key); + if(res != ERROR_SUCCESS) + { + throw "Could not close registry key handle: " + formatMessage(res); + } +} + +void +IceServiceInstaller::removeLog(const string& log) const +{ + LONG res = RegDeleteKey(HKEY_LOCAL_MACHINE, createLog(log).c_str()); + + // + // We get ERROR_ACCESS_DENIED when the log is shared by several sources + // + if(res != ERROR_SUCCESS && res != ERROR_ACCESS_DENIED) + { + throw "Could not remove registry key '" + createLog(log) + "': " + formatMessage(res); + } +} + +void +IceServiceInstaller::addSource(const string& source, const string& log, const string& resourceFile) const +{ + HKEY key = 0; + DWORD disposition = 0; + LONG res = RegCreateKeyEx(HKEY_LOCAL_MACHINE, createSource(source, log).c_str(), + 0, "REG_SZ", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, + &key, &disposition); + if(res != ERROR_SUCCESS) + { + throw "Could not create Event Log source in registry: " + formatMessage(res); + } + + // + // The event resources are bundled into this DLL, therefore + // the "EventMessageFile" key should contain the path to this + // DLL. + // + res = RegSetValueEx(key, "EventMessageFile", 0, REG_EXPAND_SZ, + reinterpret_cast<const BYTE*>(resourceFile.c_str()), + resourceFile.length() + 1); + + if(res == ERROR_SUCCESS) + { + // + // The "TypesSupported" key indicates the supported event + // types. + // + DWORD typesSupported = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE + | EVENTLOG_INFORMATION_TYPE; + res = RegSetValueEx(key, "TypesSupported", 0, REG_DWORD, + reinterpret_cast<BYTE*>(&typesSupported), sizeof(typesSupported)); + } + + if(res != ERROR_SUCCESS) + { + RegCloseKey(key); + throw "Could not set registry key: " + formatMessage(res); + } + + res = RegCloseKey(key); + if(res != ERROR_SUCCESS) + { + throw "Could not close registry key handle: " + formatMessage(res); + } +} + +string +IceServiceInstaller::removeSource(const string& source) const +{ + // + // Find the source and return the log + // + + HKEY key = 0; + + LONG res = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\EventLog", 0, + KEY_ENUMERATE_SUB_KEYS, &key); + + if(res != ERROR_SUCCESS) + { + throw "Could not open EventLog key: " + formatMessage(res); + } + + DWORD index = 0; + do + { + char subkey[4096]; + DWORD subkeySize = 4096; + + res = RegEnumKeyEx(key, index, subkey, &subkeySize, 0, 0, 0, 0); + + if(res == ERROR_SUCCESS) + { + // + // Check if we can delete the source sub-key + // + LONG delRes = RegDeleteKey(HKEY_LOCAL_MACHINE, createSource(source, subkey).c_str()); + if(delRes == ERROR_SUCCESS) + { + res = RegCloseKey(key); + if(res != ERROR_SUCCESS) + { + throw "Could not close registry key handle: " + formatMessage(res); + } + return subkey; + } + + ++index; + } + } while(res == ERROR_SUCCESS); + + + if(res == ERROR_NO_MORE_ITEMS) + { + RegCloseKey(key); + throw "Could not locate EventLog with source '" + source + "'"; + } + else + { + RegCloseKey(key); + throw "Error while searching EventLog with source '" + source + "': " + formatMessage(res); + } + + res = RegCloseKey(key); + if(res != ERROR_SUCCESS) + { + throw "Could not close registry key handle: " + formatMessage(res); + } +} + +string +IceServiceInstaller::mangleSource(const string& name) const +{ + string result = name; + // + // The source cannot contain backslashes. + // + string::size_type pos = 0; + while((pos = result.find('\\', pos)) != string::npos) + { + result[pos] = '/'; + } + return result; +} + +string +IceServiceInstaller::createLog(const string& log) const +{ + // + // The registry key is: + // + // HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\<log>. + // + return "SYSTEM\\CurrentControlSet\\Services\\EventLog\\" + log; +} + +string +IceServiceInstaller::createSource(const string& name, const string& log) const +{ + return createLog(log) + "\\" + mangleSource(name); +} + +string +IceServiceInstaller::getIceDLLPath(const string& imagePath) const +{ + string imagePathDir = imagePath; + imagePathDir.erase(imagePathDir.rfind('\\')); + + // + // Get current 'DLL' version + // + int majorVersion = (ICE_INT_VERSION / 10000); + int minorVersion = (ICE_INT_VERSION / 100) - majorVersion * 100; + ostringstream os; + os << majorVersion * 10 + minorVersion; + + int patchVersion = ICE_INT_VERSION % 100; + if(patchVersion > 50) + { + os << 'b'; + if(patchVersion >= 52) + { + os << (patchVersion - 50); + } + } + string version = os.str(); + + string result = imagePathDir + '\\' + "ice" + version + ".dll"; + + if(fileExists(result)) + { + return result; + } + else + { + result = imagePathDir + '\\' + "ice" + version + "d.dll"; + if(fileExists(result)) + { + return result; + } + else + { + throw "Could not find Ice DLL"; + } + } +} diff --git a/cpp/src/iceserviceinstall/ServiceInstaller.h b/cpp/src/iceserviceinstall/ServiceInstaller.h new file mode 100755 index 00000000000..88c3edea2d7 --- /dev/null +++ b/cpp/src/iceserviceinstall/ServiceInstaller.h @@ -0,0 +1,90 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef ICE_SERVICE_INSTALLER_H +#define ICE_SERVICE_INSTALLER_H + +#ifdef ICE_SERVICE_INSTALLER_API_EXPORTS +# define ICE_SERVICE_INSTALLER_API ICE_DECLSPEC_EXPORT +#else +# define ICE_SERVICE_INSTALLER_API ICE_DECLSPEC_IMPORT +#endif + +#include <Ice/Ice.h> + +#include <AccCtrl.h> + +class ICE_SERVICE_INSTALLER_API IceServiceInstaller +{ +public: + +#if defined(_MSC_VER) && _MSC_VER < 1300 + enum { + icegridregistry = 0, + icegridnode = 1, + glacier2router = 2, + serviceCount = 3 + }; +#else + static const int icegridregistry = 0; + static const int icegridnode = 1; + static const int glacier2router = 2; + static const int serviceCount = 3; +#endif + + IceServiceInstaller(int, const std::string&, const Ice::CommunicatorPtr&); + ~IceServiceInstaller(); + + void install(const Ice::PropertiesPtr&); + + void uninstall(); + + static std::vector<std::string> getPropertyNames(); + static std::string serviceTypeToString(int); + static std::string serviceTypeToLowerString(int); + +private: + + void initializeSid(const std::string&); + + bool fileExists(const std::string&) const; + void grantPermissions(const std::string& path, SE_OBJECT_TYPE type = SE_FILE_OBJECT, + bool inherit = false, bool fullControl = false) const; + bool mkdir(const std::string&) const; + std::string formatMessage(DWORD) const; + + void addLog(const std::string&) const; + void removeLog(const std::string&) const; + std::string createLog(const std::string&) const; + void addSource(const std::string&, const std::string&, const std::string&) const; + std::string removeSource(const std::string&) const; + std::string mangleSource(const std::string&) const; + std::string createSource(const std::string&, const std::string&) const; + + std::string getIceDLLPath(const std::string&) const; + + int _serviceType; + std::string _configFile; + Ice::CommunicatorPtr _communicator; + + Ice::PropertiesPtr _serviceProperties; + std::string _serviceName; + Ice::LocatorPrx _defaultLocator; + + std::string _icegridInstanceName; + std::string _nodeName; + std::string _glacier2InstanceName; + + SID* _sid; + std::string _sidName; + + bool _debug; +}; + +#endif diff --git a/cpp/src/iceserviceinstall/security.manifest b/cpp/src/iceserviceinstall/security.manifest new file mode 100755 index 00000000000..a683e40afe4 --- /dev/null +++ b/cpp/src/iceserviceinstall/security.manifest @@ -0,0 +1,11 @@ +<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> + <security> + <requestedPrivileges> + <requestedExecutionLevel + level="requireAdministrator" + uiAccess="false"/> + </requestedPrivileges> + </security> + </trustInfo> +</assembly> diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index b68b987de22..7694559b5fd 100755 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -2926,7 +2926,11 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) if(!throws.empty()) { C << eb; - + C << nl << "catch(const ::Ice::UserException& __ex)"; + C << sb; + C << nl << "setUserException(__ex);"; + C << nl << "return ::Ice::DispatchUserException;"; + C << eb; throws.sort(); throws.unique(); #if defined(__SUNPRO_CC) @@ -2935,14 +2939,6 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) throws.sort(Slice::DerivedToBaseCompare()); #endif - for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i) - { - C << nl << "catch(const " << fixKwd((*i)->scoped()) << "& e)"; - C << sb; - C << nl << "setUserException(e);"; - C << nl << "return ::Ice::DispatchUserException;"; - C << eb; - } } C << eb; @@ -2989,28 +2985,39 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) C << nl << "try"; C << sb; - if(!throws.empty()) + C << nl << "__direct.servant()->__collocDispatch(__direct);"; + C << eb; + C << nl << "catch(const ::std::exception& __ex)"; + C << sb; + C << nl << "__direct.destroy();"; + C << nl << "::IceInternal::LocalExceptionWrapper::throwUnknownWrapper(__ex);"; + C << eb; + C << nl << "catch(...)"; + C << sb; + C << nl << "__direct.destroy();"; + C << nl << "throw ::Ice::UnknownException(__FILE__, __LINE__, \"unknown c++ exception\");"; + C << eb; + C << nl << "__direct.destroy();"; + C << eb; + for(ExceptionList::const_iterator k = throws.begin(); k != throws.end(); ++k) { - C << nl << "if(__direct.servant()->__collocDispatch(__direct) == ::Ice::DispatchUserException)"; + C << nl << "catch(const " << fixKwd((*k)->scoped()) << "&)"; C << sb; - C << nl << "__direct.throwUserException();"; + C << nl << "throw;"; C << eb; } - else - { - C << nl << "__direct.servant()->__collocDispatch(__direct);"; - } - C << eb; - C << nl << "catch(...)"; + C << nl << "catch(const ::IceInternal::LocalExceptionWrapper&)"; C << sb; - C << nl << "__direct.destroy();"; C << nl << "throw;"; C << eb; - C << nl << "__direct.destroy();"; + C << nl << "catch(const ::std::exception& __ex)"; + C << sb; + C << nl << "::IceInternal::LocalExceptionWrapper::throwUnknownWrapper(__ex);"; C << eb; - C << nl << "catch(const ::Ice::LocalException& __ex)"; + C << nl << "catch(...)"; C << sb; - C << nl << "throw ::IceInternal::LocalExceptionWrapper(__ex, false);"; + C << nl << "throw ::IceInternal::LocalExceptionWrapper(" + << "::Ice::UnknownException(__FILE__, __LINE__, \"unknown c++ exception\"), false);"; C << eb; if(ret) { @@ -3808,10 +3815,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << nl << "*p = " << scope << name << "Ptr::dynamicCast(v);"; C << nl << "if(v && !*p)"; C << sb; - C << nl << "::Ice::UnexpectedObjectException e(__FILE__, __LINE__);"; - C << nl << "e.type = v->ice_id();"; - C << nl << "e.expectedType = " << scope << fixKwd(name) << "::ice_staticId();"; - C << nl << "throw e;"; + C << nl << "IceInternal::Ex::throwUOE(" << scoped << "::ice_staticId(), v->ice_id());"; C << eb; C << eb; @@ -5618,6 +5622,18 @@ Slice::Gen::MetaDataVisitor::visitOperation(const OperationPtr& p) { ami = true; } + + if(p->hasMetaData("UserException")) + { + if(!cl->isLocal()) + { + cout << p->definitionContext()->filename() << ":" << p->line() + << ": warning: metadata directive `UserException' applies only to local operations " + << "but enclosing " << (cl->isInterface() ? "interface" : "class") << "`" << cl->name() + << "' is not local" << endl; + } + } + StringList metaData = p->getMetaData(); metaData.remove("cpp:const"); diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 6d3cddb182d..7e21ca58aac 100755 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -675,12 +675,12 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream) } _out << "class Patcher__ : IceInternal.Patcher<" << name << ">"; _out << sb; - _out << sp << nl << "internal Patcher__(Ice.ObjectImpl instance"; + _out << sp << nl << "internal Patcher__(string type, Ice.ObjectImpl instance"; if(allClassMembers.size() > 1) { _out << ", int member"; } - _out << ")"; + _out << ") : base(type)"; _out << sb; _out << nl << "_instance = (" << name << ")instance;"; if(allClassMembers.size() > 1) @@ -710,7 +710,9 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream) string memberName = fixId((*d)->name(), DotNet::ICloneable, true); string memberType = typeToString((*d)->type()); _out << nl << "_instance." << memberName << " = (" << memberType << ")v;"; - _out << nl << "_typeId = \"" << memberType << "\";"; + ContainedPtr contained = ContainedPtr::dynamicCast((*d)->type()); + string sliceId = contained ? contained->scoped() : "::Ice::Object"; + _out << nl << "_typeId = \"" << sliceId << "\";"; if(allClassMembers.size() > 1) { _out << nl << "break;"; @@ -724,10 +726,7 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream) _out << eb; _out << nl << "catch(System.InvalidCastException)"; _out << sb; - _out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();"; - _out << nl << "_e.type = v.ice_id();"; - _out << nl << "_e.expectedType = _typeId;"; - _out << nl << "throw _e;"; + _out << nl << "IceInternal.Ex.throwUOE(_typeId, v.ice_id());"; _out << eb; _out << eb; @@ -1329,7 +1328,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sp << nl << "public " << name << "Helper(Ice.InputStream inS__)"; _out << sb; _out << nl << "_in = inS__;"; - _out << nl << "_pp = new IceInternal.ParamPatcher<" << scoped << ">();"; + _out << nl << "_pp = new IceInternal.ParamPatcher<" << scoped << ">(\"" << p->scoped() << "\");"; _out << eb; _out << sp << nl << "public static void write(Ice.OutputStream outS__, " << fixId(name) << " v__)"; @@ -1957,12 +1956,12 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) } _out << "class Patcher__ : IceInternal.Patcher<" << name << ">"; _out << sb; - _out << sp << nl << "internal Patcher__(Ice.Exception instance"; + _out << sp << nl << "internal Patcher__(string type, Ice.Exception instance"; if(allClassMembers.size() > 1) { _out << ", int member"; } - _out << ")"; + _out << ") : base(type)"; _out << sb; _out << nl << "_instance = (" << name << ")instance;"; if(allClassMembers.size() > 1) @@ -1992,7 +1991,9 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) string memberName = fixId((*q)->name(), DotNet::ApplicationException); string memberType = typeToString((*q)->type()); _out << nl << "_instance." << memberName << " = (" << memberType << ")v;"; - _out << nl << "_typeId = \"" << memberType << "\";"; + ContainedPtr contained = ContainedPtr::dynamicCast((*q)->type()); + string sliceId = contained ? contained->scoped() : "::Ice::Object"; + _out << nl << "_typeId = \"" << sliceId << "\";"; if(allClassMembers.size() > 1) { _out << nl << "break;"; @@ -2006,10 +2007,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << eb; _out << nl << "catch(System.InvalidCastException)"; _out << sb; - _out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();"; - _out << nl << "_e.type = v.ice_id();"; - _out << nl << "_e.expectedType = _typeId;"; - _out << nl << "throw _e;"; + _out << nl << "IceInternal.Ex.throwUOE(_typeId, v.ice_id());"; _out << eb; _out << eb; @@ -2357,12 +2355,12 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) { _out << sp << nl << "public sealed class Patcher__ : IceInternal.Patcher<" << name << ">"; _out << sb; - _out << sp << nl << "internal Patcher__(" << name << " instance"; + _out << sp << nl << "internal Patcher__(string type, " << name << " instance"; if(classMembers.size() > 1) { _out << ", int member"; } - _out << ")"; + _out << ") : base(type)"; _out << sb; _out << nl << "_instance = instance;"; if(classMembers.size() > 1) @@ -2392,7 +2390,9 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) string memberType = typeToString((*q)->type()); string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0); _out << nl << "_instance." << memberName << " = (" << memberType << ")v;"; - _out << nl << "_typeId = \"" << memberType<< "\";"; + ContainedPtr contained = ContainedPtr::dynamicCast((*q)->type()); + string sliceId = contained ? contained->scoped() : "::Ice::Object"; + _out << nl << "_typeId = \"" << sliceId << "\";"; if(classMembers.size() > 1) { _out << nl << "break;"; @@ -2406,10 +2406,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) _out << eb; _out << nl << "catch(System.InvalidCastException)"; _out << sb; - _out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();"; - _out << nl << "_e.type = v.ice_id();"; - _out << nl << "_e.expectedType = _typeId;"; - _out << nl << "throw _e;"; + _out << nl << "IceInternal.Ex.throwUOE(_typeId, v.ice_id());"; _out << eb; _out << eb; @@ -3501,9 +3498,10 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p) bool hasClassValue = (builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(value); if(hasClassValue) { - _out << sp << nl << "public sealed class Patcher__ : IceInternal.Patcher<" << name << ">"; + string expectedType = ContainedPtr::dynamicCast(value)->scoped(); + _out << sp << nl << "public sealed class Patcher__ : IceInternal.Patcher<" << valueS << ">"; _out << sb; - _out << sp << nl << "internal Patcher__(" << name << " m, " << keyS << " key)"; + _out << sp << nl << "internal Patcher__(string type, " << name << " m, " << keyS << " key) : base(type)"; _out << sb; _out << nl << "_m = m;"; _out << nl << "_key = key;"; @@ -3517,10 +3515,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p) _out << eb; _out << nl << "catch(System.InvalidCastException)"; _out << sb; - _out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();"; - _out << nl << "_e.type = v.GetType().FullName;"; - _out << nl << "_e.expectedType = \"" << typeToString(p->valueType()) << "\";"; - _out << nl << "throw _e;"; + _out << nl << "IceInternal.Ex.throwUOE(type(), v.ice_id());"; _out << eb; _out << eb; @@ -3894,8 +3889,9 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) { _out << nl << retS << " ret__;"; ContainedPtr contained = ContainedPtr::dynamicCast(ret); + string sliceId = contained ? contained->scoped() : "::Ice::Object"; _out << nl << "IceInternal.ParamPatcher<" << retS << "> ret___PP = new IceInternal.ParamPatcher<" - << retS << ">();"; + << retS << ">(\"" << sliceId << "\");"; _out << nl << "is__.readObject(ret___PP);"; } else @@ -3932,10 +3928,9 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) _out << eb; _out << nl << "catch(System.InvalidCastException)"; _out << sb; - _out << nl << "Ice.UnexpectedObjectException ex = new Ice.UnexpectedObjectException();"; - _out << nl << "ex.type = " << param << "_PP.value.ice_id();"; - _out << nl << "ex.expectedType = \"" << q->first->typeId() << "\";"; - _out << nl << "throw ex;"; + _out << nl << param << " = null;"; + _out << nl << "IceInternal.Ex.throwUOE(" << param << "_PP.type(), " + << param << "_PP.value.ice_id());"; _out << eb; } } @@ -3951,10 +3946,8 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) _out << eb; _out << nl << "catch(System.InvalidCastException)"; _out << sb; - _out << nl << "Ice.UnexpectedObjectException ex = new Ice.UnexpectedObjectException();"; - _out << nl << "ex.type = ret___PP.value.ice_id();"; - _out << nl << "ex.expectedType = \"" << ret->typeId() << "\";"; - _out << nl << "throw ex;"; + _out << nl << "ret__ = null;"; + _out << nl << "IceInternal.Ex.throwUOE(ret___PP.type(), ret___PP.value.ice_id());"; _out << eb; } _out << nl << "return ret__;"; @@ -4138,9 +4131,9 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) // Set out parameters // - for(vector<string>::iterator q = outHolders.begin(); q != outHolders.end(); ++q) + for(vector<string>::iterator s = outHolders.begin(); s != outHolders.end(); ++s) { - _out << nl << (*q) << " = " << (*q) << "Holder__;"; + _out << nl << (*s) << " = " << (*s) << "Holder__;"; } if(ret) diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 471b0a9697a..64870af0e4f 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -540,7 +540,16 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& { out << sp << nl << "public final " << typeToString(ret, TypeModeReturn, package, op->getMetaData()) << nl << opName << spar << params << epar; - writeThrowsClause(package, throws); + if(op->hasMetaData("UserException")) + { + out.inc(); + out << nl << "throws Ice.UserException"; + out.dec(); + } + else + { + writeThrowsClause(package, throws); + } out << sb << nl; if(ret) { @@ -1034,10 +1043,7 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& out << eb; out << nl << "catch(ClassCastException ex)"; out << sb; - out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();"; - out << nl << "_e.type = v.ice_id();"; - out << nl << "_e.expectedType = type();"; - out << nl << "throw _e;"; + out << nl << "IceInternal.Ex.throwUOE(type(), v.ice_id());"; out << eb; out << eb; @@ -1433,7 +1439,16 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent) out << "Ice.Current __current"; } out << epar; - writeThrowsClause(package, throws); + if(op->hasMetaData("UserException")) + { + out.inc(); + out << nl << "throws Ice.UserException"; + out.dec(); + } + else + { + writeThrowsClause(package, throws); + } out << ';'; } @@ -1598,10 +1613,19 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p) } out << epar; - ExceptionList throws = (*r)->throws(); - throws.sort(); - throws.unique(); - writeThrowsClause(package, throws); + if((*r)->hasMetaData("UserException")) + { + out.inc(); + out << nl << "throws Ice.UserException"; + out.dec(); + } + else + { + ExceptionList throws = (*r)->throws(); + throws.sort(); + throws.unique(); + writeThrowsClause(package, throws); + } out << sb; out << nl; if(ret && !hasAMD) @@ -2082,10 +2106,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) out << eb; out << nl << "catch(ClassCastException ex)"; out << sb; - out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();"; - out << nl << "_e.type = v.ice_id();"; - out << nl << "_e.expectedType = type();"; - out << nl << "throw _e;"; + out << nl << "IceInternal.Ex.throwUOE(type(), v.ice_id());"; out << eb; out << eb; @@ -2491,10 +2512,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) out << eb; out << nl << "catch(ClassCastException ex)"; out << sb; - out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();"; - out << nl << "_e.type = v.ice_id();"; - out << nl << "_e.expectedType = type();"; - out << nl << "throw _e;"; + out << nl << "IceInternal.Ex.throwUOE(type(), v.ice_id());"; out << eb; out << eb; @@ -3232,10 +3250,7 @@ Slice::Gen::HolderVisitor::writeHolder(const TypePtr& p) out << eb; out << nl << "catch(ClassCastException ex)"; out << sb; - out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();"; - out << nl << "_e.type = v.ice_id();"; - out << nl << "_e.expectedType = type();"; - out << nl << "throw _e;"; + out << nl << "IceInternal.Ex.throwUOE(type(), v.ice_id());"; out << eb; out << eb; @@ -4337,7 +4352,10 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << "final " << resultTypeHolder << " __result = new " << resultTypeHolder << "();"; } - out << nl << "IceInternal.Direct __direct = new IceInternal.Direct(__current)"; + out << nl << "IceInternal.Direct __direct = null;"; + out << nl << "try"; + out << sb; + out << nl << "__direct = new IceInternal.Direct(__current)"; out << sb; out << nl << "public Ice.DispatchStatus run(Ice.Object __obj)"; out << sb; @@ -4364,7 +4382,6 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) } out << "__servant." << opName << spar << args << "__current" << epar << ';'; out << nl << "return Ice.DispatchStatus.DispatchOK;"; - if(!throws.empty()) { out << eb; @@ -4374,50 +4391,80 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << "return Ice.DispatchStatus.DispatchUserException;"; out << eb; } + out << eb; out << eb; out << ";"; - out << nl << "try"; + out << sp << nl << "Ice.DispatchStatus __status = __direct.servant().__collocDispatch(__direct);"; + out << nl << "if(__status == Ice.DispatchStatus.DispatchUserException)"; out << sb; - out << nl << "Ice.DispatchStatus __status = __direct.servant().__collocDispatch(__direct);"; - if(!throws.empty()) - { - out << nl << "if(__status == Ice.DispatchStatus.DispatchUserException)"; - out << sb; - out << nl << "try"; - out << sb; - out << nl << "__direct.throwUserException();"; - out << eb; - for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t) - { - string exS = getAbsolute(*t, package); - out << nl << "catch(" << exS << " __ex)"; - out << sb; - out << nl << "throw __ex;"; - out << eb; - } - out << nl << "catch(Ice.UserException __ex)"; - out << sb; - out << nl << "assert false;"; - out << nl << "throw new Ice.UnknownUserException(__ex.toString());"; - out << eb; - out << eb; - } + out << nl << "__direct.throwUserException();"; + out << eb; out << nl << "assert __status == Ice.DispatchStatus.DispatchOK;"; if(ret) { out << nl << "return __result.value;"; } + out << eb; + for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t) + { + string exS = getAbsolute(*t, package); + out << nl << "catch(" << exS << " __ex)"; + out << sb; + out << nl << "throw __ex;"; + out << eb; + } + + // + // Next two catch handlers keep local exceptions non-transparent. + // + out << nl << "catch(Ice.UserException __ex)"; + out << sb; + out << nl << "IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);"; + out << eb; + out << nl << "catch(Ice.LocalException __ex)"; + out << sb; + out << nl << "IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);"; + out << eb; + + /* + // + // Commented-out code makes local exceptions fully location transparent, + // but the Freeze evictor relies on them being non-transparent. + // out << nl << "catch(Ice.LocalException __ex)"; out << sb; - out << nl << "throw new IceInternal.LocalExceptionWrapper(__ex, false);"; + out << nl << "IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);"; out << eb; + */ out << nl << "finally"; out << sb; + out << nl << "if(__direct != null)"; + out << sb; + out << nl << "try"; + out << sb; out << nl << "__direct.destroy();"; out << eb; + for(ExceptionList::const_iterator k = throws.begin(); k != throws.end(); ++k) + { + string exS = getAbsolute(*k, package); + out << nl << "catch(" << exS << " __ex)"; + out << sb; + out << nl << "throw __ex;"; + out << eb; + } + out << nl << "catch(java.lang.Throwable __ex)"; + out << sb; + out << nl << "IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);"; + out << eb; + out << eb; + out << eb; + } + if(ret && !cl->hasMetaData("amd") && !op->hasMetaData("amd")) + { + out << nl << "return __result.value;"; } out << eb; } @@ -4700,7 +4747,16 @@ Slice::Gen::BaseImplVisitor::writeOperation(Output& out, const string& package, throws.sort(); throws.unique(); - writeThrowsClause(package, throws); + if(op->hasMetaData("UserException")) + { + out.inc(); + out << nl << "throws Ice.UserException"; + out.dec(); + } + else + { + writeThrowsClause(package, throws); + } out << sb; diff --git a/cpp/src/slice2vb/.depend b/cpp/src/slice2vb/.depend deleted file mode 100644 index 1b1a00207ba..00000000000 --- a/cpp/src/slice2vb/.depend +++ /dev/null @@ -1,2 +0,0 @@ -Gen$(OBJEXT): Gen.cpp ../../include/IceUtil/DisableWarnings.h ../../include/IceUtil/Functional.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ./Gen.h ../../include/Slice/VbUtil.h ../../include/Slice/Parser.h ../../include/IceUtil/Shared.h ../../include/IceUtil/InputUtil.h ../../include/IceUtil/OutputUtil.h ../../include/IceUtil/Algorithm.h ../../include/IceUtil/Iterator.h ../../include/IceUtil/UUID.h ../../include/Slice/Checksum.h ../../include/Slice/DotNetNames.h -Main$(OBJEXT): Main.cpp ../../include/IceUtil/Options.h ../../include/IceUtil/Config.h ../../include/IceUtil/RecMutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Handle.h ../../include/Slice/Preprocessor.h ./Gen.h ../../include/Slice/VbUtil.h ../../include/Slice/Parser.h ../../include/IceUtil/InputUtil.h ../../include/IceUtil/OutputUtil.h diff --git a/cpp/src/slice2vb/Gen.cpp b/cpp/src/slice2vb/Gen.cpp deleted file mode 100755 index 874e8400bd2..00000000000 --- a/cpp/src/slice2vb/Gen.cpp +++ /dev/null @@ -1,5916 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include <IceUtil/DisableWarnings.h> -#include <IceUtil/Functional.h> -#include <Gen.h> -#include <limits> -#include <sys/stat.h> -#ifndef _WIN32 -#include <unistd.h> -#else -#include <direct.h> -#endif -#include <IceUtil/Algorithm.h> -#include <IceUtil/Iterator.h> -#include <IceUtil/UUID.h> -#include <Slice/Checksum.h> -#include <Slice/DotNetNames.h> - -using namespace std; -using namespace Slice; - -// -// Don't use "using namespace IceUtil", or VC++ 6.0 complains -// about ambigious symbols for constructs like -// "IceUtil::constMemFun(&Slice::Exception::isLocal)". -// -using IceUtil::Output; -using IceUtil::nl; -using IceUtil::sp; -using IceUtil::spar; -using IceUtil::epar; - -static string // Should be an anonymous namespace, but VC++ 6 can't handle that. -sliceModeToIceMode(Operation::Mode opMode) -{ - string mode; - switch(opMode) - { - case Operation::Normal: - { - mode = "Ice.OperationMode.Normal"; - break; - } - case Operation::Nonmutating: - { - mode = "Ice.OperationMode.Nonmutating"; - break; - } - case Operation::Idempotent: - { - mode = "Ice.OperationMode.Idempotent"; - break; - } - default: - { - assert(false); - break; - } - } - return mode; -} - -static void -emitDeprecate(const ContainedPtr& p1, const ContainedPtr& p2, Output& out, string type) -{ - string deprecateMetadata; - if(p1->findMetaData("deprecate", deprecateMetadata) || - (p2 != 0 && p2->findMetaData("deprecate", deprecateMetadata))) - { - string deprecateReason = "This " + type + " has been deprecated."; - if(deprecateMetadata.find("deprecate:") == 0 && deprecateMetadata.size() > 10) - { - deprecateReason = deprecateMetadata.substr(10); - } - out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>"; - } -} - -Slice::VbVisitor::VbVisitor(Output& out) : _out(out) -{ -} - -Slice::VbVisitor::~VbVisitor() -{ -} - -void -Slice::VbVisitor::writeInheritedOperations(const ClassDefPtr& p) -{ - ClassList bases = p->bases(); - if(!bases.empty() && !bases.front()->isInterface()) - { - bases.pop_front(); - } - if(!bases.empty()) - { - _out.zeroIndent(); - _out << sp << nl << "#Region \"Inherited Slice operations\""; - _out.restoreIndent(); - - OperationList allOps; - for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q) - { - OperationList tmp = (*q)->allOperations(); - allOps.splice(allOps.end(), tmp); - } - allOps.sort(); - allOps.unique(); - for(OperationList::const_iterator op = allOps.begin(); op != allOps.end(); ++op) - { - ClassDefPtr containingClass = ClassDefPtr::dynamicCast((*op)->container()); - bool amd = containingClass->hasMetaData("amd") || (*op)->hasMetaData("amd"); - string name = (*op)->name(); - TypePtr ret = (*op)->returnType(); - - if(!amd) - { - vector<string> params = getParams(*op); - vector<string> args = getArgs(*op); - string retS = typeToString((*op)->returnType()); - - string vbOp = ret ? "Function" : "Sub"; - _out << sp << nl << "Public " << vbOp << ' ' << fixId(name, DotNet::ICloneable, true) - << spar << params << epar; - if(ret) - { - _out << " As " << retS; - } - _out << " Implements " << fixId(containingClass->scoped() + "OperationsNC_.") - << fixId(name, DotNet::ICloneable, true); - _out.inc(); - _out << nl; - if((*op)->returnType()) - { - _out << "Return "; - } - _out << fixId(name, DotNet::ICloneable, true) - << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar; - _out.dec(); - _out << nl << "End " << vbOp; - - _out << sp << nl << "Public MustOverride " << vbOp << ' ' << fixId(name, DotNet::ICloneable, true) - << spar << params; - if(!containingClass->isLocal()) - { - _out << "ByVal current__ As Ice.Current"; - } - _out << epar; - if(ret) - { - _out << " As " << retS; - } - _out << " Implements " << fixId(containingClass->scoped() + "Operations_.") - << fixId(name, DotNet::ICloneable, true); - } - else - { - vector<string> params = getParamsAsync(*op, true); - vector<string> args = getArgsAsync(*op); - - _out << sp << nl << "Public Sub " << ' ' << name << "_async" << spar << params << epar - << " Implements " << fixId(containingClass->scoped() + "OperationsNC_.") - << name << "_async"; - _out.inc(); - _out << nl << name << "_async" << spar << args << epar; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public MustOverride Sub " << name << "_async" - << spar << params << "ByVal current__ As Ice.Current" << epar - << " Implements " << fixId(containingClass->scoped() + "Operations_.") - << name << "_async"; - } - } - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Inherited Slice operations - _out.restoreIndent(); - } -} - -void -Slice::VbVisitor::writeDispatch(const ClassDefPtr& p) -{ - string name = fixId(p->name()); - string scoped = p->scoped(); - ClassList allBases = p->allBases(); - StringList ids; - -#if defined(__IBMCPP__) && defined(NDEBUG) - // - // VisualAge C++ 6.0 does not see that ClassDef is a Contained, - // when inlining is on. The code below issues a warning: better - // than an error! - // - transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun<string,ClassDef>(&Contained::scoped)); -#else - transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); -#endif - - StringList other; - other.push_back(p->scoped()); - other.push_back("::Ice::Object"); - other.sort(); - ids.merge(other); - ids.unique(); - - StringList::const_iterator firstIter = ids.begin(); - StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), scoped); - assert(scopedIter != ids.end()); - StringList::difference_type scopedPos = ice_distance(firstIter, scopedIter); - - _out.zeroIndent(); - _out << sp << nl << "#Region \"Slice type-related members\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Shared Shadows ids__ As String() = New String() _"; - _out.inc(); - _out << nl << "{ _"; - _out.inc(); - - { - StringList::const_iterator q = ids.begin(); - while(q != ids.end()) - { - _out << nl << '"' << *q << '"'; - if(++q != ids.end()) - { - _out << ','; - } - _out << " _"; - } - } - _out.dec(); - _out << nl << '}'; - _out.dec(); - - _out << sp << nl << "Public Overloads Overrides Function ice_isA(ByVal s As String) As Boolean"; - _out.inc(); - _out << nl << "Return _System.Array.BinarySearch(ids__, s, IceUtil.StringUtil.OrdinalStringComparer) >= 0"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overloads Overrides Function ice_isA(ByVal s As String, Byval current__ As Ice.Current)" - " As Boolean"; - _out.inc(); - _out << nl << "Return _System.Array.BinarySearch(ids__, s, IceUtil.StringUtil.OrdinalStringComparer) >= 0"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overloads Overrides Function ice_ids() As String()"; - _out.inc(); - _out << nl << "Return ids__"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overloads Overrides Function ice_ids(ByVal current__ As Ice.Current) As String()"; - _out.inc(); - _out << nl << "Return ids__"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overloads Overrides Function ice_id() As String"; - _out.inc(); - _out << nl << "Return ids__(" << scopedPos << ")"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overloads Overrides Function ice_id(ByVal current__ As Ice.Current) As String"; - _out.inc(); - _out << nl << "Return ids__(" << scopedPos << ")"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overloads Shared Function ice_staticId() As String"; - _out.inc(); - _out << nl << "Return ids__(" << scopedPos << ")"; - _out.dec(); - _out << nl << "End Function"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Slice type-related members - _out.restoreIndent(); - - OperationList ops = p->operations(); - if(!p->isInterface() || ops.size() != 0) - { - _out.zeroIndent(); - _out << sp << nl << "#Region \"Operation dispatch\""; - _out.restoreIndent(); - } - - OperationList::const_iterator r; - for(r = ops.begin(); r != ops.end(); ++r) - { - OperationPtr op = *r; - ContainerPtr container = op->container(); - ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - assert(cl); - - string opName = op->name(); - _out << sp << nl << "Public Shared Function "<< opName << "___( _"; - _out.inc(); - _out.inc(); - _out << nl << "ByVal obj__ As " << p->name() << "Operations_, _"; - _out << nl << "ByVal inS__ As IceInternal.Incoming, _"; - _out << nl << "ByVal current__ As Ice.Current) As Ice.DispatchStatus"; - _out.dec(); - - bool amd = p->hasMetaData("amd") || op->hasMetaData("amd"); - if(!amd) - { - TypePtr ret = op->returnType(); - - TypeStringList inParams; - TypeStringList outParams; - ParamDeclList paramList = op->parameters(); - for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli) - { - if((*pli)->isOutParam()) - { - outParams.push_back(make_pair((*pli)->type(), (*pli)->name())); - } - else - { - inParams.push_back(make_pair((*pli)->type(), (*pli)->name())); - } - } - - ExceptionList throws = op->throws(); - throws.sort(); - throws.unique(); - - // - // Arrange exceptions into most-derived to least-derived order. If we don't - // do this, a base exception handler can appear before a derived exception - // handler, causing compiler warnings and resulting in the base exception - // being marshaled instead of the derived exception. - // -#if defined(__SUNPRO_CC) - throws.sort(Slice::derivedToBaseCompare); -#else - throws.sort(Slice::DerivedToBaseCompare()); -#endif - - TypeStringList::const_iterator q; - _out << nl << "checkMode__(" << sliceModeToIceMode(op->mode()) << ", current__.mode)"; - if(!inParams.empty()) - { - _out << nl << "Dim is__ As IceInternal.BasicStream = inS__.istr()"; - } - if(!outParams.empty() || ret || !throws.empty()) - { - _out << nl << "Dim os__ As IceInternal.BasicStream = inS__.ostr()"; - } - - // - // Unmarshal 'in' parameters. - // - for(q = inParams.begin(); q != inParams.end(); ++q) - { - string param = fixId(q->second); - string typeS = typeToString(q->first); - BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first); - bool isClass = (builtin && builtin->kind() == Builtin::KindObject) - || ClassDeclPtr::dynamicCast(q->first); - if(!isClass) - { - _out << nl << "Dim " << param << " As " << typeS << " = Nothing"; - } - writeMarshalUnmarshalCode(_out, q->first, param, false, false, true); - } - if(op->sendsClasses()) - { - _out << nl << "is__.readPendingObjects()"; - } - - for(q = outParams.begin(); q != outParams.end(); ++q) - { - string typeS = typeToString(q->first); - _out << nl << "Dim " << fixId(q->second) << " As " << typeS << " = Nothing"; - } - - // - // Call on the servant. - // - if(!throws.empty()) - { - _out << nl << "Try"; - _out.inc(); - } - _out << nl; - if(ret) - { - string retS = typeToString(ret); - _out << "Dim ret__ As " << retS << " = "; - } - _out << "obj__." << fixId(opName, DotNet::ICloneable, true) << spar; - for(q = inParams.begin(); q != inParams.end(); ++q) - { - BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first); - bool isClass = (builtin && builtin->kind() == Builtin::KindObject) - || ClassDeclPtr::dynamicCast(q->first); - - if(isClass) - { - _out << "CType(" + fixId(q->second) + "_PP.value, " + typeToString(q->first) + ")"; - } - else - { - _out << fixId(q->second); - } - } - for(q = outParams.begin(); q != outParams.end(); ++q) - { - _out << fixId(q->second); - } - _out << "current__" << epar; - - // - // Marshal 'out' parameters and return value. - // - for(q = outParams.begin(); q != outParams.end(); ++q) - { - writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, true, ""); - } - if(ret) - { - writeMarshalUnmarshalCode(_out, ret, "ret__", true, false, true, ""); - } - if(op->returnsClasses()) - { - _out << nl << "os__.writePendingObjects()"; - } - _out << nl << "Return Ice.DispatchStatus.DispatchOK"; - - // - // Handle user exceptions. - // - if(!throws.empty()) - { - _out.dec(); - ExceptionList::const_iterator t; - for(t = throws.begin(); t != throws.end(); ++t) - { - string exS = fixId((*t)->scoped()); - _out << nl << "Catch ex As " << exS; - _out.inc(); - _out << nl << "os__.writeUserException(ex)"; - _out << nl << "Return Ice.DispatchStatus.DispatchUserException"; - } - _out.dec(); - _out << nl << "End Try"; - } - - _out.dec(); - _out << nl << "End Function"; - } - else - { - TypeStringList inParams; - ParamDeclList paramList = op->parameters(); - for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli) - { - if(!(*pli)->isOutParam()) - { - inParams.push_back(make_pair((*pli)->type(), (*pli)->name())); - } - } - - TypeStringList::const_iterator q; - _out << nl << "checkMode__(" << sliceModeToIceMode(op->mode()) << ", current__.mode)"; - if(!inParams.empty()) - { - _out << nl << "Dim is__ As IceInternal.BasicStream = inS__.istr()"; - } - - // - // Unmarshal 'in' parameters. - // - for(q = inParams.begin(); q != inParams.end(); ++q) - { - BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first); - bool isClass = (builtin && builtin->kind() == Builtin::KindObject) - || ClassDeclPtr::dynamicCast(q->first); - if(!isClass) - { - _out << nl << "Dim " << fixId(q->second) << " As " << typeToString(q->first); - } - writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true); - } - if(op->sendsClasses()) - { - _out << nl << "is__.readPendingObjects()"; - } - - // - // Call on the servant. - // - string classNameAMD = "AMD_" + p->name(); - _out << nl << "Dim cb__ As " << classNameAMD << '_' << op->name() << " = new _" - << classNameAMD << '_' << op->name() << "(inS__)"; - _out << nl << "Try"; - _out.inc(); - _out << nl << "obj__."; - if(amd) - { - _out << opName << "_async"; - } - else - { - _out << fixId(opName, DotNet::ICloneable, true); - } - _out << spar; - if(amd) - { - _out << "cb__"; - } - for(q = inParams.begin(); q != inParams.end(); ++q) - { - BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first); - bool isClass = (builtin && builtin->kind() == Builtin::KindObject) - || ClassDeclPtr::dynamicCast(q->first); - if(isClass) - { - _out << "CType(" + q->second + "__PP.value, " + typeToString(q->first); - } - else - { - _out << fixId(q->second); - } - } - _out << "current__" << epar; - _out.dec(); - _out << nl << "Catch ex As _System.Exception"; - _out.inc(); - _out << nl << "cb__.ice_exception(ex)"; - _out.dec(); - _out << nl << "End Try"; - _out << nl << "Return Ice.DispatchStatus.DispatchAsync"; - - _out.dec(); - _out << nl << "End Function"; - } - } - - OperationList allOps = p->allOperations(); - if(!allOps.empty()) - { - StringList allOpNames; -#if defined(__IBMCPP__) && defined(NDEBUG) - // - // See comment for transform above - // - transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun<string,Operation>(&Contained::name)); -#else - transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name)); -#endif - allOpNames.push_back("ice_id"); - allOpNames.push_back("ice_ids"); - allOpNames.push_back("ice_isA"); - allOpNames.push_back("ice_ping"); - allOpNames.sort(); - allOpNames.unique(); - - StringList::const_iterator q; - - _out << sp << nl << "Public Shared Shadows all__ As String() = New String() _"; - _out.inc(); - _out << nl << "{ _"; - _out.inc(); - - q = allOpNames.begin(); - while(q != allOpNames.end()) - { - _out << nl << '"' << *q << '"'; - if(++q != allOpNames.end()) - { - _out << ','; - } - _out << " _"; - } - _out.dec(); - _out << nl << '}'; - _out.dec(); - - _out << sp << nl << "Public Overloads Overrides Function dispatch__( _"; - _out.inc(); - _out.inc(); - _out << nl << "ByVal inS__ As IceInternal.Incoming, _"; - _out << nl << "ByVal current__ As Ice.Current) As Ice.DispatchStatus"; - _out.dec(); - _out << nl << "Dim pos As Integer"; - _out << nl << "pos = _System.Array.BinarySearch(all__, current__.operation, " - << "IceUtil.StringUtil.OrdinalStringComparer)"; - _out << nl << "If pos < 0 Then"; - _out.inc(); - _out << nl << "Throw New Ice.ObjectNotExistException(current__.id, current__.facet, current__.operation)"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "Select Case pos"; - _out.inc(); - int i = 0; - for(q = allOpNames.begin(); q != allOpNames.end(); ++q) - { - string opName = *q; - - _out << nl << "Case " << i++; - _out.inc(); - if(opName == "ice_id") - { - _out << nl << "Return ice_id___(Me, inS__, current__)"; - } - else if(opName == "ice_ids") - { - _out << nl << "Return ice_ids___(Me, inS__, current__)"; - } - else if(opName == "ice_isA") - { - _out << nl << "Return ice_isA___(Me, inS__, current__)"; - } - else if(opName == "ice_ping") - { - _out << nl << "Return ice_ping___(Me, inS__, current__)"; - } - else - { - // - // There's probably a better way to do this - // - for(OperationList::const_iterator t = allOps.begin(); t != allOps.end(); ++t) - { - if((*t)->name() == (*q)) - { - ContainerPtr container = (*t)->container(); - ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - assert(cl); - if(cl->scoped() == p->scoped()) - { - _out << nl << "Return " << opName << "___(Me, inS__, current__)"; - } - else - { - string base = cl->scoped(); - if(cl->isInterface()) - { - base += "Disp_"; - } - _out << nl << "Return " << fixId(base) << "." << opName << "___(Me, inS__, current__)"; - } - break; - } - } - } - _out.dec(); - } - _out.dec(); - _out << nl << "End Select"; - _out << sp << nl << "' _System.Diagnostics.Debug.Assert(false) ' Bug in VB 7.1: Diagnostics.Debug is not found"; - _out << nl << "Throw New Ice.ObjectNotExistException(current__.id, current__.facet, current__.operation)"; - _out.dec(); - _out << nl << "End Function"; - } - - if(!p->isInterface() || ops.size() != 0) - { - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Operation dispatch - _out.restoreIndent(); - } -} - -string -Slice::VbVisitor::getParamAttributes(const ParamDeclPtr& p) -{ - string result; - StringList metaData = p->getMetaData(); - for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i) - { - static const string prefix = "vb:attribute:"; - if(i->find(prefix) == 0) - { - result += "<" + i->substr(prefix.size()) + "> "; - } - } - return result; -} - -vector<string> -Slice::VbVisitor::getParams(const OperationPtr& op) -{ - vector<string> params; - ParamDeclList paramList = op->parameters(); - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - string param = getParamAttributes(*q); - param += ((*q)->isOutParam() ? "<_System.Runtime.InteropServices.Out()> ByRef " : "ByVal ") - + fixId((*q)->name()) + " As " + typeToString((*q)->type()); - params.push_back(param); - } - return params; -} - -vector<string> -Slice::VbVisitor::getParamsAsync(const OperationPtr& op, bool amd) -{ - vector<string> params; - - string name = op->name(); - ContainerPtr container = op->container(); - ClassDefPtr cl = ClassDefPtr::dynamicCast(container); // Get the class containing the op. - string param = "ByVal cb__ As "; - string scope = fixId(cl->scope()); - param += scope + (amd ? "AMD_" : "AMI_") + cl->name() + "_" + op->name(); - params.push_back(param); - - ParamDeclList paramList = op->parameters(); - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - if(!(*q)->isOutParam()) - { - params.push_back(getParamAttributes(*q) + "ByVal " + fixId((*q)->name()) + " As " - + typeToString((*q)->type())); - } - } - return params; -} - -vector<string> -Slice::VbVisitor::getParamsAsyncCB(const OperationPtr& op) -{ - vector<string> params; - - TypePtr ret = op->returnType(); - if(ret) - { - params.push_back("ByVal ret__ As " + typeToString(ret)); - } - - ParamDeclList paramList = op->parameters(); - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - if((*q)->isOutParam()) - { - params.push_back(getParamAttributes(*q) + "ByVal " + fixId((*q)->name()) + " As " - + typeToString((*q)->type())); - } - } - - return params; -} - -vector<string> -Slice::VbVisitor::getArgs(const OperationPtr& op) -{ - vector<string> args; - ParamDeclList paramList = op->parameters(); - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - string arg = fixId((*q)->name()); - args.push_back(arg); - } - return args; -} - -vector<string> -Slice::VbVisitor::getArgsAsync(const OperationPtr& op) -{ - vector<string> args; - - args.push_back("cb__"); - - ParamDeclList paramList = op->parameters(); - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - if(!(*q)->isOutParam()) - { - args.push_back(fixId((*q)->name())); - } - } - return args; -} - -vector<string> -Slice::VbVisitor::getArgsAsyncCB(const OperationPtr& op) -{ - vector<string> args; - - TypePtr ret = op->returnType(); - if(ret) - { - args.push_back("ret__"); - } - - ParamDeclList paramList = op->parameters(); - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - if((*q)->isOutParam()) - { - args.push_back(fixId((*q)->name())); - } - } - - return args; -} - -void -Slice::VbVisitor::emitAttributes(const ContainedPtr& p) -{ - StringList metaData = p->getMetaData(); - for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i) - { - static const string prefix = "vb:attribute:"; - if(i->find(prefix) == 0) - { - _out << nl << '<' << i->substr(prefix.size()) << '>'; - } - } -} - -Slice::Gen::Gen(const string& name, const string& base, const vector<string>& includePaths, const string& dir, - bool impl, bool implTie, bool stream) - : _includePaths(includePaths), - _stream(stream) -{ - string fileBase = base; - string::size_type pos = base.find_last_of("/\\"); - if(pos != string::npos) - { - fileBase = base.substr(pos + 1); - } - string file = fileBase + ".vb"; - string fileImpl = fileBase + "I.vb"; - - if(!dir.empty()) - { - file = dir + '/' + file; - fileImpl = dir + '/' + fileImpl; - } - - _out.open(file.c_str()); - if(!_out) - { - cerr << name << ": can't open `" << file << "' for writing" << endl; - return; - } - printHeader(); - - _out << nl << "' Generated from file `" << fileBase << ".ice'"; - - _out << sp << nl << "Imports _System = System"; - _out << nl << "Imports _Microsoft = Microsoft"; - - if(impl || implTie) - { - struct stat st; - if(stat(fileImpl.c_str(), &st) == 0) - { - cerr << name << ": `" << fileImpl << "' already exists - will not overwrite" << endl; - return; - } - _impl.open(fileImpl.c_str()); - if(!_impl) - { - cerr << name << ": can't open `" << fileImpl << "' for writing" << endl; - return; - } - } -} - -Slice::Gen::~Gen() -{ - if(_out.isOpen()) - { - _out << '\n'; - } - if(_impl.isOpen()) - { - _impl << '\n'; - } -} - -bool -Slice::Gen::operator!() const -{ - return !_out; -} - -void -Slice::Gen::generate(const UnitPtr& p) -{ - - VbGenerator::validateMetaData(p); - - UnitVisitor unitVisitor(_out, _stream); - p->visit(&unitVisitor, false); - - TypesVisitor typesVisitor(_out, _stream); - p->visit(&typesVisitor, false); - - ProxyVisitor proxyVisitor(_out); - p->visit(&proxyVisitor, false); - - OpsVisitor opsVisitor(_out); - p->visit(&opsVisitor, false); - - HelperVisitor helperVisitor(_out, _stream); - p->visit(&helperVisitor, false); - - DelegateVisitor delegateVisitor(_out); - p->visit(&delegateVisitor, false); - - DelegateMVisitor delegateMVisitor(_out); - p->visit(&delegateMVisitor, false); - - DelegateDVisitor delegateDVisitor(_out); - p->visit(&delegateDVisitor, false); - - DispatcherVisitor dispatcherVisitor(_out); - p->visit(&dispatcherVisitor, false); - - AsyncVisitor asyncVisitor(_out); - p->visit(&asyncVisitor, false); -} - -void -Slice::Gen::generateTie(const UnitPtr& p) -{ - TieVisitor tieVisitor(_out); - p->visit(&tieVisitor, false); -} - -void -Slice::Gen::generateImpl(const UnitPtr& p) -{ - ImplVisitor implVisitor(_impl); - p->visit(&implVisitor, false); -} - -void -Slice::Gen::generateImplTie(const UnitPtr& p) -{ - ImplTieVisitor implTieVisitor(_impl); - p->visit(&implTieVisitor, false); -} - -void -Slice::Gen::generateChecksums(const UnitPtr& p) -{ - ChecksumMap map = createChecksums(p); - if(!map.empty()) - { - string className = "X" + IceUtil::generateUUID(); - for(string::size_type pos = 1; pos < className.size(); ++pos) - { - if(!isalnum(className[pos])) - { - className[pos] = '_'; - } - } - - _out << sp << nl << "Namespace IceInternal"; - _out.inc(); - _out << sp << nl << "Namespace SliceChecksums"; - _out.inc(); - _out << sp << nl << "Public NotInheritable Class " << className; - _out.inc(); - _out << nl << "Public Shared Readonly map As _System.Collections.Hashtable" - << " = new _System.Collections.Hashtable()"; - _out << sp << nl << "Shared Sub New()"; - _out.inc(); - for(ChecksumMap::const_iterator q = map.begin(); q != map.end(); ++q) - { - _out << nl << "map.Add(\"" << q->first << "\", \""; - ostringstream str; - str.flags(ios_base::hex); - str.fill('0'); - for(vector<unsigned char>::const_iterator r = q->second.begin(); r != q->second.end(); ++r) - { - str << (int)(*r); - } - _out << str.str() << "\")"; - } - _out.dec(); - _out << nl << "End Sub"; - _out.dec(); - _out << sp << nl << "End Class"; - _out.dec(); - _out << sp << nl << "End Namespace"; - _out.dec(); - _out << sp << nl << "End Namespace"; - } -} - -void -Slice::Gen::printHeader() -{ - static const char* header = -"' **********************************************************************\n" -"'\n" -"' Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.\n" -"'\n" -"' This copy of Ice is licensed to you under the terms described in the\n" -"' ICE_LICENSE file included in this distribution.\n" -"'\n" -"' **********************************************************************\n" - ; - - _out << header; - _out << "\n' Ice version " << ICE_STRING_VERSION; -} - -Slice::Gen::UnitVisitor::UnitVisitor(IceUtil::Output& out, bool stream) - : VbVisitor(out), _stream(stream), _globalMetaDataDone(false) -{ -} - -bool -Slice::Gen::UnitVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!_globalMetaDataDone) - { - DefinitionContextPtr dc = p->definitionContext(); - StringList globalMetaData = dc->getMetaData(); - - static const string attributePrefix = "vb:attribute:"; - - if(!globalMetaData.empty()) - { - _out << sp; - } - for(StringList::const_iterator q = globalMetaData.begin(); q != globalMetaData.end(); ++q) - { - string::size_type pos = q->find(attributePrefix); - if(pos == 0) - { - string attrib = q->substr(pos + attributePrefix.size()); - _out << nl << '<' << attrib << '>'; - } - } - _globalMetaDataDone = true; // Do this only once per source file. - } - return false; -} - -Slice::Gen::TypesVisitor::TypesVisitor(IceUtil::Output& out, bool stream) - : VbVisitor(out), - _stream(stream) -{ -} - -bool -Slice::Gen::TypesVisitor::visitModuleStart(const ModulePtr& p) -{ - string name = fixId(p->name()); - _out << sp; - emitAttributes(p); - _out << nl << "Namespace " << name; - - _out.inc(); - - return true; -} - -void -Slice::Gen::TypesVisitor::visitModuleEnd(const ModulePtr&) -{ - _out.dec(); - _out << sp << nl << "End Namespace"; -} - -bool -Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - string name = fixId(p->name()); - string scoped = fixId(p->scoped()); - ClassList bases = p->bases(); - bool hasBaseClass = !bases.empty() && !bases.front()->isInterface(); - - if(!p->isLocal() && _stream) - { - _out << sp << nl << "Public NotInheritable Class " << p->name() << "Helper"; - _out.inc(); - - _out << sp << nl << "Public Sub New(ByVal inS__ As Ice.InputStream)"; - _out.inc(); - _out << nl << "_in = inS__"; - _out << nl << "_pp = New IceInternal.ParamPatcher(GetType(" << scoped << "), \"" << p->scoped() << "\")"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << name << ')'; - _out.inc(); - _out << nl << "outS__.writeObject(v__)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub read()"; - _out.inc(); - _out << nl << "_in.readObject(_pp)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public ReadOnly Property value() As " << scoped; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "Return CType(_pp.value, " << scoped << ')'; - _out.dec(); - _out << nl << "End Get"; - _out.dec(); - _out << nl << "End Property"; - - _out << sp << nl << "Private _in As Ice.InputStream"; - _out << nl << "Private _pp As IceInternal.ParamPatcher"; - - _out.dec(); - _out << sp << nl << "End Class"; - } - - _out << sp; - emitAttributes(p); - if(p->isInterface()) - { - _out << nl << "Public Interface " << name; - _out.inc(); - if(p->isLocal()) - { - _out << nl << "Inherits Ice.LocalObject"; - } - else - { - _out << nl << "Inherits Ice.Object"; - } - _out << ", " << p->name(); - if(!p->isLocal()) - { - _out << "Operations_, " << p->name(); - } - _out << "OperationsNC_"; - if(!bases.empty()) - { - ClassList::const_iterator q = bases.begin(); - while(q != bases.end()) - { - _out << ", " << fixId((*q)->scoped()); - q++; - } - } - } - else - { - _out << nl << "Public "; - if(p->isAbstract()) - { - _out << "MustInherit "; - } - _out << "Class " << name; - _out.inc(); - - if(!hasBaseClass) - { - if(p->isLocal()) - { - _out << nl << "Inherits Ice.LocalObjectImpl"; - } - else - { - _out << nl << "Inherits Ice.ObjectImpl"; - } - } - else - { - _out << nl << "Inherits " << fixId(bases.front()->scoped()); - bases.pop_front(); - } - if(p->isAbstract()) - { - _out << nl << "Implements " << p->name(); - if(!p->isLocal()) - { - _out << "Operations_, " << p->name(); - } - _out << "OperationsNC_"; - } - for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q) - { - if((*q)->isAbstract()) - { - _out << ", " << fixId((*q)->scoped()); - } - } - } - - if(!p->isInterface()) - { - _out.zeroIndent(); - if(p->hasDataMembers() && !p->hasOperations()) - { - _out << sp << nl << "#Region \"Slice data members\""; - } - else if(p->hasDataMembers()) - { - _out << sp << nl << "#Region \"Slice data members and operations\""; - } - else if(p->hasOperations()) - { - _out << sp << nl << "#Region \"Slice operations\""; - } - _out.restoreIndent(); - } - - return true; -} - -void -Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) -{ - string name = fixId(p->name()); - DataMemberList dataMembers = p->dataMembers(); - DataMemberList allDataMembers = p->allDataMembers(); - ClassList bases = p->bases(); - bool hasBaseClass = !bases.empty() && !bases.front()->isInterface(); - DataMemberList::const_iterator d; - - if(!p->isInterface()) - { - _out.zeroIndent(); - if(p->hasDataMembers() && !p->hasOperations()) - { - _out << sp << nl << "#End Region"; // Slice data members - } - else if(p->hasDataMembers()) - { - _out << sp << nl << "#End Region"; // Slice data members and operations - } - else if(p->hasOperations()) - { - _out << sp << nl << "#End Region"; // Slice operations - } - _out.restoreIndent(); - - if(!allDataMembers.empty()) - { - _out.zeroIndent(); - _out << sp << nl << "#Region \"Constructors\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Sub New" << spar << epar; - _out.inc(); - if(hasBaseClass) - { - _out << nl << "MyBase.New()"; - } - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub New" << spar; - vector<string> paramDecl; - for(d = allDataMembers.begin(); d != allDataMembers.end(); ++d) - { - string memberName = fixId((*d)->name()); - string memberType = typeToString((*d)->type()); - paramDecl.push_back("ByVal " + memberName + " As " + memberType); - } - _out << paramDecl << epar; - _out.inc(); - if(hasBaseClass && allDataMembers.size() != dataMembers.size()) - { - _out << nl << "MyBase.New" << spar; - vector<string> baseParamNames; - DataMemberList baseDataMembers = bases.front()->allDataMembers(); - for(d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d) - { - baseParamNames.push_back(fixId((*d)->name())); - } - _out << baseParamNames << epar; - } - vector<string> paramNames; - for(d = dataMembers.begin(); d != dataMembers.end(); ++d) - { - paramNames.push_back(fixId((*d)->name())); - } - for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i) - { - _out << nl << "Me." << *i << " = " << *i; - } - _out.dec(); - _out << nl << "End Sub"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Constructors - _out.restoreIndent(); - } - - writeInheritedOperations(p); - } - - if(!p->isInterface() && !p->isLocal()) - { - writeDispatch(p); - - DataMemberList members = p->dataMembers(); - - _out.zeroIndent(); - _out << sp << nl << "#Region \"Marshaling support\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal os__ As IceInternal.BasicStream)"; - _out.inc(); - _out << nl << "os__.writeTypeId(ice_staticId())"; - _out << nl << "os__.startWriteSlice()"; - for(d = members.begin(); d != members.end(); ++d) - { - writeMarshalUnmarshalCode(_out, (*d)->type(), fixId((*d)->name(), DotNet::ICloneable, true), true, false, - false); - } - _out << nl << "os__.endWriteSlice()"; - _out << nl << "MyBase.write__(os__)"; - _out.dec(); - _out << nl << "End Sub"; - - DataMemberList allClassMembers = p->allClassDataMembers(); - if(allClassMembers.size() != 0) - { - _out << sp << nl << "Public Shadows NotInheritable Class Patcher__"; - _out.inc(); - _out << nl << "Inherits IceInternal.Patcher"; - _out << sp << nl << "Friend Sub New(ByVal instance As Ice.ObjectImpl"; - if(allClassMembers.size() > 1) - { - _out << ", ByVal member As Integer"; - } - _out << ')'; - _out.inc(); - _out << nl << "_instance = CType(instance, " << name << ')'; - if(allClassMembers.size() > 1) - { - _out << nl << "_member = member"; - } - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overrides Sub patch(ByVal v As Ice.Object)"; - _out.inc(); - _out << nl << "Try"; - _out.inc(); - if(allClassMembers.size() > 1) - { - _out << nl << "Select Case _member"; - _out.inc(); - } - int memberCount = 0; - for(d = allClassMembers.begin(); d != allClassMembers.end(); ++d) - { - if(allClassMembers.size() > 1) - { - _out << nl << "Case " << memberCount; - _out.inc(); - } - string memberName = fixId((*d)->name(), DotNet::ICloneable, true); - string memberType = typeToString((*d)->type()); - _out << nl << "type_ = GetType(" << memberType << ')'; - _out << nl << "_instance." << memberName << " = CType(v, " << memberType << ')'; - _out << nl << "_typeId = \"" << (*d)->type()->typeId() << "\""; - if(allClassMembers.size() > 1) - { - _out.dec(); - } - memberCount++; - } - if(allClassMembers.size() > 1) - { - _out << nl << "End Select"; - } - _out.dec(); - _out << nl << "Catch _ex As System.InvalidCastException"; - _out.inc(); - _out << nl << "Dim _e As Ice.UnexpectedObjectException = New Ice.UnexpectedObjectException"; - _out << nl << "_e.type = v.ice_id()"; - _out << nl << "_e.expectedType = _typeId"; - _out << nl << "Throw _e"; - _out.dec(); - _out << nl << "End Try"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Private _instance As " << name; - if(allClassMembers.size() > 1) - { - _out << nl << "Private _member As Integer"; - } - _out << nl << "Private _typeId As String"; - _out.dec(); - _out << sp << nl << "End Class"; - } - - _out << sp << nl << "Public Overloads Overrides Sub read__(ByVal is__ As IceInternal.BasicStream, " - "ByVal rid__ As Boolean)"; - _out.inc(); - _out << nl << "If rid__ Then"; - _out.inc(); - _out << nl << "Dim myId As String = is__.readTypeId()"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "is__.startReadSlice()"; - DataMemberList classMembers = p->classDataMembers(); - int classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size()); - for(d = members.begin(); d != members.end(); ++d) - { - ostringstream patchParams; - patchParams << "Me"; - BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type()); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type())) - { - if(classMembers.size() > 1 || allClassMembers.size() > 1) - { - patchParams << ", " << classMemberCount++; - } - } - writeMarshalUnmarshalCode(_out, (*d)->type(), - fixId((*d)->name(), DotNet::ICloneable, true), - false, false, false, patchParams.str()); - } - _out << nl << "is__.endReadSlice()"; - _out << nl << "MyBase.read__(is__, true)"; - _out.dec(); - _out << nl << "End Sub"; - - // - // Write streaming API. - // - if(_stream) - { - _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal outS__ As Ice.OutputStream)"; - _out.inc(); - _out << nl << "outS__.writeTypeId(ice_staticId())"; - _out << nl << "outS__.startSlice()"; - for(d = members.begin(); d != members.end(); ++d) - { - writeMarshalUnmarshalCode(_out, (*d)->type(), - fixId((*d)->name(), DotNet::ICloneable, true), - true, true, false); - } - _out << nl << "outS__.endSlice()"; - _out << nl << "MyBase.write__(outS__)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overloads Overrides Sub read__" - << "(ByVal inS__ As Ice.InputStream, ByVal rid__ As Boolean)"; - _out.inc(); - _out << nl << "If rid__ Then"; - _out.inc(); - _out << nl << "Dim myId As String = inS__.readTypeId()"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "inS__.startSlice()"; - for(d = members.begin(); d != members.end(); ++d) - { - ostringstream patchParams; - patchParams << "Me"; - BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type()); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type())) - { - if(classMembers.size() > 1 || allClassMembers.size() > 1) - { - patchParams << ", " << classMemberCount++; - } - } - writeMarshalUnmarshalCode(_out, (*d)->type(), - fixId((*d)->name(), DotNet::ICloneable, true), - false, true, false, patchParams.str()); - } - _out << nl << "inS__.endSlice()"; - _out << nl << "MyBase.read__(inS__, True)"; - _out.dec(); - _out << nl << "End Sub"; - } - else - { - // - // Emit placeholder functions to catch errors. - // - string scoped = p->scoped(); - _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal outS__ As Ice.OutputStream)"; - _out.inc(); - _out << nl << "Dim ex As Ice.MarshalException = New Ice.MarshalException"; - _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\""; - _out << nl << "Throw ex"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overloads Overrides Sub read__" - << "(ByVal inS__ As Ice.InputStream, ByVal rid__ As Boolean)"; - _out.inc(); - _out << nl << "Dim ex As Ice.MarshalException = New Ice.MarshalException"; - _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\""; - _out << nl << "Throw ex"; - _out.dec(); - _out << nl << "End Sub"; - } - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Marshalling support - _out.restoreIndent(); - } - - _out.dec(); - _out << nl << "End " << (p->isInterface() ? "Interface" : "Class"); -} - -void -Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p) -{ - - ClassDefPtr classDef = ClassDefPtr::dynamicCast(p->container()); - if(classDef->isInterface()) - { - return; - } - - bool isLocal = classDef->isLocal(); - bool amd = !isLocal && (classDef->hasMetaData("amd") || p->hasMetaData("amd")); - - string name = p->name(); - ParamDeclList paramList = p->parameters(); - vector<string> params; - vector<string> args; - TypePtr ret; - string retS; - - if(!amd) - { - params = getParams(p); - args = getArgs(p); - name = fixId(name, DotNet::ICloneable, true); - ret = p->returnType(); - retS = typeToString(ret); - } - else - { - params = getParamsAsync(p, true); - args = getArgsAsync(p); - name = name + "_async"; - } - - string vbOp = ret ? "Function" : "Sub"; - - _out << sp; - emitAttributes(p); - _out << nl << "Public "; - if(isLocal) - { - _out << "MustOverride "; - } - _out << vbOp << ' ' << name << spar << params << epar; - if(ret) - { - _out << " As " << retS; - } - _out << " Implements " << classDef->name() << "OperationsNC_." << name; - if(!isLocal) - { - _out.inc(); - _out << nl; - if(!amd && p->returnType()) - { - _out << "Return "; - } - _out << name << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar; - _out.dec(); - _out << nl << "End " << vbOp; - } - - if(!isLocal) - { - _out << sp << nl << "Public MustOverride " << vbOp << ' ' << name - << spar << params << "ByVal current__ As Ice.Current" << epar; - if(ret) - { - _out << " As " << retS; - } - _out << " Implements " << classDef->name() << "Operations_." << name; - } -} - -void -Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) -{ - // - // No need to generate anything if the sequence is mapped as an array. - // - if(!p->hasMetaData("clr:collection")) - { - return; - } - - string name = fixId(p->name()); - string s = typeToString(p->type()); - bool isValue = isValueType(p->type()); - - _out << sp; - - emitDeprecate(p, 0, _out, "type"); - - emitAttributes(p); - _out << nl << "Public Class " << name; - _out.inc(); - _out << nl << "Inherits _System.Collections.CollectionBase"; - _out << nl << "Implements _System.ICloneable"; - - _out.zeroIndent(); - _out << sp << nl << "#Region \"Constructors\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Sub New()"; - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub New(ByVal capacity As Integer)"; - _out.inc(); - _out << nl << "InnerList.Capacity = capacity"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub New(ByVal a__ As " << s << "())"; - _out.inc(); - _out << nl << "InnerList.AddRange(a__)"; - _out.dec(); - _out << nl << "End Sub"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Constructors - - _out << sp << nl << "#Region \"Array copy and conversion\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Sub CopyTo(ByVal a__ As " << s << "())"; - _out.inc(); - _out << nl << "InnerList.CopyTo(a__)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub CopyTo(ByVal a__ As " << s << "(), ByVal i__ As Integer)"; - _out.inc(); - _out << nl << "InnerList.CopyTo(a__, i__)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub CopyTo(ByVal i__ As Integer, ByVal a__ As " << s << "(), " - "ByVal ai__ As Integer, ByVal c__ As Integer)"; - _out.inc(); - _out << nl << "InnerList.CopyTo(i__, a__, ai__, c__)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Function ToArray() As " << s << "()"; - _out.inc(); - _out << nl << "Dim a__ As " << s << "() = New " << toArrayAlloc(s + "()", "InnerList.Count - 1") << " {}"; - _out << nl << "InnerList.CopyTo(a__)"; - _out << nl << "Return a__"; - _out.dec(); - _out << nl << "End Function"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Array copy and conversion - - _out << sp << nl << "#Region \"ArrayList members\""; - _out.restoreIndent(); - - _out << sp << nl << "#If VBC_VER = Nothing Then"; - _out << nl << "Property Capacity As Integer"; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "Return InnerList.Capacity"; - _out.dec(); - _out << nl << "End Get"; - _out << nl << "Set"; - _out.inc(); - _out << nl << "InnerList.Capacity = value"; - _out.dec(); - _out << nl << "End Set"; - _out.dec(); - _out << nl << "End Property"; - _out << nl << "#End If"; - - _out << sp << nl << "Public Overridable Sub TrimToSize()"; - _out.inc(); - _out << nl << "InnerList.TrimToSize()"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overloads Overridable Sub Sort()"; - _out.inc(); - _out << nl << "InnerList.Sort()"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overloads Overridable Sub Sort(ByVal comparer As _System.Collections.IComparer)"; - _out.inc(); - _out << nl << "InnerList.Sort(comparer)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overloads Overridable Sub Sort("; - _out.useCurrentPosAsIndent(); - _out << "ByVal index As Integer, ByVal count As Integer, _"; - _out << nl << "ByVal Comparer As _System.Collections.IComparer)"; - _out.restoreIndent(); - _out.inc(); - _out << nl << "InnerList.Sort(index, count, comparer)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub Reverse()"; - _out.inc(); - _out << nl << "InnerList.Reverse()"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overridable Sub Reverse(ByVal index As Integer, ByVal count As Integer)"; - _out.inc(); - _out << nl << "InnerList.Reverse(index, count)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overridable Function BinarySearch(ByVal value As " << s << ") As Integer"; - _out.inc(); - _out << nl << "Return InnerList.BinarySearch(value)"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overridable Function BinarySearch("; - _out.useCurrentPosAsIndent(); - _out << "ByVal value As " << s << ", _"; - _out << nl << "ByVal comparer As _System.Collections.IComparer) As Integer"; - _out.restoreIndent(); - _out.inc(); - _out << nl << "Return InnerList.BinarySearch(value, comparer)"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overridable Function BinarySearch("; - _out.useCurrentPosAsIndent(); - _out << "ByVal index As Integer, _"; - _out << nl << "ByVal count As Integer, _"; - _out << nl << "ByVal value As " << s << ", _"; - _out << nl << "ByVal comparer As _System.Collections.IComparer) As Integer"; - _out.restoreIndent(); - _out.inc(); - _out << nl << "Return InnerList.BinarySearch(index, count, value, comparer)"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overridable Sub InsertRange(ByVal index As Integer, ByVal c As " << name << ')'; - _out.inc(); - _out << nl << "InnerList.InsertRange(index, c)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overridable Sub InsertRange(ByVal index As Integer, ByVal c As " << s << "())"; - _out.inc(); - _out << nl << "InnerList.InsertRange(index, c)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overridable Sub RemoveRange(ByVal index As Integer, ByVal count As Integer)"; - _out.inc(); - _out << nl << "InnerList.RemoveRange(index, count)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overridable Function GetRange(ByVal index As Integer, ByVal count As Integer) As " << name; - _out.inc(); - _out << nl << "Dim al As _System.Collections.ArrayList = InnerList.GetRange(index, count)"; - _out << nl << "Dim r As " << name << " = New " << name << "(al.Count)"; - _out << nl << "r.InnerList.AddRange(al)"; - _out << nl << "Return r"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overridable Sub SetRange(ByVal index As Integer, ByVal c As " << name << ')'; - _out.inc(); - _out << nl << "InnerList.SetRange(index, c)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overridable Sub SetRange(ByVal index As Integer, ByVal c As " << s << "())"; - _out.inc(); - _out << nl << "InnerList.SetRange(index, c)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overridable Function LastIndexOf(ByVal value As " << s << ") As Integer"; - _out.inc(); - _out << nl << "Return InnerList.LastIndexOf(value)"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overridable Function LastIndexOf(ByVal value As " << s << ", ByVal startIndex As Integer) As Integer"; - _out.inc(); - _out << nl << "Return InnerList.LastIndexOf(value, startIndex)"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overridable Function LastIndexOf("; - _out.useCurrentPosAsIndent(); - _out << "ByVal value As " << s << ", _"; - _out << nl << "ByVal startIndex As Integer, _"; - _out << nl << "ByVal count As Integer) As Integer"; - _out.restoreIndent(); - _out.inc(); - _out << nl << "Return InnerList.LastIndexOf(value, startIndex, count)"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Shared Function Repeat(ByVal value As " << s << ", ByVal count As Integer) As " << name; - _out.inc(); - _out << nl << "Dim r As " << name << " = New " << name << "(count)"; - _out << nl << "For i As Integer = 0 To count - 1"; - _out.inc(); - _out << nl << "r.Add(value)"; - _out.dec(); - _out << nl << "Next"; - _out << nl << "Return r"; - _out.dec(); - _out << nl << "End Function"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // ArrayList members - - _out << sp << nl << "#Region \"AddRange members\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Sub AddRange(ByVal s__ As " << name << ')'; - _out.inc(); - _out << nl << "InnerList.AddRange(s__)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub AddRange(ByVal a__ As " << s << "())"; - _out.inc(); - _out << nl << "InnerList.AddRange(a__)"; - _out.dec(); - _out << nl << "End Sub"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // AddRange members - - _out << sp << nl << "#Region \"ICollectionBase members\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Function Add(ByVal value As " << s << ") As Integer"; - _out.inc(); - _out << nl << "Return InnerList.Add(value)"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Function IndexOf(ByVal value As " << s << ") As Integer"; - _out.inc(); - _out << nl << "Return InnerList.IndexOf(value)"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Sub Insert(ByVal index As Integer, ByVal value As " << s << ')'; - _out.inc(); - _out << nl << "InnerList.Insert(index, value)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub Remove(ByVal value As " << s << ')'; - _out.inc(); - _out << nl << "InnerList.Remove(value)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Function Contains(ByVal value As " << s << ") As Boolean"; - _out.inc(); - _out << nl << "Return InnerList.Contains(value)"; - _out.dec(); - _out << nl << "End Function"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // ICollectionBase members - - _out << sp << nl << "#Region \"ICollection members\""; - _out.restoreIndent(); - - _out << sp << nl << "Readonly Property IsSynchronized As Boolean"; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End Get"; - _out.dec(); - _out << nl << "End Property"; - - _out << sp << nl << "Readonly Property SyncRoot As Object"; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "Return Me"; - _out.dec(); - _out << nl << "End Get"; - _out.dec(); - _out << nl << "End Property"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // ICollection members - - _out << sp << nl << "#Region \"IList members\""; - _out.restoreIndent(); - - _out << sp << nl << "ReadOnly Property IsFixedSize As Boolean"; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End Get"; - _out.dec(); - _out << nl << "End Property"; - - _out << sp << nl << "ReadOnly Property IsReadOnly As Boolean"; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End Get"; - _out.dec(); - _out << nl << "End Property"; - - _out.zeroIndent(); - _out << sp << nl << "#Region \"Indexer\""; - _out.restoreIndent(); - - _out << sp << nl << "Default Property Item(ByVal index As Integer) As " << s; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "Return CType(InnerList(index), " << s << ')'; - _out.dec(); - _out << nl << "End Get"; - _out.dec(); - - _out.inc(); - _out << nl << "Set"; - _out.inc(); - _out << nl << "InnerList(index) = value"; - _out.dec(); - _out << nl << "End Set"; - _out.dec(); - _out << nl << "End Property"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Indexer - - _out << sp << nl << "#End Region"; // IList members - - _out << sp << nl << "#Region \"ICloneable members\""; - _out.restoreIndent(); - - _out << sp << nl << "Function Clone() As Object Implements _System.ICloneable.Clone"; - _out.inc(); - _out << nl << "Dim s As " << name << " = New " << name; - _out << nl << "s.InnerList.AddRange(InnerList)"; - _out << nl << "Return s"; - _out.dec(); - _out << nl << "End Function"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // ICloneable members - - _out << sp << nl << "#Region \"Object members\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Overrides Function GetHashCode() As Integer"; - _out.inc(); - _out << nl << "Dim hash As Integer = 0"; - _out << nl << "For i As Integer = 0 To Count - 1"; - _out.inc(); - if(!isValue) - { - _out << nl << "If Not InnerList(i) Is Nothing Then"; - _out.inc(); - } - _out << nl << "hash = 5 * hash + InnerList(i).GetHashCode()"; - if(!isValue) - { - _out.dec(); - _out << nl << "End If"; - } - _out.dec(); - _out << nl << "Next"; - _out << nl << "Return hash"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overloads Overrides Function Equals(ByVal other As Object) As Boolean"; - _out.inc(); - _out << nl << "If Object.ReferenceEquals(Me, other) Then"; - _out.inc(); - _out << nl << "Return True"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "If Not TypeOf other Is " << name << " Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "If Count <> CType(other, " << name << ").Count Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "For i__ As Integer = 0 To Count - 1"; - _out.inc(); - if(!isValue) - { - _out << nl << "If InnerList(i__) Is Nothing Then"; - _out.inc(); - _out << nl << "If Not CType(other, " << name << ")(i__) Is Nothing Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - _out << nl << "Else"; - _out.inc(); - } - _out << nl << "If Not InnerList(i__).Equals(CType(other, " << name << ")(i__)) Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - if(!isValue) - { - _out.dec(); - _out << nl << "End If"; - } - _out << nl << "Next"; - _out << nl << "Return True"; - _out.dec(); - _out << nl << "End Function"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Object members - _out.restoreIndent(); - - _out.dec(); - _out << sp << nl << "End Class"; -} - -bool -Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) -{ - string name = fixId(p->name()); - ExceptionPtr base = p->base(); - - _out << sp; - - emitDeprecate(p, 0, _out, "type"); - - emitAttributes(p); - _out << nl << "Public Class " << name; - _out.inc(); - if(base) - { - _out << nl << "Inherits " << fixId(base->scoped()); - } - else - { - _out << nl << "Inherits " << (p->isLocal() ? "Ice.LocalException" : "Ice.UserException"); - } - - if(!p->dataMembers().empty()) - { - _out.zeroIndent(); - _out << sp << nl << "#Region \"Slice data members\""; - _out.restoreIndent(); - } - - return true; -} - -void -Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) -{ - string name = fixId(p->name()); - - DataMemberList allDataMembers = p->allDataMembers(); - DataMemberList dataMembers = p->dataMembers(); - DataMemberList::const_iterator q; - - vector<string> allParamDecl; - for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q) - { - string memberName = fixId((*q)->name()); - string memberType = typeToString((*q)->type()); - allParamDecl.push_back("ByVal " + memberName + " As " + memberType); - } - - vector<string> paramNames; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - paramNames.push_back(fixId((*q)->name())); - } - - vector<string> paramDecl; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - string memberName = fixId((*q)->name()); - string memberType = typeToString((*q)->type()); - paramDecl.push_back("ByVal " + memberName + " As " + memberType); - } - - vector<string> baseParamNames; - DataMemberList baseDataMembers; - - if(p->base()) - { - baseDataMembers = p->base()->allDataMembers(); - for(q = baseDataMembers.begin(); q != baseDataMembers.end(); ++q) - { - baseParamNames.push_back(fixId((*q)->name())); - } - } - - if(!dataMembers.empty()) - { - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Slice data members - _out.restoreIndent(); - } - - _out.zeroIndent(); - _out << sp << nl << "#Region \"Constructors\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Sub New()"; - _out.inc(); - _out << nl << "MyBase.New()"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub New(ByVal ex__ As _System.Exception)"; - _out.inc(); - _out << nl << "MyBase.New(ex__)"; - _out.dec(); - _out << nl << "End Sub"; - - if(!allDataMembers.empty()) - { - if(!dataMembers.empty()) - { - _out << sp << nl << "Private Sub initDM__" << spar << paramDecl << epar; - _out.inc(); - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - _out << nl << "Me." << fixId((*q)->name()) << " = " << fixId((*q)->name()); - } - _out.dec(); - _out << nl << "End Sub"; - } - - _out << sp << nl << "Public Sub New" << spar << allParamDecl << epar; - _out.inc(); - if(p->base() && allDataMembers.size() != dataMembers.size()) - { - _out << nl << "MyBase.New" << spar << baseParamNames << epar; - } - if(!dataMembers.empty()) - { - _out << nl << "initDM__" << spar << paramNames << epar; - } - _out.dec(); - _out << nl << "End Sub"; - - vector<string> exceptionParam; - exceptionParam.push_back("ex__"); - vector<string> exceptionDecl; - exceptionDecl.push_back("ByVal ex__ As _System.Exception"); - _out << sp << nl << "Public Sub New" << spar << allParamDecl << exceptionDecl << epar; - _out.inc(); - _out << nl << "MyBase.New" << spar; - if(p->base() && allDataMembers.size() != dataMembers.size()) - { - _out << baseParamNames; - } - _out << exceptionParam << epar; - if(!dataMembers.empty()) - { - _out << nl << "initDM__" << spar << paramNames << epar; - } - _out.dec(); - _out << nl << "End Sub"; - } - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Constructors - - _out << sp << nl << "#Region \"Object members\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Overrides Function GetHashCode() As Integer"; - _out.inc(); - _out << nl << "Dim h__ As Integer = 0"; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - string memberName = fixId((*q)->name(), DotNet::ApplicationException); - bool isValue = isValueType((*q)->type()); - if(!isValue) - { - _out << nl << "If Not " << memberName << " Is Nothing Then"; - _out.inc(); - } - _out << nl << "h__ = 5 * h__ + "; - invokeObjectMethod((*q)->type(), memberName, "GetHashCode", ""); - if(!isValue) - { - _out.dec(); - _out << nl << "End If"; - } - } - _out << nl << "Return h__"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overloads Overrides Function Equals(ByVal other__ As Object) As Boolean"; - _out.inc(); - _out << nl << "If other__ Is Nothing Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "If Object.ReferenceEquals(Me, other__) Then"; - _out.inc(); - _out << nl << "Return True"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "If Not TypeOf other__ Is " << name << " Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - string memberName = fixId((*q)->name(), DotNet::ApplicationException); - bool isValue = isValueType((*q)->type()); - - if(!isValue) - { - _out << nl << "If " << memberName << " Is Nothing Then"; - _out.inc(); - _out << nl << "If Not (CType(other__, " + name + "))." << memberName << " Is Nothing"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - _out << nl << "Else"; - _out.inc(); - } - _out << nl << "If Not "; - invokeObjectMethod((*q)->type(), memberName, "Equals", "CType(other__, " + name + ")." + memberName); - _out << " Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - if(!isValue) - { - _out.dec(); - _out << nl << "End If"; - } - } - _out << nl << "Return True"; - _out.dec(); - _out << nl << "End Function"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Object members - _out.restoreIndent(); - - if(!p->isLocal()) - { - _out.zeroIndent(); - _out << sp << nl << "#Region \"Marshaling support\""; - _out.restoreIndent(); - - string scoped = p->scoped(); - ExceptionPtr base = p->base(); - - - _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal os__ As IceInternal.BasicStream)"; - _out.inc(); - _out << nl << "os__.writeString(\"" << scoped << "\")"; - _out << nl << "os__.startWriteSlice()"; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - writeMarshalUnmarshalCode(_out, (*q)->type(), - fixId((*q)->name(), DotNet::ApplicationException), - true, false, false); - } - _out << nl << "os__.endWriteSlice()"; - if(base) - { - _out << nl << "MyBase.write__(os__)"; - } - _out.dec(); - _out << nl << "End Sub"; - - DataMemberList allClassMembers = p->allClassDataMembers(); - if(allClassMembers.size() != 0) - { - _out << sp << nl << "Public Shadows NotInheritable Class Patcher__"; - _out.inc(); - _out << nl << "Inherits IceInternal.Patcher"; - _out << sp << nl << "Friend Sub New(ByVal instance As Ice.Exception"; - if(allClassMembers.size() > 1) - { - _out << ", ByVal member As Integer"; - } - _out << ')'; - _out.inc(); - _out << nl << "_instance = CType(instance, " << name << ')'; - if(allClassMembers.size() > 1) - { - _out << nl << "_member = member"; - } - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overrides Sub patch(ByVal v As Ice.Object)"; - _out.inc(); - _out << nl << "Try"; - _out.inc(); - if(allClassMembers.size() > 1) - { - _out << nl << "Select Case _member"; - _out.inc(); - } - int memberCount = 0; - for(q = allClassMembers.begin(); q != allClassMembers.end(); ++q) - { - if(allClassMembers.size() > 1) - { - _out << nl << "Case " << memberCount; - _out.inc(); - } - string memberName = fixId((*q)->name(), DotNet::ApplicationException); - string memberType = typeToString((*q)->type()); - _out << nl << "type_ = GetType(" << memberType << ')'; - _out << nl << "_instance." << memberName << " = CType(v, " << memberType << ')'; - _out << nl << "_typeId = \"" << (*q)->type()->typeId() << "\""; - if(allClassMembers.size() > 1) - { - _out.dec(); - } - memberCount++; - } - if(allClassMembers.size() > 1) - { - _out.dec(); - _out << nl << "End Select"; - } - _out.dec(); - _out << nl << "Catch _ex As System.InvalidCastException"; - _out.inc(); - _out << nl << "Dim _e As Ice.UnexpectedObjectException = New Ice.UnexpectedObjectException"; - _out << nl << "_e.type = v.ice_id()"; - _out << nl << "_e.expectedType = _typeId"; - _out << nl << "Throw _e"; - _out.dec(); - _out << nl << "End Try"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Private _instance As " << name; - if(allClassMembers.size() > 1) - { - _out << nl << "Private _member As Integer"; - } - _out << nl << "Private _typeId As String"; - _out.dec(); - _out << sp << nl << "End Class"; - } - _out << sp << nl << "Public Overloads Overrides Sub read__(ByVal is__ As IceInternal.BasicStream, " - "ByVal rid__ As Boolean)"; - _out.inc(); - _out << nl << "If rid__ Then"; - _out.inc(); - _out << nl << "Dim myId As String = is__.readString()"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "is__.startReadSlice()"; - DataMemberList classMembers = p->classDataMembers(); - int classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size()); - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - ostringstream patchParams; - patchParams << "Me"; - BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type()); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type())) - { - if(classMembers.size() > 1 || allClassMembers.size() > 1) - { - patchParams << ", " << classMemberCount++; - } - } - writeMarshalUnmarshalCode(_out, (*q)->type(), - fixId((*q)->name(), DotNet::ApplicationException), - false, false, false, patchParams.str()); - } - _out << nl << "is__.endReadSlice()"; - if(base) - { - _out << nl << "MyBase.read__(is__, true)"; - } - _out.dec(); - _out << nl << "End Sub"; - - if(_stream) - { - _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal outS__ As Ice.OutputStream)"; - _out.inc(); - _out << nl << "outS__.writeString(\"" << scoped << "\")"; - _out << nl << "outS__.startSlice()"; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - writeMarshalUnmarshalCode(_out, (*q)->type(), - fixId((*q)->name(), DotNet::ApplicationException), - true, true, false); - } - _out << nl << "outS__.endSlice()"; - if(base) - { - _out << nl << "MyBase.write__(outS__)"; - } - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overloads Overrides Sub read__(ByVal inS__ As Ice.InputStream, " - << "ByVal rid__ As Boolean)"; - _out.inc(); - _out << nl << "If rid__ Then"; - _out.inc(); - _out << nl << "Dim myId As String = inS__.readString()"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "inS__.startSlice()"; - classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size()); - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - ostringstream patchParams; - patchParams << "Me"; - BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type()); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type())) - { - if(classMembers.size() > 1 || allClassMembers.size() > 1) - { - patchParams << ", " << classMemberCount++; - } - } - writeMarshalUnmarshalCode(_out, (*q)->type(), - fixId((*q)->name(), DotNet::ApplicationException), - false, true, false, patchParams.str()); - } - _out << nl << "inS__.endSlice()"; - if(base) - { - _out << nl << "MyBase.read__(inS__, true)"; - } - _out.dec(); - _out << nl << "End Sub"; - } - else - { - // - // Emit placeholder functions to catch errors. - // - _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal outS__ As Ice.OutputStream)"; - _out.inc(); - _out << nl << "Dim ex As Ice.MarshalException = New Ice.MarshalException"; - _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\""; - _out << nl << "Throw ex"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overloads Overrides Sub read__" - << "(ByVal inS__ As Ice.InputStream, ByVal rid__ As Boolean)"; - _out.inc(); - _out << nl << "Dim ex As Ice.MarshalException = New Ice.MarshalException"; - _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\""; - _out << nl << "Throw ex"; - _out.dec(); - _out << nl << "End Sub"; - } - - if(!base || base && !base->usesClasses()) - { - _out << sp << nl << "Public Overrides Function usesClasses__() As Boolean"; - _out.inc(); - _out << nl << "Return True"; - _out.dec(); - _out << nl << "End Function"; - } - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Marshalling support - _out.restoreIndent(); - } - - _out.dec(); - _out << sp << nl << "End Class"; -} - -bool -Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p) -{ - string name = fixId(p->name()); - - if(!p->isLocal() && _stream) - { - _out << sp << nl << "Public NotInheritable Class " << p->name() << "Helper"; - _out.inc(); - - _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << name << ')'; - _out.inc(); - _out << nl << "v__.ice_write(outS__)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << name; - _out.inc(); - _out << nl << "Dim v__ As " << name << " = New " << name; - _out << nl << "v__.ice_read(inS__)"; - _out << nl << "Return v__"; - _out.dec(); - _out << nl << "End Function"; - - _out.dec(); - _out << sp << nl << "End Class"; - } - - _out << sp; - - emitDeprecate(p, 0, _out, "type"); - - emitAttributes(p); - if(isValueType(p)) - { - _out << nl << "Public Structure " << name; - } - else - { - _out << nl << "Public Class " << name; - _out.inc(); - _out << nl << " Implements _System.ICloneable"; - _out.dec(); - } - _out.inc(); - - _out.zeroIndent(); - _out << sp << nl << "#Region \"Slice data members\""; - _out.restoreIndent(); - - return true; -} - -void -Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) -{ - string name = fixId(p->name()); - - DataMemberList classMembers = p->classDataMembers(); - DataMemberList dataMembers = p->dataMembers(); - DataMemberList::const_iterator q; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Slice data members - - bool isClass = !isValueType(p); - - _out << sp << nl << "#Region \"Constructor"; - if(isClass) - { - _out << "s"; - } - _out << "\""; - _out.restoreIndent(); - - if(isClass) - { - _out << sp << nl << "Public Sub New()"; - _out << nl << "End Sub"; - } - - _out << sp << nl << "Public Sub New" << spar; - vector<string> paramDecl; - vector<string> paramNames; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - string memberName = fixId((*q)->name()); - string memberType = typeToString((*q)->type()); - paramDecl.push_back("ByVal " + memberName + " As " + memberType); - paramNames.push_back(memberName); - } - _out << paramDecl << epar; - _out.inc(); - for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i) - { - _out << nl << "Me." << *i << " = " << *i; - } - _out.dec(); - _out << nl << "End Sub"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Constructor(s) - _out.restoreIndent(); - - if(isClass) - { - _out.zeroIndent(); - _out << sp << nl << "#Region \"ICloneable members\""; - _out.restoreIndent(); - - _out << sp << nl << "Function Clone() As Object Implements _System.ICloneable.Clone"; - _out.inc(); - _out << nl << "Return MemberwiseClone()"; - _out.dec(); - _out << nl << "End Function"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // ICloneable members - _out.restoreIndent(); - } - - _out.zeroIndent(); - _out << sp << nl << "#Region \"Object members\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Overrides Function GetHashCode() As Integer"; - _out.inc(); - _out << nl << "Dim h__ As Integer = 0"; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0); - bool isValue = isValueType((*q)->type()); - if(!isValue) - { - _out << nl << "If Not " << memberName << " Is Nothing Then"; - _out.inc(); - } - _out << nl << "h__ = 5 * h__ + "; - invokeObjectMethod((*q)->type(), memberName, "GetHashCode", ""); - if(!isValue) - { - _out.dec(); - _out << nl << "End If"; - } - } - _out << nl << "Return h__"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overloads Overrides Function Equals(ByVal other__ As Object) As Boolean"; - _out.inc(); - if(isClass) - { - _out << nl << "If Object.ReferenceEquals(Me, other__) Then"; - _out.inc(); - _out << nl << "Return True"; - _out.dec(); - _out << nl << "End If"; - } - if(isClass) - { - _out << nl << "If other__ Is Nothing Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - } - else - { - _out << nl << "If Not TypeOf other__ Is " << name << " Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - } - if(!dataMembers.empty()) - { - _out << nl << "Dim o__ As " << name << " = CType(other__, " << name << ")"; - } - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0); - if(!isValueType((*q)->type())) - { - _out << nl << "If " << memberName << " Is Nothing Then"; - _out.inc(); - _out << nl << "If Not o__." << memberName << " Is Nothing Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - _out << nl << "Else"; - _out.inc(); - _out << nl << "If Not "; - invokeObjectMethod((*q)->type(), memberName, "Equals", "o__." + memberName); - _out << " Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - _out << nl << "End If"; - } - else - { - _out << nl << "If Not " << memberName << ".Equals(o__." << memberName << ") Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - } - } - _out << nl << "Return True"; - _out.dec(); - _out << nl << "End Function"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Object members - _out.restoreIndent(); - - if(!p->isLocal()) - { - _out.zeroIndent(); - _out << sp << nl << "#Region \"Marshalling support\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Sub write__(ByVal os__ As IceInternal.BasicStream)"; - _out.inc(); - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - writeMarshalUnmarshalCode(_out, (*q)->type(), - fixId((*q)->name(), isClass ? DotNet::ICloneable : 0), - true, false, false); - } - _out.dec(); - _out << nl << "End Sub"; - - - if(isClass && classMembers.size() != 0) - { - _out << sp << nl << "Public NotInheritable Class Patcher__"; - _out.inc(); - _out << nl << "Inherits IceInternal.Patcher"; - _out << sp << nl << "Friend Sub New(ByVal instance As " << name; - if(classMembers.size() > 1) - { - _out << ", ByVal member As Integer"; - } - _out << ')'; - _out.inc(); - _out << nl << "_instance = instance"; - if(classMembers.size() > 1) - { - _out << nl << "_member = member"; - } - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overrides Sub patch(ByVal v As Ice.Object)"; - _out.inc(); - _out << nl << "Try"; - _out.inc(); - if(classMembers.size() > 1) - { - _out << nl << "Select Case _member"; - _out.inc(); - } - int memberCount = 0; - for(q = classMembers.begin(); q != classMembers.end(); ++q) - { - if(classMembers.size() > 1) - { - _out << nl << "Case " << memberCount; - _out.inc(); - } - string memberType = typeToString((*q)->type()); - string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0); - _out << nl << "type_ = GetType(" << memberType << ')'; - _out << nl << "_instance." << memberName << " = CType(v, " << memberType << ')'; - _out << nl << "_typeId = \"" << (*q)->type()->typeId() << "\""; - if(classMembers.size() > 1) - { - _out.dec(); - } - memberCount++; - } - if(classMembers.size() > 1) - { - _out.dec(); - _out << nl << "End Select"; - } - _out.dec(); - _out << nl << "Catch _ex As System.InvalidCastException"; - _out.inc(); - _out << nl << "Dim _e As Ice.UnexpectedObjectException = New Ice.UnexpectedObjectException"; - _out << nl << "_e.type = v.ice_id()"; - _out << nl << "_e.expectedType = _typeId"; - _out << nl << "Throw _e"; - _out.dec(); - _out << nl << "End Try"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Private _instance As " << name; - if(classMembers.size() > 1) - { - _out << nl << "Private _member As Integer"; - } - _out << nl << "Private _typeId As String"; - _out.dec(); - _out << sp << nl << "End Class"; - } - - _out << sp << nl << "Public Sub read__(ByVal is__ As IceInternal.BasicStream)"; - _out.inc(); - int classMemberCount = 0; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - ostringstream patchParams; - patchParams << "Me"; - BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type()); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type())) - { - if(classMembers.size() > 1) - { - patchParams << ", " << classMemberCount++; - } - } - writeMarshalUnmarshalCode(_out, (*q)->type(), - fixId((*q)->name(), isClass ? DotNet::ICloneable : 0), - false, false, false, patchParams.str()); - } - _out.dec(); - _out << nl << "End Sub"; - - if(_stream) - { - _out << sp << nl << "Public Sub ice_write(ByVal outS__ As Ice.OutputStream)"; - _out.inc(); - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - writeMarshalUnmarshalCode(_out, (*q)->type(), - fixId((*q)->name(), isClass ? DotNet::ICloneable : 0), - true, true, false); - } - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub ice_read(ByVal inS__ As Ice.InputStream)"; - _out.inc(); - classMemberCount = 0; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - ostringstream patchParams; - patchParams << "Me"; - BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type()); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type())) - { - if(classMembers.size() > 1) - { - patchParams << ", " << classMemberCount++; - } - } - writeMarshalUnmarshalCode(_out, (*q)->type(), - fixId((*q)->name(), isClass ? DotNet::ICloneable : 0 ), - false, true, false, patchParams.str()); - } - _out.dec(); - _out << nl << "End Sub"; - } - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Marshalling support - _out.restoreIndent(); - } - - _out.dec(); - _out << sp << nl << "End " << (isClass ? "Class" : "Structure"); -} - -void -Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) -{ - string name = fixId(p->name()); - string ks = typeToString(p->keyType()); - string vs = typeToString(p->valueType()); - bool valueIsValue = isValueType(p->valueType()); - - _out << sp; - - emitDeprecate(p, 0, _out, "type"); - - emitAttributes(p); - _out << nl << "Public Class " << name; - _out.inc(); - _out << nl << "Inherits _System.Collections.DictionaryBase"; - _out << nl << "Implements _System.ICloneable"; - - _out.zeroIndent(); - _out << sp << nl << "#Region \"" << name << " members\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Sub AddRange(ByVal d__ As " << name << ')'; - _out.inc(); - _out << nl << "For Each e As _System.Collections.DictionaryEntry in d__"; - _out.inc(); - _out << nl << "Try"; - _out.inc(); - _out << nl << "InnerHashtable.Add(e.Key, e.Value)"; - _out.dec(); - _out << nl << "Catch ex As _System.ArgumentException"; - _out.inc(); - _out << nl << "' ignore"; - _out.dec(); - _out << nl << "End Try"; - _out.dec(); - _out << nl << "Next"; - _out.dec(); - _out << nl << "End Sub"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // <name> members - - _out << sp << nl << "#Region \"IDictionary members\""; - _out.restoreIndent(); - - _out << sp << nl << "ReadOnly Property IsFixedSize As Boolean"; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End Get"; - _out.dec(); - _out << nl << "End Property"; - - _out << sp << nl << "ReadOnly Property IsReadOnly As Boolean"; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End Get"; - _out.dec(); - _out << nl << "End Property"; - - _out << sp << nl << "ReadOnly Property Keys As _System.Collections.ICollection"; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "Return InnerHashtable.Keys"; - _out.dec(); - _out << nl << "End Get"; - _out.dec(); - _out << nl << "End Property"; - - _out << sp << nl << "ReadOnly Property Values As _System.Collections.ICollection"; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "Return InnerHashtable.Values"; - _out.dec(); - _out << nl << "End Get"; - _out.dec(); - _out << nl << "End Property"; - - _out.zeroIndent(); - _out << sp << nl << "#Region \"Indexer\""; - _out.restoreIndent(); - - _out << sp << nl << "Default Property Item(ByVal key As " << ks << ") As " << vs; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "return CType(InnerHashtable(key), " << vs << ')'; - _out.dec(); - _out << nl << "End Get"; - - _out << nl << "Set"; - _out.inc(); - _out << nl << "InnerHashtable(key) = value"; - _out.dec(); - _out << nl << "End Set"; - _out.dec(); - _out << nl << "End Property"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Indexer - _out.restoreIndent(); - - _out << sp << nl << "Public Sub Add(ByVal key As " << ks << ", ByVal value As " << vs << ')'; - _out.inc(); - _out << nl << "InnerHashtable.Add(key, value)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub Remove(ByVal key As " << ks << ')'; - _out.inc(); - _out << nl << "InnerHashtable.Remove(key)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Function Contains(ByVal key As " << ks << ") As Boolean"; - _out.inc(); - _out << nl << "return InnerHashtable.Contains(key)"; - _out.dec(); - _out << nl << "End Function"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // IDictionary members - - _out << sp << nl << "#Region \"ICollection members\""; - _out.restoreIndent(); - - _out << sp << nl << "Readonly Property IsSynchronized As Boolean"; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End Get"; - _out.dec(); - _out << nl << "End Property"; - - _out << sp << nl << "Readonly Property SyncRoot As Object"; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "Return Me"; - _out.dec(); - _out << nl << "End Get"; - _out.dec(); - _out << nl << "End Property"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // ICollection members - - _out << sp << nl << "#Region \"ICloneable members\""; - _out.restoreIndent(); - - _out << sp << nl << "Function Clone() As Object Implements _System.ICloneable.Clone"; - _out.inc(); - _out << nl << "Dim d As " << name << " = New " << name; - _out << nl << "For Each e As _System.Collections.DictionaryEntry in d"; - _out.inc(); - _out << nl << "d.InnerHashtable.Add(e.Key, e.Value)"; - _out.dec(); - _out << nl << "Next"; - _out << nl << "Return d"; - _out.dec(); - _out << nl << "End Function"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // ICloneable members - - _out << sp << nl << "#Region \"Object members\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Overrides Function GetHashCode() As Integer"; - _out.inc(); - _out << nl << "Dim hash As Integer = 0"; - _out << nl << "For Each e As _System.Collections.DictionaryEntry in InnerHashtable"; - _out.inc(); - _out << nl << "hash = 5 * hash + e.Key.GetHashCode()"; - if(!valueIsValue) - { - _out << nl << "If Not e.Value Is Nothing"; - _out.inc(); - } - _out << nl << "hash = 5 * hash + e.Value.GetHashCode()"; - if(!valueIsValue) - { - _out.dec(); - _out << nl << "End If"; - } - _out.dec(); - _out << nl << "Next"; - _out << nl << "Return hash"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overloads Overrides Function Equals(ByVal other As Object) As Boolean"; - _out.inc(); - _out << nl << "If Object.ReferenceEquals(Me, other)"; - _out.inc(); - _out << nl << "Return True"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "If Not TypeOf other Is " << name << " Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "If Count <> CType(other, " << name << ").Count"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "Dim klhs__() As " << ks << " = New " << ks << "(Count - 1) {}"; - _out << nl << "Keys.CopyTo(klhs__, 0)"; - _out << nl << "_System.Array.Sort(klhs__)"; - _out << nl << "Dim krsh__() As " << ks << " = New " << ks << "(CType(other, " << name << ").Count - 1) {}"; - _out << nl << "CType(other, " << name << ").Keys.CopyTo(krsh__, 0)"; - _out << nl << "_System.Array.Sort(krsh__)"; - _out << nl << "For i As Integer = 0 To Count - 1"; - _out.inc(); - _out << nl << "If Not klhs__(i).Equals(krsh__(i))"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - _out << nl << "Next"; - SequencePtr seq = SequencePtr::dynamicCast(p->valueType()); - bool valueIsArray = seq && !seq->hasMetaData("clr:collection"); - if(valueIsArray) - { - _out << nl << "Dim vlhs__ As " << vs << "() = New " << toArrayAlloc(vs + "()", "Count - 1") << " {}"; - } - else - { - _out << nl << "Dim vlhs__ As " << vs << "() = New " << vs << "(Count - 1) {}"; - } - _out << nl << "Values.CopyTo(vlhs__, 0)"; - _out << nl << "_System.Array.Sort(vlhs__)"; - string vrhsCount = "Ctype(other, " + name + ").Count - 1"; - if(valueIsArray) - { - _out << nl << "Dim vrhs__ As " << vs << "() = New " << toArrayAlloc(vs + "()", vrhsCount) << " {}"; - } - else - { - _out << nl << "Dim vrhs__ As " << vs << "() = New " << vs << '(' << vrhsCount << ") {}"; - } - _out << nl << "CType(other, " << name << ").Values.CopyTo(vrhs__, 0)"; - _out << nl << "_System.Array.Sort(vrhs__)"; - _out << nl << "For i As Integer = 0 To Count - 1"; - _out.inc(); - if(!valueIsValue) - { - _out << nl << "If vlhs__(i) Is Nothing"; - _out.inc(); - _out << nl << "If Not vrhs__(i) Is Nothing"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - _out << nl << "ElseIf Not CType(vlhs__(i), Object).Equals(vrhs__(i)) Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - } - else - { - _out << nl << "If Not vlhs__(i).Equals(vrhs__(i)) Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - } - _out << nl << "Next"; - _out << nl << "Return True"; - _out.dec(); - _out << nl << "End Function"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Object members - _out.restoreIndent(); - - _out.dec(); - _out << sp << nl << "End Class"; -} - -void -Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) -{ - string name = fixId(p->name()); - string scoped = fixId(p->scoped()); - _out << sp; - - emitDeprecate(p, 0, _out, "type"); - - emitAttributes(p); - _out << nl << "Public Enum " << name; - _out.inc(); - EnumeratorList enumerators = p->getEnumerators(); - for(EnumeratorList::const_iterator en = enumerators.begin(); en != enumerators.end(); ++en) - { - _out << nl << fixId((*en)->name()); - } - _out.dec(); - _out << nl << "End Enum"; - - if(_stream) - { - _out << sp << nl << "Public NotInheritable Class " << name << "Helper"; - _out.inc(); - - _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << scoped << ')'; - _out.inc(); - writeMarshalUnmarshalCode(_out, p, "v__", true, true, false); - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << scoped; - _out.inc(); - _out << nl << "Dim v__ As " << scoped; - writeMarshalUnmarshalCode(_out, p, "v__", false, true, false); - _out << nl << "Return v__"; - _out.dec(); - _out << nl << "End Function"; - - _out.dec(); - _out << sp << nl << "End Class"; - } -} - -void -Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p) -{ - string name = fixId(p->name()); - _out << sp; - emitAttributes(p); - _out << nl << "Public NotInheritable Class " << name; - _out.inc(); - _out << nl << "Public Const value As " << typeToString(p->type()) << " = "; - BuiltinPtr bp = BuiltinPtr::dynamicCast(p->type()); - if(bp && bp->kind() == Builtin::KindString) - { - static const string basicStringChars = "abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789" - "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' "; - static const set<char> charSet(basicStringChars.begin(), basicStringChars.end()); - - enum Position { Beginning, InString, NotInString }; - Position pos = Beginning; - - const string val = p->value(); - for(string::const_iterator c = val.begin(); c != val.end(); ++c) - { - if(charSet.find(*c) == charSet.end()) - { - // - // The character is something non-printable, such as a line feed, - // so get it into the string literal using the VB Chr() function. - // - if(pos == InString) - { - _out << '"'; // Close previous string literal. - pos = NotInString; - } - if(pos == NotInString) - { - _out << " + "; - } - - // - // char may be signed, so make it positive. - // - unsigned char uc = *c; - _out << " + Chr(" << static_cast<unsigned>(uc) << ')'; - - pos = NotInString; - } - else - { - if(pos == NotInString) - { - _out << " + "; - pos = Beginning; - } - if(pos == Beginning) - { - _out << '"'; - } - - if(*c == '"') - { - _out << "\"\""; - } - else - { - _out << *c; - } - - pos = InString; - } - } - if(pos == InString) - { - _out << '"'; // Terminate final string literal. - } - } - else if(bp && bp->kind() == Builtin::KindBool) - { - string val = p->value(); - val[0] = toupper(val[0]); - _out << val; - } - else if(bp && bp->kind() == Builtin::KindShort) - { - _out << p->value() << 'S'; - } - else if(bp && bp->kind() == Builtin::KindInt) - { - _out << p->value() << 'I'; - } - else if(bp && bp->kind() == Builtin::KindLong) - { - _out << p->value() << 'L'; - } - else if(bp && bp->kind() == Builtin::KindFloat) - { - _out << p->value() << 'F'; - } - else if(bp && bp->kind() == Builtin::KindDouble) - { - _out << p->value() << 'R'; - } - else - { - EnumPtr ep = EnumPtr::dynamicCast(p->type()); - if(ep) - { - _out << fixId(typeToString(p->type())) << '.' << fixId(p->value()); - } - else - { - _out << p->value(); // byte - } - } - _out.dec(); - _out << sp << nl << "End Class"; -} - -void -Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) -{ - int baseTypes = 0; - bool isClass = false; - bool propertyMapping = false; - bool isValue = false; - bool isProtected = false; - ContainedPtr cont = ContainedPtr::dynamicCast(p->container()); - assert(cont); - if(StructPtr::dynamicCast(cont)) - { - isValue = isValueType(StructPtr::dynamicCast(cont)); - if(!isValue || cont->hasMetaData("clr:class")) - { - baseTypes = DotNet::ICloneable; - } - if(cont->hasMetaData("clr:property")) - { - propertyMapping = true; - } - } - else if(ExceptionPtr::dynamicCast(cont)) - { - baseTypes = DotNet::ApplicationException; - } - else if(ClassDefPtr::dynamicCast(cont)) - { - baseTypes = DotNet::ICloneable; - isClass = true; - if(cont->hasMetaData("clr:property")) - { - propertyMapping = true; - } - isProtected = cont->hasMetaData("protected") || p->hasMetaData("protected"); - } - _out << sp; - - emitDeprecate(p, cont, _out, "member"); - - emitAttributes(p); - - string type = typeToString(p->type()); - string propertyName = fixId(p->name(), baseTypes, isClass); - string dataMemberName = propertyName; - if(propertyMapping) - { - dataMemberName += "_prop"; - } - - _out << nl; - if(propertyMapping) - { - _out << "Private"; - } - else if(isProtected) - { - _out << "Protected"; - } - else - { - _out << "Public"; - } - - _out << ' ' << dataMemberName << " As " << type; - - if(!propertyMapping) - { - return; - } - - _out << nl << (isProtected ? "Protected" : "Public"); - if(!isValue) - { - _out << " Overridable"; - } - _out << " Property " << propertyName << " As " << type; - _out.inc(); - _out << nl << "Get"; - _out.inc(); - _out << nl << "Return " << dataMemberName; - _out.dec(); - _out << nl << "End Get"; - _out << nl << "Set"; - _out.inc(); - _out << nl << dataMemberName << " = Value"; - _out.dec(); - _out << nl << "End Set"; - _out.dec(); - _out << nl << "End Property"; -} - -void -Slice::Gen::TypesVisitor::invokeObjectMethod(const TypePtr& type, const string& obj, const string& method, - const string& arg) -{ - BuiltinPtr b = BuiltinPtr::dynamicCast(type); - ClassDeclPtr cl; - if(!b) - { - cl = ClassDeclPtr::dynamicCast(type); - } - - // - // Visual Basic requires us to cast an interface type to Object in order to - // invoke Object methods such as GetHashCode and Equals. - // - if((b && (b->kind() == Builtin::KindObject || b->kind() == Builtin::KindObjectProxy)) || - (cl && cl->isInterface()) || ProxyPtr::dynamicCast(type)) - { - _out << "CType(" << obj << ", Object)." << method << '(' << arg << ')'; - } - else - { - _out << obj << '.' << method << '(' << arg << ')'; - } -} - -Slice::Gen::ProxyVisitor::ProxyVisitor(IceUtil::Output& out) - : VbVisitor(out) -{ -} - -bool -Slice::Gen::ProxyVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasNonLocalClassDecls()) - { - return false; - } - - _out << sp; - emitAttributes(p); - _out << nl << "Namespace " << fixId(p->name()); - _out.inc(); - return true; -} - -void -Slice::Gen::ProxyVisitor::visitModuleEnd(const ModulePtr&) -{ - _out.dec(); - _out << sp << nl << "End Namespace"; -} - -bool -Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - if(p->isLocal()) - { - return false; - } - - string name = p->name(); - ClassList bases = p->bases(); - - _out << sp << nl << "Public Interface " << name << "Prx"; - _out.inc(); - _out << nl << "Inherits "; - if(bases.empty()) - { - _out << "Ice.ObjectPrx"; - } - else - { - ClassList::const_iterator q = bases.begin(); - while(q != bases.end()) - { - _out << fixId((*q)->scoped() + "Prx"); - if(++q != bases.end()) - { - _out << ", "; - } - } - } - - return true; -} - -void -Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr&) -{ - _out.dec(); - _out << sp << nl << "End Interface"; -} - -void -Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) -{ - ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container()); - string name = fixId(p->name(), DotNet::ICloneable, true); - vector<string> params = getParams(p); - - TypePtr ret = p->returnType(); - string retS = typeToString(ret); - string vbOp = ret ? "Function" : "Sub"; - - _out << sp; - - string deprecateMetadata, deprecateReason; - if(p->findMetaData("deprecate", deprecateMetadata) || cl->findMetaData("deprecate", deprecateMetadata)) - { - deprecateReason = "This operation has been deprecated."; - if(deprecateMetadata.find("deprecate:") == 0 && deprecateMetadata.size() > 10) - { - deprecateReason = deprecateMetadata.substr(10); - } - } - - // - // Write two versions of the operation - with and without a - // context parameter. - // - if(!deprecateReason.empty()) - { - _out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>"; - } - _out << nl << vbOp << ' ' << name << spar << params << epar; - if(ret) - { - _out << " As " << retS; - } - - if(!deprecateReason.empty()) - { - _out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>"; - } - _out << nl << vbOp << ' ' << name << spar << params << "ByVal context__ As Ice.Context" << epar; - if(ret) - { - _out << " As " << retS; - } - - if(cl->hasMetaData("ami") || p->hasMetaData("ami")) - { - vector<string> paramsAMI = getParamsAsync(p, false); - - // - // Write two versions of the operation - with and without a - // context parameter. - // - _out << sp; - if(!deprecateReason.empty()) - { - _out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>"; - } - _out << nl << "Sub " << p->name() << "_async" << spar << paramsAMI << epar; - if(!deprecateReason.empty()) - { - _out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>"; - } - _out << nl << "Sub " << p->name() << "_async" << spar << paramsAMI << "ByVal ctx__ As Ice.Context" << epar; - } -} - -Slice::Gen::OpsVisitor::OpsVisitor(IceUtil::Output& out) - : VbVisitor(out) -{ -} - -bool -Slice::Gen::OpsVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasAbstractClassDefs()) - { - return false; - } - - _out << sp << nl << "Namespace " << fixId(p->name()); - _out.inc(); - return true; -} - -void -Slice::Gen::OpsVisitor::visitModuleEnd(const ModulePtr&) -{ - _out.dec(); - _out << sp << nl << "End Namespace"; -} - -bool -Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - // - // Don't generate Operations interfaces for non-abstract classes. - // - if(!p->isAbstract()) - { - return false; - } - - if(!p->isLocal()) - { - writeOperations(p, false); - } - writeOperations(p, true); - - return false; -} - -void -Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent) -{ - string name = p->name(); - string scoped = fixId(p->scoped()); - ClassList bases = p->bases(); - string opIntfName = "Operations"; - if(noCurrent || p->isLocal()) - { - opIntfName += "NC"; - } - - _out << sp << nl << "Public Interface " << name << opIntfName << '_'; - _out.inc(); - if((bases.size() == 1 && bases.front()->isAbstract()) || bases.size() > 1) - { - _out << nl << "Inherits "; - ClassList::const_iterator q = bases.begin(); - bool first = true; - while(q != bases.end()) - { - if((*q)->isAbstract()) - { - if(!first) - { - _out << ", "; - } - else - { - first = false; - } - string s = (*q)->scoped(); - s += "Operations"; - if(noCurrent) - { - s += "NC"; - } - s += "_"; - _out << fixId(s); - } - ++q; - } - } - - OperationList ops = p->operations(); - OperationList::const_iterator r; - for(r = ops.begin(); r != ops.end(); ++r) - { - OperationPtr op = *r; - bool amd = !p->isLocal() && (p->hasMetaData("amd") || op->hasMetaData("amd")); - string opname = amd ? (op->name() + "_async") : fixId(op->name(), DotNet::ICloneable, true); - - TypePtr ret; - vector<string> params; - - if(amd) - { - params = getParamsAsync(op, true); - } - else - { - params = getParams(op); - ret = op->returnType(); - } - - string vbOp = ret ? "Function" : "Sub"; - - _out << sp; - - emitDeprecate(op, p, _out, "operation"); - - emitAttributes(op); - _out << nl << vbOp << ' ' << opname << spar << params; - if(!noCurrent && !p->isLocal()) - { - _out << "ByVal current__ As Ice.Current"; - } - _out << epar; - if(ret) - { - _out << " As " << typeToString(ret); - } - } - - _out.dec(); - _out << sp << nl << "End Interface"; -} - -Slice::Gen::HelperVisitor::HelperVisitor(IceUtil::Output& out, bool stream) - : VbVisitor(out), - _stream(stream) -{ -} - -bool -Slice::Gen::HelperVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasNonLocalClassDecls() && !p->hasNonLocalSequences() && !p->hasDictionaries()) - { - return false; - } - - _out << sp << nl << "Namespace " << fixId(p->name()); - _out.inc(); - return true; -} - -void -Slice::Gen::HelperVisitor::visitModuleEnd(const ModulePtr&) -{ - _out.dec(); - _out << sp << nl << "End Namespace"; -} - -bool -Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - if(p->isLocal()) - return false; - - string name = p->name(); - ClassList bases = p->bases(); - - _out << sp << nl << "Public NotInheritable Class " << name << "PrxHelper"; - _out.inc(); - _out << nl << "Inherits Ice.ObjectPrxHelperBase"; - _out << nl << "Implements " << name << "Prx"; - - OperationList ops = p->allOperations(); - - if(!ops.empty()) - { - _out.zeroIndent(); - _out << sp << nl << "#Region \"Synchronous operations\""; - _out.restoreIndent(); - } - - OperationList::const_iterator r; - for(r = ops.begin(); r != ops.end(); ++r) - { - OperationPtr op = *r; - string opName = fixId(op->name(), DotNet::ICloneable, true); - TypePtr ret = op->returnType(); - string retS = typeToString(ret); - - vector<string> params = getParams(op); - vector<string> args = getArgs(op); - - string vbOp = ret ? "Function" : "Sub"; - _out << sp << nl << "Public " << vbOp << ' ' << opName << spar << params << epar; - if(ret) - { - _out << " As " << retS; - } - _out << " Implements " << name << "Prx." << opName; - _out.inc(); - _out << nl; - if(ret) - { - _out << "Return "; - } - _out << opName << spar << args << "Nothing" << "False" << epar; - _out.dec(); - _out << nl << "End " << vbOp; - - - _out << sp << nl << "Public " << vbOp << ' ' << opName << spar << params - << "ByVal context__ As Ice.Context" << epar; - if(ret) - { - _out << " As " << retS; - } - _out << " Implements " << name << "Prx." << opName; - _out.inc(); - _out << nl; - if(ret) - { - _out << "Return "; - } - _out << opName << spar << args << "context__" << "True" << epar; - _out.dec(); - _out << nl << "End " << vbOp; - - _out << sp << nl << "Private " << vbOp << ' ' << opName << spar << params - << "ByVal context__ As Ice.Context" << "explicitContext__ As Boolean" << epar; - if(ret) - { - _out << " As " << retS; - } - _out.inc(); - _out << nl << "If explicitContext__ And context__ Is Nothing Then"; - _out.inc(); - _out << nl << "context__ = emptyContext_"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "Dim cnt__ As Integer = 0"; - _out << nl << "While True"; - _out.inc(); - _out << nl << "Dim delBase__ As Ice.ObjectDel_ = Nothing"; - _out << nl << "Try"; - _out.inc(); - if(op->returnsData()) - { - _out << nl << "checkTwowayOnly__(\"" << op->name() << "\")"; - } - _out << nl << "delBase__ = getDelegate__()"; - _out << nl << "Dim del__ As _" << name << "Del = CType(delBase__, _" << name << "Del)"; - _out << nl; - if(ret) - { - _out << "Return "; - } - _out << "del__." << opName << spar << args << "context__" << epar; - if(!ret) - { - _out << nl << "Return"; - } - _out.dec(); - _out << nl << "Catch ex__ As IceInternal.LocalExceptionWrapper"; - _out.inc(); - if(op->mode() == Operation::Idempotent || op->mode() == Operation::Nonmutating) - { - _out << nl << "cnt__ = handleExceptionWrapperRelaxed__(delBase__, ex__, cnt__)"; - } - else - { - _out << nl << "handleExceptionWrapper__(delBase__, ex__)"; - } - _out.dec(); - _out << nl << "Catch ex__ As Ice.LocalException"; - _out.inc(); - _out << nl << "cnt__ = handleException__(delBase__, ex__, cnt__)"; - _out.dec(); - _out << nl << "End Try"; - _out.dec(); - _out << nl << "End While"; - if(ret) - { - _out << nl << "Return Nothing"; // Satisfy the VB2005 compiler. - } - - _out.dec(); - _out << nl << "End " << vbOp; - } - - if(!ops.empty()) - { - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Synchronous operations - _out.restoreIndent(); - } - - bool hasAsyncOps = false; - - for(r = ops.begin(); r != ops.end(); ++r) - { - OperationPtr op = *r; - - ClassDefPtr containingClass = ClassDefPtr::dynamicCast(op->container()); - if(containingClass->hasMetaData("ami") || op->hasMetaData("ami")) - { - if(!hasAsyncOps) - { - _out.zeroIndent(); - _out << sp << nl << "#Region \"Asynchronous operations\""; - _out.restoreIndent(); - hasAsyncOps = true; - } - vector<string> paramsAMI = getParamsAsync(op, false); - vector<string> argsAMI = getArgsAsync(op); - - string opName = op->name(); - - // - // Write two versions of the operation - with and without a - // context parameter - // - _out << sp << nl << "Public Sub " << opName << "_async" << spar << paramsAMI << epar - << " Implements " << name << "Prx." << opName << "_async"; // TODO: should be containing class? - _out.inc(); - _out << nl << opName << "_async" << spar << argsAMI << "Nothing" << epar; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub " << opName << "_async" << spar << paramsAMI - << "ByVal ctx__ As Ice.Context" << epar - << " Implements " << name << "Prx." << opName << "_async"; // TODO: should be containing class? - _out.inc(); - _out << nl << "If ctx__ Is Nothing Then"; - _out.inc(); - _out << nl << "ctx__ = emptyContext_"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "cb__.invoke__" << spar << "Me" << argsAMI << "ctx__" << epar; - _out.dec(); - _out << nl << "End Sub"; - } - } - - if(hasAsyncOps) - { - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Asynchronous operations - _out.restoreIndent(); - } - - _out.zeroIndent(); - _out << sp << nl << "#Region \"Checked and unchecked cast operations\""; - _out.restoreIndent(); - - _out << sp << nl << "Public Shared Function checkedCast(ByVal b As Ice.ObjectPrx) As " << name << "Prx"; - _out.inc(); - _out << nl << "If b Is Nothing Then"; - _out.inc(); - _out << nl << "Return Nothing"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "If TypeOf b Is " << name << "Prx Then"; - _out.inc(); - _out << nl << "Return CType(b, " << name << "Prx)"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "If b.ice_isA(\"" << p->scoped() << "\") Then"; - _out.inc(); - _out << nl << "Dim h As " << name << "PrxHelper = New " << name << "PrxHelper"; - _out << nl << "h.copyFrom__(b)"; - _out << nl << "Return h"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "Return Nothing"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Shared Function checkedCast(ByVal b As Ice.ObjectPrx, ByVal ctx As Ice.Context) As " - << name << "Prx"; - _out.inc(); - _out << nl << "If b Is Nothing Then"; - _out.inc(); - _out << nl << "Return Nothing"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "If TypeOf b Is " << name << "Prx Then"; - _out.inc(); - _out << nl << "Return CType(b, " << name << "Prx)"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "If b.ice_isA(\"" << p->scoped() << "\", ctx) Then"; - _out.inc(); - _out << nl << "Dim h As " << name << "PrxHelper = New " << name << "PrxHelper"; - _out << nl << "h.copyFrom__(b)"; - _out << nl << "Return h"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "Return Nothing"; - _out.dec(); - _out << nl << "End Function"; - - - _out << sp << nl << "Public Shared Function checkedCast(ByVal b As Ice.ObjectPrx, ByVal f As String) As " - << name << "Prx"; - _out.inc(); - _out << nl << "If b Is Nothing Then"; - _out.inc(); - _out << nl << "Return Nothing"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "Dim bb As Ice.ObjectPrx = b.ice_facet(f)"; - _out << nl << "Try"; - _out.inc(); - _out << nl << "If bb.ice_isA(\"" << p->scoped() << "\") Then"; - _out.inc(); - _out << nl << "Dim h As " << name << "PrxHelper = new " << name << "PrxHelper()"; - _out << nl << "h.copyFrom__(bb)"; - _out << nl << "Return h"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - _out << nl << "Catch ex__ As Ice.FacetNotExistException"; - _out << nl << "End Try"; - _out << nl << "Return Nothing"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Shared Function checkedCast(ByVal b As Ice.ObjectPrx, ByVal f As String, " - << "ByVal ctx As Ice.Context) As " << name << "Prx"; - _out.inc(); - _out << nl << "If b Is Nothing Then"; - _out.inc(); - _out << nl << "Return Nothing"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "Dim bb As Ice.ObjectPrx = b.ice_facet(f)"; - _out << nl << "Try"; - _out.inc(); - _out << nl << "If bb.ice_isA(\"" << p->scoped() << "\", ctx) Then"; - _out.inc(); - _out << nl << "Dim h As " << name << "PrxHelper = new " << name << "PrxHelper()"; - _out << nl << "h.copyFrom__(bb)"; - _out << nl << "Return h"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - _out << nl << "Catch ex__ As Ice.FacetNotExistException"; - _out << nl << "End Try"; - _out << nl << "Return Nothing"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Shared Function uncheckedCast(ByVal b As Ice.ObjectPrx) As " << name << "Prx"; - _out.inc(); - _out << nl << "If b Is Nothing Then"; - _out.inc(); - _out << nl << "Return Nothing"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "Dim h As " << name << "PrxHelper = new " << name << "PrxHelper()"; - _out << nl << "h.copyFrom__(b)"; - _out << nl << "Return h"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Shared Function uncheckedCast(Byval b As Ice.ObjectPrx, ByVal f As string) As " - << name << "Prx"; - _out.inc(); - _out << nl << "If b Is Nothing Then"; - _out.inc(); - _out << nl << "Return Nothing"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "Dim bb As Ice.ObjectPrx = b.ice_facet(f)"; - _out << nl << "Dim h As " << name << "PrxHelper = new " << name << "PrxHelper()"; - _out << nl << "h.copyFrom__(bb)"; - _out << nl << "Return h"; - _out.dec(); - _out << nl << "End Function"; - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Checked and unchecked cast operations - - _out << sp << nl << "#Region \"Marshaling support\""; - _out.restoreIndent(); - - _out << sp << nl << "Protected Overrides Function createDelegateM__() As Ice.ObjectDelM_"; - _out.inc(); - _out << nl << "Return New _" << name << "DelM()"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Protected Overrides Function createDelegateD__() As Ice.ObjectDelD_"; - _out.inc(); - _out << nl << "Return New _" << name << "DelD()"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Shared Sub write__(ByVal os__ As IceInternal.BasicStream, ByVal v__ As " - << name << "Prx)"; - _out.inc(); - _out << nl << "os__.writeProxy(v__)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Shared Function read__(ByVal is__ As IceInternal.BasicStream) As " << name << "Prx"; - _out.inc(); - _out << nl << "Dim proxy As Ice.ObjectPrx = is__.readProxy()"; - _out << nl << "If Not proxy Is Nothing Then"; - _out.inc(); - _out << nl << "Dim result As " << name << "PrxHelper = New " << name << "PrxHelper"; - _out << nl << "result.copyFrom__(proxy)"; - _out << nl << "Return result"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "Return Nothing"; - _out.dec(); - _out << nl << "End Function"; - - if(_stream) - { - _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << name << "Prx)"; - _out.inc(); - _out << nl << "outS__.writeProxy(v__)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << name << "Prx"; - _out.inc(); - _out << nl << "Dim proxy As Ice.ObjectPrx = inS__.readProxy()"; - _out << nl << "If Not proxy Is Nothing"; - _out.inc(); - _out << nl << "Dim result As " << name << "PrxHelper = New " << name << "PrxHelper"; - _out << nl << "result.copyFrom__(proxy)"; - _out << nl << "Return result"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "Return Nothing"; - _out.dec(); - _out << nl << "End Function"; - } - - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Marshaling support - _out.restoreIndent(); - - return true; -} - -void -Slice::Gen::HelperVisitor::visitClassDefEnd(const ClassDefPtr&) -{ - _out.dec(); - _out << sp << nl << "End Class"; -} - -void -Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p) -{ - // - // Don't generate helper for a sequence of a local type - // - if(p->isLocal()) - { - return; - } - - string name = fixId(p->name()); - string typeS = typeToString(p); - - _out << sp << nl << "Public NotInheritable Class " << p->name() << "Helper"; - _out.inc(); - - _out << sp << nl << "Public Shared Sub write(ByVal os__ As IceInternal.BasicStream, ByVal v__ As " << typeS << ')'; - _out.inc(); - writeSequenceMarshalUnmarshalCode(_out, p, "v__", true, false); - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Shared Function read(ByVal is__ As IceInternal.BasicStream) As " << typeS; - _out.inc(); - _out << nl << "Dim v__ As " << typeS << " = Nothing"; - writeSequenceMarshalUnmarshalCode(_out, p, "v__", false, false); - _out << nl << "Return v__"; - _out.dec(); - _out << nl << "End Function"; - - if(_stream) - { - _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << typeS << ')'; - _out.inc(); - writeSequenceMarshalUnmarshalCode(_out, p, "v__", true, true); - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << typeS; - _out.inc(); - _out << nl << "Dim v__ As " << typeS << " = Nothing"; - writeSequenceMarshalUnmarshalCode(_out, p, "v__", false, true); - _out << nl << "Return v__"; - _out.dec(); - _out << nl << "End Function"; - } - - _out.dec(); - _out << sp << nl << "End Class"; -} - -void -Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p) -{ - // - // Don't generate helper for a dictionary containing a local type - // - if(p->isLocal()) - { - return; - } - - TypePtr key = p->keyType(); - TypePtr value = p->valueType(); - - string name = fixId(p->name()); - string keyS = typeToString(key); - string valueS = typeToString(value); - - _out << sp << nl << "Public NotInheritable Class " << p->name() << "Helper"; - _out.inc(); - - _out << sp << nl << "Public Shared Sub write(ByVal os__ As IceInternal.BasicStream, ByVal v__ As " - << name << ')'; - _out.inc(); - _out << nl << "If v__ Is Nothing Then"; - _out.inc(); - _out << nl << "os__.writeSize(0)"; - _out.dec(); - _out << nl << "Else"; - _out.inc(); - _out << nl << "os__.writeSize(v__.Count)"; - _out << nl << "For Each e__ As _System.Collections.DictionaryEntry In v__"; - _out.inc(); - string keyArg = "CType(e__.Key, " + keyS + ")"; - writeMarshalUnmarshalCode(_out, key, keyArg, true, false, false); - string valueArg = "e__.Value"; - writeMarshalUnmarshalCode(_out, value, valueArg, true, false, false); - _out.dec(); - _out << nl << "Next"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - _out << nl << "End Sub"; - - BuiltinPtr builtin = BuiltinPtr::dynamicCast(value); - bool hasClassValue = (builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(value); - if(hasClassValue) - { - _out << sp << nl << "Public NotInheritable Class Patcher__"; - _out.inc(); - _out << nl << "Inherits IceInternal.Patcher"; - _out << sp << nl << "Friend Sub New(ByVal m As " << name << ", ByVal key As " << keyS << ')'; - _out.inc(); - _out << nl << "_m = m"; - _out << nl << "_key = key"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Overrides Sub patch(ByVal v As Ice.Object)"; - _out.inc(); - _out << nl << "type_ = GetType(" << typeToString(p->valueType()) << ')'; - _out << nl << "Try"; - _out.inc(); - _out << nl << "_m(_key) = CType(v, " << valueS << ')'; - _out.dec(); - _out << nl << "Catch _ex As System.InvalidCastException"; - _out.inc(); - _out << nl << "Dim _e As Ice.UnexpectedObjectException = New Ice.UnexpectedObjectException"; - _out << nl << "_e.type = v.ice_id()"; - _out << nl << "_e.expectedType = \"" << value->typeId() << "\""; - _out << nl << "Throw _e"; - _out.dec(); - _out << nl << "End Try"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Private _m As " << name; - _out << nl << "Private _key As " << keyS; - _out.dec(); - _out << sp << nl << "End Class"; - } - - _out << sp << nl << "Public Shared Function " << " read(ByVal is__ As IceInternal.BasicStream) As " << name; - _out.inc(); - - _out << nl << "Dim sz__ As Integer = is__.readSize()"; - _out << nl << "Dim r__ As " << name << " = New " << name; - _out << nl << "For i__ As Integer = 0 To sz__ - 1"; - _out.inc(); - _out << nl << "Dim k__ As " << keyS; - writeMarshalUnmarshalCode(_out, key, "k__", false, false, false); - - if(!hasClassValue) - { - _out << nl << "Dim v__ As " << valueS; - } - writeMarshalUnmarshalCode(_out, value, "v__", false, false, false, "r__, k__"); - if(!hasClassValue) - { - _out << nl << "r__(k__) = v__"; - } - _out.dec(); - _out << nl << "Next"; - _out << nl << "Return r__"; - - _out.dec(); - _out << nl << "End Function"; - - if(_stream) - { - _out << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << name << ')'; - _out.inc(); - _out << nl << "If v__ Is Nothing Then"; - _out.inc(); - _out << nl << "outS__.writeSize(0)"; - _out.dec(); - _out << nl << "Else"; - _out.inc(); - _out << nl << "outS__.writeSize(v__.Count)"; - _out << nl << "For Each e__ As _System.Collections.DictionaryEntry In v__"; - _out.inc(); - writeMarshalUnmarshalCode(_out, key, keyArg, true, true, false); - writeMarshalUnmarshalCode(_out, value, valueArg, true, true, false); - _out.dec(); - _out << nl << "Next"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << name; - _out.inc(); - _out << nl << "Dim sz__ As Integer = inS__.readSize()"; - _out << nl << "Dim r__ As " << name << " = New " << name; - _out << nl << "For i__ As Integer = 0 To sz__ - 1"; - _out.inc(); - _out << nl << "Dim k__ As " << keyS; - writeMarshalUnmarshalCode(_out, key, "k__", false, true, false); - if(!hasClassValue) - { - _out << nl << "Dim v__ As " << valueS; - } - writeMarshalUnmarshalCode(_out, value, "v__", false, true, false, "r__, k__"); - if(!hasClassValue) - { - _out << nl << "r__(k__) = v__"; - } - _out.dec(); - _out << nl << "Next"; - _out << nl << "Return r__"; - _out.dec(); - _out << nl << "End Function"; - } - - _out.dec(); - _out << sp << nl << "End Class"; -} - -Slice::Gen::DelegateVisitor::DelegateVisitor(IceUtil::Output& out) - : VbVisitor(out) -{ -} - -bool -Slice::Gen::DelegateVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasNonLocalClassDecls()) - { - return false; - } - - _out << sp << nl << "Namespace " << fixId(p->name()); - _out.inc(); - return true; -} - -void -Slice::Gen::DelegateVisitor::visitModuleEnd(const ModulePtr&) -{ - _out.dec(); - _out << sp << nl << "End Namespace"; -} - -bool -Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - if(p->isLocal()) - { - return false; - } - - string name = p->name(); - ClassList bases = p->bases(); - - _out << sp << nl << "Public Interface _" << name << "Del"; - _out.inc(); - _out << nl << "Inherits "; - if(bases.empty()) - { - _out << "Ice.ObjectDel_"; - } - else - { - ClassList::const_iterator q = bases.begin(); - while(q != bases.end()) - { - string s = (*q)->scoped(); - string::size_type pos = s.rfind("::"); - assert(pos != string::npos); - s = s.insert(pos + 2, "_"); - s += "Del"; - _out << fixId(s); - if(++q != bases.end()) - { - _out << ", "; - } - } - } - - OperationList ops = p->operations(); - - OperationList::const_iterator r; - for(r = ops.begin(); r != ops.end(); ++r) - { - OperationPtr op = *r; - string opName = fixId(op->name(), DotNet::ICloneable, true); - TypePtr ret = op->returnType(); - string retS = typeToString(ret); - vector<string> params = getParams(op); - string vbOp = ret ? "Function" : "Sub"; - - _out << sp << nl << vbOp << ' ' << opName << spar << params << "ByVal context__ As Ice.Context" << epar; - if(ret) - { - _out << " As " << retS; - } - } - - return true; -} - -void -Slice::Gen::DelegateVisitor::visitClassDefEnd(const ClassDefPtr&) -{ - _out.dec(); - _out << sp << nl << "End Interface"; -} - -Slice::Gen::DelegateMVisitor::DelegateMVisitor(IceUtil::Output& out) - : VbVisitor(out) -{ -} - -bool -Slice::Gen::DelegateMVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasNonLocalClassDecls()) - { - return false; - } - - _out << sp << nl << "Namespace " << fixId(p->name()); - _out.inc(); - return true; -} - -void -Slice::Gen::DelegateMVisitor::visitModuleEnd(const ModulePtr&) -{ - _out.dec(); - _out << sp << nl << "End Namespace"; -} - -bool -Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - if(p->isLocal()) - { - return false; - } - - string name = p->name(); - ClassList bases = p->bases(); - - _out << sp << nl << "Public NotInheritable class _" << name << "DelM"; - _out.inc(); - _out << nl << "Inherits Ice.ObjectDelM_"; - _out << nl << "Implements _" << name << "Del"; - - OperationList ops = p->allOperations(); - - OperationList::const_iterator r; - for(r = ops.begin(); r != ops.end(); ++r) - { - OperationPtr op = *r; - string opName = fixId(op->name(), DotNet::ICloneable, true); - TypePtr ret = op->returnType(); - string retS = typeToString(ret); - - TypeStringList inParams; - TypeStringList outParams; - ParamDeclList paramList = op->parameters(); - for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli) - { - if((*pli)->isOutParam()) - { - outParams.push_back(make_pair((*pli)->type(), (*pli)->name())); - } - else - { - inParams.push_back(make_pair((*pli)->type(), (*pli)->name())); - } - } - - TypeStringList::const_iterator q; - - ExceptionList throws = op->throws(); - throws.sort(); - throws.unique(); - - // - // Arrange exceptions into most-derived to least-derived order. If we don't - // do this, a base exception handler can appear before a derived exception - // handler, causing compiler warnings and resulting in the base exception - // being marshaled instead of the derived exception. - // -#if defined(__SUNPRO_CC) - throws.sort(Slice::derivedToBaseCompare); -#else - throws.sort(Slice::DerivedToBaseCompare()); -#endif - - vector<string> params = getParams(op); - - string vbOp = ret ? "Function" : "Sub"; - - _out << sp << nl << "Public " << vbOp << ' ' << opName << spar << params - << "ByVal context__ As Ice.Context" << epar; - if(ret) - { - _out << " As " << retS; - } - _out << " Implements _" << name << "Del." << opName; // TODO: should be containing class? - _out.inc(); - - _out << nl << "Dim og__ As IceInternal.Outgoing = getOutgoing(\"" - << op->name() << "\", " << sliceModeToIceMode(op->sendMode()) << ", context__)"; - _out << nl << "Try"; - _out.inc(); - if(!inParams.empty()) - { - _out << nl << "Try"; - _out.inc(); - _out << nl << "Dim os__ As IceInternal.BasicStream = og__.ostr()"; - for(q = inParams.begin(); q != inParams.end(); ++q) - { - writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false); - } - if(op->sendsClasses()) - { - _out << nl << "os__.writePendingObjects()"; - } - _out.dec(); - _out << nl << "Catch ex__ As Ice.LocalException"; - _out.inc(); - _out << nl << "og__.abort(ex__)"; - _out.dec(); - _out << nl << "End Try"; - } - _out << nl << "Dim ok__ As Boolean = og__.invoke()"; - _out << nl << "Try"; - _out.inc(); - _out << nl << "Dim is__ As IceInternal.BasicStream = og__.istr()"; - _out << nl << "If Not ok__ Then"; - _out.inc(); - // - // The try/catch block is necessary because throwException() - // can raise UserException. - // - _out << nl << "Try"; - _out.inc(); - _out << nl << "is__.throwException()"; - _out.dec(); - for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t) - { - _out << nl << "Catch ex__ As " << fixId((*t)->scoped()); - _out.inc(); - _out << nl << "Throw"; - _out.dec(); - } - _out << nl << "Catch ex__ As Ice.UserException"; - _out.inc(); - _out << nl << "Throw New Ice.UnknownUserException(ex__)"; - _out.dec(); - _out << nl << "End Try"; - _out.dec(); - _out << nl << "End If"; - for(q = outParams.begin(); q != outParams.end(); ++q) - { - writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true, ""); - } - if(ret) - { - BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret)) - { - ContainedPtr contained = ContainedPtr::dynamicCast(ret); - _out << nl << "Dim ret__ As " << retS << " = Nothing"; - _out << nl << "Dim ret___PP As IceInternal.ParamPatcher = New IceInternal.ParamPatcher(GetType(" - << retS << "), \"" << (contained ? contained->scoped() : string("::Ice::Object")) << "\")"; - _out << nl << "is__.readObject(ret___PP)"; - } - else - { - _out << nl << "Dim ret__ As " << retS << " = Nothing"; - writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true, ""); - } - } - if(op->returnsClasses()) - { - _out << nl << "is__.readPendingObjects()"; - for(q = outParams.begin(); q != outParams.end(); ++q) - { - string param = fixId(q->second); - BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->first)) - { - string type = typeToString(q->first); - _out << nl << param << " = CType(" << param << "_PP.value, " << type << ')'; - } - } - } - if(ret) - { - BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret)) - { - _out << nl << "ret__ = CType(ret___PP.value, " << retS << ')'; - } - _out << nl << "Return ret__"; - } - _out.dec(); - _out << nl << "Catch ex__ As Ice.LocalException"; - _out.inc(); - _out << nl << "throw New IceInternal.LocalExceptionWrapper(ex__, false)"; - _out.dec(); - _out << nl << "End Try"; - _out.dec(); - _out << nl << "Finally"; - _out.inc(); - _out << nl << "reclaimOutgoing(og__)"; - _out.dec(); - _out << nl << "End Try"; - - _out.dec(); - _out << nl << "End " << vbOp; - } - - return true; -} - -void -Slice::Gen::DelegateMVisitor::visitClassDefEnd(const ClassDefPtr&) -{ - _out.dec(); - _out << sp << nl << "End Class"; -} - -Slice::Gen::DelegateDVisitor::DelegateDVisitor(IceUtil::Output& out) - : VbVisitor(out) -{ -} - -bool -Slice::Gen::DelegateDVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasNonLocalClassDecls()) - { - return false; - } - - _out << sp << nl << "Namespace " << fixId(p->name()); - _out.inc(); - return true; -} - -void -Slice::Gen::DelegateDVisitor::visitModuleEnd(const ModulePtr&) -{ - _out.dec(); - _out << sp << nl << "End Namespace"; -} - -bool -Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - if(p->isLocal()) - { - return false; - } - - string name = p->name(); - ClassList bases = p->bases(); - - _out << sp << nl << "Public NotInheritable class _" << name << "DelD"; - _out.inc(); - _out << nl << "Inherits Ice.ObjectDelD_"; - _out << nl << "Implements _" << name << "Del"; - - OperationList ops = p->allOperations(); - - OperationList::const_iterator r; - for(r = ops.begin(); r != ops.end(); ++r) - { - OperationPtr op = *r; - string opName = fixId(op->name(), DotNet::ICloneable, true); - TypePtr ret = op->returnType(); - string retS = typeToString(ret); - string vbOp = ret ? "Function" : "Sub"; - ClassDefPtr containingClass = ClassDefPtr::dynamicCast(op->container()); - - vector<string> params = getParams(op); - vector<string> args = getArgs(op); - - _out << sp; - _out << nl << "Public " << vbOp << ' ' << opName << spar << params << "ByVal context__ As Ice.Context" << epar; - if(ret) - { - _out << " As " << retS; - } - _out << " Implements _" << name << "Del." << opName; // TODO: should be containing class? - _out.inc(); - if(containingClass->hasMetaData("amd") || op->hasMetaData("amd")) - { - _out << nl << "Throw New Ice.CollocationOptimizationException()"; - } - else - { - _out << nl << "Dim current__ As Ice.Current = New Ice.Current"; - _out << nl << "initCurrent__(current__, \"" << op->name() << "\", " - << sliceModeToIceMode(op->sendMode()) - << ", context__)"; - _out << nl << "While True"; - _out.inc(); - _out << nl << "Dim direct__ As IceInternal.Direct = New IceInternal.Direct(current__)"; - _out << nl << "Dim servant__ As Object = direct__.servant()"; - _out << nl << "If TypeOf servant__ Is " << fixId(name) << " Then"; - _out.inc(); - _out << nl << "Try"; - _out.inc(); - _out << nl; - if(ret) - { - _out << "Return "; - } - _out << "CType(servant__, " << fixId(containingClass->scoped() + "Operations_") - << ")." << opName << spar << args << "current__" << epar; - if(!ret) - { - _out << nl << "Return"; - } - _out.dec(); - _out << nl << "Catch ex__ As Ice.LocalException"; - _out.inc(); - _out << nl << "Throw New IceInternal.LocalExceptionWrapper(ex__, false)"; - _out.dec(); - _out << nl << "Finally"; - _out.inc(); - _out << nl << "direct__.destroy()"; - _out.dec(); - _out << nl << "End Try"; - _out.dec(); - _out << nl << "Else"; - _out.inc(); - _out << nl << "direct__.destroy()"; - _out << nl << "Dim opEx__ As Ice.OperationNotExistException = new Ice.OperationNotExistException()"; - _out << nl << "opEx__.id = current__.id"; - _out << nl << "opEx__.facet = current__.facet"; - _out << nl << "opEx__.operation = current__.operation"; - _out << nl << "Throw opEx__"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - _out << nl << "End While"; - if(ret) - { - _out << nl << "Return Nothing"; // Satisfy the VB2005 compiler. - } - } - _out.dec(); - _out << nl << "End " << vbOp; - } - - return true; -} - -void -Slice::Gen::DelegateDVisitor::visitClassDefEnd(const ClassDefPtr&) -{ - _out.dec(); - _out << sp << nl << "End Class"; -} - -Slice::Gen::DispatcherVisitor::DispatcherVisitor(::IceUtil::Output &out) - : VbVisitor(out) -{ -} - -bool -Slice::Gen::DispatcherVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasNonLocalClassDecls()) - { - return false; - } - - _out << sp << nl << "Namespace " << fixId(p->name()); - _out.inc(); - return true; -} - -void -Slice::Gen::DispatcherVisitor::visitModuleEnd(const ModulePtr&) -{ - _out.dec(); - _out << sp << nl << "End Namespace"; -} - -bool -Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - if(p->isLocal() || !p->isInterface()) - { - return false; - } - - _out << sp << nl << "Public MustInherit Class " << p->name() << "Disp_"; - _out.inc(); - _out << nl << "Inherits Ice.ObjectImpl"; - _out << nl << "Implements " << fixId(p->name()); - - OperationList ops = p->operations(); - if(!ops.empty()) - { - _out.zeroIndent(); - _out << sp << nl << "#Region \"Slice operations\""; - _out.restoreIndent(); - } - - for(OperationList::const_iterator op = ops.begin(); op != ops.end(); ++op) - { - bool amd = p->hasMetaData("amd") || (*op)->hasMetaData("amd"); - - string name = (*op)->name(); - vector<string> params; - vector<string> args; - TypePtr ret; - - if(amd) - { - name = name + "_async"; - params = getParamsAsync(*op, true); - args = getArgsAsync(*op); - } - else - { - name = fixId(name, DotNet::ICloneable, true); - params = getParams(*op); - ret = (*op)->returnType(); - args = getArgs(*op); - } - - string vbOp = ret ? "Function" : "Sub"; - - _out << sp << nl << "Public " << vbOp << ' ' << name << spar << params << epar; - if(ret) - { - _out << " As " << typeToString(ret); - } - _out << " Implements " << p->name() << "OperationsNC_" << '.' << name; // TODO: should be containing class? - _out.inc(); - _out << nl; - if(ret) - { - _out << "Return "; - } - _out << name << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar; - _out.dec(); - _out << nl << "End " << vbOp; - - _out << sp << nl << "Public MustOverride " << vbOp << ' ' << name << spar << params; - if(!p->isLocal()) - { - _out << "ByVal current__ As Ice.Current"; - } - _out << epar; - if(ret) - { - _out << " As " << typeToString(ret); - } - _out << " Implements " << p->name() << "Operations_" << '.' << name; // TODO: should be containing class? - } - - if(!ops.empty()) - { - _out.zeroIndent(); - _out << sp << nl << "#End Region"; // Slice operations - _out.restoreIndent(); - } - - writeInheritedOperations(p); - - writeDispatch(p); - - _out.dec(); - _out << sp << nl << "End Class"; - - return true; -} - -Slice::Gen::AsyncVisitor::AsyncVisitor(::IceUtil::Output &out) - : VbVisitor(out) -{ -} - -bool -Slice::Gen::AsyncVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasAsyncOps()) - { - return false; - } - - _out << sp << nl << "Namespace " << fixId(p->name()); - _out.inc(); - return true; -} - -void -Slice::Gen::AsyncVisitor::visitModuleEnd(const ModulePtr&) -{ - _out.dec(); - _out << sp << nl << "End Namespace"; -} - -bool -Slice::Gen::AsyncVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - return true; -} - -void -Slice::Gen::AsyncVisitor::visitClassDefEnd(const ClassDefPtr&) -{ -} - -void -Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) -{ - ContainerPtr container = p->container(); - ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - - if(cl->isLocal()) - { - return; - } - - string name = p->name(); - - if(cl->hasMetaData("ami") || p->hasMetaData("ami")) - { - - TypePtr ret = p->returnType(); - string retS = typeToString(ret); - - TypeStringList inParams; - TypeStringList outParams; - ParamDeclList paramList = p->parameters(); - for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli) - { - if((*pli)->isOutParam()) - { - outParams.push_back(make_pair((*pli)->type(), (*pli)->name())); - } - else - { - inParams.push_back(make_pair((*pli)->type(), (*pli)->name())); - } - } - - ExceptionList throws = p->throws(); - throws.sort(); - throws.unique(); - - // - // Arrange exceptions into most-derived to least-derived order. If we don't - // do this, a base exception handler can appear before a derived exception - // handler, causing compiler warnings and resulting in the base exception - // being marshaled instead of the derived exception. - // -#if defined(__SUNPRO_CC) - throws.sort(Slice::derivedToBaseCompare); -#else - throws.sort(Slice::DerivedToBaseCompare()); -#endif - - TypeStringList::const_iterator q; - - vector<string> params = getParamsAsyncCB(p); - vector<string> args = getArgsAsyncCB(p); - - vector<string> paramsInvoke = getParamsAsync(p, false); - - _out << sp << nl << "Public MustInherit Class AMI_" << cl->name() << '_' << name; - _out.inc(); - _out << nl << "Inherits IceInternal.OutgoingAsync"; - _out << sp; - _out << nl << "Public MustOverride Sub ice_response" << spar << params << epar; - - _out << sp << nl << "Public Sub invoke__" << spar << "ByVal prx__ As Ice.ObjectPrx" - << paramsInvoke << "ByVal ctx__ As Ice.Context" << epar; - _out.inc(); - _out << nl << "Try"; - _out.inc(); - _out << nl << "prepare__(prx__, \"" << p->name() << "\", " - << sliceModeToIceMode(p->sendMode()) << ", ctx__)"; - if(p->returnsData()) - for(q = inParams.begin(); q != inParams.end(); ++q) - { - string typeS = typeToString(q->first); - writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false); - } - if(p->sendsClasses()) - { - _out << nl << "os__.writePendingObjects()"; - } - _out << nl << "os__.endWriteEncaps()"; - _out.dec(); - _out << nl << "Catch ex__ As Ice.LocalException"; - _out.inc(); - _out << nl << "finished__(ex__)"; - _out << nl << "Return"; - _out.dec(); - _out << nl << "End Try"; - _out << nl << "send__()"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Protected Overrides Sub response__(ok__ As Boolean)"; - _out.inc(); - for(q = outParams.begin(); q != outParams.end(); ++q) - { - _out << nl << "Dim " << fixId(q->second) << " As " << typeToString(q->first) << " = Nothing"; - } - if(ret) - { - _out << nl << "Dim ret__ As " << retS << " = Nothing"; - } - _out << nl << "Try"; - _out.inc(); - _out << nl << "If Not ok__ Then"; - _out.inc(); - _out << nl << "Try"; - _out.inc(); - _out << nl << "is__.throwException()"; - _out.dec(); - for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r) - { - _out << nl << "Catch ex__ As " << fixId((*r)->scoped()); - _out.inc(); - _out << nl << "Throw"; - _out.dec(); - } - _out << nl << "Catch ex__ As Ice.UserException"; - _out.inc(); - _out << nl << "Throw New Ice.UnknownUserException(ex__)"; - _out.dec(); - _out << nl << "End Try"; - _out.dec(); - _out << nl << "End If"; - for(q = outParams.begin(); q != outParams.end(); ++q) - { - writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true); - } - if(ret) - { - writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true); - } - if(p->returnsClasses()) - { - _out << nl << "is__.readPendingObjects()"; - } - for(q = outParams.begin(); q != outParams.end(); ++q) - { - string param = fixId(q->second); - BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->first)) - { - string type = typeToString(q->first); - _out << nl << param << " = CType(" << param << "_PP.value, " << type << ')'; - } - } - if(ret) - { - BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret)) - { - string type = typeToString(ret); - _out << nl << "ret__ = CType(ret___PP.value, " << retS << ')'; - } - } - _out.dec(); - _out << nl << "Catch ex__ As Ice.LocalException"; - _out.inc(); - _out << nl << "finished__(ex__)"; - _out << nl << "Return"; - _out.dec(); - if(!throws.empty()) - { - _out << nl << "Catch ex__ As Ice.UserException"; - _out.inc(); - _out << nl << "ice_exception(ex__)"; - _out << nl << "Return"; - _out.dec(); - } - _out << nl << "End Try"; - _out << nl << "ice_response" << spar << args << epar; - _out.dec(); - _out << nl << "End Sub"; - _out.dec(); - _out << sp << nl << "End Class"; - } - - if(cl->hasMetaData("amd") || p->hasMetaData("amd")) - { - string classNameAMD = "AMD_" + cl->name(); - string classNameAMDI = "_AMD_" + cl->name(); - - vector<string> paramsAMD = getParamsAsyncCB(p); - - _out << sp << nl << "Public Interface " << classNameAMD << '_' << name; - _out.inc(); - _out << sp << nl << "Sub ice_response" << spar << paramsAMD << epar; - _out << sp << nl << "Sub ice_exception(ex As _System.Exception)"; - _out.dec(); - _out << nl << "End Interface"; - - TypePtr ret = p->returnType(); - - TypeStringList outParams; - ParamDeclList paramList = p->parameters(); - for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli) - { - if((*pli)->isOutParam()) - { - outParams.push_back(make_pair((*pli)->type(), (*pli)->name())); - } - } - - ExceptionList throws = p->throws(); - throws.sort(); - throws.unique(); - - // - // Arrange exceptions into most-derived to least-derived order. If we don't - // do this, a base exception handler can appear before a derived exception - // handler, causing compiler warnings and resulting in the base exception - // being marshaled instead of the derived exception. - // -#if defined(__SUNPRO_CC) - throws.sort(Slice::derivedToBaseCompare); -#else - throws.sort(Slice::DerivedToBaseCompare()); -#endif - - TypeStringList::const_iterator q; - _out << sp << nl << "Class " << classNameAMDI << '_' << name; - _out.inc(); - _out << nl << "Inherits IceInternal.IncomingAsync"; - _out << nl << "Implements " << classNameAMD << '_' << name; - - _out << sp << nl << "Public Sub New(ByVal inc As IceInternal.Incoming)"; - _out.inc(); - _out << nl << "MyBase.New(inc)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub ice_response" << spar << paramsAMD << epar - << " Implements " << classNameAMD << '_' << name << ".ice_response"; // TODO: should be containing class? - _out.inc(); - if(ret || !outParams.empty()) - { - _out << nl << "Try"; - _out.inc(); - _out << nl << "Dim os__ As IceInternal.BasicStream = Me.os__()"; - for(q = outParams.begin(); q != outParams.end(); ++q) - { - string typeS = typeToString(q->first); - writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false); - } - if(ret) - { - string retS = typeToString(ret); - writeMarshalUnmarshalCode(_out, ret, "ret__", true, false, false); - } - if(p->returnsClasses()) - { - _out << nl << "os__.writePendingObjects()"; - } - _out.dec(); - _out << nl << "Catch ex__ As Ice.LocalException"; - _out.inc(); - _out << nl << "ice_exception(ex__)"; - _out.dec(); - _out << nl << "End Try"; - } - _out << nl << "response__(true)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub ice_exception(ByVal ex As _System.Exception)" - << " Implements " << classNameAMD << '_' << name << ".ice_exception"; // TODO: should be containing class? - _out.inc(); - if(throws.empty()) - { - _out << nl << "exception__(ex)"; - } - else - { - _out << nl << "Try"; - _out.inc(); - _out << nl << "throw ex"; - _out.dec(); - ExceptionList::const_iterator r; - for(r = throws.begin(); r != throws.end(); ++r) - { - string exS = fixId((*r)->scoped()); - _out << nl << "Catch ex__ As " << exS; - _out.inc(); - _out << nl << "os__().writeUserException(ex__)"; - _out << nl << "response__(false)"; - _out.dec(); - } - _out << nl << "Catch ex__ As _System.Exception"; - _out.inc(); - _out << nl << "exception__(ex__)"; - _out.dec(); - _out << nl << "End Try"; - } - _out.dec(); - _out << nl << "End Sub"; - - _out.dec(); - _out << sp << nl << "End Class"; - } -} - -Slice::Gen::TieVisitor::TieVisitor(IceUtil::Output& out) - : VbVisitor(out) -{ -} - -bool -Slice::Gen::TieVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasClassDefs()) - { - return false; - } - - _out << sp << nl << "Namespace " << fixId(p->name()); - _out.inc(); - - return true; -} - -void -Slice::Gen::TieVisitor::visitModuleEnd(const ModulePtr&) -{ - _out.dec(); - _out << sp << nl << "End Namespace"; -} - -bool -Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - if(!p->isAbstract()) - { - return false; - } - - string name = p->name(); - string opIntfName = "Operations"; - if(p->isLocal()) - { - opIntfName += "NC"; - } - - _out << sp << nl << "Public Class " << name << "Tie_"; - _out.inc(); - _out << nl << "Inherits "; - if(p->isInterface()) - { - if(p->isLocal()) - { - _out << fixId(name); - } - else - { - _out << name << "Disp_"; - } - } - else - { - _out << fixId(name); - } - _out << nl << "Implements Ice.TieBase"; - - _out << sp << nl << "Public Sub New()"; - _out << nl << "End Sub"; - - _out << sp << nl << "Public Sub New(ByVal del As " << name << opIntfName << "_)"; - _out.inc(); - _out << nl << "_ice_delegate = del"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public Function ice_delegate() As Object Implements Ice.TieBase.ice_delegate"; - _out.inc(); - _out << nl << "Return _ice_delegate"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Sub ice_delegate(ByVal del As Object) Implements Ice.TieBase.ice_delegate"; - _out.inc(); - _out << nl << "_ice_delegate = CType(del, " << name << opIntfName << "_)"; - _out.dec(); - _out << nl << "End Sub"; - - _out << sp << nl << "Public "; - if(!p->isInterface() || !p->isLocal()) - { - _out << "Overrides "; - } - _out << "Function ice_hash() As Integer"; - - _out.inc(); - _out << nl << "Return GetHashCode()"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overrides Function GetHashCode() As Integer"; - _out.inc(); - _out << nl << "If _ice_delegate Is Nothing Then"; - _out.inc(); - _out << nl << "Return 0"; - _out.dec(); - _out << nl << "Else"; - _out.inc(); - _out << nl << "' Bug in VB 7.1: cast to Object should not be necessary."; - _out << nl << "Return CType(_ice_delegate, Object).GetHashCode()"; - _out.dec(); - _out << nl << "End If"; - _out.dec(); - _out << nl << "End Function"; - - _out << sp << nl << "Public Overloads Overrides Function Equals(ByVal rhs As Object) As Boolean"; - _out.inc(); - _out << nl << "If Object.ReferenceEquals(Me, rhs) Then"; - _out.inc(); - _out << nl << "Return true"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "If Not TypeOf rhs Is " << name << "Tie_ Then"; - _out.inc(); - _out << nl << "Return False"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "If _ice_delegate Is Nothing Then"; - _out.inc(); - _out << nl << "Return CType(rhs, " << name << "Tie_)._ice_delegate Is Nothing"; - _out.dec(); - _out << nl << "End If"; - _out << nl << "' Bug in VB 7.1: cast to Object should not be necessary."; - _out << nl << "Return CType(_ice_delegate, Object).Equals(CType(rhs, " << name << "Tie_)._ice_delegate)"; - _out.dec(); - _out << nl << "End Function"; - - OperationList ops = p->operations(); - OperationList::const_iterator r; - for(r = ops.begin(); r != ops.end(); ++r) - { - bool hasAMD = p->hasMetaData("amd") || (*r)->hasMetaData("amd"); - string opName = hasAMD ? (*r)->name() + "_async" : fixId((*r)->name(), DotNet::ICloneable, true); - - TypePtr ret = (*r)->returnType(); - string retS = typeToString(ret); - - vector<string> params; - vector<string> args; - if(hasAMD) - { - params = getParamsAsync((*r), true); - args = getArgsAsync(*r); - } - else - { - params = getParams((*r)); - args = getArgs(*r); - } - - _out << sp << nl << "Public Overloads "; - if(!p->isInterface() || !p->isLocal()) - { - _out << "Overrides "; - } - string vbOp = (!ret || hasAMD) ? "Sub" : "Function"; - _out << vbOp << ' ' << opName << spar << params; - if(!p->isLocal()) - { - _out << "ByVal current__ As Ice.Current"; - } - _out << epar; - if(ret && !hasAMD) - { - _out << " As " << retS; - } - _out.inc(); - _out << nl; - if(ret && !hasAMD) - { - _out << "Return "; - } - _out << "_ice_delegate." << opName << spar << args; - if(!p->isLocal()) - { - _out << "current__"; - } - _out << epar; - _out.dec(); - _out << nl << "End " << vbOp; - } - - NameSet opNames; - ClassList bases = p->bases(); - for(ClassList::const_iterator i = bases.begin(); i != bases.end(); ++i) - { - writeInheritedOperationsWithOpNames(*i, opNames); - } - - _out << sp << nl << "Private _ice_delegate As " << name << opIntfName << '_'; - - return true; -} - -void -Slice::Gen::TieVisitor::visitClassDefEnd(const ClassDefPtr&) -{ - _out.dec(); - _out << sp << nl << "End Class"; -} - -void -Slice::Gen::TieVisitor::writeInheritedOperationsWithOpNames(const ClassDefPtr& p, NameSet& opNames) -{ - OperationList ops = p->operations(); - OperationList::const_iterator r; - for(r = ops.begin(); r != ops.end(); ++r) - { - bool hasAMD = p->hasMetaData("amd") || (*r)->hasMetaData("amd"); - string opName = hasAMD ? (*r)->name() + "_async" : fixId((*r)->name(), DotNet::ICloneable, true); - if(opNames.find(opName) != opNames.end()) - { - continue; - } - opNames.insert(opName); - - TypePtr ret = (*r)->returnType(); - string retS = typeToString(ret); - - vector<string> params; - vector<string> args; - if(hasAMD) - { - params = getParamsAsync((*r), true); - args = getArgsAsync(*r); - } - else - { - params = getParams((*r)); - args = getArgs(*r); - } - - _out << sp << nl << "Public Overloads "; - if(!p->isInterface() || !p->isLocal()) - { - _out << "Overrides "; - } - string vbOp = (ret && !hasAMD) ? "Function" : "Sub"; - _out << vbOp << ' ' << opName << spar << params; - if(!p->isLocal()) - { - _out << "ByVal current__ As Ice.Current"; - } - _out << epar; - if(ret && !hasAMD) - { - _out << " As " << retS; - } - _out.inc(); - _out << nl; - if(ret && !hasAMD) - { - _out << "Return "; - } - _out << "_ice_delegate." << opName << spar << args; - if(!p->isLocal()) - { - _out << "current__"; - } - _out << epar; - _out.dec(); - _out << nl << "End " << vbOp; - } - - ClassList bases = p->bases(); - for(ClassList::const_iterator i = bases.begin(); i != bases.end(); ++i) - { - writeInheritedOperationsWithOpNames(*i, opNames); - } -} - -Slice::Gen::BaseImplVisitor::BaseImplVisitor(IceUtil::Output& out) - : VbVisitor(out) -{ -} - -void -Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment, bool forTie) -{ - ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container()); - string opName = op->name(); - TypePtr ret = op->returnType(); - string retS = typeToString(ret); - ParamDeclList params = op->parameters(); - ParamDeclList::const_iterator i; - - if(comment) - { - _out << nl << "' "; - } - else - { - _out << sp << nl; - } - - if(!cl->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd"))) - { - vector<string> pDecl = getParamsAsync(op, true); - - _out << "Public Overloads "; - if(!forTie) - { - _out << "Overrides "; - } - _out << "Sub " << opName << "_async" << spar << pDecl << "ByVal current__ As Ice.Current" << epar; - - if(comment) - { - return; - } - else - { - if(forTie) - { - _out << " Implements " << cl->name() << "Operations_." << opName << "_async"; // TODO: should be containing class? - } - } - - _out.inc(); - if(ret) - { - _out << nl << "Dim ret__ As " << typeToString(ret) << " = " << writeValue(ret); - } - for(i = params.begin(); i != params.end(); ++i) - { - if((*i)->isOutParam()) - { - string name = fixId((*i)->name()); - TypePtr type = (*i)->type(); - _out << nl << "Dim " << name << " As " << typeToString(type) << " = " << writeValue(type); - } - } - _out << nl << "cb__.ice_response" << spar; - if(ret) - { - _out << "ret__"; - } - for(i = params.begin(); i != params.end(); ++i) - { - if((*i)->isOutParam()) - { - _out << fixId((*i)->name()); - } - } - _out << epar; - _out.dec(); - _out << nl << "End Sub"; - } - else - { - vector<string> pDecls = getParams(op); - string vbOp = ret ? "Function" : "Sub"; - - _out << "Public Overloads "; - if(!forTie && !cl->isLocal()) - { - _out << "Overrides "; - } - _out << vbOp << ' ' << fixId(opName, DotNet::ICloneable, true) << spar << pDecls; - if(!cl->isLocal()) - { - _out << "ByVal current__ As Ice.Current"; - } - _out << epar; - if(ret) - { - _out << " As " << retS; - } - if(comment) - { - return; - } - else - { - if(forTie) - { - _out << " Implements " << cl->name() << "Operations_." << fixId(opName, DotNet::ICloneable, true); // TODO: should be containing class? - } - } - _out.inc(); - for(i = params.begin(); i != params.end(); ++i) - { - if((*i)->isOutParam()) - { - string name = fixId((*i)->name()); - TypePtr type = (*i)->type(); - _out << nl << name << " = " << writeValue(type); - } - } - if(ret) - { - _out << nl << "Return " << writeValue(ret); - } - _out.dec(); - _out << nl << "End " << vbOp; - } -} - -string -Slice::Gen::BaseImplVisitor::writeValue(const TypePtr& type) -{ - assert(type); - - BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); - if(builtin) - { - switch(builtin->kind()) - { - case Builtin::KindBool: - { - return "false"; - break; - } - case Builtin::KindByte: - case Builtin::KindShort: - case Builtin::KindInt: - case Builtin::KindLong: - { - return "0"; - break; - } - case Builtin::KindFloat: - { - return "0.0F"; - break; - } - case Builtin::KindDouble: - { - return "0.0R"; - break; - } - default: - { - return "Nothing"; - break; - } - } - } - - EnumPtr en = EnumPtr::dynamicCast(type); - if(en) - { - return fixId(en->scoped()) + "." + fixId((*en->getEnumerators().begin())->name()); - } - - StructPtr st = StructPtr::dynamicCast(type); - if(st) - { - return st->hasMetaData("clr:class") ? string("Nothing") : "New " + fixId(st->scoped()) + "()"; - } - - return "Nothing"; -} - -Slice::Gen::ImplVisitor::ImplVisitor(IceUtil::Output& out) - : BaseImplVisitor(out) -{ -} - -bool -Slice::Gen::ImplVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasClassDefs()) - { - return false; - } - - _out << sp << nl << "Namespace " << fixId(p->name()); - _out.inc(); - - return true; -} - -void -Slice::Gen::ImplVisitor::visitModuleEnd(const ModulePtr&) -{ - _out.dec(); - _out << sp << nl << "End Namespace"; -} - -bool -Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - if(!p->isAbstract()) - { - return false; - } - - string name = p->name(); - - _out << sp << nl << "Public NotInheritable Class " << name << 'I'; - _out << nl; - if(p->isInterface()) - { - if(p->isLocal()) - { - _out << "Inherits Ice.LocalObjectImpl"; - _out << nl << "Implements fixId(name)"; - } - else - { - _out << "Inherits " << name << "Disp_"; - } - } - else - { - _out << "Inherits " << fixId(name); - } - _out.inc(); - - OperationList ops = p->allOperations(); - for(OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r) - { - writeOperation(*r, false, false); - } - - return true; -} - -void -Slice::Gen::ImplVisitor::visitClassDefEnd(const ClassDefPtr&) -{ - _out.dec(); - _out << sp << nl << "End Class"; -} - -Slice::Gen::ImplTieVisitor::ImplTieVisitor(IceUtil::Output& out) - : BaseImplVisitor(out) -{ -} - -bool -Slice::Gen::ImplTieVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasClassDefs()) - { - return false; - } - - _out << sp << nl << "Namespace " << fixId(p->name()); - _out.inc(); - - return true; -} - -void -Slice::Gen::ImplTieVisitor::visitModuleEnd(const ModulePtr&) -{ - _out.dec(); - _out << sp << nl << "End Namespace"; -} - -bool -Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - if(!p->isAbstract()) - { - return false; - } - - string name = p->name(); - ClassList bases = p->bases(); - - // - // Use implementation inheritance in the following situations: - // - // * if a class extends another class - // * if a class implements a single interface - // * if an interface extends only one interface - // - bool inheritImpl = (!p->isInterface() && !bases.empty() && !bases.front()->isInterface()) || (bases.size() == 1); - - _out << sp << nl << "Public Class " << name << "I"; - _out.inc(); - if(inheritImpl) - { - _out << nl << "Inherits "; - if(bases.front()->isAbstract()) - { - _out << bases.front()->name() << 'I'; - } - else - { - _out << fixId(bases.front()->name()); - } - } - _out << nl << "Implements " << name << "Operations_"; - - _out << sp << nl << "Public Sub New()"; - _out << nl << "End Sub"; - - OperationList ops = p->allOperations(); - ops.sort(); - - OperationList baseOps; - if(inheritImpl) - { - baseOps = bases.front()->allOperations(); - baseOps.sort(); - } - - OperationList::const_iterator r; - for(r = ops.begin(); r != ops.end(); ++r) - { - if(inheritImpl && binary_search(baseOps.begin(), baseOps.end(), *r)) - { - _out << sp; - _out << nl << "'"; - _out << nl << "' Implemented by " << bases.front()->name() << 'I'; - _out << nl << "'"; - writeOperation(*r, true, true); - } - else - { - writeOperation(*r, false, true); - } - } - - _out.dec(); - _out << sp << nl << "End Class"; - - return true; -} diff --git a/cpp/src/slice2vb/Gen.h b/cpp/src/slice2vb/Gen.h deleted file mode 100644 index 0d743201b07..00000000000 --- a/cpp/src/slice2vb/Gen.h +++ /dev/null @@ -1,279 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef GEN_H -#define GEN_H - -#include <Slice/VbUtil.h> - -namespace Slice -{ - -class VbVisitor : public VbGenerator, public ParserVisitor -{ -public: - - VbVisitor(::IceUtil::Output&); - virtual ~VbVisitor(); - -protected: - - virtual void writeInheritedOperations(const ClassDefPtr&); - virtual void writeDispatch(const ClassDefPtr&); - virtual std::vector<std::string> getParams(const OperationPtr&); - virtual std::vector<std::string> getParamsAsync(const OperationPtr&, bool); - virtual std::vector<std::string> getParamsAsyncCB(const OperationPtr&); - virtual std::vector<std::string> getArgs(const OperationPtr&); - virtual std::vector<std::string> getArgsAsync(const OperationPtr&); - virtual std::vector<std::string> getArgsAsyncCB(const OperationPtr&); - - void emitAttributes(const ContainedPtr&); - ::std::string getParamAttributes(const ParamDeclPtr&); - - ::IceUtil::Output& _out; -}; - -class Gen : private ::IceUtil::noncopyable -{ -public: - - Gen(const std::string&, - const std::string&, - const std::vector<std::string>&, - const std::string&, - bool, - bool, - bool); - ~Gen(); - - bool operator!() const; // Returns true if there was a constructor error - - void generate(const UnitPtr&); - void generateTie(const UnitPtr&); - void generateImpl(const UnitPtr&); - void generateImplTie(const UnitPtr&); - void generateChecksums(const UnitPtr&); - -private: - - IceUtil::Output _out; - IceUtil::Output _impl; - - std::vector<std::string> _includePaths; - - bool _stream; - - void printHeader(); - - class UnitVisitor : public VbVisitor - { - public: - - UnitVisitor(::IceUtil::Output&, bool); - - virtual bool visitModuleStart(const ModulePtr&); - - private: - - bool _stream; - bool _globalMetaDataDone; - }; - - class TypesVisitor : public VbVisitor - { - public: - - TypesVisitor(::IceUtil::Output&, bool); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual void visitOperation(const OperationPtr&); - virtual void visitClassDefEnd(const ClassDefPtr&); - virtual bool visitExceptionStart(const ExceptionPtr&); - virtual void visitExceptionEnd(const ExceptionPtr&); - virtual bool visitStructStart(const StructPtr&); - virtual void visitStructEnd(const StructPtr&); - virtual void visitSequence(const SequencePtr&); - virtual void visitDictionary(const DictionaryPtr&); - virtual void visitEnum(const EnumPtr&); - virtual void visitConst(const ConstPtr&); - virtual void visitDataMember(const DataMemberPtr&); - - private: - - void invokeObjectMethod(const TypePtr&, const std::string&, const std::string&, const std::string&); - - bool _stream; - }; - - class ProxyVisitor : public VbVisitor - { - public: - - ProxyVisitor(::IceUtil::Output&); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual void visitClassDefEnd(const ClassDefPtr&); - virtual void visitOperation(const OperationPtr&); - }; - - class OpsVisitor : public VbVisitor - { - public: - - OpsVisitor(::IceUtil::Output&); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - - private: - void writeOperations(const ClassDefPtr&, bool); - }; - - class HelperVisitor : public VbVisitor - { - public: - - HelperVisitor(::IceUtil::Output&, bool); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual void visitClassDefEnd(const ClassDefPtr&); - virtual void visitSequence(const SequencePtr&); - virtual void visitDictionary(const DictionaryPtr&); - - private: - - bool _stream; - }; - - class DelegateVisitor : public VbVisitor - { - public: - - DelegateVisitor(::IceUtil::Output&); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual void visitClassDefEnd(const ClassDefPtr&); - }; - - class DelegateMVisitor : public VbVisitor - { - public: - - DelegateMVisitor(::IceUtil::Output&); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual void visitClassDefEnd(const ClassDefPtr&); - }; - - class DelegateDVisitor : public VbVisitor - { - public: - - DelegateDVisitor(::IceUtil::Output&); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual void visitClassDefEnd(const ClassDefPtr&); - }; - - class DispatcherVisitor : public VbVisitor - { - public: - - DispatcherVisitor(::IceUtil::Output&); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - }; - - class AsyncVisitor : public VbVisitor - { - public: - - AsyncVisitor(::IceUtil::Output&); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual void visitClassDefEnd(const ClassDefPtr&); - virtual void visitOperation(const OperationPtr&); - }; - - class TieVisitor : public VbVisitor - { - public: - - TieVisitor(::IceUtil::Output&); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual void visitClassDefEnd(const ClassDefPtr&); - - private: - - typedef ::std::set< ::std::string> NameSet; - void writeInheritedOperationsWithOpNames(const ClassDefPtr&, NameSet&); - }; - - class BaseImplVisitor : public VbVisitor - { - public: - - BaseImplVisitor(::IceUtil::Output&); - - protected: - - void writeOperation(const OperationPtr&, bool, bool); - - private: - - ::std::string writeValue(const TypePtr&); - }; - - class ImplVisitor : public BaseImplVisitor - { - public: - - ImplVisitor(::IceUtil::Output&); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual void visitClassDefEnd(const ClassDefPtr&); - }; - - class ImplTieVisitor : public BaseImplVisitor - { - public: - - ImplTieVisitor(::IceUtil::Output&); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - }; -}; - -} - -#endif diff --git a/cpp/src/slice2vb/Main.cpp b/cpp/src/slice2vb/Main.cpp deleted file mode 100644 index 07d384d7dc6..00000000000 --- a/cpp/src/slice2vb/Main.cpp +++ /dev/null @@ -1,226 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include <IceUtil/Options.h> -#include <Slice/Preprocessor.h> -#include <Gen.h> - -using namespace std; -using namespace Slice; - -void -usage(const char* n) -{ - cerr << "Usage: " << n << " [options] slice-files...\n"; - cerr << - "Options:\n" - "-h, --help Show this message.\n" - "-v, --version Display the Ice version.\n" - "-DNAME Define NAME as 1.\n" - "-DNAME=DEF Define NAME as DEF.\n" - "-UNAME Remove any definition for NAME.\n" - "-IDIR Put DIR in the include file search path.\n" - "-E Print preprocessor output on stdout.\n" - "--output-dir DIR Create files in the directory DIR.\n" - "--tie Generate TIE classes.\n" - "--impl Generate sample implementations.\n" - "--impl-tie Generate sample TIE implementations.\n" - "--depend Generate Makefile dependencies.\n" - "-d, --debug Print debug messages.\n" - "--ice Permit `Ice' prefix (for building Ice source code only)\n" - "--checksum Generate checksums for Slice definitions.\n" - "--stream Generate marshaling support for public stream API.\n" - ; - // Note: --case-sensitive is intentionally not shown here! -} - -int -main(int argc, char* argv[]) -{ - IceUtil::Options opts; - opts.addOpt("h", "help"); - opts.addOpt("v", "version"); - opts.addOpt("D", "", IceUtil::Options::NeedArg, "", IceUtil::Options::Repeat); - opts.addOpt("U", "", IceUtil::Options::NeedArg, "", IceUtil::Options::Repeat); - opts.addOpt("I", "", IceUtil::Options::NeedArg, "", IceUtil::Options::Repeat); - opts.addOpt("E"); - opts.addOpt("", "output-dir", IceUtil::Options::NeedArg); - opts.addOpt("", "tie"); - opts.addOpt("", "impl"); - opts.addOpt("", "impl-tie"); - opts.addOpt("", "depend"); - opts.addOpt("d", "debug"); - opts.addOpt("", "ice"); - opts.addOpt("", "checksum"); - opts.addOpt("", "stream"); - opts.addOpt("", "case-sensitive"); - - vector<string>args; - try - { - args = opts.parse(argc, (const char**)argv); - } - catch(const IceUtil::BadOptException& e) - { - cerr << argv[0] << ": " << e.reason << endl; - usage(argv[0]); - return EXIT_FAILURE; - } - - if(opts.isSet("help")) - { - usage(argv[0]); - return EXIT_SUCCESS; - } - - if(opts.isSet("version")) - { - cout << ICE_STRING_VERSION << endl; - return EXIT_SUCCESS; - } - - string cppArgs; - vector<string> optargs = opts.argVec("D"); - vector<string>::const_iterator i; - for(i = optargs.begin(); i != optargs.end(); ++i) - { - cppArgs += " -D" + Preprocessor::addQuotes(*i); - } - - optargs = opts.argVec("U"); - for(i = optargs.begin(); i != optargs.end(); ++i) - { - cppArgs += " -U" + Preprocessor::addQuotes(*i); - } - - vector<string> includePaths = opts.argVec("I"); - for(i = includePaths.begin(); i != includePaths.end(); ++i) - { - cppArgs += " -I" + Preprocessor::normalizeIncludePath(*i); - } - - bool preprocess = opts.isSet("E"); - - string output = opts.optArg("output-dir"); - - bool tie = opts.isSet("tie"); - - bool impl = opts.isSet("impl"); - - bool implTie = opts.isSet("impl-tie"); - - bool depend = opts.isSet("depend"); - - bool debug = opts.isSet("debug"); - - bool ice = opts.isSet("ice"); - - bool checksum = opts.isSet("checksum"); - - bool stream = opts.isSet("stream"); - - bool caseSensitive = opts.isSet("case-sensitive"); - - if(args.empty()) - { - cerr << argv[0] << ": no input file" << endl; - usage(argv[0]); - return EXIT_FAILURE; - } - - if(impl && implTie) - { - cerr << argv[0] << ": cannot specify both --impl and --impl-tie" << endl; - usage(argv[0]); - return EXIT_FAILURE; - } - - int status = EXIT_SUCCESS; - - for(i = args.begin(); i != args.end(); ++i) - { - if(depend) - { - Preprocessor icecpp(argv[0], *i, cppArgs); - icecpp.printMakefileDependencies(Preprocessor::VisualBasic); - } - else - { - Preprocessor icecpp(argv[0], *i, cppArgs); - FILE* cppHandle = icecpp.preprocess(false); - - if(cppHandle == 0) - { - return EXIT_FAILURE; - } - - if(preprocess) - { - char buf[4096]; - while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL) - { - if(fputs(buf, stdout) == EOF) - { - return EXIT_FAILURE; - } - } - if(!icecpp.close()) - { - return EXIT_FAILURE; - } - } - else - { - UnitPtr p = Unit::createUnit(false, false, ice, caseSensitive); - int parseStatus = p->parse(cppHandle, debug); - - if(!icecpp.close()) - { - p->destroy(); - return EXIT_FAILURE; - } - - if(parseStatus == EXIT_FAILURE) - { - status = EXIT_FAILURE; - } - else - { - Gen gen(argv[0], icecpp.getBaseName(), includePaths, output, impl, implTie, stream); - if(!gen) - { - p->destroy(); - return EXIT_FAILURE; - } - gen.generate(p); - if(tie) - { - gen.generateTie(p); - } - if(impl) - { - gen.generateImpl(p); - } - if(implTie) - { - gen.generateImplTie(p); - } - if(checksum) - { - gen.generateChecksums(p); - } - } - - p->destroy(); - } - } - } - - return status; -} diff --git a/cpp/src/slice2vb/Makefile b/cpp/src/slice2vb/Makefile deleted file mode 100644 index 691ce13b7ee..00000000000 --- a/cpp/src/slice2vb/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. -# -# This copy of Ice is licensed to you under the terms described in the -# ICE_LICENSE file included in this distribution. -# -# ********************************************************************** - -top_srcdir = ../.. - -NAME = $(top_srcdir)/bin/slice2vb - -TARGETS = $(NAME) - -OBJS = Gen.o \ - Main.o - -SRCS = $(OBJS:.o=.cpp) - -include $(top_srcdir)/config/Make.rules - -CPPFLAGS := -I. $(CPPFLAGS) - -$(NAME): $(OBJS) - rm -f $@ - $(CXX) $(LDFLAGS) -o $@ $(OBJS) -lSlice $(BASELIBS) - -install:: all - $(call installprogram,$(NAME),$(install_bindir)) - -include .depend diff --git a/cpp/src/slice2vb/Makefile.mak b/cpp/src/slice2vb/Makefile.mak deleted file mode 100644 index 392bd49f65d..00000000000 --- a/cpp/src/slice2vb/Makefile.mak +++ /dev/null @@ -1,56 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. -# -# This copy of Ice is licensed to you under the terms described in the -# ICE_LICENSE file included in this distribution. -# -# ********************************************************************** - -top_srcdir = ..\.. - -NAME = $(top_srcdir)\bin\slice2vb.exe - -TARGETS = $(NAME) - -OBJS = Gen.obj \ - Main.obj - -SRCS = $(OBJS:.obj=.cpp) - -!include $(top_srcdir)/config/Make.rules.mak - -CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN - -!if "$(CPP_COMPILER)" != "BCC2006" && "$(OPTIMIZE)" != "yes" -PDBFLAGS = /pdb:$(NAME:.exe=.pdb) -!endif - -$(NAME): $(OBJS) - $(LINK) $(LD_EXEFLAGS) $(PDBFLAGS) $(OBJS) $(SETARGV) $(PREOUT)$@ $(PRELIBS)slice$(LIBSUFFIX).lib $(BASELIBS) - @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ - $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest - -clean:: - del /q $(NAME:.exe=.*) - -install:: all - copy $(NAME) $(install_bindir) - -!if "$(OPTIMIZE)" != "yes" - -!if "$(CPP_COMPILER)" == "BCC2006" - -install:: all - copy $(NAME:.exe=.tds) $(install_bindir) - -!else - -install:: all - copy $(NAME:.exe=.pdb) $(install_bindir) - -!endif - -!endif - -!include .depend |