diff options
106 files changed, 14215 insertions, 519 deletions
diff --git a/cpp/allDemos.py b/cpp/allDemos.py index c281d5776c5..a5aaafba867 100755 --- a/cpp/allDemos.py +++ b/cpp/allDemos.py @@ -59,7 +59,8 @@ demos = [ "Freeze/backup", "Freeze/transform", "Freeze/casino", - "book/freeze_filesystem", + "book/map_filesystem", + "book/evictor_filesystem", "book/simple_filesystem", "book/printer", "book/lifecycle", diff --git a/cpp/demo/book/Makefile b/cpp/demo/book/Makefile index ee77a10788f..332cc489823 100644 --- a/cpp/demo/book/Makefile +++ b/cpp/demo/book/Makefile @@ -14,7 +14,8 @@ include $(top_srcdir)/config/Make.rules SUBDIRS = printer \ simple_filesystem \ lifecycle \ - freeze_filesystem + evictor_filesystem \ + map_filesystem $(EVERYTHING):: @for subdir in $(SUBDIRS); \ diff --git a/cpp/demo/book/Makefile.mak b/cpp/demo/book/Makefile.mak index da2e57f27f6..6b336b18a6d 100644 --- a/cpp/demo/book/Makefile.mak +++ b/cpp/demo/book/Makefile.mak @@ -17,7 +17,8 @@ SUBDIRS = printer \ !if "$(CPP_COMPILER)" != "VC60"
SUBDIRS = $(SUBDIRS) \
- freeze_filesystem
+ map_filesystem \
+ evictor_filesystem
!endif
$(EVERYTHING)::
diff --git a/cpp/demo/book/README b/cpp/demo/book/README index 2563dfac2f5..c823ec7313a 100644 --- a/cpp/demo/book/README +++ b/cpp/demo/book/README @@ -6,10 +6,15 @@ Demos in this directory: the Ice Run Time chapter. You can copy and modify this code to suit your needs. -- freeze_filesystem +- evictor_filesystem An implementation of the persistent version of the file system - example described in the Freeze chapter. + example described in the Freeze chapter using a Freeze evictor. + +- map_filesystem + + An implementation of the persistent version of the file system + example described in the Freeze chapter using a Freeze map. - lifecycle diff --git a/cpp/demo/book/evictor_filesystem/.depend b/cpp/demo/book/evictor_filesystem/.depend new file mode 100644 index 00000000000..ab1cc9022ff --- /dev/null +++ b/cpp/demo/book/evictor_filesystem/.depend @@ -0,0 +1,12 @@ +Filesystem$(OBJEXT): Filesystem.cpp Filesystem.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h +Client$(OBJEXT): Client.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.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/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h Filesystem.h Parser.h +Parser$(OBJEXT): Parser.cpp $(includedir)/IceUtil/DisableWarnings.h Parser.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.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/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h Filesystem.h +Grammar$(OBJEXT): Grammar.cpp Parser.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.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/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h Filesystem.h +Scanner$(OBJEXT): Scanner.cpp $(includedir)/IceUtil/Config.h Parser.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.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/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h Filesystem.h Grammar.h +PersistentFilesystem$(OBJEXT): PersistentFilesystem.cpp PersistentFilesystem.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h Filesystem.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h +PersistentFilesystemI$(OBJEXT): PersistentFilesystemI.cpp PersistentFilesystemI.h PersistentFilesystem.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h Filesystem.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/Functional.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RWRecMutex.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/Unicode.h $(includedir)/Freeze/Freeze.h $(includedir)/Freeze/Initialize.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/ConnectionAsync.h $(includedir)/Ice/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.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 +Server$(OBJEXT): Server.cpp PersistentFilesystemI.h PersistentFilesystem.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h Filesystem.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/Functional.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RWRecMutex.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/Unicode.h $(includedir)/Freeze/Freeze.h $(includedir)/Freeze/Initialize.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/ConnectionAsync.h $(includedir)/Ice/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.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 +Filesystem.cpp: Filesystem.ice +PersistentFilesystem.cpp: PersistentFilesystem.ice ./Filesystem.ice +Filesystem.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +PersistentFilesystem.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/demo/book/freeze_filesystem/.gitignore b/cpp/demo/book/evictor_filesystem/.gitignore index 7c81ab1ce91..7c81ab1ce91 100644 --- a/cpp/demo/book/freeze_filesystem/.gitignore +++ b/cpp/demo/book/evictor_filesystem/.gitignore diff --git a/cpp/demo/book/evictor_filesystem/Client.cpp b/cpp/demo/book/evictor_filesystem/Client.cpp new file mode 100644 index 00000000000..ee09e42dcbd --- /dev/null +++ b/cpp/demo/book/evictor_filesystem/Client.cpp @@ -0,0 +1,57 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 <Ice/Ice.h> +#include <Filesystem.h> +#include <Parser.h> + +using namespace std; +using namespace Filesystem; + +class FilesystemClient : public Ice::Application +{ +public: + FilesystemClient() : + // + // Since this is an interactive demo we don't want any signal + // handling. + // + Ice::Application(Ice::NoSignalHandling) + { + } + + virtual int run(int, char * []) { + + // Create a proxy for the root directory + // + Ice::ObjectPrx base = communicator()->stringToProxy("RootDir:default -p 10000"); + if(!base) + { + throw "Could not create proxy"; + } + + // Down-cast the proxy to a Directory proxy. + // + DirectoryPrx rootDir = DirectoryPrx::checkedCast(base); + if(!rootDir) + { + throw "Invalid proxy"; + } + + ParserPtr p = new Parser(rootDir); + return p->parse(); + } +}; + +int +main(int argc, char* argv[]) +{ + FilesystemClient client; + return client.main(argc, argv, "config.client"); +} diff --git a/cpp/demo/book/freeze_filesystem/Filesystem.ice b/cpp/demo/book/evictor_filesystem/Filesystem.ice index 2e48dece6e3..2e48dece6e3 100644 --- a/cpp/demo/book/freeze_filesystem/Filesystem.ice +++ b/cpp/demo/book/evictor_filesystem/Filesystem.ice diff --git a/cpp/demo/book/evictor_filesystem/Grammar.cpp b/cpp/demo/book/evictor_filesystem/Grammar.cpp new file mode 100644 index 00000000000..0bc2d1fe8a7 --- /dev/null +++ b/cpp/demo/book/evictor_filesystem/Grammar.cpp @@ -0,0 +1,1727 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* 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 2, 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* 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.3" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOK_HELP = 258, + TOK_EXIT = 259, + TOK_STRING = 260, + TOK_LIST = 261, + TOK_LIST_RECURSIVE = 262, + TOK_CREATE_FILE = 263, + TOK_CREATE_DIR = 264, + TOK_PWD = 265, + TOK_CD = 266, + TOK_CAT = 267, + TOK_WRITE = 268, + TOK_RM = 269 + }; +#endif +/* Tokens. */ +#define TOK_HELP 258 +#define TOK_EXIT 259 +#define TOK_STRING 260 +#define TOK_LIST 261 +#define TOK_LIST_RECURSIVE 262 +#define TOK_CREATE_FILE 263 +#define TOK_CREATE_DIR 264 +#define TOK_PWD 265 +#define TOK_CD 266 +#define TOK_CAT 267 +#define TOK_WRITE 268 +#define TOK_RM 269 + + + + +/* Copy the first part of user declarations. */ +#line 1 "Grammar.y" + + +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 <Parser.h> + +#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 + +using namespace std; + +void +yyerror(const char* s) +{ + parser->error(s); +} + + + +/* 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 + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + +/* Copy the second part of user declarations. */ + + +/* Line 216 of yacc.c. */ +#line 165 "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 <stddef.h> /* 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 <libintl.h> /* 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 i) +#else +static int +YYID (i) + int i; +#endif +{ + return i; +} +#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 <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* 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 <stdlib.h> /* 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 <stdlib.h> /* 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; + YYSTYPE yyvs; + }; + +/* 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) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 27 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 45 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 16 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 5 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 21 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 30 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 269 + +#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, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 15, + 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 +}; + +#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, 6, 9, 11, 14, 17, 19, + 21, 24, 27, 29, 31, 34, 37, 40, 43, 46, + 48, 51 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 17, 0, -1, 18, -1, -1, 18, 19, -1, 19, + -1, 3, 15, -1, 4, 15, -1, 6, -1, 7, + -1, 8, 20, -1, 9, 20, -1, 10, -1, 11, + -1, 11, 20, -1, 12, 5, -1, 13, 20, -1, + 14, 20, -1, 1, 15, -1, 15, -1, 5, 20, + -1, 5, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint8 yyrline[] = +{ + 0, 52, 52, 56, 63, 66, 74, 78, 82, 86, + 90, 94, 98, 102, 106, 110, 114, 118, 122, 127, + 135, 140 +}; +#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_HELP", "TOK_EXIT", "TOK_STRING", + "TOK_LIST", "TOK_LIST_RECURSIVE", "TOK_CREATE_FILE", "TOK_CREATE_DIR", + "TOK_PWD", "TOK_CD", "TOK_CAT", "TOK_WRITE", "TOK_RM", "';'", "$accept", + "start", "commands", "command", "strings", 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, 59 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 16, 17, 17, 18, 18, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 20, 20 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 0, 2, 1, 2, 2, 1, 1, + 2, 2, 1, 1, 2, 2, 2, 2, 2, 1, + 2, 1 +}; + +/* 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, 8, 9, 0, 0, 12, 13, + 0, 0, 0, 19, 0, 0, 5, 18, 6, 7, + 21, 10, 11, 14, 15, 16, 17, 1, 4, 20 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 14, 15, 16, 21 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -14 +static const yytype_int8 yypact[] = +{ + 0, -13, -10, 3, -14, -14, 28, 28, -14, 28, + 30, 28, 28, -14, 21, 16, -14, -14, -14, -14, + 28, -14, -14, -14, -14, -14, -14, -14, -14, -14 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -14, -14, -14, 23, 25 +}; + +/* 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 -4 +static const yytype_int8 yytable[] = +{ + -3, 1, 17, 2, 3, 18, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, -2, 1, 19, 2, + 3, 27, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 22, 20, 23, 24, 25, 26, 28, 0, + 0, 0, 0, 0, 0, 29 +}; + +static const yytype_int8 yycheck[] = +{ + 0, 1, 15, 3, 4, 15, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 0, 1, 15, 3, + 4, 0, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 7, 5, 9, 5, 11, 12, 15, -1, + -1, -1, -1, -1, -1, 20 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 1, 3, 4, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 17, 18, 19, 15, 15, 15, + 5, 20, 20, 20, 5, 20, 20, 0, 19, 20 +}; + +#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 <stdio.h> /* 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 *bottom, yytype_int16 *top) +#else +static void +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + 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++) + { + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + fprintf (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. | +`----------*/ + +#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 look-ahead symbol. */ +int yychar; + +/* The semantic value of the look-ahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + 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); + YYSTACK_RELOCATE (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)); + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + look-ahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to look-ahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a look-ahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead 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; + } + + if (yyn == YYFINAL) + YYACCEPT; + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + 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 53 "Grammar.y" + { +;} + break; + + case 3: +#line 56 "Grammar.y" + { +;} + break; + + case 4: +#line 64 "Grammar.y" + { +;} + break; + + case 5: +#line 67 "Grammar.y" + { +;} + break; + + case 6: +#line 75 "Grammar.y" + { + parser->usage(); +;} + break; + + case 7: +#line 79 "Grammar.y" + { + return 0; +;} + break; + + case 8: +#line 83 "Grammar.y" + { + parser->list(false); +;} + break; + + case 9: +#line 87 "Grammar.y" + { + parser->list(true); +;} + break; + + case 10: +#line 91 "Grammar.y" + { + parser->createFile((yyvsp[(2) - (2)])); +;} + break; + + case 11: +#line 95 "Grammar.y" + { + parser->createDir((yyvsp[(2) - (2)])); +;} + break; + + case 12: +#line 99 "Grammar.y" + { + parser->pwd(); +;} + break; + + case 13: +#line 103 "Grammar.y" + { + parser->cd("/"); +;} + break; + + case 14: +#line 107 "Grammar.y" + { + parser->cd((yyvsp[(2) - (2)]).front()); +;} + break; + + case 15: +#line 111 "Grammar.y" + { + parser->cat((yyvsp[(2) - (2)]).front()); +;} + break; + + case 16: +#line 115 "Grammar.y" + { + parser->write((yyvsp[(2) - (2)])); +;} + break; + + case 17: +#line 119 "Grammar.y" + { + parser->destroy((yyvsp[(2) - (2)])); +;} + break; + + case 18: +#line 123 "Grammar.y" + { + parser->usage(); + yyerrok; +;} + break; + + case 19: +#line 128 "Grammar.y" + { +;} + break; + + case 20: +#line 136 "Grammar.y" + { + (yyval) = (yyvsp[(2) - (2)]); + (yyval).push_front((yyvsp[(1) - (2)]).front()); +;} + break; + + case 21: +#line 141 "Grammar.y" + { + (yyval) = (yyvsp[(1) - (1)]); +;} + break; + + +/* Line 1267 of yacc.c. */ +#line 1512 "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 look-ahead 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 look-ahead 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); + } + + if (yyn == YYFINAL) + YYACCEPT; + + *++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; + +#ifndef yyoverflow +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEOF && 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 146 "Grammar.y" + + diff --git a/cpp/demo/book/evictor_filesystem/Grammar.h b/cpp/demo/book/evictor_filesystem/Grammar.h new file mode 100644 index 00000000000..b5b8e41ade4 --- /dev/null +++ b/cpp/demo/book/evictor_filesystem/Grammar.h @@ -0,0 +1,81 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* 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 2, 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* 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_HELP = 258, + TOK_EXIT = 259, + TOK_STRING = 260, + TOK_LIST = 261, + TOK_LIST_RECURSIVE = 262, + TOK_CREATE_FILE = 263, + TOK_CREATE_DIR = 264, + TOK_PWD = 265, + TOK_CD = 266, + TOK_CAT = 267, + TOK_WRITE = 268, + TOK_RM = 269 + }; +#endif +/* Tokens. */ +#define TOK_HELP 258 +#define TOK_EXIT 259 +#define TOK_STRING 260 +#define TOK_LIST 261 +#define TOK_LIST_RECURSIVE 262 +#define TOK_CREATE_FILE 263 +#define TOK_CREATE_DIR 264 +#define TOK_PWD 265 +#define TOK_CD 266 +#define TOK_CAT 267 +#define TOK_WRITE 268 +#define TOK_RM 269 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + diff --git a/cpp/demo/book/evictor_filesystem/Grammar.y b/cpp/demo/book/evictor_filesystem/Grammar.y new file mode 100644 index 00000000000..d3d1a2bcdde --- /dev/null +++ b/cpp/demo/book/evictor_filesystem/Grammar.y @@ -0,0 +1,146 @@ +%{ + +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 <Parser.h> + +#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 + +using namespace std; + +void +yyerror(const char* s) +{ + parser->error(s); +} + +%} + +%pure_parser + +%token TOK_HELP +%token TOK_EXIT +%token TOK_STRING +%token TOK_LIST +%token TOK_LIST_RECURSIVE +%token TOK_CREATE_FILE +%token TOK_CREATE_DIR +%token TOK_PWD +%token TOK_CD +%token TOK_CAT +%token TOK_WRITE +%token TOK_RM + +%% + +// ---------------------------------------------------------------------- +start +// ---------------------------------------------------------------------- +: commands +{ +} +| +{ +} +; + +// ---------------------------------------------------------------------- +commands +// ---------------------------------------------------------------------- +: commands command +{ +} +| command +{ +} +; + +// ---------------------------------------------------------------------- +command +// ---------------------------------------------------------------------- +: TOK_HELP ';' +{ + parser->usage(); +} +| TOK_EXIT ';' +{ + return 0; +} +| TOK_LIST +{ + parser->list(false); +} +| TOK_LIST_RECURSIVE +{ + parser->list(true); +} +| TOK_CREATE_FILE strings +{ + parser->createFile($2); +} +| TOK_CREATE_DIR strings +{ + parser->createDir($2); +} +| TOK_PWD +{ + parser->pwd(); +} +| TOK_CD +{ + parser->cd("/"); +} +| TOK_CD strings +{ + parser->cd($2.front()); +} +| TOK_CAT TOK_STRING +{ + parser->cat($2.front()); +} +| TOK_WRITE strings +{ + parser->write($2); +} +| TOK_RM strings +{ + parser->destroy($2); +} +| error ';' +{ + parser->usage(); + yyerrok; +} +| ';' +{ +} +; + +// ---------------------------------------------------------------------- +strings +// ---------------------------------------------------------------------- +: TOK_STRING strings +{ + $$ = $2; + $$.push_front($1.front()); +} +| TOK_STRING +{ + $$ = $1; +} +; + +%% diff --git a/cpp/demo/book/freeze_filesystem/Makefile b/cpp/demo/book/evictor_filesystem/Makefile index 31cbf347222..ced3e82bc54 100644 --- a/cpp/demo/book/freeze_filesystem/Makefile +++ b/cpp/demo/book/evictor_filesystem/Makefile @@ -16,7 +16,10 @@ TARGETS = $(CLIENT) $(SERVER) OBJS = Filesystem.o -COBJS = Client.o +COBJS = Client.o \ + Parser.o \ + Grammar.o \ + Scanner.o SOBJS = PersistentFilesystem.o \ PersistentFilesystemI.o \ diff --git a/cpp/demo/book/freeze_filesystem/Makefile.mak b/cpp/demo/book/evictor_filesystem/Makefile.mak index a5284a4e4ce..c6b71088cbb 100644 --- a/cpp/demo/book/freeze_filesystem/Makefile.mak +++ b/cpp/demo/book/evictor_filesystem/Makefile.mak @@ -16,7 +16,10 @@ TARGETS = $(CLIENT) $(SERVER) OBJS = Filesystem.obj
-COBJS = Client.obj
+COBJS = Scanner.obj \
+ Grammar.obj \
+ Parser.obj \
+ Client.obj
SOBJS = PersistentFilesystem.obj \
PersistentFilesystemI.obj \
@@ -24,8 +27,7 @@ SOBJS = PersistentFilesystem.obj \ SRCS = $(OBJS:.obj=.cpp) \
$(COBJS:.obj=.cpp) \
- $(SOBJS:.obj=.cpp) \
- $(COLOBJS:.obj=.cpp)
+ $(SOBJS:.obj=.cpp)
!include $(top_srcdir)/config/Make.rules.mak
@@ -47,6 +49,20 @@ $(SERVER): $(OBJS) $(SOBJS) @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \
$(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest
+Scanner.cpp: Scanner.l
+ flex Scanner.l
+ -del /q $@
+ echo #include "IceUtil/Config.h" > Scanner.cpp
+ type lex.yy.c >> Scanner.cpp
+ -del /q lex.yy.c
+
+Grammar.cpp Grammar.h: Grammar.y
+ -del /q Grammar.h Grammar.cpp
+ bison -dvt Grammar.y
+ move Grammar.tab.c Grammar.cpp
+ move Grammar.tab.h Grammar.h
+ -del /q Grammar.output
+
clean::
-del /q Filesystem.cpp Filesystem.h
-del /q PersistentFilesystem.cpp PersistentFilesystem.h
diff --git a/cpp/demo/book/evictor_filesystem/Parser.cpp b/cpp/demo/book/evictor_filesystem/Parser.cpp new file mode 100644 index 00000000000..cb4c3411d97 --- /dev/null +++ b/cpp/demo/book/evictor_filesystem/Parser.cpp @@ -0,0 +1,438 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <IceUtil/DisableWarnings.h> +#include <Parser.h> + +#ifdef HAVE_READLINE +# include <readline/readline.h> +# include <readline/history.h> +#endif + +using namespace std; +using namespace Filesystem; + +extern FILE* yyin; + +Parser* parser; + +Parser::Parser(const DirectoryPrx& root) +{ + _dirs.push_front(root); +} + +void +Parser::usage() +{ + cout << + "help Print this message.\n" + "pwd Print current directory (/ = root).\n" + "cd [DIR] Change directory (/ or empty = root).\n" + "ls List current directory.\n" + "lr Recursively list current directory.\n" + "mkdir DIR [DIR...] Create directories DIR in current directory.\n" + "mkfile FILE [FILE...] Create files FILE in current directory.\n" + "rm NAME [NAME...] Delete directory or file NAME (rm * to delete all).\n" + "cat FILE List the contents of FILE.\n" + "write FILE [STRING...] Write STRING to FILE.\n" + "exit, quit Exit this program.\n"; +} + +// Print the contents of directory "dir". If recursive is true, +// print in tree fashion. +// For files, show the contents of each file. The "depth" +// parameter is the current nesting level (for indentation). + +void +Parser::list(bool recursive) +{ + list(_dirs.front(), recursive, 0); +} + +void +Parser::list(const DirectoryPrx& dir, bool recursive, int depth) +{ + string indent(depth++, '\t'); + + NodeDescSeq contents = dir->list(); + + for(NodeDescSeq::const_iterator i = contents.begin(); i != contents.end(); ++i) + { + DirectoryPrx d = i->type == DirType ? DirectoryPrx::uncheckedCast(i->proxy) : (DirectoryPrx)0; + cout << indent << i->name << (d ? " (directory)" : " (file)"); + if(d && recursive) + { + cout << ":" << endl; + list(d, true, depth); + } + else + { + cout << endl; + } + } +} + +void +Parser::createFile(const std::list<string>& names) +{ + DirectoryPrx dir = _dirs.front(); + + for(std::list<string>::const_iterator i = names.begin(); i != names.end(); ++i) + { + if(*i == "..") + { + cout << "Cannot create a file named `..'" << endl; + continue; + } + + try + { + dir->createFile(*i); + } + catch(const NameInUse&) + { + cout << "`" << *i << "' exists already" << endl; + } + } +} + +void +Parser::createDir(const std::list<string>& names) +{ + DirectoryPrx dir = _dirs.front(); + + for(std::list<string>::const_iterator i = names.begin(); i != names.end(); ++i) + { + if(*i == "..") + { + cout << "Cannot create a directory named `.'" << endl; + continue; + } + + try + { + dir->createDirectory(*i); + } + catch(const NameInUse&) + { + cout << "`" << *i << "' exists already" << endl; + } + } +} + +void +Parser::pwd() +{ + if(_dirs.size() == 1) + { + cout << "/"; + } + else + { + // COMPILERFIX: Should be const_reverse_iterator, but that won't compile with + // gcc because operator!= is missing. + // + std::list<DirectoryPrx>::reverse_iterator i = _dirs.rbegin(); + ++i; + while(i != _dirs.rend()) + { + cout << "/" << (*i)->name(); + ++i; + } + } + cout << endl; +} + +void +Parser::cd(const string& name) +{ + if(name == "/") + { + while(_dirs.size() > 1) + { + _dirs.pop_front(); + } + return; + } + + if(name == "..") + { + if(_dirs.size() > 1) + { + _dirs.pop_front(); + } + return; + } + + DirectoryPrx dir = _dirs.front(); + NodeDesc d; + try + { + d = dir->find(name); + } + catch(const NoSuchName&) + { + cout << "`" << name << "': no such directory" << endl; + return; + } + if(d.type == FileType) + { + cout << "`" << name << "': not a directory" << endl; + return; + } + _dirs.push_front(DirectoryPrx::uncheckedCast(d.proxy)); +} + +void +Parser::cat(const string& name) +{ + DirectoryPrx dir = _dirs.front(); + NodeDesc d; + try + { + d = dir->find(name); + } + catch(const NoSuchName&) + { + cout << "`" << name << "': no such file" << endl; + return; + } + if(d.type == DirType) + { + cout << "`" << name << "': not a file" << endl; + return; + } + FilePrx f = FilePrx::uncheckedCast(d.proxy); + Lines l = f->read(); + for(Lines::const_iterator i = l.begin(); i != l.end(); ++i) + { + cout << *i << endl; + } +} + +void +Parser::write(std::list<string>& args) +{ + DirectoryPrx dir = _dirs.front(); + string name = args.front(); + args.pop_front(); + NodeDesc d; + try + { + d = dir->find(name); + } + catch(const NoSuchName&) + { + cout << "`" << name << "': no such file" << endl; + return; + } + if(d.type == DirType) + { + cout << "`" << name << "': not a file" << endl; + return; + } + FilePrx f = FilePrx::uncheckedCast(d.proxy); + + Lines l; + for(std::list<string>::const_iterator i = args.begin(); i != args.end(); ++i) + { + l.push_back(*i); + } + f->write(l); +} + +void +Parser::destroy(const std::list<string>& names) +{ + DirectoryPrx dir = _dirs.front(); + + for(std::list<string>::const_iterator i = names.begin(); i != names.end(); ++i) + { + if(*i == "*") + { + NodeDescSeq nodes = dir->list(); + for(NodeDescSeq::iterator j = nodes.begin(); j != nodes.end(); ++j) + { + try + { + j->proxy->destroy(); + } + catch(const PermissionDenied& ex) + { + cout << "cannot remove `" << j->name << "': " << ex.reason << endl; + } + } + return; + } + else + { + NodeDesc d; + try + { + d = dir->find(*i); + } + catch(const NoSuchName&) + { + cout << "`" << *i << "': no such file or directory" << endl; + return; + } + try + { + d.proxy->destroy(); + } + catch(const PermissionDenied& ex) + { + cout << "cannot remove `" << *i << "': " << ex.reason << endl; + } + } + } +} + +void +Parser::getInput(char* buf, int& result, int maxSize) +{ +#ifdef HAVE_READLINE + + const char* prompt = parser->getPrompt(); + char* line = readline(const_cast<char*>(prompt)); + if(!line) + { + result = 0; + } + else + { + if(*line) + { + add_history(line); + } + + result = strlen(line) + 1; + if(result > maxSize) + { + free(line); + error("input line too long"); + result = 0; + } + else + { + strcpy(buf, line); + strcat(buf, "\n"); + free(line); + } + } + +#else + + cout << parser->getPrompt() << flush; + + string line; + while(true) + { + char c = static_cast<char>(getc(yyin)); + if(c == EOF) + { + if(line.size()) + { + line += '\n'; + } + break; + } + + line += c; + + if(c == '\n') + { + break; + } + } + + result = static_cast<int>(line.length()); + if(result > maxSize) + { + error("input line too long"); + buf[0] = EOF; + result = 1; + } + else + { + strcpy(buf, line.c_str()); + } + +#endif +} + +void +Parser::continueLine() +{ + _continue = true; +} + +const char* +Parser::getPrompt() +{ + if(_continue) + { + _continue = false; + return "(cont) "; + } + else + { + return "> "; + } +} + +void +Parser::error(const char* s) +{ + cerr << "error: " << s << endl; + _errors++; +} + +void +Parser::error(const string& s) +{ + error(s.c_str()); +} + +void +Parser::warning(const char* s) +{ + cerr << "warning: " << s << endl; +} + +void +Parser::warning(const string& s) +{ + warning(s.c_str()); +} + +int +Parser::parse(bool debug) +{ + extern int yydebug; + yydebug = debug ? 1 : 0; + + assert(!parser); + parser = this; + + _errors = 0; + yyin = stdin; + assert(yyin); + + _continue = false; + + int status = yyparse(); + if(_errors) + { + status = EXIT_FAILURE; + } + + parser = 0; + return status; +} diff --git a/cpp/demo/book/evictor_filesystem/Parser.h b/cpp/demo/book/evictor_filesystem/Parser.h new file mode 100644 index 00000000000..648812abfaa --- /dev/null +++ b/cpp/demo/book/evictor_filesystem/Parser.h @@ -0,0 +1,83 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 PARSER_H +#define PARSER_H + +#include <Ice/Ice.h> +#include <Filesystem.h> +#include <list> +#include <stdio.h> + +// +// Stuff for flex and bison +// + +#define YYSTYPE std::list<std::string> +#define YY_DECL int yylex(YYSTYPE* yylvalp) +YY_DECL; +int yyparse(); + +// +// 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) yyerror(a) + +class Parser; +typedef IceUtil::Handle<Parser> ParserPtr; + +class Parser : public IceUtil::SimpleShared +{ +public: + Parser(const Filesystem::DirectoryPrx&); + + void usage(); + void list(bool); + void list(const Filesystem::DirectoryPrx&, bool, int); + void createFile(const ::std::list< ::std::string>&); + void createDir(const ::std::list< ::std::string>&); + void pwd(); + void cd(const ::std::string&); + void cat(const ::std::string&); + void write(::std::list< ::std::string>&); + void destroy(const ::std::list< ::std::string>&); + + void getInput(char*, int&, int); + void continueLine(); + const char* getPrompt(); + + void error(const char*); + void error(const std::string&); + + void warning(const char*); + void warning(const std::string&); + + int parse(bool = false); + +private: + ::std::list<Filesystem::DirectoryPrx> _dirs; + + bool _continue; + int _errors; +}; + +extern Parser* parser; // The current parser for bison/flex + +#endif diff --git a/cpp/demo/book/freeze_filesystem/PersistentFilesystem.ice b/cpp/demo/book/evictor_filesystem/PersistentFilesystem.ice index b8e915644d6..b8e915644d6 100644 --- a/cpp/demo/book/freeze_filesystem/PersistentFilesystem.ice +++ b/cpp/demo/book/evictor_filesystem/PersistentFilesystem.ice diff --git a/cpp/demo/book/freeze_filesystem/PersistentFilesystemI.cpp b/cpp/demo/book/evictor_filesystem/PersistentFilesystemI.cpp index 1cc4ec00f00..dc5ed333dff 100644 --- a/cpp/demo/book/freeze_filesystem/PersistentFilesystemI.cpp +++ b/cpp/demo/book/evictor_filesystem/PersistentFilesystemI.cpp @@ -115,7 +115,7 @@ Filesystem::DirectoryI::destroy(const Ice::Current& c) { if(!parent) { - throw Filesystem::PermissionDenied("cannot destroy root directory"); + throw Filesystem::PermissionDenied("Cannot destroy root directory"); } { @@ -127,7 +127,7 @@ Filesystem::DirectoryI::destroy(const Ice::Current& c) } if(!nodes.empty()) { - throw Filesystem::PermissionDenied("cannot destroy non-empty directory"); + throw Filesystem::PermissionDenied("Cannot destroy non-empty directory"); } _destroyed = true; } diff --git a/cpp/demo/book/freeze_filesystem/PersistentFilesystemI.h b/cpp/demo/book/evictor_filesystem/PersistentFilesystemI.h index ae6773be1fe..ae6773be1fe 100644 --- a/cpp/demo/book/freeze_filesystem/PersistentFilesystemI.h +++ b/cpp/demo/book/evictor_filesystem/PersistentFilesystemI.h diff --git a/cpp/demo/book/evictor_filesystem/README b/cpp/demo/book/evictor_filesystem/README new file mode 100644 index 00000000000..f7254add36d --- /dev/null +++ b/cpp/demo/book/evictor_filesystem/README @@ -0,0 +1,11 @@ +This demo presents an alternate implementation of the filesystem +application using a Freeze evictor, as discussed in the Freeze chapter +of the Ice manual. + +To run it, start the server in a window: + +$ server + +Then run the client in a separate window: + +$ client diff --git a/cpp/demo/book/evictor_filesystem/Scanner.cpp b/cpp/demo/book/evictor_filesystem/Scanner.cpp new file mode 100755 index 00000000000..ca387ed1b56 --- /dev/null +++ b/cpp/demo/book/evictor_filesystem/Scanner.cpp @@ -0,0 +1,1848 @@ +#include "IceUtil/Config.h"
+/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include <stdio.h> +#include <errno.h> + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include <stdlib.h> +#ifndef _WIN32 +#include <unistd.h> +#endif + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include <io.h> +#include <stdlib.h> +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#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 yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +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; + + /* 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 yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* 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". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + + +#define yywrap() 1 +#define YY_SKIP_YYWRAP +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 19 +#define YY_END_OF_BUFFER 20 +static yyconst short int yy_accept[56] = + { 0, + 14, 14, 20, 18, 14, 15, 16, 17, 18, 15, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 14, 0, 2, 1, 0, 14, 0, 10, 0, 0, + 6, 5, 0, 0, 0, 13, 0, 11, 0, 0, + 0, 0, 9, 0, 0, 4, 3, 0, 0, 0, + 8, 0, 12, 7, 0 + } ; + +static yyconst int 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, 1, 4, 1, 1, 1, 1, 5, 1, + 1, 6, 1, 1, 1, 1, 7, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 8, 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, 9, 1, 1, 1, 1, 10, 1, 11, 12, + + 13, 14, 1, 15, 16, 1, 17, 18, 19, 1, + 1, 20, 21, 22, 23, 24, 25, 1, 26, 27, + 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, 1, 1 + } ; + +static yyconst int yy_meta[28] = + { 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 + } ; + +static yyconst short int yy_base[56] = + { 0, + 0, 0, 69, 70, 26, 70, 70, 70, 23, 70, + 29, 24, 41, 54, 15, 49, 39, 39, 44, 40, + 31, 39, 70, 70, 41, 70, 37, 70, 44, 41, + 70, 70, 33, 46, 41, 70, 40, 70, 31, 34, + 37, 36, 70, 27, 26, 70, 70, 27, 30, 33, + 70, 26, 70, 70, 70 + } ; + +static yyconst short int yy_def[56] = + { 0, + 55, 1, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 0 + } ; + +static yyconst short int yy_nxt[98] = + { 0, + 4, 5, 6, 7, 8, 4, 9, 10, 11, 4, + 12, 4, 13, 4, 14, 4, 4, 15, 16, 17, + 18, 19, 4, 4, 4, 20, 4, 21, 23, 24, + 25, 26, 21, 27, 22, 28, 31, 32, 54, 22, + 25, 26, 25, 26, 41, 53, 42, 52, 51, 50, + 46, 49, 48, 47, 46, 45, 44, 43, 40, 39, + 38, 37, 36, 35, 34, 33, 30, 29, 55, 3, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55 + + } ; + +static yyconst short int yy_chk[98] = + { 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, 5, 9, 9, + 11, 11, 21, 12, 5, 12, 15, 15, 52, 21, + 22, 22, 25, 25, 33, 50, 33, 49, 48, 45, + 44, 42, 41, 40, 39, 37, 35, 34, 30, 29, + 27, 20, 19, 18, 17, 16, 14, 13, 3, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55 + + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +/* 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 *yytext; +#line 1 "Scanner.l" +#define INITIAL 0 +#line 2 "Scanner.l" + +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 <Parser.h> +#include <Grammar.h> + +#if defined(_MSC_VER) && defined(ICE_64) +// +// 'initializing' : conversion from '__int64' to 'int', possible loss of data +// Puts a pointer-difference into an int +// +# pragma warning( 4 : 4244 ) +#endif + +using namespace std; + +#define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) + +#define YY_ALWAYS_INTERACTIVE 1 +#line 433 "lex.yy.c" + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen YY_PROTO(( yyconst char * )); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +#endif + +#if YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include <stdlib.h> +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#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 (void) fwrite( yytext, yyleng, 1, yyout ) +#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->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + } +#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 + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL int yylex YY_PROTO(( void )) +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * 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 + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 35 "Scanner.l" + + +#line 598 "lex.yy.c" + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *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 >= 56 ) + 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_base[yy_current_state] != 70 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + 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 37 "Scanner.l" +{ + // C++-style comment + int c; + do + { + c = yyinput(); + } + while(c != '\n' && c != EOF); +} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 47 "Scanner.l" +{ + // C-style comment + while(true) + { + int c = yyinput(); + if(c == '*') + { + int next = yyinput(); + if(next == '/') + { + break; + } + else + { + unput(next); + } + } + else if(c == EOF) + { + parser->warning("EOF in comment"); + break; + } + } +} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 72 "Scanner.l" +{ + return TOK_HELP; +} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 76 "Scanner.l" +{ + return TOK_EXIT; +} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 80 "Scanner.l" +{ + return TOK_LIST; +} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 84 "Scanner.l" +{ + return TOK_LIST_RECURSIVE; +} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 88 "Scanner.l" +{ + return TOK_CREATE_FILE; +} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 92 "Scanner.l" +{ + return TOK_CREATE_DIR; +} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 96 "Scanner.l" +{ + return TOK_PWD; +} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 100 "Scanner.l" +{ + return TOK_CD; +} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 104 "Scanner.l" +{ + return TOK_CAT; +} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 108 "Scanner.l" +{ + return TOK_WRITE; +} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 112 "Scanner.l" +{ + return TOK_RM; +} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 116 "Scanner.l" +{ + size_t len = strlen(yytext); + for(size_t i = 0; i < len; ++i) + { + if(yytext[i] == '\\') + { + parser->continueLine(); + } + } +} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 127 "Scanner.l" +{ + return ';'; +} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 131 "Scanner.l" +{ + // "..."-type strings + string s; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == '"') + { + break; + } + else if(c == EOF) + { + parser->warning("EOF in string"); + break; + } + else if(c == '\\') + { + char next = static_cast<char>(yyinput()); + switch(next) + { + case '\\': + case '"': + { + s += next; + break; + } + + case 'n': + { + s += '\n'; + break; + } + + case 'r': + { + s += '\r'; + break; + } + + case 't': + { + s += '\t'; + break; + } + + case 'v': + { + s += '\v'; + break; + } + + case 'f': + { + s += '\f'; + break; + } + + default: + { + s += c; + unput(next); + } + } + } + else + { + s += c; + } + } + yylvalp->clear(); + yylvalp->push_back(s); + return TOK_STRING; +} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 205 "Scanner.l" +{ + // '...'-type strings + string s; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == '\'') + { + break; + } + else if(c == EOF) + { + parser->warning("EOF in string"); + break; + } + else + { + s += c; + } + } + yylvalp->clear(); + yylvalp->push_back(s); + return TOK_STRING; +} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 230 "Scanner.l" +{ + // Simple strings + string s; + s += yytext[0]; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == EOF) + { + break; + } + else if(isspace(c) || c == ';') + { + unput(c); + break; + } + + s += c; + } + yylvalp->clear(); + yylvalp->push_back(s); + return TOK_STRING; +} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 254 "Scanner.l" +ECHO; + YY_BREAK +#line 957 "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->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 yyin at a new source and called + * yylex(). 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->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->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->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_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, 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->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 yylex */ + + +/* 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() + { + register char *dest = yy_current_buffer->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->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->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->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->yy_n_chars = yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* 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. */ + yy_flex_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->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + + yy_current_buffer->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; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->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() + { + 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 >= 56 ) + 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 ); + */ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { + 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 >= 56 ) + 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 == 55); + + return yy_is_jam ? 0 : yy_current_state; + } + + +#ifndef YY_NO_UNPUT +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->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->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->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; + } +#endif /* ifndef YY_NO_UNPUT */ + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#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->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. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + 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 yytext */ + yy_hold_char = *++yy_c_buf_p; + + + return c; + } + + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + 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->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_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 *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +#ifndef _WIN32 +#include <unistd.h> +#else +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif +#endif + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +#if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + 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 ) + yy_load_buffer_state(); + } + + +#ifndef YY_NO_SCAN_BUFFER +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + 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) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_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; + + yy_switch_to_buffer( b ); + + return b; + } +#endif + + +#ifndef YY_NO_SCAN_STRING +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) +#else +YY_BUFFER_STATE yy_scan_string( yy_str ) +yyconst char *yy_str; +#endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } +#endif + + +#ifndef YY_NO_SCAN_BYTES +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +yyconst char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_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; + } +#endif + + +#ifndef YY_NO_PUSH_STATE +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (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 yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +yyconst char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + +#ifdef YY_NEED_STRLEN +#ifdef YY_USE_PROTOS +static int yy_flex_strlen( yyconst char *s ) +#else +static int yy_flex_strlen( s ) +yyconst char *s; +#endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + /* 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 ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 254 "Scanner.l" + diff --git a/cpp/demo/book/evictor_filesystem/Scanner.l b/cpp/demo/book/evictor_filesystem/Scanner.l new file mode 100644 index 00000000000..338a6742814 --- /dev/null +++ b/cpp/demo/book/evictor_filesystem/Scanner.l @@ -0,0 +1,254 @@ +%{ + +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 <Parser.h> +#include <Grammar.h> + +#if defined(_MSC_VER) && defined(ICE_64) +// +// 'initializing' : conversion from '__int64' to 'int', possible loss of data +// Puts a pointer-difference into an int +// +# pragma warning( 4 : 4244 ) +#endif + +using namespace std; + +#define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) + +%} + +WS [ \t\v\f\r] +NL [\n] + +%option noyywrap +%option always-interactive + +%% + +"//" { + // C++-style comment + int c; + do + { + c = yyinput(); + } + while(c != '\n' && c != EOF); +} + +"/*" { + // C-style comment + while(true) + { + int c = yyinput(); + if(c == '*') + { + int next = yyinput(); + if(next == '/') + { + break; + } + else + { + unput(next); + } + } + else if(c == EOF) + { + parser->warning("EOF in comment"); + break; + } + } +} + +"help" { + return TOK_HELP; +} + +"quit"|"exit" { + return TOK_EXIT; +} + +"ls" { + return TOK_LIST; +} + +"lr" { + return TOK_LIST_RECURSIVE; +} + +"mkfile" { + return TOK_CREATE_FILE; +} + +"mkdir" { + return TOK_CREATE_DIR; +} + +"pwd" { + return TOK_PWD; +} + +"cd" { + return TOK_CD; +} + +"cat" { + return TOK_CAT; +} + +"write" { + return TOK_WRITE; +} + +"rm" { + return TOK_RM; +} + +{WS}*(\\{WS}*{NL})? { + size_t len = strlen(yytext); + for(size_t i = 0; i < len; ++i) + { + if(yytext[i] == '\\') + { + parser->continueLine(); + } + } +} + +{NL}|; { + return ';'; +} + +\" { + // "..."-type strings + string s; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == '"') + { + break; + } + else if(c == EOF) + { + parser->warning("EOF in string"); + break; + } + else if(c == '\\') + { + char next = static_cast<char>(yyinput()); + switch(next) + { + case '\\': + case '"': + { + s += next; + break; + } + + case 'n': + { + s += '\n'; + break; + } + + case 'r': + { + s += '\r'; + break; + } + + case 't': + { + s += '\t'; + break; + } + + case 'v': + { + s += '\v'; + break; + } + + case 'f': + { + s += '\f'; + break; + } + + default: + { + s += c; + unput(next); + } + } + } + else + { + s += c; + } + } + yylvalp->clear(); + yylvalp->push_back(s); + return TOK_STRING; +} + +\' { + // '...'-type strings + string s; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == '\'') + { + break; + } + else if(c == EOF) + { + parser->warning("EOF in string"); + break; + } + else + { + s += c; + } + } + yylvalp->clear(); + yylvalp->push_back(s); + return TOK_STRING; +} + +. { + // Simple strings + string s; + s += yytext[0]; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == EOF) + { + break; + } + else if(isspace(c) || c == ';') + { + unput(c); + break; + } + + s += c; + } + yylvalp->clear(); + yylvalp->push_back(s); + return TOK_STRING; +} + +%% diff --git a/cpp/demo/book/freeze_filesystem/Server.cpp b/cpp/demo/book/evictor_filesystem/Server.cpp index f728d0a3851..72af8fe658d 100644 --- a/cpp/demo/book/freeze_filesystem/Server.cpp +++ b/cpp/demo/book/evictor_filesystem/Server.cpp @@ -33,8 +33,7 @@ public: // // Create an object adapter. // - Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints( - "FreezeFilesystem", "default -p 10000"); + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("EvictorFilesystem"); // // Create the Freeze evictor (stored in the NodeI::_evictor static member). diff --git a/cpp/demo/book/freeze_filesystem/book.freeze_filesystem.client.vcproj b/cpp/demo/book/evictor_filesystem/book.evictor_filesystem.client.vcproj index e992a4d2857..b39f6186f8f 100755 --- a/cpp/demo/book/freeze_filesystem/book.freeze_filesystem.client.vcproj +++ b/cpp/demo/book/evictor_filesystem/book.evictor_filesystem.client.vcproj @@ -2,9 +2,9 @@ <VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
- Name="book.freeze_filesystem.client"
+ Name="book.evictor_filesystem.client"
ProjectGUID="{66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}"
- RootNamespace="book.freeze_filesystem.client"
+ RootNamespace="book.evictor_filesystem.client"
TargetFrameworkVersion="131072"
>
<Platforms>
@@ -41,7 +41,7 @@ />
<Tool
Name="VCMIDLTool"
- TypeLibraryName=".\Debug/book.freeze_filesystem.client.tlb"
+ TypeLibraryName=".\Debug/book.evictor_filesystem.client.tlb"
HeaderFileName=""
/>
<Tool
@@ -100,7 +100,7 @@ <Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
- OutputFile=".\Debug/book.freeze_filesystem.client.bsc"
+ OutputFile=".\Debug/book.evictor_filesystem.client.bsc"
/>
<Tool
Name="VCFxCopTool"
@@ -113,14 +113,13 @@ />
</Configuration>
<Configuration
- Name="Release|Win32"
- OutputDirectory=".\Release"
- IntermediateDirectory=".\Release"
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -136,33 +135,34 @@ />
<Tool
Name="VCMIDLTool"
- TypeLibraryName=".\Release/book.freeze_filesystem.client.tlb"
+ TargetEnvironment="3"
+ TypeLibraryName=".\Debug/book.evictor_filesystem.client.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
+ Optimization="0"
AdditionalIncludeDirectories=". ; ..\..\..\..\cpp\include"
- PreprocessorDefinitions="_CONSOLE;NDEBUG;WIN32_LEAN_AND_MEAN"
- StringPooling="true"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
+ PreprocessorDefinitions="_CONSOLE;_DEBUG;WIN32_LEAN_AND_MEAN"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
RuntimeTypeInfo="true"
- PrecompiledHeaderFile=".\Release/book.freeze_filesystem.client.pch"
- AssemblerListingLocation=".\Release/"
- ObjectFile=".\Release/"
- ProgramDataBaseFileName=".\Release/"
+ PrecompiledHeaderFile="Debug/Filesystem.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
WarnAsError="true"
SuppressStartupBanner="true"
+ DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
+ PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
@@ -170,16 +170,18 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalOptions="/FIXED:NO /IGNORE:4089"
- AdditionalDependencies="Ice.lib IceUtil.lib setargv.obj"
+ AdditionalOptions="/FIXED:NO"
+ AdditionalDependencies="Iced.lib IceUtild.lib setargv.obj"
OutputFile="client.exe"
- LinkIncremental="1"
+ LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\..\cpp\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/client.pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
- TargetMachine="1"
+ TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
@@ -193,7 +195,7 @@ <Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
- OutputFile=".\Release/book.freeze_filesystem.client.bsc"
+ OutputFile=".\Debug/book.evictor_filesystem.client.bsc"
/>
<Tool
Name="VCFxCopTool"
@@ -206,13 +208,14 @@ />
</Configuration>
<Configuration
- Name="Debug|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -228,34 +231,33 @@ />
<Tool
Name="VCMIDLTool"
- TargetEnvironment="3"
- TypeLibraryName=".\Debug/book.freeze_filesystem.client.tlb"
+ TypeLibraryName=".\Release/book.evictor_filesystem.client.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="0"
+ Optimization="2"
+ InlineFunctionExpansion="1"
AdditionalIncludeDirectories=". ; ..\..\..\..\cpp\include"
- PreprocessorDefinitions="_CONSOLE;_DEBUG;WIN32_LEAN_AND_MEAN"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
+ PreprocessorDefinitions="_CONSOLE;NDEBUG;WIN32_LEAN_AND_MEAN"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
RuntimeTypeInfo="true"
- PrecompiledHeaderFile="Debug/Filesystem.pch"
- AssemblerListingLocation=".\Debug/"
- ObjectFile=".\Debug/"
- ProgramDataBaseFileName=".\Debug/"
+ PrecompiledHeaderFile=".\Release/book.evictor_filesystem.client.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
WarnAsError="true"
SuppressStartupBanner="true"
- DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
+ PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
@@ -263,18 +265,16 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalOptions="/FIXED:NO"
- AdditionalDependencies="Iced.lib IceUtild.lib setargv.obj"
+ AdditionalOptions="/FIXED:NO /IGNORE:4089"
+ AdditionalDependencies="Ice.lib IceUtil.lib setargv.obj"
OutputFile="client.exe"
- LinkIncremental="2"
+ LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\..\cpp\lib"
- GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Debug/client.pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
- TargetMachine="17"
+ TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
@@ -288,7 +288,7 @@ <Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
- OutputFile=".\Debug/book.freeze_filesystem.client.bsc"
+ OutputFile=".\Release/book.evictor_filesystem.client.bsc"
/>
<Tool
Name="VCFxCopTool"
@@ -325,7 +325,7 @@ <Tool
Name="VCMIDLTool"
TargetEnvironment="3"
- TypeLibraryName=".\Release/book.freeze_filesystem.client.tlb"
+ TypeLibraryName=".\Release/book.evictor_filesystem.client.tlb"
HeaderFileName=""
/>
<Tool
@@ -338,7 +338,7 @@ RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
RuntimeTypeInfo="true"
- PrecompiledHeaderFile=".\Release/book.freeze_filesystem.client.pch"
+ PrecompiledHeaderFile=".\Release/book.evictor_filesystem.client.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
@@ -382,7 +382,7 @@ <Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
- OutputFile=".\Release/book.freeze_filesystem.client.bsc"
+ OutputFile=".\Release/book.evictor_filesystem.client.bsc"
/>
<Tool
Name="VCFxCopTool"
@@ -414,7 +414,7 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Release|Win32"
+ Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
@@ -422,7 +422,7 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Debug|x64"
+ Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -442,6 +442,18 @@ RelativePath=".\Filesystem.cpp"
>
</File>
+ <File
+ RelativePath=".\Grammar.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Parser.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Scanner.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
@@ -451,6 +463,14 @@ RelativePath=".\Filesystem.h"
>
</File>
+ <File
+ RelativePath=".\Grammar.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Parser.h"
+ >
+ </File>
</Filter>
<Filter
Name="Resource Files"
diff --git a/cpp/demo/book/freeze_filesystem/book.freeze_filesystem.server.vcproj b/cpp/demo/book/evictor_filesystem/book.evictor_filesystem.server.vcproj index 16b4afbcf61..90515f9f343 100755 --- a/cpp/demo/book/freeze_filesystem/book.freeze_filesystem.server.vcproj +++ b/cpp/demo/book/evictor_filesystem/book.evictor_filesystem.server.vcproj @@ -2,9 +2,9 @@ <VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
- Name="book.freeze_filesystem.server"
+ Name="book.evictor_filesystem.server"
ProjectGUID="{2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}"
- RootNamespace="book.freeze_filesystem.server"
+ RootNamespace="book.evictor_filesystem.server"
TargetFrameworkVersion="131072"
>
<Platforms>
@@ -42,7 +42,7 @@ />
<Tool
Name="VCMIDLTool"
- TypeLibraryName=".\Release/book.freeze_filesystem.server.tlb"
+ TypeLibraryName=".\Release/book.evictor_filesystem.server.tlb"
HeaderFileName=""
/>
<Tool
@@ -55,7 +55,7 @@ RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
RuntimeTypeInfo="true"
- PrecompiledHeaderFile=".\Release/book.freeze_filesystem.server.pch"
+ PrecompiledHeaderFile=".\Release/book.evictor_filesystem.server.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
@@ -99,7 +99,7 @@ <Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
- OutputFile=".\Release/book.freeze_filesystem.server.bsc"
+ OutputFile=".\Release/book.evictor_filesystem.server.bsc"
/>
<Tool
Name="VCFxCopTool"
@@ -112,13 +112,14 @@ />
</Configuration>
<Configuration
- Name="Debug|Win32"
- OutputDirectory=".\Debug"
- IntermediateDirectory=".\Debug"
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -134,33 +135,34 @@ />
<Tool
Name="VCMIDLTool"
- TypeLibraryName=".\Debug/book.freeze_filesystem.server.tlb"
+ TargetEnvironment="3"
+ TypeLibraryName=".\Release/book.evictor_filesystem.server.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="0"
+ Optimization="2"
+ InlineFunctionExpansion="1"
AdditionalIncludeDirectories=". ; ..\..\..\..\cpp\include"
- PreprocessorDefinitions="_CONSOLE;_DEBUG;WIN32_LEAN_AND_MEAN"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
+ PreprocessorDefinitions="_CONSOLE;NDEBUG;WIN32_LEAN_AND_MEAN"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
RuntimeTypeInfo="true"
- PrecompiledHeaderFile="Debug/Filesystem.pch"
- AssemblerListingLocation=".\Debug/"
- ObjectFile=".\Debug/"
- ProgramDataBaseFileName=".\Debug/"
+ PrecompiledHeaderFile=".\Release/book.evictor_filesystem.server.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
WarnAsError="true"
SuppressStartupBanner="true"
- DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
+ PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
@@ -168,18 +170,16 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalOptions="/FIXED:NO"
- AdditionalDependencies="Freezed.lib Iced.lib IceUtild.lib setargv.obj"
+ AdditionalOptions="/FIXED:NO /IGNORE:4089"
+ AdditionalDependencies="Freeze.lib Ice.lib IceUtil.lib setargv.obj"
OutputFile="server.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\..\cpp\lib"
- GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Debug/server.pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
- TargetMachine="1"
+ TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
@@ -193,7 +193,7 @@ <Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
- OutputFile=".\Debug/book.freeze_filesystem.server.bsc"
+ OutputFile=".\Release/book.evictor_filesystem.server.bsc"
/>
<Tool
Name="VCFxCopTool"
@@ -206,14 +206,13 @@ />
</Configuration>
<Configuration
- Name="Release|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -229,34 +228,33 @@ />
<Tool
Name="VCMIDLTool"
- TargetEnvironment="3"
- TypeLibraryName=".\Release/book.freeze_filesystem.server.tlb"
+ TypeLibraryName=".\Debug/book.evictor_filesystem.server.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
+ Optimization="0"
AdditionalIncludeDirectories=". ; ..\..\..\..\cpp\include"
- PreprocessorDefinitions="_CONSOLE;NDEBUG;WIN32_LEAN_AND_MEAN"
- StringPooling="true"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
+ PreprocessorDefinitions="_CONSOLE;_DEBUG;WIN32_LEAN_AND_MEAN"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
RuntimeTypeInfo="true"
- PrecompiledHeaderFile=".\Release/book.freeze_filesystem.server.pch"
- AssemblerListingLocation=".\Release/"
- ObjectFile=".\Release/"
- ProgramDataBaseFileName=".\Release/"
+ PrecompiledHeaderFile="Debug/Filesystem.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
WarnAsError="true"
SuppressStartupBanner="true"
+ DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
+ PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
@@ -264,16 +262,18 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalOptions="/FIXED:NO /IGNORE:4089"
- AdditionalDependencies="Freeze.lib Ice.lib IceUtil.lib setargv.obj"
+ AdditionalOptions="/FIXED:NO"
+ AdditionalDependencies="Freezed.lib Iced.lib IceUtild.lib setargv.obj"
OutputFile="server.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\..\cpp\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/server.pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
- TargetMachine="17"
+ TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
@@ -287,7 +287,7 @@ <Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
- OutputFile=".\Release/book.freeze_filesystem.server.bsc"
+ OutputFile=".\Debug/book.evictor_filesystem.server.bsc"
/>
<Tool
Name="VCFxCopTool"
@@ -323,7 +323,7 @@ <Tool
Name="VCMIDLTool"
TargetEnvironment="3"
- TypeLibraryName=".\Debug/book.freeze_filesystem.server.tlb"
+ TypeLibraryName=".\Debug/book.evictor_filesystem.server.tlb"
HeaderFileName=""
/>
<Tool
@@ -382,7 +382,7 @@ <Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
- OutputFile=".\Debug/book.freeze_filesystem.server.bsc"
+ OutputFile=".\Debug/book.evictor_filesystem.server.bsc"
/>
<Tool
Name="VCFxCopTool"
@@ -422,7 +422,7 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Debug|Win32"
+ Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
@@ -430,7 +430,7 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Release|x64"
+ Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -458,7 +458,7 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Debug|Win32"
+ Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
@@ -466,7 +466,7 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Release|x64"
+ Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
diff --git a/cpp/demo/book/freeze_filesystem/config.client b/cpp/demo/book/evictor_filesystem/config.client index 6f0ba50b98f..6f0ba50b98f 100644 --- a/cpp/demo/book/freeze_filesystem/config.client +++ b/cpp/demo/book/evictor_filesystem/config.client diff --git a/cpp/demo/book/evictor_filesystem/config.server b/cpp/demo/book/evictor_filesystem/config.server new file mode 100644 index 00000000000..20049e1abd9 --- /dev/null +++ b/cpp/demo/book/evictor_filesystem/config.server @@ -0,0 +1,49 @@ +# +# Configure the server endpoints. +# +EvictorFilesystem.Endpoints=default -h 127.0.0.1 -p 10000 + +# +# Freeze Map Tracing. +# +# 0 = No map activity trace (default). +# 1 = Trace database open and close. +# 2 = Also trace iterator and transaction operations, and reference +# counting of the underlying database. +# +Freeze.Trace.Map=1 + +# +# Freeze Evictor Tracing. +# +# 0 = No evictor activity trace (default). +# 1 = Trace Ice object and facet creation and destruction, facet +# streaming time, facet saving time, object eviction (every 50 +# objects) and evictor deactivation. +# 2 = Also trace object lookups, and all object evictions. +# 3 = Also trace object retrieval from the database. +# +Freeze.Trace.Evictor=2 + +# +# Warn about connection exceptions +# +Ice.Warn.Connections=1 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +#Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 diff --git a/cpp/demo/book/freeze_filesystem/db/.gitignore b/cpp/demo/book/evictor_filesystem/db/.gitignore index 39af5887579..39af5887579 100644 --- a/cpp/demo/book/freeze_filesystem/db/.gitignore +++ b/cpp/demo/book/evictor_filesystem/db/.gitignore diff --git a/cpp/demo/book/evictor_filesystem/expect.py b/cpp/demo/book/evictor_filesystem/expect.py new file mode 100755 index 00000000000..6ffa1be6c03 --- /dev/null +++ b/cpp/demo/book/evictor_filesystem/expect.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2009 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. +# +# ********************************************************************** + +import sys, os + +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] +if len(path) == 0: + raise "can't find toplevel directory!" +sys.path.append(path[0]) + +from demoscript import * +from demoscript.book import evictor_filesystem + +print "cleaning databases...", +sys.stdout.flush() +Util.cleanDbDir("db") +print "ok" + +server = Util.spawn('./server --Ice.PrintAdapterReady') +server.expect('.* ready') +client = Util.spawn('./client') + +evictor_filesystem.run(client, server) diff --git a/cpp/demo/book/freeze_filesystem/.depend b/cpp/demo/book/freeze_filesystem/.depend deleted file mode 100644 index ed852e7c09a..00000000000 --- a/cpp/demo/book/freeze_filesystem/.depend +++ /dev/null @@ -1,9 +0,0 @@ -Filesystem$(OBJEXT): Filesystem.cpp Filesystem.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h -Client$(OBJEXT): Client.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.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/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h Filesystem.h -PersistentFilesystem$(OBJEXT): PersistentFilesystem.cpp PersistentFilesystem.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h Filesystem.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h -PersistentFilesystemI$(OBJEXT): PersistentFilesystemI.cpp PersistentFilesystemI.h PersistentFilesystem.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h Filesystem.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/Functional.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RWRecMutex.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/Unicode.h $(includedir)/Freeze/Freeze.h $(includedir)/Freeze/Initialize.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/ConnectionAsync.h $(includedir)/Ice/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.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 -Server$(OBJEXT): Server.cpp PersistentFilesystemI.h PersistentFilesystem.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h Filesystem.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/Functional.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RWRecMutex.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/Unicode.h $(includedir)/Freeze/Freeze.h $(includedir)/Freeze/Initialize.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/ConnectionAsync.h $(includedir)/Ice/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.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 -Filesystem.cpp: Filesystem.ice -PersistentFilesystem.cpp: PersistentFilesystem.ice ./Filesystem.ice -Filesystem.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -PersistentFilesystem.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/demo/book/freeze_filesystem/Client.cpp b/cpp/demo/book/freeze_filesystem/Client.cpp deleted file mode 100644 index f13969563ce..00000000000 --- a/cpp/demo/book/freeze_filesystem/Client.cpp +++ /dev/null @@ -1,150 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 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 <Ice/Ice.h> -#include <Filesystem.h> - -using namespace std; -using namespace Filesystem; - -// Recursively print the contents of directory "dir" in tree fashion. -// For files, show the contents of each file. The "depth" -// parameter is the current nesting level (for indentation). - -static void -listRecursive(const DirectoryPrx & dir, int depth = 0) -{ - string indent(++depth, '\t'); - - NodeDescSeq contents = dir->list(); - - for (NodeDescSeq::const_iterator i = contents.begin(); i != contents.end(); ++i) { - DirectoryPrx dir = DirectoryPrx::checkedCast(i->proxy); - FilePrx file = FilePrx::uncheckedCast(i->proxy); - cout << indent << i->name << (dir ? " (directory):" : " (file):") << endl; - if (dir) { - listRecursive(dir, depth); - } else { - Lines text = file->read(); - for (Lines::const_iterator j = text.begin(); j != text.end(); ++j) - cout << indent << "\t" << *j << endl; - } - } -} - -class FilesystemClient : public Ice::Application -{ -public: - - FilesystemClient(); - virtual int run(int argc, char* argv[]); -}; - -int -main(int argc, char* argv[]) -{ - FilesystemClient app; - return app.main(argc, argv, "config.client"); -} - -FilesystemClient::FilesystemClient() : - // - // Since this is an interactive demo we don't want any signal - // handling. - // - Ice::Application(Ice::NoSignalHandling) -{ -} - -int -FilesystemClient::run(int argc, char* argv[]) -{ - // - // Create a proxy for the root directory. - // - DirectoryPrx rootDir = DirectoryPrx::checkedCast(communicator()->propertyToProxy("RootDir.Proxy")); - if(!rootDir) - { - cerr << argv[0] << ": invalid proxy" << endl; - return EXIT_FAILURE; - } - - // - // Create a file called "README" in the root directory. - // - FilePrx readme; - try - { - readme = rootDir->createFile("README"); - Lines text; - text.push_back("This file system contains a collection of poetry."); - readme->write(text); - cout << "Created README." << endl; - } - catch(const NameInUse&) - { - NodeDesc desc = rootDir->find("README"); - readme = FilePrx::checkedCast(desc.proxy); - assert(readme); - } - - // - // Create a directory called "Coleridge" in the root directory. - // - DirectoryPrx coleridge; - try - { - coleridge = rootDir->createDirectory("Coleridge"); - cout << "Created Coleridge." << endl; - } - catch(const NameInUse&) - { - NodeDesc desc = rootDir->find("Coleridge"); - coleridge = DirectoryPrx::checkedCast(desc.proxy); - assert(coleridge); - } - - // - // Create a file called "Kubla_Khan" in the Coleridge directory. - // - FilePrx file; - try - { - file = coleridge->createFile("Kubla_Khan"); - Lines text; - text.push_back("In Xanadu did Kubla Khan"); - text.push_back("A stately pleasure-dome decree:"); - text.push_back("Where Alph, the sacred river, ran"); - text.push_back("Through caverns measureless to man"); - text.push_back("Down to a sunless sea."); - file->write(text); - cout << "Created Coleridge/Kubla_Khan." << endl; - } - catch(const NameInUse&) - { - NodeDesc desc = coleridge->find("Kubla_Khan"); - file = FilePrx::checkedCast(desc.proxy); - assert(file); - } - - cout << "Contents of filesystem:" << endl; - listRecursive(rootDir); - - // - // Destroy the filesystem. - // - cout << "Destroying " << file->name() << endl; - file->destroy(); - cout << "Destroying " << readme->name() << endl; - readme->destroy(); - cout << "Destroying " << coleridge->name() << endl; - coleridge->destroy(); - - return EXIT_SUCCESS; -} diff --git a/cpp/demo/book/lifecycle/Server.cpp b/cpp/demo/book/lifecycle/Server.cpp index 9820c3fe6c0..88445a1bb4e 100644 --- a/cpp/demo/book/lifecycle/Server.cpp +++ b/cpp/demo/book/lifecycle/Server.cpp @@ -25,7 +25,7 @@ public: // Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints( - "SimpleFilesystem", "default -p 10000"); + "SimpleFilesystem", "default -h 127.0.0.1 -p 10000"); // Create the root directory. // diff --git a/cpp/demo/book/map_filesystem/.depend b/cpp/demo/book/map_filesystem/.depend new file mode 100644 index 00000000000..5c4eaf55c1b --- /dev/null +++ b/cpp/demo/book/map_filesystem/.depend @@ -0,0 +1,13 @@ +Filesystem$(OBJEXT): Filesystem.cpp Filesystem.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h +Client$(OBJEXT): Client.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.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/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h Filesystem.h Parser.h +Parser$(OBJEXT): Parser.cpp $(includedir)/IceUtil/DisableWarnings.h Parser.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.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/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h Filesystem.h +Grammar$(OBJEXT): Grammar.cpp Parser.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.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/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h Filesystem.h +Scanner$(OBJEXT): Scanner.cpp $(includedir)/IceUtil/Config.h Parser.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.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/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h Filesystem.h Grammar.h +IdentityNodeMap$(OBJEXT): IdentityNodeMap.cpp $(includedir)/Ice/BasicStream.h $(includedir)/Ice/InstanceF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/IceUtil/StringUtil.h IdentityNodeMap.h $(includedir)/Freeze/Map.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/PropertiesF.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.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/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/Freeze/DB.h $(includedir)/Freeze/Exception.h $(includedir)/Freeze/Connection.h $(includedir)/Freeze/Transaction.h Filesystem.h PersistentFilesystem.h +PersistentFilesystem$(OBJEXT): PersistentFilesystem.cpp PersistentFilesystem.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h Filesystem.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h +PersistentFilesystemI$(OBJEXT): PersistentFilesystemI.cpp PersistentFilesystemI.h PersistentFilesystem.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h Filesystem.h IdentityNodeMap.h $(includedir)/Freeze/Map.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.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/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/Freeze/DB.h $(includedir)/Freeze/Exception.h $(includedir)/Freeze/Connection.h $(includedir)/Freeze/Transaction.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RWRecMutex.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/BackgroundSaveEvictor.h $(includedir)/Freeze/Evictor.h $(includedir)/Freeze/TransactionalEvictor.h $(includedir)/Freeze/TransactionHolder.h $(includedir)/Freeze/Catalog.h $(includedir)/Freeze/CatalogData.h +Server$(OBJEXT): Server.cpp PersistentFilesystemI.h PersistentFilesystem.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.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/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h Filesystem.h IdentityNodeMap.h $(includedir)/Freeze/Map.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.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/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/Freeze/DB.h $(includedir)/Freeze/Exception.h $(includedir)/Freeze/Connection.h $(includedir)/Freeze/Transaction.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RWRecMutex.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/BackgroundSaveEvictor.h $(includedir)/Freeze/Evictor.h $(includedir)/Freeze/TransactionalEvictor.h $(includedir)/Freeze/TransactionHolder.h $(includedir)/Freeze/Catalog.h $(includedir)/Freeze/CatalogData.h +Filesystem.cpp: Filesystem.ice +PersistentFilesystem.cpp: PersistentFilesystem.ice ./Filesystem.ice +Filesystem.ice: $(SLICE2CPP) $(SLICEPARSERLIB) +PersistentFilesystem.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/demo/book/map_filesystem/.gitignore b/cpp/demo/book/map_filesystem/.gitignore new file mode 100644 index 00000000000..c5e0ba11d3d --- /dev/null +++ b/cpp/demo/book/map_filesystem/.gitignore @@ -0,0 +1,12 @@ +// Generated by makegitignore.py + +// IMPORTANT: Do not edit this file -- any edits made here will be lost! +client +server +Filesystem.cpp +PersistentFilesystem.cpp +Filesystem.h +PersistentFilesystem.h +IdentityNodeMap.cpp +IdentityNodeMap.h +db/* diff --git a/cpp/demo/book/map_filesystem/Client.cpp b/cpp/demo/book/map_filesystem/Client.cpp new file mode 100644 index 00000000000..ee09e42dcbd --- /dev/null +++ b/cpp/demo/book/map_filesystem/Client.cpp @@ -0,0 +1,57 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 <Ice/Ice.h> +#include <Filesystem.h> +#include <Parser.h> + +using namespace std; +using namespace Filesystem; + +class FilesystemClient : public Ice::Application +{ +public: + FilesystemClient() : + // + // Since this is an interactive demo we don't want any signal + // handling. + // + Ice::Application(Ice::NoSignalHandling) + { + } + + virtual int run(int, char * []) { + + // Create a proxy for the root directory + // + Ice::ObjectPrx base = communicator()->stringToProxy("RootDir:default -p 10000"); + if(!base) + { + throw "Could not create proxy"; + } + + // Down-cast the proxy to a Directory proxy. + // + DirectoryPrx rootDir = DirectoryPrx::checkedCast(base); + if(!rootDir) + { + throw "Invalid proxy"; + } + + ParserPtr p = new Parser(rootDir); + return p->parse(); + } +}; + +int +main(int argc, char* argv[]) +{ + FilesystemClient client; + return client.main(argc, argv, "config.client"); +} diff --git a/cpp/demo/book/map_filesystem/Filesystem.ice b/cpp/demo/book/map_filesystem/Filesystem.ice new file mode 100644 index 00000000000..746148fba73 --- /dev/null +++ b/cpp/demo/book/map_filesystem/Filesystem.ice @@ -0,0 +1,52 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +module Filesystem +{ + exception GenericError + { + string reason; + }; + exception PermissionDenied extends GenericError {}; + exception NameInUse extends GenericError {}; + exception NoSuchName extends GenericError {}; + + interface Node + { + idempotent string name(); + void destroy() throws PermissionDenied; + }; + + sequence<string> Lines; + + interface File extends Node + { + idempotent Lines read(); + idempotent void write(Lines text) throws GenericError; + }; + + enum NodeType { DirType, FileType }; + + struct NodeDesc + { + string name; + NodeType type; + Node* proxy; + }; + + sequence<NodeDesc> NodeDescSeq; + + interface Directory extends Node + { + idempotent NodeDescSeq list(); + idempotent NodeDesc find(string name) throws NoSuchName; + File* createFile(string name) throws NameInUse; + Directory* createDirectory(string name) throws NameInUse; + }; +}; diff --git a/cpp/demo/book/map_filesystem/Grammar.cpp b/cpp/demo/book/map_filesystem/Grammar.cpp new file mode 100644 index 00000000000..0bc2d1fe8a7 --- /dev/null +++ b/cpp/demo/book/map_filesystem/Grammar.cpp @@ -0,0 +1,1727 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* 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 2, 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* 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.3" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOK_HELP = 258, + TOK_EXIT = 259, + TOK_STRING = 260, + TOK_LIST = 261, + TOK_LIST_RECURSIVE = 262, + TOK_CREATE_FILE = 263, + TOK_CREATE_DIR = 264, + TOK_PWD = 265, + TOK_CD = 266, + TOK_CAT = 267, + TOK_WRITE = 268, + TOK_RM = 269 + }; +#endif +/* Tokens. */ +#define TOK_HELP 258 +#define TOK_EXIT 259 +#define TOK_STRING 260 +#define TOK_LIST 261 +#define TOK_LIST_RECURSIVE 262 +#define TOK_CREATE_FILE 263 +#define TOK_CREATE_DIR 264 +#define TOK_PWD 265 +#define TOK_CD 266 +#define TOK_CAT 267 +#define TOK_WRITE 268 +#define TOK_RM 269 + + + + +/* Copy the first part of user declarations. */ +#line 1 "Grammar.y" + + +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 <Parser.h> + +#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 + +using namespace std; + +void +yyerror(const char* s) +{ + parser->error(s); +} + + + +/* 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 + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + +/* Copy the second part of user declarations. */ + + +/* Line 216 of yacc.c. */ +#line 165 "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 <stddef.h> /* 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 <libintl.h> /* 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 i) +#else +static int +YYID (i) + int i; +#endif +{ + return i; +} +#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 <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* 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 <stdlib.h> /* 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 <stdlib.h> /* 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; + YYSTYPE yyvs; + }; + +/* 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) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 27 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 45 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 16 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 5 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 21 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 30 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 269 + +#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, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 15, + 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 +}; + +#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, 6, 9, 11, 14, 17, 19, + 21, 24, 27, 29, 31, 34, 37, 40, 43, 46, + 48, 51 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 17, 0, -1, 18, -1, -1, 18, 19, -1, 19, + -1, 3, 15, -1, 4, 15, -1, 6, -1, 7, + -1, 8, 20, -1, 9, 20, -1, 10, -1, 11, + -1, 11, 20, -1, 12, 5, -1, 13, 20, -1, + 14, 20, -1, 1, 15, -1, 15, -1, 5, 20, + -1, 5, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint8 yyrline[] = +{ + 0, 52, 52, 56, 63, 66, 74, 78, 82, 86, + 90, 94, 98, 102, 106, 110, 114, 118, 122, 127, + 135, 140 +}; +#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_HELP", "TOK_EXIT", "TOK_STRING", + "TOK_LIST", "TOK_LIST_RECURSIVE", "TOK_CREATE_FILE", "TOK_CREATE_DIR", + "TOK_PWD", "TOK_CD", "TOK_CAT", "TOK_WRITE", "TOK_RM", "';'", "$accept", + "start", "commands", "command", "strings", 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, 59 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 16, 17, 17, 18, 18, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 20, 20 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 0, 2, 1, 2, 2, 1, 1, + 2, 2, 1, 1, 2, 2, 2, 2, 2, 1, + 2, 1 +}; + +/* 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, 8, 9, 0, 0, 12, 13, + 0, 0, 0, 19, 0, 0, 5, 18, 6, 7, + 21, 10, 11, 14, 15, 16, 17, 1, 4, 20 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 14, 15, 16, 21 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -14 +static const yytype_int8 yypact[] = +{ + 0, -13, -10, 3, -14, -14, 28, 28, -14, 28, + 30, 28, 28, -14, 21, 16, -14, -14, -14, -14, + 28, -14, -14, -14, -14, -14, -14, -14, -14, -14 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -14, -14, -14, 23, 25 +}; + +/* 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 -4 +static const yytype_int8 yytable[] = +{ + -3, 1, 17, 2, 3, 18, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, -2, 1, 19, 2, + 3, 27, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 22, 20, 23, 24, 25, 26, 28, 0, + 0, 0, 0, 0, 0, 29 +}; + +static const yytype_int8 yycheck[] = +{ + 0, 1, 15, 3, 4, 15, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 0, 1, 15, 3, + 4, 0, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 7, 5, 9, 5, 11, 12, 15, -1, + -1, -1, -1, -1, -1, 20 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 1, 3, 4, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 17, 18, 19, 15, 15, 15, + 5, 20, 20, 20, 5, 20, 20, 0, 19, 20 +}; + +#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 <stdio.h> /* 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 *bottom, yytype_int16 *top) +#else +static void +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + 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++) + { + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + fprintf (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. | +`----------*/ + +#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 look-ahead symbol. */ +int yychar; + +/* The semantic value of the look-ahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + 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); + YYSTACK_RELOCATE (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)); + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + look-ahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to look-ahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a look-ahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead 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; + } + + if (yyn == YYFINAL) + YYACCEPT; + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + 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 53 "Grammar.y" + { +;} + break; + + case 3: +#line 56 "Grammar.y" + { +;} + break; + + case 4: +#line 64 "Grammar.y" + { +;} + break; + + case 5: +#line 67 "Grammar.y" + { +;} + break; + + case 6: +#line 75 "Grammar.y" + { + parser->usage(); +;} + break; + + case 7: +#line 79 "Grammar.y" + { + return 0; +;} + break; + + case 8: +#line 83 "Grammar.y" + { + parser->list(false); +;} + break; + + case 9: +#line 87 "Grammar.y" + { + parser->list(true); +;} + break; + + case 10: +#line 91 "Grammar.y" + { + parser->createFile((yyvsp[(2) - (2)])); +;} + break; + + case 11: +#line 95 "Grammar.y" + { + parser->createDir((yyvsp[(2) - (2)])); +;} + break; + + case 12: +#line 99 "Grammar.y" + { + parser->pwd(); +;} + break; + + case 13: +#line 103 "Grammar.y" + { + parser->cd("/"); +;} + break; + + case 14: +#line 107 "Grammar.y" + { + parser->cd((yyvsp[(2) - (2)]).front()); +;} + break; + + case 15: +#line 111 "Grammar.y" + { + parser->cat((yyvsp[(2) - (2)]).front()); +;} + break; + + case 16: +#line 115 "Grammar.y" + { + parser->write((yyvsp[(2) - (2)])); +;} + break; + + case 17: +#line 119 "Grammar.y" + { + parser->destroy((yyvsp[(2) - (2)])); +;} + break; + + case 18: +#line 123 "Grammar.y" + { + parser->usage(); + yyerrok; +;} + break; + + case 19: +#line 128 "Grammar.y" + { +;} + break; + + case 20: +#line 136 "Grammar.y" + { + (yyval) = (yyvsp[(2) - (2)]); + (yyval).push_front((yyvsp[(1) - (2)]).front()); +;} + break; + + case 21: +#line 141 "Grammar.y" + { + (yyval) = (yyvsp[(1) - (1)]); +;} + break; + + +/* Line 1267 of yacc.c. */ +#line 1512 "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 look-ahead 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 look-ahead 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); + } + + if (yyn == YYFINAL) + YYACCEPT; + + *++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; + +#ifndef yyoverflow +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEOF && 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 146 "Grammar.y" + + diff --git a/cpp/demo/book/map_filesystem/Grammar.h b/cpp/demo/book/map_filesystem/Grammar.h new file mode 100644 index 00000000000..b5b8e41ade4 --- /dev/null +++ b/cpp/demo/book/map_filesystem/Grammar.h @@ -0,0 +1,81 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* 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 2, 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* 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_HELP = 258, + TOK_EXIT = 259, + TOK_STRING = 260, + TOK_LIST = 261, + TOK_LIST_RECURSIVE = 262, + TOK_CREATE_FILE = 263, + TOK_CREATE_DIR = 264, + TOK_PWD = 265, + TOK_CD = 266, + TOK_CAT = 267, + TOK_WRITE = 268, + TOK_RM = 269 + }; +#endif +/* Tokens. */ +#define TOK_HELP 258 +#define TOK_EXIT 259 +#define TOK_STRING 260 +#define TOK_LIST 261 +#define TOK_LIST_RECURSIVE 262 +#define TOK_CREATE_FILE 263 +#define TOK_CREATE_DIR 264 +#define TOK_PWD 265 +#define TOK_CD 266 +#define TOK_CAT 267 +#define TOK_WRITE 268 +#define TOK_RM 269 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + diff --git a/cpp/demo/book/map_filesystem/Grammar.y b/cpp/demo/book/map_filesystem/Grammar.y new file mode 100644 index 00000000000..d3d1a2bcdde --- /dev/null +++ b/cpp/demo/book/map_filesystem/Grammar.y @@ -0,0 +1,146 @@ +%{ + +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 <Parser.h> + +#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 + +using namespace std; + +void +yyerror(const char* s) +{ + parser->error(s); +} + +%} + +%pure_parser + +%token TOK_HELP +%token TOK_EXIT +%token TOK_STRING +%token TOK_LIST +%token TOK_LIST_RECURSIVE +%token TOK_CREATE_FILE +%token TOK_CREATE_DIR +%token TOK_PWD +%token TOK_CD +%token TOK_CAT +%token TOK_WRITE +%token TOK_RM + +%% + +// ---------------------------------------------------------------------- +start +// ---------------------------------------------------------------------- +: commands +{ +} +| +{ +} +; + +// ---------------------------------------------------------------------- +commands +// ---------------------------------------------------------------------- +: commands command +{ +} +| command +{ +} +; + +// ---------------------------------------------------------------------- +command +// ---------------------------------------------------------------------- +: TOK_HELP ';' +{ + parser->usage(); +} +| TOK_EXIT ';' +{ + return 0; +} +| TOK_LIST +{ + parser->list(false); +} +| TOK_LIST_RECURSIVE +{ + parser->list(true); +} +| TOK_CREATE_FILE strings +{ + parser->createFile($2); +} +| TOK_CREATE_DIR strings +{ + parser->createDir($2); +} +| TOK_PWD +{ + parser->pwd(); +} +| TOK_CD +{ + parser->cd("/"); +} +| TOK_CD strings +{ + parser->cd($2.front()); +} +| TOK_CAT TOK_STRING +{ + parser->cat($2.front()); +} +| TOK_WRITE strings +{ + parser->write($2); +} +| TOK_RM strings +{ + parser->destroy($2); +} +| error ';' +{ + parser->usage(); + yyerrok; +} +| ';' +{ +} +; + +// ---------------------------------------------------------------------- +strings +// ---------------------------------------------------------------------- +: TOK_STRING strings +{ + $$ = $2; + $$.push_front($1.front()); +} +| TOK_STRING +{ + $$ = $1; +} +; + +%% diff --git a/cpp/demo/book/map_filesystem/Makefile b/cpp/demo/book/map_filesystem/Makefile new file mode 100644 index 00000000000..a4eb1c27d40 --- /dev/null +++ b/cpp/demo/book/map_filesystem/Makefile @@ -0,0 +1,58 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2009 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 = ../../.. + +CLIENT = client +SERVER = server + +TARGETS = $(CLIENT) $(SERVER) + +OBJS = Filesystem.o + +COBJS = Client.o \ + Parser.o \ + Grammar.o \ + Scanner.o + +SOBJS = IdentityNodeMap.o \ + PersistentFilesystem.o \ + PersistentFilesystemI.o \ + Server.o + +SRCS = $(OBJS:.o=.cpp) \ + $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) \ + $(COLOBJS:.o=.cpp) + +SLICE_SRCS = Filesystem.ice PersistentFilesystem.ice + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := -I. $(READLINE_FLAGS) $(CPPFLAGS) +SLICE2CPPFLAGS := -I. $(SLICE2CPPFLAGS) + +$(CLIENT): $(OBJS) $(COBJS) + rm -f $@ + $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) $(READLINE_LIBS) + +$(SERVER): $(OBJS) $(SOBJS) + rm -f $@ + $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(DB_RPATH_LINK) -lFreeze $(LIBS) + +IdentityNodeMap.h: IdentityNodeMap.cpp +IdentityNodeMap.cpp: PersistentFilesystem.ice Filesystem.ice $(SLICE2FREEZE) $(SLICEPARSERLIB) + rm -f IdentityNodeMap.h IdentityNodeMap.cpp + $(SLICE2FREEZE) -I$(slicedir) -I. --ice --dict IdentityNodeMap,Ice::Identity,Filesystem::PersistentNode \ + IdentityNodeMap Filesystem.ice PersistentFilesystem.ice $(slicedir)/Ice/Identity.ice +clean:: + -rm -f db/* + -rm -f IdentityNodeMap.h IdentityNodeMap.cpp + +include .depend diff --git a/cpp/demo/book/map_filesystem/Makefile.mak b/cpp/demo/book/map_filesystem/Makefile.mak new file mode 100644 index 00000000000..a37550621a7 --- /dev/null +++ b/cpp/demo/book/map_filesystem/Makefile.mak @@ -0,0 +1,81 @@ +# **********************************************************************
+#
+# Copyright (c) 2003-2009 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 = ..\..\..
+
+CLIENT = client.exe
+SERVER = server.exe
+
+TARGETS = $(CLIENT) $(SERVER)
+
+OBJS = Filesystem.obj
+
+COBJS = Scanner.obj \
+ Grammar.obj \
+ Parser.obj \
+ Client.obj
+
+SOBJS = IdentityNodeMap.obj \
+ PersistentFilesystem.obj \
+ PersistentFilesystemI.obj \
+ Server.obj
+
+SRCS = $(OBJS:.obj=.cpp) \
+ $(COBJS:.obj=.cpp) \
+ $(SOBJS:.obj=.cpp)
+
+!include $(top_srcdir)/config/Make.rules.mak
+
+CPPFLAGS = -I. -Idummyinclude $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+SLICE2CPPFLAGS = -I. $(SLICE2CPPFLAGS)
+
+!if "$(GENERATE_PDB)" == "yes"
+CPDBFLAGS = /pdb:$(CLIENT:.exe=.pdb)
+SPDBFLAGS = /pdb:$(SERVER:.exe=.pdb)
+!endif
+
+$(CLIENT): $(OBJS) $(COBJS)
+ $(LINK) $(LD_EXEFLAGS) $(CPDBFLAGS) $(SETARGV) $(OBJS) $(COBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS)
+ @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \
+ $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest
+
+$(SERVER): $(OBJS) $(SOBJS)
+ $(LINK) $(LD_EXEFLAGS) $(SPDBFLAGS) $(SETARGV) $(OBJS) $(SOBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS) freeze$(LIBSUFFIX).lib
+ @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \
+ $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest
+
+IdentityNodeMap.h: IdentityNodeMap.cpp
+IdentityNodeMap.cpp: PersistentFilesystem.ice Filesystem.ice $(SLICE2FREEZE) $(SLICEPARSERLIB)
+ del /q IdentityNodeMap.h IdentityNodeMap.cpp
+ $(SLICE2FREEZE) -I$(slicedir) -I. --ice --dict IdentityNodeMap,Ice::Identity,Filesystem::PersistentNode \
+ IdentityNodeMap Filesystem.ice PersistentFilesystem.ice $(slicedir)/Ice/Identity.ice
+
+Scanner.cpp: Scanner.l
+ flex Scanner.l
+ -del /q $@
+ echo #include "IceUtil/Config.h" > Scanner.cpp
+ type lex.yy.c >> Scanner.cpp
+ -del /q lex.yy.c
+
+Grammar.cpp Grammar.h: Grammar.y
+ -del /q Grammar.h Grammar.cpp
+ bison -dvt Grammar.y
+ move Grammar.tab.c Grammar.cpp
+ move Grammar.tab.h Grammar.h
+ -del /q Grammar.output
+
+clean::
+ -del /q Filesystem.cpp Filesystem.h
+ -del /q PersistentFilesystem.cpp PersistentFilesystem.h
+ -del /q IdentityNodeMap.cpp IdentityNodeMap.h
+
+clean::
+ -for %f in (db\*) do if not %f == db\.gitignore del /q %f
+
+!include .depend
diff --git a/cpp/demo/book/map_filesystem/Parser.cpp b/cpp/demo/book/map_filesystem/Parser.cpp new file mode 100644 index 00000000000..cb4c3411d97 --- /dev/null +++ b/cpp/demo/book/map_filesystem/Parser.cpp @@ -0,0 +1,438 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <IceUtil/DisableWarnings.h> +#include <Parser.h> + +#ifdef HAVE_READLINE +# include <readline/readline.h> +# include <readline/history.h> +#endif + +using namespace std; +using namespace Filesystem; + +extern FILE* yyin; + +Parser* parser; + +Parser::Parser(const DirectoryPrx& root) +{ + _dirs.push_front(root); +} + +void +Parser::usage() +{ + cout << + "help Print this message.\n" + "pwd Print current directory (/ = root).\n" + "cd [DIR] Change directory (/ or empty = root).\n" + "ls List current directory.\n" + "lr Recursively list current directory.\n" + "mkdir DIR [DIR...] Create directories DIR in current directory.\n" + "mkfile FILE [FILE...] Create files FILE in current directory.\n" + "rm NAME [NAME...] Delete directory or file NAME (rm * to delete all).\n" + "cat FILE List the contents of FILE.\n" + "write FILE [STRING...] Write STRING to FILE.\n" + "exit, quit Exit this program.\n"; +} + +// Print the contents of directory "dir". If recursive is true, +// print in tree fashion. +// For files, show the contents of each file. The "depth" +// parameter is the current nesting level (for indentation). + +void +Parser::list(bool recursive) +{ + list(_dirs.front(), recursive, 0); +} + +void +Parser::list(const DirectoryPrx& dir, bool recursive, int depth) +{ + string indent(depth++, '\t'); + + NodeDescSeq contents = dir->list(); + + for(NodeDescSeq::const_iterator i = contents.begin(); i != contents.end(); ++i) + { + DirectoryPrx d = i->type == DirType ? DirectoryPrx::uncheckedCast(i->proxy) : (DirectoryPrx)0; + cout << indent << i->name << (d ? " (directory)" : " (file)"); + if(d && recursive) + { + cout << ":" << endl; + list(d, true, depth); + } + else + { + cout << endl; + } + } +} + +void +Parser::createFile(const std::list<string>& names) +{ + DirectoryPrx dir = _dirs.front(); + + for(std::list<string>::const_iterator i = names.begin(); i != names.end(); ++i) + { + if(*i == "..") + { + cout << "Cannot create a file named `..'" << endl; + continue; + } + + try + { + dir->createFile(*i); + } + catch(const NameInUse&) + { + cout << "`" << *i << "' exists already" << endl; + } + } +} + +void +Parser::createDir(const std::list<string>& names) +{ + DirectoryPrx dir = _dirs.front(); + + for(std::list<string>::const_iterator i = names.begin(); i != names.end(); ++i) + { + if(*i == "..") + { + cout << "Cannot create a directory named `.'" << endl; + continue; + } + + try + { + dir->createDirectory(*i); + } + catch(const NameInUse&) + { + cout << "`" << *i << "' exists already" << endl; + } + } +} + +void +Parser::pwd() +{ + if(_dirs.size() == 1) + { + cout << "/"; + } + else + { + // COMPILERFIX: Should be const_reverse_iterator, but that won't compile with + // gcc because operator!= is missing. + // + std::list<DirectoryPrx>::reverse_iterator i = _dirs.rbegin(); + ++i; + while(i != _dirs.rend()) + { + cout << "/" << (*i)->name(); + ++i; + } + } + cout << endl; +} + +void +Parser::cd(const string& name) +{ + if(name == "/") + { + while(_dirs.size() > 1) + { + _dirs.pop_front(); + } + return; + } + + if(name == "..") + { + if(_dirs.size() > 1) + { + _dirs.pop_front(); + } + return; + } + + DirectoryPrx dir = _dirs.front(); + NodeDesc d; + try + { + d = dir->find(name); + } + catch(const NoSuchName&) + { + cout << "`" << name << "': no such directory" << endl; + return; + } + if(d.type == FileType) + { + cout << "`" << name << "': not a directory" << endl; + return; + } + _dirs.push_front(DirectoryPrx::uncheckedCast(d.proxy)); +} + +void +Parser::cat(const string& name) +{ + DirectoryPrx dir = _dirs.front(); + NodeDesc d; + try + { + d = dir->find(name); + } + catch(const NoSuchName&) + { + cout << "`" << name << "': no such file" << endl; + return; + } + if(d.type == DirType) + { + cout << "`" << name << "': not a file" << endl; + return; + } + FilePrx f = FilePrx::uncheckedCast(d.proxy); + Lines l = f->read(); + for(Lines::const_iterator i = l.begin(); i != l.end(); ++i) + { + cout << *i << endl; + } +} + +void +Parser::write(std::list<string>& args) +{ + DirectoryPrx dir = _dirs.front(); + string name = args.front(); + args.pop_front(); + NodeDesc d; + try + { + d = dir->find(name); + } + catch(const NoSuchName&) + { + cout << "`" << name << "': no such file" << endl; + return; + } + if(d.type == DirType) + { + cout << "`" << name << "': not a file" << endl; + return; + } + FilePrx f = FilePrx::uncheckedCast(d.proxy); + + Lines l; + for(std::list<string>::const_iterator i = args.begin(); i != args.end(); ++i) + { + l.push_back(*i); + } + f->write(l); +} + +void +Parser::destroy(const std::list<string>& names) +{ + DirectoryPrx dir = _dirs.front(); + + for(std::list<string>::const_iterator i = names.begin(); i != names.end(); ++i) + { + if(*i == "*") + { + NodeDescSeq nodes = dir->list(); + for(NodeDescSeq::iterator j = nodes.begin(); j != nodes.end(); ++j) + { + try + { + j->proxy->destroy(); + } + catch(const PermissionDenied& ex) + { + cout << "cannot remove `" << j->name << "': " << ex.reason << endl; + } + } + return; + } + else + { + NodeDesc d; + try + { + d = dir->find(*i); + } + catch(const NoSuchName&) + { + cout << "`" << *i << "': no such file or directory" << endl; + return; + } + try + { + d.proxy->destroy(); + } + catch(const PermissionDenied& ex) + { + cout << "cannot remove `" << *i << "': " << ex.reason << endl; + } + } + } +} + +void +Parser::getInput(char* buf, int& result, int maxSize) +{ +#ifdef HAVE_READLINE + + const char* prompt = parser->getPrompt(); + char* line = readline(const_cast<char*>(prompt)); + if(!line) + { + result = 0; + } + else + { + if(*line) + { + add_history(line); + } + + result = strlen(line) + 1; + if(result > maxSize) + { + free(line); + error("input line too long"); + result = 0; + } + else + { + strcpy(buf, line); + strcat(buf, "\n"); + free(line); + } + } + +#else + + cout << parser->getPrompt() << flush; + + string line; + while(true) + { + char c = static_cast<char>(getc(yyin)); + if(c == EOF) + { + if(line.size()) + { + line += '\n'; + } + break; + } + + line += c; + + if(c == '\n') + { + break; + } + } + + result = static_cast<int>(line.length()); + if(result > maxSize) + { + error("input line too long"); + buf[0] = EOF; + result = 1; + } + else + { + strcpy(buf, line.c_str()); + } + +#endif +} + +void +Parser::continueLine() +{ + _continue = true; +} + +const char* +Parser::getPrompt() +{ + if(_continue) + { + _continue = false; + return "(cont) "; + } + else + { + return "> "; + } +} + +void +Parser::error(const char* s) +{ + cerr << "error: " << s << endl; + _errors++; +} + +void +Parser::error(const string& s) +{ + error(s.c_str()); +} + +void +Parser::warning(const char* s) +{ + cerr << "warning: " << s << endl; +} + +void +Parser::warning(const string& s) +{ + warning(s.c_str()); +} + +int +Parser::parse(bool debug) +{ + extern int yydebug; + yydebug = debug ? 1 : 0; + + assert(!parser); + parser = this; + + _errors = 0; + yyin = stdin; + assert(yyin); + + _continue = false; + + int status = yyparse(); + if(_errors) + { + status = EXIT_FAILURE; + } + + parser = 0; + return status; +} diff --git a/cpp/demo/book/map_filesystem/Parser.h b/cpp/demo/book/map_filesystem/Parser.h new file mode 100644 index 00000000000..648812abfaa --- /dev/null +++ b/cpp/demo/book/map_filesystem/Parser.h @@ -0,0 +1,83 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 PARSER_H +#define PARSER_H + +#include <Ice/Ice.h> +#include <Filesystem.h> +#include <list> +#include <stdio.h> + +// +// Stuff for flex and bison +// + +#define YYSTYPE std::list<std::string> +#define YY_DECL int yylex(YYSTYPE* yylvalp) +YY_DECL; +int yyparse(); + +// +// 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) yyerror(a) + +class Parser; +typedef IceUtil::Handle<Parser> ParserPtr; + +class Parser : public IceUtil::SimpleShared +{ +public: + Parser(const Filesystem::DirectoryPrx&); + + void usage(); + void list(bool); + void list(const Filesystem::DirectoryPrx&, bool, int); + void createFile(const ::std::list< ::std::string>&); + void createDir(const ::std::list< ::std::string>&); + void pwd(); + void cd(const ::std::string&); + void cat(const ::std::string&); + void write(::std::list< ::std::string>&); + void destroy(const ::std::list< ::std::string>&); + + void getInput(char*, int&, int); + void continueLine(); + const char* getPrompt(); + + void error(const char*); + void error(const std::string&); + + void warning(const char*); + void warning(const std::string&); + + int parse(bool = false); + +private: + ::std::list<Filesystem::DirectoryPrx> _dirs; + + bool _continue; + int _errors; +}; + +extern Parser* parser; // The current parser for bison/flex + +#endif diff --git a/cpp/demo/book/map_filesystem/PersistentFilesystem.ice b/cpp/demo/book/map_filesystem/PersistentFilesystem.ice new file mode 100644 index 00000000000..356c0e10454 --- /dev/null +++ b/cpp/demo/book/map_filesystem/PersistentFilesystem.ice @@ -0,0 +1,35 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 <Filesystem.ice> + +module Filesystem +{ + class PersistentDirectory; + + class PersistentNode + { + string name; + PersistentDirectory* parent; + }; + + ["cpp:virtual"] + class PersistentFile extends PersistentNode + { + Lines text; + }; + + dictionary<string, NodeDesc> NodeDict; + + ["cpp:virtual"] + class PersistentDirectory extends PersistentNode + { + NodeDict nodes; + }; +}; diff --git a/cpp/demo/book/map_filesystem/PersistentFilesystemI.cpp b/cpp/demo/book/map_filesystem/PersistentFilesystemI.cpp new file mode 100644 index 00000000000..7e43e877125 --- /dev/null +++ b/cpp/demo/book/map_filesystem/PersistentFilesystemI.cpp @@ -0,0 +1,283 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 <PersistentFilesystemI.h> +#include <Freeze/Freeze.h> + +using namespace std; + +// +// Filesystem::NodeI +// + +IdentityNodeMap* Filesystem::NodeI::_map; + +Filesystem::NodeI::NodeI(const DirectoryIPtr& parent) + : _parent(parent), _destroyed(false) +{ +} + +// +// Filesystem::FileI +// + +void +Filesystem::FileI::destroy(const Ice::Current& c) +{ + IceUtil::Mutex::Lock lock(_nodeMutex); + + if(_destroyed) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); + } + _destroyed = true; + _parent->removeEntry(_file->name); + _map->erase(c.id); + c.adapter->remove(c.id); +} + +string +Filesystem::FileI::name(const Ice::Current& c) +{ + IceUtil::Mutex::Lock lock(_nodeMutex); + + if(_destroyed) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); + } + + return _file->name; +} + + +Filesystem::Lines +Filesystem::FileI::read(const Ice::Current& c) +{ + IceUtil::Mutex::Lock lock(_nodeMutex); + + if(_destroyed) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); + } + + return _file->text; +} + +void +Filesystem::FileI::write(const Filesystem::Lines& text, const Ice::Current& c) +{ + IceUtil::Mutex::Lock lock(_nodeMutex); + + if(_destroyed) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); + } + + _file->text = text; + _map->put(make_pair(c.id, _file)); +} + +Filesystem::FileI::FileI(const PersistentFilePtr& file, const DirectoryIPtr& parent) + : NodeI(parent), _file(file) +{ +} + +// +// Filesystem::DirectoryI +// + +Ice::CommunicatorPtr Filesystem::DirectoryI::_communicator; +Ice::ObjectAdapterPtr Filesystem::DirectoryI::_adapter; + +void +Filesystem::DirectoryI::destroy(const Ice::Current& c) +{ + IceUtil::Mutex::Lock lock(_nodeMutex); + + if(!_parent) + { + throw Filesystem::PermissionDenied("Cannot destroy root directory"); + } + if(_destroyed) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); + } + if(!_dir->nodes.empty()) + { + throw Filesystem::PermissionDenied("Cannot destroy non-empty directory"); + } + _destroyed = true; + _parent->removeEntry(_dir->name); + _map->erase(c.id); + c.adapter->remove(c.id); +} + +string +Filesystem::DirectoryI::name(const Ice::Current& c) +{ + IceUtil::Mutex::Lock lock(_nodeMutex); + + if(_destroyed) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); + } + + return _dir->name; +} + +Filesystem::NodeDescSeq +Filesystem::DirectoryI::list(const Ice::Current& c) +{ + IceUtil::Mutex::Lock lock(_nodeMutex); + + if(_destroyed) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); + } + + NodeDict::const_iterator p; + NodeDescSeq result; + for(p = _dir->nodes.begin(); p != _dir->nodes.end(); ++p) + { + result.push_back(p->second); + } + return result; +} + +Filesystem::NodeDesc +Filesystem::DirectoryI::find(const string& name, const Ice::Current& c) +{ + IceUtil::Mutex::Lock lock(_nodeMutex); + + if(_destroyed) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); + } + + NodeDict::const_iterator p = _dir->nodes.find(name); + if(p == _dir->nodes.end()) + { + throw NoSuchName(name); + } + return p->second; +} + +Filesystem::DirectoryPrx +Filesystem::DirectoryI::createDirectory(const string& name, const Ice::Current& c) +{ + IceUtil::Mutex::Lock lock(_nodeMutex); + + if(_destroyed) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); + } + + if(name.empty() || _dir->nodes.find(name) != _dir->nodes.end()) + { + throw NameInUse(name); + } + + PersistentDirectoryPtr persistentDir = new PersistentDirectory; + persistentDir->name = name; + Ice::Identity id = _communicator->stringToIdentity(IceUtil::generateUUID()); + DirectoryIPtr dir = new DirectoryI(id, persistentDir, this); + _map->put(make_pair(id, persistentDir)); + + DirectoryPrx proxy = DirectoryPrx::uncheckedCast(c.adapter->createProxy(id)); + + NodeDesc nd; + nd.name = name; + nd.type = DirType; + nd.proxy = proxy; + _dir->nodes[name] = nd; + + _map->put(make_pair(c.id, _dir)); + + _adapter->add(dir, id); + + return proxy; +} + +Filesystem::FilePrx +Filesystem::DirectoryI::createFile(const string& name, const Ice::Current& c) +{ + IceUtil::Mutex::Lock lock(_nodeMutex); + + if(_destroyed) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); + } + + if(name.empty() || _dir->nodes.find(name) != _dir->nodes.end()) + { + throw NameInUse(name); + } + + PersistentFilePtr persistentFile = new PersistentFile; + persistentFile->name = name; + FileIPtr file = new FileI(persistentFile, this); + Ice::Identity id = _communicator->stringToIdentity(IceUtil::generateUUID()); + _map->put(make_pair(id, persistentFile)); + + FilePrx proxy = FilePrx::uncheckedCast(c.adapter->createProxy(id)); + + NodeDesc nd; + nd.name = name; + nd.type = FileType; + nd.proxy = proxy; + _dir->nodes[name] = nd; + + _map->put(make_pair(c.id, _dir)); + + _adapter->add(file, id); + + return proxy; +} + +// +// Called by the child to remove itself from the parent's node map when the child is destroyed. +// +void +Filesystem::DirectoryI::removeEntry(const string& name) +{ + IceUtil::Mutex::Lock lock(_nodeMutex); + + NodeDict::iterator p = _dir->nodes.find(name); + assert(p != _dir->nodes.end()); + _dir->nodes.erase(p); + _map->put(make_pair(_id, _dir)); +} + +Filesystem::DirectoryI::DirectoryI(const Ice::Identity& pid, + const PersistentDirectoryPtr& pdir, + const DirectoryIPtr& parent) + : NodeI(parent), _id(pid), _dir(pdir) +{ + // Instantiate the child nodes + // + for(NodeDict::iterator p = _dir->nodes.begin(); p != _dir->nodes.end(); ++p) + { + Ice::Identity id = p->second.proxy->ice_getIdentity(); + PersistentNodePtr node = _map->find(id)->second; + if(p->second.type == DirType) + { + PersistentDirectoryPtr pDir = PersistentDirectoryPtr::dynamicCast(node); + assert(pDir); + DirectoryIPtr d = new DirectoryI(id, pDir, this); + _adapter->add(d, id); + } + else + { + PersistentFilePtr pFile = PersistentFilePtr::dynamicCast(node); + assert(pFile); + FileIPtr f = new FileI(pFile, this); + _adapter->add(f, id); + } + } +} diff --git a/cpp/demo/book/map_filesystem/PersistentFilesystemI.h b/cpp/demo/book/map_filesystem/PersistentFilesystemI.h new file mode 100644 index 00000000000..d3b52effed6 --- /dev/null +++ b/cpp/demo/book/map_filesystem/PersistentFilesystemI.h @@ -0,0 +1,85 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 PERSISTENT_FILESYSTEM_I_H +#define PERSISTENT_FILESYSTEM_I_H + +#include <PersistentFilesystem.h> +#include <IdentityNodeMap.h> +#include <IceUtil/IceUtil.h> + +namespace Filesystem +{ + +class DirectoryI; +typedef IceUtil::Handle<DirectoryI> DirectoryIPtr; + +class NodeI : virtual public Node +{ +protected: + + NodeI(const DirectoryIPtr&); + PersistentNodePtr find(const Ice::Identity&) const; + + const DirectoryIPtr _parent; + IceUtil::Mutex _nodeMutex; + bool _destroyed; + +public: + + static IdentityNodeMap* _map; +}; + +typedef IceUtil::Handle<NodeI> NodeIPtr; + +class FileI : virtual public File, virtual public NodeI +{ +public: + + virtual void destroy(const Ice::Current&); + + virtual std::string name(const Ice::Current&); + virtual Lines read(const Ice::Current&); + virtual void write(const Lines&, const Ice::Current&); + + FileI(const PersistentFilePtr&, const DirectoryIPtr&); + +private: + + PersistentFilePtr _file; +}; +typedef IceUtil::Handle<FileI> FileIPtr; + +class DirectoryI : virtual public Directory, virtual public NodeI +{ +public: + + virtual void destroy(const Ice::Current&); + + virtual std::string name(const Ice::Current&); + virtual NodeDescSeq list(const Ice::Current&); + virtual NodeDesc find(const std::string&, const Ice::Current&); + virtual DirectoryPrx createDirectory(const std::string&, const Ice::Current&); + virtual FilePrx createFile(const std::string&, const Ice::Current&); + virtual void removeEntry(const std::string&); + + DirectoryI(const Ice::Identity& id, const PersistentDirectoryPtr&, const DirectoryIPtr&); + + static Ice::CommunicatorPtr _communicator; + static Ice::ObjectAdapterPtr _adapter; + +private: + + Ice::Identity _id; + PersistentDirectoryPtr _dir; +}; + +} + +#endif diff --git a/cpp/demo/book/freeze_filesystem/README b/cpp/demo/book/map_filesystem/README index 1eb77d69e29..80cb462be7e 100644 --- a/cpp/demo/book/freeze_filesystem/README +++ b/cpp/demo/book/map_filesystem/README @@ -1,5 +1,6 @@ This demo presents an alternate implementation of the filesystem -application, as discussed in the Freeze chapter of the Ice manual. +application using a Freeze map, as discussed in the Freeze chapter of +the Ice manual. To run it, start the server in a window: diff --git a/cpp/demo/book/map_filesystem/Scanner.cpp b/cpp/demo/book/map_filesystem/Scanner.cpp new file mode 100644 index 00000000000..ca387ed1b56 --- /dev/null +++ b/cpp/demo/book/map_filesystem/Scanner.cpp @@ -0,0 +1,1848 @@ +#include "IceUtil/Config.h"
+/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include <stdio.h> +#include <errno.h> + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include <stdlib.h> +#ifndef _WIN32 +#include <unistd.h> +#endif + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include <io.h> +#include <stdlib.h> +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#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 yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +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; + + /* 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 yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* 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". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + + +#define yywrap() 1 +#define YY_SKIP_YYWRAP +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 19 +#define YY_END_OF_BUFFER 20 +static yyconst short int yy_accept[56] = + { 0, + 14, 14, 20, 18, 14, 15, 16, 17, 18, 15, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 14, 0, 2, 1, 0, 14, 0, 10, 0, 0, + 6, 5, 0, 0, 0, 13, 0, 11, 0, 0, + 0, 0, 9, 0, 0, 4, 3, 0, 0, 0, + 8, 0, 12, 7, 0 + } ; + +static yyconst int 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, 1, 4, 1, 1, 1, 1, 5, 1, + 1, 6, 1, 1, 1, 1, 7, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 8, 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, 9, 1, 1, 1, 1, 10, 1, 11, 12, + + 13, 14, 1, 15, 16, 1, 17, 18, 19, 1, + 1, 20, 21, 22, 23, 24, 25, 1, 26, 27, + 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, 1, 1 + } ; + +static yyconst int yy_meta[28] = + { 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 + } ; + +static yyconst short int yy_base[56] = + { 0, + 0, 0, 69, 70, 26, 70, 70, 70, 23, 70, + 29, 24, 41, 54, 15, 49, 39, 39, 44, 40, + 31, 39, 70, 70, 41, 70, 37, 70, 44, 41, + 70, 70, 33, 46, 41, 70, 40, 70, 31, 34, + 37, 36, 70, 27, 26, 70, 70, 27, 30, 33, + 70, 26, 70, 70, 70 + } ; + +static yyconst short int yy_def[56] = + { 0, + 55, 1, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 0 + } ; + +static yyconst short int yy_nxt[98] = + { 0, + 4, 5, 6, 7, 8, 4, 9, 10, 11, 4, + 12, 4, 13, 4, 14, 4, 4, 15, 16, 17, + 18, 19, 4, 4, 4, 20, 4, 21, 23, 24, + 25, 26, 21, 27, 22, 28, 31, 32, 54, 22, + 25, 26, 25, 26, 41, 53, 42, 52, 51, 50, + 46, 49, 48, 47, 46, 45, 44, 43, 40, 39, + 38, 37, 36, 35, 34, 33, 30, 29, 55, 3, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55 + + } ; + +static yyconst short int yy_chk[98] = + { 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, 5, 9, 9, + 11, 11, 21, 12, 5, 12, 15, 15, 52, 21, + 22, 22, 25, 25, 33, 50, 33, 49, 48, 45, + 44, 42, 41, 40, 39, 37, 35, 34, 30, 29, + 27, 20, 19, 18, 17, 16, 14, 13, 3, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55 + + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +/* 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 *yytext; +#line 1 "Scanner.l" +#define INITIAL 0 +#line 2 "Scanner.l" + +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 <Parser.h> +#include <Grammar.h> + +#if defined(_MSC_VER) && defined(ICE_64) +// +// 'initializing' : conversion from '__int64' to 'int', possible loss of data +// Puts a pointer-difference into an int +// +# pragma warning( 4 : 4244 ) +#endif + +using namespace std; + +#define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) + +#define YY_ALWAYS_INTERACTIVE 1 +#line 433 "lex.yy.c" + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen YY_PROTO(( yyconst char * )); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +#endif + +#if YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include <stdlib.h> +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#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 (void) fwrite( yytext, yyleng, 1, yyout ) +#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->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + } +#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 + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL int yylex YY_PROTO(( void )) +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * 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 + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 35 "Scanner.l" + + +#line 598 "lex.yy.c" + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *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 >= 56 ) + 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_base[yy_current_state] != 70 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + 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 37 "Scanner.l" +{ + // C++-style comment + int c; + do + { + c = yyinput(); + } + while(c != '\n' && c != EOF); +} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 47 "Scanner.l" +{ + // C-style comment + while(true) + { + int c = yyinput(); + if(c == '*') + { + int next = yyinput(); + if(next == '/') + { + break; + } + else + { + unput(next); + } + } + else if(c == EOF) + { + parser->warning("EOF in comment"); + break; + } + } +} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 72 "Scanner.l" +{ + return TOK_HELP; +} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 76 "Scanner.l" +{ + return TOK_EXIT; +} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 80 "Scanner.l" +{ + return TOK_LIST; +} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 84 "Scanner.l" +{ + return TOK_LIST_RECURSIVE; +} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 88 "Scanner.l" +{ + return TOK_CREATE_FILE; +} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 92 "Scanner.l" +{ + return TOK_CREATE_DIR; +} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 96 "Scanner.l" +{ + return TOK_PWD; +} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 100 "Scanner.l" +{ + return TOK_CD; +} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 104 "Scanner.l" +{ + return TOK_CAT; +} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 108 "Scanner.l" +{ + return TOK_WRITE; +} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 112 "Scanner.l" +{ + return TOK_RM; +} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 116 "Scanner.l" +{ + size_t len = strlen(yytext); + for(size_t i = 0; i < len; ++i) + { + if(yytext[i] == '\\') + { + parser->continueLine(); + } + } +} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 127 "Scanner.l" +{ + return ';'; +} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 131 "Scanner.l" +{ + // "..."-type strings + string s; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == '"') + { + break; + } + else if(c == EOF) + { + parser->warning("EOF in string"); + break; + } + else if(c == '\\') + { + char next = static_cast<char>(yyinput()); + switch(next) + { + case '\\': + case '"': + { + s += next; + break; + } + + case 'n': + { + s += '\n'; + break; + } + + case 'r': + { + s += '\r'; + break; + } + + case 't': + { + s += '\t'; + break; + } + + case 'v': + { + s += '\v'; + break; + } + + case 'f': + { + s += '\f'; + break; + } + + default: + { + s += c; + unput(next); + } + } + } + else + { + s += c; + } + } + yylvalp->clear(); + yylvalp->push_back(s); + return TOK_STRING; +} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 205 "Scanner.l" +{ + // '...'-type strings + string s; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == '\'') + { + break; + } + else if(c == EOF) + { + parser->warning("EOF in string"); + break; + } + else + { + s += c; + } + } + yylvalp->clear(); + yylvalp->push_back(s); + return TOK_STRING; +} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 230 "Scanner.l" +{ + // Simple strings + string s; + s += yytext[0]; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == EOF) + { + break; + } + else if(isspace(c) || c == ';') + { + unput(c); + break; + } + + s += c; + } + yylvalp->clear(); + yylvalp->push_back(s); + return TOK_STRING; +} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 254 "Scanner.l" +ECHO; + YY_BREAK +#line 957 "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->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 yyin at a new source and called + * yylex(). 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->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->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->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_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, 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->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 yylex */ + + +/* 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() + { + register char *dest = yy_current_buffer->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->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->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->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->yy_n_chars = yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* 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. */ + yy_flex_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->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + + yy_current_buffer->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; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->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() + { + 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 >= 56 ) + 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 ); + */ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { + 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 >= 56 ) + 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 == 55); + + return yy_is_jam ? 0 : yy_current_state; + } + + +#ifndef YY_NO_UNPUT +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->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->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->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; + } +#endif /* ifndef YY_NO_UNPUT */ + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#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->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. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + 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 yytext */ + yy_hold_char = *++yy_c_buf_p; + + + return c; + } + + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + 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->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_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 *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +#ifndef _WIN32 +#include <unistd.h> +#else +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif +#endif + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +#if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + 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 ) + yy_load_buffer_state(); + } + + +#ifndef YY_NO_SCAN_BUFFER +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + 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) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_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; + + yy_switch_to_buffer( b ); + + return b; + } +#endif + + +#ifndef YY_NO_SCAN_STRING +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) +#else +YY_BUFFER_STATE yy_scan_string( yy_str ) +yyconst char *yy_str; +#endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } +#endif + + +#ifndef YY_NO_SCAN_BYTES +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +yyconst char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_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; + } +#endif + + +#ifndef YY_NO_PUSH_STATE +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (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 yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +yyconst char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + +#ifdef YY_NEED_STRLEN +#ifdef YY_USE_PROTOS +static int yy_flex_strlen( yyconst char *s ) +#else +static int yy_flex_strlen( s ) +yyconst char *s; +#endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + /* 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 ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 254 "Scanner.l" + diff --git a/cpp/demo/book/map_filesystem/Scanner.l b/cpp/demo/book/map_filesystem/Scanner.l new file mode 100644 index 00000000000..338a6742814 --- /dev/null +++ b/cpp/demo/book/map_filesystem/Scanner.l @@ -0,0 +1,254 @@ +%{ + +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 <Parser.h> +#include <Grammar.h> + +#if defined(_MSC_VER) && defined(ICE_64) +// +// 'initializing' : conversion from '__int64' to 'int', possible loss of data +// Puts a pointer-difference into an int +// +# pragma warning( 4 : 4244 ) +#endif + +using namespace std; + +#define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) + +%} + +WS [ \t\v\f\r] +NL [\n] + +%option noyywrap +%option always-interactive + +%% + +"//" { + // C++-style comment + int c; + do + { + c = yyinput(); + } + while(c != '\n' && c != EOF); +} + +"/*" { + // C-style comment + while(true) + { + int c = yyinput(); + if(c == '*') + { + int next = yyinput(); + if(next == '/') + { + break; + } + else + { + unput(next); + } + } + else if(c == EOF) + { + parser->warning("EOF in comment"); + break; + } + } +} + +"help" { + return TOK_HELP; +} + +"quit"|"exit" { + return TOK_EXIT; +} + +"ls" { + return TOK_LIST; +} + +"lr" { + return TOK_LIST_RECURSIVE; +} + +"mkfile" { + return TOK_CREATE_FILE; +} + +"mkdir" { + return TOK_CREATE_DIR; +} + +"pwd" { + return TOK_PWD; +} + +"cd" { + return TOK_CD; +} + +"cat" { + return TOK_CAT; +} + +"write" { + return TOK_WRITE; +} + +"rm" { + return TOK_RM; +} + +{WS}*(\\{WS}*{NL})? { + size_t len = strlen(yytext); + for(size_t i = 0; i < len; ++i) + { + if(yytext[i] == '\\') + { + parser->continueLine(); + } + } +} + +{NL}|; { + return ';'; +} + +\" { + // "..."-type strings + string s; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == '"') + { + break; + } + else if(c == EOF) + { + parser->warning("EOF in string"); + break; + } + else if(c == '\\') + { + char next = static_cast<char>(yyinput()); + switch(next) + { + case '\\': + case '"': + { + s += next; + break; + } + + case 'n': + { + s += '\n'; + break; + } + + case 'r': + { + s += '\r'; + break; + } + + case 't': + { + s += '\t'; + break; + } + + case 'v': + { + s += '\v'; + break; + } + + case 'f': + { + s += '\f'; + break; + } + + default: + { + s += c; + unput(next); + } + } + } + else + { + s += c; + } + } + yylvalp->clear(); + yylvalp->push_back(s); + return TOK_STRING; +} + +\' { + // '...'-type strings + string s; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == '\'') + { + break; + } + else if(c == EOF) + { + parser->warning("EOF in string"); + break; + } + else + { + s += c; + } + } + yylvalp->clear(); + yylvalp->push_back(s); + return TOK_STRING; +} + +. { + // Simple strings + string s; + s += yytext[0]; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == EOF) + { + break; + } + else if(isspace(c) || c == ';') + { + unput(c); + break; + } + + s += c; + } + yylvalp->clear(); + yylvalp->push_back(s); + return TOK_STRING; +} + +%% diff --git a/cpp/demo/book/map_filesystem/Server.cpp b/cpp/demo/book/map_filesystem/Server.cpp new file mode 100644 index 00000000000..e46cd6af201 --- /dev/null +++ b/cpp/demo/book/map_filesystem/Server.cpp @@ -0,0 +1,104 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 <PersistentFilesystemI.h> +#include <Ice/Application.h> +#include <Freeze/Freeze.h> + +using namespace std; +using namespace Filesystem; + +class FilesystemApp : public virtual Ice::Application +{ +public: + + FilesystemApp(const string& envName) + : _envName(envName) + { + } + + virtual int run(int, char*[]) + { + // Terminate cleanly on receipt of a signal + // + shutdownOnInterrupt(); + + // Install object factories + // + communicator()->addObjectFactory(PersistentFile::ice_factory(), PersistentFile::ice_staticId()); + communicator()->addObjectFactory(PersistentDirectory::ice_factory(), PersistentDirectory::ice_staticId()); + + // Create an object adapter + // + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("MapFilesystem"); + + // Create a Freeze connection and the map + // + Freeze::ConnectionPtr connection = Freeze::createConnection(communicator(), _envName); + IdentityNodeMap persistentMap(connection, "mapfs"); + + // Set static members + // + NodeI::_map = &persistentMap; + DirectoryI::_communicator = communicator(); + DirectoryI::_adapter = adapter; + + // Find the persistent node for the root directory, or create it if not found + // + Ice::Identity rootId = communicator()->stringToIdentity("RootDir"); + PersistentDirectoryPtr pRoot; + { + IdentityNodeMap::iterator p = persistentMap.find(rootId); + if(p != persistentMap.end()) + { + pRoot = PersistentDirectoryPtr::dynamicCast(p->second); + assert(pRoot); + } + else + { + pRoot = new PersistentDirectory; + pRoot->name = "/"; + persistentMap.insert(IdentityNodeMap::value_type(rootId, pRoot)); + } + } + + // Create the root directory (with name "/" and no parent) + // + DirectoryIPtr root = new DirectoryI(rootId, pRoot, 0); + adapter->add(root, rootId); + + // Ready to accept requests now + // + adapter->activate(); + + // Wait until we are done + // + communicator()->waitForShutdown(); + + // Clean up + // + if(interrupted()) + { + cerr << appName() << ": received signal, shutting down" << endl; + } + connection->close(); + + return 0; + } + +private: + string _envName; +}; + +int +main(int argc, char* argv[]) +{ + FilesystemApp app("db"); + return app.main(argc, argv, "config.server"); +} diff --git a/cpp/demo/book/map_filesystem/book.map_filesystem.client.vcproj b/cpp/demo/book/map_filesystem/book.map_filesystem.client.vcproj new file mode 100755 index 00000000000..7a44a98a133 --- /dev/null +++ b/cpp/demo/book/map_filesystem/book.map_filesystem.client.vcproj @@ -0,0 +1,507 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="book.map_filesystem.client"
+ ProjectGUID="{0C6E1127-1105-49F0-99BB-CBDC1C2566F0}"
+ RootNamespace="book.map_filesystem.client"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/book.map_filesystem.client.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=". ; ..\..\..\..\cpp\include"
+ PreprocessorDefinitions="_CONSOLE;_DEBUG;WIN32_LEAN_AND_MEAN"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ RuntimeTypeInfo="true"
+ PrecompiledHeaderFile="Debug/Filesystem.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ WarnAsError="true"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/FIXED:NO"
+ AdditionalDependencies="Iced.lib IceUtild.lib setargv.obj"
+ OutputFile="client.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\..\cpp\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/client.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/book.map_filesystem.client.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ TypeLibraryName=".\Debug/book.map_filesystem.client.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=". ; ..\..\..\..\cpp\include"
+ PreprocessorDefinitions="_CONSOLE;_DEBUG;WIN32_LEAN_AND_MEAN"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ RuntimeTypeInfo="true"
+ PrecompiledHeaderFile="Debug/Filesystem.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ WarnAsError="true"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/FIXED:NO"
+ AdditionalDependencies="Iced.lib IceUtild.lib setargv.obj"
+ OutputFile="client.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\..\cpp\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/client.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/book.map_filesystem.client.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/book.map_filesystem.client.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories=". ; ..\..\..\..\cpp\include"
+ PreprocessorDefinitions="_CONSOLE;NDEBUG;WIN32_LEAN_AND_MEAN"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ RuntimeTypeInfo="true"
+ PrecompiledHeaderFile=".\Release/book.map_filesystem.client.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ WarnAsError="true"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/FIXED:NO /IGNORE:4089"
+ AdditionalDependencies="Ice.lib IceUtil.lib setargv.obj"
+ OutputFile="client.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\..\cpp\lib"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/book.map_filesystem.client.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ TypeLibraryName=".\Release/book.map_filesystem.client.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories=". ; ..\..\..\..\cpp\include"
+ PreprocessorDefinitions="_CONSOLE;NDEBUG;WIN32_LEAN_AND_MEAN"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ RuntimeTypeInfo="true"
+ PrecompiledHeaderFile=".\Release/book.map_filesystem.client.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ WarnAsError="true"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/FIXED:NO /IGNORE:4089"
+ AdditionalDependencies="Ice.lib IceUtil.lib setargv.obj"
+ OutputFile="client.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\..\cpp\lib"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/book.map_filesystem.client.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="Client.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\Filesystem.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Grammar.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Parser.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Scanner.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath=".\Filesystem.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Grammar.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Parser.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\Filesystem.ice"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath="README"
+ >
+ </File>
+ </Files>
+ <Globals>
+ <Global
+ Name="ZerocIce_ConsoleOutput"
+ Value="True"
+ />
+ <Global
+ Name="ZerocIce_Enabled"
+ Value="True"
+ />
+ <Global
+ Name="ZerocIce_Home"
+ Value="..\..\..\.."
+ />
+ <Global
+ Name="ZerocIce_HomeExpanded"
+ Value="..\..\..\.."
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/cpp/demo/book/map_filesystem/book.map_filesystem.server.vcproj b/cpp/demo/book/map_filesystem/book.map_filesystem.server.vcproj new file mode 100755 index 00000000000..0588d5fe893 --- /dev/null +++ b/cpp/demo/book/map_filesystem/book.map_filesystem.server.vcproj @@ -0,0 +1,591 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="book.map_filesystem.server"
+ ProjectGUID="{37369B6D-DFB9-4413-A4F5-AE261FDA74A2}"
+ RootNamespace="book.map_filesystem.server"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/book.map_filesystem.server.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories=". ; ..\..\..\..\cpp\include"
+ PreprocessorDefinitions="_CONSOLE;NDEBUG;WIN32_LEAN_AND_MEAN"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ RuntimeTypeInfo="true"
+ PrecompiledHeaderFile=".\Release/book.map_filesystem.server.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ WarnAsError="true"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/FIXED:NO /IGNORE:4089"
+ AdditionalDependencies="Freeze.lib Ice.lib IceUtil.lib setargv.obj"
+ OutputFile="server.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\..\cpp\lib"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/book.map_filesystem.server.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ TypeLibraryName=".\Release/book.map_filesystem.server.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories=". ; ..\..\..\..\cpp\include"
+ PreprocessorDefinitions="_CONSOLE;NDEBUG;WIN32_LEAN_AND_MEAN"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ RuntimeTypeInfo="true"
+ PrecompiledHeaderFile=".\Release/book.map_filesystem.server.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ WarnAsError="true"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/FIXED:NO /IGNORE:4089"
+ AdditionalDependencies="Freeze.lib Ice.lib IceUtil.lib setargv.obj"
+ OutputFile="server.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\..\cpp\lib"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/book.map_filesystem.server.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/book.map_filesystem.server.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=". ; ..\..\..\..\cpp\include"
+ PreprocessorDefinitions="_CONSOLE;_DEBUG;WIN32_LEAN_AND_MEAN"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ RuntimeTypeInfo="true"
+ PrecompiledHeaderFile="Debug/Filesystem.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ WarnAsError="true"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/FIXED:NO"
+ AdditionalDependencies="Freezed.lib Iced.lib IceUtild.lib setargv.obj"
+ OutputFile="server.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\..\cpp\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/server.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/book.map_filesystem.server.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ TypeLibraryName=".\Debug/book.map_filesystem.server.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=". ; ..\..\..\..\cpp\include"
+ PreprocessorDefinitions="_CONSOLE;_DEBUG;WIN32_LEAN_AND_MEAN"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ RuntimeTypeInfo="true"
+ PrecompiledHeaderFile="Debug/Filesystem.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ WarnAsError="true"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/FIXED:NO"
+ AdditionalDependencies="Freezed.lib Iced.lib IceUtild.lib setargv.obj"
+ OutputFile="server.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\..\cpp\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/server.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/book.map_filesystem.server.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath=".\Filesystem.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IdentityNodeMap.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\PersistentFilesystem.cpp"
+ >
+ </File>
+ <File
+ RelativePath="PersistentFilesystemI.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="Server.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath=".\Filesystem.h"
+ >
+ </File>
+ <File
+ RelativePath="FilesystemI.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IdentityNodeMap.h"
+ >
+ </File>
+ <File
+ RelativePath=".\PersistentFilesystem.h"
+ >
+ </File>
+ <File
+ RelativePath="PersistentFilesystemI.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\Filesystem.ice"
+ >
+ </File>
+ <File
+ RelativePath=".\PersistentFilesystem.ice"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine=""$(IceHome)"\bin\slice2freeze.exe -I. --ice --dict IdentityNodeMap,Ice::Identity,Filesystem::PersistentNode IdentityNodeMap.cpp Filesystem.ice PersistentFilesystem.ice "$(IceHome)"\slice\Ice\Identity.ice
"
+ Outputs="IdentityNodeMap.cpp;IdentityNodeMap.h"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine=""$(IceHome)"\bin\slice2freeze.exe -I. --ice --dict IdentityNodeMap,Ice::Identity,Filesystem::PersistentNode IdentityNodeMap.cpp Filesystem.ice PersistentFilesystem.ice "$(IceHome)"\slice\Ice\Identity.ice
"
+ Outputs="IdentityNodeMap.cpp;IdentityNodeMap.h"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine=""$(IceHome)"\bin\slice2freeze.exe -I. --ice --dict IdentityNodeMap,Ice::Identity,Filesystem::PersistentNode IdentityNodeMap.cpp Filesystem.ice PersistentFilesystem.ice "$(IceHome)"\slice\Ice\Identity.ice
"
+ Outputs="IdentityNodeMap.cpp;IdentityNodeMap.h"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine=""$(IceHome)"\bin\slice2freeze.exe -I. --ice --dict IdentityNodeMap,Ice::Identity,Filesystem::PersistentNode IdentityNodeMap.cpp Filesystem.ice PersistentFilesystem.ice "$(IceHome)"\slice\Ice\Identity.ice
"
+ Outputs="IdentityNodeMap.cpp;IdentityNodeMap.h"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <File
+ RelativePath="README"
+ >
+ </File>
+ </Files>
+ <Globals>
+ <Global
+ Name="ZerocIce_ConsoleOutput"
+ Value="True"
+ />
+ <Global
+ Name="ZerocIce_Enabled"
+ Value="True"
+ />
+ <Global
+ Name="ZerocIce_Home"
+ Value="..\..\..\.."
+ />
+ <Global
+ Name="ZerocIce_HomeExpanded"
+ Value="..\..\..\.."
+ />
+ <Global
+ Name="ZerocIce_IncludePath"
+ Value="."
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/java/demo/book/freeze_filesystem/config.client b/cpp/demo/book/map_filesystem/config.client index 6f0ba50b98f..6f0ba50b98f 100644 --- a/java/demo/book/freeze_filesystem/config.client +++ b/cpp/demo/book/map_filesystem/config.client diff --git a/cpp/demo/book/freeze_filesystem/config.server b/cpp/demo/book/map_filesystem/config.server index 8ee5723e944..1b56c7c588a 100644 --- a/cpp/demo/book/freeze_filesystem/config.server +++ b/cpp/demo/book/map_filesystem/config.server @@ -1,7 +1,7 @@ # # Configure the server endpoints. # -FreezeFilesystem.Endpoints=default -p 10000 +MapFilesystem.Endpoints=default -h 127.0.0.1 -p 10000 # # Freeze Map Tracing. diff --git a/java/demo/book/freeze_filesystem/db/.gitignore b/cpp/demo/book/map_filesystem/db/.gitignore index 39af5887579..39af5887579 100644 --- a/java/demo/book/freeze_filesystem/db/.gitignore +++ b/cpp/demo/book/map_filesystem/db/.gitignore diff --git a/cpp/demo/book/freeze_filesystem/expect.py b/cpp/demo/book/map_filesystem/expect.py index f7ba0a89d9a..c767c7ea64d 100755 --- a/cpp/demo/book/freeze_filesystem/expect.py +++ b/cpp/demo/book/map_filesystem/expect.py @@ -20,7 +20,7 @@ if len(path) == 0: sys.path.append(path[0]) from demoscript import * -from demoscript.book import freeze_filesystem +from demoscript.book import map_filesystem print "cleaning databases...", sys.stdout.flush() @@ -31,4 +31,4 @@ server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') client = Util.spawn('./client') -freeze_filesystem.run(client, server) +map_filesystem.run(client, server) diff --git a/cpp/demo/book/simple_filesystem/Server.cpp b/cpp/demo/book/simple_filesystem/Server.cpp index 044b5eba9b5..5bc72089edb 100644 --- a/cpp/demo/book/simple_filesystem/Server.cpp +++ b/cpp/demo/book/simple_filesystem/Server.cpp @@ -24,7 +24,7 @@ public: // Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints( - "SimpleFilesystem", "default -p 10000"); + "SimpleFilesystem", "default -h 127.0.0.1 -p 10000"); // Create the root directory (with name "/" and no parent) // diff --git a/cpp/demo/demo.sln b/cpp/demo/demo.sln index 13ebd9b040d..8d5e28adf35 100755 --- a/cpp/demo/demo.sln +++ b/cpp/demo/demo.sln @@ -274,13 +274,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IceStorm.replicated2.subscr EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IceUtil.workqueue", "IceUtil\workqueue\IceUtil.workqueue.vcproj", "{AE45156F-573C-4BDC-911D-EC7C28DB36D7}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "book.freeze_filesystem.client", "book\freeze_filesystem\book.freeze_filesystem.client.vcproj", "{66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}"
- ProjectSection(ProjectDependencies) = postProject
- {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32} = {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "book.freeze_filesystem.server", "book\freeze_filesystem\book.freeze_filesystem.server.vcproj", "{2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "book.lifecycle.client", "book\lifecycle\book.lifecycle.client.vcproj", "{332A63F9-BBD9-4324-8C1E-26604C71D54F}"
ProjectSection(ProjectDependencies) = postProject
{95043699-A842-4E16-A95B-13E02709B210} = {95043699-A842-4E16-A95B-13E02709B210}
@@ -316,6 +309,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ice.interleaved.client", "I EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ice.interleaved.server", "Ice\interleaved\Ice.interleaved.server.vcproj", "{383AB467-E29D-4A9D-A5D4-6BCA8E754A88}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "book.map_filesystem.client", "book\map_filesystem\book.map_filesystem.client.vcproj", "{0C6E1127-1105-49F0-99BB-CBDC1C2566F0}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "book.map_filesystem.server", "book\map_filesystem\book.map_filesystem.server.vcproj", "{37369B6D-DFB9-4413-A4F5-AE261FDA74A2}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "book.evictor_filesystem.client", "book\evictor_filesystem\book.evictor_filesystem.client.vcproj", "{66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "book.evictor_filesystem.server", "book\evictor_filesystem\book.evictor_filesystem.server.vcproj", "{2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -948,22 +949,6 @@ Global {AE45156F-573C-4BDC-911D-EC7C28DB36D7}.Release|Win32.Build.0 = Release|Win32
{AE45156F-573C-4BDC-911D-EC7C28DB36D7}.Release|x64.ActiveCfg = Release|Win32
{AE45156F-573C-4BDC-911D-EC7C28DB36D7}.Release|x64.Build.0 = Release|Win32
- {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Debug|Win32.ActiveCfg = Debug|Win32
- {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Debug|Win32.Build.0 = Debug|Win32
- {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Debug|x64.ActiveCfg = Debug|x64
- {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Debug|x64.Build.0 = Debug|x64
- {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Release|Win32.ActiveCfg = Release|Win32
- {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Release|Win32.Build.0 = Release|Win32
- {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Release|x64.ActiveCfg = Release|x64
- {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Release|x64.Build.0 = Release|x64
- {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Debug|Win32.ActiveCfg = Debug|Win32
- {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Debug|Win32.Build.0 = Debug|Win32
- {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Debug|x64.ActiveCfg = Debug|x64
- {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Debug|x64.Build.0 = Debug|x64
- {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Release|Win32.ActiveCfg = Release|Win32
- {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Release|Win32.Build.0 = Release|Win32
- {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Release|x64.ActiveCfg = Release|x64
- {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Release|x64.Build.0 = Release|x64
{332A63F9-BBD9-4324-8C1E-26604C71D54F}.Debug|Win32.ActiveCfg = Debug|Win32
{332A63F9-BBD9-4324-8C1E-26604C71D54F}.Debug|Win32.Build.0 = Debug|Win32
{332A63F9-BBD9-4324-8C1E-26604C71D54F}.Debug|x64.ActiveCfg = Debug|x64
@@ -1036,6 +1021,38 @@ Global {383AB467-E29D-4A9D-A5D4-6BCA8E754A88}.Release|Win32.ActiveCfg = Release|Win32
{383AB467-E29D-4A9D-A5D4-6BCA8E754A88}.Release|Win32.Build.0 = Release|Win32
{383AB467-E29D-4A9D-A5D4-6BCA8E754A88}.Release|x64.ActiveCfg = Release|x64
+ {0C6E1127-1105-49F0-99BB-CBDC1C2566F0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0C6E1127-1105-49F0-99BB-CBDC1C2566F0}.Debug|Win32.Build.0 = Debug|Win32
+ {0C6E1127-1105-49F0-99BB-CBDC1C2566F0}.Debug|x64.ActiveCfg = Debug|x64
+ {0C6E1127-1105-49F0-99BB-CBDC1C2566F0}.Debug|x64.Build.0 = Debug|x64
+ {0C6E1127-1105-49F0-99BB-CBDC1C2566F0}.Release|Win32.ActiveCfg = Release|Win32
+ {0C6E1127-1105-49F0-99BB-CBDC1C2566F0}.Release|Win32.Build.0 = Release|Win32
+ {0C6E1127-1105-49F0-99BB-CBDC1C2566F0}.Release|x64.ActiveCfg = Release|x64
+ {0C6E1127-1105-49F0-99BB-CBDC1C2566F0}.Release|x64.Build.0 = Release|x64
+ {37369B6D-DFB9-4413-A4F5-AE261FDA74A2}.Debug|Win32.ActiveCfg = Debug|Win32
+ {37369B6D-DFB9-4413-A4F5-AE261FDA74A2}.Debug|Win32.Build.0 = Debug|Win32
+ {37369B6D-DFB9-4413-A4F5-AE261FDA74A2}.Debug|x64.ActiveCfg = Debug|x64
+ {37369B6D-DFB9-4413-A4F5-AE261FDA74A2}.Debug|x64.Build.0 = Debug|x64
+ {37369B6D-DFB9-4413-A4F5-AE261FDA74A2}.Release|Win32.ActiveCfg = Release|Win32
+ {37369B6D-DFB9-4413-A4F5-AE261FDA74A2}.Release|Win32.Build.0 = Release|Win32
+ {37369B6D-DFB9-4413-A4F5-AE261FDA74A2}.Release|x64.ActiveCfg = Release|x64
+ {37369B6D-DFB9-4413-A4F5-AE261FDA74A2}.Release|x64.Build.0 = Release|x64
+ {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Debug|Win32.ActiveCfg = Debug|Win32
+ {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Debug|Win32.Build.0 = Debug|Win32
+ {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Debug|x64.ActiveCfg = Debug|x64
+ {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Debug|x64.Build.0 = Debug|x64
+ {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Release|Win32.ActiveCfg = Release|Win32
+ {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Release|Win32.Build.0 = Release|Win32
+ {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Release|x64.ActiveCfg = Release|x64
+ {66668B00-70BB-4CF0-8DB2-2717DC5F4DA3}.Release|x64.Build.0 = Release|x64
+ {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Debug|Win32.ActiveCfg = Debug|Win32
+ {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Debug|Win32.Build.0 = Debug|Win32
+ {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Debug|x64.ActiveCfg = Debug|x64
+ {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Debug|x64.Build.0 = Debug|x64
+ {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Release|Win32.ActiveCfg = Release|Win32
+ {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Release|Win32.Build.0 = Release|Win32
+ {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Release|x64.ActiveCfg = Release|x64
+ {2E1BBDAB-F9C2-4C72-9587-29D7F428BC32}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/cs/demo/book/lifecycle/Server.cs b/cs/demo/book/lifecycle/Server.cs index c18453320dd..b9f2c5b157d 100644 --- a/cs/demo/book/lifecycle/Server.cs +++ b/cs/demo/book/lifecycle/Server.cs @@ -30,7 +30,7 @@ public class Server // Create an object adapter // Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints( - "LifecycleFilesystem", "default -p 10000"); + "LifecycleFilesystem", "default -h 127.0.0.1 -p 10000"); // Create the root directory. // diff --git a/cs/demo/book/simple_filesystem/Server.cs b/cs/demo/book/simple_filesystem/Server.cs index d9fdba70f12..9a324b2e97a 100644 --- a/cs/demo/book/simple_filesystem/Server.cs +++ b/cs/demo/book/simple_filesystem/Server.cs @@ -30,7 +30,7 @@ public class Server // Create an object adapter. // Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints( - "SimpleFilesystem", "default -p 10000"); + "SimpleFilesystem", "default -h 127.0.0.1 -p 10000"); // Create the root directory (with name "/" and no parent) // diff --git a/demoscript/book/evictor_filesystem.py b/demoscript/book/evictor_filesystem.py new file mode 100755 index 00000000000..8260a3d93ba --- /dev/null +++ b/demoscript/book/evictor_filesystem.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2009 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. +# +# ********************************************************************** + +import sys, signal + +def run(client, server): + print "testing...", + sys.stdout.flush() + client.expect('>') + client.sendline('pwd') + #client.expect('pwd') + client.expect('/\n>') + + client.sendline('cd x') + #client.expect('cd x') + client.expect('`x\': no such directory') + client.expect('\n> ') + + client.sendline('cd') + client.expect('^> ') + + client.sendline('pwd') + client.expect('^/\n> ') + + client.sendline('mkfile a') + client.expect('^> ') + + client.sendline('cd a') + client.expect('`a\': not a directory\n> ') + + client.sendline('mkdir a') + client.expect('`a\' exists already\n> ') + + client.sendline('mkdir b') + client.expect('^> ') + + client.sendline('cd b') + client.expect('^> ') + + client.sendline('pwd') + client.expect('^/b\n> ') + + client.sendline('cd') + client.expect('^> ') + + client.sendline('pwd') + client.expect('^/\n> ') + + client.sendline('cd b') + client.expect('^> ') + + client.sendline('pwd') + client.expect('^/b\n> ') + + client.sendline('cd /') + client.expect('^> ') + + client.sendline('pwd') + client.expect('^/\n> ') + + client.sendline('ls') + client.expectall(['a \(file\)\n', 'b \(directory\)\n']) + client.expect('^> ') + + client.sendline('lr') + client.expectall(['a \(file\)\n', 'b \(directory\):\n']) + client.expect('^> ') + + client.sendline('cd b') + client.expect('^> ') + + client.sendline('mkdir c') + client.expect('^> ') + + client.sendline('cd c') + client.expect('^> ') + + client.sendline('pwd') + client.expect('/b/c\n> ') + + client.sendline('cd /') + client.expect('^> ') + + client.sendline('lr') + client.expectall(['a \(file\)\n', 'b \(directory\):\n\tc \(directory\):\n']) + client.expect('^> ') + + client.sendline('mkfile c') + client.expect('^> ') + + client.sendline('write c blah c') + client.expect('^> ') + + client.sendline('cat c') + client.expect('blah\n') + client.expect('c\n') + client.expect('^> ') + + client.sendline('rm b') + client.expect('cannot remove `b\': Cannot destroy non-empty directory') + client.expect('\n> ') + + client.sendline('cd b') + client.expect('^> ') + + client.sendline('rm *') + client.expect('^> ') + + client.sendline('ls') + client.expect('^> ') + + client.sendline('cd ..') + client.expect('^> ') + + client.sendline('rm b') + client.expect('^> ') + + client.sendline('rm a c') + client.expect('^> ') + + client.sendline('ls') + client.expect('^> ') + + client.sendline('exit') + client.waitTestSuccess() + + server.kill(signal.SIGINT) + server.waitTestSuccess() + print "ok" diff --git a/demoscript/book/freeze_filesystem.py b/demoscript/book/freeze_filesystem.py deleted file mode 100755 index bf9ea01f3de..00000000000 --- a/demoscript/book/freeze_filesystem.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2009 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. -# -# ********************************************************************** - -import sys, signal - -def run(client, server): - print "testing...", - sys.stdout.flush() - client.expect('Created Coleridge/Kubla_Khan') - client.expect('Contents of filesystem:') - client.expect('Down to a sunless sea') - client.expectall(['Destroying Coleridge', 'Destroying README']) - server.expect('removed object') - server.expect('removed object') - server.expect('removed object') - client.waitTestSuccess() - print "ok" - - server.kill(signal.SIGINT) - server.waitTestSuccess() diff --git a/demoscript/book/map_filesystem.py b/demoscript/book/map_filesystem.py new file mode 100755 index 00000000000..8260a3d93ba --- /dev/null +++ b/demoscript/book/map_filesystem.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2009 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. +# +# ********************************************************************** + +import sys, signal + +def run(client, server): + print "testing...", + sys.stdout.flush() + client.expect('>') + client.sendline('pwd') + #client.expect('pwd') + client.expect('/\n>') + + client.sendline('cd x') + #client.expect('cd x') + client.expect('`x\': no such directory') + client.expect('\n> ') + + client.sendline('cd') + client.expect('^> ') + + client.sendline('pwd') + client.expect('^/\n> ') + + client.sendline('mkfile a') + client.expect('^> ') + + client.sendline('cd a') + client.expect('`a\': not a directory\n> ') + + client.sendline('mkdir a') + client.expect('`a\' exists already\n> ') + + client.sendline('mkdir b') + client.expect('^> ') + + client.sendline('cd b') + client.expect('^> ') + + client.sendline('pwd') + client.expect('^/b\n> ') + + client.sendline('cd') + client.expect('^> ') + + client.sendline('pwd') + client.expect('^/\n> ') + + client.sendline('cd b') + client.expect('^> ') + + client.sendline('pwd') + client.expect('^/b\n> ') + + client.sendline('cd /') + client.expect('^> ') + + client.sendline('pwd') + client.expect('^/\n> ') + + client.sendline('ls') + client.expectall(['a \(file\)\n', 'b \(directory\)\n']) + client.expect('^> ') + + client.sendline('lr') + client.expectall(['a \(file\)\n', 'b \(directory\):\n']) + client.expect('^> ') + + client.sendline('cd b') + client.expect('^> ') + + client.sendline('mkdir c') + client.expect('^> ') + + client.sendline('cd c') + client.expect('^> ') + + client.sendline('pwd') + client.expect('/b/c\n> ') + + client.sendline('cd /') + client.expect('^> ') + + client.sendline('lr') + client.expectall(['a \(file\)\n', 'b \(directory\):\n\tc \(directory\):\n']) + client.expect('^> ') + + client.sendline('mkfile c') + client.expect('^> ') + + client.sendline('write c blah c') + client.expect('^> ') + + client.sendline('cat c') + client.expect('blah\n') + client.expect('c\n') + client.expect('^> ') + + client.sendline('rm b') + client.expect('cannot remove `b\': Cannot destroy non-empty directory') + client.expect('\n> ') + + client.sendline('cd b') + client.expect('^> ') + + client.sendline('rm *') + client.expect('^> ') + + client.sendline('ls') + client.expect('^> ') + + client.sendline('cd ..') + client.expect('^> ') + + client.sendline('rm b') + client.expect('^> ') + + client.sendline('rm a c') + client.expect('^> ') + + client.sendline('ls') + client.expect('^> ') + + client.sendline('exit') + client.waitTestSuccess() + + server.kill(signal.SIGINT) + server.waitTestSuccess() + print "ok" diff --git a/java/allDemos.py b/java/allDemos.py index e07b2b109bc..3e50fe49f4f 100755 --- a/java/allDemos.py +++ b/java/allDemos.py @@ -48,7 +48,8 @@ demos = [ "Freeze/library", "Freeze/transform", "Freeze/casino", - "book/freeze_filesystem", + "book/evictor_filesystem", + "book/map_filesystem", "book/simple_filesystem", "book/printer", "book/lifecycle", diff --git a/java/demo/book/README b/java/demo/book/README index 3d58a2ba06f..d1653f804c4 100644 --- a/java/demo/book/README +++ b/java/demo/book/README @@ -6,10 +6,15 @@ Demos in this directory: the Ice Run Time chapter. You can copy and modify this code to suit your needs. -- freeze_filesystem +- evictor_filesystem An implementation of the persistent version of the file system - example described in the Freeze chapter. + example described in the Freeze chapter using a Freeze evictor. + +- map_filesystem + + An implementation of the persistent version of the file system + example described in the Freeze chapter using a Freeze map. - lifecycle diff --git a/java/demo/book/build.xml b/java/demo/book/build.xml index 997d62a507b..bb2c8d93a67 100644 --- a/java/demo/book/build.xml +++ b/java/demo/book/build.xml @@ -14,7 +14,8 @@ <target name="all"> <ant dir="printer"/> <ant dir="simple_filesystem"/> - <ant dir="freeze_filesystem"/> + <ant dir="evictor_filesystem"/> + <ant dir="map_filesystem"/> <ant dir="lifecycle"/> </target> @@ -22,7 +23,8 @@ <ant dir="printer" target="clean"/> <ant dir="simple_filesystem" target="clean"/> <ant dir="lifecycle" target="clean"/> - <ant dir="freeze_filesystem" target="clean"/> + <ant dir="evictor_filesystem" target="clean"/> + <ant dir="map_filesystem" target="clean"/> </target> </project> diff --git a/java/demo/book/freeze_filesystem/.gitignore b/java/demo/book/evictor_filesystem/.gitignore index 9c39416c539..9c39416c539 100644 --- a/java/demo/book/freeze_filesystem/.gitignore +++ b/java/demo/book/evictor_filesystem/.gitignore diff --git a/java/demo/book/evictor_filesystem/Client.java b/java/demo/book/evictor_filesystem/Client.java new file mode 100644 index 00000000000..c24556388ce --- /dev/null +++ b/java/demo/book/evictor_filesystem/Client.java @@ -0,0 +1,47 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +import Filesystem.*; + +public class Client extends Ice.Application +{ + public int + run(String[] args) + { + // Terminate cleanly on receipt of a signal. + // + shutdownOnInterrupt(); + + // Create a proxy for the root directory + // + DirectoryPrx rootDir = DirectoryPrxHelper.checkedCast(communicator().propertyToProxy("RootDir.Proxy")); + if(rootDir == null) + { + throw new Error("Client: invalid proxy"); + } + + Parser p = new Parser(rootDir); + return p.parse(); + } + + static public void + main(String[] args) + { + Client app = new Client(); + app.main("demo.book.evictor_filesystem.Client", args, "config.client"); + } + + static private class Error extends RuntimeException + { + public Error(String msg) + { + super(msg); + } + } +} diff --git a/java/demo/book/freeze_filesystem/DirectoryI.java b/java/demo/book/evictor_filesystem/DirectoryI.java index 59e5e4c3ed6..c58f1c64013 100644 --- a/java/demo/book/freeze_filesystem/DirectoryI.java +++ b/java/demo/book/evictor_filesystem/DirectoryI.java @@ -42,7 +42,7 @@ public final class DirectoryI extends PersistentDirectory { if(parent == null) { - throw new PermissionDenied("cannot destroy root directory"); + throw new PermissionDenied("Cannot destroy root directory"); } synchronized(this) @@ -53,7 +53,7 @@ public final class DirectoryI extends PersistentDirectory } if(!nodes.isEmpty()) { - throw new PermissionDenied("cannot destroy non-empty directory"); + throw new PermissionDenied("Cannot destroy non-empty directory"); } _destroyed = true; } diff --git a/java/demo/book/freeze_filesystem/FileI.java b/java/demo/book/evictor_filesystem/FileI.java index 8b84ae13b34..8b84ae13b34 100644 --- a/java/demo/book/freeze_filesystem/FileI.java +++ b/java/demo/book/evictor_filesystem/FileI.java diff --git a/java/demo/book/freeze_filesystem/Filesystem.ice b/java/demo/book/evictor_filesystem/Filesystem.ice index 2e48dece6e3..2e48dece6e3 100644 --- a/java/demo/book/freeze_filesystem/Filesystem.ice +++ b/java/demo/book/evictor_filesystem/Filesystem.ice diff --git a/java/demo/book/evictor_filesystem/Grammar.java b/java/demo/book/evictor_filesystem/Grammar.java new file mode 100644 index 00000000000..e9e94969364 --- /dev/null +++ b/java/demo/book/evictor_filesystem/Grammar.java @@ -0,0 +1,202 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +class Grammar +{ + Grammar(Parser p) + { + _parser = p; + _scanner = new Scanner(_parser); + } + + void + parse() + { + while(true) + { + try + { + _token = _scanner.nextToken(); + if(_token == null) + { + return; + } + else if(_token.type == Token.TOK_SEMI) + { + // Continue + } + else if(_token.type == Token.TOK_HELP) + { + _token = _scanner.nextToken(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + _parser.usage(); + } + else if(_token.type == Token.TOK_EXIT) + { + _token = _scanner.nextToken(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + return; + } + else if(_token.type == Token.TOK_LIST) + { + _token = _scanner.nextToken(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + _parser.list(false); + } + else if(_token.type == Token.TOK_LIST_RECURSIVE) + { + _token = _scanner.nextToken(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + _parser.list(true); + } + else if(_token.type == Token.TOK_CREATE_FILE) + { + java.util.List<String> s = strings(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + if(s.size() == 0) + { + throw new ParseError("usage: mkfile FILE [FILE...]"); + } + _parser.createFile(s); + } + else if(_token.type == Token.TOK_CREATE_DIR) + { + java.util.List<String> s = strings(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + if(s.size() == 0) + { + throw new ParseError("usage: mkdir DIR [DIR...]"); + } + _parser.createDir(s); + } + else if(_token.type == Token.TOK_PWD) + { + _token = _scanner.nextToken(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + _parser.pwd(); + } + else if(_token.type == Token.TOK_CD) + { + java.util.List<String> s = strings(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + if(s.size() > 1) + { + throw new ParseError("usage: cd [DIR]"); + } + else if(s.size() == 0) + { + _parser.cd("/"); + } + else + { + _parser.cd((String)s.get(0)); + } + } + else if(_token.type == Token.TOK_CAT) + { + java.util.List<String> s = strings(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + if(s.size() != 1) + { + throw new ParseError("usage: cat FILE"); + } + _parser.cat((String)s.get(0)); + } + else if(_token.type == Token.TOK_WRITE) + { + java.util.LinkedList<String> s = strings(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + if(s.size() == 0) + { + throw new ParseError("usage: write FILE [STRING...]"); + } + _parser.write(s); + } + else if(_token.type == Token.TOK_RM) + { + java.util.List<String> s = strings(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + if(s.size() == 0) + { + throw new ParseError("usage: rm NAME [NAME...]"); + } + _parser.destroy(s); + } + else + { + _parser.error("parse error"); + } + } + catch(ParseError e) + { + _parser.error("Parse error: " + e.getMessage()); + } + } + } + + private java.util.LinkedList<String> + strings() + { + java.util.LinkedList<String> l = new java.util.LinkedList<String>(); + while(true) + { + _token = _scanner.nextToken(); + if(_token.type != Token.TOK_STRING) + { + return l; + } + l.add(_token.value); + } + } + + static private class ParseError extends RuntimeException + { + ParseError(String msg) + { + super(msg); + } + } + + private Parser _parser; + private Scanner _scanner; + private Token _token; +} diff --git a/java/demo/book/freeze_filesystem/NodeFactory.java b/java/demo/book/evictor_filesystem/NodeFactory.java index 9dd3ab922ed..9dd3ab922ed 100644 --- a/java/demo/book/freeze_filesystem/NodeFactory.java +++ b/java/demo/book/evictor_filesystem/NodeFactory.java diff --git a/java/demo/book/freeze_filesystem/NodeInitializer.java b/java/demo/book/evictor_filesystem/NodeInitializer.java index e09f39c1db5..e09f39c1db5 100644 --- a/java/demo/book/freeze_filesystem/NodeInitializer.java +++ b/java/demo/book/evictor_filesystem/NodeInitializer.java diff --git a/java/demo/book/evictor_filesystem/Parser.java b/java/demo/book/evictor_filesystem/Parser.java new file mode 100644 index 00000000000..9a2889b7473 --- /dev/null +++ b/java/demo/book/evictor_filesystem/Parser.java @@ -0,0 +1,349 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +import Filesystem.*; + +class Parser +{ + Parser(DirectoryPrx root) + { + _dirs = new java.util.LinkedList<DirectoryPrx>(); + _dirs.addFirst(root); + } + + void + usage() + { + System.err.print( + "help Print this message.\n" + + "pwd Print current directory (/ = root).\n" + + "cd [DIR] Change directory (/ or empty = root).\n" + + "ls List current directory.\n" + + "lr Recursively list current directory.\n" + + "mkdir DIR [DIR...] Create directories DIR in current directory.\n" + + "mkfile FILE [FILE...] Create files FILE in current directory.\n" + + "rm NAME [NAME...] Delete directory or file NAME (rm * to delete all).\n" + + "cat FILE List the contents of FILE.\n" + + "write FILE [STRING...] Write STRING to FILE.\n" + + "exit, quit Exit this program.\n"); + } + + void + list(boolean recursive) + { + try + { + list(_dirs.get(0), recursive, 0); + } + catch(Ice.LocalException ex) + { + error(ex.toString()); + } + } + + void + list(Filesystem.DirectoryPrx dir, boolean recursive, int depth) + { + StringBuilder b = new StringBuilder(); + for(int i = 0; i < depth; ++i) + { + b.append('\t'); + } + String indent = b.toString(); + + NodeDesc[] contents = dir.list(); + + for(int i = 0; i < contents.length; ++i) + { + DirectoryPrx d + = contents[i].type == NodeType.DirType + ? DirectoryPrxHelper.uncheckedCast(contents[i].proxy) + : null; + System.out.print(indent + contents[i].name + (d != null ? " (directory)" : " (file)")); + if(d != null && recursive) + { + System.out.println(":"); + list(d, true, ++depth); + } + else + { + System.out.println(); + } + } + } + + void + createFile(java.util.List<String> names) + { + DirectoryPrx dir = _dirs.getFirst(); + + for(String name : names) + { + if(name.equals("..")) + { + System.out.println("Cannot create a file named `..'"); + continue; + } + + try + { + dir.createFile(name); + } + catch(NameInUse ex) + { + System.out.println("`" + name + "' exists already"); + } + } + } + + void + createDir(java.util.List<String> names) + { + DirectoryPrx dir = _dirs.getFirst(); + + for(String name : names) + { + if(name.equals("..")) + { + System.out.println("Cannot create a directory named `..'"); + continue; + } + + try + { + dir.createDirectory(name); + } + catch(NameInUse ex) + { + System.out.println("`" + name + "' exists already"); + } + } + } + + void + pwd() + { + if(_dirs.size() == 1) + { + System.out.print("/"); + } + else + { + java.util.ListIterator<DirectoryPrx> i = _dirs.listIterator(_dirs.size()); + i.previous(); + while(i.hasPrevious()) + { + System.out.print("/" + i.previous().name()); + } + } + System.out.println(); + } + + void + cd(String name) + { + if(name.equals("/")) + { + while(_dirs.size() > 1) + { + _dirs.removeFirst(); + } + return; + } + + if(name.equals("..")) + { + if(_dirs.size() > 1) + { + _dirs.removeFirst(); + } + return; + } + + DirectoryPrx dir = _dirs.getFirst(); + NodeDesc d; + try + { + d = dir.find(name); + } + catch(NoSuchName ex) + { + System.out.println("`" + name + "': no such directory"); + return; + } + if(d.type == NodeType.FileType) + { + System.out.println("`" + name + "': not a directory"); + return; + } + _dirs.addFirst(DirectoryPrxHelper.uncheckedCast(d.proxy)); + } + + void + cat(String name) + { + DirectoryPrx dir = _dirs.getFirst(); + NodeDesc d; + try + { + d = dir.find(name); + } + catch(NoSuchName ex) + { + System.out.println("`" + name + "': no such file"); + return; + } + if(d.type == NodeType.DirType) + { + System.out.println("`" + name + "': not a file"); + return; + } + FilePrx f = FilePrxHelper.uncheckedCast(d.proxy); + String[] l = f.read(); + for(int i = 0; i < l.length; ++i) + { + System.out.println(l[i]); + } + } + + void + write(java.util.LinkedList<String> args) + { + DirectoryPrx dir = _dirs.getFirst(); + String name = args.getFirst(); + args.removeFirst(); + NodeDesc d; + try + { + d = dir.find(name); + } + catch(NoSuchName ex) + { + System.out.println("`" + name + "': no such file"); + return; + } + if(d.type == NodeType.DirType) + { + System.out.println("`" + name + "': not a file"); + return; + } + FilePrx f = FilePrxHelper.uncheckedCast(d.proxy); + + String[] l = args.toArray(new String[0]); + try + { + f.write(l); + } + catch(GenericError ex) + { + System.out.println("`" + name + "': cannot write to file: " + ex.reason); + } + } + + void + destroy(java.util.List<String> names) + { + DirectoryPrx dir = _dirs.getFirst(); + + for(String name : names) + { + if(name.equals("*")) + { + NodeDesc[] nodes = dir.list(); + for(NodeDesc node : nodes) + { + try + { + node.proxy.destroy(); + } + catch(PermissionDenied ex) + { + System.out.println("cannot remove `" + node.name + "': " + ex.reason); + } + } + return; + } + else + { + NodeDesc d; + try + { + d = dir.find(name); + } + catch(NoSuchName ex) + { + System.out.println("`" + name + "': no such file or directory"); + return; + } + try + { + d.proxy.destroy(); + } + catch(PermissionDenied ex) + { + System.out.println("cannot remove `" + name + "': " + ex.reason); + } + } + } + } + + void + error(String s) + { + System.err.println("error: " + s); + } + + void + warning(String s) + { + System.err.println("warning: " + s); + } + + String + getInput() + { + System.out.print("> "); + System.out.flush(); + + try + { + return _in.readLine(); + } + catch(java.io.IOException e) + { + return null; + } + } + + int + parse() + { + _in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); + + Grammar g = new Grammar(this); + g.parse(); + + return 0; + } + + int + parse(java.io.BufferedReader in) + { + _in = in; + + Grammar g = new Grammar(this); + g.parse(); + + return 0; + } + + private java.util.LinkedList<DirectoryPrx> _dirs; + + private java.io.BufferedReader _in; +} diff --git a/java/demo/book/freeze_filesystem/PersistentFilesystem.ice b/java/demo/book/evictor_filesystem/PersistentFilesystem.ice index fe0216eb4d2..fe0216eb4d2 100644 --- a/java/demo/book/freeze_filesystem/PersistentFilesystem.ice +++ b/java/demo/book/evictor_filesystem/PersistentFilesystem.ice diff --git a/java/demo/book/evictor_filesystem/README b/java/demo/book/evictor_filesystem/README new file mode 100644 index 00000000000..36892b4cfed --- /dev/null +++ b/java/demo/book/evictor_filesystem/README @@ -0,0 +1,11 @@ +This demo presents an alternate implementation of the filesystem +application using a Freeze evictor, as discussed in the Freeze chapter +of the Ice manual. + +To run it, start the server in a window: + +$ java Server + +Then run the client in a separate window: + +$ java Client diff --git a/java/demo/book/evictor_filesystem/Scanner.java b/java/demo/book/evictor_filesystem/Scanner.java new file mode 100644 index 00000000000..c4c695fcd8b --- /dev/null +++ b/java/demo/book/evictor_filesystem/Scanner.java @@ -0,0 +1,283 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +class Scanner +{ + Scanner(Parser p) + { + _parser = p; + } + + Token + nextToken() + { + String s = next(); + if(s == null) + { + return null; + } + + if(s.equals(";")) + { + return new Token(Token.TOK_SEMI); + } + else if(s.equals("help")) + { + return new Token(Token.TOK_HELP); + } + else if(s.equals("exit") || s.equals("quit")) + { + return new Token(Token.TOK_EXIT); + } + else if(s.equals("ls")) + { + return new Token(Token.TOK_LIST); + } + else if(s.equals("lr")) + { + return new Token(Token.TOK_LIST_RECURSIVE); + } + else if(s.equals("mkfile")) + { + return new Token(Token.TOK_CREATE_FILE); + } + else if(s.equals("mkdir")) + { + return new Token(Token.TOK_CREATE_DIR); + } + else if(s.equals("pwd")) + { + return new Token(Token.TOK_PWD); + } + else if(s.equals("cd")) + { + return new Token(Token.TOK_CD); + } + else if(s.equals("cat")) + { + return new Token(Token.TOK_CAT); + } + else if(s.equals("write")) + { + return new Token(Token.TOK_WRITE); + } + else if(s.equals("rm")) + { + return new Token(Token.TOK_RM); + } + else + { + return new Token(Token.TOK_STRING, s); + } + } + + static private class EndOfInput extends Exception + { + } + + private char + get() + throws EndOfInput + { + // + // If there is an character in the unget buffer, return it. + // + if(_unget) + { + _unget = false; + return _ungetChar; + } + + // + // No current buffer? + // + if(_buf == null) + { + _buf = _parser.getInput(); + _pos = 0; + if(_buf == null) + { + throw new EndOfInput(); + } + } + + // + // At the end-of-buffer? + // + while(_pos >= _buf.length()) + { + _buf = null; + _pos = 0; + return '\n'; + } + + return _buf.charAt(_pos++); + } + + // + // unget only works with one character. + // + private void + unget(char c) + { + assert(!_unget); + _unget = true; + _ungetChar = c; + } + + private String + next() + { + // + // Eat any whitespace. + // + char c; + try + { + do + { + c = get(); + } + while(Character.isWhitespace(c) && c != '\n'); + } + catch(EndOfInput ignore) + { + return null; + } + + StringBuilder buf = new StringBuilder(128); + + if(c == ';' || c == '\n') + { + buf.append(';'); + } + else if(c == '\'') + { + try + { + while(true) + { + c = get(); + if(c == '\'') + { + break; + } + else + { + buf.append(c); + } + } + } + catch(EndOfInput e) + { + _parser.warning("EOF in string"); + } + } + else if(c == '\"') + { + try + { + while(true) + { + c = get(); + if(c == '\"') + { + break; + } + else if(c == '\\') + { + try + { + char next = get(); + switch(next) + { + case '\\': + case '"': + { + buf.append(next); + break; + } + + case 'n': + { + buf.append('\n'); + break; + } + + case 'r': + { + buf.append('\r'); + break; + } + + case 't': + { + buf.append('\t'); + break; + } + + case 'f': + { + buf.append('\f'); + break; + } + + default: + { + buf.append(c); + unget(next); + } + } + } + catch(EndOfInput e) + { + buf.append(c); + } + } + else + { + buf.append(c); + } + } + } + catch(EndOfInput e) + { + _parser.warning("EOF in string"); + } + } + else + { + // + // Otherwise it's a string. + // + try + { + do + { + buf.append(c); + c = get(); + } + while(!Character.isWhitespace(c) && c != ';' && c != '\n'); + + unget(c); + } + catch(EndOfInput ignore) + { + } + } + + return buf.toString(); + } + + private Parser _parser; + private boolean _unget = false; + private char _ungetChar; + private String _buf = null; + private int _pos; +} diff --git a/java/demo/book/freeze_filesystem/Server.java b/java/demo/book/evictor_filesystem/Server.java index d774785a1c3..dfdf5e109c3 100644 --- a/java/demo/book/freeze_filesystem/Server.java +++ b/java/demo/book/evictor_filesystem/Server.java @@ -31,7 +31,7 @@ public class Server extends Ice.Application // Create an object adapter. // Ice.ObjectAdapter adapter = - communicator().createObjectAdapterWithEndpoints("FreezeFilesystem", "default -p 10000"); + communicator().createObjectAdapter("EvictorFilesystem"); // // Create the Freeze evictor (stored in the _evictor @@ -74,7 +74,7 @@ public class Server extends Ice.Application main(String[] args) { Server app = new Server("db"); - int status = app.main("Server", args, "config.server"); + int status = app.main("demo.book.evictor_filesystem.Server", args, "config.server"); System.exit(status); } diff --git a/java/demo/book/evictor_filesystem/Token.java b/java/demo/book/evictor_filesystem/Token.java new file mode 100644 index 00000000000..e9b76961ea7 --- /dev/null +++ b/java/demo/book/evictor_filesystem/Token.java @@ -0,0 +1,40 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +class Token +{ + public static final int TOK_HELP = 0; + public static final int TOK_EXIT = 1; + public static final int TOK_SEMI = 2; + public static final int TOK_LIST = 3; + public static final int TOK_LIST_RECURSIVE = 4; + public static final int TOK_CREATE_FILE = 5; + public static final int TOK_CREATE_DIR = 6; + public static final int TOK_PWD = 7; + public static final int TOK_CD = 8; + public static final int TOK_CAT = 9; + public static final int TOK_WRITE = 10; + public static final int TOK_RM = 11; + public static final int TOK_STRING = 12; + + int type; + String value; + + Token(int t) + { + type = t; + value = null; + } + + Token(int t, String v) + { + type = t; + value = v; + } +} diff --git a/java/demo/book/freeze_filesystem/build.xml b/java/demo/book/evictor_filesystem/build.xml index 8010bd22527..cfe9cd29c5f 100644 --- a/java/demo/book/freeze_filesystem/build.xml +++ b/java/demo/book/evictor_filesystem/build.xml @@ -9,7 +9,7 @@ ********************************************************************** --> -<project name="demo_book_freeze_filesystem" default="all" basedir="."> +<project name="demo_book_evictor_filesystem" default="all" basedir="."> <!-- set global properties for this build --> <property name="top.dir" value="../../.."/> diff --git a/java/demo/book/evictor_filesystem/config.client b/java/demo/book/evictor_filesystem/config.client new file mode 100644 index 00000000000..6f0ba50b98f --- /dev/null +++ b/java/demo/book/evictor_filesystem/config.client @@ -0,0 +1,28 @@ +# +# The client reads this property to create the reference to the root +# "directory" object in the server. +# +RootDir.Proxy=RootDir:default -p 10000 + +# +# Warn about connection exceptions +# +Ice.Warn.Connections=1 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +#Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 diff --git a/java/demo/book/evictor_filesystem/config.server b/java/demo/book/evictor_filesystem/config.server new file mode 100644 index 00000000000..20049e1abd9 --- /dev/null +++ b/java/demo/book/evictor_filesystem/config.server @@ -0,0 +1,49 @@ +# +# Configure the server endpoints. +# +EvictorFilesystem.Endpoints=default -h 127.0.0.1 -p 10000 + +# +# Freeze Map Tracing. +# +# 0 = No map activity trace (default). +# 1 = Trace database open and close. +# 2 = Also trace iterator and transaction operations, and reference +# counting of the underlying database. +# +Freeze.Trace.Map=1 + +# +# Freeze Evictor Tracing. +# +# 0 = No evictor activity trace (default). +# 1 = Trace Ice object and facet creation and destruction, facet +# streaming time, facet saving time, object eviction (every 50 +# objects) and evictor deactivation. +# 2 = Also trace object lookups, and all object evictions. +# 3 = Also trace object retrieval from the database. +# +Freeze.Trace.Evictor=2 + +# +# Warn about connection exceptions +# +Ice.Warn.Connections=1 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +#Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 diff --git a/java/demo/book/evictor_filesystem/db/.gitignore b/java/demo/book/evictor_filesystem/db/.gitignore new file mode 100644 index 00000000000..39af5887579 --- /dev/null +++ b/java/demo/book/evictor_filesystem/db/.gitignore @@ -0,0 +1 @@ +# Dummy file, so that git retains this otherwise empty directory. diff --git a/java/demo/book/evictor_filesystem/expect.py b/java/demo/book/evictor_filesystem/expect.py new file mode 100755 index 00000000000..91b19af32e6 --- /dev/null +++ b/java/demo/book/evictor_filesystem/expect.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2009 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. +# +# ********************************************************************** + +import sys, os + +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] +if len(path) == 0: + raise "can't find toplevel directory!" +sys.path.append(path[0]) + +from demoscript import * +from demoscript.book import evictor_filesystem + +print "cleaning databases...", +sys.stdout.flush() +Util.cleanDbDir("db") +print "ok" + +server = Util.spawn('java Server --Ice.PrintAdapterReady') +server.expect('.* ready') +client = Util.spawn('java Client') + +evictor_filesystem.run(client, server) diff --git a/java/demo/book/freeze_filesystem/Client.java b/java/demo/book/freeze_filesystem/Client.java deleted file mode 100644 index 2c0056e1451..00000000000 --- a/java/demo/book/freeze_filesystem/Client.java +++ /dev/null @@ -1,165 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 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. -// -// ********************************************************************** - -import Filesystem.*; - -public class Client extends Ice.Application -{ - // Recursively print the contents of directory "dir" in tree fashion. - // For files, show the contents of each file. The "depth" - // parameter is the current nesting level (for indentation). - - static void - listRecursive(DirectoryPrx dir, int depth) - { - char[] indentCh = new char[++depth]; - java.util.Arrays.fill(indentCh, '\t'); - String indent = new String(indentCh); - - NodeDesc[] contents = dir.list(); - - for (int i = 0; i < contents.length; ++i) { - DirectoryPrx subdir = DirectoryPrxHelper.checkedCast(contents[i].proxy); - FilePrx file = FilePrxHelper.uncheckedCast(contents[i].proxy); - System.out.println(indent + contents[i].name + (subdir != null ? " (directory):" : " (file):")); - if (subdir != null) { - listRecursive(subdir, depth); - } else { - String[] text = file.read(); - for (int j = 0; j < text.length; ++j) - System.out.println(indent + "\t" + text[j]); - } - } - } - - class ShutdownHook extends Thread - { - public void - run() - { - try - { - communicator().destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - } - } - } - - public int - run(String[] args) - { - // - // Since this is an interactive demo we want to clear the - // Application installed interrupt callback and install our - // own shutdown hook. - // - setInterruptHook(new ShutdownHook()); - - // - // Create a proxy for the root directory. - // - DirectoryPrx rootDir = DirectoryPrxHelper.checkedCast(communicator().propertyToProxy("RootDir.Proxy")); - if(rootDir == null) - { - System.err.println("Client: invalid proxy"); - return 1; - } - - try - { - // - // Create a file called "README" in the root directory. - // - FilePrx readme = null; - try - { - readme = rootDir.createFile("README"); - String[] text = new String[1]; - text[0] = "This file system contains a collection of poetry."; - readme.write(text); - System.out.println("Created README."); - } - catch(NameInUse ex) - { - NodeDesc desc = rootDir.find("README"); - readme = FilePrxHelper.checkedCast(desc.proxy); - assert(readme != null); - } - - // - // Create a directory called "Coleridge" in the root directory. - // - DirectoryPrx coleridge = null; - try - { - coleridge = rootDir.createDirectory("Coleridge"); - System.out.println("Created Coleridge."); - } - catch(NameInUse ex) - { - NodeDesc desc = rootDir.find("Coleridge"); - coleridge = DirectoryPrxHelper.checkedCast(desc.proxy); - assert(coleridge != null); - } - - // - // Create a file called "Kubla_Khan" in the Coleridge directory. - // - FilePrx file = null; - try - { - file = coleridge.createFile("Kubla_Khan"); - String[] text = new String[5]; - text[0] = "In Xanadu did Kubla Khan"; - text[1] = "A stately pleasure-dome decree:"; - text[2] = "Where Alph, the sacred river, ran"; - text[3] = "Through caverns measureless to man"; - text[4] = "Down to a sunless sea."; - file.write(text); - System.out.println("Created Coleridge/Kubla_Khan."); - } - catch(NameInUse ex) - { - NodeDesc desc = coleridge.find("Kubla_Khan"); - file = FilePrxHelper.checkedCast(desc.proxy); - assert(file != null); - } - - System.out.println("Contents of filesystem:"); - listRecursive(rootDir, 0); - - // - // Destroy the filesystem. - // - System.out.println("Destroying " + file.name()); - file.destroy(); - System.out.println("Destroying " + readme.name()); - readme.destroy(); - System.out.println("Destroying " + coleridge.name()); - coleridge.destroy(); - } - catch(Ice.UserException ex) - { - ex.printStackTrace(); - } - - return 0; - } - - public static void - main(String[] args) - { - Client app = new Client(); - int status = app.main("Client", args, "config.client"); - System.exit(status); - } -} diff --git a/java/demo/book/lifecycle/Server.java b/java/demo/book/lifecycle/Server.java index 6e3286ebafb..54bc2d2526f 100644 --- a/java/demo/book/lifecycle/Server.java +++ b/java/demo/book/lifecycle/Server.java @@ -22,7 +22,7 @@ class Server extends Ice.Application // Create an object adapter // Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints( - "LifecycleFilesystem", "default -p 10000"); + "LifecycleFilesystem", "default -h 127.0.0.1 -p 10000"); // Create the root directory. // diff --git a/java/demo/book/map_filesystem/.gitignore b/java/demo/book/map_filesystem/.gitignore new file mode 100644 index 00000000000..9c39416c539 --- /dev/null +++ b/java/demo/book/map_filesystem/.gitignore @@ -0,0 +1 @@ +db/* diff --git a/java/demo/book/map_filesystem/Client.java b/java/demo/book/map_filesystem/Client.java new file mode 100644 index 00000000000..33542ecf941 --- /dev/null +++ b/java/demo/book/map_filesystem/Client.java @@ -0,0 +1,47 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +import Filesystem.*; + +public class Client extends Ice.Application +{ + public int + run(String[] args) + { + // Terminate cleanly on receipt of a signal. + // + shutdownOnInterrupt(); + + // Create a proxy for the root directory + // + DirectoryPrx rootDir = DirectoryPrxHelper.checkedCast(communicator().propertyToProxy("RootDir.Proxy")); + if(rootDir == null) + { + throw new Error("Client: invalid proxy"); + } + + Parser p = new Parser(rootDir); + return p.parse(); + } + + static public void + main(String[] args) + { + Client app = new Client(); + app.main("demo.book.map_filesystem.Client", args, "config.client"); + } + + static private class Error extends RuntimeException + { + public Error(String msg) + { + super(msg); + } + } +} diff --git a/java/demo/book/map_filesystem/DirectoryI.java b/java/demo/book/map_filesystem/DirectoryI.java new file mode 100644 index 00000000000..7b5a164ccf5 --- /dev/null +++ b/java/demo/book/map_filesystem/DirectoryI.java @@ -0,0 +1,201 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +import Filesystem.*; + +public class DirectoryI extends _DirectoryDisp +{ + public synchronized void + destroy(Ice.Current c) + throws PermissionDenied + { + if(_destroyed) + { + throw new Ice.ObjectNotExistException(c.id, c.facet, c.operation); + } + if(_parent == null) + { + throw new PermissionDenied("Cannot destroy root directory"); + } + if(!_dir.nodes.isEmpty()) + { + throw new PermissionDenied("Cannot destroy non-empty directory"); + } + _destroyed = true; + _parent.removeEntry(_dir.name); + _map.remove(c.id); + c.adapter.remove(c.id); + } + + public synchronized String + name(Ice.Current c) + { + if(_destroyed) + { + throw new Ice.ObjectNotExistException(); + } + return _dir.name; + } + + public synchronized NodeDesc[] + list(Ice.Current c) + { + if(_destroyed) + { + throw new Ice.ObjectNotExistException(); + } + NodeDesc[] result = new NodeDesc[_dir.nodes.size()]; + java.util.Iterator<NodeDesc> p = _dir.nodes.values().iterator(); + for(int i = 0; i < _dir.nodes.size(); ++i) + { + result[i] = p.next(); + } + return result; + } + + public synchronized NodeDesc + find(String name, Ice.Current c) + throws NoSuchName + { + if(_destroyed) + { + throw new Ice.ObjectNotExistException(); + } + NodeDesc nd = _dir.nodes.get(name); + if(nd == null) + { + throw new NoSuchName(name); + } + return nd; + } + + public synchronized FilePrx + createFile(String name, Ice.Current c) + throws NameInUse + { + if(_destroyed) + { + throw new Ice.ObjectNotExistException(); + } + + if(name.isEmpty() || _dir.nodes.get(name) != null) + { + throw new NameInUse(name); + } + + PersistentFile persistentFile = new PersistentFile(); + persistentFile.name = name; + Ice.Identity id = _communicator.stringToIdentity(java.util.UUID.randomUUID().toString()); + FileI file = new FileI(persistentFile, this); + _map.put(id, persistentFile); + + FilePrx proxy = FilePrxHelper.uncheckedCast(c.adapter.createProxy(id)); + + NodeDesc nd = new NodeDesc(); + nd.name = name; + nd.type = NodeType.FileType; + nd.proxy = proxy; + _dir.nodes.put(name, nd); + + _map.put(c.id, _dir); + + _adapter.add(file, id); + + return proxy; + } + + public synchronized DirectoryPrx + createDirectory(String name, Ice.Current c) + throws NameInUse + { + if(_destroyed) + { + throw new Ice.ObjectNotExistException(); + } + + if(name.isEmpty() || _dir.nodes.get(name) != null) + { + throw new NameInUse(name); + } + + PersistentDirectory persistentDir = new PersistentDirectory(); + persistentDir.name = name; + persistentDir.nodes = new java.util.HashMap<String, NodeDesc>(); + Ice.Identity id = _communicator.stringToIdentity(java.util.UUID.randomUUID().toString()); + DirectoryI dir = new DirectoryI(id, persistentDir, this); + _map.put(id, persistentDir); + + DirectoryPrx proxy = DirectoryPrxHelper.uncheckedCast(c.adapter.createProxy(id)); + + NodeDesc nd = new NodeDesc(); + nd.name = name; + nd.type = NodeType.DirType; + nd.proxy = proxy; + _dir.nodes.put(name, nd); + + _map.put(c.id, _dir); + + _adapter.add(dir, id); + + return proxy; + } + + // + // Called by the child to remove itself from the parent's node map when the child is destroyed. + // + public synchronized void + removeEntry(String name) + { + _dir.nodes.remove(name); + _map.put(_id, _dir); + } + + public + DirectoryI(Ice.Identity pid, PersistentDirectory dir, DirectoryI parent) + { + _id = pid; + _dir = dir; + _parent = parent; + _destroyed = false; + + // Instantiate the child nodes + // + java.util.Iterator<NodeDesc> p = _dir.nodes.values().iterator(); + while(p.hasNext()) + { + NodeDesc desc = p.next(); + Ice.Identity id = desc.proxy.ice_getIdentity(); + PersistentNode node = _map.get(id); + assert(node != null); + if(desc.type == NodeType.DirType) + { + PersistentDirectory pDir = (PersistentDirectory)node; + assert(pDir != null); + DirectoryI d = new DirectoryI(id, pDir, this); + _adapter.add(d, id); + } + else + { + PersistentFile pFile = (PersistentFile)node; + assert(pFile != null); + FileI f = new FileI(pFile, this); + _adapter.add(f, id); + } + } + } + + public static Ice.Communicator _communicator; + public static Ice.ObjectAdapter _adapter; + public static IdentityNodeMap _map; + + private Ice.Identity _id; + private PersistentDirectory _dir; + private DirectoryI _parent; + private boolean _destroyed; +} diff --git a/java/demo/book/map_filesystem/FileI.java b/java/demo/book/map_filesystem/FileI.java new file mode 100644 index 00000000000..3099da800cb --- /dev/null +++ b/java/demo/book/map_filesystem/FileI.java @@ -0,0 +1,73 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +import Filesystem.*; + +public class FileI extends _FileDisp +{ + public synchronized String + name(Ice.Current c) + { + if(_destroyed) + { + throw new Ice.ObjectNotExistException(); + } + return _file.name; + } + + public synchronized void + destroy(Ice.Current c) + throws PermissionDenied + { + if(_destroyed) + { + throw new Ice.ObjectNotExistException(c.id, c.facet, c.operation); + } + _destroyed = true; + _parent.removeEntry(_file.name); + _map.remove(c.id); + c.adapter.remove(c.id); + } + + public synchronized String[] + read(Ice.Current c) + { + if(_destroyed) + { + throw new Ice.ObjectNotExistException(c.id, c.facet, c.operation); + } + return _file.text; + } + + public synchronized void + write(String[] text, Ice.Current c) + throws GenericError + { + if(_destroyed) + { + throw new Ice.ObjectNotExistException(c.id, c.facet, c.operation); + } + _file.text = text; + _map.put(c.id, _file); + } + + public + FileI(PersistentFile file, DirectoryI parent) + { + _file = file; + _parent = parent; + _destroyed = false; + } + + public static IdentityNodeMap _map; + + private PersistentFile _file; + private DirectoryI _parent; + private boolean _destroyed; +} diff --git a/java/demo/book/map_filesystem/Filesystem.ice b/java/demo/book/map_filesystem/Filesystem.ice new file mode 100644 index 00000000000..746148fba73 --- /dev/null +++ b/java/demo/book/map_filesystem/Filesystem.ice @@ -0,0 +1,52 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +module Filesystem +{ + exception GenericError + { + string reason; + }; + exception PermissionDenied extends GenericError {}; + exception NameInUse extends GenericError {}; + exception NoSuchName extends GenericError {}; + + interface Node + { + idempotent string name(); + void destroy() throws PermissionDenied; + }; + + sequence<string> Lines; + + interface File extends Node + { + idempotent Lines read(); + idempotent void write(Lines text) throws GenericError; + }; + + enum NodeType { DirType, FileType }; + + struct NodeDesc + { + string name; + NodeType type; + Node* proxy; + }; + + sequence<NodeDesc> NodeDescSeq; + + interface Directory extends Node + { + idempotent NodeDescSeq list(); + idempotent NodeDesc find(string name) throws NoSuchName; + File* createFile(string name) throws NameInUse; + Directory* createDirectory(string name) throws NameInUse; + }; +}; diff --git a/java/demo/book/map_filesystem/Grammar.java b/java/demo/book/map_filesystem/Grammar.java new file mode 100644 index 00000000000..e9e94969364 --- /dev/null +++ b/java/demo/book/map_filesystem/Grammar.java @@ -0,0 +1,202 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +class Grammar +{ + Grammar(Parser p) + { + _parser = p; + _scanner = new Scanner(_parser); + } + + void + parse() + { + while(true) + { + try + { + _token = _scanner.nextToken(); + if(_token == null) + { + return; + } + else if(_token.type == Token.TOK_SEMI) + { + // Continue + } + else if(_token.type == Token.TOK_HELP) + { + _token = _scanner.nextToken(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + _parser.usage(); + } + else if(_token.type == Token.TOK_EXIT) + { + _token = _scanner.nextToken(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + return; + } + else if(_token.type == Token.TOK_LIST) + { + _token = _scanner.nextToken(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + _parser.list(false); + } + else if(_token.type == Token.TOK_LIST_RECURSIVE) + { + _token = _scanner.nextToken(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + _parser.list(true); + } + else if(_token.type == Token.TOK_CREATE_FILE) + { + java.util.List<String> s = strings(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + if(s.size() == 0) + { + throw new ParseError("usage: mkfile FILE [FILE...]"); + } + _parser.createFile(s); + } + else if(_token.type == Token.TOK_CREATE_DIR) + { + java.util.List<String> s = strings(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + if(s.size() == 0) + { + throw new ParseError("usage: mkdir DIR [DIR...]"); + } + _parser.createDir(s); + } + else if(_token.type == Token.TOK_PWD) + { + _token = _scanner.nextToken(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + _parser.pwd(); + } + else if(_token.type == Token.TOK_CD) + { + java.util.List<String> s = strings(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + if(s.size() > 1) + { + throw new ParseError("usage: cd [DIR]"); + } + else if(s.size() == 0) + { + _parser.cd("/"); + } + else + { + _parser.cd((String)s.get(0)); + } + } + else if(_token.type == Token.TOK_CAT) + { + java.util.List<String> s = strings(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + if(s.size() != 1) + { + throw new ParseError("usage: cat FILE"); + } + _parser.cat((String)s.get(0)); + } + else if(_token.type == Token.TOK_WRITE) + { + java.util.LinkedList<String> s = strings(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + if(s.size() == 0) + { + throw new ParseError("usage: write FILE [STRING...]"); + } + _parser.write(s); + } + else if(_token.type == Token.TOK_RM) + { + java.util.List<String> s = strings(); + if(_token.type != Token.TOK_SEMI) + { + throw new ParseError("Expected ';'"); + } + if(s.size() == 0) + { + throw new ParseError("usage: rm NAME [NAME...]"); + } + _parser.destroy(s); + } + else + { + _parser.error("parse error"); + } + } + catch(ParseError e) + { + _parser.error("Parse error: " + e.getMessage()); + } + } + } + + private java.util.LinkedList<String> + strings() + { + java.util.LinkedList<String> l = new java.util.LinkedList<String>(); + while(true) + { + _token = _scanner.nextToken(); + if(_token.type != Token.TOK_STRING) + { + return l; + } + l.add(_token.value); + } + } + + static private class ParseError extends RuntimeException + { + ParseError(String msg) + { + super(msg); + } + } + + private Parser _parser; + private Scanner _scanner; + private Token _token; +} diff --git a/java/demo/book/map_filesystem/Parser.java b/java/demo/book/map_filesystem/Parser.java new file mode 100644 index 00000000000..9a2889b7473 --- /dev/null +++ b/java/demo/book/map_filesystem/Parser.java @@ -0,0 +1,349 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +import Filesystem.*; + +class Parser +{ + Parser(DirectoryPrx root) + { + _dirs = new java.util.LinkedList<DirectoryPrx>(); + _dirs.addFirst(root); + } + + void + usage() + { + System.err.print( + "help Print this message.\n" + + "pwd Print current directory (/ = root).\n" + + "cd [DIR] Change directory (/ or empty = root).\n" + + "ls List current directory.\n" + + "lr Recursively list current directory.\n" + + "mkdir DIR [DIR...] Create directories DIR in current directory.\n" + + "mkfile FILE [FILE...] Create files FILE in current directory.\n" + + "rm NAME [NAME...] Delete directory or file NAME (rm * to delete all).\n" + + "cat FILE List the contents of FILE.\n" + + "write FILE [STRING...] Write STRING to FILE.\n" + + "exit, quit Exit this program.\n"); + } + + void + list(boolean recursive) + { + try + { + list(_dirs.get(0), recursive, 0); + } + catch(Ice.LocalException ex) + { + error(ex.toString()); + } + } + + void + list(Filesystem.DirectoryPrx dir, boolean recursive, int depth) + { + StringBuilder b = new StringBuilder(); + for(int i = 0; i < depth; ++i) + { + b.append('\t'); + } + String indent = b.toString(); + + NodeDesc[] contents = dir.list(); + + for(int i = 0; i < contents.length; ++i) + { + DirectoryPrx d + = contents[i].type == NodeType.DirType + ? DirectoryPrxHelper.uncheckedCast(contents[i].proxy) + : null; + System.out.print(indent + contents[i].name + (d != null ? " (directory)" : " (file)")); + if(d != null && recursive) + { + System.out.println(":"); + list(d, true, ++depth); + } + else + { + System.out.println(); + } + } + } + + void + createFile(java.util.List<String> names) + { + DirectoryPrx dir = _dirs.getFirst(); + + for(String name : names) + { + if(name.equals("..")) + { + System.out.println("Cannot create a file named `..'"); + continue; + } + + try + { + dir.createFile(name); + } + catch(NameInUse ex) + { + System.out.println("`" + name + "' exists already"); + } + } + } + + void + createDir(java.util.List<String> names) + { + DirectoryPrx dir = _dirs.getFirst(); + + for(String name : names) + { + if(name.equals("..")) + { + System.out.println("Cannot create a directory named `..'"); + continue; + } + + try + { + dir.createDirectory(name); + } + catch(NameInUse ex) + { + System.out.println("`" + name + "' exists already"); + } + } + } + + void + pwd() + { + if(_dirs.size() == 1) + { + System.out.print("/"); + } + else + { + java.util.ListIterator<DirectoryPrx> i = _dirs.listIterator(_dirs.size()); + i.previous(); + while(i.hasPrevious()) + { + System.out.print("/" + i.previous().name()); + } + } + System.out.println(); + } + + void + cd(String name) + { + if(name.equals("/")) + { + while(_dirs.size() > 1) + { + _dirs.removeFirst(); + } + return; + } + + if(name.equals("..")) + { + if(_dirs.size() > 1) + { + _dirs.removeFirst(); + } + return; + } + + DirectoryPrx dir = _dirs.getFirst(); + NodeDesc d; + try + { + d = dir.find(name); + } + catch(NoSuchName ex) + { + System.out.println("`" + name + "': no such directory"); + return; + } + if(d.type == NodeType.FileType) + { + System.out.println("`" + name + "': not a directory"); + return; + } + _dirs.addFirst(DirectoryPrxHelper.uncheckedCast(d.proxy)); + } + + void + cat(String name) + { + DirectoryPrx dir = _dirs.getFirst(); + NodeDesc d; + try + { + d = dir.find(name); + } + catch(NoSuchName ex) + { + System.out.println("`" + name + "': no such file"); + return; + } + if(d.type == NodeType.DirType) + { + System.out.println("`" + name + "': not a file"); + return; + } + FilePrx f = FilePrxHelper.uncheckedCast(d.proxy); + String[] l = f.read(); + for(int i = 0; i < l.length; ++i) + { + System.out.println(l[i]); + } + } + + void + write(java.util.LinkedList<String> args) + { + DirectoryPrx dir = _dirs.getFirst(); + String name = args.getFirst(); + args.removeFirst(); + NodeDesc d; + try + { + d = dir.find(name); + } + catch(NoSuchName ex) + { + System.out.println("`" + name + "': no such file"); + return; + } + if(d.type == NodeType.DirType) + { + System.out.println("`" + name + "': not a file"); + return; + } + FilePrx f = FilePrxHelper.uncheckedCast(d.proxy); + + String[] l = args.toArray(new String[0]); + try + { + f.write(l); + } + catch(GenericError ex) + { + System.out.println("`" + name + "': cannot write to file: " + ex.reason); + } + } + + void + destroy(java.util.List<String> names) + { + DirectoryPrx dir = _dirs.getFirst(); + + for(String name : names) + { + if(name.equals("*")) + { + NodeDesc[] nodes = dir.list(); + for(NodeDesc node : nodes) + { + try + { + node.proxy.destroy(); + } + catch(PermissionDenied ex) + { + System.out.println("cannot remove `" + node.name + "': " + ex.reason); + } + } + return; + } + else + { + NodeDesc d; + try + { + d = dir.find(name); + } + catch(NoSuchName ex) + { + System.out.println("`" + name + "': no such file or directory"); + return; + } + try + { + d.proxy.destroy(); + } + catch(PermissionDenied ex) + { + System.out.println("cannot remove `" + name + "': " + ex.reason); + } + } + } + } + + void + error(String s) + { + System.err.println("error: " + s); + } + + void + warning(String s) + { + System.err.println("warning: " + s); + } + + String + getInput() + { + System.out.print("> "); + System.out.flush(); + + try + { + return _in.readLine(); + } + catch(java.io.IOException e) + { + return null; + } + } + + int + parse() + { + _in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); + + Grammar g = new Grammar(this); + g.parse(); + + return 0; + } + + int + parse(java.io.BufferedReader in) + { + _in = in; + + Grammar g = new Grammar(this); + g.parse(); + + return 0; + } + + private java.util.LinkedList<DirectoryPrx> _dirs; + + private java.io.BufferedReader _in; +} diff --git a/java/demo/book/map_filesystem/PersistentFilesystem.ice b/java/demo/book/map_filesystem/PersistentFilesystem.ice new file mode 100644 index 00000000000..356c0e10454 --- /dev/null +++ b/java/demo/book/map_filesystem/PersistentFilesystem.ice @@ -0,0 +1,35 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 <Filesystem.ice> + +module Filesystem +{ + class PersistentDirectory; + + class PersistentNode + { + string name; + PersistentDirectory* parent; + }; + + ["cpp:virtual"] + class PersistentFile extends PersistentNode + { + Lines text; + }; + + dictionary<string, NodeDesc> NodeDict; + + ["cpp:virtual"] + class PersistentDirectory extends PersistentNode + { + NodeDict nodes; + }; +}; diff --git a/java/demo/book/freeze_filesystem/README b/java/demo/book/map_filesystem/README index 32f3381a068..4cf93946329 100644 --- a/java/demo/book/freeze_filesystem/README +++ b/java/demo/book/map_filesystem/README @@ -1,5 +1,6 @@ This demo presents an alternate implementation of the filesystem -application, as discussed in the Freeze chapter of the Ice manual. +application using a Freeze map, as discussed in the Freeze chapter of +the Ice manual. To run it, start the server in a window: diff --git a/java/demo/book/map_filesystem/Scanner.java b/java/demo/book/map_filesystem/Scanner.java new file mode 100644 index 00000000000..c4c695fcd8b --- /dev/null +++ b/java/demo/book/map_filesystem/Scanner.java @@ -0,0 +1,283 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +class Scanner +{ + Scanner(Parser p) + { + _parser = p; + } + + Token + nextToken() + { + String s = next(); + if(s == null) + { + return null; + } + + if(s.equals(";")) + { + return new Token(Token.TOK_SEMI); + } + else if(s.equals("help")) + { + return new Token(Token.TOK_HELP); + } + else if(s.equals("exit") || s.equals("quit")) + { + return new Token(Token.TOK_EXIT); + } + else if(s.equals("ls")) + { + return new Token(Token.TOK_LIST); + } + else if(s.equals("lr")) + { + return new Token(Token.TOK_LIST_RECURSIVE); + } + else if(s.equals("mkfile")) + { + return new Token(Token.TOK_CREATE_FILE); + } + else if(s.equals("mkdir")) + { + return new Token(Token.TOK_CREATE_DIR); + } + else if(s.equals("pwd")) + { + return new Token(Token.TOK_PWD); + } + else if(s.equals("cd")) + { + return new Token(Token.TOK_CD); + } + else if(s.equals("cat")) + { + return new Token(Token.TOK_CAT); + } + else if(s.equals("write")) + { + return new Token(Token.TOK_WRITE); + } + else if(s.equals("rm")) + { + return new Token(Token.TOK_RM); + } + else + { + return new Token(Token.TOK_STRING, s); + } + } + + static private class EndOfInput extends Exception + { + } + + private char + get() + throws EndOfInput + { + // + // If there is an character in the unget buffer, return it. + // + if(_unget) + { + _unget = false; + return _ungetChar; + } + + // + // No current buffer? + // + if(_buf == null) + { + _buf = _parser.getInput(); + _pos = 0; + if(_buf == null) + { + throw new EndOfInput(); + } + } + + // + // At the end-of-buffer? + // + while(_pos >= _buf.length()) + { + _buf = null; + _pos = 0; + return '\n'; + } + + return _buf.charAt(_pos++); + } + + // + // unget only works with one character. + // + private void + unget(char c) + { + assert(!_unget); + _unget = true; + _ungetChar = c; + } + + private String + next() + { + // + // Eat any whitespace. + // + char c; + try + { + do + { + c = get(); + } + while(Character.isWhitespace(c) && c != '\n'); + } + catch(EndOfInput ignore) + { + return null; + } + + StringBuilder buf = new StringBuilder(128); + + if(c == ';' || c == '\n') + { + buf.append(';'); + } + else if(c == '\'') + { + try + { + while(true) + { + c = get(); + if(c == '\'') + { + break; + } + else + { + buf.append(c); + } + } + } + catch(EndOfInput e) + { + _parser.warning("EOF in string"); + } + } + else if(c == '\"') + { + try + { + while(true) + { + c = get(); + if(c == '\"') + { + break; + } + else if(c == '\\') + { + try + { + char next = get(); + switch(next) + { + case '\\': + case '"': + { + buf.append(next); + break; + } + + case 'n': + { + buf.append('\n'); + break; + } + + case 'r': + { + buf.append('\r'); + break; + } + + case 't': + { + buf.append('\t'); + break; + } + + case 'f': + { + buf.append('\f'); + break; + } + + default: + { + buf.append(c); + unget(next); + } + } + } + catch(EndOfInput e) + { + buf.append(c); + } + } + else + { + buf.append(c); + } + } + } + catch(EndOfInput e) + { + _parser.warning("EOF in string"); + } + } + else + { + // + // Otherwise it's a string. + // + try + { + do + { + buf.append(c); + c = get(); + } + while(!Character.isWhitespace(c) && c != ';' && c != '\n'); + + unget(c); + } + catch(EndOfInput ignore) + { + } + } + + return buf.toString(); + } + + private Parser _parser; + private boolean _unget = false; + private char _ungetChar; + private String _buf = null; + private int _pos; +} diff --git a/java/demo/book/map_filesystem/Server.java b/java/demo/book/map_filesystem/Server.java new file mode 100644 index 00000000000..4bc2a397c42 --- /dev/null +++ b/java/demo/book/map_filesystem/Server.java @@ -0,0 +1,86 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +import Filesystem.*; + +public class Server extends Ice.Application +{ + public + Server(String envName) + { + _envName = envName; + } + + public int + run(String[] args) + { + // Install object factories + // + communicator().addObjectFactory(PersistentFile.ice_factory(), PersistentFile.ice_staticId()); + communicator().addObjectFactory(PersistentDirectory.ice_factory(), PersistentDirectory.ice_staticId()); + + // Create an object adapter (stored in the _adapter static member) + // + Ice.ObjectAdapter adapter = + communicator().createObjectAdapter("MapFilesystem"); + + // Create a Freeze connection and the map + // + Freeze.Connection connection = Freeze.Util.createConnection(communicator(), _envName); + IdentityNodeMap persistentMap = new IdentityNodeMap(connection, "mapfs", true); + + // Set static members + // + FileI._map = persistentMap; + DirectoryI._map = persistentMap; + DirectoryI._communicator = communicator(); + DirectoryI._adapter = adapter; + + // Find the persistent node for the root directory, or create it if not found + // + Ice.Identity rootId = Ice.Util.stringToIdentity("RootDir"); + PersistentDirectory pRoot = (PersistentDirectory)persistentMap.get(rootId); + if(pRoot == null) + { + pRoot = new PersistentDirectory(); + pRoot.name = "/"; + pRoot.nodes = new java.util.HashMap<String, NodeDesc>(); + persistentMap.put(rootId, pRoot); + } + + // Create the root directory (with name "/" and no parent) + // + DirectoryI root = new DirectoryI(rootId, pRoot, null); + adapter.add(root, rootId); + + // Ready to accept requests now + // + adapter.activate(); + + // Wait until we are done + // + communicator().waitForShutdown(); + + // Clean up + // + connection.close(); + + return 0; + } + + public static void + main(String[] args) + { + Server app = new Server("db"); + app.main("demo.book.map_filesystem.Server", args, "config.server"); + System.exit(0); + } + + private String _envName; +} diff --git a/java/demo/book/map_filesystem/Token.java b/java/demo/book/map_filesystem/Token.java new file mode 100644 index 00000000000..e9b76961ea7 --- /dev/null +++ b/java/demo/book/map_filesystem/Token.java @@ -0,0 +1,40 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +class Token +{ + public static final int TOK_HELP = 0; + public static final int TOK_EXIT = 1; + public static final int TOK_SEMI = 2; + public static final int TOK_LIST = 3; + public static final int TOK_LIST_RECURSIVE = 4; + public static final int TOK_CREATE_FILE = 5; + public static final int TOK_CREATE_DIR = 6; + public static final int TOK_PWD = 7; + public static final int TOK_CD = 8; + public static final int TOK_CAT = 9; + public static final int TOK_WRITE = 10; + public static final int TOK_RM = 11; + public static final int TOK_STRING = 12; + + int type; + String value; + + Token(int t) + { + type = t; + value = null; + } + + Token(int t, String v) + { + type = t; + value = v; + } +} diff --git a/java/demo/book/map_filesystem/build.xml b/java/demo/book/map_filesystem/build.xml new file mode 100644 index 00000000000..937733fe13f --- /dev/null +++ b/java/demo/book/map_filesystem/build.xml @@ -0,0 +1,64 @@ +<!-- + ********************************************************************** + + Copyright (c) 2003-2009 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. + + ********************************************************************** +--> + +<project name="demo_book_map_filesystem" default="all" basedir="."> + + <!-- set global properties for this build --> + <property name="top.dir" value="../../.."/> + + <!-- import common definitions --> + <import file="${top.dir}/config/common.xml"/> + + <target name="generate" depends="init"> + <!-- Create the output directory for generated code --> + <mkdir dir="${generated.dir}"/> + <slice2java outputdir="${generated.dir}"> + <includepath> + <pathelement path="." /> + </includepath> + <fileset dir="." includes="Filesystem.ice"/> + <fileset dir="." includes="PersistentFilesystem.ice"/> + </slice2java> + + <slice2freezej ice="on" outputdir="${generated.dir}"> + <includepath> + <pathelement path="." /> + <pathelement path="${slice.dir}" /> + </includepath> + <fileset dir="." includes="Filesystem.ice"/> + <fileset dir="." includes="PersistentFilesystem.ice"/> + <fileset dir="." includes="Filesystem.ice,PersistentFilesystem.ice"/> + <fileset dir="${slice.dir}/Ice" includes="Identity.ice"/> + <dict name="Filesystem.IdentityNodeMap" key="Ice::Identity" value="Filesystem::PersistentNode"/> + </slice2freezej> + + </target> + + <target name="compile" depends="generate"> + <mkdir dir="${class.dir}"/> + <javac srcdir=".:${generated.dir}" destdir="${class.dir}" debug="${debug}"> + <exclude name="${generated.dir}/**"/> + <classpath> + <path refid="ice.classpath"/> + <path refid="freeze.classpath"/> + </classpath> + <compilerarg value="${javac.lint}"/> + </javac> + </target> + + <target name="all" depends="compile"/> + + <target name="clean"> + <delete dir="${generated.dir}"/> + <delete dir="${class.dir}"/> + </target> + +</project> diff --git a/java/demo/book/map_filesystem/config.client b/java/demo/book/map_filesystem/config.client new file mode 100644 index 00000000000..6f0ba50b98f --- /dev/null +++ b/java/demo/book/map_filesystem/config.client @@ -0,0 +1,28 @@ +# +# The client reads this property to create the reference to the root +# "directory" object in the server. +# +RootDir.Proxy=RootDir:default -p 10000 + +# +# Warn about connection exceptions +# +Ice.Warn.Connections=1 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +#Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 diff --git a/java/demo/book/freeze_filesystem/config.server b/java/demo/book/map_filesystem/config.server index 8ee5723e944..1b56c7c588a 100644 --- a/java/demo/book/freeze_filesystem/config.server +++ b/java/demo/book/map_filesystem/config.server @@ -1,7 +1,7 @@ # # Configure the server endpoints. # -FreezeFilesystem.Endpoints=default -p 10000 +MapFilesystem.Endpoints=default -h 127.0.0.1 -p 10000 # # Freeze Map Tracing. diff --git a/java/demo/book/map_filesystem/db/.gitignore b/java/demo/book/map_filesystem/db/.gitignore new file mode 100644 index 00000000000..39af5887579 --- /dev/null +++ b/java/demo/book/map_filesystem/db/.gitignore @@ -0,0 +1 @@ +# Dummy file, so that git retains this otherwise empty directory. diff --git a/java/demo/book/freeze_filesystem/expect.py b/java/demo/book/map_filesystem/expect.py index dcb76d36540..a5afc074999 100755 --- a/java/demo/book/freeze_filesystem/expect.py +++ b/java/demo/book/map_filesystem/expect.py @@ -20,7 +20,7 @@ if len(path) == 0: sys.path.append(path[0]) from demoscript import * -from demoscript.book import freeze_filesystem +from demoscript.book import map_filesystem print "cleaning databases...", sys.stdout.flush() @@ -31,4 +31,4 @@ server = Util.spawn('java Server --Ice.PrintAdapterReady') server.expect('.* ready') client = Util.spawn('java Client') -freeze_filesystem.run(client, server) +map_filesystem.run(client, server) diff --git a/java/demo/book/simple_filesystem/Server.java b/java/demo/book/simple_filesystem/Server.java index 5d4101af9cc..aefca791431 100644 --- a/java/demo/book/simple_filesystem/Server.java +++ b/java/demo/book/simple_filesystem/Server.java @@ -20,7 +20,7 @@ public class Server extends Ice.Application { // Create an object adapter. // Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints( - "SimpleFilesystem", "default -p 10000"); + "SimpleFilesystem", "default -h 127.0.0.1 -p 10000"); // Create the root directory (with name "/" and no parent) // diff --git a/py/demo/book/simple_filesystem/Server.py b/py/demo/book/simple_filesystem/Server.py index 75982f0b70b..1ebc507098b 100755 --- a/py/demo/book/simple_filesystem/Server.py +++ b/py/demo/book/simple_filesystem/Server.py @@ -93,7 +93,8 @@ class Server(Ice.Application): # Create an object adapter # - adapter = self.communicator().createObjectAdapterWithEndpoints("SimpleFileSystem", "default -p 10000") + adapter = self.communicator().createObjectAdapterWithEndpoints( + "SimpleFileSystem", "default -h 127.0.0.1 -p 10000") # Create the root directory (with name "/" and no parent) # diff --git a/vb/demo/book/simple_filesystem/Server.vb b/vb/demo/book/simple_filesystem/Server.vb index 87d20174952..0145b36e59d 100644 --- a/vb/demo/book/simple_filesystem/Server.vb +++ b/vb/demo/book/simple_filesystem/Server.vb @@ -15,7 +15,7 @@ Module Server ' static members)
'
Dim adapter As Ice.ObjectAdapter = communicator().createObjectAdapterWithEndpoints( _
- "SimpleFilesystem", "default -p 10000")
+ "SimpleFilesystem", "default -h 127.0.0.1 -p 10000")
DirectoryI._adapter = adapter
FileI._adapter = adapter
|