diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..48979ca54b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: Build and test + +on: + workflow_dispatch: + push: + branches: ["main"] + pull_request: + # The branches below must be a subset of the branches above + branches: ["main"] + +# See https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + ci: + name: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + runs-on: ${{ matrix.os }} + steps: + - name: Checkout Ice + uses: actions/checkout@v4 + with: + repository: zeroc-ice/ice + ref: main + path: ice + + - name: Setup Ice Build Dependencies + uses: ./ice/.github/actions/setup-dependencies + + - name: Build Iice on ${{ matrix.os }} + uses: ./ice/.github/actions/build + timeout-minutes: 90 + with: + working_directory: ice/cpp + + - name: Checkout repository + uses: actions/checkout@v4 + with: + path: ice-demos + + - name: Build Ice Demos on ${{ matrix.os }} + timeout-minutes: 90 + working-directory: ice-demos/cpp + run: | + export ICE_HOME=$GITHUB_WORKSPACE/ice + make diff --git a/.gitignore b/.gitignore index 77c79d8e6c..877862daa1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,10 @@ locator publisher subscriber talk +chatserver + +!Chat/client/ +!Chat/server/ !**/msbuild/client !**/msbuild/server @@ -185,8 +189,7 @@ es5 # # Nuget packages # -cpp11/packages -cpp98/packages +cpp/packages csharp/packages # @@ -214,3 +217,6 @@ swift/Carthage .build Package.resolved *.bcsymbolmap + +compile_commands.json +.envrc diff --git a/.vscode/cspell.json b/.vscode/cspell.json index d7a07ee5b0..c960b0c7a7 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -2,6 +2,7 @@ "version": "0.2", "language": "en", "words": [ + "Blobject", "icegrid", "zeroc" ], diff --git a/certs/cacert.der b/certs/cacert.der index 899a6aa07f..6c405e2bb2 100644 Binary files a/certs/cacert.der and b/certs/cacert.der differ diff --git a/certs/cacert.pem b/certs/cacert.pem index ffebdf43a7..d8e6eadf57 100644 --- a/certs/cacert.pem +++ b/certs/cacert.pem @@ -1,23 +1,23 @@ -----BEGIN CERTIFICATE----- -MIIDyTCCArGgAwIBAgIIeF2eLtdo7XswDQYJKoZIhvcNAQELBQAwgYsxFTATBgNV -BAMMDEljZSBEZW1vcyBDQTEMMAoGA1UECwwDSWNlMRQwEgYDVQQKDAtaZXJvQywg +MIID1jCCAr6gAwIBAgIIUmyVFUPQ9f0wDQYJKoZIhvcNAQELBQAwgYsxFTATBgNV +BAMMDEljZSBUZXN0cyBDQTEMMAoGA1UECwwDSWNlMRQwEgYDVQQKDAtaZXJvQywg SW5jLjEQMA4GA1UEBwwHSnVwaXRlcjEQMA4GA1UECAwHRmxvcmlkYTELMAkGA1UE -BhMCVVMxHTAbBgkqhkiG9w0BCQEWDmluZm9AemVyb2MuY29tMB4XDTIxMTIyMzA4 -MTQwNVoXDTI0MDMyNzA4MTQwNVowgYsxFTATBgNVBAMMDEljZSBEZW1vcyBDQTEM +BhMCVVMxHTAbBgkqhkiG9w0BCQEWDmluZm9AemVyb2MuY29tMB4XDTIyMDcyNzEx +MzIxOFoXDTI0MTAyOTExMzIxOFowgYsxFTATBgNVBAMMDEljZSBUZXN0cyBDQTEM MAoGA1UECwwDSWNlMRQwEgYDVQQKDAtaZXJvQywgSW5jLjEQMA4GA1UEBwwHSnVw aXRlcjEQMA4GA1UECAwHRmxvcmlkYTELMAkGA1UEBhMCVVMxHTAbBgkqhkiG9w0B CQEWDmluZm9AemVyb2MuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEA8IFiB0I2O/sI3AdkrXwdTzHyCCr9Ywm4DG8dtXtTB1tehC1i1Fef0vc7ZSLO -dqukZHaWYzur05p7VxXZmoMAZ0AURbTL7Y3rv2sxAaz6C+HbHpAtYaUZp80c0MCa -ozzHtOtFskGcqNc3fvbAfBWE5T+BxJ5vJizKIp9BysDSYJsWhhN7T9MhGOQJCkbM -mBuAIObCs/nigzdntK8ydQlV4gwVXTNQ0PAmwry5zd89xqCI7yIb4+mc2HS5m45l -qA/jzt21Yb1x7TJCCvsLNkkQXXnFrNM6MHpfkPXG9G8uSuCQVMu6i2r0fN8FjFiH -xzDN9T3R6Scq+OnRwXsQrfnqSQIDAQABoy8wLTAMBgNVHRMEBTADAQH/MB0GA1Ud -DgQWBBStbUgdtOWqtzklzIZw02Dq+666cDANBgkqhkiG9w0BAQsFAAOCAQEAQnCm -CjMeFT14790k2h9z1qyzC1c1KQQP2RAL/glkLQyFXBgjU95M9DnKSQ4u/u9eR7EK -DHuyWG2M5XlUQO1pDQpaf0N3VLCqz21ydgnXes9ttbOzScLZCGulSR0gMFqQ+NUJ -TiPKrZZyZgfWMTkWOi8VdGfIluvL2Ihe277AIX13IjK+4Wt3Aq48GWglVHSv9Gj4 -cQuGgrrCqPSdwnJ9QMNwuuNnM1ofSijXvgAKhx462nGSKvRmwdof3+X5oxK7BYfI -kZAmnodnrsPEawzu68K9ZZ75Bv72PyHqUEIept2CzFPfoDBZTffqoy1kA87DsjUi -4L/B/XwCRKspT0aP9Q== +AQEAy6/rqeQ+McDn/mXQwNGk+cNftOIJb99Cdpl4dFuMzD7XBK36l1Ijo/Ro/d03 +7ZJr2BzAY/DlseyuvX9qXeQ2jsvzwlumNuEv09ILbCqn27rGt3Gu8RpvSt6ehVic +PXJR3dA/TCZW+iK8WDmDOWtD8DO9jSiN0+qneWixCqWFX5DeBFQoORF3dIjJa62B +LLPaWK1EW01/6R/Las92NKRqXuQ3TkAT1bpsQBjrJFNGSSdwwcteGGpPfzwSw9gW +IuKuS4f0/xZVx6rG9Jzcxm/J2owidhZqqKEvaNiIghMXax6Cldh9Iq2qUS3FS3Ye +T4ZuT/7cEVGu5RPyNnTKgGirhwIDAQABozwwOjAMBgNVHRMEBTADAQH/MB0GA1Ud +DgQWBBQfsKt279iGWWp5DRYKF9f9b/F1+TALBgNVHQ8EBAMCAYYwDQYJKoZIhvcN +AQELBQADggEBAI4qKKqx/edLOQKdcdH+2QAxrmsnZDSMmnlVGl51WBatFw+9GskH +YeIabYdihTx/aDbdoLW5FDVYQQEfBhnvo7uwfhoYR8DapuPFCfeyf5hED+FIpXHo +jVgeL3DrTccPQX3VaCu0ID5FN4EA3Jbp9/Kt+uwQUlHVeMrHQNfo4En/yoJoJowz +26iWrmi2ZdnxuK9WZ0HhENODLp86oNvkgqu9iOR5vJVcJOtKMAiSHmemLOZdaAeM +7UwNTu+cYTC6N2LH31K6qCwJkk3YJg89uCKhd6YkMZvmQlTrnqM39Hg+V8LKl3x/ +2iDrWoik199Rh9p/Z1qqitqeOnWK3EzNevA= -----END CERTIFICATE----- diff --git a/certs/client.bks b/certs/client.bks index e8dceb047b..9b27535f40 100644 Binary files a/certs/client.bks and b/certs/client.bks differ diff --git a/certs/client.jks b/certs/client.jks index 26c60569c8..aaf78692e4 100644 Binary files a/certs/client.jks and b/certs/client.jks differ diff --git a/certs/client.p12 b/certs/client.p12 index 414fae8c38..f2aab608a5 100644 Binary files a/certs/client.p12 and b/certs/client.p12 differ diff --git a/certs/makedemocerts.py b/certs/makedemocerts.py index ea096ed8df..64ea2c0a53 100755 --- a/certs/makedemocerts.py +++ b/certs/makedemocerts.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) ZeroC, Inc. All rights reserved. # diff --git a/certs/server.bks b/certs/server.bks index b0cabcb550..7b3a17cc34 100644 Binary files a/certs/server.bks and b/certs/server.bks differ diff --git a/certs/server.jks b/certs/server.jks index bb2fd6d17c..edc43fd1d7 100644 Binary files a/certs/server.jks and b/certs/server.jks differ diff --git a/certs/server.p12 b/certs/server.p12 index b5b853bb62..fbc2a61fb2 100644 Binary files a/certs/server.p12 and b/certs/server.p12 differ diff --git a/certs/server.pem b/certs/server.pem new file mode 100644 index 0000000000..ca1b44cb78 --- /dev/null +++ b/certs/server.pem @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE----- +MIIExjCCA66gAwIBAgIICIqPq5Tox3swDQYJKoZIhvcNAQELBQAwgYsxFTATBgNV +BAMMDEljZSBUZXN0cyBDQTEMMAoGA1UECwwDSWNlMRQwEgYDVQQKDAtaZXJvQywg +SW5jLjEQMA4GA1UEBwwHSnVwaXRlcjEQMA4GA1UECAwHRmxvcmlkYTELMAkGA1UE +BhMCVVMxHTAbBgkqhkiG9w0BCQEWDmluZm9AemVyb2MuY29tMB4XDTIyMDcyNzEx +MzIxOFoXDTI0MTAyOTExMzIxOFowgYgxEjAQBgNVBAMMCTEyNy4wLjAuMTEMMAoG +A1UECwwDSWNlMRQwEgYDVQQKDAtaZXJvQywgSW5jLjEQMA4GA1UEBwwHSnVwaXRl +cjEQMA4GA1UECAwHRmxvcmlkYTELMAkGA1UEBhMCVVMxHTAbBgkqhkiG9w0BCQEW +DmluZm9AemVyb2MuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA +t9yRk/tf1VBy4NOyf546bsc6VVkp2qLMCuJUE8nB7SCOLVMXsXZS5WWVr7P2juDa +HPisBE1eEcUpEvBgFt7KQ4VvbcIKwP/5j/Z1vmT5TTk+EH4ryAlItjaEQpDQJNiu +arymConMZfMu+bJ99D41OChrNzSw5Q/zOg1jTchcv9d9aNE6Jfe5bMKAsSjH1PW3 +VKIUGlv7taw4jbwueuAMX9Q8tKk0z/DffJfQ83EJK2y/MVLCLsN/iZh1d2psC2NB +/0u1lOJPg7xPUy4KtIhnoBH+upT9HaT56AxCEEt83ezy/dhksrsutYlNMUSRIRse +H8W9Y0jjt11Ocn1ZgSWr7wIDAQABo4IBLTCCASkwHQYDVR0OBBYEFHxebATdX527 +y0pGKgeWQ40uMkgFMIG/BgNVHSMEgbcwgbSAFB+wq3bv2IZZankNFgoX1/1v8XX5 +oYGRpIGOMIGLMRUwEwYDVQQDDAxJY2UgVGVzdHMgQ0ExDDAKBgNVBAsMA0ljZTEU +MBIGA1UECgwLWmVyb0MsIEluYy4xEDAOBgNVBAcMB0p1cGl0ZXIxEDAOBgNVBAgM +B0Zsb3JpZGExCzAJBgNVBAYTAlVTMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHplcm9j +LmNvbYIIUmyVFUPQ9f0wCwYDVR0PBAQDAgXgMBoGA1UdEQQTMBGHBH8AAAGCCWxv +Y2FsaG9zdDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcN +AQELBQADggEBAJHUGjzNU91OK2ZUdVZPgYOF9i4odGeZ9N8SefRMl/3/Uefj7Kkx +BXZbP1FEKMts9QBAfit0OktmJltxB5+DyARAS6zRH4t0c/wmUm5ml/OOza297aAl +hvW/Q1QlB6WKRMCH9F7AUyRz9uFiaM1cYsZ/I/SltoPCguESZcjqFDZ8fblNcdur +v/c6QECje4YDjZ53vxEjfYtDBpFBG6GQPXBF5BZN47F6Iu/W+kS/OQatkR/8hhEh +CjvZb3AXSr9f9V+uRm9c6yeHz2mfp9jFHIPhCJrYpkPQfSJ2pZfyiD1tzwvOyw5K +x+P/Keu4P/M4IZLHdQiYgSbV9lFe04z5cBo= +-----END CERTIFICATE----- diff --git a/cpp/Chat/client/Client.cpp b/cpp/Chat/client/Client.cpp index c6a9c3f08f..d229b1134b 100644 --- a/cpp/Chat/client/Client.cpp +++ b/cpp/Chat/client/Client.cpp @@ -2,11 +2,11 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "ChatSession.h" +#include "ChatUtils.h" #include #include - -#include -#include +#include using namespace std; @@ -14,16 +14,20 @@ static const unsigned int maxMessageSize = 1024; namespace { - // mutex to prevent intertwined cout output mutex coutMutex; + void menu() + { + const lock_guard lock(coutMutex); + cout << "enter /quit to exit." << endl; + } } -class ChatRoomCallbackI : public Chat::ChatRoomCallback +class ChatRoomCallbackI final : public Chat::ChatRoomCallback { public: - virtual void init(Ice::StringSeq names, const Ice::Current&) override + void init(Ice::StringSeq names, const Ice::Current&) final { const lock_guard lock(coutMutex); cout << "Users: "; @@ -39,132 +43,132 @@ class ChatRoomCallbackI : public Chat::ChatRoomCallback cout << endl; } - virtual void join(long long, string name, const Ice::Current&) override + void join(long long, string name, const Ice::Current&) final { const lock_guard lock(coutMutex); cout << ">>>> " << name << " joined." << endl; } - virtual void leave(long long, string name, const Ice::Current&) override + void leave(long long, string name, const Ice::Current&) final { const lock_guard lock(coutMutex); cout << "<<<< " << name << " left." << endl; } - virtual void send(long long, string name, string message, const Ice::Current&) override + void send(long long, string name, string message, const Ice::Current&) final { const lock_guard lock(coutMutex); cout << name << " > " << ChatUtils::unstripHtml(message) << endl; } }; -class ChatClient : public Glacier2::Application +Chat::ChatSessionPrx +createSession(Glacier2::RouterPrx router) { -public: - ChatClient() - : // - // Since this is an interactive demo we don't want any signal - // handling. - // - Application(Ice::SignalPolicy::NoSignalHandling) + while (true) { - } + cout << "This demo accepts any user ID and password.\n"; - virtual shared_ptr createSession() override - { - shared_ptr sessionPrx; - while (!sessionPrx) - { - cout << "This demo accepts any user ID and password.\n"; + string id; + cout << "user id: " << flush; + getline(cin, id); + id = ChatUtils::trim(id); - string id; - cout << "user id: " << flush; - getline(cin, id); - id = ChatUtils::trim(id); + string pw; + cout << "password: " << flush; + getline(cin, pw); + pw = ChatUtils::trim(pw); - string pw; - cout << "password: " << flush; - getline(cin, pw); - pw = ChatUtils::trim(pw); - - try - { - sessionPrx = router()->createSession(id, pw); - break; - } - catch (const Glacier2::CannotCreateSessionException& ex) - { - cout << "Login failed:\n" << ex.reason << endl; - } - catch (const Glacier2::PermissionDeniedException& ex) - { - cout << "Login failed:\n" << ex.reason << endl; - } - catch (const Ice::LocalException& ex) + try + { + optional session{router->createSession(id, pw)}; + if (!session) { - cerr << "Communication with the server failed:\n" << ex << endl; + cerr << "Glaicer2::createSession return null. Is the SessionManager configured?" << endl; + exit(1); } + router->ice_getCachedConnection()->setCloseCallback( + [](Ice::ConnectionPtr) + { + const lock_guard lock(coutMutex); + cout << "The Glacier2 session has been destroyed." << endl; + }); + return *session; + } + catch (const Glacier2::CannotCreateSessionException& ex) + { + cout << "Login failed:\n" << ex.reason << endl; + } + catch (const Glacier2::PermissionDeniedException& ex) + { + cout << "Login failed:\n" << ex.reason << endl; + } + catch (const Ice::LocalException& ex) + { + cerr << "Communication with the server failed:\n" << ex << endl; } - return sessionPrx; } +} - virtual void sessionDestroyed() override { cerr << "Session destroyed " << endl; } - - virtual int runWithSession(int argc, char*[]) override +void +run(shared_ptr communicator) +{ + optional router{communicator->getDefaultRouter()}; + if (!router) { - if (argc > 1) - { - const string message = "usage: "; - throw runtime_error(message + appName()); - } + cerr << "No router configured" << endl; + exit(1); + } - auto sessionPrx = Ice::uncheckedCast(this->session()); - sessionPrx->setCallback( - Ice::uncheckedCast(addWithUUID(make_shared()))); + // Create a session with the Glacier2 router + Chat::ChatSessionPrx session = createSession(*router); - menu(); + auto adapter = communicator->createObjectAdapterWithRouter("", *router); + adapter->activate(); - do - { - string s; - cout << ""; - getline(cin, s); - s = ChatUtils::trim(s); + // Create a callback object and add it to the adapter using the client's category + // provided by the router + Ice::Identity id{Ice::generateUUID(), router->getCategoryForClient()}; + + auto callbackPrx = adapter->add(make_shared(), id); + + // Set the callback proxy on the session + session->setCallback(Chat::ChatRoomCallbackPrx{callbackPrx}); + + menu(); - if (!s.empty()) + do + { + string s; + cout << ""; + getline(cin, s); + s = ChatUtils::trim(s); + + if (!s.empty()) + { + if (s[0] == '/') + { + if (s == "/quit") + { + break; + } + menu(); + } + else { - if (s[0] == '/') + if (s.size() > maxMessageSize) { - if (s == "/quit") - { - break; - } - menu(); + const lock_guard lock(coutMutex); + cout << "Message length exceeded, maximum length is " << maxMessageSize << " characters."; } else { - if (s.size() > maxMessageSize) - { - const lock_guard lock(coutMutex); - cout << "Message length exceeded, maximum length is " << maxMessageSize << " characters."; - } - else - { - sessionPrx->send(s); - } + session->send(s); } } - } while (cin.good()); - return 0; - } - -private: - void menu() - { - const lock_guard lock(coutMutex); - cout << "enter /quit to exit." << endl; - } -}; + } + } while (cin.good()); +} int main(int argc, char* argv[]) @@ -173,23 +177,44 @@ main(int argc, char* argv[]) Ice::registerIceSSL(); Ice::registerIceWS(); #endif - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); - // - // Set Ice.Default.Router if not set - // - if (initData.properties->getProperty("Ice.Default.Router").empty()) + int status = 0; + + try + { + // CommunicatorHolder's ctor initializes an Ice communicator, + // and its dtor destroys this communicator. + // + // The communicator initialization removes all Ice-related arguments from argc/argv + Ice::InitializationData initData; + initData.properties = Ice::createProperties(argc, argv); + + if (argc > 1) + { + cerr << argv[0] << ": too many arguments" << endl; + status = 1; + } + + // + // Set Ice.Default.Router if not set + // + if (initData.properties->getProperty("Ice.Default.Router").empty()) + { + initData.properties->setProperty("IceSSL.UsePlatformCAs", "1"); + // initData.properties->setProperty("IceSSL.CheckCertName", "2"); + initData.properties->setProperty( + "Ice.Default.Router", + "Glacier2/router:wss -p 443 -h zeroc.com -r /demo-proxy/chat/glacier2"); + } + const Ice::CommunicatorHolder ich(initData); + + run(ich.communicator()); + } + catch (const std::exception& ex) { - initData.properties->setProperty("Ice.Plugin.IceSSL", "IceSSL:createIceSSL"); - initData.properties->setProperty("IceSSL.UsePlatformCAs", "1"); - initData.properties->setProperty("IceSSL.CheckCertName", "2"); - initData.properties->setProperty("IceSSL.VerifyDepthMax", "5"); - initData.properties->setProperty( - "Ice.Default.Router", - "Glacier2/router:wss -p 443 -h zeroc.com -r /demo-proxy/chat/glacier2"); + cerr << ex.what() << endl; + status = 1; } - ChatClient app; - return app.main(argc, argv, initData); + return status; } diff --git a/cpp/Chat/client/PollingClient.cpp b/cpp/Chat/client/PollingClient.cpp index e4aa3e3330..cf57556151 100644 --- a/cpp/Chat/client/PollingClient.cpp +++ b/cpp/Chat/client/PollingClient.cpp @@ -2,27 +2,25 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "ChatUtils.h" +#include "PollingChat.h" #include - -#include -#include #include +#include using namespace std; static const unsigned int maxMessageSize = 1024; namespace { - // mutex to prevent intertwined cout output mutex coutMutex; - } class GetUpdatesTask { public: - explicit GetUpdatesTask(const shared_ptr& session) : _session(session) {} + explicit GetUpdatesTask(const optional& session) : _session(session) {} ~GetUpdatesTask() { @@ -114,7 +112,7 @@ class GetUpdatesTask } private: - const shared_ptr _session; + const optional _session; std::future _asyncResult; // only used by the main thread bool _done = false; @@ -144,10 +142,7 @@ main(int argc, char* argv[]) // if (initData.properties->getProperty("PollingChatSessionFactory").empty()) { - initData.properties->setProperty("Ice.Plugin.IceSSL", "IceSSL:createIceSSL"); initData.properties->setProperty("IceSSL.UsePlatformCAs", "1"); - initData.properties->setProperty("IceSSL.CheckCertName", "2"); - initData.properties->setProperty("IceSSL.VerifyDepthMax", "5"); initData.properties->setProperty( "PollingChatSessionFactory", "PollingChatSessionFactory:wss -h zeroc.com -p 443 -r /demo-proxy/chat/poll"); @@ -189,7 +184,7 @@ run(const shared_ptr& communicator) return 1; } - shared_ptr session; + optional session; while (!session) { cout << "This demo accepts any user ID and password.\n"; diff --git a/cpp/Chat/server/ChatRoom.cpp b/cpp/Chat/server/ChatRoom.cpp index b386b3f14d..6be0d1785b 100644 --- a/cpp/Chat/server/ChatRoom.cpp +++ b/cpp/Chat/server/ChatRoom.cpp @@ -80,7 +80,7 @@ ChatRoom::leave(const string& name) } } -Ice::Long +int64_t ChatRoom::send(const string& name, const string& message) { const lock_guard sync(_mutex); diff --git a/cpp/Chat/server/ChatServer.cpp b/cpp/Chat/server/ChatServer.cpp index 35e89d56d5..29a672ab34 100644 --- a/cpp/Chat/server/ChatServer.cpp +++ b/cpp/Chat/server/ChatServer.cpp @@ -2,17 +2,17 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "ChatSessionManagerI.h" +#include "PollingChatSessionFactoryI.h" #include -#include - +#include using namespace std; -class ChatServer : public Ice::Service +class ChatServer final : public Ice::Service { public: - virtual bool start(int argc, char* argv[], int&) override; - virtual bool stop() override; + bool start(int argc, char* argv[], int&) final; + bool stop() final; private: shared_ptr _adapter; @@ -21,7 +21,6 @@ class ChatServer : public Ice::Service bool ChatServer::start(int, char*[], int& status) { - const int timeout = communicator()->getProperties()->getPropertyAsIntWithDefault("PollingChatSessionTimeout", 10); const bool traceEnabled = communicator()->getProperties()->getPropertyAsIntWithDefault("Server.Trace", 0) != 0; auto logger = communicator()->getLogger(); @@ -45,7 +44,7 @@ ChatServer::start(int, char*[], int& status) out << "Chat session manager created ok."; } _adapter->add( - make_shared(chatRoom, timeout, traceEnabled, logger), + make_shared(chatRoom, traceEnabled, logger), Ice::stringToIdentity("PollingChatSessionFactory")); if (traceEnabled) diff --git a/cpp/Chat/server/ChatSessionI.cpp b/cpp/Chat/server/ChatSessionI.cpp index 6a4f576ed8..42ae9a9816 100644 --- a/cpp/Chat/server/ChatSessionI.cpp +++ b/cpp/Chat/server/ChatSessionI.cpp @@ -2,8 +2,8 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include -#include +#include "ChatSessionI.h" +#include "ChatUtils.h" using namespace std; @@ -11,8 +11,8 @@ class SessionCallbackAdapter : public ChatRoomCallbackAdapter, public enable_sha { public: SessionCallbackAdapter( - const shared_ptr& callback, - const shared_ptr& session, + const optional& callback, + const optional& session, bool trace, const shared_ptr& logger, std::string name) @@ -93,8 +93,8 @@ class SessionCallbackAdapter : public ChatRoomCallbackAdapter, public enable_sha } private: - const shared_ptr _callback; - const shared_ptr _session; + const optional _callback; + const optional _session; const bool _trace; const shared_ptr _logger; const string _name; @@ -113,7 +113,7 @@ ChatSessionI::ChatSessionI( } void -ChatSessionI::setCallback(shared_ptr callback, const Ice::Current& current) +ChatSessionI::setCallback(optional callback, const Ice::Current& current) { const lock_guard sync(_mutex); if (_destroy) @@ -131,6 +131,8 @@ ChatSessionI::setCallback(shared_ptr callback, const return; } + callback->ice_ping(); + Ice::Context ctx; ctx["_fwd"] = "o"; _callback = make_shared( diff --git a/cpp/Chat/server/ChatSessionI.h b/cpp/Chat/server/ChatSessionI.h index 2612b02697..dbf050372e 100644 --- a/cpp/Chat/server/ChatSessionI.h +++ b/cpp/Chat/server/ChatSessionI.h @@ -5,17 +5,17 @@ #ifndef CHAT_SESSION_I_H #define CHAT_SESSION_I_H -#include -#include +#include "ChatRoom.h" +#include "ChatSession.h" -class ChatSessionI : public Chat::ChatSession +class ChatSessionI final : public Chat::ChatSession { public: ChatSessionI(const std::shared_ptr&, std::string, bool trace, const std::shared_ptr& logger); - virtual void setCallback(std::shared_ptr, const Ice::Current&) override; - virtual long long send(std::string, const Ice::Current&) override; - virtual void destroy(const Ice::Current&) override; + void setCallback(std::optional, const Ice::Current&) final; + long long send(std::string, const Ice::Current&) final; + void destroy(const Ice::Current&) final; private: const std::shared_ptr _chatRoom; diff --git a/cpp/Chat/server/ChatSessionManagerI.cpp b/cpp/Chat/server/ChatSessionManagerI.cpp index 3aabb85268..9522f1d4d5 100644 --- a/cpp/Chat/server/ChatSessionManagerI.cpp +++ b/cpp/Chat/server/ChatSessionManagerI.cpp @@ -2,9 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include -#include -#include +#include "ChatSessionManagerI.h" +#include "ChatSessionI.h" +#include "ChatUtils.h" using namespace std; @@ -18,10 +18,10 @@ ChatSessionManagerI::ChatSessionManagerI( { } -shared_ptr +optional ChatSessionManagerI::create( string name, - shared_ptr sessionControl, + optional sessionControl, const Ice::Current& current) { string vname; @@ -40,7 +40,7 @@ ChatSessionManagerI::create( throw Glacier2::CannotCreateSessionException(ex.what()); } - shared_ptr proxy; + optional proxy; try { auto session = make_shared(_chatRoom, vname, _trace, _logger); diff --git a/cpp/Chat/server/ChatSessionManagerI.h b/cpp/Chat/server/ChatSessionManagerI.h index f0175fb412..cbeaaa02a2 100644 --- a/cpp/Chat/server/ChatSessionManagerI.h +++ b/cpp/Chat/server/ChatSessionManagerI.h @@ -9,13 +9,13 @@ #include #include -class ChatSessionManagerI : public Glacier2::SessionManager +class ChatSessionManagerI final : public Glacier2::SessionManager { public: ChatSessionManagerI(const std::shared_ptr&, bool trace, const std::shared_ptr& logger); - virtual std::shared_ptr - create(std::string, std::shared_ptr, const Ice::Current&) override; + std::optional + create(std::string, std::optional, const Ice::Current&) final; private: const std::shared_ptr _chatRoom; diff --git a/cpp/Chat/server/PollingChatSessionFactoryI.cpp b/cpp/Chat/server/PollingChatSessionFactoryI.cpp index 7a1bf84cfc..64b9e9da62 100644 --- a/cpp/Chat/server/PollingChatSessionFactoryI.cpp +++ b/cpp/Chat/server/PollingChatSessionFactoryI.cpp @@ -11,17 +11,15 @@ using namespace std; PollingChatSessionFactoryI::PollingChatSessionFactoryI( const shared_ptr& chatRoom, - int timeout, bool trace, const shared_ptr& logger) : _chatRoom(chatRoom), - _timeout(timeout), _trace(trace), _logger(logger) { } -shared_ptr +optional PollingChatSessionFactoryI::create(string name, string, const Ice::Current& current) { string vname; @@ -40,18 +38,13 @@ PollingChatSessionFactoryI::create(string name, string, const Ice::Current& curr throw PollingChat::CannotCreateSessionException(ex.what()); } - shared_ptr proxy; + optional proxy; auto session = make_shared(_chatRoom, vname, _trace, _logger); proxy = Ice::uncheckedCast(current.adapter->addWithUUID(session)); auto collocProxy = proxy->ice_endpoints(Ice::EndpointSeq()); - // - // Close connection if the connection is idle for _timeout seconds - // - current.con->setACM(_timeout, Ice::ACMClose::CloseOnInvocationAndIdle, Ice::ACMHeartbeat::HeartbeatOnDispatch); - auto trace = _trace; auto logger = _logger; current.con->setCloseCallback( diff --git a/cpp/Chat/server/PollingChatSessionFactoryI.h b/cpp/Chat/server/PollingChatSessionFactoryI.h index 80bf40cd8f..b4f89580db 100644 --- a/cpp/Chat/server/PollingChatSessionFactoryI.h +++ b/cpp/Chat/server/PollingChatSessionFactoryI.h @@ -5,23 +5,20 @@ #ifndef POLLING_CHAT_SESSION_FACTORY_I_H #define POLLING_CHAT_SESSION_FACTORY_I_H +#include "ChatRoom.h" +#include "PollingChat.h" +#include "PollingChatSessionI.h" #include -#include -#include -#include - -class PollingChatSessionFactoryI : public PollingChat::PollingChatSessionFactory +class PollingChatSessionFactoryI final : public PollingChat::PollingChatSessionFactory { public: - PollingChatSessionFactoryI(const std::shared_ptr&, int, bool, const std::shared_ptr&); + PollingChatSessionFactoryI(const std::shared_ptr&, bool, const std::shared_ptr&); - virtual std::shared_ptr - create(std::string, std::string, const Ice::Current&) override; + std::optional create(std::string, std::string, const Ice::Current&) final; private: const std::shared_ptr _chatRoom; - const int _timeout; const bool _trace; const std::shared_ptr _logger; }; diff --git a/cpp/Chat/server/PollingChatSessionI.cpp b/cpp/Chat/server/PollingChatSessionI.cpp index 1e700a71d2..5d1f0504f7 100644 --- a/cpp/Chat/server/PollingChatSessionI.cpp +++ b/cpp/Chat/server/PollingChatSessionI.cpp @@ -102,7 +102,7 @@ PollingChatSessionI::getUpdates(const Ice::Current&) return _callback->getUpdates(); } -Ice::Long +int64_t PollingChatSessionI::send(string message, const Ice::Current&) { const lock_guard sync(_mutex); diff --git a/cpp/Glacier2/callback/CallbackI.cpp b/cpp/Glacier2/callback/CallbackI.cpp index d4cd92bd36..242f9177a1 100644 --- a/cpp/Glacier2/callback/CallbackI.cpp +++ b/cpp/Glacier2/callback/CallbackI.cpp @@ -2,14 +2,15 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "CallbackI.h" #include +#include using namespace std; using namespace Demo; void -CallbackI::initiateCallback(shared_ptr proxy, const Ice::Current& current) +CallbackI::initiateCallback(optional proxy, const Ice::Current& current) { cout << "initiating callback to: " << current.adapter->getCommunicator()->proxyToString(proxy) << endl; try diff --git a/cpp/Glacier2/callback/CallbackI.h b/cpp/Glacier2/callback/CallbackI.h index aa53886d00..8ab439728b 100644 --- a/cpp/Glacier2/callback/CallbackI.h +++ b/cpp/Glacier2/callback/CallbackI.h @@ -5,13 +5,13 @@ #ifndef CALLBACK_I_H #define CALLBACK_I_H -#include +#include "Callback.h" -class CallbackI : public Demo::Callback +class CallbackI final : public Demo::Callback { public: - virtual void initiateCallback(std::shared_ptr, const Ice::Current&) override; - virtual void shutdown(const Ice::Current&) override; + void initiateCallback(std::optional, const Ice::Current&) final; + void shutdown(const Ice::Current&) final; }; #endif diff --git a/cpp/Glacier2/callback/Client.cpp b/cpp/Glacier2/callback/Client.cpp index 43614f75c0..dc9058e60f 100644 --- a/cpp/Glacier2/callback/Client.cpp +++ b/cpp/Glacier2/callback/Client.cpp @@ -2,17 +2,18 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Callback.h" #include #include +#include using namespace std; using namespace Demo; -class CallbackReceiverI : public Demo::CallbackReceiver +class CallbackReceiverI final : public Demo::CallbackReceiver { public: - virtual void callback(const Ice::Current&) override { cout << "received callback" << endl; } + void callback(const Ice::Current&) final { cout << "received callback" << endl; } }; void run(const shared_ptr&); @@ -60,16 +61,22 @@ void menu(); void run(const shared_ptr& communicator) { - const shared_ptr router = - Ice::checkedCast(communicator->getDefaultRouter()); - shared_ptr session; + optional defaultRouter = communicator->getDefaultRouter(); + if (!defaultRouter) + { + cerr << "no router configured" << endl; + return; + } + const Glacier2::RouterPrx router = Glacier2::RouterPrx(*communicator->getDefaultRouter()); + + optional session; // // Loop until we have successfully create a session. // while (!session) { // - // Prompt the user for the creadentials to create the session. + // Prompt the user for the credentials to create the session. // cout << "This demo accepts any user-id / password combination.\n"; @@ -100,10 +107,8 @@ run(const shared_ptr& communicator) } } - const Ice::Int acmTimeout = router->getACMTimeout(); const Ice::ConnectionPtr connection = router->ice_getCachedConnection(); assert(connection); - connection->setACM(acmTimeout, IceUtil::None, Ice::ACMHeartbeat::HeartbeatAlways); connection->setCloseCallback([](Ice::ConnectionPtr) { cout << "The Glacier2 session has been destroyed." << endl; }); diff --git a/cpp/Glacier2/callback/Server.cpp b/cpp/Glacier2/callback/Server.cpp index 0d955b0e5b..413c191c1b 100644 --- a/cpp/Glacier2/callback/Server.cpp +++ b/cpp/Glacier2/callback/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "CallbackI.h" #include +#include using namespace std; using namespace Demo; diff --git a/cpp/Glacier2/callback/config.glacier2 b/cpp/Glacier2/callback/config.glacier2 index f38ed422cb..ed378f8b38 100644 --- a/cpp/Glacier2/callback/config.glacier2 +++ b/cpp/Glacier2/callback/config.glacier2 @@ -23,13 +23,6 @@ Glacier2.Server.Endpoints=tcp -h localhost # Glacier2.PermissionsVerifier=DemoGlacier2/NullPermissionsVerifier -# -# The timeout for inactive sessions. If any client session is inactive -# for longer than this value, the session expires and is removed. The -# unit is seconds. -# -Glacier2.SessionTimeout=30 - # # Glacier can forward requests buffered or unbuffered. Unbuffered # means a lower resource consumption, as buffering requires one diff --git a/cpp/Glacier2/simpleChat/ChatSessionI.cpp b/cpp/Glacier2/simpleChat/ChatSessionI.cpp index 3ea2faab01..c8ef8f6c43 100644 --- a/cpp/Glacier2/simpleChat/ChatSessionI.cpp +++ b/cpp/Glacier2/simpleChat/ChatSessionI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "ChatSessionI.h" #include +#include #include using namespace std; @@ -18,20 +19,20 @@ class ChatRoom public: static ChatRoom* instance(); - void enter(const shared_ptr&, const shared_ptr&, const Ice::Current&); - void leave(const shared_ptr&, const Ice::Current&); + void enter(const ChatSessionPrx&, const ChatCallbackPrx&, const Ice::Current&); + void leave(const ChatCallbackPrx&, const Ice::Current&); void message(const string&) const; void deadRouter(const shared_ptr&); void destroy(); private: mutex _mutex; - list> _callbacks; + list _callbacks; // // Map of connection from Glacier2 to proxies of Chat Sessions in this server // - map, list>> _connectionMap; + map, list> _connectionMap; }; ChatRoom* @@ -42,10 +43,7 @@ ChatRoom::instance() } void -ChatRoom::enter( - const shared_ptr& session, - const shared_ptr& callback, - const Ice::Current& current) +ChatRoom::enter(const ChatSessionPrx& session, const ChatCallbackPrx& callback, const Ice::Current& current) { const lock_guard sync(_mutex); _callbacks.push_back(callback); @@ -57,11 +55,6 @@ ChatRoom::enter( _connectionMap[current.con].push_back(session); - // - // Never close this connection from Glacier2 and turn on heartbeats with a timeout of 30s - // - current.con->setACM(30, Ice::ACMClose::CloseOff, Ice::ACMHeartbeat::HeartbeatAlways); - current.con->setCloseCallback( [this](const shared_ptr& con) { @@ -80,13 +73,12 @@ ChatRoom::enter( } void -ChatRoom::leave(const shared_ptr& callback, const Ice::Current& current) +ChatRoom::leave(const ChatCallbackPrx& callback, const Ice::Current& current) { const lock_guard sync(_mutex); - _callbacks.remove_if([&callback](const shared_ptr& cb) - { return Ice::proxyIdentityEqual(callback, cb); }); - _connectionMap[current.con].remove_if([¤t](const shared_ptr& s) + _callbacks.remove_if([&callback](const ChatCallbackPrx& cb) { return Ice::proxyIdentityEqual(callback, cb); }); + _connectionMap[current.con].remove_if([¤t](const ChatSessionPrx& s) { return current.id == s->ice_getIdentity(); }); } @@ -115,7 +107,7 @@ ChatRoom::deadRouter(const shared_ptr& con) { cout << "Detected dead router - destroying all associated sessions " << endl; - list> sessions; + list sessions; { const lock_guard sync(_mutex); auto p = _connectionMap.find(con); @@ -153,18 +145,15 @@ ChatRoom::destroy() ChatSessionI::ChatSessionI(string userId) : _userId(std::move(userId)) {} void -ChatSessionI::setCallback(shared_ptr callback, const Ice::Current& current) +ChatSessionI::setCallback(optional callback, const Ice::Current& current) { const lock_guard sync(_mutex); - if (!_callback) + if (!_callback && callback) { _callback = callback; auto chatRoom = ChatRoom::instance(); chatRoom->message(_userId + " has entered the chat room."); - chatRoom->enter( - Ice::uncheckedCast(current.adapter->createProxy(current.id)), - callback, - current); + chatRoom->enter(ChatSessionPrx(current.adapter->createProxy(current.id)), *callback, current); } } @@ -183,8 +172,8 @@ ChatSessionI::destroy(const Ice::Current& current) if (_callback) { auto chatRoom = ChatRoom::instance(); - chatRoom->leave(_callback, current); - _callback = nullptr; + chatRoom->leave(*_callback, current); + _callback = nullopt; chatRoom->message(_userId + " has left the chat room."); } current.adapter->remove(current.id); @@ -194,8 +183,8 @@ ChatSessionI::destroy(const Ice::Current& current) // ChatSessionManagerI // -shared_ptr -ChatSessionManagerI::create(string userId, shared_ptr, const Ice::Current& current) +optional +ChatSessionManagerI::create(string userId, optional, const Ice::Current& current) { const Ice::Identity ident = {Ice::generateUUID(), "session"}; return Ice::uncheckedCast(current.adapter->add(make_shared(userId), ident)); diff --git a/cpp/Glacier2/simpleChat/ChatSessionI.h b/cpp/Glacier2/simpleChat/ChatSessionI.h index 19c3b54823..4e409d4571 100644 --- a/cpp/Glacier2/simpleChat/ChatSessionI.h +++ b/cpp/Glacier2/simpleChat/ChatSessionI.h @@ -9,26 +9,26 @@ #include #include -class ChatSessionI : public Demo::ChatSession +class ChatSessionI final : public Demo::ChatSession { public: ChatSessionI(std::string); - virtual void setCallback(std::shared_ptr, const Ice::Current&) override; - virtual void say(std::string, const Ice::Current&) override; - virtual void destroy(const Ice::Current&) override; + void setCallback(std::optional, const Ice::Current&) final; + void say(std::string, const Ice::Current&) final; + void destroy(const Ice::Current&) final; private: std::mutex _mutex; const std::string _userId; - std::shared_ptr _callback; + std::optional _callback; }; -class ChatSessionManagerI : public Glacier2::SessionManager +class ChatSessionManagerI final : public Glacier2::SessionManager { public: - virtual std::shared_ptr - create(std::string, std::shared_ptr, const Ice::Current&) override; + std::optional + create(std::string, std::optional, const Ice::Current&) final; void destroy(); }; diff --git a/cpp/Glacier2/simpleChat/Client.cpp b/cpp/Glacier2/simpleChat/Client.cpp index 65a2185825..21bc05b929 100644 --- a/cpp/Glacier2/simpleChat/Client.cpp +++ b/cpp/Glacier2/simpleChat/Client.cpp @@ -2,9 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Chat.h" #include #include +#include using namespace std; using namespace Demo; @@ -68,9 +69,14 @@ string trim(const string&); void run(const shared_ptr& communicator) { - const shared_ptr router = - Ice::checkedCast(communicator->getDefaultRouter()); - shared_ptr session; + optional defaultRouter = communicator->getDefaultRouter(); + if (!defaultRouter) + { + cerr << "no router configured" << endl; + return; + } + const Glacier2::RouterPrx router = Glacier2::RouterPrx(*communicator->getDefaultRouter()); + optional session; while (!session) { cout << "This demo accepts any user-id / password combination.\n"; @@ -98,10 +104,8 @@ run(const shared_ptr& communicator) } } - const Ice::Int acmTimeout = router->getACMTimeout(); const Ice::ConnectionPtr connection = router->ice_getCachedConnection(); assert(connection); - connection->setACM(acmTimeout, IceUtil::None, Ice::ACMHeartbeat::HeartbeatAlways); connection->setCloseCallback( [](Ice::ConnectionPtr) { diff --git a/cpp/Glacier2/simpleChat/Server.cpp b/cpp/Glacier2/simpleChat/Server.cpp index 04438d55ee..74a735967d 100644 --- a/cpp/Glacier2/simpleChat/Server.cpp +++ b/cpp/Glacier2/simpleChat/Server.cpp @@ -2,9 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "ChatSessionI.h" #include #include +#include using namespace std; using namespace Demo; diff --git a/cpp/Glacier2/simpleChat/config.glacier2 b/cpp/Glacier2/simpleChat/config.glacier2 index 4cacfbdb96..6ce986ccf7 100644 --- a/cpp/Glacier2/simpleChat/config.glacier2 +++ b/cpp/Glacier2/simpleChat/config.glacier2 @@ -47,13 +47,6 @@ Glacier2.SessionManager=ChatSessionManager:tcp -h localhost -p 10001 # Glacier2.PermissionsVerifier=ChatSessionVerifier:tcp -h localhost -p 10001 -# -# The timeout for inactive sessions. If any client session is inactive -# for longer than this value, the session expires and is removed. The -# unit is seconds. -# -Glacier2.SessionTimeout=30 - # # Only allow access to back end "sesion" objects. # diff --git a/cpp/Ice/async/Client.cpp b/cpp/Ice/async/Client.cpp index 2a1dec9cbe..38c75a95ff 100644 --- a/cpp/Ice/async/Client.cpp +++ b/cpp/Ice/async/Client.cpp @@ -2,9 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include -#include +#include using namespace std; diff --git a/cpp/Ice/async/HelloI.cpp b/cpp/Ice/async/HelloI.cpp index a7704f6aa2..fd92467b9d 100644 --- a/cpp/Ice/async/HelloI.cpp +++ b/cpp/Ice/async/HelloI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/Ice/async/Server.cpp b/cpp/Ice/async/Server.cpp index 60efa77c81..4df7c14fcb 100644 --- a/cpp/Ice/async/Server.cpp +++ b/cpp/Ice/async/Server.cpp @@ -2,9 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" +#include "WorkQueue.h" #include -#include +#include using namespace std; diff --git a/cpp/Ice/async/WorkQueue.cpp b/cpp/Ice/async/WorkQueue.cpp index 4586be394e..3fc170c06f 100644 --- a/cpp/Ice/async/WorkQueue.cpp +++ b/cpp/Ice/async/WorkQueue.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "WorkQueue.h" #include -#include +#include using namespace std; diff --git a/cpp/Ice/asyncInvocation/Client.cpp b/cpp/Ice/asyncInvocation/Client.cpp index 3052b73a2f..94523247ed 100644 --- a/cpp/Ice/asyncInvocation/Client.cpp +++ b/cpp/Ice/asyncInvocation/Client.cpp @@ -2,12 +2,13 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Calculator.h" + #include +#include #include -#include - using namespace std; int run(const shared_ptr&, const string&); @@ -71,18 +72,18 @@ run(const shared_ptr& communicator, const string& appName) // Calculate 13 / 5 auto fut2 = calculator->divideAsync(13, 5); - // Since the 'divide' operation has output parameters, the result of 'get' is a struct + // Since the 'divide' operation has output parameters, the result of 'get' is a tuple { - auto result = fut2.get(); - cout << "13 / 5 is " << result.returnValue << " with a remainder of " << result.remainder << endl; + auto [returnValue, remainder] = fut2.get(); + cout << "13 / 5 is " << returnValue << " with a remainder of " << remainder << endl; } // same with 13 / 0, which throws an exception try { auto fut3 = calculator->divideAsync(13, 0); - auto result = fut3.get(); - cout << "13 / 0 is " << result.returnValue << " with a remainder of " << result.remainder << endl; + auto [returnValue, remainder] = fut3.get(); + cout << "13 / 0 is " << returnValue << " with a remainder of " << remainder << endl; } catch (const Demo::DivideByZeroException&) { diff --git a/cpp/Ice/asyncInvocation/Server.cpp b/cpp/Ice/asyncInvocation/Server.cpp index cbd0eea132..6cd12b268f 100644 --- a/cpp/Ice/asyncInvocation/Server.cpp +++ b/cpp/Ice/asyncInvocation/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "CalculatorI.h" #include +#include #include using namespace std; diff --git a/cpp/Ice/bidir/CallbackI.cpp b/cpp/Ice/bidir/CallbackI.cpp index 475bf03044..d501206412 100644 --- a/cpp/Ice/bidir/CallbackI.cpp +++ b/cpp/Ice/bidir/CallbackI.cpp @@ -2,14 +2,15 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "CallbackI.h" #include +#include using namespace std; using namespace Demo; void -CallbackSenderI::addClient(std::shared_ptr client, const Ice::Current& current) +CallbackSenderI::addClient(optional client, const Ice::Current& current) { const lock_guard lock(_mutex); cout << "adding client `" << Ice::identityToString(client->ice_getIdentity()) << "'" << endl; @@ -80,7 +81,7 @@ CallbackSenderI::invokeCallback() } void -CallbackSenderI::removeClient(const shared_ptr& client, exception_ptr eptr) +CallbackSenderI::removeClient(const optional& client, exception_ptr eptr) { const lock_guard lock(_mutex); auto p = find(_clients.begin(), _clients.end(), client); diff --git a/cpp/Ice/bidir/CallbackI.h b/cpp/Ice/bidir/CallbackI.h index 9ee609e3f5..6e7f1873c2 100644 --- a/cpp/Ice/bidir/CallbackI.h +++ b/cpp/Ice/bidir/CallbackI.h @@ -5,22 +5,22 @@ #ifndef CALLBACK_I_H #define CALLBACK_I_H -#include +#include "Callback.h" -class CallbackSenderI : public Demo::CallbackSender, public std::enable_shared_from_this +class CallbackSenderI final : public Demo::CallbackSender, public std::enable_shared_from_this { public: - virtual void addClient(std::shared_ptr, const Ice::Current&) override; + void addClient(std::optional, const Ice::Current&) final; void destroy(); void start(); private: void invokeCallback(); - void removeClient(const std::shared_ptr&, std::exception_ptr); + void removeClient(const std::optional&, std::exception_ptr); bool _destroy = false; - std::vector> _clients; + std::vector> _clients; std::mutex _mutex; std::condition_variable _cv; diff --git a/cpp/Ice/bidir/Client.cpp b/cpp/Ice/bidir/Client.cpp index 2ba1228b3d..49e3b63a4a 100644 --- a/cpp/Ice/bidir/Client.cpp +++ b/cpp/Ice/bidir/Client.cpp @@ -2,16 +2,17 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Callback.h" #include +#include using namespace std; using namespace Demo; -class CallbackReceiverI : public CallbackReceiver +class CallbackReceiverI final : public CallbackReceiver { public: - virtual void callback(Ice::Int num, const Ice::Current&) override { cout << "received callback #" << num << endl; } + void callback(int32_t num, const Ice::Current&) final { cout << "received callback #" << num << endl; } }; int run(const shared_ptr&, const string&); diff --git a/cpp/Ice/bidir/Server.cpp b/cpp/Ice/bidir/Server.cpp index 8b428e6bac..67e2a54cf5 100644 --- a/cpp/Ice/bidir/Server.cpp +++ b/cpp/Ice/bidir/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "CallbackI.h" #include +#include using namespace std; using namespace Demo; diff --git a/cpp/Ice/callback/CallbackSenderI.cpp b/cpp/Ice/callback/CallbackSenderI.cpp index 318ff4e492..a02e19ecf3 100644 --- a/cpp/Ice/callback/CallbackSenderI.cpp +++ b/cpp/Ice/callback/CallbackSenderI.cpp @@ -2,14 +2,15 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "CallbackSenderI.h" #include +#include using namespace std; using namespace Demo; void -CallbackSenderI::initiateCallback(shared_ptr proxy, const Ice::Current&) +CallbackSenderI::initiateCallback(optional proxy, const Ice::Current&) { cout << "initiating callback" << endl; try diff --git a/cpp/Ice/callback/CallbackSenderI.h b/cpp/Ice/callback/CallbackSenderI.h index f131993c37..e4bc180461 100644 --- a/cpp/Ice/callback/CallbackSenderI.h +++ b/cpp/Ice/callback/CallbackSenderI.h @@ -5,13 +5,13 @@ #ifndef CALLBACK_I_H #define CALLBACK_I_H -#include +#include "Callback.h" -class CallbackSenderI : public Demo::CallbackSender +class CallbackSenderI final : public Demo::CallbackSender { public: - virtual void initiateCallback(std::shared_ptr, const Ice::Current&) override; - virtual void shutdown(const Ice::Current&) override; + void initiateCallback(std::optional, const Ice::Current&) final; + void shutdown(const Ice::Current&) final; }; #endif diff --git a/cpp/Ice/callback/Client.cpp b/cpp/Ice/callback/Client.cpp index 5d0d8686ee..53d06b2970 100644 --- a/cpp/Ice/callback/Client.cpp +++ b/cpp/Ice/callback/Client.cpp @@ -2,16 +2,17 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Callback.h" #include +#include using namespace std; using namespace Demo; -class CallbackReceiverI : public CallbackReceiver +class CallbackReceiverI final : public CallbackReceiver { public: - virtual void callback(const Ice::Current&) override { cout << "received callback" << endl; } + void callback(const Ice::Current&) final { cout << "received callback" << endl; } }; int run(const shared_ptr&); diff --git a/cpp/Ice/callback/Server.cpp b/cpp/Ice/callback/Server.cpp index eb7bc7b6a3..d47187f07a 100644 --- a/cpp/Ice/callback/Server.cpp +++ b/cpp/Ice/callback/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "CallbackSenderI.h" #include +#include using namespace std; using namespace Demo; diff --git a/cpp/Ice/context/Client.cpp b/cpp/Ice/context/Client.cpp index 492c53b1c7..dda7503991 100644 --- a/cpp/Ice/context/Client.cpp +++ b/cpp/Ice/context/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Context.h" #include +#include using namespace std; using namespace Demo; diff --git a/cpp/Ice/context/ContextI.cpp b/cpp/Ice/context/ContextI.cpp index 6a8514de33..734fcaa8ab 100644 --- a/cpp/Ice/context/ContextI.cpp +++ b/cpp/Ice/context/ContextI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "ContextI.h" #include +#include using namespace std; diff --git a/cpp/Ice/context/Server.cpp b/cpp/Ice/context/Server.cpp index 0716adc21c..e4aea7d650 100644 --- a/cpp/Ice/context/Server.cpp +++ b/cpp/Ice/context/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "ContextI.h" #include +#include using namespace std; diff --git a/cpp/Ice/hello/Client.cpp b/cpp/Ice/hello/Client.cpp index 7a106b1398..72ae948fd3 100644 --- a/cpp/Ice/hello/Client.cpp +++ b/cpp/Ice/hello/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include +#include using namespace std; using namespace Demo; diff --git a/cpp/Ice/hello/HelloI.cpp b/cpp/Ice/hello/HelloI.cpp index 07ef89de15..77b1464cea 100644 --- a/cpp/Ice/hello/HelloI.cpp +++ b/cpp/Ice/hello/HelloI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include #include using namespace std; diff --git a/cpp/Ice/hello/Server.cpp b/cpp/Ice/hello/Server.cpp index 15e7a9dde6..8635ee5d63 100644 --- a/cpp/Ice/hello/Server.cpp +++ b/cpp/Ice/hello/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/Ice/interceptor/Client.cpp b/cpp/Ice/interceptor/Client.cpp index 4f8c7df0e3..0fa2c8cb6f 100644 --- a/cpp/Ice/interceptor/Client.cpp +++ b/cpp/Ice/interceptor/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Interceptor.h" #include -#include +#include using namespace std; diff --git a/cpp/Ice/interceptor/InterceptorI.cpp b/cpp/Ice/interceptor/InterceptorI.cpp index 1e62b0e5d3..9d539de7b6 100644 --- a/cpp/Ice/interceptor/InterceptorI.cpp +++ b/cpp/Ice/interceptor/InterceptorI.cpp @@ -2,24 +2,24 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "InterceptorI.h" using namespace std; InterceptorI::InterceptorI( - shared_ptr servant, + shared_ptr next, shared_ptr authenticator, unordered_set securedOperations) - : _servant(std::move(servant)), + : _next(std::move(next)), _authenticator(std::move(authenticator)), _securedOperations(std::move(securedOperations)) { } -bool -InterceptorI::dispatch(Ice::Request& request) +void +InterceptorI::dispatch(Ice::IncomingRequest& request, function sendResponse) { - auto current = request.getCurrent(); + auto current = request.current(); // // Check if the operation requires authorization to invoke. // @@ -42,5 +42,5 @@ InterceptorI::dispatch(Ice::Request& request) throw Demo::AuthorizationException(); } } - return _servant->ice_dispatch(request); + _next->dispatch(request, sendResponse); } diff --git a/cpp/Ice/interceptor/InterceptorI.h b/cpp/Ice/interceptor/InterceptorI.h index 73dc51086c..e4337d6103 100644 --- a/cpp/Ice/interceptor/InterceptorI.h +++ b/cpp/Ice/interceptor/InterceptorI.h @@ -9,14 +9,14 @@ #include #include -class InterceptorI : public Ice::DispatchInterceptor +class InterceptorI : public Ice::Object { public: InterceptorI(std::shared_ptr, std::shared_ptr, std::unordered_set); - virtual bool dispatch(Ice::Request&) override; + void dispatch(Ice::IncomingRequest&, std::function) final; private: - std::shared_ptr _servant; + std::shared_ptr _next; std::shared_ptr _authenticator; std::unordered_set _securedOperations; }; diff --git a/cpp/Ice/interceptor/Server.cpp b/cpp/Ice/interceptor/Server.cpp index edf9d4574e..b1f82d2ac6 100644 --- a/cpp/Ice/interceptor/Server.cpp +++ b/cpp/Ice/interceptor/Server.cpp @@ -2,10 +2,11 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "AuthenticatorI.h" +#include "InterceptorI.h" +#include "ThermostatI.h" #include -#include -#include +#include #include using namespace std; diff --git a/cpp/Ice/interceptor/ThermostatI.cpp b/cpp/Ice/interceptor/ThermostatI.cpp index 65013c4bbc..8195425a04 100644 --- a/cpp/Ice/interceptor/ThermostatI.cpp +++ b/cpp/Ice/interceptor/ThermostatI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "ThermostatI.h" #include -#include +#include using namespace std; diff --git a/cpp/Ice/interleaved/Client.cpp b/cpp/Ice/interleaved/Client.cpp index e061d7faa9..83f88c0046 100644 --- a/cpp/Ice/interleaved/Client.cpp +++ b/cpp/Ice/interleaved/Client.cpp @@ -2,11 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Throughput.h" #include -#include - #include - +#include #include using namespace std; diff --git a/cpp/Ice/interleaved/Server.cpp b/cpp/Ice/interleaved/Server.cpp index 6a8fb2ed3b..eb90945383 100644 --- a/cpp/Ice/interleaved/Server.cpp +++ b/cpp/Ice/interleaved/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "ThroughputI.h" #include -#include +#include using namespace std; diff --git a/cpp/Ice/interleaved/ThroughputI.cpp b/cpp/Ice/interleaved/ThroughputI.cpp index f768a15cf4..a251a21f9b 100644 --- a/cpp/Ice/interleaved/ThroughputI.cpp +++ b/cpp/Ice/interleaved/ThroughputI.cpp @@ -2,11 +2,11 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "ThroughputI.h" #include -#include Demo::Throughput::EchoByteSeqMarshaledResult -ThroughputI::echoByteSeq(std::pair seq, const Ice::Current& current) +ThroughputI::echoByteSeq(std::pair seq, const Ice::Current& current) { return EchoByteSeqMarshaledResult(seq, current); } diff --git a/cpp/Ice/interleaved/ThroughputI.h b/cpp/Ice/interleaved/ThroughputI.h index 84d46a168f..83943bdc9e 100644 --- a/cpp/Ice/interleaved/ThroughputI.h +++ b/cpp/Ice/interleaved/ThroughputI.h @@ -5,15 +5,14 @@ #ifndef THROUGHPUT_I_H #define THROUGHPUT_I_H -#include +#include "Throughput.h" -class ThroughputI : public Demo::Throughput +class ThroughputI final : public Demo::Throughput { public: - virtual EchoByteSeqMarshaledResult - echoByteSeq(std::pair, const Ice::Current&) override; + EchoByteSeqMarshaledResult echoByteSeq(std::pair, const Ice::Current&) final; - virtual void shutdown(const Ice::Current&) override; + void shutdown(const Ice::Current&) final; }; #endif diff --git a/cpp/Ice/invoke/Client.cpp b/cpp/Ice/invoke/Client.cpp index ce367d2ae9..d877d3f056 100644 --- a/cpp/Ice/invoke/Client.cpp +++ b/cpp/Ice/invoke/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Printer.h" #include -#include +#include using namespace std; using namespace Demo; diff --git a/cpp/Ice/invoke/PrinterI.cpp b/cpp/Ice/invoke/PrinterI.cpp index c9437fa0d2..6022428ad1 100644 --- a/cpp/Ice/invoke/PrinterI.cpp +++ b/cpp/Ice/invoke/PrinterI.cpp @@ -2,8 +2,11 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "PrinterI.h" + #include -#include + +#include using namespace std; using namespace Demo; @@ -27,7 +30,7 @@ operator<<(ostream& out, Color c) } bool -PrinterI::ice_invoke(vector inParams, vector& outParams, const Ice::Current& current) +PrinterI::ice_invoke(vector inParams, vector& outParams, const Ice::Current& current) { auto communicator = current.adapter->getCommunicator(); diff --git a/cpp/Ice/invoke/PrinterI.h b/cpp/Ice/invoke/PrinterI.h index 425e655011..1223b0c704 100644 --- a/cpp/Ice/invoke/PrinterI.h +++ b/cpp/Ice/invoke/PrinterI.h @@ -5,12 +5,12 @@ #ifndef PRINTER_I_H #define PRINTER_I_H -#include +#include "Printer.h" -class PrinterI : public Ice::Blobject +class PrinterI final : public Ice::Blobject { public: - virtual bool ice_invoke(std::vector, std::vector&, const Ice::Current&) override; + bool ice_invoke(std::vector, std::vector&, const Ice::Current&) final; }; #endif diff --git a/cpp/Ice/invoke/Server.cpp b/cpp/Ice/invoke/Server.cpp index 83f8e10f9d..22f42fc333 100644 --- a/cpp/Ice/invoke/Server.cpp +++ b/cpp/Ice/invoke/Server.cpp @@ -2,8 +2,11 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "PrinterI.h" + #include -#include + +#include using namespace std; diff --git a/cpp/Ice/latency/Client.cpp b/cpp/Ice/latency/Client.cpp index b9abca472e..9d3eb56f1b 100644 --- a/cpp/Ice/latency/Client.cpp +++ b/cpp/Ice/latency/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Latency.h" #include -#include +#include using namespace std; using namespace Demo; diff --git a/cpp/Ice/latency/Server.cpp b/cpp/Ice/latency/Server.cpp index 0c0595ee9f..88468b8f0c 100644 --- a/cpp/Ice/latency/Server.cpp +++ b/cpp/Ice/latency/Server.cpp @@ -2,8 +2,11 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Latency.h" + #include -#include + +#include using namespace std; using namespace Demo; diff --git a/cpp/Ice/locator/Client.cpp b/cpp/Ice/locator/Client.cpp index 8a2e69b226..7ac9c74165 100644 --- a/cpp/Ice/locator/Client.cpp +++ b/cpp/Ice/locator/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include +#include using namespace std; using namespace Demo; diff --git a/cpp/Ice/locator/HelloI.cpp b/cpp/Ice/locator/HelloI.cpp index 07155288e1..7e91540be4 100644 --- a/cpp/Ice/locator/HelloI.cpp +++ b/cpp/Ice/locator/HelloI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; @@ -22,6 +23,6 @@ HelloI::shutdown(const Ice::Current& c) // Unregister from the Locator registry // auto communicator = c.adapter->getCommunicator(); - communicator->getDefaultLocator()->getRegistry()->setAdapterDirectProxy("Hello", nullptr); + communicator->getDefaultLocator()->getRegistry()->setAdapterDirectProxy("Hello", nullopt); communicator->shutdown(); } diff --git a/cpp/Ice/locator/Locator.cpp b/cpp/Ice/locator/Locator.cpp index 8815d3dcf8..84bd37457c 100644 --- a/cpp/Ice/locator/Locator.cpp +++ b/cpp/Ice/locator/Locator.cpp @@ -3,57 +3,58 @@ // #include +#include using namespace std; namespace { - class LocatorRegistryI : public Ice::LocatorRegistry + class LocatorRegistryI final : public Ice::LocatorRegistry { public: - virtual void setAdapterDirectProxyAsync( + void setAdapterDirectProxyAsync( string id, - shared_ptr proxy, + optional proxy, function response, function, - const Ice::Current&) override + const Ice::Current&) final { - if (!proxy) + if (proxy) { - _adapters.erase(id); + _adapters.insert({id, std::move(*proxy)}); } else { - _adapters[id] = proxy; + _adapters.erase(id); } response(); } - virtual void setReplicatedAdapterDirectProxyAsync( + void setReplicatedAdapterDirectProxyAsync( string, string, - shared_ptr, + optional, function response, function, - const Ice::Current&) override + const Ice::Current&) final { assert(false); // Not used by this demo response(); } - virtual void setServerProcessProxyAsync( + void setServerProcessProxyAsync( string, - shared_ptr, + optional, function response, function, - const Ice::Current&) override + const Ice::Current&) final { assert(false); // Not used by this demo response(); } - shared_ptr getAdapter(const string& id) + optional getAdapter(const string& id) { auto p = _adapters.find(id); if (p == _adapters.end()) @@ -64,44 +65,41 @@ namespace } private: - map> _adapters; + map _adapters; }; - class LocatorI : public Ice::Locator + class LocatorI final : public Ice::Locator { public: - LocatorI(shared_ptr registry, shared_ptr registryPrx) + LocatorI(shared_ptr registry, optional registryPrx) : _registry(std::move(registry)), _registryPrx(std::move(registryPrx)) { } - virtual void findObjectByIdAsync( + void findObjectByIdAsync( Ice::Identity, - function&)> response, + function&)> response, function, - const Ice::Current&) const override + const Ice::Current&) const final { - response(nullptr); + response(nullopt); } - virtual void findAdapterByIdAsync( + void findAdapterByIdAsync( string id, - function&)> response, + function&)> response, function, - const Ice::Current&) const override + const Ice::Current&) const final { response(_registry->getAdapter(id)); } - virtual shared_ptr getRegistry(const Ice::Current&) const override - { - return _registryPrx; - } + optional getRegistry(const Ice::Current&) const final { return _registryPrx; } private: const shared_ptr _registry; - const shared_ptr _registryPrx; + const optional _registryPrx; }; } diff --git a/cpp/Ice/locator/Server.cpp b/cpp/Ice/locator/Server.cpp index 77fe3d7984..9da1fbff49 100644 --- a/cpp/Ice/locator/Server.cpp +++ b/cpp/Ice/locator/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/Ice/minimal/Client.cpp b/cpp/Ice/minimal/Client.cpp index 186c507e6d..d50808bc39 100644 --- a/cpp/Ice/minimal/Client.cpp +++ b/cpp/Ice/minimal/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include +#include using namespace std; using namespace Demo; diff --git a/cpp/Ice/minimal/HelloI.cpp b/cpp/Ice/minimal/HelloI.cpp index 03eec19da2..59710360f1 100644 --- a/cpp/Ice/minimal/HelloI.cpp +++ b/cpp/Ice/minimal/HelloI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/Ice/minimal/Server.cpp b/cpp/Ice/minimal/Server.cpp index 3278461ce0..c443ef925a 100644 --- a/cpp/Ice/minimal/Server.cpp +++ b/cpp/Ice/minimal/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/Ice/mtalk/Client.cpp b/cpp/Ice/mtalk/Client.cpp index 676aca6f37..0717475b11 100644 --- a/cpp/Ice/mtalk/Client.cpp +++ b/cpp/Ice/mtalk/Client.cpp @@ -2,10 +2,11 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "MTalk.h" #include -#include #include #include +#include #include using namespace std; @@ -15,8 +16,8 @@ class ChatApp public: int run(const shared_ptr&); - void discoveredPeer(const string&, const shared_ptr&); - void connect(const string&, const shared_ptr&); + void discoveredPeer(const string&, const optional&); + void connect(const string&, const optional&); void message(const string&); void disconnect(const Ice::Identity&, const shared_ptr&, bool); void closed(); @@ -32,9 +33,9 @@ class ChatApp string _name; shared_ptr _multicastAdapter; shared_ptr _peerAdapter; - shared_ptr _local; - shared_ptr _remote; - map> _peers; + optional _local; + optional _remote; + map> _peers; mutex _mutex; condition_variable _condition; }; @@ -42,12 +43,12 @@ class ChatApp // // This servant listens for multicast messages. // -class DiscoveryI : public MTalk::Discovery +class DiscoveryI final : public MTalk::Discovery { public: DiscoveryI(ChatApp* app) : _app(app) {} - virtual void announce(string name, shared_ptr peer, const Ice::Current&) override + void announce(string name, optional peer, const Ice::Current&) final { _app->discoveredPeer(name, peer); } @@ -59,19 +60,19 @@ class DiscoveryI : public MTalk::Discovery // // This servant listens for incoming connections from peers. // -class IncomingPeerI : public MTalk::Peer +class IncomingPeerI final : public MTalk::Peer { public: IncomingPeerI(ChatApp* app) : _app(app) {} - virtual void connect(string name, shared_ptr peer, const Ice::Current& current) override + void connect(string name, optional peer, const Ice::Current& current) final { _app->connect(name, peer->ice_fixed(current.con)); } - virtual void message(string text, const Ice::Current&) override { _app->message(text); } + void message(string text, const Ice::Current&) final { _app->message(text); } - virtual void disconnect(const Ice::Current& current) override { _app->disconnect(current.id, current.con, true); } + void disconnect(const Ice::Current& current) final { _app->disconnect(current.id, current.con, true); } private: ChatApp* _app; @@ -80,19 +81,19 @@ class IncomingPeerI : public MTalk::Peer // // This servant handles an outgoing session with a peer. // -class OutgoingPeerI : public MTalk::Peer +class OutgoingPeerI final : public MTalk::Peer { public: OutgoingPeerI(ChatApp* app) : _app(app) {} - virtual void connect(string, shared_ptr, const Ice::Current&) override + void connect(string, optional, const Ice::Current&) final { throw MTalk::ConnectionException("already connected"); } - virtual void message(string text, const Ice::Current&) override { _app->message(text); } + void message(string text, const Ice::Current&) final { _app->message(text); } - virtual void disconnect(const Ice::Current& current) override { _app->disconnect(current.id, current.con, false); } + void disconnect(const Ice::Current& current) final { _app->disconnect(current.id, current.con, false); } private: ChatApp* _app; @@ -104,7 +105,7 @@ class OutgoingPeerI : public MTalk::Peer class DiscoverTask { public: - DiscoverTask(shared_ptr d, string n, shared_ptr p) + DiscoverTask(optional d, string n, optional p) : _discovery(d), _name(n), _proxy(p) @@ -157,9 +158,9 @@ class DiscoverTask } private: - shared_ptr _discovery; + optional _discovery; string _name; - shared_ptr _proxy; + optional _proxy; bool _destroyed = false; mutex _mutex; condition_variable _condition; @@ -301,7 +302,7 @@ ChatApp::run(const shared_ptr& communicator) } void -ChatApp::discoveredPeer(const string& name, const shared_ptr& peer) +ChatApp::discoveredPeer(const string& name, const optional& peer) { const lock_guard lock(_mutex); @@ -326,7 +327,7 @@ ChatApp::discoveredPeer(const string& name, const shared_ptr& pe } void -ChatApp::connect(const string& name, const shared_ptr& peer) +ChatApp::connect(const string& name, const optional& peer) { // // Called for a new incoming connection request. @@ -344,7 +345,6 @@ ChatApp::connect(const string& name, const shared_ptr& peer) // auto con = peer->ice_getConnection(); con->setCloseCallback([this](const shared_ptr&) { this->closed(); }); - con->setACM(30, Ice::ACMClose::CloseOff, Ice::ACMHeartbeat::HeartbeatAlways); _remote = peer->ice_invocationTimeout(5000); @@ -377,7 +377,7 @@ ChatApp::disconnect(const Ice::Identity& id, const shared_ptr& if (_remote) { cout << ">>>> Peer disconnected" << endl; - _remote = nullptr; + _remote = nullopt; } if (!incoming) @@ -393,7 +393,7 @@ ChatApp::closed() { const lock_guard lock(_mutex); - _remote = nullptr; + _remote = nullopt; cout << ">>>> Connection to peer closed" << endl; } @@ -415,7 +415,7 @@ ChatApp::doConnect(const string& cmd) } auto name = cmd.substr(sp); - shared_ptr remote; + optional remote; { const lock_guard lock(_mutex); @@ -435,7 +435,7 @@ ChatApp::doConnect(const string& cmd) remote = _remote; } - shared_ptr localPeer; + optional localPeer; try { cout << ">>>> Connecting to " << name << endl; @@ -459,7 +459,6 @@ ChatApp::doConnect(const string& cmd) // Install a connection callback and enable ACM heartbeats. // con->setCloseCallback([this](const shared_ptr&) { this->closed(); }); - con->setACM(30, Ice::ACMClose::CloseOff, Ice::ACMHeartbeat::HeartbeatAlways); // // Now we're ready to notify the peer that we'd like to connect. @@ -474,7 +473,7 @@ ChatApp::doConnect(const string& cmd) { _peerAdapter->remove(localPeer->ice_getIdentity()); } - _remote = nullptr; + _remote = nullopt; return; } catch (const Ice::Exception& ex) @@ -484,7 +483,7 @@ ChatApp::doConnect(const string& cmd) { _peerAdapter->remove(localPeer->ice_getIdentity()); } - _remote = nullptr; + _remote = nullopt; return; } } @@ -510,7 +509,7 @@ ChatApp::doList() void ChatApp::doDisconnect() { - shared_ptr peer; + optional peer; { const lock_guard lock(_mutex); @@ -522,7 +521,7 @@ ChatApp::doDisconnect() } peer = _remote; - _remote = nullptr; + _remote = nullopt; } try @@ -537,7 +536,7 @@ ChatApp::doDisconnect() void ChatApp::doMessage(const string& text) { - shared_ptr peer; + optional peer; { const lock_guard lock(_mutex); @@ -564,12 +563,12 @@ ChatApp::doMessage(const string& text) void ChatApp::failed(const Ice::LocalException& ex) { - shared_ptr peer; + optional peer; { const lock_guard lock(_mutex); peer = _remote; - _remote = nullptr; + _remote = nullopt; } cout << ">>>> Action failed:" << endl << ex << endl; diff --git a/cpp/Ice/multicast/Client.cpp b/cpp/Ice/multicast/Client.cpp index 591f37fefc..5c49496bf5 100644 --- a/cpp/Ice/multicast/Client.cpp +++ b/cpp/Ice/multicast/Client.cpp @@ -2,22 +2,21 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Discovery.h" +#include "Hello.h" #include - -#include -#include - #include #include +#include #include using namespace std; using namespace Demo; -class DiscoverReplyI : public DiscoverReply +class DiscoverReplyI final : public DiscoverReply { public: - virtual void reply(shared_ptr obj, const Ice::Current&) override + void reply(optional obj, const Ice::Current&) final { { const lock_guard lock(_mutex); @@ -29,7 +28,7 @@ class DiscoverReplyI : public DiscoverReply _cond.notify_all(); } - shared_ptr waitReply(int seconds) + optional waitReply(int seconds) { auto until = chrono::system_clock::now() + chrono::seconds(seconds); unique_lock lock(_mutex); @@ -43,7 +42,7 @@ class DiscoverReplyI : public DiscoverReply } private: - shared_ptr _obj; + optional _obj; mutex _mutex; condition_variable _cond; }; diff --git a/cpp/Ice/multicast/Server.cpp b/cpp/Ice/multicast/Server.cpp index c4eb6e7e5c..f936e914fc 100644 --- a/cpp/Ice/multicast/Server.cpp +++ b/cpp/Ice/multicast/Server.cpp @@ -2,30 +2,33 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Discovery.h" +#include "Hello.h" #include - -#include -#include +#include using namespace std; using namespace Demo; -class HelloI : public Hello +class HelloI final : public Hello { public: - virtual void sayHello(const Ice::Current&) override { cout << "Hello World!" << endl; } + void sayHello(const Ice::Current&) final { cout << "Hello World!" << endl; } }; -class DiscoverI : public Discover +class DiscoverI final : public Discover { public: - DiscoverI(const shared_ptr& obj) : _obj(obj) {} + DiscoverI(const optional& obj) : _obj(obj) {} - virtual void lookup(shared_ptr reply, const Ice::Current&) override + void lookup(optional reply, const Ice::Current&) final { try { - reply->reply(_obj); + if (reply) + { + reply->reply(_obj); + } } catch (const Ice::LocalException&) { @@ -34,7 +37,7 @@ class DiscoverI : public Discover } private: - const shared_ptr _obj; + const optional _obj; }; int diff --git a/cpp/Ice/nested/Client.cpp b/cpp/Ice/nested/Client.cpp index bb8117765e..9638311af3 100644 --- a/cpp/Ice/nested/Client.cpp +++ b/cpp/Ice/nested/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "NestedI.h" #include -#include +#include using namespace std; using namespace Demo; diff --git a/cpp/Ice/nested/NestedI.cpp b/cpp/Ice/nested/NestedI.cpp index d83858b67f..85d1f3d2d1 100644 --- a/cpp/Ice/nested/NestedI.cpp +++ b/cpp/Ice/nested/NestedI.cpp @@ -2,16 +2,17 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "NestedI.h" #include -#include +#include using namespace std; using namespace Demo; -NestedI::NestedI(shared_ptr self) : _self(std::move(self)) {} +NestedI::NestedI(optional self) : _self(std::move(self)) {} void -NestedI::nestedCall(int level, shared_ptr proxy, const Ice::Current&) +NestedI::nestedCall(int level, optional proxy, const Ice::Current&) { cout << level << endl; if (--level > 0) diff --git a/cpp/Ice/nested/NestedI.h b/cpp/Ice/nested/NestedI.h index ad67c26049..8863343315 100644 --- a/cpp/Ice/nested/NestedI.h +++ b/cpp/Ice/nested/NestedI.h @@ -5,16 +5,16 @@ #ifndef NESTED_I_H #define NESTED_I_H -#include +#include "Nested.h" -class NestedI : public Demo::Nested +class NestedI final : public Demo::Nested { public: - NestedI(std::shared_ptr); - virtual void nestedCall(int, std::shared_ptr, const Ice::Current&) override; + NestedI(std::optional); + void nestedCall(int, std::optional, const Ice::Current&) final; private: - const std::shared_ptr _self; + const std::optional _self; }; #endif diff --git a/cpp/Ice/nested/Server.cpp b/cpp/Ice/nested/Server.cpp index ebb7d1f7cc..d11bd1f482 100644 --- a/cpp/Ice/nested/Server.cpp +++ b/cpp/Ice/nested/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "NestedI.h" #include -#include +#include using namespace std; using namespace Demo; diff --git a/cpp/Ice/optional/Client.cpp b/cpp/Ice/optional/Client.cpp index 679b0cfbb2..f405b75ab8 100644 --- a/cpp/Ice/optional/Client.cpp +++ b/cpp/Ice/optional/Client.cpp @@ -2,13 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -// TODO: remove when no longer needed -#ifdef _MSC_VER -# pragma warning(disable : 4702) // unreachable code in optional -#endif - -#include +#include "Contact.h" #include +#include using namespace std; using namespace Demo; @@ -65,8 +61,8 @@ main(int argc, char* argv[]) int run(const shared_ptr& communicator, const string& appName) { - auto contactdb = Ice::checkedCast(communicator->propertyToProxy("ContactDB.Proxy")); - if (!contactdb) + auto contactDb = Ice::checkedCast(communicator->propertyToProxy("ContactDB.Proxy")); + if (!contactDb) { cerr << appName << ": invalid proxy" << endl; return 1; @@ -76,7 +72,7 @@ run(const shared_ptr& communicator, const string& appName) // Add a contact for "john". All parameters are provided. // const string johnNumber = "123-456-7890"; - contactdb->addContact("john", NumberType::HOME, johnNumber, 0); + contactDb->addContact("john", NumberType::HOME, johnNumber, 0); cout << "Checking john... " << flush; @@ -86,7 +82,7 @@ run(const shared_ptr& communicator, const string& appName) // // number is an Ice::optional // - auto number = contactdb->queryNumber("john"); + auto number = contactDb->queryNumber("john"); // // tests if an optional value is set. // @@ -121,14 +117,14 @@ run(const shared_ptr& communicator, const string& appName) } // Optional can also be used in an out parameter. - Ice::optional dialgroup; - contactdb->queryDialgroup("john", dialgroup); - if (!dialgroup || dialgroup != 0) + optional dialGroup; + contactDb->queryDialgroup("john", dialGroup); + if (!dialGroup || dialGroup != 0) { - cout << "dialgroup is incorrect " << flush; + cout << "dialGroup is incorrect " << flush; } - auto info = contactdb->query("john"); + auto info = contactDb->query("john"); // // All of the info parameters should be set. // @@ -150,16 +146,16 @@ run(const shared_ptr& communicator, const string& appName) // the default value. // const string steveNumber = "234-567-8901"; - contactdb->addContact("steve", Ice::nullopt, steveNumber, 1); + contactDb->addContact("steve", nullopt, steveNumber, 1); cout << "Checking steve... " << flush; - number = contactdb->queryNumber("steve"); + number = contactDb->queryNumber("steve"); if (number != steveNumber) { cout << "number is incorrect " << flush; } - info = contactdb->query("steve"); + info = contactDb->query("steve"); // // Check the value for the NumberType. // @@ -173,10 +169,10 @@ run(const shared_ptr& communicator, const string& appName) cout << "info is incorrect " << flush; } - contactdb->queryDialgroup("steve", dialgroup); - if (!dialgroup || dialgroup != 1) + contactDb->queryDialgroup("steve", dialGroup); + if (!dialGroup || dialGroup != 1) { - cout << "dialgroup is incorrect " << flush; + cout << "dialGroup is incorrect " << flush; } cout << "ok" << endl; @@ -185,17 +181,17 @@ run(const shared_ptr& communicator, const string& appName) // Add a contact from "frank". Here the dialGroup field isn't set. // const string frankNumber = "345-678-9012"; - contactdb->addContact("frank", NumberType::CELL, frankNumber, Ice::nullopt); + contactDb->addContact("frank", NumberType::CELL, frankNumber, nullopt); cout << "Checking frank... " << flush; - number = contactdb->queryNumber("frank"); + number = contactDb->queryNumber("frank"); if (number != frankNumber) { cout << "number is incorrect " << flush; } - info = contactdb->query("frank"); + info = contactDb->query("frank"); // // The dial group field should be unset. // @@ -208,26 +204,26 @@ run(const shared_ptr& communicator, const string& appName) cout << "info is incorrect " << flush; } - contactdb->queryDialgroup("frank", dialgroup); - if (dialgroup) + contactDb->queryDialgroup("frank", dialGroup); + if (dialGroup) { - cout << "dialgroup is incorrect " << flush; + cout << "dialGroup is incorrect " << flush; } cout << "ok" << endl; // // Add a contact from "anne". The number field isn't set. // - contactdb->addContact("anne", NumberType::OFFICE, Ice::nullopt, 2); + contactDb->addContact("anne", NumberType::OFFICE, nullopt, 2); cout << "Checking anne... " << flush; - number = contactdb->queryNumber("anne"); + number = contactDb->queryNumber("anne"); if (number) { cout << "number is incorrect " << flush; } - info = contactdb->query("anne"); + info = contactDb->query("anne"); // // The number field should be unset. // @@ -240,10 +236,10 @@ run(const shared_ptr& communicator, const string& appName) cout << "info is incorrect " << flush; } - contactdb->queryDialgroup("anne", dialgroup); - if (!dialgroup || dialgroup != 2) + contactDb->queryDialgroup("anne", dialGroup); + if (!dialGroup || dialGroup != 2) { - cout << "dialgroup is incorrect " << flush; + cout << "dialGroup is incorrect " << flush; } // @@ -252,20 +248,20 @@ run(const shared_ptr& communicator, const string& appName) // the remainder of the fields are unchanged. // const string anneNumber = "456-789-0123"; - contactdb->updateContact("anne", Ice::nullopt, anneNumber, Ice::nullopt); - number = contactdb->queryNumber("anne"); + contactDb->updateContact("anne", nullopt, anneNumber, nullopt); + number = contactDb->queryNumber("anne"); if (number != anneNumber) { cout << "number is incorrect " << flush; } - info = contactdb->query("anne"); + info = contactDb->query("anne"); if (info->number != anneNumber || info->type != NumberType::OFFICE || info->dialGroup != 2) { cout << "info is incorrect " << flush; } cout << "ok" << endl; - contactdb->shutdown(); + contactDb->shutdown(); return 0; } diff --git a/cpp/Ice/optional/ContactDBI.cpp b/cpp/Ice/optional/ContactDBI.cpp index f1773ce2fa..89f73f461c 100644 --- a/cpp/Ice/optional/ContactDBI.cpp +++ b/cpp/Ice/optional/ContactDBI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "ContactDBI.h" #include +#include using namespace std; using namespace Demo; @@ -11,9 +12,9 @@ using namespace Demo; void ContactDBI::addContact( string name, - Ice::optional type, - Ice::optional number, - Ice::optional dialGroup, + optional type, + optional number, + optional dialGroup, const Ice::Current&) { auto contact = make_shared(); @@ -40,9 +41,9 @@ ContactDBI::addContact( void ContactDBI::updateContact( string name, - Ice::optional type, - Ice::optional number, - Ice::optional dialGroup, + optional type, + optional number, + optional dialGroup, const Ice::Current&) { auto p = _contacts.find(name); @@ -74,7 +75,7 @@ ContactDBI::query(string name, const Ice::Current&) return 0; } -Ice::optional +optional ContactDBI::queryNumber(string name, const Ice::Current&) { auto p = _contacts.find(name); @@ -82,11 +83,11 @@ ContactDBI::queryNumber(string name, const Ice::Current&) { return p->second->number; } - return Ice::nullopt; + return nullopt; } void -ContactDBI::queryDialgroup(string name, Ice::optional& dialGroup, const Ice::Current&) +ContactDBI::queryDialgroup(string name, optional& dialGroup, const Ice::Current&) { auto p = _contacts.find(name); if (p != _contacts.end()) diff --git a/cpp/Ice/optional/ContactDBI.h b/cpp/Ice/optional/ContactDBI.h index 1fb0f90d28..9f33759f65 100644 --- a/cpp/Ice/optional/ContactDBI.h +++ b/cpp/Ice/optional/ContactDBI.h @@ -5,32 +5,32 @@ #ifndef CONTACT_I_H #define CONTACT_I_H -#include +#include "Contact.h" -class ContactDBI : public Demo::ContactDB +class ContactDBI final : public Demo::ContactDB { public: - virtual void addContact( + void addContact( std::string, - Ice::optional, - Ice::optional, - Ice::optional, - const Ice::Current&) override; + std::optional, + std::optional, + std::optional, + const Ice::Current&) final; - virtual void updateContact( + void updateContact( std::string, - Ice::optional, - Ice::optional, - Ice::optional, - const Ice::Current&) override; + std::optional, + std::optional, + std::optional, + const Ice::Current&) final; - virtual Demo::ContactPtr query(std::string, const Ice::Current&) override; + Demo::ContactPtr query(std::string name, const Ice::Current& current) final; - virtual Ice::optional queryNumber(std::string, const Ice::Current&) override; + std::optional queryNumber(std::string, const Ice::Current&) final; - virtual void queryDialgroup(std::string, Ice::optional&, const Ice::Current&) override; + void queryDialgroup(std::string, std::optional&, const Ice::Current&) final; - virtual void shutdown(const Ice::Current&) override; + void shutdown(const Ice::Current&) final; private: std::map> _contacts; diff --git a/cpp/Ice/optional/Server.cpp b/cpp/Ice/optional/Server.cpp index 293b6c9b76..27fc45935e 100644 --- a/cpp/Ice/optional/Server.cpp +++ b/cpp/Ice/optional/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "ContactDBI.h" #include +#include using namespace std; diff --git a/cpp/Ice/plugin/Client.cpp b/cpp/Ice/plugin/Client.cpp index eb148aa6c6..4a5aa1b006 100644 --- a/cpp/Ice/plugin/Client.cpp +++ b/cpp/Ice/plugin/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include +#include using namespace std; using namespace Demo; diff --git a/cpp/Ice/plugin/LoggerPluginI.cpp b/cpp/Ice/plugin/LoggerPluginI.cpp index df23b86ad3..6234858cf2 100644 --- a/cpp/Ice/plugin/LoggerPluginI.cpp +++ b/cpp/Ice/plugin/LoggerPluginI.cpp @@ -4,6 +4,8 @@ #include +#include + using namespace std; namespace diff --git a/cpp/Ice/plugin/Server.cpp b/cpp/Ice/plugin/Server.cpp index c2e989ed2d..9f5889643f 100644 --- a/cpp/Ice/plugin/Server.cpp +++ b/cpp/Ice/plugin/Server.cpp @@ -3,6 +3,7 @@ // #include +#include using namespace std; diff --git a/cpp/Ice/properties/Client.cpp b/cpp/Ice/properties/Client.cpp index cc9766254e..9133ea9cef 100644 --- a/cpp/Ice/properties/Client.cpp +++ b/cpp/Ice/properties/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Props.h" #include -#include +#include using namespace std; using namespace Demo; @@ -50,7 +51,7 @@ main(int argc, char* argv[]) } void menu(); -void show(const shared_ptr&); +void show(const optional&); int run(const shared_ptr& communicator) @@ -166,7 +167,7 @@ menu() } void -show(const shared_ptr& admin) +show(const optional& admin) { auto props = admin->getPropertiesForPrefix("Demo"); cout << "Server's current settings:" << endl; diff --git a/cpp/Ice/properties/Props.ice b/cpp/Ice/properties/Props.ice index 76a93c39bd..112c11f288 100644 --- a/cpp/Ice/properties/Props.ice +++ b/cpp/Ice/properties/Props.ice @@ -4,7 +4,7 @@ #pragma once -#include +#include module Demo { diff --git a/cpp/Ice/properties/Server.cpp b/cpp/Ice/properties/Server.cpp index e9de580b15..a191a127d5 100644 --- a/cpp/Ice/properties/Server.cpp +++ b/cpp/Ice/properties/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Props.h" #include -#include +#include using namespace std; diff --git a/cpp/Ice/session/Client.cpp b/cpp/Ice/session/Client.cpp index 18d92191b8..6d25d81474 100644 --- a/cpp/Ice/session/Client.cpp +++ b/cpp/Ice/session/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Session.h" #include -#include +#include using namespace std; using namespace Demo; @@ -72,7 +73,7 @@ run(const shared_ptr& communicator) auto session = factory->create(name); - vector> hellos; + vector> hellos; menu(); diff --git a/cpp/Ice/session/Server.cpp b/cpp/Ice/session/Server.cpp index 4353295ce5..07e759ebdf 100644 --- a/cpp/Ice/session/Server.cpp +++ b/cpp/Ice/session/Server.cpp @@ -2,7 +2,8 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "SessionFactoryI.h" +#include using namespace std; using namespace Demo; diff --git a/cpp/Ice/session/SessionFactoryI.cpp b/cpp/Ice/session/SessionFactoryI.cpp index 7fbba47c69..d1502d936d 100644 --- a/cpp/Ice/session/SessionFactoryI.cpp +++ b/cpp/Ice/session/SessionFactoryI.cpp @@ -2,13 +2,14 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include -#include +#include "SessionFactoryI.h" +#include "SessionI.h" +#include using namespace std; using namespace Demo; -shared_ptr +optional SessionFactoryI::create(string name, const Ice::Current& current) { auto session = make_shared(name); @@ -21,10 +22,6 @@ SessionFactoryI::create(string name, const Ice::Current& current) // auto collocProxy = proxy->ice_endpoints(Ice::EndpointSeq()); - // - // Never close this connection from the client and turn on heartbeats with a timeout of 30s - // - current.con->setACM(30, Ice::ACMClose::CloseOff, Ice::ACMHeartbeat::HeartbeatAlways); current.con->setCloseCallback( [collocProxy](const shared_ptr&) { diff --git a/cpp/Ice/session/SessionFactoryI.h b/cpp/Ice/session/SessionFactoryI.h index 08a46588ec..4079019a60 100644 --- a/cpp/Ice/session/SessionFactoryI.h +++ b/cpp/Ice/session/SessionFactoryI.h @@ -5,14 +5,14 @@ #ifndef SESSION_FACTORY_I_H #define SESSION_FACTORY_I_H +#include "Session.h" #include -#include -class SessionFactoryI : public Demo::SessionFactory +class SessionFactoryI final : public Demo::SessionFactory { public: - virtual std::shared_ptr create(std::string, const Ice::Current&) override; - virtual void shutdown(const Ice::Current&) override; + std::optional create(std::string, const Ice::Current&) final; + void shutdown(const Ice::Current&) final; }; #endif diff --git a/cpp/Ice/session/SessionI.cpp b/cpp/Ice/session/SessionI.cpp index 0ecae68815..da1511f9ff 100644 --- a/cpp/Ice/session/SessionI.cpp +++ b/cpp/Ice/session/SessionI.cpp @@ -2,7 +2,8 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "SessionI.h" +#include using namespace std; using namespace Demo; @@ -30,7 +31,7 @@ SessionI::SessionI(string name) : _name(std::move(name)), _nextId(0), _destroy(f cout << "The session " << _name << " is now created." << endl; } -shared_ptr +optional SessionI::createHello(const Ice::Current& current) { const lock_guard sync(_mutex); diff --git a/cpp/Ice/session/SessionI.h b/cpp/Ice/session/SessionI.h index e845f7805d..8678a2675a 100644 --- a/cpp/Ice/session/SessionI.h +++ b/cpp/Ice/session/SessionI.h @@ -5,25 +5,25 @@ #ifndef SESSION_I_H #define SESSION_I_H +#include "Session.h" #include -#include #include #include -class SessionI : public Demo::Session +class SessionI final : public Demo::Session { public: SessionI(std::string); - virtual std::shared_ptr createHello(const Ice::Current&) override; - virtual std::string getName(const Ice::Current&) override; - virtual void destroy(const Ice::Current&) override; + std::optional createHello(const Ice::Current&) final; + std::string getName(const Ice::Current&) final; + void destroy(const Ice::Current&) final; private: std::mutex _mutex; const std::string _name; int _nextId; // The per-session id of the next hello object. This is used for tracing purposes. - std::list> _objs; // List of per-session allocated hello objects. + std::list> _objs; // List of per-session allocated hello objects. bool _destroy; }; #endif diff --git a/cpp/Ice/throughput/Client.cpp b/cpp/Ice/throughput/Client.cpp index 953ad78028..abb006a8d0 100644 --- a/cpp/Ice/throughput/Client.cpp +++ b/cpp/Ice/throughput/Client.cpp @@ -2,9 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Throughput.h" #include -#include #include +#include using namespace std; using namespace Demo; @@ -69,7 +70,7 @@ run(const shared_ptr& communicator) auto byteArr = make_pair(byteSeq.data(), byteSeq.data() + byteSeq.size()); StringSeq stringSeq(StringSeqSize, "hello"); - const vector stringViewSeq(StringSeqSize, "hello"); + const vector stringViewSeq(StringSeqSize, "hello"); StringDoubleSeq structSeq(StringDoubleSeqSize, {"hello", 3.14}); const FixedSeq fixedSeq(FixedSeqSize, {0, 0, 0.0}); @@ -87,7 +88,7 @@ run(const shared_ptr& communicator) ByteSeq warmupBytesBuf(1); auto warmupBytes = make_pair(warmupBytesBuf.data(), warmupBytesBuf.data() + warmupBytesBuf.size()); - const vector warmupStringViews(1); + const vector warmupStringViews(1); const StringDoubleSeq warmupStructs(1); const FixedSeq warmupFixed(1); diff --git a/cpp/Ice/throughput/Server.cpp b/cpp/Ice/throughput/Server.cpp index 12441b35d9..a35d2e6b90 100644 --- a/cpp/Ice/throughput/Server.cpp +++ b/cpp/Ice/throughput/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "ThroughputI.h" #include -#include +#include using namespace std; diff --git a/cpp/Ice/throughput/Throughput.ice b/cpp/Ice/throughput/Throughput.ice index d038ed592c..431f749f69 100644 --- a/cpp/Ice/throughput/Throughput.ice +++ b/cpp/Ice/throughput/Throughput.ice @@ -41,10 +41,9 @@ module Demo ["marshaled-result", "cpp:array"] ByteSeq recvByteSeq(); ["marshaled-result", "cpp:array"] ByteSeq echoByteSeq(["cpp:array"] ByteSeq seq); - void sendStringSeq(["cpp:view-type:std::vector"] StringSeq seq); - ["marshaled-result", "cpp:view-type:std::vector"] StringSeq recvStringSeq(); - ["marshaled-result", "cpp:view-type:std::vector"] StringSeq echoStringSeq( - ["cpp:view-type:std::vector"] StringSeq seq); + void sendStringSeq(StringSeq seq); + ["marshaled-result"] StringSeq recvStringSeq(); + ["marshaled-result"] StringSeq echoStringSeq(StringSeq seq); void sendStructSeq(StringDoubleSeq seq); StringDoubleSeq recvStructSeq(); diff --git a/cpp/Ice/throughput/ThroughputI.cpp b/cpp/Ice/throughput/ThroughputI.cpp index 583217beb9..efcca90fba 100644 --- a/cpp/Ice/throughput/ThroughputI.cpp +++ b/cpp/Ice/throughput/ThroughputI.cpp @@ -8,7 +8,6 @@ ThroughputI::ThroughputI() : _byteSeq(Demo::ByteSeqSize), _stringSeq(Demo::StringSeqSize, "hello"), - _stringViewSeq(Demo::StringSeqSize, "hello"), _structSeq(Demo::StringDoubleSeqSize, {"hello", 3.14}), _fixedSeq(Demo::FixedSeqSize, {0, 0, 0.0}), _warmup(false) @@ -35,7 +34,7 @@ ThroughputI::endWarmup(const Ice::Current&) } void -ThroughputI::sendByteSeq(std::pair, const Ice::Current&) +ThroughputI::sendByteSeq(std::pair, const Ice::Current&) { } @@ -45,26 +44,26 @@ ThroughputI::recvByteSeq(const Ice::Current& current) if (_warmup) { Demo::ByteSeq warmupBytesBuf(1); - const std::pair ret = + const std::pair ret = std::make_pair(warmupBytesBuf.data(), warmupBytesBuf.data() + warmupBytesBuf.size()); return RecvByteSeqMarshaledResult(ret, current); } else { - const std::pair ret = + const std::pair ret = std::make_pair(_byteSeq.data(), _byteSeq.data() + _byteSeq.size()); return RecvByteSeqMarshaledResult(ret, current); } } Demo::Throughput::EchoByteSeqMarshaledResult -ThroughputI::echoByteSeq(std::pair seq, const Ice::Current& current) +ThroughputI::echoByteSeq(std::pair seq, const Ice::Current& current) { return EchoByteSeqMarshaledResult(seq, current); } void -ThroughputI::sendStringSeq(std::vector, const Ice::Current&) +ThroughputI::sendStringSeq(std::vector, const Ice::Current&) { } @@ -73,16 +72,16 @@ ThroughputI::recvStringSeq(const Ice::Current& current) { if (_warmup) { - return RecvStringSeqMarshaledResult(std::vector(1), current); + return RecvStringSeqMarshaledResult(std::vector(1), current); } else { - return RecvStringSeqMarshaledResult(_stringViewSeq, current); + return RecvStringSeqMarshaledResult(_stringSeq, current); } } Demo::Throughput::EchoStringSeqMarshaledResult -ThroughputI::echoStringSeq(std::vector seq, const Ice::Current& current) +ThroughputI::echoStringSeq(std::vector seq, const Ice::Current& current) { return EchoStringSeqMarshaledResult(seq, current); } diff --git a/cpp/Ice/throughput/ThroughputI.h b/cpp/Ice/throughput/ThroughputI.h index 7220a3f5a8..4cf5b64f39 100644 --- a/cpp/Ice/throughput/ThroughputI.h +++ b/cpp/Ice/throughput/ThroughputI.h @@ -5,40 +5,38 @@ #ifndef THROUGHPUT_I_H #define THROUGHPUT_I_H -#include +#include "Throughput.h" -class ThroughputI : public Demo::Throughput +class ThroughputI final : public Demo::Throughput { public: ThroughputI(); - virtual bool needsWarmup(const Ice::Current&) override; - virtual void startWarmup(const Ice::Current&) override; - virtual void endWarmup(const Ice::Current&) override; + bool needsWarmup(const Ice::Current&) final; + void startWarmup(const Ice::Current&) final; + void endWarmup(const Ice::Current&) final; - virtual void sendByteSeq(std::pair, const Ice::Current&) override; - virtual RecvByteSeqMarshaledResult recvByteSeq(const Ice::Current&) override; - virtual EchoByteSeqMarshaledResult - echoByteSeq(std::pair, const Ice::Current&) override; + void sendByteSeq(std::pair, const Ice::Current&) final; + RecvByteSeqMarshaledResult recvByteSeq(const Ice::Current&) final; + EchoByteSeqMarshaledResult echoByteSeq(std::pair, const Ice::Current&) final; - virtual void sendStringSeq(std::vector, const Ice::Current&) override; - virtual RecvStringSeqMarshaledResult recvStringSeq(const Ice::Current&) override; - virtual EchoStringSeqMarshaledResult echoStringSeq(std::vector, const Ice::Current&) override; + void sendStringSeq(std::vector, const Ice::Current&) final; + RecvStringSeqMarshaledResult recvStringSeq(const Ice::Current&) final; + EchoStringSeqMarshaledResult echoStringSeq(std::vector, const Ice::Current&) final; - virtual void sendStructSeq(Demo::StringDoubleSeq, const Ice::Current&) override; - virtual Demo::StringDoubleSeq recvStructSeq(const Ice::Current&) override; - virtual Demo::StringDoubleSeq echoStructSeq(Demo::StringDoubleSeq, const Ice::Current&) override; + void sendStructSeq(Demo::StringDoubleSeq, const Ice::Current&) final; + Demo::StringDoubleSeq recvStructSeq(const Ice::Current&) final; + Demo::StringDoubleSeq echoStructSeq(Demo::StringDoubleSeq, const Ice::Current&) final; - virtual void sendFixedSeq(Demo::FixedSeq, const Ice::Current&) override; - virtual Demo::FixedSeq recvFixedSeq(const Ice::Current&) override; - virtual Demo::FixedSeq echoFixedSeq(Demo::FixedSeq, const Ice::Current&) override; + void sendFixedSeq(Demo::FixedSeq, const Ice::Current&) final; + Demo::FixedSeq recvFixedSeq(const Ice::Current&) final; + Demo::FixedSeq echoFixedSeq(Demo::FixedSeq, const Ice::Current&) final; - virtual void shutdown(const Ice::Current&) override; + void shutdown(const Ice::Current&) final; private: Demo::ByteSeq _byteSeq; Demo::StringSeq _stringSeq; - std::vector _stringViewSeq; Demo::StringDoubleSeq _structSeq; Demo::FixedSeq _fixedSeq; diff --git a/cpp/IceBox/hello/Client.cpp b/cpp/IceBox/hello/Client.cpp index 63d54057f6..4ca5b629b9 100644 --- a/cpp/IceBox/hello/Client.cpp +++ b/cpp/IceBox/hello/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include +#include using namespace std; using namespace Demo; diff --git a/cpp/IceBox/hello/HelloI.cpp b/cpp/IceBox/hello/HelloI.cpp index 03eec19da2..59710360f1 100644 --- a/cpp/IceBox/hello/HelloI.cpp +++ b/cpp/IceBox/hello/HelloI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceBox/hello/README.md b/cpp/IceBox/hello/README.md index 2721f01d8a..a0a48f5139 100644 --- a/cpp/IceBox/hello/README.md +++ b/cpp/IceBox/hello/README.md @@ -3,7 +3,7 @@ To run this demo, open two terminal windows. In the first window, start the IceBox server: ``` -icebox++11 --Ice.Config=config.icebox +icebox --Ice.Config=config.icebox ``` In the second window, run the client: @@ -20,6 +20,6 @@ Linux 32-bit ------------ If you are using 32-bit binaries on a Linux 64-bit host, use -`icebox32++11` instead of `icebox++11` to start the IceBox server. +`icebox32` instead of `icebox` to start the IceBox server. [1]: https://doc.zeroc.com/ice/3.7/icebox diff --git a/cpp/IceDiscovery/hello/Client.cpp b/cpp/IceDiscovery/hello/Client.cpp index 92a133fdb7..abe5d49585 100644 --- a/cpp/IceDiscovery/hello/Client.cpp +++ b/cpp/IceDiscovery/hello/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include +#include using namespace std; using namespace Demo; diff --git a/cpp/IceDiscovery/hello/HelloI.cpp b/cpp/IceDiscovery/hello/HelloI.cpp index 07ef89de15..77b1464cea 100644 --- a/cpp/IceDiscovery/hello/HelloI.cpp +++ b/cpp/IceDiscovery/hello/HelloI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include #include using namespace std; diff --git a/cpp/IceDiscovery/hello/Server.cpp b/cpp/IceDiscovery/hello/Server.cpp index feaa75bd98..8945f4aa95 100644 --- a/cpp/IceDiscovery/hello/Server.cpp +++ b/cpp/IceDiscovery/hello/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceDiscovery/replication/Client.cpp b/cpp/IceDiscovery/replication/Client.cpp index 6760f167fb..73ce5a3dc2 100644 --- a/cpp/IceDiscovery/replication/Client.cpp +++ b/cpp/IceDiscovery/replication/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include +#include #include using namespace std; diff --git a/cpp/IceDiscovery/replication/HelloI.cpp b/cpp/IceDiscovery/replication/HelloI.cpp index 65285839a4..f25ce4abde 100644 --- a/cpp/IceDiscovery/replication/HelloI.cpp +++ b/cpp/IceDiscovery/replication/HelloI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceDiscovery/replication/Server.cpp b/cpp/IceDiscovery/replication/Server.cpp index 2d4c0a5728..8258a8a368 100644 --- a/cpp/IceDiscovery/replication/Server.cpp +++ b/cpp/IceDiscovery/replication/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceGrid/allocate/Client.cpp b/cpp/IceGrid/allocate/Client.cpp index 5659cb56a5..9fe4348aa1 100644 --- a/cpp/IceGrid/allocate/Client.cpp +++ b/cpp/IceGrid/allocate/Client.cpp @@ -2,9 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include #include +#include using namespace std; using namespace Demo; @@ -65,7 +66,7 @@ run(const shared_ptr& communicator) return 1; } - shared_ptr session; + optional session; while (!session) { cout << "This demo accepts any user-id / password combination.\n"; @@ -91,12 +92,6 @@ run(const shared_ptr& communicator) } } - // - // Enable heartbeats on the session connection to maintain the - // connection alive even if idle. - // - session->ice_getConnection()->setACM(registry->getACMTimeout(), Ice::nullopt, Ice::ACMHeartbeat::HeartbeatAlways); - try { // @@ -105,7 +100,7 @@ run(const shared_ptr& communicator) // we retrieve object by type, which will succeed if the // application-multiple.xml descriptor is used. // - shared_ptr hello; + optional hello; try { hello = Ice::checkedCast(session->allocateObjectById(Ice::stringToIdentity("hello"))); diff --git a/cpp/IceGrid/allocate/HelloI.cpp b/cpp/IceGrid/allocate/HelloI.cpp index 260bb15c54..435451f8d4 100644 --- a/cpp/IceGrid/allocate/HelloI.cpp +++ b/cpp/IceGrid/allocate/HelloI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceGrid/allocate/Server.cpp b/cpp/IceGrid/allocate/Server.cpp index fffacfff25..14dc5741e7 100644 --- a/cpp/IceGrid/allocate/Server.cpp +++ b/cpp/IceGrid/allocate/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceGrid/customLocator/Client.cpp b/cpp/IceGrid/customLocator/Client.cpp index 9a1cbb362f..feaa2db108 100644 --- a/cpp/IceGrid/customLocator/Client.cpp +++ b/cpp/IceGrid/customLocator/Client.cpp @@ -2,9 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include #include +#include using namespace std; using namespace Demo; diff --git a/cpp/IceGrid/customLocator/HelloI.cpp b/cpp/IceGrid/customLocator/HelloI.cpp index 260bb15c54..435451f8d4 100644 --- a/cpp/IceGrid/customLocator/HelloI.cpp +++ b/cpp/IceGrid/customLocator/HelloI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceGrid/customLocator/Locator.cpp b/cpp/IceGrid/customLocator/Locator.cpp index 51cdc420dd..63ce2c7ab9 100644 --- a/cpp/IceGrid/customLocator/Locator.cpp +++ b/cpp/IceGrid/customLocator/Locator.cpp @@ -3,6 +3,7 @@ // #include +#include using namespace std; @@ -16,42 +17,42 @@ namespace class LocatorRegistryI : public Ice::LocatorRegistry { public: - explicit LocatorRegistryI(const shared_ptr& registry) : _registry(registry) {} + explicit LocatorRegistryI(const optional& registry) : _registry(registry) {} - virtual void setAdapterDirectProxyAsync( + void setAdapterDirectProxyAsync( string id, - shared_ptr proxy, + optional proxy, function response, function exception, - const Ice::Current&) override + const Ice::Current&) final { // AMI call using the AMD callbacks _registry->setAdapterDirectProxyAsync(id, proxy, response, exception); } - virtual void setReplicatedAdapterDirectProxyAsync( + void setReplicatedAdapterDirectProxyAsync( string id, string group, - shared_ptr proxy, + optional proxy, function response, function exception, - const Ice::Current&) override + const Ice::Current&) final { _registry->setReplicatedAdapterDirectProxyAsync(id, group, proxy, response, exception); } - virtual void setServerProcessProxyAsync( + void setServerProcessProxyAsync( string id, - shared_ptr proxy, + optional proxy, function response, function exception, - const Ice::Current&) override + const Ice::Current&) final { _registry->setServerProcessProxyAsync(id, proxy, response, exception); } private: - const shared_ptr _registry; + const optional _registry; }; // @@ -61,17 +62,17 @@ namespace class LocatorI : public Ice::Locator { public: - LocatorI(const shared_ptr& locator, const shared_ptr& registry) + LocatorI(const optional& locator, const optional& registry) : _locator(locator), _registry(registry) { } - virtual void findObjectByIdAsync( + void findObjectByIdAsync( Ice::Identity id, - function&)> response, + function&)> response, function exception, - const Ice::Current& current) const override + const Ice::Current& current) const final { auto p = current.ctx.find("SECRET"); if (p != current.ctx.end() && p->second == "LetMeIn") @@ -80,15 +81,15 @@ namespace } else { - response(nullptr); + response(nullopt); } } - virtual void findAdapterByIdAsync( + void findAdapterByIdAsync( string id, - function&)> response, + function&)> response, function exception, - const Ice::Current& current) const override + const Ice::Current& current) const final { auto p = current.ctx.find("SECRET"); if (p != current.ctx.end() && p->second == "LetMeIn") @@ -97,18 +98,15 @@ namespace } else { - response(nullptr); + response(nullopt); } } - virtual shared_ptr getRegistry(const Ice::Current&) const override - { - return _registry; - } + optional getRegistry(const Ice::Current&) const final { return _registry; } private: - const shared_ptr _locator; - const shared_ptr _registry; + const optional _locator; + const optional _registry; }; } diff --git a/cpp/IceGrid/customLocator/Server.cpp b/cpp/IceGrid/customLocator/Server.cpp index 79050b4521..f15d4c08e7 100644 --- a/cpp/IceGrid/customLocator/Server.cpp +++ b/cpp/IceGrid/customLocator/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceGrid/icebox/Client.cpp b/cpp/IceGrid/icebox/Client.cpp index e383e9fceb..f043104563 100644 --- a/cpp/IceGrid/icebox/Client.cpp +++ b/cpp/IceGrid/icebox/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include +#include using namespace std; using namespace Demo; diff --git a/cpp/IceGrid/icebox/HelloI.cpp b/cpp/IceGrid/icebox/HelloI.cpp index 4d497c3477..915bf401b2 100644 --- a/cpp/IceGrid/icebox/HelloI.cpp +++ b/cpp/IceGrid/icebox/HelloI.cpp @@ -2,13 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#ifdef _MSC_VER -// For getenv -# define _CRT_SECURE_NO_WARNINGS -#endif - -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceGrid/icebox/application.xml b/cpp/IceGrid/icebox/application.xml index a44376d6e2..9380d0deef 100644 --- a/cpp/IceGrid/icebox/application.xml +++ b/cpp/IceGrid/icebox/application.xml @@ -4,10 +4,10 @@ - - - - + + + + @@ -18,8 +18,7 @@ - + @@ -34,7 +33,6 @@ - @@ -46,10 +44,7 @@ - + diff --git a/cpp/IceGrid/replication/Client.cpp b/cpp/IceGrid/replication/Client.cpp index afe1429aaa..51acaf271c 100644 --- a/cpp/IceGrid/replication/Client.cpp +++ b/cpp/IceGrid/replication/Client.cpp @@ -2,10 +2,11 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include #include #include +#include #include using namespace std; diff --git a/cpp/IceGrid/replication/HelloI.cpp b/cpp/IceGrid/replication/HelloI.cpp index 9cce263e72..b3e97614f2 100644 --- a/cpp/IceGrid/replication/HelloI.cpp +++ b/cpp/IceGrid/replication/HelloI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceGrid/replication/Server.cpp b/cpp/IceGrid/replication/Server.cpp index a1559c0db9..218bf8df12 100644 --- a/cpp/IceGrid/replication/Server.cpp +++ b/cpp/IceGrid/replication/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceGrid/secure/Client.cpp b/cpp/IceGrid/secure/Client.cpp index c0f86954e7..3370714ad2 100644 --- a/cpp/IceGrid/secure/Client.cpp +++ b/cpp/IceGrid/secure/Client.cpp @@ -2,9 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include #include +#include using namespace std; using namespace Demo; @@ -60,7 +61,7 @@ run(const shared_ptr& communicator) // identity. If it's not registered with the registry, we // search for an object with the ::Demo::Hello type. // - shared_ptr hello; + optional hello; try { hello = Ice::checkedCast(communicator->stringToProxy("hello")); diff --git a/cpp/IceGrid/secure/HelloI.cpp b/cpp/IceGrid/secure/HelloI.cpp index 260bb15c54..435451f8d4 100644 --- a/cpp/IceGrid/secure/HelloI.cpp +++ b/cpp/IceGrid/secure/HelloI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceGrid/secure/Server.cpp b/cpp/IceGrid/secure/Server.cpp index 9a7da54406..2dc0bf03ad 100644 --- a/cpp/IceGrid/secure/Server.cpp +++ b/cpp/IceGrid/secure/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceGrid/secure/config.glacier2 b/cpp/IceGrid/secure/config.glacier2 index a4db8a8372..77e1c92101 100644 --- a/cpp/IceGrid/secure/config.glacier2 +++ b/cpp/IceGrid/secure/config.glacier2 @@ -9,8 +9,6 @@ Glacier2.Server.Endpoints=ssl -h localhost Glacier2.SessionManager=DemoIceGrid/AdminSessionManager Glacier2.PermissionsVerifier=DemoGlacier2/NullPermissionsVerifier -Glacier2.SessionTimeout=30 - Ice.Default.Locator=DemoIceGrid/Locator:ssl -h localhost -p 4062 # diff --git a/cpp/IceGrid/sessionActivation/Client.cpp b/cpp/IceGrid/sessionActivation/Client.cpp index 5ecdb54c0a..6bedd59b47 100644 --- a/cpp/IceGrid/sessionActivation/Client.cpp +++ b/cpp/IceGrid/sessionActivation/Client.cpp @@ -2,9 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include #include +#include using namespace std; using namespace Demo; @@ -65,7 +66,7 @@ run(const shared_ptr& communicator) return 1; } - shared_ptr session; + optional session; while (!session) { cout << "This demo accepts any user-id / password combination.\n"; @@ -91,12 +92,6 @@ run(const shared_ptr& communicator) } } - // - // Enable heartbeats on the session connection to maintain the - // connection alive even if idle. - // - session->ice_getConnection()->setACM(registry->getACMTimeout(), Ice::nullopt, Ice::ACMHeartbeat::HeartbeatOnIdle); - try { auto hello = Ice::checkedCast(session->allocateObjectById(Ice::stringToIdentity("hello"))); diff --git a/cpp/IceGrid/sessionActivation/HelloI.cpp b/cpp/IceGrid/sessionActivation/HelloI.cpp index 7349636828..da44c0265d 100644 --- a/cpp/IceGrid/sessionActivation/HelloI.cpp +++ b/cpp/IceGrid/sessionActivation/HelloI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceGrid/sessionActivation/Server.cpp b/cpp/IceGrid/sessionActivation/Server.cpp index fffacfff25..14dc5741e7 100644 --- a/cpp/IceGrid/sessionActivation/Server.cpp +++ b/cpp/IceGrid/sessionActivation/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceGrid/simple/Client.cpp b/cpp/IceGrid/simple/Client.cpp index c0f86954e7..3370714ad2 100644 --- a/cpp/IceGrid/simple/Client.cpp +++ b/cpp/IceGrid/simple/Client.cpp @@ -2,9 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "Hello.h" #include #include +#include using namespace std; using namespace Demo; @@ -60,7 +61,7 @@ run(const shared_ptr& communicator) // identity. If it's not registered with the registry, we // search for an object with the ::Demo::Hello type. // - shared_ptr hello; + optional hello; try { hello = Ice::checkedCast(communicator->stringToProxy("hello")); diff --git a/cpp/IceGrid/simple/HelloI.cpp b/cpp/IceGrid/simple/HelloI.cpp index f34c6681f7..86349ebcca 100644 --- a/cpp/IceGrid/simple/HelloI.cpp +++ b/cpp/IceGrid/simple/HelloI.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceGrid/simple/Server.cpp b/cpp/IceGrid/simple/Server.cpp index 6f4bcea8f6..7214aa3a4d 100644 --- a/cpp/IceGrid/simple/Server.cpp +++ b/cpp/IceGrid/simple/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "HelloI.h" #include +#include using namespace std; diff --git a/cpp/IceStorm/clock/Publisher.cpp b/cpp/IceStorm/clock/Publisher.cpp index e01b776e80..bde6fa9f58 100644 --- a/cpp/IceStorm/clock/Publisher.cpp +++ b/cpp/IceStorm/clock/Publisher.cpp @@ -2,16 +2,12 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#ifdef _MSC_VER -// For localtime warning -# define _CRT_SECURE_NO_WARNINGS -#endif - -#include +#include "Clock.h" #include #include #include #include +#include #include using namespace std; @@ -125,7 +121,7 @@ run(const shared_ptr& communicator, int argc, char* argv[]) // // Retrieve the topic. // - shared_ptr topic; + optional topic; try { topic = manager->retrieve(topicName); diff --git a/cpp/IceStorm/clock/Subscriber.cpp b/cpp/IceStorm/clock/Subscriber.cpp index acfacefaca..bf2496c051 100644 --- a/cpp/IceStorm/clock/Subscriber.cpp +++ b/cpp/IceStorm/clock/Subscriber.cpp @@ -2,10 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Clock.h" #include #include - -#include +#include using namespace std; using namespace Demo; @@ -164,7 +164,7 @@ run(const shared_ptr& communicator, int argc, char* argv[]) return 1; } - shared_ptr topic; + optional topic; try { topic = manager->retrieve(topicName); diff --git a/cpp/IceStorm/clock/config.icebox b/cpp/IceStorm/clock/config.icebox index 31773667a7..f6ef8b4de1 100644 --- a/cpp/IceStorm/clock/config.icebox +++ b/cpp/IceStorm/clock/config.icebox @@ -10,7 +10,7 @@ Ice.Admin.InstanceName=icebox # The IceStorm service. The service is configured using a separate # configuration file (see config.service). # -IceBox.Service.IceStorm=IceStormService,37:createIceStorm --Ice.Config=config.service +IceBox.Service.IceStorm=IceStormService,38a0:createIceStorm --Ice.Config=config.service # # Warn about connection exceptions diff --git a/cpp/IceStorm/counter/Client.cpp b/cpp/IceStorm/counter/Client.cpp index 8cdf3dd8e3..abaa1eaebd 100644 --- a/cpp/IceStorm/counter/Client.cpp +++ b/cpp/IceStorm/counter/Client.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "CounterObserverI.h" #include +#include using namespace std; using namespace Demo; diff --git a/cpp/IceStorm/counter/CounterI.cpp b/cpp/IceStorm/counter/CounterI.cpp index e1e5a6faf7..a39b676c8b 100644 --- a/cpp/IceStorm/counter/CounterI.cpp +++ b/cpp/IceStorm/counter/CounterI.cpp @@ -2,21 +2,20 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "CounterI.h" #include -#include - using namespace std; using namespace Demo; -CounterI::CounterI(const shared_ptr& topic) +CounterI::CounterI(const optional& topic) : _topic(topic), _publisher(Ice::uncheckedCast(topic->getPublisher())) { } void -CounterI::subscribe(shared_ptr observer, const Ice::Current&) +CounterI::subscribe(optional observer, const Ice::Current&) { const lock_guard sync(_mutex); @@ -30,7 +29,7 @@ CounterI::subscribe(shared_ptr observer, const Ice::Current& } void -CounterI::unsubscribe(shared_ptr observer, const Ice::Current&) +CounterI::unsubscribe(optional observer, const Ice::Current&) { _topic->unsubscribe(observer); } diff --git a/cpp/IceStorm/counter/CounterI.h b/cpp/IceStorm/counter/CounterI.h index 357c8731f5..ef59016aed 100644 --- a/cpp/IceStorm/counter/CounterI.h +++ b/cpp/IceStorm/counter/CounterI.h @@ -5,24 +5,24 @@ #ifndef COUNTER_I_H #define COUNTER_I_H -#include +#include "Counter.h" #include #include -class CounterI : public Demo::Counter +class CounterI final : public Demo::Counter { public: - CounterI(const std::shared_ptr&); + CounterI(const std::optional&); - virtual void subscribe(std::shared_ptr, const Ice::Current&) override; - virtual void unsubscribe(std::shared_ptr, const Ice::Current&) override; - virtual void inc(int value, const Ice::Current&) override; + void subscribe(std::optional, const Ice::Current&) final; + void unsubscribe(std::optional, const Ice::Current&) final; + void inc(int value, const Ice::Current&) final; private: std::mutex _mutex; int _value = 0; - std::shared_ptr _topic; - std::shared_ptr _publisher; + std::optional _topic; + std::optional _publisher; }; #endif diff --git a/cpp/IceStorm/counter/CounterObserverI.cpp b/cpp/IceStorm/counter/CounterObserverI.cpp index e9322757ed..b40079ec1b 100644 --- a/cpp/IceStorm/counter/CounterObserverI.cpp +++ b/cpp/IceStorm/counter/CounterObserverI.cpp @@ -2,9 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "CounterObserverI.h" #include - -#include +#include using namespace std; diff --git a/cpp/IceStorm/counter/Server.cpp b/cpp/IceStorm/counter/Server.cpp index a65709f7fa..40ec8b440c 100644 --- a/cpp/IceStorm/counter/Server.cpp +++ b/cpp/IceStorm/counter/Server.cpp @@ -2,11 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "CounterI.h" #include #include - -#include - +#include #include using namespace std; @@ -53,7 +52,7 @@ main(int argc, char* argv[]) return 1; } - shared_ptr topic; + optional topic; try { topic = manager->retrieve("counter"); diff --git a/cpp/IceStorm/counter/config.icebox b/cpp/IceStorm/counter/config.icebox index 30e943fa14..7b051315ea 100644 --- a/cpp/IceStorm/counter/config.icebox +++ b/cpp/IceStorm/counter/config.icebox @@ -7,7 +7,7 @@ Ice.Admin.InstanceName=icebox # # The IceStorm service # -IceBox.Service.IceStorm=IceStormService,37:createIceStorm --Ice.Config=config.service +IceBox.Service.IceStorm=IceStormService,38a0:createIceStorm --Ice.Config=config.service # # Warn about connection exceptions diff --git a/cpp/IceStorm/replicated/Publisher.cpp b/cpp/IceStorm/replicated/Publisher.cpp index e01b776e80..bc9b051885 100644 --- a/cpp/IceStorm/replicated/Publisher.cpp +++ b/cpp/IceStorm/replicated/Publisher.cpp @@ -7,11 +7,12 @@ # define _CRT_SECURE_NO_WARNINGS #endif -#include +#include "Clock.h" #include #include #include #include +#include #include using namespace std; @@ -125,7 +126,7 @@ run(const shared_ptr& communicator, int argc, char* argv[]) // // Retrieve the topic. // - shared_ptr topic; + optional topic; try { topic = manager->retrieve(topicName); diff --git a/cpp/IceStorm/replicated/Subscriber.cpp b/cpp/IceStorm/replicated/Subscriber.cpp index dc7d217f0c..59abfbe191 100644 --- a/cpp/IceStorm/replicated/Subscriber.cpp +++ b/cpp/IceStorm/replicated/Subscriber.cpp @@ -2,18 +2,18 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Clock.h" #include #include - -#include +#include using namespace std; using namespace Demo; -class ClockI : public Clock +class ClockI final : public Clock { public: - virtual void tick(string time, const Ice::Current&) override { cout << time << endl; } + void tick(string time, const Ice::Current&) final { cout << time << endl; } }; int run(const shared_ptr& communicator, int argc, char* argv[]); @@ -177,7 +177,7 @@ run(const shared_ptr& communicator, int argc, char* argv[]) return 1; } - shared_ptr topic; + optional topic; try { topic = manager->retrieve(topicName); diff --git a/cpp/IceStorm/replicated/application.xml b/cpp/IceStorm/replicated/application.xml index f1dfdd1d43..2b85cdd530 100644 --- a/cpp/IceStorm/replicated/application.xml +++ b/cpp/IceStorm/replicated/application.xml @@ -3,66 +3,61 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cpp/IceStorm/replicated2/Publisher.cpp b/cpp/IceStorm/replicated2/Publisher.cpp index e01b776e80..bc9b051885 100644 --- a/cpp/IceStorm/replicated2/Publisher.cpp +++ b/cpp/IceStorm/replicated2/Publisher.cpp @@ -7,11 +7,12 @@ # define _CRT_SECURE_NO_WARNINGS #endif -#include +#include "Clock.h" #include #include #include #include +#include #include using namespace std; @@ -125,7 +126,7 @@ run(const shared_ptr& communicator, int argc, char* argv[]) // // Retrieve the topic. // - shared_ptr topic; + optional topic; try { topic = manager->retrieve(topicName); diff --git a/cpp/IceStorm/replicated2/Subscriber.cpp b/cpp/IceStorm/replicated2/Subscriber.cpp index f71bad9211..42f2875124 100644 --- a/cpp/IceStorm/replicated2/Subscriber.cpp +++ b/cpp/IceStorm/replicated2/Subscriber.cpp @@ -2,10 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Clock.h" #include #include - -#include +#include using namespace std; using namespace Demo; @@ -177,7 +177,7 @@ run(const shared_ptr& communicator, int argc, char* argv[]) return 1; } - shared_ptr topic; + optional topic; try { topic = manager->retrieve(topicName); diff --git a/cpp/IceStorm/replicated2/config.ib1 b/cpp/IceStorm/replicated2/config.ib1 index 5d1ef91d42..13bb2f86f9 100644 --- a/cpp/IceStorm/replicated2/config.ib1 +++ b/cpp/IceStorm/replicated2/config.ib1 @@ -7,7 +7,7 @@ Ice.Admin.InstanceName=icebox1 # # The IceStorm service # -IceBox.Service.IceStorm=IceStormService,37:createIceStorm --Ice.Config=config.s1 +IceBox.Service.IceStorm=IceStormService,38a0:createIceStorm --Ice.Config=config.s1 # # Warn about connection exceptions diff --git a/cpp/IceStorm/replicated2/config.ib2 b/cpp/IceStorm/replicated2/config.ib2 index f277e91abc..2cae416a89 100644 --- a/cpp/IceStorm/replicated2/config.ib2 +++ b/cpp/IceStorm/replicated2/config.ib2 @@ -7,7 +7,7 @@ Ice.Admin.InstanceName=icebox2 # # The IceStorm service # -IceBox.Service.IceStorm=IceStormService,37:createIceStorm --Ice.Config=config.s2 +IceBox.Service.IceStorm=IceStormService,38a0:createIceStorm --Ice.Config=config.s2 # # Warn about connection exceptions diff --git a/cpp/IceStorm/replicated2/config.ib3 b/cpp/IceStorm/replicated2/config.ib3 index bc1668d998..c92f18caef 100644 --- a/cpp/IceStorm/replicated2/config.ib3 +++ b/cpp/IceStorm/replicated2/config.ib3 @@ -7,7 +7,7 @@ Ice.Admin.InstanceName=icebox3 # # The IceStorm service # -IceBox.Service.IceStorm=IceStormService,37:createIceStorm --Ice.Config=config.s3 +IceBox.Service.IceStorm=IceStormService,38a0:createIceStorm --Ice.Config=config.s3 # # Warn about connection exceptions diff --git a/cpp/Makefile b/cpp/Makefile index a73af538b3..f3512358e9 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -3,7 +3,7 @@ # top_srcdir := .. -lang_srcdir := $(top_srcdir)/cpp11 +lang_srcdir := $(top_srcdir)/cpp include $(top_srcdir)/make/Make.rules include $(lang_srcdir)/make/Make.rules diff --git a/cpp/Manual/evictor/EvictorBase.cpp b/cpp/Manual/evictor/EvictorBase.cpp deleted file mode 100644 index b112287261..0000000000 --- a/cpp/Manual/evictor/EvictorBase.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include - -using namespace std; - -EvictorBase::EvictorBase(int size) : _size(size) -{ - if (_size < 0) - { - _size = 1000; - } -} - -shared_ptr -EvictorBase::locate(const Ice::Current& c, shared_ptr& cookie) -{ - lock_guard lk(_mutex); - - // - // Check if we have a servant in the map already. - // - shared_ptr entry; - auto i = _map.find(c.id); - if (i != _map.end()) - { - // - // Got an entry already, dequeue the entry from its current position. - // - entry = i->second; - _queue.erase(entry->queuePos); - } - else - { - // - // We do not have an entry. Ask the derived class to - // instantiate a servant and add a new entry to the map. - // - entry = make_shared(); - entry->servant = add(c, entry->userCookie); // Down-call - if (!entry->servant) - { - return 0; - } - entry->useCount = 0; - i = _map.insert(make_pair(c.id, entry)).first; - } - - // - // Increment the use count of the servant and enqueue - // the entry at the front, so we get LRU order. - // - ++(entry->useCount); - entry->queuePos = _queue.insert(_queue.begin(), i); - - cookie = entry; - - return entry->servant; -} - -void -EvictorBase::finished(const Ice::Current&, const shared_ptr&, const shared_ptr& cookie) -{ - lock_guard lk(_mutex); - - auto entry = static_pointer_cast(cookie); - - // - // Decrement use count and check if there is something to evict. - // - --(entry->useCount); - evictServants(); -} - -void -EvictorBase::deactivate(const string&) -{ - lock_guard lk(_mutex); - - _size = 0; - evictServants(); -} - -void -EvictorBase::evictServants() -{ - // - // If the evictor queue has grown larger than the limit, - // look at the excess elements to see whether any of them - // can be evicted. - // - auto p = _queue.rbegin(); - auto excessEntries = static_cast(_map.size() - _size); - - for (int i = 0; i < excessEntries; ++i) - { - auto mapPos = *p; - if (mapPos->second->useCount == 0) - { - evict(mapPos->second->servant, mapPos->second->userCookie); // Down-call - p = EvictorQueue::reverse_iterator(_queue.erase(mapPos->second->queuePos)); - _map.erase(mapPos); - } - else - { - ++p; - } - } -} diff --git a/cpp/Manual/evictor/EvictorBase.h b/cpp/Manual/evictor/EvictorBase.h deleted file mode 100644 index 9e945883a9..0000000000 --- a/cpp/Manual/evictor/EvictorBase.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef EVICTORBASE_H -#define EVICTORBASE_H - -#include -#include -#include -#include - -class EvictorBase : public Ice::ServantLocator -{ -public: - EvictorBase(int size = 1000); - - virtual std::shared_ptr locate(const Ice::Current&, std::shared_ptr&) override; - virtual void - finished(const Ice::Current&, const std::shared_ptr&, const std::shared_ptr&) override; - virtual void deactivate(const std::string&) override; - -protected: - virtual std::shared_ptr add(const Ice::Current&, std::shared_ptr&) = 0; - virtual void evict(const std::shared_ptr&, const std::shared_ptr&) = 0; - -private: - struct EvictorEntry; - - using EvictorMap = std::map>; - using EvictorQueue = std::list; - - struct EvictorEntry - { - std::shared_ptr servant; - std::shared_ptr userCookie; - EvictorQueue::iterator queuePos; - int useCount; - }; - - EvictorMap _map; - EvictorQueue _queue; - int _size; - - std::mutex _mutex; - - void evictServants(); -}; -#endif diff --git a/cpp/Manual/evictor/README.md b/cpp/Manual/evictor/README.md deleted file mode 100644 index ae31e3d62e..0000000000 --- a/cpp/Manual/evictor/README.md +++ /dev/null @@ -1,12 +0,0 @@ -The source code provided here implements a C++ evictor base class. To -use it, you must derive a class from `EvictorBase` and implement the -pure virtual functions `add` and `evict`. - -`add` is called when the evictor needs to instantiate a servant, and -`evict` is called when the evictor has decided to evict a servant. -Note that you can pass information from `add` to the corresponding -call to `evict` via the cookie argument. - -For more details on this evictor, see [Servant Evictors][1]. - -[1]: https://doc.zeroc.com/ice/3.7/best-practices/servant-evictors diff --git a/cpp/Manual/lifecycle/Client.cpp b/cpp/Manual/lifecycle/Client.cpp deleted file mode 100644 index 22db632986..0000000000 --- a/cpp/Manual/lifecycle/Client.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#include -#include -#include - -using namespace std; -using namespace Filesystem; - -int -main(int argc, char* argv[]) -{ - int status = 0; - - try - { - // - // CommunicatorHolder's ctor initializes an Ice communicator, - // and its dtor destroys this communicator. - // - const Ice::CommunicatorHolder ich(argc, argv); - - // - // Create a proxy for the root directory - // - auto base = ich->stringToProxy("RootDir:default -p 10000"); - - // - // Down-cast the proxy to a Directory proxy. - // - auto rootDir = Ice::checkedCast(base); - if (!rootDir) - { - cerr << "Invalid proxy" << endl; - status = 1; - } - else - { - unique_ptr p(new Parser(rootDir)); - status = p->parse(); - } - } - catch (const std::exception& ex) - { - cerr << argv[0] << ": " << ex.what() << endl; - status = 1; - } - - return status; -} diff --git a/cpp/Manual/lifecycle/Filesystem.ice b/cpp/Manual/lifecycle/Filesystem.ice deleted file mode 100644 index 11b2a46a40..0000000000 --- a/cpp/Manual/lifecycle/Filesystem.ice +++ /dev/null @@ -1,46 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -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 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 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/Manual/lifecycle/FilesystemI.cpp b/cpp/Manual/lifecycle/FilesystemI.cpp deleted file mode 100644 index 0b1ee68ada..0000000000 --- a/cpp/Manual/lifecycle/FilesystemI.cpp +++ /dev/null @@ -1,249 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#include - -using namespace std; -using namespace Filesystem; -using namespace FilesystemI; - -// Slice Node::name() operation. - -std::string -FilesystemI::NodeI::name(const Ice::Current& c) -{ - const lock_guard lock(_mutex); - - if (_destroyed) - { - throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); - } - - return _name; -} - -// Return the object identity for this node. - -Ice::Identity -FilesystemI::NodeI::id() const -{ - return _id; -} - -// NodeI constructor. - -FilesystemI::NodeI::NodeI(const string& nm, const shared_ptr& parent) - : _name(nm), - _parent(parent), - _destroyed(false) -{ - // - // Create an identity. The root directory has the fixed identity "RootDir". - // - if (parent != nullptr) - { - _id.name = Ice::generateUUID(); - } - else - { - _id.name = "RootDir"; - } -} - -// Slice File::read() operation. - -Lines -FilesystemI::FileI::read(const Ice::Current& c) -{ - const lock_guard lock(_mutex); - - if (_destroyed) - { - throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); - } - - return _lines; -} - -// Slice File::write() operation. - -void -FilesystemI::FileI::write(Lines text, const Ice::Current& c) -{ - const lock_guard lock(_mutex); - - if (_destroyed) - { - throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); - } - - _lines = std::move(text); -} - -// Slice File::destroy() operation. - -void -FilesystemI::FileI::destroy(const Ice::Current& c) -{ - { - const lock_guard lock(_mutex); - - if (_destroyed) - { - throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); - } - - c.adapter->remove(id()); - _destroyed = true; - } - - _parent->removeEntry(_name); -} - -// FileI constructor. - -FilesystemI::FileI::FileI(const string& nm, const shared_ptr& parent) : NodeI(nm, parent) {} - -// Slice Directory::list() operation. - -NodeDescSeq -FilesystemI::DirectoryI::list(const Ice::Current& c) -{ - const lock_guard lock(_mutex); - - if (_destroyed) - { - throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); - } - - NodeDescSeq ret; - for (const auto& i : _contents) - { - NodeDesc d; - d.name = i.first; - d.type = dynamic_pointer_cast(i.second) ? NodeType::FileType : NodeType::DirType; - d.proxy = Ice::uncheckedCast(c.adapter->createProxy(i.second->id())); - ret.push_back(d); - } - return ret; -} - -// Slice Directory::find() operation. - -NodeDesc -FilesystemI::DirectoryI::find(string nm, const Ice::Current& c) -{ - const lock_guard lock(_mutex); - - if (_destroyed) - { - throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); - } - - auto pos = _contents.find(nm); - if (pos == _contents.end()) - { - throw NoSuchName(nm); - } - - auto p = pos->second; - NodeDesc d; - d.name = nm; - d.type = dynamic_pointer_cast(p) ? NodeType::FileType : NodeType::DirType; - d.proxy = Ice::uncheckedCast(c.adapter->createProxy(p->id())); - return d; -} - -// Slice Directory::createFile() operation. - -shared_ptr -FilesystemI::DirectoryI::createFile(string nm, const Ice::Current& c) -{ - const lock_guard lock(_mutex); - - if (_destroyed) - { - throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); - } - - if (nm.empty() || _contents.find(nm) != _contents.end()) - { - throw NameInUse(nm); - } - - auto f = make_shared(nm, shared_from_this()); - auto node = c.adapter->add(f, f->id()); - _contents[nm] = f; - return Ice::uncheckedCast(node); -} - -// Slice Directory::createDirectory() operation. - -shared_ptr -FilesystemI::DirectoryI::createDirectory(string nm, const Ice::Current& c) -{ - const lock_guard lock(_mutex); - - if (_destroyed) - { - throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); - } - - if (nm.empty() || _contents.find(nm) != _contents.end()) - { - throw NameInUse(nm); - } - - auto d = make_shared(nm, shared_from_this()); - auto node = c.adapter->add(d, d->id()); - _contents[nm] = d; - return Ice::uncheckedCast(node); -} - -// Slice Directory::destroy() operation. - -void -FilesystemI::DirectoryI::destroy(const Ice::Current& c) -{ - if (!_parent) - { - throw PermissionDenied("Cannot destroy root directory"); - } - - { - const lock_guard lock(_mutex); - - if (_destroyed) - { - throw Ice::ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); - } - - if (!_contents.empty()) - { - throw PermissionDenied("Cannot destroy non-empty directory"); - } - - c.adapter->remove(id()); - _destroyed = true; - } - - _parent->removeEntry(_name); -} - -// DirectoryI constructor. - -FilesystemI::DirectoryI::DirectoryI(const string& nm, const shared_ptr& parent) : NodeI(nm, parent) {} - -// Remove the entry from the _contents map. - -void -FilesystemI::DirectoryI::removeEntry(const string& nm) -{ - const lock_guard lock(_mutex); - auto i = _contents.find(nm); - if (i != _contents.end()) - { - _contents.erase(i); - } -} diff --git a/cpp/Manual/lifecycle/FilesystemI.h b/cpp/Manual/lifecycle/FilesystemI.h deleted file mode 100644 index ba9d18a3f6..0000000000 --- a/cpp/Manual/lifecycle/FilesystemI.h +++ /dev/null @@ -1,75 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#ifndef __FilesystemI_h__ -#define __FilesystemI_h__ - -#include -#include -#include -#include - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable : 4250) // ... : inherits ... via dominance -#endif - -namespace FilesystemI -{ - - class DirectoryI; - - class NodeI : public virtual Filesystem::Node - { - public: - virtual std::string name(const Ice::Current&) override; - Ice::Identity id() const; - - protected: - NodeI(const std::string&, const std::shared_ptr&); - - const std::string _name; - const std::shared_ptr _parent; - bool _destroyed; - Ice::Identity _id; - std::mutex _mutex; - }; - - class FileI : public Filesystem::File, public NodeI - { - public: - virtual Filesystem::Lines read(const Ice::Current&) override; - virtual void write(Filesystem::Lines, const Ice::Current&) override; - virtual void destroy(const Ice::Current&) override; - - FileI(const std::string&, const std::shared_ptr&); - - private: - Filesystem::Lines _lines; - }; - - class DirectoryI : public NodeI, public Filesystem::Directory, public std::enable_shared_from_this - { - public: - virtual Filesystem::NodeDescSeq list(const Ice::Current&) override; - virtual Filesystem::NodeDesc find(std::string, const Ice::Current&) override; - std::shared_ptr createFile(std::string, const Ice::Current&) override; - std::shared_ptr createDirectory(std::string, const Ice::Current&) override; - virtual void destroy(const Ice::Current&) override; - - DirectoryI(const std::string& = "/", const std::shared_ptr& = nullptr); - - void removeEntry(const std::string&); - - private: - using Contents = std::map>; - Contents _contents; - }; -} - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#endif diff --git a/cpp/Manual/lifecycle/Grammar.cpp b/cpp/Manual/lifecycle/Grammar.cpp deleted file mode 100644 index bf22b310bd..0000000000 --- a/cpp/Manual/lifecycle/Grammar.cpp +++ /dev/null @@ -1,1661 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.7. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.7" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 1 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - -/* Copy the first part of user declarations. */ -/* Line 371 of yacc.c */ -#line 1 "Manual/lifecycle/Grammar.y" - -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#include -#include - -#ifdef _MSC_VER -// I get these warnings from some bison versions: -// warning C4102: 'yyoverflowlab' : unreferenced label -# pragma warning(disable : 4102) -// warning C4065: switch statement contains 'default' but no 'case' labels -# pragma warning(disable : 4065) -// warning C4127: conditional expression is constant -# pragma warning(disable : 4127) -// warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data -# pragma warning(disable : 4244) -// warning C4702: unreachable code -# pragma warning(disable : 4702) -#endif - -#if defined(__clang__) -# pragma clang diagnostic ignored "-Wunused-but-set-variable" -#endif - -using namespace std; - -void -yyerror(const char* s) -{ - parser->error(s); -} - -/* Line 371 of yacc.c */ -#line 103 "Manual/lifecycle/Grammar.cpp" - -#ifndef YY_NULL -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr -# else -# define YY_NULL 0 -# endif -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "Grammar.hpp". */ -#ifndef YY_YY_MANUAL_LIFECYCLE_GRAMMAR_HPP_INCLUDED -# define YY_YY_MANUAL_LIFECYCLE_GRAMMAR_HPP_INCLUDED -/* Enabling traces. */ -# ifndef YYDEBUG -# define YYDEBUG 1 -# endif -# if YYDEBUG -extern int yydebug; -# endif - -/* Tokens. */ -# ifndef YYTOKENTYPE -# define YYTOKENTYPE -/* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ -enum yytokentype -{ - TOK_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 - -# if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED -typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# endif - -# 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 */ - -#endif /* !YY_YY_MANUAL_LIFECYCLE_GRAMMAR_HPP_INCLUDED */ - -/* Copy the second part of user declarations. */ - -/* Line 390 of yacc.c */ -#line 182 "Manual/lifecycle/Grammar.cpp" - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif !defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) - 1) - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext("bison-runtime", Msgid) -# endif -# endif -# ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if !defined lint || defined __GNUC__ -# define YYUSE(E) ((void)(E)) -#else -# define YYUSE(E) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(N) (N) -#else -# if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static int -YYID(int yyi) -# else -static int -YYID(yyi) -int yyi; -# endif -{ - return yyi; -} -#endif - -#if !defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if !defined _ALLOCA_H && !defined EXIT_SUCCESS && \ - (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -/* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# 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 EXIT_SUCCESS && \ - !((defined YYMALLOC || defined malloc) && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if !defined malloc && !defined EXIT_SUCCESS && \ - (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 EXIT_SUCCESS && \ - (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -void free(void*); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - -#if (!defined yyoverflow && (!defined __cplusplus || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof(union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) ((N) * (sizeof(yytype_int16) + sizeof(YYSTYPE)) + YYSTACK_GAP_MAXIMUM) - -# define YYCOPY_NEEDED 1 - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY(&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof(*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof(*yyptr); \ - } while (YYID(0)) - -#endif - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) __builtin_memcpy(Dst, Src, (Count) * sizeof(*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } while (YYID(0)) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - -/* 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, 56, 56, 60, 67, 70, 78, 82, 86, 90, 94, - 98, 102, 106, 110, 114, 118, 122, 126, 131, 139, 144}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || 0 -/* 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", - YY_NULL}; -#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 reduction number in state STATE-NUM. - Performed 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 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}; - -#define yypact_value_is_default(Yystate) (!!((Yystate) == (-14))) - -#define yytable_value_is_error(Yytable_value) YYID(0) - -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. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL -/* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ - do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK(yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror(YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ - while (YYID(0)) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void)0) -#endif - -/* YYLEX -- calling `yylex' with the right arguments. */ -#ifdef YYLEX_PARAM -# define YYLEX yylex(&yylval, YYLEX_PARAM) -#else -# define YYLEX yylex(&yylval) -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ - do \ - { \ - if (yydebug) \ - YYFPRINTF Args; \ - } while (YYID(0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ - do \ - { \ - if (yydebug) \ - { \ - YYFPRINTF(stderr, "%s ", Title); \ - yy_symbol_print(stderr, Type, Value); \ - YYFPRINTF(stderr, "\n"); \ - } \ - } while (YYID(0)) - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -# if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print(FILE* yyoutput, int yytype, YYSTYPE const* const yyvaluep) -# else -static void yy_symbol_value_print(yyoutput, yytype, yyvaluep) FILE* yyoutput; -int yytype; -YYSTYPE const* const yyvaluep; -# endif -{ - FILE* yyo = yyoutput; - YYUSE(yyo); - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT(yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE(yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -# if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print(FILE* yyoutput, int yytype, YYSTYPE const* const yyvaluep) -# else -static void yy_symbol_print(yyoutput, yytype, yyvaluep) FILE* yyoutput; -int yytype; -YYSTYPE const* const yyvaluep; -# endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF(yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF(yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print(yyoutput, yytype, yyvaluep); - YYFPRINTF(yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -# if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print(yytype_int16* yybottom, yytype_int16* yytop) -# else -static void yy_stack_print(yybottom, yytop) yytype_int16* yybottom; -yytype_int16* yytop; -# endif -{ - YYFPRINTF(stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF(stderr, " %d", yybot); - } - YYFPRINTF(stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ - do \ - { \ - if (yydebug) \ - yy_stack_print((Bottom), (Top)); \ - } while (YYID(0)) - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -# if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print(YYSTYPE* yyvsp, int yyrule) -# else -static void yy_reduce_print(yyvsp, yyrule) YYSTYPE* yyvsp; -int yyrule; -# endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF(stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF(stderr, " $%d = ", yyi + 1); - yy_symbol_print(stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)])); - YYFPRINTF(stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ - do \ - { \ - if (yydebug) \ - yy_reduce_print(yyvsp, Rule); \ - } while (YYID(0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -# if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen(const char* yystr) -# else -static YYSIZE_T yystrlen(yystr) const char* yystr; -# endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -# if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static char* -yystpcpy(char* yydest, const char* yysrc) -# else -static char* -yystpcpy(yydest, yysrc) -char* yydest; -const char* yysrc; -# endif -{ - char* yyd = yydest; - const char* yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr(char* yyres, const char* yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const* yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes:; - } - - if (!yyres) - return yystrlen(yystr); - - return yystpcpy(yyres, yystr) - yyres; -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error(YYSIZE_T* yymsg_alloc, char** yymsg, yytype_int16* yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr(YY_NULL, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum - { - YYERROR_VERBOSE_ARGS_MAXIMUM = 5 - }; - /* Internationalized format string. */ - const char* yyformat = YY_NULL; - /* Arguments of yyformat. */ - char const* yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - - for details. YYERROR is fine as it does not invoke this - function. - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default(yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - 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 yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error(yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr(YY_NULL, yytname[yyx]); - if (!(yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - YYSIZE_T yysize1 = yysize + yystrlen(yyformat); - if (!(yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (!(yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* 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 = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr(yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#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; - } -} - -/*----------. -| 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 lookahead symbol. */ - int yychar; - -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \ - _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END _Pragma("GCC diagnostic pop") -#else - /* Default value used for initialization, for pacifying older GCCs - or non-GCC compilers. */ - static YYSTYPE yyval_default; -# define YY_INITIAL_VALUE(Value) = Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - - /* The semantic value of the lookahead symbol. */ - YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); - - /* Number of syntax errors so far. */ - int yynerrs; - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16* yyss; - yytype_int16* yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE* yyvs; - YYSTYPE* yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char* yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - goto yysetstate; - - /*------------------------------------------------------------. - | yynewstate -- Push a new state, which is found in yystate. | - `------------------------------------------------------------*/ -yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - -yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE* yyvs1 = yyvs; - yytype_int16* yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow( - YY_("memory exhausted"), - &yyss1, - yysize * sizeof(*yyssp), - &yyvs1, - yysize * sizeof(*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16* yyss1 = yyss; - union yyalloc* yyptr = (union yyalloc*)YYSTACK_ALLOC(YYSTACK_BYTES(yystacksize)); - if (!yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE(yyss_alloc, yyss); - YYSTACK_RELOCATE(yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE(yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF((stderr, "Stack size increased to %lu\n", (unsigned long int)yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yypact_value_is_default(yyn)) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE(yychar); - YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yytable_value_is_error(yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - 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 1792 of yacc.c */ -#line 57 "Manual/lifecycle/Grammar.y" - { - } - break; - - case 3: -/* Line 1792 of yacc.c */ -#line 60 "Manual/lifecycle/Grammar.y" - { - } - break; - - case 4: -/* Line 1792 of yacc.c */ -#line 68 "Manual/lifecycle/Grammar.y" - { - } - break; - - case 5: -/* Line 1792 of yacc.c */ -#line 71 "Manual/lifecycle/Grammar.y" - { - } - break; - - case 6: -/* Line 1792 of yacc.c */ -#line 79 "Manual/lifecycle/Grammar.y" - { - parser->usage(); - } - break; - - case 7: -/* Line 1792 of yacc.c */ -#line 83 "Manual/lifecycle/Grammar.y" - { - return 0; - } - break; - - case 8: -/* Line 1792 of yacc.c */ -#line 87 "Manual/lifecycle/Grammar.y" - { - parser->list(false); - } - break; - - case 9: -/* Line 1792 of yacc.c */ -#line 91 "Manual/lifecycle/Grammar.y" - { - parser->list(true); - } - break; - - case 10: -/* Line 1792 of yacc.c */ -#line 95 "Manual/lifecycle/Grammar.y" - { - parser->createFile((yyvsp[(2) - (2)])); - } - break; - - case 11: -/* Line 1792 of yacc.c */ -#line 99 "Manual/lifecycle/Grammar.y" - { - parser->createDir((yyvsp[(2) - (2)])); - } - break; - - case 12: -/* Line 1792 of yacc.c */ -#line 103 "Manual/lifecycle/Grammar.y" - { - parser->pwd(); - } - break; - - case 13: -/* Line 1792 of yacc.c */ -#line 107 "Manual/lifecycle/Grammar.y" - { - parser->cd("/"); - } - break; - - case 14: -/* Line 1792 of yacc.c */ -#line 111 "Manual/lifecycle/Grammar.y" - { - parser->cd((yyvsp[(2) - (2)]).front()); - } - break; - - case 15: -/* Line 1792 of yacc.c */ -#line 115 "Manual/lifecycle/Grammar.y" - { - parser->cat((yyvsp[(2) - (2)]).front()); - } - break; - - case 16: -/* Line 1792 of yacc.c */ -#line 119 "Manual/lifecycle/Grammar.y" - { - parser->write((yyvsp[(2) - (2)])); - } - break; - - case 17: -/* Line 1792 of yacc.c */ -#line 123 "Manual/lifecycle/Grammar.y" - { - parser->destroy((yyvsp[(2) - (2)])); - } - break; - - case 18: -/* Line 1792 of yacc.c */ -#line 127 "Manual/lifecycle/Grammar.y" - { - parser->usage(); - yyerrok; - } - break; - - case 19: -/* Line 1792 of yacc.c */ -#line 132 "Manual/lifecycle/Grammar.y" - { - } - break; - - case 20: -/* Line 1792 of yacc.c */ -#line 140 "Manual/lifecycle/Grammar.y" - { - (yyval) = (yyvsp[(2) - (2)]); - (yyval).push_front((yyvsp[(1) - (2)]).front()); - } - break; - - case 21: -/* Line 1792 of yacc.c */ -#line 145 "Manual/lifecycle/Grammar.y" - { - (yyval) = (yyvsp[(1) - (1)]); - } - break; - -/* Line 1792 of yacc.c */ -#line 1558 "Manual/lifecycle/Grammar.cpp" - default: - break; - } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - 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: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE(yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if !YYERROR_VERBOSE - yyerror(YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error(&yymsg_alloc, &yymsg, yyssp, yytoken) - { - char const* yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE(yymsg); - yymsg = (char*)YYSTACK_ALLOC(yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror(yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif - } - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct("Error: discarding", yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK(yylen); - yylen = 0; - YY_STACK_PRINT(yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default(yyn)) - { - 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); - } - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - /* Shift the error token. */ - YY_SYMBOL_PRINT("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror(YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE(yychar); - 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 2055 of yacc.c */ -#line 150 "Manual/lifecycle/Grammar.y" - -#include diff --git a/cpp/Manual/lifecycle/Grammar.h b/cpp/Manual/lifecycle/Grammar.h deleted file mode 100644 index 3741593217..0000000000 --- a/cpp/Manual/lifecycle/Grammar.h +++ /dev/null @@ -1,86 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.7. */ - -/* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -#ifndef YY_YY_MANUAL_LIFECYCLE_GRAMMAR_HPP_INCLUDED -#define YY_YY_MANUAL_LIFECYCLE_GRAMMAR_HPP_INCLUDED -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -#if YYDEBUG -extern int yydebug; -#endif - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE -/* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ -enum yytokentype -{ - TOK_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 - -#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED -typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - -#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 */ - -#endif /* !YY_YY_MANUAL_LIFECYCLE_GRAMMAR_HPP_INCLUDED */ diff --git a/cpp/Manual/lifecycle/Grammar.y b/cpp/Manual/lifecycle/Grammar.y deleted file mode 100644 index 949039c6c3..0000000000 --- a/cpp/Manual/lifecycle/Grammar.y +++ /dev/null @@ -1,154 +0,0 @@ -%{ - -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#include -#include - -#ifdef _MSC_VER -// I get these warnings from some bison versions: -// warning C4102: 'yyoverflowlab' : unreferenced label -# pragma warning( disable : 4102 ) -// warning C4065: switch statement contains 'default' but no 'case' labels -# pragma warning( disable : 4065 ) -// warning C4127: conditional expression is constant -# pragma warning( disable : 4127 ) -// warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data -# pragma warning( disable : 4244 ) -// warning C4702: unreachable code -# pragma warning( disable : 4702 ) -#endif - -#if defined(__clang__) -# pragma clang diagnostic ignored "-Wunused-but-set-variable" -#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; -} -; - -%% - -#include diff --git a/cpp/Manual/lifecycle/Makefile.mk b/cpp/Manual/lifecycle/Makefile.mk deleted file mode 100644 index 611a7f0435..0000000000 --- a/cpp/Manual/lifecycle/Makefile.mk +++ /dev/null @@ -1,7 +0,0 @@ -# -# Copyright (c) ZeroC, Inc. All rights reserved. -# - -$(demo)_client_sources = Filesystem.ice Client.cpp Grammar.cpp Parser.cpp Scanner.cpp - -demos += $(demo) diff --git a/cpp/Manual/lifecycle/Parser.cpp b/cpp/Manual/lifecycle/Parser.cpp deleted file mode 100644 index 5b9c682725..0000000000 --- a/cpp/Manual/lifecycle/Parser.cpp +++ /dev/null @@ -1,445 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#include - -#ifdef HAVE_READLINE -# include -# include -#endif - -using namespace std; -using namespace Filesystem; - -extern FILE* yyin; - -Parser* parser; - -Parser::Parser(const shared_ptr& 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 shared_ptr& dir, bool recursive, size_t depth) -{ - const string indent(depth++, '\t'); - - auto contents = dir->list(); - - for (const auto& i : contents) - { - shared_ptr d; - if (i.type == NodeType::DirType) - { - d = Ice::uncheckedCast(i.proxy); - } - 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& names) -{ - auto dir = _dirs.front(); - - for (const auto& i : names) - { - 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& names) -{ - auto dir = _dirs.front(); - - for (const auto& i : names) - { - 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 - { - auto 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; - } - - auto dir = _dirs.front(); - NodeDesc d; - try - { - d = dir->find(name); - } - catch (const NoSuchName&) - { - cout << "`" << name << "': no such directory" << endl; - return; - } - if (d.type == NodeType::FileType) - { - cout << "`" << name << "': not a directory" << endl; - return; - } - _dirs.push_front(Ice::uncheckedCast(d.proxy)); -} - -void -Parser::cat(const string& name) -{ - auto dir = _dirs.front(); - NodeDesc d; - try - { - d = dir->find(name); - } - catch (const NoSuchName&) - { - cout << "`" << name << "': no such file" << endl; - return; - } - if (d.type == NodeType::DirType) - { - cout << "`" << name << "': not a file" << endl; - return; - } - auto f = Ice::uncheckedCast(d.proxy); - auto lines = f->read(); - for (const auto& i : lines) - { - cout << i << endl; - } -} - -void -Parser::write(std::list& args) -{ - auto dir = _dirs.front(); - auto 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 == NodeType::DirType) - { - cout << "`" << name << "': not a file" << endl; - return; - } - auto f = Ice::uncheckedCast(d.proxy); - - Lines l; - for (const auto& i : args) - { - l.push_back(i); - } - f->write(l); -} - -void -Parser::destroy(const std::list& names) -{ - auto dir = _dirs.front(); - - for (const auto& i : names) - { - if (i == "*") - { - auto nodes = dir->list(); - for (auto& j : nodes) - { - 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; - } - } - } -} - -// -// With older flex version <= 2.5.35 YY_INPUT second -// paramenter is of type int&, in newer versions it -// changes to size_t& -// -void -Parser::getInput(char* buf, int& result, size_t maxSize) -{ - auto r = static_cast(result); - getInput(buf, r, maxSize); - result = static_cast(r); -} - -void -Parser::getInput(char* buf, size_t& result, size_t maxSize) -{ -#ifdef HAVE_READLINE - - auto prompt = parser->getPrompt(); - auto line = readline(const_cast(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; - int c; - do - { - c = getc(yyin); - if (c == EOF) - { - if (line.size()) - { - line += '\n'; - } - } - else - { - line += static_cast(c); - } - } while (c != EOF && c != '\n'); - - result = line.length(); - if (result > maxSize) - { - error("input line too long"); - buf[0] = EOF; - result = 1; - } - else - { -# ifdef _WIN32 - strcpy_s(buf, result + 1, line.c_str()); -# else - strcpy(buf, line.c_str()); -# endif - } - -#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; - - usage(); - - int status = yyparse(); - if (_errors) - { - status = 1; - } - - parser = 0; - return status; -} diff --git a/cpp/Manual/lifecycle/Parser.h b/cpp/Manual/lifecycle/Parser.h deleted file mode 100644 index 2cc2e93209..0000000000 --- a/cpp/Manual/lifecycle/Parser.h +++ /dev/null @@ -1,85 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#ifndef PARSER_H -#define PARSER_H - -#include -#include -#include -#include - -// -// Stuff for flex and bison -// - -#if defined(__clang__) -# pragma clang diagnostic ignored "-Wconversion" -#endif - -#define YYSTYPE std::list -#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 -{ -public: - Parser(const std::shared_ptr&); - - void usage(); - void list(bool); - void list(const std::shared_ptr&, bool, size_t); - void createFile(const std::list&); - void createDir(const std::list&); - void pwd(); - void cd(const std::string&); - void cat(const std::string&); - void write(std::list&); - void destroy(const std::list&); - - // - // With older flex version <= 2.5.35 YY_INPUT second - // paramenter is of type int&, in newer versions it - // changes to size_t& - // - void getInput(char*, int&, size_t); - void getInput(char*, size_t&, size_t); - 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> _dirs; - - bool _continue; - int _errors; -}; - -extern Parser* parser; // The current parser for bison/flex - -#endif diff --git a/cpp/Manual/lifecycle/README.md b/cpp/Manual/lifecycle/README.md deleted file mode 100644 index 55565c39f1..0000000000 --- a/cpp/Manual/lifecycle/README.md +++ /dev/null @@ -1,18 +0,0 @@ -This demo implements [the file system with life cycle support][1] -example in the Ice Manual. - -To run it, start the server in a window: - -``` -server -``` - -Then run the client in a separate window: - -``` -client -``` - -Type "help" at the client prompt to see a list of commands. - -[1]: https://doc.zeroc.com/ice/3.7/best-practices/object-life-cycle/object-life-cycle-for-the-file-system-application diff --git a/cpp/Manual/lifecycle/Scanner.cpp b/cpp/Manual/lifecycle/Scanner.cpp deleted file mode 100644 index eae6fba4f7..0000000000 --- a/cpp/Manual/lifecycle/Scanner.cpp +++ /dev/null @@ -1,2048 +0,0 @@ -#include -#line 2 "Manual/lifecycle/Scanner.cpp" - -#line 4 "Manual/lifecycle/Scanner.cpp" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 37 -#if YY_FLEX_SUBMINOR_VERSION > 0 -# define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -# define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -# ifndef __STDC_LIMIT_MACROS -# define __STDC_LIMIT_MACROS 1 -# endif - -# include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -# else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -# ifndef INT8_MIN -# define INT8_MIN (-128) -# endif -# ifndef INT16_MIN -# define INT16_MIN (-32767 - 1) -# endif -# ifndef INT32_MIN -# define INT32_MIN (-2147483647 - 1) -# endif -# ifndef INT8_MAX -# define INT8_MAX (127) -# endif -# ifndef INT16_MAX -# define INT16_MAX (32767) -# endif -# ifndef INT32_MAX -# define INT32_MAX (2147483647) -# endif -# ifndef UINT8_MAX -# define UINT8_MAX (255U) -# endif -# ifndef UINT16_MAX -# define UINT16_MAX (65535U) -# endif -# ifndef UINT32_MAX -# define UINT32_MAX (4294967295U) -# endif - -# endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -# define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -# if defined(__STDC__) - -# define YY_USE_CONST - -# endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -# define yyconst const -#else -# define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int)(unsigned char)c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -# define YY_BUF_SIZE 16384 -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -# define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state* YY_BUFFER_STATE; -#endif - -#ifndef YY_TYPEDEF_YY_SIZE_T -# define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -extern yy_size_t yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -#define YY_LESS_LINENO(n) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg); \ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } while (0) - -#define unput(c) yyunput(c, (yytext_ptr)) - -#ifndef YY_STRUCT_YY_BUFFER_STATE -# define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state -{ - FILE* yy_input_file; - - char* yy_ch_buf; /* input buffer */ - char* yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -# define YY_BUFFER_NEW 0 -# define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -# define YY_BUFFER_EOF_PENDING 2 -}; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE* yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; - -/* Points to current character in buffer. */ -static char* yy_c_buf_p = (char*)0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow 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(FILE* input_file); -void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer); -YY_BUFFER_STATE yy_create_buffer(FILE* file, int size); -void yy_delete_buffer(YY_BUFFER_STATE b); -void yy_flush_buffer(YY_BUFFER_STATE b); -void yypush_buffer_state(YY_BUFFER_STATE new_buffer); -void yypop_buffer_state(void); - -static void yyensure_buffer_stack(void); -static void yy_load_buffer_state(void); -static void yy_init_buffer(YY_BUFFER_STATE b, FILE* file); - -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER) - -YY_BUFFER_STATE yy_scan_buffer(char* base, yy_size_t size); -YY_BUFFER_STATE yy_scan_string(yyconst char* yy_str); -YY_BUFFER_STATE yy_scan_bytes(yyconst char* bytes, yy_size_t len); - -void* yyalloc(yy_size_t); -void* yyrealloc(void*, yy_size_t); -void yyfree(void*); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if (!YY_CURRENT_BUFFER) \ - { \ - yyensure_buffer_stack(); \ - YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if (!YY_CURRENT_BUFFER) \ - { \ - yyensure_buffer_stack(); \ - YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -#define yywrap() 1 -#define YY_SKIP_YYWRAP - -typedef unsigned char YY_CHAR; - -FILE *yyin = (FILE*)0, *yyout = (FILE*)0; - -typedef int yy_state_type; - -extern int yylineno; - -int yylineno = 1; - -extern char* yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state(void); -static yy_state_type yy_try_NUL_trans(yy_state_type current_state); -static int yy_get_next_buffer(void); -static void yy_fatal_error(yyconst char msg[]); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (size_t)(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 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info -{ - flex_int32_t yy_verify; - flex_int32_t yy_nxt; -}; -static yyconst flex_int16_t yy_accept[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 flex_int32_t yy_ec[256] = { - 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 2, 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 flex_int32_t 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 flex_int16_t 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 flex_int16_t 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 flex_int16_t 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 flex_int16_t 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; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char* yytext; -#line 1 "Manual/lifecycle/Scanner.l" -#line 2 "Manual/lifecycle/Scanner.l" - -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#include -#include -#include - -#if defined(_MSC_VER) -# if defined(ICE_64) -// -// '=' : conversion from 'size_t' to 'int', possible loss of data -// The result of fread() is a size_t and gets inserted into an int -// -# pragma warning(disable : 4267) -# endif -// -// 'initializing' : conversion from '__int64' to 'int', possible loss of data -// Puts a pointer-difference into an int -// -# pragma warning(disable : 4244) -// -// conditional expression is constant -// -# pragma warning(disable : 4127) -// -// '<': signed/unsigned mismatch -// -# pragma warning(disable : 4018) -#endif - -#if defined(__GNUC__) -# pragma GCC diagnostic ignored "-Wsign-compare" -#endif - -#if defined(__clang__) -# pragma clang diagnostic ignored "-Wregister" -#endif - -using namespace std; - -#ifdef _MSC_VER -# ifdef yywrap -# undef yywrap -# define yywrap() 1 -# endif -# define YY_NO_UNISTD_H -#endif - -#ifdef __SUNPRO_CC -# ifdef yywrap -# undef yywrap -# define yywrap() 1 -# endif -# ifdef ICE_64 -# pragma error_messages(off, truncwarn) -# endif -#endif - -#define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) - -#line 552 "Manual/lifecycle/Scanner.cpp" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -# include -#endif - -#ifndef YY_EXTRA_TYPE -# define YY_EXTRA_TYPE void* -#endif - -static int yy_init_globals(void); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy(void); - -int yyget_debug(void); - -void yyset_debug(int debug_flag); - -YY_EXTRA_TYPE yyget_extra(void); - -void yyset_extra(YY_EXTRA_TYPE user_defined); - -FILE* yyget_in(void); - -void yyset_in(FILE* in_str); - -FILE* yyget_out(void); - -void yyset_out(FILE* out_str); - -yy_size_t yyget_leng(void); - -char* yyget_text(void); - -int yyget_lineno(void); - -void yyset_lineno(int line_number); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -# ifdef __cplusplus -extern "C" int yywrap(void); -# else -extern int yywrap(void); -# endif -#endif - -static void yyunput(int c, char* buf_ptr); - -#ifndef yytext_ptr -static void yy_flex_strncpy(char*, yyconst char*, int); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen(yyconst char*); -#endif - -#ifndef YY_NO_INPUT - -# ifdef __cplusplus -static int yyinput(void); -# else -static int input(void); -# endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -# define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -# define ECHO \ - do \ - { \ - if (fwrite(yytext, yyleng, 1, yyout)) \ - { \ - } \ - } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -# define YY_INPUT(buf, result, max_size) \ - if (YY_CURRENT_BUFFER_LVALUE->yy_is_interactive) \ - { \ - int c = '*'; \ - size_t 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 - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -# define YY_DECL_IS_OURS 1 - -extern int yylex(void); - -# define YY_DECL int yylex(void) -#endif /* !YY_DECL */ - -/* 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 - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 70 "Manual/lifecycle/Scanner.l" - -#line 737 "Manual/lifecycle/Scanner.cpp" - - if (!(yy_init)) - { - (yy_init) = 1; - -#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) - { - yyensure_buffer_stack(); - YY_CURRENT_BUFFER_LVALUE = 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 72 "Manual/lifecycle/Scanner.l" - { - // C++-style comment - int c; - do - { - c = yyinput(); - } while (c != '\n' && c != EOF); - } - YY_BREAK - case 2: - YY_RULE_SETUP -#line 82 "Manual/lifecycle/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 107 "Manual/lifecycle/Scanner.l" - { - return TOK_HELP; - } - YY_BREAK - case 4: - YY_RULE_SETUP -#line 111 "Manual/lifecycle/Scanner.l" - { - return TOK_EXIT; - } - YY_BREAK - case 5: - YY_RULE_SETUP -#line 115 "Manual/lifecycle/Scanner.l" - { - return TOK_LIST; - } - YY_BREAK - case 6: - YY_RULE_SETUP -#line 119 "Manual/lifecycle/Scanner.l" - { - return TOK_LIST_RECURSIVE; - } - YY_BREAK - case 7: - YY_RULE_SETUP -#line 123 "Manual/lifecycle/Scanner.l" - { - return TOK_CREATE_FILE; - } - YY_BREAK - case 8: - YY_RULE_SETUP -#line 127 "Manual/lifecycle/Scanner.l" - { - return TOK_CREATE_DIR; - } - YY_BREAK - case 9: - YY_RULE_SETUP -#line 131 "Manual/lifecycle/Scanner.l" - { - return TOK_PWD; - } - YY_BREAK - case 10: - YY_RULE_SETUP -#line 135 "Manual/lifecycle/Scanner.l" - { - return TOK_CD; - } - YY_BREAK - case 11: - YY_RULE_SETUP -#line 139 "Manual/lifecycle/Scanner.l" - { - return TOK_CAT; - } - YY_BREAK - case 12: - YY_RULE_SETUP -#line 143 "Manual/lifecycle/Scanner.l" - { - return TOK_WRITE; - } - YY_BREAK - case 13: - YY_RULE_SETUP -#line 147 "Manual/lifecycle/Scanner.l" - { - return TOK_RM; - } - YY_BREAK - case 14: - /* rule 14 can match eol */ - YY_RULE_SETUP -#line 151 "Manual/lifecycle/Scanner.l" - { - size_t len = strlen(yytext); - for (size_t i = 0; i < len; ++i) - { - if (yytext[i] == '\\') - { - parser->continueLine(); - } - } - } - YY_BREAK - case 15: - /* rule 15 can match eol */ - YY_RULE_SETUP -#line 162 "Manual/lifecycle/Scanner.l" - { - return ';'; - } - YY_BREAK - case 16: - YY_RULE_SETUP -#line 166 "Manual/lifecycle/Scanner.l" - { - // "..."-type strings - string s; - while (true) - { - int c = yyinput(); - if (c == '"') - { - break; - } - else if (c == EOF) - { - parser->warning("EOF in string"); - break; - } - else if (c == '\\') - { - int next = 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 240 "Manual/lifecycle/Scanner.l" - { - // '...'-type strings - string s; - while (true) - { - int c = 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 265 "Manual/lifecycle/Scanner.l" - { - // Simple strings - string s; - s += yytext[0]; - while (true) - { - int c = 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 289 "Manual/lifecycle/Scanner.l" - ECHO; - YY_BREAK -#line 1098 "Manual/lifecycle/Scanner.cpp" - case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int)(yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed 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_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ((yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans(yy_current_state); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if (yy_next_state) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_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_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR("fatal flex scanner internal error--no action found"); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of 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(void) -{ - register char* dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char* source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ((yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1]) - YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed"); - - if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ((yy_c_buf_p) - (yytext_ptr)-YY_MORE_ADJ == 1) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int)((yy_c_buf_p) - (yytext_ptr)) - 1; - - for (i = 0; i < number_to_move; ++i) - *(dest++) = *(source++); - - if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while (num_to_read <= 0) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - int yy_c_buf_p_offset = (int)((yy_c_buf_p)-b->yy_ch_buf); - - if (b->yy_is_our_buffer) - { - yy_size_t 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. */ - yyrealloc((void*)b->yy_ch_buf, b->yy_buf_size + 2); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if (!b->yy_ch_buf) - YY_FATAL_ERROR("fatal error - scanner input buffer overflow"); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - } - - if (num_to_read > YY_READ_BUF_SIZE) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ((yy_n_chars) == 0) - { - if (number_to_move == YY_MORE_ADJ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t)((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) - { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char*)yyrealloc((void*)YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size); - if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) - YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()"); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type -yy_get_previous_state(void) -{ - register yy_state_type yy_current_state; - register char* yy_cp; - - yy_current_state = (yy_start); - - for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if (yy_accept[yy_current_state]) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) - { - yy_current_state = (int)yy_def[yy_current_state]; - if (yy_current_state >= 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 ); - */ -static yy_state_type -yy_try_NUL_trans(yy_state_type yy_current_state) -{ - register int yy_is_jam; - register char* yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if (yy_accept[yy_current_state]) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) - { - yy_current_state = (int)yy_def[yy_current_state]; - if (yy_current_state >= 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; -} - -static void -yyunput(int c, register char* yy_bp) -{ - register char* yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register yy_size_t number_to_move = (yy_n_chars) + 2; - register char* dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char* source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while (source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) - *--dest = *--source; - - yy_cp += (int)(dest - source); - yy_bp += (int)(dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2) - YY_FATAL_ERROR("flex scanner push-back overflow"); - } - - *--yy_cp = (char)c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#ifndef YY_NO_INPUT -# ifdef __cplusplus -static int -yyinput(void) -# else -static int -input(void) -# endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ((yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - yy_size_t 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); - - /*FALLTHROUGH*/ - - 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; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ -void -yyrestart(FILE* input_file) -{ - if (!YY_CURRENT_BUFFER) - { - yyensure_buffer_stack(); - YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); - } - - yy_init_buffer(YY_CURRENT_BUFFER, input_file); - yy_load_buffer_state(); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ -void -yy_switch_to_buffer(YY_BUFFER_STATE new_buffer) -{ - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack(); - if (YY_CURRENT_BUFFER == new_buffer) - return; - - if (YY_CURRENT_BUFFER) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - 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; -} - -static void -yy_load_buffer_state(void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ -YY_BUFFER_STATE -yy_create_buffer(FILE* file, int size) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE)yyalloc(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*)yyalloc(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; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ -void -yy_delete_buffer(YY_BUFFER_STATE b) -{ - if (!b) - return; - - if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE)0; - - if (b->yy_is_our_buffer) - yyfree((void*)b->yy_ch_buf); - - yyfree((void*)b); -} - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ -static void -yy_init_buffer(YY_BUFFER_STATE b, FILE* file) - -{ - int oerrno = errno; - - yy_flush_buffer(b); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER) - { - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = 1; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ -void -yy_flush_buffer(YY_BUFFER_STATE b) -{ - if (!b) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if (b == YY_CURRENT_BUFFER) - yy_load_buffer_state(); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void -yypush_buffer_state(YY_BUFFER_STATE new_buffer) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if (YY_CURRENT_BUFFER) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state(); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void -yypop_buffer_state(void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) - { - yy_load_buffer_state(); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void -yyensure_buffer_stack(void) -{ - yy_size_t num_to_alloc; - - if (!(yy_buffer_stack)) - { - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc(num_to_alloc * sizeof(struct yy_buffer_state*)); - if (!(yy_buffer_stack)) - YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()"); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) - { - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = - (struct yy_buffer_state**)yyrealloc((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*)); - if (!(yy_buffer_stack)) - YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()"); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE -yy_scan_buffer(char* base, yy_size_t size) -{ - YY_BUFFER_STATE b; - - if (size < 2 || base[size - 2] != YY_END_OF_BUFFER_CHAR || base[size - 1] != YY_END_OF_BUFFER_CHAR) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE)yyalloc(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; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE -yy_scan_string(yyconst char* yystr) { return yy_scan_bytes(yystr, strlen(yystr)); } - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE -yy_scan_bytes(yyconst char* yybytes, yy_size_t _yybytes_len) -{ - YY_BUFFER_STATE b; - char* buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char*)yyalloc(n); - if (!buf) - YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()"); - - for (i = 0; i < _yybytes_len; ++i) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR; - - b = 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; -} - -#ifndef YY_EXIT_FAILURE -# define YY_EXIT_FAILURE 2 -#endif - -static void -yy_fatal_error(yyconst char* msg) -{ - (void)fprintf(stderr, "%s\n", msg); - exit(YY_EXIT_FAILURE); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg); \ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } while (0) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int -yyget_lineno(void) -{ - return yylineno; -} - -/** Get the input stream. - * - */ -FILE* -yyget_in(void) -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE* -yyget_out(void) -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -yy_size_t -yyget_leng(void) -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char* -yyget_text(void) -{ - return yytext; -} - -/** Set the current line number. - * @param line_number - * - */ -void -yyset_lineno(int line_number) -{ - yylineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void -yyset_in(FILE* in_str) -{ - yyin = in_str; -} - -void -yyset_out(FILE* out_str) -{ - yyout = out_str; -} - -int -yyget_debug(void) -{ - return yy_flex_debug; -} - -void -yyset_debug(int bdebug) -{ - yy_flex_debug = bdebug; -} - -static int -yy_init_globals(void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char*)0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = (FILE*)0; - yyout = (FILE*)0; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int -yylex_destroy(void) -{ - /* Pop the buffer stack, destroying each element. */ - while (YY_CURRENT_BUFFER) - { - yy_delete_buffer(YY_CURRENT_BUFFER); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack)); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals(); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void -yy_flex_strncpy(char* s1, yyconst char* s2, int n) -{ - register int i; - for (i = 0; i < n; ++i) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int -yy_flex_strlen(yyconst char* s) -{ - register int n; - for (n = 0; s[n]; ++n) - ; - - return n; -} -#endif - -void* -yyalloc(yy_size_t size) -{ - return (void*)malloc(size); -} - -void* -yyrealloc(void* ptr, yy_size_t size) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void*)realloc((char*)ptr, size); -} - -void -yyfree(void* ptr) -{ - free((char*)ptr); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 289 "Manual/lifecycle/Scanner.l" - -#include diff --git a/cpp/Manual/lifecycle/Scanner.l b/cpp/Manual/lifecycle/Scanner.l deleted file mode 100644 index d594be6f72..0000000000 --- a/cpp/Manual/lifecycle/Scanner.l +++ /dev/null @@ -1,293 +0,0 @@ -%{ - -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#include -#include -#include - -#if defined(_MSC_VER) -#if defined(ICE_64) -// -// '=' : conversion from 'size_t' to 'int', possible loss of data -// The result of fread() is a size_t and gets inserted into an int -// -# pragma warning(disable:4267) -#endif -// -// 'initializing' : conversion from '__int64' to 'int', possible loss of data -// Puts a pointer-difference into an int -// -# pragma warning(disable:4244) -// -// conditional expression is constant -// -# pragma warning(disable:4127) -// -// '<': signed/unsigned mismatch -// -# pragma warning(disable:4018) -#endif - -#if defined(__GNUC__) -# pragma GCC diagnostic ignored "-Wsign-compare" -#endif - -#if defined(__clang__) -# pragma clang diagnostic ignored "-Wconversion" -#endif - -using namespace std; - -#ifdef _MSC_VER -# ifdef yywrap -# undef yywrap -# define yywrap() 1 -# endif -# define YY_NO_UNISTD_H -#endif - -#ifdef __SUNPRO_CC -# ifdef yywrap -# undef yywrap -# define yywrap() 1 -# endif -# ifdef ICE_64 -# pragma error_messages(off,truncwarn) -# endif -#endif - -#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) - { - int c = yyinput(); - if(c == '"') - { - break; - } - else if(c == EOF) - { - parser->warning("EOF in string"); - break; - } - else if(c == '\\') - { - int next = 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) - { - int c = 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) - { - int c = yyinput(); - if(c == EOF) - { - break; - } - else if(isspace(c) || c == ';') - { - unput(c); - break; - } - - s += c; - } - yylvalp->clear(); - yylvalp->push_back(s); - return TOK_STRING; -} - -%% - -#include diff --git a/cpp/Manual/lifecycle/Server.cpp b/cpp/Manual/lifecycle/Server.cpp deleted file mode 100644 index 8d8d7d827c..0000000000 --- a/cpp/Manual/lifecycle/Server.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#include -#include - -using namespace std; -using namespace Filesystem; -using namespace FilesystemI; - -int -main(int argc, char* argv[]) -{ - int status = 0; - - try - { - // - // CtrlCHandler must be created before the communicator or any other threads are started - // - Ice::CtrlCHandler ctrlCHandler; - - // - // CommunicatorHolder's ctor initializes an Ice communicator, - // and its dtor destroys this communicator. - // - const Ice::CommunicatorHolder ich(argc, argv); - const auto& communicator = ich.communicator(); - - auto appName = argv[0]; - ctrlCHandler.setCallback( - [communicator, appName](int) - { - communicator->shutdown(); - cerr << appName << ": received signal, shutting down" << endl; - }); - - // - // The communicator initialization removes all Ice-related arguments from argc/argv - // - if (argc > 1) - { - cerr << argv[0] << ": too many arguments" << endl; - status = 1; - } - else - { - // - // Create an object adapter. - // - auto adapter = - communicator->createObjectAdapterWithEndpoints("SimpleFilesystem", "default -h 127.0.0.1 -p 10000"); - - // - // Create the root directory. - // - auto root = make_shared(); - Ice::Identity id; - id.name = "RootDir"; - adapter->add(root, id); - - // - // All objects are created, allow client requests now. - // - adapter->activate(); - - // - // Wait until we are done. - // - communicator->waitForShutdown(); - } - } - catch (const std::exception& ex) - { - cerr << ex.what() << endl; - status = 1; - } - - return status; -} diff --git a/cpp/Manual/lifecycle/msbuild/client/client.vcxproj b/cpp/Manual/lifecycle/msbuild/client/client.vcxproj deleted file mode 100644 index c71604be4f..0000000000 --- a/cpp/Manual/lifecycle/msbuild/client/client.vcxproj +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - client - {332A63F9-BBD9-4324-8C1E-26604C71D54F} - - - - Application - false - $(DefaultPlatformToolset) - true - - - Application - false - Unicode - $(DefaultPlatformToolset) - false - - - Application - false - $(DefaultPlatformToolset) - true - - - Application - false - Unicode - $(DefaultPlatformToolset) - false - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - ..\..\ - $(Platform)\$(Configuration)\ - false - ..\..\ - $(Platform)\$(Configuration)\ - false - ..\..\ - $(Platform)\$(Configuration)\ - ..\..\ - $(Platform)\$(Configuration)\ - - - cpp98 - - - - OnlyExplicitInline - ICE_CPP11_MAPPING;_CONSOLE;NDEBUG;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - Level4 - true - $(Platform)\$(Configuration);..\..;%(AdditionalIncludeDirectories) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /FIXED:NO /IGNORE:4089 %(AdditionalOptions) - setargv.obj;%(AdditionalDependencies) - Console - - - MachineX86 - - - - - OnlyExplicitInline - ICE_CPP11_MAPPING;_CONSOLE;NDEBUG;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - Level4 - true - $(Platform)\$(Configuration);..\..;%(AdditionalIncludeDirectories) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /FIXED:NO /IGNORE:4089 %(AdditionalOptions) - setargv.obj;%(AdditionalDependencies) - Console - - - MachineX64 - - - - - ICE_CPP11_MAPPING;_CONSOLE;_DEBUG;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - Level4 - true - $(Platform)\$(Configuration);..\..;%(AdditionalIncludeDirectories) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /FIXED:NO %(AdditionalOptions) - setargv.obj;%(AdditionalDependencies) - Console - - - MachineX86 - - - - - ICE_CPP11_MAPPING;_CONSOLE;_DEBUG;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - Level4 - true - $(Platform)\$(Configuration);..\..;%(AdditionalIncludeDirectories) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /FIXED:NO %(AdditionalOptions) - setargv.obj;%(AdditionalDependencies) - Console - - - MachineX64 - - - - - $(Platform)\$(Configuration) - - - - - - - - - true - true - true - ..\..\Filesystem.ice - - - true - true - true - ..\..\Filesystem.ice - - - true - true - true - ..\..\Filesystem.ice - - - true - true - true - ..\..\Filesystem.ice - - - - - - - true - true - true - ..\..\Filesystem.ice - - - true - true - true - ..\..\Filesystem.ice - - - true - true - true - ..\..\Filesystem.ice - - - true - true - true - ..\..\Filesystem.ice - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - - \ No newline at end of file diff --git a/cpp/Manual/lifecycle/msbuild/client/client.vcxproj.filters b/cpp/Manual/lifecycle/msbuild/client/client.vcxproj.filters deleted file mode 100644 index 10c679ff00..0000000000 --- a/cpp/Manual/lifecycle/msbuild/client/client.vcxproj.filters +++ /dev/null @@ -1,110 +0,0 @@ - - - - - {fe251ff8-d9d5-4963-a8d8-732c824d8e5f} - cpp;c;cxx;rc;def;r;odl;idl;hpj;bat - - - {a5fa7e8b-6bc1-48f2-8663-9617c0fd949f} - h;hpp;hxx;hm;inl - - - {5985c286-d8de-440e-a59d-2b9c2a77be24} - - - {d76fb713-3805-4347-b9df-4825050cdb7e} - ice - - - {f0a2f179-523c-4372-b20e-5c00bf40e832} - - - {c02204f4-e2bb-4c5d-bedb-469fb8161867} - - - {16b125e8-e15d-4ac1-8121-f34c2b76b229} - - - {aca62e10-a3d0-4e0f-a6d3-2a0d71da7861} - - - {30a402f4-fad4-46dc-a0a2-6935fa4fc362} - - - {acb04099-fa63-4148-b31e-e74171d8385d} - - - {916993c5-47a1-45d3-b197-2ac6fd53e85b} - - - {2d45376e-fd94-416d-adb3-0c6a21796639} - - - {fa572afc-6124-4528-a901-da395f71fb83} - - - {714bbd91-903b-4e52-bcfe-26bc3f2320e1} - - - {520397b3-1c67-4662-a958-2932e7d10c2e} - - - {5203e0ce-a945-41f2-b573-fb22540945c3} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files\Win32\Debug - - - Source Files\x64\Debug - - - Source Files\Win32\Release - - - Source Files\x64\Release - - - - - Header Files - - - Header Files - - - Header Files\Win32\Debug - - - Header Files\x64\Debug - - - Header Files\Win32\Release - - - Header Files\x64\Release - - - - - - - - Slice Files - - - \ No newline at end of file diff --git a/cpp/Manual/lifecycle/msbuild/client/client.vcxproj.user b/cpp/Manual/lifecycle/msbuild/client/client.vcxproj.user deleted file mode 100644 index cedf471f6b..0000000000 --- a/cpp/Manual/lifecycle/msbuild/client/client.vcxproj.user +++ /dev/null @@ -1,19 +0,0 @@ - - - - ..\.. - WindowsLocalDebugger - - - ..\.. - WindowsLocalDebugger - - - ..\.. - WindowsLocalDebugger - - - ..\.. - WindowsLocalDebugger - - \ No newline at end of file diff --git a/cpp/Manual/lifecycle/msbuild/client/packages.config b/cpp/Manual/lifecycle/msbuild/client/packages.config deleted file mode 100644 index 0d37245cd4..0000000000 --- a/cpp/Manual/lifecycle/msbuild/client/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/cpp/Manual/lifecycle/msbuild/server/packages.config b/cpp/Manual/lifecycle/msbuild/server/packages.config deleted file mode 100644 index 0d37245cd4..0000000000 --- a/cpp/Manual/lifecycle/msbuild/server/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/cpp/Manual/lifecycle/msbuild/server/server.vcxproj b/cpp/Manual/lifecycle/msbuild/server/server.vcxproj deleted file mode 100644 index 6336d429b5..0000000000 --- a/cpp/Manual/lifecycle/msbuild/server/server.vcxproj +++ /dev/null @@ -1,269 +0,0 @@ - - - - - - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - server - {95043699-A842-4E16-A95B-13E02709B210} - - - - Application - false - $(DefaultPlatformToolset) - true - - - Application - false - Unicode - $(DefaultPlatformToolset) - false - - - Application - false - $(DefaultPlatformToolset) - true - - - Application - false - Unicode - $(DefaultPlatformToolset) - false - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - ..\..\ - $(Platform)\$(Configuration)\ - false - ..\..\ - $(Platform)\$(Configuration)\ - false - ..\..\ - $(Platform)\$(Configuration)\ - ..\..\ - $(Platform)\$(Configuration)\ - - - cpp98 - - - - OnlyExplicitInline - ICE_CPP11_MAPPING;_CONSOLE;NDEBUG;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - Level4 - true - $(Platform)\$(Configuration);..\..;%(AdditionalIncludeDirectories) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /FIXED:NO /IGNORE:4089 %(AdditionalOptions) - setargv.obj;%(AdditionalDependencies) - Console - - - MachineX86 - - - - - OnlyExplicitInline - ICE_CPP11_MAPPING;_CONSOLE;NDEBUG;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - Level4 - true - $(Platform)\$(Configuration);..\..;%(AdditionalIncludeDirectories) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /FIXED:NO /IGNORE:4089 %(AdditionalOptions) - setargv.obj;%(AdditionalDependencies) - Console - - - MachineX64 - - - - - ICE_CPP11_MAPPING;_CONSOLE;_DEBUG;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - Level4 - true - $(Platform)\$(Configuration);..\..;%(AdditionalIncludeDirectories) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /FIXED:NO %(AdditionalOptions) - setargv.obj;%(AdditionalDependencies) - Console - - - MachineX86 - - - - - ICE_CPP11_MAPPING;_CONSOLE;_DEBUG;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - Level4 - true - $(Platform)\$(Configuration);..\..;%(AdditionalIncludeDirectories) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /FIXED:NO %(AdditionalOptions) - setargv.obj;%(AdditionalDependencies) - Console - - - MachineX64 - - - - - $(Platform)\$(Configuration) - - - - - - true - true - true - ..\..\Filesystem.ice - - - true - true - true - ..\..\Filesystem.ice - - - true - true - true - ..\..\Filesystem.ice - - - true - true - true - ..\..\Filesystem.ice - - - - - - - true - true - true - ..\..\Filesystem.ice - - - true - true - true - ..\..\Filesystem.ice - - - true - true - true - ..\..\Filesystem.ice - - - true - true - true - ..\..\Filesystem.ice - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - - \ No newline at end of file diff --git a/cpp/Manual/lifecycle/msbuild/server/server.vcxproj.filters b/cpp/Manual/lifecycle/msbuild/server/server.vcxproj.filters deleted file mode 100644 index 51dc62bb8e..0000000000 --- a/cpp/Manual/lifecycle/msbuild/server/server.vcxproj.filters +++ /dev/null @@ -1,102 +0,0 @@ - - - - - {363bd847-1218-472b-9afe-326a231eef25} - h;hpp;hxx;hm;inl - - - {3270663e-4dfd-40dd-92e0-4d9754151590} - cpp;c;cxx;rc;def;r;odl;idl;hpj;bat - - - {e0064836-3aec-4669-9f2d-1d1b062120a6} - ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - {0dd46bd7-5c10-4a1d-bdd8-8f63403b6983} - ice - - - {750cd9d0-afaf-4ec3-b4ff-75bd7903d22a} - - - {de5c1c6b-ab69-4a33-bf7f-2238ee6b3a78} - - - {1cd9cb54-d822-4e9f-ba99-c9a2a17c8640} - - - {34e2ff1d-fcac-4d21-96ec-5b5247cee3ca} - - - {dfd5bebf-62ef-4232-98ec-c84feb8f01a8} - - - {826d3c80-a746-4541-bc38-30cdd80ccfd3} - - - {6b2455f5-ebdb-44ba-a614-3cd582e2213e} - - - {131abd80-82bb-4833-9978-57e5be894aa6} - - - {da6478b0-405a-4d49-ad01-ac9a8ae93035} - - - {d6b1a19e-25ed-4877-aada-b45adc65d4da} - - - {59074003-c881-4d83-a66e-da4a8831b703} - - - {bc8a034c-d836-46b3-83ce-80adeec3fed1} - - - - - Header Files - - - Header Files\Win32\Debug - - - Header Files\x64\Debug - - - Header Files\Win32\Release - - - Header Files\x64\Release - - - - - Source Files - - - Source Files - - - Source Files\Win32\Debug - - - Source Files\x64\Debug - - - Source Files\Win32\Release - - - Source Files\x64\Release - - - - - - - - Slice Files - - - \ No newline at end of file diff --git a/cpp/Manual/lifecycle/msbuild/server/server.vcxproj.user b/cpp/Manual/lifecycle/msbuild/server/server.vcxproj.user deleted file mode 100644 index cedf471f6b..0000000000 --- a/cpp/Manual/lifecycle/msbuild/server/server.vcxproj.user +++ /dev/null @@ -1,19 +0,0 @@ - - - - ..\.. - WindowsLocalDebugger - - - ..\.. - WindowsLocalDebugger - - - ..\.. - WindowsLocalDebugger - - - ..\.. - WindowsLocalDebugger - - \ No newline at end of file diff --git a/cpp/Manual/printer/Client.cpp b/cpp/Manual/printer/Client.cpp index a5ba08bcb1..880b8acd9f 100644 --- a/cpp/Manual/printer/Client.cpp +++ b/cpp/Manual/printer/Client.cpp @@ -2,9 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Printer.h" #include -#include -#include +#include using namespace std; using namespace Demo; diff --git a/cpp/Manual/printer/Server.cpp b/cpp/Manual/printer/Server.cpp index 26b61cbc2b..0dcf787dcd 100644 --- a/cpp/Manual/printer/Server.cpp +++ b/cpp/Manual/printer/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#include "Printer.h" #include -#include +#include using namespace std; using namespace Demo; diff --git a/cpp/Manual/simpleFilesystem/Client.cpp b/cpp/Manual/simpleFilesystem/Client.cpp index 84e4ceb668..355c0afccb 100644 --- a/cpp/Manual/simpleFilesystem/Client.cpp +++ b/cpp/Manual/simpleFilesystem/Client.cpp @@ -5,8 +5,6 @@ #include #include #include -#include -#include using namespace std; using namespace Filesystem; @@ -16,7 +14,7 @@ using namespace Filesystem; // parameter is the current nesting level (for indentation). static void -listRecursive(const shared_ptr& dir, size_t depth = 0) +listRecursive(const optional& dir, size_t depth = 0) { const string indent(++depth, '\t'); diff --git a/cpp/Manual/simpleFilesystem/FilesystemI.cpp b/cpp/Manual/simpleFilesystem/FilesystemI.cpp index 91a86f14e7..d392d543bb 100644 --- a/cpp/Manual/simpleFilesystem/FilesystemI.cpp +++ b/cpp/Manual/simpleFilesystem/FilesystemI.cpp @@ -64,7 +64,7 @@ Filesystem::DirectoryI::DirectoryI(string name, const shared_ptr& pa // addChild is called by the child in order to add // itself to the _contents member of the parent void -Filesystem::DirectoryI::addChild(const shared_ptr& child) +Filesystem::DirectoryI::addChild(const optional& child) { _contents.push_back(child); } diff --git a/cpp/Manual/simpleFilesystem/FilesystemI.h b/cpp/Manual/simpleFilesystem/FilesystemI.h index 308c577838..c75365e88d 100644 --- a/cpp/Manual/simpleFilesystem/FilesystemI.h +++ b/cpp/Manual/simpleFilesystem/FilesystemI.h @@ -31,11 +31,11 @@ namespace Filesystem std::shared_ptr _parent; }; - class FileI : public File, public NodeI + class FileI final : public File, public NodeI { public: - virtual Lines read(const Ice::Current&) override; - virtual void write(Lines, const Ice::Current&) override; + Lines read(const Ice::Current&) final; + void write(Lines, const Ice::Current&) final; FileI(std::string, const std::shared_ptr&); @@ -46,9 +46,9 @@ namespace Filesystem class DirectoryI : public Directory, public NodeI { public: - virtual NodeSeq list(const Ice::Current&) override; + NodeSeq list(const Ice::Current&) final; DirectoryI(std::string, const std::shared_ptr&); - void addChild(const std::shared_ptr&); + void addChild(const std::optional&); private: NodeSeq _contents; diff --git a/cpp/Manual/simpleFilesystem/Server.cpp b/cpp/Manual/simpleFilesystem/Server.cpp index a859cb6505..6d73629ccf 100644 --- a/cpp/Manual/simpleFilesystem/Server.cpp +++ b/cpp/Manual/simpleFilesystem/Server.cpp @@ -2,8 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include "FilesystemI.h" #include +#include using namespace std; using namespace Filesystem; diff --git a/cpp/make/Make.rules b/cpp/make/Make.rules index 6983285427..34f7e4beee 100644 --- a/cpp/make/Make.rules +++ b/cpp/make/Make.rules @@ -36,10 +36,6 @@ cpp-dependencies += IceBT IceBT_dependencies := Ice endif -# Append ++11 suffix to libraries -shared_targetname = $(if $(filter-out $($1_target),program),++11) -static_targetname = $(if $(filter-out $($1_target),program),++11) - # Create component dependency variables $(eval $(call create-project-dependencies,ice,$(ICE_HOME),cpp,cpp,$(cpp-dependencies))) @@ -52,14 +48,6 @@ $(foreach v,$(supported-platforms) platform config,$(eval $v_targetdir := ) $(ev slice2cpp_targetext = cpp slice2cpp_path = $(or $(ice_bindir[$(build-platform)]),$(ice_bindir))/slice2cpp -# With Xcode 14.3 C++17 deprecations apply when building with -std=c++11, we pass -std=c++17 -# to enable C++17 mode conditional code. -ifeq ($(os),Darwin) -ice_cpp_mode = c++17 -else -ice_cpp_mode = c++11 -endif - ifeq ($(wildcard $(slice2cpp_path)),) $(error Can't find Ice distribution, please set ICE_HOME to the Ice installation directory) endif @@ -73,7 +61,7 @@ $1_srcext := cpp $1_dependencies := $$(or $$($1_dependencies),Ice) $1_slicecompiler := slice2cpp $1_sliceflags := -I$(ice_slicedir) -I$1 $$($1_sliceflags) -$1_cppflags := -DICE_CPP11_MAPPING -std=$(ice_cpp_mode) -I$1 -I$1/generated $(ice_cppflags) $$($1_cppflags) +$1_cppflags := -DICE_CPP11_MAPPING -std=c++17 -I$1 -I$1/generated $(ice_cppflags) $$($1_cppflags) $1_caninstall := no # Also link with IceSSL, IceDiscovery and IceLocatorDiscovery when compiling the project with the static configuration diff --git a/csharp/Glacier2/callback/config.glacier2 b/csharp/Glacier2/callback/config.glacier2 index 07c23c3eb6..1927863457 100644 --- a/csharp/Glacier2/callback/config.glacier2 +++ b/csharp/Glacier2/callback/config.glacier2 @@ -23,13 +23,6 @@ Glacier2.Server.Endpoints=tcp -h localhost # Glacier2.PermissionsVerifier=DemoGlacier2/NullPermissionsVerifier -# -# The timeout for inactive sessions. If any client session is inactive -# for longer than this value, the session expires and is removed. The -# unit is seconds. -# -Glacier2.SessionTimeout=30 - # # Glacier can forward requests buffered or unbuffered. Unbuffered # means a lower resource consumption, as buffering requires one diff --git a/csharp/IceStorm/clock/config.icebox b/csharp/IceStorm/clock/config.icebox index 07df371852..6a9d4b9357 100644 --- a/csharp/IceStorm/clock/config.icebox +++ b/csharp/IceStorm/clock/config.icebox @@ -9,7 +9,7 @@ Ice.Admin.InstanceName=icebox # The IceStorm service. The service is configured using a separate # configuration file (see config.service). # -IceBox.Service.IceStorm=IceStormService,37:createIceStorm --Ice.Config=config.service +IceBox.Service.IceStorm=IceStormService,38a0:createIceStorm --Ice.Config=config.service # # Warn about connection exceptions diff --git a/java/Database/library/config.glacier2 b/java/Database/library/config.glacier2 index 3164dd4d3f..d6b7850235 100644 --- a/java/Database/library/config.glacier2 +++ b/java/Database/library/config.glacier2 @@ -29,13 +29,6 @@ Glacier2.SessionManager=LibrarySessionManager:tcp -h localhost -p 10000 # Glacier2.PermissionsVerifier=DemoGlacier2/NullPermissionsVerifier -# -# The timeout for inactive sessions. If any client session is inactive -# for longer than this value, the session expires and is removed. The -# unit is seconds. -# -Glacier2.SessionTimeout=30 - # # Security Tracing # diff --git a/java/Glacier2/callback/config.glacier2 b/java/Glacier2/callback/config.glacier2 index f38ed422cb..ed378f8b38 100644 --- a/java/Glacier2/callback/config.glacier2 +++ b/java/Glacier2/callback/config.glacier2 @@ -23,13 +23,6 @@ Glacier2.Server.Endpoints=tcp -h localhost # Glacier2.PermissionsVerifier=DemoGlacier2/NullPermissionsVerifier -# -# The timeout for inactive sessions. If any client session is inactive -# for longer than this value, the session expires and is removed. The -# unit is seconds. -# -Glacier2.SessionTimeout=30 - # # Glacier can forward requests buffered or unbuffered. Unbuffered # means a lower resource consumption, as buffering requires one diff --git a/java/IceGrid/icebox/application.xml b/java/IceGrid/icebox/application.xml index 23ae94a1ed..c92e331dd6 100644 --- a/java/IceGrid/icebox/application.xml +++ b/java/IceGrid/icebox/application.xml @@ -4,10 +4,10 @@ - - - - + + + + @@ -18,8 +18,7 @@ - + @@ -27,14 +26,12 @@ - - @@ -45,10 +42,7 @@ - + diff --git a/java/IceStorm/clock/config.icebox b/java/IceStorm/clock/config.icebox index c55ca9dcd6..b6b1d14255 100644 --- a/java/IceStorm/clock/config.icebox +++ b/java/IceStorm/clock/config.icebox @@ -9,7 +9,7 @@ Ice.Admin.InstanceName=icebox # The IceStorm service. The service is configured using a separate # configuration file (see config.service). # -IceBox.Service.IceStorm=IceStormService,37:createIceStorm --Ice.Config=config.service +IceBox.Service.IceStorm=IceStormService,38a0:createIceStorm --Ice.Config=config.service # # Warn about connection exceptions diff --git a/make/Make.rules b/make/Make.rules index 436b71e352..f45afe100b 100644 --- a/make/Make.rules +++ b/make/Make.rules @@ -49,8 +49,8 @@ include $(top_srcdir)/make/Make.demos.rules # # The version/soversion variables are used for versionning plugins built with the demos. # -version = 3.7.10 -soversion = 37 +version = 3.8.0 +soversion = 38a0 compatversion = $(version) static_projects = % diff --git a/php/Glacier2/hello/config.glacier2 b/php/Glacier2/hello/config.glacier2 index 31745e1fc2..4ae3f1bf1c 100644 --- a/php/Glacier2/hello/config.glacier2 +++ b/php/Glacier2/hello/config.glacier2 @@ -14,10 +14,3 @@ Glacier2.Client.Endpoints=tcp -p 4063 -h localhost # verifier allows any user-id / password combination. # Glacier2.PermissionsVerifier=DemoGlacier2/NullPermissionsVerifier - -# -# The timeout for inactive sessions. If any client session is inactive -# for longer than this value, the session expires and is removed. The -# unit is seconds. -# -Glacier2.SessionTimeout=30 diff --git a/python/Glacier2/callback/config.glacier2 b/python/Glacier2/callback/config.glacier2 index f930c8cb43..9ee609006e 100644 --- a/python/Glacier2/callback/config.glacier2 +++ b/python/Glacier2/callback/config.glacier2 @@ -23,13 +23,6 @@ Glacier2.Server.Endpoints=tcp -h 127.0.0.1 # Glacier2.PermissionsVerifier=DemoGlacier2/NullPermissionsVerifier -# -# The timeout for inactive sessions. If any client session is inactive -# for longer than this value, the session expires and is removed. The -# unit is seconds. -# -Glacier2.SessionTimeout=30 - # # Glacier can forward requests buffered or unbuffered. Unbuffered # means a lower resource consumption, as buffering requires one diff --git a/python/IceStorm/clock/config.icebox b/python/IceStorm/clock/config.icebox index c55ca9dcd6..b6b1d14255 100644 --- a/python/IceStorm/clock/config.icebox +++ b/python/IceStorm/clock/config.icebox @@ -9,7 +9,7 @@ Ice.Admin.InstanceName=icebox # The IceStorm service. The service is configured using a separate # configuration file (see config.service). # -IceBox.Service.IceStorm=IceStormService,37:createIceStorm --Ice.Config=config.service +IceBox.Service.IceStorm=IceStormService,38a0:createIceStorm --Ice.Config=config.service # # Warn about connection exceptions diff --git a/swift/Glacier2/callback/config.glacier2 b/swift/Glacier2/callback/config.glacier2 index 8abf11f145..e773f87aad 100644 --- a/swift/Glacier2/callback/config.glacier2 +++ b/swift/Glacier2/callback/config.glacier2 @@ -23,13 +23,6 @@ Glacier2.Server.Endpoints=tcp -h localhost # Glacier2.PermissionsVerifier=DemoGlacier2/NullPermissionsVerifier -# -# The timeout for inactive sessions. If any client session is inactive -# for longer than this value, the session expires and is removed. The -# unit is seconds. -# -Glacier2.SessionTimeout=30 - # # Glacier can forward requests buffered or unbuffered. Unbuffered # means a lower resource consumption, as buffering requires one diff --git a/swift/IceStorm/clock/config.icebox b/swift/IceStorm/clock/config.icebox index 31773667a7..f6ef8b4de1 100644 --- a/swift/IceStorm/clock/config.icebox +++ b/swift/IceStorm/clock/config.icebox @@ -10,7 +10,7 @@ Ice.Admin.InstanceName=icebox # The IceStorm service. The service is configured using a separate # configuration file (see config.service). # -IceBox.Service.IceStorm=IceStormService,37:createIceStorm --Ice.Config=config.service +IceBox.Service.IceStorm=IceStormService,38a0:createIceStorm --Ice.Config=config.service # # Warn about connection exceptions