From 99c3941638f735825b1bfa9f2df764255351242b Mon Sep 17 00:00:00 2001 From: Dwayne Boone Date: Fri, 13 Nov 2015 16:53:57 -0330 Subject: Moved Freeze to its own repository --- cpp/src/Freeze/.depend.mak | 2956 ----------------------- cpp/src/Freeze/.gitignore | 29 - cpp/src/Freeze/BackgroundSaveEvictorI.cpp | 1410 ----------- cpp/src/Freeze/BackgroundSaveEvictorI.h | 207 -- cpp/src/Freeze/ConnectionI.cpp | 213 -- cpp/src/Freeze/ConnectionI.h | 172 -- cpp/src/Freeze/EvictorI.cpp | 365 --- cpp/src/Freeze/EvictorI.h | 355 --- cpp/src/Freeze/EvictorIteratorI.cpp | 238 -- cpp/src/Freeze/EvictorIteratorI.h | 53 - cpp/src/Freeze/Freeze.rc | 38 - cpp/src/Freeze/Index.cpp | 57 - cpp/src/Freeze/IndexI.cpp | 447 ---- cpp/src/Freeze/IndexI.h | 53 - cpp/src/Freeze/Makefile | 96 - cpp/src/Freeze/Makefile.mak | 115 - cpp/src/Freeze/MapDb.cpp | 506 ---- cpp/src/Freeze/MapDb.h | 123 - cpp/src/Freeze/MapI.cpp | 2121 ----------------- cpp/src/Freeze/MapI.h | 215 -- cpp/src/Freeze/ObjectStore.cpp | 678 ------ cpp/src/Freeze/ObjectStore.h | 206 -- cpp/src/Freeze/PingObject.ice | 22 - cpp/src/Freeze/SharedDbEnv.cpp | 755 ------ cpp/src/Freeze/SharedDbEnv.h | 130 - cpp/src/Freeze/TransactionHolder.cpp | 71 - cpp/src/Freeze/TransactionI.cpp | 283 --- cpp/src/Freeze/TransactionI.h | 88 - cpp/src/Freeze/TransactionalEvictorContext.cpp | 395 --- cpp/src/Freeze/TransactionalEvictorContext.h | 167 -- cpp/src/Freeze/TransactionalEvictorI.cpp | 864 ------- cpp/src/Freeze/TransactionalEvictorI.h | 128 - cpp/src/Freeze/Util.cpp | 90 - cpp/src/Freeze/Util.h | 96 - cpp/src/FreezeScript/.depend.mak | 1896 --------------- cpp/src/FreezeScript/AssignVisitor.cpp | 595 ----- cpp/src/FreezeScript/AssignVisitor.h | 54 - cpp/src/FreezeScript/Data.cpp | 2585 -------------------- cpp/src/FreezeScript/Data.h | 618 ----- cpp/src/FreezeScript/DumpDB.cpp | 980 -------- cpp/src/FreezeScript/DumpDB.rc | 34 - cpp/src/FreezeScript/DumpDescriptors.cpp | 1953 --------------- cpp/src/FreezeScript/DumpDescriptors.h | 306 --- cpp/src/FreezeScript/Error.cpp | 188 -- cpp/src/FreezeScript/Error.h | 68 - cpp/src/FreezeScript/Exception.cpp | 61 - cpp/src/FreezeScript/Exception.h | 39 - cpp/src/FreezeScript/Functions.cpp | 346 --- cpp/src/FreezeScript/Functions.h | 26 - cpp/src/FreezeScript/Grammar.cpp | 2051 ---------------- cpp/src/FreezeScript/Grammar.h | 83 - cpp/src/FreezeScript/Grammar.y | 321 --- cpp/src/FreezeScript/GrammarUtil.h | 136 -- cpp/src/FreezeScript/Makefile | 59 - cpp/src/FreezeScript/Makefile.mak | 90 - cpp/src/FreezeScript/Parser.cpp | 728 ------ cpp/src/FreezeScript/Parser.h | 251 -- cpp/src/FreezeScript/Print.cpp | 233 -- cpp/src/FreezeScript/Print.h | 22 - cpp/src/FreezeScript/Scanner.cpp | 2253 ------------------ cpp/src/FreezeScript/Scanner.l | 395 --- cpp/src/FreezeScript/TransformAnalyzer.cpp | 1236 ---------- cpp/src/FreezeScript/TransformAnalyzer.h | 44 - cpp/src/FreezeScript/TransformDB.rc | 34 - cpp/src/FreezeScript/TransformVisitor.cpp | 995 -------- cpp/src/FreezeScript/TransformVisitor.h | 120 - cpp/src/FreezeScript/Transformer.cpp | 3044 ------------------------ cpp/src/FreezeScript/Transformer.h | 33 - cpp/src/FreezeScript/Util.cpp | 308 --- cpp/src/FreezeScript/Util.h | 83 - cpp/src/FreezeScript/transformdb.cpp | 1022 -------- cpp/src/Makefile | 12 +- cpp/src/Makefile.mak | 6 +- cpp/src/slice2freeze/.depend.mak | 25 - cpp/src/slice2freeze/Main.cpp | 2142 ----------------- cpp/src/slice2freeze/Makefile | 30 - cpp/src/slice2freeze/Makefile.mak | 49 - cpp/src/slice2freeze/Slice2Freeze.rc | 34 - cpp/src/slice2freezej/.depend.mak | 24 - cpp/src/slice2freezej/Main.cpp | 2039 ---------------- cpp/src/slice2freezej/Makefile | 30 - cpp/src/slice2freezej/Makefile.mak | 48 - cpp/src/slice2freezej/Slice2FreezeJ.rc | 34 - 83 files changed, 3 insertions(+), 41502 deletions(-) delete mode 100755 cpp/src/Freeze/.depend.mak delete mode 100644 cpp/src/Freeze/.gitignore delete mode 100644 cpp/src/Freeze/BackgroundSaveEvictorI.cpp delete mode 100644 cpp/src/Freeze/BackgroundSaveEvictorI.h delete mode 100644 cpp/src/Freeze/ConnectionI.cpp delete mode 100644 cpp/src/Freeze/ConnectionI.h delete mode 100644 cpp/src/Freeze/EvictorI.cpp delete mode 100644 cpp/src/Freeze/EvictorI.h delete mode 100644 cpp/src/Freeze/EvictorIteratorI.cpp delete mode 100644 cpp/src/Freeze/EvictorIteratorI.h delete mode 100644 cpp/src/Freeze/Freeze.rc delete mode 100644 cpp/src/Freeze/Index.cpp delete mode 100644 cpp/src/Freeze/IndexI.cpp delete mode 100644 cpp/src/Freeze/IndexI.h delete mode 100644 cpp/src/Freeze/Makefile delete mode 100644 cpp/src/Freeze/Makefile.mak delete mode 100644 cpp/src/Freeze/MapDb.cpp delete mode 100644 cpp/src/Freeze/MapDb.h delete mode 100644 cpp/src/Freeze/MapI.cpp delete mode 100644 cpp/src/Freeze/MapI.h delete mode 100644 cpp/src/Freeze/ObjectStore.cpp delete mode 100644 cpp/src/Freeze/ObjectStore.h delete mode 100644 cpp/src/Freeze/PingObject.ice delete mode 100644 cpp/src/Freeze/SharedDbEnv.cpp delete mode 100644 cpp/src/Freeze/SharedDbEnv.h delete mode 100644 cpp/src/Freeze/TransactionHolder.cpp delete mode 100644 cpp/src/Freeze/TransactionI.cpp delete mode 100644 cpp/src/Freeze/TransactionI.h delete mode 100644 cpp/src/Freeze/TransactionalEvictorContext.cpp delete mode 100644 cpp/src/Freeze/TransactionalEvictorContext.h delete mode 100644 cpp/src/Freeze/TransactionalEvictorI.cpp delete mode 100644 cpp/src/Freeze/TransactionalEvictorI.h delete mode 100644 cpp/src/Freeze/Util.cpp delete mode 100644 cpp/src/Freeze/Util.h delete mode 100755 cpp/src/FreezeScript/.depend.mak delete mode 100644 cpp/src/FreezeScript/AssignVisitor.cpp delete mode 100644 cpp/src/FreezeScript/AssignVisitor.h delete mode 100644 cpp/src/FreezeScript/Data.cpp delete mode 100644 cpp/src/FreezeScript/Data.h delete mode 100644 cpp/src/FreezeScript/DumpDB.cpp delete mode 100644 cpp/src/FreezeScript/DumpDB.rc delete mode 100644 cpp/src/FreezeScript/DumpDescriptors.cpp delete mode 100644 cpp/src/FreezeScript/DumpDescriptors.h delete mode 100644 cpp/src/FreezeScript/Error.cpp delete mode 100644 cpp/src/FreezeScript/Error.h delete mode 100644 cpp/src/FreezeScript/Exception.cpp delete mode 100644 cpp/src/FreezeScript/Exception.h delete mode 100644 cpp/src/FreezeScript/Functions.cpp delete mode 100644 cpp/src/FreezeScript/Functions.h delete mode 100644 cpp/src/FreezeScript/Grammar.cpp delete mode 100644 cpp/src/FreezeScript/Grammar.h delete mode 100644 cpp/src/FreezeScript/Grammar.y delete mode 100644 cpp/src/FreezeScript/GrammarUtil.h delete mode 100644 cpp/src/FreezeScript/Makefile delete mode 100644 cpp/src/FreezeScript/Makefile.mak delete mode 100644 cpp/src/FreezeScript/Parser.cpp delete mode 100644 cpp/src/FreezeScript/Parser.h delete mode 100644 cpp/src/FreezeScript/Print.cpp delete mode 100644 cpp/src/FreezeScript/Print.h delete mode 100644 cpp/src/FreezeScript/Scanner.cpp delete mode 100644 cpp/src/FreezeScript/Scanner.l delete mode 100644 cpp/src/FreezeScript/TransformAnalyzer.cpp delete mode 100644 cpp/src/FreezeScript/TransformAnalyzer.h delete mode 100644 cpp/src/FreezeScript/TransformDB.rc delete mode 100644 cpp/src/FreezeScript/TransformVisitor.cpp delete mode 100644 cpp/src/FreezeScript/TransformVisitor.h delete mode 100644 cpp/src/FreezeScript/Transformer.cpp delete mode 100644 cpp/src/FreezeScript/Transformer.h delete mode 100644 cpp/src/FreezeScript/Util.cpp delete mode 100644 cpp/src/FreezeScript/Util.h delete mode 100644 cpp/src/FreezeScript/transformdb.cpp delete mode 100755 cpp/src/slice2freeze/.depend.mak delete mode 100644 cpp/src/slice2freeze/Main.cpp delete mode 100644 cpp/src/slice2freeze/Makefile delete mode 100644 cpp/src/slice2freeze/Makefile.mak delete mode 100644 cpp/src/slice2freeze/Slice2Freeze.rc delete mode 100755 cpp/src/slice2freezej/.depend.mak delete mode 100644 cpp/src/slice2freezej/Main.cpp delete mode 100644 cpp/src/slice2freezej/Makefile delete mode 100644 cpp/src/slice2freezej/Makefile.mak delete mode 100644 cpp/src/slice2freezej/Slice2FreezeJ.rc (limited to 'cpp/src') diff --git a/cpp/src/Freeze/.depend.mak b/cpp/src/Freeze/.depend.mak deleted file mode 100755 index bf0078b6b67..00000000000 --- a/cpp/src/Freeze/.depend.mak +++ /dev/null @@ -1,2956 +0,0 @@ - -BackgroundSaveEvictor.h: \ - "$(slicedir)\Freeze\BackgroundSaveEvictor.ice" \ - "$(slicedir)/Freeze/Evictor.ice" \ - "$(slicedir)/Ice/ObjectAdapterF.ice" \ - "$(slicedir)/Ice/ServantLocator.ice" \ - "$(slicedir)/Ice/Current.ice" \ - "$(slicedir)/Ice/ConnectionF.ice" \ - "$(slicedir)/Ice/Identity.ice" \ - "$(slicedir)/Ice/Version.ice" \ - "$(slicedir)/Freeze/Exception.ice" - -CatalogData.h: \ - "$(slicedir)\Freeze\CatalogData.ice" - -Connection.h: \ - "$(slicedir)\Freeze\Connection.ice" \ - "$(slicedir)/Freeze/Transaction.ice" \ - "$(slicedir)/Ice/Version.ice" \ - "$(slicedir)/Ice/CommunicatorF.ice" - -ConnectionF.h: \ - "$(slicedir)\Freeze\ConnectionF.ice" - -DB.h: \ - "$(slicedir)\Freeze\DB.ice" - -Evictor.h: \ - "$(slicedir)\Freeze\Evictor.ice" \ - "$(slicedir)/Ice/ObjectAdapterF.ice" \ - "$(slicedir)/Ice/ServantLocator.ice" \ - "$(slicedir)/Ice/Current.ice" \ - "$(slicedir)/Ice/ConnectionF.ice" \ - "$(slicedir)/Ice/Identity.ice" \ - "$(slicedir)/Ice/Version.ice" \ - "$(slicedir)/Freeze/Exception.ice" - -EvictorF.h: \ - "$(slicedir)\Freeze\EvictorF.ice" - -EvictorStorage.h: \ - "$(slicedir)\Freeze\EvictorStorage.ice" \ - "$(slicedir)/Ice/Identity.ice" - -Exception.h: \ - "$(slicedir)\Freeze\Exception.ice" - -Transaction.h: \ - "$(slicedir)\Freeze\Transaction.ice" - -TransactionalEvictor.h: \ - "$(slicedir)\Freeze\TransactionalEvictor.ice" \ - "$(slicedir)/Freeze/Evictor.ice" \ - "$(slicedir)/Ice/ObjectAdapterF.ice" \ - "$(slicedir)/Ice/ServantLocator.ice" \ - "$(slicedir)/Ice/Current.ice" \ - "$(slicedir)/Ice/ConnectionF.ice" \ - "$(slicedir)/Ice/Identity.ice" \ - "$(slicedir)/Ice/Version.ice" \ - "$(slicedir)/Freeze/Exception.ice" - -PingObject.h: \ - PingObject.ice - -BackgroundSaveEvictorI.obj: \ - BackgroundSaveEvictorI.cpp \ - "BackgroundSaveEvictorI.h" \ - "EvictorI.h" \ - "$(includedir)\IceUtil\IceUtil.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\AbstractMutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\Cache.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\CountDownLatch.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\IceUtil\CtrlCHandler.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\IceUtil\RecMutex.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\UUID.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\Freeze.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Index.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\Freeze\BackgroundSaveEvictor.h" \ - "$(includedir)\Freeze\Evictor.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Freeze\TransactionalEvictor.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\TransactionHolder.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "ObjectStore.h" \ - "$(includedir)\Freeze\EvictorStorage.h" \ - "TransactionI.h" \ - "EvictorIteratorI.h" \ - "SharedDbEnv.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ - "$(includedir)\IceUtil\StringUtil.h" \ - "Util.h" \ - -Catalog.obj: \ - Catalog.cpp \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\IceUtil\StringUtil.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - -CatalogIndexList.obj: \ - CatalogIndexList.cpp \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\IceUtil\StringUtil.h" \ - "$(includedir)\Freeze\CatalogIndexList.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\Transaction.h" \ - -ConnectionI.obj: \ - ConnectionI.cpp \ - "ConnectionI.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Index.h" \ - "$(includedir)\Freeze\DB.h" \ - "TransactionI.h" \ - "SharedDbEnv.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ - "MapI.h" \ - -EvictorI.obj: \ - EvictorI.cpp \ - "EvictorI.h" \ - "$(includedir)\IceUtil\IceUtil.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\AbstractMutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\Cache.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\CountDownLatch.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\IceUtil\CtrlCHandler.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\IceUtil\RecMutex.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\UUID.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\Freeze.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Index.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\Freeze\BackgroundSaveEvictor.h" \ - "$(includedir)\Freeze\Evictor.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Freeze\TransactionalEvictor.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\TransactionHolder.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "ObjectStore.h" \ - "$(includedir)\Freeze\EvictorStorage.h" \ - "TransactionI.h" \ - "EvictorIteratorI.h" \ - "SharedDbEnv.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ - "Util.h" \ - "PingObject.h" \ - -EvictorIteratorI.obj: \ - EvictorIteratorI.cpp \ - "EvictorIteratorI.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\Freeze.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Index.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\Freeze\BackgroundSaveEvictor.h" \ - "$(includedir)\Freeze\Evictor.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Freeze\TransactionalEvictor.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\TransactionHolder.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "ObjectStore.h" \ - "$(includedir)\Freeze\EvictorStorage.h" \ - "TransactionI.h" \ - "$(includedir)\IceUtil\Cache.h" \ - "$(includedir)\IceUtil\CountDownLatch.h" \ - "EvictorI.h" \ - "$(includedir)\IceUtil\IceUtil.h" \ - "$(includedir)\IceUtil\AbstractMutex.h" \ - "$(includedir)\IceUtil\CtrlCHandler.h" \ - "$(includedir)\IceUtil\RecMutex.h" \ - "$(includedir)\IceUtil\UUID.h" \ - "SharedDbEnv.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ - "Util.h" \ - -Index.obj: \ - Index.cpp \ - "$(includedir)\Freeze\Index.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\DB.h" \ - "IndexI.h" \ - "EvictorI.h" \ - "$(includedir)\IceUtil\IceUtil.h" \ - "$(includedir)\IceUtil\AbstractMutex.h" \ - "$(includedir)\IceUtil\Cache.h" \ - "$(includedir)\IceUtil\CountDownLatch.h" \ - "$(includedir)\IceUtil\CtrlCHandler.h" \ - "$(includedir)\IceUtil\RecMutex.h" \ - "$(includedir)\IceUtil\UUID.h" \ - "$(includedir)\Freeze\Freeze.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\Freeze\BackgroundSaveEvictor.h" \ - "$(includedir)\Freeze\Evictor.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Freeze\TransactionalEvictor.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\TransactionHolder.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "ObjectStore.h" \ - "$(includedir)\Freeze\EvictorStorage.h" \ - "TransactionI.h" \ - "EvictorIteratorI.h" \ - "SharedDbEnv.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ - -IndexI.obj: \ - IndexI.cpp \ - "IndexI.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\Index.h" \ - "$(includedir)\Freeze\DB.h" \ - "EvictorI.h" \ - "$(includedir)\IceUtil\IceUtil.h" \ - "$(includedir)\IceUtil\AbstractMutex.h" \ - "$(includedir)\IceUtil\Cache.h" \ - "$(includedir)\IceUtil\CountDownLatch.h" \ - "$(includedir)\IceUtil\CtrlCHandler.h" \ - "$(includedir)\IceUtil\RecMutex.h" \ - "$(includedir)\IceUtil\UUID.h" \ - "$(includedir)\Freeze\Freeze.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\Freeze\BackgroundSaveEvictor.h" \ - "$(includedir)\Freeze\Evictor.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Freeze\TransactionalEvictor.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\TransactionHolder.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "ObjectStore.h" \ - "$(includedir)\Freeze\EvictorStorage.h" \ - "TransactionI.h" \ - "EvictorIteratorI.h" \ - "SharedDbEnv.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ - "Util.h" \ - -MapDb.obj: \ - MapDb.cpp \ - "MapDb.h" \ - "$(includedir)\IceUtil\Config.h" \ - "ConnectionI.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Index.h" \ - "$(includedir)\Freeze\DB.h" \ - "TransactionI.h" \ - "SharedDbEnv.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ - "Util.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "$(includedir)\Freeze\CatalogIndexList.h" \ - -MapI.obj: \ - MapI.cpp \ - "MapI.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "ConnectionI.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Index.h" \ - "TransactionI.h" \ - "SharedDbEnv.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ - "MapDb.h" \ - "Util.h" \ - "$(includedir)\Freeze\TransactionHolder.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "$(includedir)\Freeze\CatalogIndexList.h" \ - "$(includedir)\IceUtil\UUID.h" \ - -ObjectStore.obj: \ - ObjectStore.cpp \ - "ObjectStore.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\EvictorStorage.h" \ - "$(includedir)\Freeze\Index.h" \ - "TransactionI.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\IceUtil\Cache.h" \ - "$(includedir)\IceUtil\CountDownLatch.h" \ - "EvictorI.h" \ - "$(includedir)\IceUtil\IceUtil.h" \ - "$(includedir)\IceUtil\AbstractMutex.h" \ - "$(includedir)\IceUtil\CtrlCHandler.h" \ - "$(includedir)\IceUtil\RecMutex.h" \ - "$(includedir)\IceUtil\UUID.h" \ - "$(includedir)\Freeze\Freeze.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\BackgroundSaveEvictor.h" \ - "$(includedir)\Freeze\Evictor.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Freeze\TransactionalEvictor.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\TransactionHolder.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "EvictorIteratorI.h" \ - "SharedDbEnv.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ - "BackgroundSaveEvictorI.h" \ - "Util.h" \ - "IndexI.h" \ - -SharedDbEnv.obj: \ - SharedDbEnv.cpp \ - "SharedDbEnv.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ - "Util.h" \ - "MapDb.h" \ - "ConnectionI.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Index.h" \ - "TransactionI.h" \ - "TransactionalEvictorContext.h" \ - "$(includedir)\Freeze\TransactionalEvictor.h" \ - "$(includedir)\Freeze\Evictor.h" \ - "$(includedir)\Freeze\EvictorStorage.h" \ - "EvictorI.h" \ - "$(includedir)\IceUtil\IceUtil.h" \ - "$(includedir)\IceUtil\AbstractMutex.h" \ - "$(includedir)\IceUtil\Cache.h" \ - "$(includedir)\IceUtil\CountDownLatch.h" \ - "$(includedir)\IceUtil\CtrlCHandler.h" \ - "$(includedir)\IceUtil\RecMutex.h" \ - "$(includedir)\IceUtil\UUID.h" \ - "$(includedir)\Freeze\Freeze.h" \ - "$(includedir)\Freeze\BackgroundSaveEvictor.h" \ - "$(includedir)\Freeze\TransactionHolder.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "ObjectStore.h" \ - "EvictorIteratorI.h" \ - "$(includedir)\Freeze\CatalogIndexList.h" \ - "$(includedir)\IceUtil\MutexPtrTryLock.h" \ - "$(includedir)\IceUtil\StringUtil.h" \ - -TransactionalEvictorContext.obj: \ - TransactionalEvictorContext.cpp \ - "TransactionalEvictorContext.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\TransactionalEvictor.h" \ - "$(includedir)\Freeze\Evictor.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Freeze\EvictorStorage.h" \ - "EvictorI.h" \ - "$(includedir)\IceUtil\IceUtil.h" \ - "$(includedir)\IceUtil\AbstractMutex.h" \ - "$(includedir)\IceUtil\Cache.h" \ - "$(includedir)\IceUtil\CountDownLatch.h" \ - "$(includedir)\IceUtil\CtrlCHandler.h" \ - "$(includedir)\IceUtil\RecMutex.h" \ - "$(includedir)\IceUtil\UUID.h" \ - "$(includedir)\Freeze\Freeze.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Index.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\Freeze\BackgroundSaveEvictor.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\TransactionHolder.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "ObjectStore.h" \ - "TransactionI.h" \ - "EvictorIteratorI.h" \ - "SharedDbEnv.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ - "TransactionalEvictorI.h" \ - "Util.h" \ - "ConnectionI.h" \ - -TransactionalEvictorI.obj: \ - TransactionalEvictorI.cpp \ - "TransactionalEvictorI.h" \ - "EvictorI.h" \ - "$(includedir)\IceUtil\IceUtil.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\AbstractMutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\Cache.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\CountDownLatch.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\IceUtil\CtrlCHandler.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\IceUtil\RecMutex.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\UUID.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\Freeze.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Index.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\Freeze\BackgroundSaveEvictor.h" \ - "$(includedir)\Freeze\Evictor.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Freeze\TransactionalEvictor.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\TransactionHolder.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "ObjectStore.h" \ - "$(includedir)\Freeze\EvictorStorage.h" \ - "TransactionI.h" \ - "EvictorIteratorI.h" \ - "SharedDbEnv.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ - "Util.h" \ - "TransactionalEvictorContext.h" \ - "$(includedir)\IceUtil\StringUtil.h" \ - -TransactionHolder.obj: \ - TransactionHolder.cpp \ - "$(includedir)\Freeze\TransactionHolder.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - -TransactionI.obj: \ - TransactionI.cpp \ - "TransactionI.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "ConnectionI.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Index.h" \ - "$(includedir)\Freeze\DB.h" \ - "SharedDbEnv.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ - -Util.obj: \ - Util.cpp \ - "Util.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\Exception.h" \ - -BackgroundSaveEvictor.obj: \ - BackgroundSaveEvictor.cpp \ - "$(includedir)\Freeze\BackgroundSaveEvictor.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\Freeze\Evictor.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - -CatalogData.obj: \ - CatalogData.cpp \ - "$(includedir)\Freeze\CatalogData.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - -Connection.obj: \ - Connection.cpp \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - -ConnectionF.obj: \ - ConnectionF.cpp \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - -DB.obj: \ - DB.cpp \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - -Evictor.obj: \ - Evictor.cpp \ - "$(includedir)\Freeze\Evictor.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - -EvictorF.obj: \ - EvictorF.cpp \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - -EvictorStorage.obj: \ - EvictorStorage.cpp \ - "$(includedir)\Freeze\EvictorStorage.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - -Exception.obj: \ - Exception.cpp \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - -Transaction.obj: \ - Transaction.cpp \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - -TransactionalEvictor.obj: \ - TransactionalEvictor.cpp \ - "$(includedir)\Freeze\TransactionalEvictor.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\Freeze\Evictor.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - -PingObject.obj: \ - PingObject.cpp \ - "PingObject.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Outgoing.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ diff --git a/cpp/src/Freeze/.gitignore b/cpp/src/Freeze/.gitignore deleted file mode 100644 index b09bdea2d1e..00000000000 --- a/cpp/src/Freeze/.gitignore +++ /dev/null @@ -1,29 +0,0 @@ -// Generated by makegitignore.py - -// IMPORTANT: Do not edit this file -- any edits made here will be lost! -BackgroundSaveEvictor.cpp -DB.cpp -CatalogData.cpp -Connection.cpp -ConnectionF.cpp -Exception.cpp -EvictorF.cpp -EvictorStorage.cpp -Evictor.cpp -TransactionalEvictor.cpp -Transaction.cpp -PingObject.cpp -BackgroundSaveEvictor.h -DB.h -CatalogData.h -Connection.h -ConnectionF.h -Exception.h -EvictorF.h -EvictorStorage.h -Evictor.h -TransactionalEvictor.h -Transaction.h -PingObject.h -Catalog.cpp -CatalogIndexList.cpp diff --git a/cpp/src/Freeze/BackgroundSaveEvictorI.cpp b/cpp/src/Freeze/BackgroundSaveEvictorI.cpp deleted file mode 100644 index f3f9e949d98..00000000000 --- a/cpp/src/Freeze/BackgroundSaveEvictorI.cpp +++ /dev/null @@ -1,1410 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include - -using namespace std; -using namespace Freeze; -using namespace Ice; - -namespace -{ - -// -// Fatal error callback -// - -Freeze::FatalErrorCallback fatalErrorCallback = 0; -IceUtil::Mutex* fatalErrorCallbackMutex = 0; - -class Init -{ -public: - - Init() - { - fatalErrorCallbackMutex = new IceUtil::Mutex; - } - - ~Init() - { - delete fatalErrorCallbackMutex; - fatalErrorCallbackMutex = 0; - } -}; -Init init; - -void -handleFatalError(const Freeze::BackgroundSaveEvictorPtr& evictor, const Ice::CommunicatorPtr& communicator) -{ - IceUtilInternal::MutexPtrLock lock(fatalErrorCallbackMutex); - if(fatalErrorCallback != 0) - { - fatalErrorCallback(evictor, communicator); - } - else - { - ::abort(); - } -} - -// -// The timer is used to ensure the streaming of some object does not take more than -// timeout ms. We only measure the time necessary to acquire the lock on the object -// (servant), not the streaming itself. -// -class WatchDogTask : public IceUtil::TimerTask -{ -public: - - WatchDogTask(BackgroundSaveEvictorI& evictor) : _evictor(evictor) - { - } - - virtual void runTimerTask() - { - Error out(_evictor.communicator()->getLogger()); - out << "Fatal error: streaming watch dog timed out."; - out.flush(); - handleFatalError(&_evictor, _evictor.communicator()); - } - -private: - - BackgroundSaveEvictorI& _evictor; -}; - -} - -// -// createEvictor functions -// - -Freeze::BackgroundSaveEvictorPtr -Freeze::createBackgroundSaveEvictor(const ObjectAdapterPtr& adapter, - const string& envName, - const string& filename, - const ServantInitializerPtr& initializer, - const vector& indices, - bool createDb) -{ - return new BackgroundSaveEvictorI(adapter, envName, 0, filename, initializer, indices, createDb); -} - -BackgroundSaveEvictorPtr -Freeze::createBackgroundSaveEvictor(const ObjectAdapterPtr& adapter, - const string& envName, - DbEnv& dbEnv, - const string& filename, - const ServantInitializerPtr& initializer, - const vector& indices, - bool createDb) -{ - return new BackgroundSaveEvictorI(adapter, envName, &dbEnv, filename, initializer, indices, createDb); -} - -FatalErrorCallback -Freeze::registerFatalErrorCallback(FatalErrorCallback cb) -{ - IceUtilInternal::MutexPtrLock lock(fatalErrorCallbackMutex); - FatalErrorCallback result = fatalErrorCallback; - fatalErrorCallback = cb; - return result; -} - -// -// BackgroundSaveEvictorI -// - -Freeze::BackgroundSaveEvictorI::BackgroundSaveEvictorI(const ObjectAdapterPtr& adapter, - const string& envName, - DbEnv* dbEnv, - const string& filename, - const ServantInitializerPtr& initializer, - const vector& indices, - bool createDb) : - EvictorI(adapter, envName, dbEnv, filename, FacetTypeMap(), initializer, indices, createDb), - IceUtil::Thread("Freeze background save evictor thread"), - _currentEvictorSize(0), - _savingThreadDone(false) -{ - string propertyPrefix = string("Freeze.Evictor.") + envName + '.' + _filename; - - // - // By default, we save every minute or when the size of the modified queue - // reaches 10. - // - - _saveSizeTrigger = _communicator->getProperties()-> - getPropertyAsIntWithDefault(propertyPrefix + ".SaveSizeTrigger", 10); - - Int savePeriod = _communicator->getProperties()-> - getPropertyAsIntWithDefault(propertyPrefix + ".SavePeriod", 60 * 1000); - - _savePeriod = IceUtil::Time::milliSeconds(savePeriod); - - // - // By default, we save at most 10 * SaveSizeTrigger objects per transaction - // - _maxTxSize = _communicator->getProperties()-> - getPropertyAsIntWithDefault(propertyPrefix + ".MaxTxSize", 10 * _saveSizeTrigger); - - if(_maxTxSize <= 0) - { - _maxTxSize = 100; - } - - // - // By default, no stream timeout - // - _streamTimeout = _communicator->getProperties()-> - getPropertyAsIntWithDefault(propertyPrefix+ ".StreamTimeout", 0) * 1000; - - if(_streamTimeout > 0) - { - _timer = IceInternal::getInstanceTimer(_communicator); - } - - // - // Start saving thread - // - __setNoDelete(true); - start(); - __setNoDelete(false); -} - - -Ice::ObjectPrx -Freeze::BackgroundSaveEvictorI::addFacet(const ObjectPtr& servant, const Identity& ident, const string& facet) -{ - checkIdentity(ident); - checkServant(servant); - DeactivateController::Guard deactivateGuard(_deactivateController); - - ObjectStore* store = findStore(facet, _createDb); - - if(store == 0) - { - throw NotFoundException(__FILE__, __LINE__, "addFacet: could not open database for facet '" - + facet + "'"); - } - - bool alreadyThere = false; - - for(;;) - { - // - // Create a new entry - // - - BackgroundSaveEvictorElementPtr element = new BackgroundSaveEvictorElement(*store); - element->status = dead; - BackgroundSaveEvictorElementPtr oldElt = store->putIfAbsent(ident, element); - - if(oldElt != 0) - { - element = oldElt; - } - - { - Lock sync(*this); - - if(element->stale) - { - // - // Try again - // - continue; - } - fixEvictPosition(element); - - IceUtil::Mutex::Lock lock(element->mutex); - - switch(element->status) - { - case clean: - case created: - case modified: - { - alreadyThere = true; - break; - } - case destroyed: - { - element->status = modified; - element->rec.servant = servant; - - // - // No need to push it on the modified queue, as a destroyed object - // is either already on the queue or about to be saved. When saved, - // it becomes dead. - // - break; - } - case dead: - { - element->status = created; - ObjectRecord& rec = element->rec; - - rec.servant = servant; - if(store->keepStats()) - { - rec.stats.creationTime = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); - rec.stats.lastSaveTime = 0; - rec.stats.avgSaveTime = 0; - } - addToModifiedQueue(element); - break; - } - default: - { - assert(0); - break; - } - } - } - break; // for(;;) - } - - if(alreadyThere) - { - AlreadyRegisteredException ex(__FILE__, __LINE__); - ex.kindOfObject = "servant"; - ex.id = _communicator->identityToString(ident); - if(!facet.empty()) - { - ex.id += " -f " + IceUtilInternal::escapeString(facet, ""); - } - throw ex; - } - - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "added object \"" << _communicator->identityToString(ident) << "\""; - if(!facet.empty()) - { - out << " with facet \"" << facet << "\""; - } - out << " to Db \"" << _filename << "\""; - } - - ObjectPrx obj = _adapter->createProxy(ident); - if(!facet.empty()) - { - obj = obj->ice_facet(facet); - } - return obj; -} - -Ice::ObjectPtr -Freeze::BackgroundSaveEvictorI::removeFacet(const Identity& ident, const string& facet) -{ - checkIdentity(ident); - DeactivateController::Guard deactivateGuard(_deactivateController); - - ObjectStore* store = findStore(facet, false); - ObjectPtr servant = 0; - - if(store != 0) - { - for(;;) - { - // - // Retrieve object - // - - BackgroundSaveEvictorElementPtr element = store->pin(ident); - if(element != 0) - { - Lock sync(*this); - if(element->stale) - { - // - // Try again - // - continue; - } - - fixEvictPosition(element); - { - IceUtil::Mutex::Lock lock(element->mutex); - - switch(element->status) - { - case clean: - { - servant = element->rec.servant; - element->status = destroyed; - element->rec.servant = 0; - addToModifiedQueue(element); - break; - } - case created: - { - servant = element->rec.servant; - element->status = dead; - element->rec.servant = 0; - break; - } - case modified: - { - servant = element->rec.servant; - element->status = destroyed; - element->rec.servant = 0; - // - // Not necessary to push it on the modified queue, as a modified - // element is either on the queue already or about to be saved - // (at which point it becomes clean) - // - break; - } - case destroyed: - case dead: - { - break; - } - default: - { - assert(0); - break; - } - } - } - if(element->keepCount > 0) - { - assert(servant != 0); - - element->keepCount = 0; - // - // Add to front of evictor queue - // - // Note that save evicts dead objects - // - _evictorList.push_front(element); - _currentEvictorSize++; - element->evictPosition = _evictorList.begin(); - } - } - break; // for(;;) - } - } - - if(servant == 0) - { - NotRegisteredException ex(__FILE__, __LINE__); - ex.kindOfObject = "servant"; - ex.id = _communicator->identityToString(ident); - if(!facet.empty()) - { - ex.id += " -f " + IceUtilInternal::escapeString(facet, ""); - } - throw ex; - } - - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "removed object \"" << _communicator->identityToString(ident) << "\""; - if(!facet.empty()) - { - out << " with facet \"" << facet << "\""; - } - out << " from Db \"" << _filename << "\""; - } - return servant; -} - -void -Freeze::BackgroundSaveEvictorI::keep(const Identity& ident) -{ - keepFacet(ident, ""); -} - -void -Freeze::BackgroundSaveEvictorI::keepFacet(const Identity& ident, const string& facet) -{ - checkIdentity(ident); - DeactivateController::Guard deactivateGuard(_deactivateController); - - bool notThere = false; - - ObjectStore* store = findStore(facet, false); - if(store == 0) - { - notThere = true; - } - else - { - for(;;) - { - BackgroundSaveEvictorElementPtr element = store->pin(ident); - if(element == 0) - { - notThere = true; - break; - } - - Lock sync(*this); - - if(element->stale) - { - // - // try again - // - continue; - } - - - { - IceUtil::Mutex::Lock lockElement(element->mutex); - if(element->status == destroyed || element->status == dead) - { - notThere = true; - break; - } - } - - // - // Found! - // - - if(element->keepCount == 0) - { - if(element->usageCount < 0) - { - // - // New object - // - element->usageCount = 0; - } - else - { - _evictorList.erase(element->evictPosition); - _currentEvictorSize--; - } - element->keepCount = 1; - } - else - { - element->keepCount++; - } - break; - } - } - - if(notThere) - { - NotRegisteredException ex(__FILE__, __LINE__); - ex.kindOfObject = "servant"; - ex.id = _communicator->identityToString(ident); - if(!facet.empty()) - { - ex.id += " -f " + IceUtilInternal::escapeString(facet, ""); - } - throw ex; - } -} - -void -Freeze::BackgroundSaveEvictorI::release(const Identity& ident) -{ - releaseFacet(ident, ""); -} - -void -Freeze::BackgroundSaveEvictorI::releaseFacet(const Identity& ident, const string& facet) -{ - checkIdentity(ident); - DeactivateController::Guard deactivateGuard(_deactivateController); - - ObjectStore* store = findStore(facet, false); - - if(store != 0) - { - Lock sync(*this); - - BackgroundSaveEvictorElementPtr element = store->getIfPinned(ident); - if(element != 0) - { - assert(!element->stale); - if(element->keepCount > 0) - { - if(--element->keepCount == 0) - { - // - // Add to front of evictor queue - // - // Note that the element cannot be destroyed or dead since - // its keepCount was > 0. - // - _evictorList.push_front(element); - _currentEvictorSize++; - element->evictPosition = _evictorList.begin(); - } - // - // Success - // - return; - } - } - } - - NotRegisteredException ex(__FILE__, __LINE__); - ex.kindOfObject = "servant"; - ex.id = _communicator->identityToString(ident); - if(!facet.empty()) - { - ex.id += " -f " + IceUtilInternal::escapeString(facet, ""); - } - throw ex; -} - - -bool -Freeze::BackgroundSaveEvictorI::hasFacet(const Identity& ident, const string& facet) -{ - DeactivateController::Guard deactivateGuard(_deactivateController); - checkIdentity(ident); - ObjectStore* store = findStore(facet, false); - - if(store == 0) - { - return false; - } - - { - Lock sync(*this); - BackgroundSaveEvictorElementPtr element = store->getIfPinned(ident); - if(element != 0) - { - assert(!element->stale); - - IceUtil::Mutex::Lock lock(element->mutex); - return element->status != dead && element->status != destroyed; - } - } - return store->dbHasObject(ident, 0); -} - -bool -Freeze::BackgroundSaveEvictorI::hasAnotherFacet(const Identity& ident, const string& facet) -{ - DeactivateController::Guard deactivateGuard(_deactivateController); - - // - // If the object exists in another store, throw FacetNotExistException - // instead of returning 0 (== ObjectNotExistException) - // - StoreMap storeMapCopy; - { - Lock sync(*this); - storeMapCopy = _storeMap; - } - - for(StoreMap::iterator p = storeMapCopy.begin(); p != storeMapCopy.end(); ++p) - { - // - // Do not check again the given facet - // - if((*p).first != facet) - { - ObjectStore* store = (*p).second; - - bool inCache = false; - { - Lock sync(*this); - - BackgroundSaveEvictorElementPtr element = store->getIfPinned(ident); - if(element != 0) - { - inCache = true; - assert(!element->stale); - - IceUtil::Mutex::Lock lock(element->mutex); - if(element->status != dead && element->status != destroyed) - { - return true; - } - } - } - if(!inCache) - { - if(store->dbHasObject(ident, 0)) - { - return true; - } - } - } - } - return false; -} - - -ObjectPtr -Freeze::BackgroundSaveEvictorI::locateImpl(const Current& current, LocalObjectPtr& cookie) -{ - DeactivateController::Guard deactivateGuard(_deactivateController); - - cookie = 0; - - ObjectStore* store = findStore(current.facet, false); - if(store == 0) - { - if(_trace >= 2) - { - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "locate could not find a database for facet \"" << current.facet << "\""; - } - return 0; - } - - for(;;) - { - BackgroundSaveEvictorElementPtr element = store->pin(current.id); - if(element == 0) - { - if(_trace >= 2) - { - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "locate could not find \"" << _communicator->identityToString(current.id) << "\" in Db \"" - << _filename << "\""; - } - return 0; - } - - Lock sync(*this); - - if(element->stale) - { - // - // try again - // - continue; - } - - - IceUtil::Mutex::Lock lockElement(element->mutex); - if(element->status == destroyed || element->status == dead) - { - if(_trace >= 2) - { - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "locate found \"" << _communicator->identityToString(current.id) - << "\" in the cache for database \"" << current.facet << "\" but it was dead or destroyed"; - } - return 0; - } - - // - // It's a good one! - // - if(_trace >= 2) - { - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "locate found \"" << _communicator->identityToString(current.id) << "\" in Db \"" - << _filename << "\""; - } - - fixEvictPosition(element); - element->usageCount++; - cookie = element; - assert(element->rec.servant != 0); - return element->rec.servant; - } -} - -void -Freeze::BackgroundSaveEvictorI::finished(const Current& current, const ObjectPtr& servant, const LocalObjectPtr& cookie) -{ - assert(servant != 0); - DeactivateController::Guard deactivateGuard(_deactivateController); - - if(cookie != 0) - { - BackgroundSaveEvictorElementPtr element = BackgroundSaveEvictorElementPtr::dynamicCast(cookie); - assert(element); - - bool enqueue = false; - - if((servant->ice_operationAttributes(current.operation) & 0x1) != 0) - { - IceUtil::Mutex::Lock lock(element->mutex); - - if(element->status == clean) - { - // - // Assume this operation updated the object - // - element->status = modified; - enqueue = true; - } - } - - Lock sync(*this); - - // - // Only elements with a usageCount == 0 can become stale and we own - // one count! - // - assert(!element->stale); - assert(element->usageCount >= 1); - - // - // Decrease the usage count of the evictor queue element. - // - element->usageCount--; - - if(enqueue) - { - addToModifiedQueue(element); - } - else if(element->usageCount == 0 && element->keepCount == 0) - { - // - // Evict as many elements as necessary. - // - evict(); - } - } -} - -void -Freeze::BackgroundSaveEvictorI::deactivate(const string&) -{ - if(_deactivateController.deactivate()) - { - try - { - saveNow(); - - Lock sync(*this); - - // - // Set the evictor size to zero, meaning that we will evict - // everything possible. - // - _evictorSize = 0; - evict(); - - _savingThreadDone = true; - notifyAll(); - sync.release(); - getThreadControl().join(); - - closeDbEnv(); - } - catch(...) - { - _deactivateController.deactivationComplete(); - throw; - } - _deactivateController.deactivationComplete(); - } -} - -Freeze::BackgroundSaveEvictorI::~BackgroundSaveEvictorI() -{ - if(!_deactivateController.deactivated()) - { - Warning out(_communicator->getLogger()); - out << "evictor has not been deactivated"; - } -} - - -void -Freeze::BackgroundSaveEvictorI::run() -{ - try - { - for(;;) - { - deque allObjects; - deque deadObjects; - - size_t saveNowThreadsSize = 0; - - { - Lock sync(*this); - - while(!_savingThreadDone && - (_saveNowThreads.size() == 0) && - (_saveSizeTrigger < 0 || static_cast(_modifiedQueue.size()) < _saveSizeTrigger)) - { - if(_savePeriod == IceUtil::Time::milliSeconds(0)) - { - wait(); - } - else if(timedWait(_savePeriod) == false) - { - // - // Timeout, so let's save - // - break; // while - } - } - - saveNowThreadsSize = _saveNowThreads.size(); - - if(_savingThreadDone) - { - assert(_modifiedQueue.size() == 0); - assert(saveNowThreadsSize == 0); - break; // for(;;) - } - - // - // Check first if there is something to do! - // - if(_modifiedQueue.size() == 0) - { - if(saveNowThreadsSize > 0) - { - _saveNowThreads.clear(); - notifyAll(); - } - continue; // for(;;) - } - - _modifiedQueue.swap(allObjects); - } - - const size_t size = allObjects.size(); - - deque streamedObjectQueue; - - Long streamStart = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); - - // - // Stream each element - // - for(size_t i = 0; i < size; i++) - { - BackgroundSaveEvictorElementPtr& element = allObjects[i]; - - bool tryAgain; - do - { - tryAgain = false; - ObjectPtr servant = 0; - - // - // These elements can't be stale as only elements with - // usageCount == 0 can become stale, and the modifiedQueue - // (us now) owns one count. - // - - IceUtil::Mutex::Lock lockElement(element->mutex); - Byte status = element->status; - - switch(status) - { - case created: - case modified: - { - servant = element->rec.servant; - break; - } - case destroyed: - { - size_t index = streamedObjectQueue.size(); - streamedObjectQueue.resize(index + 1); - streamedObjectQueue[index] = new StreamedObject; - stream(element, streamStart, streamedObjectQueue[index]); - - element->status = dead; - deadObjects.push_back(element); - - break; - } - case dead: - { - deadObjects.push_back(element); - break; - } - default: - { - // - // Nothing to do (could be a duplicate) - // - break; - } - } - if(servant == 0) - { - lockElement.release(); - } - else - { - IceUtil::AbstractMutex* mutex = dynamic_cast(servant.get()); - if(mutex != 0) - { - // - // Lock servant and then element so that user can safely lock - // servant and call various Evictor operations - // - - IceUtil::AbstractMutex::TryLock lockServant(*mutex); - if(!lockServant.acquired()) - { - lockElement.release(); - - IceUtil::TimerTaskPtr watchDogTask; - if(_timer) - { - watchDogTask = new WatchDogTask(*this); - _timer->schedule(watchDogTask, IceUtil::Time::milliSeconds(_streamTimeout)); - } - lockServant.acquire(); - if(watchDogTask) - { - _timer->cancel(watchDogTask); - watchDogTask = 0; - } - - lockElement.acquire(); - status = element->status; - } - - switch(status) - { - case created: - case modified: - { - if(servant == element->rec.servant) - { - size_t index = streamedObjectQueue.size(); - streamedObjectQueue.resize(index + 1); - streamedObjectQueue[index] = new StreamedObject; - stream(element, streamStart, streamedObjectQueue[index]); - - element->status = clean; - } - else - { - tryAgain = true; - } - break; - } - case destroyed: - { - lockServant.release(); - - size_t index = streamedObjectQueue.size(); - streamedObjectQueue.resize(index + 1); - streamedObjectQueue[index] = new StreamedObject; - stream(element, streamStart, streamedObjectQueue[index]); - - element->status = dead; - deadObjects.push_back(element); - break; - } - case dead: - { - deadObjects.push_back(element); - break; - } - default: - { - // - // Nothing to do (could be a duplicate) - // - break; - } - } - } - else - { - DatabaseException ex(__FILE__, __LINE__); - Ice::Object& servant = *element->rec.servant; - ex.message = string(typeid(servant).name()) + " does not implement IceUtil::AbstractMutex"; - throw ex; - } - } - } while(tryAgain); - } - - if(_trace >= 1) - { - Long now = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "streamed " << streamedObjectQueue.size() << " objects in " - << static_cast(now - streamStart) << " ms"; - } - - // - // Now let's save all these streamed objects to disk using a transaction - // - - // - // Each time we get a deadlock, we reduce the number of objects to save - // per transaction - // - size_t txSize = streamedObjectQueue.size(); - if(txSize > static_cast(_maxTxSize)) - { - txSize = static_cast(_maxTxSize); - } - bool tryAgain; - - do - { - tryAgain = false; - - while(streamedObjectQueue.size() > 0) - { - if(txSize > streamedObjectQueue.size()) - { - txSize = streamedObjectQueue.size(); - } - - Long saveStart = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); - - try - { - DbTxn* tx = 0; - _dbEnv->getEnv()->txn_begin(0, &tx, 0); - - long txnId = 0; - if(_txTrace >= 1) - { - txnId = (tx->id() & 0x7FFFFFFF) + 0x80000000L; - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "started transaction " << hex << txnId << dec << " in saving thread"; - } - - try - { - for(size_t i = 0; i < txSize; i++) - { - StreamedObjectPtr obj = streamedObjectQueue[i]; - Dbt key, value; - obj->key->getDbt(key); - if(obj->value) - { - obj->value->getDbt(value); - } - obj->store->save(key, value, obj->status, tx); - } - } - catch(...) - { - tx->abort(); - if(_txTrace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "rolled back transaction " << hex << txnId << dec; - } - throw; - } - tx->commit(0); - - if(_txTrace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "committed transaction " << hex << txnId << dec; - } - - streamedObjectQueue.erase(streamedObjectQueue.begin(), streamedObjectQueue.begin() + txSize); - - if(_trace >= 1) - { - Long now = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "saved " << txSize << " objects in " - << static_cast(now - saveStart) << " ms"; - } - } - catch(const DbDeadlockException&) - { - if(_deadlockWarning) - { - Warning out(_communicator->getLogger()); - out << "Deadlock in Freeze::BackgroundSaveEvictorI::run while writing into Db \"" + _filename - + "\"; retrying ..."; - } - - tryAgain = true; - txSize = (txSize + 1)/2; - } - catch(const DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - } - } - while(tryAgain); - - { - Lock sync(*this); - - // - // Release usage count - // - for(deque::iterator p = allObjects.begin(); - p != allObjects.end(); p++) - { - BackgroundSaveEvictorElementPtr& element = *p; - element->usageCount--; - } - allObjects.clear(); - - for(deque::iterator q = deadObjects.begin(); - q != deadObjects.end(); q++) - { - BackgroundSaveEvictorElementPtr& element = *q; - if(!element->stale) - { - // - // Can be stale when there are duplicate elements on the - // deadObjecst queue - // - - if(!element->stale && element->usageCount == 0 && element->keepCount == 0) - { - // - // Get rid of unused dead elements - // - IceUtil::Mutex::Lock lockElement(element->mutex); - if(element->status == dead) - { - evict(element); - } - } - } - } - deadObjects.clear(); - evict(); - - if(saveNowThreadsSize > 0) - { - _saveNowThreads.erase(_saveNowThreads.begin(), _saveNowThreads.begin() + saveNowThreadsSize); - notifyAll(); - } - } - } - } - catch(const std::exception& ex) - { - Error out(_communicator->getLogger()); - out << "Saving thread killed by exception: " << ex; - out.flush(); - handleFatalError(this, _communicator); - } - catch(...) - { - Error out(_communicator->getLogger()); - out << "Saving thread killed by unknown exception"; - out.flush(); - handleFatalError(this, _communicator); - } -} - -Freeze::TransactionIPtr -Freeze::BackgroundSaveEvictorI::beforeQuery() -{ - saveNow(); - return 0; -} - -void -Freeze::BackgroundSaveEvictorI::saveNow() -{ - Lock sync(*this); - - IceUtil::ThreadControl myself; - - _saveNowThreads.push_back(myself); - notifyAll(); - do - { - wait(); - } - while(find(_saveNowThreads.begin(), _saveNowThreads.end(), myself) != _saveNowThreads.end()); -} - -void -Freeze::BackgroundSaveEvictorI::evict() -{ - // - // Must be called with *this locked - // - - assert(_currentEvictorSize == _evictorList.size()); - - list::reverse_iterator p = _evictorList.rbegin(); - - while(_currentEvictorSize > _evictorSize) - { - // - // Get the last unused element from the evictor queue. - // - while(p != _evictorList.rend()) - { - if((*p)->usageCount == 0) - { - break; // Fine, servant is not in use (and not in the modifiedQueue) - } - ++p; - } - if(p == _evictorList.rend()) - { - // - // All servants are active, can't evict any further. - // - break; - } - - BackgroundSaveEvictorElementPtr& element = *p; - assert(!element->stale); - assert(element->keepCount == 0); - - if(_trace >= 2 || (_trace >= 1 && _evictorList.size() % 50 == 0)) - { - string facet = element->store.facet(); - - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "evicting \"" << _communicator->identityToString(element->cachePosition->first) << "\" "; - if(facet != "") - { - out << "-f \"" << facet << "\" "; - } - out << "from the queue\n" - << "number of elements in the queue: " << _currentEvictorSize; - } - - // - // Remove last unused element from the evictor queue. - // - element->stale = true; - element->store.unpin(element->cachePosition); - p = list::reverse_iterator(_evictorList.erase(element->evictPosition)); - _currentEvictorSize--; - } -} - -void -Freeze::BackgroundSaveEvictorI::fixEvictPosition(const BackgroundSaveEvictorElementPtr& element) -{ - assert(!element->stale); - - if(element->keepCount == 0) - { - if(element->usageCount < 0) - { - // - // New object - // - element->usageCount = 0; - _currentEvictorSize++; - } - else - { - _evictorList.erase(element->evictPosition); - } - _evictorList.push_front(element); - element->evictPosition = _evictorList.begin(); - } -} - -void -Freeze::BackgroundSaveEvictorI::evict(const BackgroundSaveEvictorElementPtr& element) -{ - assert(!element->stale); - assert(element->keepCount == 0); - - _evictorList.erase(element->evictPosition); - _currentEvictorSize--; - element->stale = true; - element->store.unpin(element->cachePosition); -} - - -void -Freeze::BackgroundSaveEvictorI::addToModifiedQueue(const BackgroundSaveEvictorElementPtr& element) -{ - element->usageCount++; - _modifiedQueue.push_back(element); - - if(_saveSizeTrigger >= 0 && static_cast(_modifiedQueue.size()) >= _saveSizeTrigger) - { - notifyAll(); - } -} - - -void -Freeze::BackgroundSaveEvictorI::stream(const BackgroundSaveEvictorElementPtr& element, Long streamStart, - const StreamedObjectPtr& obj) -{ - assert(element->status != dead); - - obj->status = element->status; - obj->store = &element->store; - - const Identity& ident = element->cachePosition->first; - obj->key = new ObjectStoreBase::KeyMarshaler(ident, _communicator, _encoding); - - if(element->status != destroyed) - { - const bool keepStats = obj->store->keepStats(); - if(keepStats) - { - EvictorIBase::updateStats(element->rec.stats, streamStart); - } - obj->value = new ObjectStoreBase::ValueMarshaler(element->rec, _communicator, _encoding, keepStats); - } -} - -Freeze::BackgroundSaveEvictorElement::BackgroundSaveEvictorElement(ObjectRecord& r, - ObjectStore& s) : - store(s), - usageCount(-1), - keepCount(0), - stale(true), - rec(r), - status(clean) -{ -} - -Freeze::BackgroundSaveEvictorElement::BackgroundSaveEvictorElement(ObjectStore& s) : - store(s), - usageCount(-1), - keepCount(0), - stale(true), - status(clean) -{ - const Statistics cleanStats = { 0 }; - rec.stats = cleanStats; -} - -Freeze::BackgroundSaveEvictorElement::~BackgroundSaveEvictorElement() -{ -} - -void -Freeze::BackgroundSaveEvictorElement::init(ObjectStore::Position p) -{ - stale = false; - cachePosition = p; -} diff --git a/cpp/src/Freeze/BackgroundSaveEvictorI.h b/cpp/src/Freeze/BackgroundSaveEvictorI.h deleted file mode 100644 index 027681743ae..00000000000 --- a/cpp/src/Freeze/BackgroundSaveEvictorI.h +++ /dev/null @@ -1,207 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_BACKGROUND_SAVE_EVICTOR_I_H -#define FREEZE_BACKGROUND_SAVE_EVICTOR_I_H - -#include -#include - -namespace Freeze -{ - -#if defined(_MSC_VER) && (_MSC_VER <= 1200) || defined(__IBMCPP__) - - enum - { - clean = 0, - created = 1, - modified = 2, - destroyed = 3, - dead = 4 - }; - -#else - // - // Clean object; can become modified or destroyed - // - static const Ice::Byte clean = 0; - - // - // New object; can become clean, dead or destroyed - // - static const Ice::Byte created = 1; - - // - // Modified object; can become clean or destroyed - // - static const Ice::Byte modified = 2; - - // - // Being saved. Can become dead or created - // - static const Ice::Byte destroyed = 3; - - // - // Exists only in the Evictor; for example the object was created - // and later destroyed (without a save in between), or it was - // destroyed on disk but is still in use. Can become created. - // - static const Ice::Byte dead = 4; - -#endif - - -class BackgroundSaveEvictorI; - -struct BackgroundSaveEvictorElement; -typedef IceUtil::Handle BackgroundSaveEvictorElementPtr; - -struct BackgroundSaveEvictorElement : public Ice::LocalObject -{ - BackgroundSaveEvictorElement(ObjectRecord&, ObjectStore&); - BackgroundSaveEvictorElement(ObjectStore&); - ~BackgroundSaveEvictorElement(); - - void init(ObjectStore::Position); - - // - // Immutable - // - ObjectStore& store; - - // - // Immutable once set - // - ObjectStore::Position cachePosition; - - // - // Protected by EvictorI - // - std::list::iterator evictPosition; - int usageCount; - int keepCount; - bool stale; - - // - // Protected by mutex - // - IceUtil::Mutex mutex; - ObjectRecord rec; - Ice::Byte status; -}; - - -class BackgroundSaveEvictorI : public BackgroundSaveEvictor, public EvictorI, - public IceUtil::Thread -{ -public: - - BackgroundSaveEvictorI(const Ice::ObjectAdapterPtr&, const std::string&, DbEnv*, const std::string&, - const ServantInitializerPtr&, const std::vector&, bool); - - virtual Ice::ObjectPrx addFacet(const Ice::ObjectPtr&, const Ice::Identity&, const std::string&); - virtual Ice::ObjectPtr removeFacet(const Ice::Identity&, const std::string&); - - virtual void keep(const Ice::Identity&); - virtual void keepFacet(const Ice::Identity&, const std::string&); - - virtual void release(const Ice::Identity&); - virtual void releaseFacet(const Ice::Identity&, const std::string&); - - virtual bool hasFacet(const Ice::Identity&, const std::string&); - - virtual void finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&); - virtual void deactivate(const std::string&); - - virtual ~BackgroundSaveEvictorI(); - - - virtual TransactionIPtr beforeQuery(); - - // - // Thread - // - virtual void run(); - - struct StreamedObject : public IceUtil::Shared - { - StreamedObject() : - key(0), value(0) - { - } - - ~StreamedObject() - { - delete key; - delete value; - } - - ObjectStoreBase::KeyMarshaler* key; - ObjectStoreBase::ValueMarshaler* value; - Ice::Byte status; - ObjectStore* store; - - private: - - StreamedObject(const StreamedObject&) {} - void operator=(const StreamedObject&) {} - }; - typedef IceUtil::Handle StreamedObjectPtr; - -protected: - - virtual bool hasAnotherFacet(const Ice::Identity&, const std::string&); - - virtual Ice::ObjectPtr locateImpl(const Ice::Current&, Ice::LocalObjectPtr&); - - virtual void evict(); - -private: - - void saveNow(); - - void evict(const BackgroundSaveEvictorElementPtr&); - void addToModifiedQueue(const BackgroundSaveEvictorElementPtr&); - void fixEvictPosition(const BackgroundSaveEvictorElementPtr&); - - void stream(const BackgroundSaveEvictorElementPtr&, Ice::Long, const StreamedObjectPtr&); - - // - // The _evictorList contains a list of all objects we keep, - // with the most recently used first. - // - std::list _evictorList; - std::list::size_type _currentEvictorSize; - - // - // The _modifiedQueue contains a queue of all modified objects - // Each element in the queue "owns" a usage count, to ensure the - // element containing the pointed element remains in the cache. - // - std::deque _modifiedQueue; - - bool _savingThreadDone; - long _streamTimeout; - IceUtil::TimerPtr _timer; - - // - // Threads that have requested a "saveNow" and are waiting for - // its completion - // - std::deque _saveNowThreads; - - Ice::Int _saveSizeTrigger; - Ice::Int _maxTxSize; - IceUtil::Time _savePeriod; -}; - -} - -#endif diff --git a/cpp/src/Freeze/ConnectionI.cpp b/cpp/src/Freeze/ConnectionI.cpp deleted file mode 100644 index d6696239b3e..00000000000 --- a/cpp/src/Freeze/ConnectionI.cpp +++ /dev/null @@ -1,213 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include - -using namespace Ice; -using namespace Freeze; -using namespace std; - -Freeze::TransactionPtr -Freeze::ConnectionI::beginTransaction() -{ - return beginTransactionI(); -} - -Freeze::TransactionIPtr -Freeze::ConnectionI::beginTransactionI() -{ - if(_transaction) - { - throw TransactionAlreadyInProgressException(__FILE__, __LINE__); - } - closeAllIterators(); - _transaction = new TransactionI(this); - return _transaction; -} - -Freeze::TransactionPtr -Freeze::ConnectionI::currentTransaction() const -{ - return _transaction; -} - -void -Freeze::ConnectionI::removeMapIndex(const string& mapName, const string& indexName) -{ - if(_dbEnv == 0) - { - throw DatabaseException(__FILE__, __LINE__, "Closed connection"); - } - - string filename = mapName + "." + indexName; - - DbTxn* txn = dbTxn(); - try - { - _dbEnv->getEnv()->dbremove(txn, filename.c_str(), 0, txn != 0 ? 0 : DB_AUTO_COMMIT); - } - catch(const DbDeadlockException& dx) - { - throw DeadlockException(__FILE__, __LINE__, dx.what(), _transaction); - } - catch(const DbException& dx) - { - if(dx.get_errno() == ENOENT) - { - throw IndexNotFoundException(__FILE__, __LINE__, mapName, indexName); - } - else - { - throw DatabaseException(__FILE__, __LINE__, dx.what()); - } - } -} - - -void -Freeze::ConnectionI::close() -{ - if(_transaction) - { - _transaction->rollbackInternal(true); - assert(_transaction == 0); - } - - while(!_mapList.empty()) - { - (*_mapList.begin())->close(); - } - - _dbEnv = 0; -} - -CommunicatorPtr -Freeze::ConnectionI::getCommunicator() const -{ - return _communicator; -} - -EncodingVersion -Freeze::ConnectionI::getEncoding() const -{ - return _encoding; -} - -string -Freeze::ConnectionI::getName() const -{ - return _envName; -} - -void -Freeze::ConnectionI::__incRef() -{ - IceUtil::Mutex::Lock sync(_refCountMutex->mutex); - _refCount++; -} - - -void -Freeze::ConnectionI::__decRef() -{ - IceUtil::Mutex::Lock sync(_refCountMutex->mutex); - if(--_refCount == 0) - { - sync.release(); - delete this; - } - else if(_refCount == 1 && _transaction != 0 && _transaction->dbTxn() != 0 && _transaction->__getRefNoSync() == 1) - { - sync.release(); - if(_transaction) - { - // - // This makes the transaction release the last refcount on the connection - // - _transaction->rollbackInternal(true); - } - } -} - -int -Freeze::ConnectionI::__getRef() const -{ - IceUtil::Mutex::Lock sync(_refCountMutex->mutex); - return _refCount; -} - -int -Freeze::ConnectionI::__getRefNoSync() const -{ - return _refCount; -} - - -Freeze::ConnectionI::~ConnectionI() -{ - try - { - close(); - } - catch(const DatabaseException& ex) - { - Ice::Error error(_communicator->getLogger()); - error << "Freeze: closing connection Freeze.DbEnv: " << _envName << " raised DatabaseException: " << ex.what(); - } -} - -Freeze::ConnectionI::ConnectionI(const SharedDbEnvPtr& dbEnv) : - _communicator(dbEnv->getCommunicator()), - _encoding(dbEnv->getEncoding()), - _dbEnv(dbEnv), - _envName(dbEnv->getEnvName()), - _trace(_communicator->getProperties()->getPropertyAsInt("Freeze.Trace.Map")), - _txTrace(_communicator->getProperties()->getPropertyAsInt("Freeze.Trace.Transaction")), - _deadlockWarning(_communicator->getProperties()->getPropertyAsInt("Freeze.Warn.Deadlocks") > 0), - _refCountMutex(new SharedMutex), - _refCount(0) -{ -} - -void -Freeze::ConnectionI::closeAllIterators() -{ - for(list::iterator p = _mapList.begin(); p != _mapList.end(); - ++p) - { - (*p)->closeAllIterators(); - } -} - -void -Freeze::ConnectionI::registerMap(MapHelperI* m) -{ - _mapList.push_back(m); -} - -void -Freeze::ConnectionI::unregisterMap(MapHelperI* m) -{ - _mapList.remove(m); -} - -Freeze::ConnectionPtr -Freeze::createConnection(const CommunicatorPtr& communicator, const string& envName) -{ - - return new ConnectionI(SharedDbEnv::get(communicator, envName, 0)); -} - -Freeze::ConnectionPtr -Freeze::createConnection(const CommunicatorPtr& communicator, const string& envName, DbEnv& dbEnv) -{ - return new ConnectionI(SharedDbEnv::get(communicator, envName, &dbEnv)); -} diff --git a/cpp/src/Freeze/ConnectionI.h b/cpp/src/Freeze/ConnectionI.h deleted file mode 100644 index 97578e99efe..00000000000 --- a/cpp/src/Freeze/ConnectionI.h +++ /dev/null @@ -1,172 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_CONNECTIONI_H -#define FREEZE_CONNECTIONI_H - -#include -#include -#include -#include -#include - -namespace Freeze -{ - -class MapHelperI; - -// -// A mutex shared by a connection and all its transactions -// (for refcounting thread-safety) -// -struct SharedMutex : public IceUtil::Shared -{ - IceUtil::Mutex mutex; -}; -typedef IceUtil::Handle SharedMutexPtr; - - -class ConnectionI : public Connection -{ -public: - - virtual TransactionPtr beginTransaction(); - - virtual TransactionPtr currentTransaction() const; - - virtual void removeMapIndex(const std::string&, const std::string&); - - virtual void close(); - - virtual Ice::CommunicatorPtr getCommunicator() const; - - virtual Ice::EncodingVersion getEncoding() const; - - virtual std::string getName() const; - - // - // Custom refcounting implementation - // - virtual void __incRef(); - virtual void __decRef(); - virtual int __getRef() const; - - virtual ~ConnectionI(); - - ConnectionI(const SharedDbEnvPtr&); - - TransactionIPtr beginTransactionI(); - - void closeAllIterators(); - - void registerMap(MapHelperI*); - - void unregisterMap(MapHelperI*); - - void clearTransaction(); - - DbTxn* dbTxn() const; - - const SharedDbEnvPtr& dbEnv() const; - - const Ice::CommunicatorPtr& communicator() const; - const Ice::EncodingVersion& encoding() const; - - const std::string& envName() const; - - Ice::Int trace() const; - - Ice::Int txTrace() const; - - bool deadlockWarning() const; - -private: - - friend class TransactionI; - - int __getRefNoSync() const; - - const Ice::CommunicatorPtr _communicator; - const Ice::EncodingVersion _encoding; - SharedDbEnvPtr _dbEnv; - const std::string _envName; - TransactionIPtr _transaction; - std::list _mapList; - const Ice::Int _trace; - const Ice::Int _txTrace; - const bool _deadlockWarning; - SharedMutexPtr _refCountMutex; - int _refCount; -}; -typedef IceUtil::Handle ConnectionIPtr; - -inline void -ConnectionI::clearTransaction() -{ - _transaction = 0; -} - -inline DbTxn* -ConnectionI::dbTxn() const -{ - if(!_transaction) - { - return 0; - } - else - { - return _transaction->dbTxn(); - } -} - -inline const SharedDbEnvPtr& -ConnectionI::dbEnv() const -{ - return _dbEnv; -} - -inline const std::string& -ConnectionI::envName() const -{ - return _envName; -} - -inline const Ice::CommunicatorPtr& -ConnectionI::communicator() const -{ - return _communicator; -} - -inline const Ice::EncodingVersion& -ConnectionI::encoding() const -{ - return _encoding; -} - -inline Ice::Int -ConnectionI::trace() const -{ - return _trace; -} - -inline Ice::Int -ConnectionI::txTrace() const -{ - return _txTrace; -} - -inline bool -ConnectionI::deadlockWarning() const -{ - return _deadlockWarning; -} - -} - -#endif diff --git a/cpp/src/Freeze/EvictorI.cpp b/cpp/src/Freeze/EvictorI.cpp deleted file mode 100644 index 978999a1356..00000000000 --- a/cpp/src/Freeze/EvictorI.cpp +++ /dev/null @@ -1,365 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include - -#include - -#include - -#include - -using namespace std; -using namespace Freeze; -using namespace Ice; -using namespace IceUtil; - -// -// Static members -// - -string Freeze::EvictorIBase::defaultDb = "$default"; -string Freeze::EvictorIBase::indexPrefix = "$index:"; - - -// -// DeactivateController -// - -Freeze::DeactivateController::Guard::Guard(const DeactivateController& controller) : - _controller(const_cast(controller)) -{ - Lock sync(controller); - if(controller._deactivated || _controller._deactivating) - { - throw EvictorDeactivatedException(__FILE__, __LINE__); - } - _controller._guardCount++; -} - -Freeze::DeactivateController::Guard::~Guard() -{ - Lock sync(_controller); - _controller._guardCount--; - if(_controller._deactivating && _controller._guardCount == 0) - { - // - // Notify all the threads -- although we only want to - // reach the thread doing the deactivation. - // - _controller.notifyAll(); - } -} - -Freeze::DeactivateController::DeactivateController(EvictorIBase* evictor) : - _evictor(evictor), - _deactivating(false), - _deactivated(false), - _guardCount(0) -{ -} - -bool -Freeze::DeactivateController::deactivated() const -{ - Lock sync(*this); - return _deactivated || _deactivating; -} - -bool -Freeze::DeactivateController::deactivate() -{ - Lock sync(*this); - - if(_deactivated) - { - return false; - } - - if(_deactivating) - { - // - // Wait for deactivated - // - while(!_deactivated) - { - wait(); - } - return false; - } - else - { - _deactivating = true; - while(_guardCount > 0) - { - if(_evictor->trace() >= 1) - { - Trace out(_evictor->communicator()->getLogger(), "Freeze.Evictor"); - out << "Waiting for " << _guardCount << " threads to complete before starting deactivation."; - } - - wait(); - } - - if(_evictor->trace() >= 1) - { - Trace out(_evictor->communicator()->getLogger(), "Freeze.Evictor"); - out << "Starting deactivation."; - } - return true; - } -} - -void -Freeze::DeactivateController::deactivationComplete() -{ - if(_evictor->trace() >= 1) - { - Trace out(_evictor->communicator()->getLogger(), "Freeze.Evictor"); - out << "Deactivation complete."; - } - - Lock sync(*this); - _deactivated = true; - _deactivating = false; - notifyAll(); -} - - -// -// EvictorIBase -// - -Freeze::EvictorIBase::EvictorIBase(const ObjectAdapterPtr& adapter, - const string& envName, - DbEnv* dbEnv, - const string& filename, - const FacetTypeMap& facetTypes, - const ServantInitializerPtr& initializer, - bool createDb) : - _evictorSize(10), - _facetTypes(facetTypes), - _deactivateController(this), - _adapter(adapter), - _communicator(adapter->getCommunicator()), - _initializer(initializer), - _dbEnv(SharedDbEnv::get(_communicator, envName, dbEnv)), - _filename(filename), - _createDb(createDb), - _trace(0), - _txTrace(0), - _pingObject(new PingObject) -{ - _encoding = _dbEnv->getEncoding(); - - _trace = _communicator->getProperties()->getPropertyAsInt("Freeze.Trace.Evictor"); - _txTrace = _communicator->getProperties()->getPropertyAsInt("Freeze.Trace.Transaction"); - _deadlockWarning = (_communicator->getProperties()->getPropertyAsInt("Freeze.Warn.Deadlocks") > 0); -} - - -void -Freeze::EvictorIBase::setSize(Int evictorSize) -{ - DeactivateController::Guard deactivateGuard(_deactivateController); - - Lock sync(*this); - - // - // Ignore requests to set the evictor size to values smaller than zero. - // - if(evictorSize < 0) - { - return; - } - - // - // Update the evictor size. - // - _evictorSize = static_cast(evictorSize); - - // - // Evict as many elements as necessary. - // - evict(); -} - -Int -Freeze::EvictorIBase::getSize() -{ - Lock sync(*this); - return static_cast(_evictorSize); -} - - -Ice::ObjectPrx -Freeze::EvictorIBase::add(const ObjectPtr& servant, const Identity& ident) -{ - return addFacet(servant, ident, ""); -} - -Ice::ObjectPtr -Freeze::EvictorIBase::remove(const Identity& ident) -{ - return removeFacet(ident, ""); -} - -bool -Freeze::EvictorIBase::hasObject(const Identity& ident) -{ - return hasFacet(ident, ""); -} - -ObjectPtr -Freeze::EvictorIBase::locate(const Current& current, LocalObjectPtr& cookie) -{ - // - // Special ice_ping() handling - // - if(current.operation == "ice_ping") - { - if(hasFacet(current.id, current.facet)) - { - if(_trace >= 3) - { - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "ice_ping found \"" << _communicator->identityToString(current.id) - << "\" with facet \"" << current.facet + "\""; - } - - cookie = 0; - return _pingObject; - } - else if(hasAnotherFacet(current.id, current.facet)) - { - if(_trace >= 3) - { - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "ice_ping raises FacetNotExistException for \"" << _communicator->identityToString(current.id) - << "\" with facet \"" << current.facet + "\""; - } - throw FacetNotExistException(__FILE__, __LINE__); - } - else - { - if(_trace >= 3) - { - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "ice_ping will raise ObjectNotExistException for \"" - << _communicator->identityToString(current.id) << "\" with facet \"" << current.facet + "\""; - } - return 0; - } - } - - ObjectPtr result = locateImpl(current, cookie); - - if(result == 0) - { - if(hasAnotherFacet(current.id, current.facet)) - { - throw FacetNotExistException(__FILE__, __LINE__); - } - } - return result; -} - - -void -Freeze::EvictorIBase::initialize(const Identity& ident, const string& facet, const ObjectPtr& servant) -{ - if(_initializer != 0) - { - _initializer->initialize(_adapter, ident, facet, servant); - } -} - -void -Freeze::EvictorIBase::updateStats(Statistics& stats, IceUtil::Int64 time) -{ - IceUtil::Int64 diff = time - (stats.creationTime + stats.lastSaveTime); - if(stats.lastSaveTime == 0) - { - stats.lastSaveTime = diff; - stats.avgSaveTime = diff; - } - else - { - stats.lastSaveTime = time - stats.creationTime; - stats.avgSaveTime = static_cast(stats.avgSaveTime * 0.95 + diff * 0.05); - } -} - - -const string& -Freeze::EvictorIBase::filename() const -{ - return _filename; -} - -vector -Freeze::EvictorIBase::allDbs() const -{ - vector result; - - try - { - Db db(_dbEnv->getEnv(), 0); - - // - // Berkeley DB expects file paths to be UTF8 encoded. - // - db.open(0, nativeToUTF8(_filename, IceUtil::getProcessStringConverter()).c_str(), 0, DB_UNKNOWN, - DB_RDONLY, 0); - - Dbc* dbc = 0; - db.cursor(0, &dbc, 0); - - Dbt dbKey; - dbKey.set_flags(DB_DBT_MALLOC); - - Dbt dbValue; - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - bool more = true; - while(more) - { - more = (dbc->get(&dbKey, &dbValue, DB_NEXT) == 0); - if(more) - { - string dbName(static_cast(dbKey.get_data()), dbKey.get_size()); - - if(dbName.find(indexPrefix) != 0) - { - result.push_back(dbName); - } - free(dbKey.get_data()); - } - } - - dbc->close(); - db.close(0); - } - catch(const DbException& dx) - { - if(dx.get_errno() != ENOENT) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - } - - return result; -} - diff --git a/cpp/src/Freeze/EvictorI.h b/cpp/src/Freeze/EvictorI.h deleted file mode 100644 index 163cad210f0..00000000000 --- a/cpp/src/Freeze/EvictorI.h +++ /dev/null @@ -1,355 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_EVICTOR_I_H -#define FREEZE_EVICTOR_I_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class DbTxn; - -namespace Freeze -{ - -class EvictorIBase; - -// -// Helper class to prevent deactivation while the Evictor is in use -// -class DeactivateController : private IceUtil::Monitor -{ -public: - - // - // Prevents deactivation; the constructor raises - // EvictorDeactivatedException if _deactivated or _deactivating is true. - // - class Guard - { - public: - Guard(const DeactivateController&); - ~Guard(); - - private: - DeactivateController& _controller; - }; - - DeactivateController(EvictorIBase*); - - // - // Used mostly in asserts - // - bool deactivated() const; - - // - // Returns true if this thread is supposed to do the deactivation and - // call deactivationComplete() once done. - // - bool deactivate(); - - void deactivationComplete(); - -private: - - friend class Guard; - - EvictorIBase* _evictor; - bool _deactivating; - bool _deactivated; - int _guardCount; -}; - - -class EvictorIBase : public virtual Evictor, public IceUtil::Monitor -{ -public: - - virtual TransactionIPtr beforeQuery() = 0; - - virtual void setSize(Ice::Int); - virtual Ice::Int getSize(); - - virtual Ice::ObjectPrx add(const Ice::ObjectPtr&, const Ice::Identity&); - virtual Ice::ObjectPtr remove(const Ice::Identity&); - - virtual bool hasObject(const Ice::Identity&); - - virtual Ice::ObjectPtr locate(const Ice::Current&, Ice::LocalObjectPtr&); - - DeactivateController& deactivateController(); - const Ice::CommunicatorPtr& communicator() const; - const Ice::EncodingVersion& encoding() const; - const SharedDbEnvPtr& dbEnv() const; - const std::string& filename() const; - - bool deadlockWarning() const; - Ice::Int trace() const; - Ice::Int txTrace() const; - - void initialize(const Ice::Identity&, const std::string&, const Ice::ObjectPtr&); - - - static void updateStats(Statistics&, IceUtil::Int64); - - static std::string defaultDb; - static std::string indexPrefix; - -protected: - - EvictorIBase(const Ice::ObjectAdapterPtr&, const std::string&, DbEnv*, const std::string&, - const FacetTypeMap&, const ServantInitializerPtr&, bool); - - - virtual bool hasAnotherFacet(const Ice::Identity&, const std::string&) = 0; - - virtual Ice::ObjectPtr locateImpl(const Ice::Current&, Ice::LocalObjectPtr&) = 0; - - virtual void evict() = 0; - - std::vector allDbs() const; - - size_t _evictorSize; - - FacetTypeMap _facetTypes; - - DeactivateController _deactivateController; - - Ice::ObjectAdapterPtr _adapter; - Ice::CommunicatorPtr _communicator; - Ice::EncodingVersion _encoding; - - ServantInitializerPtr _initializer; - - SharedDbEnvPtr _dbEnv; - - std::string _filename; - bool _createDb; - - Ice::Int _trace; - Ice::Int _txTrace; - - bool _deadlockWarning; - -private: - - Ice::ObjectPtr _pingObject; -}; - -typedef IceUtil::Handle EvictorIBasePtr; - - -template -class EvictorI : public EvictorIBase -{ -public: - - virtual EvictorIteratorPtr - getIterator(const std::string& facet, Ice::Int batchSize) - { - DeactivateController::Guard deactivateGuard(_deactivateController); - - TransactionIPtr tx = beforeQuery(); - return new EvictorIteratorI(findStore(facet, false), tx, batchSize); - } - -protected: - - EvictorI(const Ice::ObjectAdapterPtr& adapter, const std::string& envName, DbEnv* dbEnv, - const std::string& filename, const FacetTypeMap& facetTypes, - const ServantInitializerPtr& initializer, const std::vector& indices, bool createDb) : - EvictorIBase(adapter, envName, dbEnv, filename, facetTypes, initializer, createDb) - { - std::string propertyPrefix = std::string("Freeze.Evictor.") + envName + '.' + filename; - bool populateEmptyIndices = - (_communicator->getProperties()-> - getPropertyAsIntWithDefault(propertyPrefix + ".PopulateEmptyIndices", 0) != 0); - - // - // Instantiate all Dbs in 2 steps: - // (1) iterate over the indices and create ObjectStore with indices - // (2) open ObjectStores without indices - // - std::vector dbs = allDbs(); - - // - // Add default db in case it's not there - // - dbs.push_back(defaultDb); - - for(std::vector::const_iterator i = indices.begin(); i != indices.end(); ++i) - { - std::string facet = (*i)->facet(); - - typename StoreMap::iterator q = _storeMap.find(facet); - if(q == _storeMap.end()) - { - // - // New db - // - std::vector storeIndices; - - for(std::vector::const_iterator r = i; r != indices.end(); ++r) - { - if((*r)->facet() == facet) - { - storeIndices.push_back(*r); - } - } - std::string facetType; - FacetTypeMap::const_iterator ft = facetTypes.find(facet); - if(ft != facetTypes.end()) - { - facetType = ft->second; - } - ObjectStore* store = new ObjectStore(facet, facetType,_createDb, this, storeIndices, populateEmptyIndices); - _storeMap.insert(typename StoreMap::value_type(facet, store)); - } - } - - for(std::vector::iterator p = dbs.begin(); p != dbs.end(); ++p) - { - std::string facet = *p; - if(facet == defaultDb) - { - facet = ""; - } -#if (defined(_MSC_VER) && (_MSC_VER >= 1600)) - std::pair ir = - _storeMap.insert(typename StoreMap::value_type(facet, static_cast*>(nullptr))); -#else - std::pair ir = - _storeMap.insert(typename StoreMap::value_type(facet, 0)); -#endif - - if(ir.second) - { - std::string facetType; - FacetTypeMap::const_iterator ft = facetTypes.find(facet); - if(ft != facetTypes.end()) - { - facetType = ft->second; - } - - ir.first->second = new ObjectStore(facet, facetType, _createDb, this); - } - } - } - - ObjectStore* - findStore(const std::string& facet, bool createIt) - { - Lock sync(*this); - ObjectStore* os = 0; - - typename StoreMap::const_iterator p = _storeMap.find(facet); - if(p != _storeMap.end()) - { - os = (*p).second; - } - else if(createIt) - { - std::string facetType; - typename FacetTypeMap::const_iterator q = _facetTypes.find(facet); - if(q != _facetTypes.end()) - { - facetType = q->second; - } - os = new ObjectStore(facet, facetType, true, this); - _storeMap.insert(typename StoreMap::value_type(facet, os)); - } - return os; - } - - void - closeDbEnv() - { - for(typename StoreMap::iterator p = _storeMap.begin(); p != _storeMap.end(); ++p) - { - delete (*p).second; - } - - _dbEnv = 0; - _initializer = 0; - } - - typedef std::map*> StoreMap; - StoreMap _storeMap; -}; - - -inline DeactivateController& -EvictorIBase::deactivateController() -{ - return _deactivateController; -} - -inline const Ice::CommunicatorPtr& -EvictorIBase::communicator() const -{ - return _communicator; -} - -inline const Ice::EncodingVersion& -EvictorIBase::encoding() const -{ - return _encoding; -} - -inline const SharedDbEnvPtr& -EvictorIBase::dbEnv() const -{ - return _dbEnv; -} - -inline bool -EvictorIBase::deadlockWarning() const -{ - return _deadlockWarning; -} - -inline Ice::Int -EvictorIBase::trace() const -{ - return _trace; -} - -// -// Helper function -// -inline void -checkIdentity(const Ice::Identity& ident) -{ - if(ident.name.size() == 0) - { - throw Ice::IllegalIdentityException(__FILE__, __LINE__, ident); - } -} - -inline void -checkServant(const Ice::ObjectPtr& servant) -{ - if(servant == 0) - { - throw Ice::IllegalServantException(__FILE__, __LINE__, "cannot add null servant to Freeze Evictor"); - } -} - -} - -#endif diff --git a/cpp/src/Freeze/EvictorIteratorI.cpp b/cpp/src/Freeze/EvictorIteratorI.cpp deleted file mode 100644 index 367f214f4ac..00000000000 --- a/cpp/src/Freeze/EvictorIteratorI.cpp +++ /dev/null @@ -1,238 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include - -using namespace std; -using namespace Freeze; -using namespace Ice; - - -Freeze::EvictorIteratorI::EvictorIteratorI(ObjectStoreBase* store, const TransactionIPtr& tx, Int batchSize) : - _store(store), - _batchSize(static_cast(batchSize)), - _key(1024), - _more(store != 0), - _initialized(false), - _tx(tx) -{ - _batchIterator = _batch.end(); -} - - -bool -Freeze::EvictorIteratorI::hasNext() -{ - if(_batchIterator != _batch.end()) - { - return true; - } - else - { - _batchIterator = nextBatch(); - return (_batchIterator != _batch.end()); - } -} - -Identity -Freeze::EvictorIteratorI::next() -{ - if(hasNext()) - { - return *_batchIterator++; - } - else - { - throw Freeze::NoSuchElementException(__FILE__, __LINE__); - } -} - - -vector::const_iterator -Freeze::EvictorIteratorI::nextBatch() -{ - _batch.clear(); - - if(!_more) - { - return _batch.end(); - } - - DeactivateController::Guard - deactivateGuard(_store->evictor()->deactivateController()); - - Key firstKey = _key; - - const CommunicatorPtr& communicator = _store->communicator(); - const EncodingVersion& encoding = _store->encoding(); - - DbTxn* txn = _tx == 0 ? 0: _tx->dbTxn(); - - try - { - for(;;) - { - _batch.clear(); - - Dbt dbKey; - initializeOutDbt(_key, dbKey); - - Dbt dbValue; - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - Dbc* dbc = 0; - try - { - // - // Move to the first record - // - u_int32_t flags = DB_NEXT; - - if(_initialized) - { - // - // _key represents the next element not yet returned - // if it has been deleted, we want the one after - // - flags = DB_SET_RANGE; - - // - // Will be used as input as well - // - dbKey.set_size(static_cast(firstKey.size())); - } - - _store->db()->cursor(txn, &dbc, 0); - - bool done = false; - do - { - for(;;) - { - try - { - // - // It is critical to set key size to key capacity before the - // get, as a resize that increases the size inserts 0 - // - _key.resize(_key.capacity()); - - _more = (dbc->get(&dbKey, &dbValue, flags) == 0); - if(_more) - { - _key.resize(dbKey.get_size()); - _initialized = true; - - flags = DB_NEXT; - - Ice::Identity ident; - ObjectStoreBase::unmarshal(ident, _key, communicator, encoding); - if(_batch.size() < _batchSize) - { - _batch.push_back(ident); - } - else - { - // - // Keep the last element in _key - // - done = true; - } - } - break; - } - catch(const DbDeadlockException&) - { - throw; - } - catch(const DbException& dx) - { - handleDbException(dx, _key, dbKey, __FILE__, __LINE__); - } - } - } - while(!done && _more); - - Dbc* toClose = dbc; - dbc = 0; - toClose->close(); - break; // for (;;) - } - catch(const DbDeadlockException&) - { - if(dbc != 0) - { - try - { - dbc->close(); - } - catch(const DbDeadlockException&) - { - if(_tx != 0) - { - throw; - } - // Else, ignored - } - } - - if(_tx == 0) - { - _key = firstKey; - // - // Retry - // - } - else - { - throw; - } - } - catch(...) - { - if(dbc != 0) - { - try - { - dbc->close(); - } - catch(const DbDeadlockException&) - { - if(_tx != 0) - { - throw; - } - // Else, ignored - } - } - throw; - } - } - } - catch(const DbDeadlockException& dx) - { - throw DeadlockException(__FILE__, __LINE__, dx.what(), _tx); - } - catch(const DbException& dx) - { - handleDbException(dx, __FILE__, __LINE__); - } - - if(_batch.size() == 0) - { - return _batch.end(); - } - else - { - return _batch.begin(); - } -} diff --git a/cpp/src/Freeze/EvictorIteratorI.h b/cpp/src/Freeze/EvictorIteratorI.h deleted file mode 100644 index d2fdb2c76e9..00000000000 --- a/cpp/src/Freeze/EvictorIteratorI.h +++ /dev/null @@ -1,53 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_EVICTOR_ITERATOR_I_H -#define FREEZE_EVICTOR_ITERATOR_I_H - -#include -#include -#include - -namespace Freeze -{ - -class TransactionI; -typedef IceUtil::Handle TransactionIPtr; - - -class ObjectStoreBase; - -class EvictorIteratorI : public EvictorIterator -{ -public: - - EvictorIteratorI(ObjectStoreBase*, const TransactionIPtr&, Ice::Int); - - virtual bool hasNext(); - virtual Ice::Identity next(); - -private: - - std::vector::const_iterator - nextBatch(); - - ObjectStoreBase* _store; - size_t _batchSize; - std::vector::const_iterator _batchIterator; - - Key _key; - std::vector _batch; - bool _more; - bool _initialized; - TransactionIPtr _tx; -}; - -} - -#endif diff --git a/cpp/src/Freeze/Freeze.rc b/cpp/src/Freeze/Freeze.rc deleted file mode 100644 index d099a2ef437..00000000000 --- a/cpp/src/Freeze/Freeze.rc +++ /dev/null @@ -1,38 +0,0 @@ -#include "winver.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,7,0,0 - PRODUCTVERSION 3,7,0,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG - #define INTERNALNAME "freeze37d\0" - #define ORIGINALFILENAME "freeze37d.dll\0" -#else - FILEFLAGS 0x0L - #define INTERNALNAME "freeze37\0" - #define ORIGINALFILENAME "freeze37.dll\0" -#endif - FILEOS 0x4L - FILETYPE VFT_DLL - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "ZeroC, Inc.\0" - VALUE "FileDescription", "Freeze C++ Library\0" - VALUE "FileVersion", "3.7.0\0" - VALUE "InternalName", INTERNALNAME - VALUE "LegalCopyright", "\251 2003-2015 ZeroC, Inc.\0" - VALUE "OriginalFilename", ORIGINALFILENAME - VALUE "ProductName", "Ice\0" - VALUE "ProductVersion", "3.7.0\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END diff --git a/cpp/src/Freeze/Index.cpp b/cpp/src/Freeze/Index.cpp deleted file mode 100644 index 8ad17f584d8..00000000000 --- a/cpp/src/Freeze/Index.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include - -using namespace Freeze; -using namespace Ice; -using namespace std; - -Freeze::Index::~Index() -{ - delete _impl; -} - -Freeze::Index::Index(const string& name, const string& facet) : - _name(name), - _facet(facet), - _impl(new IndexI(*this)) -{ -} - -const string& -Freeze::Index::name() const -{ - return _name; -} - -const string& -Freeze::Index::facet() const -{ - return _facet; -} - -vector -Freeze::Index::untypedFindFirst(const Key& bytes, Int firstN) const -{ - return _impl->untypedFindFirst(bytes, firstN); -} - -vector -Freeze::Index::untypedFind(const Key& bytes) const -{ - return _impl->untypedFind(bytes); -} - -Int -Freeze::Index::untypedCount(const Key& bytes) const -{ - return _impl->untypedCount(bytes); -} diff --git a/cpp/src/Freeze/IndexI.cpp b/cpp/src/Freeze/IndexI.cpp deleted file mode 100644 index 3b9688251d3..00000000000 --- a/cpp/src/Freeze/IndexI.cpp +++ /dev/null @@ -1,447 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include - -#include - -using namespace Freeze; -using namespace Ice; -using namespace std; - - -static int -callback(Db* secondary, const Dbt* key, const Dbt* value, Dbt* result) -{ - void* indexObj = secondary->get_app_private(); - IndexI* index = static_cast(indexObj); - assert(index != 0); - return index->secondaryKeyCreate(secondary, key, value, result); -} - - -Freeze::IndexI::IndexI(Index& index) : - _index(index), - _store(0) -{ -} - -vector -Freeze::IndexI::untypedFindFirst(const Key& bytes, Int firstN) const -{ - DeactivateController::Guard - deactivateGuard(_store->evictor()->deactivateController()); - - Dbt dbKey; - initializeInDbt(bytes, dbKey); -#if (DB_VERSION_MAJOR <= 4) || (DB_VERSION_MAJOR == 5 && DB_VERSION_MINOR <= 1) - // - // When we have a custom-comparison function, Berkeley DB returns - // the key on-disk (when it finds one). We disable this behavior: - // (ref Oracle SR 5925672.992) - // - dbKey.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); -#else - // - // In DB > 5.1 we can not set DB_DBT_PARTIAL in the key Dbt, - // when using DB_SET, we must resize the Dbt key param to hold enought - // space or Dbc::get fails with DB_BUFFER_SMALL. - // - dbKey.set_flags(DB_DBT_USERMEM); - dbKey.set_ulen(static_cast(bytes.size())); -#endif - - Key pkey(1024); - Dbt pdbKey; - initializeOutDbt(pkey, pdbKey); - - Dbt dbValue; - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - const Ice::CommunicatorPtr& communicator = _store->communicator(); - const Ice::EncodingVersion& encoding = _store->encoding(); - - TransactionIPtr transaction = _store->evictor()->beforeQuery(); - DbTxn* tx = transaction == 0 ? 0 : transaction->dbTxn(); - - vector identities; - - try - { - for(;;) - { - Dbc* dbc = 0; - identities.clear(); - - try - { - // - // Move to the first record - // - _db->cursor(tx, &dbc, 0); - u_int32_t flags = DB_SET; - - bool found; - - do - { - for(;;) - { - try - { - // - // It is critical to set key size to key capacity before the - // get, as a resize that increases the size inserts 0 - // - pkey.resize(pkey.capacity()); - - found = (dbc->pget(&dbKey, &pdbKey, &dbValue, flags) == 0); - if(found) - { - pkey.resize(pdbKey.get_size()); - - Ice::Identity ident; - ObjectStoreBase::unmarshal(ident, pkey, communicator, encoding); - identities.push_back(ident); - flags = DB_NEXT_DUP; - } - break; // for(;;) - } - catch(const DbDeadlockException&) - { - throw; - } - catch(const DbException& dx) - { - handleDbException(dx, pkey, pdbKey, __FILE__, __LINE__); - } - } - } - while((firstN <= 0 || identities.size() < static_cast(firstN)) && found); - - Dbc* toClose = dbc; - dbc = 0; - toClose->close(); - break; // for (;;) - } - catch(const DbDeadlockException&) - { - if(dbc != 0) - { - try - { - dbc->close(); - } - catch(const DbDeadlockException&) - { - if(tx != 0) - { - throw; - } - // Else ignored - } - } - - if(_store->evictor()->deadlockWarning()) - { - Warning out(_store->communicator()->getLogger()); - out << "Deadlock in Freeze::IndexI::untypedFindFirst while searching \"" - << _store->evictor()->filename() + "/" + _dbName << "\"; retrying ..."; - } - - if(tx != 0) - { - throw; - } - // Else retry - } - catch(...) - { - if(dbc != 0) - { - try - { - dbc->close(); - } - catch(const DbDeadlockException&) - { - if(tx != 0) - { - throw; - } - // Else ignored - } - } - throw; - } - } - } - catch(const DbDeadlockException& dx) - { - throw DeadlockException(__FILE__, __LINE__, dx.what(), transaction); - } - catch(const DbException& dx) - { - handleDbException(dx, __FILE__, __LINE__); - } - - return identities; -} - -vector -Freeze::IndexI::untypedFind(const Key& bytes) const -{ - return untypedFindFirst(bytes, 0); -} - -Int -Freeze::IndexI::untypedCount(const Key& bytes) const -{ - DeactivateController::Guard - deactivateGuard(_store->evictor()->deactivateController()); - - Dbt dbKey; - initializeInDbt(bytes, dbKey); -#if (DB_VERSION_MAJOR <= 4) || (DB_VERSION_MAJOR == 5 && DB_VERSION_MINOR <= 1) - // - // When we have a custom-comparison function, Berkeley DB returns - // the key on-disk (when it finds one). We disable this behavior: - // (ref Oracle SR 5925672.992) - // - dbKey.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); -#else - // - // In DB > 5.1 we can not set DB_DBT_PARTIAL in the key Dbt, - // when using DB_SET, we must resize the Dbt key param to hold enought - // space or Dbc::get fails with DB_BUFFER_SMALL. - // - dbKey.set_flags(DB_DBT_USERMEM); - dbKey.set_ulen(static_cast(bytes.size())); -#endif - - Dbt dbValue; - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - TransactionIPtr transaction = _store->evictor()->beforeQuery(); - DbTxn* tx = transaction == 0 ? 0 : transaction->dbTxn(); - - Int result = 0; - - try - { - for(;;) - { - Dbc* dbc = 0; - - try - { - // - // Move to the first record - // - _db->cursor(tx, &dbc, 0); - bool found = (dbc->get(&dbKey, &dbValue, DB_SET) == 0); - - if(found) - { - db_recno_t count = 0; - dbc->count(&count, 0); - result = static_cast(count); - } - - Dbc* toClose = dbc; - dbc = 0; - toClose->close(); - break; // for (;;) - } - catch(const DbDeadlockException&) - { - if(dbc != 0) - { - try - { - dbc->close(); - } - catch(const DbDeadlockException&) - { - if(tx != 0) - { - throw; - } - // Else ignored - } - } - - if(_store->evictor()->deadlockWarning()) - { - Warning out(_store->communicator()->getLogger()); - out << "Deadlock in Freeze::IndexI::untypedCount while searching \"" - << _store->evictor()->filename() + "/" + _dbName << "\"; retrying ..."; - } - - if(tx != 0) - { - throw; - } - // Else retry - - } - catch(...) - { - if(dbc != 0) - { - try - { - dbc->close(); - } - catch(const DbDeadlockException&) - { - if(tx != 0) - { - throw; - } - // Else ignored - } - } - throw; - } - } - } - catch(const DbDeadlockException& dx) - { - throw DeadlockException(__FILE__, __LINE__, dx.what(), transaction); - } - catch(const DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - - return result; -} - -void -Freeze::IndexI::associate(ObjectStoreBase* store, DbTxn* txn, - bool createDb, bool populateIndex) -{ - assert(txn != 0); - _store = store; - _index._communicator = store->communicator(); - _index._encoding = store->encoding(); - - _db.reset(new Db(store->evictor()->dbEnv()->getEnv(), 0)); - _db->set_flags(DB_DUP | DB_DUPSORT); - _db->set_app_private(this); - - _dbName = EvictorIBase::indexPrefix + store->dbName() + "." + _index.name(); - - Ice::PropertiesPtr properties = store->communicator()->getProperties(); - string propPrefix = "Freeze.Evictor." + store->evictor()->filename() + "."; - - int btreeMinKey = properties->getPropertyAsInt(propPrefix + _dbName + ".BtreeMinKey"); - if(btreeMinKey > 2) - { - if(store->evictor()->trace() >= 1) - { - Trace out(store->evictor()->communicator()->getLogger(), "Freeze.Evictor"); - out << "Setting \"" << store->evictor()->filename() + "." + _dbName << "\"'s btree minkey to " << btreeMinKey; - } - _db->set_bt_minkey(btreeMinKey); - } - - bool checksum = properties->getPropertyAsInt(propPrefix + "Checksum") > 0; - if(checksum) - { - // - // No tracing on purpose - // - - _db->set_flags(DB_CHKSUM); - } - - // - // pagesize can't change - // - - u_int32_t flags = 0; - if(createDb) - { - flags = DB_CREATE; - } - - // - // - // Berkeley DB expects file paths to be UTF8 encoded. We keep - // _dbName as a native string here, while it might have - // been better to convert it to UTF-8, changing this isn't - // possible without potentially breaking backward compatibility - // with deployed databases. - // - _db->open(txn, - IceUtil::nativeToUTF8(store->evictor()->filename(), IceUtil::getProcessStringConverter()).c_str(), - _dbName.c_str(), DB_BTREE, flags, FREEZE_DB_MODE); - - flags = 0; - if(populateIndex) - { - flags = DB_CREATE; - } - store->db()->associate(txn, _db.get(), callback, flags); -} - -int -Freeze::IndexI::secondaryKeyCreate(Db* /*secondary*/, const Dbt* /*dbKey*/, - const Dbt* dbValue, Dbt* result) -{ - const Ice::CommunicatorPtr& communicator = _store->communicator(); - const Ice::EncodingVersion& encoding = _store->encoding(); - - ObjectRecord rec; - Byte* first = static_cast(dbValue->get_data()); - Value value(first, first + dbValue->get_size()); - ObjectStoreBase::unmarshal(rec, value, communicator, encoding, _store->keepStats()); - - Key bytes; - if(_index.marshalKey(rec.servant, bytes)) - { - result->set_flags(DB_DBT_APPMALLOC); - void* data = malloc(bytes.size()); - memcpy(data, &bytes[0], bytes.size()); - result->set_data(data); - result->set_size(static_cast(bytes.size())); - return 0; - } - else - { - // - // Don't want to index this one - // - return DB_DONOTINDEX; - } -} - -void -Freeze::IndexI::close() -{ - if(_db.get() != 0) - { - try - { - _db->close(0); - } - catch(const DbException& dx) - { - throw DatabaseException(__FILE__, __LINE__, dx.what()); - } - _db.reset(0); - } -} diff --git a/cpp/src/Freeze/IndexI.h b/cpp/src/Freeze/IndexI.h deleted file mode 100644 index 42c55ba8101..00000000000 --- a/cpp/src/Freeze/IndexI.h +++ /dev/null @@ -1,53 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_INDEX_I_H -#define FREEZE_INDEX_I_H - -#include -#include -#include - -namespace Freeze -{ - -class ObjectStoreBase; - -class IndexI -{ -public: - - IndexI(Index&); - - std::vector untypedFindFirst(const Key&, Ice::Int) const; - - std::vector untypedFind(const Key&) const; - - Ice::Int untypedCount(const Key&) const; - - void - associate(ObjectStoreBase*, DbTxn*, bool, bool); - - int - secondaryKeyCreate(Db*, const Dbt*, const Dbt*, Dbt*); - - void - close(); - -private: - - Index& _index; - std::string _dbName; - IceUtil::UniquePtr _db; - ObjectStoreBase* _store; -}; - -} -#endif - diff --git a/cpp/src/Freeze/Makefile b/cpp/src/Freeze/Makefile deleted file mode 100644 index a1f0d151f28..00000000000 --- a/cpp/src/Freeze/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -# -# This copy of Ice is licensed to you under the terms described in the -# ICE_LICENSE file included in this distribution. -# -# ********************************************************************** - -top_srcdir = ../.. - -LIBFILENAME = $(call mklibfilename,Freeze,$(VERSION)) -SONAME = $(call mksoname,Freeze,$(SOVERSION)) -LIBNAME = $(call mklibname,Freeze) - -TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)$(cpp11libdirsuffix)/$(LIBNAME)) - -SLICE_OBJS = BackgroundSaveEvictor.o \ - CatalogData.o \ - Connection.o \ - ConnectionF.o \ - DB.o \ - Evictor.o \ - EvictorF.o \ - EvictorStorage.o \ - Exception.o \ - Transaction.o \ - TransactionalEvictor.o \ - PingObject.o - -OBJS = BackgroundSaveEvictorI.o \ - Catalog.o \ - CatalogIndexList.o \ - ConnectionI.o \ - EvictorI.o \ - EvictorIteratorI.o \ - Index.o \ - IndexI.o \ - MapDb.o \ - MapI.o \ - ObjectStore.o \ - SharedDbEnv.o \ - TransactionalEvictorContext.o \ - TransactionalEvictorI.o \ - TransactionHolder.o \ - TransactionI.o \ - Util.o \ - $(SLICE_OBJS) - -HDIR = $(headerdir)/Freeze -SDIR = $(slicedir)/Freeze - -include $(top_srcdir)/config/Make.rules - -CPPFLAGS := -I.. $(CPPFLAGS) -DFREEZE_API_EXPORTS $(DB_FLAGS) -SLICE2CPPFLAGS := --ice --include-dir Freeze --dll-export FREEZE_API $(SLICE2CPPFLAGS) -LINKWITH := $(BZIP2_RPATH_LINK) -lIce -lIceUtil $(DB_RPATH_LINK) $(DB_LIBS) - -# The slice2freeze rules are structured like this to avoid issues with -# parallel make. -$(HDIR)/Catalog.h: Catalog.cpp -Catalog.cpp: $(SDIR)/CatalogData.ice $(SLICE2FREEZE) $(SLICEPARSERLIB) - rm -f $(HDIR)/Catalog.h Catalog.cpp - $(SLICE2FREEZE) $(SLICE2CPPFLAGS) --dict Freeze::Catalog,string,Freeze::CatalogData \ - Catalog $(slicedir)/Freeze/CatalogData.ice - mv Catalog.h $(HDIR)/Catalog.h - -clean:: - -rm -f $(HDIR)/Catalog.h Catalog.cpp - -$(HDIR)/CatalogIndexList.h: CatalogIndexList.cpp -CatalogIndexList.cpp: $(slicedir)/Ice/BuiltinSequences.ice $(SLICE2FREEZE) $(SLICEPARSERLIB) - rm -f $(HDIR)/CatalogIndexList.h CatalogIndexList.cpp - $(SLICE2FREEZE) $(SLICE2CPPFLAGS) --dict Freeze::CatalogIndexList,string,Ice::StringSeq \ - CatalogIndexList ../../../slice/Ice/BuiltinSequences.ice - mv CatalogIndexList.h $(HDIR)/CatalogIndexList.h - -clean:: - -rm -f $(HDIR)/CatalogIndexList.h CatalogIndexList.cpp - -$(libdir)/$(LIBFILENAME): $(OBJS) - @mkdir -p $(dir $@) - rm -f $@ - $(call mkshlib,$@,$(SONAME),$(OBJS),$(LINKWITH)) - -$(libdir)/$(SONAME): $(libdir)/$(LIBFILENAME) - rm -f $@ - ln -s $(LIBFILENAME) $@ - -$(libdir)$(cpp11libdirsuffix)/$(LIBNAME): $(libdir)/$(SONAME) - @mkdir -p $(libdir)$(cpp11libdirsuffix) - rm -f $@ - ln -s $(cpp11sonamedir)$(SONAME) $@ - -install:: all - $(call installlib,$(DESTDIR)$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME)) diff --git a/cpp/src/Freeze/Makefile.mak b/cpp/src/Freeze/Makefile.mak deleted file mode 100644 index ebd62cc115e..00000000000 --- a/cpp/src/Freeze/Makefile.mak +++ /dev/null @@ -1,115 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -# -# This copy of Ice is licensed to you under the terms described in the -# ICE_LICENSE file included in this distribution. -# -# ********************************************************************** - -top_srcdir = ..\.. - -LIBNAME = $(top_srcdir)\lib\freeze$(LIBSUFFIX).lib -DLLNAME = $(top_srcdir)\bin\freeze$(SOVERSION)$(LIBSUFFIX)$(COMPSUFFIX).dll - -TARGETS = $(LIBNAME) $(DLLNAME) - -SLICE_OBJS = .\BackgroundSaveEvictor.obj \ - .\CatalogData.obj \ - .\Connection.obj \ - .\ConnectionF.obj \ - .\DB.obj \ - .\Evictor.obj \ - .\EvictorF.obj \ - .\EvictorStorage.obj \ - .\Exception.obj \ - .\Transaction.obj \ - .\TransactionalEvictor.obj \ - .\PingObject.obj - -OBJS = .\BackgroundSaveEvictorI.obj \ - .\Catalog.obj \ - .\CatalogIndexList.obj \ - .\ConnectionI.obj \ - .\EvictorI.obj \ - .\EvictorIteratorI.obj \ - .\Index.obj \ - .\IndexI.obj \ - .\MapDb.obj \ - .\MapI.obj \ - .\ObjectStore.obj \ - .\SharedDbEnv.obj \ - .\TransactionalEvictorContext.obj \ - .\TransactionalEvictorI.obj \ - .\TransactionHolder.obj \ - .\TransactionI.obj \ - .\Util.obj \ - $(SLICE_OBJS) - -HDIR = $(headerdir)\Freeze -SDIR = $(slicedir)\Freeze - -!include $(top_srcdir)/config/Make.rules.mak - -$(OBJS) : $(DB_NUPKG) - -CPPFLAGS = -I.. $(CPPFLAGS) -DFREEZE_API_EXPORTS -DWIN32_LEAN_AND_MEAN $(DB_CPPFLAGS) -SLICE2CPPFLAGS = --ice --include-dir Freeze --dll-export FREEZE_API $(SLICE2CPPFLAGS) -LINKWITH = $(LIBS) $(DB_LIBS) - -!if "$(GENERATE_PDB)" == "yes" -PDBFLAGS = /pdb:$(DLLNAME:.dll=.pdb) -!endif - -RES_FILE = Freeze.res - -$(LIBNAME): $(DLLNAME) - -$(DLLNAME): $(OBJS) Freeze.res - $(LINK) $(BASE):0x25000000 $(LD_DLLFLAGS) $(DB_LDFLAGS) $(PDBFLAGS) $(OBJS) $(PREOUT)$@ $(PRELIBS)$(LINKWITH) $(RES_FILE) - move $(DLLNAME:.dll=.lib) $(LIBNAME) - @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ - $(MT) -nologo -manifest $@.manifest -outputresource:$@;#2 && del /q $@.manifest - @if exist $(DLLNAME:.dll=.exp) del /q $(DLLNAME:.dll=.exp) - @if defined SIGN_CERTIFICATE echo ^ ^ ^ Signing $@ && \ - signtool sign /f "$(SIGN_CERTIFICATE)" /p $(SIGN_PASSWORD) /t $(SIGN_TIMESTAMPSERVER) $@ - -$(HDIR)/Catalog.h Catalog.cpp: $(SDIR)/CatalogData.ice "$(SLICE2FREEZE)" "$(SLICEPARSERLIB)" - del /q $(HDIR)\Catalog.h Catalog.cpp - "$(SLICE2FREEZE)" $(SLICE2CPPFLAGS) --dict Freeze::Catalog,string,Freeze::CatalogData \ - Catalog $(slicedir)/Freeze/CatalogData.ice - move Catalog.h $(HDIR) - -$(HDIR)/CatalogIndexList.h CatalogIndexList.cpp: $(slicedir)/Ice/BuiltinSequences.ice "$(SLICE2FREEZE)" $(SLICEPARSERLIB) - del /q $(HDIR)\CatalogIndexList.h CatalogIndexList.cpp - "$(SLICE2FREEZE)" $(SLICE2CPPFLAGS) --dict Freeze::CatalogIndexList,string,Ice::StringSeq \ - CatalogIndexList $(slicedir)/Ice/BuiltinSequences.ice - move CatalogIndexList.h $(HDIR) - -clean:: - -del /q Catalog.cpp $(HDIR)\Catalog.h - -del /q CatalogIndexList.cpp $(HDIR)\CatalogIndexList.h - -del /q DB.cpp $(HDIR)\DB.h - -del /q BackgroundSaveEvictor.cpp $(HDIR)\BackgroundSaveEvictor.h - -del /q CatalogData.cpp $(HDIR)\CatalogData.h - -del /q Connection.cpp $(HDIR)\Connection.h - -del /q ConnectionF.cpp $(HDIR)\ConnectionF.h - -del /q Exception.cpp $(HDIR)\Exception.h - -del /q EvictorF.cpp $(HDIR)\EvictorF.h - -del /q Evictor.cpp $(HDIR)\Evictor.h - -del /q EvictorStorage.cpp $(HDIR)\EvictorStorage.h - -del /q Transaction.cpp $(HDIR)\Transaction.h - -del /q TransactionalEvictor.cpp $(HDIR)\TransactionalEvictor.h - -del /q PingObject.cpp PingObject.h - -del /q Freeze.res - -install:: all - copy $(LIBNAME) "$(install_libdir)" - copy $(DLLNAME) "$(install_bindir)" - -!if "$(GENERATE_PDB)" == "yes" - -install:: all - copy $(DLLNAME:.dll=.pdb) "$(install_bindir)" - -!endif diff --git a/cpp/src/Freeze/MapDb.cpp b/cpp/src/Freeze/MapDb.cpp deleted file mode 100644 index a63edee9485..00000000000 --- a/cpp/src/Freeze/MapDb.cpp +++ /dev/null @@ -1,506 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include -#include - -#include - -using namespace std; -using namespace Ice; -using namespace IceUtil; -using namespace Freeze; - -namespace -{ - -const string _catalogName = "__catalog"; -const string _catalogIndexListName = "__catalogIndexList"; - -} - -extern "C" -{ -#if (DB_VERSION_MAJOR <= 5) - static int customCompare(DB* db, const DBT* dbt1, const DBT* dbt2) -#else - static int customCompare(DB* db, const DBT* dbt1, const DBT* dbt2, size_t*) -#endif - { - MapDb* me = static_cast(db->app_private); - Ice::Byte* first = static_cast(dbt1->data); - Key k1(first, first + dbt1->size); - first = static_cast(dbt2->data); - Key k2(first, first + dbt2->size); - - return me->getKeyCompare()->compare(k1, k2); - } -} - -const string& -Freeze::catalogName() -{ - return _catalogName; -} - -const string& -Freeze::catalogIndexListName() -{ - return _catalogIndexListName; -} - -Freeze::MapDb::~MapDb() -{ - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Map"); - out << "closing Db \"" << _dbName << "\""; - } - - clearIndices(); - - if(get_DB() != 0) - { - try - { - close(0); - } - catch(const ::DbException& dx) - { - Ice::Error error(_communicator->getLogger()); - error << "Freeze.Map: closing Db " << _dbName << " raised DbException: " << dx.what(); - } - } -} - -Freeze::MapDb::MapDb(const ConnectionIPtr& connection, - const string& dbName, - const string& key, - const string& value, - const KeyCompareBasePtr& keyCompare, - const vector& indices, - bool createDb) : - Db(connection->dbEnv()->getEnv(), 0), - _communicator(connection->communicator()), - _encoding(connection->encoding()), - _dbName(dbName), - _trace(connection->trace()), - _keyCompare(keyCompare) -{ - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Map"); - out << "opening Db \"" << _dbName << "\""; - } - - Catalog catalog(connection, _catalogName); - - TransactionPtr tx = connection->currentTransaction(); - bool ownTx = (tx == 0); - - for(;;) - { - try - { - if(ownTx) - { - tx = 0; - tx = connection->beginTransaction(); - } - - Catalog::iterator ci = catalog.find(_dbName); - - if(ci != catalog.end()) - { - if(ci->second.evictor) - { - throw DatabaseException(__FILE__, __LINE__, _dbName + " is an evictor database"); - } - - _key = ci->second.key; - _value = ci->second.value; - checkTypes(key, value); - } - else - { - _key = key; - _value = value; - } - - set_app_private(this); - if(_keyCompare->compareEnabled()) - { - set_bt_compare(&customCompare); - } - - PropertiesPtr properties = _communicator->getProperties(); - string propPrefix = "Freeze.Map." + _dbName + "."; - - int btreeMinKey = properties->getPropertyAsInt(propPrefix + "BtreeMinKey"); - if(btreeMinKey > 2) - { - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Map"); - out << "Setting \"" << _dbName << "\"'s btree minkey to " << btreeMinKey; - } - set_bt_minkey(btreeMinKey); - } - - bool checksum = properties->getPropertyAsInt(propPrefix + "Checksum") > 0; - if(checksum) - { - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Map"); - out << "Turning checksum on for \"" << _dbName << "\""; - } - - set_flags(DB_CHKSUM); - } - - int pageSize = properties->getPropertyAsInt(propPrefix + "PageSize"); - if(pageSize > 0) - { - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Map"); - out << "Setting \"" << _dbName << "\"'s pagesize to " << pageSize; - } - set_pagesize(pageSize); - } - - - DbTxn* txn = getTxn(tx); - - u_int32_t flags = DB_THREAD; - if(createDb) - { - flags |= DB_CREATE; - } - - // - // Berkeley DB expects file paths to be UTF8 encoded. - // - open(txn, nativeToUTF8(_dbName, getProcessStringConverter()).c_str(), 0, DB_BTREE, - flags, FREEZE_DB_MODE); - - StringSeq oldIndices; - StringSeq newIndices; - size_t oldSize = 0; - CatalogIndexList catalogIndexList(connection, _catalogIndexListName); - - if(createDb) - { - CatalogIndexList::iterator cil = catalogIndexList.find(_dbName); - if(cil != catalogIndexList.end()) - { - oldIndices = cil->second; - oldSize = oldIndices.size(); - } - } - - for(vector::const_iterator p = indices.begin(); - p != indices.end(); ++p) - { - const MapIndexBasePtr& indexBase = *p; - assert(indexBase->_impl == 0); - assert(indexBase->_communicator == 0); - indexBase->_communicator = connection->communicator(); - indexBase->_encoding = connection->encoding(); - - IceUtil::UniquePtr indexI; - - try - { - indexI.reset(new MapIndexI(connection, *this, txn, createDb, indexBase)); - } - catch(const DbDeadlockException&) - { - throw; - } - catch(const DbException& dx) - { - string message = "Error while opening index \"" + _dbName + - "." + indexBase->name() + "\": " + dx.what(); - - throw DatabaseException(__FILE__, __LINE__, message); - } - -#ifdef NDEBUG - _indices.insert(IndexMap::value_type(indexBase->name(), indexI.get())); -#else - bool inserted = - _indices.insert(IndexMap::value_type(indexBase->name(), indexI.get())).second; - assert(inserted); -#endif - - indexBase->_impl = indexI.release(); - - if(createDb) - { - newIndices.push_back(indexBase->name()); - oldIndices.erase(std::remove(oldIndices.begin(), oldIndices.end(), indexBase->name()), oldIndices.end()); - } - } - - if(ci == catalog.end()) - { - CatalogData catalogData; - catalogData.evictor = false; - catalogData.key = key; - catalogData.value = value; - catalog.put(Catalog::value_type(_dbName, catalogData)); - } - - if(createDb) - { - // - // Remove old indices and write the new ones - // - bool indexRemoved = false; - - for(StringSeq::const_iterator q = oldIndices.begin(); q != oldIndices.end(); ++q) - { - const string& index = *q; - - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Map"); - out << "removing old index \"" << index << "\" on Db \"" << _dbName << "\""; - } - - try - { - connection->removeMapIndex(_dbName, *q); - indexRemoved = true; - } - catch(const IndexNotFoundException&) - { - // Ignored - - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Map"); - out << "index \"" << index << "\" on Db \"" << _dbName << "\" does not exist"; - } - } - } - - if(indexRemoved || oldSize != newIndices.size()) - { - if(newIndices.size() == 0) - { - catalogIndexList.erase(_dbName); - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Map"); - out << "Removed catalogIndexList entry for Db \"" << _dbName << "\""; - } - - } - else - { - catalogIndexList.put(CatalogIndexList::value_type(_dbName, newIndices)); - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Map"); - out << "Updated catalogIndexList entry for Db \"" << _dbName << "\""; - } - } - } - } - - if(ownTx) - { - tx->commit(); - } - break; // for(;;) - } - catch(const DbDeadlockException& dx) - { - if(ownTx) - { - if(connection->deadlockWarning()) - { - Warning out(connection->communicator()->getLogger()); - out << "Deadlock in Freeze::MapDb::MapDb on Map \"" - << _dbName << "\"; retrying ..."; - } - - // - // Ignored, try again - // - } - else - { - throw DeadlockException(__FILE__, __LINE__, dx.what(), tx); - } - } - catch(const DbException& dx) - { - if(ownTx) - { - try - { - tx->rollback(); - } - catch(...) - { - } - } - - string message = "Error while opening Db \"" + _dbName + - "\": " + dx.what(); - - throw DatabaseException(__FILE__, __LINE__, message); - } - catch(...) - { - if(ownTx && tx != 0) - { - try - { - tx->rollback(); - } - catch(...) - { - } - } - throw; - } - } -} - -Freeze::MapDb::MapDb(const Ice::CommunicatorPtr& communicator, - const Ice::EncodingVersion& encoding, - const string& dbName, - const string& keyTypeId, - const string& valueTypeId, - DbEnv* env) : - Db(env, 0), - _communicator(communicator), - _encoding(encoding), - _dbName(dbName), - _key(keyTypeId), - _value(valueTypeId), - _trace(communicator->getProperties()->getPropertyAsInt("Freeze.Trace.Map")) -{ - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Map"); - out << "opening Db \"" << _dbName << "\""; - } - - try - { - PropertiesPtr properties = _communicator->getProperties(); - string propPrefix = "Freeze.Map." + _dbName + "."; - - int btreeMinKey = properties->getPropertyAsInt(propPrefix + "BtreeMinKey"); - if(btreeMinKey > 2) - { - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Map"); - out << "Setting \"" << _dbName << "\"'s btree minkey to " << btreeMinKey; - } - set_bt_minkey(btreeMinKey); - } - - bool checksum = properties->getPropertyAsInt(propPrefix + "Checksum") > 0; - if(checksum) - { - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Map"); - out << "Turning checksum on for \"" << _dbName << "\""; - } - - set_flags(DB_CHKSUM); - } - - int pageSize = properties->getPropertyAsInt(propPrefix + "PageSize"); - if(pageSize > 0) - { - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Map"); - out << "Setting \"" << _dbName << "\"'s pagesize to " << pageSize; - } - set_pagesize(pageSize); - } - - u_int32_t flags = DB_THREAD | DB_CREATE | DB_AUTO_COMMIT; - - // - // Berkeley DB expects file paths to be UTF8 encoded. - // - open(0, nativeToUTF8(_dbName, getProcessStringConverter()).c_str(), 0, DB_BTREE, flags, - FREEZE_DB_MODE); - } - catch(const ::DbException& dx) - { - throw DatabaseException(__FILE__, __LINE__, dx.what()); - } -} - -void -Freeze::MapDb::connectIndices(const vector& indices) const -{ - for(vector::const_iterator p = indices.begin(); - p != indices.end(); ++p) - { - const MapIndexBasePtr& indexBase = *p; - assert(indexBase->_impl == 0); - - IndexMap::const_iterator q = _indices.find(indexBase->name()); - - assert(q != _indices.end()); - indexBase->_impl = q->second; - indexBase->_communicator = _communicator; - indexBase->_encoding = _encoding; - } -} - -void -Freeze::MapDb::clearIndices() -{ - try - { - for(IndexMap::iterator p = _indices.begin(); p != _indices.end(); ++p) - { - delete p->second; - } - } - catch(const ::DbException& dx) - { - throw DatabaseException(__FILE__, __LINE__, dx.what()); - } - _indices.clear(); -} - -void -Freeze::MapDb::checkTypes(const string& key, const string& value) const -{ - if(key != _key) - { - throw DatabaseException(__FILE__, __LINE__, - _dbName + "'s key type is " + _key + ", not " + key); - } - if(value != _value) - { - throw DatabaseException(__FILE__, __LINE__, - _dbName + "'s value type is " + _value + ", not " + value); - } -} diff --git a/cpp/src/Freeze/MapDb.h b/cpp/src/Freeze/MapDb.h deleted file mode 100644 index 22362fdd572..00000000000 --- a/cpp/src/Freeze/MapDb.h +++ /dev/null @@ -1,123 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_MAP_DB_H -#define FREEZE_MAP_DB_H - -#include -#include -#include -#include - - -namespace Freeze -{ - -class SharedDbEnv; -class MapDb; - -class MapIndexI -{ -public: - - MapIndexI(const ConnectionIPtr&, MapDb&, DbTxn*, bool, const MapIndexBasePtr&); - - ~MapIndexI(); - - IteratorHelper* begin(bool, const MapHelperI&) const; - IteratorHelper* untypedFind(const Key&, bool, const MapHelperI&, bool) const; - IteratorHelper* untypedLowerBound(const Key&, bool, const MapHelperI&) const; - IteratorHelper* untypedUpperBound(const Key&, bool, const MapHelperI&) const; - - int untypedCount(const Key&, const ConnectionIPtr&) const; - - int secondaryKeyCreate(Db*, const Dbt*, const Dbt*, Dbt*); - - const std::string& name() const - { - return _index->name(); - } - - Db* db() const - { - return _db.get(); - } - - const MapIndexBasePtr& getKeyCompare() const - { - return _index; - } - -private: - - const MapIndexBasePtr _index; - IceUtil::UniquePtr _db; - std::string _dbName; -}; - - -// -// A MapDb represents the Db object underneath Freeze Maps. Several Freeze Maps often -// share the very same MapDb object; SharedDbEnv manages these shared MapDb objects. -// - -class MapDb : public ::Db -{ -public: - - MapDb(const ConnectionIPtr&, const std::string&, const std::string&, const std::string&, - const KeyCompareBasePtr&, const std::vector&, bool); - - - // - // The constructor for catalogs - // - MapDb(const Ice::CommunicatorPtr&, const Ice::EncodingVersion&, const std::string&, const std::string&, - const std::string&, DbEnv*); - - ~MapDb(); - - void connectIndices(const std::vector&) const; - void clearIndices(); - - void checkTypes(const std::string&, const std::string&) const; - - const std::string& dbName() const; - - const KeyCompareBasePtr& getKeyCompare() const; - - typedef std::map IndexMap; - -private: - - const Ice::CommunicatorPtr _communicator; - const Ice::EncodingVersion _encoding; - const std::string _dbName; - std::string _key; - std::string _value; - const int _trace; - - KeyCompareBasePtr _keyCompare; - IndexMap _indices; -}; - -inline const std::string& -MapDb::dbName() const -{ - return _dbName; -} - -inline const Freeze::KeyCompareBasePtr& -MapDb::getKeyCompare() const -{ - return _keyCompare; -} - -} -#endif diff --git a/cpp/src/Freeze/MapI.cpp b/cpp/src/Freeze/MapI.cpp deleted file mode 100644 index 0b4ffa64a7d..00000000000 --- a/cpp/src/Freeze/MapI.cpp +++ /dev/null @@ -1,2121 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace Ice; -using namespace Freeze; - -// -// MapIndexBase (from Map.h) -// - -Freeze::MapIndexBase::~MapIndexBase() -{ -} - -Freeze::MapIndexBase::MapIndexBase(const string& name, bool enabled) : - KeyCompareBase(enabled), - _name(name), - _impl(0), - _map(0) -{ -} - -const string& -MapIndexBase::name() const -{ - return _name; -} - -IteratorHelper* -Freeze::MapIndexBase::begin(bool ro) const -{ - return _impl->begin(ro, *_map); -} - -IteratorHelper* -Freeze::MapIndexBase::untypedFind(const Key& k, bool ro, bool onlyDups) const -{ - return _impl->untypedFind(k, ro, *_map, onlyDups); -} - -IteratorHelper* -Freeze::MapIndexBase::untypedLowerBound(const Key& k, bool ro) const -{ - return _impl->untypedLowerBound(k, ro, *_map); -} - -IteratorHelper* -Freeze::MapIndexBase::untypedUpperBound(const Key& k, bool ro) const -{ - return _impl->untypedUpperBound(k, ro, *_map); -} - -int -Freeze::MapIndexBase::untypedCount(const Key& k) const -{ - return _impl->untypedCount(k, _map->connection()); -} - -// -// KeyCompareBase -// -Freeze::KeyCompareBase::KeyCompareBase(bool enabled) : - _enabled(enabled) -{} - -bool -Freeze::KeyCompareBase::compareEnabled() const -{ - return _enabled; -} - -// -// MapHelper (from Map.h) -// - -/*static*/ Freeze::MapHelper* -Freeze::MapHelper::create(const Freeze::ConnectionPtr& connection, - const string& dbName, - const string& key, - const string& value, - const Freeze::KeyCompareBasePtr& keyCompare, - const std::vector& indices, - bool createDb) -{ - Freeze::ConnectionIPtr connectionI = Freeze::ConnectionIPtr::dynamicCast(connection.get()); - return new MapHelperI(connectionI, dbName, key, value, keyCompare, indices, createDb); -} - -/*static*/ void -Freeze::MapHelper::recreate(const Freeze::ConnectionPtr& connection, - const string& dbName, - const string& key, - const string& value, - const Freeze::KeyCompareBasePtr& keyCompare, - const std::vector& indices) -{ - Freeze::ConnectionIPtr connectionI = Freeze::ConnectionIPtr::dynamicCast(connection.get()); - if(connectionI == 0) - { - throw DatabaseException(__FILE__, __LINE__, "Invalid connection"); - } - - if(dbName == catalogName() || dbName == catalogIndexListName()) - { - throw DatabaseException(__FILE__, __LINE__, - "You cannot destroy recreate the \"" + dbName + "\" database"); - } - - if(connectionI->trace() >= 1) - { - Trace out(connectionI->communicator()->getLogger(), "Freeze.Map"); - out << "Recreating \"" << dbName << "\""; - } - - TransactionPtr tx = connectionI->currentTransaction(); - bool ownTx = (tx == 0); - - Dbt keyDbt; - keyDbt.set_flags(DB_DBT_REALLOC); - Dbt valueDbt; - valueDbt.set_flags(DB_DBT_REALLOC); - - try - { - for(;;) - { - try - { - if(ownTx) - { - tx = 0; - tx = connectionI->beginTransaction(); - } - - DbTxn* txn = connectionI->dbTxn(); - - if(connectionI->trace() >= 2) - { - Trace out(connectionI->communicator()->getLogger(), "Freeze.Map"); - out << "Removing all existing indices for \"" << dbName << "\""; - } - CatalogIndexList catalogIndexList(connection, catalogIndexListName()); - CatalogIndexList::iterator p = catalogIndexList.find(dbName); - if(p != catalogIndexList.end()) - { - const StringSeq& indices = p->second; - - for(size_t i = 0; i < indices.size(); ++i) - { - try - { - connection->removeMapIndex(dbName, indices[i]); - } - catch(const IndexNotFoundException&) - { - // - // Ignored - // - } - } - catalogIndexList.erase(p); - } - - // - // Rename existing database - // - string oldDbName = dbName + ".old-" + IceUtil::generateUUID(); - - if(connectionI->trace() >= 2) - { - Trace out(connectionI->communicator()->getLogger(), "Freeze.Map"); - out << "Renaming \"" << dbName << "\" to \"" << oldDbName << "\""; - } - - connectionI->dbEnv()->getEnv()->dbrename(txn, dbName.c_str(), 0, oldDbName.c_str(), 0); - - // - // Fortunately, DB closes oldDb automatically when it goes out of scope - // - Db oldDb(connectionI->dbEnv()->getEnv(), 0); - - // - // Berkeley DB expects file paths to be UTF8 encoded. - // - oldDb.open(txn, IceUtil::nativeToUTF8(oldDbName, IceUtil::getProcessStringConverter()).c_str(), - 0, DB_BTREE, DB_THREAD, FREEZE_DB_MODE); - - IceUtil::UniquePtr newDb(new MapDb(connectionI, dbName, key, value, keyCompare, indices, true)); - - if(connectionI->trace() >= 2) - { - Trace out(connectionI->communicator()->getLogger(), "Freeze.Map"); - out << "Writing contents of \"" << oldDbName << "\" to fresh \"" << dbName << "\""; - } - - // - // Now simply write all of oldDb into newDb - // - Dbc* dbc = 0; - oldDb.cursor(txn, &dbc, 0); - - try - { - while(dbc->get(&keyDbt, &valueDbt, DB_NEXT) == 0) - { - newDb->put(txn, &keyDbt, &valueDbt, 0); - } - } - catch(...) - { - dbc->close(); - throw; - } - dbc->close(); - - if(connectionI->trace() >= 2) - { - Trace out(connectionI->communicator()->getLogger(), "Freeze.Map"); - out << "Transfer complete; removing \"" << oldDbName << "\""; - } - connectionI->dbEnv()->getEnv()->dbremove(txn, oldDbName.c_str(), 0, 0); - - if(ownTx) - { - tx->commit(); - } - - break; // for (;;) - } - catch(const DbDeadlockException& dx) - { - if(ownTx) - { - if(connectionI->deadlockWarning()) - { - Warning out(connectionI->communicator()->getLogger()); - out << "Deadlock in Freeze::MapHelperI::recreate on Db \"" - << dbName << "\"; retrying ..."; - } - - // - // Ignored, try again - // - } - else - { - throw DeadlockException(__FILE__, __LINE__, dx.what(), tx); - } - } - catch(const DbException& dx) - { - if(ownTx) - { - try - { - tx->rollback(); - } - catch(...) - { - } - } - - throw DatabaseException(__FILE__, __LINE__, dx.what()); - } - catch(...) - { - if(ownTx && tx != 0) - { - try - { - tx->rollback(); - } - catch(...) - { - } - } - throw; - } - } - free(keyDbt.get_data()); - free(valueDbt.get_data()); - } - catch(...) - { - free(keyDbt.get_data()); - free(valueDbt.get_data()); - - throw; - } -} - -Freeze::MapHelper::~MapHelper() -{ -} - -// -// IteratorHelper (from Map.h) -// - -Freeze::IteratorHelper* -Freeze::IteratorHelper::create(const MapHelper& m, bool readOnly) -{ - const MapHelperI& actualMap = dynamic_cast(m); - - IceUtil::UniquePtr r(new IteratorHelperI(actualMap, readOnly, 0, false)); - if(r->next()) - { - return r.release(); - } - else - { - return 0; - } -} - -Freeze::IteratorHelper::~IteratorHelper() ICE_NOEXCEPT_FALSE -{ -} - -// -// MapCodecBase (from Map.h) -// -Freeze::MapCodecBase::MapCodecBase(const Ice::CommunicatorPtr& communicator, const Ice::EncodingVersion& encoding) : - _stream(IceInternal::getInstance(communicator).get(), encoding), - _dbt(0) -{ -} - -Freeze::MapCodecBase::~MapCodecBase() -{ - delete _dbt; -} - -void -Freeze::MapCodecBase::init() -{ - _dbt = new Dbt; - initializeInDbt(_stream, *_dbt); -} - -// -// IteratorHelperI -// - -Freeze::IteratorHelperI::IteratorHelperI(const MapHelperI& m, bool readOnly, - const MapIndexBasePtr& index, - bool onlyDups) : - _map(m), - _dbc(0), - _indexed(index != 0), - _onlyDups(onlyDups), - _tx(0) -{ - if(_map._trace >= 2) - { - Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map"); - out << "opening iterator on Db \"" << _map._dbName << "\""; - if(index != 0) - { - out << " with index \"" << index->name() << "\""; - } - } - - DbTxn* txn = _map._connection->dbTxn(); - - if(txn == 0 && !readOnly) - { - // - // Need to start a transaction - // -#ifdef ICE_CPP11 - _tx.reset(new Tx(_map)); -#else - _tx = new Tx(_map); -#endif - txn = _tx->getTxn(); - } - - try - { - if(index != 0) - { - index->_impl->db()->cursor(txn, &_dbc, 0); - } - else - { - _map._db->cursor(txn, &_dbc, 0); - } - } - catch(const ::DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - - _map._iteratorList.push_back(this); -} - -Freeze::IteratorHelperI::IteratorHelperI(const IteratorHelperI& it) : - _map(it._map), - _dbc(0), - _indexed(it._indexed), - _onlyDups(it._onlyDups), - _tx(0) -{ - if(_map._trace >= 2) - { - Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map"); - out << "duplicating iterator on Db \"" << _map._dbName << "\""; - } - - try - { - it._dbc->dup(&_dbc, DB_POSITION); - } - catch(const ::DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - - _tx = it._tx; - _map._iteratorList.push_back(this); -} - -Freeze::IteratorHelperI::~IteratorHelperI() ICE_NOEXCEPT_FALSE -{ - close(); -} - -bool -Freeze::IteratorHelperI::find(const Key& key) const -{ - Dbt dbKey; - initializeInDbt(key, dbKey); - return find(dbKey); -} - -bool -Freeze::IteratorHelperI::find(const Dbt& key) const -{ - assert((key.get_flags() & DB_DBT_USERMEM) != 0); - Dbt dbKey(key); - -#if (DB_VERSION_MAJOR <= 4) || (DB_VERSION_MAJOR == 5 && DB_VERSION_MINOR <= 1) - // - // When we have a custom-comparison function, Berkeley DB returns - // the key on-disk (when it finds one). We disable this behavior: - // (ref Oracle SR 5925672.992) - // - dbKey.set_flags(dbKey.get_flags() | DB_DBT_PARTIAL); -#else - // - // In DB > 5.1 we can not set DB_DBT_PARTIAL in the key Dbt, - // when using DB_SET, we must resize the Dbt key param to hold enough - // space or Dbc::get fails with DB_BUFFER_SMALL. - // - dbKey.set_ulen(dbKey.get_size()); -#endif - - // - // Keep 0 length since we're not interested in the data. - // - Dbt dbValue; - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - for(;;) - { - try - { - return _dbc->get(&dbKey, &dbValue, DB_SET) == 0; - } - catch(const ::DbDeadlockException& dx) - { - if(_tx != 0) - { - _tx->dead(); - } - - DeadlockException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - catch(const ::DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - } -} - -bool -Freeze::IteratorHelperI::lowerBound(const Key& key) const -{ - // - // We retrieve the actual key for upperBound - // - Dbt dbKey; - _key = key; - initializeOutDbt(_key, dbKey); - dbKey.set_size(static_cast(_key.size())); - - // - // Keep 0 length since we're not interested in the data - // - Dbt dbValue; - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - for(;;) - { - try - { - int err = _dbc->get(&dbKey, &dbValue, DB_SET_RANGE); - if(err == 0) - { - _key.resize(dbKey.get_size()); - return true; - } - else if(err == DB_NOTFOUND) - { - return false; - } - else - { - // - // Bug in Freeze - // - assert(0); - throw DatabaseException(__FILE__, __LINE__); - } - } - catch(const ::DbDeadlockException& dx) - { - if(_tx != 0) - { - _tx->dead(); - } - - DeadlockException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - catch(const ::DbException& dx) - { - handleDbException(dx, _key, dbKey, __FILE__, __LINE__); - } - } -} - -bool -Freeze::IteratorHelperI::upperBound(const Key& key) const -{ - if(lowerBound(key)) - { - if(_key == key) - { - return next(true); - } - else - { - return true; - } - } - else - { - return false; - } -} - -Freeze::IteratorHelper* -Freeze::IteratorHelperI::clone() const -{ - return new IteratorHelperI(*this); -} - -void -Freeze::IteratorHelperI::get(const Key*& key, const Value*& value) const -{ - key = &_key; - value = &_value; - - size_t keySize = _key.size(); - if(keySize < 1024) - { - keySize = 1024; - } - _key.resize(keySize); - - Dbt dbKey; - initializeOutDbt(_key, dbKey); - - size_t valueSize = _value.size(); - if(valueSize < 1024) - { - valueSize = 1024; - } - _value.resize(valueSize); - Dbt dbValue; - initializeOutDbt(_value, dbValue); - - for(;;) - { - try - { - int err; - - if(_indexed) - { - // - // Not interested in getting the index's key - // - Dbt iKey; - iKey.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - err = _dbc->pget(&iKey, &dbKey, &dbValue, DB_CURRENT); - } - else - { - err = _dbc->get(&dbKey, &dbValue, DB_CURRENT); - } - - if(err == 0) - { - _key.resize(dbKey.get_size()); - _value.resize(dbValue.get_size()); - break; // for(;;) - } - else if(err == DB_KEYEMPTY) - { - throw InvalidPositionException(__FILE__, __LINE__); - } - else - { - // - // Bug in Freeze - // - assert(0); - throw DatabaseException(__FILE__, __LINE__); - } - } - catch(const ::DbDeadlockException& dx) - { - if(_tx != 0) - { - _tx->dead(); - } - - DeadlockException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - catch(const ::DbException& dx) - { - handleDbException(dx, _key, dbKey, _value, dbValue, __FILE__, __LINE__); - } - } -} - -const Freeze::Key* -Freeze::IteratorHelperI::get() const -{ - size_t keySize = _key.size(); - if(keySize < 1024) - { - keySize = 1024; - } - _key.resize(keySize); - - Dbt dbKey; - initializeOutDbt(_key, dbKey); - - // - // Keep 0 length since we're not interested in the data - // - Dbt dbValue; - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - for(;;) - { - try - { - int err; - if(_indexed) - { - // - // Not interested in getting the index's key - // - Dbt iKey; - iKey.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - err = _dbc->pget(&iKey, &dbKey, &dbValue, DB_CURRENT); - } - else - { - err = _dbc->get(&dbKey, &dbValue, DB_CURRENT); - } - - if(err == 0) - { - _key.resize(dbKey.get_size()); - return &_key; - } - else if(err == DB_KEYEMPTY) - { - throw InvalidPositionException(__FILE__, __LINE__); - } - else - { - // - // Bug in Freeze - // - assert(0); - throw DatabaseException(__FILE__, __LINE__); - } - } - catch(const ::DbDeadlockException& dx) - { - if(_tx != 0) - { - _tx->dead(); - } - - DeadlockException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - catch(const ::DbException& dx) - { - handleDbException(dx, _key, dbKey, __FILE__, __LINE__); - } - } -} - -void -Freeze::IteratorHelperI::set(const Value& value) -{ - Dbt dbValue; - initializeInDbt(value, dbValue); - set(dbValue); -} - -void -Freeze::IteratorHelperI::set(const Dbt& value) -{ - if(_indexed) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = "Cannot set an iterator retrieved through an index"; - throw ex; - } - - // - // key ignored - // - Dbt dbKey; - dbKey.set_flags(DB_DBT_USERMEM); - - Dbt dbValue(value); - - if(_tx != 0) - { - _map.closeAllIteratorsExcept(_tx); - } - - try - { -#ifndef NDEBUG - int err = _dbc->put(&dbKey, &dbValue, DB_CURRENT); - assert(err == 0); -#else - _dbc->put(&dbKey, &dbValue, DB_CURRENT); -#endif - } - catch(const ::DbDeadlockException& dx) - { - if(_tx != 0) - { - _tx->dead(); - } - - DeadlockException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - catch(const ::DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } -} - -void -Freeze::IteratorHelperI::erase() -{ - if(_tx != 0) - { - _map.closeAllIteratorsExcept(_tx); - } - - try - { - int err = _dbc->del(0); - if(err == DB_KEYEMPTY) - { - throw InvalidPositionException(__FILE__, __LINE__); - } - assert(err == 0); - } - catch(const ::DbDeadlockException& dx) - { - if(_tx != 0) - { - _tx->dead(); - } - - DeadlockException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - catch(const ::DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } -} - -bool -Freeze::IteratorHelperI::next() const -{ - return next(false); -} - -bool -Freeze::IteratorHelperI::next(bool skipDups) const -{ - // - // Keep 0 length since we're not interested in the data - // - Dbt dbKey; - dbKey.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - Dbt dbValue; - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - int flags = DB_NEXT; - if(skipDups) - { - flags = DB_NEXT_NODUP; - } - else if(_indexed && _onlyDups) - { - flags = DB_NEXT_DUP; - } - - try - { - if(_dbc->get(&dbKey, &dbValue, flags) == 0) - { - return true; - } - else - { - return false; - } - } - catch(const ::DbDeadlockException& dx) - { - if(_tx != 0) - { - _tx->dead(); - } - - DeadlockException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - catch(const ::DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } -} - -void -Freeze::IteratorHelperI::close() -{ - if(_dbc != 0) - { - if(_map._trace >= 2) - { - Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map"); - out << "closing iterator on Db \"" << _map._dbName << "\""; - } - - try - { - _dbc->close(); - } - catch(const ::DbDeadlockException&) - { - // Ignored - it's unclear if this can ever occur - } - catch(const ::DbException& dx) - { - cleanup(); - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - cleanup(); - } -} - -void -Freeze::IteratorHelperI::cleanup() -{ - _dbc = 0; - _map._iteratorList.remove(this); - - // this can raise an exception when committing the transaction - // (only for read/write iterators) -#ifdef ICE_CPP11 - _tx.reset(); -#else - _tx = 0; -#endif -} - -// -// IteratorHelperI::Tx -// - -Freeze::IteratorHelperI::Tx::Tx(const MapHelperI& m) : - _map(m), - _txn(0), - _dead(false) -{ - if(_map._trace >= 2) - { - Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map"); - out << "starting transaction for Db \"" << _map._dbName << "\""; - } - - try - { - _map._connection->dbEnv()->getEnv()->txn_begin(0, &_txn, 0); - } - catch(const ::DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } -} - -Freeze::IteratorHelperI::Tx::~Tx() ICE_NOEXCEPT_FALSE -{ - if(_dead) - { - if(_map._trace >= 2) - { - Trace out(_map._connection->communicator()->getLogger(), ""); - out << "aborting transaction for Db \"" << _map._dbName << "\""; - } - - try - { - _txn->abort(); - } - catch(...) - { - // - // Ignore exceptions to avoid crash during stack unwinding - // - } - } - else - { - if(_map._trace >= 2) - { - Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map"); - out << "committing transaction for Db \"" << _map._dbName.c_str() << "\""; - } - - try - { - _txn->commit(0); - } - catch(const ::DbDeadlockException& dx) - { - DeadlockException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - catch(const ::DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - } -} - -void -Freeze::IteratorHelperI::Tx::dead() -{ - _dead = true; -} - -// -// MapHelperI -// - -Freeze::MapHelperI::MapHelperI(const ConnectionIPtr& connection, - const string& dbName, - const string& key, - const string& value, - const KeyCompareBasePtr& keyCompare, - const vector& indices, - bool createDb) : - _connection(connection), - _db(connection->dbEnv()->getSharedMapDb(dbName, key, value, keyCompare, indices, createDb)), - _dbName(dbName), - _trace(connection->trace()) -{ - for(vector::const_iterator p = indices.begin(); - p != indices.end(); ++p) - { - const MapIndexBasePtr& indexBase = *p; - assert(indexBase->_impl != 0); - assert(indexBase->_communicator == _connection->communicator()); - assert(indexBase->_map == 0); - -#ifdef NDEBUG - _indices.insert(IndexMap::value_type(indexBase->name(), indexBase)); -#else - bool inserted = _indices.insert(IndexMap::value_type(indexBase->name(), indexBase)).second; - assert(inserted); -#endif - - indexBase->_map = this; - } - - _connection->registerMap(this); -} - -Freeze::MapHelperI::~MapHelperI() -{ - try - { - close(); - } - catch(const DatabaseException& ex) - { - Ice::Error error(_connection->getCommunicator()->getLogger()); - error << "Freeze: closing map " << _dbName << " raised: " << ex; - } -} - -Freeze::IteratorHelper* -Freeze::MapHelperI::find(const Key& k, bool readOnly) const -{ - for(;;) - { - try - { - IceUtil::UniquePtr r(new IteratorHelperI(*this, readOnly, 0, false)); - if(r->find(k)) - { - return r.release(); - } - else - { - return 0; - } - } - catch(const DeadlockException&) - { - if(_connection->dbTxn() != 0) - { - throw; - } - else - { - if(_connection->deadlockWarning()) - { - Warning out(_connection->communicator()->getLogger()); - out << "Deadlock in Freeze::MapHelperI::find on Map \"" - << _dbName << "\"; retrying ..."; - } - - // - // Ignored, try again - // - } - } - } -} - -Freeze::IteratorHelper* -Freeze::MapHelperI::find(const Dbt& k, bool readOnly) const -{ - for(;;) - { - try - { - IceUtil::UniquePtr r(new IteratorHelperI(*this, readOnly, 0, false)); - if(r->find(k)) - { - return r.release(); - } - else - { - return 0; - } - } - catch(const DeadlockException&) - { - if(_connection->dbTxn() != 0) - { - throw; - } - else - { - if(_connection->deadlockWarning()) - { - Warning out(_connection->communicator()->getLogger()); - out << "Deadlock in Freeze::MapHelperI::find on Map \"" - << _dbName << "\"; retrying ..."; - } - - // - // Ignored, try again - // - } - } - } -} - -Freeze::IteratorHelper* -Freeze::MapHelperI::lowerBound(const Key& k, bool readOnly) const -{ - for(;;) - { - try - { - IceUtil::UniquePtr r(new IteratorHelperI(*this, readOnly, 0, false)); - if(r->lowerBound(k)) - { - return r.release(); - } - else - { - return 0; - } - } - catch(const DeadlockException&) - { - if(_connection->dbTxn() != 0) - { - throw; - } - else - { - if(_connection->deadlockWarning()) - { - Warning out(_connection->communicator()->getLogger()); - out << "Deadlock in Freeze::MapHelperI::lowerBound on Map \"" - << _dbName << "\"; retrying ..."; - } - - // - // Ignored, try again - // - } - } - } -} - -Freeze::IteratorHelper* -Freeze::MapHelperI::upperBound(const Key& k, bool readOnly) const -{ - for(;;) - { - try - { - IceUtil::UniquePtr r(new IteratorHelperI(*this, readOnly, 0, false)); - if(r->upperBound(k)) - { - return r.release(); - } - else - { - return 0; - } - } - catch(const DeadlockException&) - { - if(_connection->dbTxn() != 0) - { - throw; - } - else - { - if(_connection->deadlockWarning()) - { - Warning out(_connection->communicator()->getLogger()); - out << "Deadlock in Freeze::MapHelperI::upperBound on Map \"" - << _dbName << "\"; retrying ..."; - } - - // - // Ignored, try again - // - } - } - } -} - -void -Freeze::MapHelperI::put(const Key& key, const Value& value) -{ - Dbt dbKey; - Dbt dbValue; - initializeInDbt(key, dbKey); - initializeInDbt(value, dbValue); - put(dbKey, dbValue); -} - -void -Freeze::MapHelperI::put(const Dbt& key, const Dbt& value) -{ - DbTxn* txn = _connection->dbTxn(); - if(txn == 0) - { - closeAllIterators(); - } - - Dbt dbKey(key); - Dbt dbValue(value); - - for(;;) - { - try - { - int err = _db->put(txn, &dbKey, &dbValue, txn != 0 ? 0 : DB_AUTO_COMMIT); - - if(err == 0) - { - break; - } - else - { - // - // Bug in Freeze - // - throw DatabaseException(__FILE__, __LINE__); - } - } - catch(const ::DbDeadlockException& dx) - { - if(txn != 0) - { - DeadlockException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - else - { - if(_connection->deadlockWarning()) - { - Warning out(_connection->communicator()->getLogger()); - out << "Deadlock in Freeze::MapHelperI::put on Map \"" - << _dbName << "\"; retrying ..."; - } - - // - // Ignored, try again - // - } - } - catch(const ::DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - } -} - -size_t -Freeze::MapHelperI::erase(const Key& key) -{ - Dbt dbKey; - initializeInDbt(key, dbKey); - return erase(dbKey); -} - -size_t -Freeze::MapHelperI::erase(const Dbt& key) -{ - DbTxn* txn = _connection->dbTxn(); - if(txn == 0) - { - closeAllIterators(); - } - - Dbt dbKey(key); - - for(;;) - { - try - { - int err = _db->del(txn, &dbKey, txn != 0 ? 0 : DB_AUTO_COMMIT); - - if(err == 0) - { - return 1; - } - else if(err == DB_NOTFOUND) - { - return 0; - } - else - { - assert(0); - throw DatabaseException(__FILE__, __LINE__); - } - } - catch(const ::DbDeadlockException& dx) - { - if(txn != 0) - { - DeadlockException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - else - { - if(_connection->deadlockWarning()) - { - Warning out(_connection->communicator()->getLogger()); - out << "Deadlock in Freeze::MapHelperI::erase on Map \"" - << _dbName << "\"; retrying ..."; - } - - // - // Ignored, try again - // - } - } - catch(const ::DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - } -} - -size_t -Freeze::MapHelperI::count(const Key& key) const -{ - Dbt dbKey; - initializeInDbt(key, dbKey); - return count(dbKey); -} - -size_t -Freeze::MapHelperI::count(const Dbt& key) const -{ - Dbt dbKey(key); - - // - // Keep 0 length since we're not interested in the data - // - Dbt dbValue; - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - for(;;) - { - try - { - int err = _db->get(_connection->dbTxn(), &dbKey, &dbValue, 0); - - if(err == 0) - { - return 1; - } - else if(err == DB_NOTFOUND) - { - return 0; - } - else - { - assert(0); - throw DatabaseException(__FILE__, __LINE__); - } - } - catch(const ::DbDeadlockException& dx) - { - if(_connection->dbTxn() != 0) - { - DeadlockException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - else - { - if(_connection->deadlockWarning()) - { - Warning out(_connection->communicator()->getLogger()); - out << "Deadlock in Freeze::MapHelperI::count on Map \"" - << _dbName << "\"; retrying ..."; - } - - // - // Ignored, try again - // - } - } - catch(const ::DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - } -} - -void -Freeze::MapHelperI::clear() -{ - DbTxn* txn = _connection->dbTxn(); - if(txn == 0) - { - closeAllIterators(); - } - - Dbt dbKey; - dbKey.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - Dbt dbValue; - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - try - { - for(;;) - { - Dbc* dbc = 0; - - try - { - IteratorHelperI::TxPtr tx; - if(txn == 0) - { -#ifdef ICE_CPP11 - tx.reset(new IteratorHelperI::Tx(*this)); -#else - tx = new IteratorHelperI::Tx(*this); -#endif - txn = tx->getTxn(); - } - - _db->cursor(txn, &dbc, 0); - while(dbc->get(&dbKey, &dbValue, DB_NEXT | DB_RMW) == 0) - { - dbc->del(0); - } - - Dbc* toClose = dbc; - dbc = 0; - toClose->close(); - break; // for (;;) - } - catch(const DbDeadlockException&) - { - if(dbc != 0) - { - try - { - dbc->close(); - } - catch(const DbDeadlockException&) - { - if(txn != 0) - { - throw; - } - else - { - // - // Ignored - // - } - } - } - - if(_connection->deadlockWarning()) - { - Warning out(_connection->communicator()->getLogger()); - out << "Deadlock in Freeze::MapHelperI::clear on Map \"" - << _dbName << "\"; retrying ..."; - } - - if(txn != 0) - { - throw; - } - // - // Otherwise retry - // - } - catch(...) - { - if(dbc != 0) - { - try - { - dbc->close(); - } - catch(const DbDeadlockException&) - { - if(txn != 0) - { - throw; - } - else - { - // - // Ignored - // - } - } - } - throw; - } - } - } - catch(const DbDeadlockException& dx) - { - throw DeadlockException(__FILE__, __LINE__, dx.what(), _connection->currentTransaction()); - } - catch(const DbException& dx) - { - throw DatabaseException(__FILE__, __LINE__, dx.what()); - } -} - -void -Freeze::MapHelperI::destroy() -{ - if(_dbName == catalogName() || _dbName == catalogIndexListName()) - { - throw DatabaseException(__FILE__, __LINE__, "You cannot destroy the \"" + _dbName + "\" database"); - } - - if(_db == 0) - { - // - // We need an opened map to gather the index names - // - throw DatabaseException(__FILE__, __LINE__, "This map is closed"); - } - - if(_connection->currentTransaction()) - { - throw DatabaseException(__FILE__, __LINE__, "Cannot destroy map within transaction"); - } - - if(_trace >= 1) - { - Trace out(_connection->communicator()->getLogger(), "Freeze.Map"); - out << "Destroying \"" << _dbName << "\""; - } - - vector indexNames; - for(IndexMap::iterator p = _indices.begin(); p != _indices.end(); ++p) - { - indexNames.push_back(p->second->name()); - } - - closeDb(); - - for(;;) - { - try - { - TransactionHolder tx(_connection); - DbTxn* txn = _connection->dbTxn(); - - Catalog catalog(_connection, catalogName()); - catalog.erase(_dbName); - - CatalogIndexList catalogIndexList(_connection, catalogIndexListName()); - catalogIndexList.erase(_dbName); - - _connection->dbEnv()->getEnv()->dbremove(txn, _dbName.c_str(), 0, 0); - - // - // Remove all indices - // - for(vector::iterator q = indexNames.begin(); q != indexNames.end(); ++q) - { - _connection->removeMapIndex(_dbName, *q); - } - - tx.commit(); - - break; // for(;;) - } - catch(const DbDeadlockException&) - { - if(_connection->deadlockWarning()) - { - Warning out(_connection->communicator()->getLogger()); - out << "Deadlock in Freeze::MapHelperI::destroy on Map \"" - << _dbName << "\"; retrying ..."; - } - - // - // Ignored, try again - // - } - catch(const DbException& dx) - { - throw DatabaseException(__FILE__, __LINE__, dx.what()); - } - } -} - -size_t -Freeze::MapHelperI::size() const -{ - DB_BTREE_STAT* s; - - try - { -#if DB_VERSION_MAJOR < 4 -#error Freeze requires DB 4.x or greater -#endif -#if (DB_VERSION_MAJOR == 4) && (DB_VERSION_MINOR < 3) - _db->stat(&s, 0); -#else - _db->stat(_connection->dbTxn(), &s, 0); -#endif - } - catch(const ::DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - - size_t num = s->bt_ndata; - free(s); - return num; -} - -void -Freeze::MapHelperI::closeAllIterators() -{ - while(!_iteratorList.empty()) - { - (*_iteratorList.begin())->close(); - } -} - -const MapIndexBasePtr& -Freeze::MapHelperI::index(const string& name) const -{ - IndexMap::const_iterator p = _indices.find(name); - if(p == _indices.end()) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = "Cannot find index \"" + name + "\""; - throw ex; - } - return p->second; -} - -void -Freeze::MapHelperI::closeDb() -{ - close(); - _connection->dbEnv()->removeSharedMapDb(_dbName); -} - -Freeze::ConnectionPtr -Freeze::MapHelperI::getConnection() const -{ - return _connection; -} - -void -Freeze::MapHelperI::close() -{ - if(_db != 0) - { - closeAllIterators(); - _connection->unregisterMap(this); - } - _db = 0; - - // - // We can't clear the indexBase as MapIndexI is using - // the first map's indexBase objects - // - _indices.clear(); -} - -void -Freeze::MapHelperI::closeAllIteratorsExcept(const IteratorHelperI::TxPtr& tx) const -{ - assert(tx != 0); - - list::iterator q = _iteratorList.begin(); - - while(q != _iteratorList.end()) - { - if((*q)->tx().get() == tx.get()) - { - ++q; - } - else - { - (*q)->close(); - q = _iteratorList.begin(); - } - } -} - -// -// MapIndexI -// - -extern "C" -{ -#if (DB_VERSION_MAJOR <= 5) - static int customIndexCompare(DB* db, const DBT* dbt1, const DBT* dbt2) -#else - static int customIndexCompare(DB* db, const DBT* dbt1, const DBT* dbt2, size_t*) -#endif - { - MapIndexI* me = static_cast(db->app_private); - Byte* first = static_cast(dbt1->data); - Key k1(first, first + dbt1->size); - first = static_cast(dbt2->data); - Key k2(first, first + dbt2->size); - - return me->getKeyCompare()->compare(k1, k2); - } -} - -static int -callback(Db* secondary, const Dbt* key, const Dbt* value, Dbt* result) -{ - void* indexObj = secondary->get_app_private(); - MapIndexI* index = static_cast(indexObj); - assert(index != 0); - return index->secondaryKeyCreate(secondary, key, value, result); -} - -Freeze::MapIndexI::MapIndexI(const ConnectionIPtr& connection, MapDb& db, - DbTxn* txn, bool createDb, const MapIndexBasePtr& index) : - _index(index) -{ - assert(txn != 0); - - _db.reset(new Db(connection->dbEnv()->getEnv(), 0)); - _db->set_flags(DB_DUP | DB_DUPSORT); - - u_int32_t flags = 0; - if(createDb) - { - flags = DB_CREATE; - } - - _dbName = db.dbName() + "." + _index->name(); - - _db->set_app_private(this); - - if(index->compareEnabled()) - { - _db->set_bt_compare(&customIndexCompare); - } - - Ice::PropertiesPtr properties = connection->communicator()->getProperties(); - string propPrefix = "Freeze.Map." + _dbName + "."; - int btreeMinKey = properties->getPropertyAsInt(propPrefix + "BtreeMinKey"); - if(btreeMinKey > 2) - { - if(connection->trace() >= 1) - { - Trace out(connection->communicator()->getLogger(), "Freeze.Map"); - out << "Setting \"" << _dbName << "\"'s btree minkey to " << btreeMinKey; - } - - _db->set_bt_minkey(btreeMinKey); - } - - bool checksum = properties->getPropertyAsInt(propPrefix + "Checksum") > 0; - if(checksum) - { - if(connection->trace() >= 1) - { - Trace out(connection->communicator()->getLogger(), "Freeze.Map"); - out << "Turning checksum on for \"" << _dbName << "\""; - } - - _db->set_flags(DB_CHKSUM); - } - - int pageSize = properties->getPropertyAsInt(propPrefix + "PageSize"); - if(pageSize > 0) - { - if(connection->trace() >= 1) - { - Trace out(connection->communicator()->getLogger(), "Freeze.Map"); - out << "Setting \"" << _dbName << "\"'s pagesize to " << pageSize; - } - - _db->set_pagesize(pageSize); - } - - if(connection->trace() >= 1) - { - Trace out(connection->communicator()->getLogger(), "Freeze.Map"); - out << "Opening index \"" << _dbName << "\""; - } - - // - // Berkeley DB expects file paths to be UTF8 encoded. - // - _db->open(txn, IceUtil::nativeToUTF8(_dbName, IceUtil::getProcessStringConverter()).c_str(), 0, DB_BTREE, flags, - FREEZE_DB_MODE); - - // - // To populate empty indices - // - flags = DB_CREATE; - db.associate(txn, _db.get(), callback, flags); - - // - // Note: caller catch and translates exceptions - // -} - -Freeze::MapIndexI::~MapIndexI() -{ - try - { - _db->close(0); - } - catch(const DbException&) - { - // Ignored - } -} - -IteratorHelper* -Freeze::MapIndexI::begin(bool ro, const MapHelperI& m) const -{ - IceUtil::UniquePtr r(new IteratorHelperI(m, ro, _index, false)); - - if(r->next()) - { - return r.release(); - } - else - { - return 0; - } -} - -IteratorHelper* -Freeze::MapIndexI::untypedFind(const Key& k, bool ro, const MapHelperI& m, bool onlyDups) const -{ - IceUtil::UniquePtr r(new IteratorHelperI(m, ro, _index, onlyDups)); - - if(r->find(k)) - { - return r.release(); - } - else - { - return 0; - } -} - -IteratorHelper* -Freeze::MapIndexI::untypedLowerBound(const Key& k, bool ro, const MapHelperI& m) const -{ - IceUtil::UniquePtr r(new IteratorHelperI(m, ro, _index, false)); - - if(r->lowerBound(k)) - { - return r.release(); - } - else - { - return 0; - } -} - -IteratorHelper* -Freeze::MapIndexI::untypedUpperBound(const Key& k, bool ro, const MapHelperI& m) const -{ - IceUtil::UniquePtr r(new IteratorHelperI(m, ro, _index, false)); - - if(r->upperBound(k)) - { - return r.release(); - } - else - { - return 0; - } -} - -int -Freeze::MapIndexI::untypedCount(const Key& k, const ConnectionIPtr& connection) const -{ - Dbt dbKey; - initializeInDbt(k, dbKey); -#if (DB_VERSION_MAJOR <= 4) - // - // When we have a custom-comparison function, Berkeley DB returns - // the key on-disk (when it finds one). We disable this behavior: - // (ref Oracle SR 5925672.992) - // - dbKey.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); -#else - // - // In DB 5.x we can not set DB_DBT_PARTIAL in the key Dbt, - // when using DB_SET, we must resize the Dbt key param to hold enought - // space or Dbc::get fails with DB_BUFFER_SMALL. - // - dbKey.set_flags(DB_DBT_USERMEM); - dbKey.set_ulen(static_cast(k.size())); -#endif - - Dbt dbValue; - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - int result = 0; - - DbTxn* txn = connection->dbTxn(); - - try - { - for(;;) - { - Dbc* dbc = 0; - - try - { - // - // Move to the first record - // - _db->cursor(txn, &dbc, 0); - bool found = (dbc->get(&dbKey, &dbValue, DB_SET) == 0); - - if(found) - { - db_recno_t count = 0; - dbc->count(&count, 0); - result = static_cast(count); - } - - Dbc* toClose = dbc; - dbc = 0; - toClose->close(); - break; // for (;;) - } - catch(const DbDeadlockException&) - { - if(dbc != 0) - { - try - { - dbc->close(); - } - catch(const DbDeadlockException&) - { - if(txn != 0) - { - throw; - } - else - { - // - // Ignored - // - } - } - } - - if(connection->deadlockWarning()) - { - Warning out(connection->communicator()->getLogger()); - out << "Deadlock in Freeze::MapIndexI::untypedCount while searching \"" - << _dbName << "\""; - } - - if(txn != 0) - { - throw; - } - // - // Otherwise retry - // - } - catch(...) - { - if(dbc != 0) - { - try - { - dbc->close(); - } - catch(const DbDeadlockException&) - { - if(txn != 0) - { - throw; - } - else - { - // - // Ignored - // - } - } - } - throw; - } - } - } - catch(const DbDeadlockException& dx) - { - throw DeadlockException(__FILE__, __LINE__, dx.what(), connection->currentTransaction()); - } - catch(const DbException& dx) - { - throw DatabaseException(__FILE__, __LINE__, dx.what()); - } - - return result; -} - -int -Freeze::MapIndexI::secondaryKeyCreate(Db* /*secondary*/, const Dbt* /*dbKey*/, const Dbt* dbValue, Dbt* result) -{ - Byte* first = static_cast(dbValue->get_data()); - Value value(first, first + dbValue->get_size()); - - Key bytes; - _index->marshalKey(value, bytes); - - result->set_flags(DB_DBT_APPMALLOC); - void* data = malloc(bytes.size()); - memcpy(data, &bytes[0], bytes.size()); - result->set_data(data); - result->set_size(static_cast(bytes.size())); - return 0; -} - -// -// Print for the various exception types. -// -void -Freeze::DeadlockException::ice_print(ostream& out) const -{ - Exception::ice_print(out); - out << ":\ndatabase deadlock:\n" << message; -} - -void -Freeze::NotFoundException::ice_print(ostream& out) const -{ - Exception::ice_print(out); - out << ":\ndatabase record not found:\n" << message; -} - -void -Freeze::DatabaseException::ice_print(ostream& out) const -{ - Exception::ice_print(out); - out << ":\n" << message; -} - -void -Freeze::IndexNotFoundException::ice_print(ostream& out) const -{ - Exception::ice_print(out); - out << ":\ncould not find index \"" << indexName << "\" on map \"" << mapName << "\""; -} diff --git a/cpp/src/Freeze/MapI.h b/cpp/src/Freeze/MapI.h deleted file mode 100644 index 295035d4dad..00000000000 --- a/cpp/src/Freeze/MapI.h +++ /dev/null @@ -1,215 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_MAP_I_H -#define FREEZE_MAP_I_H - -#include -#include -#ifdef ICE_CPP11 -# include -#endif - -namespace Freeze -{ - -class MapDb; -class MapHelperI; - -class IteratorHelperI : public IteratorHelper -{ -public: - - IteratorHelperI(const MapHelperI& m, bool readOnly, const MapIndexBasePtr& index, bool onlyDups); - IteratorHelperI(const IteratorHelperI&); - - virtual - ~IteratorHelperI() ICE_NOEXCEPT_FALSE; - - bool - find(const Key& k) const; - - bool - find(const Dbt& k) const; - - bool - lowerBound(const Key& k) const; - - bool - upperBound(const Key& k) const; - - virtual IteratorHelper* - clone() const; - - virtual const Key* - get() const; - - virtual void - get(const Key*&, const Value*&) const; - - virtual void - set(const Value&); - - virtual void - set(const Dbt&); - - virtual void - erase(); - - virtual bool - next() const; - - bool next(bool) const; - - void - close(); - - class Tx -#ifndef ICE_CPP11 - : public IceUtil::SimpleShared -#endif - { - public: - - Tx(const MapHelperI&); - ~Tx() ICE_NOEXCEPT_FALSE; - - void dead(); - - DbTxn* getTxn() - { - return _txn; - } - - private: - const MapHelperI& _map; - DbTxn* _txn; - bool _dead; - }; - -#ifdef ICE_CPP11 - typedef std::shared_ptr TxPtr; -#else - typedef IceUtil::Handle TxPtr; -#endif - - const TxPtr& - tx() const; - -private: - - void - cleanup(); - - const MapHelperI& _map; - Dbc* _dbc; - const bool _indexed; - const bool _onlyDups; - TxPtr _tx; - - mutable Key _key; - mutable Value _value; -}; - -class MapHelperI : public MapHelper -{ -public: - - MapHelperI(const ConnectionIPtr&, const std::string&, const std::string&, const std::string&, - const KeyCompareBasePtr&, const std::vector&, bool); - - virtual ~MapHelperI(); - - virtual IteratorHelper* - find(const Key&, bool) const; - - virtual IteratorHelper* - find(const Dbt&, bool) const; - - virtual IteratorHelper* - lowerBound(const Key&, bool) const; - - virtual IteratorHelper* - upperBound(const Key&, bool) const; - - virtual void - put(const Key&, const Value&); - - virtual void - put(const Dbt&, const Dbt&); - - virtual size_t - erase(const Key&); - - virtual size_t - erase(const Dbt&); - - virtual size_t - count(const Key&) const; - - virtual size_t - count(const Dbt&) const; - - virtual void - clear(); - - virtual void - destroy(); - - virtual size_t - size() const; - - virtual void - closeAllIterators(); - - virtual const MapIndexBasePtr& - index(const std::string&) const; - - virtual void - closeDb(); - - virtual ConnectionPtr - getConnection() const; - - void - close(); - - const ConnectionIPtr& connection() const - { - return _connection; - } - - typedef std::map IndexMap; - -private: - - virtual void - closeAllIteratorsExcept(const IteratorHelperI::TxPtr&) const; - - friend class IteratorHelperI; - friend class IteratorHelperI::Tx; - - const ConnectionIPtr _connection; - mutable std::list _iteratorList; - MapDb* _db; - const std::string _dbName; - IndexMap _indices; - - Ice::Int _trace; -}; - -inline const IteratorHelperI::TxPtr& -IteratorHelperI::tx() const -{ - return _tx; -} - -} - -#endif diff --git a/cpp/src/Freeze/ObjectStore.cpp b/cpp/src/Freeze/ObjectStore.cpp deleted file mode 100644 index 6f8fe4e3403..00000000000 --- a/cpp/src/Freeze/ObjectStore.cpp +++ /dev/null @@ -1,678 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace std; -using namespace Ice; -using namespace Freeze; - -Freeze::ObjectStoreBase::ObjectStoreBase(const string& facet, const string& facetType, - bool createDb, EvictorIBase* evictor, - const vector& indices, - bool populateEmptyIndices) : - _facet(facet), - _evictor(evictor), - _indices(indices), - _communicator(evictor->communicator()), - _encoding(evictor->encoding()), - _keepStats(false) -{ - if(facet == "") - { - _dbName = EvictorIBase::defaultDb; - } - else - { - _dbName = facet; - } - - if(!facetType.empty()) - { - // - // Create a sample servant with this type - // - ObjectFactoryPtr factory = _communicator->findObjectFactory(facetType); - if(factory == 0) - { - throw DatabaseException(__FILE__, __LINE__, "No object factory registered for type-id '" + facetType + "'"); - } - - _sampleServant = factory->create(facetType); - } - - ConnectionPtr catalogConnection = createConnection(_communicator, evictor->dbEnv()->getEnvName()); - Catalog catalog(catalogConnection, catalogName()); - - Catalog::iterator p = catalog.find(evictor->filename()); - if(p != catalog.end()) - { - if(p->second.evictor) - { - // - // empty means the value is ::Freeze::ObjectRecord - // - _keepStats = p->second.value.empty(); - } - else - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = evictor->filename() + " is not an evictor database"; - throw ex; - } - } - - DbEnv* dbEnv = evictor->dbEnv()->getEnv(); - - try - { - _db.reset(new Db(dbEnv, 0)); - - Ice::PropertiesPtr properties = evictor->communicator()->getProperties(); - string propPrefix = "Freeze.Evictor." + evictor->filename() + "."; - - int btreeMinKey = properties->getPropertyAsInt(propPrefix + _dbName + ".BtreeMinKey"); - if(btreeMinKey > 2) - { - if(evictor->trace() >= 1) - { - Trace out(evictor->communicator()->getLogger(), "Freeze.Evictor"); - out << "Setting \"" << evictor->filename() + "." + _dbName << "\"'s btree minkey to " << btreeMinKey; - } - - _db->set_bt_minkey(btreeMinKey); - } - - bool checksum = properties->getPropertyAsInt(propPrefix + "Checksum") > 0; - if(checksum) - { - if(evictor->trace() >= 1) - { - Trace out(evictor->communicator()->getLogger(), "Freeze.Evictor"); - out << "Turning checksum on for \"" << evictor->filename() << "\""; - } - - _db->set_flags(DB_CHKSUM); - } - - int pageSize = properties->getPropertyAsInt(propPrefix + "PageSize"); - if(pageSize > 0) - { - if(evictor->trace() >= 1) - { - Trace out(evictor->communicator()->getLogger(), "Freeze.Evictor"); - out << "Setting \"" << evictor->filename() << "\"'s pagesize to " << pageSize; - } - - _db->set_pagesize(pageSize); - } - - - TransactionPtr tx = catalogConnection->beginTransaction(); - DbTxn* txn = getTxn(tx); - - u_int32_t flags = DB_THREAD; - if(createDb) - { - flags |= DB_CREATE; - } - - // - // Berkeley DB expects file paths to be UTF8 encoded. We keep - // _dbName as a native string here, while it might have - // been better to convert it to UTF-8, changing this isn't - // possible without potentially breaking backward compatibility - // with deployed databases. - // - _db->open(txn, - IceUtil::nativeToUTF8(evictor->filename(), IceUtil::getProcessStringConverter()).c_str(), - _dbName.c_str(), DB_BTREE, flags, FREEZE_DB_MODE); - - for(size_t i = 0; i < _indices.size(); ++i) - { - _indices[i]->_impl->associate(this, txn, createDb, populateEmptyIndices); - } - - if(p == catalog.end()) - { - CatalogData catalogData; - catalogData.evictor = true; - catalogData.key = "Ice::Identity"; - catalogData.value = "Object"; - catalog.put(Catalog::value_type(evictor->filename(), catalogData)); - } - - tx->commit(); - } - catch(const DbException& dx) - { - TransactionPtr tx = catalogConnection->currentTransaction(); - if(tx != 0) - { - try - { - tx->rollback(); - } - catch(...) - { - } - } - - if(dx.get_errno() == ENOENT) - { - NotFoundException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - else - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - } - catch(...) - { - TransactionPtr tx = catalogConnection->currentTransaction(); - if(tx != 0) - { - try - { - tx->rollback(); - } - catch(...) - { - } - } - throw; - } -} - -Freeze::ObjectStoreBase::~ObjectStoreBase() -{ - try - { - _db->close(0); - - for(size_t i = 0; i < _indices.size(); ++i) - { - try - { - _indices[i]->_impl->close(); - } - catch(const DatabaseException& ex) - { - Ice::Error error(_communicator->getLogger()); - error << "Freeze: closing ObjectStore " << _dbName << " raised DatabaseException: " << ex.what(); - } - } - _indices.clear(); - } - catch(const DbException& dx) - { - Ice::Error error(_communicator->getLogger()); - error << "Freeze: closing ObjectStore " << _dbName << " raised DbException: " << dx.what(); - } -} - -bool -Freeze::ObjectStoreBase::dbHasObject(const Identity& ident, const TransactionIPtr& transaction) const -{ - DbTxn* tx = 0; - if(transaction != 0) - { - tx = transaction->dbTxn(); - if(tx == 0) - { - throw DatabaseException(__FILE__, __LINE__, "inactive transaction"); - } - } - - Dbt dbKey; - KeyMarshaler km(ident, _communicator, _encoding); - km.getDbt(dbKey); - - // - // Keep 0 length since we're not interested in the data - // - Dbt dbValue; - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - for(;;) - { - try - { - int err = _db->get(tx, &dbKey, &dbValue, 0); - - if(err == 0) - { - return true; - } - else if(err == DB_NOTFOUND) - { - return false; - } - else - { - assert(0); - throw DatabaseException(__FILE__, __LINE__); - } - } - catch(const DbDeadlockException& dx) - { - if(_evictor->deadlockWarning()) - { - Warning out(_communicator->getLogger()); - out << "Deadlock in Freeze::ObjectStoreBase::dbHasObject while searching \"" - << _evictor->filename() + "/" + _dbName << "\"; retrying ..."; - } - - if(tx != 0) - { - throw DeadlockException(__FILE__, __LINE__, dx.what(), transaction); - } - // Else, try again - } - catch(const DbException& dx) - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - } - -} - -void -Freeze::ObjectStoreBase::save(Dbt& key, Dbt& value, Byte status, DbTxn* tx) -{ - switch(status) - { - case created: - case modified: - { - u_int32_t flags = (status == created) ? DB_NOOVERWRITE : 0; - int err = _db->put(tx, &key, &value, flags); - if(err != 0) - { - throw DatabaseException(__FILE__, __LINE__); - } - break; - } - - case destroyed: - { - int err = _db->del(tx, &key, 0); - if(err != 0) - { - throw DatabaseException(__FILE__, __LINE__); - } - break; - } - default: - { - assert(0); - } - } -} - -Freeze::ObjectStoreBase::Marshaler::Marshaler(const CommunicatorPtr& communicator, - const EncodingVersion& encoding) : - _os(IceInternal::getInstance(communicator).get(), encoding) -{ -} - -void -Freeze::ObjectStoreBase::Marshaler::getDbt(Dbt& dbt) const -{ - initializeInDbt(const_cast(_os), dbt); -} - -Freeze::ObjectStoreBase::KeyMarshaler::KeyMarshaler(const Identity& ident, - const CommunicatorPtr& communicator, - const EncodingVersion& encoding) : - Marshaler(communicator, encoding) -{ - _os.write(ident); -} - -Freeze::ObjectStoreBase::ValueMarshaler::ValueMarshaler(const ObjectRecord& rec, - const CommunicatorPtr& communicator, - const EncodingVersion& encoding, - bool keepStats) : - Marshaler(communicator, encoding) -{ - _os.startWriteEncaps(); - if(keepStats) - { - _os.write(rec); - } - else - { - _os.write(rec.servant); - } - - _os.writePendingObjects(); - _os.endWriteEncaps(); -} - -void -Freeze::ObjectStoreBase::unmarshal(Identity& ident, - const Key& bytes, - const CommunicatorPtr& communicator, - const EncodingVersion& encoding) -{ - IceInternal::InstancePtr instance = IceInternal::getInstance(communicator); - IceInternal::BasicStream stream(instance.get(), encoding, &bytes[0], &bytes[0] + bytes.size()); - stream.read(ident); -} - -void -Freeze::ObjectStoreBase::unmarshal(ObjectRecord& v, - const Value& bytes, - const CommunicatorPtr& communicator, - const EncodingVersion& encoding, - bool keepStats) -{ - IceInternal::InstancePtr instance = IceInternal::getInstance(communicator); - IceInternal::BasicStream stream(instance.get(), encoding, &bytes[0], &bytes[0] + bytes.size()); - stream.sliceObjects(false); - stream.startReadEncaps(); - - if(keepStats) - { - stream.read(v); - } - else - { - stream.read(v.servant); - } - - stream.readPendingObjects(); - stream.endReadEncaps(); -} - -bool -Freeze::ObjectStoreBase::load(const Identity& ident, const TransactionIPtr& transaction, ObjectRecord& rec) -{ - if(transaction == 0) - { - throw DatabaseException(__FILE__, __LINE__, "no active transaction"); - } - - DbTxn* txn = transaction->dbTxn(); - - if(txn == 0) - { - throw DatabaseException(__FILE__, __LINE__, "inactive transaction"); - } - - Dbt dbKey; - KeyMarshaler km(ident, _communicator, _encoding); - km.getDbt(dbKey); - - const size_t defaultValueSize = 4096; - Value value(defaultValueSize); - - Dbt dbValue; - initializeOutDbt(value, dbValue); - - for(;;) - { - try - { - int rs =_db->get(txn, &dbKey, &dbValue, 0); - if(rs == DB_NOTFOUND) - { - return false; - } - else if(rs != 0) - { - assert(0); - throw DatabaseException(__FILE__, __LINE__); - } - break; // for(;;) - } - catch(const DbDeadlockException& dx) - { - if(_evictor->deadlockWarning()) - { - Warning out(_communicator->getLogger()); - out << "Deadlock in Freeze::ObjectStoreBase::load while searching \"" - << _evictor->filename() + "/" + _dbName << "\""; - } - throw DeadlockException(__FILE__, __LINE__, dx.what(), transaction); - } - catch(const DbException& dx) - { - handleDbException(dx, value, dbValue, __FILE__, __LINE__); - } - } - - unmarshal(rec, value, _communicator, _encoding, _keepStats); - _evictor->initialize(ident, _facet, rec.servant); - return true; -} - -void -Freeze::ObjectStoreBase::update(const Identity& ident, const ObjectRecord& rec, const TransactionIPtr& transaction) -{ - if(transaction == 0) - { - throw DatabaseException(__FILE__, __LINE__, "no active transaction"); - } - - DbTxn* txn = transaction->dbTxn(); - - if(txn == 0) - { - throw DatabaseException(__FILE__, __LINE__, "inactive transaction"); - } - - Dbt dbKey; - KeyMarshaler km(ident, _communicator, _encoding); - km.getDbt(dbKey); - - Dbt dbValue; - ValueMarshaler vm(rec, _communicator, _encoding, _keepStats); - vm.getDbt(dbValue); - - u_int32_t flags = 0; - - try - { - _db->put(txn, &dbKey, &dbValue, flags); - } - catch(const DbDeadlockException& dx) - { - if(_evictor->deadlockWarning()) - { - Warning out(_communicator->getLogger()); - out << "Deadlock in Freeze::ObjectStoreBase::update while updating \"" - << _evictor->filename() + "/" + _dbName << "\""; - } - throw DeadlockException(__FILE__, __LINE__, dx.what(), transaction); - } - catch(const DbException& dx) - { - handleDbException(dx, __FILE__, __LINE__); - } -} - -bool -Freeze::ObjectStoreBase::insert(const Identity& ident, const ObjectRecord& rec, const TransactionIPtr& transaction) -{ - DbTxn* tx = 0; - if(transaction != 0) - { - tx = transaction->dbTxn(); - if(tx == 0) - { - throw DatabaseException(__FILE__, __LINE__, "inactive transaction"); - } - } - - Dbt dbKey; - KeyMarshaler km(ident, _communicator, _encoding); - km.getDbt(dbKey); - - Dbt dbValue; - ValueMarshaler vm(rec, _communicator, _encoding, _keepStats); - vm.getDbt(dbValue); - - u_int32_t flags = DB_NOOVERWRITE; - if(tx == 0) - { - flags |= DB_AUTO_COMMIT; - } - - for(;;) - { - try - { - return _db->put(tx, &dbKey, &dbValue, flags) == 0; - } - catch(const DbDeadlockException& dx) - { - if(_evictor->deadlockWarning()) - { - Warning out(_communicator->getLogger()); - out << "Deadlock in Freeze::ObjectStoreBase::insert while updating \"" - << _evictor->filename() + "/" + _dbName << "\""; - } - if(tx != 0) - { - throw DeadlockException(__FILE__, __LINE__, dx.what(), transaction); - } - // - // Otherwise, try again - // - } - catch(const DbException& dx) - { - handleDbException(dx, __FILE__, __LINE__); - } - } -} - -bool -Freeze::ObjectStoreBase::remove(const Identity& ident, const TransactionIPtr& transaction) -{ - DbTxn* tx = 0; - if(transaction != 0) - { - tx = transaction->dbTxn(); - if(tx == 0) - { - throw DatabaseException(__FILE__, __LINE__, "inactive transaction"); - } - } - - Dbt dbKey; - KeyMarshaler km(ident, _communicator, _encoding); - km.getDbt(dbKey); - - for(;;) - { - try - { - return _db->del(tx, &dbKey, tx != 0 ? 0 : DB_AUTO_COMMIT) == 0; - } - catch(const DbDeadlockException& dx) - { - if(_evictor->deadlockWarning()) - { - Warning out(_communicator->getLogger()); - out << "Deadlock in Freeze::ObjectStoreBase::remove while updating \"" - << _evictor->filename() + "/" + _dbName << "\""; - } - if(tx != 0) - { - throw DeadlockException(__FILE__, __LINE__, dx.what(), transaction); - } - // - // Otherwise, try again - // - } - catch(const DbException& dx) - { - handleDbException(dx, __FILE__, __LINE__); - } - } -} - - -const string& -Freeze::ObjectStoreBase::dbName() const -{ - return _dbName; -} - -// -// Non transactional load -// -bool -Freeze::ObjectStoreBase::loadImpl(const Identity& ident, ObjectRecord& rec) -{ - Dbt dbKey; - KeyMarshaler km(ident, _communicator, _encoding); - km.getDbt(dbKey); - - const size_t defaultValueSize = 4096; - Value value(defaultValueSize); - - Dbt dbValue; - initializeOutDbt(value, dbValue); - - for(;;) - { - try - { - int rs = _db->get(0, &dbKey, &dbValue, 0); - if(rs == DB_NOTFOUND) - { - return false; - } - else if(rs != 0) - { - assert(0); - throw DatabaseException(__FILE__, __LINE__); - } - break; // for(;;) - } - catch(const DbDeadlockException&) - { - if(_evictor->deadlockWarning()) - { - Warning out(_communicator->getLogger()); - out << "Deadlock in Freeze::ObjectStoreBase::load while searching \"" - << _evictor->filename() + "/" + _dbName << "\"; retrying ..."; - } - // - // Ignored, try again - // - } - catch(const DbException& dx) - { - handleDbException(dx, value, dbValue, __FILE__, __LINE__); - } - } - - unmarshal(rec, value, _communicator, _encoding, _keepStats); - _evictor->initialize(ident, _facet, rec.servant); - return true; -} diff --git a/cpp/src/Freeze/ObjectStore.h b/cpp/src/Freeze/ObjectStore.h deleted file mode 100644 index 3c8ca7cdb29..00000000000 --- a/cpp/src/Freeze/ObjectStore.h +++ /dev/null @@ -1,206 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_OBJECT_STORE_H -#define FREEZE_OBJECT_STORE_H - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace Freeze -{ - -template class EvictorI; - -class EvictorIBase; - -class ObjectStoreBase -{ -public: - - ObjectStoreBase(const std::string&, const std::string&, bool, EvictorIBase*, - const std::vector&, bool); - - virtual ~ObjectStoreBase(); - - const Ice::ObjectPtr& sampleServant() const; - - bool dbHasObject(const Ice::Identity&, const TransactionIPtr&) const; - void save(Dbt&, Dbt&, Ice::Byte, DbTxn*); - - // - // This base class encapsulates a BasicStream, which allows us to avoid - // making any extra copies of marshaled data when updating the database. - // - class Marshaler - { - public: - - Marshaler(const Ice::CommunicatorPtr&, const Ice::EncodingVersion&); - - void getDbt(Dbt&) const; - - protected: - - IceInternal::BasicStream _os; - }; - - class KeyMarshaler : public Marshaler - { - public: - - KeyMarshaler(const Ice::Identity&, const Ice::CommunicatorPtr&, const Ice::EncodingVersion&); - }; - - class ValueMarshaler : public Marshaler - { - public: - - ValueMarshaler(const ObjectRecord&, const Ice::CommunicatorPtr&, const Ice::EncodingVersion&, bool); - }; - - static void unmarshal(Ice::Identity&, const Key&, const Ice::CommunicatorPtr&, const Ice::EncodingVersion&); - static void unmarshal(ObjectRecord&, const Value&, const Ice::CommunicatorPtr&, const Ice::EncodingVersion&, bool); - - bool load(const Ice::Identity&, const TransactionIPtr&, ObjectRecord&); - void update(const Ice::Identity&, const ObjectRecord&, const TransactionIPtr&); - - bool insert(const Ice::Identity&, const ObjectRecord&, const TransactionIPtr&); - bool remove(const Ice::Identity&, const TransactionIPtr&); - - EvictorIBase* evictor() const; - - // - // For IndexI and Iterator - // - Db* db() const; - const std::string& dbName() const; - - const Ice::CommunicatorPtr& communicator() const; - const Ice::EncodingVersion& encoding() const; - const std::string& facet() const; - bool keepStats() const; - -protected: - - bool loadImpl(const Ice::Identity&, ObjectRecord&); - -private: - - IceUtil::UniquePtr _db; - std::string _facet; - std::string _dbName; - EvictorIBase* _evictor; - std::vector _indices; - Ice::CommunicatorPtr _communicator; - Ice::EncodingVersion _encoding; - Ice::ObjectPtr _sampleServant; - bool _keepStats; -}; - - -template -class ObjectStore : public ObjectStoreBase, public IceUtil::Cache -{ - public: - - ObjectStore(const std::string& facet, const std::string facetType, - bool createDb, EvictorIBase* evictor, - const std::vector& indices = std::vector(), - bool populateEmptyIndices = false) : - ObjectStoreBase(facet, facetType, createDb, evictor, indices, populateEmptyIndices) - { - } - - using ObjectStoreBase::load; - - typedef IceUtil::Cache Cache; - -protected: - - virtual IceUtil::Handle - load(const Ice::Identity& ident) - { - ObjectRecord rec; - if(loadImpl(ident, rec)) - { - return new T(rec, *this); - } - else - { - return 0; - } - } - - virtual void - pinned(const IceUtil::Handle& element, typename Cache::Position p) - { - element->init(p); - } -}; - -// -// Inline member function definitions -// - -inline Db* -ObjectStoreBase::db() const -{ - return _db.get(); -} - -inline const Ice::CommunicatorPtr& -ObjectStoreBase::communicator() const -{ - return _communicator; -} - -inline const Ice::EncodingVersion& -ObjectStoreBase::encoding() const -{ - return _encoding; -} - -inline EvictorIBase* -ObjectStoreBase::evictor() const -{ - return _evictor; -} - -inline const std::string& -ObjectStoreBase::facet() const -{ - return _facet; -} - -inline bool -ObjectStoreBase::keepStats() const -{ - return _keepStats; -} - -inline const Ice::ObjectPtr& -ObjectStoreBase::sampleServant() const -{ - return _sampleServant; -} - -} - -#endif - diff --git a/cpp/src/Freeze/PingObject.ice b/cpp/src/Freeze/PingObject.ice deleted file mode 100644 index ced2fc31f1f..00000000000 --- a/cpp/src/Freeze/PingObject.ice +++ /dev/null @@ -1,22 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#pragma once - -[["cpp:header-ext:h"]] - -module Freeze -{ - -class PingObject -{ -}; - -}; - diff --git a/cpp/src/Freeze/SharedDbEnv.cpp b/cpp/src/Freeze/SharedDbEnv.cpp deleted file mode 100644 index d467e6cae3c..00000000000 --- a/cpp/src/Freeze/SharedDbEnv.cpp +++ /dev/null @@ -1,755 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include - - -using namespace std; -using namespace IceUtil; -using namespace Ice; -using namespace Freeze; - -namespace Freeze -{ - -class CheckpointThread : public Thread, public Monitor -{ -public: - - CheckpointThread(SharedDbEnv&, const Time&, Int, Int); - - virtual void run(); - - void terminate(); - -private: - SharedDbEnv& _dbEnv; - bool _done; - Time _checkpointPeriod; - Int _kbyte; - Int _trace; -}; - -} - -namespace -{ - -struct MapKey -{ - string envName; - Ice::CommunicatorPtr communicator; -}; - -inline bool -operator<(const MapKey& lhs, const MapKey& rhs) -{ - return (lhs.communicator < rhs.communicator) || - ((lhs.communicator == rhs.communicator) && (lhs.envName < rhs.envName)); -} - -#if DB_VERSION_MAJOR < 4 -#error Freeze requires DB 4.x or greater -#endif - -#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR < 3 -void -dbErrCallback(const char* prefix, char* msg) -#else -void -dbErrCallback(const ::DbEnv* /*ignored*/, const char* prefix, const char* msg) -#endif -{ - const Freeze::SharedDbEnv* env = reinterpret_cast(prefix); - assert(env != 0); - - Ice::Trace out(env->getCommunicator()->getLogger(), "Berkeley DB"); - out << "DbEnv \"" << env->getEnvName() << "\": " << msg; -} - -namespace -{ - -Mutex* mapMutex = 0; -Mutex* refCountMutex = 0; - -class Init -{ -public: - - Init() - { - mapMutex = new IceUtil::Mutex; - refCountMutex = new IceUtil::Mutex; - } - - ~Init() - { - delete mapMutex; - mapMutex = 0; - - delete refCountMutex; - refCountMutex = 0; - } -}; - -Init init; - -} - -typedef map SharedDbEnvMap; -SharedDbEnvMap* sharedDbEnvMap; - -} - -Freeze::SharedDbEnvPtr -Freeze::SharedDbEnv::get(const CommunicatorPtr& communicator, const string& envName, DbEnv* env) -{ - IceUtilInternal::MutexPtrLock lock(mapMutex); - - if(sharedDbEnvMap == 0) - { - sharedDbEnvMap = new SharedDbEnvMap; - } - - MapKey key; - key.envName = envName; - key.communicator = communicator; - - { - SharedDbEnvMap::iterator p = sharedDbEnvMap->find(key); - if(p != sharedDbEnvMap->end()) - { - return p->second; - } - } - - // - // MapKey not found, let's create and open a new DbEnv - // - IceUtil::UniquePtr result(new SharedDbEnv(envName, communicator, env)); - - // - // Insert it into the map - // - pair insertResult; - insertResult = sharedDbEnvMap->insert(SharedDbEnvMap::value_type(key, result.get())); - assert(insertResult.second); - - return result.release(); -} - -Freeze::SharedDbEnv::~SharedDbEnv() -{ - try - { - cleanup(); - } - catch(const Ice::Exception& ex) - { - Error out(_communicator->getLogger()); - out << "Freeze DbEnv close error:" << ex; - } - catch(const std::exception& ex) - { - Error out(_communicator->getLogger()); - out << "Freeze DbEnv close error:" << ex.what(); - } - catch(...) - { - Error out(_communicator->getLogger()); - out << "Freeze DbEnv close error: unknown exception"; - } - -#ifdef _WIN32 - if(!TlsFree(_tsdKey)) - { - Error out(_communicator->getLogger()); - out << "Freeze DbEnv close error:" << IceUtilInternal::lastErrorToString(); - } -#else - int err = pthread_key_delete(_tsdKey); - if(err != 0) - { - Error out(_communicator->getLogger()); - out << "Freeze DbEnv close error:" << IceUtilInternal::errorToString(err); - } -#endif -} - - -Freeze::MapDb* -Freeze::SharedDbEnv::getSharedMapDb(const string& dbName, - const string& key, - const string& value, - const KeyCompareBasePtr& keyCompare, - const vector& indices, - bool createDb) -{ - // - // We don't want to lock to retrieve the catalog or catalog index - // - - if(dbName == _catalog->dbName()) - { - _catalog->checkTypes(key, value); - return _catalog; - } - else if(dbName == _catalogIndexList->dbName()) - { - _catalogIndexList->checkTypes(key, value); - return _catalogIndexList; - } - - IceUtil::Mutex::Lock lock(_mutex); - - SharedDbMap::iterator p = _sharedDbMap.find(dbName); - if(p != _sharedDbMap.end()) - { - MapDb* db = p->second; - db->checkTypes(key, value); - db->connectIndices(indices); - return db; - } - - - // - // key not found, let's create and open a new Db - // - - // - // Since we're going to put this SharedDb in the map no matter - // what, we use our own transaction and connection to do so - // - - ConnectionIPtr insertConnection = new ConnectionI(this); - - IceUtil::UniquePtr result(new MapDb(insertConnection, dbName, key, value, - keyCompare, indices, createDb)); - - // - // Insert it into the map - // - pair insertResult; - insertResult = _sharedDbMap.insert(SharedDbMap::value_type(dbName, result.get())); - assert(insertResult.second); - - return result.release(); -} - - - -void -Freeze::SharedDbEnv::removeSharedMapDb(const string& dbName) -{ - IceUtil::Mutex::Lock lock(_mutex); - - SharedDbMap::iterator p = _sharedDbMap.find(dbName); - if(p != _sharedDbMap.end()) - { - MapDb* db = p->second; - _sharedDbMap.erase(p); - delete db; - } -} - - -void -Freeze::SharedDbEnv::__incRef() -{ - IceUtilInternal::MutexPtrLock lock(refCountMutex); - _refCount++; -} - -void -Freeze::SharedDbEnv::__decRef() -{ - IceUtilInternal::MutexPtrLock lock(refCountMutex); - if(--_refCount == 0) - { - MapKey key; - key.envName = _envName; - key.communicator = _communicator; - - - IceUtilInternal::MutexPtrTryLock mapLock(mapMutex); - if(!mapLock.acquired()) - { - // - // Reacquire mutex in proper order and check again - // - lock.release(); - mapLock.acquire(); - lock.acquire(); - - // - // Now, maybe another thread has deleted 'this'; let's check - // we're still in the map - // - - if(sharedDbEnvMap == 0) - { - return; - } - - SharedDbEnvMap::iterator p = sharedDbEnvMap->find(key); - - if(p == sharedDbEnvMap->end() || p->second != this) - { - // - // 'this' has been deleted by another thread - // - return; - } - - if(_refCount > 0) - { - return; - } - } - - // - // Remove from map - // -#ifndef NDEBUG - size_t one = sharedDbEnvMap->erase(key); - assert(one == 1); -#else - sharedDbEnvMap->erase(key); -#endif - if(sharedDbEnvMap->size() == 0) - { - delete sharedDbEnvMap; - sharedDbEnvMap = 0; - } - - // - // Keep lock to prevent somebody else from reopening this DbEnv - // before it's closed. - // - delete this; - } -} - - -Freeze::TransactionalEvictorContextPtr -Freeze::SharedDbEnv::createCurrent() -{ - assert(getCurrent() == 0); - - Freeze::TransactionalEvictorContextPtr ctx = new TransactionalEvictorContext(this); -#ifdef _WIN32 - if(TlsSetValue(_tsdKey, ctx.get()) == 0) - { - IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } -#else - if(int err = pthread_setspecific(_tsdKey, ctx.get())) - { - throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, err); - } -#endif - - // - // Give one refcount to this thread! - // - ctx->__incRef(); - return ctx; -} - -Freeze::TransactionalEvictorContextPtr -Freeze::SharedDbEnv::getCurrent() -{ -#ifdef _WIN32 - void* val = TlsGetValue(_tsdKey); -#else - void* val = pthread_getspecific(_tsdKey); -#endif - - if(val != 0) - { - return static_cast(val); - } - else - { - return 0; - } -} - -void -Freeze::SharedDbEnv::setCurrentTransaction(const Freeze::TransactionPtr& tx) -{ - TransactionIPtr txi; - - if(tx != 0) - { - txi = Freeze::TransactionIPtr::dynamicCast(tx); - - // - // Verify it points to the good DbEnv - // - ConnectionIPtr conn = ConnectionIPtr::dynamicCast(tx->getConnection()); - if(!conn || conn->dbEnv() == 0) - { - throw DatabaseException(__FILE__, __LINE__, "invalid transaction"); - } - - if(conn->dbEnv().get() != this) - { - throw DatabaseException(__FILE__, __LINE__, "the given transaction is bound to environment '" + - conn->dbEnv()->_envName + "'"); - } - } - - Freeze::TransactionalEvictorContextPtr ctx = getCurrent(); - - if(ctx != 0) - { - // - // Release thread's refcount - // - ctx->__decRef(); - } - - if(tx != 0) - { - if(ctx == 0 || ctx->transaction().get() != txi.get()) - { - ctx = new TransactionalEvictorContext(txi); - -#ifdef _WIN32 - if(TlsSetValue(_tsdKey, ctx.get()) == 0) - { - IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } -#else - if(int err = pthread_setspecific(_tsdKey, ctx.get())) - { - throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, err); - } -#endif - // - // Give one refcount to this thread - // - ctx->__incRef(); - } - } - else if(ctx != 0) - { -#ifdef _WIN32 - if(TlsSetValue(_tsdKey, 0) == 0) - { - IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } -#else - if(int err = pthread_setspecific(_tsdKey, 0)) - { - throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, err); - } -#endif - } -} - -Freeze::SharedDbEnv::SharedDbEnv(const std::string& envName, - const Ice::CommunicatorPtr& communicator, DbEnv* env) : - _env(env), - _envName(envName), - _communicator(communicator), - _catalog(0), - _catalogIndexList(0), - _refCount(0) -{ - Ice::PropertiesPtr properties = _communicator->getProperties(); - -#ifdef _WIN32 - _tsdKey = TlsAlloc(); - if(_tsdKey == TLS_OUT_OF_INDEXES) - { - throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } -#else - int err = pthread_key_create(&_tsdKey, 0); - if(err != 0) - { - throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, err); - } -#endif - - string propertyPrefix = string("Freeze.DbEnv.") + envName; - string dbHome = properties->getPropertyWithDefault(propertyPrefix + ".DbHome", envName); - - string encoding = properties->getPropertyWithDefault(propertyPrefix + ".EncodingVersion", - encodingVersionToString(Ice::currentEncoding)); - _encoding = stringToEncodingVersion(encoding); - IceInternal::checkSupportedEncoding(_encoding); - - // - // Normally the file lock is necessary, but for read-only situations (such as when - // using the FreezeScript utilities) this property allows the file lock to be - // disabled. - // - if(properties->getPropertyAsIntWithDefault(propertyPrefix + ".LockFile", 1) > 0) - { - // - // Use a file lock to prevent multiple processes from opening the same db env. We - // create the lock file in a sub-directory to ensure db_hotbackup won't try to copy - // the file when backing up the environment (this would fail on Windows where copying - // a locked file isn't possible). - // - if(!::IceUtilInternal::directoryExists(dbHome + "/__Freeze")) - { - ::IceUtilInternal::mkdir(dbHome + "/__Freeze", 0777); - } - _fileLock = new ::IceUtilInternal::FileLock(dbHome + "/__Freeze/lock"); - } - - _trace = properties->getPropertyAsInt("Freeze.Trace.DbEnv"); - - try - { - if(_env == 0) - { - _envHolder.reset(new DbEnv(0)); - _env = _envHolder.get(); - - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.DbEnv"); - out << "opening database environment \"" << envName << "\""; - } - - _env->set_errpfx(reinterpret_cast(this)); - - _env->set_errcall(dbErrCallback); - -#ifdef _WIN32 - // - // Berkeley DB may use a different C++ runtime - // - _env->set_alloc(::malloc, ::realloc, ::free); -#endif - - // - // Deadlock detection - // - _env->set_lk_detect(DB_LOCK_YOUNGEST); - - u_int32_t flags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN; - - if(properties->getPropertyAsInt(propertyPrefix + ".DbRecoverFatal") > 0) - { - flags |= DB_RECOVER_FATAL | DB_CREATE; - } - else - { - flags |= DB_RECOVER | DB_CREATE; - } - - if(properties->getPropertyAsIntWithDefault(propertyPrefix + ".DbPrivate", 1) > 0) - { - flags |= DB_PRIVATE; - } - - // - // Auto delete - // - bool autoDelete = (properties->getPropertyAsIntWithDefault(propertyPrefix + ".OldLogsAutoDelete", 1) > 0); - - if(autoDelete) - { -#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR < 7) - // - // Old API - // - _env->set_flags(DB_LOG_AUTOREMOVE, 1); -#else - _env->log_set_config(DB_LOG_AUTO_REMOVE, 1); -#endif - } - - // - // Threading - // - flags |= DB_THREAD; - - // - // Berkeley DB expects file paths to be UTF8 encoded. - // - _env->open(nativeToUTF8(dbHome, getProcessStringConverter()).c_str(), flags, FREEZE_DB_MODE); - - // - // Default checkpoint period is every 120 seconds - // - Int checkpointPeriod = properties->getPropertyAsIntWithDefault(propertyPrefix + ".CheckpointPeriod", 120); - Int kbyte = properties->getPropertyAsIntWithDefault(propertyPrefix + ".PeriodicCheckpointMinSize", 0); - - if(checkpointPeriod > 0) - { - _thread = new CheckpointThread(*this, Time::seconds(checkpointPeriod), kbyte, _trace); - } - } - - // - // Get catalogs - // - _catalog = new MapDb(_communicator, _encoding, catalogName(), Catalog::keyTypeId(), - Catalog::valueTypeId(), _env); - _catalogIndexList = new MapDb(_communicator, _encoding, catalogIndexListName(), - CatalogIndexList::keyTypeId(), CatalogIndexList::valueTypeId(), _env); - } - catch(const ::DbException& dx) - { - cleanup(); - throw DatabaseException(__FILE__, __LINE__, dx.what()); - } -} - -void -Freeze::SharedDbEnv::cleanup() -{ - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.DbEnv"); - out << "closing database environment \"" << _envName << "\""; - } - - // - // Close & destroy all MapDbs - // - for(SharedDbMap::iterator p = _sharedDbMap.begin(); p != _sharedDbMap.end(); ++p) - { - try - { - delete p->second; - } - catch(const DatabaseException& ex) - { - Error out(_communicator->getLogger()); - out << "Freeze map: \"" << p->first << "\" close error: " << ex; - } - catch(const std::exception& ex) - { - Error out(_communicator->getLogger()); - out << "Freeze map: \"" << p->first << "\" close error: " << ex.what(); - } - catch(...) - { - Error out(_communicator->getLogger()); - out << "Freeze map: \"" << p->first << "\" close error: unknown exception."; - } - } - - // - // Same for catalogs - // - delete _catalog; - delete _catalogIndexList; - - // - // Then terminate checkpointing thread - // - if(_thread != 0) - { - _thread->terminate(); - _thread = 0; - } - - // - // And finally close env - // - - if(_envHolder.get() != 0) - { - try - { - _envHolder->close(0); - } - catch(const ::DbException& dx) - { - throw DatabaseException(__FILE__, __LINE__, dx.what()); - } - } -} - - -Freeze::CheckpointThread::CheckpointThread(SharedDbEnv& dbEnv, const Time& checkpointPeriod, Int kbyte, Int trace) : - Thread("Freeze checkpoint thread"), - _dbEnv(dbEnv), - _done(false), - _checkpointPeriod(checkpointPeriod), - _kbyte(kbyte), - _trace(trace) -{ - __setNoDelete(true); - start(); - __setNoDelete(false); -} - -void -Freeze::CheckpointThread::terminate() -{ - { - Lock sync(*this); - _done = true; - notify(); - } - - getThreadControl().join(); -} - -void -Freeze::CheckpointThread::run() -{ - for(;;) - { - { - Lock sync(*this); - while(!_done && timedWait(_checkpointPeriod)) - { - // - // Loop - // - } - if(_done) - { - return; - } - } - - try - { - if(_trace >= 2) - { - Trace out(_dbEnv.getCommunicator()->getLogger(), "Freeze.DbEnv"); - out << "checkpointing environment \"" << _dbEnv.getEnvName() << "\""; - } - _dbEnv.getEnv()->txn_checkpoint(_kbyte, 0, 0); - } - catch(const DbException& dx) - { - Warning out(_dbEnv.getCommunicator()->getLogger()); - out << "checkpoint on DbEnv \"" << _dbEnv.getEnvName() << "\" raised DbException: " << dx.what(); - } - } -} diff --git a/cpp/src/Freeze/SharedDbEnv.h b/cpp/src/Freeze/SharedDbEnv.h deleted file mode 100644 index 2d9858ef871..00000000000 --- a/cpp/src/Freeze/SharedDbEnv.h +++ /dev/null @@ -1,130 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_SHARED_DB_ENV_H -#define FREEZE_SHARED_DB_ENV_H - -#include -#include -#include -#include -#include -#include - -namespace Freeze -{ - -class CheckpointThread; -typedef IceUtil::Handle CheckpointThreadPtr; - -class SharedDbEnv; -typedef IceUtil::Handle SharedDbEnvPtr; - -class MapDb; - -class Transaction; -typedef IceInternal::Handle TransactionPtr; - -class ConnectionI; -typedef IceUtil::Handle ConnectionIPtr; - -class TransactionalEvictorContext; -typedef IceUtil::Handle TransactionalEvictorContextPtr; - -class SharedDbEnv -{ -public: - - static SharedDbEnvPtr get(const Ice::CommunicatorPtr&, const std::string&, DbEnv* = 0); - - ~SharedDbEnv(); - - // - // Returns a shared map Db; the caller should NOT close/delete this Db. - // - MapDb* getSharedMapDb(const std::string&,const std::string&, const std::string&, - const KeyCompareBasePtr&, const std::vector&, bool); - - // - // Tell SharedDbEnv to close and remove this Shared Db from the map - // - void removeSharedMapDb(const std::string&); - - - void __incRef(); - void __decRef(); - - // - // EvictorContext factory/manager - // - TransactionalEvictorContextPtr createCurrent(); - TransactionalEvictorContextPtr getCurrent(); - void setCurrentTransaction(const TransactionPtr& tx); - - DbEnv* getEnv() const; - const std::string& getEnvName() const; - const Ice::CommunicatorPtr& getCommunicator() const; - const Ice::EncodingVersion& getEncoding() const; - - typedef std::map SharedDbMap; - -private: - SharedDbEnv(const std::string&, const Ice::CommunicatorPtr&, DbEnv* env); - - void cleanup(); - - DbEnv* _env; - IceUtil::UniquePtr _envHolder; - const std::string _envName; - const Ice::CommunicatorPtr _communicator; - Ice::EncodingVersion _encoding; - MapDb* _catalog; - MapDb* _catalogIndexList; - - int _refCount; - int _trace; - CheckpointThreadPtr _thread; - -#ifdef _WIN32 - DWORD _tsdKey; -#else - pthread_key_t _tsdKey; -#endif - - SharedDbMap _sharedDbMap; - IceUtil::Mutex _mutex; - IceUtilInternal::FileLockPtr _fileLock; -}; - -inline DbEnv* -SharedDbEnv::getEnv() const -{ - return _env; -} - -inline const std::string& -SharedDbEnv::getEnvName() const -{ - return _envName; -} - -inline const Ice::CommunicatorPtr& -SharedDbEnv::getCommunicator() const -{ - return _communicator; -} - -inline const Ice::EncodingVersion& -SharedDbEnv::getEncoding() const -{ - return _encoding; -} - -} -#endif diff --git a/cpp/src/Freeze/TransactionHolder.cpp b/cpp/src/Freeze/TransactionHolder.cpp deleted file mode 100644 index 8a75bc395c1..00000000000 --- a/cpp/src/Freeze/TransactionHolder.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include - -using namespace Freeze; - -Freeze::TransactionHolder::TransactionHolder(const ConnectionPtr& connection) - : _transaction(0) -{ - if(connection->currentTransaction() == 0) - { - _transaction = connection->beginTransaction(); - } -} - -Freeze::TransactionHolder::~TransactionHolder() -{ - try - { - rollback(); - } - catch(...) - { - // - // Ignored to avoid crash during stack unwinding - // - } -} - -void -Freeze::TransactionHolder::commit() -{ - if(_transaction != 0) - { - try - { - _transaction->commit(); - _transaction = 0; - } - catch(...) - { - _transaction = 0; - throw; - } - } -} - -void -Freeze::TransactionHolder::rollback() -{ - if(_transaction != 0) - { - try - { - _transaction->rollback(); - _transaction = 0; - } - catch(...) - { - _transaction = 0; - throw; - } - } -} diff --git a/cpp/src/Freeze/TransactionI.cpp b/cpp/src/Freeze/TransactionI.cpp deleted file mode 100644 index 5c69940dec3..00000000000 --- a/cpp/src/Freeze/TransactionI.cpp +++ /dev/null @@ -1,283 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include - -using namespace std; -using namespace Ice; - -DbTxn* -Freeze::getTxn(const Freeze::TransactionPtr& tx) -{ - return dynamic_cast(tx.get())->dbTxn(); -} - -void -Freeze::TransactionI::commit() -{ - if(_txn == 0) - { - throw DatabaseException(__FILE__, __LINE__, "inactive transaction"); - } - - long txnId = 0; - - try - { - _connection->closeAllIterators(); - - if(_txTrace >= 1) - { - txnId = (_txn->id() & 0x7FFFFFFF) + 0x80000000L; - } - - _txn->commit(0); - - if(_txTrace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Transaction"); - out << "committed transaction " << hex << txnId << dec; - } - } - catch(const ::DbDeadlockException& dx) - { - if(_txTrace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Transaction"); - out << "failed to commit transaction " << hex << txnId << dec << ": " << dx.what(); - } - - postCompletion(false, true); - // After postCompletion is called the transaction may be - // dead. Beware! - DeadlockException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - catch(const ::DbException& dx) - { - if(_txTrace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Transaction"); - out << "failed to commit transaction " << hex << txnId << dec << ": " << dx.what(); - } - - postCompletion(false, false); - // After postCompletion is called the transaction may be - // dead. Beware! - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } - postCompletion(true, false); - // After postCompletion is called the transaction may be - // dead. Beware! -} - -void -Freeze::TransactionI::rollback() -{ - rollbackInternal(false); -} - -Freeze::ConnectionPtr -Freeze::TransactionI::getConnection() const -{ - if(_txn) - { - return _connection; - } - return 0; -} - -void -Freeze::TransactionI::rollbackInternal(bool warning) -{ - if(_txn != 0) - { - long txnId = 0; - try - { - _connection->closeAllIterators(); - - if(_txTrace >= 1 || (warning && _warnRollback)) - { - txnId = (_txn->id() & 0x7FFFFFFF) + 0x80000000L; - if(warning && _warnRollback) - { - Warning warn(_communicator->getLogger()); - warn << "Freeze.Transaction: rolled back transaction " << hex << txnId << dec - << " due to destruction.\nApplication code should explicitly call rollback or commit."; - } - } - - _txn->abort(); - - if(_txTrace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Transaction"); - out << "rolled back transaction " << hex << txnId << dec; - } - } - catch(const ::DbDeadlockException& dx) - { - if(_txTrace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Transaction"); - out << "failed to rollback transaction " << hex << txnId << dec << ": " << dx.what(); - } - - DeadlockException deadlockException(__FILE__, __LINE__, dx.what(), this); - - postCompletion(false, true); - // After postCompletion is called the transaction may be - // dead. Beware! - throw deadlockException; - } - catch(const ::DbException& dx) - { - if(_txTrace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Transaction"); - out << "failed to rollback transaction " << hex << txnId << dec << ": " << dx.what(); - } - - postCompletion(false, false); - // After postCompletion is called the transaction may be - // dead. Beware! - throw DatabaseException(__FILE__, __LINE__, dx.what()); - } - postCompletion(true, false); - // After postCompletion is called the transaction may be - // dead. Beware! - } -} - -void -Freeze::TransactionI::__incRef() -{ - IceUtil::Mutex::Lock sync(_refCountMutex->mutex); - _refCount++; -} - - -void -Freeze::TransactionI::__decRef() -{ - IceUtil::Mutex::Lock sync(_refCountMutex->mutex); - if(--_refCount == 0) - { - sync.release(); - delete this; - } - else if(_txn != 0 && _refCount == 1 && _connection->__getRefNoSync() == 1) - { - sync.release(); - rollbackInternal(true); - } -} - -int -Freeze::TransactionI::__getRef() const -{ - IceUtil::Mutex::Lock sync(_refCountMutex->mutex); - return _refCount; -} - -int -Freeze::TransactionI::__getRefNoSync() const -{ - return _refCount; -} - -void -Freeze::TransactionI::setPostCompletionCallback(const Freeze::PostCompletionCallbackPtr& cb) -{ - _postCompletionCallback = cb; -} - -// -// The constructor takes a ConnectionI* instead of a ConnectionIPtr -// because we have to ensure there is no call to __decRef while the -// transaction or the connection are not assigned to a Ptr in -// user-code. -// -Freeze::TransactionI::TransactionI(ConnectionI* connection) : - _communicator(connection->communicator()), - _connection(connection), - _txTrace(connection->txTrace()), - _warnRollback(_communicator->getProperties()->getPropertyAsIntWithDefault("Freeze.Warn.Rollback", 1)), - _txn(0), - _refCountMutex(connection->_refCountMutex), - _refCount(0) -{ - try - { - _connection->dbEnv()->getEnv()->txn_begin(0, &_txn, 0); - - if(_txTrace >= 1) - { - long txnId = (_txn->id() & 0x7FFFFFFF) + 0x80000000L; - Trace out(_communicator->getLogger(), "Freeze.Transaction"); - out << "started transaction " << hex << txnId << dec; - } - } - catch(const ::DbException& dx) - { - if(_txTrace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Transaction"); - out << "failed to start transaction: " << dx.what(); - } - - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } -} - - -Freeze::TransactionI::~TransactionI() -{ - assert(_txn == 0); -} - -void -Freeze::TransactionI::postCompletion(bool committed, bool deadlock) -{ - // The order of assignment in this method is very important as - // calling both the post completion callback and - // Connection::clearTransaction may alter the transaction - // reference count which checks _txn. - - { - // - // We synchronize here as _txn is checked (read) in the refcounting code - // - IceUtil::Mutex::Lock sync(_refCountMutex->mutex); - _txn = 0; - } - - if(_postCompletionCallback != 0) - { - PostCompletionCallbackPtr cb = _postCompletionCallback; - _postCompletionCallback = 0; - - cb->postCompletion(committed, deadlock, _connection->dbEnv()); - } - - ConnectionIPtr connection = _connection; - _connection = 0; - - connection->clearTransaction(); // may release the last _refCount -} diff --git a/cpp/src/Freeze/TransactionI.h b/cpp/src/Freeze/TransactionI.h deleted file mode 100644 index 4dd140f5b92..00000000000 --- a/cpp/src/Freeze/TransactionI.h +++ /dev/null @@ -1,88 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_TRANSACTIONI_H -#define FREEZE_TRANSACTIONI_H - -#include -#include -#include - -namespace Freeze -{ - -class ConnectionI; -typedef IceUtil::Handle ConnectionIPtr; - -struct SharedMutex; -typedef IceUtil::Handle SharedMutexPtr; - -class SharedDbEnv; -typedef IceUtil::Handle SharedDbEnvPtr; - -class PostCompletionCallback : public virtual IceUtil::Shared -{ -public: - - virtual void postCompletion(bool, bool, const SharedDbEnvPtr&) = 0; -}; -typedef IceUtil::Handle PostCompletionCallbackPtr; - -class TransactionI : public Transaction -{ -public: - - virtual void commit(); - - virtual void rollback(); - - - virtual ConnectionPtr getConnection() const; - - // - // Custom refcounting implementation - // - virtual void __incRef(); - virtual void __decRef(); - virtual int __getRef() const; - - void rollbackInternal(bool); - void setPostCompletionCallback(const PostCompletionCallbackPtr&); - - TransactionI(ConnectionI*); - ~TransactionI(); - - DbTxn* - dbTxn() const - { - return _txn; - } - -private: - - friend class ConnectionI; - - int __getRefNoSync() const; - - void postCompletion(bool, bool); - - const Ice::CommunicatorPtr _communicator; - ConnectionIPtr _connection; - const Ice::Int _txTrace; - const Ice::Int _warnRollback; - DbTxn* _txn; - PostCompletionCallbackPtr _postCompletionCallback; - SharedMutexPtr _refCountMutex; - int _refCount; -}; - -typedef IceUtil::Handle TransactionIPtr; - -} -#endif diff --git a/cpp/src/Freeze/TransactionalEvictorContext.cpp b/cpp/src/Freeze/TransactionalEvictorContext.cpp deleted file mode 100644 index 0fef4638727..00000000000 --- a/cpp/src/Freeze/TransactionalEvictorContext.cpp +++ /dev/null @@ -1,395 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace Freeze; -using namespace Ice; - -// -// TransactionalEvictorDeadlockException -// - -Freeze::TransactionalEvictorDeadlockException::TransactionalEvictorDeadlockException(const char* file, int line, const TransactionPtr& transaction) : - Ice::SystemException(file, line), - tx(transaction) -{ -} - -Freeze::TransactionalEvictorDeadlockException::~TransactionalEvictorDeadlockException() throw() -{ -} - -string -Freeze::TransactionalEvictorDeadlockException::ice_name() const -{ - return "Freeze::TransactionalEvictorDeadlockException"; -} - -Freeze::TransactionalEvictorDeadlockException* -Freeze::TransactionalEvictorDeadlockException::ice_clone() const -{ - return new TransactionalEvictorDeadlockException(*this); -} - -void -Freeze::TransactionalEvictorDeadlockException::ice_throw() const -{ - throw *this; -} - -// -// TransactionalEvictorContext -// - -Freeze::TransactionalEvictorContext::TransactionalEvictorContext(const SharedDbEnvPtr& dbEnv) : - _tx((new ConnectionI(dbEnv))->beginTransactionI()), - _deadlockExceptionDetected(false), - _userExceptionDetected(false) -{ - _tx->setPostCompletionCallback(this); -} - -Freeze::TransactionalEvictorContext::TransactionalEvictorContext(const TransactionIPtr& tx) : - _tx(tx), - _deadlockExceptionDetected(false) -{ - _tx->setPostCompletionCallback(this); -} - -Freeze::TransactionalEvictorContext::~TransactionalEvictorContext() -{ - for_each(_invalidateList.begin(), _invalidateList.end(), ToInvalidate::destroy); -} - -void -Freeze::TransactionalEvictorContext::commit() -{ - if(_tx != 0) - { - _tx->commit(); - } -} - -void -Freeze::TransactionalEvictorContext::rollback() -{ - if(_tx != 0) - { - _tx->rollback(); - } -} - -void -Freeze::TransactionalEvictorContext::postCompletion(bool committed, bool deadlock, const SharedDbEnvPtr& dbEnv) -{ - dbEnv->setCurrentTransaction(0); - - try - { - if(committed) - { - // - // remove updated & removed objects from cache - // - for_each(_invalidateList.begin(), _invalidateList.end(), ToInvalidate::invalidate); - _invalidateList.clear(); - } - finalize(deadlock); - } - catch(...) - { - finalize(deadlock); - throw; - } -} - -Freeze::TransactionalEvictorContext::ServantHolder::Body* -Freeze::TransactionalEvictorContext::findServantHolderBody(const Identity& ident, ObjectStore* store) const -{ - for(Stack::const_iterator p = _stack.begin(); p != _stack.end(); ++p) - { - ServantHolder::Body* b = *p; - if(b->matches(ident, store)) - { - return b; - } - } - return 0; -} - -void -Freeze::TransactionalEvictorContext::finalize(bool deadlock) -{ - Lock sync(*this); - if(_tx != 0) - { - if(deadlock) - { - _deadlockExceptionDetected = true; - } - _tx = 0; - notifyAll(); - } -} - -void -Freeze::TransactionalEvictorContext::checkDeadlockException() -{ - if(_deadlockException.get() != 0) - { - _deadlockException->ice_throw(); - } - - if(_nestedCallDeadlockException.get() != 0) - { - _nestedCallDeadlockException->ice_throw(); - } -} - -bool -Freeze::TransactionalEvictorContext::clearUserException() -{ - bool result = _userExceptionDetected; - _userExceptionDetected = false; - return result; -} - -bool -Freeze::TransactionalEvictorContext::response(bool ok) -{ - if(_owner == IceUtil::ThreadControl()) - { - if(!ok) - { - _userExceptionDetected = true; - } - return true; - } - else - { - Lock sync(*this); - while(_deadlockExceptionDetected == false && _tx != 0) - { - wait(); - } - return !_deadlockExceptionDetected; - } -} - -bool -Freeze::TransactionalEvictorContext::exception(const std::exception& ex) -{ - const DeadlockException* dx = dynamic_cast(&ex); - - if(dx != 0 && _owner == IceUtil::ThreadControl()) - { - _deadlockException.reset(dx->ice_clone()); - return false; - } - - const TransactionalEvictorDeadlockException* edx = - dynamic_cast(&ex); - if(edx != 0 && _owner == IceUtil::ThreadControl()) - { - _nestedCallDeadlockException.reset(edx->ice_clone()); - return false; - } - - return true; -} - -bool -Freeze::TransactionalEvictorContext::exception() -{ - return true; -} - -Ice::ObjectPtr -Freeze::TransactionalEvictorContext::servantRemoved(const Identity& ident, - ObjectStore* store) -{ - if(_tx != 0) - { - // - // Lookup servant holder on stack - // - ServantHolder::Body* body = findServantHolderBody(ident, store); - if(body != 0) - { - body->removed = true; - return body->rec.servant; - } - else - { - _invalidateList.push_back(new ToInvalidate(ident, store)); - return 0; - } - } - return 0; - -} - -void -Freeze::TransactionalEvictorContext::deadlockException() -{ - { - Lock sync(*this); - _deadlockExceptionDetected = true; - notifyAll(); - } - rollback(); -} - - -// -// ServantHolder -// - -Freeze::TransactionalEvictorContext::ServantHolder::ServantHolder() : - _ownBody(true) -{ -} - - -Freeze::TransactionalEvictorContext::ServantHolder::~ServantHolder() ICE_NOEXCEPT_FALSE -{ - if(_ownBody && _body.ownServant) - { - const TransactionalEvictorContextPtr& ctx = *(_body.ctx); - - if(ctx->_tx != 0) - { - if(!_body.readOnly && !_body.removed) - { - if(_body.store->keepStats()) - { - EvictorIBase::updateStats(_body.rec.stats, - IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds()); - } - _body.store->update(_body.current->id, _body.rec, ctx->_tx); - } - - if(!_body.readOnly || _body.removed) - { - ctx->_invalidateList.push_back(new ToInvalidate(_body.current->id, _body.store)); - } - } - ctx->_stack.pop_front(); - } -} - - -void -Freeze::TransactionalEvictorContext::ServantHolder::init(const TransactionalEvictorContextPtr& ctx, - const Current& current, - ObjectStore* store) -{ - assert(_ownBody && _body.ctx == 0); - - _body.ctx = &ctx; - _body.current = ¤t; - _body.store = store; - - ServantHolder::Body* body = ctx->findServantHolderBody(current.id, store); - - if(body != 0) - { - if(!body->removed) - { - _body.rec = body->rec; - _body.readOnly = body->readOnly; - } - } - else - { - // - // Let's load this servant - // - if(store->load(current.id, ctx->_tx, _body.rec)) - { - ctx->_stack.push_front(&_body); - _body.ownServant = true; - } - } -} - -void -Freeze::TransactionalEvictorContext::ServantHolder::adopt(ServantHolder& other) -{ - assert(_ownBody && _body.ctx == 0); - - _body = other._body; - other._ownBody = false; -} - -void -Freeze::TransactionalEvictorContext::ServantHolder::markReadWrite() -{ - assert(_ownBody); - - if(_body.ownServant) - { - _body.readOnly = false; - } - else - { - if(_body.readOnly) - { - throw DatabaseException(__FILE__, __LINE__, "freeze:write operation called from freeze:read operation"); - } - } -} - -Freeze::TransactionalEvictorContext::ServantHolder::Body::Body() : - readOnly(true), - removed(false), - ownServant(false), - ctx(0), - current(0), - store(0) -{ -} - -// -// ToInvalidate -// - -// -// When constructed in the servant holder destructor, it's protected by the dispatch() -// deactivate controller guard -// -Freeze::TransactionalEvictorContext::ToInvalidate::ToInvalidate(const Identity& ident, - ObjectStore* store) : - _ident(ident), - _store(store), - _evictor(store->evictor()), - _guard(_evictor->deactivateController()) -{ -} - -void -Freeze::TransactionalEvictorContext::ToInvalidate::invalidate(ToInvalidate* obj) -{ - dynamic_cast(obj->_store->evictor())->evict(obj->_ident, obj->_store); - delete obj; -} - -void -Freeze::TransactionalEvictorContext::ToInvalidate::destroy(ToInvalidate* obj) -{ - delete obj; -} diff --git a/cpp/src/Freeze/TransactionalEvictorContext.h b/cpp/src/Freeze/TransactionalEvictorContext.h deleted file mode 100644 index ab3476aec8f..00000000000 --- a/cpp/src/Freeze/TransactionalEvictorContext.h +++ /dev/null @@ -1,167 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_TRANSACTIONAL_EVICTOR_CONTEXT_H -#define FREEZE_TRANSACTIONAL_EVICTOR_CONTEXT_H - -#include -#include -#include -#include -#include -#include - -namespace Freeze -{ - -template class ObjectStore; - -class TransactionalEvictorElement; - -class TransactionalEvictorContext : public Ice::DispatchInterceptorAsyncCallback, public PostCompletionCallback, - public IceUtil::Monitor -{ -public: - - class ServantHolder - { - public: - - ServantHolder(); - ~ServantHolder() ICE_NOEXCEPT_FALSE; - - void init(const TransactionalEvictorContextPtr&, const Ice::Current&, ObjectStore*); - - void adopt(ServantHolder&); - - void markReadWrite(); - - bool initialized() const - { - return _ownBody && _body.ctx != 0; - } - - const Ice::ObjectPtr& servant() const - { - return _body.rec.servant; - } - - struct Body - { - Body(); - - bool matches(const Ice::Identity& ident, ObjectStore* s) const - { - return current->id == ident && store == s; - } - - bool readOnly; - bool removed; - bool ownServant; - - const TransactionalEvictorContextPtr* ctx; - const Ice::Current* current; - ObjectStore* store; - ObjectRecord rec; - }; - - private: - - Body _body; - bool _ownBody; - }; - - - class ToInvalidate - { - public: - - ToInvalidate(const Ice::Identity&, ObjectStore*); - - static void invalidate(ToInvalidate*); - static void destroy(ToInvalidate*); - - private: - - const Ice::Identity _ident; - ObjectStore* _store; - EvictorIBasePtr _evictor; // for _guard - DeactivateController::Guard _guard; // ensures store is not dangling - }; - - - TransactionalEvictorContext(const SharedDbEnvPtr&); - TransactionalEvictorContext(const TransactionIPtr&); - - virtual ~TransactionalEvictorContext(); - - virtual void postCompletion(bool, bool, const SharedDbEnvPtr&); - - virtual bool response(bool); - virtual bool exception(const std::exception&); - virtual bool exception(); - - Ice::ObjectPtr servantRemoved(const Ice::Identity&, ObjectStore*); - - void deadlockException(); - - void checkDeadlockException(); - - bool clearUserException(); - - void commit(); - void rollback(); - - const TransactionIPtr& transaction() const - { - return _tx; - } - -private: - - friend class ServantHolder; - - ServantHolder::Body* findServantHolderBody(const Ice::Identity&, ObjectStore*) const; - - void finalize(bool); - - // - // Stack of ServantHolder::Body* - // - typedef std::deque Stack; - Stack _stack; - - // - // List of objects to invalidate from the caches upon commit - // - std::list _invalidateList; - - TransactionIPtr _tx; - IceUtil::ThreadControl _owner; - - IceUtil::UniquePtr _deadlockException; - IceUtil::UniquePtr _nestedCallDeadlockException; - - // - // Protected by this - // - bool _deadlockExceptionDetected; - - // - // Not protected (used only by dispatch thread) - // - bool _userExceptionDetected; -}; - -typedef IceUtil::Handle TransactionalEvictorContextPtr; - -} - - -#endif diff --git a/cpp/src/Freeze/TransactionalEvictorI.cpp b/cpp/src/Freeze/TransactionalEvictorI.cpp deleted file mode 100644 index d2484e33141..00000000000 --- a/cpp/src/Freeze/TransactionalEvictorI.cpp +++ /dev/null @@ -1,864 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include - -#include -#include - -#include - -using namespace std; -using namespace Freeze; -using namespace Ice; - -namespace -{ - -// -// Must be in sync with Parser.cpp -// - -const int supports = 0; -const int mandatory = 1; -const int required = 2; -const int never = 3; -} - - -// -// createEvictor functions -// - -Freeze::TransactionalEvictorPtr -Freeze::createTransactionalEvictor(const ObjectAdapterPtr& adapter, - const string& envName, - const string& filename, - const FacetTypeMap& facetTypes, - const ServantInitializerPtr& initializer, - const vector& indices, - bool createDb) -{ - return new TransactionalEvictorI(adapter, envName, 0, filename, facetTypes, initializer, indices, createDb); -} - -TransactionalEvictorPtr -Freeze::createTransactionalEvictor(const ObjectAdapterPtr& adapter, - const string& envName, - DbEnv& dbEnv, - const string& filename, - const FacetTypeMap& facetTypes, - const ServantInitializerPtr& initializer, - const vector& indices, - bool createDb) -{ - return new TransactionalEvictorI(adapter, envName, &dbEnv, filename, facetTypes, initializer, indices, createDb); -} - - -// -// TransactionalEvictorI -// - -Freeze::TransactionalEvictorI::TransactionalEvictorI(const ObjectAdapterPtr& adapter, - const string& envName, - DbEnv* dbEnv, - const string& filename, - const FacetTypeMap& facetTypes, - const ServantInitializerPtr& initializer, - const vector& indices, - bool createDb) : - EvictorI(adapter, envName, dbEnv, filename, facetTypes, initializer, indices, createDb), - _currentEvictorSize(0) -{ - - class DispatchInterceptorAdapter : public Ice::DispatchInterceptor - { - public: - - DispatchInterceptorAdapter(const TransactionalEvictorIPtr& evictor) : - _evictor(evictor) - { - } - - virtual DispatchStatus dispatch(Request& request) - { - return _evictor->dispatch(request); - } - - private: - - TransactionalEvictorIPtr _evictor; - }; - - _interceptor = new DispatchInterceptorAdapter(this); - - string propertyPrefix = string("Freeze.Evictor.") + envName + '.' + _filename; - - _rollbackOnUserException = _communicator->getProperties()-> - getPropertyAsIntWithDefault(propertyPrefix + ".RollbackOnUserException", 0) > 0; -} - - -TransactionPtr -Freeze::TransactionalEvictorI::getCurrentTransaction() const -{ - DeactivateController::Guard deactivateGuard(_deactivateController); - - TransactionalEvictorContextPtr ctx = _dbEnv->getCurrent(); - if(ctx == 0) - { - return 0; - } - else - { - return ctx->transaction(); - } -} - -void -Freeze::TransactionalEvictorI::setCurrentTransaction(const TransactionPtr& tx) -{ - DeactivateController::Guard deactivateGuard(_deactivateController); - _dbEnv->setCurrentTransaction(tx); -} - - -ObjectPrx -Freeze::TransactionalEvictorI::addFacet(const ObjectPtr& servant, const Identity& ident, const string& facet) -{ - checkIdentity(ident); - checkServant(servant); - DeactivateController::Guard deactivateGuard(_deactivateController); - - ObjectStore* store = findStore(facet, _createDb); - if(store == 0) - { - throw NotFoundException(__FILE__, __LINE__, "addFacet: could not open database for facet '" - + facet + "'"); - } - - Ice::Long currentTime = 0; - - if(store->keepStats()) - { - currentTime = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); - } - - Statistics stats = { currentTime }; - ObjectRecord rec = { servant, stats }; - - TransactionIPtr tx = beforeQuery(); - - if(store->keepStats()) - { - updateStats(rec.stats, currentTime); - } - - if(!store->insert(ident, rec, tx)) - { - AlreadyRegisteredException ex(__FILE__, __LINE__); - ex.kindOfObject = "servant"; - ex.id = _communicator->identityToString(ident); - if(!facet.empty()) - { - ex.id += " -f " + IceUtilInternal::escapeString(facet, ""); - } - throw ex; - } - - ObjectPrx obj = _adapter->createProxy(ident); - if(!facet.empty()) - { - obj = obj->ice_facet(facet); - } - return obj; -} - -ObjectPtr -Freeze::TransactionalEvictorI::removeFacet(const Identity& ident, const string& facet) -{ - checkIdentity(ident); - DeactivateController::Guard deactivateGuard(_deactivateController); - - ObjectPtr servant = 0; - bool removed = false; - ObjectStore* store = findStore(facet, false); - - if(store != 0) - { - TransactionalEvictorContextPtr ctx = _dbEnv->getCurrent(); - TransactionIPtr tx = 0; - if(ctx != 0) - { - tx = ctx->transaction(); - if(tx == 0) - { - throw DatabaseException(__FILE__, __LINE__, "inactive transaction"); - } - } - - removed = store->remove(ident, tx); - - if(removed) - { - if(ctx != 0) - { - // - // Remove from cache when transaction commits - // - servant = ctx->servantRemoved(ident, store); - } - else - { - // - // Remove from cache immediately - // - servant = evict(ident, store); - } - } - } - - if(!removed) - { - NotRegisteredException ex(__FILE__, __LINE__); - ex.kindOfObject = "servant"; - ex.id = _communicator->identityToString(ident); - if(!facet.empty()) - { - ex.id += " -f " + IceUtilInternal::escapeString(facet, ""); - } - throw ex; - } - - if(_trace >= 1) - { - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "removed object \"" << _communicator->identityToString(ident) << "\""; - if(!facet.empty()) - { - out << " with facet \"" << facet << "\""; - } - out << " from Db \"" << _filename << "\""; - } - return servant; -} - -bool -Freeze::TransactionalEvictorI::hasFacet(const Identity& ident, const string& facet) -{ - DeactivateController::Guard deactivateGuard(_deactivateController); - checkIdentity(ident); - ObjectStore* store = findStore(facet, false); - - if(store == 0) - { - return false; - } - - TransactionIPtr tx = beforeQuery(); - - if(tx == 0) - { - TransactionalEvictorElementPtr element = store->getIfPinned(ident); - if(element != 0) - { - return true; - } - return store->dbHasObject(ident, 0); - } - else - { - return store->dbHasObject(ident, tx); - } -} - -bool -Freeze::TransactionalEvictorI::hasAnotherFacet(const Identity& ident, const string& facet) -{ - DeactivateController::Guard deactivateGuard(_deactivateController); - - // - // If the object exists in another store, throw FacetNotExistException - // instead of returning 0 (== ObjectNotExistException) - // - StoreMap storeMapCopy; - { - Lock sync(*this); - storeMapCopy = _storeMap; - } - - TransactionIPtr tx = beforeQuery(); - - for(StoreMap::iterator p = storeMapCopy.begin(); p != storeMapCopy.end(); ++p) - { - // - // Do not check again the given facet - // - if((*p).first != facet) - { - ObjectStore* store = (*p).second; - - if(tx == 0 && store->getIfPinned(ident) != 0) - { - return true; - } - - if(store->dbHasObject(ident, tx)) - { - return true; - } - } - } - - return false; -} - - -ObjectPtr -Freeze::TransactionalEvictorI::locateImpl(const Current&, LocalObjectPtr&) -{ - return _interceptor; -} - -void -Freeze::TransactionalEvictorI::finished(const Current&, const ObjectPtr&, const LocalObjectPtr&) -{ - // - // Nothing to do - // -} - -DispatchStatus -Freeze::TransactionalEvictorI::dispatch(Request& request) -{ - class CtxHolder - { - public: - -#ifndef NDEBUG - CtxHolder(bool ownCtx, const TransactionalEvictorContextPtr& ctx, const SharedDbEnvPtr& dbEnv) : - _ownCtx(ownCtx), - _ctx(ctx), - _dbEnv(dbEnv) -#else - CtxHolder(bool ownCtx, const TransactionalEvictorContextPtr& ctx) : - _ownCtx(ownCtx), - _ctx(ctx) -#endif - { - } - - ~CtxHolder() ICE_NOEXCEPT_FALSE - { - if(_ownCtx) - { - try - { - _ctx->commit(); - } - catch(...) - { - assert(_dbEnv->getCurrent() == 0); - throw; - } - assert(_dbEnv->getCurrent() == 0); - } - } - - private: - const bool _ownCtx; - const TransactionalEvictorContextPtr _ctx; -#ifndef NDEBUG - const SharedDbEnvPtr& _dbEnv; -#endif - }; - - - DeactivateController::Guard deactivateGuard(_deactivateController); - - const Current& current = request.getCurrent(); - - ObjectStore* store = findStore(current.facet, false); - if(store == 0) - { - servantNotFound(__FILE__, __LINE__, current); - } - - TransactionalEvictorContextPtr ctx = _dbEnv->getCurrent(); - - ObjectPtr sample = store->sampleServant(); - ObjectPtr cachedServant = 0; - - TransactionalEvictorContext::ServantHolder servantHolder; - - if(sample == 0) - { - if(ctx != 0) - { - try - { - servantHolder.init(ctx, current, store); - } - catch(const DeadlockException& dx) - { - assert(dx.tx == ctx->transaction()); - ctx->deadlockException(); - throw TransactionalEvictorDeadlockException(__FILE__, __LINE__, dx.tx); - } - sample = servantHolder.servant(); - } - else - { - // - // find / load read-only servant - // - - cachedServant = loadCachedServant(current.id, store); - - if(cachedServant == 0) - { - servantNotFound(__FILE__, __LINE__, current); - } - sample = cachedServant; - } - } - - assert(sample != 0); - - int operationAttributes = sample->ice_operationAttributes(current.operation); - - if(operationAttributes < 0) - { - throw OperationNotExistException(__FILE__, __LINE__); - } - - bool readOnly = (operationAttributes & 0x1) == 0; - - int txMode = (operationAttributes & 0x6) >> 1; - - bool ownCtx = false; - - // - // Establish the proper context - // - switch(txMode) - { - case never: - { - assert(readOnly); - if(ctx != 0) - { - throw DatabaseException(__FILE__, __LINE__, "transaction rejected by 'never' metadata"); - } - break; - } - case supports: - { - assert(readOnly); - break; - } - case mandatory: - { - if(ctx == 0) - { - throw DatabaseException(__FILE__, __LINE__, "operation with a mandatory transaction"); - } - break; - } - case required: - { - if(ctx == 0) - { - ownCtx = true; - } - break; - } - default: - { - assert(0); - throw OperationNotExistException(__FILE__, __LINE__); - } - } - - if(ctx == 0 && !ownCtx) - { - // - // Read-only dispatch - // - assert(readOnly); - if(cachedServant == 0) - { - cachedServant = loadCachedServant(current.id, store); - - if(cachedServant == 0) - { - servantNotFound(__FILE__, __LINE__, current); - } - } - return cachedServant->ice_dispatch(request); - } - else - { - // - // Create a new transaction; retry on DeadlockException - // - - bool tryAgain = false; - - do - { - TransactionPtr tx; - - try - { - if(ownCtx) - { - ctx = _dbEnv->createCurrent(); - } - -#ifndef NDEBUG - CtxHolder ctxHolder(ownCtx, ctx, _dbEnv); -#else - CtxHolder ctxHolder(ownCtx, ctx); -#endif - tx = ctx->transaction(); - - try - { - TransactionalEvictorContext::ServantHolder sh; - if(servantHolder.initialized()) - { - // - // Adopt it - // - sh.adopt(servantHolder); - } - else - { - sh.init(ctx, current, store); - } - - if(sh.servant() == 0) - { - servantNotFound(__FILE__, __LINE__, current); - } - - if(!readOnly) - { - sh.markReadWrite(); - } - - try - { - DispatchStatus dispatchStatus = sh.servant()->ice_dispatch(request, ctx); - if(dispatchStatus == DispatchUserException && _rollbackOnUserException) - { - ctx->rollback(); - } - if(dispatchStatus == DispatchAsync) - { - // - // May throw DeadlockException or TransactionalEvictorDeadlockException - // - ctx->checkDeadlockException(); - - if(ctx->clearUserException() && _rollbackOnUserException) - { - ctx->rollback(); - } - } - - return dispatchStatus; - } - catch(...) - { - // - // Important: this rollback() ensures that servant holder destructor won't perform - // any database operation, and hence will not throw. - // - ctx->rollback(); - throw; - } - // - // servant holder destructor runs here and may throw (if !rolled back) - // - } - catch(const DeadlockException& dx) - { - if(dx.tx == tx) - { - ctx->deadlockException(); - } - throw; - } - catch(...) - { - if(ownCtx) - { - ctx->rollback(); - } - throw; - } - - // - // commit occurs here (when ownCtx) - // - } - catch(const DeadlockException& dx) - { - if(ownCtx && dx.tx == tx) - { - tryAgain = true; - } - else - { - throw TransactionalEvictorDeadlockException(__FILE__, __LINE__, dx.tx); - } - } - catch(const TransactionalEvictorDeadlockException& dx) - { - if(ownCtx && dx.tx == tx) - { - tryAgain = true; - } - else - { - throw; - } - } - } while(tryAgain); - } - - // - // Can't be reached - // - assert(0); - throw OperationNotExistException(__FILE__, __LINE__); -} - - -void -Freeze::TransactionalEvictorI::deactivate(const string&) -{ - if(_deactivateController.deactivate()) - { - { - Lock sync(*this); - - // - // Set the evictor size to zero, meaning that we will evict - // everything possible. - // - _evictorSize = 0; - evict(); - } - - // - // Break cycle - // - _interceptor = 0; - - try - { - closeDbEnv(); - } - catch(...) - { - _deactivateController.deactivationComplete(); - throw; - } - _deactivateController.deactivationComplete(); - } -} - -Freeze::TransactionalEvictorI::~TransactionalEvictorI() -{ - // - // Because of the cycle with _interceptor, this can only run if deactivated() - // -} - -Freeze::TransactionIPtr -Freeze::TransactionalEvictorI::beforeQuery() -{ - TransactionalEvictorContextPtr ctx = _dbEnv->getCurrent(); - TransactionIPtr tx = 0; - if(ctx != 0) - { - tx = ctx->transaction(); - if(tx == 0) - { - throw DatabaseException(__FILE__, __LINE__,"inactive transaction"); - } - } - - return tx; -} - -void -Freeze::TransactionalEvictorI::evict() -{ - // - // Must be called with this locked - // - - while(_currentEvictorSize > _evictorSize) - { - // - // Evict, no matter what! - // - evict(*_evictorList.rbegin()); - } -} - - -ObjectPtr -Freeze::TransactionalEvictorI::loadCachedServant(const Identity& ident, ObjectStore* store) -{ - for(;;) - { - TransactionalEvictorElementPtr element = store->pin(ident); - - if(element == 0) - { - return 0; - } - - Lock sync(*this); - if(element->stale()) - { - // - // try again - // - continue; - } - - fixEvictPosition(element); - - // - // if _evictorSize is 0, I may evict myself ... no big deal - // - evict(); - return element->servant(); - } -} - -ObjectPtr -Freeze::TransactionalEvictorI::evict(const Identity& ident, ObjectStore* store) -{ - // - // Important: we can't wait for the DB (even indirectly) with 'this' locked - // - TransactionalEvictorElementPtr element = store->getIfPinned(ident, true); - - if(element != 0) - { - Lock sync(*this); - if(!element->_stale) - { - evict(element); - return element->servant(); - } - } - return 0; -} - -void -Freeze::TransactionalEvictorI::evict(const TransactionalEvictorElementPtr& element) -{ - // - // Must be called with this locked! - // - assert(!element->_stale); - element->_stale = true; - element->_store.unpin(element->_cachePosition); - - if(element->_inEvictor) - { - element->_inEvictor = false; - _evictorList.erase(element->_evictPosition); - _currentEvictorSize--; - } -} - -void -Freeze::TransactionalEvictorI::fixEvictPosition(const TransactionalEvictorElementPtr& element) -{ - // - // Must be called with this locked! - // - - assert(!element->_stale); - - if(element->_inEvictor) - { - _evictorList.erase(element->_evictPosition); - } - else - { - // - // New object - // - _currentEvictorSize++; - element->_inEvictor = true; - } - _evictorList.push_front(element); - element->_evictPosition = _evictorList.begin(); -} - - -void -Freeze::TransactionalEvictorI::servantNotFound(const char* file, int line, const Current& current) -{ - if(_trace >= 2) - { - Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "could not find \"" << _communicator->identityToString(current.id) - << "\" with facet \"" << current.facet + "\""; - } - - if(hasAnotherFacet(current.id, current.facet)) - { - throw FacetNotExistException(file, line, current.id, current.facet, current.operation); - } - else - { - throw ObjectNotExistException(file, line, current.id, current.facet, current.operation); - } -} - - - -Freeze::TransactionalEvictorElement::TransactionalEvictorElement(ObjectRecord& r, - ObjectStore& s) : - _servant(r.servant), - _store(s), - _stale(true), - _inEvictor(false) -{ -} - - -Freeze::TransactionalEvictorElement::~TransactionalEvictorElement() -{ -} - -void -Freeze::TransactionalEvictorElement::init(ObjectStore::Position p) -{ - _stale = false; - _cachePosition = p; -} - - - diff --git a/cpp/src/Freeze/TransactionalEvictorI.h b/cpp/src/Freeze/TransactionalEvictorI.h deleted file mode 100644 index 24ea56a4b46..00000000000 --- a/cpp/src/Freeze/TransactionalEvictorI.h +++ /dev/null @@ -1,128 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_TRANSACTIONAL_EVICTOR_I_H -#define FREEZE_TRANSACTIONAL_EVICTOR_I_H - -#include -#include -#include - -namespace Freeze -{ - -class TransactionalEvictorI; - -class TransactionalEvictorElement; -typedef IceUtil::Handle TransactionalEvictorElementPtr; - -class TransactionalEvictorElement : public Ice::LocalObject -{ -public: - - TransactionalEvictorElement(ObjectRecord&, ObjectStore&); - ~TransactionalEvictorElement(); - - void init(ObjectStore::Position); - - const Ice::ObjectPtr& servant() const - { - return _servant; - } - - bool stale() const - { - return _stale; - } - -private: - - friend class TransactionalEvictorI; - - const Ice::ObjectPtr _servant; - - // - // Immutable - // - ObjectStore& _store; - - // - // Immutable once set - // - ObjectStore::Position _cachePosition; - - // - // Protected by TransactionalEvictorI - // - std::list::iterator _evictPosition; - bool _stale; - bool _inEvictor; -}; - - -class TransactionalEvictorI : public TransactionalEvictor, public EvictorI -{ -public: - - TransactionalEvictorI(const Ice::ObjectAdapterPtr&, const std::string&, DbEnv*, const std::string&, - const FacetTypeMap&, const ServantInitializerPtr&, const std::vector&, bool); - - virtual ~TransactionalEvictorI(); - - virtual TransactionPtr getCurrentTransaction() const; - virtual void setCurrentTransaction(const TransactionPtr&); - - virtual Ice::ObjectPrx addFacet(const Ice::ObjectPtr&, const Ice::Identity&, const std::string&); - virtual Ice::ObjectPtr removeFacet(const Ice::Identity&, const std::string&); - - virtual bool hasFacet(const Ice::Identity&, const std::string&); - - virtual void finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&); - virtual void deactivate(const std::string&); - - virtual TransactionIPtr beforeQuery(); - - Ice::DispatchStatus dispatch(Ice::Request&); - - Ice::ObjectPtr evict(const Ice::Identity&, ObjectStore*); - -protected: - - virtual bool hasAnotherFacet(const Ice::Identity&, const std::string&); - - virtual Ice::ObjectPtr locateImpl(const Ice::Current&, Ice::LocalObjectPtr&); - - virtual void evict(); - -private: - - Ice::ObjectPtr loadCachedServant(const Ice::Identity&, ObjectStore*); - - void evict(const TransactionalEvictorElementPtr&); - void fixEvictPosition(const TransactionalEvictorElementPtr&); - - void servantNotFound(const char*, int, const Ice::Current&); - - // - // The _evictorList contains a list of all objects we keep, - // with the most recently used first. - // - std::list _evictorList; - std::list::size_type _currentEvictorSize; - - bool _rollbackOnUserException; - - Ice::DispatchInterceptorPtr _interceptor; -}; - -typedef IceUtil::Handle TransactionalEvictorIPtr; - -} - -#endif diff --git a/cpp/src/Freeze/Util.cpp b/cpp/src/Freeze/Util.cpp deleted file mode 100644 index 5d988d6eb0a..00000000000 --- a/cpp/src/Freeze/Util.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include - -using namespace Freeze; -using namespace Ice; -using namespace std; - -void -Freeze::handleDbException(const DbException& dx, - const char* file, int line) -{ - throw DatabaseException(file, line, dx.what()); -} - -void -Freeze::handleDbException(const DbException& dx, - Key& key, Dbt& dbKey, - const char* file, int line) -{ - bool bufferSmallException = -#if (DB_VERSION_MAJOR == 4) && (DB_VERSION_MINOR == 2) - (dx.get_errno() == ENOMEM); -#else - (dx.get_errno() == DB_BUFFER_SMALL || dx.get_errno() == ENOMEM); -#endif - - if(bufferSmallException && (dbKey.get_size() > dbKey.get_ulen())) - { - // - // Keep the old key size in case it's used as input - // - size_t oldKeySize = key.size(); - - key.resize(dbKey.get_size()); - initializeOutDbt(key, dbKey); - dbKey.set_size(static_cast(oldKeySize)); - } - else - { - handleDbException(dx, file, line); - } -} - -void -Freeze::handleDbException(const DbException& dx, - Key& key, Dbt& dbKey, - Value& value, Dbt& dbValue, - const char* file, int line) -{ - bool bufferSmallException = -#if (DB_VERSION_MAJOR == 4) && (DB_VERSION_MINOR == 2) - (dx.get_errno() == ENOMEM); -#else - (dx.get_errno() == DB_BUFFER_SMALL || dx.get_errno() == ENOMEM); -#endif - - bool resized = false; - if(bufferSmallException) - { - if(dbKey.get_size() > dbKey.get_ulen()) - { - size_t oldKeySize = key.size(); - key.resize(dbKey.get_size()); - initializeOutDbt(key, dbKey); - dbKey.set_size(static_cast(oldKeySize)); - resized = true; - } - - if(dbValue.get_size() > dbValue.get_ulen()) - { - value.resize(dbValue.get_size()); - initializeOutDbt(value, dbValue); - resized = true; - } - } - - if(!resized) - { - handleDbException(dx, file, line); - } -} diff --git a/cpp/src/Freeze/Util.h b/cpp/src/Freeze/Util.h deleted file mode 100644 index 82052883c2b..00000000000 --- a/cpp/src/Freeze/Util.h +++ /dev/null @@ -1,96 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_UTIL_H -#define FREEZE_UTIL_H - -#include -#include -#include -#include - -#ifdef _WIN32 -# define FREEZE_DB_MODE 0 -#else -# define FREEZE_DB_MODE (S_IRUSR | S_IWUSR) -#endif - - -namespace Freeze -{ - -inline void -initializeInDbt(const std::vector& v, Dbt& dbt) -{ - dbt.set_data(const_cast(&v[0])); - dbt.set_size(static_cast(v.size())); - dbt.set_ulen(0); - dbt.set_dlen(0); - dbt.set_doff(0); - dbt.set_flags(DB_DBT_USERMEM); -} - -inline void -initializeInDbt(IceInternal::BasicStream& s, Dbt& dbt) -{ - dbt.set_data(const_cast(s.b.begin())); - dbt.set_size(static_cast(s.b.size())); - dbt.set_ulen(0); - dbt.set_dlen(0); - dbt.set_doff(0); - dbt.set_flags(DB_DBT_USERMEM); -} - -inline void -initializeOutDbt(std::vector& v, Dbt& dbt) -{ - v.resize(v.capacity()); - dbt.set_data(&v[0]); - dbt.set_size(0); - dbt.set_ulen(static_cast(v.size())); - dbt.set_dlen(0); - dbt.set_doff(0); - dbt.set_flags(DB_DBT_USERMEM); -} - -inline void -initializeOutDbt(IceInternal::BasicStream& s, Dbt& dbt) -{ - dbt.set_data(const_cast(s.b.begin())); - dbt.set_size(0); - dbt.set_ulen(static_cast(s.b.size())); - dbt.set_dlen(0); - dbt.set_doff(0); - dbt.set_flags(DB_DBT_USERMEM); -} - - -// -// Handles a Berkeley DB DbException by resizing the -// given key/value/dbt (when the exception's errno is -// DB_SMALL_BUFFER) or by throwing a -// Freeze::DatabaseException -// - -void -handleDbException(const DbException&, const char*, int); - -void -handleDbException(const DbException&, Key&, Dbt&, - const char*, int); - -void -handleDbException(const DbException&, Key&, Dbt&, Value&, Dbt&, - const char*, int); - -} - - -#endif - diff --git a/cpp/src/FreezeScript/.depend.mak b/cpp/src/FreezeScript/.depend.mak deleted file mode 100755 index 60b7f82fb62..00000000000 --- a/cpp/src/FreezeScript/.depend.mak +++ /dev/null @@ -1,1896 +0,0 @@ - -AssignVisitor.obj: \ - AssignVisitor.cpp \ - "AssignVisitor.h" \ - "Data.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Slice\Parser.h" \ - "Error.h" \ - "Util.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - -Data.obj: \ - Data.cpp \ - "$(includedir)\IceUtil\DisableWarnings.h" \ - "Data.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Slice\Parser.h" \ - "Error.h" \ - "Util.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "Exception.h" \ - "$(includedir)\IceUtil\InputUtil.h" \ - -Error.obj: \ - Error.cpp \ - "Error.h" \ - "$(includedir)\Slice\Parser.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "Exception.h" \ - "Util.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - -Functions.obj: \ - Functions.cpp \ - "Functions.h" \ - "Data.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Slice\Parser.h" \ - "Error.h" \ - "Util.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "$(includedir)\IceUtil\UUID.h" \ - "$(includedir)\IceUtil\StringUtil.h" \ - -Exception.obj: \ - Exception.cpp \ - "Exception.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\IceUtil\Config.h" \ - -Parser.obj: \ - Parser.cpp \ - "Parser.h" \ - "Data.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Slice\Parser.h" \ - "Error.h" \ - "GrammarUtil.h" \ - -Print.obj: \ - Print.cpp \ - "Print.h" \ - "Data.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Slice\Parser.h" \ - "Error.h" \ - "Util.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "$(includedir)\IceUtil\OutputUtil.h" \ - -Util.obj: \ - Util.cpp \ - "Util.h" \ - "$(includedir)\Slice\Parser.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "Exception.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Index.h" \ - "$(includedir)\Slice\Preprocessor.h" \ - -Grammar.obj: \ - Grammar.cpp \ - "GrammarUtil.h" \ - "Parser.h" \ - "Data.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Slice\Parser.h" \ - "Error.h" \ - -Scanner.obj: \ - Scanner.cpp \ - "$(includedir)\IceUtil\ScannerConfig.h" \ - "$(includedir)\IceUtil\Config.h" \ - "GrammarUtil.h" \ - "Parser.h" \ - "Data.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Slice\Parser.h" \ - "Error.h" \ - "Grammar.h" \ - "$(includedir)\IceUtil\InputUtil.h" \ - -TransformAnalyzer.obj: \ - TransformAnalyzer.cpp \ - "TransformAnalyzer.h" \ - "$(includedir)\Slice\Parser.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\IceUtil\OutputUtil.h" \ - "Util.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - -TransformVisitor.obj: \ - TransformVisitor.cpp \ - "TransformVisitor.h" \ - "Data.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Slice\Parser.h" \ - "Error.h" \ - "Util.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "$(includedir)\IceUtil\InputUtil.h" \ - -Transformer.obj: \ - Transformer.cpp \ - "Transformer.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Slice\Parser.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "Data.h" \ - "Error.h" \ - "Parser.h" \ - "TransformVisitor.h" \ - "AssignVisitor.h" \ - "Print.h" \ - "Functions.h" \ - "Exception.h" \ - "Util.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Index.h" \ - "$(includedir)\IceXML\Parser.h" \ - "$(includedir)\IceUtil\InputUtil.h" \ - -transformdb.obj: \ - transformdb.cpp \ - "Transformer.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Slice\Parser.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "Data.h" \ - "Error.h" \ - "TransformAnalyzer.h" \ - "$(includedir)\IceUtil\OutputUtil.h" \ - "Exception.h" \ - "Util.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Index.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\Catalog.h" \ - "$(includedir)\Freeze\Map.h" \ - "$(includedir)\Freeze\Exception.h" \ - "$(includedir)\IceUtil\Options.h" \ - "$(includedir)\IceUtil\RecMutex.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ - -DumpDescriptors.obj: \ - DumpDescriptors.cpp \ - "DumpDescriptors.h" \ - "Parser.h" \ - "Data.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Slice\Parser.h" \ - "Error.h" \ - "$(includedir)\IceXML\Parser.h" \ - "AssignVisitor.h" \ - "Print.h" \ - "Functions.h" \ - "Exception.h" \ - "Util.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "$(includedir)\IceUtil\InputUtil.h" \ - -DumpDB.obj: \ - DumpDB.cpp \ - "DumpDescriptors.h" \ - "Parser.h" \ - "Data.h" \ - "$(includedir)\Ice\Ice.h" \ - "$(includedir)\IceUtil\PushDisableWarnings.h" \ - "$(includedir)\Ice\Config.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\Ice\DeprecatedStringConverter.h" \ - "$(includedir)\Ice\CommunicatorF.h" \ - "$(includedir)\Ice\ProxyF.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\Ice\ProxyHandle.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\Ice\ObjectF.h" \ - "$(includedir)\Ice\Handle.h" \ - "$(includedir)\Ice\Exception.h" \ - "$(includedir)\Ice\Format.h" \ - "$(includedir)\Ice\StreamF.h" \ - "$(includedir)\Ice\LocalObject.h" \ - "$(includedir)\Ice\LocalObjectF.h" \ - "$(includedir)\Ice\StreamHelpers.h" \ - "$(includedir)\IceUtil\ScopedArray.h" \ - "$(includedir)\IceUtil\Iterator.h" \ - "$(includedir)\IceUtil\Optional.h" \ - "$(includedir)\IceUtil\UndefSysMacros.h" \ - "$(includedir)\IceUtil\PopDisableWarnings.h" \ - "$(includedir)\IceUtil\StringConverter.h" \ - "$(includedir)\Ice\Plugin.h" \ - "$(includedir)\Ice\LoggerF.h" \ - "$(includedir)\Ice\BuiltinSequences.h" \ - "$(includedir)\Ice\Initialize.h" \ - "$(includedir)\IceUtil\Timer.h" \ - "$(includedir)\IceUtil\Thread.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Monitor.h" \ - "$(includedir)\IceUtil\Cond.h" \ - "$(includedir)\Ice\PropertiesF.h" \ - "$(includedir)\Ice\Proxy.h" \ - "$(includedir)\Ice\ProxyFactoryF.h" \ - "$(includedir)\Ice\ConnectionIF.h" \ - "$(includedir)\Ice\RequestHandlerF.h" \ - "$(includedir)\Ice\EndpointF.h" \ - "$(includedir)\Ice\EndpointTypes.h" \ - "$(includedir)\Ice\ObjectAdapterF.h" \ - "$(includedir)\Ice\ReferenceF.h" \ - "$(includedir)\Ice\BatchRequestQueueF.h" \ - "$(includedir)\Ice\AsyncResult.h" \ - "$(includedir)\IceUtil\UniquePtr.h" \ - "$(includedir)\Ice\ConnectionF.h" \ - "$(includedir)\Ice\InstanceF.h" \ - "$(includedir)\Ice\AsyncResultF.h" \ - "$(includedir)\Ice\ObserverHelper.h" \ - "$(includedir)\Ice\Instrumentation.h" \ - "$(includedir)\Ice\Current.h" \ - "$(includedir)\Ice\Identity.h" \ - "$(includedir)\Ice\Version.h" \ - "$(includedir)\Ice\BasicStream.h" \ - "$(includedir)\Ice\Object.h" \ - "$(includedir)\Ice\IncomingAsyncF.h" \ - "$(includedir)\Ice\ObjectFactoryF.h" \ - "$(includedir)\Ice\ObjectFactoryManagerF.h" \ - "$(includedir)\Ice\Buffer.h" \ - "$(includedir)\Ice\Protocol.h" \ - "$(includedir)\Ice\SlicedDataF.h" \ - "$(includedir)\Ice\UserExceptionFactory.h" \ - "$(includedir)\Ice\FactoryTable.h" \ - "$(includedir)\Ice\InstrumentationF.h" \ - "$(includedir)\Ice\Dispatcher.h" \ - "$(includedir)\Ice\BatchRequestInterceptor.h" \ - "$(includedir)\Ice\LocalException.h" \ - "$(includedir)\Ice\PropertiesAdmin.h" \ - "$(includedir)\Ice\GCObject.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Ice\Incoming.h" \ - "$(includedir)\Ice\ServantLocatorF.h" \ - "$(includedir)\Ice\ServantManagerF.h" \ - "$(includedir)\Ice\ResponseHandlerF.h" \ - "$(includedir)\Ice\IncomingAsync.h" \ - "$(includedir)\Ice\Properties.h" \ - "$(includedir)\Ice\Logger.h" \ - "$(includedir)\Ice\LoggerUtil.h" \ - "$(includedir)\Ice\RemoteLogger.h" \ - "$(includedir)\Ice\FactoryTableInit.h" \ - "$(includedir)\Ice\DefaultObjectFactory.h" \ - "$(includedir)\Ice\ObjectFactory.h" \ - "$(includedir)\Ice\Communicator.h" \ - "$(includedir)\Ice\RouterF.h" \ - "$(includedir)\Ice\LocatorF.h" \ - "$(includedir)\Ice\PluginF.h" \ - "$(includedir)\Ice\ImplicitContextF.h" \ - "$(includedir)\Ice\FacetMap.h" \ - "$(includedir)\Ice\CommunicatorAsync.h" \ - "$(includedir)\Ice\ObjectAdapter.h" \ - "$(includedir)\Ice\Endpoint.h" \ - "$(includedir)\Ice\ServantLocator.h" \ - "$(includedir)\Ice\SlicedData.h" \ - "$(includedir)\Ice\OutgoingAsync.h" \ - "$(includedir)\Ice\OutgoingAsyncF.h" \ - "$(includedir)\Ice\Process.h" \ - "$(includedir)\Ice\Application.h" \ - "$(includedir)\Ice\Connection.h" \ - "$(includedir)\Ice\ConnectionAsync.h" \ - "$(includedir)\Ice\Functional.h" \ - "$(includedir)\IceUtil\Functional.h" \ - "$(includedir)\Ice\Stream.h" \ - "$(includedir)\Ice\ImplicitContext.h" \ - "$(includedir)\Ice\Locator.h" \ - "$(includedir)\Ice\ProcessF.h" \ - "$(includedir)\Ice\Router.h" \ - "$(includedir)\Ice\DispatchInterceptor.h" \ - "$(includedir)\Ice\NativePropertiesAdmin.h" \ - "$(includedir)\Ice\Metrics.h" \ - "$(includedir)\Ice\SliceChecksums.h" \ - "$(includedir)\Ice\SliceChecksumDict.h" \ - "$(includedir)\Ice\Service.h" \ - "$(includedir)\Ice\RegisterPlugins.h" \ - "$(includedir)\Slice\Parser.h" \ - "Error.h" \ - "$(includedir)\IceXML\Parser.h" \ - "Util.h" \ - "$(includedir)\Freeze\CatalogData.h" \ - "Exception.h" \ - "$(includedir)\Freeze\Initialize.h" \ - "$(includedir)\Freeze\EvictorF.h" \ - "$(includedir)\Freeze\ConnectionF.h" \ - "$(includedir)\Freeze\Index.h" \ - "$(includedir)\Freeze\DB.h" \ - "$(includedir)\Freeze\Transaction.h" \ - "$(includedir)\Freeze\Connection.h" \ - "$(includedir)\IceUtil\OutputUtil.h" \ - "$(includedir)\IceUtil\Options.h" \ - "$(includedir)\IceUtil\RecMutex.h" \ - "$(includedir)\IceUtil\FileUtil.h" \ diff --git a/cpp/src/FreezeScript/AssignVisitor.cpp b/cpp/src/FreezeScript/AssignVisitor.cpp deleted file mode 100644 index ef112688117..00000000000 --- a/cpp/src/FreezeScript/AssignVisitor.cpp +++ /dev/null @@ -1,595 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include - -using namespace std; - -FreezeScript::AssignVisitor::AssignVisitor(const DataPtr& src, const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter, bool convert, - const string& context) : - _src(src), _factory(factory), _errorReporter(errorReporter), _convert(convert), - _context(context) -{ -} - -void -FreezeScript::AssignVisitor::visitBoolean(const BooleanDataPtr& dest) -{ - StringDataPtr s = StringDataPtr::dynamicCast(_src); - if(s) - { - string v = s->getValue(); - if(v == "true") - { - dest->setValue(true); - } - else if(v == "false") - { - dest->setValue(false); - } - else - { - conversionError(dest->getType(), _src->getType(), v); - } - } - else - { - dest->setValue(_src->booleanValue(_convert)); - } -} - -void -FreezeScript::AssignVisitor::visitInteger(const IntegerDataPtr& dest) -{ - dest->setValue(_src->integerValue(_convert), true); -} - -void -FreezeScript::AssignVisitor::visitDouble(const DoubleDataPtr& dest) -{ - dest->setValue(_src->doubleValue(_convert)); -} - -void -FreezeScript::AssignVisitor::visitString(const StringDataPtr& dest) -{ - dest->setValue(_src->stringValue(_convert)); -} - -void -FreezeScript::AssignVisitor::visitProxy(const ProxyDataPtr& dest) -{ - ProxyDataPtr p = ProxyDataPtr::dynamicCast(_src); - if(p) - { - dest->setValue(p->getValue()); - } - else - { - StringDataPtr s = StringDataPtr::dynamicCast(_src); - if(s) - { - dest->setValue(s->getValue(), false); - } - else - { - typeMismatchError(dest->getType(), _src->getType()); - } - } -} - -void -FreezeScript::AssignVisitor::visitStruct(const StructDataPtr& dest) -{ - Slice::StructPtr type = Slice::StructPtr::dynamicCast(dest->getType()); - assert(type); - StructDataPtr src = StructDataPtr::dynamicCast(_src); - if(src && isCompatible(type, src->getType())) - { - // - // Assign members with the same name. - // - DataMemberMap srcMap = src->getMembers(); - DataMemberMap destMap = dest->getMembers(); - string typeName = typeToString(type); - for(DataMemberMap::iterator p = destMap.begin(); p != destMap.end(); ++p) - { - DataMemberMap::iterator q = srcMap.find(p->first); - if(q != srcMap.end()) - { - string context = typeName + " member " + p->first + " value"; - AssignVisitor v(q->second, _factory, _errorReporter, _convert, context); - p->second->visit(v); - } - } - } - else - { - typeMismatchError(type, _src->getType()); - } -} - -void -FreezeScript::AssignVisitor::visitSequence(const SequenceDataPtr& dest) -{ - Slice::TypePtr type = dest->getType(); - SequenceDataPtr src = SequenceDataPtr::dynamicCast(_src); - if(src && isCompatible(type, src->getType())) - { - DataList& srcElements = src->getElements(); - DataList destElements; - Slice::SequencePtr seqType = Slice::SequencePtr::dynamicCast(type); - assert(seqType); - Slice::TypePtr elemType = seqType->type(); - string typeName = typeToString(type); - for(DataList::const_iterator p = srcElements.begin(); p != srcElements.end(); ++p) - { - DataPtr element = _factory->create(elemType, false); - Destroyer elementDestroyer(element); - AssignVisitor v(*p, _factory, _errorReporter, _convert, typeName + " element"); - element->visit(v); - destElements.push_back(element); - elementDestroyer.release(); - } - DataList& l = dest->getElements(); - l.swap(destElements); - } - else - { - typeMismatchError(type, _src->getType()); - } -} - -void -FreezeScript::AssignVisitor::visitEnum(const EnumDataPtr& dest) -{ - Slice::TypePtr type = dest->getType(); - IntegerDataPtr i = IntegerDataPtr::dynamicCast(_src); - if(i) - { - if(_convert) - { - Ice::Long l = i->integerValue(); - if(l < 0 || l > INT_MAX || !dest->setValue(static_cast(l))) - { - rangeError(i->toString(), type); - } - } - else - { - conversionError(type, i->getType(), i->toString()); - } - } - else - { - string name; - EnumDataPtr e = EnumDataPtr::dynamicCast(_src); - if(e && isCompatible(type, _src->getType())) - { - name = e->toString(); - } - else - { - StringDataPtr s = StringDataPtr::dynamicCast(_src); - if(s) - { - name = s->getValue(); - } - else - { - typeMismatchError(type, _src->getType()); - } - } - - if(!dest->setValueAsString(name)) - { - conversionError(type, _src->getType(), name); - } - } -} - -void -FreezeScript::AssignVisitor::visitDictionary(const DictionaryDataPtr& dest) -{ - Slice::TypePtr type = dest->getType(); - DictionaryDataPtr d = DictionaryDataPtr::dynamicCast(_src); - if(d && isCompatible(type, _src->getType())) - { - DataMap& srcMap = d->getElements(); - DataMap destMap; - Slice::DictionaryPtr dictType = Slice::DictionaryPtr::dynamicCast(type); - assert(dictType); - Slice::TypePtr keyType = dictType->keyType(); - Slice::TypePtr valueType = dictType->valueType(); - string typeName = typeToString(type); - for(DataMap::const_iterator p = srcMap.begin(); p != srcMap.end(); ++p) - { - DataPtr key = _factory->create(keyType, false); - Destroyer keyDestroyer(key); - DataPtr value = _factory->create(valueType, false); - Destroyer valueDestroyer(value); - - AssignVisitor keyVisitor(p->first, _factory, _errorReporter, _convert, typeName + " key"); - key->visit(keyVisitor); - - AssignVisitor valueVisitor(p->second, _factory, _errorReporter, _convert, typeName + " value"); - value->visit(valueVisitor); - - DataMap::const_iterator q = destMap.find(key); - if(q != destMap.end()) - { - error("duplicate dictionary key in " + typeToString(dictType)); - } - else - { - destMap.insert(DataMap::value_type(key, value)); - keyDestroyer.release(); - valueDestroyer.release(); - } - } - DataMap& m = dest->getElements(); - m.swap(destMap); - } - else - { - typeMismatchError(type, _src->getType()); - } -} - -void -FreezeScript::AssignVisitor::visitObject(const ObjectRefPtr& dest) -{ - Slice::TypePtr type = dest->getType(); - ObjectRefPtr src = ObjectRefPtr::dynamicCast(_src); - if(!src) - { - typeMismatchError(type, _src->getType()); - } - - ObjectDataPtr srcValue = src->getValue(); - Slice::TypePtr srcType = src->getType(); - if(!srcValue) - { - // - // Allow a nil value from type Object. - // - if(Slice::BuiltinPtr::dynamicCast(srcType) || isCompatible(type, srcType)) - { - dest->setValue(0); - } - else - { - typeMismatchError(type, srcType); - } - } - else - { - Slice::TypePtr srcValueType = srcValue->getType(); - if(isCompatible(type, srcValueType)) - { - dest->setValue(srcValue); - } - else - { - typeMismatchError(type, srcValueType); - } - } -} - -bool -FreezeScript::AssignVisitor::isCompatible(const Slice::TypePtr& dest, const Slice::TypePtr& src) -{ - Slice::BuiltinPtr b1 = Slice::BuiltinPtr::dynamicCast(dest); - if(b1) - { - Slice::BuiltinPtr b2 = Slice::BuiltinPtr::dynamicCast(src); - switch(b1->kind()) - { - case Slice::Builtin::KindByte: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindLong: - { - if(b2) - { - switch(b2->kind()) - { - case Slice::Builtin::KindByte: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindLong: - case Slice::Builtin::KindString: - { - return true; - } - case Slice::Builtin::KindBool: - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - { - return false; - } - } - } - - return false; - } - case Slice::Builtin::KindBool: - { - if(b2 && (b2->kind() == Slice::Builtin::KindBool || b2->kind() == Slice::Builtin::KindString)) - { - return true; - } - - return false; - } - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - { - if(b2) - { - switch(b2->kind()) - { - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - case Slice::Builtin::KindString: - { - return true; - } - case Slice::Builtin::KindByte: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindLong: - case Slice::Builtin::KindBool: - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - { - return false; - } - } - } - - return false; - } - case Slice::Builtin::KindString: - { - if(b2) - { - switch(b2->kind()) - { - case Slice::Builtin::KindByte: - case Slice::Builtin::KindBool: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindLong: - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - case Slice::Builtin::KindString: - case Slice::Builtin::KindObjectProxy: - { - return true; - } - case Slice::Builtin::KindObject: - case Slice::Builtin::KindLocalObject: - { - return false; - } - } - - return false; - } - else if(Slice::EnumPtr::dynamicCast(src)) - { - return true; - } - else if(Slice::ProxyPtr::dynamicCast(src)) - { - return true; - } - - return false; - } - case Slice::Builtin::KindObject: - { - // - // Allow transformation from Object to class. Validation has to - // be done during transformation, when the actual type of - // an instance can be compared for compatibility with the - // new type. - // - Slice::ClassDeclPtr cl = Slice::ClassDeclPtr::dynamicCast(src); - if(cl || (b2 && b2->kind() == Slice::Builtin::KindObject)) - { - return true; - } - - return false; - } - case Slice::Builtin::KindObjectProxy: - { - Slice::ProxyPtr p = Slice::ProxyPtr::dynamicCast(src); - if(p || (b2 && b2->kind() == Slice::Builtin::KindObjectProxy) || - (b2 && b2->kind() == Slice::Builtin::KindString)) - { - return true; - } - - return false; - } - case Slice::Builtin::KindLocalObject: - { - assert(false); - return false; - } - } - - assert(false); - } - - Slice::ClassDeclPtr cl1 = Slice::ClassDeclPtr::dynamicCast(dest); - if(cl1) - { - Slice::ClassDeclPtr cl2 = Slice::ClassDeclPtr::dynamicCast(src); - if(cl2 && checkClasses(cl1, cl2)) - { - return true; - } - - return false; - } - - Slice::StructPtr s1 = Slice::StructPtr::dynamicCast(dest); - if(s1) - { - Slice::StructPtr s2 = Slice::StructPtr::dynamicCast(src); - if(s2 && s1->scoped() == s2->scoped()) - { - return true; - } - - return false; - } - - Slice::ProxyPtr p1 = Slice::ProxyPtr::dynamicCast(dest); - if(p1) - { - Slice::BuiltinPtr b2 = Slice::BuiltinPtr::dynamicCast(src); - if(b2 && (b2->kind() == Slice::Builtin::KindObjectProxy || b2->kind() == Slice::Builtin::KindString)) - { - return true; - } - - Slice::ProxyPtr p2 = Slice::ProxyPtr::dynamicCast(src); - if(p2 && checkClasses(p1->_class(), p2->_class())) - { - return true; - } - - return false; - } - - Slice::DictionaryPtr d1 = Slice::DictionaryPtr::dynamicCast(dest); - if(d1) - { - Slice::DictionaryPtr d2 = Slice::DictionaryPtr::dynamicCast(src); - if(d2) - { - return isCompatible(d1->keyType(), d2->keyType()) && - isCompatible(d1->valueType(), d2->valueType()); - } - - return false; - } - - Slice::SequencePtr seq1 = Slice::SequencePtr::dynamicCast(dest); - if(seq1) - { - Slice::SequencePtr seq2 = Slice::SequencePtr::dynamicCast(src); - if(seq2) - { - return isCompatible(seq1->type(), seq2->type()); - } - - return false; - } - - Slice::EnumPtr e1 = Slice::EnumPtr::dynamicCast(dest); - if(e1) - { - Slice::BuiltinPtr b2 = Slice::BuiltinPtr::dynamicCast(src); - if(b2 && b2->kind() == Slice::Builtin::KindString) - { - return true; - } - - Slice::EnumPtr e2 = Slice::EnumPtr::dynamicCast(src); - if(e2 && e1->scoped() == e2->scoped()) - { - return true; - } - - return false; - } - - assert(false); - return false; -} - -bool -FreezeScript::AssignVisitor::checkClasses(const Slice::ClassDeclPtr& dest, const Slice::ClassDeclPtr& src) -{ - string s1 = dest->scoped(); - string s2 = src->scoped(); - if(s1 == s2) - { - return true; - } - else - { - Slice::ClassDefPtr def = src->definition(); - if(!def) - { - error("class " + s2 + " declared but not defined"); - } - return def->isA(s1); - } - - return false; -} - -void -FreezeScript::AssignVisitor::typeMismatchError(const Slice::TypePtr& dest, const Slice::TypePtr& src) -{ - ostringstream ostr; - ostr << "unable to transform"; - if(!_context.empty()) - { - ostr << ' ' << _context; - } - ostr << " from " << typeToString(src) << " to " << typeToString(dest); - error(ostr.str()); -} - -void -FreezeScript::AssignVisitor::conversionError(const Slice::TypePtr& dest, const Slice::TypePtr& src, - const string& value) -{ - ostringstream ostr; - ostr << "unable to convert"; - if(!_context.empty()) - { - ostr << ' ' << _context; - } - ostr << " `" << value << "' from " << typeToString(src) << " to " << typeToString(dest); - error(ostr.str()); -} - -void -FreezeScript::AssignVisitor::rangeError(const string& value, const Slice::TypePtr& type) -{ - ostringstream ostr; - if(!_context.empty()) - { - ostr << _context << ' '; - } - ostr << "`" << value << "' is out of range for type " << typeToString(type); - error(ostr.str()); -} - -void -FreezeScript::AssignVisitor::error(const string& msg) -{ - _errorReporter->error(msg); -} diff --git a/cpp/src/FreezeScript/AssignVisitor.h b/cpp/src/FreezeScript/AssignVisitor.h deleted file mode 100644 index ea346a2799f..00000000000 --- a/cpp/src/FreezeScript/AssignVisitor.h +++ /dev/null @@ -1,54 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_SCRIPT_ASSIGN_VISITOR_H -#define FREEZE_SCRIPT_ASSIGN_VISITOR_H - -#include - -namespace FreezeScript -{ - -class AssignVisitor : public DataVisitor -{ -public: - - AssignVisitor(const DataPtr&, const DataFactoryPtr&, const ErrorReporterPtr&, bool, - const std::string& = std::string()); - - virtual void visitBoolean(const BooleanDataPtr&); - virtual void visitInteger(const IntegerDataPtr&); - virtual void visitDouble(const DoubleDataPtr&); - virtual void visitString(const StringDataPtr&); - virtual void visitProxy(const ProxyDataPtr&); - virtual void visitStruct(const StructDataPtr&); - virtual void visitSequence(const SequenceDataPtr&); - virtual void visitEnum(const EnumDataPtr&); - virtual void visitDictionary(const DictionaryDataPtr&); - virtual void visitObject(const ObjectRefPtr&); - -private: - - bool isCompatible(const Slice::TypePtr&, const Slice::TypePtr&); - bool checkClasses(const Slice::ClassDeclPtr&, const Slice::ClassDeclPtr&); - void typeMismatchError(const Slice::TypePtr&, const Slice::TypePtr&); - void conversionError(const Slice::TypePtr&, const Slice::TypePtr&, const std::string&); - void rangeError(const std::string&, const Slice::TypePtr&); - void error(const std::string&); - - DataPtr _src; - DataFactoryPtr _factory; - ErrorReporterPtr _errorReporter; - bool _convert; - std::string _context; // Provides additional detail for use in warning messages. -}; - -} // End of namespace FreezeScript - -#endif diff --git a/cpp/src/FreezeScript/Data.cpp b/cpp/src/FreezeScript/Data.cpp deleted file mode 100644 index 96964e2cf15..00000000000 --- a/cpp/src/FreezeScript/Data.cpp +++ /dev/null @@ -1,2585 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace IceUtil; - -namespace FreezeScript -{ - -// -// ObjectWriter -// -class ObjectWriter : public Ice::ObjectWriter -{ -public: - - ObjectWriter(const ObjectDataPtr&); - - virtual void write(const Ice::OutputStreamPtr&) const; - -private: - - ObjectDataPtr _value; -}; - -// -// ReadObjectCallback -// -class ReadObjectCallback : public Ice::ReadObjectCallback -{ -public: - - ReadObjectCallback(const ObjectRefPtr&); - - virtual void invoke(const Ice::ObjectPtr&); - -private: - - ObjectRefPtr _ref; -}; - -// -// ObjectReader -// -class ObjectReader : public Ice::ObjectReader -{ -public: - - ObjectReader(const DataFactoryPtr&, const Slice::TypePtr&); - - virtual void read(const Ice::InputStreamPtr&); - - ObjectDataPtr getValue() const; - -private: - - DataFactoryPtr _factory; - Slice::TypePtr _type; - ObjectDataPtr _value; -}; -typedef IceUtil::Handle ObjectReaderPtr; - -} // End of namespace Transform - -// -// ObjectWriter -// -FreezeScript::ObjectWriter::ObjectWriter(const ObjectDataPtr& value) : - _value(value) -{ -} - -void -FreezeScript::ObjectWriter::write(const Ice::OutputStreamPtr& out) const -{ - out->startObject(0); - - Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(_value->_type); - Slice::ClassDefPtr type; - if(decl) - { - type = decl->definition(); - } - while(type) - { - Slice::ClassDefPtr base; - Slice::ClassList bases = type->bases(); - if(!bases.empty() && !bases.front()->isInterface()) - { - base = bases.front(); - } - - out->startSlice(type->scoped(), type->compactId(), !base); - Slice::DataMemberList members = type->dataMembers(); - for(Slice::DataMemberList::iterator p = members.begin(); p != members.end(); ++p) - { - DataMemberMap::const_iterator q = _value->_members.find((*p)->name()); - assert(q != _value->_members.end()); - q->second->marshal(out); - } - out->endSlice(); - - type = base; - } - - out->endObject(); -} - -// -// ObjectReader -// -FreezeScript::ObjectReader::ObjectReader(const DataFactoryPtr& factory, const Slice::TypePtr& type) : - _factory(factory), _type(type) -{ -} - -void -FreezeScript::ObjectReader::read(const Ice::InputStreamPtr& in) -{ - const_cast(_value) = new ObjectData(_factory, _type, true); - Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(_type); - Slice::ClassDefPtr type; - if(decl) - { - type = decl->definition(); - } - - in->startObject(); - - while(type) - { - Slice::ClassDefPtr base; - Slice::ClassList bases = type->bases(); - if(!bases.empty() && !bases.front()->isInterface()) - { - base = bases.front(); - } - - in->startSlice(); - - Slice::DataMemberList members = type->dataMembers(); - for(Slice::DataMemberList::iterator p = members.begin(); p != members.end(); ++p) - { - DataMemberMap::iterator q = _value->_members.find((*p)->name()); - assert(q != _value->_members.end()); - q->second->unmarshal(in); - } - - in->endSlice(); - - type = base; - } - - in->endObject(false); -} - -FreezeScript::ObjectDataPtr -FreezeScript::ObjectReader::getValue() const -{ - return _value; -} - -// -// DataFactory -// -FreezeScript::DataFactory::DataFactory(const Ice::CommunicatorPtr& communicator, const Slice::UnitPtr& unit, - const ErrorReporterPtr& errorReporter) : - _communicator(communicator), _unit(unit), _errorReporter(errorReporter) -{ -} - -FreezeScript::DataPtr -FreezeScript::DataFactory::create(const Slice::TypePtr& type, bool readOnly) -{ - DataPtr data = createImpl(type, readOnly); - if(!readOnly) - { - initialize(data); - } - return data; -} - -FreezeScript::DataPtr -FreezeScript::DataFactory::createBoolean(bool b, bool readOnly) -{ - DataPtr data = new BooleanData(getBuiltin(Slice::Builtin::KindBool), _errorReporter, readOnly, b); - if(!readOnly) - { - initialize(data); - } - return data; -} - -FreezeScript::DataPtr -FreezeScript::DataFactory::createInteger(Ice::Long i, bool readOnly) -{ - DataPtr data = new IntegerData(getBuiltin(Slice::Builtin::KindLong), _errorReporter, readOnly, i); - if(!readOnly) - { - initialize(data); - } - return data; -} - -FreezeScript::DataPtr -FreezeScript::DataFactory::createDouble(double d, bool readOnly) -{ - DataPtr data = new DoubleData(getBuiltin(Slice::Builtin::KindDouble), _errorReporter, readOnly, d); - if(!readOnly) - { - initialize(data); - } - return data; -} - -FreezeScript::DataPtr -FreezeScript::DataFactory::createString(const string& s, bool readOnly) -{ - DataPtr data = new StringData(this, getBuiltin(Slice::Builtin::KindString), _errorReporter, readOnly, s); - if(!readOnly) - { - initialize(data); - } - return data; -} - -FreezeScript::DataPtr -FreezeScript::DataFactory::createNil(bool readOnly) -{ - DataPtr data = new ObjectRef(this, getBuiltin(Slice::Builtin::KindObject), readOnly); - if(!readOnly) - { - initialize(data); - } - return data; -} - -FreezeScript::DataPtr -FreezeScript::DataFactory::createObject(const Slice::TypePtr& type, bool readOnly) -{ - ObjectRefPtr obj; - Slice::ClassDeclPtr cl = Slice::ClassDeclPtr::dynamicCast(type); - if(cl) - { - Slice::ClassDefPtr def = cl->definition(); - if(!def) - { - _errorReporter->error("class " + cl->scoped() + " declared but not defined"); - } - obj = new ObjectRef(this, cl, readOnly); - } - else - { - Slice::BuiltinPtr b = Slice::BuiltinPtr::dynamicCast(type); - if(b && b->kind() == Slice::Builtin::KindObject) - { - obj = new ObjectRef(this, b, readOnly); - } - } - - if(!obj) - { - _errorReporter->error("type `" + typeToString(type) + "' is not a class"); - } - - obj->instantiate(); - - if(!readOnly) - { - initialize(obj); - } - - return obj; -} - -Slice::BuiltinPtr -FreezeScript::DataFactory::getBuiltin(Slice::Builtin::Kind kind) const -{ - return _unit->builtin(kind); -} - -Ice::CommunicatorPtr -FreezeScript::DataFactory::getCommunicator() const -{ - return _communicator; -} - -FreezeScript::ErrorReporterPtr -FreezeScript::DataFactory::getErrorReporter() const -{ - return _errorReporter; -} - -FreezeScript::DataPtr -FreezeScript::DataFactory::createImpl(const Slice::TypePtr& type, bool readOnly) -{ - Slice::BuiltinPtr builtin = Slice::BuiltinPtr::dynamicCast(type); - if(builtin) - { - switch(builtin->kind()) - { - case Slice::Builtin::KindBool: - return new BooleanData(builtin, _errorReporter, readOnly); - - case Slice::Builtin::KindByte: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindLong: - return new IntegerData(builtin, _errorReporter, readOnly); - - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - return new DoubleData(builtin, _errorReporter, readOnly); - - case Slice::Builtin::KindString: - return new StringData(this, builtin, _errorReporter, readOnly); - - case Slice::Builtin::KindObject: - return new ObjectRef(this, builtin, readOnly); - - case Slice::Builtin::KindObjectProxy: - return new ProxyData(builtin, _communicator, _errorReporter, readOnly); - - case Slice::Builtin::KindLocalObject: - assert(false); - return 0; - } - } - - Slice::SequencePtr seq = Slice::SequencePtr::dynamicCast(type); - if(seq) - { - return new SequenceData(this, seq, _errorReporter, readOnly); - } - - Slice::ProxyPtr proxy = Slice::ProxyPtr::dynamicCast(type); - if(proxy) - { - return new ProxyData(proxy, _communicator, _errorReporter, readOnly); - } - - Slice::StructPtr st = Slice::StructPtr::dynamicCast(type); - if(st) - { - return new StructData(this, st, _errorReporter, readOnly); - } - - Slice::EnumPtr en = Slice::EnumPtr::dynamicCast(type); - if(en) - { - return new EnumData(en, _errorReporter, readOnly); - } - - Slice::DictionaryPtr dict = Slice::DictionaryPtr::dynamicCast(type); - if(dict) - { - return new DictionaryData(this, dict, _errorReporter, readOnly); - } - - Slice::ClassDeclPtr cl = Slice::ClassDeclPtr::dynamicCast(type); - if(cl) - { - Slice::ClassDefPtr def = cl->definition(); - if(!def) - { - _errorReporter->error("class " + cl->scoped() + " declared but not defined"); - } - return new ObjectRef(this, cl, readOnly); - } - - return 0; -} - -void -FreezeScript::DataFactory::initialize(const DataPtr&) -{ -} - -// -// Data -// -FreezeScript::Data::Data(const ErrorReporterPtr& errorReporter, bool readOnly) : - _errorReporter(errorReporter), _readOnly(readOnly) -{ -} - -FreezeScript::Data::~Data() -{ -} - -bool -FreezeScript::Data::readOnly() const -{ - return _readOnly; -} - -// -// PrimitiveData -// -FreezeScript::PrimitiveData::PrimitiveData(const ErrorReporterPtr& errorReporter, bool readOnly) : - Data(errorReporter, readOnly) -{ -} - -FreezeScript::DataPtr -FreezeScript::PrimitiveData::getMember(const string&) const -{ - return 0; -} - -FreezeScript::DataPtr -FreezeScript::PrimitiveData::getElement(const DataPtr&) const -{ - _errorReporter->error("element requested of primitive value"); - return 0; -} - -void -FreezeScript::PrimitiveData::destroy() -{ -} - -// -// BooleanData -// -FreezeScript::BooleanData::BooleanData(const Slice::BuiltinPtr& type, const ErrorReporterPtr& errorReporter, - bool readOnly) : - PrimitiveData(errorReporter, readOnly), _type(type), _value(false) -{ -} - -FreezeScript::BooleanData::BooleanData(const Slice::BuiltinPtr& type, const ErrorReporterPtr& errorReporter, - bool readOnly, bool value) : - PrimitiveData(errorReporter, readOnly), _type(type), _value(value) -{ -} - -bool -FreezeScript::BooleanData::operator==(const Data& rhs) const -{ - return !operator!=(rhs); -} - -bool -FreezeScript::BooleanData::operator!=(const Data& rhs) const -{ - const BooleanData* b = dynamic_cast(&rhs); - if(!b) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _value != b->_value; -} - -bool -FreezeScript::BooleanData::operator<(const Data& rhs) const -{ - const BooleanData* b = dynamic_cast(&rhs); - if(!b) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _value < b->_value; -} - -FreezeScript::DataPtr -FreezeScript::BooleanData::clone() const -{ - return new BooleanData(_type, _errorReporter, _readOnly, _value); -} - -Slice::TypePtr -FreezeScript::BooleanData::getType() const -{ - return _type; -} - -void -FreezeScript::BooleanData::marshal(const Ice::OutputStreamPtr& out) const -{ - out->write(_value); -} - -void -FreezeScript::BooleanData::unmarshal(const Ice::InputStreamPtr& in) -{ - in->read(_value); -} - -bool -FreezeScript::BooleanData::booleanValue(bool) const -{ - return _value; -} - -Ice::Long -FreezeScript::BooleanData::integerValue(bool) const -{ - _errorReporter->error("boolean cannot be converted to integer"); - return 0; -} - -double -FreezeScript::BooleanData::doubleValue(bool) const -{ - _errorReporter->error("boolean cannot be converted to double"); - return 0; -} - -string -FreezeScript::BooleanData::stringValue(bool convert) const -{ - if(convert) - { - return toString(); - } - else - { - return string(); - } -} - -string -FreezeScript::BooleanData::toString() const -{ - return (_value ? "true" : "false"); -} - -void -FreezeScript::BooleanData::visit(DataVisitor& visitor) -{ - visitor.visitBoolean(this); -} - -bool -FreezeScript::BooleanData::getValue() const -{ - return _value; -} - -void -FreezeScript::BooleanData::setValue(bool v) -{ - _value = v; -} - -// -// IntegerData -// -FreezeScript::IntegerData::IntegerData(const Slice::BuiltinPtr& type, const ErrorReporterPtr& errorReporter, - bool readOnly) : - PrimitiveData(errorReporter, readOnly), _type(type), _value(0) -{ -} - -FreezeScript::IntegerData::IntegerData(const Slice::BuiltinPtr& type, const ErrorReporterPtr& errorReporter, - bool readOnly, Ice::Long value) : - PrimitiveData(errorReporter, readOnly), _type(type), _value(value) -{ -} - -bool -FreezeScript::IntegerData::operator==(const Data& rhs) const -{ - return !operator!=(rhs); -} - -bool -FreezeScript::IntegerData::operator!=(const Data& rhs) const -{ - const IntegerData* i = dynamic_cast(&rhs); - if(!i) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _value != i->_value; -} - -bool -FreezeScript::IntegerData::operator<(const Data& rhs) const -{ - const IntegerData* i = dynamic_cast(&rhs); - if(!i) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _value < i->_value; -} - -FreezeScript::DataPtr -FreezeScript::IntegerData::clone() const -{ - return new IntegerData(_type, _errorReporter, _readOnly, _value); -} - -Slice::TypePtr -FreezeScript::IntegerData::getType() const -{ - return _type; -} - -void -FreezeScript::IntegerData::marshal(const Ice::OutputStreamPtr& out) const -{ - rangeCheck(_value, true); - - switch(_type->kind()) - { - case Slice::Builtin::KindByte: - { - out->write(static_cast(_value)); - break; - } - case Slice::Builtin::KindShort: - { - out->write(static_cast(_value)); - break; - } - case Slice::Builtin::KindInt: - { - out->write(static_cast(_value)); - break; - } - case Slice::Builtin::KindLong: - { - out->write(_value); - break; - } - - case Slice::Builtin::KindBool: - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - case Slice::Builtin::KindString: - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - assert(false); - } -} - -void -FreezeScript::IntegerData::unmarshal(const Ice::InputStreamPtr& in) -{ - switch(_type->kind()) - { - case Slice::Builtin::KindByte: - { - Ice::Byte val; - in->read(val); - _value = val & 0xff; - break; - } - case Slice::Builtin::KindShort: - { - Ice::Short val; - in->read(val); - _value = val; - break; - } - case Slice::Builtin::KindInt: - { - Ice::Int val; - in->read(val); - _value = val; - break; - } - case Slice::Builtin::KindLong: - { - Ice::Long val; - in->read(val); - _value = val; - break; - } - - case Slice::Builtin::KindBool: - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - case Slice::Builtin::KindString: - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - assert(false); - } -} - -bool -FreezeScript::IntegerData::booleanValue(bool) const -{ - _errorReporter->error("integer cannot be converted to boolean"); - return 0; -} - -Ice::Long -FreezeScript::IntegerData::integerValue(bool) const -{ - return _value; -} - -double -FreezeScript::IntegerData::doubleValue(bool convert) const -{ - if(convert) - { - return static_cast(_value); - } - else - { - _errorReporter->error("integer cannot be converted to double"); - return 0; - } -} - -string -FreezeScript::IntegerData::stringValue(bool convert) const -{ - if(convert) - { - return toString(); - } - else - { - _errorReporter->error("integer cannot be converted to string"); - return string(); - } -} - -string -FreezeScript::IntegerData::toString() const -{ - return toString(_value); -} - -void -FreezeScript::IntegerData::visit(DataVisitor& visitor) -{ - visitor.visitInteger(this); -} - -Ice::Long -FreezeScript::IntegerData::getValue() const -{ - return _value; -} - -void -FreezeScript::IntegerData::setValue(Ice::Long v, bool fatal) -{ - if(rangeCheck(v, fatal)) - { - _value = v; - } -} - -bool -FreezeScript::IntegerData::rangeCheck(Ice::Long value, bool fatal) const -{ - switch(_type->kind()) - { - case Slice::Builtin::KindByte: - { - if(value < 0 || value > 255) - { - _errorReporter->rangeError(toString(value), _type, fatal); - } - else - { - return true; - } - break; - } - - case Slice::Builtin::KindShort: - { - if(value < SHRT_MIN || value > SHRT_MAX) - { - _errorReporter->rangeError(toString(value), _type, fatal); - } - else - { - return true; - } - break; - } - - case Slice::Builtin::KindInt: - { - if(value < INT_MIN || value > INT_MAX) - { - _errorReporter->rangeError(toString(value), _type, fatal); - } - else - { - return true; - } - break; - } - - case Slice::Builtin::KindLong: - { - return true; - } - - case Slice::Builtin::KindBool: - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - case Slice::Builtin::KindString: - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - assert(false); - } - - return false; -} - -string -FreezeScript::IntegerData::toString(Ice::Long value) -{ - char buf[64]; -#ifdef _WIN32 - sprintf_s(buf, "%I64d", value); -#elif defined(ICE_64) - sprintf(buf, "%ld", value); -#else - sprintf(buf, "%lld", value); -#endif - return string(buf); -} - -// -// DoubleData -// -FreezeScript::DoubleData::DoubleData(const Slice::BuiltinPtr& type, const ErrorReporterPtr& errorReporter, - bool readOnly) : - PrimitiveData(errorReporter, readOnly), _type(type), _value(0) -{ -} - -FreezeScript::DoubleData::DoubleData(const Slice::BuiltinPtr& type, const ErrorReporterPtr& errorReporter, - bool readOnly, double value) : - PrimitiveData(errorReporter, readOnly), _type(type), _value(value) -{ -} - -bool -FreezeScript::DoubleData::operator==(const Data& rhs) const -{ - return !operator!=(rhs); -} - -bool -FreezeScript::DoubleData::operator!=(const Data& rhs) const -{ - const DoubleData* d = dynamic_cast(&rhs); - if(!d) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _value != d->_value; -} - -bool -FreezeScript::DoubleData::operator<(const Data& rhs) const -{ - const DoubleData* d = dynamic_cast(&rhs); - if(!d) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _value < d->_value; -} - -FreezeScript::DataPtr -FreezeScript::DoubleData::clone() const -{ - return new DoubleData(_type, _errorReporter, _readOnly, _value); -} - -Slice::TypePtr -FreezeScript::DoubleData::getType() const -{ - return _type; -} - -void -FreezeScript::DoubleData::marshal(const Ice::OutputStreamPtr& out) const -{ - switch(_type->kind()) - { - case Slice::Builtin::KindFloat: - { - out->write(static_cast(_value)); - break; - } - case Slice::Builtin::KindDouble: - { - out->write(_value); - break; - } - - case Slice::Builtin::KindByte: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindLong: - case Slice::Builtin::KindBool: - case Slice::Builtin::KindString: - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - assert(false); - } -} - -void -FreezeScript::DoubleData::unmarshal(const Ice::InputStreamPtr& in) -{ - switch(_type->kind()) - { - case Slice::Builtin::KindFloat: - { - Ice::Float val; - in->read(val); - _value = val; - break; - } - case Slice::Builtin::KindDouble: - { - in->read(_value); - break; - } - - case Slice::Builtin::KindByte: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindLong: - case Slice::Builtin::KindBool: - case Slice::Builtin::KindString: - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - assert(false); - } -} - -bool -FreezeScript::DoubleData::booleanValue(bool) const -{ - _errorReporter->error("double cannot be converted to boolean"); - return 0; -} - -Ice::Long -FreezeScript::DoubleData::integerValue(bool convert) const -{ - if(convert) - { - return static_cast(_value); - } - else - { - _errorReporter->error("double cannot be converted to integer"); - return 0; - } -} - -double -FreezeScript::DoubleData::doubleValue(bool) const -{ - return _value; -} - -string -FreezeScript::DoubleData::stringValue(bool convert) const -{ - if(convert) - { - return toString(); - } - else - { - _errorReporter->error("double cannot be converted to string"); - return string(); - } -} - -string -FreezeScript::DoubleData::toString() const -{ - char buff[64]; - sprintf(buff, "%g", _value); - return string(buff); -} - -void -FreezeScript::DoubleData::visit(DataVisitor& visitor) -{ - visitor.visitDouble(this); -} - -double -FreezeScript::DoubleData::getValue() const -{ - return _value; -} - -void -FreezeScript::DoubleData::setValue(double v) -{ - _value = v; -} - -// -// StringData -// -FreezeScript::StringData::StringData(const DataFactoryPtr& factory, const Slice::BuiltinPtr& type, - const ErrorReporterPtr& errorReporter, bool readOnly) : - PrimitiveData(errorReporter, readOnly), _factory(factory), _type(type) -{ - setValue(""); -} - -FreezeScript::StringData::StringData(const DataFactoryPtr& factory, const Slice::BuiltinPtr& type, - const ErrorReporterPtr& errorReporter, bool readOnly, const string& value) : - PrimitiveData(errorReporter, readOnly), _factory(factory), _type(type) -{ - setValue(value); -} - -FreezeScript::DataPtr -FreezeScript::StringData::getMember(const string& member) const -{ - if(member == "length") - { - _length->setValue(static_cast(_value.size()), false); - return _length; - } - - return 0; -} - -bool -FreezeScript::StringData::operator==(const Data& rhs) const -{ - return !operator!=(rhs); -} - -bool -FreezeScript::StringData::operator!=(const Data& rhs) const -{ - const StringData* s = dynamic_cast(&rhs); - if(!s) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _value != s->_value; -} - -bool -FreezeScript::StringData::operator<(const Data& rhs) const -{ - const StringData* s = dynamic_cast(&rhs); - if(!s) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _value < s->_value; -} - -FreezeScript::DataPtr -FreezeScript::StringData::clone() const -{ - return new StringData(_factory, _type, _errorReporter, _readOnly, _value); -} - -Slice::TypePtr -FreezeScript::StringData::getType() const -{ - return _type; -} - -void -FreezeScript::StringData::marshal(const Ice::OutputStreamPtr& out) const -{ - out->write(_value); -} - -void -FreezeScript::StringData::unmarshal(const Ice::InputStreamPtr& in) -{ - string val; - in->read(val); - setValue(val); -} - -bool -FreezeScript::StringData::booleanValue(bool) const -{ - _errorReporter->error("string cannot be converted to boolean"); - return false; -} - -Ice::Long -FreezeScript::StringData::integerValue(bool) const -{ - _errorReporter->error("string cannot be converted to integer"); - return 0; -} - -double -FreezeScript::StringData::doubleValue(bool) const -{ - _errorReporter->error("string cannot be converted to double"); - return 0; -} - -string -FreezeScript::StringData::stringValue(bool) const -{ - return _value; -} - -string -FreezeScript::StringData::toString() const -{ - return _value; -} - -void -FreezeScript::StringData::visit(DataVisitor& visitor) -{ - visitor.visitString(this); -} - -string -FreezeScript::StringData::getValue() const -{ - return _value; -} - -void -FreezeScript::StringData::setValue(const string& v) -{ - _value = v; - _length = IntegerDataPtr::dynamicCast(_factory->createInteger(static_cast(_value.size()), true)); -} - -// -// ProxyData -// -FreezeScript::ProxyData::ProxyData(const Slice::TypePtr& type, const Ice::CommunicatorPtr& communicator, - const ErrorReporterPtr& errorReporter, bool readOnly) : - Data(errorReporter, readOnly), _type(type), _communicator(communicator) -{ -} - -FreezeScript::ProxyData::ProxyData(const Slice::TypePtr& type, const Ice::CommunicatorPtr& communicator, - const ErrorReporterPtr& errorReporter, bool readOnly, const Ice::ObjectPrx& value) : - Data(errorReporter, readOnly), _type(type), _communicator(communicator), _value(value) -{ -} - -FreezeScript::DataPtr -FreezeScript::ProxyData::getMember(const string& /*member*/) const -{ - // TODO: Support members (id, facet, etc.)? - - return 0; -} - -FreezeScript::DataPtr -FreezeScript::ProxyData::getElement(const DataPtr&) const -{ - _errorReporter->error("element requested of proxy value"); - return 0; -} - -bool -FreezeScript::ProxyData::operator==(const Data& rhs) const -{ - return !operator!=(rhs); -} - -bool -FreezeScript::ProxyData::operator!=(const Data& rhs) const -{ - const ProxyData* p = dynamic_cast(&rhs); - if(!p) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _value != p->_value; -} - -bool -FreezeScript::ProxyData::operator<(const Data& rhs) const -{ - const ProxyData* p = dynamic_cast(&rhs); - if(!p) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _value < p->_value; -} - -FreezeScript::DataPtr -FreezeScript::ProxyData::clone() const -{ - return new ProxyData(_type, _communicator, _errorReporter, _readOnly, _value); -} - -Slice::TypePtr -FreezeScript::ProxyData::getType() const -{ - return _type; -} - -void -FreezeScript::ProxyData::destroy() -{ -} - -void -FreezeScript::ProxyData::marshal(const Ice::OutputStreamPtr& out) const -{ - out->write(_value); -} - -void -FreezeScript::ProxyData::unmarshal(const Ice::InputStreamPtr& in) -{ - in->read(_value); -} - -bool -FreezeScript::ProxyData::booleanValue(bool) const -{ - _errorReporter->error("proxy cannot be converted to boolean"); - return 0; -} - -Ice::Long -FreezeScript::ProxyData::integerValue(bool) const -{ - _errorReporter->error("proxy cannot be converted to integer"); - return 0; -} - -double -FreezeScript::ProxyData::doubleValue(bool) const -{ - _errorReporter->error("proxy cannot be converted to double"); - return 0; -} - -string -FreezeScript::ProxyData::stringValue(bool) const -{ - _errorReporter->error("proxy cannot be converted to string"); - return string(); -} - -string -FreezeScript::ProxyData::toString() const -{ - if(_value && _str.empty()) - { - const_cast(_str) = _communicator->proxyToString(_value); - } - return _str; -} - -void -FreezeScript::ProxyData::visit(DataVisitor& visitor) -{ - visitor.visitProxy(this); -} - -Ice::ObjectPrx -FreezeScript::ProxyData::getValue() const -{ - return _value; -} - -void -FreezeScript::ProxyData::setValue(const string& str, bool fatal) -{ - try - { - _value = _communicator->stringToProxy(str); - _str = str; - } - catch(const Ice::LocalException&) - { - _errorReporter->conversionError(str, _type, fatal); - } -} - -void -FreezeScript::ProxyData::setValue(const Ice::ObjectPrx& v) -{ - _value = v; - _str.clear(); -} - - -// -// StructData -// -FreezeScript::StructData::StructData(const DataFactoryPtr& factory, const Slice::StructPtr& type, - const ErrorReporterPtr& errorReporter, bool readOnly) : - Data(errorReporter, readOnly), _type(type) -{ - Slice::DataMemberList members = type->dataMembers(); - for(Slice::DataMemberList::iterator q = members.begin(); q != members.end(); ++q) - { - DataPtr value = factory->create((*q)->type(), _readOnly); - assert(value); - _members[(*q)->name()] = value; - } -} - -FreezeScript::StructData::StructData(const Slice::StructPtr& type, const ErrorReporterPtr& errorReporter, - bool readOnly, const DataMemberMap& members) : - Data(errorReporter, readOnly), _type(type) -{ - for(DataMemberMap::const_iterator p = members.begin(); p != members.end(); ++p) - { - _members[p->first] = p->second->clone(); - } -} - -FreezeScript::DataPtr -FreezeScript::StructData::getMember(const string& member) const -{ - DataMemberMap::const_iterator p = _members.find(member); - if(p != _members.end()) - { - return p->second; - } - - return 0; -} - -FreezeScript::DataPtr -FreezeScript::StructData::getElement(const DataPtr&) const -{ - _errorReporter->error("element requested of struct value"); - return 0; -} - -bool -FreezeScript::StructData::operator==(const Data& rhs) const -{ - return !operator!=(rhs); -} - -bool -FreezeScript::StructData::operator!=(const Data& rhs) const -{ - const StructData* s = dynamic_cast(&rhs); - if(!s || _type->scoped() != s->_type->scoped()) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - assert(_members.size() == s->_members.size()); - - for(DataMemberMap::const_iterator p = _members.begin(); p != _members.end(); ++p) - { - DataMemberMap::const_iterator q = s->_members.find(p->first); - assert(q != s->_members.end()); - - if(p->second != q->second) - { - return true; - } - } - - return false; -} - -bool -FreezeScript::StructData::operator<(const Data& rhs) const -{ - const StructData* s = dynamic_cast(&rhs); - if(!s || _type->scoped() != s->_type->scoped()) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - assert(_members.size() == s->_members.size()); - - for(DataMemberMap::const_iterator p = _members.begin(); p != _members.end(); ++p) - { - DataMemberMap::const_iterator q = s->_members.find(p->first); - assert(q != s->_members.end()); - - if(p->second < q->second) - { - return true; - } - else if(q->second < p->second) - { - return false; - } - } - - return false; -} - -FreezeScript::DataPtr -FreezeScript::StructData::clone() const -{ - return new StructData(_type, _errorReporter, _readOnly, _members); -} - -Slice::TypePtr -FreezeScript::StructData::getType() const -{ - return _type; -} - -void -FreezeScript::StructData::destroy() -{ - for(DataMemberMap::const_iterator p = _members.begin(); p != _members.end(); ++p) - { - p->second->destroy(); - } -} - -void -FreezeScript::StructData::marshal(const Ice::OutputStreamPtr& out) const -{ - Slice::DataMemberList members = _type->dataMembers(); - for(Slice::DataMemberList::iterator p = members.begin(); p != members.end(); ++p) - { - DataMemberMap::const_iterator q = _members.find((*p)->name()); - assert(q != _members.end()); - q->second->marshal(out); - } -} - -void -FreezeScript::StructData::unmarshal(const Ice::InputStreamPtr& in) -{ - Slice::DataMemberList members = _type->dataMembers(); - for(Slice::DataMemberList::iterator p = members.begin(); p != members.end(); ++p) - { - DataMemberMap::const_iterator q = _members.find((*p)->name()); - assert(q != _members.end()); - q->second->unmarshal(in); - } -} - -bool -FreezeScript::StructData::booleanValue(bool) const -{ - _errorReporter->error("struct " + typeToString(_type) + " cannot be converted to boolean"); - return 0; -} - -Ice::Long -FreezeScript::StructData::integerValue(bool) const -{ - _errorReporter->error("struct " + typeToString(_type) + " cannot be converted to integer"); - return 0; -} - -double -FreezeScript::StructData::doubleValue(bool) const -{ - _errorReporter->error("struct " + typeToString(_type) + " cannot be converted to double"); - return 0; -} - -string -FreezeScript::StructData::stringValue(bool) const -{ - _errorReporter->error("struct " + typeToString(_type) + " cannot be converted to string"); - return string(); -} - -string -FreezeScript::StructData::toString() const -{ - return stringValue(); -} - -void -FreezeScript::StructData::visit(DataVisitor& visitor) -{ - visitor.visitStruct(this); -} - -FreezeScript::DataMemberMap& -FreezeScript::StructData::getMembers() -{ - return _members; -} - -// -// SequenceData -// -FreezeScript::SequenceData::SequenceData(const DataFactoryPtr& factory, const Slice::SequencePtr& type, - const ErrorReporterPtr& errorReporter, bool readOnly) : - Data(errorReporter, readOnly), _factory(factory), _type(type) -{ - _length = IntegerDataPtr::dynamicCast(_factory->createInteger(0, true)); -} - -FreezeScript::SequenceData::SequenceData(const DataFactoryPtr& factory, const Slice::SequencePtr& type, - const ErrorReporterPtr& errorReporter, bool readOnly, - const DataList& elements) : - Data(errorReporter, readOnly), _factory(factory), _type(type) -{ - for(DataList::const_iterator p = elements.begin(); p != elements.end(); ++p) - { - _elements.push_back((*p)->clone()); - } - _length = IntegerDataPtr::dynamicCast(_factory->createInteger(static_cast(_elements.size()), true)); -} - -FreezeScript::DataPtr -FreezeScript::SequenceData::getMember(const string& member) const -{ - if(member == "length") - { - _length->setValue(static_cast(_elements.size()), false); - return _length; - } - - return 0; -} - -FreezeScript::DataPtr -FreezeScript::SequenceData::getElement(const DataPtr& element) const -{ - IntegerDataPtr i = IntegerDataPtr::dynamicCast(element); - if(!i) - { - _errorReporter->error("invalid sequence index type " + typeToString(element->getType())); - } - - Ice::Long iv = i->integerValue(); - if(iv < 0 || iv >= static_cast(_elements.size())) - { - _errorReporter->error("sequence index " + i->toString() + " out of range"); - } - - return _elements[static_cast(iv)]; -} - -bool -FreezeScript::SequenceData::operator==(const Data& rhs) const -{ - return !operator!=(rhs); -} - -bool -FreezeScript::SequenceData::operator!=(const Data& rhs) const -{ - const SequenceData* s = dynamic_cast(&rhs); - if(!s || _type->scoped() != s->_type->scoped()) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _elements != s->_elements; -} - -bool -FreezeScript::SequenceData::operator<(const Data& rhs) const -{ - const SequenceData* s = dynamic_cast(&rhs); - if(!s || _type->scoped() != s->_type->scoped()) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _elements < s->_elements; -} - -FreezeScript::DataPtr -FreezeScript::SequenceData::clone() const -{ - return new SequenceData(_factory, _type, _errorReporter, _readOnly, _elements); -} - -Slice::TypePtr -FreezeScript::SequenceData::getType() const -{ - return _type; -} - -void -FreezeScript::SequenceData::destroy() -{ - for(DataList::const_iterator p = _elements.begin(); p != _elements.end(); ++p) - { - (*p)->destroy(); - } -} - -void -FreezeScript::SequenceData::marshal(const Ice::OutputStreamPtr& out) const -{ - out->writeSize(static_cast(_elements.size())); - for(DataList::const_iterator p = _elements.begin(); p != _elements.end(); ++p) - { - (*p)->marshal(out); - } -} - -void -FreezeScript::SequenceData::unmarshal(const Ice::InputStreamPtr& in) -{ - Slice::TypePtr type = _type->type(); - Ice::Int sz = in->readSize(); - _elements.reserve(sz); - for(Ice::Int i = 0; i < sz; ++i) - { - DataPtr v = _factory->create(type, _readOnly); - v->unmarshal(in); - _elements.push_back(v); - } - _length->setValue(sz, false); -} - -bool -FreezeScript::SequenceData::booleanValue(bool) const -{ - _errorReporter->error("sequence " + typeToString(_type) + " cannot be converted to boolean"); - return 0; -} - -Ice::Long -FreezeScript::SequenceData::integerValue(bool) const -{ - _errorReporter->error("sequence " + typeToString(_type) + " cannot be converted to integer"); - return 0; -} - -double -FreezeScript::SequenceData::doubleValue(bool) const -{ - _errorReporter->error("sequence " + typeToString(_type) + " cannot be converted to double"); - return 0; -} - -string -FreezeScript::SequenceData::stringValue(bool) const -{ - _errorReporter->error("sequence " + typeToString(_type) + " cannot be converted to string"); - return string(); -} - -string -FreezeScript::SequenceData::toString() const -{ - return stringValue(); -} - -void -FreezeScript::SequenceData::visit(DataVisitor& visitor) -{ - visitor.visitSequence(this); -} - -FreezeScript::DataList& -FreezeScript::SequenceData::getElements() -{ - return _elements; -} - -// -// EnumData -// -FreezeScript::EnumData::EnumData(const Slice::EnumPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly) : - Data(errorReporter, readOnly), _type(type), _value(0) -{ - _count = static_cast(type->getEnumerators().size()); -} - -FreezeScript::EnumData::EnumData(const Slice::EnumPtr& type, const ErrorReporterPtr& errorReporter, bool readOnly, - Ice::Int value) : - Data(errorReporter, readOnly), _type(type), _value(value) -{ - _count = static_cast(type->getEnumerators().size()); -} - -FreezeScript::DataPtr -FreezeScript::EnumData::getMember(const string&) const -{ - return 0; -} - -FreezeScript::DataPtr -FreezeScript::EnumData::getElement(const DataPtr&) const -{ - _errorReporter->error("element requested of enum value"); - return 0; -} - -bool -FreezeScript::EnumData::operator==(const Data& rhs) const -{ - return !operator!=(rhs); -} - -bool -FreezeScript::EnumData::operator!=(const Data& rhs) const -{ - const EnumData* e = dynamic_cast(&rhs); - if(!e || _type->scoped() != e->_type->scoped()) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _value != e->_value; -} - -bool -FreezeScript::EnumData::operator<(const Data& rhs) const -{ - const EnumData* e = dynamic_cast(&rhs); - if(!e || _type->scoped() != e->_type->scoped()) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _value < e->_value; -} - -FreezeScript::DataPtr -FreezeScript::EnumData::clone() const -{ - return new EnumData(_type, _errorReporter, _value); -} - -Slice::TypePtr -FreezeScript::EnumData::getType() const -{ - return _type; -} - -void -FreezeScript::EnumData::destroy() -{ -} - -void -FreezeScript::EnumData::marshal(const Ice::OutputStreamPtr& out) const -{ - if(_count <= 127) - { - out->write(static_cast(_value)); - } - else if(_count <= 32767) - { - out->write(static_cast(_value)); - } - else - { - out->write(_value); - } -} - -void -FreezeScript::EnumData::unmarshal(const Ice::InputStreamPtr& in) -{ - if(_count <= 127) - { - Ice::Byte val; - in ->read(val); - _value = val & 0xff; - } - else if(_count <= 32767) - { - Ice::Short val; - in->read(val); - _value = val; - } - else - { - in->read(_value); - } -} - -bool -FreezeScript::EnumData::booleanValue(bool) const -{ - _errorReporter->error("enum " + typeToString(_type) + " cannot be converted to boolean"); - return 0; -} - -Ice::Long -FreezeScript::EnumData::integerValue(bool convert) const -{ - if(convert) - { - return _value; - } - else - { - _errorReporter->error("enum " + typeToString(_type) + " cannot be converted to integer"); - return 0; - } -} - -double -FreezeScript::EnumData::doubleValue(bool) const -{ - _errorReporter->error("enum " + typeToString(_type) + " cannot be converted to double"); - return 0; -} - -string -FreezeScript::EnumData::stringValue(bool) const -{ - _errorReporter->error("enum " + typeToString(_type) + " cannot be converted to string"); - return string(); -} - -string -FreezeScript::EnumData::toString() const -{ - if(_name.empty()) - { - Slice::EnumeratorList l = _type->getEnumerators(); - Slice::EnumeratorList::const_iterator p = l.begin(); - Ice::Int i = _value; - while(i > 0) - { - ++p; - assert(p != l.end()); - --i; - } - const_cast(_name) = (*p)->name(); - } - return _name; -} - -void -FreezeScript::EnumData::visit(DataVisitor& visitor) -{ - visitor.visitEnum(this); -} - -Ice::Int -FreezeScript::EnumData::getValue() const -{ - return _value; -} - -bool -FreezeScript::EnumData::setValue(Ice::Int v) -{ - if(v >= 0 && v < _count) - { - _value = v; - _name.clear(); - return true; - } - return false; -} - -bool -FreezeScript::EnumData::setValueAsString(const string& v) -{ - Slice::EnumeratorList l = _type->getEnumerators(); - Slice::EnumeratorList::const_iterator p; - Ice::Int i = 0; - for(p = l.begin(); p != l.end(); ++p, ++i) - { - if((*p)->name() == v) - { - _value = i; - _name = v; - break; - } - } - return p != l.end(); -} - -// -// DictionaryData -// -FreezeScript::DictionaryData::DictionaryData(const DataFactoryPtr& factory, const Slice::DictionaryPtr& type, - const ErrorReporterPtr& errorReporter, bool readOnly) : - Data(errorReporter, readOnly), _factory(factory), _type(type) -{ - _length = IntegerDataPtr::dynamicCast(_factory->createInteger(0, true)); -} - -FreezeScript::DictionaryData::DictionaryData(const DataFactoryPtr& factory, const Slice::DictionaryPtr& type, - const ErrorReporterPtr& errorReporter, bool readOnly, const DataMap& m) : - Data(errorReporter, readOnly), _factory(factory), _type(type) -{ - for(DataMap::const_iterator p = m.begin(); p != m.end(); ++p) - { - _map.insert(DataMap::value_type(p->first->clone(), p->second->clone())); - } - _length = IntegerDataPtr::dynamicCast(_factory->createInteger(static_cast(_map.size()), true)); -} - -FreezeScript::DataPtr -FreezeScript::DictionaryData::getMember(const string& member) const -{ - if(member == "length") - { - _length->setValue(static_cast(_map.size()), false); - return _length; - } - - return 0; -} - -FreezeScript::DataPtr -FreezeScript::DictionaryData::getElement(const DataPtr& element) const -{ - DataMap::const_iterator p = _map.find(element); - if(p != _map.end()) - { - return p->second; - } - - return 0; -} - -bool -FreezeScript::DictionaryData::operator==(const Data& rhs) const -{ - return !operator!=(rhs); -} - -bool -FreezeScript::DictionaryData::operator!=(const Data& rhs) const -{ - const DictionaryData* d = dynamic_cast(&rhs); - if(!d || _type->scoped() != d->_type->scoped()) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _map != d->_map; -} - -bool -FreezeScript::DictionaryData::operator<(const Data& rhs) const -{ - const DictionaryData* d = dynamic_cast(&rhs); - if(!d || _type->scoped() != d->_type->scoped()) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - assert(false); - } - - return _map < d->_map; -} - -FreezeScript::DataPtr -FreezeScript::DictionaryData::clone() const -{ - return new DictionaryData(_factory, _type, _errorReporter, _readOnly, _map); -} - -Slice::TypePtr -FreezeScript::DictionaryData::getType() const -{ - return _type; -} - -void -FreezeScript::DictionaryData::destroy() -{ - for(DataMap::const_iterator p = _map.begin(); p != _map.end(); ++p) - { - p->first->destroy(); - p->second->destroy(); - } -} - -void -FreezeScript::DictionaryData::marshal(const Ice::OutputStreamPtr& out) const -{ - out->writeSize(static_cast(_map.size())); - for(DataMap::const_iterator p = _map.begin(); p != _map.end(); ++p) - { - p->first->marshal(out); - p->second->marshal(out); - } -} - -void -FreezeScript::DictionaryData::unmarshal(const Ice::InputStreamPtr& in) -{ - Slice::TypePtr keyType = _type->keyType(); - Slice::TypePtr valueType = _type->valueType(); - - Ice::Int sz = in->readSize(); - - for(Ice::Int i = 0; i < sz; ++i) - { - DataPtr key = _factory->create(keyType, _readOnly); - key->unmarshal(in); - - DataPtr value = _factory->create(valueType, _readOnly); - value->unmarshal(in); - - _map.insert(DataMap::value_type(key, value)); - } - - _length->setValue(static_cast(_map.size()), false); -} - -bool -FreezeScript::DictionaryData::booleanValue(bool) const -{ - _errorReporter->error("dictionary " + typeToString(_type) + " cannot be converted to boolean"); - return 0; -} - -Ice::Long -FreezeScript::DictionaryData::integerValue(bool) const -{ - _errorReporter->error("dictionary " + typeToString(_type) + " cannot be converted to integer"); - return 0; -} - -double -FreezeScript::DictionaryData::doubleValue(bool) const -{ - _errorReporter->error("dictionary " + typeToString(_type) + " cannot be converted to double"); - return 0; -} - -string -FreezeScript::DictionaryData::stringValue(bool) const -{ - _errorReporter->error("dictionary " + typeToString(_type) + " cannot be converted to string"); - return string(); -} - -string -FreezeScript::DictionaryData::toString() const -{ - return stringValue(); -} - -void -FreezeScript::DictionaryData::visit(DataVisitor& visitor) -{ - visitor.visitDictionary(this); -} - -FreezeScript::DataMap& -FreezeScript::DictionaryData::getElements() -{ - return _map; -} - -// -// ObjectData -// -FreezeScript::ObjectData::ObjectData(const DataFactoryPtr& factory, const Slice::TypePtr& type, bool readOnly) : - Data(factory->getErrorReporter(), readOnly), _type(type), _refCount(0) -{ - Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(type); - if(decl) - { - Slice::ClassDefPtr def = decl->definition(); - assert(def); - Slice::DataMemberList members = def->allDataMembers(); - for(Slice::DataMemberList::iterator p = members.begin(); p != members.end(); ++p) - { - _members[(*p)->name()] = factory->create((*p)->type(), _readOnly); - } - _id = factory->createString(decl->scoped(), true); - } - else - { - _id = factory->createString("::Ice::Object", true); - } -} - -FreezeScript::DataPtr -FreezeScript::ObjectData::getMember(const string& member) const -{ - if(member == "ice_id") - { - return _id; - } - - DataMemberMap::const_iterator p = _members.find(member); - if(p != _members.end()) - { - return p->second; - } - - return 0; -} - -FreezeScript::DataPtr -FreezeScript::ObjectData::getElement(const DataPtr& /*element*/) const -{ - _errorReporter->error("element requested of object value"); - return 0; -} - -bool -FreezeScript::ObjectData::operator==(const Data& rhs) const -{ - return !operator!=(rhs); -} - -bool -FreezeScript::ObjectData::operator!=(const Data& /*rhs*/) const -{ - _errorReporter->error("object comparison not supported"); - return false; -} - -bool -FreezeScript::ObjectData::operator<(const Data& /*rhs*/) const -{ - _errorReporter->error("object comparison not supported"); - return false; -} - -FreezeScript::DataPtr -FreezeScript::ObjectData::clone() const -{ - assert(false); - return 0; -} - -Slice::TypePtr -FreezeScript::ObjectData::getType() const -{ - return _type; -} - -void -FreezeScript::ObjectData::destroy() -{ - assert(false); -} - -void -FreezeScript::ObjectData::marshal(const Ice::OutputStreamPtr& out) const -{ - if(!_marshaler) - { - const_cast(_marshaler) = new ObjectWriter(const_cast(this)); - } - out->writeObject(_marshaler); -} - -void -FreezeScript::ObjectData::unmarshal(const Ice::InputStreamPtr& /*in*/) -{ - // - // Unmarshaling is done by ObjectReader. - // - assert(false); -} - -bool -FreezeScript::ObjectData::booleanValue(bool) const -{ - assert(false); - return 0; -} - -Ice::Long -FreezeScript::ObjectData::integerValue(bool) const -{ - assert(false); - return 0; -} - -double -FreezeScript::ObjectData::doubleValue(bool) const -{ - assert(false); - return 0; -} - -string -FreezeScript::ObjectData::stringValue(bool) const -{ - assert(false); - return string(); -} - -string -FreezeScript::ObjectData::toString() const -{ - assert(false); - return string(); -} - -void -FreezeScript::ObjectData::visit(DataVisitor& /*visitor*/) -{ - assert(false); -} - -FreezeScript::DataMemberMap& -FreezeScript::ObjectData::getMembers() -{ - return _members; -} - -void -FreezeScript::ObjectData::incRef() -{ - _refCount++; -} - -void -FreezeScript::ObjectData::decRef() -{ - assert(_refCount > 0); - _refCount--; - if(_refCount == 0) - { - destroyI(); - } -} - -void -FreezeScript::ObjectData::destroyI() -{ - DataMemberMap members = _members; - - _members.clear(); - _marshaler = 0; - - for(DataMemberMap::const_iterator p = members.begin(); p != members.end(); ++p) - { - p->second->destroy(); - } -} - -// -// ObjectRef -// -FreezeScript::ObjectRef::ObjectRef(const DataFactoryPtr& factory, const Slice::TypePtr& type, bool readOnly) : - Data(factory->getErrorReporter(), readOnly), _factory(factory), _type(type) -{ -} - -FreezeScript::ObjectRef::ObjectRef(const DataFactoryPtr& factory, const Slice::TypePtr& type, bool readOnly, - const ObjectDataPtr& value) : - Data(factory->getErrorReporter(), readOnly), _factory(factory), _type(type), _value(value) -{ - _value->incRef(); -} - -FreezeScript::DataPtr -FreezeScript::ObjectRef::getMember(const string& member) const -{ - if(!_value) - { - _errorReporter->error("member `" + member + "' requested of nil object"); - } - - return _value->getMember(member); -} - -FreezeScript::DataPtr -FreezeScript::ObjectRef::getElement(const DataPtr&) const -{ - _errorReporter->error("element requested of object value"); - return 0; -} - -bool -FreezeScript::ObjectRef::operator==(const Data& rhs) const -{ - return !operator!=(rhs); -} - -bool -FreezeScript::ObjectRef::operator!=(const Data& rhs) const -{ - const ObjectRef* r = dynamic_cast(&rhs); - if(!r) - { - _errorReporter->typeMismatchError(_type, rhs.getType(), true); - } - - // - // Reference comparison. - // - return _value.get() != r->_value.get(); -} - -bool -FreezeScript::ObjectRef::operator<(const Data& /*rhs*/) const -{ - _errorReporter->error("object comparison not supported"); - return false; -} - -FreezeScript::DataPtr -FreezeScript::ObjectRef::clone() const -{ - return new ObjectRef(_factory, _type, _value); -} - -Slice::TypePtr -FreezeScript::ObjectRef::getType() const -{ - return _type; -} - -void -FreezeScript::ObjectRef::destroy() -{ - if(_value) - { - _value->decRef(); - _value = 0; - } -} - -void -FreezeScript::ObjectRef::marshal(const Ice::OutputStreamPtr& out) const -{ - if(!_value) - { - out->writeObject(0); - return; - } - - _value->marshal(out); -} - -FreezeScript::ReadObjectCallback::ReadObjectCallback(const ObjectRefPtr& ref) : - _ref(ref) -{ -} - -void -FreezeScript::ReadObjectCallback::invoke(const Ice::ObjectPtr& p) -{ - if(p) - { - ObjectReaderPtr reader = ObjectReaderPtr::dynamicCast(p); - assert(reader); - - _ref->setValue(reader->getValue()); - } -} - -void -FreezeScript::ObjectRef::unmarshal(const Ice::InputStreamPtr& in) -{ - in->readObject(new ReadObjectCallback(this)); -} - -bool -FreezeScript::ObjectRef::booleanValue(bool) const -{ - _errorReporter->error(typeToString(_type) + " cannot be converted to boolean"); - return 0; -} - -Ice::Long -FreezeScript::ObjectRef::integerValue(bool) const -{ - _errorReporter->error(typeToString(_type) + " cannot be converted to integer"); - return 0; -} - -double -FreezeScript::ObjectRef::doubleValue(bool) const -{ - _errorReporter->error(typeToString(_type) + " cannot be converted to double"); - return 0; -} - -string -FreezeScript::ObjectRef::stringValue(bool) const -{ - _errorReporter->error(typeToString(_type) + " cannot be converted to string"); - return string(); -} - -string -FreezeScript::ObjectRef::toString() const -{ - return stringValue(); -} - -void -FreezeScript::ObjectRef::visit(DataVisitor& visitor) -{ - visitor.visitObject(this); -} - -void -FreezeScript::ObjectRef::instantiate() -{ - ObjectDataPtr data = new ObjectData(_factory, _type, _readOnly); - setValue(data); -} - -FreezeScript::ObjectDataPtr -FreezeScript::ObjectRef::getValue() const -{ - return _value; -} - -void -FreezeScript::ObjectRef::setValue(const ObjectDataPtr& value) -{ - // TODO: Type check? - ObjectDataPtr oldValue = _value; - _value = value; - if(_value) - { - _value->incRef(); - } - if(oldValue) - { - oldValue->decRef(); - } -} - -// -// ObjectFactory -// -Ice::ObjectPtr -FreezeScript::ObjectFactory::create(const string& id) -{ - Ice::ObjectPtr result; - - if(_factory) - { - if(id == Ice::Object::ice_staticId()) - { - result = new ObjectReader(_factory, _unit->builtin(Slice::Builtin::KindObject)); - } - else - { - Slice::TypeList l = _unit->lookupTypeNoBuiltin(id); - if(!l.empty()) - { - Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(l.front()); - if(!decl) - { - _factory->getErrorReporter()->error("Slice definition for `" + id + "' is not a class"); - } - Slice::ClassDefPtr def = decl->definition(); - if(!def) - { - _factory->getErrorReporter()->error("no class definition for `" + id + "'"); - } - result = new ObjectReader(_factory, decl); - } - } - } - - return result; -} - -void -FreezeScript::ObjectFactory::destroy() -{ -} - -void -FreezeScript::ObjectFactory::activate(const DataFactoryPtr& factory, const Slice::UnitPtr& unit) -{ - assert(!_factory && !_unit); - _factory = factory; - _unit = unit; -} -void -FreezeScript::ObjectFactory::deactivate() -{ - _factory = 0; - _unit = 0; -} - -// -// DataVisitor -// -FreezeScript::DataVisitor::~DataVisitor() -{ -} - -void -FreezeScript::DataVisitor::visitBoolean(const BooleanDataPtr&) -{ -} - -void -FreezeScript::DataVisitor::visitInteger(const IntegerDataPtr&) -{ -} - -void -FreezeScript::DataVisitor::visitDouble(const DoubleDataPtr&) -{ -} - -void -FreezeScript::DataVisitor::visitString(const StringDataPtr&) -{ -} - -void -FreezeScript::DataVisitor::visitProxy(const ProxyDataPtr&) -{ -} - -void -FreezeScript::DataVisitor::visitStruct(const StructDataPtr&) -{ -} - -void -FreezeScript::DataVisitor::visitSequence(const SequenceDataPtr&) -{ -} - -void -FreezeScript::DataVisitor::visitEnum(const EnumDataPtr&) -{ -} - -void -FreezeScript::DataVisitor::visitDictionary(const DictionaryDataPtr&) -{ -} - -void -FreezeScript::DataVisitor::visitObject(const ObjectRefPtr&) -{ -} diff --git a/cpp/src/FreezeScript/Data.h b/cpp/src/FreezeScript/Data.h deleted file mode 100644 index 4115611cd89..00000000000 --- a/cpp/src/FreezeScript/Data.h +++ /dev/null @@ -1,618 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_SCRIPT_DATA_H -#define FREEZE_SCRIPT_DATA_H - -#include -#include -#include - -namespace FreezeScript -{ - -class Data; -typedef IceUtil::Handle DataPtr; - -class DataVisitor; - -typedef std::map DataMemberMap; -typedef std::vector DataList; -typedef std::map DataMap; - -class ObjectWriter; -class ObjectReader; - -class ObjectData; -typedef IceUtil::Handle ObjectDataPtr; - -class DataFactory : public IceUtil::SimpleShared -{ -public: - - DataFactory(const Ice::CommunicatorPtr&, const Slice::UnitPtr&, const ErrorReporterPtr&); - - DataPtr create(const Slice::TypePtr&, bool); - DataPtr createBoolean(bool, bool); - DataPtr createInteger(Ice::Long, bool); - DataPtr createDouble(double, bool); - DataPtr createString(const std::string&, bool); - DataPtr createNil(bool); - DataPtr createObject(const Slice::TypePtr&, bool); - - Slice::BuiltinPtr getBuiltin(Slice::Builtin::Kind) const; - - Ice::CommunicatorPtr getCommunicator() const; - ErrorReporterPtr getErrorReporter() const; - -protected: - - DataPtr createImpl(const Slice::TypePtr&, bool); - - virtual void initialize(const DataPtr&); - - Ice::CommunicatorPtr _communicator; - Slice::UnitPtr _unit; // Only used for creating builtin types. - ErrorReporterPtr _errorReporter; -}; -typedef IceUtil::Handle DataFactoryPtr; - -class Data : public IceUtil::SimpleShared -{ -public: - - virtual ~Data(); - - virtual DataPtr getMember(const std::string&) const = 0; - virtual DataPtr getElement(const DataPtr&) const = 0; - - virtual bool operator==(const Data&) const = 0; - virtual bool operator!=(const Data&) const = 0; - virtual bool operator<(const Data&) const = 0; - - virtual DataPtr clone() const = 0; - - bool readOnly() const; - virtual Slice::TypePtr getType() const = 0; - virtual void destroy() = 0; - - virtual void marshal(const Ice::OutputStreamPtr&) const = 0; - virtual void unmarshal(const Ice::InputStreamPtr&) = 0; - - virtual bool booleanValue(bool = false) const = 0; - virtual Ice::Long integerValue(bool = false) const = 0; - virtual double doubleValue(bool = false) const = 0; - virtual std::string stringValue(bool = false) const = 0; - virtual std::string toString() const = 0; - - virtual void visit(DataVisitor&) = 0; - -protected: - - Data(const ErrorReporterPtr&, bool); - - ErrorReporterPtr _errorReporter; - bool _readOnly; -}; - -class PrimitiveData : public Data -{ -public: - - virtual DataPtr getMember(const std::string&) const; - virtual DataPtr getElement(const DataPtr&) const; - - virtual void destroy(); - -protected: - - PrimitiveData(const ErrorReporterPtr&, bool); -}; -typedef IceUtil::Handle PrimitiveDataPtr; - -class BooleanData : public PrimitiveData -{ -public: - - BooleanData(const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool); - BooleanData(const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool, bool); - - virtual bool operator==(const Data&) const; - virtual bool operator!=(const Data&) const; - virtual bool operator<(const Data&) const; - - virtual DataPtr clone() const; - - virtual Slice::TypePtr getType() const; - - virtual void marshal(const Ice::OutputStreamPtr&) const; - virtual void unmarshal(const Ice::InputStreamPtr&); - - virtual bool booleanValue(bool = false) const; - virtual Ice::Long integerValue(bool = false) const; - virtual double doubleValue(bool = false) const; - virtual std::string stringValue(bool = false) const; - virtual std::string toString() const; - - virtual void visit(DataVisitor&); - - bool getValue() const; - void setValue(bool); - -private: - - Slice::BuiltinPtr _type; - bool _value; -}; -typedef IceUtil::Handle BooleanDataPtr; - -class IntegerData : public PrimitiveData -{ -public: - - IntegerData(const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool); - IntegerData(const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool, Ice::Long); - - virtual bool operator==(const Data&) const; - virtual bool operator!=(const Data&) const; - virtual bool operator<(const Data&) const; - - virtual DataPtr clone() const; - - virtual Slice::TypePtr getType() const; - - virtual void marshal(const Ice::OutputStreamPtr&) const; - virtual void unmarshal(const Ice::InputStreamPtr&); - - virtual bool booleanValue(bool = false) const; - virtual Ice::Long integerValue(bool = false) const; - virtual double doubleValue(bool = false) const; - virtual std::string stringValue(bool = false) const; - virtual std::string toString() const; - - virtual void visit(DataVisitor&); - - Ice::Long getValue() const; - void setValue(Ice::Long, bool); - -private: - - bool rangeCheck(Ice::Long, bool) const; - static std::string toString(Ice::Long); - - Slice::BuiltinPtr _type; - Ice::Long _value; -}; -typedef IceUtil::Handle IntegerDataPtr; - -class DoubleData : public PrimitiveData -{ -public: - - DoubleData(const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool); - DoubleData(const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool, double); - - virtual bool operator==(const Data&) const; - virtual bool operator!=(const Data&) const; - virtual bool operator<(const Data&) const; - - virtual DataPtr clone() const; - - virtual Slice::TypePtr getType() const; - - virtual void marshal(const Ice::OutputStreamPtr&) const; - virtual void unmarshal(const Ice::InputStreamPtr&); - - virtual bool booleanValue(bool = false) const; - virtual Ice::Long integerValue(bool = false) const; - virtual double doubleValue(bool = false) const; - virtual std::string stringValue(bool = false) const; - virtual std::string toString() const; - - virtual void visit(DataVisitor&); - - double getValue() const; - void setValue(double); - -private: - - Slice::BuiltinPtr _type; - double _value; -}; -typedef IceUtil::Handle DoubleDataPtr; - -class StringData : public PrimitiveData -{ -public: - - StringData(const DataFactoryPtr&, const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool); - StringData(const DataFactoryPtr&, const Slice::BuiltinPtr&, const ErrorReporterPtr&, bool, const std::string&); - - virtual DataPtr getMember(const std::string&) const; - - virtual bool operator==(const Data&) const; - virtual bool operator!=(const Data&) const; - virtual bool operator<(const Data&) const; - - virtual DataPtr clone() const; - - virtual Slice::TypePtr getType() const; - - virtual void marshal(const Ice::OutputStreamPtr&) const; - virtual void unmarshal(const Ice::InputStreamPtr&); - - virtual bool booleanValue(bool = false) const; - virtual Ice::Long integerValue(bool = false) const; - virtual double doubleValue(bool = false) const; - virtual std::string stringValue(bool = false) const; - virtual std::string toString() const; - - virtual void visit(DataVisitor&); - - std::string getValue() const; - void setValue(const std::string&); - -private: - - DataFactoryPtr _factory; - Slice::BuiltinPtr _type; - std::string _value; - IntegerDataPtr _length; -}; -typedef IceUtil::Handle StringDataPtr; - -class ProxyData : public Data -{ -public: - - ProxyData(const Slice::TypePtr&, const Ice::CommunicatorPtr&, const ErrorReporterPtr&, bool); - ProxyData(const Slice::TypePtr&, const Ice::CommunicatorPtr&, const ErrorReporterPtr&, bool, const Ice::ObjectPrx&); - - virtual DataPtr getMember(const std::string&) const; - virtual DataPtr getElement(const DataPtr&) const; - - virtual bool operator==(const Data&) const; - virtual bool operator!=(const Data&) const; - virtual bool operator<(const Data&) const; - - virtual DataPtr clone() const; - - virtual Slice::TypePtr getType() const; - virtual void destroy(); - - virtual void marshal(const Ice::OutputStreamPtr&) const; - virtual void unmarshal(const Ice::InputStreamPtr&); - - virtual bool booleanValue(bool = false) const; - virtual Ice::Long integerValue(bool = false) const; - virtual double doubleValue(bool = false) const; - virtual std::string stringValue(bool = false) const; - virtual std::string toString() const; - - virtual void visit(DataVisitor&); - - Ice::ObjectPrx getValue() const; - void setValue(const std::string&, bool); - void setValue(const Ice::ObjectPrx&); - -private: - - Slice::TypePtr _type; // Can be Builtin or Proxy - Ice::CommunicatorPtr _communicator; - Ice::ObjectPrx _value; - std::string _str; -}; -typedef IceUtil::Handle ProxyDataPtr; - -class StructData : public Data -{ -public: - - StructData(const DataFactoryPtr&, const Slice::StructPtr&, const ErrorReporterPtr&, bool); - - virtual DataPtr getMember(const std::string&) const; - virtual DataPtr getElement(const DataPtr&) const; - - virtual bool operator==(const Data&) const; - virtual bool operator!=(const Data&) const; - virtual bool operator<(const Data&) const; - - virtual DataPtr clone() const; - - virtual Slice::TypePtr getType() const; - - virtual void marshal(const Ice::OutputStreamPtr&) const; - virtual void unmarshal(const Ice::InputStreamPtr&); - - virtual void destroy(); - - virtual bool booleanValue(bool = false) const; - virtual Ice::Long integerValue(bool = false) const; - virtual double doubleValue(bool = false) const; - virtual std::string stringValue(bool = false) const; - virtual std::string toString() const; - - virtual void visit(DataVisitor&); - - DataMemberMap& getMembers(); - -private: - - StructData(const Slice::StructPtr&, const ErrorReporterPtr&, bool, const DataMemberMap&); - - Slice::StructPtr _type; - DataMemberMap _members; -}; -typedef IceUtil::Handle StructDataPtr; - -class SequenceData : public Data -{ -public: - - SequenceData(const DataFactoryPtr&, const Slice::SequencePtr&, const ErrorReporterPtr&, bool); - - virtual DataPtr getMember(const std::string&) const; - virtual DataPtr getElement(const DataPtr&) const; - - virtual bool operator==(const Data&) const; - virtual bool operator!=(const Data&) const; - virtual bool operator<(const Data&) const; - - virtual DataPtr clone() const; - - virtual Slice::TypePtr getType() const; - virtual void destroy(); - - virtual void marshal(const Ice::OutputStreamPtr&) const; - virtual void unmarshal(const Ice::InputStreamPtr&); - - virtual bool booleanValue(bool = false) const; - virtual Ice::Long integerValue(bool = false) const; - virtual double doubleValue(bool = false) const; - virtual std::string stringValue(bool = false) const; - virtual std::string toString() const; - - virtual void visit(DataVisitor&); - - DataList& getElements(); - -private: - - SequenceData(const DataFactoryPtr&, const Slice::SequencePtr&, const ErrorReporterPtr&, bool, const DataList&); - - DataFactoryPtr _factory; - Slice::SequencePtr _type; - DataList _elements; - IntegerDataPtr _length; -}; -typedef IceUtil::Handle SequenceDataPtr; - -class EnumData : public Data -{ -public: - - EnumData(const Slice::EnumPtr&, const ErrorReporterPtr&, bool); - EnumData(const Slice::EnumPtr&, const ErrorReporterPtr&, bool, Ice::Int); - - virtual DataPtr getMember(const std::string&) const; - virtual DataPtr getElement(const DataPtr&) const; - - virtual bool operator==(const Data&) const; - virtual bool operator!=(const Data&) const; - virtual bool operator<(const Data&) const; - - virtual DataPtr clone() const; - - virtual Slice::TypePtr getType() const; - virtual void destroy(); - - virtual void marshal(const Ice::OutputStreamPtr&) const; - virtual void unmarshal(const Ice::InputStreamPtr&); - - virtual bool booleanValue(bool = false) const; - virtual Ice::Long integerValue(bool = false) const; - virtual double doubleValue(bool = false) const; - virtual std::string stringValue(bool = false) const; - virtual std::string toString() const; - - virtual void visit(DataVisitor&); - - Ice::Int getValue() const; - bool setValue(Ice::Int); - bool setValueAsString(const std::string&); - -private: - - Slice::EnumPtr _type; - Ice::Int _value; - std::string _name; - Ice::Int _count; -}; -typedef IceUtil::Handle EnumDataPtr; - -class DictionaryData : public Data -{ -public: - - DictionaryData(const DataFactoryPtr&, const Slice::DictionaryPtr&, const ErrorReporterPtr&, bool); - - virtual DataPtr getMember(const std::string&) const; - virtual DataPtr getElement(const DataPtr&) const; - - virtual bool operator==(const Data&) const; - virtual bool operator!=(const Data&) const; - virtual bool operator<(const Data&) const; - - virtual DataPtr clone() const; - - virtual Slice::TypePtr getType() const; - virtual void destroy(); - - virtual void marshal(const Ice::OutputStreamPtr&) const; - virtual void unmarshal(const Ice::InputStreamPtr&); - - virtual bool booleanValue(bool = false) const; - virtual Ice::Long integerValue(bool = false) const; - virtual double doubleValue(bool = false) const; - virtual std::string stringValue(bool = false) const; - virtual std::string toString() const; - - virtual void visit(DataVisitor&); - - DataMap& getElements(); - -private: - - DictionaryData(const DataFactoryPtr&, const Slice::DictionaryPtr&, const ErrorReporterPtr&, bool, const DataMap&); - - DataFactoryPtr _factory; - Slice::DictionaryPtr _type; - DataMap _map; - IntegerDataPtr _length; -}; -typedef IceUtil::Handle DictionaryDataPtr; - -class ObjectData : public Data -{ -public: - - ObjectData(const DataFactoryPtr&, const Slice::TypePtr&, bool); - - virtual DataPtr getMember(const std::string&) const; - virtual DataPtr getElement(const DataPtr&) const; - - virtual bool operator==(const Data&) const; - virtual bool operator!=(const Data&) const; - virtual bool operator<(const Data&) const; - - virtual DataPtr clone() const; - - virtual Slice::TypePtr getType() const; - virtual void destroy(); - - virtual void marshal(const Ice::OutputStreamPtr&) const; - virtual void unmarshal(const Ice::InputStreamPtr&); - - virtual bool booleanValue(bool = false) const; - virtual Ice::Long integerValue(bool = false) const; - virtual double doubleValue(bool = false) const; - virtual std::string stringValue(bool = false) const; - virtual std::string toString() const; - - virtual void visit(DataVisitor&); - - DataMemberMap& getMembers(); - - void incRef(); - void decRef(); - -private: - - void destroyI(); - - Slice::TypePtr _type; // Can be Builtin (Object) or ClassDecl - DataPtr _facetMap; - DataMemberMap _members; - Ice::ObjectPtr _marshaler; - Ice::Int _refCount; - DataPtr _id; - - friend class ObjectWriter; - friend class ObjectReader; -}; - -class ObjectRef : public Data -{ -public: - - ObjectRef(const DataFactoryPtr&, const Slice::TypePtr&, bool); - ObjectRef(const DataFactoryPtr&, const Slice::TypePtr&, bool, const ObjectDataPtr&); - - virtual DataPtr getMember(const std::string&) const; - virtual DataPtr getElement(const DataPtr&) const; - - virtual bool operator==(const Data&) const; - virtual bool operator!=(const Data&) const; - virtual bool operator<(const Data&) const; - - virtual DataPtr clone() const; - - virtual Slice::TypePtr getType() const; - virtual void destroy(); - - virtual void marshal(const Ice::OutputStreamPtr&) const; - virtual void unmarshal(const Ice::InputStreamPtr&); - - virtual bool booleanValue(bool = false) const; - virtual Ice::Long integerValue(bool = false) const; - virtual double doubleValue(bool = false) const; - virtual std::string stringValue(bool = false) const; - virtual std::string toString() const; - - virtual void visit(DataVisitor&); - - void instantiate(); - ObjectDataPtr getValue() const; - void setValue(const ObjectDataPtr&); - -private: - - DataFactoryPtr _factory; - Slice::TypePtr _type; // Formal type: can be Builtin (Object) or ClassDecl - ObjectDataPtr _value; -}; -typedef IceUtil::Handle ObjectRefPtr; - -class ObjectFactory : public Ice::ObjectFactory -{ -public: - - virtual Ice::ObjectPtr create(const std::string&); - virtual void destroy(); - - void activate(const DataFactoryPtr&, const Slice::UnitPtr&); - void deactivate(); - -private: - - DataFactoryPtr _factory; - Slice::UnitPtr _unit; -}; -typedef IceUtil::Handle ObjectFactoryPtr; - -class ClassNotFoundException -{ -public: - - ClassNotFoundException(const std::string& s) : id(s) {} - - std::string id; -}; - -class DataVisitor -{ -public: - - virtual ~DataVisitor(); - - virtual void visitBoolean(const BooleanDataPtr&); - virtual void visitInteger(const IntegerDataPtr&); - virtual void visitDouble(const DoubleDataPtr&); - virtual void visitString(const StringDataPtr&); - virtual void visitProxy(const ProxyDataPtr&); - virtual void visitStruct(const StructDataPtr&); - virtual void visitSequence(const SequenceDataPtr&); - virtual void visitEnum(const EnumDataPtr&); - virtual void visitDictionary(const DictionaryDataPtr&); - virtual void visitObject(const ObjectRefPtr&); -}; - -} // End of namespace FreezeScript - -#endif diff --git a/cpp/src/FreezeScript/DumpDB.cpp b/cpp/src/FreezeScript/DumpDB.cpp deleted file mode 100644 index b91ac7e8478..00000000000 --- a/cpp/src/FreezeScript/DumpDB.cpp +++ /dev/null @@ -1,980 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace IceUtil; -using namespace IceUtilInternal; - -#ifdef _WIN32 -# define FREEZE_SCRIPT_DB_MODE 0 -#else -# define FREEZE_SCRIPT_DB_MODE (S_IRUSR | S_IWUSR) -#endif - -namespace FreezeScript -{ - -// -// SliceVisitor generates default descriptors. -// -class SliceVisitor : public Slice::ParserVisitor -{ -public: - - SliceVisitor(IceUtilInternal::XMLOutput&, const Slice::TypePtr&, const Slice::TypePtr&, const string&); - - virtual bool visitClassDefStart(const Slice::ClassDefPtr&); - virtual bool visitStructStart(const Slice::StructPtr&); - virtual void visitSequence(const Slice::SequencePtr&); - virtual void visitDictionary(const Slice::DictionaryPtr&); - virtual void visitEnum(const Slice::EnumPtr&); - -private: - - IceUtilInternal::XMLOutput& _out; -}; - -class DescriptorHandler : public IceXML::Handler -{ -public: - - DescriptorHandler(const DataFactoryPtr&, const Slice::UnitPtr&, const ErrorReporterPtr&, - const FreezeScript::ObjectFactoryPtr&); - - virtual void startElement(const std::string&, const IceXML::Attributes&, int, int); - virtual void endElement(const std::string&, int, int); - virtual void characters(const std::string&, int, int); - virtual void error(const std::string&, int, int); - - DumpDBDescriptorPtr descriptor() const; - -private: - - DataFactoryPtr _factory; - Slice::UnitPtr _unit; - ErrorReporterPtr _errorReporter; - DescriptorPtr _current; - DumpDBDescriptorPtr _descriptor; - FreezeScript::ObjectFactoryPtr _objectFactory; -}; - -} - -static void -usage(const string& n) -{ - cerr << "Usage:\n"; - cerr << "\n"; - cerr << n << " [options] dbenv db\n"; - cerr << n << " -c dbenv [db]\n"; - cerr << "\n"; - cerr << - "Options:\n" - "-h, --help Show this message.\n" - "-v, --version Display the Ice version.\n" - "-DNAME Define NAME as 1.\n" - "-DNAME=DEF Define NAME as DEF.\n" - "-UNAME Remove any definition for NAME.\n" - "-IDIR Put DIR in the include file search path.\n" - "-d, --debug Print debug messages.\n" - "--ice Permit `Ice' prefix (for building Ice source code only).\n" - "--underscore Permit underscores in Slice identifiers.\n" - "-o FILE Output sample descriptors into the file FILE.\n" - "-f FILE Execute the descriptors in the file FILE.\n" - "--load SLICE Load Slice definitions from the file SLICE.\n" - "-e Indicates the database is an Evictor database.\n" - "--key TYPE Specifies the Slice type of the database key.\n" - "--value TYPE Specifies the Slice type of the database value.\n" - "--select EXPR Dump a record only if EXPR is true.\n" - "-c, --catalog Display information about the databases in an\n" - " environment, or about a particular database.\n" - ; -} - -static void -printCatalogData(const string& dbName, const Freeze::CatalogData& data) -{ - cout << dbName << ": "; - if(data.evictor) - { - cout << "Evictor database" << endl; - } - else - { - cout << "Map database" << endl; - cout << " key type = " << data.key << endl; - cout << " value type = " << data.value << endl; - } -} - -static int -run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator, - const FreezeScript::CompactIdResolverIPtr& resolver) -{ - vector cppArgs; - bool debug; - bool ice = true; // Needs to be true in order to create default definitions. - bool underscore; - string outputFile; - string inputFile; - vector slice; - bool evictor; - string keyTypeName; - string valueTypeName; - string selectExpr; - string dbEnvName, dbName; - const string appName = originalArgs[0]; - IceUtilInternal::Options opts; - opts.addOpt("h", "help"); - opts.addOpt("v", "version"); - opts.addOpt("D", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("U", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("I", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("d", "debug"); - opts.addOpt("", "ice"); - opts.addOpt("", "underscore"); - opts.addOpt("o", "", IceUtilInternal::Options::NeedArg); - opts.addOpt("f", "", IceUtilInternal::Options::NeedArg); - opts.addOpt("", "load", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("e"); - opts.addOpt("", "key", IceUtilInternal::Options::NeedArg); - opts.addOpt("", "value", IceUtilInternal::Options::NeedArg); - opts.addOpt("", "select", IceUtilInternal::Options::NeedArg); - opts.addOpt("c", "catalog"); - - vector args; - try - { - args = opts.parse(originalArgs); - } - catch(const IceUtilInternal::BadOptException& e) - { - cerr << appName << ": " << e.reason << endl; - usage(appName); - return EXIT_FAILURE; - } - - // - // Freeze creates a lock file by default to prevent multiple processes from opening - // the same database environment simultaneously. In the case of a read-only program - // such as dumpdb, however, we still want to be able to open the environment despite - // the lock. This assumes of course that the other process has opened the environment - // with DbPrivate=0. If DbPrivate=0 is also set for dumpdb, we disable the lock. - // - if(!args.empty()) - { - // - // If an argument is present, we assume it is the name of the database environment. - // - Ice::PropertiesPtr props = communicator->getProperties(); - string prefix = "Freeze.DbEnv." + args[0]; - if(props->getPropertyAsIntWithDefault(prefix + ".DbPrivate", 1) <= 0) - { - props->setProperty(prefix + ".LockFile", "0"); - } - } - - if(opts.isSet("h")) - { - usage(appName); - return EXIT_SUCCESS; - } - if(opts.isSet("version")) - { - cout << ICE_STRING_VERSION << endl; - return EXIT_SUCCESS; - } - if(opts.isSet("c")) - { - if(args.empty()) - { - cerr << appName << ": no database environment specified." << endl; - usage(appName); - return EXIT_FAILURE; - } - else if(args.size() > 2) - { - usage(appName); - return EXIT_FAILURE; - } - try - { - FreezeScript::CatalogDataMap catalog = FreezeScript::readCatalog(communicator, args[0]); - if(args.size() == 1) - { - if(catalog.empty()) - { - cout << "Catalog is empty." << endl; - } - else - { - cout << "Catalog contents:" << endl; - for(FreezeScript::CatalogDataMap::const_iterator p = catalog.begin(); p != catalog.end(); ++p) - { - cout << endl; - printCatalogData(p->first, p->second); - } - } - } - else - { - FreezeScript::CatalogDataMap::const_iterator p = catalog.find(args[1]); - if(p == catalog.end()) - { - cerr << appName << ": database `" << args[1] << "' not found in environment `" << args[0] << "'." - << endl; - return EXIT_FAILURE; - } - else - { - printCatalogData(p->first, p->second); - } - } - return EXIT_SUCCESS; - } - catch(const FreezeScript::FailureException& ex) - { - cerr << appName << ": " << ex.reason() << endl; - return EXIT_FAILURE; - } - } - if(opts.isSet("D")) - { - vector optargs = opts.argVec("D"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - cppArgs.push_back("-D" + *i); - } - } - if(opts.isSet("U")) - { - vector optargs = opts.argVec("U"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - cppArgs.push_back("-U" + *i); - } - } - if(opts.isSet("I")) - { - vector optargs = opts.argVec("I"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - cppArgs.push_back("-I" + *i); - } - } - debug = opts.isSet("debug"); - - // No need to set --ice option here -- it is always true. - - underscore = opts.isSet("underscore"); - - if(opts.isSet("o")) - { - outputFile = opts.optArg("o"); - } - if(opts.isSet("f")) - { - inputFile = opts.optArg("f"); - } - if(opts.isSet("load")) - { - vector optArgs = opts.argVec("load"); - for(vector::const_iterator i = optArgs.begin(); i != optArgs.end(); ++i) - { - slice.push_back(*i); - } - } - evictor = opts.isSet("e"); - if(opts.isSet("key")) - { - keyTypeName = opts.optArg("key"); - } - if(opts.isSet("value")) - { - valueTypeName = opts.optArg("value"); - } - if(opts.isSet("select")) - { - selectExpr = opts.optArg("select"); - } - - if(outputFile.empty() && args.size() != 2) - { - usage(appName); - return EXIT_FAILURE; - } - - if(!args.empty()) - { - dbEnvName = args[0]; - } - if(args.size() == 2) - { - dbName = args[1]; - } - else - { - usage(appName); - return EXIT_FAILURE; - } - - if(!inputFile.empty() && !selectExpr.empty()) - { - cerr << appName << ": an input file cannot be specified with --select" << endl; - return EXIT_FAILURE; - } - - Slice::UnitPtr unit = Slice::Unit::createUnit(true, true, ice, underscore); - FreezeScript::Destroyer unitD(unit); - if(!FreezeScript::parseSlice(appName, unit, slice, cppArgs, debug, "-D__DUMPDB__")) - { - return EXIT_FAILURE; - } - - FreezeScript::createEvictorSliceTypes(unit); - - FreezeScript::collectCompactIds(unit, resolver); - - // - // If no input file was provided, then we need to generate default descriptors. - // - string descriptors; - if(inputFile.empty()) - { - const string evictorKeyTypeName = "::Ice::Identity"; - const string oldEvictorValueTypeName = "::Freeze::ObjectRecord"; - const string newEvictorValueTypeName = "Object"; - - if((!keyTypeName.empty() && valueTypeName.empty()) || (keyTypeName.empty() && !valueTypeName.empty() && !evictor)) - { - cerr << appName << ": a key type and a value type must be specified" << endl; - usage(appName); - return EXIT_FAILURE; - } - else if(valueTypeName.empty()) - { - try - { - FreezeScript::CatalogDataMap catalog = FreezeScript::readCatalog(communicator, dbEnvName); - FreezeScript::CatalogDataMap::iterator p = catalog.find(dbName); - if(p == catalog.end()) - { - cerr << appName << ": database `" << dbName << "' not found in catalog." << endl; - cerr << "Current catalog databases:" << endl; - for(p = catalog.begin(); p != catalog.end(); ++p) - { - cerr << " " << p->first << endl; - } - return EXIT_FAILURE; - } - else - { - if(p->second.evictor) - { - evictor = true; - } - keyTypeName = p->second.key; - valueTypeName = p->second.value; - - if(evictor && valueTypeName.empty()) - { - valueTypeName = oldEvictorValueTypeName; - } - } - } - catch(const FreezeScript::FailureException& ex) - { - cerr << appName << ": " << ex.reason() << endl; - return EXIT_FAILURE; - } - } - - if(evictor) - { - if(keyTypeName.empty()) - { - keyTypeName = evictorKeyTypeName; - } - if(valueTypeName.empty()) - { - valueTypeName = newEvictorValueTypeName; - } - } - - Slice::TypePtr keyType, valueType; - Slice::TypeList l; - - l = unit->lookupType(keyTypeName, false); - if(l.empty()) - { - cerr << appName << ": unknown key type `" << keyTypeName << "'" << endl; - return EXIT_FAILURE; - } - keyType = l.front(); - - l = unit->lookupType(valueTypeName, false); - if(l.empty()) - { - cerr << appName << ": unknown value type `" << valueTypeName << "'" << endl; - return EXIT_FAILURE; - } - valueType = l.front(); - - ostringstream os; - IceUtilInternal::XMLOutput out(os); - - out << se("dumpdb"); - - FreezeScript::SliceVisitor visitor(out, keyType, valueType, selectExpr); - unit->visit(&visitor, false); - - out << ee; - - descriptors = os.str(); - - if(!outputFile.empty()) - { - IceUtilInternal::ofstream of(outputFile); - if(!of.good()) - { - cerr << appName << ": unable to open file `" << outputFile << "'" << endl; - return EXIT_FAILURE; - } - of << descriptors << endl; - of.close(); - return EXIT_SUCCESS; - } - } - else - { - IceUtilInternal::ifstream in(inputFile); - char buff[1024]; - while(true) - { - in.read(buff, 1024); - descriptors.append(buff, static_cast(in.gcount())); - if(in.gcount() < 1024) - { - break; - } - } - in.close(); - } - FreezeScript::ObjectFactoryPtr objectFactory = new FreezeScript::ObjectFactory; - communicator->addObjectFactory(objectFactory, ""); - - DbEnv dbEnv(0); - DbTxn* txn = 0; - Freeze::ConnectionPtr connection; - int status = EXIT_SUCCESS; - try - { -#ifdef _WIN32 - // - // Berkeley DB may use a different C++ runtime. - // - dbEnv.set_alloc(::malloc, ::realloc, ::free); -#endif - - // - // Open the database environment and start a transaction. - // - { - u_int32_t flags = DB_THREAD | DB_CREATE | DB_INIT_TXN | DB_INIT_MPOOL; - dbEnv.open(dbEnvName.c_str(), flags, FREEZE_SCRIPT_DB_MODE); - } - - // - // We're creating a connection just to make sure the database environment - // isn't locked. - // - connection = Freeze::createConnection(communicator, dbEnvName, dbEnv); - - dbEnv.txn_begin(0, &txn, 0); - - FreezeScript::ErrorReporterPtr errorReporter = new FreezeScript::ErrorReporter(cerr, false); - try - { - FreezeScript::DataFactoryPtr factory = new FreezeScript::DataFactory(communicator, unit, errorReporter); - FreezeScript::DescriptorHandler dh(factory, unit, errorReporter, objectFactory); - - istringstream istr(descriptors); - IceXML::Parser::parse(istr, dh); - - FreezeScript::DumpDBDescriptorPtr descriptor = dh.descriptor(); - descriptor->validate(); - - if(evictor) - { - // - // The evictor database file contains multiple databases. We must first - // determine the names of those databases, ignoring any whose names - // begin with "$index:". Each database represents a separate facet, with - // the facet name used as the database name. The database named "$default" - // represents the main object. - // - vector dbNames; - { - Db db(&dbEnv, 0); - db.open(txn, dbName.c_str(), 0, DB_UNKNOWN, DB_RDONLY, 0); - Dbt dbKey, dbValue; - dbKey.set_flags(DB_DBT_MALLOC); - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - Dbc* dbc = 0; - db.cursor(txn, &dbc, 0); - - while(dbc->get(&dbKey, &dbValue, DB_NEXT) == 0) - { - string s(static_cast(dbKey.get_data()), dbKey.get_size()); - if(s.find("$index:") != 0) - { - dbNames.push_back(s); - } - free(dbKey.get_data()); - } - - dbc->close(); - db.close(0); - } - - // - // Dump each database. - // - for(vector::iterator p = dbNames.begin(); p != dbNames.end(); ++p) - { - string name = *p; - string facet = (name == "$default" ? string("") : name); - Db db(&dbEnv, 0); - db.open(txn, dbName.c_str(), name.c_str(), DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE); - descriptor->dump(communicator, &db, txn, facet); - db.close(0); - } - } - else - { - // - // Dump a map database. - // - Db db(&dbEnv, 0); - db.open(txn, dbName.c_str(), 0, DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE); - descriptor->dump(communicator, &db, txn, ""); - db.close(0); - } - } - catch(const IceXML::ParserException& ex) - { - errorReporter->error(ex.reason()); - } - } - catch(const DbException& ex) - { - cerr << appName << ": database error: " << ex.what() << endl; - status = EXIT_FAILURE; - } - catch(...) - { - try - { - if(txn) - { - txn->abort(); - } - dbEnv.close(0); - } - catch(const DbException& ex) - { - cerr << appName << ": database error: " << ex.what() << endl; - } - if(connection) - { - connection->close(); - connection = 0; - } - throw; - } - - try - { - if(txn) - { - txn->abort(); - } - if(connection) - { - connection->close(); - } - dbEnv.close(0); - } - catch(const DbException& ex) - { - cerr << appName << ": database error: " << ex.what() << endl; - status = EXIT_FAILURE; - } - - return status; -} - -#ifdef _WIN32 - -int -wmain(int argc, wchar_t* argv[]) - -#else - -int -main(int argc, char* argv[]) - -#endif -{ - Ice::StringSeq args = Ice::argsToStringSeq(argc, argv); - assert(args.size() > 0); - const string appName = args[0]; - - Ice::InitializationData initData; - FreezeScript::CompactIdResolverIPtr resolver = new FreezeScript::CompactIdResolverI; - initData.compactIdResolver = resolver; - - Ice::CommunicatorPtr communicator; - int status = EXIT_SUCCESS; - try - { - communicator = Ice::initialize(args, initData); - status = run(args, communicator, resolver); - } - catch(const FreezeScript::FailureException& ex) - { - string reason = ex.reason(); - cerr << appName << ": " << reason; - if(reason[reason.size() - 1] != '\n') - { - cerr << endl; - } - return EXIT_FAILURE; - } - catch(const std::exception& ex) - { - cerr << appName << ": " << ex.what() << endl; - status = EXIT_FAILURE; - } - catch(...) - { - cerr << appName << ": unknown error" << endl; - return EXIT_FAILURE; - } - - if(communicator) - { - communicator->destroy(); - } - - return status; -} - -// -// SliceVisitor -// -FreezeScript::SliceVisitor::SliceVisitor(IceUtilInternal::XMLOutput& out, const Slice::TypePtr& keyType, - const Slice::TypePtr& valueType, const string& selectExpr) : - _out(out) -{ - out << se("database") << attr("key", typeToString(keyType)) << attr("value", typeToString(valueType)); - out << se("record"); - if(!selectExpr.empty()) - { - out << se("if") << attr("test", selectExpr); - out << se("echo") << attr("message", "Key: ") << attr("value", "key") << ee; - out << se("echo") << attr("message", "Value: ") << attr("value", "value") << ee; - out << ee; - } - else - { - out << se("echo") << attr("message", "Key: ") << attr("value", "key") << ee; - out << se("echo") << attr("message", "Value: ") << attr("value", "value") << ee; - } - out << ee; - out << ee; -} - -bool -FreezeScript::SliceVisitor::visitClassDefStart(const Slice::ClassDefPtr& v) -{ - if(v->isInterface() || v->isLocal()) - { - return false; - } - - string scoped = v->scoped(); - if(ignoreType(scoped)) - { - return false; - } - - _out.newline(); - _out.newline(); - _out << ""; - _out << se("dump") << attr("type", scoped) << ee; - - return false; -} - -bool -FreezeScript::SliceVisitor::visitStructStart(const Slice::StructPtr& v) -{ - if(v->isLocal()) - { - return false; - } - - string scoped = v->scoped(); - if(ignoreType(scoped)) - { - return false; - } - - _out.newline(); - _out.newline(); - _out << ""; - _out << se("dump") << attr("type", scoped) << ee; - - return false; -} - -void -FreezeScript::SliceVisitor::visitSequence(const Slice::SequencePtr& v) -{ - if(v->isLocal()) - { - return; - } - - string scoped = v->scoped(); - if(ignoreType(scoped)) - { - return; - } - - _out.newline(); - _out.newline(); - _out << ""; - _out << se("dump") << attr("type", scoped) << ee; -} - -void -FreezeScript::SliceVisitor::visitDictionary(const Slice::DictionaryPtr& v) -{ - if(v->isLocal()) - { - return; - } - - string scoped = v->scoped(); - if(ignoreType(scoped)) - { - return; - } - - _out.newline(); - _out.newline(); - _out << ""; - _out << se("dump") << attr("type", scoped) << ee; -} - -void -FreezeScript::SliceVisitor::visitEnum(const Slice::EnumPtr& v) -{ - if(v->isLocal()) - { - return; - } - - string scoped = v->scoped(); - if(ignoreType(scoped)) - { - return; - } - - _out.newline(); - _out.newline(); - _out << ""; - _out << se("dump") << attr("type", scoped) << ee; -} - -// -// DescriptorHandler -// -FreezeScript::DescriptorHandler::DescriptorHandler(const DataFactoryPtr& factory, const Slice::UnitPtr& unit, - const ErrorReporterPtr& errorReporter, - const FreezeScript::ObjectFactoryPtr& objectFactory) : - _factory(factory), _unit(unit), _errorReporter(errorReporter), _objectFactory(objectFactory) -{ -} - -void -FreezeScript::DescriptorHandler::startElement(const string& name, const IceXML::Attributes& attributes, int line, - int /*column*/) -{ - DescriptorPtr d; - - if(name == "dumpdb") - { - if(_current) - { - _errorReporter->descriptorError(" must be the top-level element", line); - } - - _descriptor = new DumpDBDescriptor(line, _factory, _errorReporter, attributes, _unit); - d = _descriptor; - } - else if(name == "database") - { - if(!_current) - { - _errorReporter->descriptorError(" must be a child of ", line); - } - - d = new DatabaseDescriptor(_current, line, _factory, _errorReporter, attributes, _unit); - } - else if(name == "record") - { - if(!_current) - { - _errorReporter->descriptorError(" must be a child of ", line); - } - - d = new RecordDescriptor(_current, line, _factory, _errorReporter, attributes, _unit, _objectFactory); - } - else if(name == "dump") - { - if(!_current) - { - _errorReporter->descriptorError(" must be a child of ", line); - } - - d = new DumpDescriptor(_current, line, _factory, _errorReporter, attributes, _unit); - } - else if(name == "set") - { - if(!_current) - { - _errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new SetDescriptor(_current, line, _factory, _errorReporter, attributes); - } - else if(name == "define") - { - if(!_current) - { - _errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new DefineDescriptor(_current, line, _factory, _errorReporter, attributes, _unit); - } - else if(name == "add") - { - if(!_current) - { - _errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new AddDescriptor(_current, line, _factory, _errorReporter, attributes); - } - else if(name == "remove") - { - if(!_current) - { - _errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new RemoveDescriptor(_current, line, _factory, _errorReporter, attributes); - } - else if(name == "fail") - { - if(!_current) - { - _errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new FailDescriptor(_current, line, _factory, _errorReporter, attributes); - } - else if(name == "echo") - { - if(!_current) - { - _errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new EchoDescriptor(_current, line, _factory, _errorReporter, attributes, cout); - } - else if(name == "if") - { - if(!_current) - { - _errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new IfDescriptor(_current, line, _factory, _errorReporter, attributes); - } - else if(name == "iterate") - { - if(!_current) - { - _errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new IterateDescriptor(_current, line, _factory, _errorReporter, attributes); - } - else - { - _errorReporter->descriptorError("unknown descriptor `" + name + "'", line); - } - - if(_current) - { - _current->addChild(d); - } - _current = d; -} - -void -FreezeScript::DescriptorHandler::endElement(const std::string&, int, int) -{ - assert(_current); - _current = _current->parent(); -} - -void -FreezeScript::DescriptorHandler::characters(const std::string&, int, int) -{ -} - -void -FreezeScript::DescriptorHandler::error(const std::string& msg, int line, int) -{ - _errorReporter->descriptorError(msg, line); -} - -FreezeScript::DumpDBDescriptorPtr -FreezeScript::DescriptorHandler::descriptor() const -{ - return _descriptor; -} diff --git a/cpp/src/FreezeScript/DumpDB.rc b/cpp/src/FreezeScript/DumpDB.rc deleted file mode 100644 index 8167af81e58..00000000000 --- a/cpp/src/FreezeScript/DumpDB.rc +++ /dev/null @@ -1,34 +0,0 @@ -#include "winver.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,7,0,0 - PRODUCTVERSION 3,7,0,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE VFT_APP - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "ZeroC, Inc.\0" - VALUE "FileDescription", "Dump Freeze Database\0" - VALUE "FileVersion", "3.7.0\0" - VALUE "InternalName", "dumpdb\0" - VALUE "LegalCopyright", "\251 2003-2015 ZeroC, Inc.\0" - VALUE "OriginalFilename", "dumpdb.exe\0" - VALUE "ProductName", "Ice\0" - VALUE "ProductVersion", "3.7.0\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END diff --git a/cpp/src/FreezeScript/DumpDescriptors.cpp b/cpp/src/FreezeScript/DumpDescriptors.cpp deleted file mode 100644 index cdf5a204ff4..00000000000 --- a/cpp/src/FreezeScript/DumpDescriptors.cpp +++ /dev/null @@ -1,1953 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -namespace FreezeScript -{ - -class SymbolTableI; -typedef IceUtil::Handle SymbolTableIPtr; - -class SymbolTableI : public SymbolTable -{ -public: - - SymbolTableI(const DataFactoryPtr&, const Slice::UnitPtr&, const ErrorReporterPtr&, ExecuteInfo*, - const SymbolTablePtr& = SymbolTablePtr()); - - virtual void add(const string&, const DataPtr&); - - virtual DataPtr getValue(const EntityNodePtr&) const; - - virtual DataPtr getConstantValue(const string&) const; - - virtual SymbolTablePtr createChild(); - - virtual Slice::TypePtr lookupType(const string&); - - virtual DataPtr invokeFunction(const string&, const DataPtr&, const DataList&); - -private: - - DataPtr findValue(const string&) const; - - class EntityVisitor : public EntityNodeVisitor - { - public: - - EntityVisitor(SymbolTableI*); - - virtual void visitIdentifier(const string&); - virtual void visitElement(const NodePtr&); - - DataPtr getCurrent() const; - - private: - - SymbolTableI* _table; - DataPtr _current; - bool _error; - }; - - friend class EntityVisitor; - - DataFactoryPtr _factory; - Slice::UnitPtr _unit; - ErrorReporterPtr _errorReporter; - ExecuteInfo* _info; - SymbolTablePtr _parent; - typedef map DataMap; - DataMap _dataMap; - DataMap _constantCache; -}; - -typedef map DumpMap; - -struct ExecuteInfo -{ - Ice::CommunicatorPtr communicator; - Db* db; - DbTxn* txn; - string facet; - SymbolTablePtr symbolTable; - DumpMap dumpMap; - Slice::TypePtr keyType; - Slice::TypePtr valueType; -}; - -class DumpVisitor : public DataVisitor -{ -public: - - DumpVisitor(const DataFactoryPtr&, const Slice::UnitPtr&, const ErrorReporterPtr&, ExecuteInfo*); - - virtual void visitBoolean(const BooleanDataPtr&); - virtual void visitInteger(const IntegerDataPtr&); - virtual void visitDouble(const DoubleDataPtr&); - virtual void visitString(const StringDataPtr&); - virtual void visitProxy(const ProxyDataPtr&); - virtual void visitStruct(const StructDataPtr&); - virtual void visitSequence(const SequenceDataPtr&); - virtual void visitEnum(const EnumDataPtr&); - virtual void visitDictionary(const DictionaryDataPtr&); - virtual void visitObject(const ObjectRefPtr&); - -private: - - // - // Returns true if the contents of the data should be visited. - // - bool dump(const DataPtr&); - - DataFactoryPtr _factory; - Slice::UnitPtr _unit; - ErrorReporterPtr _errorReporter; - ExecuteInfo* _info; - set _objectHistory; -}; - -} // End of namespace FreezeScript - -// -// Descriptor -// -FreezeScript::Descriptor::Descriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter) : - _parent(parent), _line(line), _factory(factory), _errorReporter(errorReporter) -{ -} - -FreezeScript::Descriptor::~Descriptor() -{ -} - -FreezeScript::DescriptorPtr -FreezeScript::Descriptor::parent() const -{ - return _parent; -} - -FreezeScript::NodePtr -FreezeScript::Descriptor::parse(const string& expr) const -{ - return parseExpression(expr, _factory, _errorReporter); -} - -Slice::TypePtr -FreezeScript::Descriptor::findType(const Slice::UnitPtr& u, const string& type) -{ - Slice::TypeList l; - - l = u->lookupType(type, false); - if(l.empty()) - { - _errorReporter->error("unknown type `" + type + "'"); - } - - return l.front(); -} - -// -// SetDescriptor -// -FreezeScript::SetDescriptor::SetDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter, - const IceXML::Attributes& attributes) : - Descriptor(parent, line, factory, errorReporter) -{ - DescriptorErrorContext ctx(_errorReporter, "set", _line); - - IceXML::Attributes::const_iterator p; - - p = attributes.find("target"); - if(p == attributes.end()) - { - _errorReporter->error("required attribute `target' is missing"); - } - NodePtr node = parse(p->second); - _target = EntityNodePtr::dynamicCast(node); - if(!_target) - { - _errorReporter->error("`target' attribute is not an entity: `" + p->second + "'"); - } - - p = attributes.find("value"); - if(p != attributes.end()) - { - _valueStr = p->second; - } - - p = attributes.find("length"); - if(p != attributes.end()) - { - _lengthStr = p->second; - } - - p = attributes.find("convert"); - if(p != attributes.end()) - { - _convert = p->second == "true"; - } - - if(_valueStr.empty() && _lengthStr.empty()) - { - _errorReporter->error("requires a value for attributes `value' or 'length'"); - } - - if(!_valueStr.empty()) - { - _value = parse(_valueStr); - } - - if(!_lengthStr.empty()) - { - _length = parse(_lengthStr); - } -} - -void -FreezeScript::SetDescriptor::addChild(const DescriptorPtr&) -{ - DescriptorErrorContext ctx(_errorReporter, "set", _line); - _errorReporter->error("child elements are not supported"); -} - -void -FreezeScript::SetDescriptor::validate() -{ -} - -void -FreezeScript::SetDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo*) -{ - DescriptorErrorContext ctx(_errorReporter, "set", _line); - - DataPtr data = sym->getValue(_target); - if(data->readOnly()) - { - ostringstream ostr; - ostr << _target; - _errorReporter->error("target `" + ostr.str() + "' cannot be modified"); - } - - DataPtr value; - if(_value) - { - try - { - value = _value->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); - } - } - - DataPtr length; - if(_length) - { - SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); - if(!seq) - { - ostringstream ostr; - ostr << _target; - _errorReporter->error("value `" + ostr.str() + "' is not a sequence"); - } - - try - { - length = _length->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _errorReporter->error("evaluation of length `" + _lengthStr + "' failed:\n" + ex.reason()); - } - - DataList& elements = seq->getElements(); - Ice::Long l = length->integerValue(); - if(l < 0 || l > INT_MAX) - { - _errorReporter->error("sequence length " + length->toString() + " is out of range"); - } - - DataList::size_type len = static_cast(l); - if(len < elements.size()) - { - for(DataList::size_type i = len; i < elements.size(); ++i) - { - elements[i]->destroy(); - } - elements.resize(len); - } - else if(len > elements.size()) - { - Slice::SequencePtr seqType = Slice::SequencePtr::dynamicCast(seq->getType()); - assert(seqType); - Slice::TypePtr elemType = seqType->type(); - for(DataList::size_type i = elements.size(); i < len; ++i) - { - DataPtr v = _factory->create(elemType, false); - if(value) - { - AssignVisitor visitor(value, _factory, _errorReporter, _convert); - v->visit(visitor); - } - elements.push_back(v); - } - } - } - else - { - AssignVisitor visitor(value, _factory, _errorReporter, _convert); - data->visit(visitor); - } -} - -// -// DefineDescriptor -// -FreezeScript::DefineDescriptor::DefineDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter, - const IceXML::Attributes& attributes, const Slice::UnitPtr& unit) : - Descriptor(parent, line, factory, errorReporter) -{ - DescriptorErrorContext ctx(_errorReporter, "define", _line); - - IceXML::Attributes::const_iterator p; - - p = attributes.find("name"); - if(p == attributes.end()) - { - _errorReporter->error("required attribute `name' is missing"); - } - _name = p->second; - - p = attributes.find("type"); - if(p == attributes.end()) - { - _errorReporter->error("required attribute `type' is missing"); - } - _type = findType(unit, p->second); - - p = attributes.find("value"); - if(p != attributes.end()) - { - _valueStr = p->second; - } - - p = attributes.find("convert"); - if(p != attributes.end()) - { - _convert = p->second == "true"; - } - - if(!_valueStr.empty()) - { - _value = parse(_valueStr); - } -} - -void -FreezeScript::DefineDescriptor::addChild(const DescriptorPtr&) -{ - DescriptorErrorContext ctx(_errorReporter, "define", _line); - _errorReporter->error("child elements are not supported"); -} - -void -FreezeScript::DefineDescriptor::validate() -{ -} - -void -FreezeScript::DefineDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo*) -{ - DescriptorErrorContext ctx(_errorReporter, "define", _line); - - DataPtr data = _factory->create(_type, false); - - DataPtr value; - if(_value) - { - try - { - value = _value->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); - } - } - - if(value) - { - AssignVisitor visitor(value, _factory, _errorReporter, _convert); - data->visit(visitor); - } - - sym->add(_name, data); -} - -// -// AddDescriptor -// -FreezeScript::AddDescriptor::AddDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter, - const IceXML::Attributes& attributes) : - Descriptor(parent, line, factory, errorReporter) -{ - DescriptorErrorContext ctx(_errorReporter, "add", _line); - - IceXML::Attributes::const_iterator p; - - string target; - p = attributes.find("target"); - if(p == attributes.end()) - { - _errorReporter->error("required attribute `target' is missing"); - } - target = p->second; - - p = attributes.find("key"); - if(p != attributes.end()) - { - _keyStr = p->second; - } - - p = attributes.find("index"); - if(p != attributes.end()) - { - _indexStr = p->second; - } - - p = attributes.find("value"); - if(p != attributes.end()) - { - _valueStr = p->second; - } - - p = attributes.find("convert"); - if(p != attributes.end()) - { - _convert = p->second == "true"; - } - - NodePtr node = parse(target); - _target = EntityNodePtr::dynamicCast(node); - if(!_target) - { - _errorReporter->error("`target' attribute is not an entity: `" + target + "'"); - } - - if(!_keyStr.empty() && !_indexStr.empty()) - { - _errorReporter->error("attributes `key' and `index' are mutually exclusive"); - } - - if(_keyStr.empty() && _indexStr.empty()) - { - _errorReporter->error("one of attributes `key' or `index' is required"); - } - - if(!_keyStr.empty()) - { - _key = parse(_keyStr); - } - - if(!_indexStr.empty()) - { - _index = parse(_indexStr); - } - - if(!_valueStr.empty()) - { - _value = parse(_valueStr); - } -} - -void -FreezeScript::AddDescriptor::addChild(const DescriptorPtr&) -{ - DescriptorErrorContext ctx(_errorReporter, "add", _line); - _errorReporter->error("child elements are not supported"); -} - -void -FreezeScript::AddDescriptor::validate() -{ -} - -void -FreezeScript::AddDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo*) -{ - DescriptorErrorContext ctx(_errorReporter, "add", _line); - - DataPtr data = sym->getValue(_target); - if(data->readOnly()) - { - ostringstream ostr; - ostr << _target; - _errorReporter->error("target `" + ostr.str() + "' cannot be modified"); - } - - if(_key) - { - DictionaryDataPtr dict = DictionaryDataPtr::dynamicCast(data); - if(!dict) - { - ostringstream ostr; - ostr << _target; - _errorReporter->error("target `" + ostr.str() + "' is not a dictionary"); - } - - Slice::DictionaryPtr type = Slice::DictionaryPtr::dynamicCast(dict->getType()); - assert(type); - - DataPtr key; - Destroyer keyDestroyer; - try - { - DataPtr v = _key->evaluate(sym); - key = _factory->create(type->keyType(), false); - keyDestroyer.set(key); - AssignVisitor visitor(v, _factory, _errorReporter, _convert); - key->visit(visitor); - } - catch(const EvaluateException& ex) - { - _errorReporter->error("evaluation of key `" + _keyStr + "' failed:\n" + ex.reason()); - } - - if(dict->getElement(key)) - { - ostringstream ostr; - printData(key, ostr); - _errorReporter->error("key " + ostr.str() + " already exists in dictionary"); - } - - DataPtr elem = _factory->create(type->valueType(), false); - Destroyer elemDestroyer(elem); - - DataPtr value; - if(_value) - { - try - { - value = _value->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); - } - } - - if(value) - { - AssignVisitor visitor(value, _factory, _errorReporter, _convert); - elem->visit(visitor); - } - DataMap& map = dict->getElements(); - map.insert(DataMap::value_type(key, elem)); - keyDestroyer.release(); - elemDestroyer.release(); - } - else - { - assert(_index); - - SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); - if(!seq) - { - ostringstream ostr; - ostr << _target; - _errorReporter->error("target `" + ostr.str() + "' is not a sequence"); - } - - Slice::SequencePtr type = Slice::SequencePtr::dynamicCast(seq->getType()); - assert(type); - - DataPtr index; - Destroyer indexDestroyer; - try - { - index = _index->evaluate(sym); - indexDestroyer.set(index); - } - catch(const EvaluateException& ex) - { - _errorReporter->error("evaluation of index `" + _indexStr + "' failed:\n" + ex.reason()); - } - - DataList& elements = seq->getElements(); - Ice::Long l = index->integerValue(); - DataList::size_type i = static_cast(l); - if(l < 0 || l > INT_MAX || i > elements.size()) - { - _errorReporter->error("sequence index " + index->toString() + " is out of range"); - } - - DataPtr elem = _factory->create(type->type(), false); - Destroyer elemDestroyer(elem); - - DataPtr value; - if(_value) - { - try - { - value = _value->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); - } - } - - if(value) - { - AssignVisitor visitor(value, _factory, _errorReporter, _convert); - elem->visit(visitor); - } - - elements.insert(elements.begin() + i, elem); - indexDestroyer.release(); - elemDestroyer.release(); - } -} - -// -// RemoveDescriptor -// -FreezeScript::RemoveDescriptor::RemoveDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter, - const IceXML::Attributes& attributes) : - Descriptor(parent, line, factory, errorReporter) -{ - DescriptorErrorContext ctx(_errorReporter, "remove", _line); - - IceXML::Attributes::const_iterator p; - - string target; - p = attributes.find("target"); - if(p == attributes.end()) - { - _errorReporter->error("required attribute `target' is missing"); - } - target = p->second; - - p = attributes.find("key"); - if(p != attributes.end()) - { - _keyStr = p->second; - } - - p = attributes.find("index"); - if(p != attributes.end()) - { - _indexStr = p->second; - } - - if(!_keyStr.empty() && !_indexStr.empty()) - { - _errorReporter->error("attributes `key' and `index' are mutually exclusive"); - } - - if(_keyStr.empty() && _indexStr.empty()) - { - _errorReporter->error("one of attributes `key' or `index' is required"); - } - - NodePtr node = parse(target); - _target = EntityNodePtr::dynamicCast(node); - if(!_target) - { - _errorReporter->error("`target' attribute is not an entity: `" + target + "'"); - } - - if(!_keyStr.empty()) - { - _key = parse(_keyStr); - } - - if(!_indexStr.empty()) - { - _index = parse(_indexStr); - } -} - -void -FreezeScript::RemoveDescriptor::addChild(const DescriptorPtr&) -{ - DescriptorErrorContext ctx(_errorReporter, "remove", _line); - _errorReporter->error("child elements are not supported"); -} - -void -FreezeScript::RemoveDescriptor::validate() -{ -} - -void -FreezeScript::RemoveDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo*) -{ - DescriptorErrorContext ctx(_errorReporter, "remove", _line); - - DataPtr data = sym->getValue(_target); - if(data->readOnly()) - { - ostringstream ostr; - ostr << _target; - _errorReporter->error("target `" + ostr.str() + "' cannot be modified"); - } - - if(_key) - { - DataPtr key; - try - { - key = _key->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _errorReporter->error("evaluation of key `" + _keyStr + "' failed:\n" + ex.reason()); - } - - DictionaryDataPtr dict = DictionaryDataPtr::dynamicCast(data); - if(!dict) - { - ostringstream ostr; - ostr << _target; - _errorReporter->error("target `" + ostr.str() + "' is not a dictionary"); - } - - DataMap& map = dict->getElements(); - DataMap::iterator p = map.find(key); - if(p != map.end()) - { - p->first->destroy(); - p->second->destroy(); - map.erase(p); - } - } - else - { - assert(_index); - - DataPtr index; - try - { - index = _index->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _errorReporter->error("evaluation of index `" + _indexStr + "' failed:\n" + ex.reason()); - } - - SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); - if(!seq) - { - ostringstream ostr; - ostr << _target; - _errorReporter->error("target `" + ostr.str() + "' is not a sequence"); - } - - DataList& elements = seq->getElements(); - Ice::Long l = index->integerValue(); - DataList::size_type i = static_cast(l); - if(l < 0 || l > INT_MAX || i >= elements.size()) - { - _errorReporter->error("sequence index " + index->toString() + " is out of range"); - } - - elements[i]->destroy(); - elements.erase(elements.begin() + i); - } -} - -// -// FailDescriptor -// -FreezeScript::FailDescriptor::FailDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter, - const IceXML::Attributes& attributes) : - Descriptor(parent, line, factory, errorReporter) -{ - IceXML::Attributes::const_iterator p; - - p = attributes.find("test"); - if(p != attributes.end()) - { - _testStr = p->second; - } - - p = attributes.find("message"); - if(p != attributes.end()) - { - _message = p->second; - } - - if(!_testStr.empty()) - { - _test = parse(_testStr); - } - - if(_message.empty()) - { - ostringstream ostr; - ostr << " executed at line " << line << endl; - _message = ostr.str(); - } -} - -void -FreezeScript::FailDescriptor::addChild(const DescriptorPtr&) -{ - DescriptorErrorContext ctx(_errorReporter, "fail", _line); - _errorReporter->error("child elements are not supported"); -} - -void -FreezeScript::FailDescriptor::validate() -{ -} - -void -FreezeScript::FailDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo*) -{ - DescriptorErrorContext ctx(_errorReporter, "fail", _line); - - if(_test) - { - try - { - DataPtr b = _test->evaluate(sym); - BooleanDataPtr bd = BooleanDataPtr::dynamicCast(b); - if(!bd) - { - _errorReporter->error("expression `" + _testStr + "' does not evaluate to a boolean"); - } - if(!bd->booleanValue()) - { - return; - } - } - catch(const EvaluateException& ex) - { - _errorReporter->error("evaluation of expression `" + _testStr + "' failed:\n" + ex.reason()); - } - } - - throw FailureException(__FILE__, __LINE__, _message); -} - -// -// EchoDescriptor -// -FreezeScript::EchoDescriptor::EchoDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter, - const IceXML::Attributes& attributes, - ostream& os) : - Descriptor(parent, line, factory, errorReporter), _os(os) -{ - IceXML::Attributes::const_iterator p; - - p = attributes.find("message"); - if(p != attributes.end()) - { - _message = p->second; - } - - p = attributes.find("value"); - if(p != attributes.end()) - { - _valueStr = p->second; - } - - if(!_valueStr.empty()) - { - _value = parse(_valueStr); - } -} - -void -FreezeScript::EchoDescriptor::addChild(const DescriptorPtr&) -{ - DescriptorErrorContext ctx(_errorReporter, "echo", _line); - _errorReporter->error("child elements are not supported"); -} - -void -FreezeScript::EchoDescriptor::validate() -{ -} - -void -FreezeScript::EchoDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo*) -{ - DescriptorErrorContext ctx(_errorReporter, "echo", _line); - - if(!_message.empty()) - { - _os << _message; - } - - if(_value) - { - DataPtr v; - try - { - v = _value->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); - } - printData(v, _os); - } - - _os << endl; -} - -// -// ExecutableContainerDescriptor -// -FreezeScript::ExecutableContainerDescriptor::ExecutableContainerDescriptor(const DescriptorPtr& parent, int line, - const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter, - const IceXML::Attributes&, - const string& name) : - Descriptor(parent, line, factory, errorReporter), _name(name) -{ -} - -void -FreezeScript::ExecutableContainerDescriptor::addChild(const DescriptorPtr& child) -{ - _children.push_back(child); -} - -void -FreezeScript::ExecutableContainerDescriptor::validate() -{ - for(vector::iterator p = _children.begin(); p != _children.end(); ++p) - { - (*p)->validate(); - } -} - -void -FreezeScript::ExecutableContainerDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo* info) -{ - for(vector::iterator p = _children.begin(); p != _children.end(); ++p) - { - (*p)->execute(sym, info); - } -} - -// -// IfDescriptor -// -FreezeScript::IfDescriptor::IfDescriptor(const DescriptorPtr& parent, int line, const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter, - const IceXML::Attributes& attributes) : - Descriptor(parent, line, factory, errorReporter), - ExecutableContainerDescriptor(parent, line, factory, errorReporter, attributes, "if") - -{ - DescriptorErrorContext ctx(_errorReporter, "if", _line); - - IceXML::Attributes::const_iterator p = attributes.find("test"); - if(p == attributes.end()) - { - _errorReporter->error("required attribute `test' is missing"); - } - _testStr = p->second; - - _test = parse(_testStr); -} - -void -FreezeScript::IfDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo* info) -{ - DescriptorErrorContext ctx(_errorReporter, "if", _line); - - try - { - DataPtr b = _test->evaluate(sym); - BooleanDataPtr bd = BooleanDataPtr::dynamicCast(b); - if(!bd) - { - _errorReporter->error("expression `" + _testStr + "' does not evaluate to a boolean"); - } - if(bd->booleanValue()) - { - ExecutableContainerDescriptor::execute(sym, info); - } - } - catch(const EvaluateException& ex) - { - _errorReporter->error("evaluation of conditional expression `" + _testStr + "' failed:\n" + ex.reason()); - } -} - -// -// IterateDescriptor -// -FreezeScript::IterateDescriptor::IterateDescriptor(const DescriptorPtr& parent, int line, - const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter, - const IceXML::Attributes& attributes) : - Descriptor(parent, line, factory, errorReporter), - ExecutableContainerDescriptor(parent, line, factory, errorReporter, attributes, "iterate") - -{ - DescriptorErrorContext ctx(_errorReporter, "iterate", _line); - - IceXML::Attributes::const_iterator p; - string target; - - p = attributes.find("target"); - if(p == attributes.end()) - { - _errorReporter->error("required attribute `target' is missing"); - } - target = p->second; - - p = attributes.find("key"); - if(p != attributes.end()) - { - _key = p->second; - } - - p = attributes.find("value"); - if(p != attributes.end()) - { - _value = p->second; - } - - p = attributes.find("element"); - if(p != attributes.end()) - { - _element = p->second; - } - - p = attributes.find("index"); - if(p != attributes.end()) - { - _index = p->second; - } - - NodePtr node = parse(target); - _target = EntityNodePtr::dynamicCast(node); - if(!_target) - { - _errorReporter->error("`target' attribute is not an entity: `" + target + "'"); - } -} - -void -FreezeScript::IterateDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo* info) -{ - DescriptorErrorContext ctx(_errorReporter, "iterate", _line); - - DataPtr data = sym->getValue(_target); - - DictionaryDataPtr dict = DictionaryDataPtr::dynamicCast(data); - SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); - if(!dict && !seq) - { - ostringstream ostr; - ostr << _target; - _errorReporter->error("target `" + ostr.str() + "' is not a dictionary or sequence"); - } - - if(dict) - { - if(!_element.empty()) - { - _errorReporter->error("attribute `element' specified for dictionary target"); - } - if(!_index.empty()) - { - _errorReporter->error("attribute `index' specified for dictionary target"); - } - - string key = _key; - if(key.empty()) - { - key = "key"; - } - - string value = _value; - if(value.empty()) - { - value = "value"; - } - - DataMap& map = dict->getElements(); - for(DataMap::iterator p = map.begin(); p != map.end(); ++p) - { - SymbolTablePtr elemSym = sym->createChild(); - elemSym->add(key, p->first); - elemSym->add(value, p->second); - ExecutableContainerDescriptor::execute(elemSym, info); - } - } - else - { - if(!_key.empty()) - { - _errorReporter->error("attribute `key' specified for sequence target"); - } - if(!_value.empty()) - { - _errorReporter->error("attribute `value' specified for sequence target"); - } - - string element = _element; - if(element.empty()) - { - element = "elem"; - } - - string index = _index; - if(index.empty()) - { - index = "i"; - } - - // - // NOTE: Don't use iterator to traverse vector because child descriptors might remove elements. - // - DataList& l = seq->getElements(); - DataList::size_type i = 0; - while(i < l.size()) - { - SymbolTablePtr elemSym = sym->createChild(); - elemSym->add(element, l[i]); - elemSym->add(index, _factory->createInteger(i, true)); - ExecutableContainerDescriptor::execute(elemSym, info); - ++i; - } - } -} - -// -// DumpDescriptor -// -FreezeScript::DumpDescriptor::DumpDescriptor(const DescriptorPtr& parent, int line, - const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter, - const IceXML::Attributes& attributes, - const Slice::UnitPtr& unit) : - Descriptor(parent, line, factory, errorReporter), - ExecutableContainerDescriptor(parent, line, factory, errorReporter, attributes, "dump"), - _base(true), - _contents(true) -{ - DescriptorErrorContext ctx(_errorReporter, "dump", _line); - - for(IceXML::Attributes::const_iterator p = attributes.begin(); p != attributes.end(); ++p) - { - if(p->first == "type") - { - if(_type) - { - _errorReporter->error("duplicate attribute `type'"); - } - _type = findType(unit, p->second); - } - else if(p->first == "base") - { - if(p->second == "false") - { - _base = false; - } - else if(p->second != "true") - { - _errorReporter->error("invalid value `" + p->second + "' for attribute `base'"); - } - } - else if(p->first == "contents") - { - if(p->second == "false") - { - _contents = false; - } - else if(p->second != "true") - { - _errorReporter->error("invalid value `" + p->second + "' for attribute `contents'"); - } - } - else - { - _errorReporter->error("unknown attribute `" + p->first + "'"); - } - } - - if(!_type) - { - _errorReporter->error("required attribute `type' is missing"); - } -} - -Slice::TypePtr -FreezeScript::DumpDescriptor::type() const -{ - return _type; -} - -string -FreezeScript::DumpDescriptor::typeName() const -{ - return typeToString(_type); -} - -bool -FreezeScript::DumpDescriptor::base() const -{ - return _base; -} - -bool -FreezeScript::DumpDescriptor::contents() const -{ - return _contents; -} - -// -// RecordDescriptor -// -FreezeScript::RecordDescriptor::RecordDescriptor(const DescriptorPtr& parent, int line, - const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter, - const IceXML::Attributes& attributes, - const Slice::UnitPtr& unit, - const FreezeScript::ObjectFactoryPtr& objectFactory) : - Descriptor(parent, line, factory, errorReporter), - ExecutableContainerDescriptor(parent, line, factory, errorReporter, attributes, "record"), - _unit(unit), - _objectFactory(objectFactory) -{ -} - -void -FreezeScript::RecordDescriptor::execute(const SymbolTablePtr& /*sym*/, ExecuteInfo* info) -{ - // - // Temporarily add an object factory. - // - _objectFactory->activate(_factory, _unit); - - // - // Iterate over the database. - // - Dbc* dbc = 0; - info->db->cursor(info->txn, &dbc, 0); - try - { - Dbt dbKey, dbValue; - while(dbc->get(&dbKey, &dbValue, DB_NEXT) == 0) - { - Ice::ByteSeq keyBytes; - keyBytes.resize(dbKey.get_size()); - memcpy(&keyBytes[0], dbKey.get_data(), dbKey.get_size()); - Ice::InputStreamPtr inKey = Ice::wrapInputStream(info->communicator, keyBytes); - - Ice::ByteSeq valueBytes; - valueBytes.resize(dbValue.get_size()); - memcpy(&valueBytes[0], dbValue.get_data(), dbValue.get_size()); - Ice::InputStreamPtr inValue = Ice::wrapInputStream(info->communicator, valueBytes); - inValue->startEncapsulation(); - - // - // Create data representations of the key and value types. - // - DataPtr keyData = _factory->create(info->keyType, true); - Destroyer keyDataDestroyer(keyData); - DataPtr valueData = _factory->create(info->valueType, true); - Destroyer valueDataDestroyer(valueData); - DataPtr facetData = _factory->createString(info->facet, true); - Destroyer facetDataDestroyer(facetData); - - // - // Unmarshal the key and value. - // - keyData->unmarshal(inKey); - valueData->unmarshal(inValue); - if(info->valueType->usesClasses()) - { - inValue->readPendingObjects(); - } - - // - // Visit the key and value. - // - DumpVisitor visitor(_factory, _unit, _errorReporter, info); - keyData->visit(visitor); - valueData->visit(visitor); - - if(!_children.empty()) - { - // - // Execute the child descriptors. - // - SymbolTablePtr st = new SymbolTableI(_factory, _unit, _errorReporter, info, info->symbolTable); - st->add("key", keyData); - st->add("value", valueData); - st->add("facet", facetData); - ExecutableContainerDescriptor::execute(st, info); - } - } - } - catch(...) - { - if(dbc) - { - dbc->close(); - } - _objectFactory->deactivate(); - throw; - } - - if(dbc) - { - dbc->close(); - } - _objectFactory->deactivate(); -} - -// -// DatabaseDescriptor -// -FreezeScript::DatabaseDescriptor::DatabaseDescriptor(const DescriptorPtr& parent, int line, - const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter, - const IceXML::Attributes& attributes, - const Slice::UnitPtr& unit) : - Descriptor(parent, line, factory, errorReporter), - ExecutableContainerDescriptor(parent, line, factory, errorReporter, attributes, "database"), - _unit(unit) -{ - DescriptorErrorContext ctx(_errorReporter, "database", _line); - - IceXML::Attributes::const_iterator p = attributes.find("key"); - if(p == attributes.end()) - { - _errorReporter->error("required attribute `key' is missing"); - } - _key = findType(unit, p->second); - - p = attributes.find("value"); - if(p == attributes.end()) - { - _errorReporter->error("required attribute `value' is missing"); - } - _value = findType(unit, p->second); -} - -void -FreezeScript::DatabaseDescriptor::addChild(const DescriptorPtr& child) -{ - DescriptorErrorContext ctx(_errorReporter, "database", _line); - - RecordDescriptorPtr rec = RecordDescriptorPtr::dynamicCast(child); - if(rec) - { - if(_record) - { - _errorReporter->error("only one element can be specified"); - } - _record = rec; - } - - ExecutableContainerDescriptor::addChild(child); -} - -void -FreezeScript::DatabaseDescriptor::execute(const SymbolTablePtr&, ExecuteInfo* info) -{ - // - // Store the key and value types. - // - info->keyType = _key; - info->valueType = _value; - - ExecutableContainerDescriptor::execute(info->symbolTable, info); -} - -// -// DumpDBDescriptor -// -FreezeScript::DumpDBDescriptor::DumpDBDescriptor(int line, const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter, - const IceXML::Attributes& /*attributes*/, const Slice::UnitPtr& unit) : - Descriptor(0, line, factory, errorReporter), _unit(unit), _info(new ExecuteInfo) -{ - _info->symbolTable = new SymbolTableI(factory, unit, errorReporter, _info); -} - -FreezeScript::DumpDBDescriptor::~DumpDBDescriptor() -{ - delete _info; -} - -void -FreezeScript::DumpDBDescriptor::addChild(const DescriptorPtr& child) -{ - DescriptorErrorContext ctx(_errorReporter, "dumpdb", _line); - - DatabaseDescriptorPtr db = DatabaseDescriptorPtr::dynamicCast(child); - DumpDescriptorPtr dump = DumpDescriptorPtr::dynamicCast(child); - - if(db) - { - if(_database) - { - _errorReporter->error("only one element can be specified"); - } - else - { - _database = db; - _children.push_back(db); - } - } - else if(dump) - { - string name = dump->typeName(); - DumpMap::iterator p = _info->dumpMap.find(name); - if(p != _info->dumpMap.end()) - { - _errorReporter->error(" descriptor for `" + name + "' specified more than once"); - } - _info->dumpMap.insert(DumpMap::value_type(name, dump)); - - _children.push_back(dump); - } - else - { - _errorReporter->error("invalid child element"); - } -} - -void -FreezeScript::DumpDBDescriptor::validate() -{ - DescriptorErrorContext ctx(_errorReporter, "dumpdb", _line); - - if(!_database) - { - _errorReporter->error("no element specified"); - } - - for(vector::iterator p = _children.begin(); p != _children.end(); ++p) - { - (*p)->validate(); - } -} - -void -FreezeScript::DumpDBDescriptor::execute(const SymbolTablePtr&, ExecuteInfo*) -{ - assert(false); -} - -void -FreezeScript::DumpDBDescriptor::dump(const Ice::CommunicatorPtr& communicator, Db* db, DbTxn* txn, const string& facet) -{ - _info->communicator = communicator; - _info->db = db; - _info->txn = txn; - _info->facet = facet; - - try - { - _database->execute(0, _info); - } - catch(...) - { - _info->communicator = 0; - _info->db = 0; - _info->txn = 0; - throw; - } - - _info->communicator = 0; - _info->db = 0; - _info->txn = 0; -} - -// -// SymbolTableI -// -FreezeScript::SymbolTableI::SymbolTableI(const DataFactoryPtr& factory, const Slice::UnitPtr& unit, - const ErrorReporterPtr& errorReporter, ExecuteInfo* info, - const SymbolTablePtr& parent) : - _factory(factory), _unit(unit), _errorReporter(errorReporter), _info(info), _parent(parent) -{ -} - -void -FreezeScript::SymbolTableI::add(const string& name, const DataPtr& data) -{ - DataMap::const_iterator p = _dataMap.find(name); - if(p != _dataMap.end()) - { - _errorReporter->error("`" + name + "' is already defined"); - } - - _dataMap.insert(DataMap::value_type(name, data)); -} - -FreezeScript::DataPtr -FreezeScript::SymbolTableI::getValue(const EntityNodePtr& entity) const -{ - EntityVisitor visitor(const_cast(this)); - entity->visit(visitor); - DataPtr result = visitor.getCurrent(); - if(!result) - { - ostringstream ostr; - ostr << "invalid entity `" << entity << "'"; - _errorReporter->error(ostr.str()); - } - - return result; -} - -FreezeScript::DataPtr -FreezeScript::SymbolTableI::getConstantValue(const string& name) const -{ - DataMap::const_iterator p = _constantCache.find(name); - if(p != _constantCache.end()) - { - return p->second; - } - - if(_parent) - { - return _parent->getConstantValue(name); - } - - Slice::ContainedList l = _unit->findContents(name); - if(l.empty()) - { - _errorReporter->error("unknown constant `" + name + "'"); - } - - Slice::EnumeratorPtr e = Slice::EnumeratorPtr::dynamicCast(l.front()); - Slice::ConstPtr c = Slice::ConstPtr::dynamicCast(l.front()); - if(!e && !c) - { - _errorReporter->error("`" + name + "' does not refer to a Slice constant or enumerator"); - } - - DataPtr result; - - if(c) - { - Slice::TypePtr type = c->type(); - string value = c->value(); - Slice::BuiltinPtr b = Slice::BuiltinPtr::dynamicCast(type); - if(b) - { - switch(b->kind()) - { - case Slice::Builtin::KindByte: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindLong: - { - Ice::Long n; - if(!IceUtilInternal::stringToInt64(value, n)) - { - assert(false); - } - result = _factory->createInteger(n, true); - break; - } - - case Slice::Builtin::KindBool: - { - result = _factory->createBoolean(value == "true", true); - break; - } - - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - { - double v = strtod(value.c_str(), 0); - result = _factory->createDouble(v, true); - break; - } - - case Slice::Builtin::KindString: - { - result = _factory->createString(value, true); - break; - } - - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - assert(false); - } - } - else - { - Slice::EnumPtr en = Slice::EnumPtr::dynamicCast(type); - assert(en); - Slice::EnumeratorList el = en->getEnumerators(); - for(Slice::EnumeratorList::iterator q = el.begin(); q != el.end(); ++q) - { - if((*q)->name() == value) - { - e = *q; - break; - } - } - assert(e); - } - } - - if(!result) - { - assert(e); - result = _factory->create(e->type(), true); - EnumDataPtr ed = EnumDataPtr::dynamicCast(result); - assert(ed); - ed->setValueAsString(e->name()); - } - - // - // Cache the value. - // - const_cast(_constantCache).insert(DataMap::value_type(name, result)); - - return result; -} - -FreezeScript::SymbolTablePtr -FreezeScript::SymbolTableI::createChild() -{ - return new SymbolTableI(_factory, _unit, _errorReporter, _info, this); -} - -Slice::TypePtr -FreezeScript::SymbolTableI::lookupType(const string& name) -{ - Slice::TypeList l = _unit->lookupType(name, false); - Slice::TypePtr result; - if(!l.empty()) - { - result = l.front(); - } - return result; -} - -FreezeScript::DataPtr -FreezeScript::SymbolTableI::invokeFunction(const string& name, const DataPtr& target, const DataList& args) -{ - if(target) - { - DictionaryDataPtr targetDict = DictionaryDataPtr::dynamicCast(target); - if(targetDict && name == "containsKey") - { - if(args.size() != 1) - { - _errorReporter->error("containsKey() requires one argument"); - } - Slice::DictionaryPtr dictType = Slice::DictionaryPtr::dynamicCast(targetDict->getType()); - assert(dictType); - DataPtr key = _factory->create(dictType->keyType(), false); - AssignVisitor visitor(args[0], _factory, _errorReporter, false); - key->visit(visitor); - DataPtr value = targetDict->getElement(key); - return _factory->createBoolean(value ? true : false, false); - } - - DataPtr result; - if(invokeMemberFunction(name, target, args, result, _factory, _errorReporter)) - { - return result; - } - - _errorReporter->error("unknown function `" + name + "' invoked on type " + typeToString(target->getType())); - } - else - { - // - // Global function. - // - DataPtr result; - if(invokeGlobalFunction(_info->communicator, name, args, result, _factory, _errorReporter)) - { - return result; - } - else - { - _errorReporter->error("unknown global function `" + name + "'"); - } - } - - return 0; -} - -FreezeScript::DataPtr -FreezeScript::SymbolTableI::findValue(const string& name) const -{ - DataMap::const_iterator p = _dataMap.find(name); - if(p != _dataMap.end()) - { - return p->second; - } - - if(_parent) - { - SymbolTableIPtr parentI = SymbolTableIPtr::dynamicCast(_parent); - assert(parentI); - return parentI->findValue(name); - } - - return 0; -} - -FreezeScript::SymbolTableI::EntityVisitor::EntityVisitor(SymbolTableI* table) : - _table(table), _error(false) -{ -} - -void -FreezeScript::SymbolTableI::EntityVisitor::visitIdentifier(const string& name) -{ - if(!_error) - { - if(!_current) - { - _current = _table->findValue(name); - } - else - { - _current = _current->getMember(name); - } - - if(!_current) - { - _error = true; - } - } -} - -void -FreezeScript::SymbolTableI::EntityVisitor::visitElement(const NodePtr& value) -{ - if(!_error) - { - assert(_current); - - DataPtr val = value->evaluate(_table); - _current = _current->getElement(val); - - if(!_current) - { - _error = true; - } - } -} - -FreezeScript::DataPtr -FreezeScript::SymbolTableI::EntityVisitor::getCurrent() const -{ - return _current; -} - -// -// DumpVisitor -// -FreezeScript::DumpVisitor::DumpVisitor(const DataFactoryPtr& factory, const Slice::UnitPtr& unit, - const ErrorReporterPtr& errorReporter, ExecuteInfo* info) : - _factory(factory), _unit(unit), _errorReporter(errorReporter), _info(info) -{ -} - -void -FreezeScript::DumpVisitor::visitBoolean(const BooleanDataPtr& data) -{ - dump(data); -} - -void -FreezeScript::DumpVisitor::visitInteger(const IntegerDataPtr& data) -{ - dump(data); -} - -void -FreezeScript::DumpVisitor::visitDouble(const DoubleDataPtr& data) -{ - dump(data); -} - -void -FreezeScript::DumpVisitor::visitString(const StringDataPtr& data) -{ - dump(data); -} - -void -FreezeScript::DumpVisitor::visitProxy(const ProxyDataPtr& data) -{ - dump(data); -} - -void -FreezeScript::DumpVisitor::visitStruct(const StructDataPtr& data) -{ - if(dump(data)) - { - DataMemberMap& members = data->getMembers(); - for(DataMemberMap::iterator p = members.begin(); p != members.end(); ++p) - { - p->second->visit(*this); - } - } -} - -void -FreezeScript::DumpVisitor::visitSequence(const SequenceDataPtr& data) -{ - if(dump(data)) - { - DataList& elements = data->getElements(); - for(DataList::iterator p = elements.begin(); p != elements.end(); ++p) - { - (*p)->visit(*this); - } - } -} - -void -FreezeScript::DumpVisitor::visitEnum(const EnumDataPtr& data) -{ - dump(data); -} - -void -FreezeScript::DumpVisitor::visitDictionary(const DictionaryDataPtr& data) -{ - if(dump(data)) - { - DataMap& elements = data->getElements(); - for(DataMap::iterator p = elements.begin(); p != elements.end(); ++p) - { - p->first->visit(*this); - p->second->visit(*this); - } - } -} - -void -FreezeScript::DumpVisitor::visitObject(const ObjectRefPtr& data) -{ - if(dump(data)) - { - ObjectDataPtr value = data->getValue(); - if(value) - { - set::iterator p = _objectHistory.find(value.get()); - if(p == _objectHistory.end()) - { - _objectHistory.insert(value.get()); - DataMemberMap& members = value->getMembers(); - for(DataMemberMap::iterator q = members.begin(); q != members.end(); ++q) - { - q->second->visit(*this); - } - } - } - } -} - -bool -FreezeScript::DumpVisitor::dump(const DataPtr& data) -{ - bool result = true; - ObjectRefPtr obj = ObjectRefPtr::dynamicCast(data); - if(obj && obj->getValue()) - { - // - // When the value is an object, attempt to find a descriptor for the - // object's actual type. If no descriptor is found, attempt to find a - // descriptor for the object's base types (including Ice::Object). - // - ObjectDataPtr objData = obj->getValue(); - Slice::TypePtr cls = objData->getType(); // Actual type - bool checkContents = true; - while(cls) - { - string type = typeToString(cls); - bool base = true; - DumpMap::const_iterator p = _info->dumpMap.find(type); - if(p != _info->dumpMap.end()) - { - SymbolTablePtr sym = new SymbolTableI(_factory, _unit, _errorReporter, _info, _info->symbolTable); - sym->add("value", objData); - p->second->execute(sym, _info); - base = p->second->base(); - if(checkContents) - { - result = p->second->contents(); - checkContents = false; - } - } - Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(cls); - cls = 0; - if(base && decl) - { - Slice::ClassDefPtr def = decl->definition(); - assert(def); - Slice::ClassList bases = def->bases(); - if(!bases.empty() && !bases.front()->isInterface()) - { - cls = bases.front()->declaration(); - } - else - { - cls = _unit->builtin(Slice::Builtin::KindObject); - } - } - } - } - else - { - string typeName = typeToString(data->getType()); - DumpMap::iterator p = _info->dumpMap.find(typeName); - if(p != _info->dumpMap.end()) - { - SymbolTablePtr st = new SymbolTableI(_factory, _unit, _errorReporter, _info, _info->symbolTable); - st->add("value", data); - p->second->execute(st, _info); - result = p->second->contents(); - } - - } - - return result; -} diff --git a/cpp/src/FreezeScript/DumpDescriptors.h b/cpp/src/FreezeScript/DumpDescriptors.h deleted file mode 100644 index abbd06b4e0b..00000000000 --- a/cpp/src/FreezeScript/DumpDescriptors.h +++ /dev/null @@ -1,306 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_SCRIPT_DUMP_DESCRIPTORS_H -#define FREEZE_SCRIPT_DUMP_DESCRIPTORS_H - -#include -#include - -class Db; -class DbTxn; - -namespace FreezeScript -{ - -class Descriptor; -typedef IceUtil::Handle DescriptorPtr; - -struct ExecuteInfo; - -class Descriptor : virtual public IceUtil::SimpleShared -{ -public: - - virtual ~Descriptor(); - - virtual DescriptorPtr parent() const; - virtual void addChild(const DescriptorPtr&) = 0; - virtual void validate() = 0; - virtual void execute(const SymbolTablePtr&, ExecuteInfo*) = 0; - -protected: - - Descriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&); - - NodePtr parse(const std::string&) const; - - Slice::TypePtr findType(const Slice::UnitPtr&, const std::string&); - - DescriptorPtr _parent; - int _line; - DataFactoryPtr _factory; - ErrorReporterPtr _errorReporter; -}; - -class SetDescriptor : public Descriptor -{ -public: - - SetDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, - const IceXML::Attributes&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&, ExecuteInfo*); - -private: - - EntityNodePtr _target; - NodePtr _value; - std::string _valueStr; - NodePtr _length; - std::string _lengthStr; - bool _convert; -}; - -class DefineDescriptor : public Descriptor -{ -public: - - DefineDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, - const IceXML::Attributes&, const Slice::UnitPtr&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&, ExecuteInfo*); - -private: - - std::string _name; - Slice::TypePtr _type; - NodePtr _value; - std::string _valueStr; - bool _convert; -}; - -class AddDescriptor : public Descriptor -{ -public: - - AddDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, - const IceXML::Attributes&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&, ExecuteInfo*); - -private: - - EntityNodePtr _target; - NodePtr _key; - std::string _keyStr; - NodePtr _index; - std::string _indexStr; - NodePtr _value; - std::string _valueStr; - bool _convert; -}; - -class RemoveDescriptor : public Descriptor -{ -public: - - RemoveDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, - const IceXML::Attributes&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&, ExecuteInfo*); - -private: - - EntityNodePtr _target; - NodePtr _key; - std::string _keyStr; - NodePtr _index; - std::string _indexStr; -}; - -class FailDescriptor : public Descriptor -{ -public: - - FailDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, - const IceXML::Attributes&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&, ExecuteInfo*); - -private: - - NodePtr _test; - std::string _testStr; - std::string _message; -}; - -class EchoDescriptor : public Descriptor -{ -public: - - EchoDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, - const IceXML::Attributes&, std::ostream&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&, ExecuteInfo*); - -private: - - std::ostream& _os; - std::string _message; - NodePtr _value; - std::string _valueStr; -}; - -class ExecutableContainerDescriptor : virtual public Descriptor -{ -public: - - ExecutableContainerDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, - const IceXML::Attributes&, const std::string&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&, ExecuteInfo*); - -protected: - - std::vector _children; - -private: - - std::string _name; -}; - -class IfDescriptor : public ExecutableContainerDescriptor -{ -public: - - IfDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&); - - virtual void execute(const SymbolTablePtr&, ExecuteInfo*); - -private: - - NodePtr _test; - std::string _testStr; -}; - -class IterateDescriptor : public ExecutableContainerDescriptor -{ -public: - - IterateDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, - const IceXML::Attributes&); - - virtual void execute(const SymbolTablePtr&, ExecuteInfo*); - -private: - - EntityNodePtr _target; - std::string _key; - std::string _value; - std::string _element; - std::string _index; -}; - -class DumpDescriptor : public ExecutableContainerDescriptor -{ -public: - - DumpDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, - const IceXML::Attributes&, const Slice::UnitPtr&); - - Slice::TypePtr type() const; - std::string typeName() const; - bool base() const; - bool contents() const; - -private: - - Slice::TypePtr _type; - bool _base; - bool _contents; -}; -typedef IceUtil::Handle DumpDescriptorPtr; - -class RecordDescriptor : public ExecutableContainerDescriptor -{ -public: - - RecordDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, - const IceXML::Attributes&, const Slice::UnitPtr&, - const FreezeScript::ObjectFactoryPtr&); - - virtual void execute(const SymbolTablePtr&, ExecuteInfo*); - -private: - - Slice::UnitPtr _unit; - FreezeScript::ObjectFactoryPtr _objectFactory; -}; -typedef IceUtil::Handle RecordDescriptorPtr; - -class DatabaseDescriptor : public ExecutableContainerDescriptor -{ -public: - - DatabaseDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, - const IceXML::Attributes&, const Slice::UnitPtr&); - - virtual void addChild(const DescriptorPtr&); - virtual void execute(const SymbolTablePtr&, ExecuteInfo*); - -private: - - Slice::UnitPtr _unit; - Slice::TypePtr _key; - Slice::TypePtr _value; - RecordDescriptorPtr _record; -}; -typedef IceUtil::Handle DatabaseDescriptorPtr; - -class DumpDBDescriptor : public Descriptor -{ -public: - - DumpDBDescriptor(int, const DataFactoryPtr&, const ErrorReporterPtr&, const IceXML::Attributes&, - const Slice::UnitPtr&); - ~DumpDBDescriptor(); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&, ExecuteInfo*); - - void dump(const Ice::CommunicatorPtr&, Db*, DbTxn*, const std::string&); - -private: - - Slice::UnitPtr _unit; - DatabaseDescriptorPtr _database; - std::vector _children; - ExecuteInfo* _info; -}; -typedef IceUtil::Handle DumpDBDescriptorPtr; - -} // End of namespace FreezeScript - -#endif diff --git a/cpp/src/FreezeScript/Error.cpp b/cpp/src/FreezeScript/Error.cpp deleted file mode 100644 index ba4c6d48de3..00000000000 --- a/cpp/src/FreezeScript/Error.cpp +++ /dev/null @@ -1,188 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include - -using namespace std; - -// -// ErrorReporter -// -FreezeScript::ErrorReporter::ErrorReporter(ostream& out, bool suppress) : - _out(out), _suppress(suppress) -{ -} - -ostream& -FreezeScript::ErrorReporter::stream() const -{ - return _out; -} - -void -FreezeScript::ErrorReporter::warning(const string& msg) -{ - ostringstream ostr; - if(!_descName.empty()) - { - ostr << "warning in <" << _descName << "> descriptor, line " << _descLine << ": " << msg << endl; - } - else - { - ostr << "warning: " << msg << endl; - } - string warn = ostr.str(); - if(_suppress) - { - map::iterator p = _warningHistory.find(warn); - if(p != _warningHistory.end()) - { - return; - } - _warningHistory.insert(map::value_type(warn, true)); - } - _out << warn; -} - -void -FreezeScript::ErrorReporter::error(const string& msg) -{ - ostringstream ostr; - if(!_descName.empty()) - { - ostr << "error in <" << _descName << "> descriptor, line " << _descLine << ": " << msg << endl; - } - else - { - ostr << "error: " << msg << endl; - } - throw FailureException(__FILE__, __LINE__, ostr.str()); -} - -void -FreezeScript::ErrorReporter::typeMismatchError(const Slice::TypePtr& expected, const Slice::TypePtr& received, - bool fatal) -{ - ostringstream ostr; - ostr << "type mismatch: expected " << typeToString(expected) << " but received " << typeToString(received); - - if(fatal) - { - error(ostr.str()); - } - else - { - warning(ostr.str()); - } -} - -void -FreezeScript::ErrorReporter::conversionError(const string& value, const Slice::TypePtr& type, bool fatal) -{ - ostringstream ostr; - ostr << "unable to convert `" << value << "' to " << typeToString(type); - - if(fatal) - { - error(ostr.str()); - } - else - { - warning(ostr.str()); - } -} - -void -FreezeScript::ErrorReporter::rangeError(const string& value, const Slice::TypePtr& type, bool fatal) -{ - ostringstream ostr; - ostr << "value `" << value << "' is out of range for type " << typeToString(type); - - if(fatal) - { - error(ostr.str()); - } - else - { - warning(ostr.str()); - } -} - -void -FreezeScript::ErrorReporter::expressionSyntaxError(const string& msg) -{ - assert(!_expression.empty()); - ostringstream ostr; - ostr << "syntax error in expression `" << _expression << "': " << msg; - error(ostr.str()); -} - -void -FreezeScript::ErrorReporter::descriptorError(const string& msg, int line) -{ - ostringstream ostr; - ostr << "XML error on line " << line << ":" << endl << msg; - error(ostr.str()); -} - -void -FreezeScript::ErrorReporter::setDescriptor(const string& name, int line) -{ - _descName = name; - _descLine = line; -} - -void -FreezeScript::ErrorReporter::getDescriptor(string& name, int& line) -{ - name = _descName; - line = _descLine; -} - -void -FreezeScript::ErrorReporter::clearDescriptor() -{ - _descName.clear(); -} - -void -FreezeScript::ErrorReporter::setExpression(const string& expr) -{ - _expression = expr; -} - -void -FreezeScript::ErrorReporter::clearExpression() -{ - _expression.clear(); -} - -// -// DescriptorErrorContext -// -FreezeScript::DescriptorErrorContext::DescriptorErrorContext(const ErrorReporterPtr& errorReporter, const string& name, - int line) : - _errorReporter(errorReporter) -{ - // - // Save the existing descriptor information before changing it. - // - _errorReporter->getDescriptor(_name, _line); - _errorReporter->setDescriptor(name, line); -} - -FreezeScript::DescriptorErrorContext::~DescriptorErrorContext() -{ - // - // Restore the original descriptor information. - // - _errorReporter->setDescriptor(_name, _line); -} diff --git a/cpp/src/FreezeScript/Error.h b/cpp/src/FreezeScript/Error.h deleted file mode 100644 index 353ed067402..00000000000 --- a/cpp/src/FreezeScript/Error.h +++ /dev/null @@ -1,68 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_SCRIPT_ERROR_H -#define FREEZE_SCRIPT_ERROR_H - -#include - -namespace FreezeScript -{ - -class ErrorReporter : public IceUtil::SimpleShared -{ -public: - - ErrorReporter(std::ostream&, bool); - - std::ostream& stream() const; - - void warning(const std::string&); - void error(const std::string&); - void typeMismatchError(const Slice::TypePtr&, const Slice::TypePtr&, bool); - void conversionError(const std::string&, const Slice::TypePtr&, bool); - void rangeError(const std::string&, const Slice::TypePtr&, bool); - void expressionSyntaxError(const std::string&); - void descriptorError(const std::string&, int); - - void setDescriptor(const std::string&, int); - void getDescriptor(std::string&, int&); - void clearDescriptor(); - - void setExpression(const std::string&); - void clearExpression(); - -private: - - std::ostream& _out; - bool _suppress; - std::map _warningHistory; - std::string _descName; - int _descLine; - std::string _expression; -}; -typedef IceUtil::Handle ErrorReporterPtr; - -class DescriptorErrorContext -{ -public: - - DescriptorErrorContext(const ErrorReporterPtr&, const std::string&, int); - ~DescriptorErrorContext(); - -private: - - ErrorReporterPtr _errorReporter; - std::string _name; - int _line; -}; - -} // End of namespace FreezeScript - -#endif diff --git a/cpp/src/FreezeScript/Exception.cpp b/cpp/src/FreezeScript/Exception.cpp deleted file mode 100644 index 1d1f2efbbe9..00000000000 --- a/cpp/src/FreezeScript/Exception.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include - -using namespace std; - -// -// FailureException -// -FreezeScript::FailureException::FailureException(const char* file, int line, const string& reason) : - IceUtil::Exception(file, line), _reason(reason) -{ -} - -FreezeScript::FailureException::~FailureException() throw() -{ -} - -const char* FreezeScript::FailureException::_name = "FreezeScript::FailureException"; - -string -FreezeScript::FailureException::ice_name() const -{ - return _name; -} - -void -FreezeScript::FailureException::ice_print(ostream& out) const -{ - ::IceUtil::Exception::ice_print(out); - out << ":\nerror occurred during transformation"; // TODO - if(!_reason.empty()) - { - out << ":\n" << _reason; - } -} - -FreezeScript::FailureException* -FreezeScript::FailureException::ice_clone() const -{ - return new FailureException(ice_file(), ice_line(), _reason); -} - -void -FreezeScript::FailureException::ice_throw() const -{ - throw *this; -} - -string -FreezeScript::FailureException::reason() const -{ - return _reason; -} diff --git a/cpp/src/FreezeScript/Exception.h b/cpp/src/FreezeScript/Exception.h deleted file mode 100644 index 6f8007c1c5a..00000000000 --- a/cpp/src/FreezeScript/Exception.h +++ /dev/null @@ -1,39 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_SCRIPT_EXCEPTION_H -#define FREEZE_SCRIPT_EXCEPTION_H - -#include - -namespace FreezeScript -{ - -class FailureException : public IceUtil::Exception -{ -public: - - FailureException(const char*, int, const std::string&); - virtual ~FailureException() throw(); - virtual std::string ice_name() const; - virtual void ice_print(std::ostream&) const; - virtual FailureException* ice_clone() const; - virtual void ice_throw() const; - - std::string reason() const; - -private: - - std::string _reason; - static const char* _name; -}; - -} // End of namespace FreezeScript - -#endif diff --git a/cpp/src/FreezeScript/Functions.cpp b/cpp/src/FreezeScript/Functions.cpp deleted file mode 100644 index 4670ee4f1c8..00000000000 --- a/cpp/src/FreezeScript/Functions.cpp +++ /dev/null @@ -1,346 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include - -using namespace std; - -bool -FreezeScript::invokeGlobalFunction(const Ice::CommunicatorPtr& communicator, const string& name, const DataList& args, - DataPtr& result, const DataFactoryPtr& factory, - const ErrorReporterPtr& errorReporter) -{ - // - // Global function. - // - if(name == "typeOf") - { - if(args.size() != 1) - { - errorReporter->error("typeOf() requires one argument"); - } - result = factory->createString(typeToString(args.front()->getType()), false); - return true; - } - else if(name == "generateUUID") - { - if(args.size() != 0) - { - errorReporter->error("generateUUID() accepts no arguments"); - } - result = factory->createString(IceUtil::generateUUID(), false); - return true; - } - else if(name == "stringToIdentity") - { - StringDataPtr str; - if(args.size() > 0) - { - str = StringDataPtr::dynamicCast(args.front()); - } - if(args.size() != 1 || !str) - { - errorReporter->error("stringToIdentity() requires a string argument"); - } - - // - // Parse the identity string. - // - string idstr = str->stringValue(); - Ice::Identity id; - try - { - id = communicator->stringToIdentity(idstr); - } - catch(const Ice::IdentityParseException& ex) - { - errorReporter->error("error in stringToIdentity():\n" + ex.str); - } - - // - // Create a data representation of Ice::Identity. - // - Slice::UnitPtr unit = str->getType()->unit(); - Slice::TypeList l = unit->lookupType("::Ice::Identity", false); - assert(!l.empty()); - DataPtr identity = factory->create(l.front(), false); - StringDataPtr member; - member = StringDataPtr::dynamicCast(identity->getMember("name")); - assert(member); - member->setValue(id.name); - member = StringDataPtr::dynamicCast(identity->getMember("category")); - assert(member); - member->setValue(id.category); - result = identity; - return true; - } - else if(name == "identityToString") - { - StructDataPtr identity; - if(args.size() > 0) - { - identity = StructDataPtr::dynamicCast(args.front()); - } - if(identity) - { - Slice::TypePtr argType = identity->getType(); - Slice::StructPtr st = Slice::StructPtr::dynamicCast(argType); - if(!st || st->scoped() != "::Ice::Identity") - { - identity = 0; - } - } - if(args.size() != 1 || !identity) - { - errorReporter->error("identityToString() requires a argument of type ::Ice::Identity"); - } - - // - // Compose the identity. - // - Ice::Identity id; - StringDataPtr member; - member = StringDataPtr::dynamicCast(identity->getMember("name")); - assert(member); - id.name = member->stringValue(); - member = StringDataPtr::dynamicCast(identity->getMember("category")); - assert(member); - id.category = member->stringValue(); - - result = factory->createString(communicator->identityToString(id), false); - return true; - } - else if(name == "stringToProxy") - { - StringDataPtr str; - if(args.size() > 0) - { - str = StringDataPtr::dynamicCast(args.front()); - } - if(args.size() != 1 || !str) - { - errorReporter->error("stringToProxy() requires a string argument"); - } - - // - // Parse the proxy; - // - string sprx = str->stringValue(); - Ice::ObjectPrx prx; - try - { - prx = factory->getCommunicator()->stringToProxy(sprx); - } - catch(const Ice::ProxyParseException& ex) - { - errorReporter->error("error in stringToProxy():\n" + ex.str); - } - - Slice::UnitPtr unit = str->getType()->unit(); - ProxyDataPtr p = - ProxyDataPtr::dynamicCast(factory->create(unit->builtin(Slice::Builtin::KindObjectProxy), false)); - p->setValue(prx); - result = p; - return true; - } - else if(name == "proxyToString") - { - ProxyDataPtr prx; - if(args.size() > 0) - { - prx = ProxyDataPtr::dynamicCast(args.front()); - } - if(args.size() != 1 || !prx) - { - errorReporter->error("proxyToString() requires a proxy argument"); - } - - result = factory->createString(prx->toString(), false); - return true; - } - else if(name == "lowercase") - { - StringDataPtr str; - if(args.size() > 0) - { - str = StringDataPtr::dynamicCast(args.front()); - } - if(args.size() != 1 || !str) - { - errorReporter->error("lowercase() requires a string argument"); - } - string val = IceUtilInternal::toLower(str->stringValue()); - result = factory->createString(val, false); - return true; - } - - return false; -} - -bool -FreezeScript::invokeMemberFunction(const string& name, const DataPtr& target, const DataList& args, DataPtr& result, - const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter) -{ - // - // string - // - StringDataPtr targetStr = StringDataPtr::dynamicCast(target); - if(targetStr) - { - if(name == "find") - { - StringDataPtr argData; - IntegerDataPtr startData; - if(args.size() > 0) - { - argData = StringDataPtr::dynamicCast(args[0]); - } - if(args.size() > 1) - { - startData = IntegerDataPtr::dynamicCast(args[1]); - } - if(args.size() == 0 || args.size() > 2 || !argData || (args.size() == 2 && !startData)) - { - errorReporter->error("invalid arguments to find(string str[, int len])"); - } - string targ = targetStr->stringValue(); - string arg = argData->stringValue(); - string::size_type pos; - if(startData) - { - string::size_type start = static_cast(startData->integerValue()); - pos = targ.find(arg, start); - } - else - { - pos = targ.find(arg); - } - result = factory->createInteger(pos == string::npos ? -1 : static_cast(pos), false); - return true; - } - else if(name == "substr") - { - IntegerDataPtr startData; - IntegerDataPtr lenData; - if(args.size() > 0) - { - startData = IntegerDataPtr::dynamicCast(args[0]); - } - if(args.size() > 1) - { - lenData = IntegerDataPtr::dynamicCast(args[1]); - } - if(args.size() == 0 || args.size() > 2 || !startData || (args.size() == 2 && !lenData)) - { - errorReporter->error("invalid arguments to substr(int start[, int len])"); - } - string targ = targetStr->stringValue(); - string::size_type start = static_cast(startData->integerValue()); - string::size_type len = string::npos; - if(lenData) - { - len = static_cast(lenData->integerValue()); - } - if(start > targ.size()) - { - ostringstream ostr; - ostr << "substr() starting position (" << start << ") is greater than string length (" - << targ.size() << ")"; - errorReporter->error(ostr.str()); - } - result = factory->createString(targ.substr(start, len), false); - return true; - } - else if(name == "replace") - { - IntegerDataPtr startData; - IntegerDataPtr lenData; - StringDataPtr strData; - if(args.size() == 3) - { - startData = IntegerDataPtr::dynamicCast(args[0]); - lenData = IntegerDataPtr::dynamicCast(args[1]); - strData = StringDataPtr::dynamicCast(args[2]); - } - if(args.size() != 3 || !startData || !lenData || !strData) - { - errorReporter->error("invalid arguments to replace(int start, int len, string val)"); - } - string targ = targetStr->stringValue(); - string::size_type start = static_cast(startData->integerValue()); - string::size_type len = static_cast(lenData->integerValue()); - string str = strData->stringValue(); - if(start > targ.size()) - { - ostringstream ostr; - ostr << "replace() starting position (" << start << ") is greater than string length (" - << targ.size() << ")"; - errorReporter->error(ostr.str()); - } - result = factory->createString(targ.replace(start, len, str), false); - return true; - } - - return false; - } - - // - // Object - // - ObjectRefPtr targetObj = ObjectRefPtr::dynamicCast(target); - if(targetObj) - { - if(name == "ice_isA") - { - ObjectDataPtr value = targetObj->getValue(); - if(!value) - { - errorReporter->error("ice_isA() invoked on nil object"); - } - StringDataPtr str; - if(args.size() > 0) - { - str = StringDataPtr::dynamicCast(args.front()); - } - if(args.size() != 1 || !str) - { - errorReporter->error("invalid arguments to ice_isA(string id)"); - } - - string id = str->stringValue(); - if(id == "::Ice::Object") - { - result = factory->createBoolean(true, false); - return true; - } - - Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(value->getType()); - if(!decl) - { - // - // Ice::Object - // - result = factory->createBoolean(false, false); - return true; - } - - Slice::ClassDefPtr def = decl->definition(); - assert(def); - result = factory->createBoolean(def->isA(id), false); - return true; - } - - return false; - } - - return false; -} diff --git a/cpp/src/FreezeScript/Functions.h b/cpp/src/FreezeScript/Functions.h deleted file mode 100644 index 9b4860fb6f2..00000000000 --- a/cpp/src/FreezeScript/Functions.h +++ /dev/null @@ -1,26 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_SCRIPT_FUNCTIONS_H -#define FREEZE_SCRIPT_FUNCTIONS_H - -#include - -namespace FreezeScript -{ - -bool invokeGlobalFunction(const Ice::CommunicatorPtr&, const std::string&, const DataList&, DataPtr&, - const DataFactoryPtr&, const ErrorReporterPtr&); - -bool invokeMemberFunction(const std::string&, const DataPtr&, const DataList&, DataPtr&, const DataFactoryPtr&, - const ErrorReporterPtr&); - -} - -#endif diff --git a/cpp/src/FreezeScript/Grammar.cpp b/cpp/src/FreezeScript/Grammar.cpp deleted file mode 100644 index e3e79cb8910..00000000000 --- a/cpp/src/FreezeScript/Grammar.cpp +++ /dev/null @@ -1,2051 +0,0 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.4.1" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 1 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - -/* Substitute the variable and function names. */ -#define yyparse freeze_script_parse -#define yylex freeze_script_lex -#define yyerror freeze_script_error -#define yylval freeze_script_lval -#define yychar freeze_script_char -#define yydebug freeze_script_debug -#define yynerrs freeze_script_nerrs - - -/* Copy the first part of user declarations. */ - -/* Line 189 of yacc.c */ -#line 1 "../FreezeScript/Grammar.y" - - -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include - -#ifdef _MSC_VER -// I get these warnings from some bison versions: -// warning C4102: 'yyoverflowlab' : unreferenced label -# pragma warning( disable : 4102 ) -// warning C4065: switch statement contains 'default' but no 'case' labels -# pragma warning( disable : 4065 ) -#endif - -// -// Avoid old style cast warnings in generated grammar -// -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wold-style-cast" -#endif - -using namespace std; -using namespace FreezeScript; - -void -freeze_script_error(const char* s) -{ - // yacc and recent versions of Bison use "syntax error" instead - // of "parse error". - - if(strcmp(s, "parse error") == 0) - { - parseErrorReporter->expressionSyntaxError("syntax error"); - } - else - { - parseErrorReporter->expressionSyntaxError(s); - } -} - - - -/* Line 189 of yacc.c */ -#line 131 "Grammar.tab.c" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_AND = 258, - TOK_OR = 259, - TOK_NOT = 260, - TOK_ADD = 261, - TOK_SUB = 262, - TOK_MUL = 263, - TOK_DIV = 264, - TOK_MOD = 265, - TOK_LPAREN = 266, - TOK_RPAREN = 267, - TOK_LBRACKET = 268, - TOK_RBRACKET = 269, - TOK_LESS_THAN = 270, - TOK_GREATER_THAN = 271, - TOK_LESS_EQUAL = 272, - TOK_GREATER_EQUAL = 273, - TOK_EQUAL = 274, - TOK_NEQ = 275, - TOK_TRUE = 276, - TOK_FALSE = 277, - TOK_NIL = 278, - TOK_SCOPE_DELIMITER = 279, - TOK_IDENTIFIER = 280, - TOK_STRING_LITERAL = 281, - TOK_INTEGER_LITERAL = 282, - TOK_FLOATING_POINT_LITERAL = 283, - UNARY_OP = 284 - }; -#endif - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - - -/* Copy the second part of user declarations. */ - - -/* Line 264 of yacc.c */ -#line 202 "Grammar.tab.c" - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; -#endif -{ - return yyi; -} -#endif - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 24 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 111 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 32 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 9 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 39 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 65 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 284 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 31, 2, 30, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 5, 7, 11, 15, 19, 23, 27, - 31, 35, 39, 43, 47, 51, 55, 59, 61, 65, - 68, 71, 73, 75, 77, 79, 81, 83, 85, 89, - 91, 93, 98, 102, 104, 109, 113, 115, 116, 120 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 33, 0, -1, 34, -1, 35, -1, 35, 15, 35, - -1, 35, 16, 35, -1, 35, 17, 35, -1, 35, - 18, 35, -1, 35, 19, 35, -1, 35, 20, 35, - -1, 35, 4, 35, -1, 35, 3, 35, -1, 35, - 8, 35, -1, 35, 9, 35, -1, 35, 10, 35, - -1, 35, 6, 35, -1, 35, 7, 35, -1, 36, - -1, 11, 34, 12, -1, 7, 36, -1, 5, 36, - -1, 27, -1, 28, -1, 26, -1, 21, -1, 22, - -1, 23, -1, 37, -1, 37, 30, 38, -1, 38, - -1, 40, -1, 37, 13, 34, 14, -1, 37, 30, - 25, -1, 25, -1, 25, 11, 39, 12, -1, 39, - 31, 34, -1, 34, -1, -1, 40, 24, 25, -1, - 24, 25, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 91, 91, 100, 109, 113, 117, 121, 125, 129, - 133, 137, 141, 145, 149, 153, 157, 161, 170, 174, - 178, 182, 188, 194, 200, 204, 208, 212, 216, 225, - 229, 240, 247, 256, 267, 280, 287, 294, 302, 311 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "TOK_AND", "TOK_OR", "TOK_NOT", - "TOK_ADD", "TOK_SUB", "TOK_MUL", "TOK_DIV", "TOK_MOD", "TOK_LPAREN", - "TOK_RPAREN", "TOK_LBRACKET", "TOK_RBRACKET", "TOK_LESS_THAN", - "TOK_GREATER_THAN", "TOK_LESS_EQUAL", "TOK_GREATER_EQUAL", "TOK_EQUAL", - "TOK_NEQ", "TOK_TRUE", "TOK_FALSE", "TOK_NIL", "TOK_SCOPE_DELIMITER", - "TOK_IDENTIFIER", "TOK_STRING_LITERAL", "TOK_INTEGER_LITERAL", - "TOK_FLOATING_POINT_LITERAL", "UNARY_OP", "'.'", "','", "$accept", - "start", "expr", "binary", "unary", "entity", "function", "arg_list", - "constant", 0 -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 46, 44 -}; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 32, 33, 34, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, - 36, 37, 37, 37, 38, 39, 39, 39, 40, 40 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 1, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 1, 3, 2, - 2, 1, 1, 1, 1, 1, 1, 1, 3, 1, - 1, 4, 3, 1, 4, 3, 1, 0, 3, 2 -}; - -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 0, 0, 0, 0, 24, 25, 26, 0, 33, 23, - 21, 22, 0, 2, 3, 17, 27, 29, 30, 20, - 19, 0, 39, 37, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 18, 36, 0, 11, 10, 15, 16, 12, 13, - 14, 4, 5, 6, 7, 8, 9, 0, 32, 28, - 38, 34, 0, 31, 35 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 12, 13, 14, 15, 16, 17, 43, 18 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -20 -static const yytype_int8 yypact[] = -{ - 0, 0, 0, 0, -20, -20, -20, -19, 1, -20, - -20, -20, 13, -20, 30, -20, -12, -20, -10, -20, - -20, 3, -20, 0, -20, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -9, - -8, -20, -20, -2, 63, 48, -6, -6, -20, -20, - -20, 78, 78, 78, 78, 78, 78, 5, 1, -20, - -20, -20, 0, -20, -20 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = -{ - -20, -20, -3, 74, 7, -20, -7, -20, -20 -}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 -static const yytype_int8 yytable[] = -{ - 21, 38, 29, 30, 31, 1, 22, 2, 19, 20, - 61, 3, 23, 24, 40, 41, 58, 60, 39, 63, - 42, 4, 5, 6, 7, 8, 9, 10, 11, 62, - 0, 0, 59, 25, 26, 57, 27, 28, 29, 30, - 31, 0, 0, 0, 0, 32, 33, 34, 35, 36, - 37, 25, 0, 0, 27, 28, 29, 30, 31, 64, - 0, 0, 0, 32, 33, 34, 35, 36, 37, 27, - 28, 29, 30, 31, 0, 0, 0, 0, 32, 33, - 34, 35, 36, 37, 27, 28, 29, 30, 31, 0, - 0, 0, 0, -1, -1, -1, -1, -1, -1, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56 -}; - -static const yytype_int8 yycheck[] = -{ - 3, 13, 8, 9, 10, 5, 25, 7, 1, 2, - 12, 11, 11, 0, 24, 12, 25, 25, 30, 14, - 23, 21, 22, 23, 24, 25, 26, 27, 28, 31, - -1, -1, 39, 3, 4, 38, 6, 7, 8, 9, - 10, -1, -1, -1, -1, 15, 16, 17, 18, 19, - 20, 3, -1, -1, 6, 7, 8, 9, 10, 62, - -1, -1, -1, 15, 16, 17, 18, 19, 20, 6, - 7, 8, 9, 10, -1, -1, -1, -1, 15, 16, - 17, 18, 19, 20, 6, 7, 8, 9, 10, -1, - -1, -1, -1, 15, 16, 17, 18, 19, 20, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 5, 7, 11, 21, 22, 23, 24, 25, 26, - 27, 28, 33, 34, 35, 36, 37, 38, 40, 36, - 36, 34, 25, 11, 0, 3, 4, 6, 7, 8, - 9, 10, 15, 16, 17, 18, 19, 20, 13, 30, - 24, 12, 34, 39, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 34, 25, 38, - 25, 12, 31, 14, 34 -}; - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ - -#define YYFAIL goto yyerrlab - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -#else -# define YYLEX yylex (&yylval) -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; - - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; - } -} -#endif /* YYERROR_VERBOSE */ - - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} - -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - - - - -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ - -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else -int -yyparse () - -#endif -#endif -{ -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; - - /* Number of syntax errors so far. */ - int yynerrs; - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - *++yyvsp = yylval; - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: - -/* Line 1455 of yacc.c */ -#line 92 "../FreezeScript/Grammar.y" - { - parseResult = (yyvsp[(1) - (1)]); -;} - break; - - case 3: - -/* Line 1455 of yacc.c */ -#line 101 "../FreezeScript/Grammar.y" - { - (yyval) = (yyvsp[(1) - (1)]); -;} - break; - - case 4: - -/* Line 1455 of yacc.c */ -#line 110 "../FreezeScript/Grammar.y" - { - (yyval) = new BinaryNode(BinOpLess, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); -;} - break; - - case 5: - -/* Line 1455 of yacc.c */ -#line 114 "../FreezeScript/Grammar.y" - { - (yyval) = new BinaryNode(BinOpGreater, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); -;} - break; - - case 6: - -/* Line 1455 of yacc.c */ -#line 118 "../FreezeScript/Grammar.y" - { - (yyval) = new BinaryNode(BinOpLessEq, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); -;} - break; - - case 7: - -/* Line 1455 of yacc.c */ -#line 122 "../FreezeScript/Grammar.y" - { - (yyval) = new BinaryNode(BinOpGrEq, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); -;} - break; - - case 8: - -/* Line 1455 of yacc.c */ -#line 126 "../FreezeScript/Grammar.y" - { - (yyval) = new BinaryNode(BinOpEq, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); -;} - break; - - case 9: - -/* Line 1455 of yacc.c */ -#line 130 "../FreezeScript/Grammar.y" - { - (yyval) = new BinaryNode(BinOpNotEq, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); -;} - break; - - case 10: - -/* Line 1455 of yacc.c */ -#line 134 "../FreezeScript/Grammar.y" - { - (yyval) = new BinaryNode(BinOpOr, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); -;} - break; - - case 11: - -/* Line 1455 of yacc.c */ -#line 138 "../FreezeScript/Grammar.y" - { - (yyval) = new BinaryNode(BinOpAnd, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); -;} - break; - - case 12: - -/* Line 1455 of yacc.c */ -#line 142 "../FreezeScript/Grammar.y" - { - (yyval) = new BinaryNode(BinOpMul, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); -;} - break; - - case 13: - -/* Line 1455 of yacc.c */ -#line 146 "../FreezeScript/Grammar.y" - { - (yyval) = new BinaryNode(BinOpDiv, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); -;} - break; - - case 14: - -/* Line 1455 of yacc.c */ -#line 150 "../FreezeScript/Grammar.y" - { - (yyval) = new BinaryNode(BinOpMod, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); -;} - break; - - case 15: - -/* Line 1455 of yacc.c */ -#line 154 "../FreezeScript/Grammar.y" - { - (yyval) = new BinaryNode(BinOpAdd, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); -;} - break; - - case 16: - -/* Line 1455 of yacc.c */ -#line 158 "../FreezeScript/Grammar.y" - { - (yyval) = new BinaryNode(BinOpSub, parseDataFactory, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); -;} - break; - - case 17: - -/* Line 1455 of yacc.c */ -#line 162 "../FreezeScript/Grammar.y" - { - (yyval) = (yyvsp[(1) - (1)]); -;} - break; - - case 18: - -/* Line 1455 of yacc.c */ -#line 171 "../FreezeScript/Grammar.y" - { - (yyval) = (yyvsp[(2) - (3)]); -;} - break; - - case 19: - -/* Line 1455 of yacc.c */ -#line 175 "../FreezeScript/Grammar.y" - { - (yyval) = new UnaryNode(UnaryOpNeg, parseDataFactory, (yyvsp[(2) - (2)])); -;} - break; - - case 20: - -/* Line 1455 of yacc.c */ -#line 179 "../FreezeScript/Grammar.y" - { - (yyval) = new UnaryNode(UnaryOpNot, parseDataFactory, (yyvsp[(2) - (2)])); -;} - break; - - case 21: - -/* Line 1455 of yacc.c */ -#line 183 "../FreezeScript/Grammar.y" - { - IntegerTokPtr intVal = IntegerTokPtr::dynamicCast((yyvsp[(1) - (1)])); - assert(intVal); - (yyval) = new DataNode(parseDataFactory->createInteger(intVal->v, true)); -;} - break; - - case 22: - -/* Line 1455 of yacc.c */ -#line 189 "../FreezeScript/Grammar.y" - { - FloatingTokPtr floatVal = FloatingTokPtr::dynamicCast((yyvsp[(1) - (1)])); - assert(floatVal); - (yyval) = new DataNode(parseDataFactory->createDouble(floatVal->v, true)); -;} - break; - - case 23: - -/* Line 1455 of yacc.c */ -#line 195 "../FreezeScript/Grammar.y" - { - StringTokPtr stringVal = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); - assert(stringVal); - (yyval) = new DataNode(parseDataFactory->createString(stringVal->v, true)); -;} - break; - - case 24: - -/* Line 1455 of yacc.c */ -#line 201 "../FreezeScript/Grammar.y" - { - (yyval) = new DataNode(parseDataFactory->createBoolean(true, true)); -;} - break; - - case 25: - -/* Line 1455 of yacc.c */ -#line 205 "../FreezeScript/Grammar.y" - { - (yyval) = new DataNode(parseDataFactory->createBoolean(false, true)); -;} - break; - - case 26: - -/* Line 1455 of yacc.c */ -#line 209 "../FreezeScript/Grammar.y" - { - (yyval) = new DataNode(parseDataFactory->createNil(true)); -;} - break; - - case 27: - -/* Line 1455 of yacc.c */ -#line 213 "../FreezeScript/Grammar.y" - { - (yyval) = (yyvsp[(1) - (1)]); -;} - break; - - case 28: - -/* Line 1455 of yacc.c */ -#line 217 "../FreezeScript/Grammar.y" - { - EntityNodePtr entity = EntityNodePtr::dynamicCast((yyvsp[(1) - (3)])); - assert(entity); - FunctionNodePtr func = FunctionNodePtr::dynamicCast((yyvsp[(3) - (3)])); - assert(func); - func->setTarget(entity); - (yyval) = (yyvsp[(3) - (3)]); -;} - break; - - case 29: - -/* Line 1455 of yacc.c */ -#line 226 "../FreezeScript/Grammar.y" - { - (yyval) = (yyvsp[(1) - (1)]); -;} - break; - - case 30: - -/* Line 1455 of yacc.c */ -#line 230 "../FreezeScript/Grammar.y" - { - StringTokPtr stringVal = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); - assert(stringVal); - (yyval) = new ConstantNode(stringVal->v); -;} - break; - - case 31: - -/* Line 1455 of yacc.c */ -#line 241 "../FreezeScript/Grammar.y" - { - EntityNodePtr entity = EntityNodePtr::dynamicCast((yyvsp[(1) - (4)])); - assert(entity); - entity->append(new ElementNode((yyvsp[(3) - (4)]))); - (yyval) = (yyvsp[(1) - (4)]); -;} - break; - - case 32: - -/* Line 1455 of yacc.c */ -#line 248 "../FreezeScript/Grammar.y" - { - StringTokPtr stringVal = StringTokPtr::dynamicCast((yyvsp[(3) - (3)])); - assert(stringVal); - EntityNodePtr entity = EntityNodePtr::dynamicCast((yyvsp[(1) - (3)])); - assert(entity); - entity->append(new IdentNode(stringVal->v)); - (yyval) = (yyvsp[(1) - (3)]); -;} - break; - - case 33: - -/* Line 1455 of yacc.c */ -#line 257 "../FreezeScript/Grammar.y" - { - StringTokPtr stringVal = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); - assert(stringVal); - (yyval) = new IdentNode(stringVal->v); -;} - break; - - case 34: - -/* Line 1455 of yacc.c */ -#line 268 "../FreezeScript/Grammar.y" - { - StringTokPtr func = StringTokPtr::dynamicCast((yyvsp[(1) - (4)])); - assert(func); - NodeListTokPtr args = NodeListTokPtr::dynamicCast((yyvsp[(3) - (4)])); - assert(args); - (yyval) = new FunctionNode(func->v, args->v); -;} - break; - - case 35: - -/* Line 1455 of yacc.c */ -#line 281 "../FreezeScript/Grammar.y" - { - NodeListTokPtr l = NodeListTokPtr::dynamicCast((yyvsp[(1) - (3)])); - assert(l); - l->v.push_back((yyvsp[(3) - (3)])); - (yyval) = (yyvsp[(1) - (3)]); -;} - break; - - case 36: - -/* Line 1455 of yacc.c */ -#line 288 "../FreezeScript/Grammar.y" - { - NodeListTokPtr result = new NodeListTok; - result->v.push_back((yyvsp[(1) - (1)])); - (yyval) = result; -;} - break; - - case 37: - -/* Line 1455 of yacc.c */ -#line 294 "../FreezeScript/Grammar.y" - { - (yyval) = new NodeListTok; -;} - break; - - case 38: - -/* Line 1455 of yacc.c */ -#line 303 "../FreezeScript/Grammar.y" - { - StringTokPtr stringVal = StringTokPtr::dynamicCast((yyvsp[(1) - (3)])); - assert(stringVal); - StringTokPtr idVal = StringTokPtr::dynamicCast((yyvsp[(3) - (3)])); - assert(idVal); - stringVal->v.append("::" + idVal->v); - (yyval) = (yyvsp[(1) - (3)]); -;} - break; - - case 39: - -/* Line 1455 of yacc.c */ -#line 312 "../FreezeScript/Grammar.y" - { - StringTokPtr idVal = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); - assert(idVal); - StringTokPtr stringVal = new StringTok; - stringVal->v.append("::" + idVal->v); - (yyval) = stringVal; -;} - break; - - - -/* Line 1455 of yacc.c */ -#line 1838 "Grammar.tab.c" - default: break; - } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else - { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } - } -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - *++yyvsp = yylval; - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined(yyoverflow) || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - /* Make sure YYID is used. */ - return YYID (yyresult); -} - - - -/* Line 1675 of yacc.c */ -#line 321 "../FreezeScript/Grammar.y" - - diff --git a/cpp/src/FreezeScript/Grammar.h b/cpp/src/FreezeScript/Grammar.h deleted file mode 100644 index ae561a72f12..00000000000 --- a/cpp/src/FreezeScript/Grammar.h +++ /dev/null @@ -1,83 +0,0 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_AND = 258, - TOK_OR = 259, - TOK_NOT = 260, - TOK_ADD = 261, - TOK_SUB = 262, - TOK_MUL = 263, - TOK_DIV = 264, - TOK_MOD = 265, - TOK_LPAREN = 266, - TOK_RPAREN = 267, - TOK_LBRACKET = 268, - TOK_RBRACKET = 269, - TOK_LESS_THAN = 270, - TOK_GREATER_THAN = 271, - TOK_LESS_EQUAL = 272, - TOK_GREATER_EQUAL = 273, - TOK_EQUAL = 274, - TOK_NEQ = 275, - TOK_TRUE = 276, - TOK_FALSE = 277, - TOK_NIL = 278, - TOK_SCOPE_DELIMITER = 279, - TOK_IDENTIFIER = 280, - TOK_STRING_LITERAL = 281, - TOK_INTEGER_LITERAL = 282, - TOK_FLOATING_POINT_LITERAL = 283, - UNARY_OP = 284 - }; -#endif - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - - - - diff --git a/cpp/src/FreezeScript/Grammar.y b/cpp/src/FreezeScript/Grammar.y deleted file mode 100644 index 3db0052ca88..00000000000 --- a/cpp/src/FreezeScript/Grammar.y +++ /dev/null @@ -1,321 +0,0 @@ -%{ - -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include - -#ifdef _MSC_VER -// I get these warnings from some bison versions: -// warning C4102: 'yyoverflowlab' : unreferenced label -# pragma warning( disable : 4102 ) -// warning C4065: switch statement contains 'default' but no 'case' labels -# pragma warning( disable : 4065 ) -#endif - -// -// Avoid old style cast warnings in generated grammar -// -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wold-style-cast" -#endif - -using namespace std; -using namespace FreezeScript; - -void -freeze_script_error(const char* s) -{ - // yacc and recent versions of Bison use "syntax error" instead - // of "parse error". - - if(strcmp(s, "parse error") == 0) - { - parseErrorReporter->expressionSyntaxError("syntax error"); - } - else - { - parseErrorReporter->expressionSyntaxError(s); - } -} - -%} - -%pure_parser - -%token TOK_AND -%token TOK_OR -%token TOK_NOT -%token TOK_ADD -%token TOK_SUB -%token TOK_MUL -%token TOK_DIV -%token TOK_MOD -%token TOK_LPAREN -%token TOK_RPAREN -%token TOK_LBRACKET -%token TOK_RBRACKET -%token TOK_LESS_THAN -%token TOK_GREATER_THAN -%token TOK_LESS_EQUAL -%token TOK_GREATER_EQUAL -%token TOK_EQUAL -%token TOK_NEQ -%token TOK_TRUE -%token TOK_FALSE -%token TOK_NIL -%token TOK_SCOPE_DELIMITER -%token TOK_IDENTIFIER -%token TOK_STRING_LITERAL -%token TOK_INTEGER_LITERAL -%token TOK_FLOATING_POINT_LITERAL - -%left TOK_OR -%left TOK_AND -%nonassoc TOK_LESS_THAN TOK_GREATER_THAN TOK_LESS_EQUAL TOK_GREATER_EQUAL TOK_EQUAL TOK_NEQ -%left TOK_ADD TOK_SUB -%left TOK_MUL TOK_DIV TOK_MOD -%right UNARY_OP - -%% - -// ---------------------------------------------------------------------- -start -// ---------------------------------------------------------------------- -: expr -{ - parseResult = $1; -} -; - -// ---------------------------------------------------------------------- -expr -// ---------------------------------------------------------------------- -: binary -{ - $$ = $1; -} -; - -// ---------------------------------------------------------------------- -binary -// ---------------------------------------------------------------------- -: binary TOK_LESS_THAN binary -{ - $$ = new BinaryNode(BinOpLess, parseDataFactory, $1, $3); -} -| binary TOK_GREATER_THAN binary -{ - $$ = new BinaryNode(BinOpGreater, parseDataFactory, $1, $3); -} -| binary TOK_LESS_EQUAL binary -{ - $$ = new BinaryNode(BinOpLessEq, parseDataFactory, $1, $3); -} -| binary TOK_GREATER_EQUAL binary -{ - $$ = new BinaryNode(BinOpGrEq, parseDataFactory, $1, $3); -} -| binary TOK_EQUAL binary -{ - $$ = new BinaryNode(BinOpEq, parseDataFactory, $1, $3); -} -| binary TOK_NEQ binary -{ - $$ = new BinaryNode(BinOpNotEq, parseDataFactory, $1, $3); -} -| binary TOK_OR binary -{ - $$ = new BinaryNode(BinOpOr, parseDataFactory, $1, $3); -} -| binary TOK_AND binary -{ - $$ = new BinaryNode(BinOpAnd, parseDataFactory, $1, $3); -} -| binary TOK_MUL binary -{ - $$ = new BinaryNode(BinOpMul, parseDataFactory, $1, $3); -} -| binary TOK_DIV binary -{ - $$ = new BinaryNode(BinOpDiv, parseDataFactory, $1, $3); -} -| binary TOK_MOD binary -{ - $$ = new BinaryNode(BinOpMod, parseDataFactory, $1, $3); -} -| binary TOK_ADD binary -{ - $$ = new BinaryNode(BinOpAdd, parseDataFactory, $1, $3); -} -| binary TOK_SUB binary -{ - $$ = new BinaryNode(BinOpSub, parseDataFactory, $1, $3); -} -| unary -{ - $$ = $1; -} -; - -// ---------------------------------------------------------------------- -unary -// ---------------------------------------------------------------------- -: TOK_LPAREN expr TOK_RPAREN -{ - $$ = $2; -} -| TOK_SUB unary %prec UNARY_OP -{ - $$ = new UnaryNode(UnaryOpNeg, parseDataFactory, $2); -} -| TOK_NOT unary %prec UNARY_OP -{ - $$ = new UnaryNode(UnaryOpNot, parseDataFactory, $2); -} -| TOK_INTEGER_LITERAL -{ - IntegerTokPtr intVal = IntegerTokPtr::dynamicCast($1); - assert(intVal); - $$ = new DataNode(parseDataFactory->createInteger(intVal->v, true)); -} -| TOK_FLOATING_POINT_LITERAL -{ - FloatingTokPtr floatVal = FloatingTokPtr::dynamicCast($1); - assert(floatVal); - $$ = new DataNode(parseDataFactory->createDouble(floatVal->v, true)); -} -| TOK_STRING_LITERAL -{ - StringTokPtr stringVal = StringTokPtr::dynamicCast($1); - assert(stringVal); - $$ = new DataNode(parseDataFactory->createString(stringVal->v, true)); -} -| TOK_TRUE -{ - $$ = new DataNode(parseDataFactory->createBoolean(true, true)); -} -| TOK_FALSE -{ - $$ = new DataNode(parseDataFactory->createBoolean(false, true)); -} -| TOK_NIL -{ - $$ = new DataNode(parseDataFactory->createNil(true)); -} -| entity -{ - $$ = $1; -} -| entity '.' function -{ - EntityNodePtr entity = EntityNodePtr::dynamicCast($1); - assert(entity); - FunctionNodePtr func = FunctionNodePtr::dynamicCast($3); - assert(func); - func->setTarget(entity); - $$ = $3; -} -| function -{ - $$ = $1; -} -| constant -{ - StringTokPtr stringVal = StringTokPtr::dynamicCast($1); - assert(stringVal); - $$ = new ConstantNode(stringVal->v); -} -; - -// ---------------------------------------------------------------------- -entity -// ---------------------------------------------------------------------- -: entity TOK_LBRACKET expr TOK_RBRACKET -{ - EntityNodePtr entity = EntityNodePtr::dynamicCast($1); - assert(entity); - entity->append(new ElementNode($3)); - $$ = $1; -} -| entity '.' TOK_IDENTIFIER -{ - StringTokPtr stringVal = StringTokPtr::dynamicCast($3); - assert(stringVal); - EntityNodePtr entity = EntityNodePtr::dynamicCast($1); - assert(entity); - entity->append(new IdentNode(stringVal->v)); - $$ = $1; -} -| TOK_IDENTIFIER -{ - StringTokPtr stringVal = StringTokPtr::dynamicCast($1); - assert(stringVal); - $$ = new IdentNode(stringVal->v); -} -; - -// ---------------------------------------------------------------------- -function -// ---------------------------------------------------------------------- -: TOK_IDENTIFIER TOK_LPAREN arg_list TOK_RPAREN -{ - StringTokPtr func = StringTokPtr::dynamicCast($1); - assert(func); - NodeListTokPtr args = NodeListTokPtr::dynamicCast($3); - assert(args); - $$ = new FunctionNode(func->v, args->v); -} -; - -// ---------------------------------------------------------------------- -arg_list -// ---------------------------------------------------------------------- -: arg_list ',' expr -{ - NodeListTokPtr l = NodeListTokPtr::dynamicCast($1); - assert(l); - l->v.push_back($3); - $$ = $1; -} -| expr -{ - NodeListTokPtr result = new NodeListTok; - result->v.push_back($1); - $$ = result; -} -| -{ - $$ = new NodeListTok; -} -; - -// ---------------------------------------------------------------------- -constant -// ---------------------------------------------------------------------- -: constant TOK_SCOPE_DELIMITER TOK_IDENTIFIER -{ - StringTokPtr stringVal = StringTokPtr::dynamicCast($1); - assert(stringVal); - StringTokPtr idVal = StringTokPtr::dynamicCast($3); - assert(idVal); - stringVal->v.append("::" + idVal->v); - $$ = $1; -} -| TOK_SCOPE_DELIMITER TOK_IDENTIFIER -{ - StringTokPtr idVal = StringTokPtr::dynamicCast($2); - assert(idVal); - StringTokPtr stringVal = new StringTok; - stringVal->v.append("::" + idVal->v); - $$ = stringVal; -} -; - -%% diff --git a/cpp/src/FreezeScript/GrammarUtil.h b/cpp/src/FreezeScript/GrammarUtil.h deleted file mode 100644 index 5605bc34c70..00000000000 --- a/cpp/src/FreezeScript/GrammarUtil.h +++ /dev/null @@ -1,136 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_SCRIPT_GRAMMAR_UTIL_H -#define FREEZE_SCRIPT_GRAMMAR_UTIL_H - -#include - -namespace FreezeScript -{ - -extern DataFactoryPtr parseDataFactory; -extern ErrorReporterPtr parseErrorReporter; -extern NodePtr parseResult; -extern int parseLine; - -int getInput(char*, int); - -class StringTok; -class IdentifierTok; -class BoolTok; -class IntegerTok; -class FloatingTok; -class NodeListTok; - -typedef ::IceUtil::Handle StringTokPtr; -typedef ::IceUtil::Handle IdentifierTokPtr; -typedef ::IceUtil::Handle BoolTokPtr; -typedef ::IceUtil::Handle IntegerTokPtr; -typedef ::IceUtil::Handle FloatingTokPtr; -typedef ::IceUtil::Handle NodeListTokPtr; - -// ---------------------------------------------------------------------- -// Token -// ---------------------------------------------------------------------- - -class Token : public Node -{ -public: - - Token() { } - virtual DataPtr evaluate(const SymbolTablePtr&) { return 0; } - virtual void print(std::ostream&) const {} -}; - -// ---------------------------------------------------------------------- -// StringTok -// ---------------------------------------------------------------------- - -class StringTok : public Token -{ -public: - - StringTok() { } - - std::string v; -}; - -// ---------------------------------------------------------------------- -// BoolTok -// ---------------------------------------------------------------------- - -class BoolTok : public Token -{ -public: - - BoolTok() { } - bool v; -}; - -// ---------------------------------------------------------------------- -// IntegerTok -// ---------------------------------------------------------------------- - -class IntegerTok : public Token -{ -public: - - IntegerTok() { } - IceUtil::Int64 v; -}; - -// ---------------------------------------------------------------------- -// FloatingTok -// ---------------------------------------------------------------------- - -class FloatingTok : public Token -{ -public: - - FloatingTok() { } - double v; -}; - -class NodeListTok : public Token -{ -public: - - NodeListTok() { } - NodeList v; -}; - -} // End of namespace FreezeScript - -// -// Stuff for flex and bison -// - -#define YYSTYPE FreezeScript::NodePtr -#define YY_DECL int freeze_script_lex(YYSTYPE* yylvalp) -YY_DECL; -int freeze_script_parse(); - -// -// I must set the initial stack depth to the maximum stack depth to -// disable bison stack resizing. The bison stack resizing routines use -// simple malloc/alloc/memcpy calls, which do not work for the -// YYSTYPE, since YYSTYPE is a C++ type, with constructor, destructor, -// assignment operator, etc. -// -#define YYMAXDEPTH 10000 -#define YYINITDEPTH YYMAXDEPTH // Initial depth is set to max depth, for the reasons described above. - -// -// Newer bison versions allow to disable stack resizing by defining -// yyoverflow. -// -#define yyoverflow(a, b, c, d, e, f) freeze_script_error(a) - -#endif diff --git a/cpp/src/FreezeScript/Makefile b/cpp/src/FreezeScript/Makefile deleted file mode 100644 index cd25fd9f481..00000000000 --- a/cpp/src/FreezeScript/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -# -# This copy of Ice is licensed to you under the terms described in the -# ICE_LICENSE file included in this distribution. -# -# ********************************************************************** - -top_srcdir = ../.. - -TRANSFORMDB = $(bindir)/transformdb -DUMPDB = $(bindir)/dumpdb - -TARGETS = $(TRANSFORMDB) $(DUMPDB) - -COMMON_OBJS = AssignVisitor.o \ - Data.o \ - Error.o \ - Exception.o \ - Functions.o \ - Parser.o \ - Print.o \ - Scanner.o \ - Util.o \ - Grammar.o - -TRANSFORM_OBJS = TransformAnalyzer.o \ - TransformVisitor.o \ - Transformer.o \ - transformdb.o - -DUMP_OBJS = DumpDescriptors.o \ - DumpDB.o - -OBJS = $(COMMON_OBJS) $(TRANSFORM_OBJS) $(DUMP_OBJS) - -HDIR = $(headerdir)/FreezeScript - -RPATH_DIR = $(LOADER_PATH)/../$(libsubdir) - -include $(top_srcdir)/config/Make.rules - -CPPFLAGS := -I.. $(CPPFLAGS) $(DB_FLAGS) -BISONFLAGS := --name-prefix "freeze_script_" $(BISONFLAGS) - -$(TRANSFORMDB): $(TRANSFORM_OBJS) $(COMMON_OBJS) - rm -f $@ - $(CXX) $(LDFLAGS) $(LDEXEFLAGS) -o $@ $(TRANSFORM_OBJS) $(COMMON_OBJS) -lSlice $(EXPAT_RPATH_LINK) -lIceXML $(DB_RPATH_LINK) -lFreeze $(LIBS) $(DB_LIBS) - -$(DUMPDB): $(DUMP_OBJS) $(COMMON_OBJS) - rm -f $@ - $(CXX) $(LDFLAGS) $(LDEXEFLAGS) -o $@ $(DUMP_OBJS) $(COMMON_OBJS) -lSlice $(EXPAT_RPATH_LINK) -lIceXML $(DB_RPATH_LINK) -lFreeze $(LIBS) $(DB_LIBS) - -install:: all - $(call installprogram,$(TRANSFORMDB),$(DESTDIR)$(install_bindir)) - $(call installdata,$(top_srcdir)/../man/man1/transformdb.1,$(DESTDIR)$(install_mandir)) - $(call installprogram,$(DUMPDB),$(DESTDIR)$(install_bindir)) - $(call installdata,$(top_srcdir)/../man/man1/dumpdb.1,$(DESTDIR)$(install_mandir)) diff --git a/cpp/src/FreezeScript/Makefile.mak b/cpp/src/FreezeScript/Makefile.mak deleted file mode 100644 index 6743beb4dc4..00000000000 --- a/cpp/src/FreezeScript/Makefile.mak +++ /dev/null @@ -1,90 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -# -# This copy of Ice is licensed to you under the terms described in the -# ICE_LICENSE file included in this distribution. -# -# ********************************************************************** - -top_srcdir = ..\.. - -TRANSFORMDB = $(top_srcdir)\bin\transformdb.exe -DUMPDB = $(top_srcdir)\bin\dumpdb.exe - -TARGETS = $(TRANSFORMDB) $(DUMPDB) - -BISON_FLEX_OBJS = .\Grammar.obj \ - .\Scanner.obj - -COMMON_OBJS = .\AssignVisitor.obj \ - .\Data.obj \ - .\Error.obj \ - .\Functions.obj \ - .\Exception.obj \ - .\Parser.obj \ - .\Print.obj \ - .\Util.obj \ - $(BISON_FLEX_OBJS) - -TRANSFORM_OBJS = .\TransformAnalyzer.obj \ - .\TransformVisitor.obj \ - .\Transformer.obj \ - .\transformdb.obj - -DUMP_OBJS = .\DumpDescriptors.obj \ - .\DumpDB.obj - -OBJS = $(COMMON_OBJS) $(TRANSFORM_OBJS) $(DUMP_OBJS) - -HDIR = $(headerdir)\FreezeScript - -!include $(top_srcdir)/config/Make.rules.mak - -$(OBJS) : $(DB_NUPKG) - -CPPFLAGS = -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN $(DB_CPPFLAGS) -BISONFLAGS = --name-prefix "freeze_script_" $(BISONFLAGS) - -LINKWITH = $(LIBS) $(DB_LIBS) - -!if "$(GENERATE_PDB)" == "yes" -TPDBFLAGS = /pdb:$(TRANSFORMDB:.exe=.pdb) -DPDBFLAGS = /pdb:$(DUMPDB:.exe=.pdb) -!endif - -TRES_FILE = TransformDB.res -DRES_FILE = DumpDB.res - -$(TRANSFORMDB): $(TRANSFORM_OBJS) $(COMMON_OBJS) TransformDB.res - $(LINK) $(LD_EXEFLAGS) $(DB_LDFLAGS) $(TPDBFLAGS) $(TRANSFORM_OBJS) $(COMMON_OBJS) $(SETARGV) $(PREOUT)$@ \ - $(PRELIBS)$(LINKWITH) $(TRES_FILE) - @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ - $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest - @if defined SIGN_CERTIFICATE echo ^ ^ ^ Signing $@ && \ - signtool sign /f "$(SIGN_CERTIFICATE)" /p $(SIGN_PASSWORD) /t $(SIGN_TIMESTAMPSERVER) $@ - -$(DUMPDB): $(DUMP_OBJS) $(COMMON_OBJS) DumpDB.res - $(LINK) $(LD_EXEFLAGS) $(DB_LDFLAGS) $(DPDBFLAGS) $(DUMP_OBJS) $(COMMON_OBJS) $(SETARGV) $(PREOUT)$@ \ - $(PRELIBS)$(LINKWITH) $(DRES_FILE) - @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ - $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest - @if defined SIGN_CERTIFICATE echo ^ ^ ^ Signing $@ && \ - signtool sign /f "$(SIGN_CERTIFICATE)" /p $(SIGN_PASSWORD) /t $(SIGN_TIMESTAMPSERVER) $@ - -clean:: - -del /q $(TRANSFORMDB:.exe=.*) - -del /q $(DUMPDB:.exe=.*) - -del /q TransformDB.res DumpDB.res - -install:: all - copy $(TRANSFORMDB) "$(install_bindir)" - copy $(DUMPDB) "$(install_bindir)" - -!if "$(GENERATE_PDB)" == "yes" - -install:: all - copy $(TRANSFORMDB:.exe=.pdb) "$(install_bindir)" - copy $(DUMPDB:.exe=.pdb) "$(install_bindir)" - -!endif diff --git a/cpp/src/FreezeScript/Parser.cpp b/cpp/src/FreezeScript/Parser.cpp deleted file mode 100644 index f5fbe129ae3..00000000000 --- a/cpp/src/FreezeScript/Parser.cpp +++ /dev/null @@ -1,728 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include - -using namespace std; - -namespace FreezeScript -{ - -class EntityNodePrinter : public EntityNodeVisitor -{ -public: - - EntityNodePrinter(ostream& os) : - _os(os), _first(true) - { - } - - virtual void - visitIdentifier(const std::string& name) - { - if(_first) - { - _first = false; - } - else - { - _os << '.'; - } - _os << name; - } - - virtual void - visitElement(const NodePtr& value) - { - assert(!_first); - _os << '['; - value->print(_os); - _os << ']'; - } - -private: - - ostream& _os; - bool _first; -}; - -} // End of namespace FreezeScript - -// -// Globals required by the Bison grammar. -// -FreezeScript::DataFactoryPtr FreezeScript::parseDataFactory; -FreezeScript::ErrorReporterPtr FreezeScript::parseErrorReporter; -FreezeScript::NodePtr FreezeScript::parseResult; -int FreezeScript::parseLine; - -namespace -{ - -string _input; -string::size_type _pos; - -IceUtil::Mutex* _parserMutex = 0; - -class Init -{ -public: - - Init() - { - _parserMutex = new IceUtil::Mutex; - } - - ~Init() - { - delete _parserMutex; - _parserMutex = 0; - } -}; - -Init init; - -} - -// -// parseExpression -// -FreezeScript::NodePtr -FreezeScript::parseExpression(const string& expr, const DataFactoryPtr& factory, const ErrorReporterPtr& errorReporter) -{ - // - // The bison grammar is not thread-safe. - // - IceUtilInternal::MutexPtrLock sync(_parserMutex); - - parseDataFactory = factory; - parseErrorReporter = errorReporter; - parseLine = 1; - - parseErrorReporter->setExpression(expr); - - _input = expr; - _pos = 0; - - int status = freeze_script_parse(); - if(status != 0) - { - parseResult = 0; - } - - parseErrorReporter->clearExpression(); - parseErrorReporter = 0; - - return parseResult; -} - -// -// getInput supplies characters to the lexical scanner. -// -int -FreezeScript::getInput(char* buf, int /*maxSize*/) -{ - if(_pos < _input.length()) - { - buf[0] = _input[_pos]; - _pos++; - return 1; - } - else - { - return 0; - } -} - -// -// EvaluateException -// -FreezeScript::EvaluateException::EvaluateException(const char* file, int line, const string& reason) : - IceUtil::Exception(file, line), _reason(reason) -{ -} - -FreezeScript::EvaluateException::~EvaluateException() throw() -{ -} - -const char* FreezeScript::EvaluateException::_name = "FreezeScript::EvaluateException"; - -string -FreezeScript::EvaluateException::ice_name() const -{ - return _name; -} - -void -FreezeScript::EvaluateException::ice_print(ostream& out) const -{ - Ice::Exception::ice_print(out); - out << ":\nerror occurred while evaluating expression"; - if(!_reason.empty()) - { - out << ":\n" << _reason; - } -} - -FreezeScript::EvaluateException* -FreezeScript::EvaluateException::ice_clone() const -{ - return new EvaluateException(ice_file(), ice_line(), _reason); -} - -void -FreezeScript::EvaluateException::ice_throw() const -{ - throw *this; -} - -string -FreezeScript::EvaluateException::reason() const -{ - return _reason; -} - -// -// SymbolTable -// -FreezeScript::SymbolTable::~SymbolTable() -{ -} - -// -// Node -// -FreezeScript::Node::~Node() -{ -} - -// -// BinaryNode -// -FreezeScript::BinaryNode::BinaryNode(BinaryOperator op, const DataFactoryPtr& factory, const NodePtr& left, - const NodePtr& right) : - _op(op), _factory(factory), _left(left), _right(right) -{ -} - -FreezeScript::DataPtr -FreezeScript::BinaryNode::evaluate(const SymbolTablePtr& st) -{ - DataPtr result; - - switch(_op) - { - case BinOpOr: - { - DataPtr leftValue = _left->evaluate(st); - if(leftValue->booleanValue()) - { - result = leftValue; - } - else - { - result = _right->evaluate(st); - } - break; - } - - case BinOpAnd: - { - DataPtr leftValue = _left->evaluate(st); - if(!leftValue->booleanValue()) - { - result = leftValue; - } - else - { - result = _right->evaluate(st); - } - break; - } - - case BinOpMul: - { - DataPtr leftValue = _left->evaluate(st); - DataPtr rightValue = _right->evaluate(st); - IntegerDataPtr ileft = IntegerDataPtr::dynamicCast(leftValue); - IntegerDataPtr iright = IntegerDataPtr::dynamicCast(rightValue); - if(ileft && iright) - { - result = _factory->createInteger(leftValue->integerValue() * rightValue->integerValue(), true); - } - else - { - result = _factory->createDouble(leftValue->doubleValue(true) * rightValue->doubleValue(true), true); - } - break; - } - - case BinOpDiv: - { - DataPtr leftValue = _left->evaluate(st); - DataPtr rightValue = _right->evaluate(st); - IntegerDataPtr ileft = IntegerDataPtr::dynamicCast(leftValue); - IntegerDataPtr iright = IntegerDataPtr::dynamicCast(rightValue); - if(ileft && iright) - { - result = _factory->createInteger(leftValue->integerValue() / rightValue->integerValue(), true); - } - else - { - result = _factory->createDouble(leftValue->doubleValue(true) / rightValue->doubleValue(true), true); - } - break; - } - - case BinOpMod: - { - DataPtr leftValue = _left->evaluate(st); - DataPtr rightValue = _right->evaluate(st); - result = _factory->createInteger(leftValue->integerValue() % rightValue->integerValue(), true); - break; - } - - case BinOpAdd: - { - DataPtr leftValue = _left->evaluate(st); - DataPtr rightValue = _right->evaluate(st); - StringDataPtr sleft = StringDataPtr::dynamicCast(leftValue); - StringDataPtr sright = StringDataPtr::dynamicCast(rightValue); - IntegerDataPtr ileft = IntegerDataPtr::dynamicCast(leftValue); - IntegerDataPtr iright = IntegerDataPtr::dynamicCast(rightValue); - if(sleft || sright) - { - if(sleft && sright) - { - result = _factory->createString(leftValue->stringValue() + rightValue->stringValue(), true); - } - else - { - _factory->getErrorReporter()->error("string concatenation requires two string arguments"); - } - } - else if(ileft && iright) - { - result = _factory->createInteger(leftValue->integerValue() + rightValue->integerValue(), true); - } - else - { - result = _factory->createDouble(leftValue->doubleValue(true) + rightValue->doubleValue(true), true); - } - break; - } - - case BinOpSub: - { - DataPtr leftValue = _left->evaluate(st); - DataPtr rightValue = _right->evaluate(st); - IntegerDataPtr ileft = IntegerDataPtr::dynamicCast(leftValue); - IntegerDataPtr iright = IntegerDataPtr::dynamicCast(rightValue); - if(ileft && iright) - { - result = _factory->createInteger(leftValue->integerValue() - rightValue->integerValue(), true); - } - else - { - result = _factory->createDouble(leftValue->doubleValue(true) - rightValue->doubleValue(true), true); - } - break; - } - - case BinOpLess: - { - DataPtr leftValue = _left->evaluate(st); - DataPtr rightValue = _right->evaluate(st); - bool b = leftValue < rightValue; - result = _factory->createBoolean(b, true); - break; - } - - case BinOpGreater: - { - DataPtr leftValue = _left->evaluate(st); - DataPtr rightValue = _right->evaluate(st); - bool b = (leftValue < rightValue) || (leftValue == rightValue); - result = _factory->createBoolean(!b, true); - break; - } - - case BinOpLessEq: - { - DataPtr leftValue = _left->evaluate(st); - DataPtr rightValue = _right->evaluate(st); - bool b = (leftValue < rightValue) || (leftValue == rightValue); - result = _factory->createBoolean(b, true); - break; - } - - case BinOpGrEq: - { - DataPtr leftValue = _left->evaluate(st); - DataPtr rightValue = _right->evaluate(st); - bool b = leftValue < rightValue; - result = _factory->createBoolean(!b, true); - break; - } - - case BinOpEq: - { - DataPtr leftValue = _left->evaluate(st); - DataPtr rightValue = _right->evaluate(st); - bool b = leftValue == rightValue; - result = _factory->createBoolean(b, true); - break; - } - - case BinOpNotEq: - { - DataPtr leftValue = _left->evaluate(st); - DataPtr rightValue = _right->evaluate(st); - bool b = leftValue == rightValue; - result = _factory->createBoolean(!b, true); - break; - } - } - - if(!result) - { - throw EvaluateException(__FILE__, __LINE__, "invalid operands to operator " + opToString(_op)); - } - - return result; -} - -void -FreezeScript::BinaryNode::print(ostream& os) const -{ - os << opToString(_op) << ": left="; - _left->print(os); - os << ", right="; - _right->print(os); -} - -string -FreezeScript::BinaryNode::opToString(BinaryOperator op) -{ - switch(op) - { - case BinOpOr: - return "OR"; - - case BinOpAnd: - return "AND"; - - case BinOpMul: - return "*"; - - case BinOpDiv: - return "/"; - - case BinOpMod: - return "%"; - - case BinOpAdd: - return "+"; - - case BinOpSub: - return "-"; - - case BinOpLess: - return "<"; - - case BinOpGreater: - return ">"; - - case BinOpLessEq: - return "<="; - - case BinOpGrEq: - return ">="; - - case BinOpEq: - return "=="; - - case BinOpNotEq: - return "!="; - } - - assert(false); - return string(); -} - -// -// UnaryNode -// -FreezeScript::UnaryNode::UnaryNode(UnaryOperator op, const DataFactoryPtr& factory, const NodePtr& right) : - _op(op), _factory(factory), _right(right) -{ -} - -FreezeScript::DataPtr -FreezeScript::UnaryNode::evaluate(const SymbolTablePtr& st) -{ - DataPtr result; - - switch(_op) - { - case UnaryOpNeg: - { - DataPtr rightValue = _right->evaluate(st); - IntegerDataPtr iright = IntegerDataPtr::dynamicCast(rightValue); - if(iright) - { - result = _factory->createInteger(-rightValue->integerValue(), true); - } - else - { - result = _factory->createDouble(-rightValue->doubleValue(), true); - } - break; - } - - case UnaryOpNot: - { - DataPtr rightValue = _right->evaluate(st); - result = _factory->createBoolean(!rightValue->booleanValue(), true); - break; - } - } - - if(!result) - { - throw EvaluateException(__FILE__, __LINE__, "invalid operand to operator " + opToString(_op)); - } - - return result; -} - -void -FreezeScript::UnaryNode::print(ostream& os) const -{ - os << opToString(_op) << ": right="; - _right->print(os); -} - -string -FreezeScript::UnaryNode::opToString(UnaryOperator op) -{ - switch(op) - { - case UnaryOpNeg: - return "-"; - - case UnaryOpNot: - return "!"; - } - - assert(false); - return string(); -} - -// -// DataNode -// -FreezeScript::DataNode::DataNode(const DataPtr& data) : - _data(data) -{ -} - -FreezeScript::DataPtr -FreezeScript::DataNode::evaluate(const SymbolTablePtr&) -{ - return _data; -} - -void -FreezeScript::DataNode::print(ostream& /*os*/) const -{ - // TODO - //_data->print(os); -} - -// -// EntityNodeVisitor -// -FreezeScript::EntityNodeVisitor::~EntityNodeVisitor() -{ -} - -// -// EntityNode -// -FreezeScript::DataPtr -FreezeScript::EntityNode::evaluate(const SymbolTablePtr& st) -{ - DataPtr result = st->getValue(this); - if(!result) - { - ostringstream ostr; - print(ostr); - throw EvaluateException(__FILE__, __LINE__, "unknown entity `" + ostr.str() + "'"); - } - return result; -} - -void -FreezeScript::EntityNode::print(ostream& os) const -{ - EntityNodePrinter printer(os); - visit(printer); -} - -void -FreezeScript::EntityNode::append(const EntityNodePtr& next) -{ - if(_next) - { - _next->append(next); - } - else - { - _next = next; - } -} - -// -// IdentNode -// -FreezeScript::IdentNode::IdentNode(const string& value) : - _value(value) -{ -} - -string -FreezeScript::IdentNode::getValue() const -{ - return _value; -} - -void -FreezeScript::IdentNode::visit(EntityNodeVisitor& visitor) const -{ - visitor.visitIdentifier(_value); - if(_next) - { - _next->visit(visitor); - } -} - -// -// ElementNode -// -FreezeScript::ElementNode::ElementNode(const NodePtr& value) : - _value(value) -{ -} - -FreezeScript::NodePtr -FreezeScript::ElementNode::getValue() const -{ - return _value; -} - -void -FreezeScript::ElementNode::visit(EntityNodeVisitor& visitor) const -{ - visitor.visitElement(_value); - if(_next) - { - _next->visit(visitor); - } -} - -// -// FunctionNode -// -FreezeScript::FunctionNode::FunctionNode(const string& name, const NodeList& args) : - _name(name), _args(args) -{ -} - -FreezeScript::DataPtr -FreezeScript::FunctionNode::evaluate(const SymbolTablePtr& st) -{ - DataPtr target; - if(_target) - { - target = _target->evaluate(st); - } - DataList args; - for(NodeList::iterator p = _args.begin(); p != _args.end(); ++p) - { - args.push_back((*p)->evaluate(st)); - } - return st->invokeFunction(_name, target, args); -} - -void -FreezeScript::FunctionNode::print(ostream& os) const -{ - if(_target) - { - _target->print(os); - os << '.'; - } - os << _name << '('; - for(NodeList::const_iterator p = _args.begin(); p != _args.end(); ++p) - { - if(p != _args.begin()) - { - os << ", "; - } - (*p)->print(os); - } - os << ')'; -} - -void -FreezeScript::FunctionNode::setTarget(const EntityNodePtr& target) -{ - _target = target; -} - -// -// ConstantNode -// -FreezeScript::ConstantNode::ConstantNode(const string& value) : - _value(value) -{ -} - -FreezeScript::DataPtr -FreezeScript::ConstantNode::evaluate(const SymbolTablePtr& st) -{ - DataPtr result = st->getConstantValue(_value); - if(!result) - { - throw EvaluateException(__FILE__, __LINE__, "unknown constant `" + _value + "'"); - } - return result; -} - -void -FreezeScript::ConstantNode::print(ostream& os) const -{ - os << _value; -} - -// -// Stream insertion for an entity node. -// -ostream& -operator<<(ostream& os, const FreezeScript::EntityNodePtr& entity) -{ - FreezeScript::EntityNodePrinter printer(os); - entity->visit(printer); - return os; -} diff --git a/cpp/src/FreezeScript/Parser.h b/cpp/src/FreezeScript/Parser.h deleted file mode 100644 index 213d615022f..00000000000 --- a/cpp/src/FreezeScript/Parser.h +++ /dev/null @@ -1,251 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_SCRIPT_PARSER_H -#define FREEZE_SCRIPT_PARSER_H - -#include - -namespace FreezeScript -{ - -class SymbolTable; -typedef IceUtil::Handle SymbolTablePtr; - -class Node; -typedef IceUtil::Handle NodePtr; - -typedef std::vector NodeList; - -class EntityNode; -typedef IceUtil::Handle EntityNodePtr; - -// -// parseExpression parses the given expression and returns the root node of the parse tree. -// -NodePtr parseExpression(const std::string&, const DataFactoryPtr&, const ErrorReporterPtr&); - -// -// EvaluateException is raised by Node::evaluate(). -// -class EvaluateException : public IceUtil::Exception -{ -public: - - EvaluateException(const char*, int, const std::string&); - virtual ~EvaluateException() throw(); - virtual std::string ice_name() const; - virtual void ice_print(std::ostream&) const; - virtual EvaluateException* ice_clone() const; - virtual void ice_throw() const; - - std::string reason() const; - -private: - - std::string _reason; - static const char* _name; -}; - -// -// SymbolTable is an interface for the lookup operations required by node evaluation. -// -class SymbolTable : public IceUtil::SimpleShared -{ -public: - - virtual ~SymbolTable(); - - virtual void add(const std::string&, const DataPtr&) = 0; - - virtual DataPtr getValue(const EntityNodePtr&) const = 0; - - virtual DataPtr getConstantValue(const std::string&) const = 0; - - virtual SymbolTablePtr createChild() = 0; - - virtual Slice::TypePtr lookupType(const std::string&) = 0; - - virtual DataPtr invokeFunction(const std::string&, const DataPtr&, const DataList&) = 0; -}; - -class Node : public IceUtil::SimpleShared -{ -public: - - virtual ~Node(); - - virtual DataPtr evaluate(const SymbolTablePtr&) = 0; - - virtual void print(std::ostream&) const = 0; -}; - -enum BinaryOperator -{ - BinOpOr, BinOpAnd, - BinOpMul, BinOpDiv, BinOpMod, - BinOpAdd, BinOpSub, - BinOpLess, BinOpGreater, BinOpLessEq, BinOpGrEq, BinOpEq, BinOpNotEq -}; - -class BinaryNode : public Node -{ -public: - - BinaryNode(BinaryOperator, const DataFactoryPtr&, const NodePtr&, const NodePtr&); - - virtual DataPtr evaluate(const SymbolTablePtr&); - - virtual void print(std::ostream&) const; - -private: - - static std::string opToString(BinaryOperator); - - BinaryOperator _op; - DataFactoryPtr _factory; - NodePtr _left; - NodePtr _right; -}; - -enum UnaryOperator { UnaryOpNeg, UnaryOpNot }; - -class UnaryNode : public Node -{ -public: - - UnaryNode(UnaryOperator, const DataFactoryPtr&, const NodePtr&); - - virtual DataPtr evaluate(const SymbolTablePtr&); - - virtual void print(std::ostream&) const; - -private: - - static std::string opToString(UnaryOperator); - - UnaryOperator _op; - DataFactoryPtr _factory; - NodePtr _right; -}; - -class DataNode : public Node -{ -public: - - DataNode(const DataPtr&); - - virtual DataPtr evaluate(const SymbolTablePtr&); - - virtual void print(std::ostream&) const; - -private: - - DataPtr _data; -}; - -class EntityNodeVisitor -{ -public: - - virtual ~EntityNodeVisitor(); - - virtual void visitIdentifier(const std::string&) = 0; - virtual void visitElement(const NodePtr&) = 0; -}; - -class EntityNode : public Node -{ -public: - - virtual DataPtr evaluate(const SymbolTablePtr&); - - virtual void print(std::ostream&) const; - - virtual void visit(EntityNodeVisitor&) const = 0; - - void append(const EntityNodePtr&); - -protected: - - EntityNodePtr _next; -}; - -class IdentNode : public EntityNode -{ -public: - - IdentNode(const std::string&); - - virtual void visit(EntityNodeVisitor&) const; - - std::string getValue() const; - -private: - - std::string _value; -}; -typedef IceUtil::Handle IdentNodePtr; - -class ElementNode : public EntityNode -{ -public: - - ElementNode(const NodePtr&); - - virtual void visit(EntityNodeVisitor&) const; - - NodePtr getValue() const; - -private: - - NodePtr _value; -}; -typedef IceUtil::Handle ElementNodePtr; - -class FunctionNode : public Node -{ -public: - - FunctionNode(const std::string&, const NodeList&); - - virtual DataPtr evaluate(const SymbolTablePtr&); - - virtual void print(std::ostream&) const; - - void setTarget(const EntityNodePtr&); - -private: - - std::string _name; - NodeList _args; - EntityNodePtr _target; -}; -typedef IceUtil::Handle FunctionNodePtr; - -class ConstantNode : public Node -{ -public: - - ConstantNode(const std::string&); - - virtual DataPtr evaluate(const SymbolTablePtr&); - - virtual void print(std::ostream&) const; - -private: - - std::string _value; -}; - -} // End of namespace FreezeScript - -std::ostream& operator<<(std::ostream&, const FreezeScript::EntityNodePtr&); - -#endif diff --git a/cpp/src/FreezeScript/Print.cpp b/cpp/src/FreezeScript/Print.cpp deleted file mode 100644 index 7709301e12f..00000000000 --- a/cpp/src/FreezeScript/Print.cpp +++ /dev/null @@ -1,233 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include - -using namespace std; -using namespace IceUtil; -using namespace IceUtilInternal; - -namespace FreezeScript -{ - -class PrintVisitor : public DataVisitor -{ -public: - - PrintVisitor(ostream&); - ~PrintVisitor(); - - virtual void visitBoolean(const BooleanDataPtr&); - virtual void visitInteger(const IntegerDataPtr&); - virtual void visitDouble(const DoubleDataPtr&); - virtual void visitString(const StringDataPtr&); - virtual void visitProxy(const ProxyDataPtr&); - virtual void visitStruct(const StructDataPtr&); - virtual void visitSequence(const SequenceDataPtr&); - virtual void visitEnum(const EnumDataPtr&); - virtual void visitDictionary(const DictionaryDataPtr&); - virtual void visitObject(const ObjectRefPtr&); - -private: - - void printObjectMembers(const Slice::ClassDefPtr&, const DataMemberMap&); - - IceUtilInternal::Output _out; - typedef map ObjectHistoryMap; - ObjectHistoryMap _objectHistory; - int _objectCount; -}; - -} // End of namespace FreezeScript - -// -// printData -// -void -FreezeScript::printData(const DataPtr& data, ostream& os) -{ - PrintVisitor visitor(os); - data->visit(visitor); -} - -// -// PrintVisitor -// -FreezeScript::PrintVisitor::PrintVisitor(ostream& os) : - _out(os), _objectCount(0) -{ -} - -FreezeScript::PrintVisitor::~PrintVisitor() -{ -} - -void -FreezeScript::PrintVisitor::visitBoolean(const BooleanDataPtr& data) -{ - _out << "bool(" << data->toString() << ")"; -} - -void -FreezeScript::PrintVisitor::visitInteger(const IntegerDataPtr& data) -{ - _out << typeToString(data->getType()) << "(" << data->toString() << ")"; -} - -void -FreezeScript::PrintVisitor::visitDouble(const DoubleDataPtr& data) -{ - _out << typeToString(data->getType()) << "(" << data->toString() << ")"; -} - -void -FreezeScript::PrintVisitor::visitString(const StringDataPtr& data) -{ - _out << "'" << data->toString() << "'"; -} - -void -FreezeScript::PrintVisitor::visitProxy(const ProxyDataPtr& data) -{ - string str = data->toString(); - _out << typeToString(data->getType()) << '(' << (str.empty() ? string("nil") : str) << ')'; -} - -void -FreezeScript::PrintVisitor::visitStruct(const StructDataPtr& data) -{ - Slice::StructPtr type = Slice::StructPtr::dynamicCast(data->getType()); - assert(type); - _out << "struct " << typeToString(type); - _out << sb; - // - // Print members in order of declaration. - // - Slice::DataMemberList l = type->dataMembers(); - DataMemberMap members = data->getMembers(); - for(Slice::DataMemberList::const_iterator p = l.begin(); p != l.end(); ++p) - { - DataMemberMap::const_iterator q = members.find((*p)->name()); - assert(q != members.end()); - _out << nl; - _out << q->first << " = "; - q->second->visit(*this); - } - _out << eb; -} - -void -FreezeScript::PrintVisitor::visitSequence(const SequenceDataPtr& data) -{ - DataList& elements = data->getElements(); - _out << "sequence " << typeToString(data->getType()) << " (size = " << elements.size() << ")"; - _out << sb; - Ice::Int i = 0; - for(DataList::const_iterator p = elements.begin(); p != elements.end(); ++p, ++i) - { - _out << nl << "[" << i << "] = "; - (*p)->visit(*this); - } - _out << eb; -} - -void -FreezeScript::PrintVisitor::visitEnum(const EnumDataPtr& data) -{ - _out << typeToString(data->getType()) << "(" << data->toString() << ")"; -} - -void -FreezeScript::PrintVisitor::visitDictionary(const DictionaryDataPtr& data) -{ - DataMap& map = data->getElements(); - _out << "dictionary " << typeToString(data->getType()) << " (size = " << map.size() << ")"; - _out << sb; - for(DataMap::const_iterator p = map.begin(); p != map.end(); ++p) - { - _out << nl; - p->first->visit(*this); - _out << " => "; - p->second->visit(*this); - } - _out << eb; -} - -void -FreezeScript::PrintVisitor::visitObject(const ObjectRefPtr& data) -{ - ObjectDataPtr value = data->getValue(); - if(!value) - { - _out << typeToString(data->getType()) << "(nil)"; - } - else - { - Slice::TypePtr type = value->getType(); - Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(type); // May be nil for Ice::Object - - _out << "class " << typeToString(type); - ObjectHistoryMap::iterator p = _objectHistory.find(value.get()); - if(p != _objectHistory.end()) - { - ostringstream ostr; - ostr << " (object #" << p->second << ")"; - _out << ostr.str(); - } - else - { - _objectHistory.insert(ObjectHistoryMap::value_type(value.get(), _objectCount)); - ostringstream ostr; - ostr << " (object #" << _objectCount << ")"; - _out << ostr.str(); - _objectCount++; - _out << sb; - - DataMemberMap members = value->getMembers(); - - // - // If Ice::Object had any members, this is where we would print them. - // - - if(decl) - { - Slice::ClassDefPtr def = decl->definition(); - assert(def); - printObjectMembers(def, members); - } - - _out << eb; - } - } -} - -void -FreezeScript::PrintVisitor::printObjectMembers(const Slice::ClassDefPtr& type, const DataMemberMap& members) -{ - Slice::ClassList bases = type->bases(); - if(!bases.empty() && !bases.front()->isAbstract()) - { - printObjectMembers(bases.front(), members); - } - - // - // Print members in order of declaration. - // - Slice::DataMemberList l = type->dataMembers(); - for(Slice::DataMemberList::const_iterator p = l.begin(); p != l.end(); ++p) - { - DataMemberMap::const_iterator q = members.find((*p)->name()); - assert(q != members.end()); - _out << nl; - _out << q->first << " = "; - q->second->visit(*this); - } -} diff --git a/cpp/src/FreezeScript/Print.h b/cpp/src/FreezeScript/Print.h deleted file mode 100644 index 0ce50cadea4..00000000000 --- a/cpp/src/FreezeScript/Print.h +++ /dev/null @@ -1,22 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_SCRIPT_PRINT_H -#define FREEZE_SCRIPT_PRINT_H - -#include - -namespace FreezeScript -{ - -void printData(const DataPtr&, std::ostream&); - -} // End of namespace FreezeScript - -#endif diff --git a/cpp/src/FreezeScript/Scanner.cpp b/cpp/src/FreezeScript/Scanner.cpp deleted file mode 100644 index 35aa5e2e5c6..00000000000 --- a/cpp/src/FreezeScript/Scanner.cpp +++ /dev/null @@ -1,2253 +0,0 @@ -#include -#line 2 "lex.yy.c" - -#line 4 "lex.yy.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define yy_create_buffer freeze_script__create_buffer -#define yy_delete_buffer freeze_script__delete_buffer -#define yy_flex_debug freeze_script__flex_debug -#define yy_init_buffer freeze_script__init_buffer -#define yy_flush_buffer freeze_script__flush_buffer -#define yy_load_buffer_state freeze_script__load_buffer_state -#define yy_switch_to_buffer freeze_script__switch_to_buffer -#define yyin freeze_script_in -#define yyleng freeze_script_leng -#define yylex freeze_script_lex -#define yylineno freeze_script_lineno -#define yyout freeze_script_out -#define yyrestart freeze_script_restart -#define yytext freeze_script_text -#define yywrap freeze_script_wrap -#define yyalloc freeze_script_alloc -#define yyrealloc freeze_script_realloc -#define yyfree freeze_script_free - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE freeze_script_restart(freeze_script_in ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#define YY_BUF_SIZE 16384 -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -extern int freeze_script_leng; - -extern FILE *freeze_script_in, *freeze_script_out; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up freeze_script_text. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up freeze_script_text again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via freeze_script_restart()), so that the user can continue scanning by - * just pointing freeze_script_in at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when freeze_script_text is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int freeze_script_leng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow freeze_script_wrap()'s to do buffer switches - * instead of setting up a fresh freeze_script_in. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void freeze_script_restart (FILE *input_file ); -void freeze_script__switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE freeze_script__create_buffer (FILE *file,int size ); -void freeze_script__delete_buffer (YY_BUFFER_STATE b ); -void freeze_script__flush_buffer (YY_BUFFER_STATE b ); -void freeze_script_push_buffer_state (YY_BUFFER_STATE new_buffer ); -void freeze_script_pop_buffer_state (void ); - -static void freeze_script_ensure_buffer_stack (void ); -static void freeze_script__load_buffer_state (void ); -static void freeze_script__init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER freeze_script__flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE freeze_script__scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE freeze_script__scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE freeze_script__scan_bytes (yyconst char *bytes,int len ); - -void *freeze_script_alloc (yy_size_t ); -void *freeze_script_realloc (void *,yy_size_t ); -void freeze_script_free (void * ); - -#define yy_new_buffer freeze_script__create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - freeze_script_ensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - freeze_script__create_buffer(freeze_script_in,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - freeze_script_ensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - freeze_script__create_buffer(freeze_script_in,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -#define freeze_script_wrap(n) 1 -#define YY_SKIP_YYWRAP - -typedef unsigned char YY_CHAR; - -FILE *freeze_script_in = (FILE *) 0, *freeze_script_out = (FILE *) 0; - -typedef int yy_state_type; - -extern int freeze_script_lineno; - -int freeze_script_lineno = 1; - -extern char *freeze_script_text; -#define yytext_ptr freeze_script_text - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up freeze_script_text. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - freeze_script_leng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 26 -#define YY_END_OF_BUFFER 27 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[51] = - { 0, - 0, 0, 27, 25, 8, 8, 25, 4, 19, 5, - 20, 21, 17, 15, 16, 25, 18, 6, 6, 25, - 9, 25, 10, 3, 22, 23, 14, 0, 6, 6, - 7, 2, 1, 7, 6, 0, 0, 24, 11, 13, - 12, 3, 0, 7, 0, 7, 6, 0, 7, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 4, 5, 1, 1, 6, 1, 7, 8, - 9, 10, 11, 1, 12, 13, 14, 15, 16, 16, - 16, 16, 16, 16, 16, 17, 17, 18, 1, 19, - 20, 21, 1, 1, 22, 22, 22, 22, 23, 24, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 26, 1, 27, 1, 25, 1, 22, 22, 22, 22, - - 28, 24, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 29, - 25, 25, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int32_t yy_meta[30] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 1, 1, 3, 3, 3, 1, 1, 1, - 1, 4, 4, 4, 5, 1, 1, 4, 5 - } ; - -static yyconst flex_int16_t yy_base[55] = - { 0, - 0, 0, 72, 104, 104, 104, 51, 104, 104, 104, - 104, 104, 104, 17, 22, 25, 33, 35, 30, 44, - 29, 24, 16, 0, 104, 104, 104, 38, 0, 0, - 50, 104, 104, 0, 2, 45, 0, 104, 104, 104, - 104, 0, 49, 104, 53, 60, 0, 64, 70, 104, - 92, 96, 97, 100 - } ; - -static yyconst flex_int16_t yy_def[55] = - { 0, - 50, 1, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 18, 50, - 50, 50, 50, 51, 50, 50, 50, 50, 18, 19, - 50, 50, 50, 31, 18, 52, 53, 50, 50, 50, - 50, 51, 54, 50, 50, 50, 53, 50, 50, 0, - 50, 50, 50, 50 - } ; - -static yyconst flex_int16_t yy_nxt[134] = - { 0, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, - 23, 24, 24, 24, 24, 25, 26, 24, 24, 28, - 50, 29, 30, 30, 28, 41, 29, 30, 30, 31, - 31, 31, 32, 40, 30, 30, 33, 34, 39, 35, - 35, 30, 31, 31, 31, 45, 45, 36, 50, 48, - 48, 38, 36, 37, 31, 31, 31, 46, 46, 46, - 27, 50, 43, 44, 46, 46, 46, 43, 49, 49, - 49, 50, 50, 44, 49, 49, 49, 50, 50, 50, - 50, 50, 50, 44, 42, 42, 42, 46, 46, 47, - - 47, 49, 49, 3, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50 - } ; - -static yyconst flex_int16_t yy_chk[134] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 14, - 35, 14, 14, 14, 15, 23, 15, 15, 15, 16, - 16, 16, 17, 22, 19, 19, 17, 18, 21, 18, - 18, 18, 28, 28, 28, 36, 36, 18, 19, 43, - 43, 20, 18, 18, 31, 31, 31, 45, 45, 45, - 7, 3, 31, 31, 46, 46, 46, 31, 48, 48, - 48, 0, 0, 46, 49, 49, 49, 0, 0, 0, - 0, 0, 0, 49, 51, 51, 51, 52, 52, 53, - - 53, 54, 54, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int freeze_script__flex_debug; -int freeze_script__flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *freeze_script_text; -#line 1 "Scanner.l" -#line 2 "Scanner.l" - -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include // Before Grammar.h, so that YYSTYPE is defined -#include -#include - -#include -#include - -#include - -#if defined(_MSC_VER) && defined(ICE_64) -// -// '=' : conversion from 'size_t' to 'int', possible loss of data -// The result of fread() is a size_t and gets inserted into an int -// -# pragma warning( 4 : 4267 ) -// -// 'initializing' : conversion from '__int64' to 'int', possible loss of data -// Puts a pointer-difference into an int -// -# pragma warning( 4 : 4244 ) -#endif - -#ifdef _MSC_VER -# ifdef freeze_script_wrap -# undef freeze_script_wrap -# define freeze_script_wrap() 1 -# endif -# define YY_NO_UNISTD_H -#endif - -#ifdef __SUNPRO_CC -# ifdef freeze_script_wrap -# undef freeze_script_wrap -# define freeze_script_wrap() 1 -# endif -# ifdef ICE_64 -# pragma error_messages(off,truncwarn) -# endif -#endif - -using namespace std; -using namespace FreezeScript; - -namespace FreezeScript -{ - -typedef map KeywordMap; -static KeywordMap keywordMap; - -void initScanner(); -int checkKeyword(const string&); -StringTokPtr parseString(char); - -} - -#define YY_USER_INIT initScanner(); - -#define YY_INPUT(buf, result, max_size) { result = getInput(buf, max_size); } -#line 585 "lex.yy.c" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int freeze_script_lex_destroy (void ); - -int freeze_script_get_debug (void ); - -void freeze_script_set_debug (int debug_flag ); - -YY_EXTRA_TYPE freeze_script_get_extra (void ); - -void freeze_script_set_extra (YY_EXTRA_TYPE user_defined ); - -FILE *freeze_script_get_in (void ); - -void freeze_script_set_in (FILE * in_str ); - -FILE *freeze_script_get_out (void ); - -void freeze_script_set_out (FILE * out_str ); - -int freeze_script_get_leng (void ); - -char *freeze_script_get_text (void ); - -int freeze_script_get_lineno (void ); - -void freeze_script_set_lineno (int line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int freeze_script_wrap (void ); -#else -extern int freeze_script_wrap (void ); -#endif -#endif - - static void yyunput (int c,char *buf_ptr ); - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( freeze_script_text, freeze_script_leng, 1, freeze_script_out )) {} } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - unsigned n; \ - for ( n = 0; n < max_size && \ - (c = getc( freeze_script_in )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( freeze_script_in ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, freeze_script_in))==0 && ferror(freeze_script_in)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(freeze_script_in); \ - } \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int freeze_script_lex (void); - -#define YY_DECL int freeze_script_lex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after freeze_script_text and freeze_script_leng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 83 "Scanner.l" - - -#line 770 "lex.yy.c" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! freeze_script_in ) - freeze_script_in = stdin; - - if ( ! freeze_script_out ) - freeze_script_out = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - freeze_script_ensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - freeze_script__create_buffer(freeze_script_in,YY_BUF_SIZE ); - } - - freeze_script__load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of freeze_script_text. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 51 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_current_state != 50 ); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 85 "Scanner.l" -{ - // C++-style comment - int c; - do - { - c = yyinput(); - if(c == '\n') - { - parseLine++; - } - } - while(c != '\n' && c != EOF); -} - YY_BREAK -case 2: -YY_RULE_SETUP -#line 99 "Scanner.l" -{ - // C-style comment - while(true) - { - int c = yyinput(); - if(c == '\n') - { - parseLine++; - } - else if(c == '*') - { - int next = yyinput(); - if(next == '/') - { - break; - } - else - { - unput(next); - } - } - else if(c == EOF) - { - parseErrorReporter->expressionSyntaxError("EOF in comment"); - break; - } - } -} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 128 "Scanner.l" -{ - StringTokPtr ident = new StringTok; - ident->v = freeze_script_text; - *yylvalp = ident; - return checkKeyword(ident->v); -} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 135 "Scanner.l" -{ - StringTokPtr str = parseString('"'); - *yylvalp = str; - return TOK_STRING_LITERAL; -} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 141 "Scanner.l" -{ - StringTokPtr str = parseString('\''); - *yylvalp = str; - return TOK_STRING_LITERAL; -} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 147 "Scanner.l" -{ - IntegerTokPtr itp = new IntegerTok; - *yylvalp = itp; - if(!IceUtilInternal::stringToInt64(string(freeze_script_text), itp->v)) - { - assert(itp->v != 0); - string msg = "integer constant `"; - msg += freeze_script_text; - msg += "' out of range"; - parseErrorReporter->expressionSyntaxError(msg); - } - return TOK_INTEGER_LITERAL; -} - YY_BREAK -case 7: -YY_RULE_SETUP -#line 161 "Scanner.l" -{ - errno = 0; - FloatingTokPtr ftp = new FloatingTok; - *yylvalp = ftp; - string literal(freeze_script_text); - char lastChar = literal[literal.size() - 1]; - if(lastChar == 'f' || lastChar == 'F') - { - literal = literal.substr(0, literal.size() - 1); // Clobber trailing 'f' or 'F' suffix - } - ftp->v = strtod(literal.c_str(), 0); - if((ftp->v == HUGE_VAL || ftp->v == -HUGE_VAL) && errno == ERANGE) - { - string msg = "floating-point constant `"; - msg += freeze_script_text; - msg += "' too large (overflow)"; - parseErrorReporter->expressionSyntaxError(msg); - } - else if(ftp->v == 0 && errno == ERANGE) - { - string msg = "floating-point constant `"; - msg += freeze_script_text; - msg += "' too small (underflow)"; - parseErrorReporter->expressionSyntaxError(msg); - } - return TOK_FLOATING_POINT_LITERAL; -} - YY_BREAK -case 8: -/* rule 8 can match eol */ -YY_RULE_SETUP -#line 189 "Scanner.l" -{ - // Igore white-space - - if(freeze_script_text[0] == '\n') - { - parseLine++; - } -} - YY_BREAK -case 9: -YY_RULE_SETUP -#line 198 "Scanner.l" -return TOK_LESS_THAN; - YY_BREAK -case 10: -YY_RULE_SETUP -#line 199 "Scanner.l" -return TOK_GREATER_THAN; - YY_BREAK -case 11: -YY_RULE_SETUP -#line 200 "Scanner.l" -return TOK_LESS_EQUAL; - YY_BREAK -case 12: -YY_RULE_SETUP -#line 201 "Scanner.l" -return TOK_GREATER_EQUAL; - YY_BREAK -case 13: -YY_RULE_SETUP -#line 202 "Scanner.l" -return TOK_EQUAL; - YY_BREAK -case 14: -YY_RULE_SETUP -#line 203 "Scanner.l" -return TOK_NEQ; - YY_BREAK -case 15: -YY_RULE_SETUP -#line 204 "Scanner.l" -return TOK_ADD; - YY_BREAK -case 16: -YY_RULE_SETUP -#line 205 "Scanner.l" -return TOK_SUB; - YY_BREAK -case 17: -YY_RULE_SETUP -#line 206 "Scanner.l" -return TOK_MUL; - YY_BREAK -case 18: -YY_RULE_SETUP -#line 207 "Scanner.l" -return TOK_DIV; - YY_BREAK -case 19: -YY_RULE_SETUP -#line 208 "Scanner.l" -return TOK_MOD; - YY_BREAK -case 20: -YY_RULE_SETUP -#line 209 "Scanner.l" -return TOK_LPAREN; - YY_BREAK -case 21: -YY_RULE_SETUP -#line 210 "Scanner.l" -return TOK_RPAREN; - YY_BREAK -case 22: -YY_RULE_SETUP -#line 211 "Scanner.l" -return TOK_LBRACKET; - YY_BREAK -case 23: -YY_RULE_SETUP -#line 212 "Scanner.l" -return TOK_RBRACKET; - YY_BREAK -case 24: -YY_RULE_SETUP -#line 213 "Scanner.l" -return TOK_SCOPE_DELIMITER; - YY_BREAK -case 25: -YY_RULE_SETUP -#line 215 "Scanner.l" -{ - return freeze_script_text[0]; -} - YY_BREAK -case 26: -YY_RULE_SETUP -#line 219 "Scanner.l" -ECHO; - YY_BREAK -#line 1079 "lex.yy.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed freeze_script_in at a new source and called - * freeze_script_lex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = freeze_script_in; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( freeze_script_wrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * freeze_script_text, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of freeze_script_lex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - freeze_script_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t) num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - freeze_script_restart(freeze_script_in ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) freeze_script_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 51 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 51 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 50); - - return yy_is_jam ? 0 : yy_current_state; -} - - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up freeze_script_text */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - freeze_script_restart(freeze_script_in ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( freeze_script_wrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve freeze_script_text */ - (yy_hold_char) = *++(yy_c_buf_p); - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void freeze_script_restart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - freeze_script_ensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - freeze_script__create_buffer(freeze_script_in,YY_BUF_SIZE ); - } - - freeze_script__init_buffer(YY_CURRENT_BUFFER,input_file ); - freeze_script__load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void freeze_script__switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * freeze_script_pop_buffer_state(); - * freeze_script_push_buffer_state(new_buffer); - */ - freeze_script_ensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - freeze_script__load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (freeze_script_wrap()) processing, but the only time this flag - * is looked at is after freeze_script_wrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void freeze_script__load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - freeze_script_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE freeze_script__create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) freeze_script_alloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in freeze_script__create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) freeze_script_alloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in freeze_script__create_buffer()" ); - - b->yy_is_our_buffer = 1; - - freeze_script__init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with freeze_script__create_buffer() - * - */ - void freeze_script__delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - freeze_script_free((void *) b->yy_ch_buf ); - - freeze_script_free((void *) b ); -} - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a freeze_script_restart() or at EOF. - */ - static void freeze_script__init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - freeze_script__flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then freeze_script__init_buffer was _probably_ - * called from freeze_script_restart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void freeze_script__flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - freeze_script__load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void freeze_script_push_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - freeze_script_ensure_buffer_stack(); - - /* This block is copied from freeze_script__switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from freeze_script__switch_to_buffer. */ - freeze_script__load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void freeze_script_pop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - freeze_script__delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - freeze_script__load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void freeze_script_ensure_buffer_stack (void) -{ - int num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)freeze_script_alloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in freeze_script_ensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)freeze_script_realloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in freeze_script_ensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE freeze_script__scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) freeze_script_alloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in freeze_script__scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - freeze_script__switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to freeze_script_lex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * freeze_script__scan_bytes() instead. - */ -YY_BUFFER_STATE freeze_script__scan_string (yyconst char * yystr ) -{ - - return freeze_script__scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to freeze_script_lex() will - * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE freeze_script__scan_bytes (yyconst char * yybytes, int _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) freeze_script_alloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in freeze_script__scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = freeze_script__scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in freeze_script__scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up freeze_script_text. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - freeze_script_text[freeze_script_leng] = (yy_hold_char); \ - (yy_c_buf_p) = freeze_script_text + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - freeze_script_leng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int freeze_script_get_lineno (void) -{ - - return freeze_script_lineno; -} - -/** Get the input stream. - * - */ -FILE *freeze_script_get_in (void) -{ - return freeze_script_in; -} - -/** Get the output stream. - * - */ -FILE *freeze_script_get_out (void) -{ - return freeze_script_out; -} - -/** Get the length of the current token. - * - */ -int freeze_script_get_leng (void) -{ - return freeze_script_leng; -} - -/** Get the current token. - * - */ - -char *freeze_script_get_text (void) -{ - return freeze_script_text; -} - -/** Set the current line number. - * @param line_number - * - */ -void freeze_script_set_lineno (int line_number ) -{ - - freeze_script_lineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see freeze_script__switch_to_buffer - */ -void freeze_script_set_in (FILE * in_str ) -{ - freeze_script_in = in_str ; -} - -void freeze_script_set_out (FILE * out_str ) -{ - freeze_script_out = out_str ; -} - -int freeze_script_get_debug (void) -{ - return freeze_script__flex_debug; -} - -void freeze_script_set_debug (int bdebug ) -{ - freeze_script__flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from freeze_script_lex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - freeze_script_in = stdin; - freeze_script_out = stdout; -#else - freeze_script_in = (FILE *) 0; - freeze_script_out = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * freeze_script_lex_init() - */ - return 0; -} - -/* freeze_script_lex_destroy is for both reentrant and non-reentrant scanners. */ -int freeze_script_lex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - freeze_script__delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - freeze_script_pop_buffer_state(); - } - - /* Destroy the stack itself. */ - freeze_script_free((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * freeze_script_lex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *freeze_script_alloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *freeze_script_realloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void freeze_script_free (void * ptr ) -{ - free( (char *) ptr ); /* see freeze_script_realloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 219 "Scanner.l" - - - -namespace FreezeScript -{ - -void -initScanner() -{ - keywordMap["true"] = TOK_TRUE; - keywordMap["false"] = TOK_FALSE; - keywordMap["and"] = TOK_AND; - keywordMap["or"] = TOK_OR; - keywordMap["not"] = TOK_NOT; - keywordMap["nil"] = TOK_NIL; -} - -int -checkKeyword(const string& id) -{ - KeywordMap::const_iterator pos = keywordMap.find(id); - if(pos != keywordMap.end()) - { - return pos->second; - } - return TOK_IDENTIFIER; -} - -StringTokPtr -parseString(char start) -{ - StringTokPtr str = new StringTok; - while(true) - { - char c = static_cast(yyinput()); - if(c == start) - { - break; - } - else if(c == EOF) - { - parseErrorReporter->expressionSyntaxError("EOF in string"); - break; - } - else if(c == '\n') - { - parseErrorReporter->expressionSyntaxError("newline in string"); - } - else if(c == '\\') - { - char next = static_cast(yyinput()); - switch(next) - { - case '\\': - case '"': - case '\'': - { - str->v += next; - break; - } - - case 'n': - { - str->v += '\n'; - break; - } - - case 'r': - { - str->v += '\r'; - break; - } - - case 't': - { - str->v += '\t'; - break; - } - - case 'v': - { - str->v += '\v'; - break; - } - - case 'f': - { - str->v += '\f'; - break; - } - - case 'a': - { - str->v += '\a'; - break; - } - - case 'b': - { - str->v += '\b'; - break; - } - - case '?': - { - str->v += '\?'; - break; - } - - case '0': - case '1': - case '2': - case '3': - { - static string octalDigits = "01234567"; - unsigned short us = next - '0'; - if(octalDigits.find_first_of(next = static_cast(yyinput())) != string::npos) - { - us = us * 8 + next - '0'; - if(octalDigits.find_first_of(next = static_cast(yyinput())) != string::npos) - { - us = us * 8 + next - '0'; - } - else - { - unput(next); - } - } - else - { - unput(next); - } - str->v += static_cast(us); - break; - } - case 'x': - { - IceUtil::Int64 ull = 0; - while(isxdigit(static_cast(next = static_cast(yyinput())))) - { - ull *= 16; - if(isdigit(static_cast(next))) - { - ull += next - '0'; - } - else if(islower(static_cast(next))) - { - ull += next - 'a' + 10; - } - else - { - ull += next - 'A' + 10; - } - } - unput(next); - str->v += static_cast(ull); - break; - } - - // TODO: add universal character names - - default: - { - str->v += c; - unput(next); - } - } - } - else - { - str->v += c; - } - } - - return str; -} - -} // End of namespace FreezeScript - diff --git a/cpp/src/FreezeScript/Scanner.l b/cpp/src/FreezeScript/Scanner.l deleted file mode 100644 index 0b1d3bac0e9..00000000000 --- a/cpp/src/FreezeScript/Scanner.l +++ /dev/null @@ -1,395 +0,0 @@ -%{ - -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include // Before Grammar.h, so that YYSTYPE is defined -#include -#include - -#include -#include - -#include - -#if defined(_MSC_VER) && defined(ICE_64) -// -// '=' : conversion from 'size_t' to 'int', possible loss of data -// The result of fread() is a size_t and gets inserted into an int -// -# pragma warning( 4 : 4267 ) -// -// 'initializing' : conversion from '__int64' to 'int', possible loss of data -// Puts a pointer-difference into an int -// -# pragma warning( 4 : 4244 ) -#endif - -#ifdef _MSC_VER -# ifdef freeze_script_wrap -# undef freeze_script_wrap -# define freeze_script_wrap() 1 -# endif -# define YY_NO_UNISTD_H -#endif - -#ifdef __SUNPRO_CC -# ifdef freeze_script_wrap -# undef freeze_script_wrap -# define freeze_script_wrap() 1 -# endif -# ifdef ICE_64 -# pragma error_messages(off,truncwarn) -# endif -#endif - -using namespace std; -using namespace FreezeScript; - -namespace FreezeScript -{ - -typedef map KeywordMap; -static KeywordMap keywordMap; - -void initScanner(); -int checkKeyword(const string&); -StringTokPtr parseString(char); - -} - -#define YY_USER_INIT initScanner(); - -#define YY_INPUT(buf, result, max_size) { result = getInput(buf, max_size); } -%} - -%option noyywrap -%option never-interactive -%option prefix="freeze_script_" -%option outfile="lex.yy.c" - -identifier [[:alpha:]_][[:alnum:]_]* -integer_constant (\+|-)?((0[0-7]+)|(0x[[:xdigit:]]+)|([[:digit:]]+)) -fractional_constant (\+|-)?(([[:digit:]]*\.[[:digit:]]+)|([[:digit:]]+\.)) -exponent_part (e|E)(\+|-)?[[:digit:]]+ -floating_literal (({fractional_constant}{exponent_part}?)|((\+|-)?[[:digit:]]+{exponent_part}))[fF]? - -%% - -"//" { - // C++-style comment - int c; - do - { - c = yyinput(); - if(c == '\n') - { - parseLine++; - } - } - while(c != '\n' && c != EOF); -} - -"/*" { - // C-style comment - while(true) - { - int c = yyinput(); - if(c == '\n') - { - parseLine++; - } - else if(c == '*') - { - int next = yyinput(); - if(next == '/') - { - break; - } - else - { - unput(next); - } - } - else if(c == EOF) - { - parseErrorReporter->expressionSyntaxError("EOF in comment"); - break; - } - } -} - -{identifier} { - StringTokPtr ident = new StringTok; - ident->v = yytext; - *yylvalp = ident; - return checkKeyword(ident->v); -} - -\" { - StringTokPtr str = parseString('"'); - *yylvalp = str; - return TOK_STRING_LITERAL; -} - -\' { - StringTokPtr str = parseString('\''); - *yylvalp = str; - return TOK_STRING_LITERAL; -} - -{integer_constant} { - IntegerTokPtr itp = new IntegerTok; - *yylvalp = itp; - if(!IceUtilInternal::stringToInt64(string(yytext), itp->v)) - { - assert(itp->v != 0); - string msg = "integer constant `"; - msg += yytext; - msg += "' out of range"; - parseErrorReporter->expressionSyntaxError(msg); - } - return TOK_INTEGER_LITERAL; -} - -{floating_literal} { - errno = 0; - FloatingTokPtr ftp = new FloatingTok; - *yylvalp = ftp; - string literal(yytext); - char lastChar = literal[literal.size() - 1]; - if(lastChar == 'f' || lastChar == 'F') - { - literal = literal.substr(0, literal.size() - 1); // Clobber trailing 'f' or 'F' suffix - } - ftp->v = strtod(literal.c_str(), 0); - if((ftp->v == HUGE_VAL || ftp->v == -HUGE_VAL) && errno == ERANGE) - { - string msg = "floating-point constant `"; - msg += yytext; - msg += "' too large (overflow)"; - parseErrorReporter->expressionSyntaxError(msg); - } - else if(ftp->v == 0 && errno == ERANGE) - { - string msg = "floating-point constant `"; - msg += yytext; - msg += "' too small (underflow)"; - parseErrorReporter->expressionSyntaxError(msg); - } - return TOK_FLOATING_POINT_LITERAL; -} - -[[:space:]] { - // Igore white-space - - if(yytext[0] == '\n') - { - parseLine++; - } -} - -"<" return TOK_LESS_THAN; -">" return TOK_GREATER_THAN; -"<=" return TOK_LESS_EQUAL; -">=" return TOK_GREATER_EQUAL; -"==" return TOK_EQUAL; -"!=" return TOK_NEQ; -"+" return TOK_ADD; -"-" return TOK_SUB; -"*" return TOK_MUL; -"/" return TOK_DIV; -"%" return TOK_MOD; -"(" return TOK_LPAREN; -")" return TOK_RPAREN; -"[" return TOK_LBRACKET; -"]" return TOK_RBRACKET; -"::" return TOK_SCOPE_DELIMITER; - -. { - return yytext[0]; -} - -%% - -namespace FreezeScript -{ - -void -initScanner() -{ - keywordMap["true"] = TOK_TRUE; - keywordMap["false"] = TOK_FALSE; - keywordMap["and"] = TOK_AND; - keywordMap["or"] = TOK_OR; - keywordMap["not"] = TOK_NOT; - keywordMap["nil"] = TOK_NIL; -} - -int -checkKeyword(const string& id) -{ - KeywordMap::const_iterator pos = keywordMap.find(id); - if(pos != keywordMap.end()) - { - return pos->second; - } - return TOK_IDENTIFIER; -} - -StringTokPtr -parseString(char start) -{ - StringTokPtr str = new StringTok; - while(true) - { - char c = static_cast(yyinput()); - if(c == start) - { - break; - } - else if(c == EOF) - { - parseErrorReporter->expressionSyntaxError("EOF in string"); - break; - } - else if(c == '\n') - { - parseErrorReporter->expressionSyntaxError("newline in string"); - } - else if(c == '\\') - { - char next = static_cast(yyinput()); - switch(next) - { - case '\\': - case '"': - case '\'': - { - str->v += next; - break; - } - - case 'n': - { - str->v += '\n'; - break; - } - - case 'r': - { - str->v += '\r'; - break; - } - - case 't': - { - str->v += '\t'; - break; - } - - case 'v': - { - str->v += '\v'; - break; - } - - case 'f': - { - str->v += '\f'; - break; - } - - case 'a': - { - str->v += '\a'; - break; - } - - case 'b': - { - str->v += '\b'; - break; - } - - case '?': - { - str->v += '\?'; - break; - } - - case '0': - case '1': - case '2': - case '3': - { - static string octalDigits = "01234567"; - unsigned short us = next - '0'; - if(octalDigits.find_first_of(next = static_cast(yyinput())) != string::npos) - { - us = us * 8 + next - '0'; - if(octalDigits.find_first_of(next = static_cast(yyinput())) != string::npos) - { - us = us * 8 + next - '0'; - } - else - { - unput(next); - } - } - else - { - unput(next); - } - str->v += static_cast(us); - break; - } - case 'x': - { - IceUtil::Int64 ull = 0; - while(isxdigit(static_cast(next = static_cast(yyinput())))) - { - ull *= 16; - if(isdigit(static_cast(next))) - { - ull += next - '0'; - } - else if(islower(static_cast(next))) - { - ull += next - 'a' + 10; - } - else - { - ull += next - 'A' + 10; - } - } - unput(next); - str->v += static_cast(ull); - break; - } - - // TODO: add universal character names - - default: - { - str->v += c; - unput(next); - } - } - } - else - { - str->v += c; - } - } - - return str; -} - -} // End of namespace FreezeScript diff --git a/cpp/src/FreezeScript/TransformAnalyzer.cpp b/cpp/src/FreezeScript/TransformAnalyzer.cpp deleted file mode 100644 index e1c9776e128..00000000000 --- a/cpp/src/FreezeScript/TransformAnalyzer.cpp +++ /dev/null @@ -1,1236 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include - -using namespace std; -using namespace Slice; -using namespace IceUtil; -using namespace IceUtilInternal; - -namespace FreezeScript -{ - -// -// AnalyzeTransformVisitor visits the old definitions and compares them with -// the new definitions. -// -class AnalyzeTransformVisitor : public ParserVisitor -{ -public: - - AnalyzeTransformVisitor(XMLOutput&, const UnitPtr&, bool, vector&, vector&); - - void addDatabase(const string&, const TypePtr&, const TypePtr&, const TypePtr&, const TypePtr&); - - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual bool visitStructStart(const StructPtr&); - virtual void visitSequence(const SequencePtr&); - virtual void visitDictionary(const DictionaryPtr&); - virtual void visitEnum(const EnumPtr&); - -private: - - void compareMembers(const DataMemberList&, const DataMemberList&); - void compareTypes(const string&, const TypePtr&, const TypePtr&); - void typeChange(const string&, const TypePtr&, const TypePtr&); - bool checkClasses(const ClassDeclPtr&, const ClassDeclPtr&); - - XMLOutput& _out; - UnitPtr _newUnit; - bool _ignoreTypeChanges; - vector& _missingTypes; - vector& _errors; -}; - -// -// InitVisitor visits the new definitions to find any that are not present -// in the old definitions, and generates init elements for them. -// -class AnalyzeInitVisitor : public ParserVisitor -{ -public: - - AnalyzeInitVisitor(XMLOutput&, const UnitPtr&); - - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual bool visitStructStart(const StructPtr&); - virtual void visitSequence(const SequencePtr&); - virtual void visitDictionary(const DictionaryPtr&); - virtual void visitEnum(const EnumPtr&); - -private: - - void typeChange(const TypePtr&, const string&, const string&); - - XMLOutput& _out; - UnitPtr _oldUnit; -}; - -} - -//////////////////////////////////// -// AnalyzeTransformVisitor -//////////////////////////////////// - -FreezeScript::AnalyzeTransformVisitor::AnalyzeTransformVisitor(XMLOutput& out, const UnitPtr& newUnit, - bool ignoreTypeChanges, vector& missingTypes, - vector& errors) : - _out(out), _newUnit(newUnit), _ignoreTypeChanges(ignoreTypeChanges), _missingTypes(missingTypes), _errors(errors) -{ -} - -void -FreezeScript::AnalyzeTransformVisitor::addDatabase(const string& name, const TypePtr& oldKey, const TypePtr& newKey, - const TypePtr& oldValue, const TypePtr& newValue) -{ - _out << "\n"; - _out << se("database"); - - if(!name.empty()) - { - _out << attr("name", name); - } - - string oldKeyName = oldKey ? typeToString(oldKey) : string("UNKNOWN"); - string newKeyName = newKey ? typeToString(newKey) : string("UNKNOWN"); - if(oldKeyName == newKeyName) - { - _out << attr("key", oldKeyName); - } - else - { - _out << attr("key", oldKeyName + "," + newKeyName); - } - - string oldValueName = oldValue ? typeToString(oldValue) : string("UNKNOWN"); - string newValueName = newValue ? typeToString(newValue) : string("UNKNOWN"); - if(oldValueName == newValueName) - { - _out << attr("value", oldValueName); - } - else - { - _out << attr("value", oldValueName + "," + newValueName); - } - - _out << se("record"); - if(oldKey && newKey) - { - compareTypes("database key", oldKey, newKey); - } - if(oldValue && newValue) - { - compareTypes("database value", oldValue, newValue); - } - _out << ee; - - _out << ee; -} - -bool -FreezeScript::AnalyzeTransformVisitor::visitClassDefStart(const ClassDefPtr& v) -{ - if(v->isInterface() || v->isLocal()) - { - return false; - } - - string scoped = v->scoped(); - if(ignoreType(scoped)) - { - return false; - } - - TypeList l = _newUnit->lookupTypeNoBuiltin(scoped, false); - if(l.empty()) - { - _missingTypes.push_back(scoped); - return false; - } - - // - // Allow transforming from class to struct. - // - ClassDeclPtr decl = ClassDeclPtr::dynamicCast(l.front()); - StructPtr newStruct = StructPtr::dynamicCast(l.front()); - if(!newStruct && (!decl || decl->isInterface())) - { - if(!_ignoreTypeChanges) - { - typeChange(scoped, v->declaration(), l.front()); - } - return false; - } - - ClassDefPtr newClass; - if(decl) - { - newClass = decl->definition(); - if(!newClass) - { - _missingTypes.push_back(scoped); - return false; - } - } - - DataMemberList oldMembers, newMembers; - - if(newClass) - { - oldMembers = v->dataMembers(); - newMembers = newClass->dataMembers(); - } - else - { - oldMembers = v->allDataMembers(); - newMembers = newStruct->dataMembers(); - } - - _out.newline(); - _out.newline(); - if(newStruct) - { - _out << ""; - } - else - { - _out << ""; - } - _out << se("transform") << attr("type", scoped); - - compareMembers(oldMembers, newMembers); - - _out << ee; - - return false; -} - -bool -FreezeScript::AnalyzeTransformVisitor::visitStructStart(const StructPtr& v) -{ - if(v->isLocal()) - { - return false; - } - - string scoped = v->scoped(); - if(ignoreType(scoped)) - { - return false; - } - - TypeList l = _newUnit->lookupTypeNoBuiltin(scoped, false); - if(l.empty()) - { - _missingTypes.push_back(scoped); - return false; - } - - // - // Allow transforming from struct to class. - // - StructPtr newStruct = StructPtr::dynamicCast(l.front()); - ClassDeclPtr decl = ClassDeclPtr::dynamicCast(l.front()); - ClassDefPtr newClass; - if(decl) - { - newClass = decl->definition(); - if(!newClass) - { - _missingTypes.push_back(scoped); - return false; - } - } - else if(!newStruct) - { - if(!_ignoreTypeChanges) - { - typeChange(scoped, v, l.front()); - } - return false; - } - - _out.newline(); - _out.newline(); - if(newClass) - { - _out << ""; - } - else - { - _out << ""; - } - _out << se("transform") << attr("type", scoped); - - DataMemberList oldMembers, newMembers; - - if(newClass) - { - oldMembers = v->dataMembers(); - newMembers = newClass->allDataMembers(); - } - else - { - oldMembers = v->dataMembers(); - newMembers = newStruct->dataMembers(); - } - - compareMembers(oldMembers, newMembers); - - _out << ee; - - return false; -} - -void -FreezeScript::AnalyzeTransformVisitor::visitSequence(const SequencePtr& v) -{ - if(v->isLocal()) - { - return; - } - - string scoped = v->scoped(); - if(ignoreType(scoped)) - { - return; - } - - TypeList l = _newUnit->lookupTypeNoBuiltin(scoped, false); - if(l.empty()) - { - _missingTypes.push_back(scoped); - return; - } - - SequencePtr newSeq = SequencePtr::dynamicCast(l.front()); - if(!newSeq) - { - if(!_ignoreTypeChanges) - { - typeChange(scoped, v, l.front()); - } - return; - } - - _out.newline(); - _out.newline(); - _out << ""; - _out << se("transform") << attr("type", scoped); - - compareTypes(scoped + " sequence type", v->type(), newSeq->type()); - - _out << ee; -} - -void -FreezeScript::AnalyzeTransformVisitor::visitDictionary(const DictionaryPtr& v) -{ - if(v->isLocal()) - { - return; - } - - string scoped = v->scoped(); - if(ignoreType(scoped)) - { - return; - } - - TypeList l = _newUnit->lookupTypeNoBuiltin(scoped, false); - if(l.empty()) - { - _missingTypes.push_back(scoped); - return; - } - - DictionaryPtr newDict = DictionaryPtr::dynamicCast(l.front()); - if(!newDict) - { - if(!_ignoreTypeChanges) - { - typeChange(scoped, v, l.front()); - } - return; - } - - _out.newline(); - _out.newline(); - _out << ""; - _out << se("transform") << attr("type", scoped); - - compareTypes(scoped + " key type", v->keyType(), newDict->keyType()); - compareTypes(scoped + " value type", v->valueType(), newDict->valueType()); - - _out << ee; -} - -void -FreezeScript::AnalyzeTransformVisitor::visitEnum(const EnumPtr& v) -{ - if(v->isLocal()) - { - return; - } - - string scoped = v->scoped(); - if(ignoreType(scoped)) - { - return; - } - - TypeList l = _newUnit->lookupTypeNoBuiltin(scoped, false); - if(l.empty()) - { - _missingTypes.push_back(scoped); - return; - } - - EnumPtr newEnum = EnumPtr::dynamicCast(l.front()); - if(!newEnum) - { - if(!_ignoreTypeChanges) - { - typeChange(scoped, v, l.front()); - } - return; - } - - map m; - { - Slice::EnumeratorList enumerators = newEnum->getEnumerators(); - int i = 0; - for(Slice::EnumeratorList::iterator p = enumerators.begin(); p != enumerators.end(); ++p, ++i) - { - m.insert(map::value_type((*p)->name(), i)); - } - } - - _out.newline(); - _out.newline(); - _out << ""; - _out << se("transform") << attr("type", scoped); - - Slice::EnumeratorList enumerators = v->getEnumerators(); - int i = 0; - for(Slice::EnumeratorList::iterator p = enumerators.begin(); p != enumerators.end(); ++p, ++i) - { - map::const_iterator q = m.find((*p)->name()); - if(q == m.end()) - { - _out.newline(); - _out << ""; - } - else if(q->second != i) - { - _out.newline(); - _out << ""; - } - } - - _out << ee; -} - -void -FreezeScript::AnalyzeTransformVisitor::compareMembers(const DataMemberList& oldMembers, - const DataMemberList& newMembers) -{ - map oldMap, newMap; - - for(DataMemberList::const_iterator p = oldMembers.begin(); p != oldMembers.end(); ++p) - { - oldMap.insert(pair((*p)->name(), *p)); - } - - for(DataMemberList::const_iterator p = newMembers.begin(); p != newMembers.end(); ++p) - { - newMap.insert(pair((*p)->name(), *p)); - } - - for(DataMemberList::const_iterator p = oldMembers.begin(); p != oldMembers.end(); ++p) - { - string name = (*p)->name(); - map::iterator q = newMap.find(name); - if(q == newMap.end()) - { - _out.newline(); - _out << ""; - } - else - { - TypePtr oldType = (*p)->type(); - TypePtr newType = q->second->type(); - compareTypes(name, oldType, newType); - - // - // Remove this entry from the map to indicate that we've - // already seen it. - // - newMap.erase(q); - } - } - - // - // Iterate over the remaining entries in newMap. These represent - // members that were added in the new definition. - // - for(map::iterator q = newMap.begin(); q != newMap.end(); ++q) - { - _out.newline(); - _out << ""; - } -} - -void -FreezeScript::AnalyzeTransformVisitor::compareTypes(const string& desc, const TypePtr& oldType, const TypePtr& newType) -{ - assert(!oldType->isLocal()); - if(newType->isLocal()) - { - ostringstream ostr; - ostr << desc << " has changed to a local type"; - _errors.push_back(ostr.str()); - return; - } - - BuiltinPtr b = BuiltinPtr::dynamicCast(oldType); - if(b) - { - BuiltinPtr newb = BuiltinPtr::dynamicCast(newType); - switch(b->kind()) - { - case Builtin::KindByte: - { - if(newb) - { - switch(newb->kind()) - { - case Builtin::KindByte: - case Builtin::KindShort: - case Builtin::KindInt: - case Builtin::KindLong: - case Builtin::KindString: - { - return; - } - case Builtin::KindBool: - case Builtin::KindFloat: - case Builtin::KindDouble: - case Builtin::KindObject: - case Builtin::KindObjectProxy: - case Builtin::KindLocalObject: - { - break; - } - } - } - - break; - } - case Builtin::KindBool: - { - if(newb && (newb->kind() == Builtin::KindBool || newb->kind() == Builtin::KindString)) - { - return; - } - - break; - } - case Builtin::KindShort: - { - if(newb) - { - switch(newb->kind()) - { - case Builtin::KindByte: - case Builtin::KindShort: - case Builtin::KindInt: - case Builtin::KindLong: - case Builtin::KindString: - { - return; - } - case Builtin::KindBool: - case Builtin::KindFloat: - case Builtin::KindDouble: - case Builtin::KindObject: - case Builtin::KindObjectProxy: - case Builtin::KindLocalObject: - { - break; - } - } - } - - break; - } - case Builtin::KindInt: - { - if(newb) - { - switch(newb->kind()) - { - case Builtin::KindByte: - case Builtin::KindShort: - case Builtin::KindInt: - case Builtin::KindLong: - case Builtin::KindString: - { - return; - } - case Builtin::KindBool: - case Builtin::KindFloat: - case Builtin::KindDouble: - case Builtin::KindObject: - case Builtin::KindObjectProxy: - case Builtin::KindLocalObject: - { - break; - } - } - } - - break; - } - case Builtin::KindLong: - { - if(newb) - { - switch(newb->kind()) - { - case Builtin::KindByte: - case Builtin::KindShort: - case Builtin::KindInt: - case Builtin::KindLong: - case Builtin::KindString: - { - return; - } - case Builtin::KindBool: - case Builtin::KindFloat: - case Builtin::KindDouble: - case Builtin::KindObject: - case Builtin::KindObjectProxy: - case Builtin::KindLocalObject: - { - break; - } - } - } - - break; - } - case Builtin::KindFloat: - { - if(newb) - { - switch(newb->kind()) - { - case Builtin::KindFloat: - case Builtin::KindDouble: - case Builtin::KindString: - { - return; - } - case Builtin::KindByte: - case Builtin::KindShort: - case Builtin::KindInt: - case Builtin::KindLong: - case Builtin::KindBool: - case Builtin::KindObject: - case Builtin::KindObjectProxy: - case Builtin::KindLocalObject: - { - break; - } - } - } - - break; - } - case Builtin::KindDouble: - { - if(newb) - { - switch(newb->kind()) - { - case Builtin::KindFloat: - case Builtin::KindDouble: - case Builtin::KindString: - { - return; - } - case Builtin::KindByte: - case Builtin::KindShort: - case Builtin::KindInt: - case Builtin::KindLong: - case Builtin::KindBool: - case Builtin::KindObject: - case Builtin::KindObjectProxy: - case Builtin::KindLocalObject: - { - break; - } - } - } - - break; - } - case Builtin::KindString: - { - if(newb) - { - switch(newb->kind()) - { - case Builtin::KindByte: - case Builtin::KindBool: - case Builtin::KindShort: - case Builtin::KindInt: - case Builtin::KindLong: - case Builtin::KindFloat: - case Builtin::KindDouble: - case Builtin::KindString: - case Builtin::KindObjectProxy: - { - return; - } - case Builtin::KindObject: - case Builtin::KindLocalObject: - { - break; - } - } - - break; - } - - if(EnumPtr::dynamicCast(newType)) - { - return; - } - - if(ProxyPtr::dynamicCast(newType)) - { - return; - } - - break; - } - case Builtin::KindObject: - { - // - // Allow change from Object to class. Validation has to - // be done during transformation, when the actual type of - // an instance can be compared for compatibility with the - // new type. - // - ClassDeclPtr cl = ClassDeclPtr::dynamicCast(newType); - if(cl || (newb && newb->kind() == Builtin::KindObject)) - { - return; - } - - break; - } - case Builtin::KindObjectProxy: - { - ProxyPtr p = ProxyPtr::dynamicCast(newType); - if(p || (newb && newb->kind() == Builtin::KindObjectProxy) || (newb && newb->kind() == Builtin::KindString)) - { - return; - } - - break; - } - case Builtin::KindLocalObject: - { - assert(false); - break; - } - } - - typeChange(desc, oldType, newType); - return; - } - - ClassDeclPtr cl = ClassDeclPtr::dynamicCast(oldType); - if(cl) - { - if(!cl->definition()) - { - _errors.push_back("class " + cl->scoped() + " declared but not defined"); - return; - } - - // - // Allow target type of Object. - // - BuiltinPtr newb = BuiltinPtr::dynamicCast(newType); - if(newb && newb->kind() == Builtin::KindObject) - { - return; - } - - // - // Allow target type of struct. - // - if(StructPtr::dynamicCast(newType)) - { - return; - } - - ClassDeclPtr newcl = ClassDeclPtr::dynamicCast(newType); - if(newcl) - { - if(!newcl->definition()) - { - _errors.push_back("class " + newcl->scoped() + " declared but not defined"); - return; - } - - if(checkClasses(cl, newcl)) - { - return; - } - } - - typeChange(desc, oldType, newType); - return; - } - - StructPtr s = StructPtr::dynamicCast(oldType); - if(s) - { - StructPtr news = StructPtr::dynamicCast(newType); - if(news && s->scoped() == news->scoped()) - { - return; - } - - // - // Allow target type of class. - // - if(ClassDeclPtr::dynamicCast(newType)) - { - return; - } - - typeChange(desc, oldType, newType); - return; - } - - ProxyPtr proxy = ProxyPtr::dynamicCast(oldType); - if(proxy) - { - // - // Allow target type of Object* and string. - // - BuiltinPtr newb = BuiltinPtr::dynamicCast(newType); - if(newb && (newb->kind() == Builtin::KindObjectProxy || newb->kind() == Builtin::KindString)) - { - return; - } - - ProxyPtr newProxy = ProxyPtr::dynamicCast(newType); - if(newProxy && checkClasses(proxy->_class(), newProxy->_class())) - { - return; - } - - typeChange(desc, oldType, newType); - return; - } - - DictionaryPtr dict = DictionaryPtr::dynamicCast(oldType); - if(dict) - { - DictionaryPtr newDict = DictionaryPtr::dynamicCast(newType); - if(newDict && dict->scoped() == newDict->scoped()) - { - return; - } - - typeChange(desc, oldType, newType); - return; - } - - SequencePtr seq = SequencePtr::dynamicCast(oldType); - if(seq) - { - SequencePtr newSeq = SequencePtr::dynamicCast(newType); - if(newSeq && seq->scoped() == newSeq->scoped()) - { - return; - } - - typeChange(desc, oldType, newType); - return; - } - - EnumPtr en = EnumPtr::dynamicCast(oldType); - if(en) - { - EnumPtr newen = EnumPtr::dynamicCast(newType); - BuiltinPtr newb = BuiltinPtr::dynamicCast(newType); - if((newen && en->scoped() == newen->scoped()) || (newb && newb->kind() == Builtin::KindString)) - { - return; - } - - typeChange(desc, oldType, newType); - return; - } - - assert(false); -} - -void -FreezeScript::AnalyzeTransformVisitor::typeChange(const string& desc, const TypePtr& t1, const TypePtr& t2) -{ - BuiltinPtr b1 = BuiltinPtr::dynamicCast(t1); - BuiltinPtr b2 = BuiltinPtr::dynamicCast(t2); - ContainedPtr c1 = ContainedPtr::dynamicCast(t1); - ContainedPtr c2 = ContainedPtr::dynamicCast(t2); - ProxyPtr p1 = ProxyPtr::dynamicCast(t1); - ProxyPtr p2 = ProxyPtr::dynamicCast(t2); - - if(_ignoreTypeChanges) - { - _out.newline(); - _out << ""; - } - else - { - ostringstream ostr; - ostr << "unsupported type change in " << desc << " from "; - if(b1) - { - ostr << b1->kindAsString(); - } - else if(p1) - { - ostr << p1->_class()->scoped() << '*'; - } - else - { - assert(c1); - ostr << c1->kindOf() << ' ' << c1->scoped(); - } - ostr << " to "; - if(b2) - { - ostr << b2->kindAsString(); - } - else if(p2) - { - ostr << p2->_class()->scoped() << '*'; - } - else - { - assert(c2); - ostr << c2->kindOf() << ' ' << c2->scoped(); - } - _errors.push_back(ostr.str()); - } -} - -bool -FreezeScript::AnalyzeTransformVisitor::checkClasses(const ClassDeclPtr& from, const ClassDeclPtr& to) -{ - string fromScoped = from->scoped(); - string toScoped = to->scoped(); - - if(fromScoped == toScoped) - { - return true; - } - - // - // The types don't match, so check them for compatibility. Specifically, - // look up the old type id in the new Slice and see if it has the target - // type as a base class. - // - TypeList l = to->unit()->lookupTypeNoBuiltin(from->scoped(), false); - if(!l.empty()) - { - ClassDeclPtr decl = ClassDeclPtr::dynamicCast(l.front()); - if(decl) - { - ClassDefPtr def = decl->definition(); - if(def) - { - ClassList bases = def->allBases(); - for(ClassList::iterator p = bases.begin(); p != bases.end(); ++p) - { - if((*p)->scoped() == toScoped) - { - return true; - } - } - } - } - } - - return false; -} - -//////////////////////////////////// -// InitVisitor -//////////////////////////////////// - -FreezeScript::AnalyzeInitVisitor::AnalyzeInitVisitor(XMLOutput& out, const UnitPtr& oldUnit) : - _out(out), _oldUnit(oldUnit) -{ -} - -bool -FreezeScript::AnalyzeInitVisitor::visitClassDefStart(const ClassDefPtr& v) -{ - if(v->isInterface() || v->isLocal()) - { - return false; - } - - string scoped = v->scoped(); - TypeList l = _oldUnit->lookupTypeNoBuiltin(scoped, false); - if(!l.empty()) - { - ClassDeclPtr decl = ClassDeclPtr::dynamicCast(l.front()); - if(!decl || decl->isInterface()) - { - typeChange(l.front(), scoped, "class"); - } - else - { - return false; - } - } - - _out.newline(); - _out.newline(); - _out << ""; - _out << se("init") << attr("type", scoped); - _out << ee; - - return false; -} - -bool -FreezeScript::AnalyzeInitVisitor::visitStructStart(const StructPtr& v) -{ - if(v->isLocal()) - { - return false; - } - - string scoped = v->scoped(); - TypeList l = _oldUnit->lookupTypeNoBuiltin(scoped, false); - if(!l.empty()) - { - StructPtr s = StructPtr::dynamicCast(l.front()); - if(!s) - { - typeChange(l.front(), scoped, "struct"); - } - else - { - return false; - } - } - - _out.newline(); - _out.newline(); - _out << ""; - _out << se("init") << attr("type", scoped); - _out << ee; - - return false; -} - -void -FreezeScript::AnalyzeInitVisitor::visitSequence(const SequencePtr& v) -{ - if(v->isLocal()) - { - return; - } - - string scoped = v->scoped(); - TypeList l = _oldUnit->lookupTypeNoBuiltin(scoped, false); - if(!l.empty()) - { - SequencePtr s = SequencePtr::dynamicCast(l.front()); - if(!s) - { - typeChange(l.front(), scoped, "sequence"); - } - else - { - return; - } - } - - _out.newline(); - _out.newline(); - _out << ""; - _out << se("init") << attr("type", scoped); - _out << ee; -} - -void -FreezeScript::AnalyzeInitVisitor::visitDictionary(const DictionaryPtr& v) -{ - if(v->isLocal()) - { - return; - } - - string scoped = v->scoped(); - TypeList l = _oldUnit->lookupTypeNoBuiltin(scoped, false); - if(!l.empty()) - { - DictionaryPtr d = DictionaryPtr::dynamicCast(l.front()); - if(!d) - { - typeChange(l.front(), scoped, "dictionary"); - } - else - { - return; - } - } - - _out.newline(); - _out.newline(); - _out << ""; - _out << se("init") << attr("type", scoped); - _out << ee; -} - -void -FreezeScript::AnalyzeInitVisitor::visitEnum(const EnumPtr& v) -{ - if(v->isLocal()) - { - return; - } - - string scoped = v->scoped(); - TypeList l = _oldUnit->lookupTypeNoBuiltin(scoped, false); - if(!l.empty()) - { - EnumPtr e = EnumPtr::dynamicCast(l.front()); - if(!e) - { - typeChange(l.front(), scoped, "enum"); - } - else - { - return; - } - } - - _out.newline(); - _out.newline(); - _out << ""; - _out << se("init") << attr("type", scoped); - _out << ee; -} - - -void -FreezeScript::AnalyzeInitVisitor::typeChange(const TypePtr& t, const string& scoped, const string& kind) -{ - BuiltinPtr b = BuiltinPtr::dynamicCast(t); - ContainedPtr c = ContainedPtr::dynamicCast(t); - ProxyPtr p = ProxyPtr::dynamicCast(t); - - _out.newline(); - _out.newline(); - _out << ""; -} - -FreezeScript::TransformAnalyzer::TransformAnalyzer(const UnitPtr& oldUnit, const UnitPtr& newUnit, - bool ignoreTypeChanges, ostream& os, vector& missingTypes, - vector& errors) : - _old(oldUnit), _new(newUnit), _out(os), - _visitor(new AnalyzeTransformVisitor(_out, newUnit, ignoreTypeChanges, missingTypes, errors)) -{ - _out << se("transformdb"); -} - -FreezeScript::TransformAnalyzer::~TransformAnalyzer() -{ - delete _visitor; -} - -void -FreezeScript::TransformAnalyzer::addDatabase(const string& name, const TypePtr& oldKey, const TypePtr& newKey, - const TypePtr& oldValue, const TypePtr& newValue) -{ - _visitor->addDatabase(name, oldKey, newKey, oldValue, newValue); -} - -void -FreezeScript::TransformAnalyzer::finish() -{ - _old->visit(_visitor, false); - - AnalyzeInitVisitor initVisitor(_out, _old); - _new->visit(&initVisitor, false); - - _out << ee; - _out << '\n'; -} diff --git a/cpp/src/FreezeScript/TransformAnalyzer.h b/cpp/src/FreezeScript/TransformAnalyzer.h deleted file mode 100644 index 938b04ec1e3..00000000000 --- a/cpp/src/FreezeScript/TransformAnalyzer.h +++ /dev/null @@ -1,44 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_SCRIPT_TRANSFORM_ANALYZER_H -#define FREEZE_SCRIPT_TRANSFORM_ANALYZER_H - -#include -#include -#include - -namespace FreezeScript -{ - -class AnalyzeTransformVisitor; - -class TransformAnalyzer -{ -public: - - TransformAnalyzer(const Slice::UnitPtr&, const Slice::UnitPtr&, bool, std::ostream&, std::vector&, - std::vector&); - ~TransformAnalyzer(); - - void addDatabase(const std::string&, const Slice::TypePtr&, const Slice::TypePtr&, const Slice::TypePtr&, - const Slice::TypePtr&); - void finish(); - -private: - - Slice::UnitPtr _old; - Slice::UnitPtr _new; - IceUtilInternal::XMLOutput _out; - AnalyzeTransformVisitor* _visitor; -}; - -} - -#endif diff --git a/cpp/src/FreezeScript/TransformDB.rc b/cpp/src/FreezeScript/TransformDB.rc deleted file mode 100644 index 6211ed2a3c1..00000000000 --- a/cpp/src/FreezeScript/TransformDB.rc +++ /dev/null @@ -1,34 +0,0 @@ -#include "winver.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,7,0,0 - PRODUCTVERSION 3,7,0,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE VFT_APP - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "ZeroC, Inc.\0" - VALUE "FileDescription", "Transform Freeze Database\0" - VALUE "FileVersion", "3.7.0\0" - VALUE "InternalName", "transformdb\0" - VALUE "LegalCopyright", "\251 2003-2015 ZeroC, Inc.\0" - VALUE "OriginalFilename", "transformdb.exe\0" - VALUE "ProductName", "Ice\0" - VALUE "ProductVersion", "3.7.0\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END diff --git a/cpp/src/FreezeScript/TransformVisitor.cpp b/cpp/src/FreezeScript/TransformVisitor.cpp deleted file mode 100644 index fb77a39353f..00000000000 --- a/cpp/src/FreezeScript/TransformVisitor.cpp +++ /dev/null @@ -1,995 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include - -using namespace std; - -FreezeScript::TransformVisitor::TransformVisitor(const DataPtr& src, const TransformInfoPtr& info, - const string& context) : - _src(src), _info(info), _context(context) -{ - assert(_info); -} - -void -FreezeScript::TransformVisitor::visitBoolean(const BooleanDataPtr& dest) -{ - Slice::TypePtr type = dest->getType(); - if(_info->doDefaultTransform(type)) - { - BooleanDataPtr b = BooleanDataPtr::dynamicCast(_src); - if(b) - { - dest->setValue(b->getValue()); - } - else - { - StringDataPtr s = StringDataPtr::dynamicCast(_src); - if(s) - { - string v = s->getValue(); - if(v == "true") - { - dest->setValue(true); - } - else if(v == "false") - { - dest->setValue(false); - } - else - { - conversionError(type, _src->getType(), v); - } - } - else - { - typeMismatchError(type, _src->getType()); - } - } - } - _info->executeCustomTransform(dest, _src); -} - -void -FreezeScript::TransformVisitor::visitInteger(const IntegerDataPtr& dest) -{ - Slice::TypePtr type = dest->getType(); - if(_info->doDefaultTransform(type)) - { - IntegerDataPtr i = IntegerDataPtr::dynamicCast(_src); - if(i) - { - dest->setValue(i->getValue(), false); - } - else - { - StringDataPtr s = StringDataPtr::dynamicCast(_src); - if(s) - { - string str = s->getValue(); - Ice::Long value; - if(IceUtilInternal::stringToInt64(str, value)) - { - dest->setValue(value, false); - } - else - { - conversionError(type, _src->getType(), str); - } - } - else - { - typeMismatchError(type, _src->getType()); - } - } - } - _info->executeCustomTransform(dest, _src); -} - -void -FreezeScript::TransformVisitor::visitDouble(const DoubleDataPtr& dest) -{ - Slice::TypePtr type = dest->getType(); - if(_info->doDefaultTransform(type)) - { - DoubleDataPtr d = DoubleDataPtr::dynamicCast(_src); - if(d) - { - dest->setValue(d->doubleValue()); - } - else - { - StringDataPtr s = StringDataPtr::dynamicCast(_src); - if(s) - { - string str = s->stringValue(); - const char* start = str.c_str(); - char* end; - double v = strtod(start, &end); - if(errno == ERANGE) - { - rangeError(str, type); - } - else - { - while(*end) - { - if(!isspace(static_cast(*end))) - { - conversionError(type, _src->getType(), str); - return; - } - end++; - } - if(!*end) - { - dest->setValue(v); - } - } - } - else - { - typeMismatchError(type, _src->getType()); - } - } - } - _info->executeCustomTransform(dest, _src); -} - -void -FreezeScript::TransformVisitor::visitString(const StringDataPtr& dest) -{ - Slice::TypePtr type = dest->getType(); - if(_info->doDefaultTransform(type)) - { - StringDataPtr s = StringDataPtr::dynamicCast(_src); - BooleanDataPtr b = BooleanDataPtr::dynamicCast(_src); - IntegerDataPtr i = IntegerDataPtr::dynamicCast(_src); - DoubleDataPtr d = DoubleDataPtr::dynamicCast(_src); - EnumDataPtr e = EnumDataPtr::dynamicCast(_src); - ProxyDataPtr p = ProxyDataPtr::dynamicCast(_src); - if(s || b || i || d || e || p) - { - dest->setValue(_src->toString()); - } - else - { - typeMismatchError(type, _src->getType()); - } - } - _info->executeCustomTransform(dest, _src); -} - -void -FreezeScript::TransformVisitor::visitProxy(const ProxyDataPtr& dest) -{ - Slice::TypePtr type = dest->getType(); - if(_info->doDefaultTransform(type)) - { - ProxyDataPtr p = ProxyDataPtr::dynamicCast(_src); - if(p) - { - dest->setValue(p->getValue()); - } - else - { - StringDataPtr s = StringDataPtr::dynamicCast(_src); - if(s) - { - dest->setValue(s->getValue(), false); - } - else - { - typeMismatchError(type, _src->getType()); - } - } - } - _info->executeCustomTransform(dest, _src); -} - -void -FreezeScript::TransformVisitor::visitStruct(const StructDataPtr& dest) -{ - Slice::TypePtr type = dest->getType(); - if(_info->doDefaultTransform(type)) - { - // - // Support struct->struct and class->struct transforms. - // - StructDataPtr s = StructDataPtr::dynamicCast(_src); - ObjectRefPtr obj = ObjectRefPtr::dynamicCast(_src); - if((s || obj) && isCompatible(type, _src->getType())) - { - // - // Transform members with the same name. - // - DataMemberMap srcMap = s ? s->getMembers() : obj->getValue()->getMembers(); - DataMemberMap destMap = dest->getMembers(); - string typeName = typeToString(type); - for(DataMemberMap::iterator p = destMap.begin(); p != destMap.end(); ++p) - { - DataMemberMap::iterator q = srcMap.find(p->first); - if(q != srcMap.end()) - { - string context = typeName + " member " + p->first + " value"; - TransformVisitor v(q->second, _info, context); - p->second->visit(v); - } - } - } - else - { - typeMismatchError(type, _src->getType()); - } - } - _info->executeCustomTransform(dest, _src); -} - -void -FreezeScript::TransformVisitor::visitSequence(const SequenceDataPtr& dest) -{ - Slice::TypePtr type = dest->getType(); - if(_info->doDefaultTransform(type)) - { - SequenceDataPtr s = SequenceDataPtr::dynamicCast(_src); - if(s && isCompatible(type, _src->getType())) - { - DataList& srcElements = s->getElements(); - DataList destElements; - Slice::SequencePtr seqType = Slice::SequencePtr::dynamicCast(type); - assert(seqType); - Slice::TypePtr elemType = seqType->type(); - string typeName = typeToString(type); - for(DataList::const_iterator p = srcElements.begin(); p != srcElements.end(); ++p) - { - DataPtr element = _info->getDataFactory()->create(elemType, false); - Destroyer elementDestroyer(element); - try - { - TransformVisitor v(*p, _info, typeName + " element"); - element->visit(v); - destElements.push_back(element); - elementDestroyer.release(); - } - catch(const ClassNotFoundException& ex) - { - // - // If transformation of the sequence element fails because a class - // could not be found, then we invoke purgeObjects() to determine - // whether we should ignore the situation (and remove the element - // from the sequence) or raise the exception again. - // - if(!_info->purgeObjects()) - { - throw; - } - warning("purging element of sequence " + typeToString(type) + - " due to missing class type " + ex.id); - } - } - DataList& l = dest->getElements(); - l.swap(destElements); - } - else - { - typeMismatchError(type, _src->getType()); - } - } - _info->executeCustomTransform(dest, _src); -} - -void -FreezeScript::TransformVisitor::visitEnum(const EnumDataPtr& dest) -{ - Slice::TypePtr type = dest->getType(); - if(_info->doDefaultTransform(type)) - { - string name; - EnumDataPtr e = EnumDataPtr::dynamicCast(_src); - if(e && isCompatible(type, _src->getType())) - { - name = e->toString(); - } - else - { - StringDataPtr s = StringDataPtr::dynamicCast(_src); - if(s) - { - name = s->getValue(); - } - else - { - typeMismatchError(type, _src->getType()); - return; - } - } - - if(!dest->setValueAsString(name)) - { - conversionError(type, _src->getType(), name); - } - } - _info->executeCustomTransform(dest, _src); -} - -void -FreezeScript::TransformVisitor::visitDictionary(const DictionaryDataPtr& dest) -{ - Slice::TypePtr type = dest->getType(); - if(_info->doDefaultTransform(type)) - { - DictionaryDataPtr d = DictionaryDataPtr::dynamicCast(_src); - if(d && isCompatible(type, _src->getType())) - { - DataMap& srcMap = d->getElements(); - DataMap destMap; - Slice::DictionaryPtr dictType = Slice::DictionaryPtr::dynamicCast(type); - assert(dictType); - Slice::TypePtr keyType = dictType->keyType(); - Slice::TypePtr valueType = dictType->valueType(); - string typeName = typeToString(type); - for(DataMap::const_iterator p = srcMap.begin(); p != srcMap.end(); ++p) - { - DataPtr key = _info->getDataFactory()->create(keyType, false); - Destroyer keyDestroyer(key); - DataPtr value = _info->getDataFactory()->create(valueType, false); - Destroyer valueDestroyer(value); - - TransformVisitor keyVisitor(p->first, _info, typeName + " key"); - key->visit(keyVisitor); - - try - { - TransformVisitor valueVisitor(p->second, _info, typeName + " value"); - value->visit(valueVisitor); - } - catch(const ClassNotFoundException& ex) - { - // - // If transformation of the dictionary value fails because a class - // could not be found, then we invoke purgeObjects() to determine - // whether we should ignore the situation (and remove the element - // from the dictionary) or raise the exception again. - // - if(!_info->purgeObjects()) - { - throw; - } - warning("purging element of dictionary " + typeToString(dictType) + " due to missing class type " + - ex.id); - continue; - } - - DataMap::const_iterator q = destMap.find(key); - if(q != destMap.end()) - { - warning("duplicate dictionary key in " + typeToString(dictType)); - } - else - { - destMap.insert(DataMap::value_type(key, value)); - keyDestroyer.release(); - valueDestroyer.release(); - } - } - DataMap& m = dest->getElements(); - m.swap(destMap); - } - else - { - typeMismatchError(type, _src->getType()); - } - } - _info->executeCustomTransform(dest, _src); -} - -void -FreezeScript::TransformVisitor::visitObject(const ObjectRefPtr& dest) -{ - // - // Support struct->class and class->class transforms. - // - Slice::TypePtr type = dest->getType(); - ObjectRefPtr src = ObjectRefPtr::dynamicCast(_src); - StructDataPtr s = StructDataPtr::dynamicCast(_src); - if(!src && !s) - { - typeMismatchError(type, _src->getType()); - } - else if(_info->doDefaultTransform(type)) - { - if(src) - { - // - // class->class transform - // - ObjectDataPtr srcValue = src->getValue(); - Slice::TypePtr srcType = src->getType(); - if(!srcValue) - { - // - // Allow a nil value from type Object. - // - if(Slice::BuiltinPtr::dynamicCast(srcType) || isCompatible(type, srcType)) - { - dest->setValue(0); - } - else - { - typeMismatchError(type, srcType); - } - } - else - { - Slice::TypePtr srcValueType = srcValue->getType(); - if(isCompatible(type, srcValueType)) - { - // - // If the types are in the same Slice unit, then we can simply - // copy the reference. Otherwise, we check the object map to - // see if an equivalent object has already been created, and - // if not, then we have to create one. - // - if(type->unit().get() == srcValueType->unit().get()) - { - dest->setValue(srcValue); - } - else - { - ObjectDataMap& objectDataMap = _info->getObjectDataMap(); - ObjectDataMap::iterator p = objectDataMap.find(srcValue.get()); - if(p != objectDataMap.end() && p->second) - { - dest->setValue(p->second); - } - else - { - // - // If the type has been renamed, we need to get its equivalent - // in the new Slice definitions. - // - Slice::TypePtr newType = _info->getRenamedType(srcValueType); - if(!newType) - { - string name = typeToString(srcValueType); - Slice::TypeList l = type->unit()->lookupType(name, false); - if(l.empty()) - { - throw ClassNotFoundException(name); - } - newType = l.front(); - } - - // - // Use createObject() so that an initializer is invoked if necessary. - // - DataPtr newObj = _info->getDataFactory()->createObject(newType, false); - ObjectRefPtr newRef = ObjectRefPtr::dynamicCast(newObj); - assert(newRef); - - ObjectDataPtr newValue = newRef->getValue(); - try - { - transformObject(newValue, srcValue); - } - catch(...) - { - newObj->destroy(); - throw; - } - - dest->setValue(newValue); - newObj->destroy(); - } - } - } - else - { - typeMismatchError(type, srcValueType); - } - } - } - else - { - // - // struct->class transform - // - Slice::TypePtr srcType = _src->getType(); - if(isCompatible(type, srcType)) - { - // - // If the type has been renamed, we need to get its equivalent - // in the new Slice definitions. - // - Slice::TypePtr newType = _info->getRenamedType(srcType); - if(!newType) - { - string name = typeToString(srcType); - Slice::TypeList l = type->unit()->lookupType(name, false); - if(l.empty()) - { - throw ClassNotFoundException(name); - } - newType = l.front(); - } - - // - // Use createObject() so that an initializer is invoked if necessary. - // - DataPtr newObj = _info->getDataFactory()->createObject(newType, false); - ObjectRefPtr newRef = ObjectRefPtr::dynamicCast(newObj); - assert(newRef); - - ObjectDataPtr newValue = newRef->getValue(); - try - { - // - // Transform members with the same name. - // - DataMemberMap srcMap = s->getMembers(); - DataMemberMap destMap = newValue->getMembers(); - string typeName = typeToString(type); - for(DataMemberMap::iterator p = destMap.begin(); p != destMap.end(); ++p) - { - DataMemberMap::iterator q = srcMap.find(p->first); - if(q != srcMap.end()) - { - string context = typeName + " member " + p->first + " value"; - TransformVisitor v(q->second, _info, context); - p->second->visit(v); - } - } - } - catch(...) - { - newObj->destroy(); - throw; - } - - dest->setValue(newValue); - newObj->destroy(); - } - else - { - typeMismatchError(type, srcType); - } - } - } - _info->executeCustomTransform(dest, _src); -} - -void -FreezeScript::TransformVisitor::transformObject(const ObjectDataPtr& dest, const ObjectDataPtr& src) -{ - // - // The source object must be present in the object map (we currently don't support - // transforming two ObjectData instances from the same Slice unit - this transform - // would be handled by-reference at the ObjectRef level). We must update the object - // map before transforming members in order to handle cycles. - // - ObjectDataMap& objectDataMap = _info->getObjectDataMap(); - ObjectDataMap::iterator p = objectDataMap.find(src.get()); - assert(p != objectDataMap.end()); - assert(p->second == 0); - objectDataMap.erase(p); - objectDataMap.insert(ObjectDataMap::value_type(src.get(), dest)); - p = objectDataMap.find(src.get()); - - try - { - // - // Transform members with the same name. - // - DataMemberMap srcMap = src->getMembers(); - DataMemberMap destMap = dest->getMembers(); - string typeName = typeToString(dest->getType()); - for(DataMemberMap::iterator p = destMap.begin(); p != destMap.end(); ++p) - { - DataMemberMap::iterator q = srcMap.find(p->first); - if(q != srcMap.end()) - { - string context = typeName + " member " + p->first + " value"; - TransformVisitor v(q->second, _info, context); - p->second->visit(v); - } - } - } - catch(...) - { - objectDataMap.erase(p); - -#if (defined(_MSC_VER) && (_MSC_VER >= 1600)) - objectDataMap.insert(ObjectDataMap::value_type(src.get(), static_cast(nullptr))); -#else - objectDataMap.insert(ObjectDataMap::value_type(src.get(), 0)); -#endif - throw; - } -} - -bool -FreezeScript::TransformVisitor::checkRename(const Slice::TypePtr& dest, const Slice::TypePtr& src) -{ - if(dest->unit().get() != src->unit().get()) - { - Slice::TypePtr t = _info->getRenamedType(src); - return t.get() == dest.get(); - } - - return false; -} - -bool -FreezeScript::TransformVisitor::isCompatible(const Slice::TypePtr& dest, const Slice::TypePtr& src) -{ - Slice::BuiltinPtr b1 = Slice::BuiltinPtr::dynamicCast(dest); - if(b1) - { - Slice::BuiltinPtr b2 = Slice::BuiltinPtr::dynamicCast(src); - switch(b1->kind()) - { - case Slice::Builtin::KindByte: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindLong: - { - if(b2) - { - switch(b2->kind()) - { - case Slice::Builtin::KindByte: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindLong: - case Slice::Builtin::KindString: - { - return true; - } - case Slice::Builtin::KindBool: - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - { - return false; - } - } - } - - return false; - } - case Slice::Builtin::KindBool: - { - if(b2 && (b2->kind() == Slice::Builtin::KindBool || b2->kind() == Slice::Builtin::KindString)) - { - return true; - } - - return false; - } - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - { - if(b2) - { - switch(b2->kind()) - { - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - case Slice::Builtin::KindString: - { - return true; - } - case Slice::Builtin::KindByte: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindLong: - case Slice::Builtin::KindBool: - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - { - return false; - } - } - } - - return false; - } - case Slice::Builtin::KindString: - { - if(b2) - { - switch(b2->kind()) - { - case Slice::Builtin::KindByte: - case Slice::Builtin::KindBool: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindLong: - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - case Slice::Builtin::KindString: - case Slice::Builtin::KindObjectProxy: - { - return true; - } - case Slice::Builtin::KindObject: - case Slice::Builtin::KindLocalObject: - { - return false; - } - } - - return false; - } - else if(Slice::EnumPtr::dynamicCast(src)) - { - return true; - } - else if(Slice::ProxyPtr::dynamicCast(src)) - { - return true; - } - - return false; - } - case Slice::Builtin::KindObject: - { - // - // Allow transformation from Object to class. Validation has to - // be done during transformation, when the actual type of - // an instance can be compared for compatibility with the - // new type. - // - Slice::ClassDeclPtr cl = Slice::ClassDeclPtr::dynamicCast(src); - if(cl || (b2 && b2->kind() == Slice::Builtin::KindObject)) - { - return true; - } - - return false; - } - case Slice::Builtin::KindObjectProxy: - { - Slice::ProxyPtr p = Slice::ProxyPtr::dynamicCast(src); - if(p || (b2 && b2->kind() == Slice::Builtin::KindObjectProxy) || - (b2 && b2->kind() == Slice::Builtin::KindString)) - { - return true; - } - - return false; - } - case Slice::Builtin::KindLocalObject: - { - assert(false); - return false; - } - } - - assert(false); - } - - Slice::ClassDeclPtr cl1 = Slice::ClassDeclPtr::dynamicCast(dest); - if(cl1) - { - Slice::ClassDeclPtr cl2 = Slice::ClassDeclPtr::dynamicCast(src); - if(cl2 && checkClasses(cl1, cl2)) - { - return true; - } - - Slice::StructPtr s2 = Slice::StructPtr::dynamicCast(src); - if(s2) - { - if(checkRename(dest, src)) - { - return true; - } - - if(s2 && cl1->scoped() == s2->scoped()) - { - return true; - } - } - - return false; - } - - Slice::StructPtr s1 = Slice::StructPtr::dynamicCast(dest); - if(s1) - { - if(checkRename(dest, src)) - { - return true; - } - - Slice::StructPtr s2 = Slice::StructPtr::dynamicCast(src); - Slice::ClassDeclPtr cl2 = Slice::ClassDeclPtr::dynamicCast(src); - if((s2 && s1->scoped() == s2->scoped()) || (cl2 && s1->scoped() == cl2->scoped())) - { - return true; - } - - return false; - } - - Slice::ProxyPtr p1 = Slice::ProxyPtr::dynamicCast(dest); - if(p1) - { - Slice::BuiltinPtr b2 = Slice::BuiltinPtr::dynamicCast(src); - if(b2 && (b2->kind() == Slice::Builtin::KindObjectProxy || b2->kind() == Slice::Builtin::KindString)) - { - return true; - } - - Slice::ProxyPtr p2 = Slice::ProxyPtr::dynamicCast(src); - if(p2 && checkClasses(p1->_class(), p2->_class())) - { - return true; - } - - return false; - } - - Slice::DictionaryPtr d1 = Slice::DictionaryPtr::dynamicCast(dest); - if(d1) - { - Slice::DictionaryPtr d2 = Slice::DictionaryPtr::dynamicCast(src); - if(d2) - { - return isCompatible(d1->keyType(), d2->keyType()) && - isCompatible(d1->valueType(), d2->valueType()); - } - - return false; - } - - Slice::SequencePtr seq1 = Slice::SequencePtr::dynamicCast(dest); - if(seq1) - { - Slice::SequencePtr seq2 = Slice::SequencePtr::dynamicCast(src); - if(seq2) - { - return isCompatible(seq1->type(), seq2->type()); - } - - return false; - } - - Slice::EnumPtr e1 = Slice::EnumPtr::dynamicCast(dest); - if(e1) - { - Slice::BuiltinPtr b2 = Slice::BuiltinPtr::dynamicCast(src); - if(b2 && b2->kind() == Slice::Builtin::KindString) - { - return true; - } - - if(checkRename(dest, src)) - { - return true; - } - - Slice::EnumPtr e2 = Slice::EnumPtr::dynamicCast(src); - if(e2 && e1->scoped() == e2->scoped()) - { - return true; - } - - return false; - } - - assert(false); - return false; -} - -bool -FreezeScript::TransformVisitor::checkClasses(const Slice::ClassDeclPtr& dest, const Slice::ClassDeclPtr& src) -{ - // - // Here are the rules for verifying class compatibility: - // - // 1. If the type ids are the same, assume they are compatible. - // 2. If the source type has been renamed, then check its equivalent new definition for compatibility. - // 3. Otherwise, the types are only compatible if they are defined in the same Slice unit, and if the - // destination type is a base type of the source type. - // - string s1 = dest->scoped(); - string s2 = src->scoped(); - if(s1 == s2) - { - return true; - } - else - { - Slice::TypePtr t = _info->getRenamedType(src); - Slice::ClassDeclPtr s = Slice::ClassDeclPtr::dynamicCast(t); - if(s) - { - return checkClasses(dest, s); - } - - if(dest->unit().get() != src->unit().get()) - { - Slice::TypeList l = dest->unit()->lookupTypeNoBuiltin(s2, false); - if(l.empty()) - { - _info->getErrorReporter()->error("class " + s2 + " not found in new Slice definitions"); - } - s = Slice::ClassDeclPtr::dynamicCast(l.front()); - } - else - { - s = src; - } - - if(s) - { - Slice::ClassDefPtr def = s->definition(); - if(!def) - { - _info->getErrorReporter()->error("class " + s2 + " declared but not defined"); - } - return def->isA(s1); - } - } - - return false; -} - -void -FreezeScript::TransformVisitor::typeMismatchError(const Slice::TypePtr& dest, const Slice::TypePtr& src) -{ - ostringstream ostr; - ostr << "unable to transform"; - if(!_context.empty()) - { - ostr << ' ' << _context; - } - ostr << " from " << typeToString(src) << " to " << typeToString(dest); - warning(ostr.str()); -} - -void -FreezeScript::TransformVisitor::conversionError(const Slice::TypePtr& dest, const Slice::TypePtr& src, - const string& value) -{ - ostringstream ostr; - ostr << "unable to convert"; - if(!_context.empty()) - { - ostr << ' ' << _context; - } - ostr << " `" << value << "' from " << typeToString(src) << " to " << typeToString(dest); - warning(ostr.str()); -} - -void -FreezeScript::TransformVisitor::rangeError(const string& value, const Slice::TypePtr& type) -{ - ostringstream ostr; - if(!_context.empty()) - { - ostr << _context << ' '; - } - ostr << "`" << value << "' is out of range for type " << typeToString(type); - warning(ostr.str()); -} - -void -FreezeScript::TransformVisitor::warning(const string& msg) -{ - _info->getErrorReporter()->warning(msg); -} diff --git a/cpp/src/FreezeScript/TransformVisitor.h b/cpp/src/FreezeScript/TransformVisitor.h deleted file mode 100644 index 724f4b42b0a..00000000000 --- a/cpp/src/FreezeScript/TransformVisitor.h +++ /dev/null @@ -1,120 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_SCRIPT_TRANSFORM_VISITOR_H -#define FREEZE_SCRIPT_TRANSFORM_VISITOR_H - -#include - -namespace FreezeScript -{ - -// -// ObjectDataMap associates old instances of ObjectData to their -// transformed equivalents. -// -typedef std::map ObjectDataMap; - -// -// TransformInfo supplies information required by TransformVisitor. -// -class TransformInfo : public IceUtil::SimpleShared -{ -public: - - virtual ~TransformInfo() {} - - // - // Get data factory. - // - virtual DataFactoryPtr getDataFactory() = 0; - - // - // Get error reporter. - // - virtual ErrorReporterPtr getErrorReporter() = 0; - - // - // Indicates whether the default transformation should be performed. - // - virtual bool doDefaultTransform(const Slice::TypePtr&) = 0; - - // - // Indicates whether a base class transformation should be performed. - // - virtual bool doBaseTransform(const Slice::ClassDefPtr&) = 0; - - // - // Given an old type, return the equivalent new type if the type - // has been renamed. - // - virtual Slice::TypePtr getRenamedType(const Slice::TypePtr&) = 0; - - // - // Execute the custom transformation for the given old and new Data values. - // - virtual void executeCustomTransform(const DataPtr&, const DataPtr&) = 0; - - // - // The facet name of the database (evictor only). - // - virtual std::string facetName() = 0; - - // - // Indicates whether objects should be removed if no class definition is found. - // - virtual bool purgeObjects() = 0; - - // - // Associates old object instances with their transformed equivalents. - // - virtual ObjectDataMap& getObjectDataMap() = 0; -}; -typedef IceUtil::Handle TransformInfoPtr; - -// -// TransformVisitor is used to visit a destination Data value and -// preserve as much information as possible from the source Data value. -// -class TransformVisitor : public DataVisitor -{ -public: - - TransformVisitor(const DataPtr&, const TransformInfoPtr&, const std::string& = std::string()); - - virtual void visitBoolean(const BooleanDataPtr&); - virtual void visitInteger(const IntegerDataPtr&); - virtual void visitDouble(const DoubleDataPtr&); - virtual void visitString(const StringDataPtr&); - virtual void visitProxy(const ProxyDataPtr&); - virtual void visitStruct(const StructDataPtr&); - virtual void visitSequence(const SequenceDataPtr&); - virtual void visitEnum(const EnumDataPtr&); - virtual void visitDictionary(const DictionaryDataPtr&); - virtual void visitObject(const ObjectRefPtr&); - -private: - - void transformObject(const ObjectDataPtr&, const ObjectDataPtr&); - bool checkRename(const Slice::TypePtr&, const Slice::TypePtr&); - bool isCompatible(const Slice::TypePtr&, const Slice::TypePtr&); - bool checkClasses(const Slice::ClassDeclPtr&, const Slice::ClassDeclPtr&); - void typeMismatchError(const Slice::TypePtr&, const Slice::TypePtr&); - void conversionError(const Slice::TypePtr&, const Slice::TypePtr&, const std::string&); - void rangeError(const std::string&, const Slice::TypePtr&); - void warning(const std::string&); - - DataPtr _src; - TransformInfoPtr _info; - std::string _context; // Provides additional detail for use in warning messages. -}; - -} // End of namespace FreezeScript - -#endif diff --git a/cpp/src/FreezeScript/Transformer.cpp b/cpp/src/FreezeScript/Transformer.cpp deleted file mode 100644 index e6fc8f66c19..00000000000 --- a/cpp/src/FreezeScript/Transformer.cpp +++ /dev/null @@ -1,3044 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -namespace FreezeScript -{ - -class DeleteRecordException {}; - -class Descriptor; -typedef IceUtil::Handle DescriptorPtr; - -class InitDescriptor; -typedef IceUtil::Handle InitDescriptorPtr; - -class TransformDescriptor; -typedef IceUtil::Handle TransformDescriptorPtr; - -class TransformDataFactory; -typedef IceUtil::Handle TransformDataFactoryPtr; - -typedef map TransformMap; -typedef map RenameMap; - -// -// TransformInfoI -// -struct TransformInfoI : public TransformInfo -{ - virtual DataFactoryPtr getDataFactory(); - virtual ErrorReporterPtr getErrorReporter(); - virtual bool doDefaultTransform(const Slice::TypePtr&); - virtual bool doBaseTransform(const Slice::ClassDefPtr&); - virtual Slice::TypePtr getRenamedType(const Slice::TypePtr&); - virtual void executeCustomTransform(const DataPtr&, const DataPtr&); - virtual string facetName(); - virtual bool purgeObjects(); - virtual ObjectDataMap& getObjectDataMap(); - - Ice::CommunicatorPtr communicator; - FreezeScript::ObjectFactoryPtr objectFactory; - Slice::UnitPtr oldUnit; - Slice::UnitPtr newUnit; - Db* oldDb; - Db* newDb; - DbTxn* newDbTxn; - - // - // Connection to the new environment; not null only if we want to write into the catalog - // - Freeze::ConnectionPtr connection; - string newDbName; - - string facet; - bool purge; - ErrorReporterPtr errorReporter; - TransformDataFactoryPtr factory; - SymbolTablePtr symbolTable; - Slice::TypePtr oldKeyType; - Slice::TypePtr oldValueType; - Slice::TypePtr newKeyType; - Slice::TypePtr newValueType; - TransformMap transformMap; - RenameMap renameMap; - ObjectDataMap objectDataMap; -}; -typedef IceUtil::Handle TransformInfoIPtr; - -// -// TransformDataFactory -// -class TransformDataFactory : public DataFactory -{ -public: - - TransformDataFactory(const Ice::CommunicatorPtr&, const Slice::UnitPtr&, const ErrorReporterPtr&); - - void addInitDescriptor(const InitDescriptorPtr&); - void disableInitializers(); - void enableInitializers(); - -protected: - - virtual void initialize(const DataPtr&); - -private: - - typedef map InitMap; - InitMap _initMap; - bool _enabled; -}; - -// -// Descriptor -// -class Descriptor : public IceUtil::SimpleShared -{ -public: - - virtual ~Descriptor(); - - virtual DescriptorPtr parent() const; - virtual void addChild(const DescriptorPtr&) = 0; - virtual void validate() = 0; - virtual void execute(const SymbolTablePtr&) = 0; - -protected: - - Descriptor(const DescriptorPtr&, int, const TransformInfoIPtr&); - - NodePtr parse(const string&) const; - - Slice::TypePtr findType(const Slice::UnitPtr&, const string&); - - DescriptorPtr _parent; - int _line; - TransformInfoIPtr _info; -}; - -// -// SetDescriptor -// -class SetDescriptor : public Descriptor -{ -public: - - SetDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&); - -private: - - EntityNodePtr _target; - NodePtr _value; - string _valueStr; - string _type; - NodePtr _length; - string _lengthStr; - bool _convert; -}; - -// -// DefineDescriptor -// -class DefineDescriptor : public Descriptor -{ -public: - - DefineDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&); - -private: - - string _name; - NodePtr _value; - string _valueStr; - Slice::TypePtr _type; - bool _convert; -}; - -// -// AddDescriptor -// -class AddDescriptor : public Descriptor -{ -public: - - AddDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&); - -private: - - EntityNodePtr _target; - NodePtr _key; - string _keyStr; - NodePtr _index; - string _indexStr; - NodePtr _value; - string _valueStr; - string _type; - bool _convert; -}; - -// -// RemoveDescriptor -// -class RemoveDescriptor : public Descriptor -{ -public: - - RemoveDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&); - -private: - - EntityNodePtr _target; - NodePtr _key; - string _keyStr; - NodePtr _index; - string _indexStr; -}; - -// -// DeleteDescriptor -// -class DeleteDescriptor : public Descriptor -{ -public: - - DeleteDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&); -}; - -// -// FailDescriptor -// -class FailDescriptor : public Descriptor -{ -public: - - FailDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&); - -private: - - NodePtr _test; - string _testStr; - string _message; -}; - -// -// EchoDescriptor -// -class EchoDescriptor : public Descriptor -{ -public: - - EchoDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&); - -private: - - string _message; - NodePtr _value; - string _valueStr; -}; - -// -// ExecutableContainerDescriptor -// -class ExecutableContainerDescriptor : public Descriptor -{ -public: - - ExecutableContainerDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&, - const string&); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&); - -protected: - - vector _children; - -private: - - string _name; -}; - -// -// IfDescriptor -// -class IfDescriptor : public ExecutableContainerDescriptor -{ -public: - - IfDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); - - virtual void execute(const SymbolTablePtr&); - -private: - - NodePtr _test; - string _testStr; -}; - -// -// IterateDescriptor -// -class IterateDescriptor : public ExecutableContainerDescriptor -{ -public: - - IterateDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); - - virtual void execute(const SymbolTablePtr&); - -private: - - EntityNodePtr _target; - string _key; - string _value; - string _element; - string _index; -}; - -// -// TransformDescriptor -// -class TransformDescriptor : public ExecutableContainerDescriptor -{ -public: - - TransformDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); - - Slice::TypePtr type() const; - string typeName() const; - Slice::TypePtr renameType() const; - string renameTypeName() const; - bool doDefaultTransform() const; - bool doBaseTransform() const; - -private: - - bool _default; - bool _base; - Slice::TypePtr _newType; - Slice::TypePtr _renameType; -}; -typedef IceUtil::Handle TransformDescriptorPtr; - -// -// InitDescriptor -// -class InitDescriptor : public ExecutableContainerDescriptor -{ -public: - - InitDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); - - void initialize(const DataPtr&); - - string typeName() const; - -private: - - Slice::TypePtr _type; -}; - -// -// RecordDescriptor -// -class RecordDescriptor : public ExecutableContainerDescriptor -{ -public: - - RecordDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); - - virtual void execute(const SymbolTablePtr&); - -private: - - void transformRecord(const Ice::ByteSeq&, const Ice::ByteSeq&, Ice::ByteSeq&, Ice::ByteSeq&); - - Slice::UnitPtr _old; - Slice::UnitPtr _new; -}; -typedef IceUtil::Handle RecordDescriptorPtr; - -// -// DatabaseDescriptor -// -class DatabaseDescriptor : public ExecutableContainerDescriptor -{ -public: - - DatabaseDescriptor(const DescriptorPtr&, int, const TransformInfoIPtr&, const IceXML::Attributes&); - - virtual void addChild(const DescriptorPtr&); - virtual void execute(const SymbolTablePtr&); - - string name() const; - -private: - - string _name; - string _oldKeyName; - string _oldValueName; - string _newKeyName; - string _newValueName; - RecordDescriptorPtr _record; -}; -typedef IceUtil::Handle DatabaseDescriptorPtr; - -// -// TransformDBDescriptor -// -class TransformDBDescriptor : public Descriptor -{ -public: - - TransformDBDescriptor(int, const TransformInfoIPtr&, const IceXML::Attributes&); - ~TransformDBDescriptor(); - - virtual void addChild(const DescriptorPtr&); - virtual void validate(); - virtual void execute(const SymbolTablePtr&); - -private: - - map _databases; - vector _children; -}; -typedef IceUtil::Handle TransformDBDescriptorPtr; - -// -// SymbolTableI -// -class SymbolTableI : public SymbolTable -{ -public: - - SymbolTableI(const TransformInfoIPtr&, const SymbolTablePtr& = SymbolTablePtr()); - - virtual void add(const string&, const DataPtr&); - - virtual DataPtr getValue(const EntityNodePtr&) const; - - virtual DataPtr getConstantValue(const string&) const; - - virtual SymbolTablePtr createChild(); - - virtual Slice::TypePtr lookupType(const string&); - - virtual DataPtr invokeFunction(const string&, const DataPtr&, const DataList&); - -private: - - DataPtr findValue(const string&) const; - - class EntityVisitor : public EntityNodeVisitor - { - public: - - EntityVisitor(SymbolTableI*); - - virtual void visitIdentifier(const string&); - virtual void visitElement(const NodePtr&); - - DataPtr getCurrent() const; - - private: - - SymbolTableI* _table; - DataPtr _current; - bool _error; - }; - - friend class EntityVisitor; - - TransformInfoIPtr _info; - SymbolTablePtr _parent; - typedef map DataMap; - DataMap _dataMap; - DataMap _constantCache; -}; -typedef IceUtil::Handle SymbolTableIPtr; - -// -// ObjectVisitor -// -class ObjectVisitor : public DataVisitor -{ -public: - - ObjectVisitor(ObjectDataMap&); - - virtual void visitStruct(const StructDataPtr&); - virtual void visitSequence(const SequenceDataPtr&); - virtual void visitDictionary(const DictionaryDataPtr&); - virtual void visitObject(const ObjectRefPtr&); - -private: - - ObjectDataMap& _map; -}; - -// -// DescriptorHandler -// -class DescriptorHandler : public IceXML::Handler -{ -public: - - DescriptorHandler(const TransformInfoIPtr&); - - virtual void startElement(const string&, const IceXML::Attributes&, int, int); - virtual void endElement(const string&, int, int); - virtual void characters(const string&, int, int); - virtual void error(const string&, int, int); - - TransformDBDescriptorPtr descriptor() const; - -private: - - TransformInfoIPtr _info; - DescriptorPtr _current; - TransformDBDescriptorPtr _descriptor; -}; - -void assignOrTransform(const DataPtr&, const DataPtr&, bool, const TransformInfoPtr&); - -} // End of namespace FreezeScript - -// -// TransformDataFactory -// -FreezeScript::TransformDataFactory::TransformDataFactory(const Ice::CommunicatorPtr& communicator, - const Slice::UnitPtr& unit, - const ErrorReporterPtr& errorReporter) : - DataFactory(communicator, unit, errorReporter), _enabled(true) -{ -} - -void -FreezeScript::TransformDataFactory::addInitDescriptor(const InitDescriptorPtr& init) -{ - string typeName = init->typeName(); - assert(_initMap.find(typeName) == _initMap.end()); - _initMap.insert(InitMap::value_type(typeName, init)); -} - -void -FreezeScript::TransformDataFactory::initialize(const DataPtr& data) -{ - if(_enabled) - { - string typeName = typeToString(data->getType()); - InitMap::iterator p = _initMap.find(typeName); - if(p != _initMap.end()) - { - p->second->initialize(data); - } - } -} - -void -FreezeScript::TransformDataFactory::disableInitializers() -{ - _enabled = false; -} - -void -FreezeScript::TransformDataFactory::enableInitializers() -{ - _enabled = true; -} - -// -// Descriptor -// -FreezeScript::Descriptor::Descriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info) : - _parent(parent), _line(line), _info(info) -{ -} - -FreezeScript::Descriptor::~Descriptor() -{ -} - -FreezeScript::DescriptorPtr -FreezeScript::Descriptor::parent() const -{ - return _parent; -} - -FreezeScript::NodePtr -FreezeScript::Descriptor::parse(const string& expr) const -{ - return parseExpression(expr, _info->factory, _info->errorReporter); -} - -Slice::TypePtr -FreezeScript::Descriptor::findType(const Slice::UnitPtr& u, const string& type) -{ - Slice::TypeList l; - - l = u->lookupType(type, false); - if(l.empty()) - { - _info->errorReporter->error("unknown type `" + type + "'"); - } - - return l.front(); -} - -// -// SetDescriptor -// -FreezeScript::SetDescriptor::SetDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, - const IceXML::Attributes& attributes) : - Descriptor(parent, line, info) -{ - DescriptorErrorContext ctx(_info->errorReporter, "set", _line); - - IceXML::Attributes::const_iterator p; - - string target; - p = attributes.find("target"); - if(p == attributes.end()) - { - _info->errorReporter->error("required attribute `target' is missing"); - } - target = p->second; - - p = attributes.find("value"); - if(p != attributes.end()) - { - _valueStr = p->second; - } - - p = attributes.find("type"); - if(p != attributes.end()) - { - _type = p->second; - } - - p = attributes.find("length"); - if(p != attributes.end()) - { - _lengthStr = p->second; - } - - p = attributes.find("convert"); - if(p != attributes.end()) - { - _convert = p->second == "true"; - } - - if(!_valueStr.empty() && !_type.empty()) - { - _info->errorReporter->error("attributes `value' and 'type' are mutually exclusive"); - } - - if(_valueStr.empty() && _type.empty() && _lengthStr.empty()) - { - _info->errorReporter->error("requires a value for attributes `value', 'type' or 'length'"); - } - - NodePtr node = parse(target); - _target = EntityNodePtr::dynamicCast(node); - if(!_target) - { - _info->errorReporter->error("`target' attribute is not an entity: `" + target + "'"); - } - - if(!_valueStr.empty()) - { - _value = parse(_valueStr); - } - - if(!_lengthStr.empty()) - { - _length = parse(_lengthStr); - } -} - -void -FreezeScript::SetDescriptor::addChild(const DescriptorPtr&) -{ - DescriptorErrorContext ctx(_info->errorReporter, "set", _line); - _info->errorReporter->error("child elements are not supported"); -} - -void -FreezeScript::SetDescriptor::validate() -{ -} - -void -FreezeScript::SetDescriptor::execute(const SymbolTablePtr& sym) -{ - DescriptorErrorContext ctx(_info->errorReporter, "set", _line); - - DataPtr data = sym->getValue(_target); - if(data->readOnly()) - { - ostringstream ostr; - ostr << _target; - _info->errorReporter->error("target `" + ostr.str() + "' cannot be modified"); - } - - DataPtr value; - if(_value) - { - try - { - value = _value->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _info->errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); - } - } - - Destroyer valueDestroyer; - if(!_type.empty()) - { - assert(!value); - Slice::TypePtr type = sym->lookupType(_type); - if(!type) - { - _info->errorReporter->error("type `" + _type + "' not found"); - } - value = _info->factory->createObject(type, false); - valueDestroyer.set(value); - } - - DataPtr length; - if(_length) - { - SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); - if(!seq) - { - ostringstream ostr; - ostr << _target; - _info->errorReporter->error("target `" + ostr.str() + "' is not a sequence"); - } - - try - { - length = _length->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _info->errorReporter->error("evaluation of length `" + _lengthStr + "' failed:\n" + ex.reason()); - } - - DataList& elements = seq->getElements(); - Ice::Long l = length->integerValue(); - if(l < 0 || l > INT_MAX) - { - _info->errorReporter->error("sequence length " + length->toString() + " is out of range"); - } - - DataList::size_type len = static_cast(l); - if(len < elements.size()) - { - for(DataList::size_type i = len; i < elements.size(); ++i) - { - elements[i]->destroy(); - } - elements.resize(len); - } - else if(len > elements.size()) - { - Slice::SequencePtr seqType = Slice::SequencePtr::dynamicCast(seq->getType()); - assert(seqType); - Slice::TypePtr elemType = seqType->type(); - for(DataList::size_type i = elements.size(); i < len; ++i) - { - DataPtr v = _info->factory->create(elemType, false); - if(value) - { - assignOrTransform(v, value, _convert, _info); - } - elements.push_back(v); - } - } - } - else - { - assignOrTransform(data, value, _convert, _info); - } -} - -// -// DefineDescriptor -// -FreezeScript::DefineDescriptor::DefineDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, - const IceXML::Attributes& attributes) : - Descriptor(parent, line, info) -{ - DescriptorErrorContext ctx(_info->errorReporter, "define", _line); - - IceXML::Attributes::const_iterator p; - - p = attributes.find("name"); - if(p == attributes.end()) - { - _info->errorReporter->error("required attribute `name' is missing"); - } - _name = p->second; - - p = attributes.find("type"); - if(p == attributes.end()) - { - _info->errorReporter->error("required attribute `type' is missing"); - } - if(p->second.find("::New") != string::npos) - { - Slice::TypeList l = _info->newUnit->lookupType(p->second.substr(5), false); - if(l.empty()) - { - _info->errorReporter->error("type `" + p->second + "' not found"); - } - _type = l.front(); - } - else if(p->second.find("::Old") != string::npos) - { - Slice::TypeList l = _info->oldUnit->lookupType(p->second.substr(5), false); - if(l.empty()) - { - _info->errorReporter->error("type `" + p->second + "' not found"); - } - _type = l.front(); - } - else - { - Slice::TypeList l = _info->newUnit->lookupType(p->second, false); - if(l.empty()) - { - _info->errorReporter->error("type `" + p->second + "' not found"); - } - _type = l.front(); - } - - p = attributes.find("value"); - if(p != attributes.end()) - { - _valueStr = p->second; - } - - p = attributes.find("convert"); - if(p != attributes.end()) - { - _convert = p->second == "true"; - } - - if(!_valueStr.empty()) - { - _value = parse(_valueStr); - } -} - -void -FreezeScript::DefineDescriptor::addChild(const DescriptorPtr&) -{ - DescriptorErrorContext ctx(_info->errorReporter, "define", _line); - _info->errorReporter->error("child elements are not supported"); -} - -void -FreezeScript::DefineDescriptor::validate() -{ -} - -void -FreezeScript::DefineDescriptor::execute(const SymbolTablePtr& sym) -{ - DescriptorErrorContext ctx(_info->errorReporter, "define", _line); - - DataPtr data = _info->factory->create(_type, false); - - DataPtr value; - if(_value) - { - try - { - value = _value->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _info->errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); - } - } - - if(value) - { - assignOrTransform(data, value, _convert, _info); - } - - sym->add(_name, data); -} - -// -// AddDescriptor -// -FreezeScript::AddDescriptor::AddDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, - const IceXML::Attributes& attributes) : - Descriptor(parent, line, info) -{ - DescriptorErrorContext ctx(_info->errorReporter, "add", _line); - - IceXML::Attributes::const_iterator p; - - string target; - p = attributes.find("target"); - if(p == attributes.end()) - { - _info->errorReporter->error("required attribute `target' is missing"); - } - target = p->second; - - p = attributes.find("key"); - if(p != attributes.end()) - { - _keyStr = p->second; - } - - p = attributes.find("index"); - if(p != attributes.end()) - { - _indexStr = p->second; - } - - p = attributes.find("value"); - if(p != attributes.end()) - { - _valueStr = p->second; - } - - p = attributes.find("type"); - if(p != attributes.end()) - { - _type = p->second; - } - - p = attributes.find("convert"); - if(p != attributes.end()) - { - _convert = p->second == "true"; - } - - if(!_keyStr.empty() && !_indexStr.empty()) - { - _info->errorReporter->error("attributes `key' and `index' are mutually exclusive"); - } - - if(_keyStr.empty() && _indexStr.empty()) - { - _info->errorReporter->error("one of attributes `key' or `index' is required"); - } - - if(!_valueStr.empty() && !_type.empty()) - { - _info->errorReporter->error("attributes `value' and `type' are mutually exclusive"); - } - - NodePtr node = parse(target); - _target = EntityNodePtr::dynamicCast(node); - if(!_target) - { - _info->errorReporter->error("`target' attribute is not an entity: `" + target + "'"); - } - - if(!_keyStr.empty()) - { - _key = parse(_keyStr); - } - - if(!_indexStr.empty()) - { - _index = parse(_indexStr); - } - - if(!_valueStr.empty()) - { - _value = parse(_valueStr); - } -} - -void -FreezeScript::AddDescriptor::addChild(const DescriptorPtr&) -{ - DescriptorErrorContext ctx(_info->errorReporter, "add", _line); - _info->errorReporter->error("child elements are not supported"); -} - -void -FreezeScript::AddDescriptor::validate() -{ -} - -void -FreezeScript::AddDescriptor::execute(const SymbolTablePtr& sym) -{ - DescriptorErrorContext ctx(_info->errorReporter, "add", _line); - - DataPtr data = sym->getValue(_target); - if(data->readOnly()) - { - ostringstream ostr; - ostr << _target; - _info->errorReporter->error("target `" + ostr.str() + "' cannot be modified"); - } - - if(_key) - { - DictionaryDataPtr dict = DictionaryDataPtr::dynamicCast(data); - if(!dict) - { - ostringstream ostr; - ostr << _target; - _info->errorReporter->error("target `" + ostr.str() + "' is not a dictionary"); - } - - Slice::DictionaryPtr type = Slice::DictionaryPtr::dynamicCast(dict->getType()); - assert(type); - - DataPtr key; - Destroyer keyDestroyer; - try - { - DataPtr v = _key->evaluate(sym); - key = _info->factory->create(type->keyType(), false); - keyDestroyer.set(key); - assignOrTransform(key, v, _convert, _info); - } - catch(const EvaluateException& ex) - { - _info->errorReporter->error("evaluation of key `" + _keyStr + "' failed:\n" + ex.reason()); - } - - if(dict->getElement(key)) - { - ostringstream ostr; - printData(key, ostr); - _info->errorReporter->error("key " + ostr.str() + " already exists in dictionary"); - } - - DataPtr elem = _info->factory->create(type->valueType(), false); - Destroyer elemDestroyer(elem); - - DataPtr value; - if(_value) - { - try - { - value = _value->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _info->errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); - } - } - - Destroyer valueDestroyer; - if(!_type.empty()) - { - assert(!value); - Slice::TypePtr type = sym->lookupType(_type); - if(!type) - { - _info->errorReporter->error("type `" + _type + "' not found"); - } - value = _info->factory->createObject(type, false); - valueDestroyer.set(value); - } - - if(value) - { - assignOrTransform(elem, value, _convert, _info); - } - DataMap& map = dict->getElements(); - map.insert(DataMap::value_type(key, elem)); - keyDestroyer.release(); - elemDestroyer.release(); - } - else - { - assert(_index); - - SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); - if(!seq) - { - ostringstream ostr; - ostr << _target; - _info->errorReporter->error("target `" + ostr.str() + "' is not a sequence"); - } - - Slice::SequencePtr type = Slice::SequencePtr::dynamicCast(seq->getType()); - assert(type); - - DataPtr index; - Destroyer indexDestroyer; - try - { - index = _index->evaluate(sym); - indexDestroyer.set(index); - } - catch(const EvaluateException& ex) - { - _info->errorReporter->error("evaluation of index `" + _indexStr + "' failed:\n" + ex.reason()); - } - - DataList& elements = seq->getElements(); - Ice::Long l = index->integerValue(); - DataList::size_type i = static_cast(l); - if(l < 0 || l > INT_MAX || i > elements.size()) - { - _info->errorReporter->error("sequence index " + index->toString() + " is out of range"); - } - - DataPtr elem = _info->factory->create(type->type(), false); - Destroyer elemDestroyer(elem); - - DataPtr value; - if(_value) - { - try - { - value = _value->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _info->errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); - } - } - - Destroyer valueDestroyer; - if(!_type.empty()) - { - assert(!value); - Slice::TypePtr type = sym->lookupType(_type); - if(!type) - { - _info->errorReporter->error("type `" + _type + "' not found"); - } - value = _info->factory->createObject(type, false); - valueDestroyer.set(value); - } - - if(value) - { - assignOrTransform(elem, value, _convert, _info); - } - - elements.insert(elements.begin() + i, elem); - indexDestroyer.release(); - elemDestroyer.release(); - } -} - -// -// RemoveDescriptor -// -FreezeScript::RemoveDescriptor::RemoveDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, - const IceXML::Attributes& attributes) : - Descriptor(parent, line, info) -{ - DescriptorErrorContext ctx(_info->errorReporter, "remove", _line); - - IceXML::Attributes::const_iterator p; - - string target; - p = attributes.find("target"); - if(p == attributes.end()) - { - _info->errorReporter->error("required attribute `target' is missing"); - } - target = p->second; - - p = attributes.find("key"); - if(p != attributes.end()) - { - _keyStr = p->second; - } - - p = attributes.find("index"); - if(p != attributes.end()) - { - _indexStr = p->second; - } - - NodePtr node = parse(target); - _target = EntityNodePtr::dynamicCast(node); - if(!_target) - { - _info->errorReporter->error("`target' attribute is not an entity: `" + target + "'"); - } - - if(!_keyStr.empty() && !_indexStr.empty()) - { - _info->errorReporter->error("attributes `key' and `index' are mutually exclusive"); - } - - if(_keyStr.empty() && _indexStr.empty()) - { - _info->errorReporter->error("one of attributes `key' or `index' is required"); - } - - if(!_keyStr.empty()) - { - _key = parse(_keyStr); - } - - if(!_indexStr.empty()) - { - _index = parse(_indexStr); - } -} - -void -FreezeScript::RemoveDescriptor::addChild(const DescriptorPtr&) -{ - DescriptorErrorContext ctx(_info->errorReporter, "remove", _line); - _info->errorReporter->error("child elements are not supported"); -} - -void -FreezeScript::RemoveDescriptor::validate() -{ -} - -void -FreezeScript::RemoveDescriptor::execute(const SymbolTablePtr& sym) -{ - DescriptorErrorContext ctx(_info->errorReporter, "remove", _line); - - DataPtr data = sym->getValue(_target); - if(data->readOnly()) - { - ostringstream ostr; - ostr << _target; - _info->errorReporter->error("target `" + ostr.str() + "' cannot be modified"); - } - - if(_key) - { - DataPtr key; - try - { - key = _key->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _info->errorReporter->error("evaluation of key `" + _keyStr + "' failed:\n" + ex.reason()); - } - - DictionaryDataPtr dict = DictionaryDataPtr::dynamicCast(data); - if(!dict) - { - ostringstream ostr; - ostr << _target; - _info->errorReporter->error("target `" + ostr.str() + "' is not a dictionary"); - } - - DataMap& map = dict->getElements(); - DataMap::iterator p = map.find(key); - if(p != map.end()) - { - p->first->destroy(); - p->second->destroy(); - map.erase(p); - } - } - else - { - assert(_index); - - DataPtr index; - try - { - index = _index->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _info->errorReporter->error("evaluation of index `" + _indexStr + "' failed:\n" + ex.reason()); - } - - SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); - if(!seq) - { - ostringstream ostr; - ostr << _target; - _info->errorReporter->error("target `" + ostr.str() + "' is not a sequence"); - } - - DataList& elements = seq->getElements(); - Ice::Long l = index->integerValue(); - DataList::size_type i = static_cast(l); - if(l < 0 || l > INT_MAX || i >= elements.size()) - { - _info->errorReporter->error("sequence index " + index->toString() + " is out of range"); - } - - elements[i]->destroy(); - elements.erase(elements.begin() + i); - } -} - -// -// DeleteDescriptor -// -FreezeScript::DeleteDescriptor::DeleteDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, - const IceXML::Attributes&) : - Descriptor(parent, line, info) -{ -} - -void -FreezeScript::DeleteDescriptor::addChild(const DescriptorPtr&) -{ - DescriptorErrorContext ctx(_info->errorReporter, "delete", _line); - _info->errorReporter->error("child elements are not supported"); -} - -void -FreezeScript::DeleteDescriptor::validate() -{ -} - -void -FreezeScript::DeleteDescriptor::execute(const SymbolTablePtr&) -{ - throw DeleteRecordException(); -} - -// -// FailDescriptor -// -FreezeScript::FailDescriptor::FailDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, - const IceXML::Attributes& attributes) : - Descriptor(parent, line, info) -{ - IceXML::Attributes::const_iterator p; - - p = attributes.find("test"); - if(p != attributes.end()) - { - _testStr = p->second; - } - - p = attributes.find("message"); - if(p != attributes.end()) - { - _message = p->second; - } - - if(!_testStr.empty()) - { - _test = parse(_testStr); - } - - if(_message.empty()) - { - ostringstream ostr; - ostr << " executed at line " << line << endl; - _message = ostr.str(); - } -} - -void -FreezeScript::FailDescriptor::addChild(const DescriptorPtr&) -{ - DescriptorErrorContext ctx(_info->errorReporter, "fail", _line); - _info->errorReporter->error("child elements are not supported"); -} - -void -FreezeScript::FailDescriptor::validate() -{ -} - -void -FreezeScript::FailDescriptor::execute(const SymbolTablePtr& sym) -{ - DescriptorErrorContext ctx(_info->errorReporter, "fail", _line); - - if(_test) - { - try - { - DataPtr b = _test->evaluate(sym); - BooleanDataPtr bd = BooleanDataPtr::dynamicCast(b); - if(!bd) - { - _info->errorReporter->error("expression `" + _testStr + "' does not evaluate to a boolean"); - } - if(!bd->booleanValue()) - { - return; - } - } - catch(const EvaluateException& ex) - { - _info->errorReporter->error("evaluation of expression `" + _testStr + "' failed:\n" + ex.reason()); - } - } - - throw FailureException(__FILE__, __LINE__, _message); -} - -// -// EchoDescriptor -// -FreezeScript::EchoDescriptor::EchoDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, - const IceXML::Attributes& attributes) : - Descriptor(parent, line, info) -{ - IceXML::Attributes::const_iterator p; - - p = attributes.find("message"); - if(p != attributes.end()) - { - _message = p->second; - } - - p = attributes.find("value"); - if(p != attributes.end()) - { - _valueStr = p->second; - } - - if(!_valueStr.empty()) - { - _value = parse(_valueStr); - } -} - -void -FreezeScript::EchoDescriptor::addChild(const DescriptorPtr&) -{ - DescriptorErrorContext ctx(_info->errorReporter, "echo", _line); - _info->errorReporter->error("child elements are not supported"); -} - -void -FreezeScript::EchoDescriptor::validate() -{ -} - -void -FreezeScript::EchoDescriptor::execute(const SymbolTablePtr& sym) -{ - DescriptorErrorContext ctx(_info->errorReporter, "echo", _line); - - ostream& out = _info->errorReporter->stream(); - - if(!_message.empty()) - { - out << _message; - } - - if(_value) - { - DataPtr v; - try - { - v = _value->evaluate(sym); - } - catch(const EvaluateException& ex) - { - _info->errorReporter->error("evaluation of value `" + _valueStr + "' failed:\n" + ex.reason()); - } - printData(v, out); - } - - out << endl; -} - -// -// ExecutableContainerDescriptor -// -FreezeScript::ExecutableContainerDescriptor::ExecutableContainerDescriptor(const DescriptorPtr& parent, int line, - const TransformInfoIPtr& info, - const IceXML::Attributes&, - const string& name) : - Descriptor(parent, line, info), _name(name) -{ -} - -void -FreezeScript::ExecutableContainerDescriptor::addChild(const DescriptorPtr& child) -{ - _children.push_back(child); -} - -void -FreezeScript::ExecutableContainerDescriptor::validate() -{ - for(vector::iterator p = _children.begin(); p != _children.end(); ++p) - { - (*p)->validate(); - } -} - -void -FreezeScript::ExecutableContainerDescriptor::execute(const SymbolTablePtr& sym) -{ - for(vector::iterator p = _children.begin(); p != _children.end(); ++p) - { - (*p)->execute(sym); - } -} - -// -// IfDescriptor -// -FreezeScript::IfDescriptor::IfDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, - const IceXML::Attributes& attributes) : - ExecutableContainerDescriptor(parent, line, info, attributes, "if") -{ - DescriptorErrorContext ctx(_info->errorReporter, "if", _line); - - IceXML::Attributes::const_iterator p = attributes.find("test"); - if(p == attributes.end()) - { - _info->errorReporter->error("required attribute `test' is missing"); - } - _testStr = p->second; - - _test = parse(_testStr); -} - -void -FreezeScript::IfDescriptor::execute(const SymbolTablePtr& sym) -{ - DescriptorErrorContext ctx(_info->errorReporter, "if", _line); - - try - { - DataPtr b = _test->evaluate(sym); - BooleanDataPtr bd = BooleanDataPtr::dynamicCast(b); - if(!bd) - { - _info->errorReporter->error("expression `" + _testStr + "' does not evaluate to a boolean"); - } - if(bd->booleanValue()) - { - ExecutableContainerDescriptor::execute(sym); - } - } - catch(const EvaluateException& ex) - { - _info->errorReporter->error("evaluation of conditional expression `" + _testStr + "' failed:\n" + ex.reason()); - } -} - -// -// IterateDescriptor -// -FreezeScript::IterateDescriptor::IterateDescriptor(const DescriptorPtr& parent, int line, - const TransformInfoIPtr& info, - const IceXML::Attributes& attributes) : - ExecutableContainerDescriptor(parent, line, info, attributes, "iterate") -{ - DescriptorErrorContext ctx(_info->errorReporter, "iterate", _line); - - IceXML::Attributes::const_iterator p; - string target; - - p = attributes.find("target"); - if(p == attributes.end()) - { - _info->errorReporter->error("required attribute `target' is missing"); - } - target = p->second; - - p = attributes.find("key"); - if(p != attributes.end()) - { - _key = p->second; - } - - p = attributes.find("value"); - if(p != attributes.end()) - { - _value = p->second; - } - - p = attributes.find("element"); - if(p != attributes.end()) - { - _element = p->second; - } - - p = attributes.find("index"); - if(p != attributes.end()) - { - _index = p->second; - } - - NodePtr node = parse(target); - _target = EntityNodePtr::dynamicCast(node); - if(!_target) - { - _info->errorReporter->error("`target' attribute is not an entity: `" + target + "'"); - } -} - -void -FreezeScript::IterateDescriptor::execute(const SymbolTablePtr& sym) -{ - DescriptorErrorContext ctx(_info->errorReporter, "iterate", _line); - - DataPtr data = sym->getValue(_target); - - DictionaryDataPtr dict = DictionaryDataPtr::dynamicCast(data); - SequenceDataPtr seq = SequenceDataPtr::dynamicCast(data); - if(!dict && !seq) - { - ostringstream ostr; - ostr << _target; - _info->errorReporter->error("target `" + ostr.str() + "' is not a dictionary or sequence"); - } - - if(dict) - { - if(!_element.empty()) - { - _info->errorReporter->error("attribute `element' specified for dictionary target"); - } - if(!_index.empty()) - { - _info->errorReporter->error("attribute `index' specified for dictionary target"); - } - - string key = _key; - if(key.empty()) - { - key = "key"; - } - - string value = _value; - if(value.empty()) - { - value = "value"; - } - - DataMap& map = dict->getElements(); - for(DataMap::iterator p = map.begin(); p != map.end(); ++p) - { - SymbolTablePtr elemSym = sym->createChild(); - elemSym->add(key, p->first); - elemSym->add(value, p->second); - ExecutableContainerDescriptor::execute(elemSym); - } - } - else - { - if(!_key.empty()) - { - _info->errorReporter->error("attribute `key' specified for sequence target"); - } - if(!_value.empty()) - { - _info->errorReporter->error("attribute `value' specified for sequence target"); - } - - string element = _element; - if(element.empty()) - { - element = "elem"; - } - - string index = _index; - if(index.empty()) - { - index = "i"; - } - - // - // NOTE: Don't use iterator to traverse vector because child descriptors might remove elements. - // - DataList& l = seq->getElements(); - DataList::size_type i = 0; - while(i < l.size()) - { - SymbolTablePtr elemSym = sym->createChild(); - elemSym->add(element, l[i]); - elemSym->add(index, _info->factory->createInteger(i, true)); - ExecutableContainerDescriptor::execute(elemSym); - ++i; - } - } -} - -// -// TransformDescriptor -// -FreezeScript::TransformDescriptor::TransformDescriptor(const DescriptorPtr& parent, int line, - const TransformInfoIPtr& info, - const IceXML::Attributes& attributes) : - ExecutableContainerDescriptor(parent, line, info, attributes, "transform"), _default(true), _base(true) -{ - DescriptorErrorContext ctx(_info->errorReporter, "transform", _line); - - IceXML::Attributes::const_iterator p; - - string type, rename; - - p = attributes.find("type"); - if(p == attributes.end()) - { - _info->errorReporter->error("required attribute `type' is missing"); - } - type = p->second; - - p = attributes.find("default"); - if(p != attributes.end()) - { - if(p->second == "false") - { - _default = false; - } - } - - p = attributes.find("base"); - if(p != attributes.end()) - { - if(p->second == "false") - { - _base = false; - } - } - - p = attributes.find("rename"); - if(p != attributes.end()) - { - rename = p->second; - } - - Slice::TypeList l; - - l = _info->newUnit->lookupType(type, false); - if(l.empty()) - { - _info->errorReporter->error("unable to find type `" + type + "' in new Slice definitions"); - } - else - { - _newType = l.front(); - } - - if(!rename.empty()) - { - l = _info->oldUnit->lookupType(rename, false); - if(l.empty()) - { - _info->errorReporter->error("unable to find type `" + rename + "' in old Slice definitions"); - } - _renameType = l.front(); - } -} - -Slice::TypePtr -FreezeScript::TransformDescriptor::type() const -{ - return _newType; -} - -string -FreezeScript::TransformDescriptor::typeName() const -{ - return typeToString(_newType); -} - -Slice::TypePtr -FreezeScript::TransformDescriptor::renameType() const -{ - return _renameType; -} - -string -FreezeScript::TransformDescriptor::renameTypeName() const -{ - string result; - if(_renameType) - { - result = typeToString(_renameType); - } - return result; -} - -bool -FreezeScript::TransformDescriptor::doDefaultTransform() const -{ - return _default; -} - -bool -FreezeScript::TransformDescriptor::doBaseTransform() const -{ - return _base; -} - -// -// InitDescriptor -// -FreezeScript::InitDescriptor::InitDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, - const IceXML::Attributes& attributes) : - ExecutableContainerDescriptor(parent, line, info, attributes, "init") -{ - DescriptorErrorContext ctx(_info->errorReporter, "init", _line); - - IceXML::Attributes::const_iterator p = attributes.find("type"); - - string type; - - if(p == attributes.end()) - { - _info->errorReporter->error("required attribute `type' is missing"); - } - type = p->second; - - Slice::TypeList l = _info->newUnit->lookupType(type, false); - if(l.empty()) - { - _info->errorReporter->error("unable to find type `" + type + "' in new Slice definitions"); - } - else - { - _type = l.front(); - } -} - -void -FreezeScript::InitDescriptor::initialize(const DataPtr& data) -{ - SymbolTablePtr sym = new SymbolTableI(_info, _info->symbolTable); - sym->add("value", data); - execute(sym); -} - -string -FreezeScript::InitDescriptor::typeName() const -{ - return typeToString(_type); -} - -// -// RecordDescriptor -// -FreezeScript::RecordDescriptor::RecordDescriptor(const DescriptorPtr& parent, int line, const TransformInfoIPtr& info, - const IceXML::Attributes& attributes) : - ExecutableContainerDescriptor(parent, line, info, attributes, "record") -{ -} - -void -FreezeScript::RecordDescriptor::execute(const SymbolTablePtr& /*sym*/) -{ - // - // Temporarily add an object factory. - // - _info->objectFactory->activate(_info->factory, _info->oldUnit); - - // - // Iterate over the database. - // - Dbc* dbc = 0; - _info->oldDb->cursor(0, &dbc, 0); - try - { - Dbt dbKey, dbValue; - while(dbc->get(&dbKey, &dbValue, DB_NEXT) == 0) - { - Ice::ByteSeq inKeyBytes; - inKeyBytes.resize(dbKey.get_size()); - memcpy(&inKeyBytes[0], dbKey.get_data(), dbKey.get_size()); - - Ice::ByteSeq inValueBytes; - inValueBytes.resize(dbValue.get_size()); - memcpy(&inValueBytes[0], dbValue.get_data(), dbValue.get_size()); - - try - { - Ice::ByteSeq outKeyBytes, outValueBytes; - transformRecord(inKeyBytes, inValueBytes, outKeyBytes, outValueBytes); - Dbt dbNewKey(&outKeyBytes[0], static_cast(outKeyBytes.size())), - dbNewValue(&outValueBytes[0], static_cast(outValueBytes.size())); - if(_info->newDb->put(_info->newDbTxn, &dbNewKey, &dbNewValue, DB_NOOVERWRITE) == DB_KEYEXIST) - { - _info->errorReporter->error("duplicate key encountered"); - } - } - catch(const DeleteRecordException&) - { - // The record is deleted simply by not adding it to the new database. - } - catch(const ClassNotFoundException& ex) - { - if(!_info->purge) - { - _info->errorReporter->error("class " + ex.id + " not found in new Slice definitions"); - } - else - { - // The record is deleted simply by not adding it to the new database. - _info->errorReporter->warning("purging database record due to missing class type " + ex.id); - } - } - } - } - catch(...) - { - if(dbc) - { - dbc->close(); - } - _info->objectFactory->deactivate(); - throw; - } - - if(dbc) - { - dbc->close(); - } - _info->objectFactory->deactivate(); -} - -void -FreezeScript::RecordDescriptor::transformRecord(const Ice::ByteSeq& inKeyBytes, - const Ice::ByteSeq& inValueBytes, - Ice::ByteSeq& outKeyBytes, - Ice::ByteSeq& outValueBytes) -{ - Ice::InputStreamPtr inKey = Ice::wrapInputStream(_info->communicator, inKeyBytes); - Ice::InputStreamPtr inValue = Ice::wrapInputStream(_info->communicator, inValueBytes); - inValue->startEncapsulation(); - - Ice::OutputStreamPtr outKey = Ice::createOutputStream(_info->communicator); - Ice::OutputStreamPtr outValue = Ice::createOutputStream(_info->communicator); - outValue->startEncapsulation(); - - // - // Create data representations of the old key and value types. - // - _info->factory->disableInitializers(); - DataPtr oldKeyData = _info->factory->create(_info->oldKeyType, true); - Destroyer oldKeyDataDestroyer(oldKeyData); - DataPtr oldValueData = _info->factory->create(_info->oldValueType, true); - Destroyer oldValueDataDestroyer(oldValueData); - - // - // Unmarshal the old key and value. - // - oldKeyData->unmarshal(inKey); - oldValueData->unmarshal(inValue); - _info->objectDataMap.clear(); - if(_info->oldValueType->usesClasses()) - { - inValue->readPendingObjects(); - ObjectVisitor visitor(_info->objectDataMap); - oldValueData->visit(visitor); - } - _info->factory->enableInitializers(); - - // - // Create data representations of the new key and value types. - // - DataPtr newKeyData = _info->factory->create(_info->newKeyType, false); - Destroyer newKeyDataDestroyer(newKeyData); - DataPtr newValueData = _info->factory->create(_info->newValueType, false); - Destroyer newValueDataDestroyer(newValueData); - DataPtr facetData = _info->factory->createString(_info->facet, true); - Destroyer facetDataDestroyer(facetData); - - // - // Copy the data from the old key and value to the new key and value, if possible. - // - TransformVisitor keyVisitor(oldKeyData, _info); - newKeyData->visit(keyVisitor); - TransformVisitor valueVisitor(oldValueData, _info); - newValueData->visit(valueVisitor); - - if(!_children.empty()) - { - // - // Execute the child descriptors. - // - // TODO: Revisit identifiers. - // - SymbolTablePtr st = new SymbolTableI(_info, _info->symbolTable); - st->add("oldkey", oldKeyData); - st->add("newkey", newKeyData); - st->add("oldvalue", oldValueData); - st->add("newvalue", newValueData); - st->add("facet", facetData); - ExecutableContainerDescriptor::execute(st); - } - - newKeyData->marshal(outKey); - newValueData->marshal(outValue); - - outKey->finished(outKeyBytes); - - if(_info->newValueType->usesClasses()) - { - outValue->writePendingObjects(); - } - outValue->endEncapsulation(); - outValue->finished(outValueBytes); -} - -// -// DatabaseDescriptor -// -FreezeScript::DatabaseDescriptor::DatabaseDescriptor(const DescriptorPtr& parent, int line, - const TransformInfoIPtr& info, - const IceXML::Attributes& attributes) : - ExecutableContainerDescriptor(parent, line, info, attributes, "database") -{ - DescriptorErrorContext ctx(_info->errorReporter, "database", _line); - - IceXML::Attributes::const_iterator p; - - p = attributes.find("name"); - if(p != attributes.end()) - { - _name = p->second; - } - - p = attributes.find("key"); - if(p == attributes.end()) - { - _info->errorReporter->error("required attribute `key' is missing"); - } - string keyTypes = p->second; - - p = attributes.find("value"); - if(p == attributes.end()) - { - _info->errorReporter->error("required attribute `value' is missing"); - } - string valueTypes = p->second; - - string::size_type pos; - - pos = keyTypes.find(','); - if(pos == 0 || pos == keyTypes.size()) - { - _info->errorReporter->error("invalid key type specification `" + keyTypes +"'"); - } - if(pos == string::npos) - { - _oldKeyName = keyTypes; - _newKeyName = keyTypes; - } - else - { - _oldKeyName = keyTypes.substr(0, pos); - _newKeyName = keyTypes.substr(pos + 1); - } - - pos = valueTypes.find(','); - if(pos == 0 || pos == valueTypes.size()) - { - _info->errorReporter->error("invalid value type specification `" + valueTypes +"'"); - } - if(pos == string::npos) - { - _oldValueName = valueTypes; - _newValueName = valueTypes; - } - else - { - _oldValueName = valueTypes.substr(0, pos); - _newValueName = valueTypes.substr(pos + 1); - } -} - -void -FreezeScript::DatabaseDescriptor::addChild(const DescriptorPtr& child) -{ - DescriptorErrorContext ctx(_info->errorReporter, "database", _line); - - RecordDescriptorPtr rec = RecordDescriptorPtr::dynamicCast(child); - if(rec) - { - if(_record) - { - _info->errorReporter->error("only one element can be specified"); - } - _record = rec; - } - - ExecutableContainerDescriptor::addChild(child); -} - -void -FreezeScript::DatabaseDescriptor::execute(const SymbolTablePtr& st) -{ - DescriptorErrorContext ctx(_info->errorReporter, "database", _line); - - // - // Look up the Slice definitions for the key and value types. - // - _info->oldKeyType = findType(_info->oldUnit, _oldKeyName); - _info->newKeyType = findType(_info->newUnit, _newKeyName); - _info->oldValueType = findType(_info->oldUnit, _oldValueName); - _info->newValueType = findType(_info->newUnit, _newValueName); - - if(_info->connection != 0) - { - Freeze::Catalog catalog(_info->connection, Freeze::catalogName()); - Freeze::CatalogData catalogData; - catalogData.evictor = false; - catalogData.key = _info->newKeyType->typeId(); - catalogData.value = _info->newValueType->typeId(); - catalog.put(Freeze::Catalog::value_type(_info->newDbName, catalogData)); - } - - // - // TODO: it looks like _info is not destroyed before the new dbEnv is closed. - // - _info->connection = 0; - - ExecutableContainerDescriptor::execute(st); -} - -string -FreezeScript::DatabaseDescriptor::name() const -{ - return _name; -} - -// -// TransformDBDescriptor -// -FreezeScript::TransformDBDescriptor::TransformDBDescriptor(int line, const TransformInfoIPtr& info, - const IceXML::Attributes&) : - Descriptor(0, line, info) -{ -} - -FreezeScript::TransformDBDescriptor::~TransformDBDescriptor() -{ -} - -void -FreezeScript::TransformDBDescriptor::addChild(const DescriptorPtr& child) -{ - DescriptorErrorContext ctx(_info->errorReporter, "transformdb", _line); - - DatabaseDescriptorPtr db = DatabaseDescriptorPtr::dynamicCast(child); - TransformDescriptorPtr transform = TransformDescriptorPtr::dynamicCast(child); - InitDescriptorPtr init = InitDescriptorPtr::dynamicCast(child); - - if(db) - { - string name = db->name(); - map::iterator p = _databases.find(name); - if(p != _databases.end()) - { - if(name.empty()) - { - _info->errorReporter->error("duplicate element"); - } - else - { - _info->errorReporter->error(string("duplicate element for ") + name); - } - } - else - { - _databases[name] = db; - _children.push_back(db); - } - } - else if(transform) - { - string name = transform->typeName(); - TransformMap::iterator p = _info->transformMap.find(name); - if(p != _info->transformMap.end()) - { - _info->errorReporter->error("transform `" + name + "' specified more than once"); - } - _info->transformMap.insert(TransformMap::value_type(name, transform)); - - string renameTypeName = transform->renameTypeName(); - if(!renameTypeName.empty()) - { - RenameMap::iterator q = _info->renameMap.find(renameTypeName); - if(q != _info->renameMap.end()) - { - _info->errorReporter->error("multiple transform descriptors specify the rename value `" + - renameTypeName + "'"); - } - _info->renameMap.insert(RenameMap::value_type(renameTypeName, transform->type())); - } - - _children.push_back(transform); - } - else if(init) - { - _info->factory->addInitDescriptor(init); - _children.push_back(init); - } - else - { - _info->errorReporter->error("invalid child element"); - } -} - -void -FreezeScript::TransformDBDescriptor::validate() -{ - DescriptorErrorContext ctx(_info->errorReporter, "transformdb", _line); - - if(_databases.empty()) - { - _info->errorReporter->error("no element defined"); - } - - for(vector::iterator p = _children.begin(); p != _children.end(); ++p) - { - (*p)->validate(); - } -} - -void -FreezeScript::TransformDBDescriptor::execute(const SymbolTablePtr& sym) -{ - map::iterator p = _databases.find(_info->newDbName); - if(p == _databases.end()) - { - p = _databases.find(""); - } - - if(p == _databases.end()) - { - _info->errorReporter->error("no element found for `" + _info->newDbName + "'"); - } - - p->second->execute(sym); -} - -// -// SymbolTableI -// -FreezeScript::SymbolTableI::SymbolTableI(const TransformInfoIPtr& info, const SymbolTablePtr& parent) : - _info(info), _parent(parent) -{ -} - -void -FreezeScript::SymbolTableI::add(const string& name, const DataPtr& data) -{ - DataMap::const_iterator p = _dataMap.find(name); - if(p != _dataMap.end()) - { - _info->errorReporter->error("`" + name + "' is already defined"); - } - - _dataMap.insert(DataMap::value_type(name, data)); -} - -FreezeScript::DataPtr -FreezeScript::SymbolTableI::getValue(const EntityNodePtr& entity) const -{ - EntityVisitor visitor(const_cast(this)); - entity->visit(visitor); - DataPtr result = visitor.getCurrent(); - if(!result) - { - ostringstream ostr; - ostr << "invalid entity `" << entity << "'"; - _info->errorReporter->error(ostr.str()); - } - - return result; -} - -FreezeScript::DataPtr -FreezeScript::SymbolTableI::getConstantValue(const string& name) const -{ - string::size_type pos; - Slice::UnitPtr unit; - string key; - - DataMap::const_iterator p = _constantCache.find(name); - if(p != _constantCache.end()) - { - return p->second; - } - - if(_parent) - { - return _parent->getConstantValue(name); - } - - // - // Name must start with "::Old" or "::New" to indicate the Slice unit. - // - pos = name.find("::Old"); - if(pos == 0) - { - if(name.length() > 5) - { - key = name.substr(5); - unit = _info->oldUnit; - } - } - else - { - pos = name.find("::New"); - if(pos == 0) - { - if(name.length() > 5) - { - key = name.substr(5); - unit = _info->newUnit; - } - } - } - - if(key.empty()) - { - _info->errorReporter->error("invalid constant name `" + name + "'"); - } - - Slice::ContainedList l = unit->findContents(key); - if(l.empty()) - { - _info->errorReporter->error("unknown constant `" + name + "'"); - } - - Slice::EnumeratorPtr e = Slice::EnumeratorPtr::dynamicCast(l.front()); - Slice::ConstPtr c = Slice::ConstPtr::dynamicCast(l.front()); - if(!e && !c) - { - _info->errorReporter->error("`" + name + "' does not refer to a Slice constant or enumerator"); - } - - DataPtr result; - - if(c) - { - Slice::TypePtr type = c->type(); - string value = c->value(); - Slice::BuiltinPtr b = Slice::BuiltinPtr::dynamicCast(type); - if(b) - { - switch(b->kind()) - { - case Slice::Builtin::KindByte: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindLong: - { - Ice::Long n; - if(!IceUtilInternal::stringToInt64(value, n)) - { - assert(false); - } - result = _info->factory->createInteger(n, true); - break; - } - - case Slice::Builtin::KindBool: - { - result = _info->factory->createBoolean(value == "true", true); - break; - } - - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - { - double v = strtod(value.c_str(), 0); - result = _info->factory->createDouble(v, true); - break; - } - - case Slice::Builtin::KindString: - { - result = _info->factory->createString(value, true); - break; - } - - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - assert(false); - } - } - else - { - Slice::EnumPtr en = Slice::EnumPtr::dynamicCast(type); - assert(en); - Slice::EnumeratorList el = en->getEnumerators(); - for(Slice::EnumeratorList::iterator q = el.begin(); q != el.end(); ++q) - { - if((*q)->name() == value) - { - e = *q; - break; - } - } - assert(e); - } - } - - if(!result) - { - assert(e); - result = _info->factory->create(e->type(), true); - EnumDataPtr ed = EnumDataPtr::dynamicCast(result); - assert(ed); - ed->setValueAsString(e->name()); - } - - // - // Cache the value. - // - const_cast(_constantCache).insert(DataMap::value_type(name, result)); - - return result; -} - -FreezeScript::SymbolTablePtr -FreezeScript::SymbolTableI::createChild() -{ - return new SymbolTableI(_info, this); -} - -Slice::TypePtr -FreezeScript::SymbolTableI::lookupType(const string& name) -{ - Slice::TypeList l = _info->newUnit->lookupType(name, false); - Slice::TypePtr result; - if(!l.empty()) - { - result = l.front(); - } - return result; -} - -FreezeScript::DataPtr -FreezeScript::SymbolTableI::invokeFunction(const string& name, const DataPtr& target, const DataList& args) -{ - if(target) - { - DictionaryDataPtr targetDict = DictionaryDataPtr::dynamicCast(target); - if(targetDict && name == "containsKey") - { - if(args.size() != 1) - { - _info->errorReporter->error("containsKey() requires one argument"); - } - Slice::DictionaryPtr dictType = Slice::DictionaryPtr::dynamicCast(targetDict->getType()); - assert(dictType); - DataPtr key = _info->factory->create(dictType->keyType(), false); - assignOrTransform(key, args[0], false, _info); - DataPtr value = targetDict->getElement(key); - return _info->factory->createBoolean(value ? true : false, false); - } - - DataPtr result; - if(invokeMemberFunction(name, target, args, result, _info->factory, _info->errorReporter)) - { - return result; - } - - _info->errorReporter->error("unknown function `" + name + "' invoked on type " + - typeToString(target->getType())); - } - else - { - // - // Global function. - // - DataPtr result; - if(invokeGlobalFunction(_info->communicator, name, args, result, _info->factory, _info->errorReporter)) - { - return result; - } - else - { - _info->errorReporter->error("unknown global function `" + name + "'"); - } - } - - return 0; -} - -FreezeScript::DataPtr -FreezeScript::SymbolTableI::findValue(const string& name) const -{ - DataMap::const_iterator p = _dataMap.find(name); - if(p != _dataMap.end()) - { - return p->second; - } - - if(_parent) - { - SymbolTableIPtr parentI = SymbolTableIPtr::dynamicCast(_parent); - assert(parentI); - return parentI->findValue(name); - } - - return 0; -} - -FreezeScript::SymbolTableI::EntityVisitor::EntityVisitor(SymbolTableI* table) : - _table(table), _error(false) -{ -} - -void -FreezeScript::SymbolTableI::EntityVisitor::visitIdentifier(const string& name) -{ - if(!_error) - { - if(!_current) - { - _current = _table->findValue(name); - } - else - { - _current = _current->getMember(name); - } - - if(!_current) - { - _error = true; - } - } -} - -void -FreezeScript::SymbolTableI::EntityVisitor::visitElement(const NodePtr& value) -{ - if(!_error) - { - assert(_current); - - DataPtr val = value->evaluate(_table); - _current = _current->getElement(val); - - if(!_current) - { - _error = true; - } - } -} - -FreezeScript::DataPtr -FreezeScript::SymbolTableI::EntityVisitor::getCurrent() const -{ - return _current; -} - -// -// ObjectVisitor -// -FreezeScript::ObjectVisitor::ObjectVisitor(ObjectDataMap& objectDataMap) : - _map(objectDataMap) -{ -} - -void -FreezeScript::ObjectVisitor::visitStruct(const StructDataPtr& data) -{ - Slice::TypePtr type = data->getType(); - if(type->usesClasses()) - { - DataMemberMap& members = data->getMembers(); - for(DataMemberMap::iterator p = members.begin(); p != members.end(); ++p) - { - p->second->visit(*this); - } - } -} - -void -FreezeScript::ObjectVisitor::visitSequence(const SequenceDataPtr& data) -{ - Slice::TypePtr type = data->getType(); - if(type->usesClasses()) - { - DataList& elements = data->getElements(); - for(DataList::iterator p = elements.begin(); p != elements.end(); ++p) - { - (*p)->visit(*this); - } - } -} - -void -FreezeScript::ObjectVisitor::visitDictionary(const DictionaryDataPtr& data) -{ - Slice::TypePtr type = data->getType(); - if(type->usesClasses()) - { - DataMap& elements = data->getElements(); - for(DataMap::iterator p = elements.begin(); p != elements.end(); ++p) - { - // - // NOTE: There's no need to visit the key. - // - p->second->visit(*this); - } - } -} - -void -FreezeScript::ObjectVisitor::visitObject(const ObjectRefPtr& data) -{ - ObjectDataPtr value = data->getValue(); - if(value) - { - ObjectDataMap::iterator p = _map.find(value.get()); - if(p == _map.end()) - { -#if (defined(_MSC_VER) && (_MSC_VER >= 1600)) - _map.insert(ObjectDataMap::value_type(value.get(), static_cast(nullptr))); -#else - _map.insert(ObjectDataMap::value_type(value.get(), 0)); -#endif - DataMemberMap& members = value->getMembers(); - for(DataMemberMap::iterator q = members.begin(); q != members.end(); ++q) - { - q->second->visit(*this); - } - } - } -} - -// -// TransformInfoI -// -FreezeScript::DataFactoryPtr -FreezeScript::TransformInfoI::getDataFactory() -{ - return factory; -} - -FreezeScript::ErrorReporterPtr -FreezeScript::TransformInfoI::getErrorReporter() -{ - return errorReporter; -} - -bool -FreezeScript::TransformInfoI::doDefaultTransform(const Slice::TypePtr& type) -{ - TransformMap::const_iterator p = transformMap.find(typeToString(type)); - if(p != transformMap.end()) - { - return p->second->doDefaultTransform(); - } - return true; -} - -bool -FreezeScript::TransformInfoI::doBaseTransform(const Slice::ClassDefPtr& type) -{ - TransformMap::const_iterator p = transformMap.find(type->scoped()); - if(p != transformMap.end()) - { - return p->second->doBaseTransform(); - } - return true; -} - -Slice::TypePtr -FreezeScript::TransformInfoI::getRenamedType(const Slice::TypePtr& old) -{ - RenameMap::iterator p = renameMap.find(typeToString(old)); - if(p != renameMap.end()) - { - return p->second; - } - return 0; -} - -void -FreezeScript::TransformInfoI::executeCustomTransform(const DataPtr& dest, const DataPtr& src) -{ - // - // Execute the type's transform (if any). Non-nil objects need special consideration, - // for two reasons: - // - // 1. The dest and src arguments are ObjectRef instances whose getType() - // function returns the formal type, which may not match the actual type - // if inheritance is being used. Therefore, we need to look for the - // transform of the actual type of the object. - // - // 2. It's not sufficient to execute only the transform for the actual type; - // the transform descriptors for base types must also be executed (if not - // explicitly precluded). - // - // The algorithm goes like this: - // - // 1. If a transform exists for the actual type, execute it. - // 2. If the transform doesn't exist, or if it does exist and does not preclude - // the execution of the base transform, then obtain the base type. If the - // type has no user-defined base class, use Object. - // 3. If a base type was found and a transform exists for the base type, execute it. - // 4. Repeat step 2. - // - ObjectRefPtr obj = ObjectRefPtr::dynamicCast(dest); - if(obj && obj->getValue()) - { - ObjectDataPtr data = obj->getValue(); - Slice::TypePtr cls = data->getType(); // Actual type: may be Builtin (Object) or ClassDecl - bool transformBase = true; - while(cls) - { - string type = typeToString(cls); - TransformMap::const_iterator p = transformMap.find(type); - if(p != transformMap.end()) - { - SymbolTablePtr sym = new SymbolTableI(this, symbolTable); - sym->add("new", dest); - sym->add("old", src); - p->second->execute(sym); - transformBase = p->second->doBaseTransform(); - } - Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(cls); - cls = 0; - if(transformBase && decl) - { - Slice::ClassDefPtr def = decl->definition(); - assert(def); - Slice::ClassList bases = def->bases(); - if(!bases.empty() && !bases.front()->isInterface()) - { - cls = bases.front()->declaration(); - } - else - { - cls = newUnit->builtin(Slice::Builtin::KindObject); - } - } - } - } - else - { - string type = typeToString(dest->getType()); - TransformMap::const_iterator p = transformMap.find(type); - if(p != transformMap.end()) - { - SymbolTablePtr sym = new SymbolTableI(this, symbolTable); - sym->add("new", dest); - sym->add("old", src); - p->second->execute(sym); - } - } -} - -string -FreezeScript::TransformInfoI::facetName() -{ - return facet; -} - -bool -FreezeScript::TransformInfoI::purgeObjects() -{ - return purge; -} - -FreezeScript::ObjectDataMap& -FreezeScript::TransformInfoI::getObjectDataMap() -{ - return objectDataMap; -} - -// -// DescriptorHandler -// -FreezeScript::DescriptorHandler::DescriptorHandler(const TransformInfoIPtr& info) : - _info(info) -{ -} - -void -FreezeScript::DescriptorHandler::startElement(const string& name, const IceXML::Attributes& attributes, int line, - int /*column*/) -{ - DescriptorPtr d; - - if(name == "transformdb") - { - if(_current) - { - _info->errorReporter->descriptorError(" must be the top-level element", line); - } - - _descriptor = new TransformDBDescriptor(line, _info, attributes); - d = _descriptor; - } - else if(name == "database") - { - if(!_current) - { - _info->errorReporter->descriptorError(" must be a child of ", line); - } - - d = new DatabaseDescriptor(_current, line, _info, attributes); - } - else if(name == "record") - { - if(!_current) - { - _info->errorReporter->descriptorError(" must be a child of ", line); - } - - d = new RecordDescriptor(_current, line, _info, attributes); - } - else if(name == "transform") - { - if(!_current) - { - _info->errorReporter->descriptorError(" must be a child of ", line); - } - - d = new TransformDescriptor(_current, line, _info, attributes); - } - else if(name == "init") - { - if(!_current) - { - _info->errorReporter->descriptorError(" must be a child of ", line); - } - - d = new InitDescriptor(_current, line, _info, attributes); - } - else if(name == "set") - { - if(!_current) - { - _info->errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new SetDescriptor(_current, line, _info, attributes); - } - else if(name == "define") - { - if(!_current) - { - _info->errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new DefineDescriptor(_current, line, _info, attributes); - } - else if(name == "add") - { - if(!_current) - { - _info->errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new AddDescriptor(_current, line, _info, attributes); - } - else if(name == "remove") - { - if(!_current) - { - _info->errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new RemoveDescriptor(_current, line, _info, attributes); - } - else if(name == "delete") - { - if(!_current) - { - _info->errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new DeleteDescriptor(_current, line, _info, attributes); - } - else if(name == "fail") - { - if(!_current) - { - _info->errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new FailDescriptor(_current, line, _info, attributes); - } - else if(name == "echo") - { - if(!_current) - { - _info->errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new EchoDescriptor(_current, line, _info, attributes); - } - else if(name == "if") - { - if(!_current) - { - _info->errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new IfDescriptor(_current, line, _info, attributes); - } - else if(name == "iterate") - { - if(!_current) - { - _info->errorReporter->descriptorError(" cannot be a top-level element", line); - } - - d = new IterateDescriptor(_current, line, _info, attributes); - } - else - { - _info->errorReporter->descriptorError("unknown descriptor `" + name + "'", line); - } - - if(_current) - { - _current->addChild(d); - } - _current = d; -} - -void -FreezeScript::DescriptorHandler::endElement(const string&, int, int) -{ - assert(_current); - _current = _current->parent(); -} - -void -FreezeScript::DescriptorHandler::characters(const string&, int, int) -{ -} - -void -FreezeScript::DescriptorHandler::error(const string& msg, int line, int) -{ - _info->errorReporter->descriptorError(msg, line); -} - -FreezeScript::TransformDBDescriptorPtr -FreezeScript::DescriptorHandler::descriptor() const -{ - return _descriptor; -} - -// -// assignOrTransform -// -void -FreezeScript::assignOrTransform(const DataPtr& dest, const DataPtr& src, bool convert, const TransformInfoPtr& info) -{ - Slice::TypePtr destType = dest->getType(); - Slice::TypePtr srcType = src->getType(); - Slice::BuiltinPtr b1 = Slice::BuiltinPtr::dynamicCast(destType); - Slice::BuiltinPtr b2 = Slice::BuiltinPtr::dynamicCast(srcType); - - if(!b1 && !b2 && dest->getType()->unit().get() != src->getType()->unit().get()) - { - TransformVisitor v(src, info); - dest->visit(v); - } - else - { - AssignVisitor v(src, info->getDataFactory(), info->getErrorReporter(), convert); - dest->visit(v); - } -} - -void -FreezeScript::transformDatabase(const Ice::CommunicatorPtr& communicator, - const FreezeScript::ObjectFactoryPtr& objectFactory, - const Slice::UnitPtr& oldUnit, const Slice::UnitPtr& newUnit, - Db* oldDb, Db* newDb, DbTxn* newDbTxn, const Freeze::ConnectionPtr& connection, - const string& newDbName, const string& facetName, bool purgeObjects, ostream& errors, - bool suppress, istream& is) -{ - - TransformInfoIPtr info = new TransformInfoI; - info->communicator = communicator; - info->objectFactory = objectFactory; - info->oldUnit = oldUnit; - info->newUnit = newUnit; - info->oldDb = oldDb; - info->newDb = newDb; - info->newDbTxn = newDbTxn; - info->connection = connection; - info->newDbName = newDbName; - info->facet = facetName; - info->purge = purgeObjects; - info->errorReporter = new ErrorReporter(errors, suppress); - info->factory = new TransformDataFactory(communicator, newUnit, info->errorReporter); - info->symbolTable = new SymbolTableI(info); - - try - { - DescriptorHandler dh(info); - IceXML::Parser::parse(is, dh); - TransformDBDescriptorPtr descriptor = dh.descriptor(); - descriptor->validate(); - descriptor->execute(info->symbolTable); - } - catch(const IceXML::ParserException& ex) - { - info->errorReporter->error(ex.reason()); - } -} diff --git a/cpp/src/FreezeScript/Transformer.h b/cpp/src/FreezeScript/Transformer.h deleted file mode 100644 index 71eee136c04..00000000000 --- a/cpp/src/FreezeScript/Transformer.h +++ /dev/null @@ -1,33 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_SCRIPT_TRANSFORMER_H -#define FREEZE_SCRIPT_TRANSFORMER_H - -#include -#include -#include -#include - -class Db; -class DbTxn; - -namespace FreezeScript -{ - -void -transformDatabase(const Ice::CommunicatorPtr&, - const FreezeScript::ObjectFactoryPtr& objectFactory, - const Slice::UnitPtr&, const Slice::UnitPtr&, - Db*, Db*, DbTxn*, const Freeze::ConnectionPtr&, const std::string&, const std::string&, bool, - std::ostream&, bool, std::istream&); - -} // End of namespace FreezeScript - -#endif diff --git a/cpp/src/FreezeScript/Util.cpp b/cpp/src/FreezeScript/Util.cpp deleted file mode 100644 index 941b9cf9b76..00000000000 --- a/cpp/src/FreezeScript/Util.cpp +++ /dev/null @@ -1,308 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace Slice; - -string -FreezeScript::typeToString(const TypePtr& type) -{ - BuiltinPtr b = BuiltinPtr::dynamicCast(type); - ContainedPtr c = ContainedPtr::dynamicCast(type); - if(b) - { - return b->kindAsString(); - } - else if(c) - { - return c->scoped(); - } - else - { - ProxyPtr p = ProxyPtr::dynamicCast(type); - assert(p); - return p->_class()->scoped() + "*"; - } -} - -bool -FreezeScript::ignoreType(const string& type) -{ - // - // Suppress descriptors for the following pre-defined types. Must be kept in ascending alphabetical order. - // - static const string ignoreTypeList[] = - { - "::Freeze::ObjectRecord", - "::Freeze::Statistics", - "::Ice::Identity" - }; - - return binary_search(&ignoreTypeList[0], &ignoreTypeList[sizeof(ignoreTypeList) / sizeof(*ignoreTypeList)], type); -} - -void -FreezeScript::createEvictorSliceTypes(const Slice::UnitPtr& u) -{ - Slice::TypeList l; - Slice::ContainedList c; - - // - // Create the Ice module if necessary. - // - c = u->lookupContained("Ice", false); - Slice::ModulePtr ice; - if(c.empty()) - { - ice = u->createModule("Ice"); - } - else - { - ice = Slice::ModulePtr::dynamicCast(c.front()); - if(!ice) - { - throw FailureException(__FILE__, __LINE__, "the symbol `::Ice' is defined in Slice but is not a module"); - } - } - - // - // Create the Slice definition for Ice::Identity if it doesn't exist. - // - string scoped = "::Ice::Identity"; - l = u->lookupTypeNoBuiltin(scoped, false); - Slice::StructPtr identity; - if(l.empty()) - { - identity = ice->createStruct("Identity", false); - Slice::TypePtr str = u->builtin(Slice::Builtin::KindString); - identity->createDataMember("name", str, false, 0, 0, "", ""); - identity->createDataMember("category", str, false, 0, 0, "", ""); - } - else - { - identity = Slice::StructPtr::dynamicCast(l.front()); - if(!identity) - { - throw FailureException(__FILE__, __LINE__, - "the symbol `::Ice::Identity' is defined in Slice but is not a struct"); - } - } - - // - // Create the Freeze module if necessary. - // - c = u->lookupContained("Freeze", false); - Slice::ModulePtr freeze; - if(c.empty()) - { - freeze = u->createModule("Freeze"); - } - else - { - freeze = Slice::ModulePtr::dynamicCast(c.front()); - if(!freeze) - { - throw FailureException(__FILE__, __LINE__, - "the symbol `::Freeze' is defined in Slice but is not a module"); - } - } - - // - // Create the Slice definition for Freeze::Statistics if it doesn't exist. - // - scoped = "::Freeze::Statistics"; - l = u->lookupTypeNoBuiltin(scoped, false); - Slice::StructPtr stats; - if(l.empty()) - { - stats = freeze->createStruct("Statistics", false); - Slice::TypePtr tl = u->builtin(Slice::Builtin::KindLong); - stats->createDataMember("creationTime", tl, false, 0, 0, "", ""); - stats->createDataMember("lastSaveTime", tl, false, 0, 0, "", ""); - stats->createDataMember("avgSaveTime", tl, false, 0, 0, "", ""); - } - else - { - stats = Slice::StructPtr::dynamicCast(l.front()); - if(!stats) - { - throw FailureException(__FILE__, __LINE__, "the symbol `::Freeze::Statistics' is defined in " - "Slice but is not a struct"); - } - } - - // - // Create the Slice definition for Freeze::ObjectRecord if it doesn't exist. - // - scoped = "::Freeze::ObjectRecord"; - l = u->lookupTypeNoBuiltin(scoped, false); - if(l.empty()) - { - Slice::StructPtr rec = freeze->createStruct("ObjectRecord", false); - Slice::TypePtr obj = u->builtin(Slice::Builtin::KindObject); - rec->createDataMember("servant", obj, false, 0, 0, "", ""); - rec->createDataMember("stats", stats, false, 0, 0, "", ""); - } - else - { - if(!Slice::StructPtr::dynamicCast(l.front())) - { - throw FailureException(__FILE__, __LINE__, "the symbol `::Freeze::ObjectRecord' is defined in " - "Slice but is not a struct"); - } - } -} - -bool -FreezeScript::parseSlice(const string& n, const Slice::UnitPtr& u, const vector& files, - const vector& cppArgs, bool debug, const std::string& extraArgs) -{ - // - // Parse the Slice files. - // - for(vector::const_iterator p = files.begin(); p != files.end(); ++p) - { - PreprocessorPtr icecpp = Preprocessor::create(n, *p, cppArgs); - - FILE* cppHandle = icecpp->preprocess(false, extraArgs); - - if(cppHandle == 0) - { - return false; - } - - int status = u->parse(*p, cppHandle, debug); - - if(!icecpp->close()) - { - return false; - } - - if(status != EXIT_SUCCESS) - { - return false; - } - } - - u->mergeModules(); - - return true; -} - -FreezeScript::CatalogDataMap -FreezeScript::readCatalog(const Ice::CommunicatorPtr& communicator, const string& dbEnvName) -{ - CatalogDataMap result; - - DbEnv dbEnv(0); - try - { -#ifdef _WIN32 - // - // Berkeley DB may use a different C++ runtime. - // - dbEnv.set_alloc(::malloc, ::realloc, ::free); -#endif - - // - // Open the database environment. - // - { - u_int32_t flags = DB_THREAD | DB_CREATE | DB_INIT_TXN | DB_INIT_MPOOL; - dbEnv.open(dbEnvName.c_str(), flags, 0); - } - - Freeze::ConnectionPtr connection = Freeze::createConnection(communicator, dbEnvName, dbEnv); - Freeze::Catalog catalog(connection, Freeze::catalogName()); - for(Freeze::Catalog::const_iterator p = catalog.begin(); p != catalog.end(); ++p) - { - result.insert(make_pair(p->first, p->second)); - } - } - catch(const DbException& ex) - { - dbEnv.close(0); - throw FailureException(__FILE__, __LINE__, string("database error: ") + ex.what()); - } - catch(const IceUtil::FileLockException&) - { - dbEnv.close(0); - throw FailureException(__FILE__, __LINE__, "environment `" + dbEnvName + "' is locked"); - } - catch(...) - { - dbEnv.close(0); - throw; - } - - dbEnv.close(0); - - return result; -} - -string -FreezeScript::CompactIdResolverI::resolve(Ice::Int id) const -{ - string type; - map::const_iterator p = _ids.find(id); - if(p != _ids.end()) - { - type = p->second; - } - return type; -} - -void -FreezeScript::CompactIdResolverI::add(Ice::Int id, const string& type) -{ -#ifndef NDEBUG - map::const_iterator p = _ids.find(id); -#else - _ids.find(id); -#endif - assert(p == _ids.end()); - - _ids[id] = type; -} - -void -FreezeScript::collectCompactIds(const UnitPtr& unit, const FreezeScript::CompactIdResolverIPtr& r) -{ - class Visitor : public ParserVisitor - { - public: - - Visitor(const FreezeScript::CompactIdResolverIPtr& resolver) : _r(resolver) - { - } - - virtual bool visitClassDefStart(const ClassDefPtr& p) - { - if(p->compactId() != -1) - { - _r->add(p->compactId(), p->scoped()); - } - return true; - } - - FreezeScript::CompactIdResolverIPtr _r; - }; - - Visitor v(r); - unit->visit(&v, false); -} diff --git a/cpp/src/FreezeScript/Util.h b/cpp/src/FreezeScript/Util.h deleted file mode 100644 index 71d07988602..00000000000 --- a/cpp/src/FreezeScript/Util.h +++ /dev/null @@ -1,83 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FREEZE_SCRIPT_UTIL_H -#define FREEZE_SCRIPT_UTIL_H - -#include -#include -#include - -namespace FreezeScript -{ - -template -class Destroyer -{ -public: - - Destroyer() {} - Destroyer(T p) : _p(p) {} - ~Destroyer() - { - if(_p) - { - _p->destroy(); - } - } - - void set(T p) - { - if(_p) - { - _p->destroy(); - } - _p = p; - } - - void release() - { - _p = 0; - } - -private: - - T _p; -}; - -std::string typeName(const Slice::TypePtr&); -std::string typeToString(const Slice::TypePtr&); -bool ignoreType(const std::string&); -void createEvictorSliceTypes(const Slice::UnitPtr&); -bool parseSlice(const std::string&, const Slice::UnitPtr&, const std::vector&, - const std::vector&, bool, const std::string&); - -typedef std::map CatalogDataMap; - -CatalogDataMap readCatalog(const Ice::CommunicatorPtr&, const std::string&); - -class CompactIdResolverI : public Ice::CompactIdResolver -{ -public: - - virtual std::string resolve(Ice::Int) const; - - void add(Ice::Int, const std::string&); - -private: - - std::map _ids; -}; -typedef IceUtil::Handle CompactIdResolverIPtr; - -void collectCompactIds(const Slice::UnitPtr&, const CompactIdResolverIPtr&); - -} // End of namespace FreezeScript - -#endif diff --git a/cpp/src/FreezeScript/transformdb.cpp b/cpp/src/FreezeScript/transformdb.cpp deleted file mode 100644 index d260ef0a7f6..00000000000 --- a/cpp/src/FreezeScript/transformdb.cpp +++ /dev/null @@ -1,1022 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -#ifdef _WIN32 -# define FREEZE_SCRIPT_DB_MODE 0 -#else -# define FREEZE_SCRIPT_DB_MODE (S_IRUSR | S_IWUSR) -#endif - -static void -usage(const std::string& n) -{ - cerr << "Usage:\n"; - cerr << "\n"; - cerr << n << " -o FILE [-i] [slice-options] [type-options]\n"; - cerr << " Generates descriptors in FILE for a database.\n"; - cerr << "\n"; - cerr << n << " -o FILE [-i] [slice-options] DBENV\n"; - cerr << " Generates descriptors in FILE for all databases in the environment DBENV.\n"; - cerr << "\n"; - cerr << n << " [options] [slice-options] [type-options] DBENV DB NEWDBENV\n"; - cerr << " Transform the database DB in the environment DBENV. A database of the\n"; - cerr << " same name is created in the environment NEWDBENV.\n"; - cerr << "\n"; - cerr << n << " [options] [slice-options] DBENV NEWDBENV\n"; - cerr << " Transform all databases from the environment DBENV into the\n"; - cerr << " environment NEWDBENV.\n"; - cerr << "\n"; - cerr << - "Slice Options:\n" - "-DNAME Define NAME as 1.\n" - "-DNAME=DEF Define NAME as DEF.\n" - "-UNAME Remove any definition for NAME.\n" - "-d, --debug Print debug messages.\n" - "--underscore Permit underscores in Slice identifiers.\n" - "--include-old DIR Put DIR in the include file search path for old Slice\n" - " definitions.\n" - "--include-new DIR Put DIR in the include file search path for new Slice\n" - " definitions.\n" - "--old SLICE Load old Slice definitions from the file SLICE.\n" - "--new SLICE Load new Slice definitions from the file SLICE.\n" - ; - cerr << "\n"; - cerr << - "Type Options:\n" - "-e Indicates the database is an Evictor database.\n" - "--key TYPE[,TYPE] Specifies the Slice types of the database key. If the\n" - " type names have not changed, only one needs to be\n" - " specified. Otherwise, the type names are specified as\n" - " old-type,new-type.\n" - "--value TYPE[,TYPE] Specifies the Slice types of the database value. If the\n" - " type names have not changed, only one needs to be\n" - " specified. Otherwise, the type names are specified as\n" - " old-type,new-type.\n" - ; - cerr << "\n"; - cerr << - "Options:\n" - "-h, --help Show this message.\n" - "-v, --version Display the Ice version.\n" - "-i Ignore incompatible type changes.\n" - "-p Purge objects whose types no longer exist.\n" - "-c Use catastrophic recovery on the old database environment.\n" - "-w Suppress duplicate warnings during migration.\n" - "-f FILE Execute the transformation descriptors in the file FILE.\n" - ; -} - -static Slice::TypePtr -findType(const Slice::UnitPtr& u, const string& type) -{ - Slice::TypeList l; - - string t; - if(type == "::Ice::Object") - { - t = "Object"; - } - else if(type == "::Ice::Object*") - { - t = "Object*"; - } - else - { - t = type; - } - - l = u->lookupType(t, false); - if(l.empty()) - { - return 0; - } - - return l.front(); -} - -static void -transformDb(bool evictor, const Ice::CommunicatorPtr& communicator, - const FreezeScript::ObjectFactoryPtr& objectFactory, - DbEnv& dbEnv, DbEnv& dbEnvNew, const string& dbName, - const Freeze::ConnectionPtr& connectionNew, vector& dbs, - const Slice::UnitPtr& oldUnit, const Slice::UnitPtr& newUnit, - DbTxn* txnNew, bool purgeObjects, bool suppress, string descriptors) -{ - if(evictor) - { - // - // The evictor database file contains multiple databases. We must first - // determine the names of those databases, ignoring any whose names - // begin with "$index:". Each database represents a separate facet, with - // the facet name used as the database name. The database named "$default" - // represents the main object. - // - vector dbNames; - { - Db db(&dbEnv, 0); - db.open(0, dbName.c_str(), 0, DB_UNKNOWN, DB_RDONLY, 0); - Dbt dbKey, dbValue; - dbKey.set_flags(DB_DBT_MALLOC); - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - Dbc* dbc = 0; - db.cursor(0, &dbc, 0); - - while(dbc->get(&dbKey, &dbValue, DB_NEXT) == 0) - { - string s(static_cast(dbKey.get_data()), dbKey.get_size()); - if(s.find("$index:") != 0) - { - dbNames.push_back(s); - } - free(dbKey.get_data()); - } - - dbc->close(); - db.close(0); - } - - // - // Transform each database. We must delay closing the new databases - // until after the transaction is committed or aborted. - // - for(vector::iterator p = dbNames.begin(); p != dbNames.end(); ++p) - { - string name = p->c_str(); - - Db db(&dbEnv, 0); - db.open(0, dbName.c_str(), name.c_str(), DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE); - - Db* dbNew = new Db(&dbEnvNew, 0); - dbs.push_back(dbNew); - dbNew->open(txnNew, dbName.c_str(), name.c_str(), DB_BTREE, DB_CREATE | DB_EXCL, FREEZE_SCRIPT_DB_MODE); - - // - // Execute the transformation descriptors. - // - istringstream istr(descriptors); - string facet = (name == "$default" ? string("") : name); - FreezeScript::transformDatabase(communicator, objectFactory, oldUnit, newUnit, &db, dbNew, txnNew, 0, - dbName, facet, purgeObjects, cerr, suppress, istr); - - db.close(0); - } - - Freeze::Catalog catalogNew(connectionNew, Freeze::catalogName()); - Freeze::CatalogData catalogData = { true, "::Ice::Identity", "Object" }; - catalogNew.put(Freeze::Catalog::value_type(dbName, catalogData)); - } - else - { - // - // Transform a map database. - // - Db db(&dbEnv, 0); - db.open(0, dbName.c_str(), 0, DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE); - - Db* dbNew = new Db(&dbEnvNew, 0); - dbs.push_back(dbNew); - dbNew->open(txnNew, dbName.c_str(), 0, DB_BTREE, DB_CREATE | DB_EXCL, FREEZE_SCRIPT_DB_MODE); - - // - // Execute the transformation descriptors. - // - istringstream istr(descriptors); - FreezeScript::transformDatabase(communicator, objectFactory, oldUnit, newUnit, &db, dbNew, txnNew, - connectionNew, dbName, "", purgeObjects, cerr, suppress, istr); - - db.close(0); - } -} - -static int -run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator, - const FreezeScript::CompactIdResolverIPtr& resolver) -{ - vector oldCppArgs; - vector newCppArgs; - bool debug; - bool ice = true; // Needs to be true in order to create default definitions. - bool underscore; - string outputFile; - bool ignoreTypeChanges; - bool purgeObjects; - bool catastrophicRecover; - bool suppress; - string inputFile; - vector oldSlice; - vector newSlice; - bool evictor; - string keyTypeNames; - string valueTypeNames; - string dbEnvName, dbName, dbEnvNameNew; - bool allDb = false; - - IceUtilInternal::Options opts; - opts.addOpt("h", "help"); - opts.addOpt("v", "version"); - opts.addOpt("D", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("U", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("d", "debug"); - opts.addOpt("", "underscore"); - opts.addOpt("o", "", IceUtilInternal::Options::NeedArg); - opts.addOpt("i"); - opts.addOpt("p"); - opts.addOpt("c"); - opts.addOpt("w"); - opts.addOpt("f", "", IceUtilInternal::Options::NeedArg); - opts.addOpt("", "include-old", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("", "include-new", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("", "old", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("", "new", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("a"); - opts.addOpt("e"); - opts.addOpt("", "key", IceUtilInternal::Options::NeedArg); - opts.addOpt("", "value", IceUtilInternal::Options::NeedArg); - - const string appName = originalArgs[0]; - vector args; - try - { - args = opts.parse(originalArgs); - } - catch(const IceUtilInternal::BadOptException& e) - { - cerr << appName << ": " << e.reason << endl; - usage(appName); - return EXIT_FAILURE; - } - - if(opts.isSet("help")) - { - usage(appName); - return EXIT_SUCCESS; - } - if(opts.isSet("version")) - { - cout << ICE_STRING_VERSION << endl; - return EXIT_SUCCESS; - } - if(opts.isSet("D")) - { - vector optargs = opts.argVec("D"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - oldCppArgs.push_back("-D" + *i); - newCppArgs.push_back("-D" + *i); - } - } - if(opts.isSet("U")) - { - vector optargs = opts.argVec("U"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - oldCppArgs.push_back("-U" + *i); - newCppArgs.push_back("-U" + *i); - } - } - debug = opts.isSet("debug"); - - underscore = opts.isSet("underscore"); - - if(opts.isSet("o")) - { - outputFile = opts.optArg("o"); - } - ignoreTypeChanges = opts.isSet("i"); - purgeObjects = opts.isSet("p"); - catastrophicRecover = opts.isSet("c"); - suppress = opts.isSet("w"); - - if(opts.isSet("f")) - { - inputFile = opts.optArg("f"); - } - if(opts.isSet("include-old")) - { - vector optargs = opts.argVec("include-old"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - oldCppArgs.push_back("-I" + *i); - } - } - if(opts.isSet("include-new")) - { - vector optargs = opts.argVec("include-new"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - newCppArgs.push_back("-I" + *i); - } - } - if(opts.isSet("old")) - { - vector optargs = opts.argVec("old"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - oldSlice.push_back(*i); - } - } - if(opts.isSet("new")) - { - vector optargs = opts.argVec("new"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - newSlice.push_back(*i); - } - } - evictor = opts.isSet("e"); - if(opts.isSet("key")) - { - keyTypeNames = opts.optArg("key"); - } - if(opts.isSet("value")) - { - valueTypeNames = opts.optArg("value"); - } - - if(outputFile.empty()) - { - if(args.size() == 2) - { - allDb = true; - } - else if(args.size() != 3) - { - usage(appName); - return EXIT_FAILURE; - } - } - else - { - if(args.size() == 1) - { - allDb = true; - } - else if(args.size() != 0) - { - usage(appName); - return EXIT_FAILURE; - } - } - - if(allDb && (!keyTypeNames.empty() || !valueTypeNames.empty())) - { - usage(appName); - return EXIT_FAILURE; - } - - if(inputFile.empty() && !allDb && !evictor && (keyTypeNames.empty() || valueTypeNames.empty())) - { - usage(appName); - return EXIT_FAILURE; - } - - if(args.size() > 0) - { - dbEnvName = args[0]; - } - if(args.size() > 1) - { - if(allDb) - { - dbEnvNameNew = args[1]; - } - else - { - dbName = args[1]; - } - } - if(args.size() > 2) - { - dbEnvNameNew = args[2]; - } - if(args.size() > 3) - { - cerr << appName << ": too many arguments" << endl; - usage(appName); - return EXIT_FAILURE; - } - - // - // Freeze creates a lock file by default to prevent multiple processes from opening - // the same database environment simultaneously. In the case of a read-only program - // such as transformdb, however, we still want to be able to open the environment despite - // the lock. This assumes of course that the other process has opened the environment - // with DbPrivate=0. If DbPrivate=0 is also set for dumpdb, we disable the lock. - // - if(!catastrophicRecover && outputFile.empty()) - { - Ice::PropertiesPtr props = communicator->getProperties(); - string prefix = "Freeze.DbEnv." + args[0]; - if(props->getPropertyAsIntWithDefault(prefix + ".DbPrivate", 1) <= 0) - { - props->setProperty(prefix + ".LockFile", "0"); - } - } - - Slice::UnitPtr oldUnit = Slice::Unit::createUnit(true, true, ice, underscore); - FreezeScript::Destroyer oldD(oldUnit); - if(!FreezeScript::parseSlice(appName, oldUnit, oldSlice, oldCppArgs, debug, "-D__TRANSFORMDB__")) - { - return EXIT_FAILURE; - } - - FreezeScript::collectCompactIds(oldUnit, resolver); - - Slice::UnitPtr newUnit = Slice::Unit::createUnit(true, true, ice, underscore); - FreezeScript::Destroyer newD(newUnit); - if(!FreezeScript::parseSlice(appName, newUnit, newSlice, newCppArgs, debug, "-D__TRANSFORMDB__")) - { - return EXIT_FAILURE; - } - - // - // Install the evictor types in the Slice units. - // - FreezeScript::createEvictorSliceTypes(oldUnit); - FreezeScript::createEvictorSliceTypes(newUnit); - - // - // Read the catalog if necessary. - // - FreezeScript::CatalogDataMap catalog; - if(allDb) - { - try - { - catalog = FreezeScript::readCatalog(communicator, dbEnvName); - } - catch(const FreezeScript::FailureException& ex) - { - cerr << appName << ": " << ex.reason() << endl; - return EXIT_FAILURE; - } - if(catalog.empty()) - { - cerr << appName << ": no databases in environment `" << dbEnvName << "'" << endl; - return EXIT_FAILURE; - } - } - - // - // If no input file was provided, then we need to analyze the Slice types. - // - string descriptors; - - if(inputFile.empty()) - { - ostringstream out; - vector missingTypes; - vector analyzeErrors; - - FreezeScript::TransformAnalyzer analyzer(oldUnit, newUnit, ignoreTypeChanges, out, missingTypes, analyzeErrors); - - const string evictorKeyName = "::Ice::Identity"; - const string oldEvictorValueName = "::Freeze::ObjectRecord"; - const string newEvictorValueName = "Object"; - - if(allDb) - { - // - // Add a element for each database in the catalog. - // - for(FreezeScript::CatalogDataMap::iterator p = catalog.begin(); p != catalog.end(); ++p) - { - string keyName, valueName; - - if(p->second.evictor) - { - keyName = p->second.key; - valueName = p->second.value; - - if(keyName.empty()) - { - keyName = evictorKeyName; - } - if(valueName.empty()) - { - valueName = oldEvictorValueName; - } - } - else - { - keyName = p->second.key; - valueName = p->second.value; - } - - // - // Look up the key and value types in the old and new Slice definitions. - // - Slice::TypePtr oldKeyType = findType(oldUnit, keyName); - if(!oldKeyType) - { - cerr << appName << ": type `" << keyName << "' from database `" << p->first - << "' not found in old Slice definitions" << endl; - } - Slice::TypePtr newKeyType = findType(newUnit, keyName); - if(!newKeyType) - { - cerr << appName << ": type `" << keyName << "' from database `" << p->first - << "' not found in new Slice definitions" << endl; - } - Slice::TypePtr oldValueType = findType(oldUnit, valueName); - if(!oldValueType) - { - cerr << appName << ": type `" << valueName << "' from database `" << p->first - << "' not found in old Slice definitions" << endl; - } - - Slice::TypePtr newValueType; - if(p->second.evictor) - { - // - // The new evictor does not keep stats - // - newValueType = findType(newUnit, newEvictorValueName); - } - else - { - newValueType = findType(newUnit, valueName); - } - - if(!newValueType) - { - cerr << appName << ": type `" << valueName << "' from database `" << p->first - << "' not found in new Slice definitions" << endl; - } - - // - // If we are generating an output file, we do not consider a missing type to be - // an error. Since the type information comes from the catalog of the old - // environment, it's possible that the key or value types are not present in - // the new Slice definitions. Rather than abort at this point, we simply emit - // a partially-defined element that must be edited by the user. - // - // If we are not generating an output file, we have to stop now. - // - if(outputFile.empty() && (!oldKeyType || !newKeyType || !oldValueType || !newValueType)) - { - return EXIT_FAILURE; - } - - analyzer.addDatabase(p->first, oldKeyType, newKeyType, oldValueType, newValueType); - } - } - else - { - string oldKeyName, newKeyName, oldValueName, newValueName; - - string::size_type pos; - - if(!evictor && (keyTypeNames.empty() || valueTypeNames.empty())) - { - usage(appName); - return EXIT_FAILURE; - } - - if(!keyTypeNames.empty()) - { - pos = keyTypeNames.find(','); - if(pos == 0 || pos == keyTypeNames.size()) - { - usage(appName); - return EXIT_FAILURE; - } - if(pos == string::npos) - { - oldKeyName = keyTypeNames; - newKeyName = keyTypeNames; - } - else - { - oldKeyName = keyTypeNames.substr(0, pos); - newKeyName = keyTypeNames.substr(pos + 1); - } - } - - if(!valueTypeNames.empty()) - { - pos = valueTypeNames.find(','); - if(pos == 0 || pos == valueTypeNames.size()) - { - usage(appName); - return EXIT_FAILURE; - } - if(pos == string::npos) - { - oldValueName = valueTypeNames; - newValueName = valueTypeNames; - } - else - { - oldValueName = valueTypeNames.substr(0, pos); - newValueName = valueTypeNames.substr(pos + 1); - } - } - - if(evictor) - { - if(oldKeyName.empty()) - { - oldKeyName = evictorKeyName; - } - if(newKeyName.empty()) - { - newKeyName = evictorKeyName; - } - if(oldValueName.empty()) - { - oldValueName = newEvictorValueName; - } - if(newValueName.empty()) - { - newValueName = newEvictorValueName; - } - } - - // - // Look up the key and value types in the old and new Slice definitions. - // - Slice::TypePtr oldKeyType = findType(oldUnit, oldKeyName); - if(!oldKeyType) - { - cerr << appName << ": type `" << oldKeyName << "' not found in old Slice definitions" << endl; - } - Slice::TypePtr newKeyType = findType(newUnit, newKeyName); - if(!newKeyType) - { - cerr << appName << ": type `" << newKeyName << "' not found in new Slice definitions" << endl; - } - Slice::TypePtr oldValueType = findType(oldUnit, oldValueName); - if(!oldValueType) - { - cerr << appName << ": type `" << oldValueName << "' not found in old Slice definitions" << endl; - } - Slice::TypePtr newValueType = findType(newUnit, newValueName); - if(!newValueType) - { - cerr << appName << ": type `" << newValueName << "' not found in new Slice definitions" << endl; - } - - // - // Stop now if any of the types could not be found. - // - if(!oldKeyType || !newKeyType || !oldValueType || !newValueType) - { - return EXIT_FAILURE; - } - - analyzer.addDatabase("", oldKeyType, newKeyType, oldValueType, newValueType); - } - - analyzer.finish(); - - if(!analyzeErrors.empty()) - { - for(vector::const_iterator p = analyzeErrors.begin(); p != analyzeErrors.end(); ++p) - { - cerr << appName << ": " << *p << endl; - } - } - - if(!missingTypes.empty()) - { - sort(missingTypes.begin(), missingTypes.end()); - unique(missingTypes.begin(), missingTypes.end()); - if(!analyzeErrors.empty()) - { - cerr << endl; - } - cerr << "The following types had no matching definitions in the new Slice:" << endl; - for(vector::const_iterator p = missingTypes.begin(); p != missingTypes.end(); ++p) - { - cerr << " " << *p << endl; - } - } - - if(!analyzeErrors.empty()) - { - return EXIT_FAILURE; - } - - descriptors = out.str(); - - if(!outputFile.empty()) - { - IceUtilInternal::ofstream of(outputFile); - if(!of.good()) - { - cerr << appName << ": unable to open file `" << outputFile << "'" << endl; - return EXIT_FAILURE; - } - of << descriptors; - of.close(); - return EXIT_SUCCESS; - } - } - else - { - // - // Read the input file. - // - IceUtilInternal::ifstream in(inputFile); - char buff[1024]; - while(true) - { - in.read(buff, 1024); - descriptors.append(buff, static_cast(in.gcount())); - if(in.gcount() < 1024) - { - break; - } - } - in.close(); - } - - if(dbEnvName == dbEnvNameNew) - { - cerr << appName << ": database environment names must be different" << endl; - return EXIT_FAILURE; - } - - FreezeScript::ObjectFactoryPtr objectFactory = new FreezeScript::ObjectFactory; - communicator->addObjectFactory(objectFactory, ""); - - // - // Transform the database. - // - DbEnv dbEnv(0); - DbEnv dbEnvNew(0); - Freeze::TransactionPtr txNew; - Freeze::ConnectionPtr connection; - Freeze::ConnectionPtr connectionNew; - vector dbs; - int status = EXIT_SUCCESS; - try - { -#ifdef _WIN32 - // - // Berkeley DB may use a different C++ runtime. - // - dbEnv.set_alloc(::malloc, ::realloc, ::free); - dbEnvNew.set_alloc(::malloc, ::realloc, ::free); -#endif - - // - // Open the old database environment. Use DB_RECOVER_FATAL if -c is specified. - // No transaction is created for the old environment. - // - // DB_THREAD is for compatibility with Freeze (the catalog) - // - { - u_int32_t flags = DB_THREAD | DB_CREATE | DB_INIT_TXN | DB_INIT_MPOOL; - if(catastrophicRecover) - { - flags |= DB_INIT_LOG | DB_RECOVER_FATAL; - } - dbEnv.open(dbEnvName.c_str(), flags, FREEZE_SCRIPT_DB_MODE); - } - - // - // We're creating a connection just to make sure the database environment - // isn't locked. - // - connection = Freeze::createConnection(communicator, dbEnvName, dbEnv); - - // - // Open the new database environment and start a transaction. - // - // - // DB_THREAD is for compatibility with Freeze (the catalog) - // - { - u_int32_t flags = DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_RECOVER | DB_CREATE | DB_THREAD; - dbEnvNew.open(dbEnvNameNew.c_str(), flags, FREEZE_SCRIPT_DB_MODE); - } - - // - // TODO: handle properly DbHome config (currently it will break if it's set for the new env) - // - - // - // Open the catalog of the new environment, and start a transaction. - // - connectionNew = Freeze::createConnection(communicator, dbEnvNameNew, dbEnvNew); - txNew = connectionNew->beginTransaction(); - DbTxn* txnNew = Freeze::getTxn(txNew); - - if(allDb) - { - // - // Transform all databases in the old catalog. - // - for(FreezeScript::CatalogDataMap::iterator p = catalog.begin(); p != catalog.end(); ++p) - { - transformDb(p->second.evictor, communicator, objectFactory, dbEnv, dbEnvNew, p->first, connectionNew, - dbs, oldUnit, newUnit, txnNew, purgeObjects, suppress, descriptors); - } - } - else - { - transformDb(evictor, communicator, objectFactory, dbEnv, dbEnvNew, dbName, connectionNew, dbs, - oldUnit, newUnit, txnNew, purgeObjects, suppress, descriptors); - } - } - catch(const DbException& ex) - { - cerr << appName << ": database error: " << ex.what() << endl; - status = EXIT_FAILURE; - } - catch(const IceUtil::FileLockException&) - { - cerr << appName << ": error: database environment is locked" << endl; - status = EXIT_FAILURE; - } - catch(...) - { - try - { - if(txNew != 0) - { - txNew->rollback(); - txNew = 0; - } - if(connectionNew) - { - connectionNew->close(); - connectionNew = 0; - } - if(connection) - { - connection->close(); - connection = 0; - } - for(vector::iterator p = dbs.begin(); p != dbs.end(); ++p) - { - Db* db = *p; - db->close(0); - delete db; - } - try - { - dbEnv.close(0); - } - catch(const DbException&) - { - } - try - { - dbEnvNew.close(0); - } - catch(const DbException&) - { - } - } - catch(const DbException& ex) - { - cerr << appName << ": database error: " << ex.what() << endl; - } - throw; - } - - if(txNew != 0) - { - try - { - if(status == EXIT_FAILURE) - { - txNew->rollback(); - } - else - { - txNew->commit(); - - // - // Checkpoint to migrate changes from the log to the database(s). - // - dbEnvNew.txn_checkpoint(0, 0, DB_FORCE); - } - - for(vector::iterator p = dbs.begin(); p != dbs.end(); ++p) - { - Db* db = *p; - db->close(0); - delete db; - } - } - catch(const DbException& ex) - { - cerr << appName << ": database error: " << ex.what() << endl; - status = EXIT_FAILURE; - } - } - // Clear the transaction before closing the database environment. - txNew = 0; - - if(connectionNew) - { - connectionNew->close(); - connectionNew = 0; - } - - if(connection) - { - connection->close(); - connection = 0; - } - - try - { - dbEnv.close(0); - } - catch(const DbException&) - { - } - - try - { - dbEnvNew.close(0); - } - catch(const DbException&) - { - } - - return status; -} - -#ifdef _WIN32 - -int -wmain(int argc, wchar_t* argv[]) - -#else - -int -main(int argc, char* argv[]) -#endif -{ - Ice::StringSeq args = Ice::argsToStringSeq(argc, argv); - assert(args.size() > 0); - const string appName = args[0]; - - Ice::InitializationData initData; - FreezeScript::CompactIdResolverIPtr resolver = new FreezeScript::CompactIdResolverI; - initData.compactIdResolver = resolver; - - Ice::CommunicatorPtr communicator; - int status = EXIT_SUCCESS; - try - { - communicator = Ice::initialize(args, initData); - status = run(args, communicator, resolver); - } - catch(const FreezeScript::FailureException& ex) - { - string reason = ex.reason(); - cerr << appName << ": " << reason; - if(reason[reason.size() - 1] != '\n') - { - cerr << endl; - } - status = EXIT_FAILURE; - } - catch(const std::exception& ex) - { - cerr << appName << ": " << ex.what() << endl; - status = EXIT_FAILURE; - } - catch(...) - { - cerr << appName << ": unknown exception" << endl; - status = EXIT_FAILURE; - } - - if(communicator) - { - communicator->destroy(); - } - - return status; -} - diff --git a/cpp/src/Makefile b/cpp/src/Makefile index c4c5b4192b7..7ed1b7f07f8 100644 --- a/cpp/src/Makefile +++ b/cpp/src/Makefile @@ -24,8 +24,6 @@ else Slice \ slice2cpp \ slice2cs \ - slice2freeze \ - slice2freezej \ slice2java \ slice2php \ slice2html \ @@ -41,8 +39,6 @@ endif IceSSL \ IceDiscovery \ IceLocatorDiscovery \ - Freeze \ - FreezeScript \ IceBox \ Glacier2Lib \ Glacier2CryptPermissionsVerifier \ @@ -64,15 +60,11 @@ endif Slice: IceUtil -slice2cpp slice2cs slice2freeze slice2freezej slice2java slice2js slice2php slice2html slice2objc: Slice +slice2cpp slice2cs slice2java slice2js slice2php slice2html slice2objc: Slice Ice: slice2cpp -IceXML IceSSL Freeze FreezeScript IceBox Glacier2Lib IcePatch2Lib IceStormLib IceGridLib: Ice - -Freeze: slice2freeze - -FreezeScript: Freeze +IceXML IceSSL IceBox Glacier2Lib IcePatch2Lib IceStormLib IceGridLib: Ice Glacier2 IceGridLib Glacier2CryptPermissionsVerifier: Glacier2Lib diff --git a/cpp/src/Makefile.mak b/cpp/src/Makefile.mak index d67f8c3353e..daefee51925 100644 --- a/cpp/src/Makefile.mak +++ b/cpp/src/Makefile.mak @@ -31,9 +31,7 @@ SUBDIRS = IceUtil \ SUBDIRS = IceUtil \ Slice \ slice2cpp \ - slice2freeze \ slice2cs \ - slice2freezej \ slice2java \ slice2html \ slice2php \ @@ -44,8 +42,6 @@ SUBDIRS = IceUtil \ IceLocatorDiscovery \ IceXML \ IceDB \ - Freeze \ - FreezeScript \ IcePatch2Lib \ Glacier2Lib \ IceStormLib \ @@ -75,4 +71,4 @@ $(EVERYTHING):: @if exist %i \ @echo "making $@ in %i" && \ cmd /c "cd %i && $(MAKE) -nologo -f Makefile.mak $@" || exit 1 -!endif \ No newline at end of file +!endif diff --git a/cpp/src/slice2freeze/.depend.mak b/cpp/src/slice2freeze/.depend.mak deleted file mode 100755 index 91efa2f3260..00000000000 --- a/cpp/src/slice2freeze/.depend.mak +++ /dev/null @@ -1,25 +0,0 @@ - -Main.obj: \ - Main.cpp \ - "$(includedir)\IceUtil\DisableWarnings.h" \ - "$(includedir)\IceUtil\Options.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\RecMutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\CtrlCHandler.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Slice\Preprocessor.h" \ - "$(includedir)\Slice\CPlusPlusUtil.h" \ - "$(includedir)\Slice\Parser.h" \ - "$(includedir)\IceUtil\OutputUtil.h" \ - "$(includedir)\Slice\FileTracker.h" \ - "$(includedir)\Slice\Util.h" \ - "$(includedir)\IceUtil\StringUtil.h" \ diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp deleted file mode 100644 index 487707d2e6d..00000000000 --- a/cpp/src/slice2freeze/Main.cpp +++ /dev/null @@ -1,2142 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace IceUtil; -using namespace IceUtilInternal; -using namespace Slice; - -namespace -{ - -IceUtil::Mutex* globalMutex = 0; -bool interrupted = false; - -class Init -{ -public: - - Init() - { - globalMutex = new IceUtil::Mutex; - } - - ~Init() - { - delete globalMutex; - globalMutex = 0; - } -}; - -Init init; - -string ICE_ENCODING_COMPARE = "Freeze::IceEncodingCompare"; - -} - -void -interruptedCallback(int /*signal*/) -{ - IceUtilInternal::MutexPtrLock sync(globalMutex); - - interrupted = true; -} - -class MetaDataVisitor : public ParserVisitor -{ -public: - - MetaDataVisitor() : - _useWstring(false) - { - } - - virtual bool visitModuleStart(const ModulePtr& p) - { - setUseWstring(p); - return true; - } - - virtual void visitModuleEnd(const ModulePtr&) - { - resetUseWstring(); - } - - virtual bool visitClassDefStart(const ClassDefPtr& p) - { - setUseWstring(p); - checkMetaData(p->dataMembers()); - resetUseWstring(); - return true; - } - - virtual bool visitStructStart(const StructPtr& p) - { - setUseWstring(p); - checkMetaData(p->dataMembers()); - resetUseWstring(); - return true; - } - -private: - - void checkMetaData(const DataMemberList& dataMembers) - { - for(DataMemberList::const_iterator p = dataMembers.begin(); p != dataMembers.end(); ++p) - { - BuiltinPtr builtin = BuiltinPtr::dynamicCast((*p)->type()); - if(builtin && builtin->kind() == Builtin::KindString) - { - StringList metaData = (*p)->getMetaData(); - for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ++q) - { - if(*q == "cpp:type:string" || *q == "cpp:type:wstring") - { - continue; - } - } - metaData.push_back(_useWstring ? "cpp:type:wstring" : "cpp:type:string"); - (*p)->setMetaData(metaData); - } - } - } - - void setUseWstring(ContainedPtr p) - { - _useWstringHist.push_back(_useWstring); - StringList metaData = p->getMetaData(); - if(find(metaData.begin(), metaData.end(), "cpp:type:wstring") != metaData.end()) - { - _useWstring = true; - } - else if(find(metaData.begin(), metaData.end(), "cpp:type:string") != metaData.end()) - { - _useWstring = false; - } - } - - void resetUseWstring() - { - _useWstring = _useWstringHist.back(); - _useWstringHist.pop_back(); - } - - bool _useWstring; - std::list _useWstringHist; -}; - -struct DictIndex -{ - string member; - bool caseSensitive; - bool sort; - string userCompare; - - bool operator==(const DictIndex& rhs) const - { - return member == rhs.member; - } - - bool operator!=(const DictIndex& rhs) const - { - return member != rhs.member; - } -}; - -struct Dict -{ - string name; - string key; - StringList keyMetaData; - string value; - StringList valueMetaData; - bool sort; - string userCompare; - - vector indices; -}; - -struct Index -{ - string name; - string type; - string member; - bool caseSensitive; -}; - -struct IndexType -{ - TypePtr type; - StringList metaData; -}; - -void -usage(const char* n) -{ - getErrorStream() << "Usage: " << n << " [options] file-base [slice-files...]\n"; - getErrorStream() << - "Options:\n" - "-h, --help Show this message.\n" - "-v, --version Display the Ice version.\n" - "--validate Validate command line options.\n" - "--header-ext EXT Use EXT instead of the default `h' extension.\n" - "--source-ext EXT Use EXT instead of the default `cpp' extension.\n" - "--add-header HDR[,GUARD]\n" - " Add #include for HDR (with guard GUARD) to\n" - " generated source file.\n" - "-DNAME Define NAME as 1.\n" - "-DNAME=DEF Define NAME as DEF.\n" - "-UNAME Remove any definition for NAME.\n" - "-IDIR Put DIR in the include file search path.\n" - "-E Print preprocessor output on stdout.\n" - "--include-dir DIR Use DIR as the header include directory in\n" - " source files.\n" - "--dll-export SYMBOL Use SYMBOL for DLL exports.\n" - "--dict NAME,KEY,VALUE[,sort[,COMPARE]]\n" - " Create a Freeze dictionary with the name NAME,\n" - " using KEY as key, and VALUE as value. This\n" - " option may be specified multiple times for\n" - " different names. NAME may be a scoped name.\n" - " By default, keys are sorted using their binary\n" - " Ice-encoding representation. Use 'sort' to sort\n" - " with the COMPARE functor class. COMPARE's default\n" - " value is std::less\n" - "--index NAME,TYPE,MEMBER[,{case-sensitive|case-insensitive}]\n" - " Create a Freeze evictor index with the name\n" - " NAME for member MEMBER of class TYPE. This\n" - " option may be specified multiple times for\n" - " different names. NAME may be a scoped name.\n" - " When member is a string, the case can be\n" - " sensitive or insensitive (default is sensitive).\n" - "--dict-index DICT[,MEMBER][,{case-sensitive|case-insensitive}]\n" - " [,sort[,COMPARE]]\n" - " Add an index to dictionary DICT. If MEMBER is \n" - " specified, then DICT's VALUE must be a class or\n" - " a struct, and MEMBER must designate a member of\n" - " VALUE. Otherwise, the entire VALUE is used for \n" - " indexing. When the secondary key is a string, \n" - " the case can be sensitive or insensitive (default\n" - " is sensitive).\n" - " By default, keys are sorted using their binary\n" - " Ice-encoding representation. Use 'sort' to sort\n" - " with the COMPARE functor class. COMPARE's default\n" - " value is std::less.\n" - "--output-dir DIR Create files in the directory DIR.\n" - "--depend Generate dependencies for input Slice files.\n" - "--depend-xml Generate dependencies in XML format.\n" - "--depend-file FILE Write dependencies to FILE instead of standard output.\n" - "-d, --debug Print debug messages.\n" - "--ice Allow reserved Ice prefix in Slice identifiers.\n" - "--underscore Allow underscores in Slice identifiers.\n" - ; -} - -void -checkIdentifier(string t, string s) -{ - if(s.empty() || (!IceUtilInternal::isAlpha(s[0]) && s[0] != '_')) - { - ostringstream os; - os << t << "' is not a valid type name"; - throw os.str(); - } - - for(unsigned int i = 1; i < s.size(); ++i) - { - if(!isalnum(static_cast(s[i])) && s[i] != '_') - { - ostringstream os; - os << t << "' is not a valid type name"; - throw os.str(); - } - } -} - -void -printFreezeTypes(Output& out, const vector& dicts, const vector& indices) -{ - out << '\n'; - out << "\n// Freeze types in this file:"; - for(vector::const_iterator p = dicts.begin(); p != dicts.end(); ++p) - { - out << "\n// name=\"" << p->name << "\", key=\"" - << p->key << "\", value=\"" << p->value << "\""; - } - - for(vector::const_iterator q = indices.begin(); q != indices.end(); ++q) - { - out << "\n// name=\"" << q->name << "\", type=\"" << q->type - << "\", member=\"" << q->member << "\""; - if(q->caseSensitive == false) - { - out << " (case insensitive)"; - } - } - out << '\n'; -} - -template -inline string -getCompare(const T& t, const string& keyType) -{ - if(t.sort) - { - if(t.userCompare == "") - { - return "std::less< " + keyType + ">"; - } - else - { - return t.userCompare; - } - } - else - { - return ICE_ENCODING_COMPARE; - } -} - -string -getTypeId(const TypePtr& type, const StringList& metaData) -{ - string typeId = type->typeId(); - BuiltinPtr builtInType = BuiltinPtr::dynamicCast(type); - if(builtInType && builtInType->kind() == Builtin::KindString && metaData.size() != 0 && - metaData.front() == "cpp:type:wstring") - { - typeId = "wstring"; - } - return typeId; -} - -void -writeDictH(const string& name, const Dict& dict, const vector indexTypes, const TypePtr& keyType, - const StringList& keyMetaData, const TypePtr& valueType, const StringList& valueMetaData, Output& H, - const string& dllExport) -{ - const string keyTypeS = typeToString(keyType, keyMetaData); - const string valueTypeS = typeToString(valueType, valueMetaData); - const string compare = getCompare(dict, keyTypeS); - const string keyCodec = string("::Freeze::MapKeyCodec< ") + keyTypeS + " >"; - const string valueCodec = - string(valueType->usesClasses() ? "::Freeze::MapObjectValueCodec" : "::Freeze::MapValueCodec") + - "< " + valueTypeS + " >"; - - const string templateParams = string("< ") + keyTypeS + ", " + valueTypeS + ", " + keyCodec + ", " + valueCodec + - ", " + compare + " >"; - - const string keyCompareParams = string("< ") + keyTypeS + ", " + keyCodec + ", " + compare + " >"; - - vector capitalizedMembers; - - for(size_t i = 0; i < dict.indices.size(); ++i) - { - const string& member = dict.indices[i].member; - if(!member.empty()) - { - string capitalizedMember = member; - capitalizedMember[0] = toupper(static_cast(capitalizedMember[0])); - capitalizedMembers.push_back(capitalizedMember); - } - else - { - capitalizedMembers.push_back("Value"); - } - } - - H << sp << nl << "class " << dllExport << name - << " : public Freeze::Map" << templateParams; - H << sb; - H.dec(); - H << sp << nl << "public:"; - H << sp; - H.inc(); - - // - // Typedefs - // - /* - H << nl << "typedef std::pair value_type;"; - - H << nl << "typedef Freeze::Iterator" << templateParams << " iterator;"; - H << nl << "typedef Freeze::ConstIterator" << templateParams << " const_iterator;"; - H << nl << "typedef size_t size_type;"; - H << nl << "typedef ptrdiff_t difference_type;"; - */ - - // - // Nested index classes - // - - for(size_t i = 0; i < capitalizedMembers.size(); ++i) - { - string className = capitalizedMembers[i] + "Index"; - - string indexCompare = getCompare(dict.indices[i], typeToString(indexTypes[i].type, indexTypes[i].metaData)); - - string indexCompareParams = string("< ") + typeToString(indexTypes[i].type, indexTypes[i].metaData) + ", " - + className + ", " + indexCompare + " >"; - - H << sp << nl << "class " << dllExport << className - << " : public Freeze::MapIndex" << indexCompareParams; - H << sb; - - H.dec(); - H << sp << nl << "public:"; - H << sp; - H.inc(); - H << nl << capitalizedMembers[i] << "Index(const std::string&, const " - << indexCompare << "& = " << indexCompare << "());"; - - H << sp; - - // - // Codec - // - H << nl << "static void write(" << inputTypeToString(indexTypes[i].type, 0, indexTypes[i].metaData) - << ", Freeze::Key&, const Ice::CommunicatorPtr&, const Ice::EncodingVersion&);"; - - H << nl << "static void read(" - << typeToString(indexTypes[i].type, indexTypes[i].metaData) - << "&, const Freeze::Key&, const ::Ice::CommunicatorPtr&, const Ice::EncodingVersion&);"; - - H.dec(); - H << sp << nl << "protected:"; - H << sp; - H.inc(); - - H << nl << "virtual void marshalKey(const Freeze::Value&, Freeze::Key&) const;"; - - H << eb << ';'; - } - - // - // Constructors - // - H << sp; - H << nl << name << "(const Freeze::ConnectionPtr&, const std::string&, " - << "bool = true, const " << compare << "& = " << compare << "());"; - H << sp; - H << nl << "template " - << nl << name << "(const Freeze::ConnectionPtr& __connection, " - << "const std::string& __dbName, bool __createDb, _InputIterator __first, _InputIterator __last, " - << "const " << compare << "& __compare = " << compare << "())"; - H.inc(); - if(capitalizedMembers.empty()) - { - H << nl << ": Freeze::Map" << templateParams <<"(__connection, __dbName, keyTypeId(), valueTypeId(), " - << "__createDb, __first, __last, __compare)"; - H.dec(); - H << sb; - H << eb; - } - else - { - H << nl << ": Freeze::Map" << templateParams <<"(__connection->getCommunicator(), __connection->getEncoding())"; - H.dec(); - H << sb; - H << nl << "Freeze::KeyCompareBasePtr __keyCompare = " - << "new Freeze::KeyCompare" << keyCompareParams << "(__compare, this->_communicator, this->_encoding);"; - H << nl << "std::vector __indices;"; - for(size_t i = 0; i < capitalizedMembers.size(); ++i) - { - string indexName = dict.indices[i].member; - if(indexName.empty()) - { - indexName = "index"; - } - indexName = string("\"") + indexName + "\""; - - H << nl << "__indices.push_back(new " << capitalizedMembers[i] << "Index(" << indexName << "));"; - } - H << nl << "this->_helper.reset(Freeze::MapHelper::create(__connection, __dbName, keyTypeId(), valueTypeId(), " - << "__keyCompare, __indices, __createDb));"; - H << nl << "while(__first != __last)"; - H << sb; - H << nl << "put(*__first);"; - H << nl << "++__first;"; - H << eb; - H << eb; - - // - // Recreate - // - H << sp << nl << "static void recreate(const Freeze::ConnectionPtr&, const std::string&, " - << "const " << compare << "& = " << compare << "());"; - } - - H << sp; - H << nl << "static std::string keyTypeId();"; - H << nl << "static std::string valueTypeId();"; - - // - // Find, begin, lowerBound, upperBound, equalRange and count functions - // - for(size_t i = 0; i < capitalizedMembers.size(); ++i) - { - H << sp; - H << nl << "iterator findBy" << capitalizedMembers[i] - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ", bool = true);"; - H << nl << "const_iterator findBy" << capitalizedMembers[i] - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ", bool = true) const;"; - - H << nl << "iterator beginFor" << capitalizedMembers[i] << "();"; - H << nl << "const_iterator beginFor" << capitalizedMembers[i] << "() const;"; - - H << nl << "iterator endFor" << capitalizedMembers[i] << "();"; - H << nl << "const_iterator endFor" << capitalizedMembers[i] << "() const;"; - - H << nl << "iterator lowerBoundFor" << capitalizedMembers[i] - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ");"; - H << nl << "const_iterator lowerBoundFor" << capitalizedMembers[i] - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ") const;"; - - H << nl << "iterator upperBoundFor" << capitalizedMembers[i] - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ");"; - H << nl << "const_iterator upperBoundFor" << capitalizedMembers[i] - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ") const;"; - - H << nl << "std::pair equalRangeFor" - << capitalizedMembers[i] << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) - << ");"; - - H << nl << "std::pair equalRangeFor" - << capitalizedMembers[i] << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) - << ") const;"; - - string countFunction = dict.indices[i].member.empty() ? string("valueCount") - : dict.indices[i].member + "Count"; - - H << nl << "int " << countFunction - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ") const;"; - - } - - H << eb << ';'; -} - -void -writeDictC(const string& name, const string& absolute, const Dict& dict, const vector indexTypes, - const TypePtr& keyType, const StringList& keyMetaData, const TypePtr& valueType, - const StringList& valueMetaData, Output& C) -{ - const string keyTypeS = typeToString(keyType, keyMetaData); - const string valueTypeS = typeToString(valueType, valueMetaData); - const string compare = getCompare(dict, keyTypeS); - const string keyCodec = string("::Freeze::MapKeyCodec< ") + keyTypeS + " >"; - const string valueCodec = - string(valueType->usesClasses() ? "::Freeze::MapObjectValueCodec" : "::Freeze::MapValueCodec") + - "< " + valueTypeS + " >"; - - const string templateParams = string("< ") + keyTypeS + ", " + valueTypeS + ", " + keyCodec + ", " + valueCodec + - ", " + compare + " >"; - - const string keyCompareParams = string("< ") + keyTypeS + ", " + keyCodec + ", " + compare + " >"; - - vector capitalizedMembers; - - for(size_t i = 0; i < dict.indices.size(); ++i) - { - const string& member = dict.indices[i].member; - if(!member.empty()) - { - string capitalizedMember = member; - capitalizedMember[0] = toupper(static_cast(capitalizedMember[0])); - capitalizedMembers.push_back(capitalizedMember); - } - else - { - capitalizedMembers.push_back("Value"); - } - } - - // - // Nested index classes - // - for(size_t i = 0; i < capitalizedMembers.size(); ++i) - { - string className = capitalizedMembers[i] + "Index"; - - string indexCompare = getCompare(dict.indices[i], typeToString(indexTypes[i].type, indexTypes[i].metaData)); - - string indexCompareParams = string("< ") + typeToString(indexTypes[i].type, indexTypes[i].metaData) + ", " - + className + ", " + indexCompare + " >"; - - C << sp << nl << absolute << "::" << className << "::" << className - << "(const std::string& __name, " - << "const " << indexCompare << "& __compare)"; - - C.inc(); - C << nl << ": Freeze::MapIndex" << indexCompareParams << "(__name, __compare)"; - C.dec(); - C << sb; - C << eb; - - C << sp << nl << "void" - << nl << absolute << "::" << className << "::" - << "marshalKey(const Freeze::Value& __v, Freeze::Key& __k) const"; - C << sb; - - bool optimize = false; - - if(dict.indices[i].member.empty() && dict.indices[i].caseSensitive) - { - optimize = true; - C << nl << "__k = __v;"; - } - else - { - // - // Can't optimize - // - C << nl << valueTypeS << " __x;"; - C << nl << valueCodec << "::read(__x, __v, _communicator, _encoding);"; - string param = "__x"; - - if(!dict.indices[i].member.empty()) - { - if(ClassDeclPtr::dynamicCast(valueType) != 0) - { - param += "->" + dict.indices[i].member; - } - else - { - param += "." + dict.indices[i].member; - } - } - C << nl << "write(" << param << ", __k, _communicator, _encoding);"; - } - C << eb; - - C << sp << nl << "void" - << nl << absolute << "::" << className << "::" - << "write(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) - << " __index, Freeze::Key& __bytes, const Ice::CommunicatorPtr& __communicator, " - << "const Ice::EncodingVersion& __encoding)"; - C << sb; - - if(optimize) - { - C << nl << valueCodec << "::write(__index, __bytes, __communicator, __encoding);"; - } - else - { - assert(!indexTypes[i].type->usesClasses()); - - C << nl << "IceInternal::InstancePtr __instance = IceInternal::getInstance(__communicator);"; - C << nl << "IceInternal::BasicStream __stream(__instance.get(), __encoding);"; - - string valueS; - if(dict.indices[i].caseSensitive) - { - valueS = "__index"; - } - else - { - C << nl << typeToString(indexTypes[i].type, indexTypes[i].metaData) - << " __lowerCaseIndex = IceUtilInternal::toLower(__index);"; - valueS = "__lowerCaseIndex"; - } - - writeMarshalUnmarshalCode(C, indexTypes[i].type, false, 0, valueS, true, indexTypes[i].metaData, 0, - "__stream", false); - C << nl << "::std::vector(__stream.b.begin(), __stream.b.end()).swap(__bytes);"; - } - C << eb; - - C << sp << nl << "void" - << nl << absolute << "::" << className << "::" - << "read(" << typeToString(indexTypes[i].type, indexTypes[i].metaData) - << "& __index, const Freeze::Key& __bytes, const Ice::CommunicatorPtr& __communicator, " - << "const Ice::EncodingVersion& __encoding)"; - C << sb; - - if(optimize) - { - C << nl << valueCodec << "::read(__index, __bytes, __communicator, __encoding);"; - } - else - { - C << nl << "IceInternal::InstancePtr __instance = IceInternal::getInstance(__communicator);"; - C << nl << "IceInternal::BasicStream __stream(__instance.get(), __encoding, "; - C << "&__bytes[0], &__bytes[0] + __bytes.size());"; - - writeMarshalUnmarshalCode(C, indexTypes[i].type, false, 0, "__index", false, indexTypes[i].metaData, 0, - "__stream", false); - } - C << eb; - } - - // - // Constructor - // - C << sp << nl << absolute << "::" << name - << "(const Freeze::ConnectionPtr& __connection, const std::string& __dbName ," - << "bool __createDb, const " << compare << "& __compare)"; - if(capitalizedMembers.empty()) - { - C.inc(); - C << nl << ": Freeze::Map" << templateParams - <<"(__connection, __dbName, keyTypeId(), valueTypeId(), __createDb, __compare)"; - C.dec(); - C << sb; - C << eb; - } - else - { - C.inc(); - C << nl << ": Freeze::Map" << templateParams <<"(__connection->getCommunicator(), __connection->getEncoding())"; - C.dec(); - C << sb; - C << nl << "Freeze::KeyCompareBasePtr __keyCompare = " - << "new Freeze::KeyCompare" << keyCompareParams << "(__compare, _communicator, _encoding);"; - C << nl << "std::vector __indices;"; - for(size_t i = 0; i < capitalizedMembers.size(); ++i) - { - string indexName = dict.indices[i].member; - if(indexName.empty()) - { - indexName = "index"; - } - indexName = string("\"") + indexName + "\""; - - C << nl << "__indices.push_back(new " << capitalizedMembers[i] << "Index(" << indexName << "));"; - } - C << nl << "_helper.reset(Freeze::MapHelper::create(__connection, __dbName, keyTypeId(), valueTypeId(), " - << "__keyCompare, __indices, __createDb));"; - C << eb; - - // - // Recreate - // - C << sp << nl << "void" - << nl << absolute - << "::recreate(const Freeze::ConnectionPtr& __connection, const std::string& __dbName ," - << " const " << compare << "& __compare)"; - C << sb; - C << nl << "Freeze::KeyCompareBasePtr __keyCompare = " - << "new Freeze::KeyCompare" << keyCompareParams << "(__compare, __connection->getCommunicator()" - <<", __connection->getEncoding());"; - C << nl << "std::vector __indices;"; - for(size_t i = 0; i < capitalizedMembers.size(); ++i) - { - string indexName = dict.indices[i].member; - if(indexName.empty()) - { - indexName = "index"; - } - indexName = string("\"") + indexName + "\""; - - C << nl << "__indices.push_back(new " << capitalizedMembers[i] << "Index(" << indexName << "));"; - } - C << nl << "Freeze::MapHelper::recreate(__connection, __dbName, keyTypeId(), valueTypeId(), __keyCompare, " - << "__indices);"; - C << eb; - } - - C << sp << nl << "std::string" - << nl << absolute << "::keyTypeId()"; - C << sb; - C << nl << "return \"" << getTypeId(keyType, keyMetaData) << "\";"; - C << eb; - C << sp << nl << "std::string" - << nl << absolute << "::valueTypeId()"; - C << sb; - C << nl << "return \"" << getTypeId(valueType, valueMetaData) << "\";"; - C << eb; - - // - // Find and count functions - // - for(size_t i = 0; i < capitalizedMembers.size(); ++i) - { - string indexClassName = capitalizedMembers[i] + "Index"; - - string indexName = dict.indices[i].member; - if(indexName.empty()) - { - indexName = "index"; - } - indexName = string("\"") + indexName + "\""; - - C << sp << nl << absolute << "::iterator" - << nl << absolute << "::" << "findBy" << capitalizedMembers[i] - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) - << " __index, bool __onlyDups)"; - C << sb; - C << nl << "Freeze::Key __bytes;"; - C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator, _encoding);"; - C << nl << "return iterator(_helper->index(" << indexName - << ")->untypedFind(__bytes, false, __onlyDups), _communicator, _encoding);"; - C << eb; - - C << sp << nl << absolute << "::const_iterator" - << nl << absolute << "::" << "findBy" << capitalizedMembers[i] - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) - << " __index, bool __onlyDups) const"; - C << sb; - C << nl << "Freeze::Key __bytes;"; - C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator, _encoding);"; - C << nl << "return const_iterator(_helper->index(" << indexName - << ")->untypedFind(__bytes, true, __onlyDups), _communicator, _encoding);"; - C << eb; - - C << sp << nl << absolute << "::iterator" - << nl << absolute << "::" << "beginFor" << capitalizedMembers[i] << "()"; - C << sb; - C << nl << "return iterator(_helper->index(" << indexName << ")->begin(false), _communicator, _encoding);"; - C << eb; - - C << sp << nl << absolute << "::const_iterator" - << nl << absolute << "::" << "beginFor" << capitalizedMembers[i] << "() const"; - C << sb; - C << nl << "return const_iterator(_helper->index(" << indexName << ")->begin(true), _communicator, _encoding);"; - C << eb; - - C << sp << nl << absolute << "::iterator" - << nl << absolute << "::" << "endFor" << capitalizedMembers[i] << "()"; - C << sb; - C << nl << "return iterator();"; - C << eb; - - C << sp << nl << absolute << "::const_iterator" - << nl << absolute << "::" << "endFor" << capitalizedMembers[i] << "() const"; - C << sb; - C << nl << "return const_iterator();"; - C << eb; - - C << sp << nl << absolute << "::iterator" - << nl << absolute << "::" << "lowerBoundFor" << capitalizedMembers[i] - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index)"; - C << sb; - C << nl << "Freeze::Key __bytes;"; - C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator, _encoding);"; - C << nl << "return iterator(_helper->index(" << indexName - << ")->untypedLowerBound(__bytes, false), _communicator, _encoding);"; - C << eb; - - C << sp << nl << absolute << "::const_iterator" - << nl << absolute << "::" << "lowerBoundFor" << capitalizedMembers[i] - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index) const"; - C << sb; - C << nl << "Freeze::Key __bytes;"; - C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator, _encoding);"; - C << nl << "return const_iterator(_helper->index(" << indexName - << ")->untypedLowerBound(__bytes, true), _communicator, _encoding);"; - C << eb; - - C << sp << nl << absolute << "::iterator" - << nl << absolute << "::" << "upperBoundFor" << capitalizedMembers[i] - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index)"; - C << sb; - C << nl << "Freeze::Key __bytes;"; - C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator, _encoding);"; - C << nl << "return iterator(_helper->index(" << indexName - << ")->untypedUpperBound(__bytes, false), _communicator, _encoding);"; - C << eb; - - C << sp << nl << absolute << "::const_iterator" - << nl << absolute << "::" << "upperBoundFor" << capitalizedMembers[i] - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index) const"; - C << sb; - C << nl << "Freeze::Key __bytes;"; - C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator, _encoding);"; - C << nl << "return const_iterator(_helper->index(" << indexName - << ")->untypedUpperBound(__bytes, true), _communicator, _encoding);"; - C << eb; - - C << sp << nl << "std::pair<" << absolute << "::iterator, " - << absolute << "::iterator>" - << nl << absolute << "::" << "equalRangeFor" << capitalizedMembers[i] - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index)"; - C << sb; - C << nl << "return std::make_pair(lowerBoundFor" << capitalizedMembers[i] - << "(__index), upperBoundFor" << capitalizedMembers[i] << "(__index));"; - C << eb; - - C << sp << nl << "std::pair<" << absolute << "::const_iterator, " - << absolute << "::const_iterator>" - << nl << absolute << "::" << "equalRangeFor" << capitalizedMembers[i] - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index) const"; - C << sb; - C << nl << "return std::make_pair(lowerBoundFor" << capitalizedMembers[i] - << "(__index), upperBoundFor" << capitalizedMembers[i] << "(__index));"; - C << eb; - - string countFunction = dict.indices[i].member.empty() ? string("valueCount") - : dict.indices[i].member + "Count"; - - C << sp << nl << "int" - << nl << absolute << "::" << countFunction - << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index) const"; - C << sb; - C << nl << "Freeze::Key __bytes;"; - C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator, _encoding);"; - C << nl << "return _helper->index(" << indexName - << ")->untypedCount(__bytes);"; - C << eb; - } -} - -void -writeDict(const string& n, const UnitPtr& u, const Dict& dict, Output& H, Output& C, const string& dllExport) -{ - string absolute = dict.name; - if(absolute.find("::") == 0) - { - absolute.erase(0, 2); - } - string name = absolute; - vector scope; - string::size_type pos; - while((pos = name.find("::")) != string::npos) - { - string s = name.substr(0, pos); - name.erase(0, pos + 2); - - checkIdentifier(absolute, s); - - scope.push_back(s); - } - - checkIdentifier(absolute, name); - - TypeList keyTypes = u->lookupType(dict.key, false); - if(keyTypes.empty()) - { - ostringstream os; - os << "`" << dict.key << "' is not a valid type"; - throw os.str(); - } - TypePtr keyType = keyTypes.front(); - - TypeList valueTypes = u->lookupType(dict.value, false); - if(valueTypes.empty()) - { - ostringstream os; - os << "`" << dict.value << "' is not a valid type"; - throw os.str(); - } - TypePtr valueType = valueTypes.front(); - - for(vector::const_iterator q = scope.begin(); q != scope.end(); ++q) - { - H << sp; - H << nl << "namespace " << *q << nl << '{'; - } - - vector indexTypes; - - for(vector::const_iterator p = dict.indices.begin(); p != dict.indices.end(); ++p) - { - const DictIndex& index = *p; - if(index.member.empty()) - { - if(dict.indices.size() > 1) - { - ostringstream os; - os << "bad index for dictionary `" << dict.name << "'"; - throw os.str(); - } - - bool containsSequence = false; - if(!Dictionary::legalKeyType(valueType, containsSequence)) - { - ostringstream os; - os << "`" << dict.value << "' is not a valid index type"; - throw os.str(); - } - if(containsSequence) - { - getErrorStream() << n << ": warning: use of sequences in dictionary keys has been deprecated"; - } - - if(index.caseSensitive == false) - { - // - // Let's check value is a string - // - - BuiltinPtr builtInType = BuiltinPtr::dynamicCast(valueType); - - if(builtInType == 0 || builtInType->kind() != Builtin::KindString) - { - ostringstream os; - os << "VALUE is a `" << dict.value << "', not a string"; - throw os.str(); - } - } - IndexType iType; - iType.type = valueType; - iType.metaData = dict.valueMetaData; - indexTypes.push_back(iType); - } - else - { - DataMemberPtr dataMember = 0; - DataMemberList dataMembers; - - ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(valueType); - if(classDecl != 0) - { - dataMembers = classDecl->definition()->allDataMembers(); - } - else - { - StructPtr structDecl = StructPtr::dynamicCast(valueType); - if(structDecl == 0) - { - ostringstream os; - os << "`" << dict.value << "' is neither a class nor a struct."; - throw os.str(); - } - dataMembers = structDecl->dataMembers(); - } - DataMemberList::const_iterator d = dataMembers.begin(); - while(d != dataMembers.end() && dataMember == 0) - { - if((*d)->name() == index.member) - { - dataMember = *d; - } - else - { - ++d; - } - } - - if(dataMember == 0) - { - ostringstream os; - os << "The value of `" << dict.name - << "' has no data member named `" << index.member << "'"; - throw os.str(); - } - - TypePtr dataMemberType = dataMember->type(); - - bool containsSequence = false; - if(!Dictionary::legalKeyType(dataMemberType, containsSequence)) - { - ostringstream os; - os << "`" << index.member << "' cannot be used as an index"; - throw os.str(); - } - if(containsSequence) - { - getErrorStream() << n << ": warning: use of sequences in dictionary keys has been deprecated"; - } - - if(index.caseSensitive == false) - { - // - // Let's check member is a string - // - BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMemberType); - if(memberType == 0 || memberType->kind() != Builtin::KindString) - { - ostringstream os; - os << "`" << index.member << "' is not a string "; - throw os.str(); - } - } - IndexType iType; - iType.type = dataMemberType; - iType.metaData = dataMember->getMetaData(); - indexTypes.push_back(iType); - } - } - - writeDictH(name, dict, indexTypes, keyType, dict.keyMetaData, valueType, dict.valueMetaData, H, dllExport); - - for(vector::const_iterator q = scope.begin(); q != scope.end(); ++q) - { - H << sp; - H << nl << '}'; - } - - writeDictC(name, absolute, dict, indexTypes, keyType, dict.keyMetaData, valueType, dict.valueMetaData, C); -} - -void -writeIndexH(const string& memberTypeString, const string& name, Output& H, const string& dllExport) -{ - H << sp << nl << "class " << dllExport << name - << " : public Freeze::Index"; - H << sb; - H.dec(); - H << sp << nl << "public:"; - H << sp; - H.inc(); - - H << nl << name << "(const std::string&, const std::string& = \"\");"; - H << sp << nl << "std::vector"; - H << nl << "findFirst(" << memberTypeString << ", Ice::Int) const;"; - - H << sp << nl << "std::vector"; - H << nl << "find(" << memberTypeString << ") const;"; - - H << sp << nl << "Ice::Int"; - H << nl << "count(" << memberTypeString << ") const;"; - H.dec(); - H << sp << nl << "private:"; - H << sp; - H.inc(); - - H << nl << "virtual bool"; - H << nl << "marshalKey(const Ice::ObjectPtr&, Freeze::Key&) const;"; - - H << sp << nl << "void"; - H << nl << "marshalKey(" << memberTypeString << ", Freeze::Key&) const;"; - - H << eb << ';'; - H << sp; - H << nl << "typedef IceUtil::Handle<" << name << "> " << name << "Ptr;"; -} - -void -writeIndexC(const TypePtr& type, const TypePtr& memberType, const string& memberName, - bool caseSensitive, const string& fullName, const string& name, Output& C) -{ - string inputType = inputTypeToString(memberType, false); - - C << sp << nl << fullName << "::" << name - << "(const ::std::string& __name, const ::std::string& __facet)"; - C.inc(); - C << nl << ": Freeze::Index(__name, __facet)"; - C.dec(); - C << sb; - C << eb; - - C << sp << nl << "std::vector"; - C << nl << fullName << "::" << "findFirst(" << inputType << " __index, ::Ice::Int __firstN) const"; - C << sb; - C << nl << "Freeze::Key __bytes;"; - C << nl << "marshalKey(__index, __bytes);"; - C << nl << "return untypedFindFirst(__bytes, __firstN);"; - C << eb; - - C << sp << nl << "std::vector"; - C << nl << fullName << "::" << "find(" << inputType << " __index) const"; - C << sb; - C << nl << "Freeze::Key __bytes;"; - C << nl << "marshalKey(__index, __bytes);"; - C << nl << "return untypedFind(__bytes);"; - C << eb; - - C << sp << nl << "Ice::Int"; - C << nl << fullName << "::" << "count(" << inputType << " __index) const"; - C << sb; - C << nl << "Freeze::Key __bytes;"; - C << nl << "marshalKey(__index, __bytes);"; - C << nl << "return untypedCount(__bytes);"; - C << eb; - - string typeString = typeToString(type); - - C << sp << nl << "bool"; - C << nl << fullName << "::" << "marshalKey(const Ice::ObjectPtr& __servant, Freeze::Key& __bytes) const"; - C << sb; - C << nl << typeString << " __s = " << typeString << "::dynamicCast(__servant);"; - C << nl << "if(__s != 0)"; - C << sb; - C << nl << "marshalKey(__s->" << memberName << ", __bytes);"; - C << nl << "return true;"; - C << eb; - C << nl << "else"; - C << sb; - C << nl << "return false;"; - C << eb; - C << eb; - - C << sp << nl << "void"; - C << nl << fullName << "::" << "marshalKey(" << inputType << " __index, Freeze::Key& __bytes) const"; - C << sb; - C << nl << "IceInternal::InstancePtr __instance = IceInternal::getInstance(_communicator);"; - C << nl << "IceInternal::BasicStream __stream(__instance.get(), _encoding);"; - - string valueS; - if(caseSensitive) - { - valueS = "__index"; - } - else - { - C << nl << typeToString(memberType) << " __lowerCaseIndex = IceUtilInternal::toLower(__index);"; - valueS = "__lowerCaseIndex"; - } - - writeMarshalUnmarshalCode(C, memberType, false, 0, valueS, true, StringList(), 0, "__stream", false); - if(memberType->usesClasses()) - { - C << nl << "__stream.writePendingObjects();"; - } - C << nl << "::std::vector(__stream.b.begin(), __stream.b.end()).swap(__bytes);"; - C << eb; -} - -void -writeIndex(const string& /*n*/, const UnitPtr& u, const Index& index, Output& H, Output& C, const string& dllExport) -{ - string absolute = index.name; - if(absolute.find("::") == 0) - { - absolute.erase(0, 2); - } - string name = absolute; - vector scope; - string::size_type pos; - while((pos = name.find("::")) != string::npos) - { - string s = name.substr(0, pos); - name.erase(0, pos + 2); - - checkIdentifier(absolute, s); - - scope.push_back(s); - } - - checkIdentifier(absolute, name); - - TypeList types = u->lookupType(index.type, false); - if(types.empty()) - { - ostringstream os; - os << "`" << index.type << "' is not a valid type"; - throw os.str(); - } - TypePtr type = types.front(); - - ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(type); - if(classDecl == 0) - { - ostringstream os; - os << "`" << index.type << "' is not a class"; - throw os.str(); - } - - DataMemberList dataMembers = classDecl->definition()->allDataMembers(); - DataMemberPtr dataMember = 0; - DataMemberList::const_iterator p = dataMembers.begin(); - while(p != dataMembers.end() && dataMember == 0) - { - if((*p)->name() == index.member) - { - dataMember = *p; - } - else - { - ++p; - } - } - - if(dataMember == 0) - { - ostringstream os; - os << "`" << index.type << "' has no data member named `" << index.member << "'"; - throw os.str(); - } - - if(index.caseSensitive == false) - { - // - // Let's check member is a string - // - BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMember->type()); - if(memberType == 0 || memberType->kind() != Builtin::KindString) - { - ostringstream os; - os << "`" << index.member << "'is not a string"; - throw os.str(); - } - } - - for(vector::const_iterator q = scope.begin(); q != scope.end(); ++q) - { - H << sp; - H << nl << "namespace " << *q << nl << '{'; - } - - writeIndexH(inputTypeToString(dataMember->type(), false), name, H, dllExport); - - for(vector::const_iterator q = scope.begin(); q != scope.end(); ++q) - { - H << sp; - H << nl << '}'; - } - - writeIndexC(type, dataMember->type(), index.member, index.caseSensitive, absolute, name, C); -} - -void -gen(const string& name, const UnitPtr& u, const vector& includePaths, const vector& extraHeaders, - const vector& dicts, const vector& indices, const string& include, const string& headerExtension, - const string& sourceExtension, string dllExport, const StringList& includes, const vector& args, - const string& output) -{ - string fileH = args[0]; - fileH += "." + headerExtension; - string includeH = fileH; - string fileC = args[0]; - fileC += "." + sourceExtension; - - if(!output.empty()) - { - fileH = output + '/' + fileH; - fileC = output + '/' + fileC; - } - - u->mergeModules(); - u->sort(); - - IceUtilInternal::Output H; - H.open(fileH.c_str()); - if(!H) - { - ostringstream os; - os << "cannot open `" << fileH << "': " << strerror(errno); - throw FileException(__FILE__, __LINE__, os.str()); - } - - FileTracker::instance()->addFile(fileH); - - printHeader(H); - printGeneratedHeader(H, string(args[0]) + ".ice"); - - - printFreezeTypes(H, dicts, indices); - - IceUtilInternal::Output CPP; - CPP.open(fileC.c_str()); - if(!CPP) - { - ostringstream os; - os << "cannot open `" << fileC << "': " << strerror(errno); - throw FileException(__FILE__, __LINE__, os.str()); - } - FileTracker::instance()->addFile(fileC); - - printHeader(CPP); - printGeneratedHeader(CPP, string(args[0]) + ".ice"); - - printFreezeTypes(CPP, dicts, indices); - - for(vector::const_iterator i = extraHeaders.begin(); i != extraHeaders.end(); ++i) - { - string hdr = *i; - string guard; - string::size_type pos = hdr.rfind(','); - if(pos != string::npos) - { - hdr = i->substr(0, pos); - guard = i->substr(pos + 1); - } - if(!guard.empty()) - { - CPP << "\n#ifndef " << guard; - CPP << "\n#define " << guard; - } - CPP << "\n#include <"; - if(!include.empty()) - { - CPP << include << '/'; - } - CPP << hdr << '>'; - if(!guard.empty()) - { - CPP << "\n#endif"; - } - } - - string s = fileH; - transform(s.begin(), s.end(), s.begin(), ToIfdef()); - H << "\n#ifndef __" << s << "__"; - H << "\n#define __" << s << "__"; - H << '\n'; - - H << "\n#include "; - - if(dicts.size() > 0) - { - H << "\n#include "; - } - - if(indices.size() > 0) - { - H << "\n#include "; - } - - for(StringList::const_iterator p = includes.begin(); p != includes.end(); ++p) - { - H << "\n#include <" << changeInclude(*p, includePaths) << "." + headerExtension + ">"; - } - - - CPP << "\n#include "; - CPP << "\n#include "; - CPP << "\n#include "; - CPP << "\n#include "; - CPP << "\n#include <"; - if(include.size()) - { - CPP << include << '/'; - } - CPP << includeH << '>'; - - printVersionCheck(H); - printVersionCheck(CPP); - - printDllExportStuff(H, dllExport); - if(dllExport.size()) - { - dllExport += " "; - } - - for(vector::const_iterator p = dicts.begin(); p != dicts.end(); ++p) - { - writeDict(name, u, *p, H, CPP, dllExport); - } - - for(vector::const_iterator q = indices.begin(); q != indices.end(); ++q) - { - writeIndex(name, u, *q, H, CPP, dllExport); - } - - H << "\n\n#include "; - H << "\n#endif\n"; - CPP << '\n'; - - H.close(); - CPP.close(); -} - -int -compile(int argc, char* argv[]) -{ - IceUtilInternal::Options opts; - opts.addOpt("h", "help"); - opts.addOpt("v", "version"); - opts.addOpt("", "validate"); - opts.addOpt("", "header-ext", IceUtilInternal::Options::NeedArg, "h"); - opts.addOpt("", "source-ext", IceUtilInternal::Options::NeedArg, "cpp"); - opts.addOpt("", "add-header", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("D", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("U", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("I", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("E"); - opts.addOpt("", "include-dir", IceUtilInternal::Options::NeedArg); - opts.addOpt("", "dll-export", IceUtilInternal::Options::NeedArg); - opts.addOpt("", "dict", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("", "index", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("", "dict-index", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("", "output-dir", IceUtilInternal::Options::NeedArg); - opts.addOpt("", "depend"); - opts.addOpt("", "depend-xml"); - opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, ""); - opts.addOpt("d", "debug"); - opts.addOpt("", "ice"); - opts.addOpt("", "underscore"); - - bool validate = false; - for(int i = 0; i < argc; ++i) - { - if(string(argv[i]) == "--validate") - { - validate = true; - break; - } - } - - vector args; - try - { - args = opts.parse(argc, const_cast(argv)); - } - catch(const IceUtilInternal::BadOptException& e) - { - getErrorStream() << argv[0] << ": error: " << e.reason << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(opts.isSet("help")) - { - usage(argv[0]); - return EXIT_SUCCESS; - } - - if(opts.isSet("version")) - { - getErrorStream() << ICE_STRING_VERSION << endl; - return EXIT_SUCCESS; - } - - string headerExtension = opts.optArg("header-ext"); - string sourceExtension = opts.optArg("source-ext"); - - vector cppArgs; - vector extraHeaders = opts.argVec("add-header"); - vector optargs = opts.argVec("D"); - - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - cppArgs.push_back("-D" + *i); - } - - optargs = opts.argVec("U"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - cppArgs.push_back("-U" + *i); - } - - vector includePaths = opts.argVec("I"); - for(vector::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i) - { - cppArgs.push_back("-I" + Preprocessor::normalizeIncludePath(*i)); - } - - // Convert include paths to full paths. - for(vector::iterator p = includePaths.begin(); p != includePaths.end(); ++p) - { - *p = fullPath(*p); - } - - bool preprocess= opts.isSet("E"); - - string include = opts.optArg("include-dir"); - - string dllExport = opts.optArg("dll-export"); - - vector dicts; - optargs = opts.argVec("dict"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - string s = IceUtilInternal::removeWhitespace(*i); - - Dict dict; - - string::size_type pos; - pos = s.find(','); - if(pos != string::npos) - { - dict.name = s.substr(0, pos); - s.erase(0, pos + 1); - } - pos = s.find(','); - if(pos != string::npos) - { - if(s.find("[\"") == 0) - { - string::size_type end = s.find("\"]"); - if(end != string::npos && end < pos) - { - dict.key = s.substr(end + 2, pos - end - 2); - dict.keyMetaData.push_back(s.substr(2, end - 2)); - } - else - { - dict.key = s.substr(0, pos); - } - } - else - { - dict.key = s.substr(0, pos); - } - s.erase(0, pos + 1); - } - pos = s.find(','); - if(pos == string::npos) - { - if(s.find("[\"") == 0) - { - string::size_type end = s.find("\"]"); - if(end != string::npos) - { - dict.value = s.substr(end + 2); - dict.valueMetaData.push_back(s.substr(2, end - 2)); - } - else - { - dict.value = s; - } - } - else - { - dict.value = s; - } - dict.sort = false; - } - else - { - if(s.find("[\"") == 0) - { - string::size_type end = s.find("\"]"); - if(end != string::npos && end < pos) - { - dict.value = s.substr(end + 2, pos - end - 2); - dict.valueMetaData.push_back(s.substr(2, end - 2)); - } - else - { - dict.value = s.substr(0, pos); - } - } - else - { - dict.value = s.substr(0, pos); - } - s.erase(0, pos + 1); - - pos = s.find(','); - if(pos == string::npos) - { - if(s != "sort") - { - getErrorStream() << argv[0] << ": error: " << *i << ": nothing or ',sort' expected after value-type" - << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - dict.sort = true; - } - else - { - string sort = s.substr(0, pos); - s.erase(0, pos + 1); - if(sort != "sort") - { - getErrorStream() << argv[0] << ": error: " << *i << ": nothing or ',sort' expected after value-type" - << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - dict.sort = true; - dict.userCompare = s; - } - } - - if(dict.name.empty()) - { - getErrorStream() << argv[0] << ": error: " << *i << ": no name specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(dict.key.empty()) - { - getErrorStream() << argv[0] << ": error: " << *i << ": no key specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(dict.value.empty()) - { - getErrorStream() << argv[0] << ": error: " << *i << ": no value specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - dicts.push_back(dict); - } - - vector indices; - optargs = opts.argVec("index"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - string s = IceUtilInternal::removeWhitespace(*i); - - Index index; - - string::size_type pos; - pos = s.find(','); - if(pos != string::npos) - { - index.name = s.substr(0, pos); - s.erase(0, pos + 1); - } - pos = s.find(','); - if(pos != string::npos) - { - index.type = s.substr(0, pos); - s.erase(0, pos + 1); - } - pos = s.find(','); - string caseString; - if(pos != string::npos) - { - index.member = s.substr(0, pos); - s.erase(0, pos + 1); - caseString = s; - } - else - { - index.member = s; - caseString = "case-sensitive"; - } - - if(index.name.empty()) - { - getErrorStream() << argv[0] << ": error: " << *i << ": no name specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(index.type.empty()) - { - getErrorStream() << argv[0] << ": error: " << *i << ": no type specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(index.member.empty()) - { - getErrorStream() << argv[0] << ": error: " << *i << ": no member specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(caseString != "case-sensitive" && caseString != "case-insensitive") - { - getErrorStream() << argv[0] << ": error: " << *i << ": the case can be `case-sensitive' or " - << "`case-insensitive'" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - index.caseSensitive = (caseString == "case-sensitive"); - - indices.push_back(index); - } - - optargs = opts.argVec("dict-index"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - string s = IceUtilInternal::removeWhitespace(*i); - - string dictName; - DictIndex index; - index.sort = false; - index.caseSensitive = true; - - string::size_type pos = s.find(','); - if(pos == string::npos) - { - dictName = s; - } - else - { - dictName = s.substr(0, pos); - s.erase(0, pos + 1); - - bool done = false; - while(!done) - { - pos = s.find(','); - if(pos == string::npos) - { - if(s == "sort") - { - index.sort = true; - } - else if(s == "case-sensitive") - { - index.caseSensitive = true; - } - else if(s == "case-insensitive") - { - index.caseSensitive = false; - } - else if(index.member.empty()) - { - if(s == "\\sort") - { - index.member = "sort"; - } - else - { - index.member = s; - } - } - else - { - getErrorStream() << argv[0] << ": error: " << *i << ": syntax error" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - done = true; - } - else - { - string subs = s.substr(0, pos); - s.erase(0, pos + 1); - - if(subs == "sort") - { - index.sort = true; - index.userCompare = s; - done = true; - } - else if(subs == "case-sensitive") - { - index.caseSensitive = true; - } - else if(subs == "case-insensitive") - { - index.caseSensitive = false; - } - else if(index.member.empty()) - { - if(subs == "\\sort") - { - index.member = "sort"; - } - else - { - index.member = subs; - } - } - else - { - getErrorStream() << argv[0] << ": error: " << *i << ": syntax error" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - } - } - } - - if(dictName.empty()) - { - getErrorStream() << argv[0] << ": error: " << *i << ": no dictionary specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - bool found = false; - for(vector::iterator p = dicts.begin(); p != dicts.end(); ++p) - { - if(p->name == dictName) - { - if(find(p->indices.begin(), p->indices.end(), index) != p->indices.end()) - { - getErrorStream() << argv[0] << ": error: --dict-index " << *i - << ": this dict-index is defined twice" << endl; - return EXIT_FAILURE; - } - p->indices.push_back(index); - found = true; - break; - } - } - if(!found) - { - getErrorStream() << argv[0] << ": error: " << *i << ": unknown dictionary" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - } - - string output = opts.optArg("output-dir"); - - bool depend = opts.isSet("depend"); - bool dependxml = opts.isSet("depend-xml"); - - string dependFile = opts.optArg("depend-file"); - - bool debug = opts.isSet("debug"); - - bool ice = opts.isSet("ice"); - - bool underscore = opts.isSet("underscore"); - - if(dicts.empty() && indices.empty() && !(depend || dependxml)) - { - getErrorStream() << argv[0] << ": error: no Freeze types specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(args.empty()) - { - getErrorStream() << argv[0] << ": error: no file name base specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(depend && dependxml) - { - getErrorStream() << argv[0] << ": error: cannot specify both --depend and --depend-xml" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(validate) - { - return EXIT_SUCCESS; - } - - UnitPtr u = Unit::createUnit(true, false, ice, underscore); - - StringList includes; - - int status = EXIT_SUCCESS; - - IceUtil::CtrlCHandler ctrlCHandler; - ctrlCHandler.setCallback(interruptedCallback); - - DependOutputUtil out(dependFile); - if(dependxml) - { - out.os() << "\n" << endl; - } - - for(vector::size_type idx = 1; idx < args.size(); ++idx) - { - if(depend || dependxml) - { - PreprocessorPtr icecpp = Preprocessor::create(argv[0], args[idx], cppArgs); - FILE* cppHandle = icecpp->preprocess(false, "-D__SLICE2FREEZE__"); - - if(cppHandle == 0) - { - out.cleanup(); - u->destroy(); - return EXIT_FAILURE; - } - - status = u->parse(args[idx], cppHandle, debug); - - if(status == EXIT_FAILURE) - { - out.cleanup(); - u->destroy(); - return EXIT_FAILURE; - } - - if(!icecpp->printMakefileDependencies(out.os(), depend ? Preprocessor::CPlusPlus : Preprocessor::SliceXML, includePaths, - "-D__SLICE2FREEZE__", sourceExtension, headerExtension)) - { - out.cleanup(); - u->destroy(); - return EXIT_FAILURE; - } - - if(!icecpp->close()) - { - out.cleanup(); - u->destroy(); - return EXIT_FAILURE; - } - } - else - { - PreprocessorPtr icecpp = Preprocessor::create(argv[0], args[idx], cppArgs); - - // - // Add an include file for each Slice file. Note that the .h extension - // is replaced with headerExtension later. - // - includes.push_back(icecpp->getBaseName() + ".h"); - - FILE* cppHandle = icecpp->preprocess(false, "-D__SLICE2FREEZE__"); - - if(cppHandle == 0) - { - u->destroy(); - return EXIT_FAILURE; - } - - if(preprocess) - { - char buf[4096]; - while(fgets(buf, static_cast(sizeof(buf)), cppHandle) != NULL) - { - if(fputs(buf, stdout) == EOF) - { - u->destroy(); - return EXIT_FAILURE; - } - } - } - else - { - status = u->parse(args[idx], cppHandle, debug); - - MetaDataVisitor visitor; - u->visit(&visitor, false); - } - - if(!icecpp->close()) - { - u->destroy(); - return EXIT_FAILURE; - } - } - - { - IceUtilInternal::MutexPtrLock sync(globalMutex); - - if(interrupted) - { - return EXIT_FAILURE; - } - } - } - - if(dependxml) - { - out.os() << "\n"; - } - - if(depend || dependxml) - { - u->destroy(); - return EXIT_SUCCESS; - } - - if(status == EXIT_SUCCESS && !preprocess) - { - try - { - gen(argv[0], u, includePaths, extraHeaders, dicts, indices, include, headerExtension, - sourceExtension, dllExport, includes, args, output); - } - catch(const string& ex) - { - // If a file could not be created, then cleanup any - // created files. - FileTracker::instance()->cleanup(); - u->destroy(); - getErrorStream() << argv[0] << ": error: " << ex << endl; - return EXIT_FAILURE; - } - catch(const Slice::FileException& ex) - { - // If a file could not be created, then cleanup any - // created files. - FileTracker::instance()->cleanup(); - u->destroy(); - getErrorStream() << argv[0] << ": error: " << ex.reason() << endl; - return EXIT_FAILURE; - } - catch(...) - { - getErrorStream() << argv[0] << ": error: unknown exception" << endl; - FileTracker::instance()->cleanup(); - u->destroy(); - return EXIT_FAILURE; - } - } - - u->destroy(); - - { - IceUtilInternal::MutexPtrLock sync(globalMutex); - - if(interrupted) - { - FileTracker::instance()->cleanup(); - return EXIT_FAILURE; - } - } - - return status; -} - -int -main(int argc, char* argv[]) -{ - try - { - return compile(argc, argv); - } - catch(const std::exception& ex) - { - getErrorStream() << argv[0] << ": error:" << ex.what() << endl; - return EXIT_FAILURE; - } - catch(const std::string& msg) - { - getErrorStream() << argv[0] << ": error:" << msg << endl; - return EXIT_FAILURE; - } - catch(const char* msg) - { - getErrorStream() << argv[0] << ": error:" << msg << endl; - return EXIT_FAILURE; - } - catch(...) - { - getErrorStream() << argv[0] << ": error:" << "unknown exception" << endl; - return EXIT_FAILURE; - } -} diff --git a/cpp/src/slice2freeze/Makefile b/cpp/src/slice2freeze/Makefile deleted file mode 100644 index 1b63be66a7e..00000000000 --- a/cpp/src/slice2freeze/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -# -# This copy of Ice is licensed to you under the terms described in the -# ICE_LICENSE file included in this distribution. -# -# ********************************************************************** - -top_srcdir = ../.. - -NAME = $(bindir)/slice2freeze - -TARGETS = $(NAME) - -OBJS = Main.o - -RPATH_DIR = $(LOADER_PATH)/../$(libsubdir) - -include $(top_srcdir)/config/Make.rules - -CPPFLAGS := -I. $(CPPFLAGS) - -$(NAME): $(OBJS) - rm -f $@ - $(CXX) $(LDFLAGS) $(LDEXEFLAGS) -o $@ $(OBJS) $(SLICE_LIBS) $(MCPP_RPATH_LINK) - -install:: all - $(call installprogram,$(NAME),$(DESTDIR)$(install_bindir)) - $(call installdata,$(top_srcdir)/../man/man1/slice2freeze.1,$(DESTDIR)$(install_mandir)) diff --git a/cpp/src/slice2freeze/Makefile.mak b/cpp/src/slice2freeze/Makefile.mak deleted file mode 100644 index 8924b22e7e4..00000000000 --- a/cpp/src/slice2freeze/Makefile.mak +++ /dev/null @@ -1,49 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -# -# This copy of Ice is licensed to you under the terms described in the -# ICE_LICENSE file included in this distribution. -# -# ********************************************************************** - -top_srcdir = ..\.. - -NAME = $(top_srcdir)\bin\slice2freeze.exe - -TARGETS = $(NAME) - -OBJS = .\Main.obj - -!include $(top_srcdir)/config/Make.rules.mak - -CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN - -!if "$(GENERATE_PDB)" == "yes" -PDBFLAGS = /pdb:$(NAME:.exe=.pdb) -!endif - -RES_FILE = Slice2Freeze.res - -$(NAME): $(OBJS) Slice2Freeze.res - $(LINK) $(LD_EXEFLAGS) $(PDBFLAGS) $(OBJS) $(SETARGV) $(PREOUT)$@ $(PRELIBS) \ - $(BASELIBS) $(RES_FILE) - @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ - $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest - @if defined SIGN_CERTIFICATE echo ^ ^ ^ Signing $@ && \ - signtool sign /f "$(SIGN_CERTIFICATE)" /p $(SIGN_PASSWORD) /t $(SIGN_TIMESTAMPSERVER) $@ - -clean:: - del /q $(NAME:.exe=.*) - del /q Slice2Freeze.res - -install:: all - copy $(NAME) "$(install_bindir)" - - -!if "$(GENERATE_PDB)" == "yes" - -install:: all - copy $(NAME:.exe=.pdb) "$(install_bindir)" - -!endif diff --git a/cpp/src/slice2freeze/Slice2Freeze.rc b/cpp/src/slice2freeze/Slice2Freeze.rc deleted file mode 100644 index 6a217c4887b..00000000000 --- a/cpp/src/slice2freeze/Slice2Freeze.rc +++ /dev/null @@ -1,34 +0,0 @@ -#include "winver.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,7,0,0 - PRODUCTVERSION 3,7,0,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE VFT_APP - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "ZeroC, Inc.\0" - VALUE "FileDescription", "Slice to Freeze for C++ Translator\0" - VALUE "FileVersion", "3.7.0\0" - VALUE "InternalName", "slice2freeze\0" - VALUE "LegalCopyright", "\251 2003-2015 ZeroC, Inc.\0" - VALUE "OriginalFilename", "slice2freeze.exe\0" - VALUE "ProductName", "Ice\0" - VALUE "ProductVersion", "3.7.0\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END diff --git a/cpp/src/slice2freezej/.depend.mak b/cpp/src/slice2freezej/.depend.mak deleted file mode 100755 index 0092c15b6fe..00000000000 --- a/cpp/src/slice2freezej/.depend.mak +++ /dev/null @@ -1,24 +0,0 @@ - -Main.obj: \ - Main.cpp \ - "$(includedir)\IceUtil\Options.h" \ - "$(includedir)\IceUtil\Config.h" \ - "$(includedir)\IceUtil\RecMutex.h" \ - "$(includedir)\IceUtil\Lock.h" \ - "$(includedir)\IceUtil\ThreadException.h" \ - "$(includedir)\IceUtil\Exception.h" \ - "$(includedir)\IceUtil\Time.h" \ - "$(includedir)\IceUtil\MutexProtocol.h" \ - "$(includedir)\IceUtil\Shared.h" \ - "$(includedir)\IceUtil\Atomic.h" \ - "$(includedir)\IceUtil\Handle.h" \ - "$(includedir)\IceUtil\StringUtil.h" \ - "$(includedir)\IceUtil\CtrlCHandler.h" \ - "$(includedir)\IceUtil\Mutex.h" \ - "$(includedir)\IceUtil\MutexPtrLock.h" \ - "$(includedir)\Slice\Preprocessor.h" \ - "$(includedir)\Slice\FileTracker.h" \ - "$(includedir)\Slice\Parser.h" \ - "$(includedir)\Slice\JavaUtil.h" \ - "$(includedir)\IceUtil\OutputUtil.h" \ - "$(includedir)\Slice\Util.h" \ diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp deleted file mode 100644 index bcfcccbb095..00000000000 --- a/cpp/src/slice2freezej/Main.cpp +++ /dev/null @@ -1,2039 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace Slice; -using namespace IceUtil; -using namespace IceUtilInternal; - -namespace -{ - -IceUtil::Mutex* globalMutex = 0; -bool interrupted = false; - -class Init -{ -public: - - Init() - { - globalMutex = new IceUtil::Mutex; - } - - ~Init() - { - delete globalMutex; - globalMutex = 0; - } -}; - -Init init; - -} - -void -interruptedCallback(int /*signal*/) -{ - IceUtilInternal::MutexPtrLock lock(globalMutex); - - interrupted = true; -} - -struct DictIndex -{ - string member; - bool caseSensitive; - - bool operator==(const DictIndex& rhs) const - { - return member == rhs.member; - } - - bool operator!=(const DictIndex& rhs) const - { - return member != rhs.member; - } -}; - -struct Dict -{ - string name; - string key; - string value; - - vector indices; -}; - -struct Index -{ - string name; - string type; - string member; - bool caseSensitive; -}; - -class FreezeGenerator : public JavaGenerator -{ -public: - FreezeGenerator(const string&, const string&); - virtual ~FreezeGenerator(); - - void generate(UnitPtr&, const Dict&); - - void generate(UnitPtr&, const Index&); - -#ifdef __SUNPRO_CC -protected: - using JavaGenerator::typeToObjectString; -#endif - -private: - - string typeToObjectString(const TypePtr&); - string varToObject(const TypePtr&, const string&); - string objectToVar(const TypePtr&, const string&); - - const string _prog; -}; - -FreezeGenerator::FreezeGenerator(const string& prog, const string& dir) - : JavaGenerator(dir), - _prog(prog) -{ -} - -FreezeGenerator::~FreezeGenerator() -{ -} - -string -FreezeGenerator::typeToObjectString(const TypePtr& type) -{ - static const char* builtinTable[] = - { - "java.lang.Byte", - "java.lang.Boolean", - "java.lang.Short", - "java.lang.Integer", - "java.lang.Long", - "java.lang.Float", - "java.lang.Double", - "java.lang.String", - "Ice.Object", - "Ice.ObjectPrx", - "Ice.LocalObject" - }; - - BuiltinPtr b = BuiltinPtr::dynamicCast(type); - if(b) - { - return builtinTable[b->kind()]; - } - else - { - return typeToString(type, TypeModeIn); - } -} - -string -FreezeGenerator::varToObject(const TypePtr& type, const string& param) -{ - string result = param; - - BuiltinPtr b = BuiltinPtr::dynamicCast(type); - if(b != 0) - { - switch(b->kind()) - { - case Builtin::KindByte: - { - result = string("java.lang.Byte.valueOf(") + param + ")"; - break; - } - case Builtin::KindBool: - { - result = string("java.lang.Boolean.valueOf(") + param + ")"; - break; - } - case Builtin::KindShort: - { - result = string("java.lang.Short.valueOf(") + param + ")"; - break; - } - case Builtin::KindInt: - { - result = string("java.lang.Integer.valueOf(") + param + ")"; - break; - } - case Builtin::KindLong: - { - result = string("java.lang.Long.valueOf(") + param + ")"; - break; - } - case Builtin::KindFloat: - { - result = string("java.lang.Float.valueOf(") + param + ")"; - break; - } - case Builtin::KindDouble: - { - result = string("java.lang.Double.valueOf(") + param + ")"; - break; - } - case Builtin::KindString: - case Builtin::KindObject: - case Builtin::KindObjectProxy: - case Builtin::KindLocalObject: - break; - } - } - return result; -} - -string -FreezeGenerator::objectToVar(const TypePtr& type, const string& param) -{ - string result = param; - - BuiltinPtr b = BuiltinPtr::dynamicCast(type); - if(b != 0) - { - switch(b->kind()) - { - case Builtin::KindByte: - { - result = param + ".byteValue()"; - break; - } - case Builtin::KindBool: - { - result = param + ".booleanValue()"; - break; - } - case Builtin::KindShort: - { - result = param + ".shortValue()"; - break; - } - case Builtin::KindInt: - { - result = param + ".intValue()"; - break; - } - case Builtin::KindLong: - { - result = param + ".longValue()"; - break; - } - case Builtin::KindFloat: - { - result = param + ".floatValue()"; - break; - } - case Builtin::KindDouble: - { - result = param + ".doubleValue()"; - break; - } - case Builtin::KindString: - case Builtin::KindObject: - case Builtin::KindObjectProxy: - case Builtin::KindLocalObject: - break; - } - } - return result; -} - -void -FreezeGenerator::generate(UnitPtr& u, const Dict& dict) -{ - // - // The dictionary name may include a package. - // - string name; - string::size_type pos = dict.name.rfind('.'); - if(pos == string::npos) - { - name = dict.name; - } - else - { - name = dict.name.substr(pos + 1); - } - - TypeList keyTypes = u->lookupType(dict.key, false); - if(keyTypes.empty()) - { - ostringstream os; - os << "`" << dict.key << "' is not a valid type" << endl; - throw os.str(); - } - TypePtr keyType = keyTypes.front(); - - TypeList valueTypes = u->lookupType(dict.value, false); - if(valueTypes.empty()) - { - ostringstream os; - os << "`" << dict.value << "' is not a valid type" << endl; - throw os.str(); - } - TypePtr valueType = valueTypes.front(); - - vector indexTypes; - vector members; - vector capitalizedMembers; - vector indexNames; - - for(size_t i = 0; i < dict.indices.size(); ++i) - { - const DictIndex& index = dict.indices[i]; - const string& member = index.member; - - if(index.member.empty()) - { - // - // No member was specified, which means we use the map's value type as the index key. - // - - if(dict.indices.size() > 1) - { - ostringstream os; - os << "bad index for dictionary `" << dict.name << "'" << endl; - throw os.str(); - } - - bool containsSequence = false; - if(!Dictionary::legalKeyType(valueType, containsSequence)) - { - ostringstream os; - os << "`" << dict.value << "' is not a valid index type" << endl; - throw os.str(); - } - if(containsSequence) - { - getErrorStream() << _prog << ": warning: use of sequences in dictionary keys has been deprecated" - << endl; - } - - if(index.caseSensitive == false) - { - // - // Verify that value type is a string. - // - BuiltinPtr b = BuiltinPtr::dynamicCast(valueType); - if(b == 0 || b->kind() != Builtin::KindString) - { - ostringstream os; - os << "VALUE is a `" << dict.value << "', not a string" << endl; - throw os.str(); - } - } - indexTypes.push_back(valueType); - members.push_back("value"); - capitalizedMembers.push_back("Value"); - indexNames.push_back("index"); - } - else - { - DataMemberPtr dataMember = 0; - DataMemberList dataMembers; - - ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(valueType); - if(classDecl != 0) - { - dataMembers = classDecl->definition()->allDataMembers(); - } - else - { - StructPtr structDecl = StructPtr::dynamicCast(valueType); - if(structDecl == 0) - { - ostringstream os; - os << "`" << dict.value << "' is neither a class nor a struct" << endl; - throw os.str(); - } - dataMembers = structDecl->dataMembers(); - } - - DataMemberList::const_iterator q = dataMembers.begin(); - while(q != dataMembers.end() && dataMember == 0) - { - if((*q)->name() == index.member) - { - dataMember = *q; - } - else - { - ++q; - } - } - - if(dataMember == 0) - { - ostringstream os; - os << "The value of `" << dict.name << "' has no data member named `" << index.member << "'" << endl; - throw os.str(); - } - - TypePtr dataMemberType = dataMember->type(); - - bool containsSequence = false; - if(!Dictionary::legalKeyType(dataMemberType, containsSequence)) - { - ostringstream os; - os << "`" << index.member << "' cannot be used as an index key" << endl; - throw os.str(); - } - if(containsSequence) - { - getErrorStream() << _prog << ": warning: use of sequences in dictionary keys has been deprecated" - << endl; - } - - if(index.caseSensitive == false) - { - // - // Verify that member type is a string. - // - BuiltinPtr b = BuiltinPtr::dynamicCast(dataMemberType); - if(b == 0 || b->kind() != Builtin::KindString) - { - ostringstream os; - os << "`" << index.member << "' is not a string" << endl; - throw os.str(); - } - } - indexTypes.push_back(dataMemberType); - - members.push_back(member); - string capitalizedMember = member; - capitalizedMember[0] = toupper(static_cast(capitalizedMember[0])); - capitalizedMembers.push_back(capitalizedMember); - indexNames.push_back(member); - } - } - - open(dict.name, u->currentFile()); - - Output& out = output(); - - string keyTypeS = typeToObjectString(keyType); - string valueTypeS = typeToObjectString(valueType); - - out << sp << nl << "public class " << name << " extends Freeze.MapInternal.MapI<" << keyTypeS << ", " - << valueTypeS << ">"; - out << sb; - - if(dict.indices.size() > 0) - { - out << sp; - out << nl << "/**" - << nl << " * Supplies a comparator for each index key." - << nl << " */"; - out << nl << "public static class IndexComparators"; - out << sb; - out << sp; - out << nl << "/**" - << nl << " * Default constructor assigns null to the comparator for each index key." - << nl << " */"; - out << nl << "public" << nl << "IndexComparators()"; - out << sb; - out << eb; - - out << sp; - out << nl << "/**" - << nl << " * This constructor accepts a comparator for each index key."; - for(size_t i = 0; i < dict.indices.size(); ++i) - { - out << nl << " * @param " << members[i] << "Comparator Comparator for " << members[i] << "."; - } - out << nl << " */"; - out << nl << "public" << nl << "IndexComparators("; - for(size_t i = 0; i < dict.indices.size(); ++i) - { - if(i > 0) - { - out << ", "; - } - out << "java.util.Comparator<" << typeToObjectString(indexTypes[i]) << "> " << members[i] - << "Comparator"; - } - out << ")"; - out << sb; - for(size_t i = 0; i < dict.indices.size(); ++i) - { - out << nl << "this." << members[i] << "Comparator = " << members[i] << "Comparator;"; - } - out << eb; - - out << sp; - for(size_t i = 0; i < dict.indices.size(); ++i) - { - out << nl << "/** Comparator for " << members[i] << ". */"; - out << nl << "public java.util.Comparator<" << typeToObjectString(indexTypes[i]) << "> " << members[i] - << "Comparator;"; - } - out << eb; - } - - // - // Constructors - // - - out << sp << nl << "private" << nl << name - << "(Freeze.Connection __connection, String __dbName, java.util.Comparator<" << keyTypeS << "> __comparator"; - if(dict.indices.size() > 0) - { - out << ", IndexComparators __indexComparators"; - } - out << ")"; - out << sb; - - out << nl << "super(__connection, __dbName, __comparator);"; - if(dict.indices.size() > 0) - { - out << nl << "_indices = new Freeze.MapIndex[" << dict.indices.size() << "];"; - for(size_t i = 0; i < dict.indices.size(); ++i) - { - out << nl << "_" << members[i] << "Index = new " << capitalizedMembers[i] << "Index(\"" << indexNames[i] - << "\", __indexComparators == null ? null : __indexComparators." << members[i] << "Comparator);"; - out << nl << "_indices[" << i << "] = _" << members[i] << "Index;"; - } - } - out << eb; - - if(dict.indices.size() > 0) - { - out << sp; - out << nl << "/**" - << nl << " * Instantiates a Freeze map using the given connection. If the database" - << nl << " * named in __dbName does not exist and __createDb" - << nl << " * is true, the database is created automatically, otherwise this constructor" - << nl << " * raises DatabaseException." - << nl << " * @param __connection The Freeze connection associated with this map." - << nl << " * @param __dbName The name of the Berkeley DB database." - << nl << " * @param __createDb True if the database should be created if it does not" - << nl << " * already exist, false otherwise." - << nl << " * @param __comparator A comparator for the map's main key, or null to use the" - << nl << " * default key comparison strategy." - << nl << " * @param __indexComparators A map of string to comparator, representing the" - << nl << " * key comparator for each of the map's indices. The map uses the default" - << nl << " * key comparison strategy for an index if __indexComparators" - << nl << " * is null, or if no entry can be found in the comparators map for an index." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */" - << nl << "public" << nl << name - << "(Freeze.Connection __connection, String __dbName, boolean __createDb, " - << "java.util.Comparator<" << keyTypeS << "> __comparator, " - << "IndexComparators __indexComparators)"; - out << sb; - out << nl << "this(__connection, __dbName, __comparator, __indexComparators);"; - out << nl << "init(_indices, __dbName, \"" << keyType->typeId() << "\", \"" << valueType->typeId() - << "\", __createDb);"; - out << eb; - } - - out << sp; - out << nl << "/**" - << nl << " * Instantiates a Freeze map using the given connection. If the database" - << nl << " * named in __dbName does not exist and __createDb" - << nl << " * is true, the database is created automatically, otherwise this constructor" - << nl << " * raises DatabaseException." - << nl << " * @param __connection The Freeze connection associated with this map." - << nl << " * @param __dbName The name of the Berkeley DB database." - << nl << " * @param __createDb True if the database should be created if it does not" - << nl << " * already exist, false otherwise." - << nl << " * @param __comparator A comparator for the map's main key, or null to use the" - << nl << " * default key comparison strategy." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - out << nl << "public" << nl << name - << "(Freeze.Connection __connection, String __dbName, boolean __createDb, " - << "java.util.Comparator<" << keyTypeS << "> __comparator)"; - out << sb; - if(dict.indices.size() > 0) - { - out << nl << "this(__connection, __dbName, __createDb, __comparator, null);"; - } - else - { - out << nl << "super(__connection, __dbName, \"" << keyType->typeId() << "\", \"" - << valueType->typeId() << "\", __createDb, __comparator);"; - } - out << eb; - - out << sp; - out << nl << "/**" - << nl << " * Instantiates a Freeze map using the given connection. If the database" - << nl << " * named in __dbName does not exist and __createDb" - << nl << " * is true, the database is created automatically, otherwise this constructor" - << nl << " * raises DatabaseException. The map uses the default key" - << nl << " * comparison strategy." - << nl << " * @param __connection The Freeze connection associated with this map." - << nl << " * @param __dbName The name of the Berkeley DB database." - << nl << " * @param __createDb True if the database should be created if it does not" - << nl << " * already exist, false otherwise." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - out << nl << "public" << nl << name - << "(Freeze.Connection __connection, String __dbName, boolean __createDb)"; - out << sb; - out << nl << "this(__connection, __dbName, __createDb, null);"; - out << eb; - - out << sp; - out << nl << "/**" - << nl << " * Instantiates a Freeze map using the given connection. If the database" - << nl << " * named in __dbName does not exist, it is created automatically." - << nl << " * The map uses the default key comparison strategy." - << nl << " * @param __connection The Freeze connection associated with this map." - << nl << " * @param __dbName The name of the Berkeley DB database." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - out << nl << "public" << nl << name << "(Freeze.Connection __connection, String __dbName)"; - out << sb; - out << nl << "this(__connection, __dbName, true);"; - out << eb; - - // - // recreate - // - if(dict.indices.size() > 0) - { - out << sp; - out << nl << "/**" - << nl << " * Copies an existing database. The new database has the name given in" - << nl << " * __dbName, and the old database is renamed with a UUID" - << nl << " * suffix." - << nl << " * @param __connection The Freeze connection associated with this map." - << nl << " * @param __dbName The name of the Berkeley DB database." - << nl << " * @param __comparator A comparator for the map's main key, or null to use the" - << nl << " * default key comparison strategy." - << nl << " * @param __indexComparators A map of string to comparator, representing the" - << nl << " * key comparator for each of the map's indices. The map uses the default" - << nl << " * key comparison strategy for an index if __indexComparators" - << nl << " * is null, or if no entry can be found in the comparators map for an index." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - out << nl << "public static void" << nl - << "recreate(Freeze.Connection __connection, String __dbName, " - << "java.util.Comparator<" << keyTypeS << "> __comparator, " - << "IndexComparators __indexComparators)"; - out << sb; - out << nl << name << " __tmpMap = new " << name - << "(__connection, __dbName, __comparator, __indexComparators);"; - out << nl << "recreate(__tmpMap, __dbName, \"" << keyType->typeId() << "\", \"" - << valueType->typeId() << "\", __tmpMap._indices);"; - out << eb; - } - - out << sp; - out << nl << "/**" - << nl << " * Copies an existing database. The new database has the name given in" - << nl << " * __dbName, and the old database is renamed with a UUID" - << nl << " * suffix." - << nl << " * @param __connection The Freeze connection associated with this map." - << nl << " * @param __dbName The name of the Berkeley DB database." - << nl << " * @param __comparator A comparator for the map's main key, or null to use the" - << nl << " * default key comparison strategy." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - out << nl << "public static void" << nl - << "recreate(Freeze.Connection __connection, String __dbName, " - << "java.util.Comparator<" << keyTypeS << "> __comparator)"; - out << sb; - if(dict.indices.size() > 0) - { - out << nl << "recreate(__connection, __dbName, __comparator, null);"; - } - else - { - out << nl << name << " __tmpMap = new " << name << "(__connection, __dbName, __comparator);"; - out << nl << "recreate(__tmpMap, __dbName, \"" << keyType->typeId() << "\", \"" - << valueType->typeId() << "\", null);"; - } - out << eb; - - // - // Index methods - // - for(size_t i = 0; i < capitalizedMembers.size(); ++i) - { - string indexClassName = capitalizedMembers[i] + "Index"; - string indexTypeS = typeToString(indexTypes[i], TypeModeIn); - string indexObjTypeS = typeToObjectString(indexTypes[i]); - string indexObj = varToObject(indexTypes[i], "__key"); - - out << sp; - out << nl << "/**" - << nl << " * Obtains an iterator ordered using the index value." - << nl << " * The iterator's initial position is an element whose key matches __key; if" - << nl << " * no such element exists, the returned iterator is empty (hasNext returns" - << nl << " * false). If __onlyDups is true, the iterator only returns elements whose" - << nl << " * key exactly matches __key; otherwise, the iterator continues to iterate over" - << nl << " * the remaining elements in the map." - << nl << " * @param __key The value at which the iterator begins." - << nl << " * @param __onlyDups True if the iterator should be limited to elements whose key" - << nl << " * exactly matches __key, false otherwise." - << nl << " * @return A new iterator." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - out << nl << "public Freeze.Map.EntryIterator>"; - out << nl << "findBy" << capitalizedMembers[i] << "(" << indexTypeS << " __key, boolean __onlyDups)"; - out << sb; - out << nl << "return _" << members[i] << "Index.find(" << indexObj << ", __onlyDups);"; - out << eb; - - out << sp; - out << nl << "/**" - << nl << " * Obtains an iterator ordered using the values of member " << members[i] << "." - << nl << " * The iterator's initial position is an element whose key matches __key; if" - << nl << " * no such element exists, the returned iterator is empty (hasNext returns" - << nl << " * false). This iterator only returns elements whose key exactly matches __key." - << nl << " * @param __key The value at which the iterator begins." - << nl << " * @return A new iterator." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - out << nl << "public Freeze.Map.EntryIterator>"; - out << nl << "findBy" << capitalizedMembers[i] << "(" << indexTypeS << " __key)"; - out << sb; - out << nl << "return _" << members[i] << "Index.find(" << indexObj << ", true);"; - out << eb; - - out << sp; - out << nl << "/**" - << nl << " * Determines the number of elements whose index values match __key." - << nl << " * @return The number of matching elements." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - string countMethod = dict.indices[i].member.empty() ? string("valueCount") : dict.indices[i].member + "Count"; - out << nl << "public int"; - out << nl << countMethod << "(" << indexTypeS << " __key)"; - out << sb; - out << nl << "return _" << members[i] << "Index.count(" << indexObj << ");"; - out << eb; - - string subMap = "Freeze.NavigableMap<" + indexObjTypeS + ", java.util.Set>>"; - - out << sp; - out << nl << "/**" - << nl << " * Returns a view of the portion of this map whose keys are strictly less than" - << nl << " * __toKey, or less than or equal to __toKey if" - << nl << " * __inclusive is true. Insertions and removals via this map are" - << nl << " * not supported." - << nl << " * @param __toKey High endpoint of the keys in the returned map." - << nl << " * @param __inclusive If true, the endpoint is included in the returned map;" - << nl << " * otherwise, the endpoint is excluded." - << nl << " * @return A view of the portion of this map whose keys are strictly less than" - << nl << " * __toKey, or less than or equal to __toKey if" - << nl << " * __inclusive is true." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - out << nl << "public " + subMap; - out << nl << "headMapFor" << capitalizedMembers[i] << "(" << indexTypeS << " __toKey, boolean __inclusive)"; - out << sb; - out << nl << "return _" << members[i] << "Index.createHeadMap(" << varToObject(indexTypes[i], "__toKey") - << ", __inclusive);"; - out << eb; - - out << sp; - out << nl << "/**" - << nl << " * Returns a view of the portion of this map whose keys are strictly less than" - << nl << " * __toKey. Insertions and removals via this map are not supported." - << nl << " * @param __toKey High endpoint of the keys in the returned map." - << nl << " * @return A view of the portion of this map whose keys are strictly less than" - << nl << " * __toKey>" - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - out << nl << "public " + subMap; - out << nl << "headMapFor" << capitalizedMembers[i] << "(" << indexTypeS << " __toKey)"; - out << sb; - out << nl << "return headMapFor" << capitalizedMembers[i] << "(__toKey, false);"; - out << eb; - - out << sp; - out << nl << "/**" - << nl << " * Returns a view of the portion of this map whose keys are strictly greater than" - << nl << " * __fromKey, or greater than or equal to __fromKey if" - << nl << " * __inclusive is true. Insertions and removals via this map are" - << nl << " * not supported." - << nl << " * @param __fromKey Low endpoint of the keys in the returned map." - << nl << " * @param __inclusive If true, the endpoint is included in the returned map;" - << nl << " * otherwise, the endpoint is excluded." - << nl << " * @return A view of the portion of this map whose keys are strictly greater than" - << nl << " * __fromKey, or greater than or equal to __fromKey if" - << nl << " * __inclusive is true." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - out << nl << "public " + subMap; - out << nl << "tailMapFor" << capitalizedMembers[i] << "(" << indexTypeS << " __fromKey, boolean __inclusive)"; - out << sb; - out << nl << "return _" << members[i] << "Index.createTailMap(" << varToObject(indexTypes[i], "__fromKey") - << ", __inclusive);"; - out << eb; - - out << sp; - out << nl << "/**" - << nl << " * Returns a view of the portion of this map whose keys are greater than or equal" - << nl << " * to __fromKey. Insertions and removals via this map are not supported." - << nl << " * @param __fromKey Low endpoint of the keys in the returned map." - << nl << " * @return A view of the portion of this map whose keys are greater than or equal" - << nl << " * to __fromKey." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - out << nl << "public " + subMap; - out << nl << "tailMapFor" << capitalizedMembers[i] << "(" << indexTypeS << " __fromKey)"; - out << sb; - out << nl << "return tailMapFor" << capitalizedMembers[i] << "(__fromKey, true);"; - out << eb; - - out << sp; - out << nl << "/**" - << nl << " * Returns a view of the portion of this map whose keys range from" - << nl << " * __fromKey to __toKey. If __fromKey" - << nl << " * and __toKey are equal, the returned map is empty unless" - << nl << " * __fromInclusive and __toInclusive are both true." - << nl << " * Insertions and removals via this map are not supported." - << nl << " * @param __fromKey Low endpoint of the keys in the returned map." - << nl << " * @param __fromInclusive If true, the low endpoint is included in the returned map;" - << nl << " * otherwise, the endpoint is excluded." - << nl << " * @param __toKey High endpoint of the keys in the returned map." - << nl << " * @param __toInclusive If true, the high endpoint is included in the returned map;" - << nl << " * otherwise, the endpoint is excluded." - << nl << " * @return A view of the portion of this map whose keys range from" - << nl << " * __fromKey to __toKey." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - out << nl << "public " + subMap; - out << nl << "subMapFor" << capitalizedMembers[i] << "(" << indexTypeS - << " __fromKey, boolean __fromInclusive, " << indexTypeS << " __toKey, boolean __toInclusive)"; - out << sb; - out << nl << "return _" << members[i] << "Index.createSubMap(" << varToObject(indexTypes[i], "__fromKey") - << ", __fromInclusive, " << varToObject(indexTypes[i], "__toKey") << ", __toInclusive);"; - out << eb; - - out << sp; - out << nl << "/**" - << nl << " * Returns a view of the portion of this map whose keys are greater than" - << nl << " * or equal to __fromKey and strictly less than __toKey." - << nl << " * Insertions and removals via this map are not supported." - << nl << " * @param __fromKey Low endpoint of the keys in the returned map." - << nl << " * @param __toKey High endpoint of the keys in the returned map." - << nl << " * @return A view of the portion of this map whose keys range from" - << nl << " * __fromKey to __toKey." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - out << nl << "public " + subMap; - out << nl << "subMapFor" << capitalizedMembers[i] << "(" << indexTypeS << " __fromKey, " << indexTypeS - << " __toKey)"; - out << sb; - out << nl << "return subMapFor" << capitalizedMembers[i] << "(__fromKey, true, __toKey, false);"; - out << eb; - - out << sp; - out << nl << "/**" - << nl << " * Returns a view of this map whose keys are ordered by the index value." - << nl << " * Insertions and removals via this map are not supported." - << nl << " * @return A view of this map whose keys range are ordered by the index value." - << nl << " * @throws Freeze.DatabaseException If an error occurs during database operations." - << nl << " */"; - out << nl << "public " + subMap; - out << nl << "mapFor" << capitalizedMembers[i] << "()"; - out << sb; - out << nl << "return _" << members[i] << "Index.createMap();"; - out << eb; - } - - // - // Top-level encode/decode - // - for(size_t i = 0; i < 2; i++) - { - string keyValue; - TypePtr type; - bool encaps; - string typeS; - - if(i == 0) - { - keyValue = "Key"; - type = keyType; - typeS = keyTypeS; - encaps = false; // Do not encapsulate keys. - } - else - { - keyValue = "Value"; - type = valueType; - typeS = valueTypeS; - encaps = true; - } - - string valS = objectToVar(type, "v"); - - int iter; - - // - // encode - // - out << sp << nl << "public void" << nl << "encode" << keyValue << "(" << typeS - << " v, IceInternal.BasicStream __os)"; - out << sb; - if(encaps) - { - out << nl << "__os.startWriteEncaps();"; - } - iter = 0; - writeMarshalUnmarshalCode(out, "", type, OptionalNone, false, 0, valS, true, iter, false); - if(type->usesClasses()) - { - out << nl << "__os.writePendingObjects();"; - } - if(encaps) - { - out << nl << "__os.endWriteEncaps();"; - } - out << eb; - - // - // decode - // - out << sp << nl << "public " << typeS << nl << "decode" << keyValue << "(IceInternal.BasicStream __is)"; - out << sb; - if(type->usesClasses()) - { - out << nl << "__is.sliceObjects(false);"; - } - if(encaps) - { - out << nl << "__is.startReadEncaps();"; - } - iter = 0; - list metaData; - string patchParams; - BuiltinPtr b = BuiltinPtr::dynamicCast(type); - if((b && b->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(type)) - { - out << nl << "Patcher __p = new Patcher();"; - patchParams = "__p"; - } - else if(StructPtr::dynamicCast(type)) - { - out << nl << typeS << " __r = null;"; - } - else - { - out << nl << typeS << " __r;"; - } - if(b) - { - switch(b->kind()) - { - case Builtin::KindByte: - { - out << nl << "__r = java.lang.Byte.valueOf(__is.readByte());"; - break; - } - case Builtin::KindBool: - { - out << nl << "__r = java.lang.Boolean.valueOf(__is.readBool());"; - break; - } - case Builtin::KindShort: - { - out << nl << "__r = java.lang.Short.valueOf(__is.readShort());"; - break; - } - case Builtin::KindInt: - { - out << nl << "__r = java.lang.Integer.valueOf(__is.readInt());"; - break; - } - case Builtin::KindLong: - { - out << nl << "__r = java.lang.Long.valueOf(__is.readLong());"; - break; - } - case Builtin::KindFloat: - { - out << nl << "__r = java.lang.Float.valueOf(__is.readFloat());"; - break; - } - case Builtin::KindDouble: - { - out << nl << "__r = java.lang.Double.valueOf(__is.readDouble());"; - break; - } - case Builtin::KindString: - case Builtin::KindObject: - case Builtin::KindObjectProxy: - case Builtin::KindLocalObject: - { - writeMarshalUnmarshalCode(out, "", type, OptionalNone, false, 0, "__r", false, iter, false, metaData, - patchParams); - break; - } - } - } - else - { - writeMarshalUnmarshalCode(out, "", type, OptionalNone, false, 0, "__r", false, iter, false, metaData, - patchParams); - } - if(type->usesClasses()) - { - out << nl << "__is.readPendingObjects();"; - } - if(encaps) - { - out << nl << "__is.endReadEncaps();"; - } - if((b && b->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(type)) - { - out << nl << "return __p.value;"; - } - else - { - out << nl << "return __r;"; - } - out << eb; - } - - // - // Inner index classes - // - for(size_t i = 0; i < capitalizedMembers.size(); ++i) - { - string indexClassName = capitalizedMembers[i] + "Index"; - string indexKeyTypeS = typeToObjectString(indexTypes[i]); - - out << sp << nl << "private class " << indexClassName << " extends Freeze.MapInternal.Index<" << keyTypeS - << ", " << valueTypeS << ", " << indexKeyTypeS << ">"; - out << sb; - - // - // encodeKey - // - out << sp << nl << "public void"; - out << nl << "encodeKey(" << indexKeyTypeS << " key, IceInternal.BasicStream __os)"; - out << sb; - if(dict.indices[i].member.empty()) - { - // - // Encode the full value (with an encaps!) - // - string keyS = "key"; - if(!dict.indices[i].caseSensitive) - { - keyS = "key.toLowerCase()"; - } - - out << nl << "encodeValue(" << keyS << ", __os);"; - } - else - { - // - // No encaps - // - string keyS = dict.indices[i].caseSensitive ? "key" : "key.toLowerCase()"; - - keyS = objectToVar(indexTypes[i], keyS); - - int iter = 0; - writeMarshalUnmarshalCode(out, "", indexTypes[i], OptionalNone, false, 0, keyS, true, iter, false); - assert(!indexTypes[i]->usesClasses()); - } - out << eb; - - // - // decodeKey - // - out << sp << nl << "public " << indexKeyTypeS; - out << nl << "decodeKey(IceInternal.BasicStream __is)"; - out << sb; - if(dict.indices[i].member.empty()) - { - // - // Decode the full value (with an encaps!) - // - out << nl << "return decodeValue(__is);"; - } - else - { - int iter = 0; - list metaData; - string patchParams; - - if(StructPtr::dynamicCast(indexTypes[i])) - { - out << nl << indexKeyTypeS << " r = null;"; - } - else - { - out << nl << indexKeyTypeS << " r;"; - } - - BuiltinPtr b = BuiltinPtr::dynamicCast(indexTypes[i]); - if(b != 0) - { - switch(b->kind()) - { - case Builtin::KindByte: - { - out << nl << "r = java.lang.Byte.valueOf(__is.readByte());"; - break; - } - case Builtin::KindBool: - { - out << nl << "r = java.lang.Boolean.valueOf(__is.readBool());"; - break; - } - case Builtin::KindShort: - { - out << nl << "r = java.lang.Short.valueOf(__is.readShort());"; - break; - } - case Builtin::KindInt: - { - out << nl << "r = java.lang.Integer.valueOf(__is.readInt());"; - break; - } - case Builtin::KindLong: - { - out << nl << "r = java.lang.Long.valueOf(__is.readLong());"; - break; - } - case Builtin::KindFloat: - { - out << nl << "r = java.lang.Float.valueOf(__is.readFloat());"; - break; - } - case Builtin::KindDouble: - { - out << nl << "r = java.lang.Double.valueOf(__is.readDouble());"; - break; - } - case Builtin::KindString: - case Builtin::KindObject: - case Builtin::KindObjectProxy: - case Builtin::KindLocalObject: - { - writeMarshalUnmarshalCode(out, "", indexTypes[i], OptionalNone, false, 0, "r", false, iter, false, - metaData, patchParams); - break; - } - } - } - else - { - writeMarshalUnmarshalCode(out, "", indexTypes[i], OptionalNone, false, 0, "r", false, iter, false, - metaData, patchParams); - } - out << nl << "return r;"; - } - out << eb; - - // - // extractKey - // - out << sp << nl << "protected " << indexKeyTypeS; - out << nl << "extractKey(" << valueTypeS << " value)"; - out << sb; - if(dict.indices[i].member.empty()) - { - if(dict.indices[i].caseSensitive) - { - out << nl << "return value;"; - } - else - { - out << nl << "return value.toLowerCase();"; - } - } - else - { - string member = "value." + dict.indices[i].member; - if(!dict.indices[i].caseSensitive) - { - member += ".toLowerCase()"; - } - out << nl << "return " << varToObject(indexTypes[i], member) << ";"; - } - out << eb; - - // - // marshalKey optimization - // - if(dict.indices[i].member.empty() && dict.indices[i].caseSensitive) - { - out << sp << nl << "protected java.nio.ByteBuffer"; - out << nl << "marshalKey(java.nio.ByteBuffer value)"; - out << sb; - out << nl << "return value;"; - out << eb; - } - - // - // Constructor - // - out << sp << nl << "private" << nl << indexClassName << "(String name, java.util.Comparator<" << indexKeyTypeS - << "> comparator)"; - out << sb; - out << nl << "super(" << name << ".this, name, comparator);"; - out << eb; - out << eb; - } - - // - // Patcher class. - // - BuiltinPtr b = BuiltinPtr::dynamicCast(valueType); - if((b && b->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(valueType)) - { - string typeS = typeToString(valueType, TypeModeIn); - out << sp << nl << "private static class Patcher implements IceInternal.Patcher"; - out << sb; - out << sp << nl << "public void" << nl << "patch(Ice.Object v)"; - out << sb; - if(b) - { - out << nl << "value = v;"; - } - else - { - out << nl << "value = (" << typeS << ")v;"; - } - out << eb; - out << sp << nl << "public String" << nl << "type()"; - out << sb; - if(b) - { - out << nl << "return \"::Ice::Object\";"; - } - else - { - ClassDeclPtr decl = ClassDeclPtr::dynamicCast(valueType); - out << nl << "return \"" << decl->scoped() << "\";"; - } - out << eb; - out << sp << nl << typeS << " value;"; - out << eb; - } - - // - // Fields - // - if(!dict.indices.empty()) - { - out << sp << nl << "private Freeze.MapIndex[] _indices;"; - } - for(size_t i = 0; i < dict.indices.size(); ++i) - { - out << nl << "private " << capitalizedMembers[i] << "Index _" << members[i] << "Index;"; - } - - out << eb; - - close(); -} - -void -FreezeGenerator::generate(UnitPtr& u, const Index& index) -{ - string name; - string::size_type pos = index.name.rfind('.'); - if(pos == string::npos) - { - name = index.name; - } - else - { - name = index.name.substr(pos + 1); - } - - TypeList types = u->lookupType(index.type, false); - if(types.empty()) - { - ostringstream os; - os << "`" << index.type << "' is not a valid type" << endl; - throw os.str(); - } - TypePtr type = types.front(); - - ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(type); - if(classDecl == 0) - { - ostringstream os; - os << "`" << index.type << "' is not a class" << endl; - throw os.str(); - } - - DataMemberList dataMembers = classDecl->definition()->allDataMembers(); - DataMemberPtr dataMember = 0; - DataMemberList::const_iterator p = dataMembers.begin(); - while(p != dataMembers.end() && dataMember == 0) - { - if((*p)->name() == index.member) - { - dataMember = *p; - } - else - { - ++p; - } - } - - if(dataMember == 0) - { - ostringstream os; - os << "`" << index.type << "' has no data member named `" << index.member << "'" << endl; - throw os.str(); - } - - if(index.caseSensitive == false) - { - // - // Let's check member is a string - // - BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMember->type()); - if(memberType == 0 || memberType->kind() != Builtin::KindString) - { - ostringstream os; - os << "`" << index.member << "'is not a string " << endl; - throw os.str(); - } - } - - string memberTypeString = typeToString(dataMember->type(), TypeModeIn); - - open(index.name, u->currentFile()); - - Output& out = output(); - - out << sp << nl << "public class " << name << " extends Freeze.Index"; - out << sb; - - // - // Constructors - // - out << sp << nl << "public" << nl << name << "(String __indexName, String __facet)"; - out << sb; - out << nl << "super(__indexName, __facet);"; - out << eb; - - out << sp << nl << "public" << nl << name << "(String __indexName)"; - out << sb; - out << nl << "super(__indexName, \"\");"; - out << eb; - - // - // find and count - // - out << sp << nl << "public Ice.Identity[]" << nl - << "findFirst(" << memberTypeString << " __index, int __firstN)"; - out << sb; - out << nl << "return untypedFindFirst(marshalKey(__index), __firstN);"; - out << eb; - - out << sp << nl << "public Ice.Identity[]" << nl - << "find(" << memberTypeString << " __index)"; - out << sb; - out << nl << "return untypedFind(marshalKey(__index));"; - out << eb; - - out << sp << nl << "public int" << nl - << "count(" << memberTypeString << " __index)"; - out << sb; - out << nl << "return untypedCount(marshalKey(__index));"; - out << eb; - - // - // Key marshalling - // - string typeString = typeToString(type, TypeModeIn); - - out << sp << nl << "protected java.nio.ByteBuffer" << nl - << "marshalKey(Ice.Object __servant)"; - out << sb; - out << nl << "if(__servant instanceof " << typeString << ")"; - out << sb; - out << nl << memberTypeString << " __key = ((" << typeString << ")__servant)." << index.member << ";"; - out << nl << "return marshalKey(__key);"; - out << eb; - out << nl << "else"; - out << sb; - out << nl << "return null;"; - out << eb; - out << eb; - - string valueS = index.caseSensitive ? "__key" : "__key.toLowerCase()"; - - out << sp << nl << "private java.nio.ByteBuffer" << nl - << "marshalKey(" << memberTypeString << " __key)"; - out << sb; - out << nl << "IceInternal.BasicStream __os = " - << "new IceInternal.BasicStream(IceInternal.Util.getInstance(communicator()), encoding(), false);"; - int iter = 0; - writeMarshalUnmarshalCode(out, "", dataMember->type(), OptionalNone, false, 0, valueS, true, iter, false); - if(dataMember->type()->usesClasses()) - { - out << nl << "__os.writePendingObjects();"; - } - out << nl << "return __os.prepareWrite().b;"; - out << eb; - - out << eb; - - close(); -} - -void -usage(const char* n) -{ - getErrorStream() << "Usage: " << n << " [options] [slice-files...]\n"; - getErrorStream() << - "Options:\n" - "-h, --help Show this message.\n" - "-v, --version Display the Ice version.\n" - "--validate Validate command line options.\n" - "-DNAME Define NAME as 1.\n" - "-DNAME=DEF Define NAME as DEF.\n" - "-UNAME Remove any definition for NAME.\n" - "-IDIR Put DIR in the include file search path.\n" - "-E Print preprocessor output on stdout.\n" - "--include-dir DIR Use DIR as the header include directory.\n" - "--dict NAME,KEY,VALUE Create a Freeze dictionary with the name NAME,\n" - " using KEY as key, and VALUE as value. This\n" - " option may be specified multiple times for\n" - " different names. NAME may be a scoped name.\n" - "--index NAME,TYPE,MEMBER[,{case-sensitive|case-insensitive}]\n" - " Create a Freeze evictor index with the name\n" - " NAME for member MEMBER of class TYPE. This\n" - " option may be specified multiple times for\n" - " different names. NAME may be a scoped name.\n" - " When member is a string, the case can be\n" - " sensitive or insensitive (default is sensitive).\n" - "--dict-index DICT[,MEMBER][,{case-sensitive|case-insensitive}] \n" - " Add an index to dictionary DICT. If MEMBER is \n" - " specified, then DICT's VALUE must be a class or\n" - " a struct, and MEMBER must designate a member of\n" - " VALUE. Otherwise, the entire VALUE is used for \n" - " indexing. When the secondary key is a string, \n" - " the case can be sensitive or insensitive (default\n" - " is sensitive).\n" - "--output-dir DIR Create files in the directory DIR.\n" - "--depend Generate Makefile dependencies.\n" - "--depend-xml Generate dependencies in XML format.\n" - "--depend-file FILE Write dependencies to FILE instead of standard output.\n" - "-d, --debug Print debug messages.\n" - "--ice Allow reserved Ice prefix in Slice identifiers.\n" - "--underscore Allow underscores in Slice identifiers.\n" - "--meta META Define global metadata directive META.\n" - ; -} - -int -compile(int argc, char* argv[]) -{ - IceUtilInternal::Options opts; - opts.addOpt("h", "help"); - opts.addOpt("v", "version"); - opts.addOpt("", "validate"); - opts.addOpt("D", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("U", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("I", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("E"); - opts.addOpt("", "include-dir", IceUtilInternal::Options::NeedArg); - opts.addOpt("", "dict", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("", "index", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("", "dict-index", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - opts.addOpt("", "output-dir", IceUtilInternal::Options::NeedArg); - opts.addOpt("", "depend"); - opts.addOpt("", "depend-xml"); - opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, ""); - opts.addOpt("d", "debug"); - opts.addOpt("", "ice"); - opts.addOpt("", "underscore"); - opts.addOpt("", "meta", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); - - bool validate = false; - for(int i = 0; i < argc; ++i) - { - if(string(argv[i]) == "--validate") - { - validate = true; - break; - } - } - - vector args; - try - { - args = opts.parse(argc, const_cast(argv)); - } - catch(const IceUtilInternal::BadOptException& e) - { - getErrorStream() << argv[0] << ": error: " << e.reason << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(opts.isSet("help")) - { - usage(argv[0]); - return EXIT_SUCCESS; - } - - if(opts.isSet("version")) - { - getErrorStream() << ICE_STRING_VERSION << endl; - return EXIT_SUCCESS; - } - - vector cppArgs; - vector optargs = opts.argVec("D"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - cppArgs.push_back("-D" + *i); - } - - optargs = opts.argVec("U"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - cppArgs.push_back("-U" + *i); - } - - vector includePaths = opts.argVec("I"); - for(vector::const_iterator i = includePaths.begin(); i != includePaths.end(); ++i) - { - cppArgs.push_back("-I" + Preprocessor::normalizeIncludePath(*i)); - } - - bool preprocess = opts.isSet("E"); - - string include = opts.optArg("include-dir"); - - vector dicts; - optargs = opts.argVec("dict"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - string s = IceUtilInternal::removeWhitespace(*i); - - Dict dict; - - string::size_type pos; - pos = s.find(','); - if(pos != string::npos) - { - dict.name = s.substr(0, pos); - s.erase(0, pos + 1); - } - pos = s.find(','); - if(pos != string::npos) - { - dict.key = s.substr(0, pos); - s.erase(0, pos + 1); - } - dict.value = s; - - if(dict.name.empty()) - { - getErrorStream() << argv[0] << ": error: " << *i << ": no name specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(dict.key.empty()) - { - getErrorStream() << argv[0] << ": error: " << *i << ": no key specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(dict.value.empty()) - { - getErrorStream() << argv[0] << ": error: " << *i << ": no value specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - dicts.push_back(dict); - } - - vector indices; - optargs = opts.argVec("index"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - string s = IceUtilInternal::removeWhitespace(*i); - - Index index; - - string::size_type pos; - pos = s.find(','); - if(pos != string::npos) - { - index.name = s.substr(0, pos); - s.erase(0, pos + 1); - } - pos = s.find(','); - if(pos != string::npos) - { - index.type = s.substr(0, pos); - s.erase(0, pos + 1); - } - pos = s.find(','); - string caseString; - if(pos != string::npos) - { - index.member = s.substr(0, pos); - s.erase(0, pos + 1); - caseString = s; - } - else - { - index.member = s; - caseString = "case-sensitive"; - } - - if(index.name.empty()) - { - getErrorStream() << argv[0] << ": error: " << *i << ": no name specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(index.type.empty()) - { - getErrorStream() << argv[0] << ": error: " << *i << ": no type specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(index.member.empty()) - { - getErrorStream() << argv[0] << ": error: " << *i << ": no member specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(caseString != "case-sensitive" && caseString != "case-insensitive") - { - getErrorStream() << argv[0] << ": error: " << *i << ": the case can be `case-sensitive' or " - << "`case-insensitive'" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - index.caseSensitive = (caseString == "case-sensitive"); - - indices.push_back(index); - } - - if(opts.isSet("dict-index")) - { - vector optargs = opts.argVec("dict-index"); - for(vector::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - string s = IceUtilInternal::removeWhitespace(*i); - - string dictName; - DictIndex index; - string::size_type pos; - - string caseString = "case-sensitive"; - pos = s.find(','); - if(pos != string::npos) - { - dictName = s.substr(0, pos); - s.erase(0, pos + 1); - - pos = s.find(','); - if(pos != string::npos) - { - index.member = s.substr(0, pos); - s.erase(0, pos + 1); - caseString = s; - } - else - { - if(s == "case-sensitive" || s == "case-insensitive") - { - caseString = s; - } - else - { - index.member = s; - } - } - } - else - { - dictName = s; - } - - if(dictName.empty()) - { - getErrorStream() << argv[0] << ": error: " << *i << ": no dictionary specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(caseString != "case-sensitive" && caseString != "case-insensitive") - { - getErrorStream() << argv[0] << ": error: " << *i << ": the case can be `case-sensitive' or " - << "`case-insensitive'" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - index.caseSensitive = (caseString == "case-sensitive"); - - bool found = false; - for(vector::iterator p = dicts.begin(); p != dicts.end(); ++p) - { - if(p->name == dictName) - { - if(find(p->indices.begin(), p->indices.end(), index) != p->indices.end()) - { - getErrorStream() << argv[0] << ": error: --dict-index " << *i - << ": this dict-index is defined twice" << endl; - return EXIT_FAILURE; - } - - p->indices.push_back(index); - found = true; - break; - } - } - if(!found) - { - getErrorStream() << argv[0] << ": error: " << *i << ": unknown dictionary" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - } - } - - string output = opts.optArg("output-dir"); - - bool depend = opts.isSet("depend"); - bool dependxml = opts.isSet("depend-xml"); - - string dependFile = opts.optArg("depend-file"); - - bool debug = opts.isSet("debug"); - - bool ice = opts.isSet("ice"); - - bool underscore = opts.isSet("underscore"); - - StringList globalMetadata; - vector v = opts.argVec("meta"); - copy(v.begin(), v.end(), back_inserter(globalMetadata)); - - if(dicts.empty() && indices.empty() && !(depend || dependxml)) - { - getErrorStream() << argv[0] << ": error: no Freeze types specified" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(depend && dependxml) - { - getErrorStream() << argv[0] << ": error: cannot specify both --depend and --depend-xml" << endl; - if(!validate) - { - usage(argv[0]); - } - return EXIT_FAILURE; - } - - if(validate) - { - return EXIT_SUCCESS; - } - - UnitPtr u = Unit::createUnit(true, false, ice, underscore, globalMetadata); - - int status = EXIT_SUCCESS; - - IceUtil::CtrlCHandler ctrlCHandler; - ctrlCHandler.setCallback(interruptedCallback); - - DependOutputUtil out(dependFile); - if(dependxml) - { - out.os() << "\n" << endl; - } - - for(vector::size_type idx = 0; idx < args.size(); ++idx) - { - if(depend || dependxml) - { - PreprocessorPtr icecpp = Preprocessor::create(argv[0], args[idx], cppArgs); - FILE* cppHandle = icecpp->preprocess(false, "-D__SLICE2FREEZEJ__"); - - if(cppHandle == 0) - { - out.cleanup(); - u->destroy(); - return EXIT_FAILURE; - } - - status = u->parse(args[idx], cppHandle, debug); - - if(status == EXIT_FAILURE) - { - out.cleanup(); - u->destroy(); - return EXIT_FAILURE; - } - - if(!icecpp->printMakefileDependencies(out.os(), depend ? Preprocessor::Java : Preprocessor::SliceXML, includePaths, - "-D__SLICE2FREEZEJ__")) - { - out.cleanup(); - u->destroy(); - return EXIT_FAILURE; - } - - if(!icecpp->close()) - { - out.cleanup(); - u->destroy(); - return EXIT_FAILURE; - } - } - else - { - PreprocessorPtr icecpp = Preprocessor::create(argv[0], args[idx], cppArgs); - FILE* cppHandle = icecpp->preprocess(false, "-DICE_COMPILER=ICE_SLICE2FREEZEJ"); - - if(cppHandle == 0) - { - u->destroy(); - return EXIT_FAILURE; - } - - if(preprocess) - { - char buf[4096]; - while(fgets(buf, static_cast(sizeof(buf)), cppHandle) != NULL) - { - if(fputs(buf, stdout) == EOF) - { - u->destroy(); - return EXIT_FAILURE; - } - } - } - else - { - status = u->parse(args[idx], cppHandle, debug); - } - - if(!icecpp->close()) - { - u->destroy(); - return EXIT_FAILURE; - } - } - - { - IceUtilInternal::MutexPtrLock sync(globalMutex); - - if(interrupted) - { - out.cleanup(); - return EXIT_FAILURE; - } - } - } - - if(dependxml) - { - out.os() << "\n"; - } - - if(depend || dependxml) - { - u->destroy(); - return EXIT_SUCCESS; - } - - if(status == EXIT_SUCCESS && !preprocess) - { - u->mergeModules(); - u->sort(); - - FreezeGenerator gen(argv[0], output); - - JavaGenerator::validateMetaData(u); - - for(vector::const_iterator p = dicts.begin(); p != dicts.end(); ++p) - { - try - { - gen.generate(u, *p); - } - catch(const string& ex) - { - // If a file could not be created, then cleanup any - // created files. - FileTracker::instance()->cleanup(); - u->destroy(); - getErrorStream() << argv[0] << ": error: " << ex << endl; - return EXIT_FAILURE; - } - catch(const Slice::FileException& ex) - { - // If a file could not be created, then cleanup any - // created files. - FileTracker::instance()->cleanup(); - u->destroy(); - getErrorStream() << argv[0] << ": error: " << ex.reason() << endl; - return EXIT_FAILURE; - } - catch(...) - { - FileTracker::instance()->cleanup(); - getErrorStream() << argv[0] << ": error: unknown exception" << endl; - u->destroy(); - return EXIT_FAILURE; - } - } - - for(vector::const_iterator q = indices.begin(); q != indices.end(); ++q) - { - try - { - gen.generate(u, *q); - } - catch(const string& ex) - { - // If a file could not be created, then cleanup any - // created files. - FileTracker::instance()->cleanup(); - u->destroy(); - getErrorStream() << argv[0] << ": error: " << ex << endl; - return EXIT_FAILURE; - } - catch(const Slice::FileException& ex) - { - // If a file could not be created, then cleanup any - // created files. - FileTracker::instance()->cleanup(); - u->destroy(); - getErrorStream() << argv[0] << ": error: " << ex.reason() << endl; - return EXIT_FAILURE; - } - catch(...) - { - getErrorStream() << argv[0] << ": error: unknown exception" << endl; - FileTracker::instance()->cleanup(); - u->destroy(); - return EXIT_FAILURE; - } - } - - } - - u->destroy(); - - { - IceUtilInternal::MutexPtrLock sync(globalMutex); - - if(interrupted) - { - FileTracker::instance()->cleanup(); - return EXIT_FAILURE; - } - } - - return status; -} - -int -main(int argc, char* argv[]) -{ - try - { - return compile(argc, argv); - } - catch(const std::exception& ex) - { - getErrorStream() << argv[0] << ": error:" << ex.what() << endl; - return EXIT_FAILURE; - } - catch(const std::string& msg) - { - getErrorStream() << argv[0] << ": error:" << msg << endl; - return EXIT_FAILURE; - } - catch(const char* msg) - { - getErrorStream() << argv[0] << ": error:" << msg << endl; - return EXIT_FAILURE; - } - catch(...) - { - getErrorStream() << argv[0] << ": error:" << "unknown exception" << endl; - return EXIT_FAILURE; - } -} diff --git a/cpp/src/slice2freezej/Makefile b/cpp/src/slice2freezej/Makefile deleted file mode 100644 index b244066aeb5..00000000000 --- a/cpp/src/slice2freezej/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -# -# This copy of Ice is licensed to you under the terms described in the -# ICE_LICENSE file included in this distribution. -# -# ********************************************************************** - -top_srcdir = ../.. - -NAME = $(bindir)/slice2freezej - -TARGETS = $(NAME) - -OBJS = Main.o - -RPATH_DIR = $(LOADER_PATH)/../$(libsubdir) - -include $(top_srcdir)/config/Make.rules - -CPPFLAGS := -I. $(CPPFLAGS) - -$(NAME): $(OBJS) - rm -f $@ - $(CXX) $(LDFLAGS) $(LDEXEFLAGS) -o $@ $(OBJS) $(SLICE_LIBS) $(MCPP_RPATH_LINK) - -install:: all - $(call installprogram,$(NAME),$(DESTDIR)$(install_bindir)) - $(call installdata,$(top_srcdir)/../man/man1/slice2freezej.1,$(DESTDIR)$(install_mandir)) diff --git a/cpp/src/slice2freezej/Makefile.mak b/cpp/src/slice2freezej/Makefile.mak deleted file mode 100644 index b9314546f2b..00000000000 --- a/cpp/src/slice2freezej/Makefile.mak +++ /dev/null @@ -1,48 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -# -# This copy of Ice is licensed to you under the terms described in the -# ICE_LICENSE file included in this distribution. -# -# ********************************************************************** - -top_srcdir = ..\.. - -NAME = $(top_srcdir)\bin\slice2freezej.exe - -TARGETS = $(NAME) - -OBJS = .\Main.obj - -!include $(top_srcdir)/config/Make.rules.mak - -CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN - -!if "$(GENERATE_PDB)" == "yes" -PDBFLAGS = /pdb:$(NAME:.exe=.pdb) -!endif - -RES_FILE = Slice2FreezeJ.res - -$(NAME): $(OBJS) Slice2FreezeJ.res - $(LINK) $(LD_EXEFLAGS) $(PDBFLAGS) $(OBJS) $(SETARGV) $(PREOUT)$@ $(PRELIBS) \ - $(BASELIBS) $(RES_FILE) - @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ - $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest - @if defined SIGN_CERTIFICATE echo ^ ^ ^ Signing $@ && \ - signtool sign /f "$(SIGN_CERTIFICATE)" /p $(SIGN_PASSWORD) /t $(SIGN_TIMESTAMPSERVER) $@ - -clean:: - del /q $(NAME:.exe=.*) - del /q Slice2FreezeJ.res - -install:: all - copy $(NAME) "$(install_bindir)" - -!if "$(GENERATE_PDB)" == "yes" - -install:: all - copy $(NAME:.exe=.pdb) "$(install_bindir)" - -!endif diff --git a/cpp/src/slice2freezej/Slice2FreezeJ.rc b/cpp/src/slice2freezej/Slice2FreezeJ.rc deleted file mode 100644 index b67a0b199af..00000000000 --- a/cpp/src/slice2freezej/Slice2FreezeJ.rc +++ /dev/null @@ -1,34 +0,0 @@ -#include "winver.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,7,0,0 - PRODUCTVERSION 3,7,0,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE VFT_APP - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "ZeroC, Inc.\0" - VALUE "FileDescription", "Slice to Freeze for Java Translator\0" - VALUE "FileVersion", "3.7.0\0" - VALUE "InternalName", "slice2freezej\0" - VALUE "LegalCopyright", "\251 2003-2015 ZeroC, Inc.\0" - VALUE "OriginalFilename", "slice2freezej.exe\0" - VALUE "ProductName", "Ice\0" - VALUE "ProductVersion", "3.7.0\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END -- cgit v1.2.3