zeroc-ice 3.6b1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ICE_LICENSE +54 -0
- data/LICENSE +339 -0
- data/bin/slice2rb +17 -0
- data/ext/Communicator.cpp +596 -0
- data/ext/Communicator.h +25 -0
- data/ext/Config.h +111 -0
- data/ext/Connection.cpp +381 -0
- data/ext/Connection.h +26 -0
- data/ext/Endpoint.cpp +311 -0
- data/ext/Endpoint.h +27 -0
- data/ext/ImplicitContext.cpp +152 -0
- data/ext/ImplicitContext.h +25 -0
- data/ext/Init.cpp +52 -0
- data/ext/Logger.cpp +151 -0
- data/ext/Logger.h +28 -0
- data/ext/ObjectFactory.cpp +140 -0
- data/ext/ObjectFactory.h +50 -0
- data/ext/Operation.cpp +676 -0
- data/ext/Operation.h +36 -0
- data/ext/Properties.cpp +369 -0
- data/ext/Properties.h +25 -0
- data/ext/Proxy.cpp +1354 -0
- data/ext/Proxy.h +27 -0
- data/ext/Slice.cpp +223 -0
- data/ext/Slice.h +22 -0
- data/ext/Types.cpp +3160 -0
- data/ext/Types.h +545 -0
- data/ext/Util.cpp +792 -0
- data/ext/Util.h +511 -0
- data/ext/extconf.rb +118 -0
- data/ext/ice/BZIP_LICENSE +42 -0
- data/ext/ice/MCPP_LICENSE +36 -0
- data/ext/ice/bzip2/blocksort.c +1094 -0
- data/ext/ice/bzip2/bzlib.c +1572 -0
- data/ext/ice/bzip2/bzlib.h +282 -0
- data/ext/ice/bzip2/bzlib_private.h +509 -0
- data/ext/ice/bzip2/compress.c +672 -0
- data/ext/ice/bzip2/crctable.c +104 -0
- data/ext/ice/bzip2/decompress.c +646 -0
- data/ext/ice/bzip2/huffman.c +205 -0
- data/ext/ice/bzip2/randtable.c +84 -0
- data/ext/ice/cpp/include/Ice/ACMF.h +30 -0
- data/ext/ice/cpp/include/Ice/Application.h +156 -0
- data/ext/ice/cpp/include/Ice/AsyncResult.h +363 -0
- data/ext/ice/cpp/include/Ice/AsyncResultF.h +26 -0
- data/ext/ice/cpp/include/Ice/BasicStream.h +1315 -0
- data/ext/ice/cpp/include/Ice/Buffer.h +159 -0
- data/ext/ice/cpp/include/Ice/BuiltinSequences.h +74 -0
- data/ext/ice/cpp/include/Ice/Communicator.h +194 -0
- data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +115 -0
- data/ext/ice/cpp/include/Ice/CommunicatorF.h +60 -0
- data/ext/ice/cpp/include/Ice/Config.h +97 -0
- data/ext/ice/cpp/include/Ice/Connection.h +495 -0
- data/ext/ice/cpp/include/Ice/ConnectionAsync.h +115 -0
- data/ext/ice/cpp/include/Ice/ConnectionF.h +72 -0
- data/ext/ice/cpp/include/Ice/ConnectionFactoryF.h +30 -0
- data/ext/ice/cpp/include/Ice/ConnectionIF.h +37 -0
- data/ext/ice/cpp/include/Ice/Current.h +94 -0
- data/ext/ice/cpp/include/Ice/DefaultObjectFactory.h +48 -0
- data/ext/ice/cpp/include/Ice/DeprecatedStringConverter.h +62 -0
- data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +33 -0
- data/ext/ice/cpp/include/Ice/Dispatcher.h +51 -0
- data/ext/ice/cpp/include/Ice/DynamicLibrary.h +105 -0
- data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +29 -0
- data/ext/ice/cpp/include/Ice/Endpoint.h +350 -0
- data/ext/ice/cpp/include/Ice/EndpointF.h +97 -0
- data/ext/ice/cpp/include/Ice/EndpointTypes.h +74 -0
- data/ext/ice/cpp/include/Ice/Exception.h +114 -0
- data/ext/ice/cpp/include/Ice/FacetMap.h +56 -0
- data/ext/ice/cpp/include/Ice/FactoryTable.h +69 -0
- data/ext/ice/cpp/include/Ice/FactoryTableInit.h +87 -0
- data/ext/ice/cpp/include/Ice/Format.h +39 -0
- data/ext/ice/cpp/include/Ice/Functional.h +138 -0
- data/ext/ice/cpp/include/Ice/GCObject.h +73 -0
- data/ext/ice/cpp/include/Ice/Handle.h +192 -0
- data/ext/ice/cpp/include/Ice/Ice.h +54 -0
- data/ext/ice/cpp/include/Ice/Identity.h +160 -0
- data/ext/ice/cpp/include/Ice/ImplicitContext.h +96 -0
- data/ext/ice/cpp/include/Ice/ImplicitContextF.h +60 -0
- data/ext/ice/cpp/include/Ice/Incoming.h +131 -0
- data/ext/ice/cpp/include/Ice/IncomingAsync.h +108 -0
- data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +35 -0
- data/ext/ice/cpp/include/Ice/Initialize.h +141 -0
- data/ext/ice/cpp/include/Ice/InstanceF.h +26 -0
- data/ext/ice/cpp/include/Ice/Instrumentation.h +377 -0
- data/ext/ice/cpp/include/Ice/InstrumentationF.h +71 -0
- data/ext/ice/cpp/include/Ice/LocalException.h +1022 -0
- data/ext/ice/cpp/include/Ice/LocalObject.h +36 -0
- data/ext/ice/cpp/include/Ice/LocalObjectF.h +26 -0
- data/ext/ice/cpp/include/Ice/Locator.h +2191 -0
- data/ext/ice/cpp/include/Ice/LocatorF.h +89 -0
- data/ext/ice/cpp/include/Ice/Logger.h +94 -0
- data/ext/ice/cpp/include/Ice/LoggerF.h +60 -0
- data/ext/ice/cpp/include/Ice/LoggerUtil.h +153 -0
- data/ext/ice/cpp/include/Ice/Makefile +26 -0
- data/ext/ice/cpp/include/Ice/Metrics.h +2989 -0
- data/ext/ice/cpp/include/Ice/MetricsAdminI.h +662 -0
- data/ext/ice/cpp/include/Ice/MetricsFunctional.h +144 -0
- data/ext/ice/cpp/include/Ice/MetricsObserverI.h +576 -0
- data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +55 -0
- data/ext/ice/cpp/include/Ice/Object.h +165 -0
- data/ext/ice/cpp/include/Ice/ObjectAdapter.h +162 -0
- data/ext/ice/cpp/include/Ice/ObjectAdapterF.h +60 -0
- data/ext/ice/cpp/include/Ice/ObjectAdapterFactoryF.h +26 -0
- data/ext/ice/cpp/include/Ice/ObjectF.h +26 -0
- data/ext/ice/cpp/include/Ice/ObjectFactory.h +86 -0
- data/ext/ice/cpp/include/Ice/ObjectFactoryF.h +60 -0
- data/ext/ice/cpp/include/Ice/ObjectFactoryManagerF.h +26 -0
- data/ext/ice/cpp/include/Ice/ObserverHelper.h +177 -0
- data/ext/ice/cpp/include/Ice/Outgoing.h +197 -0
- data/ext/ice/cpp/include/Ice/OutgoingAsync.h +264 -0
- data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +38 -0
- data/ext/ice/cpp/include/Ice/Plugin.h +121 -0
- data/ext/ice/cpp/include/Ice/PluginF.h +66 -0
- data/ext/ice/cpp/include/Ice/Process.h +568 -0
- data/ext/ice/cpp/include/Ice/ProcessF.h +77 -0
- data/ext/ice/cpp/include/Ice/Properties.h +130 -0
- data/ext/ice/cpp/include/Ice/PropertiesAdmin.h +824 -0
- data/ext/ice/cpp/include/Ice/PropertiesF.h +83 -0
- data/ext/ice/cpp/include/Ice/Protocol.h +242 -0
- data/ext/ice/cpp/include/Ice/Proxy.h +2448 -0
- data/ext/ice/cpp/include/Ice/ProxyF.h +78 -0
- data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +26 -0
- data/ext/ice/cpp/include/Ice/ProxyHandle.h +330 -0
- data/ext/ice/cpp/include/Ice/ReferenceF.h +34 -0
- data/ext/ice/cpp/include/Ice/RemoteLogger.h +1496 -0
- data/ext/ice/cpp/include/Ice/RequestHandlerF.h +29 -0
- data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +25 -0
- data/ext/ice/cpp/include/Ice/Router.h +1155 -0
- data/ext/ice/cpp/include/Ice/RouterF.h +77 -0
- data/ext/ice/cpp/include/Ice/ServantLocator.h +90 -0
- data/ext/ice/cpp/include/Ice/ServantLocatorF.h +60 -0
- data/ext/ice/cpp/include/Ice/ServantManagerF.h +26 -0
- data/ext/ice/cpp/include/Ice/Service.h +260 -0
- data/ext/ice/cpp/include/Ice/SliceChecksumDict.h +56 -0
- data/ext/ice/cpp/include/Ice/SliceChecksums.h +34 -0
- data/ext/ice/cpp/include/Ice/SlicedData.h +103 -0
- data/ext/ice/cpp/include/Ice/SlicedDataF.h +34 -0
- data/ext/ice/cpp/include/Ice/Stream.h +449 -0
- data/ext/ice/cpp/include/Ice/StreamF.h +30 -0
- data/ext/ice/cpp/include/Ice/StreamHelpers.h +877 -0
- data/ext/ice/cpp/include/Ice/ThreadPoolF.h +28 -0
- data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +56 -0
- data/ext/ice/cpp/include/Ice/Version.h +254 -0
- data/ext/ice/cpp/include/IceSSL/Config.h +23 -0
- data/ext/ice/cpp/include/IceSSL/ConnectionInfo.h +119 -0
- data/ext/ice/cpp/include/IceSSL/EndpointInfo.h +101 -0
- data/ext/ice/cpp/include/IceSSL/IceSSL.h +22 -0
- data/ext/ice/cpp/include/IceSSL/Makefile +26 -0
- data/ext/ice/cpp/include/IceSSL/Plugin.h +558 -0
- data/ext/ice/cpp/include/IceUtil/AbstractMutex.h +119 -0
- data/ext/ice/cpp/include/IceUtil/Cache.h +362 -0
- data/ext/ice/cpp/include/IceUtil/Cond.h +323 -0
- data/ext/ice/cpp/include/IceUtil/Config.h +234 -0
- data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +50 -0
- data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +70 -0
- data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +45 -0
- data/ext/ice/cpp/include/IceUtil/Exception.h +184 -0
- data/ext/ice/cpp/include/IceUtil/Functional.h +389 -0
- data/ext/ice/cpp/include/IceUtil/Handle.h +266 -0
- data/ext/ice/cpp/include/IceUtil/IceUtil.h +51 -0
- data/ext/ice/cpp/include/IceUtil/IconvStringConverter.h +302 -0
- data/ext/ice/cpp/include/IceUtil/InputUtil.h +47 -0
- data/ext/ice/cpp/include/IceUtil/Iterator.h +36 -0
- data/ext/ice/cpp/include/IceUtil/Lock.h +135 -0
- data/ext/ice/cpp/include/IceUtil/Makefile +26 -0
- data/ext/ice/cpp/include/IceUtil/Monitor.h +249 -0
- data/ext/ice/cpp/include/IceUtil/Mutex.h +357 -0
- data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +28 -0
- data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +83 -0
- data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +82 -0
- data/ext/ice/cpp/include/IceUtil/Optional.h +322 -0
- data/ext/ice/cpp/include/IceUtil/Options.h +141 -0
- data/ext/ice/cpp/include/IceUtil/OutputUtil.h +362 -0
- data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +19 -0
- data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +26 -0
- data/ext/ice/cpp/include/IceUtil/Random.h +24 -0
- data/ext/ice/cpp/include/IceUtil/RecMutex.h +113 -0
- data/ext/ice/cpp/include/IceUtil/SHA1.h +65 -0
- data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +44 -0
- data/ext/ice/cpp/include/IceUtil/ScopedArray.h +97 -0
- data/ext/ice/cpp/include/IceUtil/Shared.h +168 -0
- data/ext/ice/cpp/include/IceUtil/StringConverter.h +175 -0
- data/ext/ice/cpp/include/IceUtil/StringUtil.h +91 -0
- data/ext/ice/cpp/include/IceUtil/Thread.h +181 -0
- data/ext/ice/cpp/include/IceUtil/ThreadException.h +108 -0
- data/ext/ice/cpp/include/IceUtil/Time.h +209 -0
- data/ext/ice/cpp/include/IceUtil/Timer.h +143 -0
- data/ext/ice/cpp/include/IceUtil/UUID.h +22 -0
- data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +42 -0
- data/ext/ice/cpp/include/IceUtil/UniquePtr.h +101 -0
- data/ext/ice/cpp/include/Slice/CPlusPlusUtil.h +64 -0
- data/ext/ice/cpp/include/Slice/Checksum.h +26 -0
- data/ext/ice/cpp/include/Slice/CsUtil.h +92 -0
- data/ext/ice/cpp/include/Slice/DotNetNames.h +34 -0
- data/ext/ice/cpp/include/Slice/FileTracker.h +71 -0
- data/ext/ice/cpp/include/Slice/JavaUtil.h +277 -0
- data/ext/ice/cpp/include/Slice/Makefile +26 -0
- data/ext/ice/cpp/include/Slice/PHPUtil.h +50 -0
- data/ext/ice/cpp/include/Slice/Parser.h +1116 -0
- data/ext/ice/cpp/include/Slice/Preprocessor.h +68 -0
- data/ext/ice/cpp/include/Slice/PythonUtil.h +64 -0
- data/ext/ice/cpp/include/Slice/RubyUtil.h +54 -0
- data/ext/ice/cpp/include/Slice/Util.h +33 -0
- data/ext/ice/cpp/src/Ice/ACM.cpp +343 -0
- data/ext/ice/cpp/src/Ice/ACM.h +117 -0
- data/ext/ice/cpp/src/Ice/Acceptor.cpp +16 -0
- data/ext/ice/cpp/src/Ice/Acceptor.h +41 -0
- data/ext/ice/cpp/src/Ice/AcceptorF.h +30 -0
- data/ext/ice/cpp/src/Ice/Application.cpp +760 -0
- data/ext/ice/cpp/src/Ice/AsyncResult.cpp +599 -0
- data/ext/ice/cpp/src/Ice/Base64.cpp +269 -0
- data/ext/ice/cpp/src/Ice/Base64.h +36 -0
- data/ext/ice/cpp/src/Ice/BasicStream.cpp +3393 -0
- data/ext/ice/cpp/src/Ice/Buffer.cpp +98 -0
- data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +34 -0
- data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +718 -0
- data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +106 -0
- data/ext/ice/cpp/src/Ice/Communicator.cpp +45 -0
- data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +386 -0
- data/ext/ice/cpp/src/Ice/CommunicatorI.h +112 -0
- data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +546 -0
- data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +97 -0
- data/ext/ice/cpp/src/Ice/Connection.cpp +58 -0
- data/ext/ice/cpp/src/Ice/ConnectionF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +1639 -0
- data/ext/ice/cpp/src/Ice/ConnectionFactory.h +236 -0
- data/ext/ice/cpp/src/Ice/ConnectionI.cpp +3876 -0
- data/ext/ice/cpp/src/Ice/ConnectionI.h +364 -0
- data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +115 -0
- data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +50 -0
- data/ext/ice/cpp/src/Ice/Connector.cpp +16 -0
- data/ext/ice/cpp/src/Ice/Connector.h +36 -0
- data/ext/ice/cpp/src/Ice/ConnectorF.h +26 -0
- data/ext/ice/cpp/src/Ice/Current.cpp +38 -0
- data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +168 -0
- data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +57 -0
- data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +26 -0
- data/ext/ice/cpp/src/Ice/DeprecatedStringConverter.cpp +60 -0
- data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +49 -0
- data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +281 -0
- data/ext/ice/cpp/src/Ice/Endpoint.cpp +53 -0
- data/ext/ice/cpp/src/Ice/EndpointF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +25 -0
- data/ext/ice/cpp/src/Ice/EndpointFactory.h +44 -0
- data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +26 -0
- data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +208 -0
- data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +46 -0
- data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +26 -0
- data/ext/ice/cpp/src/Ice/EndpointI.cpp +87 -0
- data/ext/ice/cpp/src/Ice/EndpointI.h +165 -0
- data/ext/ice/cpp/src/Ice/EndpointIF.h +41 -0
- data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +38 -0
- data/ext/ice/cpp/src/Ice/EventHandler.cpp +35 -0
- data/ext/ice/cpp/src/Ice/EventHandler.h +78 -0
- data/ext/ice/cpp/src/Ice/EventHandlerF.h +26 -0
- data/ext/ice/cpp/src/Ice/EventLoggerMsg.h +53 -0
- data/ext/ice/cpp/src/Ice/Exception.cpp +832 -0
- data/ext/ice/cpp/src/Ice/FacetMap.cpp +34 -0
- data/ext/ice/cpp/src/Ice/FactoryTable.cpp +158 -0
- data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +95 -0
- data/ext/ice/cpp/src/Ice/GCObject.cpp +444 -0
- data/ext/ice/cpp/src/Ice/HashUtil.h +59 -0
- data/ext/ice/cpp/src/Ice/HttpParser.cpp +680 -0
- data/ext/ice/cpp/src/Ice/HttpParser.h +124 -0
- data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +733 -0
- data/ext/ice/cpp/src/Ice/IPEndpointI.h +157 -0
- data/ext/ice/cpp/src/Ice/IPEndpointIF.h +29 -0
- data/ext/ice/cpp/src/Ice/Identity.cpp +42 -0
- data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +41 -0
- data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +639 -0
- data/ext/ice/cpp/src/Ice/ImplicitContextI.h +51 -0
- data/ext/ice/cpp/src/Ice/Incoming.cpp +757 -0
- data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +340 -0
- data/ext/ice/cpp/src/Ice/IncomingRequest.h +37 -0
- data/ext/ice/cpp/src/Ice/Initialize.cpp +401 -0
- data/ext/ice/cpp/src/Ice/Instance.cpp +1928 -0
- data/ext/ice/cpp/src/Ice/Instance.h +198 -0
- data/ext/ice/cpp/src/Ice/Instrumentation.cpp +68 -0
- data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +43 -0
- data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +1083 -0
- data/ext/ice/cpp/src/Ice/InstrumentationI.h +262 -0
- data/ext/ice/cpp/src/Ice/LocalException.cpp +2091 -0
- data/ext/ice/cpp/src/Ice/LocalObject.cpp +29 -0
- data/ext/ice/cpp/src/Ice/Locator.cpp +1946 -0
- data/ext/ice/cpp/src/Ice/LocatorF.cpp +39 -0
- data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +917 -0
- data/ext/ice/cpp/src/Ice/LocatorInfo.h +193 -0
- data/ext/ice/cpp/src/Ice/LocatorInfoF.h +34 -0
- data/ext/ice/cpp/src/Ice/Logger.cpp +40 -0
- data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +862 -0
- data/ext/ice/cpp/src/Ice/LoggerAdminI.h +46 -0
- data/ext/ice/cpp/src/Ice/LoggerF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/LoggerI.cpp +199 -0
- data/ext/ice/cpp/src/Ice/LoggerI.h +57 -0
- data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +107 -0
- data/ext/ice/cpp/src/Ice/Makefile +190 -0
- data/ext/ice/cpp/src/Ice/Metrics.cpp +2159 -0
- data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +669 -0
- data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +14 -0
- data/ext/ice/cpp/src/Ice/Network.cpp +2694 -0
- data/ext/ice/cpp/src/Ice/Network.h +291 -0
- data/ext/ice/cpp/src/Ice/NetworkF.h +28 -0
- data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +325 -0
- data/ext/ice/cpp/src/Ice/NetworkProxy.h +74 -0
- data/ext/ice/cpp/src/Ice/NetworkProxyF.h +26 -0
- data/ext/ice/cpp/src/Ice/Object.cpp +440 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +41 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +241 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +52 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +1498 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +155 -0
- data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +41 -0
- data/ext/ice/cpp/src/Ice/ObjectFactoryF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ObjectFactoryManager.cpp +140 -0
- data/ext/ice/cpp/src/Ice/ObjectFactoryManager.h +43 -0
- data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +84 -0
- data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +407 -0
- data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +70 -0
- data/ext/ice/cpp/src/Ice/Outgoing.cpp +737 -0
- data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +874 -0
- data/ext/ice/cpp/src/Ice/Plugin.cpp +43 -0
- data/ext/ice/cpp/src/Ice/PluginF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +503 -0
- data/ext/ice/cpp/src/Ice/PluginManagerI.h +67 -0
- data/ext/ice/cpp/src/Ice/Process.cpp +299 -0
- data/ext/ice/cpp/src/Ice/ProcessF.cpp +39 -0
- data/ext/ice/cpp/src/Ice/Properties.cpp +45 -0
- data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +555 -0
- data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +207 -0
- data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +45 -0
- data/ext/ice/cpp/src/Ice/PropertiesF.cpp +39 -0
- data/ext/ice/cpp/src/Ice/PropertiesI.cpp +759 -0
- data/ext/ice/cpp/src/Ice/PropertiesI.h +78 -0
- data/ext/ice/cpp/src/Ice/PropertyNames.cpp +1293 -0
- data/ext/ice/cpp/src/Ice/PropertyNames.h +81 -0
- data/ext/ice/cpp/src/Ice/Protocol.cpp +137 -0
- data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +98 -0
- data/ext/ice/cpp/src/Ice/ProtocolInstance.h +91 -0
- data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +26 -0
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +51 -0
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +67 -0
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +26 -0
- data/ext/ice/cpp/src/Ice/Proxy.cpp +1810 -0
- data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +305 -0
- data/ext/ice/cpp/src/Ice/ProxyFactory.h +57 -0
- data/ext/ice/cpp/src/Ice/Reference.cpp +1947 -0
- data/ext/ice/cpp/src/Ice/Reference.h +305 -0
- data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +937 -0
- data/ext/ice/cpp/src/Ice/ReferenceFactory.h +81 -0
- data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +24 -0
- data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +958 -0
- data/ext/ice/cpp/src/Ice/ReplyStatus.h +29 -0
- data/ext/ice/cpp/src/Ice/RequestHandler.cpp +40 -0
- data/ext/ice/cpp/src/Ice/RequestHandler.h +90 -0
- data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +70 -0
- data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +41 -0
- data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +20 -0
- data/ext/ice/cpp/src/Ice/ResponseHandler.h +39 -0
- data/ext/ice/cpp/src/Ice/RetryQueue.cpp +154 -0
- data/ext/ice/cpp/src/Ice/RetryQueue.h +69 -0
- data/ext/ice/cpp/src/Ice/RetryQueueF.h +24 -0
- data/ext/ice/cpp/src/Ice/Router.cpp +849 -0
- data/ext/ice/cpp/src/Ice/RouterF.cpp +39 -0
- data/ext/ice/cpp/src/Ice/RouterInfo.cpp +381 -0
- data/ext/ice/cpp/src/Ice/RouterInfo.h +148 -0
- data/ext/ice/cpp/src/Ice/RouterInfoF.h +30 -0
- data/ext/ice/cpp/src/Ice/Selector.cpp +926 -0
- data/ext/ice/cpp/src/Ice/Selector.h +231 -0
- data/ext/ice/cpp/src/Ice/ServantLocator.cpp +41 -0
- data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ServantManager.cpp +495 -0
- data/ext/ice/cpp/src/Ice/ServantManager.h +74 -0
- data/ext/ice/cpp/src/Ice/Service.cpp +1897 -0
- data/ext/ice/cpp/src/Ice/SharedContext.h +51 -0
- data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +34 -0
- data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +80 -0
- data/ext/ice/cpp/src/Ice/SlicedData.cpp +80 -0
- data/ext/ice/cpp/src/Ice/Stream.cpp +53 -0
- data/ext/ice/cpp/src/Ice/StreamI.cpp +832 -0
- data/ext/ice/cpp/src/Ice/StreamI.h +198 -0
- data/ext/ice/cpp/src/Ice/StreamSocket.cpp +521 -0
- data/ext/ice/cpp/src/Ice/StreamSocket.h +85 -0
- data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +145 -0
- data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +167 -0
- data/ext/ice/cpp/src/Ice/SysLoggerI.h +43 -0
- data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +235 -0
- data/ext/ice/cpp/src/Ice/TcpAcceptor.h +67 -0
- data/ext/ice/cpp/src/Ice/TcpConnector.cpp +133 -0
- data/ext/ice/cpp/src/Ice/TcpConnector.h +51 -0
- data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +397 -0
- data/ext/ice/cpp/src/Ice/TcpEndpointI.h +93 -0
- data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +127 -0
- data/ext/ice/cpp/src/Ice/TcpTransceiver.h +61 -0
- data/ext/ice/cpp/src/Ice/ThreadPool.cpp +1357 -0
- data/ext/ice/cpp/src/Ice/ThreadPool.h +399 -0
- data/ext/ice/cpp/src/Ice/TraceLevels.cpp +43 -0
- data/ext/ice/cpp/src/Ice/TraceLevels.h +50 -0
- data/ext/ice/cpp/src/Ice/TraceLevelsF.h +26 -0
- data/ext/ice/cpp/src/Ice/TraceUtil.cpp +452 -0
- data/ext/ice/cpp/src/Ice/TraceUtil.h +28 -0
- data/ext/ice/cpp/src/Ice/Transceiver.cpp +24 -0
- data/ext/ice/cpp/src/Ice/Transceiver.h +52 -0
- data/ext/ice/cpp/src/Ice/TransceiverF.h +38 -0
- data/ext/ice/cpp/src/Ice/UdpConnector.cpp +144 -0
- data/ext/ice/cpp/src/Ice/UdpConnector.h +51 -0
- data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +483 -0
- data/ext/ice/cpp/src/Ice/UdpEndpointI.h +95 -0
- data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +1156 -0
- data/ext/ice/cpp/src/Ice/UdpTransceiver.h +123 -0
- data/ext/ice/cpp/src/Ice/Version.cpp +46 -0
- data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +103 -0
- data/ext/ice/cpp/src/Ice/WSAcceptor.h +61 -0
- data/ext/ice/cpp/src/Ice/WSConnector.cpp +113 -0
- data/ext/ice/cpp/src/Ice/WSConnector.h +51 -0
- data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +441 -0
- data/ext/ice/cpp/src/Ice/WSEndpoint.h +97 -0
- data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +1728 -0
- data/ext/ice/cpp/src/Ice/WSTransceiver.h +149 -0
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +594 -0
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +1035 -0
- data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +208 -0
- data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +78 -0
- data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +308 -0
- data/ext/ice/cpp/src/IceDiscovery/LookupI.h +183 -0
- data/ext/ice/cpp/src/IceDiscovery/Makefile +61 -0
- data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +148 -0
- data/ext/ice/cpp/src/IceDiscovery/PluginI.h +39 -0
- data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +258 -0
- data/ext/ice/cpp/src/IceSSL/AcceptorI.h +66 -0
- data/ext/ice/cpp/src/IceSSL/Certificate.cpp +1334 -0
- data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +42 -0
- data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +151 -0
- data/ext/ice/cpp/src/IceSSL/ConnectorI.h +56 -0
- data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +397 -0
- data/ext/ice/cpp/src/IceSSL/EndpointI.h +96 -0
- data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +41 -0
- data/ext/ice/cpp/src/IceSSL/Instance.cpp +38 -0
- data/ext/ice/cpp/src/IceSSL/Instance.h +42 -0
- data/ext/ice/cpp/src/IceSSL/InstanceF.h +34 -0
- data/ext/ice/cpp/src/IceSSL/Makefile +82 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +1001 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +607 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +75 -0
- data/ext/ice/cpp/src/IceSSL/PluginI.cpp +102 -0
- data/ext/ice/cpp/src/IceSSL/PluginI.h +56 -0
- data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +541 -0
- data/ext/ice/cpp/src/IceSSL/RFC2253.h +67 -0
- data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +729 -0
- data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +1062 -0
- data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +130 -0
- data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +291 -0
- data/ext/ice/cpp/src/IceSSL/SSLEngine.h +264 -0
- data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +41 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +1514 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +609 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +91 -0
- data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +246 -0
- data/ext/ice/cpp/src/IceSSL/TrustManager.h +51 -0
- data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +26 -0
- data/ext/ice/cpp/src/IceSSL/Util.cpp +1423 -0
- data/ext/ice/cpp/src/IceSSL/Util.h +136 -0
- data/ext/ice/cpp/src/IceUtil/ArgVector.cpp +65 -0
- data/ext/ice/cpp/src/IceUtil/ArgVector.h +41 -0
- data/ext/ice/cpp/src/IceUtil/Cond.cpp +386 -0
- data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +477 -0
- data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +144 -0
- data/ext/ice/cpp/src/IceUtil/CountDownLatch.cpp +184 -0
- data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +273 -0
- data/ext/ice/cpp/src/IceUtil/Exception.cpp +782 -0
- data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +532 -0
- data/ext/ice/cpp/src/IceUtil/FileUtil.h +159 -0
- data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +41 -0
- data/ext/ice/cpp/src/IceUtil/Makefile +68 -0
- data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +24 -0
- data/ext/ice/cpp/src/IceUtil/Options.cpp +1049 -0
- data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +591 -0
- data/ext/ice/cpp/src/IceUtil/Random.cpp +185 -0
- data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +257 -0
- data/ext/ice/cpp/src/IceUtil/SHA1.cpp +126 -0
- data/ext/ice/cpp/src/IceUtil/Shared.cpp +200 -0
- data/ext/ice/cpp/src/IceUtil/StopWatch.h +54 -0
- data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +450 -0
- data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +842 -0
- data/ext/ice/cpp/src/IceUtil/Thread.cpp +809 -0
- data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +172 -0
- data/ext/ice/cpp/src/IceUtil/Time.cpp +306 -0
- data/ext/ice/cpp/src/IceUtil/Timer.cpp +251 -0
- data/ext/ice/cpp/src/IceUtil/UUID.cpp +174 -0
- data/ext/ice/cpp/src/IceUtil/Unicode.cpp +131 -0
- data/ext/ice/cpp/src/IceUtil/Unicode.h +49 -0
- data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +1139 -0
- data/ext/ice/cpp/src/Slice/Checksum.cpp +452 -0
- data/ext/ice/cpp/src/Slice/CsUtil.cpp +2650 -0
- data/ext/ice/cpp/src/Slice/DotNetNames.cpp +146 -0
- data/ext/ice/cpp/src/Slice/FileTracker.cpp +203 -0
- data/ext/ice/cpp/src/Slice/Grammar.cpp +4755 -0
- data/ext/ice/cpp/src/Slice/Grammar.h +98 -0
- data/ext/ice/cpp/src/Slice/GrammarUtil.h +234 -0
- data/ext/ice/cpp/src/Slice/JavaUtil.cpp +4376 -0
- data/ext/ice/cpp/src/Slice/MD5.cpp +57 -0
- data/ext/ice/cpp/src/Slice/MD5.h +44 -0
- data/ext/ice/cpp/src/Slice/MD5I.cpp +385 -0
- data/ext/ice/cpp/src/Slice/MD5I.h +91 -0
- data/ext/ice/cpp/src/Slice/Makefile +65 -0
- data/ext/ice/cpp/src/Slice/PHPUtil.cpp +156 -0
- data/ext/ice/cpp/src/Slice/Parser.cpp +6386 -0
- data/ext/ice/cpp/src/Slice/Preprocessor.cpp +686 -0
- data/ext/ice/cpp/src/Slice/Python.cpp +675 -0
- data/ext/ice/cpp/src/Slice/PythonUtil.cpp +2614 -0
- data/ext/ice/cpp/src/Slice/Ruby.cpp +317 -0
- data/ext/ice/cpp/src/Slice/RubyUtil.cpp +1774 -0
- data/ext/ice/cpp/src/Slice/Scanner.cpp +2426 -0
- data/ext/ice/cpp/src/Slice/Util.cpp +325 -0
- data/ext/ice/mcpp/config.h.Darwin +227 -0
- data/ext/ice/mcpp/config.h.Linux +227 -0
- data/ext/ice/mcpp/config.h.MINGW +7 -0
- data/ext/ice/mcpp/configed.H +382 -0
- data/ext/ice/mcpp/directive.c +1699 -0
- data/ext/ice/mcpp/eval.c +1673 -0
- data/ext/ice/mcpp/expand.c +2980 -0
- data/ext/ice/mcpp/internal.H +564 -0
- data/ext/ice/mcpp/main.c +1131 -0
- data/ext/ice/mcpp/mbchar.c +869 -0
- data/ext/ice/mcpp/mcpp_lib.h +31 -0
- data/ext/ice/mcpp/mcpp_out.h +13 -0
- data/ext/ice/mcpp/support.c +2811 -0
- data/ext/ice/mcpp/system.H +396 -0
- data/ext/ice/mcpp/system.c +4940 -0
- data/ice.gemspec +41 -0
- data/lib/Glacier2.rb +12 -0
- data/lib/Glacier2/Metrics.rb +99 -0
- data/lib/Glacier2/PermissionsVerifier.rb +168 -0
- data/lib/Glacier2/PermissionsVerifierF.rb +34 -0
- data/lib/Glacier2/Router.rb +141 -0
- data/lib/Glacier2/RouterF.rb +29 -0
- data/lib/Glacier2/SSLInfo.rb +79 -0
- data/lib/Glacier2/Session.rb +470 -0
- data/lib/Ice.rb +659 -0
- data/lib/Ice/BuiltinSequences.rb +64 -0
- data/lib/Ice/Communicator.rb +93 -0
- data/lib/Ice/CommunicatorF.rb +28 -0
- data/lib/Ice/Connection.rb +414 -0
- data/lib/Ice/ConnectionF.rb +36 -0
- data/lib/Ice/Current.rb +152 -0
- data/lib/Ice/Endpoint.rb +265 -0
- data/lib/Ice/EndpointF.rb +52 -0
- data/lib/Ice/EndpointTypes.rb +77 -0
- data/lib/Ice/FacetMap.rb +28 -0
- data/lib/Ice/Identity.rb +70 -0
- data/lib/Ice/ImplicitContext.rb +59 -0
- data/lib/Ice/ImplicitContextF.rb +28 -0
- data/lib/Ice/Instrumentation.rb +425 -0
- data/lib/Ice/InstrumentationF.rb +35 -0
- data/lib/Ice/LocalException.rb +1081 -0
- data/lib/Ice/Locator.rb +314 -0
- data/lib/Ice/LocatorF.rb +34 -0
- data/lib/Ice/Logger.rb +57 -0
- data/lib/Ice/LoggerF.rb +28 -0
- data/lib/Ice/Metrics.rb +696 -0
- data/lib/Ice/ObjectAdapterF.rb +28 -0
- data/lib/Ice/ObjectFactory.rb +53 -0
- data/lib/Ice/ObjectFactoryF.rb +28 -0
- data/lib/Ice/Plugin.rb +87 -0
- data/lib/Ice/PluginF.rb +32 -0
- data/lib/Ice/Process.rb +93 -0
- data/lib/Ice/ProcessF.rb +29 -0
- data/lib/Ice/Properties.rb +65 -0
- data/lib/Ice/PropertiesAdmin.rb +104 -0
- data/lib/Ice/PropertiesF.rb +33 -0
- data/lib/Ice/Router.rb +163 -0
- data/lib/Ice/RouterF.rb +29 -0
- data/lib/Ice/SliceChecksumDict.rb +28 -0
- data/lib/Ice/Version.rb +100 -0
- data/lib/IceBox.rb +10 -0
- data/lib/IceBox/IceBox.rb +272 -0
- data/lib/IceGrid.rb +17 -0
- data/lib/IceGrid/Admin.rb +1076 -0
- data/lib/IceGrid/Descriptor.rb +1505 -0
- data/lib/IceGrid/Exception.rb +401 -0
- data/lib/IceGrid/FileParser.rb +105 -0
- data/lib/IceGrid/Locator.rb +105 -0
- data/lib/IceGrid/Observer.rb +571 -0
- data/lib/IceGrid/Query.rb +168 -0
- data/lib/IceGrid/Registry.rb +120 -0
- data/lib/IceGrid/Session.rb +114 -0
- data/lib/IceGrid/UserAccountMapper.rb +101 -0
- data/lib/IcePatch2.rb +10 -0
- data/lib/IcePatch2/FileInfo.rb +75 -0
- data/lib/IcePatch2/FileServer.rb +141 -0
- data/lib/IceStorm.rb +11 -0
- data/lib/IceStorm/IceStorm.rb +463 -0
- data/lib/IceStorm/Metrics.rb +155 -0
- data/slice/Freeze/BackgroundSaveEvictor.ice +111 -0
- data/slice/Freeze/CatalogData.ice +49 -0
- data/slice/Freeze/Connection.ice +111 -0
- data/slice/Freeze/ConnectionF.ice +20 -0
- data/slice/Freeze/DB.ice +37 -0
- data/slice/Freeze/Evictor.ice +339 -0
- data/slice/Freeze/EvictorF.ice +22 -0
- data/slice/Freeze/EvictorStorage.ice +72 -0
- data/slice/Freeze/Exception.ice +100 -0
- data/slice/Freeze/Transaction.ice +57 -0
- data/slice/Freeze/TransactionalEvictor.ice +50 -0
- data/slice/Glacier2/Metrics.ice +77 -0
- data/slice/Glacier2/PermissionsVerifier.ice +105 -0
- data/slice/Glacier2/PermissionsVerifierF.ice +21 -0
- data/slice/Glacier2/Router.ice +178 -0
- data/slice/Glacier2/RouterF.ice +20 -0
- data/slice/Glacier2/SSLInfo.ice +50 -0
- data/slice/Glacier2/Session.ice +273 -0
- data/slice/Ice/BuiltinSequences.ice +48 -0
- data/slice/Ice/Communicator.ice +567 -0
- data/slice/Ice/CommunicatorF.ice +20 -0
- data/slice/Ice/Connection.ice +323 -0
- data/slice/Ice/ConnectionF.ice +22 -0
- data/slice/Ice/Current.ice +160 -0
- data/slice/Ice/Endpoint.ice +227 -0
- data/slice/Ice/EndpointF.ice +32 -0
- data/slice/Ice/EndpointTypes.ice +38 -0
- data/slice/Ice/FacetMap.ice +25 -0
- data/slice/Ice/Identity.ice +59 -0
- data/slice/Ice/ImplicitContext.ice +109 -0
- data/slice/Ice/ImplicitContextF.ice +20 -0
- data/slice/Ice/Instrumentation.ice +499 -0
- data/slice/Ice/InstrumentationF.ice +26 -0
- data/slice/Ice/LocalException.ice +1015 -0
- data/slice/Ice/Locator.ice +227 -0
- data/slice/Ice/LocatorF.ice +21 -0
- data/slice/Ice/Logger.ice +86 -0
- data/slice/Ice/LoggerF.ice +20 -0
- data/slice/Ice/Metrics.ice +422 -0
- data/slice/Ice/ObjectAdapter.ice +673 -0
- data/slice/Ice/ObjectAdapterF.ice +20 -0
- data/slice/Ice/ObjectFactory.ice +60 -0
- data/slice/Ice/ObjectFactoryF.ice +20 -0
- data/slice/Ice/Plugin.ice +117 -0
- data/slice/Ice/PluginF.ice +21 -0
- data/slice/Ice/Process.ice +54 -0
- data/slice/Ice/ProcessF.ice +20 -0
- data/slice/Ice/Properties.ice +228 -0
- data/slice/Ice/PropertiesAdmin.ice +75 -0
- data/slice/Ice/PropertiesF.ice +21 -0
- data/slice/Ice/RemoteLogger.ice +232 -0
- data/slice/Ice/Router.ice +83 -0
- data/slice/Ice/RouterF.ice +20 -0
- data/slice/Ice/ServantLocator.ice +117 -0
- data/slice/Ice/ServantLocatorF.ice +20 -0
- data/slice/Ice/SliceChecksumDict.ice +25 -0
- data/slice/Ice/Version.ice +39 -0
- data/slice/IceBox/IceBox.ice +194 -0
- data/slice/IceDiscovery/IceDiscovery.ice +32 -0
- data/slice/IceGrid/Admin.ice +1578 -0
- data/slice/IceGrid/Descriptor.ice +1079 -0
- data/slice/IceGrid/Discovery.ice +73 -0
- data/slice/IceGrid/Exception.ice +383 -0
- data/slice/IceGrid/FileParser.ice +61 -0
- data/slice/IceGrid/Locator.ice +56 -0
- data/slice/IceGrid/Observer.ice +394 -0
- data/slice/IceGrid/PluginFacade.ice +316 -0
- data/slice/IceGrid/Query.ice +130 -0
- data/slice/IceGrid/Registry.ice +138 -0
- data/slice/IceGrid/Session.ice +124 -0
- data/slice/IceGrid/UserAccountMapper.ice +58 -0
- data/slice/IcePatch2/FileInfo.ice +49 -0
- data/slice/IcePatch2/FileServer.ice +129 -0
- data/slice/IceSSL/ConnectionInfo.ice +34 -0
- data/slice/IceSSL/EndpointInfo.ice +41 -0
- data/slice/IceStorm/IceStorm.ice +405 -0
- data/slice/IceStorm/Metrics.ice +71 -0
- metadata +737 -0
data/ext/ice/mcpp/eval.c
ADDED
@@ -0,0 +1,1673 @@
|
|
1
|
+
/*-
|
2
|
+
* Copyright (c) 1998, 2002-2008 Kiyoshi Matsui <kmatsui@t3.rim.or.jp>
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* Some parts of this code are derived from the public domain software
|
6
|
+
* DECUS cpp (1984,1985) written by Martin Minow.
|
7
|
+
*
|
8
|
+
* Redistribution and use in source and binary forms, with or without
|
9
|
+
* modification, are permitted provided that the following conditions
|
10
|
+
* are met:
|
11
|
+
* 1. Redistributions of source code must retain the above copyright
|
12
|
+
* notice, this list of conditions and the following disclaimer.
|
13
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
14
|
+
* notice, this list of conditions and the following disclaimer in the
|
15
|
+
* documentation and/or other materials provided with the distribution.
|
16
|
+
*
|
17
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
18
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
19
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
20
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
21
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
22
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
23
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
24
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
25
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
26
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
27
|
+
* SUCH DAMAGE.
|
28
|
+
*/
|
29
|
+
|
30
|
+
/*
|
31
|
+
* E V A L . C
|
32
|
+
* E x p r e s s i o n E v a l u a t i o n
|
33
|
+
*
|
34
|
+
* The routines to evaluate #if expression are placed here.
|
35
|
+
* Some routines are used also to evaluate the value of numerical tokens.
|
36
|
+
*/
|
37
|
+
|
38
|
+
#if PREPROCESSED
|
39
|
+
#include "mcpp.H"
|
40
|
+
#else
|
41
|
+
#include "system.H"
|
42
|
+
#include "internal.H"
|
43
|
+
#endif
|
44
|
+
|
45
|
+
typedef struct optab {
|
46
|
+
char op; /* Operator */
|
47
|
+
char prec; /* Its precedence */
|
48
|
+
char skip; /* Short-circuit: non-0 to skip */
|
49
|
+
} OPTAB;
|
50
|
+
|
51
|
+
static int eval_lex( void);
|
52
|
+
/* Get type and value of token */
|
53
|
+
static int chk_ops( void);
|
54
|
+
/* Check identifier-like ops */
|
55
|
+
static VAL_SIGN * eval_char( char * const token);
|
56
|
+
/* Evaluate character constant */
|
57
|
+
static expr_t eval_one( char ** seq_pp, int wide, int mbits, int * ucn8);
|
58
|
+
/* Evaluate a character */
|
59
|
+
static VAL_SIGN * eval_eval( VAL_SIGN * valp, int op);
|
60
|
+
/* Entry to #if arithmetic */
|
61
|
+
static expr_t eval_signed( VAL_SIGN ** valpp, expr_t v1, expr_t v2, int op);
|
62
|
+
/* Do signed arithmetic of expr.*/
|
63
|
+
static expr_t eval_unsigned( VAL_SIGN ** valpp, uexpr_t v1u, uexpr_t v2u
|
64
|
+
, int op);
|
65
|
+
/* Do unsigned arithmetic */
|
66
|
+
static void overflow( const char * op_name, VAL_SIGN ** valpp
|
67
|
+
, int ll_overflow);
|
68
|
+
/* Diagnose overflow of expr. */
|
69
|
+
static int do_sizeof( void);
|
70
|
+
/* Evaluate sizeof (type) */
|
71
|
+
static int look_type( int typecode);
|
72
|
+
/* Look for type of the name */
|
73
|
+
static void dump_val( const char * msg, const VAL_SIGN * valp);
|
74
|
+
/* Print value of an operand */
|
75
|
+
static void dump_stack( const OPTAB * opstack, const OPTAB * opp
|
76
|
+
, const VAL_SIGN * value, const VAL_SIGN * valp);
|
77
|
+
/* Print stacked operators */
|
78
|
+
|
79
|
+
/* For debug and error messages. */
|
80
|
+
static const char * const opname[ OP_END + 1] = {
|
81
|
+
"end of expression", "val", "(",
|
82
|
+
"unary +", "unary -", "~", "!",
|
83
|
+
"*", "/", "%",
|
84
|
+
"+", "-", "<<", ">>",
|
85
|
+
"<", "<=", ">", ">=", "==", "!=",
|
86
|
+
"&", "^", "|", "&&", "||",
|
87
|
+
"?", ":",
|
88
|
+
")", "(none)"
|
89
|
+
};
|
90
|
+
|
91
|
+
/*
|
92
|
+
* opdope[] has the operator (and operand) precedence:
|
93
|
+
* Bits
|
94
|
+
* 7 Unused (so the value is always positive)
|
95
|
+
* 6-2 Precedence (0000 .. 0174)
|
96
|
+
* 1-0 Binary op. flags:
|
97
|
+
* 10 The next binop flag (binop should/not follow).
|
98
|
+
* 01 The binop flag (should be set/cleared when this op is seen).
|
99
|
+
* Note: next binop
|
100
|
+
* value 1 0 Value doesn't follow value.
|
101
|
+
* Binop, ), END should follow value, value or unop doesn't.
|
102
|
+
* ( 0 0 ( doesn't follow value. Value follows.
|
103
|
+
* unary 0 0 Unop doesn't follow value. Value follows.
|
104
|
+
* binary 0 1 Binary op follows value. Value follows.
|
105
|
+
* ) 1 1 ) follows value. Binop, ), END follows.
|
106
|
+
* END 0 1 END follows value, doesn't follow ops.
|
107
|
+
*/
|
108
|
+
|
109
|
+
static const char opdope[ OP_END + 1] = {
|
110
|
+
0001, /* End of expression */
|
111
|
+
0002, 0170, /* VAL (constant), LPA */
|
112
|
+
/* Unary op's */
|
113
|
+
0160, 0160, 0160, 0160, /* PLU, NEG, COM, NOT */
|
114
|
+
/* Binary op's */
|
115
|
+
0151, 0151, 0151, /* MUL, DIV, MOD, */
|
116
|
+
0141, 0141, 0131, 0131, /* ADD, SUB, SL, SR */
|
117
|
+
0121, 0121, 0121, 0121, 0111, 0111, /* LT, LE, GT, GE, EQ, NE */
|
118
|
+
0101, 0071, 0061, 0051, 0041, /* AND, XOR, OR, ANA, ORO */
|
119
|
+
0031, 0031, /* QUE, COL */
|
120
|
+
/* Parens */
|
121
|
+
0013, 0023 /* RPA, END */
|
122
|
+
};
|
123
|
+
/*
|
124
|
+
* OP_QUE, OP_RPA and unary operators have alternate precedences:
|
125
|
+
*/
|
126
|
+
#define OP_RPA_PREC 0013
|
127
|
+
#define OP_QUE_PREC 0024 /* From right to left grouping */
|
128
|
+
#define OP_UNOP_PREC 0154 /* ditto */
|
129
|
+
|
130
|
+
/*
|
131
|
+
* S_ANDOR and S_QUEST signal "short-circuit" boolean evaluation, so that
|
132
|
+
* #if FOO != 0 && 10 / FOO ...
|
133
|
+
* doesn't generate an error message. They are stored in optab.skip.
|
134
|
+
*/
|
135
|
+
#define S_ANDOR 2
|
136
|
+
#define S_QUEST 1
|
137
|
+
|
138
|
+
static VAL_SIGN ev; /* Current value and signedness */
|
139
|
+
static int skip = 0; /* 3-way signal of skipping expr*/
|
140
|
+
static const char * const non_eval
|
141
|
+
= " (in non-evaluated sub-expression)"; /* _W8_ */
|
142
|
+
|
143
|
+
#if HAVE_LONG_LONG && COMPILER == INDEPENDENT
|
144
|
+
static int w_level = 1; /* warn_level at overflow of long */
|
145
|
+
#else
|
146
|
+
static int w_level = 2;
|
147
|
+
#endif
|
148
|
+
|
149
|
+
/*
|
150
|
+
* In KR and OLD_PREP modes.
|
151
|
+
* Define bits for the basic types and their adjectives.
|
152
|
+
*/
|
153
|
+
#define T_CHAR 1
|
154
|
+
#define T_INT 2
|
155
|
+
#define T_FLOAT 4
|
156
|
+
#define T_DOUBLE 8
|
157
|
+
#define T_LONGDOUBLE 16
|
158
|
+
#define T_SHORT 32
|
159
|
+
#define T_LONG 64
|
160
|
+
#define T_LONGLONG 128
|
161
|
+
#define T_SIGNED 256
|
162
|
+
#define T_UNSIGNED 512
|
163
|
+
#define T_PTR 1024 /* Pointer to data objects */
|
164
|
+
#define T_FPTR 2048 /* Pointer to functions */
|
165
|
+
|
166
|
+
/*
|
167
|
+
* The SIZES structure is used to store the values for #if sizeof.
|
168
|
+
*/
|
169
|
+
typedef struct sizes {
|
170
|
+
int bits; /* If this bit is set, */
|
171
|
+
int size; /* this is the datum size value */
|
172
|
+
int psize; /* this is the pointer size */
|
173
|
+
} SIZES;
|
174
|
+
|
175
|
+
/*
|
176
|
+
* S_CHAR, etc. define the sizeof the basic TARGET machine word types.
|
177
|
+
* By default, sizes are set to the values for the HOST computer. If
|
178
|
+
* this is inappropriate, see those tables for details on what to change.
|
179
|
+
* Also, if you have a machine where sizeof (signed int) differs from
|
180
|
+
* sizeof (unsigned int), you will have to edit those tables and code in
|
181
|
+
* eval.c.
|
182
|
+
* Note: sizeof in #if expression is disallowed by Standard.
|
183
|
+
*/
|
184
|
+
|
185
|
+
#define S_CHAR (sizeof (char))
|
186
|
+
#define S_SINT (sizeof (short int))
|
187
|
+
#define S_INT (sizeof (int))
|
188
|
+
#define S_LINT (sizeof (long int))
|
189
|
+
#define S_FLOAT (sizeof (float))
|
190
|
+
#define S_DOUBLE (sizeof (double))
|
191
|
+
#define S_PCHAR (sizeof (char *))
|
192
|
+
#define S_PSINT (sizeof (short int *))
|
193
|
+
#define S_PINT (sizeof (int *))
|
194
|
+
#define S_PLINT (sizeof (long int *))
|
195
|
+
#define S_PFLOAT (sizeof (float *))
|
196
|
+
#define S_PDOUBLE (sizeof (double *))
|
197
|
+
#define S_PFPTR (sizeof (int (*)()))
|
198
|
+
#if HAVE_LONG_LONG
|
199
|
+
#if (HOST_COMPILER == BORLANDC) \
|
200
|
+
|| (HOST_COMPILER == MSC && defined(_MSC_VER) && (_MSC_VER < 1300))
|
201
|
+
#define S_LLINT (sizeof (__int64))
|
202
|
+
#define S_PLLINT (sizeof (__int64 *))
|
203
|
+
#else
|
204
|
+
#define S_LLINT (sizeof (long long int))
|
205
|
+
#define S_PLLINT (sizeof (long long int *))
|
206
|
+
#endif
|
207
|
+
#endif
|
208
|
+
#define S_LDOUBLE (sizeof (long double))
|
209
|
+
#define S_PLDOUBLE (sizeof (long double *))
|
210
|
+
|
211
|
+
typedef struct types {
|
212
|
+
int type; /* This is the bits for types */
|
213
|
+
char * token_name; /* this is the token word */
|
214
|
+
int excluded; /* but these aren't legal here. */
|
215
|
+
} TYPES;
|
216
|
+
|
217
|
+
#define ANYSIGN (T_SIGNED | T_UNSIGNED)
|
218
|
+
#define ANYFLOAT (T_FLOAT | T_DOUBLE | T_LONGDOUBLE)
|
219
|
+
#if HAVE_LONG_LONG
|
220
|
+
#define ANYINT (T_CHAR | T_SHORT | T_INT | T_LONG | T_LONGLONG)
|
221
|
+
#else
|
222
|
+
#define ANYINT (T_CHAR | T_SHORT | T_INT | T_LONG)
|
223
|
+
#endif
|
224
|
+
|
225
|
+
static const TYPES basic_types[] = {
|
226
|
+
{ T_CHAR, "char", ANYFLOAT | ANYINT },
|
227
|
+
{ T_SHORT, "short", ANYFLOAT | ANYINT },
|
228
|
+
{ T_INT, "int", ANYFLOAT | T_CHAR | T_INT },
|
229
|
+
{ T_LONG, "long", ANYFLOAT | ANYINT },
|
230
|
+
#if HAVE_LONG_LONG
|
231
|
+
#if HOST_COMPILER == BORLANDC
|
232
|
+
{ T_LONGLONG, "__int64", ANYFLOAT | ANYINT },
|
233
|
+
#else
|
234
|
+
{ T_LONGLONG, "long long", ANYFLOAT | ANYINT },
|
235
|
+
#endif
|
236
|
+
#endif
|
237
|
+
{ T_FLOAT, "float", ANYFLOAT | ANYINT | ANYSIGN },
|
238
|
+
{ T_DOUBLE, "double", ANYFLOAT | ANYINT | ANYSIGN },
|
239
|
+
{ T_LONGDOUBLE, "long double", ANYFLOAT | ANYINT | ANYSIGN },
|
240
|
+
{ T_SIGNED, "signed", ANYFLOAT | ANYINT | ANYSIGN },
|
241
|
+
{ T_UNSIGNED, "unsigned", ANYFLOAT | ANYINT | ANYSIGN },
|
242
|
+
{ 0, NULL, 0 } /* Signal end */
|
243
|
+
};
|
244
|
+
|
245
|
+
/*
|
246
|
+
* In this table, T_FPTR (pointer to function) should be placed last.
|
247
|
+
*/
|
248
|
+
static const SIZES size_table[] = {
|
249
|
+
{ T_CHAR, S_CHAR, S_PCHAR }, /* char */
|
250
|
+
{ T_SHORT, S_SINT, S_PSINT }, /* short int */
|
251
|
+
{ T_INT, S_INT, S_PINT }, /* int */
|
252
|
+
{ T_LONG, S_LINT, S_PLINT }, /* long */
|
253
|
+
#if HAVE_LONG_LONG
|
254
|
+
{ T_LONGLONG, S_LLINT, S_PLLINT }, /* long long */
|
255
|
+
#endif
|
256
|
+
{ T_FLOAT, S_FLOAT, S_PFLOAT }, /* float */
|
257
|
+
{ T_DOUBLE, S_DOUBLE, S_PDOUBLE }, /* double */
|
258
|
+
{ T_LONGDOUBLE, S_LDOUBLE, S_PLDOUBLE }, /* long double */
|
259
|
+
{ T_FPTR, 0, S_PFPTR }, /* int (*()) */
|
260
|
+
{ 0, 0, 0 } /* End of table */
|
261
|
+
};
|
262
|
+
|
263
|
+
#define is_binary(op) (FIRST_BINOP <= op && op <= LAST_BINOP)
|
264
|
+
#define is_unary(op) (FIRST_UNOP <= op && op <= LAST_UNOP)
|
265
|
+
|
266
|
+
|
267
|
+
#if MCPP_LIB
|
268
|
+
void init_eval( void)
|
269
|
+
{
|
270
|
+
skip = 0;
|
271
|
+
}
|
272
|
+
#endif
|
273
|
+
|
274
|
+
expr_t eval_if( void)
|
275
|
+
/*
|
276
|
+
* Evaluate a #if expression. Straight-forward operator precedence.
|
277
|
+
* This is called from directive() on encountering an #if directive.
|
278
|
+
* It calls the following routines:
|
279
|
+
* eval_lex() Lexical analyser -- returns the type and value of
|
280
|
+
* the next input token.
|
281
|
+
* eval_eval() Evaluates the current operator, given the values on the
|
282
|
+
* value stack. Returns a pointer to the (new) value stack.
|
283
|
+
*/
|
284
|
+
{
|
285
|
+
VAL_SIGN value[ NEXP * 2 + 1]; /* Value stack */
|
286
|
+
OPTAB opstack[ NEXP * 3 + 1]; /* Operator stack */
|
287
|
+
int parens = 0; /* Nesting levels of (, ) */
|
288
|
+
int prec; /* Operator precedence */
|
289
|
+
int binop = 0; /* Set if binary op. needed */
|
290
|
+
int op1; /* Operator from stack */
|
291
|
+
int skip_cur; /* For short-circuit testing */
|
292
|
+
VAL_SIGN * valp = value; /* -> Value and signedness */
|
293
|
+
OPTAB * opp = opstack; /* -> Operator stack */
|
294
|
+
int op; /* Current operator */
|
295
|
+
|
296
|
+
opp->op = OP_END; /* Mark bottom of stack */
|
297
|
+
opp->prec = opdope[ OP_END]; /* And its precedence */
|
298
|
+
skip = skip_cur = opp->skip = 0; /* Not skipping now */
|
299
|
+
|
300
|
+
while (1) {
|
301
|
+
if (mcpp_debug & EXPRESSION)
|
302
|
+
mcpp_fprintf( DBG
|
303
|
+
, "In eval loop skip = %d, binop = %d, line is: %s\n"
|
304
|
+
, opp->skip, binop, infile->bptr);
|
305
|
+
skip = opp->skip;
|
306
|
+
op = eval_lex();
|
307
|
+
skip = 0; /* Reset to be ready to return */
|
308
|
+
switch (op) {
|
309
|
+
case OP_SUB :
|
310
|
+
if (binop == 0)
|
311
|
+
op = OP_NEG; /* Unary minus */
|
312
|
+
break;
|
313
|
+
case OP_ADD :
|
314
|
+
if (binop == 0)
|
315
|
+
op = OP_PLU; /* Unary plus */
|
316
|
+
break;
|
317
|
+
case OP_FAIL:
|
318
|
+
return 0L; /* Token error */
|
319
|
+
}
|
320
|
+
if (mcpp_debug & EXPRESSION)
|
321
|
+
mcpp_fprintf( DBG
|
322
|
+
, "op = %s, opdope = %04o, binop = %d, skip = %d\n"
|
323
|
+
, opname[ op], opdope[ op], binop, opp->skip);
|
324
|
+
if (op == VAL) { /* Value? */
|
325
|
+
if (binop != 0) { /* Binop is needed */
|
326
|
+
cerror( "Misplaced constant \"%s\"" /* _E_ */
|
327
|
+
, work_buf, 0L, NULL);
|
328
|
+
return 0L;
|
329
|
+
} else if (& value[ NEXP * 2] <= valp) {
|
330
|
+
cerror( "More than %.0s%ld constants stacked at %s" /* _E_ */
|
331
|
+
, NULL, (long) (NEXP * 2 - 1), work_buf);
|
332
|
+
return 0L;
|
333
|
+
} else {
|
334
|
+
if (mcpp_debug & EXPRESSION) {
|
335
|
+
dump_val( "pushing ", &ev);
|
336
|
+
mcpp_fprintf( DBG, " onto value stack[%d]\n"
|
337
|
+
, (int)(valp - value));
|
338
|
+
}
|
339
|
+
valp->val = ev.val;
|
340
|
+
(valp++)->sign = ev.sign;
|
341
|
+
binop = 1; /* Binary operator or so should follow */
|
342
|
+
}
|
343
|
+
continue;
|
344
|
+
} /* Else operators */
|
345
|
+
prec = opdope[ op];
|
346
|
+
if (binop != (prec & 1)) {
|
347
|
+
if (op == OP_EOE)
|
348
|
+
cerror( "Unterminated expression" /* _E_ */
|
349
|
+
, NULL, 0L, NULL);
|
350
|
+
else
|
351
|
+
cerror( "Operator \"%s\" in incorrect context" /* _E_ */
|
352
|
+
, opname[ op], 0L, NULL);
|
353
|
+
return 0L;
|
354
|
+
}
|
355
|
+
binop = (prec & 2) >> 1; /* Binop should follow? */
|
356
|
+
|
357
|
+
while (1) {
|
358
|
+
if (mcpp_debug & EXPRESSION)
|
359
|
+
mcpp_fprintf( DBG
|
360
|
+
, "op %s, prec %d, stacked op %s, prec %d, skip %d\n"
|
361
|
+
, opname[ op], prec, opname[ opp->op], opp->prec, opp->skip);
|
362
|
+
|
363
|
+
/* Stack coming sub-expression of higher precedence. */
|
364
|
+
if (opp->prec < prec) {
|
365
|
+
if (op == OP_LPA) {
|
366
|
+
prec = OP_RPA_PREC;
|
367
|
+
if (standard && (warn_level & 4)
|
368
|
+
&& ++parens == std_limits.exp_nest + 1)
|
369
|
+
cwarn(
|
370
|
+
"More than %.0s%ld nesting of parens" /* _W4_ */
|
371
|
+
, NULL, (long) std_limits.exp_nest, NULL);
|
372
|
+
} else if (op == OP_QUE) {
|
373
|
+
prec = OP_QUE_PREC;
|
374
|
+
} else if (is_unary( op)) {
|
375
|
+
prec = OP_UNOP_PREC;
|
376
|
+
}
|
377
|
+
op1 = opp->skip; /* Save skip for test */
|
378
|
+
/*
|
379
|
+
* Push operator onto operator stack.
|
380
|
+
*/
|
381
|
+
opp++;
|
382
|
+
if (& opstack[ NEXP * 3] <= opp) {
|
383
|
+
cerror(
|
384
|
+
"More than %.0s%ld operators and parens stacked at %s" /* _E_ */
|
385
|
+
, NULL, (long) (NEXP * 3 - 1), opname[ op]);
|
386
|
+
return 0L;
|
387
|
+
}
|
388
|
+
opp->op = op;
|
389
|
+
opp->prec = prec;
|
390
|
+
if (&value[0] < valp)
|
391
|
+
skip_cur = (valp[-1].val != 0L);
|
392
|
+
/* Short-circuit tester */
|
393
|
+
/*
|
394
|
+
* Do the short-circuit stuff here. Short-circuiting
|
395
|
+
* stops automagically when operators are evaluated.
|
396
|
+
*/
|
397
|
+
if ((op == OP_ANA && ! skip_cur)
|
398
|
+
|| (op == OP_ORO && skip_cur)) {
|
399
|
+
opp->skip = S_ANDOR; /* And/or skip starts */
|
400
|
+
if (skip_cur) /* Evaluate non-zero */
|
401
|
+
valp[-1].val = 1L; /* value to 1 */
|
402
|
+
} else if (op == OP_QUE) { /* Start of ?: operator */
|
403
|
+
opp->skip = (op1 & S_ANDOR) | (!skip_cur ? S_QUEST : 0);
|
404
|
+
} else if (op == OP_COL) { /* : inverts S_QUEST */
|
405
|
+
opp->skip = (op1 & S_ANDOR)
|
406
|
+
| (((op1 & S_QUEST) != 0) ? 0 : S_QUEST);
|
407
|
+
} else { /* Other operators leave*/
|
408
|
+
opp->skip = op1; /* skipping unchanged. */
|
409
|
+
}
|
410
|
+
if (mcpp_debug & EXPRESSION) {
|
411
|
+
mcpp_fprintf( DBG, "stacking %s, ", opname[ op]);
|
412
|
+
if (&value[0] < valp)
|
413
|
+
dump_val( "valp[-1].val == ", valp - 1);
|
414
|
+
mcpp_fprintf( DBG, " at %s\n", infile->bptr);
|
415
|
+
dump_stack( opstack, opp, value, valp);
|
416
|
+
}
|
417
|
+
break;
|
418
|
+
}
|
419
|
+
|
420
|
+
/*
|
421
|
+
* Coming sub-expression is of lower precedence.
|
422
|
+
* Evaluate stacked sub-expression.
|
423
|
+
* Pop operator from operator stack and evaluate it.
|
424
|
+
* End of stack and '(', ')' are specials.
|
425
|
+
*/
|
426
|
+
skip_cur = opp->skip; /* Remember skip value */
|
427
|
+
switch ((op1 = opp->op)) { /* Look at stacked op */
|
428
|
+
case OP_END: /* Stack end marker */
|
429
|
+
if (op == OP_RPA) { /* No corresponding ( */
|
430
|
+
cerror( "Excessive \")\"", NULL, 0L, NULL); /* _E_ */
|
431
|
+
return 0L;
|
432
|
+
}
|
433
|
+
if (op == OP_EOE)
|
434
|
+
return valp[-1].val; /* Finished ok. */
|
435
|
+
break;
|
436
|
+
case OP_LPA: /* ( on stack */
|
437
|
+
if (op != OP_RPA) { /* Matches ) on input? */
|
438
|
+
cerror( "Missing \")\"", NULL, 0L, NULL); /* _E_ */
|
439
|
+
return 0L;
|
440
|
+
}
|
441
|
+
opp--; /* Unstack it */
|
442
|
+
parens--; /* Count down nest level*/
|
443
|
+
break;
|
444
|
+
case OP_QUE: /* Evaluate true expr. */
|
445
|
+
break;
|
446
|
+
case OP_COL: /* : on stack */
|
447
|
+
opp--; /* Unstack : */
|
448
|
+
if (opp->op != OP_QUE) { /* Matches ? on stack? */
|
449
|
+
cerror(
|
450
|
+
"Misplaced \":\", previous operator is \"%s\"" /* _E_ */
|
451
|
+
, opname[opp->op], 0L, NULL);
|
452
|
+
return 0L;
|
453
|
+
}
|
454
|
+
/* Evaluate op1. Fall through */
|
455
|
+
default: /* Others: */
|
456
|
+
opp--; /* Unstack the operator */
|
457
|
+
if (mcpp_debug & EXPRESSION) {
|
458
|
+
mcpp_fprintf( DBG, "Stack before evaluation of %s\n"
|
459
|
+
, opname[ op1]);
|
460
|
+
dump_stack( opstack, opp, value, valp);
|
461
|
+
}
|
462
|
+
if (op1 == OP_COL)
|
463
|
+
skip = 0;
|
464
|
+
else
|
465
|
+
skip = skip_cur;
|
466
|
+
valp = eval_eval( valp, op1);
|
467
|
+
if (valp->sign == VAL_ERROR)
|
468
|
+
return 0L; /* Out of range or divide by 0 */
|
469
|
+
valp++;
|
470
|
+
skip = 0;
|
471
|
+
if (mcpp_debug & EXPRESSION) {
|
472
|
+
mcpp_fprintf( DBG, "Stack after evaluation\n");
|
473
|
+
dump_stack( opstack, opp, value, valp);
|
474
|
+
}
|
475
|
+
} /* op1 switch end */
|
476
|
+
|
477
|
+
if (op1 == OP_END || op1 == OP_LPA || op1 == OP_QUE)
|
478
|
+
break; /* Read another op. */
|
479
|
+
} /* Stack unwind loop */
|
480
|
+
|
481
|
+
}
|
482
|
+
|
483
|
+
return 0L; /* Never reach here */
|
484
|
+
}
|
485
|
+
|
486
|
+
static int eval_lex( void)
|
487
|
+
/*
|
488
|
+
* Return next operator or constant to evaluate. Called from eval_if(). It
|
489
|
+
* calls a special-purpose routines for character constants and numeric values:
|
490
|
+
* eval_char() called to evaluate 'x'
|
491
|
+
* eval_num() called to evaluate numbers
|
492
|
+
* C++98 treats 11 identifier-like tokens as operators.
|
493
|
+
* POST_STD forbids character constants in #if expression.
|
494
|
+
*/
|
495
|
+
{
|
496
|
+
int c1;
|
497
|
+
VAL_SIGN * valp;
|
498
|
+
int warn = ! skip || (warn_level & 8);
|
499
|
+
int token_type;
|
500
|
+
int c;
|
501
|
+
|
502
|
+
ev.sign = SIGNED; /* Default signedness */
|
503
|
+
ev.val = 0L; /* Default value (on error or 0 value) */
|
504
|
+
in_if = ! skip; /* Inform to expand_macro() that the macro is */
|
505
|
+
/* in #if line and not skipped expression. */
|
506
|
+
c = skip_ws();
|
507
|
+
if (c == '\n') {
|
508
|
+
unget_ch();
|
509
|
+
return OP_EOE; /* End of expression */
|
510
|
+
}
|
511
|
+
token_type = get_unexpandable( c, warn);
|
512
|
+
if (standard && macro_line == MACRO_ERROR)
|
513
|
+
return OP_FAIL; /* Unterminated macro call */
|
514
|
+
if (token_type == NO_TOKEN)
|
515
|
+
return OP_EOE; /* Only macro(s) expanding to 0-token */
|
516
|
+
|
517
|
+
switch (token_type) {
|
518
|
+
case NAM:
|
519
|
+
if (standard && str_eq( identifier, "defined")) { /* defined name */
|
520
|
+
c1 = c = skip_ws();
|
521
|
+
if (c == '(') /* Allow defined (name) */
|
522
|
+
c = skip_ws();
|
523
|
+
if (scan_token( c, (workp = work_buf, &workp), work_end) == NAM) {
|
524
|
+
DEFBUF * defp = look_id( identifier);
|
525
|
+
if (warn) {
|
526
|
+
ev.val = (defp != NULL);
|
527
|
+
if ((mcpp_debug & MACRO_CALL) && ! skip && defp)
|
528
|
+
/* Annotate if the macro is in non-skipped expr. */
|
529
|
+
mcpp_fprintf( OUT, "/*%s*/", defp->name);
|
530
|
+
}
|
531
|
+
if (c1 != '(' || skip_ws() == ')') /* Balanced ? */
|
532
|
+
return VAL; /* Parsed ok */
|
533
|
+
}
|
534
|
+
cerror( "Bad defined syntax: %s" /* _E_ */
|
535
|
+
, infile->fp ? "" : infile->buffer, 0L, NULL);
|
536
|
+
break;
|
537
|
+
} else if (cplus_val) {
|
538
|
+
if (str_eq( identifier, "true")) {
|
539
|
+
ev.val = 1L;
|
540
|
+
return VAL;
|
541
|
+
} else if (str_eq( identifier, "false")) {
|
542
|
+
ev.val = 0L;
|
543
|
+
return VAL;
|
544
|
+
} else if (mcpp_mode != POST_STD
|
545
|
+
&& (openum = id_operator( identifier)) != 0) {
|
546
|
+
/* Identifier-like operator in C++98 */
|
547
|
+
strcpy( work_buf, identifier);
|
548
|
+
return chk_ops();
|
549
|
+
}
|
550
|
+
} else if (! standard && str_eq( identifier, "sizeof")) {
|
551
|
+
/* sizeof hackery */
|
552
|
+
return do_sizeof(); /* Gets own routine */
|
553
|
+
}
|
554
|
+
/*
|
555
|
+
* The ANSI C Standard says that an undefined symbol
|
556
|
+
* in an #if has the value zero. We are a bit pickier,
|
557
|
+
* warning except where the programmer was careful to write
|
558
|
+
* #if defined(foo) ? foo : 0
|
559
|
+
*/
|
560
|
+
if ((! skip && (warn_level & 4)) || (skip && (warn_level & 8)))
|
561
|
+
cwarn( "Undefined symbol \"%s\"%.0ld%s" /* _W4_ _W8_ */
|
562
|
+
, identifier, 0L, skip ? non_eval : ", evaluated to 0");
|
563
|
+
return VAL;
|
564
|
+
case CHR: /* Character constant */
|
565
|
+
case WCHR: /* Wide char constant */
|
566
|
+
if (mcpp_mode == POST_STD) {
|
567
|
+
cerror( "Can't use a character constant %s" /* _E_ */
|
568
|
+
, work_buf, 0L, NULL);
|
569
|
+
break;
|
570
|
+
}
|
571
|
+
valp = eval_char( work_buf); /* 'valp' points 'ev' */
|
572
|
+
if (valp->sign == VAL_ERROR)
|
573
|
+
break;
|
574
|
+
if (mcpp_debug & EXPRESSION) {
|
575
|
+
dump_val( "eval_char returns ", &ev);
|
576
|
+
mcpp_fputc( '\n', DBG);
|
577
|
+
}
|
578
|
+
return VAL; /* Return a value */
|
579
|
+
case STR: /* String literal */
|
580
|
+
case WSTR: /* Wide string literal */
|
581
|
+
cerror(
|
582
|
+
"Can't use a string literal %s", work_buf, 0L, NULL); /* _E_ */
|
583
|
+
break;
|
584
|
+
case NUM: /* Numbers are harder */
|
585
|
+
valp = eval_num( work_buf); /* 'valp' points 'ev' */
|
586
|
+
if (valp->sign == VAL_ERROR)
|
587
|
+
break;
|
588
|
+
if (mcpp_debug & EXPRESSION) {
|
589
|
+
dump_val( "eval_num returns ", &ev);
|
590
|
+
mcpp_fputc( '\n', DBG);
|
591
|
+
}
|
592
|
+
return VAL;
|
593
|
+
case OPE: /* Operator or punctuator */
|
594
|
+
return chk_ops();
|
595
|
+
|
596
|
+
default: /* Total nonsense */
|
597
|
+
cerror( "Can't use the character %.0s0x%02lx" /* _E_ */
|
598
|
+
, NULL, (long) c, NULL);
|
599
|
+
break;
|
600
|
+
}
|
601
|
+
|
602
|
+
return OP_FAIL; /* Any errors */
|
603
|
+
}
|
604
|
+
|
605
|
+
static int chk_ops( void)
|
606
|
+
/*
|
607
|
+
* Check the operator.
|
608
|
+
* If it can't be used in #if expression return OP_FAIL
|
609
|
+
* else return openum.
|
610
|
+
*/
|
611
|
+
{
|
612
|
+
switch (openum) {
|
613
|
+
case OP_STR: case OP_CAT: case OP_ELL:
|
614
|
+
case OP_1: case OP_2: case OP_3:
|
615
|
+
cerror( "Can't use the operator \"%s\"" /* _E_ */
|
616
|
+
, work_buf, 0L, NULL);
|
617
|
+
return OP_FAIL;
|
618
|
+
default:
|
619
|
+
return openum;
|
620
|
+
}
|
621
|
+
}
|
622
|
+
|
623
|
+
static int do_sizeof( void)
|
624
|
+
/*
|
625
|
+
* Process the sizeof (basic type) operation in an #if string.
|
626
|
+
* Sets ev.val to the size and returns
|
627
|
+
* VAL success
|
628
|
+
* OP_FAIL bad parse or something.
|
629
|
+
* This routine is never called in STD and POST_STD mode.
|
630
|
+
*/
|
631
|
+
{
|
632
|
+
const char * const no_type = "sizeof: No type specified"; /* _E_ */
|
633
|
+
int warn = ! skip || (warn_level & 8);
|
634
|
+
int type_end = FALSE;
|
635
|
+
int typecode = 0;
|
636
|
+
int token_type = NO_TOKEN;
|
637
|
+
const SIZES * sizp = NULL;
|
638
|
+
|
639
|
+
if (get_unexpandable( skip_ws(), warn) != OPE || openum != OP_LPA)
|
640
|
+
goto no_good; /* Not '(' */
|
641
|
+
|
642
|
+
/*
|
643
|
+
* Scan off the tokens.
|
644
|
+
*/
|
645
|
+
|
646
|
+
while (! type_end) {
|
647
|
+
token_type = get_unexpandable( skip_ws(), warn);
|
648
|
+
/* Get next token expanding macros */
|
649
|
+
switch (token_type) {
|
650
|
+
case OPE:
|
651
|
+
if (openum == OP_LPA) { /* thing (*)() func ptr */
|
652
|
+
if (get_unexpandable( skip_ws(), warn) == OPE
|
653
|
+
&& openum == OP_MUL
|
654
|
+
&& get_unexpandable( skip_ws(), warn) == OPE
|
655
|
+
&& openum == OP_RPA) { /* (*) */
|
656
|
+
if (get_unexpandable( skip_ws(), warn) != OPE
|
657
|
+
|| openum != OP_LPA
|
658
|
+
|| get_unexpandable( skip_ws(), warn) != OPE
|
659
|
+
|| openum != OP_RPA) /* Not () */
|
660
|
+
goto no_good;
|
661
|
+
typecode |= T_FPTR; /* Function pointer */
|
662
|
+
} else { /* Junk is an error */
|
663
|
+
goto no_good;
|
664
|
+
}
|
665
|
+
} else { /* '*' or ')' */
|
666
|
+
type_end = TRUE;
|
667
|
+
}
|
668
|
+
break;
|
669
|
+
case NAM: /* Look for type comb. */
|
670
|
+
if ((typecode = look_type( typecode)) == 0)
|
671
|
+
return OP_FAIL; /* Illegal type or comb.*/
|
672
|
+
break;
|
673
|
+
default: goto no_good; /* Illegal token */
|
674
|
+
}
|
675
|
+
} /* End of while */
|
676
|
+
|
677
|
+
/*
|
678
|
+
* We are at the end of the type scan. Chew off '*' if necessary.
|
679
|
+
*/
|
680
|
+
if (token_type == OPE) {
|
681
|
+
if (openum == OP_MUL) { /* '*' */
|
682
|
+
typecode |= T_PTR;
|
683
|
+
if (get_unexpandable( skip_ws(), warn) != OPE)
|
684
|
+
goto no_good;
|
685
|
+
}
|
686
|
+
if (openum == OP_RPA) { /* ')' */
|
687
|
+
/*
|
688
|
+
* Last syntax check
|
689
|
+
* We assume that all function pointers are the same size:
|
690
|
+
* sizeof (int (*)()) == sizeof (float (*)())
|
691
|
+
* We assume that signed and unsigned don't change the size:
|
692
|
+
* sizeof (signed int) == sizeof (unsigned int)
|
693
|
+
*/
|
694
|
+
if ((typecode & T_FPTR) != 0) { /* Function pointer */
|
695
|
+
typecode = T_FPTR | T_PTR;
|
696
|
+
} else { /* Var or var * datum */
|
697
|
+
typecode &= ~(T_SIGNED | T_UNSIGNED);
|
698
|
+
#if HAVE_LONG_LONG
|
699
|
+
if ((typecode & (T_SHORT | T_LONG | T_LONGLONG)) != 0)
|
700
|
+
#else
|
701
|
+
if ((typecode & (T_SHORT | T_LONG)) != 0)
|
702
|
+
#endif
|
703
|
+
typecode &= ~T_INT;
|
704
|
+
}
|
705
|
+
if ((typecode & ~T_PTR) == 0) {
|
706
|
+
cerror( no_type, NULL, 0L, NULL);
|
707
|
+
return OP_FAIL;
|
708
|
+
} else {
|
709
|
+
/*
|
710
|
+
* Exactly one bit (and possibly T_PTR) may be set.
|
711
|
+
*/
|
712
|
+
for (sizp = size_table; sizp->bits != 0; sizp++) {
|
713
|
+
if ((typecode & ~T_PTR) == sizp->bits) {
|
714
|
+
ev.val = ((typecode & T_PTR) != 0)
|
715
|
+
? sizp->psize : sizp->size;
|
716
|
+
break;
|
717
|
+
}
|
718
|
+
}
|
719
|
+
}
|
720
|
+
} else {
|
721
|
+
goto no_good;
|
722
|
+
}
|
723
|
+
} else {
|
724
|
+
goto no_good;
|
725
|
+
}
|
726
|
+
|
727
|
+
if (mcpp_debug & EXPRESSION) {
|
728
|
+
if (sizp)
|
729
|
+
mcpp_fprintf( DBG,
|
730
|
+
"sizp->bits:0x%x sizp->size:0x%x sizp->psize:0x%x ev.val:0x%lx\n"
|
731
|
+
, sizp->bits, sizp->size, sizp->psize
|
732
|
+
, (unsigned long) ev.val);
|
733
|
+
}
|
734
|
+
return VAL;
|
735
|
+
|
736
|
+
no_good:
|
737
|
+
unget_ch();
|
738
|
+
cerror( "sizeof: Syntax error", NULL, 0L, NULL); /* _E_ */
|
739
|
+
return OP_FAIL;
|
740
|
+
}
|
741
|
+
|
742
|
+
static int look_type(
|
743
|
+
int typecode
|
744
|
+
)
|
745
|
+
{
|
746
|
+
const char * const unknown_type
|
747
|
+
= "sizeof: Unknown type \"%s\"%.0ld%s"; /* _E_ _W8_ */
|
748
|
+
const char * const illeg_comb
|
749
|
+
= "sizeof: Illegal type combination with \"%s\"%.0ld%s"; /* _E_ _W8_ */
|
750
|
+
int token_type;
|
751
|
+
const TYPES * tp;
|
752
|
+
|
753
|
+
if (str_eq( identifier, "long")) {
|
754
|
+
if ((token_type
|
755
|
+
= get_unexpandable( skip_ws(), !skip || (warn_level & 8)))
|
756
|
+
== NO_TOKEN)
|
757
|
+
return typecode;
|
758
|
+
if (token_type == NAM) {
|
759
|
+
#if HAVE_LONG_LONG
|
760
|
+
if (str_eq( identifier, "long")) {
|
761
|
+
strcpy( work_buf, "long long");
|
762
|
+
goto basic;
|
763
|
+
}
|
764
|
+
#endif
|
765
|
+
if (str_eq( identifier, "double")) {
|
766
|
+
strcpy( work_buf, "long double");
|
767
|
+
goto basic;
|
768
|
+
}
|
769
|
+
}
|
770
|
+
unget_string( work_buf, NULL); /* Not long long */
|
771
|
+
strcpy( work_buf, "long"); /* nor long double */
|
772
|
+
}
|
773
|
+
|
774
|
+
/*
|
775
|
+
* Look for this unexpandable token in basic_types.
|
776
|
+
*/
|
777
|
+
basic:
|
778
|
+
for (tp = basic_types; tp->token_name != NULL; tp++) {
|
779
|
+
if (str_eq( work_buf, tp->token_name))
|
780
|
+
break;
|
781
|
+
}
|
782
|
+
|
783
|
+
if (tp->token_name == NULL) {
|
784
|
+
if (! skip) {
|
785
|
+
cerror( unknown_type, work_buf, 0L, NULL);
|
786
|
+
return 0;
|
787
|
+
} else if (warn_level & 8) {
|
788
|
+
cwarn( unknown_type, work_buf, 0L, non_eval);
|
789
|
+
}
|
790
|
+
}
|
791
|
+
if ((typecode & tp->excluded) != 0) {
|
792
|
+
if (! skip) {
|
793
|
+
cerror( illeg_comb, work_buf, 0L, NULL);
|
794
|
+
return 0;
|
795
|
+
} else if (warn_level & 8) {
|
796
|
+
cwarn( illeg_comb, work_buf, 0L, non_eval);
|
797
|
+
}
|
798
|
+
}
|
799
|
+
|
800
|
+
if (mcpp_debug & EXPRESSION) {
|
801
|
+
if (tp->token_name)
|
802
|
+
mcpp_fprintf( DBG,
|
803
|
+
"sizeof -- typecode:0x%x tp->token_name:\"%s\" tp->type:0x%x\n"
|
804
|
+
, typecode, tp->token_name, tp->type);
|
805
|
+
}
|
806
|
+
return typecode |= tp->type; /* Or in the type bit */
|
807
|
+
}
|
808
|
+
|
809
|
+
VAL_SIGN * eval_num(
|
810
|
+
const char * nump /* Preprocessing number */
|
811
|
+
)
|
812
|
+
/*
|
813
|
+
* Evaluate number for #if lexical analysis. Note: eval_num recognizes
|
814
|
+
* the unsigned suffix, but only returns a signed expr_t value, and stores
|
815
|
+
* the signedness to ev.sign, which is set UNSIGNED (== unsigned) if the
|
816
|
+
* value is not in the range of positive (signed) expr_t.
|
817
|
+
*/
|
818
|
+
{
|
819
|
+
const char * const not_integer = "Not an integer \"%s\""; /* _E_ */
|
820
|
+
const char * const out_of_range
|
821
|
+
= "Constant \"%s\"%.0ld%s is out of range"; /* _E_ _W1_ _W8_ */
|
822
|
+
expr_t value;
|
823
|
+
uexpr_t v, v1; /* unsigned long long or unsigned long */
|
824
|
+
int uflag = FALSE;
|
825
|
+
int lflag = FALSE;
|
826
|
+
int erange = FALSE;
|
827
|
+
int base;
|
828
|
+
int c, c1;
|
829
|
+
const char * cp = nump;
|
830
|
+
#if HAVE_LONG_LONG
|
831
|
+
const char * const out_of_range_long =
|
832
|
+
"Constant \"%s\"%.0ld%s is out of range " /* _E_ _W1_ _W2_ _W8_ */
|
833
|
+
"of (unsigned) long";
|
834
|
+
const char * const ll_suffix =
|
835
|
+
"LL suffix is used in other than C99 mode \"%s\"%.0ld%s"; /* _W1_ _W2_ _W8_ */
|
836
|
+
#if COMPILER == MSC || COMPILER == BORLANDC
|
837
|
+
const char * const i64_suffix =
|
838
|
+
"I64 suffix is used in other than C99 mode \"%s\"%.0ld%s"; /* _W2_ _W8_ */
|
839
|
+
#endif
|
840
|
+
int llflag = FALSE;
|
841
|
+
int erange_long = FALSE;
|
842
|
+
#endif
|
843
|
+
|
844
|
+
ev.sign = SIGNED; /* Default signedness */
|
845
|
+
ev.val = 0L; /* Default value */
|
846
|
+
if ((char_type[ c = *cp++ & UCHARMAX] & DIG) == 0) /* Dot */
|
847
|
+
goto num_err;
|
848
|
+
if (c != '0') { /* Decimal */
|
849
|
+
base = 10;
|
850
|
+
} else if ((c = *cp++ & UCHARMAX) == 'x' || c == 'X') {
|
851
|
+
base = 16; /* Hexadecimal */
|
852
|
+
c = *cp++ & UCHARMAX;
|
853
|
+
} else if (c == EOS) { /* 0 */
|
854
|
+
return & ev;
|
855
|
+
} else { /* Octal or illegal */
|
856
|
+
base = 8;
|
857
|
+
}
|
858
|
+
|
859
|
+
v = v1 = 0L;
|
860
|
+
for (;;) {
|
861
|
+
c1 = c;
|
862
|
+
if (isupper( c1))
|
863
|
+
c1 = tolower( c1);
|
864
|
+
if (c1 >= 'a')
|
865
|
+
c1 -= ('a' - 10);
|
866
|
+
else
|
867
|
+
c1 -= '0';
|
868
|
+
if (c1 < 0 || base <= c1)
|
869
|
+
break;
|
870
|
+
v1 *= base;
|
871
|
+
v1 += c1;
|
872
|
+
if (v1 / base < v) { /* Overflow */
|
873
|
+
if (! skip)
|
874
|
+
goto range_err;
|
875
|
+
else
|
876
|
+
erange = TRUE;
|
877
|
+
}
|
878
|
+
#if HAVE_LONG_LONG
|
879
|
+
if (! stdc3 && v1 > ULONGMAX)
|
880
|
+
/* Overflow of long or unsigned long */
|
881
|
+
erange_long = TRUE;
|
882
|
+
#endif
|
883
|
+
v = v1;
|
884
|
+
c = *cp++ & UCHARMAX;
|
885
|
+
}
|
886
|
+
|
887
|
+
value = v;
|
888
|
+
while (c == 'u' || c == 'U' || c == 'l' || c == 'L') {
|
889
|
+
if (c == 'u' || c == 'U') {
|
890
|
+
if (uflag)
|
891
|
+
goto num_err;
|
892
|
+
uflag = TRUE;
|
893
|
+
} else if (c == 'l' || c == 'L') {
|
894
|
+
#if HAVE_LONG_LONG
|
895
|
+
if (llflag) {
|
896
|
+
goto num_err;
|
897
|
+
} else if (lflag) {
|
898
|
+
llflag = TRUE;
|
899
|
+
if (! stdc3 && ((! skip && (warn_level & w_level))
|
900
|
+
|| (skip && (warn_level & 8))))
|
901
|
+
cwarn( ll_suffix, nump, 0L, skip ? non_eval : NULL);
|
902
|
+
} else {
|
903
|
+
lflag = TRUE;
|
904
|
+
}
|
905
|
+
#else
|
906
|
+
if (lflag)
|
907
|
+
goto num_err;
|
908
|
+
else
|
909
|
+
lflag = TRUE;
|
910
|
+
#endif
|
911
|
+
}
|
912
|
+
c = *cp++;
|
913
|
+
}
|
914
|
+
#if HAVE_LONG_LONG && (COMPILER == MSC || COMPILER == BORLANDC)
|
915
|
+
if (tolower( c) == 'i') {
|
916
|
+
c1 = atoi( cp);
|
917
|
+
if (c1 == 64) {
|
918
|
+
if (! stdc3 && ((! skip && (warn_level & w_level))
|
919
|
+
|| (skip && (warn_level & 8))))
|
920
|
+
cwarn( i64_suffix, nump, 0L, skip ? non_eval : NULL);
|
921
|
+
cp += 2;
|
922
|
+
} else if (c1 == 32 || c1 == 16) {
|
923
|
+
cp += 2;
|
924
|
+
} else if (c1 == 8) {
|
925
|
+
cp++;
|
926
|
+
}
|
927
|
+
c = *cp++;
|
928
|
+
}
|
929
|
+
#endif
|
930
|
+
|
931
|
+
if (c != EOS)
|
932
|
+
goto num_err;
|
933
|
+
|
934
|
+
if (standard) {
|
935
|
+
if (uflag) /* If 'U' suffixed, uexpr_t is treated as unsigned */
|
936
|
+
ev.sign = UNSIGNED;
|
937
|
+
else
|
938
|
+
ev.sign = (value >= 0L);
|
939
|
+
#if HAVE_LONG_LONG
|
940
|
+
} else {
|
941
|
+
if (value > LONGMAX)
|
942
|
+
erange_long = TRUE;
|
943
|
+
#endif
|
944
|
+
}
|
945
|
+
|
946
|
+
ev.val = value;
|
947
|
+
if (erange && (warn_level & 8))
|
948
|
+
cwarn( out_of_range, nump, 0L, non_eval);
|
949
|
+
#if HAVE_LONG_LONG
|
950
|
+
else if (erange_long && ((skip && (warn_level & 8))
|
951
|
+
|| (! stdc3 && ! skip && (warn_level & w_level))))
|
952
|
+
cwarn( out_of_range_long, nump, 0L, skip ? non_eval : NULL);
|
953
|
+
#endif
|
954
|
+
return & ev;
|
955
|
+
|
956
|
+
range_err:
|
957
|
+
cerror( out_of_range, nump, 0L, NULL);
|
958
|
+
ev.sign = VAL_ERROR;
|
959
|
+
return & ev;
|
960
|
+
num_err:
|
961
|
+
cerror( not_integer, nump, 0L, NULL);
|
962
|
+
ev.sign = VAL_ERROR;
|
963
|
+
return & ev;
|
964
|
+
}
|
965
|
+
|
966
|
+
static VAL_SIGN * eval_char(
|
967
|
+
char * const token
|
968
|
+
)
|
969
|
+
/*
|
970
|
+
* Evaluate a character constant.
|
971
|
+
* This routine is never called in POST_STD mode.
|
972
|
+
*/
|
973
|
+
{
|
974
|
+
const char * const w_out_of_range
|
975
|
+
= "Wide character constant %s%.0ld%s is out of range"; /* _E_ _W8_ */
|
976
|
+
const char * const c_out_of_range
|
977
|
+
= "Integer character constant %s%.0ld%s is out of range"; /* _E_ _W8_ */
|
978
|
+
uexpr_t value;
|
979
|
+
uexpr_t tmp;
|
980
|
+
expr_t cl;
|
981
|
+
int erange = FALSE;
|
982
|
+
int wide = (*token == 'L');
|
983
|
+
int ucn8;
|
984
|
+
int i;
|
985
|
+
int bits, mbits, u8bits, bits_save;
|
986
|
+
char * cp = token + 1; /* Character content */
|
987
|
+
#if HAVE_LONG_LONG
|
988
|
+
const char * const w_out_of_range_long =
|
989
|
+
"Wide character constant %s%.0ld%s is " /* _E_ _W1_ _W2_ _W8_ */
|
990
|
+
"out of range of unsigned long";
|
991
|
+
const char * const c_out_of_range_long =
|
992
|
+
"Integer character constant %s%.0ld%s is " /* _E_ _W1_ _W2_ _W8_ */
|
993
|
+
"out of range of unsigned long";
|
994
|
+
int erange_long = FALSE;
|
995
|
+
#endif
|
996
|
+
|
997
|
+
bits = CHARBIT;
|
998
|
+
u8bits = CHARBIT * 4;
|
999
|
+
if (mbchar & UTF8)
|
1000
|
+
mbits = CHARBIT * 4;
|
1001
|
+
else
|
1002
|
+
mbits = CHARBIT * 2;
|
1003
|
+
if (mcpp_mode == STD && wide) { /* Wide character constant */
|
1004
|
+
cp++; /* Skip 'L' */
|
1005
|
+
bits = mbits;
|
1006
|
+
}
|
1007
|
+
if (char_type[ *cp & UCHARMAX] & mbchk) {
|
1008
|
+
cl = mb_eval( &cp);
|
1009
|
+
bits = mbits;
|
1010
|
+
} else if ((cl = eval_one( &cp, wide, mbits, (ucn8 = FALSE, &ucn8)))
|
1011
|
+
== -1L) {
|
1012
|
+
ev.sign = VAL_ERROR;
|
1013
|
+
return & ev;
|
1014
|
+
}
|
1015
|
+
bits_save = bits;
|
1016
|
+
value = cl;
|
1017
|
+
|
1018
|
+
for (i = 0; *cp != '\'' && *cp != EOS; i++) {
|
1019
|
+
if (char_type[ *cp & UCHARMAX] & mbchk) {
|
1020
|
+
cl = mb_eval( &cp);
|
1021
|
+
if (cl == 0)
|
1022
|
+
/* Shift-out sequence of multi-byte or wide character */
|
1023
|
+
continue;
|
1024
|
+
bits = mbits;
|
1025
|
+
} else {
|
1026
|
+
cl = eval_one( &cp, wide, mbits, (ucn8 = FALSE, &ucn8));
|
1027
|
+
if (cl == -1L) {
|
1028
|
+
ev.sign = VAL_ERROR;
|
1029
|
+
return & ev;
|
1030
|
+
}
|
1031
|
+
#if OK_UCN
|
1032
|
+
if (ucn8 == TRUE)
|
1033
|
+
bits = u8bits;
|
1034
|
+
else
|
1035
|
+
bits = bits_save;
|
1036
|
+
#endif
|
1037
|
+
}
|
1038
|
+
tmp = value;
|
1039
|
+
value = (value << bits) | cl; /* Multi-char or multi-byte char */
|
1040
|
+
if ((value >> bits) < tmp) { /* Overflow */
|
1041
|
+
if (! skip)
|
1042
|
+
goto range_err;
|
1043
|
+
else
|
1044
|
+
erange = TRUE;
|
1045
|
+
}
|
1046
|
+
#if HAVE_LONG_LONG
|
1047
|
+
if ((mcpp_mode == STD && (! stdc3 && value > ULONGMAX))
|
1048
|
+
|| (! standard && value > LONGMAX))
|
1049
|
+
erange_long = TRUE;
|
1050
|
+
#endif
|
1051
|
+
}
|
1052
|
+
|
1053
|
+
ev.sign = ((expr_t) value >= 0L);
|
1054
|
+
ev.val = value;
|
1055
|
+
|
1056
|
+
if (erange && skip && (warn_level & 8)) {
|
1057
|
+
if (wide)
|
1058
|
+
cwarn( w_out_of_range, token, 0L, non_eval);
|
1059
|
+
else
|
1060
|
+
cwarn( c_out_of_range, token, 0L, non_eval);
|
1061
|
+
#if HAVE_LONG_LONG
|
1062
|
+
} else if (erange_long && ((skip && (warn_level & 8))
|
1063
|
+
|| (! stdc3 && ! skip && (warn_level & w_level)))) {
|
1064
|
+
if (wide)
|
1065
|
+
cwarn( w_out_of_range_long, token, 0L, skip ? non_eval : NULL);
|
1066
|
+
else
|
1067
|
+
cwarn( c_out_of_range_long, token, 0L, skip ? non_eval : NULL);
|
1068
|
+
#endif
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
if (i == 0) /* Constant of single (character or wide-character) */
|
1072
|
+
return & ev;
|
1073
|
+
|
1074
|
+
if ((! skip && (warn_level & 4)) || (skip && (warn_level & 8))) {
|
1075
|
+
if (mcpp_mode == STD && wide)
|
1076
|
+
cwarn(
|
1077
|
+
"Multi-character wide character constant %s%.0ld%s isn't portable" /* _W4_ _W8_ */
|
1078
|
+
, token, 0L, skip ? non_eval : NULL);
|
1079
|
+
else
|
1080
|
+
cwarn(
|
1081
|
+
"Multi-character or multi-byte character constant %s%.0ld%s isn't portable" /* _W4_ _W8_ */
|
1082
|
+
, token, 0L, skip ? non_eval : NULL);
|
1083
|
+
}
|
1084
|
+
return & ev;
|
1085
|
+
|
1086
|
+
range_err:
|
1087
|
+
if (wide)
|
1088
|
+
cerror( w_out_of_range, token, 0L, NULL);
|
1089
|
+
else
|
1090
|
+
cerror( c_out_of_range, token, 0L, NULL);
|
1091
|
+
ev.sign = VAL_ERROR;
|
1092
|
+
return & ev;
|
1093
|
+
}
|
1094
|
+
|
1095
|
+
static expr_t eval_one(
|
1096
|
+
char ** seq_pp, /* Address of pointer to sequence */
|
1097
|
+
/* eval_one() advances the pointer to sequence */
|
1098
|
+
int wide, /* Flag of wide-character */
|
1099
|
+
int mbits, /* Number of bits of a wide-char */
|
1100
|
+
int * ucn8 /* Flag of UCN-32 bits */
|
1101
|
+
)
|
1102
|
+
/*
|
1103
|
+
* Called from eval_char() above to get a single character, single multi-
|
1104
|
+
* byte character or wide character (with or without \ escapes).
|
1105
|
+
* Returns the value of the character or -1L on error.
|
1106
|
+
*/
|
1107
|
+
{
|
1108
|
+
#if OK_UCN
|
1109
|
+
const char * const ucn_malval
|
1110
|
+
= "UCN cannot specify the value %.0s\"%08lx\""; /* _E_ _W8_ */
|
1111
|
+
#endif
|
1112
|
+
const char * const out_of_range
|
1113
|
+
= "%s%ld bits can't represent escape sequence '%s'"; /* _E_ _W8_ */
|
1114
|
+
uexpr_t value;
|
1115
|
+
int erange = FALSE;
|
1116
|
+
char * seq = *seq_pp; /* Initial seq_pp for diagnostic*/
|
1117
|
+
const char * cp;
|
1118
|
+
const char * digits;
|
1119
|
+
unsigned uc;
|
1120
|
+
unsigned uc1;
|
1121
|
+
int count;
|
1122
|
+
int bits;
|
1123
|
+
size_t wchar_max;
|
1124
|
+
|
1125
|
+
uc = *(*seq_pp)++ & UCHARMAX;
|
1126
|
+
|
1127
|
+
if (uc != '\\') /* Other than escape sequence */
|
1128
|
+
return (expr_t) uc;
|
1129
|
+
|
1130
|
+
/* escape sequence */
|
1131
|
+
uc1 = uc = *(*seq_pp)++ & UCHARMAX;
|
1132
|
+
switch (uc) {
|
1133
|
+
case 'a':
|
1134
|
+
return '\a';
|
1135
|
+
case 'b':
|
1136
|
+
return '\b';
|
1137
|
+
case 'f':
|
1138
|
+
return '\f';
|
1139
|
+
case 'n':
|
1140
|
+
return '\n';
|
1141
|
+
case 'r':
|
1142
|
+
return '\r';
|
1143
|
+
case 't':
|
1144
|
+
return '\t';
|
1145
|
+
case 'v':
|
1146
|
+
return '\v';
|
1147
|
+
#if OK_UCN
|
1148
|
+
case 'u': case 'U':
|
1149
|
+
if (! stdc2)
|
1150
|
+
goto undefined;
|
1151
|
+
/* Else Universal character name */
|
1152
|
+
/* Fall through */
|
1153
|
+
#endif
|
1154
|
+
case 'x': /* '\xFF' */
|
1155
|
+
if (! standard)
|
1156
|
+
goto undefined;
|
1157
|
+
digits = "0123456789abcdef";
|
1158
|
+
bits = 4;
|
1159
|
+
uc = *(*seq_pp)++ & UCHARMAX;
|
1160
|
+
break;
|
1161
|
+
case '0': case '1': case '2': case '3':
|
1162
|
+
case '4': case '5': case '6': case '7':
|
1163
|
+
digits = "01234567";
|
1164
|
+
bits = 3;
|
1165
|
+
break;
|
1166
|
+
case '\'': case '"': case '?': case '\\':
|
1167
|
+
return (expr_t) uc;
|
1168
|
+
default:
|
1169
|
+
goto undefined;
|
1170
|
+
}
|
1171
|
+
|
1172
|
+
wchar_max = (UCHARMAX << CHARBIT) | UCHARMAX;
|
1173
|
+
if (mbits == CHARBIT * 4) {
|
1174
|
+
if (mcpp_mode == STD)
|
1175
|
+
wchar_max = (wchar_max << CHARBIT * 2) | wchar_max;
|
1176
|
+
else
|
1177
|
+
wchar_max = LONGMAX;
|
1178
|
+
}
|
1179
|
+
|
1180
|
+
value = 0L;
|
1181
|
+
for (count = 0; ; ++count) {
|
1182
|
+
if (isupper( uc))
|
1183
|
+
uc = tolower( uc);
|
1184
|
+
if ((cp = strchr( digits, uc)) == NULL)
|
1185
|
+
break;
|
1186
|
+
if (count >= 3 && bits == 3)
|
1187
|
+
break; /* Octal escape sequence at most 3 digits */
|
1188
|
+
#if OK_UCN
|
1189
|
+
if ((count >= 4 && uc1 == 'u') || (count >= 8 && uc1 == 'U'))
|
1190
|
+
break;
|
1191
|
+
#endif
|
1192
|
+
value = (value << bits) | (cp - digits);
|
1193
|
+
#if OK_UCN
|
1194
|
+
if (wchar_max < value && uc1 != 'u' && uc1 != 'U')
|
1195
|
+
#else
|
1196
|
+
if (wchar_max < value)
|
1197
|
+
#endif
|
1198
|
+
{
|
1199
|
+
if (! skip)
|
1200
|
+
goto range_err;
|
1201
|
+
else
|
1202
|
+
erange = TRUE;
|
1203
|
+
}
|
1204
|
+
uc = *(*seq_pp)++ & UCHARMAX;
|
1205
|
+
}
|
1206
|
+
(*seq_pp)--;
|
1207
|
+
|
1208
|
+
if (erange) {
|
1209
|
+
value &= wchar_max;
|
1210
|
+
goto range_err;
|
1211
|
+
}
|
1212
|
+
|
1213
|
+
if (count == 0 && bits == 4) /* '\xnonsense' */
|
1214
|
+
goto undefined;
|
1215
|
+
#if OK_UCN
|
1216
|
+
if (uc1 == 'u' || uc1 == 'U') {
|
1217
|
+
if ((count < 4 && uc1 == 'u') || (count < 8 && uc1 == 'U'))
|
1218
|
+
goto undefined;
|
1219
|
+
if ((value >= 0L && value <= 0x9FL
|
1220
|
+
&& value != 0x24L && value != 0x40L && value != 0x60L)
|
1221
|
+
|| (!stdc3 && value >= 0xD800L && value <= 0xDFFFL)) {
|
1222
|
+
if (!skip)
|
1223
|
+
cerror( ucn_malval, NULL, (long) value, NULL);
|
1224
|
+
else if (warn_level & 8)
|
1225
|
+
cwarn( ucn_malval, NULL, (long) value, NULL);
|
1226
|
+
}
|
1227
|
+
if (count >= 8 && uc1 == 'U')
|
1228
|
+
*ucn8 = TRUE;
|
1229
|
+
return (expr_t) value;
|
1230
|
+
}
|
1231
|
+
#endif /* OK_UCN */
|
1232
|
+
if (! wide && (UCHARMAX < value)) {
|
1233
|
+
value &= UCHARMAX;
|
1234
|
+
goto range_err;
|
1235
|
+
}
|
1236
|
+
return (expr_t) value;
|
1237
|
+
|
1238
|
+
undefined:
|
1239
|
+
uc1 = **seq_pp;
|
1240
|
+
**seq_pp = EOS; /* For diagnostic */
|
1241
|
+
if ((! skip && (warn_level & 1)) || (skip && (warn_level & 8)))
|
1242
|
+
cwarn(
|
1243
|
+
"Undefined escape sequence%s %.0ld'%s'" /* _W1_ _W8_ */
|
1244
|
+
, skip ? non_eval : NULL, 0L, seq);
|
1245
|
+
**seq_pp = uc1;
|
1246
|
+
*seq_pp = seq + 1;
|
1247
|
+
return (expr_t) '\\'; /* Returns the escape char */
|
1248
|
+
|
1249
|
+
range_err:
|
1250
|
+
uc1 = **seq_pp;
|
1251
|
+
**seq_pp = EOS; /* For diagnostic */
|
1252
|
+
if (wide) {
|
1253
|
+
if (! skip)
|
1254
|
+
cerror( out_of_range, NULL, (long) mbits, seq);
|
1255
|
+
else if (warn_level & 8)
|
1256
|
+
cwarn( out_of_range, non_eval, (long) mbits, seq);
|
1257
|
+
} else {
|
1258
|
+
if (! skip)
|
1259
|
+
cerror( out_of_range, NULL, (long) CHARBIT, seq);
|
1260
|
+
else if (warn_level & 8)
|
1261
|
+
cwarn( out_of_range, non_eval, (long) CHARBIT, seq);
|
1262
|
+
}
|
1263
|
+
|
1264
|
+
**seq_pp = uc1;
|
1265
|
+
if (! skip)
|
1266
|
+
return -1L;
|
1267
|
+
else
|
1268
|
+
return (expr_t) value;
|
1269
|
+
}
|
1270
|
+
|
1271
|
+
static VAL_SIGN * eval_eval(
|
1272
|
+
VAL_SIGN * valp,
|
1273
|
+
int op
|
1274
|
+
)
|
1275
|
+
/*
|
1276
|
+
* One or two values are popped from the value stack and do arithmetic.
|
1277
|
+
* The result is pushed onto the value stack.
|
1278
|
+
* eval_eval() returns the new pointer to the top of the value stack.
|
1279
|
+
*/
|
1280
|
+
{
|
1281
|
+
const char * const zero_div = "%sDivision by zero%.0ld%s"; /* _E_ _W8_ */
|
1282
|
+
#if HAVE_LONG_LONG
|
1283
|
+
const char * const neg_format =
|
1284
|
+
"Negative value \"%" LL_FORM "d\" is converted to positive \"%" /* _W1_ _W8_*/
|
1285
|
+
LL_FORM "u\"%%s";
|
1286
|
+
#else
|
1287
|
+
const char * const neg_format =
|
1288
|
+
"Negative value \"%ld\" is converted to positive \"%lu\"%%s"; /* _W1_ _W8_*/
|
1289
|
+
#endif
|
1290
|
+
expr_t v1, v2;
|
1291
|
+
int sign1, sign2;
|
1292
|
+
|
1293
|
+
if (is_binary( op)) {
|
1294
|
+
v2 = (--valp)->val;
|
1295
|
+
sign2 = valp->sign;
|
1296
|
+
} else {
|
1297
|
+
v2 = 0L; /* Dummy */
|
1298
|
+
sign2 = SIGNED; /* Dummy */
|
1299
|
+
}
|
1300
|
+
v1 = (--valp)->val;
|
1301
|
+
sign1 = valp->sign;
|
1302
|
+
if (mcpp_debug & EXPRESSION) {
|
1303
|
+
mcpp_fprintf( DBG, "%s op %s", (is_binary( op)) ? "binary" : "unary"
|
1304
|
+
, opname[ op]);
|
1305
|
+
dump_val( ", v1 = ", valp);
|
1306
|
+
if (is_binary( op))
|
1307
|
+
dump_val( ", v2 = ", valp + 1);
|
1308
|
+
mcpp_fputc( '\n', DBG);
|
1309
|
+
}
|
1310
|
+
|
1311
|
+
if (standard
|
1312
|
+
&& (sign1 == UNSIGNED || sign2 == UNSIGNED) && is_binary( op)
|
1313
|
+
&& op != OP_ANA && op != OP_ORO && op != OP_SR && op != OP_SL) {
|
1314
|
+
if (((sign1 == SIGNED && v1 < 0L) || (sign2 == SIGNED && v2 < 0L)
|
1315
|
+
) && ((! skip && (warn_level & 1))
|
1316
|
+
|| (skip && (warn_level & 8)))) {
|
1317
|
+
char negate[(((sizeof (expr_t) * 8) / 3) + 1) * 2 + 50];
|
1318
|
+
expr_t v3;
|
1319
|
+
|
1320
|
+
v3 = (sign1 == SIGNED ? v1 : v2);
|
1321
|
+
sprintf( negate, neg_format, v3, v3);
|
1322
|
+
cwarn( negate, skip ? non_eval : NULL, 0L, NULL);
|
1323
|
+
}
|
1324
|
+
valp->sign = sign1 = sign2 = UNSIGNED;
|
1325
|
+
}
|
1326
|
+
if ((op == OP_SL || op == OP_SR)
|
1327
|
+
&& ((! skip && (warn_level & 1)) || (skip && (warn_level & 8)))) {
|
1328
|
+
if (v2 < 0L || v2 >= sizeof (expr_t) * CHARBIT)
|
1329
|
+
cwarn( "Illegal shift count %.0s\"%ld\"%s" /* _W1_ _W8_ */
|
1330
|
+
, NULL, (long) v2, skip ? non_eval : NULL);
|
1331
|
+
#if HAVE_LONG_LONG
|
1332
|
+
else if (! stdc3 && v2 >= sizeof (long) * CHARBIT
|
1333
|
+
&& ((! skip && (warn_level & w_level))
|
1334
|
+
|| (skip && (warn_level & 8))))
|
1335
|
+
cwarn(
|
1336
|
+
"Shift count %.0s\"%ld\" is larger than bit count of long%s" /* _W1_ _W8_*/
|
1337
|
+
, NULL, (long) v2, skip ? non_eval : NULL);
|
1338
|
+
#endif
|
1339
|
+
}
|
1340
|
+
if ((op == OP_DIV || op == OP_MOD) && v2 == 0L) {
|
1341
|
+
if (! skip) {
|
1342
|
+
cerror( zero_div, NULL, 0L, NULL);
|
1343
|
+
valp->sign = VAL_ERROR;
|
1344
|
+
return valp;
|
1345
|
+
} else {
|
1346
|
+
if (warn_level & 8)
|
1347
|
+
cwarn( zero_div, NULL, 0L, non_eval);
|
1348
|
+
valp->sign = sign1;
|
1349
|
+
valp->val = (expr_t) EXPR_MAX;
|
1350
|
+
return valp;
|
1351
|
+
}
|
1352
|
+
}
|
1353
|
+
|
1354
|
+
if (! standard || sign1 == SIGNED)
|
1355
|
+
v1 = eval_signed( & valp, v1, v2, op);
|
1356
|
+
else
|
1357
|
+
v1 = eval_unsigned( & valp, (uexpr_t) v1, (uexpr_t) v2, op);
|
1358
|
+
|
1359
|
+
if (valp->sign == VAL_ERROR) /* Out of range */
|
1360
|
+
return valp;
|
1361
|
+
|
1362
|
+
switch (op) {
|
1363
|
+
case OP_NOT: case OP_EQ: case OP_NE:
|
1364
|
+
case OP_LT: case OP_LE: case OP_GT: case OP_GE:
|
1365
|
+
case OP_ANA: case OP_ORO:
|
1366
|
+
valp->sign = SIGNED;
|
1367
|
+
break;
|
1368
|
+
default:
|
1369
|
+
valp->sign = sign1;
|
1370
|
+
break;
|
1371
|
+
}
|
1372
|
+
valp->val = v1;
|
1373
|
+
return valp;
|
1374
|
+
}
|
1375
|
+
|
1376
|
+
static expr_t eval_signed(
|
1377
|
+
VAL_SIGN ** valpp,
|
1378
|
+
expr_t v1,
|
1379
|
+
expr_t v2,
|
1380
|
+
int op
|
1381
|
+
)
|
1382
|
+
/*
|
1383
|
+
* Apply the argument operator to the signed data.
|
1384
|
+
* OP_COL is a special case.
|
1385
|
+
*/
|
1386
|
+
{
|
1387
|
+
const char * const illeg_op
|
1388
|
+
= "Bug: Illegal operator \"%s\" in eval_signed()"; /* _F_ */
|
1389
|
+
const char * const not_portable
|
1390
|
+
= "\"%s\" of negative number isn't portable%.0ld%s"; /* _W1_ _W8_*/
|
1391
|
+
const char * op_name = opname[ op];
|
1392
|
+
VAL_SIGN * valp = *valpp;
|
1393
|
+
expr_t val;
|
1394
|
+
int chk; /* Flag of overflow in long long */
|
1395
|
+
|
1396
|
+
switch (op) {
|
1397
|
+
case OP_EOE:
|
1398
|
+
case OP_PLU: break;
|
1399
|
+
case OP_NEG:
|
1400
|
+
chk = v1 && v1 == -v1;
|
1401
|
+
if (chk
|
1402
|
+
#if HAVE_LONG_LONG
|
1403
|
+
|| (! stdc3 && v1 && (long) v1 == (long) -v1)
|
1404
|
+
#endif
|
1405
|
+
)
|
1406
|
+
overflow( op_name, valpp, chk);
|
1407
|
+
v1 = -v1;
|
1408
|
+
break;
|
1409
|
+
case OP_COM: v1 = ~v1; break;
|
1410
|
+
case OP_NOT: v1 = !v1; break;
|
1411
|
+
case OP_MUL:
|
1412
|
+
val = v1 * v2;
|
1413
|
+
chk = v1 && v2 && (val / v1 != v2 || val / v2 != v1);
|
1414
|
+
if (chk
|
1415
|
+
#if HAVE_LONG_LONG
|
1416
|
+
|| (! stdc3 && v1 && v2
|
1417
|
+
&& ((long)val / (long)v1 != (long)v2
|
1418
|
+
|| (long)val / (long)v2 != (long)v1))
|
1419
|
+
#endif
|
1420
|
+
)
|
1421
|
+
overflow( op_name, valpp, chk);
|
1422
|
+
v1 = val;
|
1423
|
+
break;
|
1424
|
+
case OP_DIV:
|
1425
|
+
case OP_MOD:
|
1426
|
+
/* Division by 0 has been already diagnosed by eval_eval(). */
|
1427
|
+
chk = -v1 == v1 && v2 == -1;
|
1428
|
+
if (chk /* LONG_MIN / -1 on two's complement */
|
1429
|
+
#if HAVE_LONG_LONG
|
1430
|
+
|| (! stdc3
|
1431
|
+
&& (long)-v1 == (long)v1 && (long)v2 == (long)-1)
|
1432
|
+
#endif
|
1433
|
+
)
|
1434
|
+
overflow( op_name, valpp, chk);
|
1435
|
+
else if (! stdc3 && (v1 < 0L || v2 < 0L)
|
1436
|
+
&& ((! skip && (warn_level & 1))
|
1437
|
+
|| (skip && (warn_level & 8))))
|
1438
|
+
cwarn( not_portable, op_name, 0L, skip ? non_eval : NULL);
|
1439
|
+
if (op == OP_DIV)
|
1440
|
+
v1 /= v2;
|
1441
|
+
else
|
1442
|
+
v1 %= v2;
|
1443
|
+
break;
|
1444
|
+
case OP_ADD:
|
1445
|
+
val = v1 + v2;
|
1446
|
+
chk = (v2 > 0L && v1 > val) || (v2 < 0L && v1 < val);
|
1447
|
+
if (chk
|
1448
|
+
#if HAVE_LONG_LONG
|
1449
|
+
|| (! stdc3
|
1450
|
+
&& (((long)v2 > 0L && (long)v1 > (long)val)
|
1451
|
+
|| ((long)v2 < 0L && (long)v1 < (long)val)))
|
1452
|
+
#endif
|
1453
|
+
)
|
1454
|
+
overflow( op_name, valpp, chk);
|
1455
|
+
v1 = val;
|
1456
|
+
break;
|
1457
|
+
case OP_SUB:
|
1458
|
+
val = v1 - v2;
|
1459
|
+
chk = (v2 > 0L && val > v1) || (v2 < 0L && val < v1);
|
1460
|
+
if (chk
|
1461
|
+
#if HAVE_LONG_LONG
|
1462
|
+
|| (! stdc3
|
1463
|
+
&& (((long)v2 > 0L && (long)val > (long)v1)
|
1464
|
+
|| ((long)v2 < 0L && (long)val < (long)v1)))
|
1465
|
+
#endif
|
1466
|
+
)
|
1467
|
+
overflow( op_name, valpp, chk);
|
1468
|
+
v1 = val;
|
1469
|
+
break;
|
1470
|
+
case OP_SL: v1 <<= v2; break;
|
1471
|
+
case OP_SR:
|
1472
|
+
if (v1 < 0L
|
1473
|
+
&& ((!skip && (warn_level & 1))
|
1474
|
+
|| (skip && (warn_level & 8))))
|
1475
|
+
cwarn( not_portable, op_name, 0L, skip ? non_eval : NULL);
|
1476
|
+
v1 >>= v2;
|
1477
|
+
break;
|
1478
|
+
case OP_LT: v1 = (v1 < v2); break;
|
1479
|
+
case OP_LE: v1 = (v1 <= v2); break;
|
1480
|
+
case OP_GT: v1 = (v1 > v2); break;
|
1481
|
+
case OP_GE: v1 = (v1 >= v2); break;
|
1482
|
+
case OP_EQ: v1 = (v1 == v2); break;
|
1483
|
+
case OP_NE: v1 = (v1 != v2); break;
|
1484
|
+
case OP_AND: v1 &= v2; break;
|
1485
|
+
case OP_XOR: v1 ^= v2; break;
|
1486
|
+
case OP_OR: v1 |= v2; break;
|
1487
|
+
case OP_ANA: v1 = (v1 && v2); break;
|
1488
|
+
case OP_ORO: v1 = (v1 || v2); break;
|
1489
|
+
case OP_COL:
|
1490
|
+
/*
|
1491
|
+
* If v1 has the "true" value, v2 has the "false" value.
|
1492
|
+
* The top of the value stack has the test.
|
1493
|
+
*/
|
1494
|
+
v1 = (--*valpp)->val ? v1 : v2;
|
1495
|
+
break;
|
1496
|
+
default:
|
1497
|
+
cfatal( illeg_op, op_name, 0L, NULL);
|
1498
|
+
}
|
1499
|
+
|
1500
|
+
*valpp = valp;
|
1501
|
+
return v1;
|
1502
|
+
}
|
1503
|
+
|
1504
|
+
static expr_t eval_unsigned(
|
1505
|
+
VAL_SIGN ** valpp,
|
1506
|
+
uexpr_t v1u,
|
1507
|
+
uexpr_t v2u,
|
1508
|
+
int op
|
1509
|
+
)
|
1510
|
+
/*
|
1511
|
+
* Apply the argument operator to the unsigned data.
|
1512
|
+
* Called from eval_eval() only in Standard mode.
|
1513
|
+
*/
|
1514
|
+
{
|
1515
|
+
const char * const illeg_op
|
1516
|
+
= "Bug: Illegal operator \"%s\" in eval_unsigned()"; /* _F_ */
|
1517
|
+
const char * op_name = opname[ op];
|
1518
|
+
VAL_SIGN * valp = *valpp;
|
1519
|
+
uexpr_t v1 = 0;
|
1520
|
+
int chk; /* Flag of overflow in unsigned long long */
|
1521
|
+
int minus; /* Big integer converted from signed long */
|
1522
|
+
|
1523
|
+
minus = ! stdc3 && (v1u > ULONGMAX || v2u > ULONGMAX);
|
1524
|
+
|
1525
|
+
switch (op) {
|
1526
|
+
case OP_EOE:
|
1527
|
+
case OP_PLU: v1 = v1u; break;
|
1528
|
+
case OP_NEG:
|
1529
|
+
v1 = -v1u;
|
1530
|
+
if (v1u)
|
1531
|
+
overflow( op_name, valpp, TRUE);
|
1532
|
+
break;
|
1533
|
+
case OP_COM: v1 = ~v1u; break;
|
1534
|
+
case OP_NOT: v1 = !v1u; break;
|
1535
|
+
case OP_MUL:
|
1536
|
+
v1 = v1u * v2u;
|
1537
|
+
chk = v1u && v2u && (v1 / v2u != v1u || v1 / v1u != v2u);
|
1538
|
+
if (chk
|
1539
|
+
#if HAVE_LONG_LONG
|
1540
|
+
|| (! stdc3 && ! minus && v1 > ULONGMAX)
|
1541
|
+
#endif
|
1542
|
+
)
|
1543
|
+
overflow( op_name, valpp, chk);
|
1544
|
+
break;
|
1545
|
+
case OP_DIV:
|
1546
|
+
/* Division by 0 has been already diagnosed by eval_eval(). */
|
1547
|
+
v1 = v1u / v2u;
|
1548
|
+
break;
|
1549
|
+
case OP_MOD:
|
1550
|
+
v1 = v1u % v2u;
|
1551
|
+
break;
|
1552
|
+
case OP_ADD:
|
1553
|
+
v1 = v1u + v2u;
|
1554
|
+
chk = v1 < v1u;
|
1555
|
+
if (chk
|
1556
|
+
#if HAVE_LONG_LONG
|
1557
|
+
|| (! stdc3 && ! minus && v1 > ULONGMAX)
|
1558
|
+
#endif
|
1559
|
+
)
|
1560
|
+
overflow( op_name, valpp, chk);
|
1561
|
+
break;
|
1562
|
+
case OP_SUB:
|
1563
|
+
v1 = v1u - v2u;
|
1564
|
+
chk = v1 > v1u;
|
1565
|
+
if (chk
|
1566
|
+
#if HAVE_LONG_LONG
|
1567
|
+
|| (! stdc3 && ! minus && v1 > ULONGMAX)
|
1568
|
+
#endif
|
1569
|
+
)
|
1570
|
+
overflow( op_name, valpp, chk);
|
1571
|
+
break;
|
1572
|
+
case OP_SL: v1 = v1u << v2u; break;
|
1573
|
+
case OP_SR: v1 = v1u >> v2u; break;
|
1574
|
+
case OP_LT: v1 = (v1u < v2u); break;
|
1575
|
+
case OP_LE: v1 = (v1u <= v2u); break;
|
1576
|
+
case OP_GT: v1 = (v1u > v2u); break;
|
1577
|
+
case OP_GE: v1 = (v1u >= v2u); break;
|
1578
|
+
case OP_EQ: v1 = (v1u == v2u); break;
|
1579
|
+
case OP_NE: v1 = (v1u != v2u); break;
|
1580
|
+
case OP_AND: v1 = v1u & v2u; break;
|
1581
|
+
case OP_XOR: v1 = v1u ^ v2u; break;
|
1582
|
+
case OP_OR: v1 = v1u | v2u; break;
|
1583
|
+
case OP_ANA: v1 = (v1u && v2u); break;
|
1584
|
+
case OP_ORO: v1 = (v1u || v2u); break;
|
1585
|
+
case OP_COL: valp--;
|
1586
|
+
if (valp->val)
|
1587
|
+
v1 = v1u;
|
1588
|
+
else
|
1589
|
+
v1 = v2u;
|
1590
|
+
break;
|
1591
|
+
default:
|
1592
|
+
cfatal( illeg_op, op_name, 0L, NULL);
|
1593
|
+
}
|
1594
|
+
|
1595
|
+
*valpp = valp;
|
1596
|
+
return v1;
|
1597
|
+
}
|
1598
|
+
|
1599
|
+
static void overflow(
|
1600
|
+
const char * op_name,
|
1601
|
+
VAL_SIGN ** valpp,
|
1602
|
+
int ll_overflow /* Flag of overflow in long long */
|
1603
|
+
)
|
1604
|
+
{
|
1605
|
+
const char * const out_of_range
|
1606
|
+
= "Result of \"%s\" is out of range%.0ld%s"; /* _E_ _W1_ _W8_ */
|
1607
|
+
|
1608
|
+
#if HAVE_LONG_LONG
|
1609
|
+
if (standard && ! ll_overflow) {
|
1610
|
+
/* Overflow of long not in C99 mode */
|
1611
|
+
if ((! skip && (warn_level & w_level)) || (skip && (warn_level & 8)))
|
1612
|
+
cwarn( out_of_range, op_name, 0L, " of (unsigned) long");
|
1613
|
+
} else
|
1614
|
+
#endif
|
1615
|
+
if (skip) {
|
1616
|
+
if (warn_level & 8)
|
1617
|
+
cwarn( out_of_range, op_name, 0L, non_eval);
|
1618
|
+
/* Else don't warn */
|
1619
|
+
} else if (standard && (*valpp)->sign == UNSIGNED) {/* Never overflow */
|
1620
|
+
if (warn_level & 1)
|
1621
|
+
cwarn( out_of_range, op_name, 0L, NULL);
|
1622
|
+
} else {
|
1623
|
+
cerror( out_of_range, op_name, 0L, NULL);
|
1624
|
+
(*valpp)->sign = VAL_ERROR;
|
1625
|
+
}
|
1626
|
+
}
|
1627
|
+
|
1628
|
+
static void dump_val(
|
1629
|
+
const char * msg,
|
1630
|
+
const VAL_SIGN * valp
|
1631
|
+
)
|
1632
|
+
/*
|
1633
|
+
* Dump a value by internal representation.
|
1634
|
+
*/
|
1635
|
+
{
|
1636
|
+
#if HAVE_LONG_LONG
|
1637
|
+
const char * const format
|
1638
|
+
= "%s(%ssigned long long) 0x%016" LL_FORM "x";
|
1639
|
+
#else
|
1640
|
+
const char * const format = "%s(%ssigned long) 0x%08lx";
|
1641
|
+
#endif
|
1642
|
+
int sign = valp->sign;
|
1643
|
+
|
1644
|
+
mcpp_fprintf( DBG, format, msg, sign ? "" : "un", valp->val);
|
1645
|
+
}
|
1646
|
+
|
1647
|
+
static void dump_stack(
|
1648
|
+
const OPTAB * opstack, /* Operator stack */
|
1649
|
+
const OPTAB * opp, /* Pointer into operator stack */
|
1650
|
+
const VAL_SIGN * value, /* Value stack */
|
1651
|
+
const VAL_SIGN * valp /* -> value vector */
|
1652
|
+
)
|
1653
|
+
/*
|
1654
|
+
* Dump stacked operators and values.
|
1655
|
+
*/
|
1656
|
+
{
|
1657
|
+
if (opstack < opp)
|
1658
|
+
mcpp_fprintf( DBG, "Index op prec skip name -- op stack at %s"
|
1659
|
+
, infile->bptr);
|
1660
|
+
|
1661
|
+
while (opstack < opp) {
|
1662
|
+
mcpp_fprintf( DBG, " [%2d] %2d %04o %d %s\n", (int)(opp - opstack)
|
1663
|
+
, opp->op, opp->prec, opp->skip, opname[ opp->op]);
|
1664
|
+
opp--;
|
1665
|
+
}
|
1666
|
+
|
1667
|
+
while (value <= --valp) {
|
1668
|
+
mcpp_fprintf( DBG, "value[%d].val = ", (int)(valp - value));
|
1669
|
+
dump_val( "", valp);
|
1670
|
+
mcpp_fputc( '\n', DBG);
|
1671
|
+
}
|
1672
|
+
}
|
1673
|
+
|