zeroc-ice 3.7.10 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/dist/IceRuby/Communicator.cpp +575 -0
- data/dist/IceRuby/Communicator.h +19 -0
- data/dist/IceRuby/Config.h +77 -0
- data/dist/IceRuby/Connection.cpp +428 -0
- data/dist/IceRuby/Connection.h +20 -0
- data/dist/IceRuby/DefaultSliceLoader.cpp +45 -0
- data/dist/IceRuby/DefaultSliceLoader.h +25 -0
- data/dist/IceRuby/Endpoint.cpp +342 -0
- data/dist/IceRuby/Endpoint.h +18 -0
- data/dist/IceRuby/ImplicitContext.cpp +143 -0
- data/dist/IceRuby/ImplicitContext.h +16 -0
- data/dist/IceRuby/Init.cpp +36 -0
- data/dist/IceRuby/Logger.cpp +146 -0
- data/dist/IceRuby/Logger.h +19 -0
- data/dist/IceRuby/Operation.cpp +623 -0
- data/dist/IceRuby/Operation.h +28 -0
- data/dist/IceRuby/Properties.cpp +413 -0
- data/dist/IceRuby/Properties.h +16 -0
- data/dist/IceRuby/Proxy.cpp +926 -0
- data/dist/IceRuby/Proxy.h +21 -0
- data/dist/IceRuby/RubySliceLoader.cpp +39 -0
- data/dist/IceRuby/RubySliceLoader.h +27 -0
- data/dist/IceRuby/Slice.cpp +199 -0
- data/dist/IceRuby/Slice.h +13 -0
- data/dist/IceRuby/Types.cpp +3133 -0
- data/dist/IceRuby/Types.h +533 -0
- data/dist/IceRuby/Util.cpp +553 -0
- data/dist/IceRuby/Util.h +485 -0
- data/dist/ice/cpp/include/Ice/AsyncResponseHandler.h +85 -0
- data/dist/ice/cpp/include/Ice/BatchRequest.h +39 -0
- data/dist/ice/cpp/include/Ice/BatchRequestQueueF.h +14 -0
- data/dist/ice/cpp/include/Ice/Buffer.h +159 -0
- data/dist/ice/cpp/include/Ice/Communicator.h +411 -0
- data/dist/ice/cpp/include/Ice/CommunicatorF.h +16 -0
- data/dist/ice/cpp/include/Ice/Config.h +60 -0
- data/dist/ice/cpp/include/Ice/Connection.h +410 -0
- data/dist/ice/cpp/include/Ice/ConnectionF.h +36 -0
- data/dist/ice/cpp/include/Ice/ConnectionIF.h +16 -0
- data/dist/ice/cpp/include/Ice/CtrlCHandler.h +56 -0
- data/dist/ice/cpp/include/Ice/Current.h +60 -0
- data/dist/ice/cpp/include/Ice/DefaultSliceLoader.h +160 -0
- data/dist/ice/cpp/include/Ice/Demangle.h +17 -0
- data/dist/ice/cpp/include/Ice/Endpoint.h +298 -0
- data/dist/ice/cpp/include/Ice/EndpointF.h +44 -0
- data/dist/ice/cpp/include/Ice/EndpointSelectionType.h +21 -0
- data/dist/ice/cpp/include/Ice/Exception.h +56 -0
- data/dist/ice/cpp/include/Ice/FacetMap.h +16 -0
- data/dist/ice/cpp/include/Ice/Format.h +22 -0
- data/dist/ice/cpp/include/Ice/Ice.h +60 -0
- data/dist/ice/cpp/include/Ice/IconvStringConverter.h +216 -0
- data/dist/ice/cpp/include/Ice/ImplicitContext.h +76 -0
- data/dist/ice/cpp/include/Ice/IncomingRequest.h +75 -0
- data/dist/ice/cpp/include/Ice/Initialize.h +143 -0
- data/dist/ice/cpp/include/Ice/InputStream.h +942 -0
- data/dist/ice/cpp/include/Ice/InstanceF.h +14 -0
- data/dist/ice/cpp/include/Ice/Instrumentation.h +319 -0
- data/dist/ice/cpp/include/Ice/LocalException.h +58 -0
- data/dist/ice/cpp/include/Ice/LocalExceptions.h +870 -0
- data/dist/ice/cpp/include/Ice/Logger.h +62 -0
- data/dist/ice/cpp/include/Ice/LoggerUtil.h +162 -0
- data/dist/ice/cpp/include/Ice/MarshaledResult.h +50 -0
- data/dist/ice/cpp/include/Ice/NativePropertiesAdmin.h +54 -0
- data/dist/ice/cpp/include/Ice/Object.h +168 -0
- data/dist/ice/cpp/include/Ice/ObjectAdapter.h +324 -0
- data/dist/ice/cpp/include/Ice/ObjectAdapterF.h +16 -0
- data/dist/ice/cpp/include/Ice/ObjectF.h +16 -0
- data/dist/ice/cpp/include/Ice/ObserverHelper.h +164 -0
- data/dist/ice/cpp/include/Ice/OutgoingAsync.h +512 -0
- data/dist/ice/cpp/include/Ice/OutgoingResponse.h +129 -0
- data/dist/ice/cpp/include/Ice/OutputStream.h +872 -0
- data/dist/ice/cpp/include/Ice/Plugin.h +73 -0
- data/dist/ice/cpp/include/Ice/PluginFactory.h +77 -0
- data/dist/ice/cpp/include/Ice/PopDisableWarnings.h +16 -0
- data/dist/ice/cpp/include/Ice/Properties.h +307 -0
- data/dist/ice/cpp/include/Ice/PropertiesF.h +19 -0
- data/dist/ice/cpp/include/Ice/Proxy.h +742 -0
- data/dist/ice/cpp/include/Ice/ProxyF.h +11 -0
- data/dist/ice/cpp/include/Ice/ProxyFunctions.h +209 -0
- data/dist/ice/cpp/include/Ice/PushDisableWarnings.h +29 -0
- data/dist/ice/cpp/include/Ice/ReferenceF.h +14 -0
- data/dist/ice/cpp/include/Ice/RequestHandlerF.h +20 -0
- data/dist/ice/cpp/include/Ice/SSL/ClientAuthenticationOptions.h +268 -0
- data/dist/ice/cpp/include/Ice/SSL/Config.h +54 -0
- data/dist/ice/cpp/include/Ice/SSL/ConnectionInfo.h +107 -0
- data/dist/ice/cpp/include/Ice/SSL/ConnectionInfoF.h +39 -0
- data/dist/ice/cpp/include/Ice/SSL/EndpointInfo.h +40 -0
- data/dist/ice/cpp/include/Ice/SSL/SSLException.h +32 -0
- data/dist/ice/cpp/include/Ice/SSL/ServerAuthenticationOptions.h +278 -0
- data/dist/ice/cpp/include/Ice/ServantLocator.h +51 -0
- data/dist/ice/cpp/include/Ice/Service.h +219 -0
- data/dist/ice/cpp/include/Ice/SliceLoader.h +67 -0
- data/dist/ice/cpp/include/Ice/SlicedData.h +125 -0
- data/dist/ice/cpp/include/Ice/SlicedDataF.h +30 -0
- data/dist/ice/cpp/include/Ice/StreamHelpers.h +652 -0
- data/dist/ice/cpp/include/Ice/StreamableTraits.h +291 -0
- data/dist/ice/cpp/include/Ice/StringConverter.h +167 -0
- data/dist/ice/cpp/include/Ice/StringUtil.h +114 -0
- data/dist/ice/cpp/include/Ice/TimerTask.h +24 -0
- data/dist/ice/cpp/include/Ice/TupleCompare.h +103 -0
- data/dist/ice/cpp/include/Ice/UUID.h +16 -0
- data/dist/ice/cpp/include/Ice/UserException.h +46 -0
- data/dist/ice/cpp/include/Ice/UserExceptionFactory.h +15 -0
- data/dist/ice/cpp/include/Ice/Value.h +127 -0
- data/dist/ice/cpp/include/Ice/ValueF.h +16 -0
- data/dist/ice/cpp/include/IceDiscovery/IceDiscovery.h +28 -0
- data/dist/ice/cpp/include/IceLocatorDiscovery/IceLocatorDiscovery.h +28 -0
- data/dist/ice/cpp/include/generated/Ice/BuiltinSequences.h +70 -0
- data/dist/ice/cpp/include/generated/Ice/Context.h +40 -0
- data/dist/ice/cpp/include/generated/Ice/EndpointTypes.h +74 -0
- data/dist/ice/cpp/include/generated/Ice/Identity.h +108 -0
- data/dist/ice/cpp/include/generated/Ice/Locator.h +542 -0
- data/dist/ice/cpp/include/generated/Ice/LocatorRegistry.h +443 -0
- data/dist/ice/cpp/include/generated/Ice/Metrics.h +1103 -0
- data/dist/ice/cpp/include/generated/Ice/OperationMode.h +73 -0
- data/dist/ice/cpp/include/generated/Ice/Process.h +245 -0
- data/dist/ice/cpp/include/generated/Ice/PropertiesAdmin.h +314 -0
- data/dist/ice/cpp/include/generated/Ice/PropertyDict.h +39 -0
- data/dist/ice/cpp/include/generated/Ice/RemoteLogger.h +724 -0
- data/dist/ice/cpp/include/generated/Ice/ReplyStatus.h +94 -0
- data/dist/ice/cpp/include/generated/Ice/Router.h +496 -0
- data/dist/ice/cpp/include/generated/Ice/SliceChecksumDict.h +37 -0
- data/dist/ice/cpp/include/generated/Ice/Version.h +112 -0
- data/dist/ice/cpp/include/generated/IceDiscovery/Lookup.h +498 -0
- data/dist/ice/cpp/include/generated/IceLocatorDiscovery/Lookup.h +387 -0
- data/dist/ice/cpp/src/Ice/Acceptor.h +41 -0
- data/dist/ice/cpp/src/Ice/AcceptorF.h +17 -0
- data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories.h +16 -0
- data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories_all.cpp +43 -0
- data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories_min.cpp +17 -0
- data/dist/ice/cpp/src/Ice/ArgVector.cpp +58 -0
- data/dist/ice/cpp/src/Ice/ArgVector.h +30 -0
- data/dist/ice/cpp/src/Ice/Base64.cpp +263 -0
- data/dist/ice/cpp/src/Ice/Base64.h +26 -0
- data/dist/ice/cpp/src/Ice/BatchRequestQueue.cpp +199 -0
- data/dist/ice/cpp/src/Ice/BatchRequestQueue.h +49 -0
- data/dist/ice/cpp/src/Ice/Buffer.cpp +187 -0
- data/dist/ice/cpp/src/Ice/CheckIdentity.h +21 -0
- data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +373 -0
- data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.h +65 -0
- data/dist/ice/cpp/src/Ice/Communicator.cpp +399 -0
- data/dist/ice/cpp/src/Ice/CommunicatorFlushBatchAsync.cpp +140 -0
- data/dist/ice/cpp/src/Ice/CommunicatorFlushBatchAsync.h +39 -0
- data/dist/ice/cpp/src/Ice/ConnectRequestHandler.cpp +227 -0
- data/dist/ice/cpp/src/Ice/ConnectRequestHandler.h +51 -0
- data/dist/ice/cpp/src/Ice/ConnectRequestHandlerF.h +14 -0
- data/dist/ice/cpp/src/Ice/Connection.cpp +44 -0
- data/dist/ice/cpp/src/Ice/ConnectionFactory.cpp +1758 -0
- data/dist/ice/cpp/src/Ice/ConnectionFactory.h +264 -0
- data/dist/ice/cpp/src/Ice/ConnectionFactoryF.h +17 -0
- data/dist/ice/cpp/src/Ice/ConnectionI.cpp +3563 -0
- data/dist/ice/cpp/src/Ice/ConnectionI.h +429 -0
- data/dist/ice/cpp/src/Ice/ConnectionOptions.h +22 -0
- data/dist/ice/cpp/src/Ice/Connector.h +38 -0
- data/dist/ice/cpp/src/Ice/ConnectorF.h +14 -0
- data/dist/ice/cpp/src/Ice/ConsoleUtil.cpp +136 -0
- data/dist/ice/cpp/src/Ice/ConsoleUtil.h +79 -0
- data/dist/ice/cpp/src/Ice/CtrlCHandler.cpp +189 -0
- data/dist/ice/cpp/src/Ice/Current.cpp +29 -0
- data/dist/ice/cpp/src/Ice/DLLMain.cpp +40 -0
- data/dist/ice/cpp/src/Ice/DefaultSliceLoader.cpp +39 -0
- data/dist/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +81 -0
- data/dist/ice/cpp/src/Ice/DefaultsAndOverrides.h +38 -0
- data/dist/ice/cpp/src/Ice/DefaultsAndOverridesF.h +14 -0
- data/dist/ice/cpp/src/Ice/Demangle.cpp +25 -0
- data/dist/ice/cpp/src/Ice/DisableWarnings.h +31 -0
- data/dist/ice/cpp/src/Ice/DynamicLibrary.cpp +216 -0
- data/dist/ice/cpp/src/Ice/DynamicLibrary.h +91 -0
- data/dist/ice/cpp/src/Ice/Endian.h +40 -0
- data/dist/ice/cpp/src/Ice/EndpointFactory.cpp +165 -0
- data/dist/ice/cpp/src/Ice/EndpointFactory.h +96 -0
- data/dist/ice/cpp/src/Ice/EndpointFactoryF.h +14 -0
- data/dist/ice/cpp/src/Ice/EndpointFactoryManager.cpp +180 -0
- data/dist/ice/cpp/src/Ice/EndpointFactoryManager.h +42 -0
- data/dist/ice/cpp/src/Ice/EndpointFactoryManagerF.h +14 -0
- data/dist/ice/cpp/src/Ice/EndpointI.cpp +128 -0
- data/dist/ice/cpp/src/Ice/EndpointI.h +150 -0
- data/dist/ice/cpp/src/Ice/EndpointIF.h +21 -0
- data/dist/ice/cpp/src/Ice/EventHandler.cpp +9 -0
- data/dist/ice/cpp/src/Ice/EventHandler.h +71 -0
- data/dist/ice/cpp/src/Ice/EventHandlerF.h +14 -0
- data/dist/ice/cpp/src/Ice/Exception.cpp +5 -0
- data/dist/ice/cpp/src/Ice/FileUtil.cpp +476 -0
- data/dist/ice/cpp/src/Ice/FileUtil.h +152 -0
- data/dist/ice/cpp/src/Ice/FixedRequestHandler.cpp +34 -0
- data/dist/ice/cpp/src/Ice/FixedRequestHandler.h +29 -0
- data/dist/ice/cpp/src/Ice/HashUtil.h +67 -0
- data/dist/ice/cpp/src/Ice/HttpParser.cpp +684 -0
- data/dist/ice/cpp/src/Ice/HttpParser.h +112 -0
- data/dist/ice/cpp/src/Ice/IPEndpointI.cpp +593 -0
- data/dist/ice/cpp/src/Ice/IPEndpointI.h +106 -0
- data/dist/ice/cpp/src/Ice/IPEndpointIF.h +17 -0
- data/dist/ice/cpp/src/Ice/IdleTimeoutTransceiverDecorator.cpp +172 -0
- data/dist/ice/cpp/src/Ice/IdleTimeoutTransceiverDecorator.h +89 -0
- data/dist/ice/cpp/src/Ice/ImplicitContext.cpp +109 -0
- data/dist/ice/cpp/src/Ice/IncomingRequest.cpp +66 -0
- data/dist/ice/cpp/src/Ice/Initialize.cpp +160 -0
- data/dist/ice/cpp/src/Ice/InputStream.cpp +2206 -0
- data/dist/ice/cpp/src/Ice/Instance.cpp +1956 -0
- data/dist/ice/cpp/src/Ice/Instance.h +225 -0
- data/dist/ice/cpp/src/Ice/InstrumentationI.cpp +959 -0
- data/dist/ice/cpp/src/Ice/InstrumentationI.h +235 -0
- data/dist/ice/cpp/src/Ice/LocalException.cpp +518 -0
- data/dist/ice/cpp/src/Ice/LocalExceptions.cpp +577 -0
- data/dist/ice/cpp/src/Ice/LocatorInfo.cpp +851 -0
- data/dist/ice/cpp/src/Ice/LocatorInfo.h +176 -0
- data/dist/ice/cpp/src/Ice/LocatorInfoF.h +20 -0
- data/dist/ice/cpp/src/Ice/LoggerAdminI.cpp +774 -0
- data/dist/ice/cpp/src/Ice/LoggerAdminI.h +31 -0
- data/dist/ice/cpp/src/Ice/LoggerI.cpp +234 -0
- data/dist/ice/cpp/src/Ice/LoggerI.h +47 -0
- data/dist/ice/cpp/src/Ice/LoggerMiddleware.cpp +176 -0
- data/dist/ice/cpp/src/Ice/LoggerMiddleware.h +42 -0
- data/dist/ice/cpp/src/Ice/LoggerUtil.cpp +76 -0
- data/dist/ice/cpp/src/Ice/MarshaledResult.cpp +20 -0
- data/dist/ice/cpp/src/Ice/MetricsAdminI.cpp +608 -0
- data/dist/ice/cpp/src/Ice/MetricsAdminI.h +600 -0
- data/dist/ice/cpp/src/Ice/MetricsFunctional.h +92 -0
- data/dist/ice/cpp/src/Ice/MetricsObserverI.h +587 -0
- data/dist/ice/cpp/src/Ice/NativePropertiesAdmin.cpp +185 -0
- data/dist/ice/cpp/src/Ice/Network.cpp +1927 -0
- data/dist/ice/cpp/src/Ice/Network.h +265 -0
- data/dist/ice/cpp/src/Ice/NetworkF.h +11 -0
- data/dist/ice/cpp/src/Ice/NetworkProxy.cpp +306 -0
- data/dist/ice/cpp/src/Ice/NetworkProxy.h +67 -0
- data/dist/ice/cpp/src/Ice/NetworkProxyF.h +14 -0
- data/dist/ice/cpp/src/Ice/OSLogLoggerI.cpp +55 -0
- data/dist/ice/cpp/src/Ice/OSLogLoggerI.h +35 -0
- data/dist/ice/cpp/src/Ice/Object.cpp +249 -0
- data/dist/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +348 -0
- data/dist/ice/cpp/src/Ice/ObjectAdapterFactory.h +53 -0
- data/dist/ice/cpp/src/Ice/ObjectAdapterFactoryF.h +14 -0
- data/dist/ice/cpp/src/Ice/ObjectAdapterI.cpp +1383 -0
- data/dist/ice/cpp/src/Ice/ObjectAdapterI.h +163 -0
- data/dist/ice/cpp/src/Ice/ObserverHelper.cpp +75 -0
- data/dist/ice/cpp/src/Ice/ObserverMiddleware.cpp +96 -0
- data/dist/ice/cpp/src/Ice/ObserverMiddleware.h +25 -0
- data/dist/ice/cpp/src/Ice/OpaqueEndpointI.cpp +368 -0
- data/dist/ice/cpp/src/Ice/OpaqueEndpointI.h +66 -0
- data/dist/ice/cpp/src/Ice/Options.cpp +980 -0
- data/dist/ice/cpp/src/Ice/Options.h +119 -0
- data/dist/ice/cpp/src/Ice/OutgoingAsync.cpp +1106 -0
- data/dist/ice/cpp/src/Ice/OutgoingResponse.cpp +276 -0
- data/dist/ice/cpp/src/Ice/OutputStream.cpp +1454 -0
- data/dist/ice/cpp/src/Ice/OutputUtil.cpp +344 -0
- data/dist/ice/cpp/src/Ice/OutputUtil.h +173 -0
- data/dist/ice/cpp/src/Ice/PluginManagerI.cpp +344 -0
- data/dist/ice/cpp/src/Ice/PluginManagerI.h +54 -0
- data/dist/ice/cpp/src/Ice/Properties.cpp +931 -0
- data/dist/ice/cpp/src/Ice/PropertyNames.cpp +606 -0
- data/dist/ice/cpp/src/Ice/PropertyNames.h +63 -0
- data/dist/ice/cpp/src/Ice/PropertyUtil.cpp +103 -0
- data/dist/ice/cpp/src/Ice/PropertyUtil.h +31 -0
- data/dist/ice/cpp/src/Ice/Protocol.cpp +159 -0
- data/dist/ice/cpp/src/Ice/Protocol.h +116 -0
- data/dist/ice/cpp/src/Ice/ProtocolInstance.cpp +186 -0
- data/dist/ice/cpp/src/Ice/ProtocolInstance.h +74 -0
- data/dist/ice/cpp/src/Ice/ProtocolInstanceF.h +14 -0
- data/dist/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +29 -0
- data/dist/ice/cpp/src/Ice/ProtocolPluginFacade.h +35 -0
- data/dist/ice/cpp/src/Ice/Proxy.cpp +541 -0
- data/dist/ice/cpp/src/Ice/ProxyAsync.cpp +684 -0
- data/dist/ice/cpp/src/Ice/ProxyFunctions.cpp +90 -0
- data/dist/ice/cpp/src/Ice/PushDisableDeprecatedWarnings.h +15 -0
- data/dist/ice/cpp/src/Ice/Random.cpp +29 -0
- data/dist/ice/cpp/src/Ice/Random.h +23 -0
- data/dist/ice/cpp/src/Ice/Reference.cpp +1584 -0
- data/dist/ice/cpp/src/Ice/Reference.h +339 -0
- data/dist/ice/cpp/src/Ice/ReferenceFactory.cpp +830 -0
- data/dist/ice/cpp/src/Ice/ReferenceFactory.h +58 -0
- data/dist/ice/cpp/src/Ice/ReferenceFactoryF.h +14 -0
- data/dist/ice/cpp/src/Ice/RequestHandler.cpp +28 -0
- data/dist/ice/cpp/src/Ice/RequestHandler.h +53 -0
- data/dist/ice/cpp/src/Ice/RequestHandlerCache.cpp +76 -0
- data/dist/ice/cpp/src/Ice/RequestHandlerCache.h +33 -0
- data/dist/ice/cpp/src/Ice/ResourceConfig.h +27 -0
- data/dist/ice/cpp/src/Ice/RetryQueue.cpp +151 -0
- data/dist/ice/cpp/src/Ice/RetryQueue.h +59 -0
- data/dist/ice/cpp/src/Ice/RetryQueueF.h +14 -0
- data/dist/ice/cpp/src/Ice/RouterInfo.cpp +275 -0
- data/dist/ice/cpp/src/Ice/RouterInfo.h +95 -0
- data/dist/ice/cpp/src/Ice/RouterInfoF.h +17 -0
- data/dist/ice/cpp/src/Ice/SHA1.cpp +195 -0
- data/dist/ice/cpp/src/Ice/SHA1.h +35 -0
- data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.cpp +89 -0
- data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.h +87 -0
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.cpp +513 -0
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.h +40 -0
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngineF.h +13 -0
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.cpp +635 -0
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.h +80 -0
- data/dist/ice/cpp/src/Ice/SSL/RFC2253.cpp +487 -0
- data/dist/ice/cpp/src/Ice/SSL/RFC2253.h +58 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLAcceptorI.cpp +124 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLAcceptorI.h +52 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLConnectorI.cpp +92 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLConnectorI.h +38 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLEndpointI.cpp +377 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLEndpointI.h +84 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLEngine.cpp +115 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLEngine.h +72 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLEngineF.h +14 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLException.cpp +18 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLInstance.cpp +27 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLInstance.h +26 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLInstanceF.h +19 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLUtil.cpp +654 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLUtil.h +104 -0
- data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.cpp +1437 -0
- data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.h +58 -0
- data/dist/ice/cpp/src/Ice/SSL/SchannelEngineF.h +18 -0
- data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.cpp +1085 -0
- data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.h +118 -0
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.cpp +822 -0
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.h +44 -0
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngineF.h +18 -0
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportTransceiverI.cpp +621 -0
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportTransceiverI.h +91 -0
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.cpp +1061 -0
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.h +40 -0
- data/dist/ice/cpp/src/Ice/SSL/TrustManager.cpp +222 -0
- data/dist/ice/cpp/src/Ice/SSL/TrustManager.h +42 -0
- data/dist/ice/cpp/src/Ice/SSL/TrustManagerF.h +14 -0
- data/dist/ice/cpp/src/Ice/ScannerConfig.h +35 -0
- data/dist/ice/cpp/src/Ice/Selector.cpp +1270 -0
- data/dist/ice/cpp/src/Ice/Selector.h +235 -0
- data/dist/ice/cpp/src/Ice/ServantManager.cpp +547 -0
- data/dist/ice/cpp/src/Ice/ServantManager.h +66 -0
- data/dist/ice/cpp/src/Ice/ServantManagerF.h +14 -0
- data/dist/ice/cpp/src/Ice/Service.cpp +1790 -0
- data/dist/ice/cpp/src/Ice/SharedContext.h +33 -0
- data/dist/ice/cpp/src/Ice/SliceLoader.cpp +53 -0
- data/dist/ice/cpp/src/Ice/SlicedData.cpp +48 -0
- data/dist/ice/cpp/src/Ice/StreamSocket.cpp +472 -0
- data/dist/ice/cpp/src/Ice/StreamSocket.h +73 -0
- data/dist/ice/cpp/src/Ice/StringConverter.cpp +582 -0
- data/dist/ice/cpp/src/Ice/StringUtil.cpp +1137 -0
- data/dist/ice/cpp/src/Ice/SysLoggerI.cpp +160 -0
- data/dist/ice/cpp/src/Ice/SysLoggerI.h +34 -0
- data/dist/ice/cpp/src/Ice/SystemdJournalI.cpp +65 -0
- data/dist/ice/cpp/src/Ice/SystemdJournalI.h +33 -0
- data/dist/ice/cpp/src/Ice/TargetCompare.h +96 -0
- data/dist/ice/cpp/src/Ice/TcpAcceptor.cpp +213 -0
- data/dist/ice/cpp/src/Ice/TcpAcceptor.h +55 -0
- data/dist/ice/cpp/src/Ice/TcpConnector.cpp +128 -0
- data/dist/ice/cpp/src/Ice/TcpConnector.h +36 -0
- data/dist/ice/cpp/src/Ice/TcpEndpointI.cpp +411 -0
- data/dist/ice/cpp/src/Ice/TcpEndpointI.h +86 -0
- data/dist/ice/cpp/src/Ice/TcpTransceiver.cpp +147 -0
- data/dist/ice/cpp/src/Ice/TcpTransceiver.h +53 -0
- data/dist/ice/cpp/src/Ice/ThreadPool.cpp +1110 -0
- data/dist/ice/cpp/src/Ice/ThreadPool.h +305 -0
- data/dist/ice/cpp/src/Ice/ThreadPoolF.h +14 -0
- data/dist/ice/cpp/src/Ice/TimeUtil.cpp +47 -0
- data/dist/ice/cpp/src/Ice/TimeUtil.h +21 -0
- data/dist/ice/cpp/src/Ice/Timer.cpp +169 -0
- data/dist/ice/cpp/src/Ice/Timer.h +212 -0
- data/dist/ice/cpp/src/Ice/TraceLevels.cpp +20 -0
- data/dist/ice/cpp/src/Ice/TraceLevels.h +39 -0
- data/dist/ice/cpp/src/Ice/TraceLevelsF.h +14 -0
- data/dist/ice/cpp/src/Ice/TraceUtil.cpp +399 -0
- data/dist/ice/cpp/src/Ice/TraceUtil.h +41 -0
- data/dist/ice/cpp/src/Ice/Transceiver.cpp +14 -0
- data/dist/ice/cpp/src/Ice/Transceiver.h +52 -0
- data/dist/ice/cpp/src/Ice/TransceiverF.h +23 -0
- data/dist/ice/cpp/src/Ice/UUID.cpp +79 -0
- data/dist/ice/cpp/src/Ice/UdpConnector.cpp +131 -0
- data/dist/ice/cpp/src/Ice/UdpConnector.h +36 -0
- data/dist/ice/cpp/src/Ice/UdpEndpointI.cpp +480 -0
- data/dist/ice/cpp/src/Ice/UdpEndpointI.h +92 -0
- data/dist/ice/cpp/src/Ice/UdpTransceiver.cpp +786 -0
- data/dist/ice/cpp/src/Ice/UdpTransceiver.h +90 -0
- data/dist/ice/cpp/src/Ice/UndefSysMacros.h +37 -0
- data/dist/ice/cpp/src/Ice/UniqueRef.h +77 -0
- data/dist/ice/cpp/src/Ice/UserException.cpp +58 -0
- data/dist/ice/cpp/src/Ice/Value.cpp +145 -0
- data/dist/ice/cpp/src/Ice/WSAcceptor.cpp +87 -0
- data/dist/ice/cpp/src/Ice/WSAcceptor.h +46 -0
- data/dist/ice/cpp/src/Ice/WSConnector.cpp +87 -0
- data/dist/ice/cpp/src/Ice/WSConnector.h +36 -0
- data/dist/ice/cpp/src/Ice/WSEndpoint.cpp +455 -0
- data/dist/ice/cpp/src/Ice/WSEndpoint.h +82 -0
- data/dist/ice/cpp/src/Ice/WSTransceiver.cpp +1715 -0
- data/dist/ice/cpp/src/Ice/WSTransceiver.h +135 -0
- data/dist/ice/cpp/src/Ice/generated/BuiltinSequences.cpp +40 -0
- data/dist/ice/cpp/src/Ice/generated/Context.cpp +40 -0
- data/dist/ice/cpp/src/Ice/generated/EndpointTypes.cpp +40 -0
- data/dist/ice/cpp/src/Ice/generated/Identity.cpp +47 -0
- data/dist/ice/cpp/src/Ice/generated/Locator.cpp +752 -0
- data/dist/ice/cpp/src/Ice/generated/LocatorRegistry.cpp +577 -0
- data/dist/ice/cpp/src/Ice/generated/Metrics.cpp +1205 -0
- data/dist/ice/cpp/src/Ice/generated/OperationMode.cpp +56 -0
- data/dist/ice/cpp/src/Ice/generated/Process.cpp +330 -0
- data/dist/ice/cpp/src/Ice/generated/PropertiesAdmin.cpp +443 -0
- data/dist/ice/cpp/src/Ice/generated/PropertyDict.cpp +40 -0
- data/dist/ice/cpp/src/Ice/generated/RemoteLogger.cpp +851 -0
- data/dist/ice/cpp/src/Ice/generated/ReplyStatus.cpp +70 -0
- data/dist/ice/cpp/src/Ice/generated/Router.cpp +660 -0
- data/dist/ice/cpp/src/Ice/generated/SliceChecksumDict.cpp +39 -0
- data/dist/ice/cpp/src/Ice/generated/Version.cpp +54 -0
- data/dist/ice/cpp/src/IceDiscovery/LocatorI.cpp +202 -0
- data/dist/ice/cpp/src/IceDiscovery/LocatorI.h +68 -0
- data/dist/ice/cpp/src/IceDiscovery/LookupI.cpp +494 -0
- data/dist/ice/cpp/src/IceDiscovery/LookupI.h +168 -0
- data/dist/ice/cpp/src/IceDiscovery/PluginI.cpp +155 -0
- data/dist/ice/cpp/src/IceDiscovery/PluginI.h +31 -0
- data/dist/ice/cpp/src/IceDiscovery/generated/Lookup.cpp +638 -0
- data/dist/ice/cpp/src/IceLocatorDiscovery/Plugin.h +24 -0
- data/dist/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +822 -0
- data/dist/ice/cpp/src/IceLocatorDiscovery/generated/Lookup.cpp +468 -0
- data/dist/ice/cpp/src/Slice/DeprecationReporter.cpp +172 -0
- data/dist/ice/cpp/src/Slice/DeprecationReporter.h +14 -0
- data/dist/ice/cpp/src/Slice/DocCommentParser.cpp +736 -0
- data/dist/ice/cpp/src/Slice/DocCommentParser.h +61 -0
- data/dist/ice/cpp/src/Slice/FileTracker.cpp +96 -0
- data/dist/ice/cpp/src/Slice/FileTracker.h +44 -0
- data/dist/ice/cpp/src/Slice/Grammar.cpp +4125 -0
- data/dist/ice/cpp/src/Slice/Grammar.h +138 -0
- data/dist/ice/cpp/src/Slice/GrammarUtil.h +128 -0
- data/dist/ice/cpp/src/Slice/MetadataValidation.cpp +473 -0
- data/dist/ice/cpp/src/Slice/MetadataValidation.h +106 -0
- data/dist/ice/cpp/src/Slice/Parser.cpp +4906 -0
- data/dist/ice/cpp/src/Slice/Parser.h +1175 -0
- data/dist/ice/cpp/src/Slice/Preprocessor.cpp +295 -0
- data/dist/ice/cpp/src/Slice/Preprocessor.h +44 -0
- data/dist/ice/cpp/src/Slice/Scanner.cpp +3445 -0
- data/dist/ice/cpp/src/Slice/SliceUtil.cpp +790 -0
- data/dist/ice/cpp/src/Slice/StringLiteralUtil.cpp +448 -0
- data/dist/ice/cpp/src/Slice/Util.h +134 -0
- data/dist/ice/cpp/src/slice2rb/Main.cpp +33 -0
- data/dist/ice/cpp/src/slice2rb/Ruby.cpp +250 -0
- data/dist/ice/cpp/src/slice2rb/RubyUtil.cpp +1197 -0
- data/dist/ice/cpp/src/slice2rb/RubyUtil.h +56 -0
- data/dist/ice/mcpp/internal.H +530 -0
- data/dist/ice/mcpp/system.c +2741 -0
- data/dist/ice/slice/Glacier2/Metrics.ice +47 -0
- data/dist/ice/slice/Glacier2/PermissionsVerifier.ice +55 -0
- data/dist/ice/slice/Glacier2/Router.ice +93 -0
- data/dist/ice/slice/Glacier2/SSLInfo.ice +42 -0
- data/dist/ice/slice/Glacier2/Session.ice +133 -0
- data/dist/ice/slice/Ice/BuiltinSequences.ice +54 -0
- data/dist/ice/slice/Ice/Context.ice +24 -0
- data/dist/ice/slice/Ice/EndpointTypes.ice +50 -0
- data/dist/ice/slice/Ice/Identity.ice +36 -0
- data/dist/ice/slice/Ice/Locator.ice +74 -0
- data/dist/ice/slice/Ice/LocatorRegistry.ice +77 -0
- data/dist/ice/slice/Ice/Metrics.ice +201 -0
- data/dist/ice/slice/Ice/OperationMode.ice +38 -0
- data/dist/ice/slice/Ice/Process.ice +28 -0
- data/dist/ice/slice/Ice/PropertiesAdmin.ice +37 -0
- data/dist/ice/slice/Ice/PropertyDict.ice +23 -0
- data/dist/ice/slice/Ice/RemoteLogger.ice +126 -0
- data/dist/ice/slice/Ice/ReplyStatus.ice +65 -0
- data/dist/ice/slice/Ice/Router.ice +54 -0
- data/dist/ice/slice/Ice/SliceChecksumDict.ice +18 -0
- data/dist/ice/slice/Ice/Version.ice +43 -0
- data/dist/ice/slice/IceBox/ServiceManager.ice +79 -0
- data/dist/ice/slice/IceGrid/Admin.ice +981 -0
- data/dist/ice/slice/IceGrid/Descriptor.ice +519 -0
- data/dist/ice/slice/IceGrid/Exception.ice +98 -0
- data/dist/ice/slice/IceGrid/FileParser.ice +36 -0
- data/dist/ice/slice/IceGrid/Registry.ice +130 -0
- data/dist/ice/slice/IceGrid/Session.ice +64 -0
- data/dist/ice/slice/IceGrid/UserAccountMapper.ice +34 -0
- data/dist/ice/slice/IceStorm/IceStorm.ice +186 -0
- data/dist/ice/slice/IceStorm/Metrics.ice +41 -0
- data/dist/lib/Glacier2/Metrics.rb +41 -0
- data/dist/lib/Glacier2/PermissionsVerifier.rb +61 -0
- data/dist/lib/Glacier2/Router.rb +73 -0
- data/dist/lib/Glacier2/SSLInfo.rb +64 -0
- data/dist/lib/Glacier2/Session.rb +187 -0
- data/dist/lib/Glacier2.rb +7 -0
- data/dist/lib/Ice/BuiltinSequences.rb +48 -0
- data/dist/lib/Ice/CompressBatch.rb +50 -0
- data/dist/lib/Ice/Context.rb +12 -0
- data/dist/lib/Ice/EndpointSelectionType.rb +49 -0
- data/dist/lib/Ice/EndpointTypes.rb +28 -0
- data/dist/lib/Ice/Exception.rb +20 -0
- data/dist/lib/Ice/Identity.rb +47 -0
- data/dist/lib/Ice/IdentitySpaceship.rb +16 -0
- data/dist/lib/Ice/InitializationData.rb +12 -0
- data/dist/lib/Ice/LocalExceptions.rb +168 -0
- data/dist/lib/Ice/Locator.rb +83 -0
- data/dist/lib/Ice/LocatorRegistry.rb +73 -0
- data/dist/lib/Ice/Metrics.rb +290 -0
- data/dist/lib/Ice/OperationMode.rb +58 -0
- data/dist/lib/Ice/Process.rb +34 -0
- data/dist/lib/Ice/PropertiesAdmin.rb +39 -0
- data/dist/lib/Ice/PropertyDict.rb +12 -0
- data/dist/lib/Ice/Proxy.rb +85 -0
- data/dist/lib/Ice/ProxyFunctions.rb +69 -0
- data/dist/lib/Ice/RemoteLogger.rb +176 -0
- data/dist/lib/Ice/ReplyStatus.rb +65 -0
- data/dist/lib/Ice/Router.rb +59 -0
- data/dist/lib/Ice/SliceChecksumDict.rb +12 -0
- data/dist/lib/Ice/SliceUtil.rb +41 -0
- data/dist/lib/Ice/Struct.rb +11 -0
- data/dist/lib/Ice/ToStringMode.rb +50 -0
- data/dist/lib/Ice/Value.rb +93 -0
- data/dist/lib/Ice/Version.rb +78 -0
- data/dist/lib/Ice.rb +37 -0
- data/dist/lib/IceBox/ServiceManager.rb +104 -0
- data/dist/lib/IceBox.rb +3 -0
- data/dist/lib/IceGrid/Admin.rb +1208 -0
- data/dist/lib/IceGrid/Descriptor.rb +989 -0
- data/dist/lib/IceGrid/Exception.rb +145 -0
- data/dist/lib/IceGrid/FileParser.rb +41 -0
- data/dist/lib/IceGrid/Registry.rb +168 -0
- data/dist/lib/IceGrid/Session.rb +56 -0
- data/dist/lib/IceGrid/UserAccountMapper.rb +38 -0
- data/dist/lib/IceGrid.rb +9 -0
- data/dist/lib/IceStorm/IceStorm.rb +251 -0
- data/dist/lib/IceStorm/Metrics.rb +55 -0
- data/dist/lib/IceStorm.rb +4 -0
- data/extconf.rb +89 -0
- data/ice.gemspec +22 -17
- data/scripts/slice2rb +10 -0
- metadata +536 -712
- data/ICE_LICENSE +0 -48
- data/LICENSE +0 -340
- data/MCPP_LICENSE +0 -29
- data/bin/slice2rb +0 -12
- data/ext/Communicator.cpp +0 -792
- data/ext/Communicator.h +0 -20
- data/ext/Config.h +0 -143
- data/ext/Connection.cpp +0 -532
- data/ext/Connection.h +0 -24
- data/ext/Endpoint.cpp +0 -340
- data/ext/Endpoint.h +0 -22
- data/ext/ImplicitContext.cpp +0 -144
- data/ext/ImplicitContext.h +0 -20
- data/ext/Init.cpp +0 -49
- data/ext/Logger.cpp +0 -147
- data/ext/Logger.h +0 -23
- data/ext/Operation.cpp +0 -661
- data/ext/Operation.h +0 -31
- data/ext/Properties.cpp +0 -365
- data/ext/Properties.h +0 -20
- data/ext/Proxy.cpp +0 -1396
- data/ext/Proxy.h +0 -22
- data/ext/Slice.cpp +0 -205
- data/ext/Slice.h +0 -17
- data/ext/Types.cpp +0 -3325
- data/ext/Types.h +0 -595
- data/ext/Util.cpp +0 -812
- data/ext/Util.h +0 -586
- data/ext/ValueFactoryManager.cpp +0 -441
- data/ext/ValueFactoryManager.h +0 -95
- data/ext/extconf.rb +0 -97
- data/ext/ice/cpp/include/Ice/Application.h +0 -326
- data/ext/ice/cpp/include/Ice/AsyncResult.h +0 -155
- data/ext/ice/cpp/include/Ice/AsyncResultF.h +0 -23
- data/ext/ice/cpp/include/Ice/BatchRequestInterceptor.h +0 -75
- data/ext/ice/cpp/include/Ice/BatchRequestQueueF.h +0 -20
- data/ext/ice/cpp/include/Ice/Buffer.h +0 -154
- data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +0 -154
- data/ext/ice/cpp/include/Ice/Comparable.h +0 -205
- data/ext/ice/cpp/include/Ice/Config.h +0 -76
- data/ext/ice/cpp/include/Ice/ConnectionAsync.h +0 -302
- data/ext/ice/cpp/include/Ice/ConnectionIF.h +0 -38
- data/ext/ice/cpp/include/Ice/ConsoleUtil.h +0 -23
- data/ext/ice/cpp/include/Ice/DefaultValueFactory.h +0 -57
- data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +0 -41
- data/ext/ice/cpp/include/Ice/Dispatcher.h +0 -67
- data/ext/ice/cpp/include/Ice/DynamicLibrary.h +0 -102
- data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +0 -24
- data/ext/ice/cpp/include/Ice/Exception.h +0 -161
- data/ext/ice/cpp/include/Ice/ExceptionHelpers.h +0 -74
- data/ext/ice/cpp/include/Ice/FactoryTable.h +0 -73
- data/ext/ice/cpp/include/Ice/FactoryTableInit.h +0 -84
- data/ext/ice/cpp/include/Ice/Format.h +0 -38
- data/ext/ice/cpp/include/Ice/Functional.h +0 -140
- data/ext/ice/cpp/include/Ice/GCObject.h +0 -76
- data/ext/ice/cpp/include/Ice/Handle.h +0 -182
- data/ext/ice/cpp/include/Ice/Ice.h +0 -55
- data/ext/ice/cpp/include/Ice/IconvStringConverter.h +0 -377
- data/ext/ice/cpp/include/Ice/Incoming.h +0 -225
- data/ext/ice/cpp/include/Ice/IncomingAsync.h +0 -186
- data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +0 -36
- data/ext/ice/cpp/include/Ice/Initialize.h +0 -957
- data/ext/ice/cpp/include/Ice/InputStream.h +0 -1514
- data/ext/ice/cpp/include/Ice/InstanceF.h +0 -20
- data/ext/ice/cpp/include/Ice/InterfaceByValue.h +0 -57
- data/ext/ice/cpp/include/Ice/LocalObject.h +0 -35
- data/ext/ice/cpp/include/Ice/LocalObjectF.h +0 -21
- data/ext/ice/cpp/include/Ice/LoggerUtil.h +0 -185
- data/ext/ice/cpp/include/Ice/MetricsAdminI.h +0 -715
- data/ext/ice/cpp/include/Ice/MetricsFunctional.h +0 -159
- data/ext/ice/cpp/include/Ice/MetricsObserverI.h +0 -669
- data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +0 -86
- data/ext/ice/cpp/include/Ice/Object.h +0 -507
- data/ext/ice/cpp/include/Ice/ObjectF.h +0 -30
- data/ext/ice/cpp/include/Ice/ObserverHelper.h +0 -182
- data/ext/ice/cpp/include/Ice/Optional.h +0 -1114
- data/ext/ice/cpp/include/Ice/OutgoingAsync.h +0 -856
- data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +0 -39
- data/ext/ice/cpp/include/Ice/OutputStream.h +0 -1092
- data/ext/ice/cpp/include/Ice/Protocol.h +0 -274
- data/ext/ice/cpp/include/Ice/Proxy.h +0 -5154
- data/ext/ice/cpp/include/Ice/ProxyF.h +0 -53
- data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +0 -21
- data/ext/ice/cpp/include/Ice/ProxyHandle.h +0 -318
- data/ext/ice/cpp/include/Ice/ReferenceF.h +0 -29
- data/ext/ice/cpp/include/Ice/RegisterPlugins.h +0 -127
- data/ext/ice/cpp/include/Ice/RequestHandlerF.h +0 -30
- data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +0 -25
- data/ext/ice/cpp/include/Ice/SHA1.h +0 -40
- data/ext/ice/cpp/include/Ice/ServantManagerF.h +0 -21
- data/ext/ice/cpp/include/Ice/Service.h +0 -379
- data/ext/ice/cpp/include/Ice/SliceChecksums.h +0 -33
- data/ext/ice/cpp/include/Ice/SlicedData.h +0 -172
- data/ext/ice/cpp/include/Ice/SlicedDataF.h +0 -40
- data/ext/ice/cpp/include/Ice/StreamHelpers.h +0 -1190
- data/ext/ice/cpp/include/Ice/StringConverter.h +0 -78
- data/ext/ice/cpp/include/Ice/ThreadPoolF.h +0 -23
- data/ext/ice/cpp/include/Ice/UUID.h +0 -19
- data/ext/ice/cpp/include/Ice/UniquePtr.h +0 -95
- data/ext/ice/cpp/include/Ice/UniqueRef.h +0 -97
- data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +0 -88
- data/ext/ice/cpp/include/Ice/Value.h +0 -139
- data/ext/ice/cpp/include/Ice/ValueF.h +0 -21
- data/ext/ice/cpp/include/IceSSL/Config.h +0 -21
- data/ext/ice/cpp/include/IceSSL/IceSSL.h +0 -24
- data/ext/ice/cpp/include/IceSSL/OpenSSL.h +0 -147
- data/ext/ice/cpp/include/IceSSL/Plugin.h +0 -712
- data/ext/ice/cpp/include/IceSSL/SChannel.h +0 -72
- data/ext/ice/cpp/include/IceSSL/SecureTransport.h +0 -72
- data/ext/ice/cpp/include/IceSSL/UWP.h +0 -62
- data/ext/ice/cpp/include/IceUtil/Atomic.h +0 -179
- data/ext/ice/cpp/include/IceUtil/Cond.h +0 -317
- data/ext/ice/cpp/include/IceUtil/Config.h +0 -392
- data/ext/ice/cpp/include/IceUtil/ConsoleUtil.h +0 -92
- data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +0 -45
- data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +0 -92
- data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +0 -44
- data/ext/ice/cpp/include/IceUtil/Exception.h +0 -394
- data/ext/ice/cpp/include/IceUtil/FileUtil.h +0 -140
- data/ext/ice/cpp/include/IceUtil/Functional.h +0 -389
- data/ext/ice/cpp/include/IceUtil/Handle.h +0 -261
- data/ext/ice/cpp/include/IceUtil/IceUtil.h +0 -40
- data/ext/ice/cpp/include/IceUtil/InputUtil.h +0 -42
- data/ext/ice/cpp/include/IceUtil/Iterator.h +0 -31
- data/ext/ice/cpp/include/IceUtil/Lock.h +0 -128
- data/ext/ice/cpp/include/IceUtil/Monitor.h +0 -243
- data/ext/ice/cpp/include/IceUtil/Mutex.h +0 -349
- data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +0 -23
- data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +0 -78
- data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +0 -77
- data/ext/ice/cpp/include/IceUtil/Optional.h +0 -433
- data/ext/ice/cpp/include/IceUtil/Options.h +0 -135
- data/ext/ice/cpp/include/IceUtil/OutputUtil.h +0 -383
- data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +0 -14
- data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +0 -33
- data/ext/ice/cpp/include/IceUtil/Random.h +0 -55
- data/ext/ice/cpp/include/IceUtil/RecMutex.h +0 -107
- data/ext/ice/cpp/include/IceUtil/ResourceConfig.h +0 -37
- data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +0 -40
- data/ext/ice/cpp/include/IceUtil/ScopedArray.h +0 -98
- data/ext/ice/cpp/include/IceUtil/Shared.h +0 -127
- data/ext/ice/cpp/include/IceUtil/StopWatch.h +0 -49
- data/ext/ice/cpp/include/IceUtil/StringConverter.h +0 -195
- data/ext/ice/cpp/include/IceUtil/StringUtil.h +0 -97
- data/ext/ice/cpp/include/IceUtil/Thread.h +0 -160
- data/ext/ice/cpp/include/IceUtil/ThreadException.h +0 -94
- data/ext/ice/cpp/include/IceUtil/Time.h +0 -205
- data/ext/ice/cpp/include/IceUtil/Timer.h +0 -144
- data/ext/ice/cpp/include/IceUtil/UUID.h +0 -21
- data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +0 -37
- data/ext/ice/cpp/include/generated/Ice/BuiltinSequences.h +0 -170
- data/ext/ice/cpp/include/generated/Ice/Communicator.h +0 -1162
- data/ext/ice/cpp/include/generated/Ice/CommunicatorF.h +0 -101
- data/ext/ice/cpp/include/generated/Ice/Connection.h +0 -1703
- data/ext/ice/cpp/include/generated/Ice/ConnectionF.h +0 -119
- data/ext/ice/cpp/include/generated/Ice/Current.h +0 -322
- data/ext/ice/cpp/include/generated/Ice/Endpoint.h +0 -979
- data/ext/ice/cpp/include/generated/Ice/EndpointF.h +0 -166
- data/ext/ice/cpp/include/generated/Ice/EndpointTypes.h +0 -118
- data/ext/ice/cpp/include/generated/Ice/FacetMap.h +0 -80
- data/ext/ice/cpp/include/generated/Ice/Identity.h +0 -264
- data/ext/ice/cpp/include/generated/Ice/ImplicitContext.h +0 -284
- data/ext/ice/cpp/include/generated/Ice/ImplicitContextF.h +0 -101
- data/ext/ice/cpp/include/generated/Ice/Instrumentation.h +0 -1203
- data/ext/ice/cpp/include/generated/Ice/InstrumentationF.h +0 -128
- data/ext/ice/cpp/include/generated/Ice/LocalException.h +0 -7437
- data/ext/ice/cpp/include/generated/Ice/Locator.h +0 -3898
- data/ext/ice/cpp/include/generated/Ice/LocatorF.h +0 -147
- data/ext/ice/cpp/include/generated/Ice/Logger.h +0 -237
- data/ext/ice/cpp/include/generated/Ice/LoggerF.h +0 -101
- data/ext/ice/cpp/include/generated/Ice/Metrics.h +0 -4769
- data/ext/ice/cpp/include/generated/Ice/ObjectAdapter.h +0 -1181
- data/ext/ice/cpp/include/generated/Ice/ObjectAdapterF.h +0 -101
- data/ext/ice/cpp/include/generated/Ice/ObjectFactory.h +0 -203
- data/ext/ice/cpp/include/generated/Ice/Plugin.h +0 -318
- data/ext/ice/cpp/include/generated/Ice/PluginF.h +0 -110
- data/ext/ice/cpp/include/generated/Ice/Process.h +0 -977
- data/ext/ice/cpp/include/generated/Ice/ProcessF.h +0 -125
- data/ext/ice/cpp/include/generated/Ice/Properties.h +0 -452
- data/ext/ice/cpp/include/generated/Ice/PropertiesAdmin.h +0 -1366
- data/ext/ice/cpp/include/generated/Ice/PropertiesF.h +0 -134
- data/ext/ice/cpp/include/generated/Ice/RemoteLogger.h +0 -2707
- data/ext/ice/cpp/include/generated/Ice/Router.h +0 -1850
- data/ext/ice/cpp/include/generated/Ice/RouterF.h +0 -125
- data/ext/ice/cpp/include/generated/Ice/ServantLocator.h +0 -305
- data/ext/ice/cpp/include/generated/Ice/ServantLocatorF.h +0 -101
- data/ext/ice/cpp/include/generated/Ice/SliceChecksumDict.h +0 -84
- data/ext/ice/cpp/include/generated/Ice/ValueFactory.h +0 -330
- data/ext/ice/cpp/include/generated/Ice/Version.h +0 -357
- data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfo.h +0 -228
- data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfoF.h +0 -101
- data/ext/ice/cpp/include/generated/IceSSL/EndpointInfo.h +0 -186
- data/ext/ice/cpp/src/Ice/ACM.cpp +0 -380
- data/ext/ice/cpp/src/Ice/ACM.h +0 -119
- data/ext/ice/cpp/src/Ice/ACMF.h +0 -30
- data/ext/ice/cpp/src/Ice/Acceptor.cpp +0 -16
- data/ext/ice/cpp/src/Ice/Acceptor.h +0 -37
- data/ext/ice/cpp/src/Ice/AcceptorF.h +0 -25
- data/ext/ice/cpp/src/Ice/ArgVector.cpp +0 -59
- data/ext/ice/cpp/src/Ice/ArgVector.h +0 -36
- data/ext/ice/cpp/src/Ice/AsyncResult.cpp +0 -70
- data/ext/ice/cpp/src/Ice/Base64.cpp +0 -263
- data/ext/ice/cpp/src/Ice/Base64.h +0 -31
- data/ext/ice/cpp/src/Ice/BatchRequestQueue.cpp +0 -250
- data/ext/ice/cpp/src/Ice/BatchRequestQueue.h +0 -59
- data/ext/ice/cpp/src/Ice/Buffer.cpp +0 -155
- data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +0 -49
- data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +0 -407
- data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +0 -87
- data/ext/ice/cpp/src/Ice/Communicator.cpp +0 -79
- data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +0 -61
- data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +0 -586
- data/ext/ice/cpp/src/Ice/CommunicatorI.h +0 -167
- data/ext/ice/cpp/src/Ice/Cond.cpp +0 -381
- data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +0 -348
- data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +0 -72
- data/ext/ice/cpp/src/Ice/ConnectRequestHandlerF.h +0 -24
- data/ext/ice/cpp/src/Ice/Connection.cpp +0 -155
- data/ext/ice/cpp/src/Ice/ConnectionF.cpp +0 -61
- data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +0 -1972
- data/ext/ice/cpp/src/Ice/ConnectionFactory.h +0 -264
- data/ext/ice/cpp/src/Ice/ConnectionFactoryF.h +0 -30
- data/ext/ice/cpp/src/Ice/ConnectionI.cpp +0 -3670
- data/ext/ice/cpp/src/Ice/ConnectionI.h +0 -389
- data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +0 -73
- data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +0 -41
- data/ext/ice/cpp/src/Ice/Connector.cpp +0 -16
- data/ext/ice/cpp/src/Ice/Connector.h +0 -32
- data/ext/ice/cpp/src/Ice/ConnectorF.h +0 -21
- data/ext/ice/cpp/src/Ice/CountDownLatch.cpp +0 -171
- data/ext/ice/cpp/src/Ice/Current.cpp +0 -62
- data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +0 -159
- data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +0 -52
- data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +0 -21
- data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +0 -37
- data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +0 -284
- data/ext/ice/cpp/src/Ice/Endpoint.cpp +0 -147
- data/ext/ice/cpp/src/Ice/EndpointF.cpp +0 -61
- data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +0 -189
- data/ext/ice/cpp/src/Ice/EndpointFactory.h +0 -117
- data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +0 -21
- data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +0 -213
- data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +0 -47
- data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +0 -21
- data/ext/ice/cpp/src/Ice/EndpointI.cpp +0 -98
- data/ext/ice/cpp/src/Ice/EndpointI.h +0 -218
- data/ext/ice/cpp/src/Ice/EndpointIF.h +0 -49
- data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +0 -51
- data/ext/ice/cpp/src/Ice/EventHandler.cpp +0 -32
- data/ext/ice/cpp/src/Ice/EventHandler.h +0 -81
- data/ext/ice/cpp/src/Ice/EventHandlerF.h +0 -24
- data/ext/ice/cpp/src/Ice/Exception.cpp +0 -818
- data/ext/ice/cpp/src/Ice/FacetMap.cpp +0 -49
- data/ext/ice/cpp/src/Ice/FactoryTable.cpp +0 -162
- data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +0 -88
- data/ext/ice/cpp/src/Ice/GCObject.cpp +0 -442
- data/ext/ice/cpp/src/Ice/HashUtil.h +0 -53
- data/ext/ice/cpp/src/Ice/HttpParser.cpp +0 -684
- data/ext/ice/cpp/src/Ice/HttpParser.h +0 -117
- data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +0 -710
- data/ext/ice/cpp/src/Ice/IPEndpointI.h +0 -152
- data/ext/ice/cpp/src/Ice/IPEndpointIF.h +0 -28
- data/ext/ice/cpp/src/Ice/IconvStringConverter.cpp +0 -51
- data/ext/ice/cpp/src/Ice/Identity.cpp +0 -57
- data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +0 -75
- data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +0 -61
- data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +0 -655
- data/ext/ice/cpp/src/Ice/ImplicitContextI.h +0 -48
- data/ext/ice/cpp/src/Ice/Incoming.cpp +0 -795
- data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +0 -230
- data/ext/ice/cpp/src/Ice/IncomingRequest.h +0 -33
- data/ext/ice/cpp/src/Ice/Initialize.cpp +0 -654
- data/ext/ice/cpp/src/Ice/InputStream.cpp +0 -2741
- data/ext/ice/cpp/src/Ice/Instance.cpp +0 -1967
- data/ext/ice/cpp/src/Ice/Instance.h +0 -235
- data/ext/ice/cpp/src/Ice/Instrumentation.cpp +0 -188
- data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +0 -66
- data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +0 -1094
- data/ext/ice/cpp/src/Ice/InstrumentationI.h +0 -256
- data/ext/ice/cpp/src/Ice/LocalException.cpp +0 -3262
- data/ext/ice/cpp/src/Ice/LocalObject.cpp +0 -23
- data/ext/ice/cpp/src/Ice/Locator.cpp +0 -2042
- data/ext/ice/cpp/src/Ice/LocatorF.cpp +0 -63
- data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +0 -889
- data/ext/ice/cpp/src/Ice/LocatorInfo.h +0 -189
- data/ext/ice/cpp/src/Ice/LocatorInfoF.h +0 -29
- data/ext/ice/cpp/src/Ice/Logger.cpp +0 -73
- data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +0 -956
- data/ext/ice/cpp/src/Ice/LoggerAdminI.h +0 -41
- data/ext/ice/cpp/src/Ice/LoggerF.cpp +0 -61
- data/ext/ice/cpp/src/Ice/LoggerI.cpp +0 -259
- data/ext/ice/cpp/src/Ice/LoggerI.h +0 -52
- data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +0 -100
- data/ext/ice/cpp/src/Ice/Metrics.cpp +0 -2352
- data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +0 -694
- data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +0 -8
- data/ext/ice/cpp/src/Ice/Network.cpp +0 -2249
- data/ext/ice/cpp/src/Ice/Network.h +0 -289
- data/ext/ice/cpp/src/Ice/NetworkF.h +0 -19
- data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +0 -311
- data/ext/ice/cpp/src/Ice/NetworkProxy.h +0 -72
- data/ext/ice/cpp/src/Ice/NetworkProxyF.h +0 -21
- data/ext/ice/cpp/src/Ice/OSLogLoggerI.cpp +0 -57
- data/ext/ice/cpp/src/Ice/OSLogLoggerI.h +0 -40
- data/ext/ice/cpp/src/Ice/Object.cpp +0 -435
- data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +0 -79
- data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +0 -61
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +0 -291
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +0 -53
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactoryF.h +0 -25
- data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +0 -1530
- data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +0 -159
- data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +0 -75
- data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +0 -56
- data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +0 -408
- data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +0 -74
- data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +0 -1322
- data/ext/ice/cpp/src/Ice/OutputStream.cpp +0 -1367
- data/ext/ice/cpp/src/Ice/Plugin.cpp +0 -87
- data/ext/ice/cpp/src/Ice/PluginF.cpp +0 -61
- data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +0 -503
- data/ext/ice/cpp/src/Ice/PluginManagerI.h +0 -61
- data/ext/ice/cpp/src/Ice/Process.cpp +0 -471
- data/ext/ice/cpp/src/Ice/ProcessF.cpp +0 -63
- data/ext/ice/cpp/src/Ice/Properties.cpp +0 -78
- data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +0 -603
- data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +0 -265
- data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +0 -64
- data/ext/ice/cpp/src/Ice/PropertiesF.cpp +0 -63
- data/ext/ice/cpp/src/Ice/PropertiesI.cpp +0 -739
- data/ext/ice/cpp/src/Ice/PropertiesI.h +0 -70
- data/ext/ice/cpp/src/Ice/PropertyNames.cpp +0 -1429
- data/ext/ice/cpp/src/Ice/PropertyNames.h +0 -78
- data/ext/ice/cpp/src/Ice/Protocol.cpp +0 -124
- data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +0 -131
- data/ext/ice/cpp/src/Ice/ProtocolInstance.h +0 -93
- data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +0 -21
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +0 -51
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +0 -64
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +0 -21
- data/ext/ice/cpp/src/Ice/Proxy.cpp +0 -1601
- data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +0 -300
- data/ext/ice/cpp/src/Ice/ProxyFactory.h +0 -57
- data/ext/ice/cpp/src/Ice/Reference.cpp +0 -2046
- data/ext/ice/cpp/src/Ice/Reference.h +0 -323
- data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +0 -888
- data/ext/ice/cpp/src/Ice/ReferenceFactory.h +0 -76
- data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +0 -19
- data/ext/ice/cpp/src/Ice/RegisterPluginsInit.cpp +0 -38
- data/ext/ice/cpp/src/Ice/RegisterPluginsInit.h +0 -20
- data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +0 -1171
- data/ext/ice/cpp/src/Ice/ReplyStatus.h +0 -24
- data/ext/ice/cpp/src/Ice/RequestHandler.cpp +0 -37
- data/ext/ice/cpp/src/Ice/RequestHandler.h +0 -78
- data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +0 -77
- data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +0 -37
- data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +0 -12
- data/ext/ice/cpp/src/Ice/ResponseHandler.h +0 -43
- data/ext/ice/cpp/src/Ice/RetryQueue.cpp +0 -157
- data/ext/ice/cpp/src/Ice/RetryQueue.h +0 -66
- data/ext/ice/cpp/src/Ice/RetryQueueF.h +0 -19
- data/ext/ice/cpp/src/Ice/Router.cpp +0 -977
- data/ext/ice/cpp/src/Ice/RouterF.cpp +0 -63
- data/ext/ice/cpp/src/Ice/RouterInfo.cpp +0 -379
- data/ext/ice/cpp/src/Ice/RouterInfo.h +0 -152
- data/ext/ice/cpp/src/Ice/RouterInfoF.h +0 -25
- data/ext/ice/cpp/src/Ice/SHA1.cpp +0 -169
- data/ext/ice/cpp/src/Ice/Selector.cpp +0 -1525
- data/ext/ice/cpp/src/Ice/Selector.h +0 -292
- data/ext/ice/cpp/src/Ice/ServantLocator.cpp +0 -75
- data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +0 -61
- data/ext/ice/cpp/src/Ice/ServantManager.cpp +0 -480
- data/ext/ice/cpp/src/Ice/ServantManager.h +0 -69
- data/ext/ice/cpp/src/Ice/SharedContext.h +0 -46
- data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +0 -49
- data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +0 -75
- data/ext/ice/cpp/src/Ice/SlicedData.cpp +0 -127
- data/ext/ice/cpp/src/Ice/StreamSocket.cpp +0 -519
- data/ext/ice/cpp/src/Ice/StreamSocket.h +0 -85
- data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +0 -192
- data/ext/ice/cpp/src/Ice/StringUtil.h +0 -30
- data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +0 -166
- data/ext/ice/cpp/src/Ice/SysLoggerI.h +0 -37
- data/ext/ice/cpp/src/Ice/SystemdJournalI.cpp +0 -66
- data/ext/ice/cpp/src/Ice/SystemdJournalI.h +0 -39
- data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +0 -234
- data/ext/ice/cpp/src/Ice/TcpAcceptor.h +0 -61
- data/ext/ice/cpp/src/Ice/TcpConnector.cpp +0 -127
- data/ext/ice/cpp/src/Ice/TcpConnector.h +0 -45
- data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +0 -385
- data/ext/ice/cpp/src/Ice/TcpEndpointI.h +0 -90
- data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +0 -135
- data/ext/ice/cpp/src/Ice/TcpTransceiver.h +0 -58
- data/ext/ice/cpp/src/Ice/Thread.cpp +0 -569
- data/ext/ice/cpp/src/Ice/ThreadPool.cpp +0 -1292
- data/ext/ice/cpp/src/Ice/ThreadPool.h +0 -393
- data/ext/ice/cpp/src/Ice/Timer.cpp +0 -263
- data/ext/ice/cpp/src/Ice/TraceLevels.cpp +0 -38
- data/ext/ice/cpp/src/Ice/TraceLevels.h +0 -45
- data/ext/ice/cpp/src/Ice/TraceLevelsF.h +0 -21
- data/ext/ice/cpp/src/Ice/TraceUtil.cpp +0 -478
- data/ext/ice/cpp/src/Ice/TraceUtil.h +0 -30
- data/ext/ice/cpp/src/Ice/Transceiver.cpp +0 -18
- data/ext/ice/cpp/src/Ice/Transceiver.h +0 -49
- data/ext/ice/cpp/src/Ice/TransceiverF.h +0 -33
- data/ext/ice/cpp/src/Ice/UdpConnector.cpp +0 -131
- data/ext/ice/cpp/src/Ice/UdpConnector.h +0 -45
- data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +0 -515
- data/ext/ice/cpp/src/Ice/UdpEndpointI.h +0 -95
- data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +0 -806
- data/ext/ice/cpp/src/Ice/UdpTransceiver.h +0 -96
- data/ext/ice/cpp/src/Ice/Value.cpp +0 -76
- data/ext/ice/cpp/src/Ice/ValueFactory.cpp +0 -83
- data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.cpp +0 -61
- data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.h +0 -37
- data/ext/ice/cpp/src/Ice/Version.cpp +0 -57
- data/ext/ice/cpp/src/Ice/VirtualShared.h +0 -38
- data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +0 -92
- data/ext/ice/cpp/src/Ice/WSAcceptor.h +0 -52
- data/ext/ice/cpp/src/Ice/WSConnector.cpp +0 -102
- data/ext/ice/cpp/src/Ice/WSConnector.h +0 -43
- data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +0 -508
- data/ext/ice/cpp/src/Ice/WSEndpoint.h +0 -93
- data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +0 -1704
- data/ext/ice/cpp/src/Ice/WSTransceiver.h +0 -141
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +0 -915
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +0 -1889
- data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +0 -265
- data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +0 -109
- data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +0 -608
- data/ext/ice/cpp/src/IceDiscovery/LookupI.h +0 -228
- data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +0 -176
- data/ext/ice/cpp/src/IceDiscovery/PluginI.h +0 -36
- data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.cpp +0 -730
- data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.h +0 -1197
- data/ext/ice/cpp/src/IceLocatorDiscovery/Plugin.h +0 -47
- data/ext/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +0 -1048
- data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +0 -105
- data/ext/ice/cpp/src/IceSSL/AcceptorI.h +0 -52
- data/ext/ice/cpp/src/IceSSL/CertificateI.cpp +0 -301
- data/ext/ice/cpp/src/IceSSL/CertificateI.h +0 -64
- data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +0 -75
- data/ext/ice/cpp/src/IceSSL/ConnectionInfoF.cpp +0 -61
- data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +0 -102
- data/ext/ice/cpp/src/IceSSL/ConnectorI.h +0 -44
- data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +0 -372
- data/ext/ice/cpp/src/IceSSL/EndpointI.h +0 -100
- data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +0 -75
- data/ext/ice/cpp/src/IceSSL/Instance.cpp +0 -28
- data/ext/ice/cpp/src/IceSSL/Instance.h +0 -37
- data/ext/ice/cpp/src/IceSSL/InstanceF.h +0 -33
- data/ext/ice/cpp/src/IceSSL/OpenSSLCertificateI.cpp +0 -688
- data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +0 -1147
- data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.h +0 -59
- data/ext/ice/cpp/src/IceSSL/OpenSSLEngineF.h +0 -27
- data/ext/ice/cpp/src/IceSSL/OpenSSLPluginI.cpp +0 -127
- data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +0 -1092
- data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +0 -90
- data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.cpp +0 -288
- data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.h +0 -58
- data/ext/ice/cpp/src/IceSSL/PluginI.cpp +0 -246
- data/ext/ice/cpp/src/IceSSL/PluginI.h +0 -67
- data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +0 -490
- data/ext/ice/cpp/src/IceSSL/RFC2253.h +0 -62
- data/ext/ice/cpp/src/IceSSL/SChannelCertificateI.cpp +0 -721
- data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +0 -1283
- data/ext/ice/cpp/src/IceSSL/SChannelEngine.h +0 -123
- data/ext/ice/cpp/src/IceSSL/SChannelEngineF.h +0 -31
- data/ext/ice/cpp/src/IceSSL/SChannelPluginI.cpp +0 -73
- data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +0 -1174
- data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +0 -133
- data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +0 -313
- data/ext/ice/cpp/src/IceSSL/SSLEngine.h +0 -100
- data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +0 -21
- data/ext/ice/cpp/src/IceSSL/SecureTransportCertificateI.cpp +0 -999
- data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +0 -1308
- data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.h +0 -59
- data/ext/ice/cpp/src/IceSSL/SecureTransportEngineF.h +0 -29
- data/ext/ice/cpp/src/IceSSL/SecureTransportPluginI.cpp +0 -75
- data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +0 -719
- data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +0 -92
- data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.cpp +0 -868
- data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.h +0 -45
- data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +0 -236
- data/ext/ice/cpp/src/IceSSL/TrustManager.h +0 -46
- data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +0 -21
- data/ext/ice/cpp/src/IceSSL/UWPCertificateI.cpp +0 -266
- data/ext/ice/cpp/src/IceSSL/UWPEngine.cpp +0 -338
- data/ext/ice/cpp/src/IceSSL/UWPEngine.h +0 -41
- data/ext/ice/cpp/src/IceSSL/UWPEngineF.h +0 -26
- data/ext/ice/cpp/src/IceSSL/UWPPluginI.cpp +0 -89
- data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.cpp +0 -383
- data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.h +0 -71
- data/ext/ice/cpp/src/IceSSL/Util.cpp +0 -192
- data/ext/ice/cpp/src/IceSSL/Util.h +0 -99
- data/ext/ice/cpp/src/IceUtil/ConsoleUtil.cpp +0 -157
- data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +0 -472
- data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +0 -147
- data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +0 -259
- data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +0 -471
- data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +0 -36
- data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +0 -19
- data/ext/ice/cpp/src/IceUtil/Options.cpp +0 -1051
- data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +0 -609
- data/ext/ice/cpp/src/IceUtil/Random.cpp +0 -180
- data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +0 -238
- data/ext/ice/cpp/src/IceUtil/Shared.cpp +0 -71
- data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +0 -690
- data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +0 -1135
- data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +0 -130
- data/ext/ice/cpp/src/IceUtil/Time.cpp +0 -307
- data/ext/ice/cpp/src/IceUtil/UUID.cpp +0 -165
- data/ext/ice/cpp/src/IceUtil/Unicode.cpp +0 -183
- data/ext/ice/cpp/src/IceUtil/Unicode.h +0 -43
- data/ext/ice/cpp/src/IceUtil/UtilException.cpp +0 -839
- data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +0 -1810
- data/ext/ice/cpp/src/Slice/CPlusPlusUtil.h +0 -72
- data/ext/ice/cpp/src/Slice/Checksum.cpp +0 -447
- data/ext/ice/cpp/src/Slice/Checksum.h +0 -21
- data/ext/ice/cpp/src/Slice/FileTracker.cpp +0 -146
- data/ext/ice/cpp/src/Slice/FileTracker.h +0 -66
- data/ext/ice/cpp/src/Slice/Grammar.cpp +0 -4793
- data/ext/ice/cpp/src/Slice/Grammar.h +0 -118
- data/ext/ice/cpp/src/Slice/GrammarUtil.h +0 -228
- data/ext/ice/cpp/src/Slice/JavaUtil.cpp +0 -5176
- data/ext/ice/cpp/src/Slice/JavaUtil.h +0 -407
- data/ext/ice/cpp/src/Slice/MD5.cpp +0 -52
- data/ext/ice/cpp/src/Slice/MD5.h +0 -39
- data/ext/ice/cpp/src/Slice/MD5I.cpp +0 -393
- data/ext/ice/cpp/src/Slice/MD5I.h +0 -91
- data/ext/ice/cpp/src/Slice/PHPUtil.cpp +0 -157
- data/ext/ice/cpp/src/Slice/PHPUtil.h +0 -36
- data/ext/ice/cpp/src/Slice/Parser.cpp +0 -7058
- data/ext/ice/cpp/src/Slice/Parser.h +0 -1174
- data/ext/ice/cpp/src/Slice/Preprocessor.cpp +0 -797
- data/ext/ice/cpp/src/Slice/Preprocessor.h +0 -60
- data/ext/ice/cpp/src/Slice/Python.cpp +0 -830
- data/ext/ice/cpp/src/Slice/PythonUtil.cpp +0 -3439
- data/ext/ice/cpp/src/Slice/PythonUtil.h +0 -70
- data/ext/ice/cpp/src/Slice/Ruby.cpp +0 -350
- data/ext/ice/cpp/src/Slice/RubyUtil.cpp +0 -1571
- data/ext/ice/cpp/src/Slice/RubyUtil.h +0 -49
- data/ext/ice/cpp/src/Slice/Scanner.cpp +0 -2807
- data/ext/ice/cpp/src/Slice/SliceUtil.cpp +0 -424
- data/ext/ice/cpp/src/Slice/StringLiteralUtil.cpp +0 -456
- data/ext/ice/cpp/src/Slice/Util.h +0 -50
- data/ext/ice/mcpp/CMakeLists.txt +0 -80
- data/ext/ice/mcpp/LICENSE +0 -29
- data/ext/ice/mcpp/Makefile +0 -63
- data/ext/ice/mcpp/README.md +0 -32
- data/ext/ice/mcpp/internal.H +0 -530
- data/ext/ice/mcpp/mcpp.gyp +0 -88
- data/ext/ice/mcpp/system.c +0 -2737
- data/lib/Glacier2/Metrics.rb +0 -56
- data/lib/Glacier2/PermissionsVerifier.rb +0 -93
- data/lib/Glacier2/PermissionsVerifierF.rb +0 -30
- data/lib/Glacier2/Router.rb +0 -95
- data/lib/Glacier2/RouterF.rb +0 -25
- data/lib/Glacier2/SSLInfo.rb +0 -72
- data/lib/Glacier2/Session.rb +0 -247
- data/lib/Glacier2.rb +0 -7
- data/lib/Ice/BuiltinSequences.rb +0 -60
- data/lib/Ice/Communicator.rb +0 -87
- data/lib/Ice/CommunicatorF.rb +0 -24
- data/lib/Ice/Connection.rb +0 -413
- data/lib/Ice/ConnectionF.rb +0 -32
- data/lib/Ice/Current.rb +0 -141
- data/lib/Ice/Endpoint.rb +0 -187
- data/lib/Ice/EndpointF.rb +0 -48
- data/lib/Ice/EndpointTypes.rb +0 -69
- data/lib/Ice/FacetMap.rb +0 -24
- data/lib/Ice/Identity.rb +0 -63
- data/lib/Ice/ImplicitContext.rb +0 -26
- data/lib/Ice/ImplicitContextF.rb +0 -24
- data/lib/Ice/Instrumentation.rb +0 -169
- data/lib/Ice/InstrumentationF.rb +0 -31
- data/lib/Ice/LocalException.rb +0 -1031
- data/lib/Ice/Locator.rb +0 -196
- data/lib/Ice/LocatorF.rb +0 -30
- data/lib/Ice/Logger.rb +0 -24
- data/lib/Ice/LoggerF.rb +0 -24
- data/lib/Ice/Metrics.rb +0 -337
- data/lib/Ice/ObjectAdapter.rb +0 -29
- data/lib/Ice/ObjectAdapterF.rb +0 -24
- data/lib/Ice/ObjectFactory.rb +0 -24
- data/lib/Ice/Plugin.rb +0 -30
- data/lib/Ice/PluginF.rb +0 -28
- data/lib/Ice/Process.rb +0 -53
- data/lib/Ice/ProcessF.rb +0 -25
- data/lib/Ice/Properties.rb +0 -25
- data/lib/Ice/PropertiesAdmin.rb +0 -63
- data/lib/Ice/PropertiesF.rb +0 -29
- data/lib/Ice/RemoteLogger.rb +0 -207
- data/lib/Ice/Router.rb +0 -87
- data/lib/Ice/RouterF.rb +0 -25
- data/lib/Ice/ServantLocator.rb +0 -26
- data/lib/Ice/ServantLocatorF.rb +0 -24
- data/lib/Ice/SliceChecksumDict.rb +0 -24
- data/lib/Ice/ValueFactory.rb +0 -28
- data/lib/Ice/Version.rb +0 -90
- data/lib/Ice.rb +0 -673
- data/lib/IceBox/IceBox.rb +0 -164
- data/lib/IceBox.rb +0 -5
- data/lib/IceGrid/Admin.rb +0 -1196
- data/lib/IceGrid/Descriptor.rb +0 -1034
- data/lib/IceGrid/Exception.rb +0 -376
- data/lib/IceGrid/FileParser.rb +0 -65
- data/lib/IceGrid/PluginFacade.rb +0 -35
- data/lib/IceGrid/Registry.rb +0 -209
- data/lib/IceGrid/Session.rb +0 -71
- data/lib/IceGrid/UserAccountMapper.rb +0 -61
- data/lib/IceGrid.rb +0 -9
- data/lib/IcePatch2/FileInfo.rb +0 -115
- data/lib/IcePatch2/FileServer.rb +0 -123
- data/lib/IcePatch2.rb +0 -5
- data/lib/IceStorm/IceStorm.rb +0 -332
- data/lib/IceStorm/Metrics.rb +0 -73
- data/lib/IceStorm.rb +0 -6
- data/slice/Glacier2/Metrics.ice +0 -88
- data/slice/Glacier2/PermissionsVerifier.ice +0 -111
- data/slice/Glacier2/PermissionsVerifierF.ice +0 -30
- data/slice/Glacier2/Router.ice +0 -186
- data/slice/Glacier2/RouterF.ice +0 -29
- data/slice/Glacier2/SSLInfo.ice +0 -59
- data/slice/Glacier2/Session.ice +0 -274
- data/slice/Ice/BuiltinSequences.ice +0 -59
- data/slice/Ice/Communicator.ice +0 -676
- data/slice/Ice/CommunicatorF.ice +0 -31
- data/slice/Ice/Connection.ice +0 -516
- data/slice/Ice/ConnectionF.ice +0 -33
- data/slice/Ice/Current.ice +0 -170
- data/slice/Ice/Endpoint.ice +0 -291
- data/slice/Ice/EndpointF.ice +0 -43
- data/slice/Ice/EndpointTypes.ice +0 -48
- data/slice/Ice/FacetMap.ice +0 -36
- data/slice/Ice/Identity.ice +0 -75
- data/slice/Ice/ImplicitContext.ice +0 -119
- data/slice/Ice/ImplicitContextF.ice +0 -30
- data/slice/Ice/Instrumentation.ice +0 -509
- data/slice/Ice/InstrumentationF.ice +0 -38
- data/slice/Ice/LocalException.ice +0 -1040
- data/slice/Ice/Locator.ice +0 -239
- data/slice/Ice/LocatorF.ice +0 -32
- data/slice/Ice/Logger.ice +0 -99
- data/slice/Ice/LoggerF.ice +0 -31
- data/slice/Ice/Metrics.ice +0 -436
- data/slice/Ice/ObjectAdapter.ice +0 -710
- data/slice/Ice/ObjectAdapterF.ice +0 -31
- data/slice/Ice/ObjectFactory.ice +0 -71
- data/slice/Ice/Plugin.ice +0 -131
- data/slice/Ice/PluginF.ice +0 -36
- data/slice/Ice/Process.ice +0 -64
- data/slice/Ice/ProcessF.ice +0 -31
- data/slice/Ice/Properties.ice +0 -244
- data/slice/Ice/PropertiesAdmin.ice +0 -87
- data/slice/Ice/PropertiesF.ice +0 -32
- data/slice/Ice/RemoteLogger.ice +0 -226
- data/slice/Ice/Router.ice +0 -103
- data/slice/Ice/RouterF.ice +0 -31
- data/slice/Ice/ServantLocator.ice +0 -136
- data/slice/Ice/ServantLocatorF.ice +0 -31
- data/slice/Ice/SliceChecksumDict.ice +0 -36
- data/slice/Ice/ValueFactory.ice +0 -133
- data/slice/Ice/Version.ice +0 -51
- data/slice/IceBT/ConnectionInfo.ice +0 -59
- data/slice/IceBT/EndpointInfo.ice +0 -57
- data/slice/IceBT/Types.ice +0 -45
- data/slice/IceBox/IceBox.ice +0 -216
- data/slice/IceDiscovery/IceDiscovery.ice +0 -98
- data/slice/IceGrid/Admin.ice +0 -1957
- data/slice/IceGrid/Descriptor.ice +0 -1094
- data/slice/IceGrid/Exception.ice +0 -396
- data/slice/IceGrid/FileParser.ice +0 -72
- data/slice/IceGrid/PluginFacade.ice +0 -329
- data/slice/IceGrid/Registry.ice +0 -269
- data/slice/IceGrid/Session.ice +0 -128
- data/slice/IceGrid/UserAccountMapper.ice +0 -69
- data/slice/IceIAP/ConnectionInfo.ice +0 -74
- data/slice/IceIAP/EndpointInfo.ice +0 -68
- data/slice/IceLocatorDiscovery/IceLocatorDiscovery.ice +0 -83
- data/slice/IcePatch2/FileInfo.ice +0 -85
- data/slice/IcePatch2/FileServer.ice +0 -191
- data/slice/IceSSL/ConnectionInfo.ice +0 -54
- data/slice/IceSSL/ConnectionInfoF.ice +0 -31
- data/slice/IceSSL/EndpointInfo.ice +0 -45
- data/slice/IceStorm/IceStorm.ice +0 -414
- data/slice/IceStorm/Metrics.ice +0 -83
- /data/{ext → dist}/ice/mcpp/config.h +0 -0
- /data/{ext → dist}/ice/mcpp/configed.H +0 -0
- /data/{ext → dist}/ice/mcpp/directive.c +0 -0
- /data/{ext → dist}/ice/mcpp/eval.c +0 -0
- /data/{ext → dist}/ice/mcpp/expand.c +0 -0
- /data/{ext → dist}/ice/mcpp/mbchar.c +0 -0
- /data/{ext → dist}/ice/mcpp/mcpp_lib.h +0 -0
- /data/{ext/ice/mcpp/main.c → dist/ice/mcpp/mcpp_main.c} +0 -0
- /data/{ext → dist}/ice/mcpp/mcpp_out.h +0 -0
- /data/{ext → dist}/ice/mcpp/support.c +0 -0
- /data/{ext → dist}/ice/mcpp/system.H +0 -0
|
@@ -0,0 +1,4906 @@
|
|
|
1
|
+
// Copyright (c) ZeroC, Inc.
|
|
2
|
+
|
|
3
|
+
#include "Parser.h"
|
|
4
|
+
#include "../Ice/FileUtil.h"
|
|
5
|
+
#include "DeprecationReporter.h"
|
|
6
|
+
#include "DocCommentParser.h"
|
|
7
|
+
#include "Ice/StringUtil.h"
|
|
8
|
+
#include "Util.h"
|
|
9
|
+
|
|
10
|
+
#include <algorithm>
|
|
11
|
+
#include <cassert>
|
|
12
|
+
#include <cstring>
|
|
13
|
+
#include <iterator>
|
|
14
|
+
#include <limits>
|
|
15
|
+
|
|
16
|
+
using namespace std;
|
|
17
|
+
using namespace Slice;
|
|
18
|
+
|
|
19
|
+
bool
|
|
20
|
+
Slice::containedCompare(const ContainedPtr& lhs, const ContainedPtr& rhs)
|
|
21
|
+
{
|
|
22
|
+
return lhs->scoped() < rhs->scoped();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
bool
|
|
26
|
+
Slice::containedEqual(const ContainedPtr& lhs, const ContainedPtr& rhs)
|
|
27
|
+
{
|
|
28
|
+
return lhs->scoped() == rhs->scoped();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// NOTE: It is important that this list is kept in alphabetical order!
|
|
32
|
+
constexpr string_view languages[] = {"cpp", "cs", "java", "js", "matlab", "php", "python", "ruby", "swift"};
|
|
33
|
+
|
|
34
|
+
// Forward declare things from Bison and Flex the parser can use.
|
|
35
|
+
extern int slice_parse();
|
|
36
|
+
extern int slice_lineno;
|
|
37
|
+
extern FILE* slice_in;
|
|
38
|
+
extern int slice_debug;
|
|
39
|
+
extern int slice__flex_debug; // NOLINT(cert-dcl37-c,cert-dcl51-cpp)
|
|
40
|
+
|
|
41
|
+
//
|
|
42
|
+
// Operation attributes
|
|
43
|
+
//
|
|
44
|
+
// read + supports must be 0 (the default)
|
|
45
|
+
//
|
|
46
|
+
|
|
47
|
+
namespace
|
|
48
|
+
{
|
|
49
|
+
DataMemberList filterOrderedOptionalDataMembers(const DataMemberList& members)
|
|
50
|
+
{
|
|
51
|
+
DataMemberList result;
|
|
52
|
+
copy_if(members.begin(), members.end(), back_inserter(result), [](const auto& p) { return p->optional(); });
|
|
53
|
+
result.sort(compareTag<DataMemberPtr>);
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
bool isMutableAfterReturnType(const TypePtr& type)
|
|
58
|
+
{
|
|
59
|
+
// Returns true if the type contains data types which can be referenced by user code and mutated after a
|
|
60
|
+
// dispatch returns.
|
|
61
|
+
|
|
62
|
+
if (type->isClassType())
|
|
63
|
+
{
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (dynamic_pointer_cast<Sequence>(type) || dynamic_pointer_cast<Dictionary>(type))
|
|
68
|
+
{
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (dynamic_pointer_cast<Struct>(type))
|
|
73
|
+
{
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/// Reports any naming conflicts between @p name and @p definitions.
|
|
81
|
+
/// This should only be called for Slice elements that are _not_ defined at module scope.
|
|
82
|
+
/// For example, this is fine to use for operations, enumerators, data members, and parameters.
|
|
83
|
+
/// For elements that are defined within directly within modules, `findContents` must be used instead.
|
|
84
|
+
/// @param name The name to check for conflicts.
|
|
85
|
+
/// @param kind The kind of element that we're checking (only used for error messages).
|
|
86
|
+
/// @param definitions A list of definitions check @p name against.
|
|
87
|
+
/// @return @c false if there are no name conflicts, @c true otherwise.
|
|
88
|
+
bool doesNameConflict(string_view name, string_view kind, const ContainedList& definitions)
|
|
89
|
+
{
|
|
90
|
+
const string lowerName = IceInternal::toLower(name);
|
|
91
|
+
const auto match = std::find_if(
|
|
92
|
+
definitions.begin(),
|
|
93
|
+
definitions.end(),
|
|
94
|
+
[&](const auto& p) { return lowerName == IceInternal::toLower(p->name()); });
|
|
95
|
+
if (match == definitions.end())
|
|
96
|
+
{
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if ((*match)->name() != name)
|
|
101
|
+
{
|
|
102
|
+
ostringstream os;
|
|
103
|
+
os << kind << " '" << name << "' differs only in capitalization from " << (*match)->kindOf() << " '"
|
|
104
|
+
<< (*match)->name() << "'";
|
|
105
|
+
currentUnit->error(os.str());
|
|
106
|
+
}
|
|
107
|
+
else
|
|
108
|
+
{
|
|
109
|
+
ostringstream os;
|
|
110
|
+
os << "redefinition of " << (*match)->kindOf() << " '" << name << "'";
|
|
111
|
+
currentUnit->error(os.str());
|
|
112
|
+
}
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
namespace Slice
|
|
118
|
+
{
|
|
119
|
+
Unit* currentUnit;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// ----------------------------------------------------------------------
|
|
123
|
+
// Metadata
|
|
124
|
+
// ----------------------------------------------------------------------
|
|
125
|
+
|
|
126
|
+
Slice::Metadata::Metadata(string rawMetadata, string file, int line)
|
|
127
|
+
{
|
|
128
|
+
_file = std::move(file);
|
|
129
|
+
_line = line;
|
|
130
|
+
|
|
131
|
+
size_t splitPos = string::npos;
|
|
132
|
+
|
|
133
|
+
size_t firstColonPos = rawMetadata.find(':');
|
|
134
|
+
if (firstColonPos != string::npos)
|
|
135
|
+
{
|
|
136
|
+
// Check if the metadata starts with a language prefix.
|
|
137
|
+
string prefix = rawMetadata.substr(0, firstColonPos);
|
|
138
|
+
bool hasLangPrefix = binary_search(&languages[0], &languages[sizeof(languages) / sizeof(*languages)], prefix);
|
|
139
|
+
if (hasLangPrefix)
|
|
140
|
+
{
|
|
141
|
+
// If the metadata does start with a language prefix, we need to check for a 2nd ':' separator then.
|
|
142
|
+
// If one isn't present (i.e. the metadata only contains 1 ':' separator), then there are no arguments.
|
|
143
|
+
// If one is present, then that's the boundary between directive and arguments.
|
|
144
|
+
splitPos = rawMetadata.find(':', firstColonPos + 1);
|
|
145
|
+
}
|
|
146
|
+
else
|
|
147
|
+
{
|
|
148
|
+
// If the metadata doesn't start with a language prefix, then everything after the first ':' are arguments.
|
|
149
|
+
splitPos = firstColonPos;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Split the metadata into a 'directive' substring and an 'arguments' substring if necessary.
|
|
154
|
+
if (splitPos != string::npos)
|
|
155
|
+
{
|
|
156
|
+
_directive = rawMetadata.substr(0, splitPos);
|
|
157
|
+
_arguments = rawMetadata.substr(splitPos + 1);
|
|
158
|
+
}
|
|
159
|
+
else
|
|
160
|
+
{
|
|
161
|
+
_directive = std::move(rawMetadata);
|
|
162
|
+
_arguments = "";
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const string&
|
|
167
|
+
Slice::Metadata::directive() const
|
|
168
|
+
{
|
|
169
|
+
return _directive;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const string&
|
|
173
|
+
Slice::Metadata::arguments() const
|
|
174
|
+
{
|
|
175
|
+
return _arguments;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const string&
|
|
179
|
+
Slice::Metadata::file() const
|
|
180
|
+
{
|
|
181
|
+
return _file;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
int
|
|
185
|
+
Slice::Metadata::line() const
|
|
186
|
+
{
|
|
187
|
+
return _line;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// ----------------------------------------------------------------------
|
|
191
|
+
// DefinitionContext
|
|
192
|
+
// ----------------------------------------------------------------------
|
|
193
|
+
|
|
194
|
+
Slice::DefinitionContext::DefinitionContext(int includeLevel) : _includeLevel(includeLevel) {}
|
|
195
|
+
|
|
196
|
+
const string&
|
|
197
|
+
Slice::DefinitionContext::filename() const
|
|
198
|
+
{
|
|
199
|
+
return _filename;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const string&
|
|
203
|
+
Slice::DefinitionContext::resolvedFilename() const
|
|
204
|
+
{
|
|
205
|
+
return _resolvedFilename;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
int
|
|
209
|
+
Slice::DefinitionContext::includeLevel() const
|
|
210
|
+
{
|
|
211
|
+
return _includeLevel;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
bool
|
|
215
|
+
Slice::DefinitionContext::seenDefinition() const
|
|
216
|
+
{
|
|
217
|
+
return _seenDefinition;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
void
|
|
221
|
+
Slice::DefinitionContext::setFilename(string filename, string resolvedFilename)
|
|
222
|
+
{
|
|
223
|
+
_filename = std::move(filename);
|
|
224
|
+
_resolvedFilename = std::move(resolvedFilename);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
void
|
|
228
|
+
Slice::DefinitionContext::setSeenDefinition()
|
|
229
|
+
{
|
|
230
|
+
_seenDefinition = true;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const MetadataList&
|
|
234
|
+
Slice::DefinitionContext::getMetadata() const
|
|
235
|
+
{
|
|
236
|
+
return _metadata;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
void
|
|
240
|
+
Slice::DefinitionContext::setMetadata(MetadataList metadata)
|
|
241
|
+
{
|
|
242
|
+
_metadata = std::move(metadata);
|
|
243
|
+
initSuppressedWarnings();
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
void
|
|
247
|
+
Slice::DefinitionContext::appendMetadata(MetadataList metadata)
|
|
248
|
+
{
|
|
249
|
+
_metadata.splice(_metadata.end(), std::move(metadata));
|
|
250
|
+
initSuppressedWarnings();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
bool
|
|
254
|
+
Slice::DefinitionContext::hasMetadata(string_view directive) const
|
|
255
|
+
{
|
|
256
|
+
for (const auto& p : getMetadata())
|
|
257
|
+
{
|
|
258
|
+
if (p->directive() == directive)
|
|
259
|
+
{
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
optional<string>
|
|
267
|
+
Slice::DefinitionContext::getMetadataArgs(string_view directive) const
|
|
268
|
+
{
|
|
269
|
+
for (const auto& p : getMetadata())
|
|
270
|
+
{
|
|
271
|
+
if (p->directive() == directive)
|
|
272
|
+
{
|
|
273
|
+
return p->arguments();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return nullopt;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
bool
|
|
280
|
+
Slice::DefinitionContext::isSuppressed(WarningCategory category) const
|
|
281
|
+
{
|
|
282
|
+
return _suppressedWarnings.find(category) != _suppressedWarnings.end() ||
|
|
283
|
+
_suppressedWarnings.find(All) != _suppressedWarnings.end();
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
void
|
|
287
|
+
Slice::DefinitionContext::initSuppressedWarnings()
|
|
288
|
+
{
|
|
289
|
+
_suppressedWarnings.clear();
|
|
290
|
+
for (const auto& metadata : getMetadata())
|
|
291
|
+
{
|
|
292
|
+
if (metadata->directive() != "suppress-warning")
|
|
293
|
+
{
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
string_view category = metadata->arguments();
|
|
298
|
+
if (category.empty())
|
|
299
|
+
{
|
|
300
|
+
_suppressedWarnings.insert(All);
|
|
301
|
+
}
|
|
302
|
+
else
|
|
303
|
+
{
|
|
304
|
+
vector<string> result;
|
|
305
|
+
IceInternal::splitString(category, ",", result);
|
|
306
|
+
for (const auto& p : result)
|
|
307
|
+
{
|
|
308
|
+
string s = IceInternal::trim(p);
|
|
309
|
+
if (s == "all")
|
|
310
|
+
{
|
|
311
|
+
_suppressedWarnings.insert(All);
|
|
312
|
+
}
|
|
313
|
+
else if (s == "deprecated")
|
|
314
|
+
{
|
|
315
|
+
_suppressedWarnings.insert(Deprecated);
|
|
316
|
+
}
|
|
317
|
+
else if (s == "invalid-comment")
|
|
318
|
+
{
|
|
319
|
+
_suppressedWarnings.insert(InvalidComment);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// ----------------------------------------------------------------------
|
|
327
|
+
// DocComment
|
|
328
|
+
// ----------------------------------------------------------------------
|
|
329
|
+
|
|
330
|
+
optional<DocComment>
|
|
331
|
+
Slice::DocComment::createUnparsed(const string& rawDocComment)
|
|
332
|
+
{
|
|
333
|
+
// Split the comment into separate lines, and remove any trailing whitespace from each line.
|
|
334
|
+
StringList lines;
|
|
335
|
+
string::size_type pos = 0;
|
|
336
|
+
string::size_type nextPos;
|
|
337
|
+
while ((nextPos = rawDocComment.find_first_of('\n', pos)) != string::npos)
|
|
338
|
+
{
|
|
339
|
+
lines.push_back(IceInternal::trim(rawDocComment.substr(pos, nextPos - pos)));
|
|
340
|
+
pos = nextPos + 1; // Skip the '\n' character.
|
|
341
|
+
}
|
|
342
|
+
lines.push_back(IceInternal::trim(rawDocComment.substr(pos)));
|
|
343
|
+
|
|
344
|
+
// Remove empty trailing lines.
|
|
345
|
+
while (!lines.empty() && lines.back().empty())
|
|
346
|
+
{
|
|
347
|
+
lines.pop_back();
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (lines.empty())
|
|
351
|
+
{
|
|
352
|
+
return nullopt;
|
|
353
|
+
}
|
|
354
|
+
else
|
|
355
|
+
{
|
|
356
|
+
DocComment comment;
|
|
357
|
+
comment._rawDocCommentLines = std::move(lines);
|
|
358
|
+
return comment;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
bool
|
|
363
|
+
Slice::DocComment::isDeprecated() const
|
|
364
|
+
{
|
|
365
|
+
return _isDeprecated;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
const StringList&
|
|
369
|
+
Slice::DocComment::deprecated() const
|
|
370
|
+
{
|
|
371
|
+
return _deprecated;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const StringList&
|
|
375
|
+
Slice::DocComment::overview() const
|
|
376
|
+
{
|
|
377
|
+
return _overview;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const StringList&
|
|
381
|
+
Slice::DocComment::remarks() const
|
|
382
|
+
{
|
|
383
|
+
return _remarks;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
const StringList&
|
|
387
|
+
Slice::DocComment::seeAlso() const
|
|
388
|
+
{
|
|
389
|
+
return _seeAlso;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
const StringList&
|
|
393
|
+
Slice::DocComment::returns() const
|
|
394
|
+
{
|
|
395
|
+
return _returns;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const map<string, StringList>&
|
|
399
|
+
Slice::DocComment::parameters() const
|
|
400
|
+
{
|
|
401
|
+
return _parameters;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
const map<string, StringList>&
|
|
405
|
+
Slice::DocComment::exceptions() const
|
|
406
|
+
{
|
|
407
|
+
return _exceptions;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// ----------------------------------------------------------------------
|
|
411
|
+
// Type
|
|
412
|
+
// ----------------------------------------------------------------------
|
|
413
|
+
|
|
414
|
+
bool
|
|
415
|
+
Slice::Type::isClassType() const
|
|
416
|
+
{
|
|
417
|
+
return false;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
bool
|
|
421
|
+
Slice::Type::usesClasses() const
|
|
422
|
+
{
|
|
423
|
+
return isClassType();
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// ----------------------------------------------------------------------
|
|
427
|
+
// Builtin
|
|
428
|
+
// ----------------------------------------------------------------------
|
|
429
|
+
|
|
430
|
+
void
|
|
431
|
+
Slice::Builtin::destroy()
|
|
432
|
+
{
|
|
433
|
+
// We keep a pointer to the Unit that created this builtin.
|
|
434
|
+
// And that Unit has a pointer to this builtin in its `contents`.
|
|
435
|
+
_unit = nullptr;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
UnitPtr
|
|
439
|
+
Slice::Builtin::unit() const
|
|
440
|
+
{
|
|
441
|
+
return _unit;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
bool
|
|
445
|
+
Slice::Builtin::isClassType() const
|
|
446
|
+
{
|
|
447
|
+
return _kind == KindValue;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
size_t
|
|
451
|
+
Slice::Builtin::minWireSize() const
|
|
452
|
+
{
|
|
453
|
+
switch (_kind)
|
|
454
|
+
{
|
|
455
|
+
case KindBool:
|
|
456
|
+
return 1;
|
|
457
|
+
case KindByte:
|
|
458
|
+
return 1;
|
|
459
|
+
case KindShort:
|
|
460
|
+
return 2;
|
|
461
|
+
case KindInt:
|
|
462
|
+
return 4;
|
|
463
|
+
case KindLong:
|
|
464
|
+
return 8;
|
|
465
|
+
case KindFloat:
|
|
466
|
+
return 4;
|
|
467
|
+
case KindDouble:
|
|
468
|
+
return 8;
|
|
469
|
+
case KindString:
|
|
470
|
+
return 1; // at least one byte for an empty string.
|
|
471
|
+
case KindObjectProxy:
|
|
472
|
+
return 2; // at least an empty identity for a nil proxy, that is, 2 bytes.
|
|
473
|
+
case KindValue:
|
|
474
|
+
return 1; // at least one byte (to marshal an index instead of an instance).
|
|
475
|
+
default:
|
|
476
|
+
// TODO remove after converting `kind` to an `enum class`.
|
|
477
|
+
throw logic_error("no min wire size");
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
string
|
|
482
|
+
Slice::Builtin::getOptionalFormat() const
|
|
483
|
+
{
|
|
484
|
+
switch (_kind)
|
|
485
|
+
{
|
|
486
|
+
case KindBool:
|
|
487
|
+
case KindByte:
|
|
488
|
+
return "F1";
|
|
489
|
+
case KindShort:
|
|
490
|
+
return "F2";
|
|
491
|
+
case KindInt:
|
|
492
|
+
case KindFloat:
|
|
493
|
+
return "F4";
|
|
494
|
+
case KindLong:
|
|
495
|
+
case KindDouble:
|
|
496
|
+
return "F8";
|
|
497
|
+
case KindString:
|
|
498
|
+
return "VSize";
|
|
499
|
+
case KindValue:
|
|
500
|
+
return "Class";
|
|
501
|
+
case KindObjectProxy:
|
|
502
|
+
return "FSize";
|
|
503
|
+
default:
|
|
504
|
+
// TODO remove after converting `kind` to an `enum class`.
|
|
505
|
+
throw logic_error("no optional format");
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
bool
|
|
510
|
+
Slice::Builtin::isVariableLength() const
|
|
511
|
+
{
|
|
512
|
+
switch (_kind)
|
|
513
|
+
{
|
|
514
|
+
case KindString:
|
|
515
|
+
case KindObjectProxy:
|
|
516
|
+
case KindValue:
|
|
517
|
+
return true;
|
|
518
|
+
default:
|
|
519
|
+
return false;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
bool
|
|
524
|
+
Slice::Builtin::isNumericType() const
|
|
525
|
+
{
|
|
526
|
+
switch (_kind)
|
|
527
|
+
{
|
|
528
|
+
case KindByte:
|
|
529
|
+
case KindShort:
|
|
530
|
+
case KindInt:
|
|
531
|
+
case KindLong:
|
|
532
|
+
case KindFloat:
|
|
533
|
+
case KindDouble:
|
|
534
|
+
return true;
|
|
535
|
+
default:
|
|
536
|
+
return false;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
bool
|
|
541
|
+
Slice::Builtin::isIntegralType() const
|
|
542
|
+
{
|
|
543
|
+
switch (_kind)
|
|
544
|
+
{
|
|
545
|
+
case KindByte:
|
|
546
|
+
case KindShort:
|
|
547
|
+
case KindInt:
|
|
548
|
+
case KindLong:
|
|
549
|
+
return true;
|
|
550
|
+
default:
|
|
551
|
+
return false;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
Builtin::Kind
|
|
556
|
+
Slice::Builtin::kind() const
|
|
557
|
+
{
|
|
558
|
+
return _kind;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
string
|
|
562
|
+
Slice::Builtin::kindAsString() const
|
|
563
|
+
{
|
|
564
|
+
return builtinTable[_kind];
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
optional<Slice::Builtin::Kind>
|
|
568
|
+
Slice::Builtin::kindFromString(string_view str)
|
|
569
|
+
{
|
|
570
|
+
// Object is an alias for Value that we don't put in the builtinTable.
|
|
571
|
+
if (str == "Object")
|
|
572
|
+
{
|
|
573
|
+
return KindValue;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
for (size_t i = 0; i < builtinTable.size(); i++)
|
|
577
|
+
{
|
|
578
|
+
if (str == builtinTable[i])
|
|
579
|
+
{
|
|
580
|
+
return static_cast<Kind>(i);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
return nullopt;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
Slice::Builtin::Builtin(UnitPtr unit, Kind kind) : _kind(kind), _unit(std::move(unit)) {}
|
|
587
|
+
|
|
588
|
+
// ----------------------------------------------------------------------
|
|
589
|
+
// Contained
|
|
590
|
+
// ----------------------------------------------------------------------
|
|
591
|
+
|
|
592
|
+
ContainerPtr
|
|
593
|
+
Slice::Contained::container() const
|
|
594
|
+
{
|
|
595
|
+
return _container;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
bool
|
|
599
|
+
Slice::Contained::isTopLevel() const
|
|
600
|
+
{
|
|
601
|
+
return dynamic_pointer_cast<Unit>(container()) != nullptr;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
ModulePtr
|
|
605
|
+
Slice::Contained::getTopLevelModule() const
|
|
606
|
+
{
|
|
607
|
+
if (auto parent = dynamic_pointer_cast<Contained>(container()))
|
|
608
|
+
{
|
|
609
|
+
return parent->getTopLevelModule();
|
|
610
|
+
}
|
|
611
|
+
// `Module` has its own implementation of this function. So reaching here means we hit an
|
|
612
|
+
// element which is a top-level non-module. The parser will report an error for it, but
|
|
613
|
+
// until we exit (at the end of parsing) this element will exist, and needs to be handled.
|
|
614
|
+
return nullptr;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
string
|
|
618
|
+
Slice::Contained::name() const
|
|
619
|
+
{
|
|
620
|
+
return _name;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
string
|
|
624
|
+
Slice::Contained::scoped() const
|
|
625
|
+
{
|
|
626
|
+
return scope() + name();
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
string
|
|
630
|
+
Slice::Contained::scope() const
|
|
631
|
+
{
|
|
632
|
+
string scoped;
|
|
633
|
+
if (auto container = dynamic_pointer_cast<Contained>(_container))
|
|
634
|
+
{
|
|
635
|
+
scoped = container->scoped();
|
|
636
|
+
}
|
|
637
|
+
return scoped + "::";
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
string
|
|
641
|
+
Slice::Contained::mappedName() const
|
|
642
|
+
{
|
|
643
|
+
// First check if any 'xxx:identifier' has been applied to this element.
|
|
644
|
+
// If so, we return that instead of the element's Slice identifier.
|
|
645
|
+
const string metadata = unit()->languageName() + ":identifier";
|
|
646
|
+
if (auto customName = getMetadataArgs(metadata))
|
|
647
|
+
{
|
|
648
|
+
return *customName;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
return _name;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
string
|
|
655
|
+
Slice::Contained::mappedScoped(const string& separator, bool leading) const
|
|
656
|
+
{
|
|
657
|
+
return mappedScope(separator, leading) + mappedName();
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
string
|
|
661
|
+
Slice::Contained::mappedScope(const string& separator, bool leading) const
|
|
662
|
+
{
|
|
663
|
+
string scoped;
|
|
664
|
+
if (auto container = dynamic_pointer_cast<Contained>(_container))
|
|
665
|
+
{
|
|
666
|
+
scoped = container->mappedScoped(separator, leading) + separator;
|
|
667
|
+
}
|
|
668
|
+
else if (leading)
|
|
669
|
+
{
|
|
670
|
+
scoped = separator;
|
|
671
|
+
}
|
|
672
|
+
return scoped;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
const string&
|
|
676
|
+
Slice::Contained::file() const
|
|
677
|
+
{
|
|
678
|
+
return _file;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
int
|
|
682
|
+
Slice::Contained::line() const
|
|
683
|
+
{
|
|
684
|
+
return _line;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
const optional<DocComment>&
|
|
688
|
+
Slice::Contained::docComment() const
|
|
689
|
+
{
|
|
690
|
+
return _docComment;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
int
|
|
694
|
+
Slice::Contained::includeLevel() const
|
|
695
|
+
{
|
|
696
|
+
return _includeLevel;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
DefinitionContextPtr
|
|
700
|
+
Slice::Contained::definitionContext() const
|
|
701
|
+
{
|
|
702
|
+
return _definitionContext;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
UnitPtr
|
|
706
|
+
Slice::Contained::unit() const
|
|
707
|
+
{
|
|
708
|
+
return _container->unit();
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
const MetadataList&
|
|
712
|
+
Slice::Contained::getMetadata() const
|
|
713
|
+
{
|
|
714
|
+
return _metadata;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
void
|
|
718
|
+
Slice::Contained::setMetadata(MetadataList metadata)
|
|
719
|
+
{
|
|
720
|
+
_metadata = std::move(metadata);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
void
|
|
724
|
+
Slice::Contained::appendMetadata(MetadataList metadata)
|
|
725
|
+
{
|
|
726
|
+
_metadata.splice(_metadata.end(), std::move(metadata));
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
bool
|
|
730
|
+
Slice::Contained::hasMetadata(string_view directive) const
|
|
731
|
+
{
|
|
732
|
+
for (const auto& p : getMetadata())
|
|
733
|
+
{
|
|
734
|
+
if (p->directive() == directive)
|
|
735
|
+
{
|
|
736
|
+
return true;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
optional<string>
|
|
743
|
+
Slice::Contained::getMetadataArgs(string_view directive) const
|
|
744
|
+
{
|
|
745
|
+
for (const auto& p : getMetadata())
|
|
746
|
+
{
|
|
747
|
+
if (p->directive() == directive)
|
|
748
|
+
{
|
|
749
|
+
return p->arguments();
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
return nullopt;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
std::optional<FormatType>
|
|
756
|
+
Slice::Contained::parseFormatMetadata() const
|
|
757
|
+
{
|
|
758
|
+
if (auto metadata = getMetadataArgs("format"))
|
|
759
|
+
{
|
|
760
|
+
const string& arg = *metadata;
|
|
761
|
+
if (arg == "compact")
|
|
762
|
+
{
|
|
763
|
+
return CompactFormat;
|
|
764
|
+
}
|
|
765
|
+
else if (arg == "sliced")
|
|
766
|
+
{
|
|
767
|
+
return SlicedFormat;
|
|
768
|
+
}
|
|
769
|
+
else
|
|
770
|
+
{
|
|
771
|
+
// TODO: Allow "default" to be specified as a format value?
|
|
772
|
+
assert(arg == "default");
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
return nullopt;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
bool
|
|
779
|
+
Slice::Contained::isDeprecated() const
|
|
780
|
+
{
|
|
781
|
+
return (hasMetadata("deprecate") || hasMetadata("deprecated"));
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
optional<string>
|
|
785
|
+
Slice::Contained::getDeprecationReason() const
|
|
786
|
+
{
|
|
787
|
+
string reasonMessage;
|
|
788
|
+
if (auto reason = getMetadataArgs("deprecate"))
|
|
789
|
+
{
|
|
790
|
+
reasonMessage = *reason;
|
|
791
|
+
}
|
|
792
|
+
if (auto reason = getMetadataArgs("deprecated"))
|
|
793
|
+
{
|
|
794
|
+
reasonMessage = *reason;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
return (reasonMessage.empty()) ? nullopt : optional{reasonMessage};
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
Slice::Contained::Contained(const ContainerPtr& container, string name) : _container(container), _name(std::move(name))
|
|
801
|
+
{
|
|
802
|
+
UnitPtr unit = container->unit();
|
|
803
|
+
_file = unit->currentFile();
|
|
804
|
+
_line = unit->currentLine();
|
|
805
|
+
_docComment = DocComment::createUnparsed(unit->currentDocComment());
|
|
806
|
+
_includeLevel = unit->currentIncludeLevel();
|
|
807
|
+
_definitionContext = unit->currentDefinitionContext();
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// ----------------------------------------------------------------------
|
|
811
|
+
// Container
|
|
812
|
+
// ----------------------------------------------------------------------
|
|
813
|
+
|
|
814
|
+
void
|
|
815
|
+
Slice::Container::destroyContents()
|
|
816
|
+
{
|
|
817
|
+
// Container has pointers to all it's contents (since it logically owns them).
|
|
818
|
+
// But each Contained also keeps a pointer to it's parent, creating a cycle.
|
|
819
|
+
// We need to break this cycle.
|
|
820
|
+
for (const auto& i : _contents)
|
|
821
|
+
{
|
|
822
|
+
i->destroy();
|
|
823
|
+
}
|
|
824
|
+
_contents.clear();
|
|
825
|
+
_introducedMap.clear();
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
ModulePtr
|
|
829
|
+
Slice::Container::createModule(const string& name, bool nestedSyntax)
|
|
830
|
+
{
|
|
831
|
+
ModulePtr q = make_shared<Module>(shared_from_this(), name, nestedSyntax);
|
|
832
|
+
|
|
833
|
+
if (!name.empty())
|
|
834
|
+
{
|
|
835
|
+
if (thisScope() == "::")
|
|
836
|
+
{
|
|
837
|
+
unit()->addTopLevelModule(unit()->currentFile(), name);
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
bool hasConflictingIdentifier = false;
|
|
841
|
+
ContainedList matches = unit()->findContents(thisScope() + name);
|
|
842
|
+
matches.sort(containedCompare); // Modules can occur many times...
|
|
843
|
+
matches.unique(containedEqual); // ... but we only want one instance of each.
|
|
844
|
+
for (const auto& p : matches)
|
|
845
|
+
{
|
|
846
|
+
bool differsOnlyInCase = matches.front()->name() != name;
|
|
847
|
+
if (ModulePtr module = dynamic_pointer_cast<Module>(p))
|
|
848
|
+
{
|
|
849
|
+
if (differsOnlyInCase) // Modules can be reopened only if they are capitalized correctly.
|
|
850
|
+
{
|
|
851
|
+
ostringstream os;
|
|
852
|
+
os << "module '" << name << "' is capitalized inconsistently with its previous name: '"
|
|
853
|
+
<< module->name() << "'";
|
|
854
|
+
unit()->error(os.str());
|
|
855
|
+
hasConflictingIdentifier = true;
|
|
856
|
+
break;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
else if (!differsOnlyInCase)
|
|
860
|
+
{
|
|
861
|
+
ostringstream os;
|
|
862
|
+
os << "redefinition of " << matches.front()->kindOf() << " '" << matches.front()->name()
|
|
863
|
+
<< "' as module";
|
|
864
|
+
unit()->error(os.str());
|
|
865
|
+
hasConflictingIdentifier = true;
|
|
866
|
+
break;
|
|
867
|
+
}
|
|
868
|
+
else
|
|
869
|
+
{
|
|
870
|
+
ostringstream os;
|
|
871
|
+
os << "module '" << name << "' differs only in capitalization from " << matches.front()->kindOf()
|
|
872
|
+
<< " name '" << matches.front()->name() << "'";
|
|
873
|
+
unit()->error(os.str());
|
|
874
|
+
hasConflictingIdentifier = true;
|
|
875
|
+
break;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
if (!hasConflictingIdentifier)
|
|
879
|
+
{
|
|
880
|
+
// If this module's identifier doesn't conflict with another definition,
|
|
881
|
+
// add it to the unit's contentMap so it can be looked up later.
|
|
882
|
+
unit()->addContent(q);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
reportIllegalSuffixOrUnderscore(name);
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
_contents.push_back(q);
|
|
889
|
+
return q;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
ClassDefPtr
|
|
893
|
+
Slice::Container::createClassDef(const string& name, int32_t id, const ClassDefPtr& base)
|
|
894
|
+
{
|
|
895
|
+
ContainedList matches = unit()->findContents(thisScope() + name);
|
|
896
|
+
for (const auto& p : matches)
|
|
897
|
+
{
|
|
898
|
+
ClassDeclPtr decl = dynamic_pointer_cast<ClassDecl>(p);
|
|
899
|
+
if (decl)
|
|
900
|
+
{
|
|
901
|
+
continue; // all good
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
bool differsOnlyInCase = matches.front()->name() != name;
|
|
905
|
+
ClassDefPtr def = dynamic_pointer_cast<ClassDef>(p);
|
|
906
|
+
if (def)
|
|
907
|
+
{
|
|
908
|
+
if (differsOnlyInCase)
|
|
909
|
+
{
|
|
910
|
+
ostringstream os;
|
|
911
|
+
os << "class definition '" << name << "' is capitalized inconsistently with its previous name: '"
|
|
912
|
+
<< def->name() << "'";
|
|
913
|
+
unit()->error(os.str());
|
|
914
|
+
}
|
|
915
|
+
else
|
|
916
|
+
{
|
|
917
|
+
ostringstream os;
|
|
918
|
+
os << "redefinition of class '" << name << "'";
|
|
919
|
+
unit()->error(os.str());
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
else if (differsOnlyInCase)
|
|
923
|
+
{
|
|
924
|
+
ostringstream os;
|
|
925
|
+
os << "class definition '" << name << "' differs only in capitalization from " << matches.front()->kindOf()
|
|
926
|
+
<< " name '" << matches.front()->name() << "'";
|
|
927
|
+
unit()->error(os.str());
|
|
928
|
+
}
|
|
929
|
+
else
|
|
930
|
+
{
|
|
931
|
+
const string kindOf = matches.front()->kindOf();
|
|
932
|
+
ostringstream os;
|
|
933
|
+
os << "class '" << name << "' was previously defined as " << getArticleFor(kindOf) << " " << kindOf;
|
|
934
|
+
unit()->error(os.str());
|
|
935
|
+
}
|
|
936
|
+
return nullptr;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
if (!reportIllegalSuffixOrUnderscore(name) || !checkForGlobalDefinition("classes"))
|
|
940
|
+
{
|
|
941
|
+
return nullptr;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
// Implicitly create a class declaration for each class definition.
|
|
945
|
+
// This way the code generator can rely on always having a class declaration available for lookup.
|
|
946
|
+
ClassDefPtr def = make_shared<ClassDef>(shared_from_this(), name, id, base);
|
|
947
|
+
ClassDeclPtr decl = createClassDecl(name);
|
|
948
|
+
def->_declaration = decl;
|
|
949
|
+
decl->_definition = def;
|
|
950
|
+
|
|
951
|
+
// Patch forward declarations which may of been created in other openings of this class' module.
|
|
952
|
+
for (const auto& q : matches)
|
|
953
|
+
{
|
|
954
|
+
dynamic_pointer_cast<ClassDecl>(q)->_definition = def;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
unit()->addContent(def);
|
|
958
|
+
_contents.push_back(def);
|
|
959
|
+
return def;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
ClassDeclPtr
|
|
963
|
+
Slice::Container::createClassDecl(const string& name)
|
|
964
|
+
{
|
|
965
|
+
ContainedList matches = unit()->findContents(thisScope() + name);
|
|
966
|
+
for (const auto& p : matches)
|
|
967
|
+
{
|
|
968
|
+
ClassDefPtr clDef = dynamic_pointer_cast<ClassDef>(p);
|
|
969
|
+
if (clDef)
|
|
970
|
+
{
|
|
971
|
+
continue;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
ClassDeclPtr clDecl = dynamic_pointer_cast<ClassDecl>(p);
|
|
975
|
+
if (clDecl)
|
|
976
|
+
{
|
|
977
|
+
continue;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
bool differsOnlyInCase = matches.front()->name() != name;
|
|
981
|
+
if (differsOnlyInCase)
|
|
982
|
+
{
|
|
983
|
+
ostringstream os;
|
|
984
|
+
os << "class declaration '" << name << "' differs only in capitalization from " << matches.front()->kindOf()
|
|
985
|
+
<< " name '" << matches.front()->name() << "'";
|
|
986
|
+
unit()->error(os.str());
|
|
987
|
+
}
|
|
988
|
+
else
|
|
989
|
+
{
|
|
990
|
+
const string kindOf = matches.front()->kindOf();
|
|
991
|
+
ostringstream os;
|
|
992
|
+
os << "class '" << name << "' was previously defined as " << getArticleFor(kindOf) << " " << kindOf;
|
|
993
|
+
unit()->error(os.str());
|
|
994
|
+
}
|
|
995
|
+
return nullptr;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
if (!reportIllegalSuffixOrUnderscore(name) || !checkForGlobalDefinition("classes"))
|
|
999
|
+
{
|
|
1000
|
+
return nullptr;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
//
|
|
1004
|
+
// Multiple declarations are permissible. But if we do already
|
|
1005
|
+
// have a declaration for the class in this container, we don't
|
|
1006
|
+
// create another one.
|
|
1007
|
+
//
|
|
1008
|
+
for (const auto& q : _contents)
|
|
1009
|
+
{
|
|
1010
|
+
if (q->name() == name)
|
|
1011
|
+
{
|
|
1012
|
+
ClassDeclPtr decl = dynamic_pointer_cast<ClassDecl>(q);
|
|
1013
|
+
if (decl)
|
|
1014
|
+
{
|
|
1015
|
+
return decl;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
ClassDeclPtr decl = make_shared<ClassDecl>(shared_from_this(), name);
|
|
1021
|
+
unit()->addContent(decl);
|
|
1022
|
+
_contents.push_back(decl);
|
|
1023
|
+
return decl;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
InterfaceDefPtr
|
|
1027
|
+
Slice::Container::createInterfaceDef(const string& name, const InterfaceList& bases)
|
|
1028
|
+
{
|
|
1029
|
+
ContainedList matches = unit()->findContents(thisScope() + name);
|
|
1030
|
+
for (const auto& p : matches)
|
|
1031
|
+
{
|
|
1032
|
+
InterfaceDeclPtr decl = dynamic_pointer_cast<InterfaceDecl>(p);
|
|
1033
|
+
if (decl)
|
|
1034
|
+
{
|
|
1035
|
+
continue; // all good
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
bool differsOnlyInCase = matches.front()->name() != name;
|
|
1039
|
+
InterfaceDefPtr def = dynamic_pointer_cast<InterfaceDef>(p);
|
|
1040
|
+
if (def)
|
|
1041
|
+
{
|
|
1042
|
+
if (differsOnlyInCase)
|
|
1043
|
+
{
|
|
1044
|
+
ostringstream os;
|
|
1045
|
+
os << "interface definition '" << name << "' is capitalized inconsistently with its previous name: '"
|
|
1046
|
+
<< def->name() + "'";
|
|
1047
|
+
unit()->error(os.str());
|
|
1048
|
+
}
|
|
1049
|
+
else
|
|
1050
|
+
{
|
|
1051
|
+
ostringstream os;
|
|
1052
|
+
os << "redefinition of interface '" << name << "'";
|
|
1053
|
+
unit()->error(os.str());
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
else if (differsOnlyInCase)
|
|
1057
|
+
{
|
|
1058
|
+
ostringstream os;
|
|
1059
|
+
os << "interface definition '" << name << "' differs only in capitalization from "
|
|
1060
|
+
<< matches.front()->kindOf() << " name '" << matches.front()->name() << "'";
|
|
1061
|
+
unit()->error(os.str());
|
|
1062
|
+
}
|
|
1063
|
+
else
|
|
1064
|
+
{
|
|
1065
|
+
const string kindOf = matches.front()->kindOf();
|
|
1066
|
+
ostringstream os;
|
|
1067
|
+
os << "interface '" << name << "' was previously defined as " << getArticleFor(kindOf) << " " << kindOf;
|
|
1068
|
+
unit()->error(os.str());
|
|
1069
|
+
}
|
|
1070
|
+
return nullptr;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
if (!reportIllegalSuffixOrUnderscore(name) || !checkForGlobalDefinition("interfaces"))
|
|
1074
|
+
{
|
|
1075
|
+
return nullptr;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
InterfaceDecl::checkBasesAreLegal(name, bases, unit());
|
|
1079
|
+
|
|
1080
|
+
// Implicitly create an interface declaration for each interface definition.
|
|
1081
|
+
// This way the code generator can rely on always having an interface declaration available for lookup.
|
|
1082
|
+
InterfaceDefPtr def = make_shared<InterfaceDef>(shared_from_this(), name, bases);
|
|
1083
|
+
InterfaceDeclPtr decl = createInterfaceDecl(name);
|
|
1084
|
+
def->_declaration = decl;
|
|
1085
|
+
decl->_definition = def;
|
|
1086
|
+
|
|
1087
|
+
// Patch forward declarations which may of been created in other openings of this interface's module.
|
|
1088
|
+
for (const auto& q : matches)
|
|
1089
|
+
{
|
|
1090
|
+
dynamic_pointer_cast<InterfaceDecl>(q)->_definition = def;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
unit()->addContent(def);
|
|
1094
|
+
_contents.push_back(def);
|
|
1095
|
+
return def;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
InterfaceDeclPtr
|
|
1099
|
+
Slice::Container::createInterfaceDecl(const string& name)
|
|
1100
|
+
{
|
|
1101
|
+
ContainedList matches = unit()->findContents(thisScope() + name);
|
|
1102
|
+
for (const auto& p : matches)
|
|
1103
|
+
{
|
|
1104
|
+
InterfaceDefPtr interfaceDef = dynamic_pointer_cast<InterfaceDef>(p);
|
|
1105
|
+
if (interfaceDef)
|
|
1106
|
+
{
|
|
1107
|
+
continue;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
InterfaceDeclPtr interfaceDecl = dynamic_pointer_cast<InterfaceDecl>(p);
|
|
1111
|
+
if (interfaceDecl)
|
|
1112
|
+
{
|
|
1113
|
+
continue;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
bool differsOnlyInCase = matches.front()->name() != name;
|
|
1117
|
+
if (differsOnlyInCase)
|
|
1118
|
+
{
|
|
1119
|
+
ostringstream os;
|
|
1120
|
+
os << "interface declaration '" << name << "' differs only in capitalization from "
|
|
1121
|
+
<< matches.front()->kindOf() << " name '" << matches.front()->name() << "'";
|
|
1122
|
+
unit()->error(os.str());
|
|
1123
|
+
}
|
|
1124
|
+
else
|
|
1125
|
+
{
|
|
1126
|
+
const string kindOf = matches.front()->kindOf();
|
|
1127
|
+
ostringstream os;
|
|
1128
|
+
os << "interface '" << name << "' was previously defined as " << getArticleFor(kindOf) << " " << kindOf;
|
|
1129
|
+
unit()->error(os.str());
|
|
1130
|
+
}
|
|
1131
|
+
return nullptr;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
if (!reportIllegalSuffixOrUnderscore(name) || !checkForGlobalDefinition("interfaces"))
|
|
1135
|
+
{
|
|
1136
|
+
return nullptr;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
// Multiple declarations are permissible. But if we do already have a declaration for the interface in this
|
|
1140
|
+
// container, we don't create another one.
|
|
1141
|
+
for (const auto& q : _contents)
|
|
1142
|
+
{
|
|
1143
|
+
if (q->name() == name)
|
|
1144
|
+
{
|
|
1145
|
+
InterfaceDeclPtr decl = dynamic_pointer_cast<InterfaceDecl>(q);
|
|
1146
|
+
if (decl)
|
|
1147
|
+
{
|
|
1148
|
+
return decl;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
InterfaceDeclPtr decl = make_shared<InterfaceDecl>(shared_from_this(), name);
|
|
1154
|
+
unit()->addContent(decl);
|
|
1155
|
+
_contents.push_back(decl);
|
|
1156
|
+
return decl;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
ExceptionPtr
|
|
1160
|
+
Slice::Container::createException(const string& name, const ExceptionPtr& base)
|
|
1161
|
+
{
|
|
1162
|
+
ExceptionPtr p = make_shared<Exception>(shared_from_this(), name, base);
|
|
1163
|
+
|
|
1164
|
+
checkForGlobalDefinition("exceptions");
|
|
1165
|
+
|
|
1166
|
+
if (!name.empty())
|
|
1167
|
+
{
|
|
1168
|
+
ContainedList matches = unit()->findContents(thisScope() + name);
|
|
1169
|
+
if (!matches.empty())
|
|
1170
|
+
{
|
|
1171
|
+
if (matches.front()->name() == name)
|
|
1172
|
+
{
|
|
1173
|
+
ostringstream os;
|
|
1174
|
+
os << "redefinition of " << matches.front()->kindOf() << " '" << name << "' as exception";
|
|
1175
|
+
unit()->error(os.str());
|
|
1176
|
+
}
|
|
1177
|
+
else
|
|
1178
|
+
{
|
|
1179
|
+
ostringstream os;
|
|
1180
|
+
os << "exception '" << name << "' differs only in capitalization from " << matches.front()->kindOf()
|
|
1181
|
+
<< " '" << matches.front()->name() << "'";
|
|
1182
|
+
unit()->error(os.str());
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
else
|
|
1186
|
+
{
|
|
1187
|
+
// If this exceptions's identifier doesn't conflict with another definition,
|
|
1188
|
+
// add it to the unit's contentMap so it can be looked up later.
|
|
1189
|
+
unit()->addContent(p);
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
reportIllegalSuffixOrUnderscore(name);
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
_contents.push_back(p);
|
|
1196
|
+
return p;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
StructPtr
|
|
1200
|
+
Slice::Container::createStruct(const string& name)
|
|
1201
|
+
{
|
|
1202
|
+
StructPtr p = make_shared<Struct>(shared_from_this(), name);
|
|
1203
|
+
|
|
1204
|
+
checkForGlobalDefinition("structs");
|
|
1205
|
+
|
|
1206
|
+
if (!name.empty())
|
|
1207
|
+
{
|
|
1208
|
+
ContainedList matches = unit()->findContents(thisScope() + name);
|
|
1209
|
+
if (!matches.empty())
|
|
1210
|
+
{
|
|
1211
|
+
if (matches.front()->name() == name)
|
|
1212
|
+
{
|
|
1213
|
+
ostringstream os;
|
|
1214
|
+
os << "redefinition of " << matches.front()->kindOf() << " '" << name << "' as struct";
|
|
1215
|
+
unit()->error(os.str());
|
|
1216
|
+
}
|
|
1217
|
+
else
|
|
1218
|
+
{
|
|
1219
|
+
ostringstream os;
|
|
1220
|
+
os << "struct '" << name << "' differs only in capitalization from " << matches.front()->kindOf()
|
|
1221
|
+
<< " '" << matches.front()->name() << "'";
|
|
1222
|
+
unit()->error(os.str());
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
else
|
|
1226
|
+
{
|
|
1227
|
+
// If this struct's identifier doesn't conflict with another definition,
|
|
1228
|
+
// add it to the unit's contentMap so it can be looked up later.
|
|
1229
|
+
unit()->addContent(p);
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
reportIllegalSuffixOrUnderscore(name);
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
_contents.push_back(p);
|
|
1236
|
+
return p;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
SequencePtr
|
|
1240
|
+
Slice::Container::createSequence(const string& name, const TypePtr& type, MetadataList metadata)
|
|
1241
|
+
{
|
|
1242
|
+
SequencePtr p = make_shared<Sequence>(shared_from_this(), name, type, std::move(metadata));
|
|
1243
|
+
|
|
1244
|
+
checkForGlobalDefinition("sequences");
|
|
1245
|
+
|
|
1246
|
+
if (!name.empty())
|
|
1247
|
+
{
|
|
1248
|
+
ContainedList matches = unit()->findContents(thisScope() + name);
|
|
1249
|
+
if (!matches.empty())
|
|
1250
|
+
{
|
|
1251
|
+
if (matches.front()->name() == name)
|
|
1252
|
+
{
|
|
1253
|
+
ostringstream os;
|
|
1254
|
+
os << "redefinition of " << matches.front()->kindOf() << " '" << name << "' as sequence";
|
|
1255
|
+
unit()->error(os.str());
|
|
1256
|
+
}
|
|
1257
|
+
else
|
|
1258
|
+
{
|
|
1259
|
+
ostringstream os;
|
|
1260
|
+
os << "sequence '" << name << "' differs only in capitalization from " << matches.front()->kindOf()
|
|
1261
|
+
<< " '" << matches.front()->name() << "'";
|
|
1262
|
+
unit()->error(os.str());
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
else
|
|
1266
|
+
{
|
|
1267
|
+
// If this sequence's identifier doesn't conflict with another definition,
|
|
1268
|
+
// add it to the unit's contentMap so it can be looked up later.
|
|
1269
|
+
unit()->addContent(p);
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
reportIllegalSuffixOrUnderscore(name);
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
_contents.push_back(p);
|
|
1276
|
+
return p;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
DictionaryPtr
|
|
1280
|
+
Slice::Container::createDictionary(
|
|
1281
|
+
const string& name,
|
|
1282
|
+
const TypePtr& keyType,
|
|
1283
|
+
MetadataList keyMetadata,
|
|
1284
|
+
const TypePtr& valueType,
|
|
1285
|
+
MetadataList valueMetadata)
|
|
1286
|
+
{
|
|
1287
|
+
DictionaryPtr p = make_shared<Dictionary>(
|
|
1288
|
+
shared_from_this(),
|
|
1289
|
+
name,
|
|
1290
|
+
keyType,
|
|
1291
|
+
std::move(keyMetadata),
|
|
1292
|
+
valueType,
|
|
1293
|
+
std::move(valueMetadata));
|
|
1294
|
+
|
|
1295
|
+
checkForGlobalDefinition("dictionaries");
|
|
1296
|
+
if (keyType && !Dictionary::isLegalKeyType(keyType))
|
|
1297
|
+
{
|
|
1298
|
+
unit()->error("dictionary '" + name + "' uses an illegal key type");
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
if (!name.empty())
|
|
1302
|
+
{
|
|
1303
|
+
ContainedList matches = unit()->findContents(thisScope() + name);
|
|
1304
|
+
if (!matches.empty())
|
|
1305
|
+
{
|
|
1306
|
+
if (matches.front()->name() == name)
|
|
1307
|
+
{
|
|
1308
|
+
ostringstream os;
|
|
1309
|
+
os << "redefinition of " << matches.front()->kindOf() << " '" << name << "' as dictionary";
|
|
1310
|
+
unit()->error(os.str());
|
|
1311
|
+
}
|
|
1312
|
+
else
|
|
1313
|
+
{
|
|
1314
|
+
ostringstream os;
|
|
1315
|
+
os << "dictionary '" << name << "' differs only in capitalization from " << matches.front()->kindOf()
|
|
1316
|
+
<< " '" << matches.front()->name() << "'";
|
|
1317
|
+
unit()->error(os.str());
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
else
|
|
1321
|
+
{
|
|
1322
|
+
// If this dictionary's identifier doesn't conflict with another definition,
|
|
1323
|
+
// add it to the unit's contentMap so it can be looked up later.
|
|
1324
|
+
unit()->addContent(p);
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
reportIllegalSuffixOrUnderscore(name);
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
_contents.push_back(p);
|
|
1331
|
+
return p;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
EnumPtr
|
|
1335
|
+
Slice::Container::createEnum(const string& name)
|
|
1336
|
+
{
|
|
1337
|
+
EnumPtr p = make_shared<Enum>(shared_from_this(), name);
|
|
1338
|
+
|
|
1339
|
+
checkForGlobalDefinition("enums");
|
|
1340
|
+
|
|
1341
|
+
if (!name.empty())
|
|
1342
|
+
{
|
|
1343
|
+
ContainedList matches = unit()->findContents(thisScope() + name);
|
|
1344
|
+
if (!matches.empty())
|
|
1345
|
+
{
|
|
1346
|
+
if (matches.front()->name() == name)
|
|
1347
|
+
{
|
|
1348
|
+
ostringstream os;
|
|
1349
|
+
os << "redefinition of " << matches.front()->kindOf() << " '" << name << "' as enumeration";
|
|
1350
|
+
unit()->error(os.str());
|
|
1351
|
+
}
|
|
1352
|
+
else
|
|
1353
|
+
{
|
|
1354
|
+
ostringstream os;
|
|
1355
|
+
os << "enumeration '" << name << "' differs only in capitalization from " << matches.front()->kindOf()
|
|
1356
|
+
<< " '" << matches.front()->name() << "'";
|
|
1357
|
+
unit()->error(os.str());
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
else
|
|
1361
|
+
{
|
|
1362
|
+
// If this enum's identifier doesn't conflict with another definition,
|
|
1363
|
+
// add it to the unit's contentMap so it can be looked up later.
|
|
1364
|
+
unit()->addContent(p);
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
reportIllegalSuffixOrUnderscore(name);
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
_contents.push_back(p);
|
|
1371
|
+
return p;
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
ConstPtr
|
|
1375
|
+
Slice::Container::createConst(
|
|
1376
|
+
const string& name,
|
|
1377
|
+
const TypePtr& type,
|
|
1378
|
+
MetadataList metadata,
|
|
1379
|
+
const SyntaxTreeBasePtr& valueType,
|
|
1380
|
+
const string& valueString)
|
|
1381
|
+
{
|
|
1382
|
+
SyntaxTreeBasePtr resolvedValueType = valueType;
|
|
1383
|
+
validateConstant(name, type, resolvedValueType, valueString, true);
|
|
1384
|
+
ConstPtr p =
|
|
1385
|
+
make_shared<Const>(shared_from_this(), name, type, std::move(metadata), resolvedValueType, valueString);
|
|
1386
|
+
|
|
1387
|
+
checkForGlobalDefinition("constants");
|
|
1388
|
+
|
|
1389
|
+
if (!name.empty())
|
|
1390
|
+
{
|
|
1391
|
+
ContainedList matches = unit()->findContents(thisScope() + name);
|
|
1392
|
+
if (!matches.empty())
|
|
1393
|
+
{
|
|
1394
|
+
if (matches.front()->name() == name)
|
|
1395
|
+
{
|
|
1396
|
+
ostringstream os;
|
|
1397
|
+
os << "redefinition of " << matches.front()->kindOf() << " '" << name << "' as constant";
|
|
1398
|
+
unit()->error(os.str());
|
|
1399
|
+
}
|
|
1400
|
+
else
|
|
1401
|
+
{
|
|
1402
|
+
ostringstream os;
|
|
1403
|
+
os << "constant '" << name << "' differs only in capitalization from " << matches.front()->kindOf()
|
|
1404
|
+
<< " '" << matches.front()->name() << "'";
|
|
1405
|
+
unit()->error(os.str());
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
else
|
|
1409
|
+
{
|
|
1410
|
+
// If this constant's identifier doesn't conflict with another definition,
|
|
1411
|
+
// add it to the unit's contentMap so it can be looked up later.
|
|
1412
|
+
unit()->addContent(p);
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
reportIllegalSuffixOrUnderscore(name);
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
_contents.push_back(p);
|
|
1419
|
+
return p;
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
TypeList
|
|
1423
|
+
Slice::Container::lookupType(const string& identifier)
|
|
1424
|
+
{
|
|
1425
|
+
// Remove whitespace.
|
|
1426
|
+
string sc = identifier;
|
|
1427
|
+
string::size_type pos;
|
|
1428
|
+
while ((pos = sc.find_first_of(" \t\r\n")) != string::npos)
|
|
1429
|
+
{
|
|
1430
|
+
sc.erase(pos, 1);
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
// Check for builtin type.
|
|
1434
|
+
auto kind = Builtin::kindFromString(sc);
|
|
1435
|
+
if (kind)
|
|
1436
|
+
{
|
|
1437
|
+
return {unit()->createBuiltin(*kind)};
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
// Not a builtin type, try to look up a user-defined type.
|
|
1441
|
+
return lookupTypeNoBuiltin(identifier, true);
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
TypeList
|
|
1445
|
+
Slice::Container::lookupTypeNoBuiltin(const string& identifier, bool emitErrors, bool ignoreUndefined)
|
|
1446
|
+
{
|
|
1447
|
+
// Remove whitespace.
|
|
1448
|
+
string sc = identifier;
|
|
1449
|
+
string::size_type pos;
|
|
1450
|
+
while ((pos = sc.find_first_of(" \t\r\n")) != string::npos)
|
|
1451
|
+
{
|
|
1452
|
+
sc.erase(pos, 1);
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
// Absolute scoped name?
|
|
1456
|
+
if (sc.size() >= 2 && sc[0] == ':')
|
|
1457
|
+
{
|
|
1458
|
+
return unit()->lookupTypeNoBuiltin(sc.substr(2), emitErrors);
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
TypeList results;
|
|
1462
|
+
bool typeError = false;
|
|
1463
|
+
vector<string> errors;
|
|
1464
|
+
|
|
1465
|
+
ContainedList matches = unit()->findContents(thisScope() + sc);
|
|
1466
|
+
for (const auto& p : matches)
|
|
1467
|
+
{
|
|
1468
|
+
if (dynamic_pointer_cast<InterfaceDef>(p) || dynamic_pointer_cast<ClassDef>(p))
|
|
1469
|
+
{
|
|
1470
|
+
continue; // Ignore interface and class definitions.
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
if (emitErrors && matches.front()->scoped() != (thisScope() + sc))
|
|
1474
|
+
{
|
|
1475
|
+
ostringstream os;
|
|
1476
|
+
os << p->kindOf() << " name '" << identifier << "' is capitalized inconsistently with its previous name: '"
|
|
1477
|
+
<< matches.front()->scoped() << "'";
|
|
1478
|
+
errors.push_back(os.str());
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
ExceptionPtr ex = dynamic_pointer_cast<Exception>(p);
|
|
1482
|
+
if (ex)
|
|
1483
|
+
{
|
|
1484
|
+
if (emitErrors)
|
|
1485
|
+
{
|
|
1486
|
+
ostringstream os;
|
|
1487
|
+
os << "'" << sc << "' is an exception, which cannot be used as a type";
|
|
1488
|
+
unit()->error(os.str());
|
|
1489
|
+
}
|
|
1490
|
+
return {};
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
TypePtr type = dynamic_pointer_cast<Type>(p);
|
|
1494
|
+
if (!type)
|
|
1495
|
+
{
|
|
1496
|
+
typeError = true;
|
|
1497
|
+
if (emitErrors)
|
|
1498
|
+
{
|
|
1499
|
+
ostringstream os;
|
|
1500
|
+
os << "'" << sc << "' is not a type";
|
|
1501
|
+
errors.push_back(os.str());
|
|
1502
|
+
}
|
|
1503
|
+
break; // Possible that correct match is higher in scope
|
|
1504
|
+
}
|
|
1505
|
+
results.push_back(type);
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
if (results.empty())
|
|
1509
|
+
{
|
|
1510
|
+
ContainedPtr contained = dynamic_pointer_cast<Contained>(shared_from_this());
|
|
1511
|
+
if (contained)
|
|
1512
|
+
{
|
|
1513
|
+
results = contained->container()->lookupTypeNoBuiltin(sc, emitErrors, typeError || ignoreUndefined);
|
|
1514
|
+
}
|
|
1515
|
+
else if (!typeError)
|
|
1516
|
+
{
|
|
1517
|
+
if (emitErrors && !ignoreUndefined)
|
|
1518
|
+
{
|
|
1519
|
+
ostringstream os;
|
|
1520
|
+
os << "'" << sc << "' is not defined";
|
|
1521
|
+
unit()->error(os.str());
|
|
1522
|
+
}
|
|
1523
|
+
return {};
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
// Do not emit errors if there was a type error but a match was found in a higher scope.
|
|
1528
|
+
// TODO The second part of this check looks funny to me.
|
|
1529
|
+
if (emitErrors && !(typeError && !results.empty()))
|
|
1530
|
+
{
|
|
1531
|
+
for (const auto& error : errors)
|
|
1532
|
+
{
|
|
1533
|
+
unit()->error(error);
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
return results;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
ContainedList
|
|
1540
|
+
Slice::Container::lookupContained(const string& identifier, bool emitErrors)
|
|
1541
|
+
{
|
|
1542
|
+
// Remove whitespace.
|
|
1543
|
+
string sc = identifier;
|
|
1544
|
+
string::size_type pos;
|
|
1545
|
+
while ((pos = sc.find_first_of(" \t\r\n")) != string::npos)
|
|
1546
|
+
{
|
|
1547
|
+
sc.erase(pos, 1);
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
// Absolute scoped name?
|
|
1551
|
+
if (sc.size() >= 2 && sc[0] == ':')
|
|
1552
|
+
{
|
|
1553
|
+
return unit()->lookupContained(sc.substr(2), emitErrors);
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
ContainedList matches = unit()->findContents(thisScope() + sc);
|
|
1557
|
+
ContainedList results;
|
|
1558
|
+
for (const auto& p : matches)
|
|
1559
|
+
{
|
|
1560
|
+
if (dynamic_pointer_cast<InterfaceDef>(p) || dynamic_pointer_cast<ClassDef>(p))
|
|
1561
|
+
{
|
|
1562
|
+
continue; // ignore definitions
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
results.push_back(p);
|
|
1566
|
+
|
|
1567
|
+
if (emitErrors && p->scoped() != (thisScope() + sc))
|
|
1568
|
+
{
|
|
1569
|
+
ostringstream os;
|
|
1570
|
+
os << p->kindOf() << " name '" << identifier << "' is capitalized inconsistently with its previous name: '"
|
|
1571
|
+
<< p->scoped() << "'";
|
|
1572
|
+
unit()->error(os.str());
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
if (results.empty())
|
|
1577
|
+
{
|
|
1578
|
+
ContainedPtr contained = dynamic_pointer_cast<Contained>(shared_from_this());
|
|
1579
|
+
if (!contained)
|
|
1580
|
+
{
|
|
1581
|
+
if (emitErrors)
|
|
1582
|
+
{
|
|
1583
|
+
ostringstream os;
|
|
1584
|
+
os << "'" << sc << "' is not defined";
|
|
1585
|
+
unit()->error(os.str());
|
|
1586
|
+
}
|
|
1587
|
+
return {};
|
|
1588
|
+
}
|
|
1589
|
+
return contained->container()->lookupContained(sc, emitErrors);
|
|
1590
|
+
}
|
|
1591
|
+
else
|
|
1592
|
+
{
|
|
1593
|
+
return results;
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
InterfaceDefPtr
|
|
1598
|
+
Slice::Container::lookupInterfaceDef(const string& identifier, bool emitErrors)
|
|
1599
|
+
{
|
|
1600
|
+
TypeList types = lookupType(identifier);
|
|
1601
|
+
if (!types.empty())
|
|
1602
|
+
{
|
|
1603
|
+
auto interface = dynamic_pointer_cast<InterfaceDecl>(types.front());
|
|
1604
|
+
if (!interface)
|
|
1605
|
+
{
|
|
1606
|
+
if (emitErrors)
|
|
1607
|
+
{
|
|
1608
|
+
unit()->error("'" + identifier + "' is not an interface");
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
else
|
|
1612
|
+
{
|
|
1613
|
+
InterfaceDefPtr def = interface->definition();
|
|
1614
|
+
if (!def)
|
|
1615
|
+
{
|
|
1616
|
+
if (emitErrors)
|
|
1617
|
+
{
|
|
1618
|
+
unit()->error("'" + identifier + "' has been declared but not defined");
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
else
|
|
1622
|
+
{
|
|
1623
|
+
return def;
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
// If we failed to find a valid interface with the specified name.
|
|
1629
|
+
return nullptr;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
ExceptionPtr
|
|
1633
|
+
Slice::Container::lookupException(const string& identifier, bool emitErrors)
|
|
1634
|
+
{
|
|
1635
|
+
ContainedList contained = lookupContained(identifier, emitErrors);
|
|
1636
|
+
if (contained.empty())
|
|
1637
|
+
{
|
|
1638
|
+
return nullptr;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
ExceptionList exceptions;
|
|
1642
|
+
for (const auto& p : contained)
|
|
1643
|
+
{
|
|
1644
|
+
ExceptionPtr ex = dynamic_pointer_cast<Exception>(p);
|
|
1645
|
+
if (!ex)
|
|
1646
|
+
{
|
|
1647
|
+
if (emitErrors)
|
|
1648
|
+
{
|
|
1649
|
+
ostringstream os;
|
|
1650
|
+
os << "'" << identifier << "' is not an exception";
|
|
1651
|
+
unit()->error(os.str());
|
|
1652
|
+
}
|
|
1653
|
+
return nullptr;
|
|
1654
|
+
}
|
|
1655
|
+
exceptions.push_back(ex);
|
|
1656
|
+
}
|
|
1657
|
+
assert(exceptions.size() == 1);
|
|
1658
|
+
return exceptions.front();
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
ModuleList
|
|
1662
|
+
Slice::Container::modules() const
|
|
1663
|
+
{
|
|
1664
|
+
ModuleList result;
|
|
1665
|
+
for (const auto& p : _contents)
|
|
1666
|
+
{
|
|
1667
|
+
ModulePtr q = dynamic_pointer_cast<Module>(p);
|
|
1668
|
+
if (q)
|
|
1669
|
+
{
|
|
1670
|
+
result.push_back(q);
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
return result;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
InterfaceList
|
|
1677
|
+
Slice::Container::interfaces() const
|
|
1678
|
+
{
|
|
1679
|
+
InterfaceList result;
|
|
1680
|
+
for (const auto& p : _contents)
|
|
1681
|
+
{
|
|
1682
|
+
InterfaceDefPtr q = dynamic_pointer_cast<InterfaceDef>(p);
|
|
1683
|
+
if (q)
|
|
1684
|
+
{
|
|
1685
|
+
result.push_back(q);
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
return result;
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
EnumList
|
|
1692
|
+
Slice::Container::enums() const
|
|
1693
|
+
{
|
|
1694
|
+
EnumList result;
|
|
1695
|
+
for (const auto& p : _contents)
|
|
1696
|
+
{
|
|
1697
|
+
EnumPtr q = dynamic_pointer_cast<Enum>(p);
|
|
1698
|
+
if (q)
|
|
1699
|
+
{
|
|
1700
|
+
result.push_back(q);
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
return result;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
EnumeratorList
|
|
1707
|
+
Slice::Container::enumerators() const
|
|
1708
|
+
{
|
|
1709
|
+
EnumeratorList result;
|
|
1710
|
+
for (const auto& p : _contents)
|
|
1711
|
+
{
|
|
1712
|
+
EnumeratorPtr q = dynamic_pointer_cast<Enumerator>(p);
|
|
1713
|
+
if (q)
|
|
1714
|
+
{
|
|
1715
|
+
result.push_back(q);
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
return result;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
// Find enumerators using the old unscoped enumerators lookup
|
|
1722
|
+
EnumeratorList
|
|
1723
|
+
Slice::Container::enumerators(const string& identifier) const
|
|
1724
|
+
{
|
|
1725
|
+
EnumeratorList result;
|
|
1726
|
+
string::size_type lastColon = identifier.rfind(':');
|
|
1727
|
+
|
|
1728
|
+
if (lastColon == string::npos)
|
|
1729
|
+
{
|
|
1730
|
+
// check all enclosing scopes
|
|
1731
|
+
ContainerPtr container = const_pointer_cast<Container>(shared_from_this());
|
|
1732
|
+
do
|
|
1733
|
+
{
|
|
1734
|
+
EnumList enums = container->enums();
|
|
1735
|
+
for (const auto& p : enums)
|
|
1736
|
+
{
|
|
1737
|
+
ContainedList cl = p->lookupContained(identifier, false);
|
|
1738
|
+
if (!cl.empty())
|
|
1739
|
+
{
|
|
1740
|
+
result.push_back(dynamic_pointer_cast<Enumerator>(cl.front()));
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
ContainedPtr contained = dynamic_pointer_cast<Contained>(container);
|
|
1745
|
+
container = contained ? contained->container() : nullptr;
|
|
1746
|
+
} while (result.empty() && container);
|
|
1747
|
+
}
|
|
1748
|
+
else
|
|
1749
|
+
{
|
|
1750
|
+
// Find the referenced scope
|
|
1751
|
+
ContainerPtr container = const_pointer_cast<Container>(shared_from_this());
|
|
1752
|
+
string scope = identifier.substr(0, identifier.rfind("::"));
|
|
1753
|
+
ContainedList cl = container->lookupContained(scope, false);
|
|
1754
|
+
if (!cl.empty())
|
|
1755
|
+
{
|
|
1756
|
+
container = dynamic_pointer_cast<Container>(cl.front());
|
|
1757
|
+
if (container)
|
|
1758
|
+
{
|
|
1759
|
+
EnumList enums = container->enums();
|
|
1760
|
+
string name = identifier.substr(lastColon + 1);
|
|
1761
|
+
for (const auto& p : enums)
|
|
1762
|
+
{
|
|
1763
|
+
ContainedList cl2 = p->lookupContained(name, false);
|
|
1764
|
+
if (!cl2.empty())
|
|
1765
|
+
{
|
|
1766
|
+
result.push_back(dynamic_pointer_cast<Enumerator>(cl2.front()));
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
return result;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
ContainedList
|
|
1777
|
+
Slice::Container::contents() const
|
|
1778
|
+
{
|
|
1779
|
+
return _contents;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
string
|
|
1783
|
+
Slice::Container::thisScope() const
|
|
1784
|
+
{
|
|
1785
|
+
string s;
|
|
1786
|
+
ContainedPtr contained = dynamic_pointer_cast<Contained>(const_pointer_cast<Container>(shared_from_this()));
|
|
1787
|
+
if (contained)
|
|
1788
|
+
{
|
|
1789
|
+
s = contained->scoped();
|
|
1790
|
+
}
|
|
1791
|
+
s += "::";
|
|
1792
|
+
return s;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
void
|
|
1796
|
+
Slice::Container::visitContents(ParserVisitor* visitor)
|
|
1797
|
+
{
|
|
1798
|
+
for (const auto& p : _contents)
|
|
1799
|
+
{
|
|
1800
|
+
if (visitor->shouldVisitIncludedDefinitions() || p->includeLevel() == 0)
|
|
1801
|
+
{
|
|
1802
|
+
p->visit(visitor);
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
void
|
|
1808
|
+
Slice::Container::checkHasChangedMeaning(const string& name, ContainedPtr namedThing)
|
|
1809
|
+
{
|
|
1810
|
+
// If 'name' is empty or fully qualified, there's no risk of ambiguity, and so no need to check it.
|
|
1811
|
+
if (name.empty() || name[0] == ':')
|
|
1812
|
+
{
|
|
1813
|
+
return;
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
// Split off first component.
|
|
1817
|
+
string::size_type pos = name.find("::");
|
|
1818
|
+
string firstComponent = pos == string::npos ? name : name.substr(0, pos);
|
|
1819
|
+
|
|
1820
|
+
// If we don't have a type, the thing that is introduced is the contained for the first component.
|
|
1821
|
+
if (namedThing == nullptr)
|
|
1822
|
+
{
|
|
1823
|
+
ContainedList cl = lookupContained(firstComponent, false);
|
|
1824
|
+
if (cl.empty())
|
|
1825
|
+
{
|
|
1826
|
+
return; // Ignore types whose creation failed previously.
|
|
1827
|
+
}
|
|
1828
|
+
namedThing = cl.front();
|
|
1829
|
+
}
|
|
1830
|
+
else
|
|
1831
|
+
{
|
|
1832
|
+
// For each scope, get the container until we have the container for the first scope (which is the introduced
|
|
1833
|
+
// one).
|
|
1834
|
+
ContainerPtr c;
|
|
1835
|
+
bool first = true;
|
|
1836
|
+
while (pos != string::npos)
|
|
1837
|
+
{
|
|
1838
|
+
if (first)
|
|
1839
|
+
{
|
|
1840
|
+
c = namedThing->container();
|
|
1841
|
+
}
|
|
1842
|
+
else
|
|
1843
|
+
{
|
|
1844
|
+
ContainedPtr contained = dynamic_pointer_cast<Contained>(c);
|
|
1845
|
+
if (contained)
|
|
1846
|
+
{
|
|
1847
|
+
c = contained->container();
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
first = false;
|
|
1851
|
+
if (pos != string::npos)
|
|
1852
|
+
{
|
|
1853
|
+
pos = name.find("::", pos + 2);
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
if (dynamic_pointer_cast<Contained>(c))
|
|
1858
|
+
{
|
|
1859
|
+
namedThing = dynamic_pointer_cast<Contained>(c);
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
// Check if the first component is in the introduced map of this scope.
|
|
1864
|
+
auto it = _introducedMap.find(firstComponent);
|
|
1865
|
+
if (it == _introducedMap.end())
|
|
1866
|
+
{
|
|
1867
|
+
// We've just introduced the first component to the current scope.
|
|
1868
|
+
_introducedMap[firstComponent] = namedThing; // No, insert it
|
|
1869
|
+
}
|
|
1870
|
+
else
|
|
1871
|
+
{
|
|
1872
|
+
// If both identifiers resolve to the exact same element, then their meaning didn't change.
|
|
1873
|
+
if (it->second->scoped() == namedThing->scoped())
|
|
1874
|
+
{
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
// If the two identifiers resolve to different elements, but those elements are in the same container,
|
|
1879
|
+
// then the 'real' error is that the user redefined an element, not that an element changed meaning.
|
|
1880
|
+
// This error is reported elsewhere in the code, so nothing to do here.
|
|
1881
|
+
if (it->second->container() == namedThing->container())
|
|
1882
|
+
{
|
|
1883
|
+
return;
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
// We don't want to issue errors for data-members or parameters.
|
|
1887
|
+
// These elements always exist within a self-contained scope, the only way for them to "change meaning"
|
|
1888
|
+
// is to be redefined, which we already emit an error for elsewhere (see doesNameConflict).
|
|
1889
|
+
auto isInSelfContainedScope = [](const ContainedPtr& p)
|
|
1890
|
+
{ return dynamic_pointer_cast<DataMember>(p) || dynamic_pointer_cast<Parameter>(p); };
|
|
1891
|
+
|
|
1892
|
+
if (!isInSelfContainedScope(it->second) && !isInSelfContainedScope(namedThing))
|
|
1893
|
+
{
|
|
1894
|
+
unit()->error("'" + firstComponent + "' has changed meaning");
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
bool
|
|
1900
|
+
Slice::Container::checkForGlobalDefinition(const char* definitionKindPlural)
|
|
1901
|
+
{
|
|
1902
|
+
if (dynamic_cast<Unit*>(this))
|
|
1903
|
+
{
|
|
1904
|
+
ostringstream os;
|
|
1905
|
+
os << definitionKindPlural << " can only be defined within a module";
|
|
1906
|
+
unit()->error(os.str());
|
|
1907
|
+
return false;
|
|
1908
|
+
}
|
|
1909
|
+
return true;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
bool
|
|
1913
|
+
Slice::Container::validateConstant(
|
|
1914
|
+
const string& name,
|
|
1915
|
+
const TypePtr& type,
|
|
1916
|
+
SyntaxTreeBasePtr& valueType,
|
|
1917
|
+
const string& valueString,
|
|
1918
|
+
bool isConstant)
|
|
1919
|
+
{
|
|
1920
|
+
// Don't bother validating the constant if some other error prevented us from resolving its type.
|
|
1921
|
+
if (!type)
|
|
1922
|
+
{
|
|
1923
|
+
return true;
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
// isConstant indicates whether a constant or a data member (with a default value) is being defined.
|
|
1927
|
+
|
|
1928
|
+
const string desc = isConstant ? "constant" : "data member";
|
|
1929
|
+
|
|
1930
|
+
// If valueType is a ConstPtr, it means the constant or data member being defined refers to another constant.
|
|
1931
|
+
const ConstPtr constant = dynamic_pointer_cast<Const>(valueType);
|
|
1932
|
+
|
|
1933
|
+
// First verify that it is legal to specify a constant or default value for the given type.
|
|
1934
|
+
BuiltinPtr b = dynamic_pointer_cast<Builtin>(type);
|
|
1935
|
+
EnumPtr e = dynamic_pointer_cast<Enum>(type);
|
|
1936
|
+
|
|
1937
|
+
if (b)
|
|
1938
|
+
{
|
|
1939
|
+
if (b->usesClasses() || b->kind() == Builtin::KindObjectProxy)
|
|
1940
|
+
{
|
|
1941
|
+
if (isConstant)
|
|
1942
|
+
{
|
|
1943
|
+
ostringstream os;
|
|
1944
|
+
os << "constant '" << name << "' has illegal type: '" << b->kindAsString() << "'";
|
|
1945
|
+
unit()->error(os.str());
|
|
1946
|
+
}
|
|
1947
|
+
else
|
|
1948
|
+
{
|
|
1949
|
+
ostringstream os;
|
|
1950
|
+
os << "default value not allowed for data member '" << name << "' of type '" << b->kindAsString()
|
|
1951
|
+
<< "'";
|
|
1952
|
+
unit()->error(os.str());
|
|
1953
|
+
}
|
|
1954
|
+
return false;
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
else if (!e)
|
|
1958
|
+
{
|
|
1959
|
+
if (isConstant)
|
|
1960
|
+
{
|
|
1961
|
+
ostringstream os;
|
|
1962
|
+
os << "constant '" << name << "' has illegal type";
|
|
1963
|
+
unit()->error(os.str());
|
|
1964
|
+
}
|
|
1965
|
+
else
|
|
1966
|
+
{
|
|
1967
|
+
ostringstream os;
|
|
1968
|
+
os << "default value not allowed for data member '" << name << "'";
|
|
1969
|
+
unit()->error(os.str());
|
|
1970
|
+
}
|
|
1971
|
+
return false;
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
// Next, verify that the type of the constant or data member is compatible with the given value.
|
|
1975
|
+
if (b)
|
|
1976
|
+
{
|
|
1977
|
+
BuiltinPtr lt;
|
|
1978
|
+
|
|
1979
|
+
if (constant)
|
|
1980
|
+
{
|
|
1981
|
+
lt = dynamic_pointer_cast<Builtin>(constant->type());
|
|
1982
|
+
}
|
|
1983
|
+
else
|
|
1984
|
+
{
|
|
1985
|
+
lt = dynamic_pointer_cast<Builtin>(valueType);
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
if (lt)
|
|
1989
|
+
{
|
|
1990
|
+
bool ok = false;
|
|
1991
|
+
if (b->kind() == lt->kind())
|
|
1992
|
+
{
|
|
1993
|
+
ok = true;
|
|
1994
|
+
}
|
|
1995
|
+
else if (b->isIntegralType())
|
|
1996
|
+
{
|
|
1997
|
+
ok = lt->isIntegralType();
|
|
1998
|
+
}
|
|
1999
|
+
else if (b->isNumericType())
|
|
2000
|
+
{
|
|
2001
|
+
ok = lt->isNumericType();
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
if (!ok)
|
|
2005
|
+
{
|
|
2006
|
+
ostringstream os;
|
|
2007
|
+
os << "initializer of type '" << lt->kindAsString() << "' is incompatible with the type '"
|
|
2008
|
+
<< b->kindAsString() << "' of " << desc << " '" << name << "'";
|
|
2009
|
+
unit()->error(os.str());
|
|
2010
|
+
return false;
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
else
|
|
2014
|
+
{
|
|
2015
|
+
ostringstream os;
|
|
2016
|
+
os << "type of initializer is incompatible with the type '" << b->kindAsString() << "' of " << desc << " '"
|
|
2017
|
+
<< name << "'";
|
|
2018
|
+
unit()->error(os.str());
|
|
2019
|
+
return false;
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
switch (b->kind())
|
|
2023
|
+
{
|
|
2024
|
+
case Builtin::KindByte:
|
|
2025
|
+
{
|
|
2026
|
+
int64_t l = std::stoll(valueString, nullptr, 0);
|
|
2027
|
+
if (l < numeric_limits<uint8_t>::min() || l > numeric_limits<uint8_t>::max())
|
|
2028
|
+
{
|
|
2029
|
+
ostringstream os;
|
|
2030
|
+
os << "initializer '" << valueString << "' for " << desc << " '" << name
|
|
2031
|
+
<< "' out of range for type byte";
|
|
2032
|
+
unit()->error(os.str());
|
|
2033
|
+
return false;
|
|
2034
|
+
}
|
|
2035
|
+
break;
|
|
2036
|
+
}
|
|
2037
|
+
case Builtin::KindShort:
|
|
2038
|
+
{
|
|
2039
|
+
int64_t l = std::stoll(valueString, nullptr, 0);
|
|
2040
|
+
if (l < numeric_limits<int16_t>::min() || l > numeric_limits<int16_t>::max())
|
|
2041
|
+
{
|
|
2042
|
+
ostringstream os;
|
|
2043
|
+
os << "initializer '" << valueString << "' for " << desc << " '" << name
|
|
2044
|
+
<< "' out of range for type short";
|
|
2045
|
+
unit()->error(os.str());
|
|
2046
|
+
return false;
|
|
2047
|
+
}
|
|
2048
|
+
break;
|
|
2049
|
+
}
|
|
2050
|
+
case Builtin::KindInt:
|
|
2051
|
+
{
|
|
2052
|
+
int64_t l = std::stoll(valueString, nullptr, 0);
|
|
2053
|
+
if (l < numeric_limits<int32_t>::min() || l > numeric_limits<int32_t>::max())
|
|
2054
|
+
{
|
|
2055
|
+
ostringstream os;
|
|
2056
|
+
os << "initializer '" << valueString << "' for " + desc << " '" << name
|
|
2057
|
+
<< "' out of range for type int";
|
|
2058
|
+
unit()->error(os.str());
|
|
2059
|
+
return false;
|
|
2060
|
+
}
|
|
2061
|
+
break;
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
default:
|
|
2065
|
+
{
|
|
2066
|
+
break;
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
if (e)
|
|
2072
|
+
{
|
|
2073
|
+
if (constant)
|
|
2074
|
+
{
|
|
2075
|
+
EnumPtr ec = dynamic_pointer_cast<Enum>(constant->type());
|
|
2076
|
+
if (e != ec)
|
|
2077
|
+
{
|
|
2078
|
+
ostringstream os;
|
|
2079
|
+
os << "type of initializer is incompatible with the type of " << desc << " '" << name << "'";
|
|
2080
|
+
unit()->error(os.str());
|
|
2081
|
+
return false;
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
else
|
|
2085
|
+
{
|
|
2086
|
+
if (valueType)
|
|
2087
|
+
{
|
|
2088
|
+
EnumeratorPtr lte = dynamic_pointer_cast<Enumerator>(valueType);
|
|
2089
|
+
|
|
2090
|
+
if (!lte)
|
|
2091
|
+
{
|
|
2092
|
+
ostringstream os;
|
|
2093
|
+
os << "type of initializer is incompatible with the type of " << desc << " '" << name << "'";
|
|
2094
|
+
unit()->error(os.str());
|
|
2095
|
+
return false;
|
|
2096
|
+
}
|
|
2097
|
+
EnumeratorList elist = e->enumerators();
|
|
2098
|
+
if (find(elist.begin(), elist.end(), lte) == elist.end())
|
|
2099
|
+
{
|
|
2100
|
+
ostringstream os;
|
|
2101
|
+
os << "enumerator '" << valueString << "' is not defined in enumeration '" << e->scoped() << "'";
|
|
2102
|
+
unit()->error(os.str());
|
|
2103
|
+
return false;
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
else
|
|
2107
|
+
{
|
|
2108
|
+
// Check if value designates an enumerator of e
|
|
2109
|
+
string newVal = valueString;
|
|
2110
|
+
string::size_type lastColon = valueString.rfind(':');
|
|
2111
|
+
if (lastColon != string::npos && lastColon + 1 < valueString.length())
|
|
2112
|
+
{
|
|
2113
|
+
newVal =
|
|
2114
|
+
valueString.substr(0, lastColon + 1) + e->name() + "::" + valueString.substr(lastColon + 1);
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
ContainedList clist = e->lookupContained(newVal, false);
|
|
2118
|
+
if (clist.empty())
|
|
2119
|
+
{
|
|
2120
|
+
ostringstream os;
|
|
2121
|
+
os << "'" << valueString << "' does not designate an enumerator of '" << e->scoped() << "'";
|
|
2122
|
+
unit()->error(os.str());
|
|
2123
|
+
return false;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
EnumeratorPtr lte = dynamic_pointer_cast<Enumerator>(clist.front());
|
|
2127
|
+
if (lte)
|
|
2128
|
+
{
|
|
2129
|
+
valueType = lte;
|
|
2130
|
+
}
|
|
2131
|
+
else
|
|
2132
|
+
{
|
|
2133
|
+
ostringstream os;
|
|
2134
|
+
os << "type of initializer is incompatible with the type of " << desc << " '" << name << "'";
|
|
2135
|
+
unit()->error(os.str());
|
|
2136
|
+
return false;
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
return true;
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
// ----------------------------------------------------------------------
|
|
2146
|
+
// Module
|
|
2147
|
+
// ----------------------------------------------------------------------
|
|
2148
|
+
|
|
2149
|
+
string
|
|
2150
|
+
Slice::Module::kindOf() const
|
|
2151
|
+
{
|
|
2152
|
+
return "module";
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
ModulePtr
|
|
2156
|
+
Slice::Module::getTopLevelModule() const
|
|
2157
|
+
{
|
|
2158
|
+
if (auto parent = dynamic_pointer_cast<Contained>(container()))
|
|
2159
|
+
{
|
|
2160
|
+
return parent->getTopLevelModule();
|
|
2161
|
+
}
|
|
2162
|
+
// Reaching here means that this module is at the top-level! We return it.
|
|
2163
|
+
return dynamic_pointer_cast<Module>(const_pointer_cast<Container>(shared_from_this()));
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
void
|
|
2167
|
+
Slice::Module::visit(ParserVisitor* visitor)
|
|
2168
|
+
{
|
|
2169
|
+
auto self = dynamic_pointer_cast<Module>(shared_from_this());
|
|
2170
|
+
if (visitor->visitModuleStart(self))
|
|
2171
|
+
{
|
|
2172
|
+
visitContents(visitor);
|
|
2173
|
+
visitor->visitModuleEnd(self);
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
void
|
|
2178
|
+
Slice::Module::destroy()
|
|
2179
|
+
{
|
|
2180
|
+
destroyContents();
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
Slice::Module::Module(const ContainerPtr& container, const string& name, bool nestedSyntax)
|
|
2184
|
+
: Contained(container, name),
|
|
2185
|
+
usesNestedSyntax(nestedSyntax)
|
|
2186
|
+
{
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
// ----------------------------------------------------------------------
|
|
2190
|
+
// ClassDecl
|
|
2191
|
+
// ----------------------------------------------------------------------
|
|
2192
|
+
|
|
2193
|
+
void
|
|
2194
|
+
Slice::ClassDecl::destroy()
|
|
2195
|
+
{
|
|
2196
|
+
_definition = nullptr;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
ClassDefPtr
|
|
2200
|
+
Slice::ClassDecl::definition() const
|
|
2201
|
+
{
|
|
2202
|
+
return _definition;
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
bool
|
|
2206
|
+
Slice::ClassDecl::isClassType() const
|
|
2207
|
+
{
|
|
2208
|
+
return true;
|
|
2209
|
+
}
|
|
2210
|
+
|
|
2211
|
+
size_t
|
|
2212
|
+
Slice::ClassDecl::minWireSize() const
|
|
2213
|
+
{
|
|
2214
|
+
return 1; // At least four bytes for an instance, if the instance is marshaled as an index.
|
|
2215
|
+
}
|
|
2216
|
+
|
|
2217
|
+
string
|
|
2218
|
+
Slice::ClassDecl::getOptionalFormat() const
|
|
2219
|
+
{
|
|
2220
|
+
return "Class";
|
|
2221
|
+
}
|
|
2222
|
+
|
|
2223
|
+
bool
|
|
2224
|
+
Slice::ClassDecl::isVariableLength() const
|
|
2225
|
+
{
|
|
2226
|
+
return true;
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
string
|
|
2230
|
+
Slice::ClassDecl::kindOf() const
|
|
2231
|
+
{
|
|
2232
|
+
return "class";
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
void
|
|
2236
|
+
Slice::ClassDecl::visit(ParserVisitor* visitor)
|
|
2237
|
+
{
|
|
2238
|
+
visitor->visitClassDecl(shared_from_this());
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
Slice::ClassDecl::ClassDecl(const ContainerPtr& container, const string& name) : Contained(container, name) {}
|
|
2242
|
+
|
|
2243
|
+
// ----------------------------------------------------------------------
|
|
2244
|
+
// ClassDef
|
|
2245
|
+
// ----------------------------------------------------------------------
|
|
2246
|
+
|
|
2247
|
+
void
|
|
2248
|
+
Slice::ClassDef::destroy()
|
|
2249
|
+
{
|
|
2250
|
+
_declaration = nullptr;
|
|
2251
|
+
_base = nullptr;
|
|
2252
|
+
destroyContents();
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
DataMemberPtr
|
|
2256
|
+
Slice::ClassDef::createDataMember(
|
|
2257
|
+
const string& name,
|
|
2258
|
+
const TypePtr& type,
|
|
2259
|
+
bool isOptional,
|
|
2260
|
+
int32_t tag,
|
|
2261
|
+
SyntaxTreeBasePtr defaultValueType,
|
|
2262
|
+
optional<string> defaultValueString)
|
|
2263
|
+
{
|
|
2264
|
+
if (defaultValueString)
|
|
2265
|
+
{
|
|
2266
|
+
// Validate the default value.
|
|
2267
|
+
if (!validateConstant(name, type, defaultValueType, *defaultValueString, false))
|
|
2268
|
+
{
|
|
2269
|
+
// Create the data member anyway, just without the default value.
|
|
2270
|
+
defaultValueType = nullptr;
|
|
2271
|
+
defaultValueString = nullopt;
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
DataMemberPtr member = make_shared<DataMember>(
|
|
2276
|
+
shared_from_this(),
|
|
2277
|
+
name,
|
|
2278
|
+
type,
|
|
2279
|
+
isOptional,
|
|
2280
|
+
tag,
|
|
2281
|
+
std::move(defaultValueType),
|
|
2282
|
+
std::move(defaultValueString));
|
|
2283
|
+
|
|
2284
|
+
if (!name.empty())
|
|
2285
|
+
{
|
|
2286
|
+
if (!doesNameConflict(name, "data member", _contents))
|
|
2287
|
+
{
|
|
2288
|
+
// If this data member's identifier doesn't conflict with another definition,
|
|
2289
|
+
// add it to the unit's contentMap so it can be looked up later.
|
|
2290
|
+
unit()->addContent(member);
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
reportIllegalSuffixOrUnderscore(name);
|
|
2294
|
+
|
|
2295
|
+
// Check whether any bases have defined something with the same name already.
|
|
2296
|
+
if (_base)
|
|
2297
|
+
{
|
|
2298
|
+
for (const auto& baseMember : _base->allDataMembers())
|
|
2299
|
+
{
|
|
2300
|
+
if (baseMember->name() == name)
|
|
2301
|
+
{
|
|
2302
|
+
ostringstream os;
|
|
2303
|
+
os << "data member '" << name << "' is already defined as a data member in a base class";
|
|
2304
|
+
unit()->error(os.str());
|
|
2305
|
+
break;
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
string baseName = IceInternal::toLower(baseMember->name());
|
|
2309
|
+
string newName = IceInternal::toLower(name);
|
|
2310
|
+
if (baseName == newName)
|
|
2311
|
+
{
|
|
2312
|
+
ostringstream os;
|
|
2313
|
+
os << "data member '" << name << "' differs only in capitalization from data member '"
|
|
2314
|
+
<< baseMember->name() << "', which is defined in a base class";
|
|
2315
|
+
unit()->error(os.str());
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
if (isOptional)
|
|
2322
|
+
{
|
|
2323
|
+
// Validate the tag.
|
|
2324
|
+
for (const auto& q : dataMembers())
|
|
2325
|
+
{
|
|
2326
|
+
if (q->optional() && tag == q->tag())
|
|
2327
|
+
{
|
|
2328
|
+
unit()->error("tag for optional data member '" + name + "' is already in use");
|
|
2329
|
+
break;
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
_contents.push_back(member);
|
|
2335
|
+
return member;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
ClassDeclPtr
|
|
2339
|
+
Slice::ClassDef::declaration() const
|
|
2340
|
+
{
|
|
2341
|
+
return _declaration;
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
ClassDefPtr
|
|
2345
|
+
Slice::ClassDef::base() const
|
|
2346
|
+
{
|
|
2347
|
+
return _base;
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
ClassList
|
|
2351
|
+
Slice::ClassDef::allBases() const
|
|
2352
|
+
{
|
|
2353
|
+
ClassList result;
|
|
2354
|
+
if (_base)
|
|
2355
|
+
{
|
|
2356
|
+
result.push_back(_base);
|
|
2357
|
+
result.merge(_base->allBases());
|
|
2358
|
+
}
|
|
2359
|
+
return result;
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
DataMemberList
|
|
2363
|
+
Slice::ClassDef::dataMembers() const
|
|
2364
|
+
{
|
|
2365
|
+
DataMemberList result;
|
|
2366
|
+
for (const auto& p : _contents)
|
|
2367
|
+
{
|
|
2368
|
+
DataMemberPtr q = dynamic_pointer_cast<DataMember>(p);
|
|
2369
|
+
if (q)
|
|
2370
|
+
{
|
|
2371
|
+
result.push_back(q);
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
return result;
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
DataMemberList
|
|
2378
|
+
Slice::ClassDef::orderedOptionalDataMembers() const
|
|
2379
|
+
{
|
|
2380
|
+
return filterOrderedOptionalDataMembers(dataMembers());
|
|
2381
|
+
}
|
|
2382
|
+
|
|
2383
|
+
// Return the data members of this class and its parent classes, in base-to-derived order.
|
|
2384
|
+
DataMemberList
|
|
2385
|
+
Slice::ClassDef::allDataMembers() const
|
|
2386
|
+
{
|
|
2387
|
+
DataMemberList result;
|
|
2388
|
+
|
|
2389
|
+
// Check if we have a base class. If so, recursively get the data members of the base(s).
|
|
2390
|
+
if (_base)
|
|
2391
|
+
{
|
|
2392
|
+
result = _base->allDataMembers();
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
// Append this class's data members.
|
|
2396
|
+
DataMemberList myMembers = dataMembers();
|
|
2397
|
+
result.splice(result.end(), myMembers);
|
|
2398
|
+
|
|
2399
|
+
return result;
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
DataMemberList
|
|
2403
|
+
Slice::ClassDef::classDataMembers() const
|
|
2404
|
+
{
|
|
2405
|
+
DataMemberList result;
|
|
2406
|
+
for (const auto& p : _contents)
|
|
2407
|
+
{
|
|
2408
|
+
DataMemberPtr q = dynamic_pointer_cast<DataMember>(p);
|
|
2409
|
+
if (q && q->type()->isClassType())
|
|
2410
|
+
{
|
|
2411
|
+
result.push_back(q);
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
return result;
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
bool
|
|
2418
|
+
Slice::ClassDef::canBeCyclic() const
|
|
2419
|
+
{
|
|
2420
|
+
if (_base && _base->canBeCyclic())
|
|
2421
|
+
{
|
|
2422
|
+
return true;
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2425
|
+
for (const auto& i : dataMembers())
|
|
2426
|
+
{
|
|
2427
|
+
if (i->type()->usesClasses())
|
|
2428
|
+
{
|
|
2429
|
+
return true;
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
return false;
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
string
|
|
2436
|
+
Slice::ClassDef::kindOf() const
|
|
2437
|
+
{
|
|
2438
|
+
return "class";
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
void
|
|
2442
|
+
Slice::ClassDef::visit(ParserVisitor* visitor)
|
|
2443
|
+
{
|
|
2444
|
+
auto self = dynamic_pointer_cast<ClassDef>(shared_from_this());
|
|
2445
|
+
if (visitor->visitClassDefStart(self))
|
|
2446
|
+
{
|
|
2447
|
+
visitContents(visitor);
|
|
2448
|
+
visitor->visitClassDefEnd(self);
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
int32_t
|
|
2453
|
+
Slice::ClassDef::compactId() const
|
|
2454
|
+
{
|
|
2455
|
+
return _compactId;
|
|
2456
|
+
}
|
|
2457
|
+
|
|
2458
|
+
const MetadataList&
|
|
2459
|
+
Slice::ClassDef::getMetadata() const
|
|
2460
|
+
{
|
|
2461
|
+
return _declaration->getMetadata();
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
void
|
|
2465
|
+
Slice::ClassDef::setMetadata(MetadataList metadata)
|
|
2466
|
+
{
|
|
2467
|
+
_declaration->setMetadata(std::move(metadata));
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
void
|
|
2471
|
+
Slice::ClassDef::appendMetadata(MetadataList metadata)
|
|
2472
|
+
{
|
|
2473
|
+
_declaration->appendMetadata(std::move(metadata));
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
Slice::ClassDef::ClassDef(const ContainerPtr& container, const string& name, int32_t id, ClassDefPtr base)
|
|
2477
|
+
: Contained(container, name),
|
|
2478
|
+
_base(std::move(base)),
|
|
2479
|
+
_compactId(id)
|
|
2480
|
+
{
|
|
2481
|
+
if (_compactId != -1 && !name.empty())
|
|
2482
|
+
{
|
|
2483
|
+
unit()->addTypeId(_compactId, scoped());
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
// ----------------------------------------------------------------------
|
|
2488
|
+
// InterfaceDecl
|
|
2489
|
+
// ----------------------------------------------------------------------
|
|
2490
|
+
|
|
2491
|
+
void
|
|
2492
|
+
Slice::InterfaceDecl::destroy()
|
|
2493
|
+
{
|
|
2494
|
+
_definition = nullptr;
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
InterfaceDefPtr
|
|
2498
|
+
Slice::InterfaceDecl::definition() const
|
|
2499
|
+
{
|
|
2500
|
+
return _definition;
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
size_t
|
|
2504
|
+
Slice::InterfaceDecl::minWireSize() const
|
|
2505
|
+
{
|
|
2506
|
+
return 2; // a null proxy is encoded on 2 bytes
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
string
|
|
2510
|
+
Slice::InterfaceDecl::getOptionalFormat() const
|
|
2511
|
+
{
|
|
2512
|
+
return "FSize"; // with the 1.1 encoding, the size of a proxy is encoded using a fixed-length size
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
bool
|
|
2516
|
+
Slice::InterfaceDecl::isVariableLength() const
|
|
2517
|
+
{
|
|
2518
|
+
return true;
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
string
|
|
2522
|
+
Slice::InterfaceDecl::kindOf() const
|
|
2523
|
+
{
|
|
2524
|
+
return "interface";
|
|
2525
|
+
}
|
|
2526
|
+
|
|
2527
|
+
void
|
|
2528
|
+
Slice::InterfaceDecl::visit(ParserVisitor* visitor)
|
|
2529
|
+
{
|
|
2530
|
+
visitor->visitInterfaceDecl(shared_from_this());
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
void
|
|
2534
|
+
Slice::InterfaceDecl::checkBasesAreLegal(const string& name, const InterfaceList& bases, const UnitPtr& unit)
|
|
2535
|
+
{
|
|
2536
|
+
// Check whether, for multiple inheritance, any of the bases define the same operations.
|
|
2537
|
+
if (bases.size() > 1)
|
|
2538
|
+
{
|
|
2539
|
+
//
|
|
2540
|
+
// We have multiple inheritance. Build a list of paths through the
|
|
2541
|
+
// inheritance graph, such that multiple inheritance is legal if
|
|
2542
|
+
// the union of the names defined in classes on each path are disjoint.
|
|
2543
|
+
//
|
|
2544
|
+
GraphPartitionList gpl;
|
|
2545
|
+
for (const auto& base : bases)
|
|
2546
|
+
{
|
|
2547
|
+
InterfaceList cl;
|
|
2548
|
+
gpl.push_back(cl);
|
|
2549
|
+
addPartition(gpl, gpl.rbegin(), base);
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
//
|
|
2553
|
+
// We now have a list of partitions, with each partition containing
|
|
2554
|
+
// a list of class definitions. Turn the list of partitions of class
|
|
2555
|
+
// definitions into a list of sets of strings, with each
|
|
2556
|
+
// set containing the names of operations and data members defined in
|
|
2557
|
+
// the classes in each partition.
|
|
2558
|
+
//
|
|
2559
|
+
StringPartitionList spl = toStringPartitionList(gpl);
|
|
2560
|
+
|
|
2561
|
+
//
|
|
2562
|
+
// Multiple inheritance is legal if no two partitions contain a common
|
|
2563
|
+
// name (that is, if the union of the intersections of all possible pairs
|
|
2564
|
+
// of partitions is empty).
|
|
2565
|
+
//
|
|
2566
|
+
checkPairIntersections(spl, name, unit);
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
Slice::InterfaceDecl::InterfaceDecl(const ContainerPtr& container, const string& name) : Contained(container, name) {}
|
|
2571
|
+
|
|
2572
|
+
// Return `true` if the interface definition `idp` is on one of the interface lists in `gpl`, `false` otherwise.
|
|
2573
|
+
bool
|
|
2574
|
+
Slice::InterfaceDecl::isInList(const GraphPartitionList& gpl, const InterfaceDefPtr& interfaceDef)
|
|
2575
|
+
{
|
|
2576
|
+
for (const auto& i : gpl)
|
|
2577
|
+
{
|
|
2578
|
+
if (any_of(
|
|
2579
|
+
i.begin(),
|
|
2580
|
+
i.end(),
|
|
2581
|
+
[scope = interfaceDef->scoped()](const auto& other) { return other->scoped() == scope; }))
|
|
2582
|
+
{
|
|
2583
|
+
return true;
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2586
|
+
return false;
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2589
|
+
void
|
|
2590
|
+
Slice::InterfaceDecl::addPartition(
|
|
2591
|
+
GraphPartitionList& partitions,
|
|
2592
|
+
const GraphPartitionList::reverse_iterator& tail,
|
|
2593
|
+
const InterfaceDefPtr& base)
|
|
2594
|
+
{
|
|
2595
|
+
// If this base is on one of the partition lists already, do nothing.
|
|
2596
|
+
if (isInList(partitions, base))
|
|
2597
|
+
{
|
|
2598
|
+
return;
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
// Put the current base at the end of the current partition.
|
|
2602
|
+
tail->push_back(base);
|
|
2603
|
+
|
|
2604
|
+
// If the base has bases in turn, recurse, adding the first base of base (the left-most "grandbase") to the current
|
|
2605
|
+
// partition.
|
|
2606
|
+
if (base->bases().size())
|
|
2607
|
+
{
|
|
2608
|
+
addPartition(partitions, tail, *(base->bases().begin()));
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
// If the base has multiple bases, each of the "grandbases" except for the left-most (which we just dealt with)
|
|
2612
|
+
// adds a new partition.
|
|
2613
|
+
if (base->bases().size() > 1)
|
|
2614
|
+
{
|
|
2615
|
+
InterfaceList grandBases = base->bases();
|
|
2616
|
+
auto i = grandBases.begin();
|
|
2617
|
+
while (++i != grandBases.end())
|
|
2618
|
+
{
|
|
2619
|
+
InterfaceList cl;
|
|
2620
|
+
partitions.push_back(cl);
|
|
2621
|
+
addPartition(partitions, partitions.rbegin(), *i);
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
//
|
|
2627
|
+
// Convert the list of partitions of interface definitions into a
|
|
2628
|
+
// list of lists, with each member list containing the operation
|
|
2629
|
+
// names defined by the interfaces in each partition.
|
|
2630
|
+
//
|
|
2631
|
+
Slice::InterfaceDecl::StringPartitionList
|
|
2632
|
+
Slice::InterfaceDecl::toStringPartitionList(const GraphPartitionList& partitions)
|
|
2633
|
+
{
|
|
2634
|
+
StringPartitionList spl;
|
|
2635
|
+
for (const auto& interfaces : partitions)
|
|
2636
|
+
{
|
|
2637
|
+
StringList sl;
|
|
2638
|
+
for (const auto& interfaceDefinition : interfaces)
|
|
2639
|
+
{
|
|
2640
|
+
for (const auto& operation : interfaceDefinition->operations())
|
|
2641
|
+
{
|
|
2642
|
+
sl.push_back(operation->name());
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
spl.push_back(std::move(sl));
|
|
2646
|
+
}
|
|
2647
|
+
return spl;
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
//
|
|
2651
|
+
// For all (unique) pairs of string lists, check whether an identifier in one list occurs
|
|
2652
|
+
// in the other and, if so, complain.
|
|
2653
|
+
//
|
|
2654
|
+
void
|
|
2655
|
+
Slice::InterfaceDecl::checkPairIntersections(
|
|
2656
|
+
const StringPartitionList& stringPartitions,
|
|
2657
|
+
const string& name,
|
|
2658
|
+
const UnitPtr& unit)
|
|
2659
|
+
{
|
|
2660
|
+
set<string> reported;
|
|
2661
|
+
for (auto i = stringPartitions.begin(); i != stringPartitions.end(); ++i)
|
|
2662
|
+
{
|
|
2663
|
+
auto cursor = i;
|
|
2664
|
+
++cursor;
|
|
2665
|
+
for (auto j = cursor; j != stringPartitions.end(); ++j)
|
|
2666
|
+
{
|
|
2667
|
+
for (const auto& s1 : *i)
|
|
2668
|
+
{
|
|
2669
|
+
for (const auto& s2 : *j)
|
|
2670
|
+
{
|
|
2671
|
+
if (s1 == s2 && reported.find(s1) == reported.end())
|
|
2672
|
+
{
|
|
2673
|
+
ostringstream os;
|
|
2674
|
+
os << "ambiguous multiple inheritance: '" << name << "' inherits operation '" << s1
|
|
2675
|
+
<< "' from two or more unrelated base interfaces";
|
|
2676
|
+
unit->error(os.str());
|
|
2677
|
+
reported.insert(s1);
|
|
2678
|
+
}
|
|
2679
|
+
else if (
|
|
2680
|
+
!CICompare()(s1, s2) && !CICompare()(s2, s1) && reported.find(s1) == reported.end() &&
|
|
2681
|
+
reported.find(s2) == reported.end())
|
|
2682
|
+
{
|
|
2683
|
+
ostringstream os;
|
|
2684
|
+
os << "ambiguous multiple inheritance: '" << name << "' inherits operations '" << s1
|
|
2685
|
+
<< "' and '" << s2
|
|
2686
|
+
<< "', which differ only in capitalization, from unrelated base interfaces";
|
|
2687
|
+
unit->error(os.str());
|
|
2688
|
+
reported.insert(s1);
|
|
2689
|
+
reported.insert(s2);
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
// ----------------------------------------------------------------------
|
|
2698
|
+
// InterfaceDef
|
|
2699
|
+
// ----------------------------------------------------------------------
|
|
2700
|
+
|
|
2701
|
+
void
|
|
2702
|
+
Slice::InterfaceDef::destroy()
|
|
2703
|
+
{
|
|
2704
|
+
_declaration = nullptr;
|
|
2705
|
+
_bases.clear();
|
|
2706
|
+
destroyContents();
|
|
2707
|
+
}
|
|
2708
|
+
|
|
2709
|
+
OperationPtr
|
|
2710
|
+
Slice::InterfaceDef::createOperation(
|
|
2711
|
+
const string& name,
|
|
2712
|
+
const TypePtr& returnType,
|
|
2713
|
+
bool isOptional,
|
|
2714
|
+
int32_t tag,
|
|
2715
|
+
Operation::Mode mode)
|
|
2716
|
+
{
|
|
2717
|
+
OperationPtr op = make_shared<Operation>(shared_from_this(), name, returnType, isOptional, tag, mode);
|
|
2718
|
+
|
|
2719
|
+
if (!name.empty())
|
|
2720
|
+
{
|
|
2721
|
+
bool hasConflictingIdentifier = doesNameConflict(name, "operation", _contents);
|
|
2722
|
+
|
|
2723
|
+
// Check whether enclosing interface has the same name.
|
|
2724
|
+
if (name == this->name())
|
|
2725
|
+
{
|
|
2726
|
+
ostringstream os;
|
|
2727
|
+
os << "interface name '" << name << "' cannot be used as operation name";
|
|
2728
|
+
unit()->error(os.str());
|
|
2729
|
+
hasConflictingIdentifier = true;
|
|
2730
|
+
}
|
|
2731
|
+
else if (IceInternal::toLower(name) == IceInternal::toLower(this->name()))
|
|
2732
|
+
{
|
|
2733
|
+
ostringstream os;
|
|
2734
|
+
os << "operation '" << name << "' differs only in capitalization from enclosing interface name '"
|
|
2735
|
+
<< this->name() << "'";
|
|
2736
|
+
unit()->error(os.str());
|
|
2737
|
+
hasConflictingIdentifier = true;
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
// Check whether any base has an operation with the same name already
|
|
2741
|
+
for (const auto& baseInterface : _bases)
|
|
2742
|
+
{
|
|
2743
|
+
vector<string> baseNames;
|
|
2744
|
+
for (const auto& baseOp : baseInterface->allOperations())
|
|
2745
|
+
{
|
|
2746
|
+
baseNames.push_back(baseOp->name());
|
|
2747
|
+
}
|
|
2748
|
+
if (!checkBaseOperationNames(name, baseNames))
|
|
2749
|
+
{
|
|
2750
|
+
hasConflictingIdentifier = true;
|
|
2751
|
+
break;
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
// Check the operations of the Object pseudo-interface.
|
|
2755
|
+
if (!checkBaseOperationNames(name, {"ice_id", "ice_ids", "ice_ping", "ice_isA"}))
|
|
2756
|
+
{
|
|
2757
|
+
hasConflictingIdentifier = true;
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
if (!hasConflictingIdentifier)
|
|
2761
|
+
{
|
|
2762
|
+
// If this operation's identifier doesn't conflict with another definition,
|
|
2763
|
+
// add it to the unit's contentMap so it can be looked up later.
|
|
2764
|
+
unit()->addContent(op);
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
_contents.push_back(op);
|
|
2769
|
+
return op;
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2772
|
+
bool
|
|
2773
|
+
Slice::InterfaceDef::checkBaseOperationNames(const string& name, const vector<string>& baseNames)
|
|
2774
|
+
{
|
|
2775
|
+
string nameInLowercase = IceInternal::toLower(name);
|
|
2776
|
+
|
|
2777
|
+
for (const auto& baseName : baseNames)
|
|
2778
|
+
{
|
|
2779
|
+
if (baseName == name)
|
|
2780
|
+
{
|
|
2781
|
+
ostringstream os;
|
|
2782
|
+
os << "operation '" << name << "' is already defined as an operation in a base interface";
|
|
2783
|
+
unit()->error(os.str());
|
|
2784
|
+
return false;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
string baseNameInLowercase = IceInternal::toLower(baseName);
|
|
2788
|
+
|
|
2789
|
+
if (baseNameInLowercase == nameInLowercase)
|
|
2790
|
+
{
|
|
2791
|
+
ostringstream os;
|
|
2792
|
+
os << "operation '" << name << "' differs only in capitalization from operation"
|
|
2793
|
+
<< " '" << baseName << "', which is defined in a base interface";
|
|
2794
|
+
unit()->error(os.str());
|
|
2795
|
+
return false;
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
return true;
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
InterfaceDeclPtr
|
|
2802
|
+
Slice::InterfaceDef::declaration() const
|
|
2803
|
+
{
|
|
2804
|
+
return _declaration;
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
InterfaceList
|
|
2808
|
+
Slice::InterfaceDef::bases() const
|
|
2809
|
+
{
|
|
2810
|
+
return _bases;
|
|
2811
|
+
}
|
|
2812
|
+
|
|
2813
|
+
InterfaceList
|
|
2814
|
+
Slice::InterfaceDef::allBases() const
|
|
2815
|
+
{
|
|
2816
|
+
InterfaceList result = _bases;
|
|
2817
|
+
result.sort(containedCompare);
|
|
2818
|
+
for (const auto& p : _bases)
|
|
2819
|
+
{
|
|
2820
|
+
result.merge(p->allBases(), containedCompare);
|
|
2821
|
+
result.unique(containedEqual);
|
|
2822
|
+
}
|
|
2823
|
+
return result;
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
OperationList
|
|
2827
|
+
Slice::InterfaceDef::operations() const
|
|
2828
|
+
{
|
|
2829
|
+
OperationList result;
|
|
2830
|
+
for (const auto& p : _contents)
|
|
2831
|
+
{
|
|
2832
|
+
OperationPtr q = dynamic_pointer_cast<Operation>(p);
|
|
2833
|
+
if (q)
|
|
2834
|
+
{
|
|
2835
|
+
result.push_back(q);
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
return result;
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
OperationList
|
|
2842
|
+
Slice::InterfaceDef::allOperations() const
|
|
2843
|
+
{
|
|
2844
|
+
OperationList result;
|
|
2845
|
+
for (const auto& p : _bases)
|
|
2846
|
+
{
|
|
2847
|
+
for (const auto& q : p->allOperations())
|
|
2848
|
+
{
|
|
2849
|
+
if (none_of(
|
|
2850
|
+
result.begin(),
|
|
2851
|
+
result.end(),
|
|
2852
|
+
[name = q->name()](const auto& other) { return other->name() == name; }))
|
|
2853
|
+
{
|
|
2854
|
+
result.push_back(q);
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2859
|
+
for (const auto& q : operations())
|
|
2860
|
+
{
|
|
2861
|
+
if (none_of(
|
|
2862
|
+
result.begin(),
|
|
2863
|
+
result.end(),
|
|
2864
|
+
[name = q->name()](const auto& other) { return other->name() == name; }))
|
|
2865
|
+
{
|
|
2866
|
+
result.push_back(q);
|
|
2867
|
+
}
|
|
2868
|
+
}
|
|
2869
|
+
return result;
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
string
|
|
2873
|
+
Slice::InterfaceDef::kindOf() const
|
|
2874
|
+
{
|
|
2875
|
+
return "interface";
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2878
|
+
void
|
|
2879
|
+
Slice::InterfaceDef::visit(ParserVisitor* visitor)
|
|
2880
|
+
{
|
|
2881
|
+
auto self = dynamic_pointer_cast<InterfaceDef>(shared_from_this());
|
|
2882
|
+
if (visitor->visitInterfaceDefStart(self))
|
|
2883
|
+
{
|
|
2884
|
+
visitContents(visitor);
|
|
2885
|
+
visitor->visitInterfaceDefEnd(self);
|
|
2886
|
+
}
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
StringList
|
|
2890
|
+
Slice::InterfaceDef::ids() const
|
|
2891
|
+
{
|
|
2892
|
+
StringList ids;
|
|
2893
|
+
InterfaceList bases = allBases();
|
|
2894
|
+
std::transform(bases.begin(), bases.end(), back_inserter(ids), [](const auto& c) { return c->scoped(); });
|
|
2895
|
+
ids.push_back(scoped());
|
|
2896
|
+
ids.emplace_back("::Ice::Object");
|
|
2897
|
+
ids.sort();
|
|
2898
|
+
ids.unique();
|
|
2899
|
+
return ids;
|
|
2900
|
+
}
|
|
2901
|
+
|
|
2902
|
+
const MetadataList&
|
|
2903
|
+
Slice::InterfaceDef::getMetadata() const
|
|
2904
|
+
{
|
|
2905
|
+
return _declaration->getMetadata();
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2908
|
+
void
|
|
2909
|
+
Slice::InterfaceDef::setMetadata(MetadataList metadata)
|
|
2910
|
+
{
|
|
2911
|
+
_declaration->setMetadata(std::move(metadata));
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2914
|
+
void
|
|
2915
|
+
Slice::InterfaceDef::appendMetadata(MetadataList metadata)
|
|
2916
|
+
{
|
|
2917
|
+
_declaration->appendMetadata(std::move(metadata));
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
Slice::InterfaceDef::InterfaceDef(const ContainerPtr& container, const string& name, InterfaceList bases)
|
|
2921
|
+
: Contained(container, name),
|
|
2922
|
+
_bases(std::move(bases))
|
|
2923
|
+
{
|
|
2924
|
+
}
|
|
2925
|
+
|
|
2926
|
+
// ----------------------------------------------------------------------
|
|
2927
|
+
// Operation
|
|
2928
|
+
// ----------------------------------------------------------------------
|
|
2929
|
+
|
|
2930
|
+
InterfaceDefPtr
|
|
2931
|
+
Slice::Operation::interface() const
|
|
2932
|
+
{
|
|
2933
|
+
return dynamic_pointer_cast<InterfaceDef>(_container);
|
|
2934
|
+
}
|
|
2935
|
+
|
|
2936
|
+
TypePtr
|
|
2937
|
+
Slice::Operation::returnType() const
|
|
2938
|
+
{
|
|
2939
|
+
return _returnType;
|
|
2940
|
+
}
|
|
2941
|
+
|
|
2942
|
+
bool
|
|
2943
|
+
Slice::Operation::returnIsOptional() const
|
|
2944
|
+
{
|
|
2945
|
+
return _returnIsOptional;
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
int32_t
|
|
2949
|
+
Slice::Operation::returnTag() const
|
|
2950
|
+
{
|
|
2951
|
+
return _returnTag;
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2954
|
+
Operation::Mode
|
|
2955
|
+
Slice::Operation::mode() const
|
|
2956
|
+
{
|
|
2957
|
+
return _mode;
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2960
|
+
bool
|
|
2961
|
+
Slice::Operation::hasMarshaledResult() const
|
|
2962
|
+
{
|
|
2963
|
+
InterfaceDefPtr intf = interface();
|
|
2964
|
+
assert(intf);
|
|
2965
|
+
if (intf->hasMetadata("marshaled-result") || hasMetadata("marshaled-result"))
|
|
2966
|
+
{
|
|
2967
|
+
if (returnType() && isMutableAfterReturnType(returnType()))
|
|
2968
|
+
{
|
|
2969
|
+
return true;
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
for (const auto& p : _contents)
|
|
2973
|
+
{
|
|
2974
|
+
ParameterPtr q = dynamic_pointer_cast<Parameter>(p);
|
|
2975
|
+
if (q->isOutParam() && isMutableAfterReturnType(q->type()))
|
|
2976
|
+
{
|
|
2977
|
+
return true;
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
return false;
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2984
|
+
ParameterPtr
|
|
2985
|
+
Slice::Operation::createParameter(const string& name, const TypePtr& type, bool isOptional, int32_t tag)
|
|
2986
|
+
{
|
|
2987
|
+
ParameterPtr p = make_shared<Parameter>(shared_from_this(), name, type, isOptional, tag);
|
|
2988
|
+
|
|
2989
|
+
if (!name.empty())
|
|
2990
|
+
{
|
|
2991
|
+
if (!doesNameConflict(name, "parameter", _contents))
|
|
2992
|
+
{
|
|
2993
|
+
// If this parameter's identifier doesn't conflict with another definition,
|
|
2994
|
+
// add it to the unit's contentMap so it can be looked up later.
|
|
2995
|
+
unit()->addContent(p);
|
|
2996
|
+
}
|
|
2997
|
+
|
|
2998
|
+
reportIllegalSuffixOrUnderscore(name);
|
|
2999
|
+
}
|
|
3000
|
+
|
|
3001
|
+
if (isOptional)
|
|
3002
|
+
{
|
|
3003
|
+
// Check for a duplicate tag.
|
|
3004
|
+
const string msg = "tag for optional parameter '" + name + "' is already in use";
|
|
3005
|
+
if (_returnIsOptional && tag == _returnTag)
|
|
3006
|
+
{
|
|
3007
|
+
unit()->error(msg);
|
|
3008
|
+
}
|
|
3009
|
+
else
|
|
3010
|
+
{
|
|
3011
|
+
for (const auto& param : parameters())
|
|
3012
|
+
{
|
|
3013
|
+
if (param->optional() && param->tag() == tag)
|
|
3014
|
+
{
|
|
3015
|
+
unit()->error(msg);
|
|
3016
|
+
break;
|
|
3017
|
+
}
|
|
3018
|
+
}
|
|
3019
|
+
}
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
_contents.push_back(p);
|
|
3023
|
+
return p;
|
|
3024
|
+
}
|
|
3025
|
+
|
|
3026
|
+
ParameterList
|
|
3027
|
+
Slice::Operation::parameters() const
|
|
3028
|
+
{
|
|
3029
|
+
ParameterList result;
|
|
3030
|
+
for (const auto& p : _contents)
|
|
3031
|
+
{
|
|
3032
|
+
ParameterPtr q = dynamic_pointer_cast<Parameter>(p);
|
|
3033
|
+
if (q)
|
|
3034
|
+
{
|
|
3035
|
+
result.push_back(q);
|
|
3036
|
+
}
|
|
3037
|
+
}
|
|
3038
|
+
return result;
|
|
3039
|
+
}
|
|
3040
|
+
|
|
3041
|
+
ParameterList
|
|
3042
|
+
Slice::Operation::inParameters() const
|
|
3043
|
+
{
|
|
3044
|
+
ParameterList result;
|
|
3045
|
+
for (const auto& p : _contents)
|
|
3046
|
+
{
|
|
3047
|
+
ParameterPtr q = dynamic_pointer_cast<Parameter>(p);
|
|
3048
|
+
if (q && !q->isOutParam())
|
|
3049
|
+
{
|
|
3050
|
+
result.push_back(q);
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
return result;
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
ParameterList
|
|
3057
|
+
Slice::Operation::sortedInParameters() const
|
|
3058
|
+
{
|
|
3059
|
+
// First sort each parameter into either 'required' or 'optional'.
|
|
3060
|
+
ParameterList required, optional;
|
|
3061
|
+
for (const auto& param : inParameters())
|
|
3062
|
+
{
|
|
3063
|
+
if (param->optional())
|
|
3064
|
+
{
|
|
3065
|
+
optional.push_back(param);
|
|
3066
|
+
}
|
|
3067
|
+
else
|
|
3068
|
+
{
|
|
3069
|
+
required.push_back(param);
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3073
|
+
// Then, sort the optional parameters by their tags.
|
|
3074
|
+
optional.sort(compareTag<ParameterPtr>);
|
|
3075
|
+
|
|
3076
|
+
// Finally, append the 'optional' list to the end of 'required' and return it.
|
|
3077
|
+
required.splice(required.end(), optional);
|
|
3078
|
+
return required;
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
ParameterList
|
|
3082
|
+
Slice::Operation::outParameters() const
|
|
3083
|
+
{
|
|
3084
|
+
ParameterList result;
|
|
3085
|
+
|
|
3086
|
+
for (const auto& p : _contents)
|
|
3087
|
+
{
|
|
3088
|
+
ParameterPtr q = dynamic_pointer_cast<Parameter>(p);
|
|
3089
|
+
if (q && q->isOutParam())
|
|
3090
|
+
{
|
|
3091
|
+
result.push_back(q);
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3094
|
+
return result;
|
|
3095
|
+
}
|
|
3096
|
+
|
|
3097
|
+
ParameterPtr
|
|
3098
|
+
Slice::Operation::returnParameter(const string& name)
|
|
3099
|
+
{
|
|
3100
|
+
if (_returnType)
|
|
3101
|
+
{
|
|
3102
|
+
ParameterPtr returnParam =
|
|
3103
|
+
make_shared<Parameter>(shared_from_this(), name, _returnType, _returnIsOptional, _returnTag);
|
|
3104
|
+
|
|
3105
|
+
// Remove xxx:identifier metadata: we don't want to rename the return parameter to be the remapped operation
|
|
3106
|
+
// name.
|
|
3107
|
+
MetadataList metadata = getMetadata();
|
|
3108
|
+
const string xxxIdentifier = unit()->languageName() + ":identifier";
|
|
3109
|
+
metadata.erase(
|
|
3110
|
+
remove_if(
|
|
3111
|
+
metadata.begin(),
|
|
3112
|
+
metadata.end(),
|
|
3113
|
+
[&xxxIdentifier](const MetadataPtr& m) { return m->directive() == xxxIdentifier; }),
|
|
3114
|
+
metadata.end());
|
|
3115
|
+
|
|
3116
|
+
returnParam->setMetadata(metadata);
|
|
3117
|
+
return returnParam;
|
|
3118
|
+
}
|
|
3119
|
+
else
|
|
3120
|
+
{
|
|
3121
|
+
return nullptr;
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
|
|
3125
|
+
ParameterList
|
|
3126
|
+
Slice::Operation::sortedReturnAndOutParameters(const string& returnName)
|
|
3127
|
+
{
|
|
3128
|
+
// We get the return and out parameters, and filter out any optional parameters into a separate 'optional' list.
|
|
3129
|
+
ParameterList required = outParameters();
|
|
3130
|
+
if (_returnType)
|
|
3131
|
+
{
|
|
3132
|
+
required.push_back(returnParameter(returnName));
|
|
3133
|
+
}
|
|
3134
|
+
|
|
3135
|
+
ParameterList optional;
|
|
3136
|
+
|
|
3137
|
+
// First sort each parameter into either 'required' or 'optional'.
|
|
3138
|
+
for (auto i = required.begin(); i != required.end();)
|
|
3139
|
+
{
|
|
3140
|
+
if ((*i)->optional())
|
|
3141
|
+
{
|
|
3142
|
+
optional.push_back(*i);
|
|
3143
|
+
i = required.erase(i);
|
|
3144
|
+
}
|
|
3145
|
+
else
|
|
3146
|
+
{
|
|
3147
|
+
++i;
|
|
3148
|
+
}
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3151
|
+
// Then, sort the optional parameters by their tags.
|
|
3152
|
+
optional.sort(compareTag<ParameterPtr>);
|
|
3153
|
+
|
|
3154
|
+
// Finally, append the 'optional' list to the end of 'required' and return it.
|
|
3155
|
+
required.splice(required.end(), optional);
|
|
3156
|
+
return required;
|
|
3157
|
+
}
|
|
3158
|
+
|
|
3159
|
+
ExceptionList
|
|
3160
|
+
Slice::Operation::throws() const
|
|
3161
|
+
{
|
|
3162
|
+
return _throws;
|
|
3163
|
+
}
|
|
3164
|
+
|
|
3165
|
+
void
|
|
3166
|
+
Slice::Operation::setExceptionList(const ExceptionList& exceptions)
|
|
3167
|
+
{
|
|
3168
|
+
_throws = exceptions;
|
|
3169
|
+
|
|
3170
|
+
// Check that no exception occurs more than once in the throws clause.
|
|
3171
|
+
ExceptionList uniqueExceptions = exceptions;
|
|
3172
|
+
uniqueExceptions.sort(containedCompare);
|
|
3173
|
+
uniqueExceptions.unique(containedEqual);
|
|
3174
|
+
if (uniqueExceptions.size() != exceptions.size())
|
|
3175
|
+
{
|
|
3176
|
+
// At least one exception appears twice.
|
|
3177
|
+
ExceptionList tmp = exceptions;
|
|
3178
|
+
tmp.sort(containedCompare);
|
|
3179
|
+
ExceptionList duplicates;
|
|
3180
|
+
set_difference(
|
|
3181
|
+
tmp.begin(),
|
|
3182
|
+
tmp.end(),
|
|
3183
|
+
uniqueExceptions.begin(),
|
|
3184
|
+
uniqueExceptions.end(),
|
|
3185
|
+
back_inserter(duplicates),
|
|
3186
|
+
containedCompare);
|
|
3187
|
+
ostringstream os;
|
|
3188
|
+
os << "operation '" << name() << "' has a throws clause with ";
|
|
3189
|
+
if (duplicates.size() == 1)
|
|
3190
|
+
{
|
|
3191
|
+
os << "a ";
|
|
3192
|
+
}
|
|
3193
|
+
os << "duplicate exception";
|
|
3194
|
+
if (duplicates.size() > 1)
|
|
3195
|
+
{
|
|
3196
|
+
os << "s";
|
|
3197
|
+
}
|
|
3198
|
+
auto i = duplicates.begin();
|
|
3199
|
+
os << ": '" << (*i)->name() << "'";
|
|
3200
|
+
for (i = ++i; i != duplicates.end(); ++i)
|
|
3201
|
+
{
|
|
3202
|
+
os << ", '" << (*i)->name() << "'";
|
|
3203
|
+
}
|
|
3204
|
+
unit()->error(os.str());
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
|
+
bool
|
|
3209
|
+
Slice::Operation::sendsClasses() const
|
|
3210
|
+
{
|
|
3211
|
+
for (const auto& i : parameters())
|
|
3212
|
+
{
|
|
3213
|
+
if (!i->isOutParam() && i->type()->usesClasses())
|
|
3214
|
+
{
|
|
3215
|
+
return true;
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
return false;
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
bool
|
|
3222
|
+
Slice::Operation::returnsClasses() const
|
|
3223
|
+
{
|
|
3224
|
+
TypePtr t = returnType();
|
|
3225
|
+
if (t && t->usesClasses())
|
|
3226
|
+
{
|
|
3227
|
+
return true;
|
|
3228
|
+
}
|
|
3229
|
+
|
|
3230
|
+
for (const auto& i : parameters())
|
|
3231
|
+
{
|
|
3232
|
+
if (i->isOutParam() && i->type()->usesClasses())
|
|
3233
|
+
{
|
|
3234
|
+
return true;
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
return false;
|
|
3238
|
+
}
|
|
3239
|
+
|
|
3240
|
+
bool
|
|
3241
|
+
Slice::Operation::returnsData() const
|
|
3242
|
+
{
|
|
3243
|
+
TypePtr t = returnType();
|
|
3244
|
+
if (t)
|
|
3245
|
+
{
|
|
3246
|
+
return true;
|
|
3247
|
+
}
|
|
3248
|
+
|
|
3249
|
+
for (const auto& i : parameters())
|
|
3250
|
+
{
|
|
3251
|
+
if (i->isOutParam())
|
|
3252
|
+
{
|
|
3253
|
+
return true;
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
|
|
3257
|
+
if (!throws().empty())
|
|
3258
|
+
{
|
|
3259
|
+
return true;
|
|
3260
|
+
}
|
|
3261
|
+
return false;
|
|
3262
|
+
}
|
|
3263
|
+
|
|
3264
|
+
bool
|
|
3265
|
+
Slice::Operation::returnsAnyValues() const
|
|
3266
|
+
{
|
|
3267
|
+
return returnType() || !outParameters().empty();
|
|
3268
|
+
}
|
|
3269
|
+
|
|
3270
|
+
bool
|
|
3271
|
+
Slice::Operation::returnsMultipleValues() const
|
|
3272
|
+
{
|
|
3273
|
+
size_t count = outParameters().size();
|
|
3274
|
+
|
|
3275
|
+
if (returnType())
|
|
3276
|
+
{
|
|
3277
|
+
++count;
|
|
3278
|
+
}
|
|
3279
|
+
|
|
3280
|
+
return count > 1;
|
|
3281
|
+
}
|
|
3282
|
+
|
|
3283
|
+
bool
|
|
3284
|
+
Slice::Operation::sendsOptionals() const
|
|
3285
|
+
{
|
|
3286
|
+
for (const auto& i : inParameters())
|
|
3287
|
+
{
|
|
3288
|
+
if (i->optional())
|
|
3289
|
+
{
|
|
3290
|
+
return true;
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
return false;
|
|
3294
|
+
}
|
|
3295
|
+
|
|
3296
|
+
bool
|
|
3297
|
+
Slice::Operation::receivesOptionals() const
|
|
3298
|
+
{
|
|
3299
|
+
for (const auto& i : outParameters())
|
|
3300
|
+
{
|
|
3301
|
+
if (i->optional())
|
|
3302
|
+
{
|
|
3303
|
+
return true;
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
return returnIsOptional();
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
std::optional<FormatType>
|
|
3310
|
+
Slice::Operation::format() const
|
|
3311
|
+
{
|
|
3312
|
+
std::optional<FormatType> format = parseFormatMetadata();
|
|
3313
|
+
if (!format)
|
|
3314
|
+
{
|
|
3315
|
+
ContainedPtr cont = dynamic_pointer_cast<Contained>(container());
|
|
3316
|
+
assert(cont);
|
|
3317
|
+
format = cont->parseFormatMetadata();
|
|
3318
|
+
}
|
|
3319
|
+
return format;
|
|
3320
|
+
}
|
|
3321
|
+
|
|
3322
|
+
string
|
|
3323
|
+
Slice::Operation::kindOf() const
|
|
3324
|
+
{
|
|
3325
|
+
return "operation";
|
|
3326
|
+
}
|
|
3327
|
+
|
|
3328
|
+
void
|
|
3329
|
+
Slice::Operation::visit(ParserVisitor* visitor)
|
|
3330
|
+
{
|
|
3331
|
+
visitor->visitOperation(dynamic_pointer_cast<Operation>(shared_from_this()));
|
|
3332
|
+
}
|
|
3333
|
+
|
|
3334
|
+
void
|
|
3335
|
+
Slice::Operation::destroy()
|
|
3336
|
+
{
|
|
3337
|
+
destroyContents();
|
|
3338
|
+
}
|
|
3339
|
+
|
|
3340
|
+
Slice::Operation::Operation(
|
|
3341
|
+
const ContainerPtr& container,
|
|
3342
|
+
const string& name,
|
|
3343
|
+
TypePtr returnType,
|
|
3344
|
+
bool returnIsOptional,
|
|
3345
|
+
int32_t returnTag,
|
|
3346
|
+
Mode mode)
|
|
3347
|
+
: Contained(container, name),
|
|
3348
|
+
_returnType(std::move(returnType)),
|
|
3349
|
+
_returnIsOptional(returnIsOptional),
|
|
3350
|
+
_returnTag(returnTag),
|
|
3351
|
+
_mode(mode)
|
|
3352
|
+
{
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
// ----------------------------------------------------------------------
|
|
3356
|
+
// Exception
|
|
3357
|
+
// ----------------------------------------------------------------------
|
|
3358
|
+
|
|
3359
|
+
void
|
|
3360
|
+
Slice::Exception::destroy()
|
|
3361
|
+
{
|
|
3362
|
+
_base = nullptr;
|
|
3363
|
+
destroyContents();
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
DataMemberPtr
|
|
3367
|
+
Slice::Exception::createDataMember(
|
|
3368
|
+
const string& name,
|
|
3369
|
+
const TypePtr& type,
|
|
3370
|
+
bool isOptional,
|
|
3371
|
+
int32_t tag,
|
|
3372
|
+
SyntaxTreeBasePtr defaultValueType,
|
|
3373
|
+
optional<string> defaultValueString)
|
|
3374
|
+
{
|
|
3375
|
+
if (defaultValueString)
|
|
3376
|
+
{
|
|
3377
|
+
// Validate the default value.
|
|
3378
|
+
if (!validateConstant(name, type, defaultValueType, *defaultValueString, false))
|
|
3379
|
+
{
|
|
3380
|
+
// Create the data member anyway, just without the default value.
|
|
3381
|
+
defaultValueType = nullptr;
|
|
3382
|
+
defaultValueString = nullopt;
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
|
|
3386
|
+
DataMemberPtr member = make_shared<DataMember>(
|
|
3387
|
+
shared_from_this(),
|
|
3388
|
+
name,
|
|
3389
|
+
type,
|
|
3390
|
+
isOptional,
|
|
3391
|
+
tag,
|
|
3392
|
+
std::move(defaultValueType),
|
|
3393
|
+
std::move(defaultValueString));
|
|
3394
|
+
|
|
3395
|
+
if (!name.empty())
|
|
3396
|
+
{
|
|
3397
|
+
if (!doesNameConflict(name, "data member", _contents))
|
|
3398
|
+
{
|
|
3399
|
+
// If this data member's identifier doesn't conflict with another definition,
|
|
3400
|
+
// add it to the unit's contentMap so it can be looked up later.
|
|
3401
|
+
unit()->addContent(member);
|
|
3402
|
+
}
|
|
3403
|
+
|
|
3404
|
+
reportIllegalSuffixOrUnderscore(name);
|
|
3405
|
+
|
|
3406
|
+
// Check whether any bases have defined a member with the same name already.
|
|
3407
|
+
for (const auto& q : allBases())
|
|
3408
|
+
{
|
|
3409
|
+
for (const auto& baseMember : q->dataMembers())
|
|
3410
|
+
{
|
|
3411
|
+
if (baseMember->name() == name)
|
|
3412
|
+
{
|
|
3413
|
+
ostringstream os;
|
|
3414
|
+
os << "data member '" << name << "' is already defined in a base exception";
|
|
3415
|
+
unit()->error(os.str());
|
|
3416
|
+
break;
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3419
|
+
string baseName = IceInternal::toLower(baseMember->name());
|
|
3420
|
+
string newName = IceInternal::toLower(name);
|
|
3421
|
+
if (baseName == newName) // TODO use ciCompare
|
|
3422
|
+
{
|
|
3423
|
+
ostringstream os;
|
|
3424
|
+
os << "data member '" << name << "' differs only in capitalization from data member '"
|
|
3425
|
+
<< baseMember->name() << "', which is defined in a base exception";
|
|
3426
|
+
unit()->error(os.str());
|
|
3427
|
+
}
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
|
|
3432
|
+
if (isOptional)
|
|
3433
|
+
{
|
|
3434
|
+
// Validate the tag.
|
|
3435
|
+
for (const auto& q : dataMembers())
|
|
3436
|
+
{
|
|
3437
|
+
if (q->optional() && tag == q->tag())
|
|
3438
|
+
{
|
|
3439
|
+
unit()->error("tag for optional data member '" + name + "' is already in use");
|
|
3440
|
+
break;
|
|
3441
|
+
}
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
|
|
3445
|
+
_contents.push_back(member);
|
|
3446
|
+
return member;
|
|
3447
|
+
}
|
|
3448
|
+
|
|
3449
|
+
DataMemberList
|
|
3450
|
+
Slice::Exception::dataMembers() const
|
|
3451
|
+
{
|
|
3452
|
+
DataMemberList result;
|
|
3453
|
+
for (const auto& p : _contents)
|
|
3454
|
+
{
|
|
3455
|
+
DataMemberPtr q = dynamic_pointer_cast<DataMember>(p);
|
|
3456
|
+
if (q)
|
|
3457
|
+
{
|
|
3458
|
+
result.push_back(q);
|
|
3459
|
+
}
|
|
3460
|
+
}
|
|
3461
|
+
return result;
|
|
3462
|
+
}
|
|
3463
|
+
|
|
3464
|
+
DataMemberList
|
|
3465
|
+
Slice::Exception::orderedOptionalDataMembers() const
|
|
3466
|
+
{
|
|
3467
|
+
return filterOrderedOptionalDataMembers(dataMembers());
|
|
3468
|
+
}
|
|
3469
|
+
|
|
3470
|
+
// Return the data members of this exception and its parent exceptions, in base-to-derived order.
|
|
3471
|
+
DataMemberList
|
|
3472
|
+
Slice::Exception::allDataMembers() const
|
|
3473
|
+
{
|
|
3474
|
+
DataMemberList result;
|
|
3475
|
+
|
|
3476
|
+
// Check if we have a base exception. If so, recursively get the data members of the base exception(s).
|
|
3477
|
+
if (base())
|
|
3478
|
+
{
|
|
3479
|
+
result = base()->allDataMembers();
|
|
3480
|
+
}
|
|
3481
|
+
|
|
3482
|
+
// Append this exceptions's data members.
|
|
3483
|
+
DataMemberList myMembers = dataMembers();
|
|
3484
|
+
result.splice(result.end(), myMembers);
|
|
3485
|
+
return result;
|
|
3486
|
+
}
|
|
3487
|
+
|
|
3488
|
+
DataMemberList
|
|
3489
|
+
Slice::Exception::classDataMembers() const
|
|
3490
|
+
{
|
|
3491
|
+
DataMemberList result;
|
|
3492
|
+
for (const auto& p : _contents)
|
|
3493
|
+
{
|
|
3494
|
+
DataMemberPtr q = dynamic_pointer_cast<DataMember>(p);
|
|
3495
|
+
if (q && q->type()->isClassType())
|
|
3496
|
+
{
|
|
3497
|
+
result.push_back(q);
|
|
3498
|
+
}
|
|
3499
|
+
}
|
|
3500
|
+
return result;
|
|
3501
|
+
}
|
|
3502
|
+
|
|
3503
|
+
ExceptionPtr
|
|
3504
|
+
Slice::Exception::base() const
|
|
3505
|
+
{
|
|
3506
|
+
return _base;
|
|
3507
|
+
}
|
|
3508
|
+
|
|
3509
|
+
ExceptionList
|
|
3510
|
+
Slice::Exception::allBases() const
|
|
3511
|
+
{
|
|
3512
|
+
ExceptionList result;
|
|
3513
|
+
if (_base)
|
|
3514
|
+
{
|
|
3515
|
+
result = _base->allBases();
|
|
3516
|
+
result.push_front(_base);
|
|
3517
|
+
}
|
|
3518
|
+
return result;
|
|
3519
|
+
}
|
|
3520
|
+
|
|
3521
|
+
bool
|
|
3522
|
+
Slice::Exception::isBaseOf(const ExceptionPtr& otherException) const
|
|
3523
|
+
{
|
|
3524
|
+
string scope = scoped();
|
|
3525
|
+
if (scope == otherException->scoped())
|
|
3526
|
+
{
|
|
3527
|
+
return false;
|
|
3528
|
+
}
|
|
3529
|
+
|
|
3530
|
+
for (const auto& i : otherException->allBases())
|
|
3531
|
+
{
|
|
3532
|
+
if (i->scoped() == scope)
|
|
3533
|
+
{
|
|
3534
|
+
return true;
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
return false;
|
|
3538
|
+
}
|
|
3539
|
+
|
|
3540
|
+
bool
|
|
3541
|
+
Slice::Exception::usesClasses() const
|
|
3542
|
+
{
|
|
3543
|
+
for (const auto& i : dataMembers())
|
|
3544
|
+
{
|
|
3545
|
+
if (i->type()->usesClasses())
|
|
3546
|
+
{
|
|
3547
|
+
return true;
|
|
3548
|
+
}
|
|
3549
|
+
}
|
|
3550
|
+
|
|
3551
|
+
if (_base)
|
|
3552
|
+
{
|
|
3553
|
+
return _base->usesClasses();
|
|
3554
|
+
}
|
|
3555
|
+
return false;
|
|
3556
|
+
}
|
|
3557
|
+
|
|
3558
|
+
string
|
|
3559
|
+
Slice::Exception::kindOf() const
|
|
3560
|
+
{
|
|
3561
|
+
return "exception";
|
|
3562
|
+
}
|
|
3563
|
+
|
|
3564
|
+
void
|
|
3565
|
+
Slice::Exception::visit(ParserVisitor* visitor)
|
|
3566
|
+
{
|
|
3567
|
+
auto self = dynamic_pointer_cast<Exception>(shared_from_this());
|
|
3568
|
+
if (visitor->visitExceptionStart(self))
|
|
3569
|
+
{
|
|
3570
|
+
visitContents(visitor);
|
|
3571
|
+
visitor->visitExceptionEnd(self);
|
|
3572
|
+
}
|
|
3573
|
+
}
|
|
3574
|
+
|
|
3575
|
+
Slice::Exception::Exception(const ContainerPtr& container, const string& name, ExceptionPtr base)
|
|
3576
|
+
: Contained(container, name),
|
|
3577
|
+
_base(std::move(base))
|
|
3578
|
+
{
|
|
3579
|
+
}
|
|
3580
|
+
|
|
3581
|
+
// ----------------------------------------------------------------------
|
|
3582
|
+
// Struct
|
|
3583
|
+
// ----------------------------------------------------------------------
|
|
3584
|
+
|
|
3585
|
+
DataMemberPtr
|
|
3586
|
+
Slice::Struct::createDataMember(
|
|
3587
|
+
const string& name,
|
|
3588
|
+
const TypePtr& type,
|
|
3589
|
+
SyntaxTreeBasePtr defaultValueType,
|
|
3590
|
+
optional<string> defaultValueString)
|
|
3591
|
+
{
|
|
3592
|
+
// Structures cannot contain themselves.
|
|
3593
|
+
if (type && type.get() == this)
|
|
3594
|
+
{
|
|
3595
|
+
unit()->error("struct '" + this->name() + "' cannot contain itself");
|
|
3596
|
+
return nullptr;
|
|
3597
|
+
}
|
|
3598
|
+
|
|
3599
|
+
if (defaultValueString)
|
|
3600
|
+
{
|
|
3601
|
+
// Validate the default value.
|
|
3602
|
+
if (!validateConstant(name, type, defaultValueType, *defaultValueString, false))
|
|
3603
|
+
{
|
|
3604
|
+
// Create the data member anyway, just without the default value.
|
|
3605
|
+
defaultValueType = nullptr;
|
|
3606
|
+
defaultValueString = nullopt;
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3609
|
+
|
|
3610
|
+
DataMemberPtr member = make_shared<DataMember>(
|
|
3611
|
+
shared_from_this(),
|
|
3612
|
+
name,
|
|
3613
|
+
type,
|
|
3614
|
+
false,
|
|
3615
|
+
-1,
|
|
3616
|
+
std::move(defaultValueType),
|
|
3617
|
+
std::move(defaultValueString));
|
|
3618
|
+
|
|
3619
|
+
if (!name.empty())
|
|
3620
|
+
{
|
|
3621
|
+
if (!doesNameConflict(name, "data member", _contents))
|
|
3622
|
+
{
|
|
3623
|
+
// If this data member's identifier doesn't conflict with another definition,
|
|
3624
|
+
// add it to the unit's contentMap so it can be looked up later.
|
|
3625
|
+
unit()->addContent(member);
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3628
|
+
reportIllegalSuffixOrUnderscore(name);
|
|
3629
|
+
}
|
|
3630
|
+
|
|
3631
|
+
_contents.push_back(member);
|
|
3632
|
+
return member;
|
|
3633
|
+
}
|
|
3634
|
+
|
|
3635
|
+
DataMemberList
|
|
3636
|
+
Slice::Struct::dataMembers() const
|
|
3637
|
+
{
|
|
3638
|
+
DataMemberList result;
|
|
3639
|
+
for (const auto& p : _contents)
|
|
3640
|
+
{
|
|
3641
|
+
DataMemberPtr q = dynamic_pointer_cast<DataMember>(p);
|
|
3642
|
+
if (q)
|
|
3643
|
+
{
|
|
3644
|
+
result.push_back(q);
|
|
3645
|
+
}
|
|
3646
|
+
}
|
|
3647
|
+
return result;
|
|
3648
|
+
}
|
|
3649
|
+
|
|
3650
|
+
DataMemberList
|
|
3651
|
+
Slice::Struct::classDataMembers() const
|
|
3652
|
+
{
|
|
3653
|
+
DataMemberList result;
|
|
3654
|
+
for (const auto& p : _contents)
|
|
3655
|
+
{
|
|
3656
|
+
DataMemberPtr q = dynamic_pointer_cast<DataMember>(p);
|
|
3657
|
+
if (q && q->type()->isClassType())
|
|
3658
|
+
{
|
|
3659
|
+
result.push_back(q);
|
|
3660
|
+
}
|
|
3661
|
+
}
|
|
3662
|
+
return result;
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3665
|
+
string
|
|
3666
|
+
Slice::Struct::getOptionalFormat() const
|
|
3667
|
+
{
|
|
3668
|
+
return isVariableLength() ? "FSize" : "VSize";
|
|
3669
|
+
}
|
|
3670
|
+
|
|
3671
|
+
bool
|
|
3672
|
+
Slice::Struct::usesClasses() const
|
|
3673
|
+
{
|
|
3674
|
+
for (const auto& p : _contents)
|
|
3675
|
+
{
|
|
3676
|
+
DataMemberPtr q = dynamic_pointer_cast<DataMember>(p);
|
|
3677
|
+
if (q)
|
|
3678
|
+
{
|
|
3679
|
+
if (q->type()->usesClasses())
|
|
3680
|
+
{
|
|
3681
|
+
return true;
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
}
|
|
3685
|
+
return false;
|
|
3686
|
+
}
|
|
3687
|
+
|
|
3688
|
+
size_t
|
|
3689
|
+
Slice::Struct::minWireSize() const
|
|
3690
|
+
{
|
|
3691
|
+
// At least the sum of the minimum member sizes.
|
|
3692
|
+
size_t sz = 0;
|
|
3693
|
+
for (const auto& i : dataMembers())
|
|
3694
|
+
{
|
|
3695
|
+
sz += i->type()->minWireSize();
|
|
3696
|
+
}
|
|
3697
|
+
return sz;
|
|
3698
|
+
}
|
|
3699
|
+
|
|
3700
|
+
bool
|
|
3701
|
+
Slice::Struct::isVariableLength() const
|
|
3702
|
+
{
|
|
3703
|
+
for (const auto& i : dataMembers())
|
|
3704
|
+
{
|
|
3705
|
+
if (i->type()->isVariableLength())
|
|
3706
|
+
{
|
|
3707
|
+
return true;
|
|
3708
|
+
}
|
|
3709
|
+
}
|
|
3710
|
+
return false;
|
|
3711
|
+
}
|
|
3712
|
+
|
|
3713
|
+
string
|
|
3714
|
+
Slice::Struct::kindOf() const
|
|
3715
|
+
{
|
|
3716
|
+
return "struct";
|
|
3717
|
+
}
|
|
3718
|
+
|
|
3719
|
+
void
|
|
3720
|
+
Slice::Struct::visit(ParserVisitor* visitor)
|
|
3721
|
+
{
|
|
3722
|
+
auto self = dynamic_pointer_cast<Struct>(shared_from_this());
|
|
3723
|
+
if (visitor->visitStructStart(self))
|
|
3724
|
+
{
|
|
3725
|
+
visitContents(visitor);
|
|
3726
|
+
visitor->visitStructEnd(self);
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3729
|
+
|
|
3730
|
+
void
|
|
3731
|
+
Slice::Struct::destroy()
|
|
3732
|
+
{
|
|
3733
|
+
destroyContents();
|
|
3734
|
+
}
|
|
3735
|
+
|
|
3736
|
+
Slice::Struct::Struct(const ContainerPtr& container, const string& name) : Contained(container, name) {}
|
|
3737
|
+
|
|
3738
|
+
// ----------------------------------------------------------------------
|
|
3739
|
+
// Sequence
|
|
3740
|
+
// ----------------------------------------------------------------------
|
|
3741
|
+
|
|
3742
|
+
TypePtr
|
|
3743
|
+
Slice::Sequence::type() const
|
|
3744
|
+
{
|
|
3745
|
+
return _type;
|
|
3746
|
+
}
|
|
3747
|
+
|
|
3748
|
+
MetadataList
|
|
3749
|
+
Slice::Sequence::typeMetadata() const
|
|
3750
|
+
{
|
|
3751
|
+
return _typeMetadata;
|
|
3752
|
+
}
|
|
3753
|
+
|
|
3754
|
+
void
|
|
3755
|
+
Slice::Sequence::setTypeMetadata(MetadataList metadata)
|
|
3756
|
+
{
|
|
3757
|
+
_typeMetadata = std::move(metadata);
|
|
3758
|
+
}
|
|
3759
|
+
|
|
3760
|
+
bool
|
|
3761
|
+
Slice::Sequence::usesClasses() const
|
|
3762
|
+
{
|
|
3763
|
+
return _type->usesClasses();
|
|
3764
|
+
}
|
|
3765
|
+
|
|
3766
|
+
size_t
|
|
3767
|
+
Slice::Sequence::minWireSize() const
|
|
3768
|
+
{
|
|
3769
|
+
return 1; // An empty sequence.
|
|
3770
|
+
}
|
|
3771
|
+
|
|
3772
|
+
bool
|
|
3773
|
+
Slice::Sequence::isVariableLength() const
|
|
3774
|
+
{
|
|
3775
|
+
return true;
|
|
3776
|
+
}
|
|
3777
|
+
|
|
3778
|
+
string
|
|
3779
|
+
Slice::Sequence::getOptionalFormat() const
|
|
3780
|
+
{
|
|
3781
|
+
return _type->isVariableLength() ? "FSize" : "VSize";
|
|
3782
|
+
}
|
|
3783
|
+
|
|
3784
|
+
string
|
|
3785
|
+
Slice::Sequence::kindOf() const
|
|
3786
|
+
{
|
|
3787
|
+
return "sequence";
|
|
3788
|
+
}
|
|
3789
|
+
|
|
3790
|
+
void
|
|
3791
|
+
Slice::Sequence::visit(ParserVisitor* visitor)
|
|
3792
|
+
{
|
|
3793
|
+
visitor->visitSequence(shared_from_this());
|
|
3794
|
+
}
|
|
3795
|
+
|
|
3796
|
+
Slice::Sequence::Sequence(const ContainerPtr& container, const string& name, TypePtr type, MetadataList typeMetadata)
|
|
3797
|
+
: Contained(container, name),
|
|
3798
|
+
_type(std::move(type)),
|
|
3799
|
+
_typeMetadata(std::move(typeMetadata))
|
|
3800
|
+
{
|
|
3801
|
+
}
|
|
3802
|
+
|
|
3803
|
+
// ----------------------------------------------------------------------
|
|
3804
|
+
// Dictionary
|
|
3805
|
+
// ----------------------------------------------------------------------
|
|
3806
|
+
|
|
3807
|
+
TypePtr
|
|
3808
|
+
Slice::Dictionary::keyType() const
|
|
3809
|
+
{
|
|
3810
|
+
return _keyType;
|
|
3811
|
+
}
|
|
3812
|
+
|
|
3813
|
+
TypePtr
|
|
3814
|
+
Slice::Dictionary::valueType() const
|
|
3815
|
+
{
|
|
3816
|
+
return _valueType;
|
|
3817
|
+
}
|
|
3818
|
+
|
|
3819
|
+
MetadataList
|
|
3820
|
+
Slice::Dictionary::keyMetadata() const
|
|
3821
|
+
{
|
|
3822
|
+
return _keyMetadata;
|
|
3823
|
+
}
|
|
3824
|
+
|
|
3825
|
+
MetadataList
|
|
3826
|
+
Slice::Dictionary::valueMetadata() const
|
|
3827
|
+
{
|
|
3828
|
+
return _valueMetadata;
|
|
3829
|
+
}
|
|
3830
|
+
|
|
3831
|
+
void
|
|
3832
|
+
Slice::Dictionary::setKeyMetadata(MetadataList metadata)
|
|
3833
|
+
{
|
|
3834
|
+
_keyMetadata = std::move(metadata);
|
|
3835
|
+
}
|
|
3836
|
+
|
|
3837
|
+
void
|
|
3838
|
+
Slice::Dictionary::setValueMetadata(MetadataList metadata)
|
|
3839
|
+
{
|
|
3840
|
+
_valueMetadata = std::move(metadata);
|
|
3841
|
+
}
|
|
3842
|
+
|
|
3843
|
+
bool
|
|
3844
|
+
Slice::Dictionary::usesClasses() const
|
|
3845
|
+
{
|
|
3846
|
+
return _valueType->usesClasses();
|
|
3847
|
+
}
|
|
3848
|
+
|
|
3849
|
+
size_t
|
|
3850
|
+
Slice::Dictionary::minWireSize() const
|
|
3851
|
+
{
|
|
3852
|
+
return 1; // An empty dictionary.
|
|
3853
|
+
}
|
|
3854
|
+
|
|
3855
|
+
string
|
|
3856
|
+
Slice::Dictionary::getOptionalFormat() const
|
|
3857
|
+
{
|
|
3858
|
+
return _keyType->isVariableLength() || _valueType->isVariableLength() ? "FSize" : "VSize";
|
|
3859
|
+
}
|
|
3860
|
+
|
|
3861
|
+
bool
|
|
3862
|
+
Slice::Dictionary::isVariableLength() const
|
|
3863
|
+
{
|
|
3864
|
+
return true;
|
|
3865
|
+
}
|
|
3866
|
+
|
|
3867
|
+
string
|
|
3868
|
+
Slice::Dictionary::kindOf() const
|
|
3869
|
+
{
|
|
3870
|
+
return "dictionary";
|
|
3871
|
+
}
|
|
3872
|
+
|
|
3873
|
+
void
|
|
3874
|
+
Slice::Dictionary::visit(ParserVisitor* visitor)
|
|
3875
|
+
{
|
|
3876
|
+
visitor->visitDictionary(shared_from_this());
|
|
3877
|
+
}
|
|
3878
|
+
|
|
3879
|
+
// Checks whether the provided type is a legal dictionary key type.
|
|
3880
|
+
// Legal key types are integral types, string, and structs that only contain other legal key types.
|
|
3881
|
+
bool
|
|
3882
|
+
Slice::Dictionary::isLegalKeyType(const TypePtr& type)
|
|
3883
|
+
{
|
|
3884
|
+
BuiltinPtr bp = dynamic_pointer_cast<Builtin>(type);
|
|
3885
|
+
if (bp)
|
|
3886
|
+
{
|
|
3887
|
+
switch (bp->kind())
|
|
3888
|
+
{
|
|
3889
|
+
case Builtin::KindByte:
|
|
3890
|
+
case Builtin::KindBool:
|
|
3891
|
+
case Builtin::KindShort:
|
|
3892
|
+
case Builtin::KindInt:
|
|
3893
|
+
case Builtin::KindLong:
|
|
3894
|
+
case Builtin::KindString:
|
|
3895
|
+
{
|
|
3896
|
+
return true;
|
|
3897
|
+
}
|
|
3898
|
+
|
|
3899
|
+
case Builtin::KindFloat:
|
|
3900
|
+
case Builtin::KindDouble:
|
|
3901
|
+
case Builtin::KindObjectProxy:
|
|
3902
|
+
case Builtin::KindValue:
|
|
3903
|
+
{
|
|
3904
|
+
return false;
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
}
|
|
3908
|
+
|
|
3909
|
+
if (dynamic_pointer_cast<Enum>(type))
|
|
3910
|
+
{
|
|
3911
|
+
return true;
|
|
3912
|
+
}
|
|
3913
|
+
|
|
3914
|
+
StructPtr structPtr = dynamic_pointer_cast<Struct>(type);
|
|
3915
|
+
if (structPtr)
|
|
3916
|
+
{
|
|
3917
|
+
for (const auto& dm : structPtr->dataMembers())
|
|
3918
|
+
{
|
|
3919
|
+
if (dm->type() && !isLegalKeyType(dm->type()))
|
|
3920
|
+
{
|
|
3921
|
+
return false;
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
3924
|
+
return true;
|
|
3925
|
+
}
|
|
3926
|
+
|
|
3927
|
+
return false;
|
|
3928
|
+
}
|
|
3929
|
+
|
|
3930
|
+
Slice::Dictionary::Dictionary(
|
|
3931
|
+
const ContainerPtr& container,
|
|
3932
|
+
const string& name,
|
|
3933
|
+
TypePtr keyType,
|
|
3934
|
+
MetadataList keyMetadata,
|
|
3935
|
+
TypePtr valueType,
|
|
3936
|
+
MetadataList valueMetadata)
|
|
3937
|
+
: Contained(container, name),
|
|
3938
|
+
_keyType(std::move(keyType)),
|
|
3939
|
+
_valueType(std::move(valueType)),
|
|
3940
|
+
_keyMetadata(std::move(keyMetadata)),
|
|
3941
|
+
_valueMetadata(std::move(valueMetadata))
|
|
3942
|
+
{
|
|
3943
|
+
}
|
|
3944
|
+
|
|
3945
|
+
// ----------------------------------------------------------------------
|
|
3946
|
+
// Enum
|
|
3947
|
+
// ----------------------------------------------------------------------
|
|
3948
|
+
|
|
3949
|
+
EnumeratorPtr
|
|
3950
|
+
Slice::Enum::createEnumerator(const string& name, optional<int32_t> explicitValue)
|
|
3951
|
+
{
|
|
3952
|
+
// Validate the enumerator's name.
|
|
3953
|
+
doesNameConflict(name, "enumerator", _contents); // Ignore return value.
|
|
3954
|
+
reportIllegalSuffixOrUnderscore(name); // Ignore return value.
|
|
3955
|
+
|
|
3956
|
+
// Determine the enumerator's value, and check that it's valid.
|
|
3957
|
+
int32_t nextValue;
|
|
3958
|
+
if (explicitValue)
|
|
3959
|
+
{
|
|
3960
|
+
// If an explicit value was provided, the parser already checks that it's between `0` and `int32_t::max`.
|
|
3961
|
+
_hasExplicitValues = true;
|
|
3962
|
+
nextValue = *explicitValue;
|
|
3963
|
+
}
|
|
3964
|
+
else
|
|
3965
|
+
{
|
|
3966
|
+
if (_lastValue == numeric_limits<int32_t>::max())
|
|
3967
|
+
{
|
|
3968
|
+
ostringstream os;
|
|
3969
|
+
os << "value for enumerator '" << name << "' is out of range";
|
|
3970
|
+
unit()->error(os.str());
|
|
3971
|
+
}
|
|
3972
|
+
// If the enumerator was not assigned an explicit value,
|
|
3973
|
+
// we automatically assign it one more than the previous enumerator.
|
|
3974
|
+
nextValue = _lastValue + 1;
|
|
3975
|
+
}
|
|
3976
|
+
|
|
3977
|
+
// Check if the enumerator's value is already in use.
|
|
3978
|
+
bool checkForDuplicates = true;
|
|
3979
|
+
if (nextValue > _maxValue)
|
|
3980
|
+
{
|
|
3981
|
+
_maxValue = nextValue;
|
|
3982
|
+
checkForDuplicates = false;
|
|
3983
|
+
}
|
|
3984
|
+
if (nextValue < _minValue)
|
|
3985
|
+
{
|
|
3986
|
+
_minValue = nextValue;
|
|
3987
|
+
checkForDuplicates = false;
|
|
3988
|
+
}
|
|
3989
|
+
if (checkForDuplicates)
|
|
3990
|
+
{
|
|
3991
|
+
for (const auto& r : enumerators())
|
|
3992
|
+
{
|
|
3993
|
+
if (r->value() == nextValue)
|
|
3994
|
+
{
|
|
3995
|
+
ostringstream os;
|
|
3996
|
+
os << "enumerator '" << name << "' has the same value as enumerator '" << r->name() << "'";
|
|
3997
|
+
unit()->error(os.str());
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
|
|
4002
|
+
// Create the enumerator.
|
|
4003
|
+
ContainerPtr cont = shared_from_this();
|
|
4004
|
+
EnumeratorPtr p = make_shared<Enumerator>(cont, name, nextValue, explicitValue.has_value());
|
|
4005
|
+
unit()->addContent(p);
|
|
4006
|
+
_contents.push_back(p);
|
|
4007
|
+
_lastValue = nextValue;
|
|
4008
|
+
return p;
|
|
4009
|
+
}
|
|
4010
|
+
|
|
4011
|
+
bool
|
|
4012
|
+
Slice::Enum::hasExplicitValues() const
|
|
4013
|
+
{
|
|
4014
|
+
return _hasExplicitValues;
|
|
4015
|
+
}
|
|
4016
|
+
|
|
4017
|
+
int32_t
|
|
4018
|
+
Slice::Enum::minValue() const
|
|
4019
|
+
{
|
|
4020
|
+
return static_cast<int>(_minValue);
|
|
4021
|
+
}
|
|
4022
|
+
|
|
4023
|
+
int32_t
|
|
4024
|
+
Slice::Enum::maxValue() const
|
|
4025
|
+
{
|
|
4026
|
+
return static_cast<int>(_maxValue);
|
|
4027
|
+
}
|
|
4028
|
+
|
|
4029
|
+
size_t
|
|
4030
|
+
Slice::Enum::minWireSize() const
|
|
4031
|
+
{
|
|
4032
|
+
return 1;
|
|
4033
|
+
}
|
|
4034
|
+
|
|
4035
|
+
string
|
|
4036
|
+
Slice::Enum::getOptionalFormat() const
|
|
4037
|
+
{
|
|
4038
|
+
return "Size";
|
|
4039
|
+
}
|
|
4040
|
+
|
|
4041
|
+
bool
|
|
4042
|
+
Slice::Enum::isVariableLength() const
|
|
4043
|
+
{
|
|
4044
|
+
return true;
|
|
4045
|
+
}
|
|
4046
|
+
|
|
4047
|
+
string
|
|
4048
|
+
Slice::Enum::kindOf() const
|
|
4049
|
+
{
|
|
4050
|
+
return "enumeration";
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
void
|
|
4054
|
+
Slice::Enum::visit(ParserVisitor* visitor)
|
|
4055
|
+
{
|
|
4056
|
+
visitor->visitEnum(dynamic_pointer_cast<Enum>(shared_from_this()));
|
|
4057
|
+
}
|
|
4058
|
+
|
|
4059
|
+
void
|
|
4060
|
+
Slice::Enum::destroy()
|
|
4061
|
+
{
|
|
4062
|
+
destroyContents();
|
|
4063
|
+
}
|
|
4064
|
+
|
|
4065
|
+
Slice::Enum::Enum(const ContainerPtr& container, const string& name)
|
|
4066
|
+
: Contained(container, name),
|
|
4067
|
+
_minValue(numeric_limits<int32_t>::max())
|
|
4068
|
+
{
|
|
4069
|
+
}
|
|
4070
|
+
|
|
4071
|
+
// ----------------------------------------------------------------------
|
|
4072
|
+
// Enumerator
|
|
4073
|
+
// ----------------------------------------------------------------------
|
|
4074
|
+
|
|
4075
|
+
EnumPtr
|
|
4076
|
+
Slice::Enumerator::type() const
|
|
4077
|
+
{
|
|
4078
|
+
return dynamic_pointer_cast<Enum>(container());
|
|
4079
|
+
}
|
|
4080
|
+
|
|
4081
|
+
string
|
|
4082
|
+
Slice::Enumerator::kindOf() const
|
|
4083
|
+
{
|
|
4084
|
+
return "enumerator";
|
|
4085
|
+
}
|
|
4086
|
+
|
|
4087
|
+
bool
|
|
4088
|
+
Slice::Enumerator::hasExplicitValue() const
|
|
4089
|
+
{
|
|
4090
|
+
return _hasExplicitValue;
|
|
4091
|
+
}
|
|
4092
|
+
|
|
4093
|
+
int32_t
|
|
4094
|
+
Slice::Enumerator::value() const
|
|
4095
|
+
{
|
|
4096
|
+
return _value;
|
|
4097
|
+
}
|
|
4098
|
+
|
|
4099
|
+
void
|
|
4100
|
+
Slice::Enumerator::visit(ParserVisitor*)
|
|
4101
|
+
{
|
|
4102
|
+
// TODO we should probably visit enumerators, even if only for validation purposes.
|
|
4103
|
+
}
|
|
4104
|
+
|
|
4105
|
+
Slice::Enumerator::Enumerator(const ContainerPtr& container, const string& name, int32_t value, bool hasExplicitValue)
|
|
4106
|
+
: Contained(container, name),
|
|
4107
|
+
_hasExplicitValue(hasExplicitValue),
|
|
4108
|
+
_value(value)
|
|
4109
|
+
{
|
|
4110
|
+
}
|
|
4111
|
+
|
|
4112
|
+
// ----------------------------------------------------------------------
|
|
4113
|
+
// Const
|
|
4114
|
+
// ----------------------------------------------------------------------
|
|
4115
|
+
|
|
4116
|
+
TypePtr
|
|
4117
|
+
Slice::Const::type() const
|
|
4118
|
+
{
|
|
4119
|
+
return _type;
|
|
4120
|
+
}
|
|
4121
|
+
|
|
4122
|
+
MetadataList
|
|
4123
|
+
Slice::Const::typeMetadata() const
|
|
4124
|
+
{
|
|
4125
|
+
return _typeMetadata;
|
|
4126
|
+
}
|
|
4127
|
+
|
|
4128
|
+
void
|
|
4129
|
+
Slice::Const::setTypeMetadata(MetadataList metadata)
|
|
4130
|
+
{
|
|
4131
|
+
_typeMetadata = std::move(metadata);
|
|
4132
|
+
}
|
|
4133
|
+
|
|
4134
|
+
SyntaxTreeBasePtr
|
|
4135
|
+
Slice::Const::valueType() const
|
|
4136
|
+
{
|
|
4137
|
+
return _valueType;
|
|
4138
|
+
}
|
|
4139
|
+
|
|
4140
|
+
string
|
|
4141
|
+
Slice::Const::value() const
|
|
4142
|
+
{
|
|
4143
|
+
return _value;
|
|
4144
|
+
}
|
|
4145
|
+
|
|
4146
|
+
string
|
|
4147
|
+
Slice::Const::kindOf() const
|
|
4148
|
+
{
|
|
4149
|
+
return "constant";
|
|
4150
|
+
}
|
|
4151
|
+
|
|
4152
|
+
void
|
|
4153
|
+
Slice::Const::visit(ParserVisitor* visitor)
|
|
4154
|
+
{
|
|
4155
|
+
visitor->visitConst(shared_from_this());
|
|
4156
|
+
}
|
|
4157
|
+
|
|
4158
|
+
Slice::Const::Const(
|
|
4159
|
+
const ContainerPtr& container,
|
|
4160
|
+
const string& name,
|
|
4161
|
+
TypePtr type,
|
|
4162
|
+
MetadataList typeMetadata,
|
|
4163
|
+
SyntaxTreeBasePtr valueType,
|
|
4164
|
+
string valueString)
|
|
4165
|
+
: Contained(container, name),
|
|
4166
|
+
_type(std::move(type)),
|
|
4167
|
+
_typeMetadata(std::move(typeMetadata)),
|
|
4168
|
+
_valueType(std::move(valueType)),
|
|
4169
|
+
_value(std::move(valueString))
|
|
4170
|
+
{
|
|
4171
|
+
}
|
|
4172
|
+
|
|
4173
|
+
// ----------------------------------------------------------------------
|
|
4174
|
+
// Parameter
|
|
4175
|
+
// ----------------------------------------------------------------------
|
|
4176
|
+
|
|
4177
|
+
TypePtr
|
|
4178
|
+
Slice::Parameter::type() const
|
|
4179
|
+
{
|
|
4180
|
+
return _type;
|
|
4181
|
+
}
|
|
4182
|
+
|
|
4183
|
+
bool
|
|
4184
|
+
Slice::Parameter::isOutParam() const
|
|
4185
|
+
{
|
|
4186
|
+
return _isOutParam;
|
|
4187
|
+
}
|
|
4188
|
+
|
|
4189
|
+
void
|
|
4190
|
+
Slice::Parameter::setIsOutParam()
|
|
4191
|
+
{
|
|
4192
|
+
// Emit an error if this parameter was already marked as 'out' (meaning 'out' was written multiple times in a row).
|
|
4193
|
+
if (_isOutParam)
|
|
4194
|
+
{
|
|
4195
|
+
unit()->error("parameter '" + _name + "' was marked 'out' multiple times");
|
|
4196
|
+
}
|
|
4197
|
+
_isOutParam = true;
|
|
4198
|
+
}
|
|
4199
|
+
|
|
4200
|
+
bool
|
|
4201
|
+
Slice::Parameter::optional() const
|
|
4202
|
+
{
|
|
4203
|
+
return _optional;
|
|
4204
|
+
}
|
|
4205
|
+
|
|
4206
|
+
int32_t
|
|
4207
|
+
Slice::Parameter::tag() const
|
|
4208
|
+
{
|
|
4209
|
+
return _tag;
|
|
4210
|
+
}
|
|
4211
|
+
|
|
4212
|
+
string
|
|
4213
|
+
Slice::Parameter::kindOf() const
|
|
4214
|
+
{
|
|
4215
|
+
return "parameter";
|
|
4216
|
+
}
|
|
4217
|
+
|
|
4218
|
+
void
|
|
4219
|
+
Slice::Parameter::visit(ParserVisitor* visitor)
|
|
4220
|
+
{
|
|
4221
|
+
visitor->visitParameter(shared_from_this());
|
|
4222
|
+
}
|
|
4223
|
+
|
|
4224
|
+
Slice::Parameter::Parameter(
|
|
4225
|
+
const ContainerPtr& container,
|
|
4226
|
+
const string& name,
|
|
4227
|
+
TypePtr type,
|
|
4228
|
+
bool isOptional,
|
|
4229
|
+
int32_t tag)
|
|
4230
|
+
: Contained(container, name),
|
|
4231
|
+
_type(std::move(type)),
|
|
4232
|
+
_optional(isOptional),
|
|
4233
|
+
_tag(tag)
|
|
4234
|
+
{
|
|
4235
|
+
}
|
|
4236
|
+
|
|
4237
|
+
// ----------------------------------------------------------------------
|
|
4238
|
+
// DataMember
|
|
4239
|
+
// ----------------------------------------------------------------------
|
|
4240
|
+
|
|
4241
|
+
TypePtr
|
|
4242
|
+
Slice::DataMember::type() const
|
|
4243
|
+
{
|
|
4244
|
+
return _type;
|
|
4245
|
+
}
|
|
4246
|
+
|
|
4247
|
+
bool
|
|
4248
|
+
Slice::DataMember::optional() const
|
|
4249
|
+
{
|
|
4250
|
+
return _optional;
|
|
4251
|
+
}
|
|
4252
|
+
|
|
4253
|
+
int32_t
|
|
4254
|
+
Slice::DataMember::tag() const
|
|
4255
|
+
{
|
|
4256
|
+
return _tag;
|
|
4257
|
+
}
|
|
4258
|
+
|
|
4259
|
+
optional<string>
|
|
4260
|
+
Slice::DataMember::defaultValue() const
|
|
4261
|
+
{
|
|
4262
|
+
return _defaultValue;
|
|
4263
|
+
}
|
|
4264
|
+
|
|
4265
|
+
SyntaxTreeBasePtr
|
|
4266
|
+
Slice::DataMember::defaultValueType() const
|
|
4267
|
+
{
|
|
4268
|
+
return _defaultValueType;
|
|
4269
|
+
}
|
|
4270
|
+
|
|
4271
|
+
string
|
|
4272
|
+
Slice::DataMember::kindOf() const
|
|
4273
|
+
{
|
|
4274
|
+
return "data member";
|
|
4275
|
+
}
|
|
4276
|
+
|
|
4277
|
+
void
|
|
4278
|
+
Slice::DataMember::visit(ParserVisitor* visitor)
|
|
4279
|
+
{
|
|
4280
|
+
visitor->visitDataMember(shared_from_this());
|
|
4281
|
+
}
|
|
4282
|
+
|
|
4283
|
+
Slice::DataMember::DataMember(
|
|
4284
|
+
const ContainerPtr& container,
|
|
4285
|
+
const string& name,
|
|
4286
|
+
TypePtr type,
|
|
4287
|
+
bool isOptional,
|
|
4288
|
+
int32_t tag,
|
|
4289
|
+
SyntaxTreeBasePtr defaultValueType,
|
|
4290
|
+
std::optional<string> defaultValueString)
|
|
4291
|
+
: Contained(container, name),
|
|
4292
|
+
_type(std::move(type)),
|
|
4293
|
+
_optional(isOptional),
|
|
4294
|
+
_tag(tag),
|
|
4295
|
+
_defaultValueType(std::move(defaultValueType)),
|
|
4296
|
+
_defaultValue(std::move(defaultValueString))
|
|
4297
|
+
{
|
|
4298
|
+
// They are either both null or both non-null.
|
|
4299
|
+
assert((_defaultValueType && _defaultValue) || (!_defaultValueType && !_defaultValue));
|
|
4300
|
+
}
|
|
4301
|
+
|
|
4302
|
+
// ----------------------------------------------------------------------
|
|
4303
|
+
// Unit
|
|
4304
|
+
// ----------------------------------------------------------------------
|
|
4305
|
+
|
|
4306
|
+
UnitPtr
|
|
4307
|
+
Slice::Unit::createUnit(string languageName, bool all)
|
|
4308
|
+
{
|
|
4309
|
+
return make_shared<Unit>(std::move(languageName), all);
|
|
4310
|
+
}
|
|
4311
|
+
|
|
4312
|
+
string
|
|
4313
|
+
Slice::Unit::languageName() const
|
|
4314
|
+
{
|
|
4315
|
+
return _languageName;
|
|
4316
|
+
}
|
|
4317
|
+
|
|
4318
|
+
void
|
|
4319
|
+
Slice::Unit::setDocComment(const string& comment)
|
|
4320
|
+
{
|
|
4321
|
+
_currentDocComment = "";
|
|
4322
|
+
|
|
4323
|
+
string::size_type end = 0;
|
|
4324
|
+
while (true)
|
|
4325
|
+
{
|
|
4326
|
+
string::size_type begin;
|
|
4327
|
+
if (end == 0)
|
|
4328
|
+
{
|
|
4329
|
+
// Skip past the initial whitespace.
|
|
4330
|
+
begin = comment.find_first_not_of(" \t\r\n*", end);
|
|
4331
|
+
}
|
|
4332
|
+
else
|
|
4333
|
+
{
|
|
4334
|
+
// Skip more whitespace but retain blank lines.
|
|
4335
|
+
begin = comment.find_first_not_of(" \t*", end);
|
|
4336
|
+
}
|
|
4337
|
+
|
|
4338
|
+
if (begin == string::npos)
|
|
4339
|
+
{
|
|
4340
|
+
break;
|
|
4341
|
+
}
|
|
4342
|
+
|
|
4343
|
+
end = comment.find('\n', begin);
|
|
4344
|
+
if (end != string::npos)
|
|
4345
|
+
{
|
|
4346
|
+
if (end + 1 > begin)
|
|
4347
|
+
{
|
|
4348
|
+
_currentDocComment += comment.substr(begin, end + 1 - begin);
|
|
4349
|
+
}
|
|
4350
|
+
++end;
|
|
4351
|
+
}
|
|
4352
|
+
else
|
|
4353
|
+
{
|
|
4354
|
+
end = comment.find_last_not_of(" \t\r\n*");
|
|
4355
|
+
if (end != string::npos)
|
|
4356
|
+
{
|
|
4357
|
+
if (end + 1 > begin)
|
|
4358
|
+
{
|
|
4359
|
+
_currentDocComment += comment.substr(begin, end + 1 - begin);
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
break;
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
4365
|
+
}
|
|
4366
|
+
|
|
4367
|
+
void
|
|
4368
|
+
Slice::Unit::appendToDocComment(const string& comment)
|
|
4369
|
+
{
|
|
4370
|
+
if (!_currentDocComment.empty())
|
|
4371
|
+
{
|
|
4372
|
+
_currentDocComment += '\n';
|
|
4373
|
+
}
|
|
4374
|
+
_currentDocComment += comment;
|
|
4375
|
+
}
|
|
4376
|
+
|
|
4377
|
+
string
|
|
4378
|
+
Slice::Unit::currentDocComment()
|
|
4379
|
+
{
|
|
4380
|
+
string comment;
|
|
4381
|
+
comment.swap(_currentDocComment);
|
|
4382
|
+
return comment;
|
|
4383
|
+
}
|
|
4384
|
+
|
|
4385
|
+
string
|
|
4386
|
+
Slice::Unit::currentFile() const
|
|
4387
|
+
{
|
|
4388
|
+
DefinitionContextPtr dc = currentDefinitionContext();
|
|
4389
|
+
if (dc)
|
|
4390
|
+
{
|
|
4391
|
+
return dc->filename();
|
|
4392
|
+
}
|
|
4393
|
+
else
|
|
4394
|
+
{
|
|
4395
|
+
return {};
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4398
|
+
|
|
4399
|
+
const string&
|
|
4400
|
+
Slice::Unit::topLevelFile() const
|
|
4401
|
+
{
|
|
4402
|
+
return _topLevelFile;
|
|
4403
|
+
}
|
|
4404
|
+
|
|
4405
|
+
int
|
|
4406
|
+
Slice::Unit::currentLine() const
|
|
4407
|
+
{
|
|
4408
|
+
return slice_lineno;
|
|
4409
|
+
}
|
|
4410
|
+
|
|
4411
|
+
int
|
|
4412
|
+
Slice::Unit::setCurrentFile(std::string currentFile, int lineNumber)
|
|
4413
|
+
{
|
|
4414
|
+
assert(!currentFile.empty());
|
|
4415
|
+
|
|
4416
|
+
// `currentFile` is the file being parsed, as reported by the MCPP preprocessor.
|
|
4417
|
+
// It may be an absolute or relative path.
|
|
4418
|
+
//
|
|
4419
|
+
// `resolvedFilename` is always an absolute path, computed from `currentFile` and the current definition context.
|
|
4420
|
+
string resolvedFilename;
|
|
4421
|
+
if (IceInternal::isAbsolutePath(currentFile))
|
|
4422
|
+
{
|
|
4423
|
+
resolvedFilename = currentFile;
|
|
4424
|
+
if (!IceInternal::fileExists(resolvedFilename))
|
|
4425
|
+
{
|
|
4426
|
+
// MCPP may report incorrect absolute paths when files are included using relative paths.
|
|
4427
|
+
// See: https://github.com/zeroc-ice/ice/issues/4253
|
|
4428
|
+
|
|
4429
|
+
// If the path is absolute but the file doesn't exist, treat it as relative to the current definition
|
|
4430
|
+
// context.
|
|
4431
|
+
DefinitionContextPtr dc = currentDefinitionContext();
|
|
4432
|
+
assert(dc);
|
|
4433
|
+
string previousDir = dirName(dc->resolvedFilename());
|
|
4434
|
+
|
|
4435
|
+
vector<string> tokens1;
|
|
4436
|
+
vector<string> tokens2;
|
|
4437
|
+
|
|
4438
|
+
IceInternal::splitString(previousDir, "/\\", tokens1);
|
|
4439
|
+
IceInternal::splitString(resolvedFilename, "/\\", tokens2);
|
|
4440
|
+
|
|
4441
|
+
auto i1 = tokens1.begin();
|
|
4442
|
+
auto i2 = tokens2.begin();
|
|
4443
|
+
|
|
4444
|
+
// Skip the common path elements.
|
|
4445
|
+
while (i1 != tokens1.end() && i2 != tokens2.end() && *i1 == *i2)
|
|
4446
|
+
{
|
|
4447
|
+
i1++;
|
|
4448
|
+
i2++;
|
|
4449
|
+
}
|
|
4450
|
+
|
|
4451
|
+
// The remaining elements represent the path relative the current definition context.
|
|
4452
|
+
resolvedFilename = "";
|
|
4453
|
+
for (; i2 != tokens2.end(); ++i2)
|
|
4454
|
+
{
|
|
4455
|
+
resolvedFilename += "/" + *i2;
|
|
4456
|
+
}
|
|
4457
|
+
|
|
4458
|
+
resolvedFilename = normalizePath(previousDir + resolvedFilename);
|
|
4459
|
+
currentFile = resolvedFilename;
|
|
4460
|
+
}
|
|
4461
|
+
}
|
|
4462
|
+
else
|
|
4463
|
+
{
|
|
4464
|
+
// Relative paths are interpreted relative to the current definition context, which corresponds to the file
|
|
4465
|
+
// currently being parsed.
|
|
4466
|
+
DefinitionContextPtr dc = currentDefinitionContext();
|
|
4467
|
+
assert(dc);
|
|
4468
|
+
resolvedFilename = normalizePath(Slice::dirName(dc->resolvedFilename()) + "/" + currentFile);
|
|
4469
|
+
}
|
|
4470
|
+
|
|
4471
|
+
enum LineType
|
|
4472
|
+
{
|
|
4473
|
+
File,
|
|
4474
|
+
Push,
|
|
4475
|
+
Pop
|
|
4476
|
+
};
|
|
4477
|
+
|
|
4478
|
+
LineType type = File;
|
|
4479
|
+
|
|
4480
|
+
if (lineNumber == 0)
|
|
4481
|
+
{
|
|
4482
|
+
if (_currentIncludeLevel > 0 || currentFile != _topLevelFile)
|
|
4483
|
+
{
|
|
4484
|
+
type = Push;
|
|
4485
|
+
}
|
|
4486
|
+
}
|
|
4487
|
+
else
|
|
4488
|
+
{
|
|
4489
|
+
DefinitionContextPtr dc = currentDefinitionContext();
|
|
4490
|
+
if (dc != nullptr && !dc->filename().empty() && dc->filename() != currentFile)
|
|
4491
|
+
{
|
|
4492
|
+
type = Pop;
|
|
4493
|
+
}
|
|
4494
|
+
}
|
|
4495
|
+
|
|
4496
|
+
switch (type)
|
|
4497
|
+
{
|
|
4498
|
+
case Push:
|
|
4499
|
+
{
|
|
4500
|
+
DefinitionContextPtr dc = currentDefinitionContext();
|
|
4501
|
+
if (dc && dc->seenDefinition())
|
|
4502
|
+
{
|
|
4503
|
+
error("'#include' directives must come before any Slice definitions in a file");
|
|
4504
|
+
}
|
|
4505
|
+
|
|
4506
|
+
if (++_currentIncludeLevel == 1)
|
|
4507
|
+
{
|
|
4508
|
+
if (find(_includeFiles.begin(), _includeFiles.end(), currentFile) == _includeFiles.end())
|
|
4509
|
+
{
|
|
4510
|
+
_includeFiles.push_back(currentFile);
|
|
4511
|
+
}
|
|
4512
|
+
}
|
|
4513
|
+
pushDefinitionContext();
|
|
4514
|
+
_currentDocComment = "";
|
|
4515
|
+
break;
|
|
4516
|
+
}
|
|
4517
|
+
case Pop:
|
|
4518
|
+
{
|
|
4519
|
+
--_currentIncludeLevel;
|
|
4520
|
+
popDefinitionContext();
|
|
4521
|
+
_currentDocComment = "";
|
|
4522
|
+
break;
|
|
4523
|
+
}
|
|
4524
|
+
default:
|
|
4525
|
+
{
|
|
4526
|
+
break; // Do nothing
|
|
4527
|
+
}
|
|
4528
|
+
}
|
|
4529
|
+
|
|
4530
|
+
if ((type == File && _allFiles.empty()) || type == Push)
|
|
4531
|
+
{
|
|
4532
|
+
// Either this is the first file being parsed, or we are pushing a new file onto the stack.
|
|
4533
|
+
|
|
4534
|
+
DefinitionContextPtr dc = currentDefinitionContext();
|
|
4535
|
+
assert(dc);
|
|
4536
|
+
dc->setFilename(currentFile, resolvedFilename);
|
|
4537
|
+
_definitionContextMap.insert(make_pair(currentFile, dc));
|
|
4538
|
+
|
|
4539
|
+
if (find(_allFiles.begin(), _allFiles.end(), resolvedFilename) == _allFiles.end())
|
|
4540
|
+
{
|
|
4541
|
+
_allFiles.push_back(resolvedFilename);
|
|
4542
|
+
}
|
|
4543
|
+
}
|
|
4544
|
+
|
|
4545
|
+
return static_cast<int>(type);
|
|
4546
|
+
}
|
|
4547
|
+
|
|
4548
|
+
int
|
|
4549
|
+
Slice::Unit::currentIncludeLevel() const
|
|
4550
|
+
{
|
|
4551
|
+
if (_all)
|
|
4552
|
+
{
|
|
4553
|
+
return 0;
|
|
4554
|
+
}
|
|
4555
|
+
else
|
|
4556
|
+
{
|
|
4557
|
+
return _currentIncludeLevel;
|
|
4558
|
+
}
|
|
4559
|
+
}
|
|
4560
|
+
|
|
4561
|
+
void
|
|
4562
|
+
Slice::Unit::addFileMetadata(MetadataList metadata)
|
|
4563
|
+
{
|
|
4564
|
+
DefinitionContextPtr dc = currentDefinitionContext();
|
|
4565
|
+
assert(dc);
|
|
4566
|
+
if (dc->seenDefinition())
|
|
4567
|
+
{
|
|
4568
|
+
error("file metadata must appear before any definitions");
|
|
4569
|
+
}
|
|
4570
|
+
else
|
|
4571
|
+
{
|
|
4572
|
+
dc->appendMetadata(std::move(metadata));
|
|
4573
|
+
}
|
|
4574
|
+
}
|
|
4575
|
+
|
|
4576
|
+
void
|
|
4577
|
+
Slice::Unit::setSeenDefinition()
|
|
4578
|
+
{
|
|
4579
|
+
DefinitionContextPtr dc = currentDefinitionContext();
|
|
4580
|
+
assert(dc);
|
|
4581
|
+
dc->setSeenDefinition();
|
|
4582
|
+
}
|
|
4583
|
+
|
|
4584
|
+
void
|
|
4585
|
+
Slice::Unit::error(string_view message)
|
|
4586
|
+
{
|
|
4587
|
+
error(currentFile(), currentLine(), message);
|
|
4588
|
+
}
|
|
4589
|
+
|
|
4590
|
+
void
|
|
4591
|
+
Slice::Unit::error(string_view file, int line, string_view message)
|
|
4592
|
+
{
|
|
4593
|
+
emitError(file, line, message);
|
|
4594
|
+
_errors++;
|
|
4595
|
+
}
|
|
4596
|
+
|
|
4597
|
+
void
|
|
4598
|
+
Slice::Unit::warning(WarningCategory category, string_view message) const
|
|
4599
|
+
{
|
|
4600
|
+
warning(currentFile(), currentLine(), category, message);
|
|
4601
|
+
}
|
|
4602
|
+
|
|
4603
|
+
void
|
|
4604
|
+
Slice::Unit::warning(string_view file, int line, WarningCategory category, string_view message) const
|
|
4605
|
+
{
|
|
4606
|
+
DefinitionContextPtr dc = findDefinitionContext(file);
|
|
4607
|
+
assert(dc);
|
|
4608
|
+
|
|
4609
|
+
// Determine whether the warning should be ignored by checking for any 'suppress-warning' metadata in this context.
|
|
4610
|
+
if (!dc->isSuppressed(category))
|
|
4611
|
+
{
|
|
4612
|
+
emitWarning(file, line, message);
|
|
4613
|
+
}
|
|
4614
|
+
}
|
|
4615
|
+
|
|
4616
|
+
ContainerPtr
|
|
4617
|
+
Slice::Unit::currentContainer() const
|
|
4618
|
+
{
|
|
4619
|
+
assert(!_containerStack.empty());
|
|
4620
|
+
return _containerStack.top();
|
|
4621
|
+
}
|
|
4622
|
+
|
|
4623
|
+
void
|
|
4624
|
+
Slice::Unit::pushContainer(const ContainerPtr& container)
|
|
4625
|
+
{
|
|
4626
|
+
_containerStack.push(container);
|
|
4627
|
+
}
|
|
4628
|
+
|
|
4629
|
+
void
|
|
4630
|
+
Slice::Unit::popContainer()
|
|
4631
|
+
{
|
|
4632
|
+
assert(!_containerStack.empty());
|
|
4633
|
+
_containerStack.pop();
|
|
4634
|
+
}
|
|
4635
|
+
|
|
4636
|
+
DefinitionContextPtr
|
|
4637
|
+
Slice::Unit::currentDefinitionContext() const
|
|
4638
|
+
{
|
|
4639
|
+
DefinitionContextPtr dc;
|
|
4640
|
+
if (!_definitionContextStack.empty())
|
|
4641
|
+
{
|
|
4642
|
+
dc = _definitionContextStack.top();
|
|
4643
|
+
}
|
|
4644
|
+
return dc;
|
|
4645
|
+
}
|
|
4646
|
+
|
|
4647
|
+
void
|
|
4648
|
+
Slice::Unit::pushDefinitionContext()
|
|
4649
|
+
{
|
|
4650
|
+
_definitionContextStack.push(make_shared<DefinitionContext>(_currentIncludeLevel));
|
|
4651
|
+
}
|
|
4652
|
+
|
|
4653
|
+
void
|
|
4654
|
+
Slice::Unit::popDefinitionContext()
|
|
4655
|
+
{
|
|
4656
|
+
assert(!_definitionContextStack.empty());
|
|
4657
|
+
_definitionContextStack.pop();
|
|
4658
|
+
}
|
|
4659
|
+
|
|
4660
|
+
DefinitionContextPtr
|
|
4661
|
+
Slice::Unit::findDefinitionContext(string_view file) const
|
|
4662
|
+
{
|
|
4663
|
+
auto p = _definitionContextMap.find(file);
|
|
4664
|
+
if (p != _definitionContextMap.end())
|
|
4665
|
+
{
|
|
4666
|
+
return p->second;
|
|
4667
|
+
}
|
|
4668
|
+
return nullptr;
|
|
4669
|
+
}
|
|
4670
|
+
|
|
4671
|
+
void
|
|
4672
|
+
Slice::Unit::addContent(const ContainedPtr& contained)
|
|
4673
|
+
{
|
|
4674
|
+
assert(!contained->name().empty());
|
|
4675
|
+
string scoped = IceInternal::toLower(contained->scoped());
|
|
4676
|
+
_contentMap[scoped].push_back(contained);
|
|
4677
|
+
}
|
|
4678
|
+
|
|
4679
|
+
ContainedList
|
|
4680
|
+
Slice::Unit::findContents(const string& scopedName) const
|
|
4681
|
+
{
|
|
4682
|
+
assert(!scopedName.empty());
|
|
4683
|
+
assert(scopedName[0] == ':');
|
|
4684
|
+
|
|
4685
|
+
string name = IceInternal::toLower(scopedName);
|
|
4686
|
+
auto p = _contentMap.find(name);
|
|
4687
|
+
if (p != _contentMap.end())
|
|
4688
|
+
{
|
|
4689
|
+
return p->second;
|
|
4690
|
+
}
|
|
4691
|
+
else
|
|
4692
|
+
{
|
|
4693
|
+
return {};
|
|
4694
|
+
}
|
|
4695
|
+
}
|
|
4696
|
+
|
|
4697
|
+
void
|
|
4698
|
+
Slice::Unit::addTypeId(int32_t compactId, const std::string& typeId)
|
|
4699
|
+
{
|
|
4700
|
+
_typeIds.insert(make_pair(compactId, typeId));
|
|
4701
|
+
}
|
|
4702
|
+
|
|
4703
|
+
std::string
|
|
4704
|
+
Slice::Unit::getTypeId(int32_t compactId) const
|
|
4705
|
+
{
|
|
4706
|
+
auto p = _typeIds.find(compactId);
|
|
4707
|
+
if (p != _typeIds.end())
|
|
4708
|
+
{
|
|
4709
|
+
return p->second;
|
|
4710
|
+
}
|
|
4711
|
+
return {};
|
|
4712
|
+
}
|
|
4713
|
+
|
|
4714
|
+
StringList
|
|
4715
|
+
Slice::Unit::includeFiles() const
|
|
4716
|
+
{
|
|
4717
|
+
return _includeFiles;
|
|
4718
|
+
}
|
|
4719
|
+
|
|
4720
|
+
StringList
|
|
4721
|
+
Slice::Unit::allFiles() const
|
|
4722
|
+
{
|
|
4723
|
+
return _allFiles;
|
|
4724
|
+
}
|
|
4725
|
+
|
|
4726
|
+
int
|
|
4727
|
+
Slice::Unit::parse(const string& filename, FILE* file, bool debugMode)
|
|
4728
|
+
{
|
|
4729
|
+
slice_debug = debugMode ? 1 : 0;
|
|
4730
|
+
slice__flex_debug = debugMode ? 1 : 0;
|
|
4731
|
+
|
|
4732
|
+
assert(!Slice::currentUnit);
|
|
4733
|
+
Slice::currentUnit = this;
|
|
4734
|
+
|
|
4735
|
+
_currentDocComment = "";
|
|
4736
|
+
_currentIncludeLevel = 0;
|
|
4737
|
+
_topLevelFile = fullPath(filename);
|
|
4738
|
+
pushContainer(shared_from_this());
|
|
4739
|
+
pushDefinitionContext();
|
|
4740
|
+
setCurrentFile(_topLevelFile, 0);
|
|
4741
|
+
|
|
4742
|
+
slice_in = file;
|
|
4743
|
+
int status = slice_parse();
|
|
4744
|
+
if (_errors > 0)
|
|
4745
|
+
{
|
|
4746
|
+
status = EXIT_FAILURE;
|
|
4747
|
+
}
|
|
4748
|
+
|
|
4749
|
+
if (status == EXIT_FAILURE)
|
|
4750
|
+
{
|
|
4751
|
+
while (!_containerStack.empty())
|
|
4752
|
+
{
|
|
4753
|
+
popContainer();
|
|
4754
|
+
}
|
|
4755
|
+
while (!_definitionContextStack.empty())
|
|
4756
|
+
{
|
|
4757
|
+
popDefinitionContext();
|
|
4758
|
+
}
|
|
4759
|
+
}
|
|
4760
|
+
else
|
|
4761
|
+
{
|
|
4762
|
+
assert(_containerStack.size() == 1);
|
|
4763
|
+
popContainer();
|
|
4764
|
+
assert(_definitionContextStack.size() == 1);
|
|
4765
|
+
popDefinitionContext();
|
|
4766
|
+
|
|
4767
|
+
emitDeprecationWarningsFor(unit());
|
|
4768
|
+
}
|
|
4769
|
+
|
|
4770
|
+
Slice::currentUnit = nullptr;
|
|
4771
|
+
return status;
|
|
4772
|
+
}
|
|
4773
|
+
|
|
4774
|
+
void
|
|
4775
|
+
Slice::Unit::destroy()
|
|
4776
|
+
{
|
|
4777
|
+
// Unit has a pointer to each of the builtin types (since it logically owns them).
|
|
4778
|
+
// But each builtin also keeps a pointer to the builtin that created them.
|
|
4779
|
+
// We need to break this cycle.
|
|
4780
|
+
for (auto& builtin : _builtins)
|
|
4781
|
+
{
|
|
4782
|
+
builtin.second->destroy();
|
|
4783
|
+
}
|
|
4784
|
+
destroyContents();
|
|
4785
|
+
|
|
4786
|
+
_contentMap.clear();
|
|
4787
|
+
_builtins.clear();
|
|
4788
|
+
}
|
|
4789
|
+
|
|
4790
|
+
void
|
|
4791
|
+
Slice::Unit::visit(ParserVisitor* visitor)
|
|
4792
|
+
{
|
|
4793
|
+
auto self = dynamic_pointer_cast<Unit>(shared_from_this());
|
|
4794
|
+
if (visitor->visitUnitStart(self))
|
|
4795
|
+
{
|
|
4796
|
+
visitContents(visitor);
|
|
4797
|
+
visitor->visitUnitEnd(self);
|
|
4798
|
+
}
|
|
4799
|
+
}
|
|
4800
|
+
|
|
4801
|
+
UnitPtr
|
|
4802
|
+
Slice::Unit::unit() const
|
|
4803
|
+
{
|
|
4804
|
+
ContainerPtr self = const_cast<Unit*>(this)->shared_from_this();
|
|
4805
|
+
return dynamic_pointer_cast<Unit>(self);
|
|
4806
|
+
}
|
|
4807
|
+
|
|
4808
|
+
int
|
|
4809
|
+
Slice::Unit::getStatus() const
|
|
4810
|
+
{
|
|
4811
|
+
return (_errors > 0 ? EXIT_FAILURE : EXIT_SUCCESS);
|
|
4812
|
+
}
|
|
4813
|
+
|
|
4814
|
+
BuiltinPtr
|
|
4815
|
+
Slice::Unit::createBuiltin(Builtin::Kind kind)
|
|
4816
|
+
{
|
|
4817
|
+
auto p = _builtins.find(kind);
|
|
4818
|
+
if (p != _builtins.end())
|
|
4819
|
+
{
|
|
4820
|
+
return p->second;
|
|
4821
|
+
}
|
|
4822
|
+
auto builtin = make_shared<Builtin>(dynamic_pointer_cast<Unit>(shared_from_this()), kind);
|
|
4823
|
+
_builtins.insert(make_pair(kind, builtin));
|
|
4824
|
+
return builtin;
|
|
4825
|
+
}
|
|
4826
|
+
|
|
4827
|
+
void
|
|
4828
|
+
Slice::Unit::addTopLevelModule(const string& file, const string& module)
|
|
4829
|
+
{
|
|
4830
|
+
auto i = _fileTopLevelModules.find(file);
|
|
4831
|
+
if (i == _fileTopLevelModules.end())
|
|
4832
|
+
{
|
|
4833
|
+
set<string> modules;
|
|
4834
|
+
modules.insert(module);
|
|
4835
|
+
_fileTopLevelModules.insert(make_pair(file, modules));
|
|
4836
|
+
}
|
|
4837
|
+
else
|
|
4838
|
+
{
|
|
4839
|
+
i->second.insert(module);
|
|
4840
|
+
}
|
|
4841
|
+
}
|
|
4842
|
+
|
|
4843
|
+
set<string>
|
|
4844
|
+
Slice::Unit::getTopLevelModules(const string& file) const
|
|
4845
|
+
{
|
|
4846
|
+
auto i = _fileTopLevelModules.find(file);
|
|
4847
|
+
if (i == _fileTopLevelModules.end())
|
|
4848
|
+
{
|
|
4849
|
+
return {};
|
|
4850
|
+
}
|
|
4851
|
+
else
|
|
4852
|
+
{
|
|
4853
|
+
return i->second;
|
|
4854
|
+
}
|
|
4855
|
+
}
|
|
4856
|
+
|
|
4857
|
+
Slice::Unit::Unit(string languageName, bool all) : _languageName(std::move(languageName)), _all(all)
|
|
4858
|
+
{
|
|
4859
|
+
if (!languageName.empty())
|
|
4860
|
+
{
|
|
4861
|
+
assert(binary_search(&languages[0], &languages[sizeof(languages) / sizeof(*languages)], _languageName));
|
|
4862
|
+
}
|
|
4863
|
+
}
|
|
4864
|
+
|
|
4865
|
+
// ----------------------------------------------------------------------
|
|
4866
|
+
// CICompare
|
|
4867
|
+
// ----------------------------------------------------------------------
|
|
4868
|
+
|
|
4869
|
+
bool
|
|
4870
|
+
Slice::CICompare::operator()(const string& lhs, const string& rhs) const
|
|
4871
|
+
{
|
|
4872
|
+
string::const_iterator p1 = lhs.begin();
|
|
4873
|
+
string::const_iterator p2 = rhs.begin();
|
|
4874
|
+
while (p1 != lhs.end() && p2 != rhs.end() &&
|
|
4875
|
+
::tolower(static_cast<unsigned char>(*p1)) == ::tolower(static_cast<unsigned char>(*p2)))
|
|
4876
|
+
{
|
|
4877
|
+
++p1;
|
|
4878
|
+
++p2;
|
|
4879
|
+
}
|
|
4880
|
+
if (p1 == lhs.end() && p2 == rhs.end())
|
|
4881
|
+
{
|
|
4882
|
+
return false;
|
|
4883
|
+
}
|
|
4884
|
+
else if (p1 == lhs.end())
|
|
4885
|
+
{
|
|
4886
|
+
return true;
|
|
4887
|
+
}
|
|
4888
|
+
else if (p2 == rhs.end())
|
|
4889
|
+
{
|
|
4890
|
+
return false;
|
|
4891
|
+
}
|
|
4892
|
+
else
|
|
4893
|
+
{
|
|
4894
|
+
return ::tolower(static_cast<unsigned char>(*p1)) < ::tolower(static_cast<unsigned char>(*p2));
|
|
4895
|
+
}
|
|
4896
|
+
}
|
|
4897
|
+
|
|
4898
|
+
// ----------------------------------------------------------------------
|
|
4899
|
+
// DerivedToBaseCompare
|
|
4900
|
+
// ----------------------------------------------------------------------
|
|
4901
|
+
|
|
4902
|
+
bool
|
|
4903
|
+
Slice::DerivedToBaseCompare::operator()(const ExceptionPtr& lhs, const ExceptionPtr& rhs) const
|
|
4904
|
+
{
|
|
4905
|
+
return rhs->isBaseOf(lhs);
|
|
4906
|
+
}
|