diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/doc/ModuleIce.sgml | 1 | ||||
-rw-r--r-- | cpp/include/Ice/Config.h | 6 | ||||
-rw-r--r-- | cpp/include/Ice/Initialize.h | 5 | ||||
-rw-r--r-- | cpp/include/Ice/LocalException.h | 12 | ||||
-rw-r--r-- | cpp/src/Slice/OutputUtil.h | 9 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 19 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Main.cpp | 7 | ||||
-rw-r--r-- | cpp/src/slice2docbook/Gen.cpp | 1 | ||||
-rw-r--r-- | cpp/src/slice2docbook/Main.cpp | 11 |
9 files changed, 67 insertions, 4 deletions
diff --git a/cpp/doc/ModuleIce.sgml b/cpp/doc/ModuleIce.sgml index 07fcccd5f7d..17d66c998f2 100644 --- a/cpp/doc/ModuleIce.sgml +++ b/cpp/doc/ModuleIce.sgml @@ -9,6 +9,7 @@ All Rights Reserved Generated by the `slice2docbook' converter ********************************************************************** --> +<!-- Ice version 0.0.1 --> <section id="slice2docbook.1"> <title> Ice diff --git a/cpp/include/Ice/Config.h b/cpp/include/Ice/Config.h index 662fe122422..6a192e446b3 100644 --- a/cpp/include/Ice/Config.h +++ b/cpp/include/Ice/Config.h @@ -124,4 +124,10 @@ private: } +// +// The Ice version +// +#define ICE_STRING_VERSION "0.0.1" +#define ICE_INT_VERSION 0x00000001 + #endif diff --git a/cpp/include/Ice/Initialize.h b/cpp/include/Ice/Initialize.h index 1784ba87383..408597cd292 100644 --- a/cpp/include/Ice/Initialize.h +++ b/cpp/include/Ice/Initialize.h @@ -14,9 +14,10 @@ namespace Ice { -ICE_API Communicator_ptr initialize(int&, char*[]); +ICE_API Communicator_ptr initialize(int&, char*[], Int = ICE_INT_VERSION); ICE_API Communicator_ptr initializeWithProperties(int&, char*[], - const Properties_ptr&); + const Properties_ptr&, + Int = ICE_INT_VERSION); ICE_API Properties_ptr createProperties(); ICE_API Properties_ptr loadProperties(const std::string&); diff --git a/cpp/include/Ice/LocalException.h b/cpp/include/Ice/LocalException.h index a2724b12d06..a159c5d219d 100644 --- a/cpp/include/Ice/LocalException.h +++ b/cpp/include/Ice/LocalException.h @@ -52,6 +52,18 @@ public: virtual void raise() const; }; +class ICE_API VersionMismatchException : public LocalException +{ +public: + + VersionMismatchException(const char*, int); + VersionMismatchException(const VersionMismatchException&); + VersionMismatchException& operator=(const VersionMismatchException&); + virtual std::string toString() const; + virtual LocalException* clone() const; + virtual void raise() const; +}; + class ICE_API CommunicatorDestroyedException : public LocalException { public: diff --git a/cpp/src/Slice/OutputUtil.h b/cpp/src/Slice/OutputUtil.h index c88b469eb14..8811af826d5 100644 --- a/cpp/src/Slice/OutputUtil.h +++ b/cpp/src/Slice/OutputUtil.h @@ -75,6 +75,15 @@ Output& operator<<(Output& out, const T& val) return out; } +template<typename T> +Output& operator<<(Output& out, T val) +{ + std::ostringstream s; + s << val; + out.print(s.str().c_str()); + return out; +} + ICE_API Output& operator<<(Output&, const NextLine&); ICE_API Output& operator<<(Output&, const StartBlock&); ICE_API Output& operator<<(Output&, const EndBlock&); diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 93ff60c61b2..3225095bfa8 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -136,6 +136,24 @@ Slice::Gen::generate(const Unit_ptr& unit) H << "\n#include <" << changeInclude(*q) << ".h>"; } + H << sp; + H.zeroIndent(); + H << "\n#ifndef ICE_IGNORE_VERSION"; + H << "\n# if ICE_INT_VERSION != 0x" << hex << ICE_INT_VERSION; + H << "\n# error Ice version mismatch!"; + H << "\n# endif"; + H << "\n#endif"; + H.restoreIndent(); + + C << sp; + C.zeroIndent(); + C << "\n#ifndef ICE_IGNORE_VERSION"; + C << "\n# if ICE_INT_VERSION != 0x" << hex << ICE_INT_VERSION; + C << "\n# error Ice version mismatch!"; + C << "\n# endif"; + C << "\n#endif"; + C.restoreIndent(); + ProxyDeclVisitor proxyDeclVisitor(H, C, dllExport_); unit -> visit(&proxyDeclVisitor); @@ -204,6 +222,7 @@ Slice::Gen::printHeader(Output& out) out << header; out << "\n// Generated from file `" << changeInclude(base_) << ".ice'"; + out << "\n// Ice version " << ICE_STRING_VERSION; out << '\n'; } diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp index 16633aa5531..21575b54eb3 100644 --- a/cpp/src/slice2cpp/Main.cpp +++ b/cpp/src/slice2cpp/Main.cpp @@ -21,6 +21,7 @@ usage(const char* n) cerr << "Options:\n" "-h, --help Show this message.\n" +"-v, --version Display the Ice version.\n" "-DNAME Define NAME as 1.\n" "-DNAME=DEF Define NAME as DEF.\n" "-UNAME Remove any definition for NAME.\n" @@ -72,6 +73,12 @@ main(int argc, char* argv[]) usage(argv[0]); return EXIT_SUCCESS; } + else if(strcmp(argv[idx], "-v") == 0 || + strcmp(argv[idx], "--version") == 0) + { + cout << ICE_STRING_VERSION << endl; + return EXIT_SUCCESS; + } else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0) { diff --git a/cpp/src/slice2docbook/Gen.cpp b/cpp/src/slice2docbook/Gen.cpp index 50f7253ab58..655fde98747 100644 --- a/cpp/src/slice2docbook/Gen.cpp +++ b/cpp/src/slice2docbook/Gen.cpp @@ -516,6 +516,7 @@ Slice::Gen::printHeader() O.zeroIndent(); O << header; + O << "\n<!-- Ice version " << ICE_STRING_VERSION << " -->"; O.restoreIndent(); } diff --git a/cpp/src/slice2docbook/Main.cpp b/cpp/src/slice2docbook/Main.cpp index 058f3d287ed..adba203cb80 100644 --- a/cpp/src/slice2docbook/Main.cpp +++ b/cpp/src/slice2docbook/Main.cpp @@ -20,13 +20,14 @@ usage(const char* n) cerr << "Usage: " << n << " [options] docbook-file slice-files ...\n"; cerr << "Options:\n" -"-s, --stand-alone Create stand-alone docbook file.\n" -"--no-globals Don't document the global module.\n" "-h, --help Show this message.\n" +"-v, --version Display the Ice version.\n" "-DNAME Define NAME as 1.\n" "-DNAME=DEF Define NAME as DEF.\n" "-UNAME Remove any definition for NAME.\n" "-IDIR Put DIR in the include file search path.\n" +"-s, --stand-alone Create stand-alone docbook file.\n" +"--no-globals Don't document the global module.\n" "-d, --debug Print debug messages.\n" ; } @@ -87,6 +88,12 @@ main(int argc, char* argv[]) usage(argv[0]); return EXIT_SUCCESS; } + else if(strcmp(argv[idx], "-v") == 0 || + strcmp(argv[idx], "--version") == 0) + { + cout << ICE_STRING_VERSION << endl; + return EXIT_SUCCESS; + } else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0) { |