summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2002-07-17 20:10:41 +0000
committerMatthew Newhook <matthew@zeroc.com>2002-07-17 20:10:41 +0000
commitf7965adf013cb576a3d2cd0f05e2731ab10b4f8d (patch)
treee820b257dbb0d7fb653961124d1a27da86751b96 /cpp/src
parentHave added new capabilities to Glacier to adjust the issued time to allow (diff)
downloadice-f7965adf013cb576a3d2cd0f05e2731ab10b4f8d.tar.bz2
ice-f7965adf013cb576a3d2cd0f05e2731ab10b4f8d.tar.xz
ice-f7965adf013cb576a3d2cd0f05e2731ab10b4f8d.zip
Added Yellow implementation.
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Makefile3
-rw-r--r--cpp/src/Yellow/.depend10
-rw-r--r--cpp/src/Yellow/Admin.cpp252
-rw-r--r--cpp/src/Yellow/AdminI.cpp85
-rw-r--r--cpp/src/Yellow/AdminI.h36
-rw-r--r--cpp/src/Yellow/Grammar.y118
-rw-r--r--cpp/src/Yellow/Makefile107
-rw-r--r--cpp/src/Yellow/Parser.cpp414
-rw-r--r--cpp/src/Yellow/Parser.h110
-rw-r--r--cpp/src/Yellow/QueryI.cpp45
-rw-r--r--cpp/src/Yellow/QueryI.h36
-rw-r--r--cpp/src/Yellow/Scanner.l275
-rw-r--r--cpp/src/Yellow/Service.cpp121
13 files changed, 1611 insertions, 1 deletions
diff --git a/cpp/src/Makefile b/cpp/src/Makefile
index 4565687d369..d50cc571636 100644
--- a/cpp/src/Makefile
+++ b/cpp/src/Makefile
@@ -29,7 +29,8 @@ SUBDIRS = IceUtil \
IceStorm \
IcePack \
Glacier \
- IcePatch
+ IcePatch \
+ Yellow
$(EVERYTHING)::
@for subdir in $(SUBDIRS); \
diff --git a/cpp/src/Yellow/.depend b/cpp/src/Yellow/.depend
new file mode 100644
index 00000000000..2c08ca07ff4
--- /dev/null
+++ b/cpp/src/Yellow/.depend
@@ -0,0 +1,10 @@
+Yellow.o: Yellow.cpp ../../include/Yellow/Yellow.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/ObjectFactory.h ../../include/Ice/Stream.h
+Yellow.o: Yellow.cpp ../../include/Yellow/Yellow.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/ObjectFactory.h ../../include/Ice/Stream.h
+StringObjectProxySeqDict.o: StringObjectProxySeqDict.cpp ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../Yellow/StringObjectProxySeqDict.h ../../include/Freeze/Map.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/PropertiesF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Freeze/DB.h ../../include/Freeze/DBException.h ../../include/Freeze/DBF.h ../../include/Freeze/EvictorF.h
+AdminI.o: AdminI.cpp ../Yellow/AdminI.h ../../include/Yellow/Yellow.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/BuiltinSequences.h ../Yellow/StringObjectProxySeqDict.h ../../include/Freeze/Map.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/PropertiesF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Freeze/DB.h ../../include/Freeze/DBException.h ../../include/Freeze/DBF.h ../../include/Freeze/EvictorF.h
+QueryI.o: QueryI.cpp ../Yellow/QueryI.h ../../include/Yellow/Yellow.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/BuiltinSequences.h ../Yellow/StringObjectProxySeqDict.h ../../include/Freeze/Map.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/PropertiesF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Freeze/DB.h ../../include/Freeze/DBException.h ../../include/Freeze/DBF.h ../../include/Freeze/EvictorF.h
+Service.o: Service.cpp ../Yellow/AdminI.h ../../include/Yellow/Yellow.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/BuiltinSequences.h ../Yellow/StringObjectProxySeqDict.h ../../include/Freeze/Map.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/PropertiesF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Freeze/DB.h ../../include/Freeze/DBException.h ../../include/Freeze/DBF.h ../../include/Freeze/EvictorF.h ../Yellow/QueryI.h ../../include/IceBox/IceBox.h
+Admin.o: Admin.cpp ../../include/Ice/Application.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../Yellow/Parser.h ../../include/Yellow/Yellow.h
+Grammar.o: Grammar.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../Yellow/Parser.h ../../include/Yellow/Yellow.h
+Scanner.o: Scanner.cpp ../../include/IceUtil/Config.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../Yellow/Parser.h ../../include/Yellow/Yellow.h ../Yellow/Grammar.h
+Parser.o: Parser.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../Yellow/Parser.h ../../include/Yellow/Yellow.h
diff --git a/cpp/src/Yellow/Admin.cpp b/cpp/src/Yellow/Admin.cpp
new file mode 100644
index 00000000000..4cfab0cdf1d
--- /dev/null
+++ b/cpp/src/Yellow/Admin.cpp
@@ -0,0 +1,252 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// Mutable Realms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Ice/Application.h>
+#include <Yellow/Parser.h>
+#include <fstream>
+
+using namespace std;
+using namespace Ice;
+using namespace Yellow;
+
+class Client : public Application
+{
+public:
+
+ void usage();
+ virtual int run(int, char*[]);
+};
+
+int
+main(int argc, char* argv[])
+{
+ Client app;
+ return app.main(argc, argv);
+}
+
+void
+Client::usage()
+{
+ cerr << "Usage: " << appName() << " [options] [file...]\n";
+ cerr <<
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-v, --version Display the Ice version.\n"
+ "-DNAME Define NAME as 1.\n"
+ "-DNAME=DEF Define NAME as DEF.\n"
+ "-UNAME Remove any definition for NAME.\n"
+ "-IDIR Put DIR in the include file search path.\n"
+ "-e COMMANDS Execute COMMANDS.\n"
+ "-d, --debug Print debug messages.\n"
+ "-s, --service name the service name (defaults to Yellow).\n"
+ ;
+}
+
+int
+Client::run(int argc, char* argv[])
+{
+ string cpp("cpp");
+ string commands;
+ bool debug = false;
+ string service("Yellow");
+
+ PropertiesPtr properties = communicator()->getProperties();
+
+ StringSeq args = argsToStringSeq(argc, argv);
+ args = properties->parseCommandLineOptions("Yellow", args);
+ stringSeqToArgs(args, argc, argv);
+
+ int idx = 1;
+ while(idx < argc)
+ {
+ if(strncmp(argv[idx], "-I", 2) == 0)
+ {
+ cpp += ' ';
+ cpp += argv[idx];
+
+ for(int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
+ else if(strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
+ {
+ cpp += ' ';
+ cpp += argv[idx];
+
+ for(int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
+ else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ {
+ usage();
+ return EXIT_SUCCESS;
+ }
+ else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
+ {
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
+ }
+ else if(strcmp(argv[idx], "-e") == 0)
+ {
+ if(idx + 1 >= argc)
+ {
+ cerr << appName() << ": argument expected for`" << argv[idx] << "'" << endl;
+ usage();
+ return EXIT_FAILURE;
+ }
+
+ commands += argv[idx + 1];
+ commands += ';';
+
+ for(int i = idx ; i + 2 < argc ; ++i)
+ {
+ argv[i] = argv[i + 2];
+ }
+ argc -= 2;
+ }
+ else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
+ {
+ debug = true;
+ for(int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
+ else if(strcmp(argv[idx], "-s") == 0 || strcmp(argv[idx], "--service") == 0)
+ {
+ if(idx + 1 >= argc)
+ {
+ cerr << appName() << ": argument expected for`" << argv[idx] << "'" << endl;
+ usage();
+ return EXIT_FAILURE;
+ }
+
+ service = argv[idx + 1];
+
+ for(int i = idx ; i + 2 < argc ; ++i)
+ {
+ argv[i] = argv[i + 2];
+ }
+ argc -= 2;
+ }
+ else if(argv[idx][0] == '-')
+ {
+ cerr << appName() << ": unknown option `" << argv[idx] << "'" << endl;
+ usage();
+ return EXIT_FAILURE;
+ }
+ else
+ {
+ ++idx;
+ }
+ }
+
+ if(argc >= 2 && !commands.empty())
+ {
+ cerr << appName() << ": `-e' option cannot be used if input files are given" << endl;
+ usage();
+ return EXIT_FAILURE;
+ }
+
+ string queryProxy = communicator()->getProperties()->getProperty(service + ".Query");
+ string adminProxy = communicator()->getProperties()->getProperty(service + ".Admin");
+
+ if(queryProxy.empty())
+ {
+ queryProxy = "Yellow/Query@YellowQueryAdapter";
+ }
+ if(adminProxy.empty())
+ {
+ adminProxy = "Yellow/Admin@YellowAdminAdapter";
+ }
+
+ AdminPrx admin = AdminPrx::checkedCast(communicator()->stringToProxy(adminProxy));
+ if(!admin)
+ {
+ cerr << appName() << ": `" << "' are not valid administrative endpoints" << endl;
+ return EXIT_FAILURE;
+ }
+
+ QueryPrx query = QueryPrx::checkedCast(communicator()->stringToProxy(queryProxy));
+ if(!query)
+ {
+ cerr << appName() << ": `" << "' are not valid query endpoints" << endl;
+ return EXIT_FAILURE;
+ }
+
+ ParserPtr parser = Parser::createParser(communicator(), admin, query);
+ int status = EXIT_SUCCESS;
+
+ if(argc < 2) // No files given
+ {
+ if(!commands.empty()) // Commands were given
+ {
+ int parseStatus = parser->parse(commands, debug);
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
+ else // No commands, let's use standard input
+ {
+ int parseStatus = parser->parse(stdin, debug);
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
+ }
+ else // Process files given on the command line
+ {
+ for(idx = 1 ; idx < argc ; ++idx)
+ {
+ ifstream test(argv[idx]);
+ if(!test)
+ {
+ cerr << appName() << ": can't open `" << argv[idx] << "' for reading: " << strerror(errno) << endl;
+ return EXIT_FAILURE;
+ }
+ test.close();
+
+ string cmd = cpp + " " + argv[idx];
+#ifdef _WIN32
+ FILE* cppHandle = _popen(cmd.c_str(), "r");
+#else
+ FILE* cppHandle = popen(cmd.c_str(), "r");
+#endif
+ if(cppHandle == NULL)
+ {
+ cerr << appName() << ": can't run C++ preprocessor: " << strerror(errno) << endl;
+ return EXIT_FAILURE;
+ }
+
+ int parseStatus = parser->parse(cppHandle, debug);
+
+#ifdef _WIN32
+ _pclose(cppHandle);
+#else
+ pclose(cppHandle);
+#endif
+
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
+ }
+
+ return status;
+}
diff --git a/cpp/src/Yellow/AdminI.cpp b/cpp/src/Yellow/AdminI.cpp
new file mode 100644
index 00000000000..3cf4e90b3c1
--- /dev/null
+++ b/cpp/src/Yellow/AdminI.cpp
@@ -0,0 +1,85 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Yellow/AdminI.h>
+
+using namespace std;
+using namespace Ice;
+using namespace Yellow;
+using namespace Freeze;
+
+Yellow::AdminI::AdminI(const DBPtr& db) :
+ _dict(db)
+{
+}
+
+void
+Yellow::AdminI::add(const string& intf, const ObjectPrx& offer, const Current&)
+{
+ IceUtil::Mutex::Lock sync(*this);
+
+ ObjectProxySeq seq;
+
+ StringObjectProxySeqDict::iterator p = _dict.find(intf);
+ if(p != _dict.end())
+ {
+ seq = p->second;
+ }
+
+ seq.push_back(offer);
+ if(p == _dict.end())
+ {
+ _dict.insert(make_pair(intf, seq));
+ }
+ else
+ {
+ p.set(seq);
+ }
+}
+
+void
+Yellow::AdminI::remove(const string& intf, const ObjectPrx& offer, const Current&)
+{
+ IceUtil::Mutex::Lock sync(*this);
+
+ ObjectProxySeq seq;
+
+ StringObjectProxySeqDict::iterator p = _dict.find(intf);
+ if(p == _dict.end())
+ {
+ throw NoSuchOfferException();
+ }
+
+ seq = p->second;
+ Ice::Identity ident = offer->ice_getIdentity();
+ ObjectProxySeq::iterator q;
+ for(q = seq.begin(); q != seq.end(); ++q)
+ {
+ ObjectPrx proxy = *q;
+ if(proxy->ice_getIdentity() == ident)
+ {
+ break;
+ }
+ }
+ if(q == seq.end())
+ {
+ throw NoSuchOfferException();
+ }
+ seq.erase(q);
+ if(seq.size() == 0)
+ {
+ _dict.erase(p);
+ }
+ else
+ {
+ p.set(seq);
+ }
+}
+
diff --git a/cpp/src/Yellow/AdminI.h b/cpp/src/Yellow/AdminI.h
new file mode 100644
index 00000000000..c88039a82de
--- /dev/null
+++ b/cpp/src/Yellow/AdminI.h
@@ -0,0 +1,36 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ADMIN_I_H
+#define ADMIN_I_H
+
+#include <Yellow/Yellow.h>
+#include <Yellow/StringObjectProxySeqDict.h>
+
+namespace Yellow
+{
+
+class AdminI : public Admin, public IceUtil::Mutex
+{
+public:
+
+ AdminI(const Freeze::DBPtr&);
+
+ virtual void add(const ::std::string&, const ::Ice::ObjectPrx&, const Ice::Current&);
+ virtual void remove(const ::std::string&, const ::Ice::ObjectPrx&, const Ice::Current&);
+
+private:
+
+ StringObjectProxySeqDict _dict;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Yellow/Grammar.y b/cpp/src/Yellow/Grammar.y
new file mode 100644
index 00000000000..053755f0d1a
--- /dev/null
+++ b/cpp/src/Yellow/Grammar.y
@@ -0,0 +1,118 @@
+%{
+
+// **********************************************************************
+//
+// Copyright (c) 2001
+// Mutable Realms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <Yellow/Parser.h>
+
+#ifdef _WIN32
+// I get this warning from some bison version:
+// warning C4102: 'yyoverflowlab' : unreferenced label
+# pragma warning( disable : 4102 )
+#endif
+
+using namespace std;
+using namespace Ice;
+using namespace Yellow;
+
+void
+yyerror(const char* s)
+{
+ parser->error(s);
+}
+
+%}
+
+%pure_parser
+
+%token YELLOW_HELP
+%token YELLOW_EXIT
+%token YELLOW_ADD
+%token YELLOW_REMOVE
+%token YELLOW_LOOKUP
+%token YELLOW_LOOKUP_ALL
+%token YELLOW_STRING
+
+%%
+
+// ----------------------------------------------------------------------
+start
+// ----------------------------------------------------------------------
+: commands
+{
+}
+|
+{
+}
+;
+
+// ----------------------------------------------------------------------
+commands
+// ----------------------------------------------------------------------
+: commands command
+{
+}
+| command
+{
+}
+;
+
+// ----------------------------------------------------------------------
+command
+// ----------------------------------------------------------------------
+: YELLOW_HELP ';'
+{
+ parser->usage();
+}
+| YELLOW_EXIT ';'
+{
+ return 0;
+}
+| YELLOW_ADD strings ';'
+{
+ parser->addOffer($2);
+}
+| YELLOW_REMOVE strings ';'
+{
+ parser->removeOffer($2);
+}
+| YELLOW_LOOKUP strings ';'
+{
+ parser->lookup($2);
+}
+| YELLOW_LOOKUP_ALL strings ';'
+{
+ parser->lookupAll($2);
+}
+| error ';'
+{
+ yyerrok;
+}
+| ';'
+{
+}
+;
+
+// ----------------------------------------------------------------------
+strings
+// ----------------------------------------------------------------------
+: YELLOW_STRING strings
+{
+ $$ = $2;
+ $$.push_front($1.front());
+}
+| YELLOW_STRING
+{
+ $$ = $1
+}
+;
+
+%%
diff --git a/cpp/src/Yellow/Makefile b/cpp/src/Yellow/Makefile
new file mode 100644
index 00000000000..8ac9102856f
--- /dev/null
+++ b/cpp/src/Yellow/Makefile
@@ -0,0 +1,107 @@
+#**********************************************************************
+#
+# Copyright (c) 2001
+# Mutable Realms, Inc.
+# Huntsville, AL, USA
+#
+# All Rights Reserved
+#
+# **********************************************************************
+
+top_srcdir = ../..
+
+BASE = libYellow.so
+VERSIONED_BASE = $(BASE).$(VERSION)
+
+NAME = $(top_srcdir)/lib/$(BASE)
+VERSIONED_NAME = $(top_srcdir)/lib/$(VERSIONED_BASE)
+
+SBASE = libYellowService.so
+VERSIONED_SBASE = $(SBASE).$(VERSION)
+
+SNAME = $(top_srcdir)/lib/$(SBASE)
+VERSIONED_SNAME = $(top_srcdir)/lib/$(VERSIONED_SBASE)
+
+ADMIN = $(top_srcdir)/bin/yellowadmin
+
+TARGETS = $(NAME) $(VERSIONED_NAME) $(SNAME) $(VERSIONED_SNAME) $(SERVER) $(ADMIN)
+
+OBJS = Yellow.o
+
+SERVICE_OBJS = Yellow.o \
+ StringObjectProxySeqDict.o \
+ AdminI.o \
+ QueryI.o \
+ Service.o
+
+AOBJS = Admin.o \
+ Grammar.o \
+ Scanner.o \
+ Parser.o
+
+SRCS = $(OBJS:.o=.cpp) \
+ $(SERVICE_OBJS:.o=.cpp) \
+ $(AOBJS:.o=.cpp)
+
+HDIR = $(includedir)/Yellow
+SDIR = $(slicedir)/Yellow
+SLICECMD = $(SLICE2CPP) --include-dir Yellow -I$(slicedir) -I..
+SLICE2FREEZECMD = $(SLICE2FREEZE) --include-dir Yellow -I$(slicedir) -I..
+
+include $(top_srcdir)/config/Make.rules
+
+CPPFLAGS := -I.. -I$(DB_HOME)/include $(XERCESC_FLAGS) $(CPPFLAGS)
+LDFLAGS := $(LDFLAGS) -L$(DB_HOME)/lib
+
+$(VERSIONED_NAME): $(OBJS)
+ rm -f $@
+ $(CXX) -Xlinker -soname -Xlinker $(VERSIONED_BASE) $(LDFLAGS) -shared -o $@ $(OBJS)
+
+$(NAME): $(VERSIONED_NAME)
+ rm -f $@
+ ln -s $(VERSIONED_BASE) $@
+
+$(VERSIONED_SNAME): $(SERVICE_OBJS)
+ rm -f $@
+ $(CXX) -Xlinker -soname -Xlinker $(VERSIONED_SBASE) $(LDFLAGS) -shared -o $@ $(SERVICE_OBJS)
+
+$(SNAME): $(VERSIONED_SNAME)
+ rm -f $@
+ ln -s $(VERSIONED_SBASE) $@
+
+$(ADMIN): $(AOBJS)
+ rm -f $@
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(AOBJS) -lYellow $(LIBS) -lreadline -lcurses
+
+$(HDIR)/Yellow.h Yellow.cpp: $(SDIR)/Yellow.ice $(SLICE2CPP)
+ rm -f $(HDIR)/Yellow.h Yellow.cpp
+ $(SLICECMD) --dll-export ICE_YELLOW_API $(SDIR)/Yellow.ice
+ mv Yellow.h $(HDIR)
+
+clean::
+ rm -f $(HDIR)/Yellow.h Yellow.cpp
+
+StringObjectProxySeqDict.h StringObjectProxySeqDict.cpp: $(SLICE2FREEZE)
+ rm -f StringObjectProxySeqDict.h StringObjectProxySeqDict.cpp
+ $(SLICE2FREEZECMD) --dict Yellow::StringObjectProxySeqDict,string,Ice::ObjectProxySeq \
+ StringObjectProxySeqDict ../../slice/Ice/BuiltinSequences.ice
+
+clean::
+ rm -f StringObjectProxySeqDict.h StringObjectProxySeqDict.cpp
+
+Grammar.cpp Grammar.h: Grammar.y
+ bison -dvt Grammar.y
+ rm -f Grammar.cpp ; mv Grammar.tab.c Grammar.cpp
+ rm -f Grammar.h ; mv Grammar.tab.h Grammar.h
+
+Scanner.cpp: Scanner.l Grammar.h
+ flex Scanner.l
+ rm -f Scanner.cpp
+ echo '#include <IceUtil/Config.h>' > Scanner.cpp
+ cat lex.yy.c >> Scanner.cpp
+
+clean::
+ -rm -f Grammar.cpp Grammar.h Grammar.output
+ -rm -f Scanner.cpp lex.yy.c
+
+include .depend
diff --git a/cpp/src/Yellow/Parser.cpp b/cpp/src/Yellow/Parser.cpp
new file mode 100644
index 00000000000..a614071cf51
--- /dev/null
+++ b/cpp/src/Yellow/Parser.cpp
@@ -0,0 +1,414 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// Mutable Realms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <Yellow/Parser.h>
+
+#ifdef HAVE_READLINE
+# include <readline/readline.h>
+# include <readline/history.h>
+#endif
+
+#include <iterator>
+
+using namespace std;
+using namespace Ice;
+using namespace Yellow;
+
+extern FILE* yyin;
+
+namespace Yellow
+{
+
+Parser* parser;
+
+}
+
+ParserPtr
+Yellow::Parser::createParser(const CommunicatorPtr& communicator, const AdminPrx& admin, const QueryPrx& query)
+{
+ return new Parser(communicator, admin, query);
+}
+
+void
+Yellow::Parser::usage()
+{
+ cout <<
+ "help Print this message.\n"
+ "exit, quit Exit this program.\n"
+ "add interface proxy Add this offer.\n"
+ "remove interface proxy Remove this offer.\n"
+ "lookup interface Lookup an offer for an interface.\n"
+ "lookupAll interface Retrieve all offers for an interface.\n";
+}
+
+void
+Yellow::Parser::addOffer(const list<string>& args)
+{
+ if(args.size() != 2)
+ {
+ error("`add' requires exactly two arguments (type `help' for more info)");
+ return;
+ }
+ string intf = args.front();
+ string offer = args.back();
+
+ cout << "adding offer: " << intf << " " << offer << endl;
+ _admin->add(intf, _communicator->stringToProxy(offer));
+}
+
+void
+Yellow::Parser::removeOffer(const list<string>& args)
+{
+ if(args.size() != 2)
+ {
+ error("`remove' requires exactly two arguments (type `help' for more info)");
+ return;
+ }
+ string intf = args.front();
+ string offer = args.back();
+
+ try
+ {
+ _admin->remove(intf, _communicator->stringToProxy(offer));
+ }
+ catch(const NoSuchOfferException&)
+ {
+ cerr << intf << ": no offer" << endl;
+ }
+}
+
+void
+Yellow::Parser::lookup(const list<string>& args)
+{
+ if(args.size() != 1)
+ {
+ error("`lookup' requires exactly one argument (type `help' for more info)");
+ return;
+ }
+ string intf = args.front();
+
+ try
+ {
+ Ice::ObjectPrx offer = _query->lookup(intf);
+ cout << _communicator->proxyToString(offer) << endl;
+ }
+ catch(const NoSuchOfferException&)
+ {
+ cerr << intf << ": no offer" << endl;
+ }
+}
+
+void
+Yellow::Parser::lookupAll(const list<string>& args)
+{
+ if(args.size() != 1)
+ {
+ error("`lookup' requires exactly one argument (type `help' for more info)");
+ return;
+ }
+ string intf = args.front();
+
+ try
+ {
+ Ice::ObjectProxySeq offers = _query->lookupAll(intf);
+ cout << offers.size() << " offers" << endl;
+ for (Ice::ObjectProxySeq::const_iterator p = offers.begin(); p != offers.end(); ++p)
+ {
+ cout << "\t" << _communicator->proxyToString(*p) << endl;
+ }
+ }
+ catch(const NoSuchOfferException&)
+ {
+ cerr << intf << ": no offer" << endl;
+ }
+}
+
+void
+Yellow::Parser::getInput(char* buf, int& result, int maxSize)
+{
+ if(!_commands.empty())
+ {
+ if(_commands == ";")
+ {
+ result = 0;
+ }
+ else
+ {
+#if defined(_MSC_VER) && !defined(_STLP_MSVC)
+ // COMPILERBUG: Stupid Visual C++ defines min and max as macros
+ result = _MIN(maxSize, static_cast<int>(_commands.length()));
+#else
+ result = min(maxSize, static_cast<int>(_commands.length()));
+#endif
+ strncpy(buf, _commands.c_str(), result);
+ _commands.erase(0, result);
+ if(_commands.empty())
+ {
+ _commands = ";";
+ }
+ }
+ }
+ else if(isatty(fileno(yyin)))
+ {
+#ifdef HAVE_READLINE
+
+ char* line = readline(parser->getPrompt());
+ 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 = line.length();
+ if(result > maxSize)
+ {
+ error("input line too long");
+ buf[0] = EOF;
+ result = 1;
+ }
+ else
+ {
+ strcpy(buf, line.c_str());
+ }
+
+#endif
+ }
+ else
+ {
+ if(((result = fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin))
+ {
+ error("input in flex scanner failed");
+ buf[0] = EOF;
+ result = 1;
+ }
+ }
+}
+
+void
+Yellow::Parser::nextLine()
+{
+ _currentLine++;
+}
+
+void
+Yellow::Parser::continueLine()
+{
+ _continue = true;
+}
+
+char*
+Yellow::Parser::getPrompt()
+{
+ assert(_commands.empty() && isatty(fileno(yyin)));
+
+ if(_continue)
+ {
+ _continue = false;
+ return "(cont) ";
+ }
+ else
+ {
+ return ">>> ";
+ }
+}
+
+void
+Yellow::Parser::scanPosition(const char* s)
+{
+ string line(s);
+ string::size_type idx;
+
+ idx = line.find("line");
+ if(idx != string::npos)
+ {
+ line.erase(0, idx + 4);
+ }
+
+ idx = line.find_first_not_of(" \t\r#");
+ if(idx != string::npos)
+ {
+ line.erase(0, idx);
+ }
+
+ _currentLine = atoi(line.c_str()) - 1;
+
+ idx = line.find_first_of(" \t\r");
+ if(idx != string::npos)
+ {
+ line.erase(0, idx);
+ }
+
+ idx = line.find_first_not_of(" \t\r\"");
+ if(idx != string::npos)
+ {
+ line.erase(0, idx);
+
+ idx = line.find_first_of(" \t\r\"");
+ if(idx != string::npos)
+ {
+ _currentFile = line.substr(0, idx);
+ line.erase(0, idx + 1);
+ }
+ else
+ {
+ _currentFile = line;
+ }
+ }
+}
+
+void
+Yellow::Parser::error(const char* s)
+{
+ if(_commands.empty() && !isatty(fileno(yyin)))
+ {
+ cerr << _currentFile << ':' << _currentLine << ": " << s << endl;
+ }
+ else
+ {
+ cerr << "error: " << s << endl;
+ }
+ _errors++;
+}
+
+void
+Yellow::Parser::error(const string& s)
+{
+ error(s.c_str());
+}
+
+void
+Yellow::Parser::warning(const char* s)
+{
+ if(_commands.empty() && !isatty(fileno(yyin)))
+ {
+ cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl;
+ }
+ else
+ {
+ cerr << "warning: " << s << endl;
+ }
+}
+
+void
+Yellow::Parser::warning(const string& s)
+{
+ warning(s.c_str());
+}
+
+int
+Yellow::Parser::parse(FILE* file, bool debug)
+{
+ extern int yydebug;
+ yydebug = debug ? 1 : 0;
+
+ assert(!parser);
+ parser = this;
+
+ _errors = 0;
+ _commands.empty();
+ yyin = file;
+ assert(yyin);
+
+ _currentFile = "";
+ _currentLine = 0;
+ _continue = false;
+ nextLine();
+
+ int status = yyparse();
+ if(_errors)
+ {
+ status = EXIT_FAILURE;
+ }
+
+ parser = 0;
+ return status;
+}
+
+int
+Yellow::Parser::parse(const std::string& commands, bool debug)
+{
+ extern int yydebug;
+ yydebug = debug ? 1 : 0;
+
+ assert(!parser);
+ parser = this;
+
+ _errors = 0;
+ _commands = commands;
+ assert(!_commands.empty());
+ yyin = 0;
+
+ _currentFile = "";
+ _currentLine = 0;
+ _continue = false;
+ nextLine();
+
+ int status = yyparse();
+ if(_errors)
+ {
+ status = EXIT_FAILURE;
+ }
+
+ parser = 0;
+ return status;
+}
+
+Yellow::Parser::Parser(const CommunicatorPtr& communicator, const AdminPrx& admin, const QueryPrx& query) :
+ _communicator(communicator),
+ _admin(admin),
+ _query(query)
+{
+}
diff --git a/cpp/src/Yellow/Parser.h b/cpp/src/Yellow/Parser.h
new file mode 100644
index 00000000000..c7f7af52bfe
--- /dev/null
+++ b/cpp/src/Yellow/Parser.h
@@ -0,0 +1,110 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// Mutable Realms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_PACK_PARSER_H
+#define ICE_PACK_PARSER_H
+
+#include <IceUtil/Handle.h>
+#include <Yellow/Yellow.h>
+#include <list>
+
+#ifdef _WIN32
+# include <io.h>
+# define isatty _isatty
+# define fileno _fileno
+// '_isatty' : inconsistent dll linkage. dllexport assumed.
+# pragma warning( disable : 4273 )
+#endif
+
+//
+// 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 20000 // 20000 should suffice. Bison default is 10000 as maximum.
+#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)
+
+namespace Yellow
+{
+
+class Parser;
+typedef ::IceUtil::Handle<Parser> ParserPtr;
+
+}
+
+namespace Yellow
+{
+
+class Parser : public ::IceUtil::SimpleShared
+{
+public:
+
+ static ParserPtr createParser(const Ice::CommunicatorPtr&, const Yellow::AdminPrx&, const Yellow::QueryPrx&);
+
+ void usage();
+
+ void addOffer(const std::list<std::string>&);
+ void removeOffer(const std::list<std::string>&);
+ void lookup(const std::list<std::string>&);
+ void lookupAll(const std::list<std::string>&);
+
+ void shutdown();
+
+ void getInput(char*, int&, int);
+ void nextLine();
+ void continueLine();
+ char* getPrompt();
+ void scanPosition(const char*);
+
+ void error(const char*);
+ void error(const std::string&);
+
+ void warning(const char*);
+ void warning(const std::string&);
+
+ int parse(FILE*, bool);
+ int parse(const std::string&, bool);
+
+private:
+
+ Parser(const Ice::CommunicatorPtr&, const Yellow::AdminPrx&, const Yellow::QueryPrx&);
+
+ std::string _commands;
+ Ice::CommunicatorPtr _communicator;
+ Yellow::AdminPrx _admin;
+ Yellow::QueryPrx _query;
+ bool _continue;
+ int _errors;
+ int _currentLine;
+ std::string _currentFile;
+};
+
+extern Parser* parser; // The current parser for bison/flex
+
+}
+
+#endif
diff --git a/cpp/src/Yellow/QueryI.cpp b/cpp/src/Yellow/QueryI.cpp
new file mode 100644
index 00000000000..82f1ebfd700
--- /dev/null
+++ b/cpp/src/Yellow/QueryI.cpp
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Yellow/QueryI.h>
+
+using namespace std;
+using namespace Ice;
+using namespace Yellow;
+using namespace Freeze;
+
+Yellow::QueryI::QueryI(const DBPtr& db) :
+ _dict(db)
+{
+}
+
+ObjectPrx
+Yellow::QueryI::lookup(const string& intf, const Current&)
+{
+ StringObjectProxySeqDict::const_iterator p = _dict.find(intf);
+ if(p == _dict.end())
+ {
+ throw NoSuchOfferException();
+ }
+
+ int r = rand() % p->second.size();
+ return p->second[r];
+}
+
+ObjectProxySeq
+Yellow::QueryI::lookupAll(const string& intf, const Current&)
+{
+ StringObjectProxySeqDict::const_iterator p = _dict.find(intf);
+ if(p == _dict.end())
+ {
+ throw NoSuchOfferException();
+ }
+ return p->second;
+}
diff --git a/cpp/src/Yellow/QueryI.h b/cpp/src/Yellow/QueryI.h
new file mode 100644
index 00000000000..43a5dc1ebe8
--- /dev/null
+++ b/cpp/src/Yellow/QueryI.h
@@ -0,0 +1,36 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef QUERY_I_H
+#define QUERY_I_H
+
+#include <Yellow/Yellow.h>
+#include <Yellow/StringObjectProxySeqDict.h>
+
+namespace Yellow
+{
+
+class QueryI : public Query
+{
+public:
+
+ QueryI(const Freeze::DBPtr&);
+
+ virtual ::Ice::ObjectPrx lookup(const ::std::string&, const Ice::Current&);
+ virtual ::Ice::ObjectProxySeq lookupAll(const ::std::string&, const Ice::Current&);
+
+private:
+
+ StringObjectProxySeqDict _dict;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Yellow/Scanner.l b/cpp/src/Yellow/Scanner.l
new file mode 100644
index 00000000000..9f89afc8ed5
--- /dev/null
+++ b/cpp/src/Yellow/Scanner.l
@@ -0,0 +1,275 @@
+%{
+
+// **********************************************************************
+//
+// Copyright (c) 2001
+// Mutable Realms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <Yellow/Parser.h>
+#include <Yellow/Grammar.h>
+
+using namespace std;
+using namespace Ice;
+using namespace Yellow;
+
+#define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize)
+
+%}
+
+WS [ \t\v\f\r]
+NL [\n]
+
+%option noyywrap
+
+%%
+
+^"#"[[:blank:]]*[[:digit:]]+[[:blank:]]*$ {
+ parser->scanPosition(yytext);
+}
+
+^"#"[[:blank:]]*[[:digit:]]+[[:blank:]]+"\""[^\"]*"\"".*$ {
+ parser->scanPosition(yytext);
+}
+
+^"#"[[:blank:]]*"line"[[:blank:]]+[[:digit:]]+[[:blank:]]*$ {
+ parser->scanPosition(yytext);
+}
+
+^"#"[[:blank:]]*"line"[[:blank:]]+[[:digit:]]+[[:blank:]]+"\""[^\"]*"\"".*$ {
+ parser->scanPosition(yytext);
+}
+
+"//" {
+ // C++-style comment
+ int c;
+ do
+ {
+ c = yyinput();
+ if(c == '\n')
+ {
+ parser->nextLine();
+ }
+ }
+ while(c != '\n' && c != EOF);
+}
+
+"/*" {
+ // C-style comment
+ while(true)
+ {
+ int c = yyinput();
+ if(c == '\n')
+ {
+ parser->nextLine();
+ }
+ else if(c == '*')
+ {
+ int next = yyinput();
+ if(next == '/')
+ {
+ break;
+ }
+ else
+ {
+ unput(next);
+ }
+ }
+ else if(c == EOF)
+ {
+ parser->warning("EOF in comment");
+ break;
+ }
+ }
+}
+
+"help" {
+ return YELLOW_HELP;
+}
+
+"quit"|"exit" {
+ return YELLOW_EXIT;
+}
+
+"add" {
+ return YELLOW_ADD;
+}
+
+"remove" {
+ return YELLOW_REMOVE;
+}
+
+"lookup" {
+ return YELLOW_LOOKUP;
+}
+
+"lookupAll" {
+ return YELLOW_LOOKUP_ALL;
+}
+
+{WS}*(\\{WS}*{NL})? {
+ int len = strlen(yytext);
+ for(int i = 0; i < len; ++i)
+ {
+ if(yytext[i] == '\\')
+ {
+ parser->continueLine();
+ }
+ else if(yytext[i] == '\n')
+ {
+ parser->nextLine();
+ }
+ }
+}
+
+{NL}|; {
+ int len = strlen(yytext);
+ for(int i = 0; i < len; ++i)
+ {
+ if(yytext[i] == '\n')
+ {
+ parser->nextLine();
+ }
+ }
+ 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 == '\n')
+ {
+ s += c;
+ parser->nextLine();
+ }
+ 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 YELLOW_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 if(c == '\n')
+ {
+ s += c;
+ parser->nextLine();
+ }
+ else
+ {
+ s += c;
+ }
+ }
+ yylvalp->clear();
+ yylvalp->push_back(s);
+ return YELLOW_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 YELLOW_STRING;
+}
+
+%%
diff --git a/cpp/src/Yellow/Service.cpp b/cpp/src/Yellow/Service.cpp
new file mode 100644
index 00000000000..223c2a2381c
--- /dev/null
+++ b/cpp/src/Yellow/Service.cpp
@@ -0,0 +1,121 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Yellow/AdminI.h>
+#include <Yellow/QueryI.h>
+
+#include <IceBox/IceBox.h>
+
+using namespace std;
+using namespace Ice;
+using namespace Yellow;
+using namespace Freeze;
+
+namespace Yellow
+{
+
+class ServiceI : public ::IceBox::FreezeService
+{
+public:
+
+ ServiceI();
+ virtual ~ServiceI();
+
+ virtual void start(const string&,
+ const CommunicatorPtr&,
+ const PropertiesPtr&,
+ const StringSeq&,
+ const ::Freeze::DBEnvironmentPtr&);
+
+ virtual void stop();
+
+private:
+
+ ObjectAdapterPtr _queryAdapter;
+ ObjectAdapterPtr _adminAdapter;
+};
+
+} // End namespace Yellow
+
+extern "C"
+{
+
+//
+// Factory function
+//
+::IceBox::FreezeService*
+create(Ice::CommunicatorPtr communicator)
+{
+ return new Yellow::ServiceI;
+}
+
+}
+
+Yellow::ServiceI::ServiceI()
+{
+}
+
+Yellow::ServiceI::~ServiceI()
+{
+}
+
+void
+Yellow::ServiceI::start(const string& name,
+ const CommunicatorPtr& communicator,
+ const PropertiesPtr& properties,
+ const StringSeq& args,
+ const DBEnvironmentPtr& dbEnv)
+{
+ //
+ // The Admin & Query interface implementations each have their own
+ // map. This is safe because a) no iterators are used on the
+ // database, and b) internally the database is synchronized.
+ //
+ DBPtr dbYellow = dbEnv->openDB("yellow", true);
+
+ //
+ // With respect to the adapters I want to support three use-cases:
+ //
+ // 1) admin is not permitted.
+ // 2) both admin & query is permitted on the same endpoint
+ // 3) query & admin are permitted, but on seperate endpoitns
+ //
+ // TODO: At present #2 isn't supported.
+ //
+ string queryEndpoints = properties->getProperty(name + ".Query.Endpoints");
+ _queryAdapter = communicator->createObjectAdapterWithEndpoints(name + "QueryAdapter", queryEndpoints);
+
+ string adminEndpoints = properties->getProperty(name + ".Admin.Endpoints");
+ if(!adminEndpoints.empty())
+ {
+ _adminAdapter = communicator->createObjectAdapterWithEndpoints(name + "AdminAdapter", adminEndpoints);
+ ObjectPtr admin = new AdminI(dbYellow);
+ _adminAdapter->add(admin, stringToIdentity(name + "/Admin"));
+ }
+
+ ObjectPtr query = new QueryI(dbYellow);
+ _queryAdapter->add(query, stringToIdentity(name + "/Query"));
+
+ if(_adminAdapter)
+ {
+ _adminAdapter->activate();
+ }
+ _queryAdapter->activate();
+}
+
+void
+Yellow::ServiceI::stop()
+{
+ if(_adminAdapter)
+ {
+ _adminAdapter->deactivate();
+ }
+ _queryAdapter->deactivate();
+}