zeroc-ice 3.6b1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ICE_LICENSE +54 -0
- data/LICENSE +339 -0
- data/bin/slice2rb +17 -0
- data/ext/Communicator.cpp +596 -0
- data/ext/Communicator.h +25 -0
- data/ext/Config.h +111 -0
- data/ext/Connection.cpp +381 -0
- data/ext/Connection.h +26 -0
- data/ext/Endpoint.cpp +311 -0
- data/ext/Endpoint.h +27 -0
- data/ext/ImplicitContext.cpp +152 -0
- data/ext/ImplicitContext.h +25 -0
- data/ext/Init.cpp +52 -0
- data/ext/Logger.cpp +151 -0
- data/ext/Logger.h +28 -0
- data/ext/ObjectFactory.cpp +140 -0
- data/ext/ObjectFactory.h +50 -0
- data/ext/Operation.cpp +676 -0
- data/ext/Operation.h +36 -0
- data/ext/Properties.cpp +369 -0
- data/ext/Properties.h +25 -0
- data/ext/Proxy.cpp +1354 -0
- data/ext/Proxy.h +27 -0
- data/ext/Slice.cpp +223 -0
- data/ext/Slice.h +22 -0
- data/ext/Types.cpp +3160 -0
- data/ext/Types.h +545 -0
- data/ext/Util.cpp +792 -0
- data/ext/Util.h +511 -0
- data/ext/extconf.rb +118 -0
- data/ext/ice/BZIP_LICENSE +42 -0
- data/ext/ice/MCPP_LICENSE +36 -0
- data/ext/ice/bzip2/blocksort.c +1094 -0
- data/ext/ice/bzip2/bzlib.c +1572 -0
- data/ext/ice/bzip2/bzlib.h +282 -0
- data/ext/ice/bzip2/bzlib_private.h +509 -0
- data/ext/ice/bzip2/compress.c +672 -0
- data/ext/ice/bzip2/crctable.c +104 -0
- data/ext/ice/bzip2/decompress.c +646 -0
- data/ext/ice/bzip2/huffman.c +205 -0
- data/ext/ice/bzip2/randtable.c +84 -0
- data/ext/ice/cpp/include/Ice/ACMF.h +30 -0
- data/ext/ice/cpp/include/Ice/Application.h +156 -0
- data/ext/ice/cpp/include/Ice/AsyncResult.h +363 -0
- data/ext/ice/cpp/include/Ice/AsyncResultF.h +26 -0
- data/ext/ice/cpp/include/Ice/BasicStream.h +1315 -0
- data/ext/ice/cpp/include/Ice/Buffer.h +159 -0
- data/ext/ice/cpp/include/Ice/BuiltinSequences.h +74 -0
- data/ext/ice/cpp/include/Ice/Communicator.h +194 -0
- data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +115 -0
- data/ext/ice/cpp/include/Ice/CommunicatorF.h +60 -0
- data/ext/ice/cpp/include/Ice/Config.h +97 -0
- data/ext/ice/cpp/include/Ice/Connection.h +495 -0
- data/ext/ice/cpp/include/Ice/ConnectionAsync.h +115 -0
- data/ext/ice/cpp/include/Ice/ConnectionF.h +72 -0
- data/ext/ice/cpp/include/Ice/ConnectionFactoryF.h +30 -0
- data/ext/ice/cpp/include/Ice/ConnectionIF.h +37 -0
- data/ext/ice/cpp/include/Ice/Current.h +94 -0
- data/ext/ice/cpp/include/Ice/DefaultObjectFactory.h +48 -0
- data/ext/ice/cpp/include/Ice/DeprecatedStringConverter.h +62 -0
- data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +33 -0
- data/ext/ice/cpp/include/Ice/Dispatcher.h +51 -0
- data/ext/ice/cpp/include/Ice/DynamicLibrary.h +105 -0
- data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +29 -0
- data/ext/ice/cpp/include/Ice/Endpoint.h +350 -0
- data/ext/ice/cpp/include/Ice/EndpointF.h +97 -0
- data/ext/ice/cpp/include/Ice/EndpointTypes.h +74 -0
- data/ext/ice/cpp/include/Ice/Exception.h +114 -0
- data/ext/ice/cpp/include/Ice/FacetMap.h +56 -0
- data/ext/ice/cpp/include/Ice/FactoryTable.h +69 -0
- data/ext/ice/cpp/include/Ice/FactoryTableInit.h +87 -0
- data/ext/ice/cpp/include/Ice/Format.h +39 -0
- data/ext/ice/cpp/include/Ice/Functional.h +138 -0
- data/ext/ice/cpp/include/Ice/GCObject.h +73 -0
- data/ext/ice/cpp/include/Ice/Handle.h +192 -0
- data/ext/ice/cpp/include/Ice/Ice.h +54 -0
- data/ext/ice/cpp/include/Ice/Identity.h +160 -0
- data/ext/ice/cpp/include/Ice/ImplicitContext.h +96 -0
- data/ext/ice/cpp/include/Ice/ImplicitContextF.h +60 -0
- data/ext/ice/cpp/include/Ice/Incoming.h +131 -0
- data/ext/ice/cpp/include/Ice/IncomingAsync.h +108 -0
- data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +35 -0
- data/ext/ice/cpp/include/Ice/Initialize.h +141 -0
- data/ext/ice/cpp/include/Ice/InstanceF.h +26 -0
- data/ext/ice/cpp/include/Ice/Instrumentation.h +377 -0
- data/ext/ice/cpp/include/Ice/InstrumentationF.h +71 -0
- data/ext/ice/cpp/include/Ice/LocalException.h +1022 -0
- data/ext/ice/cpp/include/Ice/LocalObject.h +36 -0
- data/ext/ice/cpp/include/Ice/LocalObjectF.h +26 -0
- data/ext/ice/cpp/include/Ice/Locator.h +2191 -0
- data/ext/ice/cpp/include/Ice/LocatorF.h +89 -0
- data/ext/ice/cpp/include/Ice/Logger.h +94 -0
- data/ext/ice/cpp/include/Ice/LoggerF.h +60 -0
- data/ext/ice/cpp/include/Ice/LoggerUtil.h +153 -0
- data/ext/ice/cpp/include/Ice/Makefile +26 -0
- data/ext/ice/cpp/include/Ice/Metrics.h +2989 -0
- data/ext/ice/cpp/include/Ice/MetricsAdminI.h +662 -0
- data/ext/ice/cpp/include/Ice/MetricsFunctional.h +144 -0
- data/ext/ice/cpp/include/Ice/MetricsObserverI.h +576 -0
- data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +55 -0
- data/ext/ice/cpp/include/Ice/Object.h +165 -0
- data/ext/ice/cpp/include/Ice/ObjectAdapter.h +162 -0
- data/ext/ice/cpp/include/Ice/ObjectAdapterF.h +60 -0
- data/ext/ice/cpp/include/Ice/ObjectAdapterFactoryF.h +26 -0
- data/ext/ice/cpp/include/Ice/ObjectF.h +26 -0
- data/ext/ice/cpp/include/Ice/ObjectFactory.h +86 -0
- data/ext/ice/cpp/include/Ice/ObjectFactoryF.h +60 -0
- data/ext/ice/cpp/include/Ice/ObjectFactoryManagerF.h +26 -0
- data/ext/ice/cpp/include/Ice/ObserverHelper.h +177 -0
- data/ext/ice/cpp/include/Ice/Outgoing.h +197 -0
- data/ext/ice/cpp/include/Ice/OutgoingAsync.h +264 -0
- data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +38 -0
- data/ext/ice/cpp/include/Ice/Plugin.h +121 -0
- data/ext/ice/cpp/include/Ice/PluginF.h +66 -0
- data/ext/ice/cpp/include/Ice/Process.h +568 -0
- data/ext/ice/cpp/include/Ice/ProcessF.h +77 -0
- data/ext/ice/cpp/include/Ice/Properties.h +130 -0
- data/ext/ice/cpp/include/Ice/PropertiesAdmin.h +824 -0
- data/ext/ice/cpp/include/Ice/PropertiesF.h +83 -0
- data/ext/ice/cpp/include/Ice/Protocol.h +242 -0
- data/ext/ice/cpp/include/Ice/Proxy.h +2448 -0
- data/ext/ice/cpp/include/Ice/ProxyF.h +78 -0
- data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +26 -0
- data/ext/ice/cpp/include/Ice/ProxyHandle.h +330 -0
- data/ext/ice/cpp/include/Ice/ReferenceF.h +34 -0
- data/ext/ice/cpp/include/Ice/RemoteLogger.h +1496 -0
- data/ext/ice/cpp/include/Ice/RequestHandlerF.h +29 -0
- data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +25 -0
- data/ext/ice/cpp/include/Ice/Router.h +1155 -0
- data/ext/ice/cpp/include/Ice/RouterF.h +77 -0
- data/ext/ice/cpp/include/Ice/ServantLocator.h +90 -0
- data/ext/ice/cpp/include/Ice/ServantLocatorF.h +60 -0
- data/ext/ice/cpp/include/Ice/ServantManagerF.h +26 -0
- data/ext/ice/cpp/include/Ice/Service.h +260 -0
- data/ext/ice/cpp/include/Ice/SliceChecksumDict.h +56 -0
- data/ext/ice/cpp/include/Ice/SliceChecksums.h +34 -0
- data/ext/ice/cpp/include/Ice/SlicedData.h +103 -0
- data/ext/ice/cpp/include/Ice/SlicedDataF.h +34 -0
- data/ext/ice/cpp/include/Ice/Stream.h +449 -0
- data/ext/ice/cpp/include/Ice/StreamF.h +30 -0
- data/ext/ice/cpp/include/Ice/StreamHelpers.h +877 -0
- data/ext/ice/cpp/include/Ice/ThreadPoolF.h +28 -0
- data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +56 -0
- data/ext/ice/cpp/include/Ice/Version.h +254 -0
- data/ext/ice/cpp/include/IceSSL/Config.h +23 -0
- data/ext/ice/cpp/include/IceSSL/ConnectionInfo.h +119 -0
- data/ext/ice/cpp/include/IceSSL/EndpointInfo.h +101 -0
- data/ext/ice/cpp/include/IceSSL/IceSSL.h +22 -0
- data/ext/ice/cpp/include/IceSSL/Makefile +26 -0
- data/ext/ice/cpp/include/IceSSL/Plugin.h +558 -0
- data/ext/ice/cpp/include/IceUtil/AbstractMutex.h +119 -0
- data/ext/ice/cpp/include/IceUtil/Cache.h +362 -0
- data/ext/ice/cpp/include/IceUtil/Cond.h +323 -0
- data/ext/ice/cpp/include/IceUtil/Config.h +234 -0
- data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +50 -0
- data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +70 -0
- data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +45 -0
- data/ext/ice/cpp/include/IceUtil/Exception.h +184 -0
- data/ext/ice/cpp/include/IceUtil/Functional.h +389 -0
- data/ext/ice/cpp/include/IceUtil/Handle.h +266 -0
- data/ext/ice/cpp/include/IceUtil/IceUtil.h +51 -0
- data/ext/ice/cpp/include/IceUtil/IconvStringConverter.h +302 -0
- data/ext/ice/cpp/include/IceUtil/InputUtil.h +47 -0
- data/ext/ice/cpp/include/IceUtil/Iterator.h +36 -0
- data/ext/ice/cpp/include/IceUtil/Lock.h +135 -0
- data/ext/ice/cpp/include/IceUtil/Makefile +26 -0
- data/ext/ice/cpp/include/IceUtil/Monitor.h +249 -0
- data/ext/ice/cpp/include/IceUtil/Mutex.h +357 -0
- data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +28 -0
- data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +83 -0
- data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +82 -0
- data/ext/ice/cpp/include/IceUtil/Optional.h +322 -0
- data/ext/ice/cpp/include/IceUtil/Options.h +141 -0
- data/ext/ice/cpp/include/IceUtil/OutputUtil.h +362 -0
- data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +19 -0
- data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +26 -0
- data/ext/ice/cpp/include/IceUtil/Random.h +24 -0
- data/ext/ice/cpp/include/IceUtil/RecMutex.h +113 -0
- data/ext/ice/cpp/include/IceUtil/SHA1.h +65 -0
- data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +44 -0
- data/ext/ice/cpp/include/IceUtil/ScopedArray.h +97 -0
- data/ext/ice/cpp/include/IceUtil/Shared.h +168 -0
- data/ext/ice/cpp/include/IceUtil/StringConverter.h +175 -0
- data/ext/ice/cpp/include/IceUtil/StringUtil.h +91 -0
- data/ext/ice/cpp/include/IceUtil/Thread.h +181 -0
- data/ext/ice/cpp/include/IceUtil/ThreadException.h +108 -0
- data/ext/ice/cpp/include/IceUtil/Time.h +209 -0
- data/ext/ice/cpp/include/IceUtil/Timer.h +143 -0
- data/ext/ice/cpp/include/IceUtil/UUID.h +22 -0
- data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +42 -0
- data/ext/ice/cpp/include/IceUtil/UniquePtr.h +101 -0
- data/ext/ice/cpp/include/Slice/CPlusPlusUtil.h +64 -0
- data/ext/ice/cpp/include/Slice/Checksum.h +26 -0
- data/ext/ice/cpp/include/Slice/CsUtil.h +92 -0
- data/ext/ice/cpp/include/Slice/DotNetNames.h +34 -0
- data/ext/ice/cpp/include/Slice/FileTracker.h +71 -0
- data/ext/ice/cpp/include/Slice/JavaUtil.h +277 -0
- data/ext/ice/cpp/include/Slice/Makefile +26 -0
- data/ext/ice/cpp/include/Slice/PHPUtil.h +50 -0
- data/ext/ice/cpp/include/Slice/Parser.h +1116 -0
- data/ext/ice/cpp/include/Slice/Preprocessor.h +68 -0
- data/ext/ice/cpp/include/Slice/PythonUtil.h +64 -0
- data/ext/ice/cpp/include/Slice/RubyUtil.h +54 -0
- data/ext/ice/cpp/include/Slice/Util.h +33 -0
- data/ext/ice/cpp/src/Ice/ACM.cpp +343 -0
- data/ext/ice/cpp/src/Ice/ACM.h +117 -0
- data/ext/ice/cpp/src/Ice/Acceptor.cpp +16 -0
- data/ext/ice/cpp/src/Ice/Acceptor.h +41 -0
- data/ext/ice/cpp/src/Ice/AcceptorF.h +30 -0
- data/ext/ice/cpp/src/Ice/Application.cpp +760 -0
- data/ext/ice/cpp/src/Ice/AsyncResult.cpp +599 -0
- data/ext/ice/cpp/src/Ice/Base64.cpp +269 -0
- data/ext/ice/cpp/src/Ice/Base64.h +36 -0
- data/ext/ice/cpp/src/Ice/BasicStream.cpp +3393 -0
- data/ext/ice/cpp/src/Ice/Buffer.cpp +98 -0
- data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +34 -0
- data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +718 -0
- data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +106 -0
- data/ext/ice/cpp/src/Ice/Communicator.cpp +45 -0
- data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +386 -0
- data/ext/ice/cpp/src/Ice/CommunicatorI.h +112 -0
- data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +546 -0
- data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +97 -0
- data/ext/ice/cpp/src/Ice/Connection.cpp +58 -0
- data/ext/ice/cpp/src/Ice/ConnectionF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +1639 -0
- data/ext/ice/cpp/src/Ice/ConnectionFactory.h +236 -0
- data/ext/ice/cpp/src/Ice/ConnectionI.cpp +3876 -0
- data/ext/ice/cpp/src/Ice/ConnectionI.h +364 -0
- data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +115 -0
- data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +50 -0
- data/ext/ice/cpp/src/Ice/Connector.cpp +16 -0
- data/ext/ice/cpp/src/Ice/Connector.h +36 -0
- data/ext/ice/cpp/src/Ice/ConnectorF.h +26 -0
- data/ext/ice/cpp/src/Ice/Current.cpp +38 -0
- data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +168 -0
- data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +57 -0
- data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +26 -0
- data/ext/ice/cpp/src/Ice/DeprecatedStringConverter.cpp +60 -0
- data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +49 -0
- data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +281 -0
- data/ext/ice/cpp/src/Ice/Endpoint.cpp +53 -0
- data/ext/ice/cpp/src/Ice/EndpointF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +25 -0
- data/ext/ice/cpp/src/Ice/EndpointFactory.h +44 -0
- data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +26 -0
- data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +208 -0
- data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +46 -0
- data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +26 -0
- data/ext/ice/cpp/src/Ice/EndpointI.cpp +87 -0
- data/ext/ice/cpp/src/Ice/EndpointI.h +165 -0
- data/ext/ice/cpp/src/Ice/EndpointIF.h +41 -0
- data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +38 -0
- data/ext/ice/cpp/src/Ice/EventHandler.cpp +35 -0
- data/ext/ice/cpp/src/Ice/EventHandler.h +78 -0
- data/ext/ice/cpp/src/Ice/EventHandlerF.h +26 -0
- data/ext/ice/cpp/src/Ice/EventLoggerMsg.h +53 -0
- data/ext/ice/cpp/src/Ice/Exception.cpp +832 -0
- data/ext/ice/cpp/src/Ice/FacetMap.cpp +34 -0
- data/ext/ice/cpp/src/Ice/FactoryTable.cpp +158 -0
- data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +95 -0
- data/ext/ice/cpp/src/Ice/GCObject.cpp +444 -0
- data/ext/ice/cpp/src/Ice/HashUtil.h +59 -0
- data/ext/ice/cpp/src/Ice/HttpParser.cpp +680 -0
- data/ext/ice/cpp/src/Ice/HttpParser.h +124 -0
- data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +733 -0
- data/ext/ice/cpp/src/Ice/IPEndpointI.h +157 -0
- data/ext/ice/cpp/src/Ice/IPEndpointIF.h +29 -0
- data/ext/ice/cpp/src/Ice/Identity.cpp +42 -0
- data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +41 -0
- data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +639 -0
- data/ext/ice/cpp/src/Ice/ImplicitContextI.h +51 -0
- data/ext/ice/cpp/src/Ice/Incoming.cpp +757 -0
- data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +340 -0
- data/ext/ice/cpp/src/Ice/IncomingRequest.h +37 -0
- data/ext/ice/cpp/src/Ice/Initialize.cpp +401 -0
- data/ext/ice/cpp/src/Ice/Instance.cpp +1928 -0
- data/ext/ice/cpp/src/Ice/Instance.h +198 -0
- data/ext/ice/cpp/src/Ice/Instrumentation.cpp +68 -0
- data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +43 -0
- data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +1083 -0
- data/ext/ice/cpp/src/Ice/InstrumentationI.h +262 -0
- data/ext/ice/cpp/src/Ice/LocalException.cpp +2091 -0
- data/ext/ice/cpp/src/Ice/LocalObject.cpp +29 -0
- data/ext/ice/cpp/src/Ice/Locator.cpp +1946 -0
- data/ext/ice/cpp/src/Ice/LocatorF.cpp +39 -0
- data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +917 -0
- data/ext/ice/cpp/src/Ice/LocatorInfo.h +193 -0
- data/ext/ice/cpp/src/Ice/LocatorInfoF.h +34 -0
- data/ext/ice/cpp/src/Ice/Logger.cpp +40 -0
- data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +862 -0
- data/ext/ice/cpp/src/Ice/LoggerAdminI.h +46 -0
- data/ext/ice/cpp/src/Ice/LoggerF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/LoggerI.cpp +199 -0
- data/ext/ice/cpp/src/Ice/LoggerI.h +57 -0
- data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +107 -0
- data/ext/ice/cpp/src/Ice/Makefile +190 -0
- data/ext/ice/cpp/src/Ice/Metrics.cpp +2159 -0
- data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +669 -0
- data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +14 -0
- data/ext/ice/cpp/src/Ice/Network.cpp +2694 -0
- data/ext/ice/cpp/src/Ice/Network.h +291 -0
- data/ext/ice/cpp/src/Ice/NetworkF.h +28 -0
- data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +325 -0
- data/ext/ice/cpp/src/Ice/NetworkProxy.h +74 -0
- data/ext/ice/cpp/src/Ice/NetworkProxyF.h +26 -0
- data/ext/ice/cpp/src/Ice/Object.cpp +440 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +41 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +241 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +52 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +1498 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +155 -0
- data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +41 -0
- data/ext/ice/cpp/src/Ice/ObjectFactoryF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ObjectFactoryManager.cpp +140 -0
- data/ext/ice/cpp/src/Ice/ObjectFactoryManager.h +43 -0
- data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +84 -0
- data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +407 -0
- data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +70 -0
- data/ext/ice/cpp/src/Ice/Outgoing.cpp +737 -0
- data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +874 -0
- data/ext/ice/cpp/src/Ice/Plugin.cpp +43 -0
- data/ext/ice/cpp/src/Ice/PluginF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +503 -0
- data/ext/ice/cpp/src/Ice/PluginManagerI.h +67 -0
- data/ext/ice/cpp/src/Ice/Process.cpp +299 -0
- data/ext/ice/cpp/src/Ice/ProcessF.cpp +39 -0
- data/ext/ice/cpp/src/Ice/Properties.cpp +45 -0
- data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +555 -0
- data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +207 -0
- data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +45 -0
- data/ext/ice/cpp/src/Ice/PropertiesF.cpp +39 -0
- data/ext/ice/cpp/src/Ice/PropertiesI.cpp +759 -0
- data/ext/ice/cpp/src/Ice/PropertiesI.h +78 -0
- data/ext/ice/cpp/src/Ice/PropertyNames.cpp +1293 -0
- data/ext/ice/cpp/src/Ice/PropertyNames.h +81 -0
- data/ext/ice/cpp/src/Ice/Protocol.cpp +137 -0
- data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +98 -0
- data/ext/ice/cpp/src/Ice/ProtocolInstance.h +91 -0
- data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +26 -0
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +51 -0
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +67 -0
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +26 -0
- data/ext/ice/cpp/src/Ice/Proxy.cpp +1810 -0
- data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +305 -0
- data/ext/ice/cpp/src/Ice/ProxyFactory.h +57 -0
- data/ext/ice/cpp/src/Ice/Reference.cpp +1947 -0
- data/ext/ice/cpp/src/Ice/Reference.h +305 -0
- data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +937 -0
- data/ext/ice/cpp/src/Ice/ReferenceFactory.h +81 -0
- data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +24 -0
- data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +958 -0
- data/ext/ice/cpp/src/Ice/ReplyStatus.h +29 -0
- data/ext/ice/cpp/src/Ice/RequestHandler.cpp +40 -0
- data/ext/ice/cpp/src/Ice/RequestHandler.h +90 -0
- data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +70 -0
- data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +41 -0
- data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +20 -0
- data/ext/ice/cpp/src/Ice/ResponseHandler.h +39 -0
- data/ext/ice/cpp/src/Ice/RetryQueue.cpp +154 -0
- data/ext/ice/cpp/src/Ice/RetryQueue.h +69 -0
- data/ext/ice/cpp/src/Ice/RetryQueueF.h +24 -0
- data/ext/ice/cpp/src/Ice/Router.cpp +849 -0
- data/ext/ice/cpp/src/Ice/RouterF.cpp +39 -0
- data/ext/ice/cpp/src/Ice/RouterInfo.cpp +381 -0
- data/ext/ice/cpp/src/Ice/RouterInfo.h +148 -0
- data/ext/ice/cpp/src/Ice/RouterInfoF.h +30 -0
- data/ext/ice/cpp/src/Ice/Selector.cpp +926 -0
- data/ext/ice/cpp/src/Ice/Selector.h +231 -0
- data/ext/ice/cpp/src/Ice/ServantLocator.cpp +41 -0
- data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ServantManager.cpp +495 -0
- data/ext/ice/cpp/src/Ice/ServantManager.h +74 -0
- data/ext/ice/cpp/src/Ice/Service.cpp +1897 -0
- data/ext/ice/cpp/src/Ice/SharedContext.h +51 -0
- data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +34 -0
- data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +80 -0
- data/ext/ice/cpp/src/Ice/SlicedData.cpp +80 -0
- data/ext/ice/cpp/src/Ice/Stream.cpp +53 -0
- data/ext/ice/cpp/src/Ice/StreamI.cpp +832 -0
- data/ext/ice/cpp/src/Ice/StreamI.h +198 -0
- data/ext/ice/cpp/src/Ice/StreamSocket.cpp +521 -0
- data/ext/ice/cpp/src/Ice/StreamSocket.h +85 -0
- data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +145 -0
- data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +167 -0
- data/ext/ice/cpp/src/Ice/SysLoggerI.h +43 -0
- data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +235 -0
- data/ext/ice/cpp/src/Ice/TcpAcceptor.h +67 -0
- data/ext/ice/cpp/src/Ice/TcpConnector.cpp +133 -0
- data/ext/ice/cpp/src/Ice/TcpConnector.h +51 -0
- data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +397 -0
- data/ext/ice/cpp/src/Ice/TcpEndpointI.h +93 -0
- data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +127 -0
- data/ext/ice/cpp/src/Ice/TcpTransceiver.h +61 -0
- data/ext/ice/cpp/src/Ice/ThreadPool.cpp +1357 -0
- data/ext/ice/cpp/src/Ice/ThreadPool.h +399 -0
- data/ext/ice/cpp/src/Ice/TraceLevels.cpp +43 -0
- data/ext/ice/cpp/src/Ice/TraceLevels.h +50 -0
- data/ext/ice/cpp/src/Ice/TraceLevelsF.h +26 -0
- data/ext/ice/cpp/src/Ice/TraceUtil.cpp +452 -0
- data/ext/ice/cpp/src/Ice/TraceUtil.h +28 -0
- data/ext/ice/cpp/src/Ice/Transceiver.cpp +24 -0
- data/ext/ice/cpp/src/Ice/Transceiver.h +52 -0
- data/ext/ice/cpp/src/Ice/TransceiverF.h +38 -0
- data/ext/ice/cpp/src/Ice/UdpConnector.cpp +144 -0
- data/ext/ice/cpp/src/Ice/UdpConnector.h +51 -0
- data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +483 -0
- data/ext/ice/cpp/src/Ice/UdpEndpointI.h +95 -0
- data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +1156 -0
- data/ext/ice/cpp/src/Ice/UdpTransceiver.h +123 -0
- data/ext/ice/cpp/src/Ice/Version.cpp +46 -0
- data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +103 -0
- data/ext/ice/cpp/src/Ice/WSAcceptor.h +61 -0
- data/ext/ice/cpp/src/Ice/WSConnector.cpp +113 -0
- data/ext/ice/cpp/src/Ice/WSConnector.h +51 -0
- data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +441 -0
- data/ext/ice/cpp/src/Ice/WSEndpoint.h +97 -0
- data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +1728 -0
- data/ext/ice/cpp/src/Ice/WSTransceiver.h +149 -0
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +594 -0
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +1035 -0
- data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +208 -0
- data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +78 -0
- data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +308 -0
- data/ext/ice/cpp/src/IceDiscovery/LookupI.h +183 -0
- data/ext/ice/cpp/src/IceDiscovery/Makefile +61 -0
- data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +148 -0
- data/ext/ice/cpp/src/IceDiscovery/PluginI.h +39 -0
- data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +258 -0
- data/ext/ice/cpp/src/IceSSL/AcceptorI.h +66 -0
- data/ext/ice/cpp/src/IceSSL/Certificate.cpp +1334 -0
- data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +42 -0
- data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +151 -0
- data/ext/ice/cpp/src/IceSSL/ConnectorI.h +56 -0
- data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +397 -0
- data/ext/ice/cpp/src/IceSSL/EndpointI.h +96 -0
- data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +41 -0
- data/ext/ice/cpp/src/IceSSL/Instance.cpp +38 -0
- data/ext/ice/cpp/src/IceSSL/Instance.h +42 -0
- data/ext/ice/cpp/src/IceSSL/InstanceF.h +34 -0
- data/ext/ice/cpp/src/IceSSL/Makefile +82 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +1001 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +607 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +75 -0
- data/ext/ice/cpp/src/IceSSL/PluginI.cpp +102 -0
- data/ext/ice/cpp/src/IceSSL/PluginI.h +56 -0
- data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +541 -0
- data/ext/ice/cpp/src/IceSSL/RFC2253.h +67 -0
- data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +729 -0
- data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +1062 -0
- data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +130 -0
- data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +291 -0
- data/ext/ice/cpp/src/IceSSL/SSLEngine.h +264 -0
- data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +41 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +1514 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +609 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +91 -0
- data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +246 -0
- data/ext/ice/cpp/src/IceSSL/TrustManager.h +51 -0
- data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +26 -0
- data/ext/ice/cpp/src/IceSSL/Util.cpp +1423 -0
- data/ext/ice/cpp/src/IceSSL/Util.h +136 -0
- data/ext/ice/cpp/src/IceUtil/ArgVector.cpp +65 -0
- data/ext/ice/cpp/src/IceUtil/ArgVector.h +41 -0
- data/ext/ice/cpp/src/IceUtil/Cond.cpp +386 -0
- data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +477 -0
- data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +144 -0
- data/ext/ice/cpp/src/IceUtil/CountDownLatch.cpp +184 -0
- data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +273 -0
- data/ext/ice/cpp/src/IceUtil/Exception.cpp +782 -0
- data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +532 -0
- data/ext/ice/cpp/src/IceUtil/FileUtil.h +159 -0
- data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +41 -0
- data/ext/ice/cpp/src/IceUtil/Makefile +68 -0
- data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +24 -0
- data/ext/ice/cpp/src/IceUtil/Options.cpp +1049 -0
- data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +591 -0
- data/ext/ice/cpp/src/IceUtil/Random.cpp +185 -0
- data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +257 -0
- data/ext/ice/cpp/src/IceUtil/SHA1.cpp +126 -0
- data/ext/ice/cpp/src/IceUtil/Shared.cpp +200 -0
- data/ext/ice/cpp/src/IceUtil/StopWatch.h +54 -0
- data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +450 -0
- data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +842 -0
- data/ext/ice/cpp/src/IceUtil/Thread.cpp +809 -0
- data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +172 -0
- data/ext/ice/cpp/src/IceUtil/Time.cpp +306 -0
- data/ext/ice/cpp/src/IceUtil/Timer.cpp +251 -0
- data/ext/ice/cpp/src/IceUtil/UUID.cpp +174 -0
- data/ext/ice/cpp/src/IceUtil/Unicode.cpp +131 -0
- data/ext/ice/cpp/src/IceUtil/Unicode.h +49 -0
- data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +1139 -0
- data/ext/ice/cpp/src/Slice/Checksum.cpp +452 -0
- data/ext/ice/cpp/src/Slice/CsUtil.cpp +2650 -0
- data/ext/ice/cpp/src/Slice/DotNetNames.cpp +146 -0
- data/ext/ice/cpp/src/Slice/FileTracker.cpp +203 -0
- data/ext/ice/cpp/src/Slice/Grammar.cpp +4755 -0
- data/ext/ice/cpp/src/Slice/Grammar.h +98 -0
- data/ext/ice/cpp/src/Slice/GrammarUtil.h +234 -0
- data/ext/ice/cpp/src/Slice/JavaUtil.cpp +4376 -0
- data/ext/ice/cpp/src/Slice/MD5.cpp +57 -0
- data/ext/ice/cpp/src/Slice/MD5.h +44 -0
- data/ext/ice/cpp/src/Slice/MD5I.cpp +385 -0
- data/ext/ice/cpp/src/Slice/MD5I.h +91 -0
- data/ext/ice/cpp/src/Slice/Makefile +65 -0
- data/ext/ice/cpp/src/Slice/PHPUtil.cpp +156 -0
- data/ext/ice/cpp/src/Slice/Parser.cpp +6386 -0
- data/ext/ice/cpp/src/Slice/Preprocessor.cpp +686 -0
- data/ext/ice/cpp/src/Slice/Python.cpp +675 -0
- data/ext/ice/cpp/src/Slice/PythonUtil.cpp +2614 -0
- data/ext/ice/cpp/src/Slice/Ruby.cpp +317 -0
- data/ext/ice/cpp/src/Slice/RubyUtil.cpp +1774 -0
- data/ext/ice/cpp/src/Slice/Scanner.cpp +2426 -0
- data/ext/ice/cpp/src/Slice/Util.cpp +325 -0
- data/ext/ice/mcpp/config.h.Darwin +227 -0
- data/ext/ice/mcpp/config.h.Linux +227 -0
- data/ext/ice/mcpp/config.h.MINGW +7 -0
- data/ext/ice/mcpp/configed.H +382 -0
- data/ext/ice/mcpp/directive.c +1699 -0
- data/ext/ice/mcpp/eval.c +1673 -0
- data/ext/ice/mcpp/expand.c +2980 -0
- data/ext/ice/mcpp/internal.H +564 -0
- data/ext/ice/mcpp/main.c +1131 -0
- data/ext/ice/mcpp/mbchar.c +869 -0
- data/ext/ice/mcpp/mcpp_lib.h +31 -0
- data/ext/ice/mcpp/mcpp_out.h +13 -0
- data/ext/ice/mcpp/support.c +2811 -0
- data/ext/ice/mcpp/system.H +396 -0
- data/ext/ice/mcpp/system.c +4940 -0
- data/ice.gemspec +41 -0
- data/lib/Glacier2.rb +12 -0
- data/lib/Glacier2/Metrics.rb +99 -0
- data/lib/Glacier2/PermissionsVerifier.rb +168 -0
- data/lib/Glacier2/PermissionsVerifierF.rb +34 -0
- data/lib/Glacier2/Router.rb +141 -0
- data/lib/Glacier2/RouterF.rb +29 -0
- data/lib/Glacier2/SSLInfo.rb +79 -0
- data/lib/Glacier2/Session.rb +470 -0
- data/lib/Ice.rb +659 -0
- data/lib/Ice/BuiltinSequences.rb +64 -0
- data/lib/Ice/Communicator.rb +93 -0
- data/lib/Ice/CommunicatorF.rb +28 -0
- data/lib/Ice/Connection.rb +414 -0
- data/lib/Ice/ConnectionF.rb +36 -0
- data/lib/Ice/Current.rb +152 -0
- data/lib/Ice/Endpoint.rb +265 -0
- data/lib/Ice/EndpointF.rb +52 -0
- data/lib/Ice/EndpointTypes.rb +77 -0
- data/lib/Ice/FacetMap.rb +28 -0
- data/lib/Ice/Identity.rb +70 -0
- data/lib/Ice/ImplicitContext.rb +59 -0
- data/lib/Ice/ImplicitContextF.rb +28 -0
- data/lib/Ice/Instrumentation.rb +425 -0
- data/lib/Ice/InstrumentationF.rb +35 -0
- data/lib/Ice/LocalException.rb +1081 -0
- data/lib/Ice/Locator.rb +314 -0
- data/lib/Ice/LocatorF.rb +34 -0
- data/lib/Ice/Logger.rb +57 -0
- data/lib/Ice/LoggerF.rb +28 -0
- data/lib/Ice/Metrics.rb +696 -0
- data/lib/Ice/ObjectAdapterF.rb +28 -0
- data/lib/Ice/ObjectFactory.rb +53 -0
- data/lib/Ice/ObjectFactoryF.rb +28 -0
- data/lib/Ice/Plugin.rb +87 -0
- data/lib/Ice/PluginF.rb +32 -0
- data/lib/Ice/Process.rb +93 -0
- data/lib/Ice/ProcessF.rb +29 -0
- data/lib/Ice/Properties.rb +65 -0
- data/lib/Ice/PropertiesAdmin.rb +104 -0
- data/lib/Ice/PropertiesF.rb +33 -0
- data/lib/Ice/Router.rb +163 -0
- data/lib/Ice/RouterF.rb +29 -0
- data/lib/Ice/SliceChecksumDict.rb +28 -0
- data/lib/Ice/Version.rb +100 -0
- data/lib/IceBox.rb +10 -0
- data/lib/IceBox/IceBox.rb +272 -0
- data/lib/IceGrid.rb +17 -0
- data/lib/IceGrid/Admin.rb +1076 -0
- data/lib/IceGrid/Descriptor.rb +1505 -0
- data/lib/IceGrid/Exception.rb +401 -0
- data/lib/IceGrid/FileParser.rb +105 -0
- data/lib/IceGrid/Locator.rb +105 -0
- data/lib/IceGrid/Observer.rb +571 -0
- data/lib/IceGrid/Query.rb +168 -0
- data/lib/IceGrid/Registry.rb +120 -0
- data/lib/IceGrid/Session.rb +114 -0
- data/lib/IceGrid/UserAccountMapper.rb +101 -0
- data/lib/IcePatch2.rb +10 -0
- data/lib/IcePatch2/FileInfo.rb +75 -0
- data/lib/IcePatch2/FileServer.rb +141 -0
- data/lib/IceStorm.rb +11 -0
- data/lib/IceStorm/IceStorm.rb +463 -0
- data/lib/IceStorm/Metrics.rb +155 -0
- data/slice/Freeze/BackgroundSaveEvictor.ice +111 -0
- data/slice/Freeze/CatalogData.ice +49 -0
- data/slice/Freeze/Connection.ice +111 -0
- data/slice/Freeze/ConnectionF.ice +20 -0
- data/slice/Freeze/DB.ice +37 -0
- data/slice/Freeze/Evictor.ice +339 -0
- data/slice/Freeze/EvictorF.ice +22 -0
- data/slice/Freeze/EvictorStorage.ice +72 -0
- data/slice/Freeze/Exception.ice +100 -0
- data/slice/Freeze/Transaction.ice +57 -0
- data/slice/Freeze/TransactionalEvictor.ice +50 -0
- data/slice/Glacier2/Metrics.ice +77 -0
- data/slice/Glacier2/PermissionsVerifier.ice +105 -0
- data/slice/Glacier2/PermissionsVerifierF.ice +21 -0
- data/slice/Glacier2/Router.ice +178 -0
- data/slice/Glacier2/RouterF.ice +20 -0
- data/slice/Glacier2/SSLInfo.ice +50 -0
- data/slice/Glacier2/Session.ice +273 -0
- data/slice/Ice/BuiltinSequences.ice +48 -0
- data/slice/Ice/Communicator.ice +567 -0
- data/slice/Ice/CommunicatorF.ice +20 -0
- data/slice/Ice/Connection.ice +323 -0
- data/slice/Ice/ConnectionF.ice +22 -0
- data/slice/Ice/Current.ice +160 -0
- data/slice/Ice/Endpoint.ice +227 -0
- data/slice/Ice/EndpointF.ice +32 -0
- data/slice/Ice/EndpointTypes.ice +38 -0
- data/slice/Ice/FacetMap.ice +25 -0
- data/slice/Ice/Identity.ice +59 -0
- data/slice/Ice/ImplicitContext.ice +109 -0
- data/slice/Ice/ImplicitContextF.ice +20 -0
- data/slice/Ice/Instrumentation.ice +499 -0
- data/slice/Ice/InstrumentationF.ice +26 -0
- data/slice/Ice/LocalException.ice +1015 -0
- data/slice/Ice/Locator.ice +227 -0
- data/slice/Ice/LocatorF.ice +21 -0
- data/slice/Ice/Logger.ice +86 -0
- data/slice/Ice/LoggerF.ice +20 -0
- data/slice/Ice/Metrics.ice +422 -0
- data/slice/Ice/ObjectAdapter.ice +673 -0
- data/slice/Ice/ObjectAdapterF.ice +20 -0
- data/slice/Ice/ObjectFactory.ice +60 -0
- data/slice/Ice/ObjectFactoryF.ice +20 -0
- data/slice/Ice/Plugin.ice +117 -0
- data/slice/Ice/PluginF.ice +21 -0
- data/slice/Ice/Process.ice +54 -0
- data/slice/Ice/ProcessF.ice +20 -0
- data/slice/Ice/Properties.ice +228 -0
- data/slice/Ice/PropertiesAdmin.ice +75 -0
- data/slice/Ice/PropertiesF.ice +21 -0
- data/slice/Ice/RemoteLogger.ice +232 -0
- data/slice/Ice/Router.ice +83 -0
- data/slice/Ice/RouterF.ice +20 -0
- data/slice/Ice/ServantLocator.ice +117 -0
- data/slice/Ice/ServantLocatorF.ice +20 -0
- data/slice/Ice/SliceChecksumDict.ice +25 -0
- data/slice/Ice/Version.ice +39 -0
- data/slice/IceBox/IceBox.ice +194 -0
- data/slice/IceDiscovery/IceDiscovery.ice +32 -0
- data/slice/IceGrid/Admin.ice +1578 -0
- data/slice/IceGrid/Descriptor.ice +1079 -0
- data/slice/IceGrid/Discovery.ice +73 -0
- data/slice/IceGrid/Exception.ice +383 -0
- data/slice/IceGrid/FileParser.ice +61 -0
- data/slice/IceGrid/Locator.ice +56 -0
- data/slice/IceGrid/Observer.ice +394 -0
- data/slice/IceGrid/PluginFacade.ice +316 -0
- data/slice/IceGrid/Query.ice +130 -0
- data/slice/IceGrid/Registry.ice +138 -0
- data/slice/IceGrid/Session.ice +124 -0
- data/slice/IceGrid/UserAccountMapper.ice +58 -0
- data/slice/IcePatch2/FileInfo.ice +49 -0
- data/slice/IcePatch2/FileServer.ice +129 -0
- data/slice/IceSSL/ConnectionInfo.ice +34 -0
- data/slice/IceSSL/EndpointInfo.ice +41 -0
- data/slice/IceStorm/IceStorm.ice +405 -0
- data/slice/IceStorm/Metrics.ice +71 -0
- metadata +737 -0
@@ -0,0 +1,2614 @@
|
|
1
|
+
// **********************************************************************
|
2
|
+
//
|
3
|
+
// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
|
4
|
+
//
|
5
|
+
// This copy of Ice is licensed to you under the terms described in the
|
6
|
+
// ICE_LICENSE file included in this distribution.
|
7
|
+
//
|
8
|
+
// **********************************************************************
|
9
|
+
|
10
|
+
#include <Slice/PythonUtil.h>
|
11
|
+
#include <Slice/Checksum.h>
|
12
|
+
#include <Slice/Util.h>
|
13
|
+
#include <IceUtil/IceUtil.h>
|
14
|
+
#include <IceUtil/StringUtil.h>
|
15
|
+
#include <IceUtil/InputUtil.h>
|
16
|
+
#include <climits>
|
17
|
+
#include <iterator>
|
18
|
+
|
19
|
+
using namespace std;
|
20
|
+
using namespace Slice;
|
21
|
+
using namespace IceUtil;
|
22
|
+
using namespace IceUtilInternal;
|
23
|
+
|
24
|
+
namespace Slice
|
25
|
+
{
|
26
|
+
namespace Python
|
27
|
+
{
|
28
|
+
|
29
|
+
class MetaDataVisitor : public ParserVisitor
|
30
|
+
{
|
31
|
+
public:
|
32
|
+
|
33
|
+
virtual bool visitUnitStart(const UnitPtr&);
|
34
|
+
virtual bool visitModuleStart(const ModulePtr&);
|
35
|
+
virtual void visitClassDecl(const ClassDeclPtr&);
|
36
|
+
virtual bool visitClassDefStart(const ClassDefPtr&);
|
37
|
+
virtual bool visitExceptionStart(const ExceptionPtr&);
|
38
|
+
virtual bool visitStructStart(const StructPtr&);
|
39
|
+
virtual void visitOperation(const OperationPtr&);
|
40
|
+
virtual void visitDataMember(const DataMemberPtr&);
|
41
|
+
virtual void visitSequence(const SequencePtr&);
|
42
|
+
virtual void visitDictionary(const DictionaryPtr&);
|
43
|
+
virtual void visitEnum(const EnumPtr&);
|
44
|
+
virtual void visitConst(const ConstPtr&);
|
45
|
+
|
46
|
+
private:
|
47
|
+
|
48
|
+
//
|
49
|
+
// Validates sequence metadata.
|
50
|
+
//
|
51
|
+
void validateSequence(const string&, const string&, const TypePtr&, const StringList&);
|
52
|
+
|
53
|
+
//
|
54
|
+
// Checks a definition that doesn't currently support Python metadata.
|
55
|
+
//
|
56
|
+
void reject(const ContainedPtr&);
|
57
|
+
|
58
|
+
StringSet _history;
|
59
|
+
};
|
60
|
+
|
61
|
+
//
|
62
|
+
// ModuleVisitor finds all of the Slice modules whose include level is greater
|
63
|
+
// than 0 and emits a statement of the following form:
|
64
|
+
//
|
65
|
+
// _M_Foo = Ice.openModule('Foo')
|
66
|
+
//
|
67
|
+
// This statement allows the code generated for this translation unit to refer
|
68
|
+
// to types residing in those included modules.
|
69
|
+
//
|
70
|
+
class ModuleVisitor : public ParserVisitor
|
71
|
+
{
|
72
|
+
public:
|
73
|
+
|
74
|
+
ModuleVisitor(Output&, set<string>&);
|
75
|
+
|
76
|
+
virtual bool visitModuleStart(const ModulePtr&);
|
77
|
+
|
78
|
+
private:
|
79
|
+
|
80
|
+
Output& _out;
|
81
|
+
set<string>& _history;
|
82
|
+
};
|
83
|
+
|
84
|
+
//
|
85
|
+
// CodeVisitor generates the Python mapping for a translation unit.
|
86
|
+
//
|
87
|
+
class CodeVisitor : public ParserVisitor
|
88
|
+
{
|
89
|
+
public:
|
90
|
+
|
91
|
+
CodeVisitor(IceUtilInternal::Output&, set<string>&);
|
92
|
+
|
93
|
+
virtual bool visitModuleStart(const ModulePtr&);
|
94
|
+
virtual void visitModuleEnd(const ModulePtr&);
|
95
|
+
virtual void visitClassDecl(const ClassDeclPtr&);
|
96
|
+
virtual bool visitClassDefStart(const ClassDefPtr&);
|
97
|
+
virtual bool visitExceptionStart(const ExceptionPtr&);
|
98
|
+
virtual bool visitStructStart(const StructPtr&);
|
99
|
+
virtual void visitSequence(const SequencePtr&);
|
100
|
+
virtual void visitDictionary(const DictionaryPtr&);
|
101
|
+
virtual void visitEnum(const EnumPtr&);
|
102
|
+
virtual void visitConst(const ConstPtr&);
|
103
|
+
|
104
|
+
private:
|
105
|
+
|
106
|
+
//
|
107
|
+
// Return a Python symbol for the given parser element.
|
108
|
+
//
|
109
|
+
string getSymbol(const ContainedPtr&, const string& = string());
|
110
|
+
|
111
|
+
//
|
112
|
+
// Emit Python code to assign the given symbol in the current module.
|
113
|
+
//
|
114
|
+
void registerName(const string&);
|
115
|
+
|
116
|
+
//
|
117
|
+
// Emit the tuple for a Slice type.
|
118
|
+
//
|
119
|
+
void writeType(const TypePtr&);
|
120
|
+
|
121
|
+
//
|
122
|
+
// Write an initializer value for a given type.
|
123
|
+
//
|
124
|
+
void writeInitializer(const TypePtr&);
|
125
|
+
|
126
|
+
//
|
127
|
+
// Add a value to a hash code.
|
128
|
+
//
|
129
|
+
void writeHash(const string&, const TypePtr&, int&);
|
130
|
+
|
131
|
+
//
|
132
|
+
// Write Python metadata as a tuple.
|
133
|
+
//
|
134
|
+
void writeMetaData(const StringList&);
|
135
|
+
|
136
|
+
//
|
137
|
+
// Convert an operation mode into a string.
|
138
|
+
//
|
139
|
+
string getOperationMode(Slice::Operation::Mode);
|
140
|
+
|
141
|
+
struct MemberInfo
|
142
|
+
{
|
143
|
+
string fixedName;
|
144
|
+
bool inherited;
|
145
|
+
DataMemberPtr dataMember;
|
146
|
+
};
|
147
|
+
typedef list<MemberInfo> MemberInfoList;
|
148
|
+
|
149
|
+
//
|
150
|
+
// Write a member assignment statement for a constructor.
|
151
|
+
//
|
152
|
+
void writeAssign(const MemberInfo&);
|
153
|
+
|
154
|
+
//
|
155
|
+
// Write a constant value.
|
156
|
+
//
|
157
|
+
void writeConstantValue(const TypePtr&, const SyntaxTreeBasePtr&, const string&);
|
158
|
+
|
159
|
+
//
|
160
|
+
// Write constructor parameters with default values.
|
161
|
+
//
|
162
|
+
void writeConstructorParams(const MemberInfoList&);
|
163
|
+
|
164
|
+
void collectClassMembers(const ClassDefPtr&, MemberInfoList&, bool);
|
165
|
+
void collectExceptionMembers(const ExceptionPtr&, MemberInfoList&, bool);
|
166
|
+
|
167
|
+
string editComment(const string&);
|
168
|
+
|
169
|
+
Output& _out;
|
170
|
+
set<string>& _moduleHistory;
|
171
|
+
list<string> _moduleStack;
|
172
|
+
set<string> _classHistory;
|
173
|
+
};
|
174
|
+
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
static string
|
179
|
+
lookupKwd(const string& name)
|
180
|
+
{
|
181
|
+
//
|
182
|
+
// Keyword list. *Must* be kept in alphabetical order.
|
183
|
+
//
|
184
|
+
static const string keywordList[] =
|
185
|
+
{
|
186
|
+
"None", "and", "assert", "break", "class", "continue", "def", "del", "elif", "else", "except", "exec",
|
187
|
+
"finally", "for", "from", "global", "if", "import", "in", "is", "lambda", "not", "or", "pass",
|
188
|
+
"print", "raise", "return", "self", "try", "while", "yield"
|
189
|
+
};
|
190
|
+
bool found = binary_search(&keywordList[0],
|
191
|
+
&keywordList[sizeof(keywordList) / sizeof(*keywordList)],
|
192
|
+
name);
|
193
|
+
return found ? "_" + name : name;
|
194
|
+
}
|
195
|
+
|
196
|
+
//
|
197
|
+
// Split a scoped name into its components and return the components as a list of (unscoped) identifiers.
|
198
|
+
//
|
199
|
+
static vector<string>
|
200
|
+
splitScopedName(const string& scoped)
|
201
|
+
{
|
202
|
+
assert(scoped[0] == ':');
|
203
|
+
vector<string> ids;
|
204
|
+
string::size_type next = 0;
|
205
|
+
string::size_type pos;
|
206
|
+
while((pos = scoped.find("::", next)) != string::npos)
|
207
|
+
{
|
208
|
+
pos += 2;
|
209
|
+
if(pos != scoped.size())
|
210
|
+
{
|
211
|
+
string::size_type endpos = scoped.find("::", pos);
|
212
|
+
if(endpos != string::npos)
|
213
|
+
{
|
214
|
+
ids.push_back(scoped.substr(pos, endpos - pos));
|
215
|
+
}
|
216
|
+
}
|
217
|
+
next = pos;
|
218
|
+
}
|
219
|
+
if(next != scoped.size())
|
220
|
+
{
|
221
|
+
ids.push_back(scoped.substr(next));
|
222
|
+
}
|
223
|
+
else
|
224
|
+
{
|
225
|
+
ids.push_back("");
|
226
|
+
}
|
227
|
+
|
228
|
+
return ids;
|
229
|
+
}
|
230
|
+
|
231
|
+
static string
|
232
|
+
getDictLookup(const ContainedPtr& cont, const string& suffix = string())
|
233
|
+
{
|
234
|
+
string scope = Slice::Python::scopedToName(cont->scope());
|
235
|
+
assert(!scope.empty());
|
236
|
+
|
237
|
+
string package = Slice::Python::getPackageMetadata(cont);
|
238
|
+
if(!package.empty())
|
239
|
+
{
|
240
|
+
scope = package + "." + scope;
|
241
|
+
}
|
242
|
+
|
243
|
+
return "'" + suffix + Slice::Python::fixIdent(cont->name()) + "' not in _M_" + scope + "__dict__";
|
244
|
+
}
|
245
|
+
|
246
|
+
//
|
247
|
+
// ModuleVisitor implementation.
|
248
|
+
//
|
249
|
+
Slice::Python::ModuleVisitor::ModuleVisitor(Output& out, set<string>& history) :
|
250
|
+
_out(out), _history(history)
|
251
|
+
{
|
252
|
+
}
|
253
|
+
|
254
|
+
bool
|
255
|
+
Slice::Python::ModuleVisitor::visitModuleStart(const ModulePtr& p)
|
256
|
+
{
|
257
|
+
if(p->includeLevel() > 0)
|
258
|
+
{
|
259
|
+
string abs = getAbsolute(p);
|
260
|
+
if(_history.count(abs) == 0)
|
261
|
+
{
|
262
|
+
//
|
263
|
+
// If this is a top-level module, then we check if it has package metadata.
|
264
|
+
// If so, we need to emit statements to open each of the modules in the
|
265
|
+
// package before we can open this module.
|
266
|
+
//
|
267
|
+
if(UnitPtr::dynamicCast(p->container()))
|
268
|
+
{
|
269
|
+
string pkg = getPackageMetadata(p);
|
270
|
+
if(!pkg.empty())
|
271
|
+
{
|
272
|
+
vector<string> v;
|
273
|
+
splitString(pkg, ".", v);
|
274
|
+
string mod;
|
275
|
+
for(vector<string>::iterator q = v.begin(); q != v.end(); ++q)
|
276
|
+
{
|
277
|
+
mod = mod.empty() ? *q : mod + "." + *q;
|
278
|
+
if(_history.count(mod) == 0)
|
279
|
+
{
|
280
|
+
_out << nl << "_M_" << mod << " = Ice.openModule('" << mod << "')";
|
281
|
+
_history.insert(mod);
|
282
|
+
}
|
283
|
+
}
|
284
|
+
}
|
285
|
+
}
|
286
|
+
|
287
|
+
_out << sp << nl << "# Included module " << abs;
|
288
|
+
_out << nl << "_M_" << abs << " = Ice.openModule('" << abs << "')";
|
289
|
+
_history.insert(abs);
|
290
|
+
}
|
291
|
+
}
|
292
|
+
|
293
|
+
return true;
|
294
|
+
}
|
295
|
+
|
296
|
+
//
|
297
|
+
// CodeVisitor implementation.
|
298
|
+
//
|
299
|
+
Slice::Python::CodeVisitor::CodeVisitor(Output& out, set<string>& moduleHistory) :
|
300
|
+
_out(out), _moduleHistory(moduleHistory)
|
301
|
+
{
|
302
|
+
}
|
303
|
+
|
304
|
+
bool
|
305
|
+
Slice::Python::CodeVisitor::visitModuleStart(const ModulePtr& p)
|
306
|
+
{
|
307
|
+
//
|
308
|
+
// As each module is opened, we emit the statement
|
309
|
+
//
|
310
|
+
// __name__ = 'Foo'
|
311
|
+
//
|
312
|
+
// This renames the current module to 'Foo' so that subsequent
|
313
|
+
// type definitions have the proper fully-qualified name.
|
314
|
+
//
|
315
|
+
// We also emit the statement
|
316
|
+
//
|
317
|
+
// _M_Foo = Ice.openModule('Foo')
|
318
|
+
//
|
319
|
+
// This allows us to create types in the module Foo.
|
320
|
+
//
|
321
|
+
string abs = getAbsolute(p);
|
322
|
+
_out << sp << nl << "# Start of module " << abs;
|
323
|
+
if(_moduleHistory.count(abs) == 0) // Don't emit this more than once for each module.
|
324
|
+
{
|
325
|
+
//
|
326
|
+
// If this is a top-level module, then we check if it has package metadata.
|
327
|
+
// If so, we need to emit statements to open each of the modules in the
|
328
|
+
// package before we can open this module.
|
329
|
+
//
|
330
|
+
if(UnitPtr::dynamicCast(p->container()))
|
331
|
+
{
|
332
|
+
string pkg = getPackageMetadata(p);
|
333
|
+
if(!pkg.empty())
|
334
|
+
{
|
335
|
+
vector<string> v;
|
336
|
+
splitString(pkg, ".", v);
|
337
|
+
string mod;
|
338
|
+
for(vector<string>::iterator q = v.begin(); q != v.end(); ++q)
|
339
|
+
{
|
340
|
+
mod = mod.empty() ? *q : mod + "." + *q;
|
341
|
+
if(_moduleHistory.count(mod) == 0) // Don't emit this more than once for each module.
|
342
|
+
{
|
343
|
+
_out << nl << "_M_" << mod << " = Ice.openModule('" << mod << "')";
|
344
|
+
_moduleHistory.insert(mod);
|
345
|
+
}
|
346
|
+
}
|
347
|
+
}
|
348
|
+
}
|
349
|
+
_out << nl << "_M_" << abs << " = Ice.openModule('" << abs << "')";
|
350
|
+
_moduleHistory.insert(abs);
|
351
|
+
}
|
352
|
+
_out << nl << "__name__ = '" << abs << "'";
|
353
|
+
|
354
|
+
string comment = p->comment();
|
355
|
+
if(!comment.empty())
|
356
|
+
{
|
357
|
+
_out << nl << "_M_" << abs << ".__doc__ = '''" << editComment(comment) << "'''";
|
358
|
+
}
|
359
|
+
|
360
|
+
_moduleStack.push_front(abs);
|
361
|
+
return true;
|
362
|
+
}
|
363
|
+
|
364
|
+
void
|
365
|
+
Slice::Python::CodeVisitor::visitModuleEnd(const ModulePtr&)
|
366
|
+
{
|
367
|
+
assert(!_moduleStack.empty());
|
368
|
+
_out << sp << nl << "# End of module " << _moduleStack.front();
|
369
|
+
_moduleStack.pop_front();
|
370
|
+
|
371
|
+
if(!_moduleStack.empty())
|
372
|
+
{
|
373
|
+
_out << sp << nl << "__name__ = '" << _moduleStack.front() << "'";
|
374
|
+
}
|
375
|
+
}
|
376
|
+
|
377
|
+
void
|
378
|
+
Slice::Python::CodeVisitor::visitClassDecl(const ClassDeclPtr& p)
|
379
|
+
{
|
380
|
+
//
|
381
|
+
// Emit forward declarations.
|
382
|
+
//
|
383
|
+
string scoped = p->scoped();
|
384
|
+
if(_classHistory.count(scoped) == 0)
|
385
|
+
{
|
386
|
+
_out << sp << nl << "if " << getDictLookup(p) << ':';
|
387
|
+
_out.inc();
|
388
|
+
string type = getAbsolute(p, "_t_");
|
389
|
+
_out << nl << "_M_" << type << " = IcePy.declareClass('" << scoped << "')";
|
390
|
+
if(!p->isLocal())
|
391
|
+
{
|
392
|
+
_out << nl << "_M_" << getAbsolute(p, "_t_", "Prx") << " = IcePy.declareProxy('" << scoped << "')";
|
393
|
+
}
|
394
|
+
_out.dec();
|
395
|
+
_classHistory.insert(scoped); // Avoid redundant declarations.
|
396
|
+
}
|
397
|
+
}
|
398
|
+
|
399
|
+
bool
|
400
|
+
Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
|
401
|
+
{
|
402
|
+
string scoped = p->scoped();
|
403
|
+
string type = getAbsolute(p, "_t_");
|
404
|
+
string abs = getAbsolute(p);
|
405
|
+
string name = fixIdent(p->name());
|
406
|
+
string prxAbs = getAbsolute(p, "", "Prx");
|
407
|
+
string prxName = fixIdent(p->name() + "Prx");
|
408
|
+
string prxType = getAbsolute(p, "_t_", "Prx");
|
409
|
+
ClassList bases = p->bases();
|
410
|
+
ClassDefPtr base;
|
411
|
+
OperationList ops = p->operations();
|
412
|
+
bool isAbstract = p->isInterface() || p->allOperations().size() > 0; // Don't use isAbstract() - see bug 3739
|
413
|
+
|
414
|
+
//
|
415
|
+
// Define the class.
|
416
|
+
//
|
417
|
+
_out << sp << nl << "if " << getDictLookup(p) << ':';
|
418
|
+
_out.inc();
|
419
|
+
_out << nl << "_M_" << abs << " = Ice.createTempClass()";
|
420
|
+
_out << nl << "class " << name << '(';
|
421
|
+
if(bases.empty())
|
422
|
+
{
|
423
|
+
if(p->isLocal())
|
424
|
+
{
|
425
|
+
_out << "object";
|
426
|
+
}
|
427
|
+
else
|
428
|
+
{
|
429
|
+
_out << "Ice.Object";
|
430
|
+
}
|
431
|
+
}
|
432
|
+
else
|
433
|
+
{
|
434
|
+
for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
|
435
|
+
{
|
436
|
+
if(q != bases.begin())
|
437
|
+
{
|
438
|
+
_out << ", ";
|
439
|
+
}
|
440
|
+
_out << getSymbol(*q);
|
441
|
+
}
|
442
|
+
if(!bases.front()->isInterface())
|
443
|
+
{
|
444
|
+
base = bases.front();
|
445
|
+
}
|
446
|
+
}
|
447
|
+
_out << "):";
|
448
|
+
|
449
|
+
_out.inc();
|
450
|
+
|
451
|
+
string comment = p->comment();
|
452
|
+
if(!comment.empty())
|
453
|
+
{
|
454
|
+
_out << nl << "'''" << editComment(comment) << "'''";
|
455
|
+
}
|
456
|
+
|
457
|
+
//
|
458
|
+
// __init__
|
459
|
+
//
|
460
|
+
_out << nl << "def __init__(self";
|
461
|
+
MemberInfoList allMembers;
|
462
|
+
collectClassMembers(p, allMembers, false);
|
463
|
+
writeConstructorParams(allMembers);
|
464
|
+
_out << "):";
|
465
|
+
_out.inc();
|
466
|
+
if(!base && !p->hasDataMembers() && !isAbstract)
|
467
|
+
{
|
468
|
+
_out << nl << "pass";
|
469
|
+
}
|
470
|
+
else
|
471
|
+
{
|
472
|
+
if(isAbstract)
|
473
|
+
{
|
474
|
+
_out << nl << "if Ice.getType(self) == _M_" << abs << ':';
|
475
|
+
_out.inc();
|
476
|
+
_out << nl << "raise RuntimeError('" << abs << " is an abstract class')";
|
477
|
+
_out.dec();
|
478
|
+
}
|
479
|
+
if(base)
|
480
|
+
{
|
481
|
+
_out << nl << getSymbol(base) << ".__init__(self";
|
482
|
+
for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
|
483
|
+
{
|
484
|
+
if(q->inherited)
|
485
|
+
{
|
486
|
+
_out << ", " << q->fixedName;
|
487
|
+
}
|
488
|
+
}
|
489
|
+
_out << ')';
|
490
|
+
}
|
491
|
+
for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
|
492
|
+
{
|
493
|
+
if(!q->inherited)
|
494
|
+
{
|
495
|
+
writeAssign(*q);
|
496
|
+
}
|
497
|
+
}
|
498
|
+
}
|
499
|
+
_out.dec();
|
500
|
+
|
501
|
+
if(!p->isLocal())
|
502
|
+
{
|
503
|
+
//
|
504
|
+
// ice_ids
|
505
|
+
//
|
506
|
+
ClassList allBases = p->allBases();
|
507
|
+
StringList ids;
|
508
|
+
#if defined(__IBMCPP__) && defined(NDEBUG)
|
509
|
+
//
|
510
|
+
// VisualAge C++ 6.0 does not see that ClassDef is a Contained,
|
511
|
+
// when inlining is on. The code below issues a warning: better
|
512
|
+
// than an error!
|
513
|
+
//
|
514
|
+
transform(allBases.begin(), allBases.end(), back_inserter(ids),
|
515
|
+
IceUtil::constMemFun<string,ClassDef>(&Contained::scoped));
|
516
|
+
#else
|
517
|
+
transform(allBases.begin(), allBases.end(), back_inserter(ids), IceUtil::constMemFun(&Contained::scoped));
|
518
|
+
#endif
|
519
|
+
StringList other;
|
520
|
+
other.push_back(scoped);
|
521
|
+
other.push_back("::Ice::Object");
|
522
|
+
other.sort();
|
523
|
+
ids.merge(other);
|
524
|
+
ids.unique();
|
525
|
+
_out << sp << nl << "def ice_ids(self, current=None):";
|
526
|
+
_out.inc();
|
527
|
+
_out << nl << "return (";
|
528
|
+
for(StringList::iterator q = ids.begin(); q != ids.end(); ++q)
|
529
|
+
{
|
530
|
+
if(q != ids.begin())
|
531
|
+
{
|
532
|
+
_out << ", ";
|
533
|
+
}
|
534
|
+
_out << "'" << *q << "'";
|
535
|
+
}
|
536
|
+
_out << ')';
|
537
|
+
_out.dec();
|
538
|
+
|
539
|
+
//
|
540
|
+
// ice_id
|
541
|
+
//
|
542
|
+
_out << sp << nl << "def ice_id(self, current=None):";
|
543
|
+
_out.inc();
|
544
|
+
_out << nl << "return '" << scoped << "'";
|
545
|
+
_out.dec();
|
546
|
+
|
547
|
+
//
|
548
|
+
// ice_staticId
|
549
|
+
//
|
550
|
+
_out << sp << nl << "def ice_staticId():";
|
551
|
+
_out.inc();
|
552
|
+
_out << nl << "return '" << scoped << "'";
|
553
|
+
_out.dec();
|
554
|
+
_out << nl << "ice_staticId = staticmethod(ice_staticId)";
|
555
|
+
}
|
556
|
+
|
557
|
+
if(!ops.empty())
|
558
|
+
{
|
559
|
+
//
|
560
|
+
// Emit a placeholder for each operation.
|
561
|
+
//
|
562
|
+
for(OperationList::iterator oli = ops.begin(); oli != ops.end(); ++oli)
|
563
|
+
{
|
564
|
+
string fixedOpName = fixIdent((*oli)->name());
|
565
|
+
if(!p->isLocal() && (p->hasMetaData("amd") || (*oli)->hasMetaData("amd")))
|
566
|
+
{
|
567
|
+
_out << sp << nl << "def " << (*oli)->name() << "_async(self, _cb";
|
568
|
+
|
569
|
+
ParamDeclList params = (*oli)->parameters();
|
570
|
+
|
571
|
+
for(ParamDeclList::iterator pli = params.begin(); pli != params.end(); ++pli)
|
572
|
+
{
|
573
|
+
if(!(*pli)->isOutParam())
|
574
|
+
{
|
575
|
+
_out << ", " << fixIdent((*pli)->name());
|
576
|
+
}
|
577
|
+
}
|
578
|
+
if(!p->isLocal())
|
579
|
+
{
|
580
|
+
_out << ", current=None";
|
581
|
+
}
|
582
|
+
_out << "):";
|
583
|
+
_out.inc();
|
584
|
+
comment = (*oli)->comment();
|
585
|
+
if(!comment.empty())
|
586
|
+
{
|
587
|
+
_out << nl << "'''" << editComment(comment) << "'''";
|
588
|
+
}
|
589
|
+
_out << nl << "pass";
|
590
|
+
_out.dec();
|
591
|
+
}
|
592
|
+
else
|
593
|
+
{
|
594
|
+
_out << sp << nl << "def " << fixedOpName << "(self";
|
595
|
+
|
596
|
+
ParamDeclList params = (*oli)->parameters();
|
597
|
+
|
598
|
+
for(ParamDeclList::iterator pli = params.begin(); pli != params.end(); ++pli)
|
599
|
+
{
|
600
|
+
if(!(*pli)->isOutParam())
|
601
|
+
{
|
602
|
+
_out << ", " << fixIdent((*pli)->name());
|
603
|
+
}
|
604
|
+
}
|
605
|
+
if(!p->isLocal())
|
606
|
+
{
|
607
|
+
_out << ", current=None";
|
608
|
+
}
|
609
|
+
_out << "):";
|
610
|
+
_out.inc();
|
611
|
+
comment = (*oli)->comment();
|
612
|
+
if(!comment.empty())
|
613
|
+
{
|
614
|
+
_out << nl << "'''" << editComment(comment) << "'''";
|
615
|
+
}
|
616
|
+
_out << nl << "pass";
|
617
|
+
_out.dec();
|
618
|
+
}
|
619
|
+
}
|
620
|
+
}
|
621
|
+
|
622
|
+
//
|
623
|
+
// __str__
|
624
|
+
//
|
625
|
+
_out << sp << nl << "def __str__(self):";
|
626
|
+
_out.inc();
|
627
|
+
_out << nl << "return IcePy.stringify(self, _M_" << getAbsolute(p, "_t_") << ")";
|
628
|
+
_out.dec();
|
629
|
+
_out << sp << nl << "__repr__ = __str__";
|
630
|
+
|
631
|
+
_out.dec();
|
632
|
+
|
633
|
+
//
|
634
|
+
// Define the proxy class.
|
635
|
+
//
|
636
|
+
if(!p->isLocal())
|
637
|
+
{
|
638
|
+
_out << sp << nl << "_M_" << prxAbs << " = Ice.createTempClass()";
|
639
|
+
_out << nl << "class " << prxName << "(";
|
640
|
+
if(bases.empty())
|
641
|
+
{
|
642
|
+
_out << "Ice.ObjectPrx";
|
643
|
+
}
|
644
|
+
else
|
645
|
+
{
|
646
|
+
ClassList::const_iterator q = bases.begin();
|
647
|
+
while(q != bases.end())
|
648
|
+
{
|
649
|
+
_out << getSymbol(*q, "Prx");
|
650
|
+
if(++q != bases.end())
|
651
|
+
{
|
652
|
+
_out << ", ";
|
653
|
+
}
|
654
|
+
}
|
655
|
+
}
|
656
|
+
_out << "):";
|
657
|
+
_out.inc();
|
658
|
+
|
659
|
+
for(OperationList::iterator oli = ops.begin(); oli != ops.end(); ++oli)
|
660
|
+
{
|
661
|
+
string fixedOpName = fixIdent((*oli)->name());
|
662
|
+
if(fixedOpName == "checkedCast" || fixedOpName == "uncheckedCast")
|
663
|
+
{
|
664
|
+
fixedOpName.insert(0, "_");
|
665
|
+
}
|
666
|
+
TypePtr ret = (*oli)->returnType();
|
667
|
+
ParamDeclList paramList = (*oli)->parameters();
|
668
|
+
string inParams;
|
669
|
+
|
670
|
+
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
|
671
|
+
{
|
672
|
+
if(!(*q)->isOutParam())
|
673
|
+
{
|
674
|
+
if(!inParams.empty())
|
675
|
+
{
|
676
|
+
inParams.append(", ");
|
677
|
+
}
|
678
|
+
inParams.append(fixIdent((*q)->name()));
|
679
|
+
}
|
680
|
+
}
|
681
|
+
|
682
|
+
comment = (*oli)->comment();
|
683
|
+
if(!comment.empty())
|
684
|
+
{
|
685
|
+
comment = "'''" + editComment(comment) + "'''";
|
686
|
+
}
|
687
|
+
|
688
|
+
_out << sp;
|
689
|
+
if(!comment.empty())
|
690
|
+
{
|
691
|
+
_out << nl << comment;
|
692
|
+
}
|
693
|
+
_out << nl << "def " << fixedOpName << "(self";
|
694
|
+
if(!inParams.empty())
|
695
|
+
{
|
696
|
+
_out << ", " << inParams;
|
697
|
+
}
|
698
|
+
_out << ", _ctx=None):";
|
699
|
+
_out.inc();
|
700
|
+
_out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".invoke(self, ((" << inParams;
|
701
|
+
if(!inParams.empty() && inParams.find(',') == string::npos)
|
702
|
+
{
|
703
|
+
_out << ", ";
|
704
|
+
}
|
705
|
+
_out << "), _ctx))";
|
706
|
+
_out.dec();
|
707
|
+
|
708
|
+
//
|
709
|
+
// Async operations.
|
710
|
+
//
|
711
|
+
_out << sp;
|
712
|
+
if(!comment.empty())
|
713
|
+
{
|
714
|
+
_out << nl << comment;
|
715
|
+
}
|
716
|
+
_out << nl << "def begin_" << (*oli)->name() << "(self";
|
717
|
+
if(!inParams.empty())
|
718
|
+
{
|
719
|
+
_out << ", " << inParams;
|
720
|
+
}
|
721
|
+
_out << ", _response=None, _ex=None, _sent=None, _ctx=None):";
|
722
|
+
_out.inc();
|
723
|
+
_out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".begin(self, ((" << inParams;
|
724
|
+
if(!inParams.empty() && inParams.find(',') == string::npos)
|
725
|
+
{
|
726
|
+
_out << ", ";
|
727
|
+
}
|
728
|
+
_out << "), _response, _ex, _sent, _ctx))";
|
729
|
+
_out.dec();
|
730
|
+
|
731
|
+
_out << sp;
|
732
|
+
if(!comment.empty())
|
733
|
+
{
|
734
|
+
_out << nl << comment;
|
735
|
+
}
|
736
|
+
_out << nl << "def end_" << (*oli)->name() << "(self, _r):";
|
737
|
+
_out.inc();
|
738
|
+
_out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".end(self, _r)";
|
739
|
+
_out.dec();
|
740
|
+
}
|
741
|
+
|
742
|
+
_out << sp << nl << "def checkedCast(proxy, facetOrCtx=None, _ctx=None):";
|
743
|
+
_out.inc();
|
744
|
+
_out << nl << "return _M_" << prxAbs << ".ice_checkedCast(proxy, '" << scoped << "', facetOrCtx, _ctx)";
|
745
|
+
_out.dec();
|
746
|
+
_out << nl << "checkedCast = staticmethod(checkedCast)";
|
747
|
+
|
748
|
+
_out << sp << nl << "def uncheckedCast(proxy, facet=None):";
|
749
|
+
_out.inc();
|
750
|
+
_out << nl << "return _M_" << prxAbs << ".ice_uncheckedCast(proxy, facet)";
|
751
|
+
_out.dec();
|
752
|
+
_out << nl << "uncheckedCast = staticmethod(uncheckedCast)";
|
753
|
+
|
754
|
+
|
755
|
+
//
|
756
|
+
// ice_staticId
|
757
|
+
//
|
758
|
+
_out << sp << nl << "def ice_staticId():";
|
759
|
+
_out.inc();
|
760
|
+
_out << nl << "return '" << scoped << "'";
|
761
|
+
_out.dec();
|
762
|
+
_out << nl << "ice_staticId = staticmethod(ice_staticId)";
|
763
|
+
|
764
|
+
_out.dec();
|
765
|
+
|
766
|
+
_out << sp << nl << "_M_" << prxType << " = IcePy.defineProxy('" << scoped << "', " << prxName << ")";
|
767
|
+
}
|
768
|
+
|
769
|
+
if(_classHistory.count(scoped) == 0 && p->canBeCyclic())
|
770
|
+
{
|
771
|
+
//
|
772
|
+
// Emit a forward declaration for the class in case a data member refers to this type.
|
773
|
+
//
|
774
|
+
_out << sp << nl << "_M_" << type << " = IcePy.declareClass('" << scoped << "')";
|
775
|
+
}
|
776
|
+
|
777
|
+
DataMemberList members = p->dataMembers();
|
778
|
+
_out << sp << nl << "_M_" << type << " = IcePy.defineClass('" << scoped << "', " << name << ", " << p->compactId()
|
779
|
+
<< ", ";
|
780
|
+
writeMetaData(p->getMetaData());
|
781
|
+
const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice");
|
782
|
+
_out << ", " << (isAbstract ? "True" : "False") << ", " << (preserved ? "True" : "False") << ", ";
|
783
|
+
if(!base)
|
784
|
+
{
|
785
|
+
_out << "None";
|
786
|
+
}
|
787
|
+
else
|
788
|
+
{
|
789
|
+
_out << "_M_" << getAbsolute(base, "_t_");
|
790
|
+
}
|
791
|
+
_out << ", (";
|
792
|
+
//
|
793
|
+
// Interfaces
|
794
|
+
//
|
795
|
+
int interfaceCount = 0;
|
796
|
+
for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
|
797
|
+
{
|
798
|
+
if((*q)->isInterface())
|
799
|
+
{
|
800
|
+
if(interfaceCount > 0)
|
801
|
+
{
|
802
|
+
_out << ", ";
|
803
|
+
}
|
804
|
+
_out << "_M_" << getAbsolute(*q, "_t_");
|
805
|
+
++interfaceCount;
|
806
|
+
}
|
807
|
+
}
|
808
|
+
if(interfaceCount == 1)
|
809
|
+
{
|
810
|
+
_out << ',';
|
811
|
+
}
|
812
|
+
//
|
813
|
+
// Members
|
814
|
+
//
|
815
|
+
// Data members are represented as a tuple:
|
816
|
+
//
|
817
|
+
// ('MemberName', MemberMetaData, MemberType, Optional, Tag)
|
818
|
+
//
|
819
|
+
// where MemberType is either a primitive type constant (T_INT, etc.) or the id of a constructed type.
|
820
|
+
//
|
821
|
+
_out << "), (";
|
822
|
+
if(members.size() > 1)
|
823
|
+
{
|
824
|
+
_out.inc();
|
825
|
+
_out << nl;
|
826
|
+
}
|
827
|
+
bool isProtected = p->hasMetaData("protected");
|
828
|
+
for(DataMemberList::iterator r = members.begin(); r != members.end(); ++r)
|
829
|
+
{
|
830
|
+
if(r != members.begin())
|
831
|
+
{
|
832
|
+
_out << ',' << nl;
|
833
|
+
}
|
834
|
+
_out << "('";
|
835
|
+
if(isProtected || (*r)->hasMetaData("protected"))
|
836
|
+
{
|
837
|
+
_out << '_';
|
838
|
+
}
|
839
|
+
_out << fixIdent((*r)->name()) << "', ";
|
840
|
+
writeMetaData((*r)->getMetaData());
|
841
|
+
_out << ", ";
|
842
|
+
writeType((*r)->type());
|
843
|
+
_out << ", " << ((*r)->optional() ? "True" : "False") << ", "
|
844
|
+
<< ((*r)->optional() ? (*r)->tag() : 0) << ')';
|
845
|
+
}
|
846
|
+
if(members.size() == 1)
|
847
|
+
{
|
848
|
+
_out << ',';
|
849
|
+
}
|
850
|
+
else if(members.size() > 1)
|
851
|
+
{
|
852
|
+
_out.dec();
|
853
|
+
_out << nl;
|
854
|
+
}
|
855
|
+
_out << "))";
|
856
|
+
_out << nl << name << "._ice_type = _M_" << type;
|
857
|
+
|
858
|
+
//
|
859
|
+
// Define each operation. The arguments to the IcePy.Operation constructor are:
|
860
|
+
//
|
861
|
+
// 'opName', Mode, SendMode, AMD, Format, MetaData, (InParams), (OutParams), ReturnParam, (Exceptions)
|
862
|
+
//
|
863
|
+
// where InParams and OutParams are tuples of type descriptions, and Exceptions
|
864
|
+
// is a tuple of exception type ids.
|
865
|
+
//
|
866
|
+
if(!p->isLocal())
|
867
|
+
{
|
868
|
+
if(!ops.empty())
|
869
|
+
{
|
870
|
+
_out << sp;
|
871
|
+
}
|
872
|
+
for(OperationList::iterator s = ops.begin(); s != ops.end(); ++s)
|
873
|
+
{
|
874
|
+
ParamDeclList params = (*s)->parameters();
|
875
|
+
ParamDeclList::iterator t;
|
876
|
+
int count;
|
877
|
+
string format;
|
878
|
+
switch((*s)->format())
|
879
|
+
{
|
880
|
+
case DefaultFormat:
|
881
|
+
format = "None";
|
882
|
+
break;
|
883
|
+
case CompactFormat:
|
884
|
+
format = "Ice.FormatType.CompactFormat";
|
885
|
+
break;
|
886
|
+
case SlicedFormat:
|
887
|
+
format = "Ice.FormatType.SlicedFormat";
|
888
|
+
break;
|
889
|
+
}
|
890
|
+
|
891
|
+
_out << nl << name << "._op_" << (*s)->name() << " = IcePy.Operation('" << (*s)->name() << "', "
|
892
|
+
<< getOperationMode((*s)->mode()) << ", " << getOperationMode((*s)->sendMode()) << ", "
|
893
|
+
<< ((p->hasMetaData("amd") || (*s)->hasMetaData("amd")) ? "True" : "False") << ", "
|
894
|
+
<< format << ", ";
|
895
|
+
writeMetaData((*s)->getMetaData());
|
896
|
+
_out << ", (";
|
897
|
+
for(t = params.begin(), count = 0; t != params.end(); ++t)
|
898
|
+
{
|
899
|
+
if(!(*t)->isOutParam())
|
900
|
+
{
|
901
|
+
if(count > 0)
|
902
|
+
{
|
903
|
+
_out << ", ";
|
904
|
+
}
|
905
|
+
_out << '(';
|
906
|
+
writeMetaData((*t)->getMetaData());
|
907
|
+
_out << ", ";
|
908
|
+
writeType((*t)->type());
|
909
|
+
_out << ", " << ((*t)->optional() ? "True" : "False") << ", "
|
910
|
+
<< ((*t)->optional() ? (*t)->tag() : 0) << ')';
|
911
|
+
++count;
|
912
|
+
}
|
913
|
+
}
|
914
|
+
if(count == 1)
|
915
|
+
{
|
916
|
+
_out << ',';
|
917
|
+
}
|
918
|
+
_out << "), (";
|
919
|
+
for(t = params.begin(), count = 0; t != params.end(); ++t)
|
920
|
+
{
|
921
|
+
if((*t)->isOutParam())
|
922
|
+
{
|
923
|
+
if(count > 0)
|
924
|
+
{
|
925
|
+
_out << ", ";
|
926
|
+
}
|
927
|
+
_out << '(';
|
928
|
+
writeMetaData((*t)->getMetaData());
|
929
|
+
_out << ", ";
|
930
|
+
writeType((*t)->type());
|
931
|
+
_out << ", " << ((*t)->optional() ? "True" : "False") << ", "
|
932
|
+
<< ((*t)->optional() ? (*t)->tag() : 0) << ')';
|
933
|
+
++count;
|
934
|
+
}
|
935
|
+
}
|
936
|
+
if(count == 1)
|
937
|
+
{
|
938
|
+
_out << ',';
|
939
|
+
}
|
940
|
+
_out << "), ";
|
941
|
+
TypePtr returnType = (*s)->returnType();
|
942
|
+
if(returnType)
|
943
|
+
{
|
944
|
+
//
|
945
|
+
// The return type has the same format as an in/out parameter:
|
946
|
+
//
|
947
|
+
// MetaData, Type, Optional?, OptionalTag
|
948
|
+
//
|
949
|
+
_out << "((), ";
|
950
|
+
writeType(returnType);
|
951
|
+
_out << ", " << ((*s)->returnIsOptional() ? "True" : "False") << ", "
|
952
|
+
<< ((*s)->returnIsOptional() ? (*s)->returnTag() : 0) << ')';
|
953
|
+
}
|
954
|
+
else
|
955
|
+
{
|
956
|
+
_out << "None";
|
957
|
+
}
|
958
|
+
_out << ", (";
|
959
|
+
ExceptionList exceptions = (*s)->throws();
|
960
|
+
for(ExceptionList::iterator u = exceptions.begin(); u != exceptions.end(); ++u)
|
961
|
+
{
|
962
|
+
if(u != exceptions.begin())
|
963
|
+
{
|
964
|
+
_out << ", ";
|
965
|
+
}
|
966
|
+
_out << "_M_" << getAbsolute(*u, "_t_");
|
967
|
+
}
|
968
|
+
if(exceptions.size() == 1)
|
969
|
+
{
|
970
|
+
_out << ',';
|
971
|
+
}
|
972
|
+
_out << "))";
|
973
|
+
|
974
|
+
string deprecateMetadata;
|
975
|
+
if((*s)->findMetaData("deprecate", deprecateMetadata) || p->findMetaData("deprecate", deprecateMetadata))
|
976
|
+
{
|
977
|
+
string msg;
|
978
|
+
string::size_type pos = deprecateMetadata.find(':');
|
979
|
+
if(pos != string::npos && pos < deprecateMetadata.size() - 1)
|
980
|
+
{
|
981
|
+
msg = deprecateMetadata.substr(pos + 1);
|
982
|
+
}
|
983
|
+
_out << nl << name << "._op_" << (*s)->name() << ".deprecate(\"" << msg << "\")";
|
984
|
+
}
|
985
|
+
}
|
986
|
+
}
|
987
|
+
|
988
|
+
registerName(name);
|
989
|
+
|
990
|
+
if(!p->isLocal())
|
991
|
+
{
|
992
|
+
registerName(prxName);
|
993
|
+
}
|
994
|
+
|
995
|
+
_out.dec();
|
996
|
+
|
997
|
+
if(_classHistory.count(scoped) == 0)
|
998
|
+
{
|
999
|
+
_classHistory.insert(scoped); // Avoid redundant declarations.
|
1000
|
+
}
|
1001
|
+
|
1002
|
+
return false;
|
1003
|
+
}
|
1004
|
+
|
1005
|
+
bool
|
1006
|
+
Slice::Python::CodeVisitor::visitExceptionStart(const ExceptionPtr& p)
|
1007
|
+
{
|
1008
|
+
string scoped = p->scoped();
|
1009
|
+
string abs = getAbsolute(p);
|
1010
|
+
string name = fixIdent(p->name());
|
1011
|
+
|
1012
|
+
_out << sp << nl << "if " << getDictLookup(p) << ':';
|
1013
|
+
_out.inc();
|
1014
|
+
_out << nl << "_M_" << abs << " = Ice.createTempClass()";
|
1015
|
+
_out << nl << "class " << name << '(';
|
1016
|
+
ExceptionPtr base = p->base();
|
1017
|
+
string baseName;
|
1018
|
+
if(base)
|
1019
|
+
{
|
1020
|
+
baseName = getSymbol(base);
|
1021
|
+
_out << baseName;
|
1022
|
+
}
|
1023
|
+
else if(p->isLocal())
|
1024
|
+
{
|
1025
|
+
_out << "Ice.LocalException";
|
1026
|
+
}
|
1027
|
+
else
|
1028
|
+
{
|
1029
|
+
_out << "Ice.UserException";
|
1030
|
+
}
|
1031
|
+
_out << "):";
|
1032
|
+
_out.inc();
|
1033
|
+
|
1034
|
+
string comment = p->comment();
|
1035
|
+
if(!comment.empty())
|
1036
|
+
{
|
1037
|
+
_out << nl << "'''" << editComment(comment) << "'''";
|
1038
|
+
}
|
1039
|
+
|
1040
|
+
DataMemberList members = p->dataMembers();
|
1041
|
+
|
1042
|
+
//
|
1043
|
+
// __init__
|
1044
|
+
//
|
1045
|
+
_out << nl << "def __init__(self";
|
1046
|
+
MemberInfoList allMembers;
|
1047
|
+
collectExceptionMembers(p, allMembers, false);
|
1048
|
+
writeConstructorParams(allMembers);
|
1049
|
+
_out << "):";
|
1050
|
+
_out.inc();
|
1051
|
+
if(!base && members.empty())
|
1052
|
+
{
|
1053
|
+
_out << nl << "pass";
|
1054
|
+
}
|
1055
|
+
else
|
1056
|
+
{
|
1057
|
+
if(base)
|
1058
|
+
{
|
1059
|
+
_out << nl << baseName << ".__init__(self";
|
1060
|
+
for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
|
1061
|
+
{
|
1062
|
+
if(q->inherited)
|
1063
|
+
{
|
1064
|
+
_out << ", " << q->fixedName;
|
1065
|
+
}
|
1066
|
+
}
|
1067
|
+
_out << ')';
|
1068
|
+
}
|
1069
|
+
for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
|
1070
|
+
{
|
1071
|
+
if(!q->inherited)
|
1072
|
+
{
|
1073
|
+
writeAssign(*q);
|
1074
|
+
}
|
1075
|
+
}
|
1076
|
+
}
|
1077
|
+
_out.dec();
|
1078
|
+
|
1079
|
+
//
|
1080
|
+
// __str__
|
1081
|
+
//
|
1082
|
+
_out << sp << nl << "def __str__(self):";
|
1083
|
+
_out.inc();
|
1084
|
+
_out << nl << "return IcePy.stringifyException(self)";
|
1085
|
+
_out.dec();
|
1086
|
+
_out << sp << nl << "__repr__ = __str__";
|
1087
|
+
|
1088
|
+
//
|
1089
|
+
// _ice_name
|
1090
|
+
//
|
1091
|
+
_out << sp << nl << "_ice_name = '" << scoped.substr(2) << "'";
|
1092
|
+
|
1093
|
+
_out.dec();
|
1094
|
+
|
1095
|
+
//
|
1096
|
+
// Emit the type information.
|
1097
|
+
//
|
1098
|
+
string type = getAbsolute(p, "_t_");
|
1099
|
+
_out << sp << nl << "_M_" << type << " = IcePy.defineException('" << scoped << "', " << name << ", ";
|
1100
|
+
writeMetaData(p->getMetaData());
|
1101
|
+
const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice");
|
1102
|
+
_out << ", " << (preserved ? "True" : "False") << ", ";
|
1103
|
+
if(!base)
|
1104
|
+
{
|
1105
|
+
_out << "None";
|
1106
|
+
}
|
1107
|
+
else
|
1108
|
+
{
|
1109
|
+
_out << "_M_" << getAbsolute(base, "_t_");
|
1110
|
+
}
|
1111
|
+
_out << ", (";
|
1112
|
+
if(members.size() > 1)
|
1113
|
+
{
|
1114
|
+
_out.inc();
|
1115
|
+
_out << nl;
|
1116
|
+
}
|
1117
|
+
//
|
1118
|
+
// Data members are represented as a tuple:
|
1119
|
+
//
|
1120
|
+
// ('MemberName', MemberMetaData, MemberType, Optional, Tag)
|
1121
|
+
//
|
1122
|
+
// where MemberType is either a primitive type constant (T_INT, etc.) or the id of a constructed type.
|
1123
|
+
//
|
1124
|
+
for(DataMemberList::iterator dmli = members.begin(); dmli != members.end(); ++dmli)
|
1125
|
+
{
|
1126
|
+
if(dmli != members.begin())
|
1127
|
+
{
|
1128
|
+
_out << ',' << nl;
|
1129
|
+
}
|
1130
|
+
_out << "('" << fixIdent((*dmli)->name()) << "', ";
|
1131
|
+
writeMetaData((*dmli)->getMetaData());
|
1132
|
+
_out << ", ";
|
1133
|
+
writeType((*dmli)->type());
|
1134
|
+
_out << ", " << ((*dmli)->optional() ? "True" : "False") << ", "
|
1135
|
+
<< ((*dmli)->optional() ? (*dmli)->tag() : 0) << ')';
|
1136
|
+
}
|
1137
|
+
if(members.size() == 1)
|
1138
|
+
{
|
1139
|
+
_out << ',';
|
1140
|
+
}
|
1141
|
+
else if(members.size() > 1)
|
1142
|
+
{
|
1143
|
+
_out.dec();
|
1144
|
+
_out << nl;
|
1145
|
+
}
|
1146
|
+
_out << "))";
|
1147
|
+
_out << nl << name << "._ice_type = _M_" << type;
|
1148
|
+
|
1149
|
+
registerName(name);
|
1150
|
+
|
1151
|
+
_out.dec();
|
1152
|
+
|
1153
|
+
return false;
|
1154
|
+
}
|
1155
|
+
|
1156
|
+
bool
|
1157
|
+
Slice::Python::CodeVisitor::visitStructStart(const StructPtr& p)
|
1158
|
+
{
|
1159
|
+
string scoped = p->scoped();
|
1160
|
+
string abs = getAbsolute(p);
|
1161
|
+
string name = fixIdent(p->name());
|
1162
|
+
MemberInfoList memberList;
|
1163
|
+
|
1164
|
+
{
|
1165
|
+
DataMemberList members = p->dataMembers();
|
1166
|
+
for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
|
1167
|
+
{
|
1168
|
+
memberList.push_back(MemberInfo());
|
1169
|
+
memberList.back().fixedName = fixIdent((*q)->name());
|
1170
|
+
memberList.back().inherited = false;
|
1171
|
+
memberList.back().dataMember = *q;
|
1172
|
+
}
|
1173
|
+
}
|
1174
|
+
|
1175
|
+
_out << sp << nl << "if " << getDictLookup(p) << ':';
|
1176
|
+
_out.inc();
|
1177
|
+
_out << nl << "_M_" << abs << " = Ice.createTempClass()";
|
1178
|
+
_out << nl << "class " << name << "(object):";
|
1179
|
+
_out.inc();
|
1180
|
+
|
1181
|
+
string comment = p->comment();
|
1182
|
+
if(!comment.empty())
|
1183
|
+
{
|
1184
|
+
_out << nl << "'''" << editComment(comment) << "'''";
|
1185
|
+
}
|
1186
|
+
|
1187
|
+
_out << nl << "def __init__(self";
|
1188
|
+
writeConstructorParams(memberList);
|
1189
|
+
_out << "):";
|
1190
|
+
_out.inc();
|
1191
|
+
for(MemberInfoList::iterator r = memberList.begin(); r != memberList.end(); ++r)
|
1192
|
+
{
|
1193
|
+
writeAssign(*r);
|
1194
|
+
}
|
1195
|
+
_out.dec();
|
1196
|
+
|
1197
|
+
//
|
1198
|
+
// Only generate __hash__ and the comparison operators if this structure type
|
1199
|
+
// is a legal dictionary key type.
|
1200
|
+
//
|
1201
|
+
bool containsSequence = false;
|
1202
|
+
if(Dictionary::legalKeyType(p, containsSequence))
|
1203
|
+
{
|
1204
|
+
_out << sp << nl << "def __hash__(self):";
|
1205
|
+
_out.inc();
|
1206
|
+
_out << nl << "_h = 0";
|
1207
|
+
int iter = 0;
|
1208
|
+
for(MemberInfoList::iterator r = memberList.begin(); r != memberList.end(); ++r)
|
1209
|
+
{
|
1210
|
+
string s = "self." + r->fixedName;
|
1211
|
+
writeHash(s, r->dataMember->type(), iter);
|
1212
|
+
}
|
1213
|
+
_out << nl << "return _h % 0x7fffffff";
|
1214
|
+
_out.dec();
|
1215
|
+
|
1216
|
+
//
|
1217
|
+
// Rich operators. __lt__, __le__, __eq__, __ne__, __gt__, __ge__
|
1218
|
+
//
|
1219
|
+
|
1220
|
+
_out << sp << nl << "def __compare(self, other):";
|
1221
|
+
_out.inc();
|
1222
|
+
_out << nl << "if other is None:";
|
1223
|
+
_out.inc();
|
1224
|
+
_out << nl << "return 1";
|
1225
|
+
_out.dec();
|
1226
|
+
_out << nl << "elif not isinstance(other, _M_" << abs << "):";
|
1227
|
+
_out.inc();
|
1228
|
+
_out << nl << "return NotImplemented";
|
1229
|
+
_out.dec();
|
1230
|
+
_out << nl << "else:";
|
1231
|
+
_out.inc();
|
1232
|
+
for(MemberInfoList::iterator r = memberList.begin(); r != memberList.end(); ++r)
|
1233
|
+
{
|
1234
|
+
//
|
1235
|
+
// The None value is not orderable in Python 3.
|
1236
|
+
//
|
1237
|
+
_out << nl << "if self." << r->fixedName << " is None or other." << r->fixedName << " is None:";
|
1238
|
+
_out.inc();
|
1239
|
+
_out << nl << "if self." << r->fixedName << " != other." << r->fixedName << ':';
|
1240
|
+
_out.inc();
|
1241
|
+
_out << nl << "return (-1 if self." << r->fixedName << " is None else 1)";
|
1242
|
+
_out.dec();
|
1243
|
+
_out.dec();
|
1244
|
+
_out << nl << "else:";
|
1245
|
+
_out.inc();
|
1246
|
+
_out << nl << "if self." << r->fixedName << " < other." << r->fixedName << ':';
|
1247
|
+
_out.inc();
|
1248
|
+
_out << nl << "return -1";
|
1249
|
+
_out.dec();
|
1250
|
+
_out << nl << "elif self." << r->fixedName << " > other." << r->fixedName << ':';
|
1251
|
+
_out.inc();
|
1252
|
+
_out << nl << "return 1";
|
1253
|
+
_out.dec();
|
1254
|
+
_out.dec();
|
1255
|
+
}
|
1256
|
+
_out << nl << "return 0";
|
1257
|
+
_out.dec();
|
1258
|
+
_out.dec();
|
1259
|
+
|
1260
|
+
_out << sp << nl << "def __lt__(self, other):";
|
1261
|
+
_out.inc();
|
1262
|
+
_out << nl << "r = self.__compare(other)";
|
1263
|
+
_out << nl << "if r is NotImplemented:";
|
1264
|
+
_out.inc();
|
1265
|
+
_out << nl << "return r";
|
1266
|
+
_out.dec();
|
1267
|
+
_out << nl << "else:";
|
1268
|
+
_out.inc();
|
1269
|
+
_out << nl << "return r < 0";
|
1270
|
+
_out.dec();
|
1271
|
+
_out.dec();
|
1272
|
+
|
1273
|
+
_out << sp << nl << "def __le__(self, other):";
|
1274
|
+
_out.inc();
|
1275
|
+
_out << nl << "r = self.__compare(other)";
|
1276
|
+
_out << nl << "if r is NotImplemented:";
|
1277
|
+
_out.inc();
|
1278
|
+
_out << nl << "return r";
|
1279
|
+
_out.dec();
|
1280
|
+
_out << nl << "else:";
|
1281
|
+
_out.inc();
|
1282
|
+
_out << nl << "return r <= 0";
|
1283
|
+
_out.dec();
|
1284
|
+
_out.dec();
|
1285
|
+
|
1286
|
+
_out << sp << nl << "def __gt__(self, other):";
|
1287
|
+
_out.inc();
|
1288
|
+
_out << nl << "r = self.__compare(other)";
|
1289
|
+
_out << nl << "if r is NotImplemented:";
|
1290
|
+
_out.inc();
|
1291
|
+
_out << nl << "return r";
|
1292
|
+
_out.dec();
|
1293
|
+
_out << nl << "else:";
|
1294
|
+
_out.inc();
|
1295
|
+
_out << nl << "return r > 0";
|
1296
|
+
_out.dec();
|
1297
|
+
_out.dec();
|
1298
|
+
|
1299
|
+
_out << sp << nl << "def __ge__(self, other):";
|
1300
|
+
_out.inc();
|
1301
|
+
_out << nl << "r = self.__compare(other)";
|
1302
|
+
_out << nl << "if r is NotImplemented:";
|
1303
|
+
_out.inc();
|
1304
|
+
_out << nl << "return r";
|
1305
|
+
_out.dec();
|
1306
|
+
_out << nl << "else:";
|
1307
|
+
_out.inc();
|
1308
|
+
_out << nl << "return r >= 0";
|
1309
|
+
_out.dec();
|
1310
|
+
_out.dec();
|
1311
|
+
|
1312
|
+
_out << sp << nl << "def __eq__(self, other):";
|
1313
|
+
_out.inc();
|
1314
|
+
_out << nl << "r = self.__compare(other)";
|
1315
|
+
_out << nl << "if r is NotImplemented:";
|
1316
|
+
_out.inc();
|
1317
|
+
_out << nl << "return r";
|
1318
|
+
_out.dec();
|
1319
|
+
_out << nl << "else:";
|
1320
|
+
_out.inc();
|
1321
|
+
_out << nl << "return r == 0";
|
1322
|
+
_out.dec();
|
1323
|
+
_out.dec();
|
1324
|
+
|
1325
|
+
_out << sp << nl << "def __ne__(self, other):";
|
1326
|
+
_out.inc();
|
1327
|
+
_out << nl << "r = self.__compare(other)";
|
1328
|
+
_out << nl << "if r is NotImplemented:";
|
1329
|
+
_out.inc();
|
1330
|
+
_out << nl << "return r";
|
1331
|
+
_out.dec();
|
1332
|
+
_out << nl << "else:";
|
1333
|
+
_out.inc();
|
1334
|
+
_out << nl << "return r != 0";
|
1335
|
+
_out.dec();
|
1336
|
+
_out.dec();
|
1337
|
+
}
|
1338
|
+
else
|
1339
|
+
{
|
1340
|
+
//
|
1341
|
+
// Only generate the rich equality operators __eq__ and __ne__.
|
1342
|
+
//
|
1343
|
+
|
1344
|
+
_out << sp << nl << "def __eq__(self, other):";
|
1345
|
+
_out.inc();
|
1346
|
+
_out << nl << "if other is None:";
|
1347
|
+
_out.inc();
|
1348
|
+
_out << nl << "return False";
|
1349
|
+
_out.dec();
|
1350
|
+
_out << nl << "elif not isinstance(other, _M_" << abs << "):";
|
1351
|
+
_out.inc();
|
1352
|
+
_out << nl << "return NotImplemented";
|
1353
|
+
_out.dec();
|
1354
|
+
_out << nl << "else:";
|
1355
|
+
_out.inc();
|
1356
|
+
for(MemberInfoList::iterator r = memberList.begin(); r != memberList.end(); ++r)
|
1357
|
+
{
|
1358
|
+
//
|
1359
|
+
// The None value is not orderable in Python 3.
|
1360
|
+
//
|
1361
|
+
_out << nl << "if self." << r->fixedName << " != other." << r->fixedName << ':';
|
1362
|
+
_out.inc();
|
1363
|
+
_out << nl << "return False";
|
1364
|
+
_out.dec();
|
1365
|
+
}
|
1366
|
+
_out << nl << "return True";
|
1367
|
+
_out.dec();
|
1368
|
+
_out.dec();
|
1369
|
+
|
1370
|
+
_out << sp << nl << "def __ne__(self, other):";
|
1371
|
+
_out.inc();
|
1372
|
+
_out << nl << "return not self.__eq__(other)";
|
1373
|
+
_out.dec();
|
1374
|
+
}
|
1375
|
+
|
1376
|
+
//
|
1377
|
+
// __str__
|
1378
|
+
//
|
1379
|
+
_out << sp << nl << "def __str__(self):";
|
1380
|
+
_out.inc();
|
1381
|
+
_out << nl << "return IcePy.stringify(self, _M_" << getAbsolute(p, "_t_") << ")";
|
1382
|
+
_out.dec();
|
1383
|
+
_out << sp << nl << "__repr__ = __str__";
|
1384
|
+
|
1385
|
+
_out.dec();
|
1386
|
+
|
1387
|
+
//
|
1388
|
+
// Emit the type information.
|
1389
|
+
//
|
1390
|
+
_out << sp << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.defineStruct('" << scoped << "', " << name << ", ";
|
1391
|
+
writeMetaData(p->getMetaData());
|
1392
|
+
_out << ", (";
|
1393
|
+
//
|
1394
|
+
// Data members are represented as a tuple:
|
1395
|
+
//
|
1396
|
+
// ('MemberName', MemberMetaData, MemberType)
|
1397
|
+
//
|
1398
|
+
// where MemberType is either a primitive type constant (T_INT, etc.) or the id of a constructed type.
|
1399
|
+
//
|
1400
|
+
if(memberList.size() > 1)
|
1401
|
+
{
|
1402
|
+
_out.inc();
|
1403
|
+
_out << nl;
|
1404
|
+
}
|
1405
|
+
for(MemberInfoList::iterator r = memberList.begin(); r != memberList.end(); ++r)
|
1406
|
+
{
|
1407
|
+
if(r != memberList.begin())
|
1408
|
+
{
|
1409
|
+
_out << ',' << nl;
|
1410
|
+
}
|
1411
|
+
_out << "('" << r->fixedName << "', ";
|
1412
|
+
writeMetaData(r->dataMember->getMetaData());
|
1413
|
+
_out << ", ";
|
1414
|
+
writeType(r->dataMember->type());
|
1415
|
+
_out << ')';
|
1416
|
+
}
|
1417
|
+
if(memberList.size() == 1)
|
1418
|
+
{
|
1419
|
+
_out << ',';
|
1420
|
+
}
|
1421
|
+
else if(memberList.size() > 1)
|
1422
|
+
{
|
1423
|
+
_out.dec();
|
1424
|
+
_out << nl;
|
1425
|
+
}
|
1426
|
+
_out << "))";
|
1427
|
+
|
1428
|
+
registerName(name);
|
1429
|
+
|
1430
|
+
_out.dec();
|
1431
|
+
|
1432
|
+
return false;
|
1433
|
+
}
|
1434
|
+
|
1435
|
+
void
|
1436
|
+
Slice::Python::CodeVisitor::visitSequence(const SequencePtr& p)
|
1437
|
+
{
|
1438
|
+
static const string protobuf = "python:protobuf:";
|
1439
|
+
StringList metaData = p->getMetaData();
|
1440
|
+
bool isCustom = false;
|
1441
|
+
string customType;
|
1442
|
+
for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ++q)
|
1443
|
+
{
|
1444
|
+
if(q->find(protobuf) == 0)
|
1445
|
+
{
|
1446
|
+
BuiltinPtr builtin = BuiltinPtr::dynamicCast(p->type());
|
1447
|
+
if(!builtin || builtin->kind() != Builtin::KindByte)
|
1448
|
+
{
|
1449
|
+
continue;
|
1450
|
+
}
|
1451
|
+
isCustom = true;
|
1452
|
+
customType = q->substr(protobuf.size());
|
1453
|
+
break;
|
1454
|
+
}
|
1455
|
+
}
|
1456
|
+
|
1457
|
+
//
|
1458
|
+
// Emit the type information.
|
1459
|
+
//
|
1460
|
+
string scoped = p->scoped();
|
1461
|
+
_out << sp << nl << "if " << getDictLookup(p, "_t_") << ':';
|
1462
|
+
_out.inc();
|
1463
|
+
if(isCustom)
|
1464
|
+
{
|
1465
|
+
string package = customType.substr(0, customType.find('.'));
|
1466
|
+
_out << nl << "import " << package;
|
1467
|
+
_out << nl << "_M_" << getAbsolute(p, "_t_")
|
1468
|
+
<< " = IcePy.defineCustom('" << scoped << "', " << customType << ")";
|
1469
|
+
}
|
1470
|
+
else
|
1471
|
+
{
|
1472
|
+
_out << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.defineSequence('" << scoped << "', ";
|
1473
|
+
writeMetaData(metaData);
|
1474
|
+
_out << ", ";
|
1475
|
+
writeType(p->type());
|
1476
|
+
_out << ")";
|
1477
|
+
}
|
1478
|
+
_out.dec();
|
1479
|
+
}
|
1480
|
+
|
1481
|
+
void
|
1482
|
+
Slice::Python::CodeVisitor::visitDictionary(const DictionaryPtr& p)
|
1483
|
+
{
|
1484
|
+
//
|
1485
|
+
// Emit the type information.
|
1486
|
+
//
|
1487
|
+
string scoped = p->scoped();
|
1488
|
+
_out << sp << nl << "if " << getDictLookup(p, "_t_") << ':';
|
1489
|
+
_out.inc();
|
1490
|
+
_out << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.defineDictionary('" << scoped << "', ";
|
1491
|
+
writeMetaData(p->getMetaData());
|
1492
|
+
_out << ", ";
|
1493
|
+
writeType(p->keyType());
|
1494
|
+
_out << ", ";
|
1495
|
+
writeType(p->valueType());
|
1496
|
+
_out << ")";
|
1497
|
+
_out.dec();
|
1498
|
+
}
|
1499
|
+
|
1500
|
+
void
|
1501
|
+
Slice::Python::CodeVisitor::visitEnum(const EnumPtr& p)
|
1502
|
+
{
|
1503
|
+
string scoped = p->scoped();
|
1504
|
+
string abs = getAbsolute(p);
|
1505
|
+
string name = fixIdent(p->name());
|
1506
|
+
EnumeratorList enums = p->getEnumerators();
|
1507
|
+
EnumeratorList::iterator q;
|
1508
|
+
|
1509
|
+
_out << sp << nl << "if " << getDictLookup(p) << ':';
|
1510
|
+
_out.inc();
|
1511
|
+
_out << nl << "_M_" << abs << " = Ice.createTempClass()";
|
1512
|
+
_out << nl << "class " << name << "(Ice.EnumBase):";
|
1513
|
+
_out.inc();
|
1514
|
+
|
1515
|
+
string comment = p->comment();
|
1516
|
+
if(!comment.empty())
|
1517
|
+
{
|
1518
|
+
_out << nl << "'''" << editComment(comment) << "'''";
|
1519
|
+
}
|
1520
|
+
|
1521
|
+
_out << sp << nl << "def __init__(self, _n, _v):";
|
1522
|
+
_out.inc();
|
1523
|
+
_out << nl << "Ice.EnumBase.__init__(self, _n, _v)";
|
1524
|
+
_out.dec();
|
1525
|
+
|
1526
|
+
_out << sp << nl << "def valueOf(self, _n):";
|
1527
|
+
_out.inc();
|
1528
|
+
_out << nl << "if _n in self._enumerators:";
|
1529
|
+
_out.inc();
|
1530
|
+
_out << nl << "return self._enumerators[_n]";
|
1531
|
+
_out.dec();
|
1532
|
+
_out << nl << "return None";
|
1533
|
+
_out.dec();
|
1534
|
+
_out << nl << "valueOf = classmethod(valueOf)";
|
1535
|
+
|
1536
|
+
_out.dec();
|
1537
|
+
|
1538
|
+
_out << sp;
|
1539
|
+
for(q = enums.begin(); q != enums.end(); ++q)
|
1540
|
+
{
|
1541
|
+
string fixedEnum = fixIdent((*q)->name());
|
1542
|
+
_out << nl << name << '.' << fixedEnum << " = " << name << "(\"" << (*q)->name() << "\", " << (*q)->value()
|
1543
|
+
<< ')';
|
1544
|
+
}
|
1545
|
+
_out << nl << name << "._enumerators = { ";
|
1546
|
+
for(q = enums.begin(); q != enums.end(); ++q)
|
1547
|
+
{
|
1548
|
+
if(q != enums.begin())
|
1549
|
+
{
|
1550
|
+
_out << ", ";
|
1551
|
+
}
|
1552
|
+
string fixedEnum = fixIdent((*q)->name());
|
1553
|
+
_out << (*q)->value() << ':' << name << '.' << fixedEnum;
|
1554
|
+
}
|
1555
|
+
_out << " }";
|
1556
|
+
|
1557
|
+
//
|
1558
|
+
// Emit the type information.
|
1559
|
+
//
|
1560
|
+
_out << sp << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.defineEnum('" << scoped << "', " << name
|
1561
|
+
<< ", ";
|
1562
|
+
writeMetaData(p->getMetaData());
|
1563
|
+
_out << ", " << name << "._enumerators)";
|
1564
|
+
|
1565
|
+
registerName(name);
|
1566
|
+
|
1567
|
+
_out.dec();
|
1568
|
+
}
|
1569
|
+
|
1570
|
+
void
|
1571
|
+
Slice::Python::CodeVisitor::visitConst(const ConstPtr& p)
|
1572
|
+
{
|
1573
|
+
Slice::TypePtr type = p->type();
|
1574
|
+
string name = fixIdent(p->name());
|
1575
|
+
|
1576
|
+
_out << sp << nl << "_M_" << getAbsolute(p) << " = ";
|
1577
|
+
writeConstantValue(type, p->valueType(), p->value());
|
1578
|
+
}
|
1579
|
+
|
1580
|
+
string
|
1581
|
+
Slice::Python::CodeVisitor::getSymbol(const ContainedPtr& p, const string& nameSuffix)
|
1582
|
+
{
|
1583
|
+
//
|
1584
|
+
// An explicit reference to another type must always be prefixed with "_M_".
|
1585
|
+
//
|
1586
|
+
return "_M_" + getAbsolute(p, "", nameSuffix);
|
1587
|
+
}
|
1588
|
+
|
1589
|
+
void
|
1590
|
+
Slice::Python::CodeVisitor::registerName(const string& name)
|
1591
|
+
{
|
1592
|
+
assert(!_moduleStack.empty());
|
1593
|
+
_out << sp << nl << "_M_" << _moduleStack.front() << '.' << name << " = " << name;
|
1594
|
+
_out << nl << "del " << name;
|
1595
|
+
}
|
1596
|
+
|
1597
|
+
void
|
1598
|
+
Slice::Python::CodeVisitor::writeType(const TypePtr& p)
|
1599
|
+
{
|
1600
|
+
BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
|
1601
|
+
if(builtin)
|
1602
|
+
{
|
1603
|
+
switch(builtin->kind())
|
1604
|
+
{
|
1605
|
+
case Builtin::KindBool:
|
1606
|
+
{
|
1607
|
+
_out << "IcePy._t_bool";
|
1608
|
+
break;
|
1609
|
+
}
|
1610
|
+
case Builtin::KindByte:
|
1611
|
+
{
|
1612
|
+
_out << "IcePy._t_byte";
|
1613
|
+
break;
|
1614
|
+
}
|
1615
|
+
case Builtin::KindShort:
|
1616
|
+
{
|
1617
|
+
_out << "IcePy._t_short";
|
1618
|
+
break;
|
1619
|
+
}
|
1620
|
+
case Builtin::KindInt:
|
1621
|
+
{
|
1622
|
+
_out << "IcePy._t_int";
|
1623
|
+
break;
|
1624
|
+
}
|
1625
|
+
case Builtin::KindLong:
|
1626
|
+
{
|
1627
|
+
_out << "IcePy._t_long";
|
1628
|
+
break;
|
1629
|
+
}
|
1630
|
+
case Builtin::KindFloat:
|
1631
|
+
{
|
1632
|
+
_out << "IcePy._t_float";
|
1633
|
+
break;
|
1634
|
+
}
|
1635
|
+
case Builtin::KindDouble:
|
1636
|
+
{
|
1637
|
+
_out << "IcePy._t_double";
|
1638
|
+
break;
|
1639
|
+
}
|
1640
|
+
case Builtin::KindString:
|
1641
|
+
{
|
1642
|
+
_out << "IcePy._t_string";
|
1643
|
+
break;
|
1644
|
+
}
|
1645
|
+
case Builtin::KindObject:
|
1646
|
+
{
|
1647
|
+
_out << "IcePy._t_Object";
|
1648
|
+
break;
|
1649
|
+
}
|
1650
|
+
case Builtin::KindObjectProxy:
|
1651
|
+
{
|
1652
|
+
_out << "IcePy._t_ObjectPrx";
|
1653
|
+
break;
|
1654
|
+
}
|
1655
|
+
case Builtin::KindLocalObject:
|
1656
|
+
{
|
1657
|
+
_out << "IcePy._t_LocalObject";
|
1658
|
+
break;
|
1659
|
+
}
|
1660
|
+
}
|
1661
|
+
return;
|
1662
|
+
}
|
1663
|
+
|
1664
|
+
ProxyPtr prx = ProxyPtr::dynamicCast(p);
|
1665
|
+
if(prx)
|
1666
|
+
{
|
1667
|
+
_out << "_M_" << getAbsolute(prx->_class(), "_t_", "Prx");
|
1668
|
+
return;
|
1669
|
+
}
|
1670
|
+
|
1671
|
+
ContainedPtr cont = ContainedPtr::dynamicCast(p);
|
1672
|
+
assert(cont);
|
1673
|
+
_out << "_M_" << getAbsolute(cont, "_t_");
|
1674
|
+
}
|
1675
|
+
|
1676
|
+
void
|
1677
|
+
Slice::Python::CodeVisitor::writeInitializer(const TypePtr& p)
|
1678
|
+
{
|
1679
|
+
BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
|
1680
|
+
if(builtin)
|
1681
|
+
{
|
1682
|
+
switch(builtin->kind())
|
1683
|
+
{
|
1684
|
+
case Builtin::KindBool:
|
1685
|
+
{
|
1686
|
+
_out << "False";
|
1687
|
+
break;
|
1688
|
+
}
|
1689
|
+
case Builtin::KindByte:
|
1690
|
+
case Builtin::KindShort:
|
1691
|
+
case Builtin::KindInt:
|
1692
|
+
case Builtin::KindLong:
|
1693
|
+
{
|
1694
|
+
_out << "0";
|
1695
|
+
break;
|
1696
|
+
}
|
1697
|
+
case Builtin::KindFloat:
|
1698
|
+
case Builtin::KindDouble:
|
1699
|
+
{
|
1700
|
+
_out << "0.0";
|
1701
|
+
break;
|
1702
|
+
}
|
1703
|
+
case Builtin::KindString:
|
1704
|
+
{
|
1705
|
+
_out << "''";
|
1706
|
+
break;
|
1707
|
+
}
|
1708
|
+
case Builtin::KindObject:
|
1709
|
+
case Builtin::KindObjectProxy:
|
1710
|
+
case Builtin::KindLocalObject:
|
1711
|
+
{
|
1712
|
+
_out << "None";
|
1713
|
+
break;
|
1714
|
+
}
|
1715
|
+
}
|
1716
|
+
return;
|
1717
|
+
}
|
1718
|
+
|
1719
|
+
EnumPtr en = EnumPtr::dynamicCast(p);
|
1720
|
+
if(en)
|
1721
|
+
{
|
1722
|
+
EnumeratorList enums = en->getEnumerators();
|
1723
|
+
_out << getSymbol(en) << "." << fixIdent(enums.front()->name());
|
1724
|
+
return;
|
1725
|
+
}
|
1726
|
+
|
1727
|
+
StructPtr st = StructPtr::dynamicCast(p);
|
1728
|
+
if(st)
|
1729
|
+
{
|
1730
|
+
//
|
1731
|
+
// We cannot emit a call to the struct's constructor here because Python
|
1732
|
+
// only evaluates this expression once (see bug 3676). Instead, we emit
|
1733
|
+
// a marker that allows us to determine whether the application has
|
1734
|
+
// supplied a value.
|
1735
|
+
//
|
1736
|
+
_out << "Ice._struct_marker";
|
1737
|
+
return;
|
1738
|
+
}
|
1739
|
+
|
1740
|
+
_out << "None";
|
1741
|
+
}
|
1742
|
+
|
1743
|
+
void
|
1744
|
+
Slice::Python::CodeVisitor::writeHash(const string& name, const TypePtr& p, int& iter)
|
1745
|
+
{
|
1746
|
+
SequencePtr seq = SequencePtr::dynamicCast(p);
|
1747
|
+
if(seq)
|
1748
|
+
{
|
1749
|
+
_out << nl << "if " << name << ':';
|
1750
|
+
_out.inc();
|
1751
|
+
_out << nl << "for _i" << iter << " in " << name << ':';
|
1752
|
+
_out.inc();
|
1753
|
+
ostringstream elem;
|
1754
|
+
elem << "_i" << iter;
|
1755
|
+
iter++;
|
1756
|
+
writeHash(elem.str(), seq->type(), iter);
|
1757
|
+
_out.dec();
|
1758
|
+
_out.dec();
|
1759
|
+
return;
|
1760
|
+
}
|
1761
|
+
|
1762
|
+
DictionaryPtr dict = DictionaryPtr::dynamicCast(p);
|
1763
|
+
if(dict)
|
1764
|
+
{
|
1765
|
+
_out << nl << "if " << name << ':';
|
1766
|
+
_out.inc();
|
1767
|
+
_out << nl << "for _i" << iter << " in " << name << ':';
|
1768
|
+
_out.inc();
|
1769
|
+
ostringstream key;
|
1770
|
+
key << "_i" << iter;
|
1771
|
+
ostringstream value;
|
1772
|
+
value << name << '[' << key.str() << ']';
|
1773
|
+
iter++;
|
1774
|
+
writeHash(key.str(), dict->keyType(), iter);
|
1775
|
+
writeHash(value.str(), dict->valueType(), iter);
|
1776
|
+
_out.dec();
|
1777
|
+
_out.dec();
|
1778
|
+
return;
|
1779
|
+
}
|
1780
|
+
|
1781
|
+
_out << nl << "_h = 5 * _h + Ice.getHash(" << name << ")";
|
1782
|
+
}
|
1783
|
+
|
1784
|
+
void
|
1785
|
+
Slice::Python::CodeVisitor::writeMetaData(const StringList& meta)
|
1786
|
+
{
|
1787
|
+
int i = 0;
|
1788
|
+
_out << '(';
|
1789
|
+
for(StringList::const_iterator p = meta.begin(); p != meta.end(); ++p)
|
1790
|
+
{
|
1791
|
+
if(p->find("python:") == 0)
|
1792
|
+
{
|
1793
|
+
if(i > 0)
|
1794
|
+
{
|
1795
|
+
_out << ", ";
|
1796
|
+
}
|
1797
|
+
_out << "'" << *p << "'";
|
1798
|
+
++i;
|
1799
|
+
}
|
1800
|
+
}
|
1801
|
+
if(i == 1)
|
1802
|
+
{
|
1803
|
+
_out << ',';
|
1804
|
+
}
|
1805
|
+
_out << ')';
|
1806
|
+
}
|
1807
|
+
|
1808
|
+
void
|
1809
|
+
Slice::Python::CodeVisitor::writeAssign(const MemberInfo& info)
|
1810
|
+
{
|
1811
|
+
string paramName = info.fixedName;
|
1812
|
+
string memberName = info.fixedName;
|
1813
|
+
|
1814
|
+
//
|
1815
|
+
// Structures are treated differently (see bug 3676).
|
1816
|
+
//
|
1817
|
+
StructPtr st = StructPtr::dynamicCast(info.dataMember->type());
|
1818
|
+
if(st && !info.dataMember->optional())
|
1819
|
+
{
|
1820
|
+
_out << nl << "if " << paramName << " is Ice._struct_marker:";
|
1821
|
+
_out.inc();
|
1822
|
+
_out << nl << "self." << memberName << " = " << getSymbol(st) << "()";
|
1823
|
+
_out.dec();
|
1824
|
+
_out << nl << "else:";
|
1825
|
+
_out.inc();
|
1826
|
+
_out << nl << "self." << memberName << " = " << paramName;
|
1827
|
+
_out.dec();
|
1828
|
+
}
|
1829
|
+
else
|
1830
|
+
{
|
1831
|
+
_out << nl << "self." << memberName << " = " << paramName;
|
1832
|
+
}
|
1833
|
+
}
|
1834
|
+
|
1835
|
+
void
|
1836
|
+
Slice::Python::CodeVisitor::writeConstantValue(const TypePtr& type, const SyntaxTreeBasePtr& valueType,
|
1837
|
+
const string& value)
|
1838
|
+
{
|
1839
|
+
ConstPtr constant = ConstPtr::dynamicCast(valueType);
|
1840
|
+
if(constant)
|
1841
|
+
{
|
1842
|
+
_out << "_M_" << getAbsolute(constant);
|
1843
|
+
}
|
1844
|
+
else
|
1845
|
+
{
|
1846
|
+
Slice::BuiltinPtr b = Slice::BuiltinPtr::dynamicCast(type);
|
1847
|
+
Slice::EnumPtr en = Slice::EnumPtr::dynamicCast(type);
|
1848
|
+
if(b)
|
1849
|
+
{
|
1850
|
+
switch(b->kind())
|
1851
|
+
{
|
1852
|
+
case Slice::Builtin::KindBool:
|
1853
|
+
{
|
1854
|
+
_out << (value == "true" ? "True" : "False");
|
1855
|
+
break;
|
1856
|
+
}
|
1857
|
+
case Slice::Builtin::KindByte:
|
1858
|
+
case Slice::Builtin::KindShort:
|
1859
|
+
case Slice::Builtin::KindInt:
|
1860
|
+
case Slice::Builtin::KindFloat:
|
1861
|
+
case Slice::Builtin::KindDouble:
|
1862
|
+
case Slice::Builtin::KindLong:
|
1863
|
+
{
|
1864
|
+
_out << value;
|
1865
|
+
break;
|
1866
|
+
}
|
1867
|
+
case Slice::Builtin::KindString:
|
1868
|
+
{
|
1869
|
+
//
|
1870
|
+
// Expand strings into the basic source character set. We can't use isalpha() and the like
|
1871
|
+
// here because they are sensitive to the current locale.
|
1872
|
+
//
|
1873
|
+
static const string basicSourceChars = "abcdefghijklmnopqrstuvwxyz"
|
1874
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
1875
|
+
"0123456789"
|
1876
|
+
"_{}[]#()<>%:;.?*+-/^&|~!=, '";
|
1877
|
+
static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end());
|
1878
|
+
|
1879
|
+
_out << "\""; // Opening "
|
1880
|
+
|
1881
|
+
for(string::const_iterator c = value.begin(); c != value.end(); ++c)
|
1882
|
+
{
|
1883
|
+
switch(*c)
|
1884
|
+
{
|
1885
|
+
case '"':
|
1886
|
+
{
|
1887
|
+
_out << "\\\"";
|
1888
|
+
break;
|
1889
|
+
}
|
1890
|
+
case '\\':
|
1891
|
+
{
|
1892
|
+
_out << "\\\\";
|
1893
|
+
break;
|
1894
|
+
}
|
1895
|
+
case '\r':
|
1896
|
+
{
|
1897
|
+
_out << "\\r";
|
1898
|
+
break;
|
1899
|
+
}
|
1900
|
+
case '\n':
|
1901
|
+
{
|
1902
|
+
_out << "\\n";
|
1903
|
+
break;
|
1904
|
+
}
|
1905
|
+
case '\t':
|
1906
|
+
{
|
1907
|
+
_out << "\\t";
|
1908
|
+
break;
|
1909
|
+
}
|
1910
|
+
case '\b':
|
1911
|
+
{
|
1912
|
+
_out << "\\b";
|
1913
|
+
break;
|
1914
|
+
}
|
1915
|
+
case '\f':
|
1916
|
+
{
|
1917
|
+
_out << "\\f";
|
1918
|
+
break;
|
1919
|
+
}
|
1920
|
+
default:
|
1921
|
+
{
|
1922
|
+
if(charSet.find(*c) == charSet.end())
|
1923
|
+
{
|
1924
|
+
unsigned char uc = *c; // Char may be signed, so make it positive.
|
1925
|
+
stringstream s;
|
1926
|
+
s << "\\"; // Print as octal if not in basic source character set.
|
1927
|
+
s.flags(ios_base::oct);
|
1928
|
+
s.width(3);
|
1929
|
+
s.fill('0');
|
1930
|
+
s << static_cast<unsigned>(uc);
|
1931
|
+
_out << s.str();
|
1932
|
+
}
|
1933
|
+
else
|
1934
|
+
{
|
1935
|
+
_out << *c; // Print normally if in basic source character set.
|
1936
|
+
}
|
1937
|
+
break;
|
1938
|
+
}
|
1939
|
+
}
|
1940
|
+
}
|
1941
|
+
|
1942
|
+
_out << "\""; // Closing "
|
1943
|
+
break;
|
1944
|
+
}
|
1945
|
+
case Slice::Builtin::KindObject:
|
1946
|
+
case Slice::Builtin::KindObjectProxy:
|
1947
|
+
case Slice::Builtin::KindLocalObject:
|
1948
|
+
assert(false);
|
1949
|
+
}
|
1950
|
+
}
|
1951
|
+
else if(en)
|
1952
|
+
{
|
1953
|
+
string enumName = getSymbol(en);
|
1954
|
+
string::size_type colon = value.rfind(':');
|
1955
|
+
string enumerator;
|
1956
|
+
if(colon != string::npos)
|
1957
|
+
{
|
1958
|
+
enumerator = fixIdent(value.substr(colon + 1));
|
1959
|
+
}
|
1960
|
+
else
|
1961
|
+
{
|
1962
|
+
enumerator = fixIdent(value);
|
1963
|
+
}
|
1964
|
+
_out << enumName << '.' << enumerator;
|
1965
|
+
}
|
1966
|
+
else
|
1967
|
+
{
|
1968
|
+
assert(false); // Unknown const type.
|
1969
|
+
}
|
1970
|
+
}
|
1971
|
+
}
|
1972
|
+
|
1973
|
+
void
|
1974
|
+
Slice::Python::CodeVisitor::writeConstructorParams(const MemberInfoList& members)
|
1975
|
+
{
|
1976
|
+
for(MemberInfoList::const_iterator p = members.begin(); p != members.end(); ++p)
|
1977
|
+
{
|
1978
|
+
_out << ", " << p->fixedName << "=";
|
1979
|
+
|
1980
|
+
const DataMemberPtr member = p->dataMember;
|
1981
|
+
if(member->defaultValueType())
|
1982
|
+
{
|
1983
|
+
writeConstantValue(member->type(), member->defaultValueType(), member->defaultValue());
|
1984
|
+
}
|
1985
|
+
else if(member->optional())
|
1986
|
+
{
|
1987
|
+
_out << "Ice.Unset";
|
1988
|
+
}
|
1989
|
+
else
|
1990
|
+
{
|
1991
|
+
writeInitializer(member->type());
|
1992
|
+
}
|
1993
|
+
}
|
1994
|
+
}
|
1995
|
+
|
1996
|
+
string
|
1997
|
+
Slice::Python::CodeVisitor::getOperationMode(Slice::Operation::Mode mode)
|
1998
|
+
{
|
1999
|
+
string result;
|
2000
|
+
switch(mode)
|
2001
|
+
{
|
2002
|
+
case Operation::Normal:
|
2003
|
+
result = "Ice.OperationMode.Normal";
|
2004
|
+
break;
|
2005
|
+
case Operation::Nonmutating:
|
2006
|
+
result = "Ice.OperationMode.Nonmutating";
|
2007
|
+
break;
|
2008
|
+
case Operation::Idempotent:
|
2009
|
+
result = "Ice.OperationMode.Idempotent";
|
2010
|
+
break;
|
2011
|
+
}
|
2012
|
+
return result;
|
2013
|
+
}
|
2014
|
+
|
2015
|
+
void
|
2016
|
+
Slice::Python::CodeVisitor::collectClassMembers(const ClassDefPtr& p, MemberInfoList& allMembers, bool inherited)
|
2017
|
+
{
|
2018
|
+
ClassList bases = p->bases();
|
2019
|
+
if(!bases.empty() && !bases.front()->isInterface())
|
2020
|
+
{
|
2021
|
+
collectClassMembers(bases.front(), allMembers, true);
|
2022
|
+
}
|
2023
|
+
|
2024
|
+
DataMemberList members = p->dataMembers();
|
2025
|
+
|
2026
|
+
for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
|
2027
|
+
{
|
2028
|
+
MemberInfo m;
|
2029
|
+
if(p->hasMetaData("protected") || (*q)->hasMetaData("protected"))
|
2030
|
+
{
|
2031
|
+
m.fixedName = "_" + fixIdent((*q)->name());
|
2032
|
+
}
|
2033
|
+
else
|
2034
|
+
{
|
2035
|
+
m.fixedName = fixIdent((*q)->name());
|
2036
|
+
}
|
2037
|
+
m.inherited = inherited;
|
2038
|
+
m.dataMember = *q;
|
2039
|
+
allMembers.push_back(m);
|
2040
|
+
}
|
2041
|
+
}
|
2042
|
+
|
2043
|
+
void
|
2044
|
+
Slice::Python::CodeVisitor::collectExceptionMembers(const ExceptionPtr& p, MemberInfoList& allMembers, bool inherited)
|
2045
|
+
{
|
2046
|
+
ExceptionPtr base = p->base();
|
2047
|
+
if(base)
|
2048
|
+
{
|
2049
|
+
collectExceptionMembers(base, allMembers, true);
|
2050
|
+
}
|
2051
|
+
|
2052
|
+
DataMemberList members = p->dataMembers();
|
2053
|
+
|
2054
|
+
for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
|
2055
|
+
{
|
2056
|
+
MemberInfo m;
|
2057
|
+
m.fixedName = fixIdent((*q)->name());
|
2058
|
+
m.inherited = inherited;
|
2059
|
+
m.dataMember = *q;
|
2060
|
+
allMembers.push_back(m);
|
2061
|
+
}
|
2062
|
+
}
|
2063
|
+
|
2064
|
+
string
|
2065
|
+
Slice::Python::CodeVisitor::editComment(const string& comment)
|
2066
|
+
{
|
2067
|
+
//
|
2068
|
+
// Strip HTML markup and javadoc links.
|
2069
|
+
//
|
2070
|
+
string result = comment;
|
2071
|
+
string::size_type pos = 0;
|
2072
|
+
do
|
2073
|
+
{
|
2074
|
+
pos = result.find('<', pos);
|
2075
|
+
if(pos != string::npos)
|
2076
|
+
{
|
2077
|
+
string::size_type endpos = result.find('>', pos);
|
2078
|
+
if(endpos == string::npos)
|
2079
|
+
{
|
2080
|
+
break;
|
2081
|
+
}
|
2082
|
+
result.erase(pos, endpos - pos + 1);
|
2083
|
+
}
|
2084
|
+
} while(pos != string::npos);
|
2085
|
+
|
2086
|
+
const string link = "{@link";
|
2087
|
+
pos = 0;
|
2088
|
+
do
|
2089
|
+
{
|
2090
|
+
pos = result.find(link, pos);
|
2091
|
+
if(pos != string::npos)
|
2092
|
+
{
|
2093
|
+
result.erase(pos, link.size());
|
2094
|
+
string::size_type endpos = result.find('}', pos);
|
2095
|
+
if(endpos != string::npos)
|
2096
|
+
{
|
2097
|
+
string::size_type identpos = result.find_first_not_of(" \t#", pos);
|
2098
|
+
if(identpos != string::npos && identpos < endpos)
|
2099
|
+
{
|
2100
|
+
string ident = result.substr(identpos, endpos - identpos);
|
2101
|
+
result.replace(pos, endpos - pos + 1, fixIdent(ident));
|
2102
|
+
}
|
2103
|
+
}
|
2104
|
+
}
|
2105
|
+
} while(pos != string::npos);
|
2106
|
+
|
2107
|
+
//
|
2108
|
+
// Strip @see sections.
|
2109
|
+
//
|
2110
|
+
static const string seeTag = "@see";
|
2111
|
+
pos = 0;
|
2112
|
+
do
|
2113
|
+
{
|
2114
|
+
//
|
2115
|
+
// Look for the next @ and delete up to that, or
|
2116
|
+
// to the end of the string, if not found.
|
2117
|
+
//
|
2118
|
+
pos = result.find(seeTag, pos);
|
2119
|
+
if(pos != string::npos)
|
2120
|
+
{
|
2121
|
+
string::size_type next = result.find('@', pos + seeTag.size());
|
2122
|
+
if(next != string::npos)
|
2123
|
+
{
|
2124
|
+
result.erase(pos, next - pos);
|
2125
|
+
}
|
2126
|
+
else
|
2127
|
+
{
|
2128
|
+
result.erase(pos, string::npos);
|
2129
|
+
}
|
2130
|
+
}
|
2131
|
+
} while(pos != string::npos);
|
2132
|
+
|
2133
|
+
//
|
2134
|
+
// Reformat @param, @return, and @throws.
|
2135
|
+
//
|
2136
|
+
static const string paramTag = "@param";
|
2137
|
+
pos = 0;
|
2138
|
+
bool first = true;
|
2139
|
+
do
|
2140
|
+
{
|
2141
|
+
pos = result.find(paramTag, pos);
|
2142
|
+
if(pos != string::npos)
|
2143
|
+
{
|
2144
|
+
result.replace(pos, paramTag.size() + 1, " ");
|
2145
|
+
|
2146
|
+
if(first)
|
2147
|
+
{
|
2148
|
+
string::size_type bol = result.rfind('\n', pos);
|
2149
|
+
if(bol == string::npos)
|
2150
|
+
{
|
2151
|
+
bol = 0;
|
2152
|
+
}
|
2153
|
+
else
|
2154
|
+
{
|
2155
|
+
bol++;
|
2156
|
+
}
|
2157
|
+
result.insert(bol, "Arguments:\n");
|
2158
|
+
first = false;
|
2159
|
+
}
|
2160
|
+
}
|
2161
|
+
} while(pos != string::npos);
|
2162
|
+
|
2163
|
+
static const string returnTag = "@return";
|
2164
|
+
pos = result.find(returnTag);
|
2165
|
+
first = true;
|
2166
|
+
if(pos != string::npos)
|
2167
|
+
{
|
2168
|
+
result.replace(pos, returnTag.size() + 1, " ");
|
2169
|
+
string::size_type bol = result.rfind('\n', pos);
|
2170
|
+
if(bol == string::npos)
|
2171
|
+
{
|
2172
|
+
bol = 0;
|
2173
|
+
}
|
2174
|
+
else
|
2175
|
+
{
|
2176
|
+
bol++;
|
2177
|
+
}
|
2178
|
+
result.insert(bol, "Returns:\n");
|
2179
|
+
}
|
2180
|
+
|
2181
|
+
static const string throwsTag = "@throws";
|
2182
|
+
pos = 0;
|
2183
|
+
first = true;
|
2184
|
+
do
|
2185
|
+
{
|
2186
|
+
pos = result.find(throwsTag, pos);
|
2187
|
+
if(pos != string::npos)
|
2188
|
+
{
|
2189
|
+
result.replace(pos, throwsTag.size() + 1, " ");
|
2190
|
+
|
2191
|
+
if(first)
|
2192
|
+
{
|
2193
|
+
string::size_type bol = result.rfind('\n', pos);
|
2194
|
+
if(bol == string::npos)
|
2195
|
+
{
|
2196
|
+
bol = 0;
|
2197
|
+
}
|
2198
|
+
else
|
2199
|
+
{
|
2200
|
+
bol++;
|
2201
|
+
}
|
2202
|
+
result.insert(bol, "Exceptions:\n");
|
2203
|
+
first = false;
|
2204
|
+
}
|
2205
|
+
}
|
2206
|
+
} while(pos != string::npos);
|
2207
|
+
|
2208
|
+
//
|
2209
|
+
// Escape triple quotes.
|
2210
|
+
//
|
2211
|
+
static const string quotes = "'''";
|
2212
|
+
pos = 0;
|
2213
|
+
do
|
2214
|
+
{
|
2215
|
+
pos = result.find(quotes, pos);
|
2216
|
+
if(pos != string::npos)
|
2217
|
+
{
|
2218
|
+
result.insert(pos, "\\");
|
2219
|
+
pos += quotes.size() + 1;
|
2220
|
+
}
|
2221
|
+
} while(pos != string::npos);
|
2222
|
+
|
2223
|
+
//
|
2224
|
+
// Fold multiple empty lines.
|
2225
|
+
//
|
2226
|
+
pos = 0;
|
2227
|
+
while(true)
|
2228
|
+
{
|
2229
|
+
pos = result.find('\n', pos);
|
2230
|
+
if(pos == string::npos)
|
2231
|
+
{
|
2232
|
+
break;
|
2233
|
+
}
|
2234
|
+
|
2235
|
+
//
|
2236
|
+
// Skip the next LF or CR/LF, if present.
|
2237
|
+
//
|
2238
|
+
if(pos < result.size() - 1 && result[pos + 1] == '\n')
|
2239
|
+
{
|
2240
|
+
pos += 2;
|
2241
|
+
}
|
2242
|
+
else if(pos < result.size() - 2 && result[pos + 1] == '\r' && result[pos + 2] == '\n')
|
2243
|
+
{
|
2244
|
+
pos += 3;
|
2245
|
+
}
|
2246
|
+
else
|
2247
|
+
{
|
2248
|
+
++pos;
|
2249
|
+
continue;
|
2250
|
+
}
|
2251
|
+
|
2252
|
+
//
|
2253
|
+
// Erase any more CR/LF characters.
|
2254
|
+
//
|
2255
|
+
string::size_type next = result.find_first_not_of("\r\n", pos);
|
2256
|
+
if(next != string::npos)
|
2257
|
+
{
|
2258
|
+
result.erase(pos, next - pos);
|
2259
|
+
}
|
2260
|
+
}
|
2261
|
+
|
2262
|
+
//
|
2263
|
+
// Remove trailing whitespace.
|
2264
|
+
//
|
2265
|
+
pos = result.find_last_not_of(" \t\r\n");
|
2266
|
+
if(pos != string::npos)
|
2267
|
+
{
|
2268
|
+
result.erase(pos + 1, result.size() - pos - 1);
|
2269
|
+
}
|
2270
|
+
|
2271
|
+
return result;
|
2272
|
+
}
|
2273
|
+
|
2274
|
+
void
|
2275
|
+
Slice::Python::generate(const UnitPtr& un, bool all, bool checksum, const vector<string>& includePaths, Output& out)
|
2276
|
+
{
|
2277
|
+
Slice::Python::MetaDataVisitor visitor;
|
2278
|
+
un->visit(&visitor, false);
|
2279
|
+
|
2280
|
+
out << nl << "import Ice, IcePy";
|
2281
|
+
|
2282
|
+
if(!all)
|
2283
|
+
{
|
2284
|
+
vector<string> paths = includePaths;
|
2285
|
+
for(vector<string>::iterator p = paths.begin(); p != paths.end(); ++p)
|
2286
|
+
{
|
2287
|
+
*p = fullPath(*p);
|
2288
|
+
}
|
2289
|
+
|
2290
|
+
StringList includes = un->includeFiles();
|
2291
|
+
for(StringList::const_iterator q = includes.begin(); q != includes.end(); ++q)
|
2292
|
+
{
|
2293
|
+
string file = changeInclude(*q, paths);
|
2294
|
+
replace(file.begin(), file.end(), '/', '_');
|
2295
|
+
out << nl << "import " << file << "_ice";
|
2296
|
+
}
|
2297
|
+
}
|
2298
|
+
|
2299
|
+
set<string> moduleHistory;
|
2300
|
+
|
2301
|
+
ModuleVisitor moduleVisitor(out, moduleHistory);
|
2302
|
+
un->visit(&moduleVisitor, true);
|
2303
|
+
|
2304
|
+
CodeVisitor codeVisitor(out, moduleHistory);
|
2305
|
+
un->visit(&codeVisitor, false);
|
2306
|
+
|
2307
|
+
if(checksum)
|
2308
|
+
{
|
2309
|
+
ChecksumMap checksums = createChecksums(un);
|
2310
|
+
if(!checksums.empty())
|
2311
|
+
{
|
2312
|
+
out << sp;
|
2313
|
+
for(ChecksumMap::const_iterator p = checksums.begin(); p != checksums.end(); ++p)
|
2314
|
+
{
|
2315
|
+
out << nl << "Ice.sliceChecksums[\"" << p->first << "\"] = \"";
|
2316
|
+
ostringstream str;
|
2317
|
+
str.flags(ios_base::hex);
|
2318
|
+
str.fill('0');
|
2319
|
+
for(vector<unsigned char>::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
|
2320
|
+
{
|
2321
|
+
str << static_cast<int>(*q);
|
2322
|
+
}
|
2323
|
+
out << str.str() << "\"";
|
2324
|
+
}
|
2325
|
+
}
|
2326
|
+
}
|
2327
|
+
|
2328
|
+
out << nl; // Trailing newline.
|
2329
|
+
}
|
2330
|
+
|
2331
|
+
string
|
2332
|
+
Slice::Python::scopedToName(const string& scoped)
|
2333
|
+
{
|
2334
|
+
string result = fixIdent(scoped);
|
2335
|
+
if(result.find("::") == 0)
|
2336
|
+
{
|
2337
|
+
result.erase(0, 2);
|
2338
|
+
}
|
2339
|
+
|
2340
|
+
string::size_type pos;
|
2341
|
+
while((pos = result.find("::")) != string::npos)
|
2342
|
+
{
|
2343
|
+
result.replace(pos, 2, ".");
|
2344
|
+
}
|
2345
|
+
|
2346
|
+
return result;
|
2347
|
+
}
|
2348
|
+
|
2349
|
+
string
|
2350
|
+
Slice::Python::fixIdent(const string& ident)
|
2351
|
+
{
|
2352
|
+
if(ident[0] != ':')
|
2353
|
+
{
|
2354
|
+
return lookupKwd(ident);
|
2355
|
+
}
|
2356
|
+
vector<string> ids = splitScopedName(ident);
|
2357
|
+
transform(ids.begin(), ids.end(), ids.begin(), ptr_fun(lookupKwd));
|
2358
|
+
stringstream result;
|
2359
|
+
for(vector<string>::const_iterator i = ids.begin(); i != ids.end(); ++i)
|
2360
|
+
{
|
2361
|
+
result << "::" + *i;
|
2362
|
+
}
|
2363
|
+
return result.str();
|
2364
|
+
}
|
2365
|
+
|
2366
|
+
string
|
2367
|
+
Slice::Python::getPackageMetadata(const ContainedPtr& cont)
|
2368
|
+
{
|
2369
|
+
UnitPtr unit = cont->container()->unit();
|
2370
|
+
string file = cont->file();
|
2371
|
+
assert(!file.empty());
|
2372
|
+
|
2373
|
+
static const string prefix = "python:package:";
|
2374
|
+
DefinitionContextPtr dc = unit->findDefinitionContext(file);
|
2375
|
+
assert(dc);
|
2376
|
+
string q = dc->findMetaData(prefix);
|
2377
|
+
if(!q.empty())
|
2378
|
+
{
|
2379
|
+
q = q.substr(prefix.size());
|
2380
|
+
}
|
2381
|
+
return q;
|
2382
|
+
}
|
2383
|
+
|
2384
|
+
string
|
2385
|
+
Slice::Python::getAbsolute(const ContainedPtr& cont, const string& suffix, const string& nameSuffix)
|
2386
|
+
{
|
2387
|
+
string scope = scopedToName(cont->scope());
|
2388
|
+
|
2389
|
+
string package = getPackageMetadata(cont);
|
2390
|
+
if(!package.empty())
|
2391
|
+
{
|
2392
|
+
if(!scope.empty())
|
2393
|
+
{
|
2394
|
+
scope = package + "." + scope;
|
2395
|
+
}
|
2396
|
+
else
|
2397
|
+
{
|
2398
|
+
scope = package + ".";
|
2399
|
+
}
|
2400
|
+
}
|
2401
|
+
|
2402
|
+
if(suffix.empty())
|
2403
|
+
{
|
2404
|
+
return scope + fixIdent(cont->name() + nameSuffix);
|
2405
|
+
}
|
2406
|
+
else
|
2407
|
+
{
|
2408
|
+
return scope + suffix + fixIdent(cont->name() + nameSuffix);
|
2409
|
+
}
|
2410
|
+
}
|
2411
|
+
|
2412
|
+
void
|
2413
|
+
Slice::Python::printHeader(IceUtilInternal::Output& out)
|
2414
|
+
{
|
2415
|
+
static const char* header =
|
2416
|
+
"# **********************************************************************\n"
|
2417
|
+
"#\n"
|
2418
|
+
"# Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.\n"
|
2419
|
+
"#\n"
|
2420
|
+
"# This copy of Ice is licensed to you under the terms described in the\n"
|
2421
|
+
"# ICE_LICENSE file included in this distribution.\n"
|
2422
|
+
"#\n"
|
2423
|
+
"# **********************************************************************\n"
|
2424
|
+
;
|
2425
|
+
|
2426
|
+
out << header;
|
2427
|
+
out << "#\n";
|
2428
|
+
out << "# Ice version " << ICE_STRING_VERSION << "\n";
|
2429
|
+
out << "#\n";
|
2430
|
+
}
|
2431
|
+
|
2432
|
+
bool
|
2433
|
+
Slice::Python::MetaDataVisitor::visitUnitStart(const UnitPtr& p)
|
2434
|
+
{
|
2435
|
+
static const string prefix = "python:";
|
2436
|
+
|
2437
|
+
//
|
2438
|
+
// Validate global metadata in the top-level file and all included files.
|
2439
|
+
//
|
2440
|
+
StringList files = p->allFiles();
|
2441
|
+
|
2442
|
+
for(StringList::iterator q = files.begin(); q != files.end(); ++q)
|
2443
|
+
{
|
2444
|
+
string file = *q;
|
2445
|
+
DefinitionContextPtr dc = p->findDefinitionContext(file);
|
2446
|
+
assert(dc);
|
2447
|
+
StringList globalMetaData = dc->getMetaData();
|
2448
|
+
for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end(); ++r)
|
2449
|
+
{
|
2450
|
+
string s = *r;
|
2451
|
+
if(_history.count(s) == 0)
|
2452
|
+
{
|
2453
|
+
if(s.find(prefix) == 0)
|
2454
|
+
{
|
2455
|
+
static const string packagePrefix = "python:package:";
|
2456
|
+
if(s.find(packagePrefix) != 0 || s.size() == packagePrefix.size())
|
2457
|
+
{
|
2458
|
+
emitWarning(file, "", "ignoring invalid global metadata `" + s + "'");
|
2459
|
+
}
|
2460
|
+
}
|
2461
|
+
_history.insert(s);
|
2462
|
+
}
|
2463
|
+
}
|
2464
|
+
}
|
2465
|
+
return true;
|
2466
|
+
}
|
2467
|
+
|
2468
|
+
bool
|
2469
|
+
Slice::Python::MetaDataVisitor::visitModuleStart(const ModulePtr& p)
|
2470
|
+
{
|
2471
|
+
reject(p);
|
2472
|
+
return true;
|
2473
|
+
}
|
2474
|
+
|
2475
|
+
void
|
2476
|
+
Slice::Python::MetaDataVisitor::visitClassDecl(const ClassDeclPtr& p)
|
2477
|
+
{
|
2478
|
+
reject(p);
|
2479
|
+
}
|
2480
|
+
|
2481
|
+
bool
|
2482
|
+
Slice::Python::MetaDataVisitor::visitClassDefStart(const ClassDefPtr& p)
|
2483
|
+
{
|
2484
|
+
reject(p);
|
2485
|
+
return true;
|
2486
|
+
}
|
2487
|
+
|
2488
|
+
bool
|
2489
|
+
Slice::Python::MetaDataVisitor::visitExceptionStart(const ExceptionPtr& p)
|
2490
|
+
{
|
2491
|
+
reject(p);
|
2492
|
+
return true;
|
2493
|
+
}
|
2494
|
+
|
2495
|
+
bool
|
2496
|
+
Slice::Python::MetaDataVisitor::visitStructStart(const StructPtr& p)
|
2497
|
+
{
|
2498
|
+
reject(p);
|
2499
|
+
return true;
|
2500
|
+
}
|
2501
|
+
|
2502
|
+
void
|
2503
|
+
Slice::Python::MetaDataVisitor::visitOperation(const OperationPtr& p)
|
2504
|
+
{
|
2505
|
+
TypePtr ret = p->returnType();
|
2506
|
+
if(ret)
|
2507
|
+
{
|
2508
|
+
validateSequence(p->file(), p->line(), ret, p->getMetaData());
|
2509
|
+
}
|
2510
|
+
|
2511
|
+
ParamDeclList params = p->parameters();
|
2512
|
+
for(ParamDeclList::iterator q = params.begin(); q != params.end(); ++q)
|
2513
|
+
{
|
2514
|
+
validateSequence(p->file(), (*q)->line(), (*q)->type(), (*q)->getMetaData());
|
2515
|
+
}
|
2516
|
+
}
|
2517
|
+
|
2518
|
+
void
|
2519
|
+
Slice::Python::MetaDataVisitor::visitDataMember(const DataMemberPtr& p)
|
2520
|
+
{
|
2521
|
+
validateSequence(p->file(), p->line(), p->type(), p->getMetaData());
|
2522
|
+
}
|
2523
|
+
|
2524
|
+
void
|
2525
|
+
Slice::Python::MetaDataVisitor::visitSequence(const SequencePtr& p)
|
2526
|
+
{
|
2527
|
+
static const string protobuf = "python:protobuf:";
|
2528
|
+
StringList metaData = p->getMetaData();
|
2529
|
+
const string file = p->file();
|
2530
|
+
const string line = p->line();
|
2531
|
+
for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); )
|
2532
|
+
{
|
2533
|
+
string s = *q++;
|
2534
|
+
if(s.find(protobuf) == 0)
|
2535
|
+
{
|
2536
|
+
//
|
2537
|
+
// Remove from list so validateSequence does not try to handle as well.
|
2538
|
+
//
|
2539
|
+
metaData.remove(s);
|
2540
|
+
|
2541
|
+
BuiltinPtr builtin = BuiltinPtr::dynamicCast(p->type());
|
2542
|
+
if(!builtin || builtin->kind() != Builtin::KindByte)
|
2543
|
+
{
|
2544
|
+
emitWarning(file, line, "ignoring invalid metadata `" + s + ": " +
|
2545
|
+
"`protobuf' encoding must be a byte sequence");
|
2546
|
+
}
|
2547
|
+
}
|
2548
|
+
}
|
2549
|
+
|
2550
|
+
validateSequence(file, line, p, metaData);
|
2551
|
+
}
|
2552
|
+
|
2553
|
+
void
|
2554
|
+
Slice::Python::MetaDataVisitor::visitDictionary(const DictionaryPtr& p)
|
2555
|
+
{
|
2556
|
+
reject(p);
|
2557
|
+
}
|
2558
|
+
|
2559
|
+
void
|
2560
|
+
Slice::Python::MetaDataVisitor::visitEnum(const EnumPtr& p)
|
2561
|
+
{
|
2562
|
+
reject(p);
|
2563
|
+
}
|
2564
|
+
|
2565
|
+
void
|
2566
|
+
Slice::Python::MetaDataVisitor::visitConst(const ConstPtr& p)
|
2567
|
+
{
|
2568
|
+
reject(p);
|
2569
|
+
}
|
2570
|
+
|
2571
|
+
void
|
2572
|
+
Slice::Python::MetaDataVisitor::validateSequence(const string& file, const string& line,
|
2573
|
+
const TypePtr& type, const StringList& meta)
|
2574
|
+
{
|
2575
|
+
static const string prefix = "python:";
|
2576
|
+
|
2577
|
+
for(StringList::const_iterator p = meta.begin(); p != meta.end(); ++p)
|
2578
|
+
{
|
2579
|
+
string s = *p;
|
2580
|
+
if(s.find(prefix) == 0)
|
2581
|
+
{
|
2582
|
+
string::size_type pos = s.find(':', prefix.size());
|
2583
|
+
if(pos != string::npos && s.substr(prefix.size(), pos - prefix.size()) == "seq")
|
2584
|
+
{
|
2585
|
+
static const string seqPrefix = "python:seq:";
|
2586
|
+
string arg = s.substr(seqPrefix.size(), pos - seqPrefix.size());
|
2587
|
+
if(SequencePtr::dynamicCast(type))
|
2588
|
+
{
|
2589
|
+
if(arg == "tuple" || arg == "list" || arg == "default")
|
2590
|
+
{
|
2591
|
+
continue;
|
2592
|
+
}
|
2593
|
+
}
|
2594
|
+
}
|
2595
|
+
emitWarning(file, line, "ignoring invalid metadata `" + s + "'");
|
2596
|
+
}
|
2597
|
+
}
|
2598
|
+
}
|
2599
|
+
|
2600
|
+
void
|
2601
|
+
Slice::Python::MetaDataVisitor::reject(const ContainedPtr& cont)
|
2602
|
+
{
|
2603
|
+
StringList localMetaData = cont->getMetaData();
|
2604
|
+
|
2605
|
+
static const string prefix = "python:";
|
2606
|
+
|
2607
|
+
for(StringList::const_iterator p = localMetaData.begin(); p != localMetaData.end(); ++p)
|
2608
|
+
{
|
2609
|
+
if(p->find(prefix) == 0)
|
2610
|
+
{
|
2611
|
+
emitWarning(cont->file(), cont->line(), "ignoring invalid metadata `" + *p + "'");
|
2612
|
+
}
|
2613
|
+
}
|
2614
|
+
}
|