summaryrefslogtreecommitdiff
path: root/ACE/contrib
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2008-03-04 14:51:23 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2008-03-04 14:51:23 +0000
commit99aa8c60282c7b8072eb35eb9ac815702f5bf586 (patch)
treebda96bf8c3a4c2875a083d7b16720533c8ffeaf4 /ACE/contrib
parentc4078c377d74290ebe4e66da0b4975da91732376 (diff)
downloadATCD-99aa8c60282c7b8072eb35eb9ac815702f5bf586.tar.gz
undoing accidental deletion
Diffstat (limited to 'ACE/contrib')
-rw-r--r--ACE/contrib/FaCE/ACE.icobin0 -> 1078 bytes
-rw-r--r--ACE/contrib/FaCE/ACE_Racer.bmpbin0 -> 9918 bytes
-rw-r--r--ACE/contrib/FaCE/CE_ARGV.CPP118
-rw-r--r--ACE/contrib/FaCE/CE_ARGV.H90
-rw-r--r--ACE/contrib/FaCE/CE_Screen_Output.cpp166
-rw-r--r--ACE/contrib/FaCE/CE_Screen_Output.h97
-rw-r--r--ACE/contrib/FaCE/FACE.icobin0 -> 1078 bytes
-rw-r--r--ACE/contrib/FaCE/FaCE.cpp656
-rw-r--r--ACE/contrib/FaCE/FaCE.h57
-rw-r--r--ACE/contrib/FaCE/FaCE.mpc16
-rw-r--r--ACE/contrib/FaCE/FaCE.rc268
-rw-r--r--ACE/contrib/FaCE/FaCENOACE.mpc16
-rw-r--r--ACE/contrib/FaCE/FaCE_OS.h38
-rw-r--r--ACE/contrib/FaCE/License.txt27
-rw-r--r--ACE/contrib/FaCE/Main.cpp49
-rw-r--r--ACE/contrib/FaCE/README287
-rw-r--r--ACE/contrib/FaCE/TAO.bmpbin0 -> 21798 bytes
-rw-r--r--ACE/contrib/FaCE/newres.h43
-rw-r--r--ACE/contrib/FaCE/resource.h45
-rw-r--r--ACE/contrib/minizip/ChangeLogUnzip67
-rw-r--r--ACE/contrib/minizip/crypt.h136
-rw-r--r--ACE/contrib/minizip/ioapi.c169
-rw-r--r--ACE/contrib/minizip/ioapi.h78
-rw-r--r--ACE/contrib/minizip/miniunz.c587
-rw-r--r--ACE/contrib/minizip/minizip.c422
-rw-r--r--ACE/contrib/minizip/minizip.mpc23
-rw-r--r--ACE/contrib/minizip/minizip_export.h33
-rw-r--r--ACE/contrib/minizip/mztools.c282
-rw-r--r--ACE/contrib/minizip/mztools.h32
-rw-r--r--ACE/contrib/minizip/unzip.c1536
-rw-r--r--ACE/contrib/minizip/unzip.h368
-rw-r--r--ACE/contrib/minizip/zip.c1164
-rw-r--r--ACE/contrib/minizip/zip.h245
-rw-r--r--ACE/contrib/utility/BuildRules/Archive.gcc.post.rules47
-rw-r--r--ACE/contrib/utility/BuildRules/Archive.gcc.pre.rules28
-rw-r--r--ACE/contrib/utility/BuildRules/Archive.post.rules7
-rw-r--r--ACE/contrib/utility/BuildRules/Archive.pre.rules7
-rw-r--r--ACE/contrib/utility/BuildRules/Bootstrap.rules95
-rw-r--r--ACE/contrib/utility/BuildRules/Documentation.post.rules35
-rw-r--r--ACE/contrib/utility/BuildRules/Documentation.pre.rules18
-rw-r--r--ACE/contrib/utility/BuildRules/Executable.gcc.post.rules46
-rw-r--r--ACE/contrib/utility/BuildRules/Executable.gcc.pre.rules26
-rw-r--r--ACE/contrib/utility/BuildRules/Executable.generic.post.rules55
-rw-r--r--ACE/contrib/utility/BuildRules/Executable.generic.pre.rules26
-rw-r--r--ACE/contrib/utility/BuildRules/Executable.post.rules8
-rw-r--r--ACE/contrib/utility/BuildRules/Executable.pre.rules8
-rw-r--r--ACE/contrib/utility/BuildRules/Object.gcc.post.rules38
-rw-r--r--ACE/contrib/utility/BuildRules/Object.gcc.pre.rules22
-rw-r--r--ACE/contrib/utility/BuildRules/Object.post.rules7
-rw-r--r--ACE/contrib/utility/BuildRules/Object.pre.rules7
-rw-r--r--ACE/contrib/utility/BuildRules/Recursion.post.rules37
-rw-r--r--ACE/contrib/utility/BuildRules/Recursion.pre.rules13
-rw-r--r--ACE/contrib/utility/BuildRules/Shared.gcc.post.rules43
-rw-r--r--ACE/contrib/utility/BuildRules/Shared.gcc.pre.rules26
-rw-r--r--ACE/contrib/utility/BuildRules/Shared.generic.post.rules51
-rw-r--r--ACE/contrib/utility/BuildRules/Shared.generic.pre.rules26
-rw-r--r--ACE/contrib/utility/BuildRules/Shared.post.rules7
-rw-r--r--ACE/contrib/utility/BuildRules/Shared.pre.rules7
-rw-r--r--ACE/contrib/utility/BuildRules/Thoughts55
-rw-r--r--ACE/contrib/utility/Documentation/Build.xhtml58
-rw-r--r--ACE/contrib/utility/Documentation/CommandLine/News.xhtml31
-rw-r--r--ACE/contrib/utility/Documentation/CommandLine/Terminology.xhtml272
-rw-r--r--ACE/contrib/utility/Documentation/CommandLine/Thoughts8
-rw-r--r--ACE/contrib/utility/Documentation/CommandLine/index.xhtml39
-rw-r--r--ACE/contrib/utility/Documentation/ExH/Compound.hpp.html50
-rw-r--r--ACE/contrib/utility/Documentation/ExH/Example/Makefile26
-rw-r--r--ACE/contrib/utility/Documentation/ExH/Example/bad_cast.cpp.html63
-rw-r--r--ACE/contrib/utility/Documentation/ExH/Example/compound.cpp.html153
-rw-r--r--ACE/contrib/utility/Documentation/ExH/Example/hello_world.cpp.html152
-rw-r--r--ACE/contrib/utility/Documentation/ExH/Example/logic_to_system.cpp.html69
-rw-r--r--ACE/contrib/utility/Documentation/ExH/Logic/DescriptiveException.hpp.html61
-rw-r--r--ACE/contrib/utility/Documentation/ExH/Logic/Exception.hpp.html43
-rw-r--r--ACE/contrib/utility/Documentation/ExH/Logic/Makefile20
-rw-r--r--ACE/contrib/utility/Documentation/ExH/Makefile16
-rw-r--r--ACE/contrib/utility/Documentation/ExH/Makefile.documentation20
-rw-r--r--ACE/contrib/utility/Documentation/ExH/News.xhtml47
-rw-r--r--ACE/contrib/utility/Documentation/ExH/System/DescriptiveException.hpp.html64
-rw-r--r--ACE/contrib/utility/Documentation/ExH/System/Exception.hpp.html32
-rw-r--r--ACE/contrib/utility/Documentation/ExH/System/Makefile20
-rw-r--r--ACE/contrib/utility/Documentation/ExH/index.xhtml60
-rw-r--r--ACE/contrib/utility/Documentation/Hetero/News.xhtml31
-rw-r--r--ACE/contrib/utility/Documentation/Hetero/index.xhtml62
-rw-r--r--ACE/contrib/utility/Documentation/Introspection/News.xhtml38
-rw-r--r--ACE/contrib/utility/Documentation/Introspection/index.xhtml42
-rw-r--r--ACE/contrib/utility/Documentation/Makefile16
-rw-r--r--ACE/contrib/utility/Documentation/News.xhtml72
-rw-r--r--ACE/contrib/utility/Documentation/ReferenceCounting/DefaultImpl.hpp.html93
-rw-r--r--ACE/contrib/utility/Documentation/ReferenceCounting/Interface.hpp.html82
-rw-r--r--ACE/contrib/utility/Documentation/ReferenceCounting/Makefile22
-rw-r--r--ACE/contrib/utility/Documentation/ReferenceCounting/News.xhtml90
-rw-r--r--ACE/contrib/utility/Documentation/ReferenceCounting/SmartPtr.hpp.html103
-rw-r--r--ACE/contrib/utility/Documentation/ReferenceCounting/StrictPtr.hpp.html107
-rw-r--r--ACE/contrib/utility/Documentation/ReferenceCounting/index.xhtml50
-rw-r--r--ACE/contrib/utility/Documentation/ReleaseProcess13
-rw-r--r--ACE/contrib/utility/Documentation/Style/CXX.css9
-rw-r--r--ACE/contrib/utility/Documentation/Style/CXX_Blue.css25
-rw-r--r--ACE/contrib/utility/Documentation/Style/Default.css45
-rw-r--r--ACE/contrib/utility/Documentation/Synch/Makefile16
-rw-r--r--ACE/contrib/utility/Documentation/Synch/News.xhtml36
-rw-r--r--ACE/contrib/utility/Documentation/Synch/Policy/Makefile20
-rw-r--r--ACE/contrib/utility/Documentation/Synch/Policy/Null.hpp.html59
-rw-r--r--ACE/contrib/utility/Documentation/Synch/index.xhtml48
-rw-r--r--ACE/contrib/utility/Documentation/TODO53
-rw-r--r--ACE/contrib/utility/Documentation/Template.xhtml33
-rw-r--r--ACE/contrib/utility/Documentation/Thoughts/Enum/EnumCount95
-rw-r--r--ACE/contrib/utility/Documentation/Thoughts/Enum/EnumCount217
-rw-r--r--ACE/contrib/utility/Documentation/Thoughts/Enum/EnumInfo45
-rw-r--r--ACE/contrib/utility/Documentation/index.xhtml81
-rw-r--r--ACE/contrib/utility/Example/CommandLine/Foo/command.cpp88
-rw-r--r--ACE/contrib/utility/Example/CommandLine/Foo/foo.cpp184
-rw-r--r--ACE/contrib/utility/Example/ExH/BadCast/Makefile24
-rw-r--r--ACE/contrib/utility/Example/ExH/BadCast/bad_cast.cpp54
-rw-r--r--ACE/contrib/utility/Example/ExH/Compound/Makefile24
-rw-r--r--ACE/contrib/utility/Example/ExH/Compound/compound.cpp144
-rw-r--r--ACE/contrib/utility/Example/ExH/HelloWorld/Makefile24
-rw-r--r--ACE/contrib/utility/Example/ExH/HelloWorld/hello_world.cpp142
-rw-r--r--ACE/contrib/utility/Example/ExH/LogicToSystem/Makefile24
-rw-r--r--ACE/contrib/utility/Example/ExH/LogicToSystem/logic_to_system.cpp60
-rw-r--r--ACE/contrib/utility/Example/ExH/Makefile16
-rw-r--r--ACE/contrib/utility/Example/Hetero/Container/Makefile24
-rw-r--r--ACE/contrib/utility/Example/Hetero/Container/container.cpp112
-rw-r--r--ACE/contrib/utility/Example/Hetero/Makefile16
-rw-r--r--ACE/contrib/utility/Example/Introspection/InheritanceTree/Hierarchy.cpp104
-rw-r--r--ACE/contrib/utility/Example/Introspection/InheritanceTree/Hierarchy.hpp61
-rw-r--r--ACE/contrib/utility/Example/Introspection/InheritanceTree/Makefile22
-rw-r--r--ACE/contrib/utility/Example/Introspection/InheritanceTree/inheritance_tree.cpp65
-rw-r--r--ACE/contrib/utility/Example/Introspection/Makefile16
-rw-r--r--ACE/contrib/utility/Example/Introspection/Traversal/Makefile22
-rw-r--r--ACE/contrib/utility/Example/Introspection/Traversal/SyntaxTree.cpp119
-rw-r--r--ACE/contrib/utility/Example/Introspection/Traversal/SyntaxTree.hpp95
-rw-r--r--ACE/contrib/utility/Example/Introspection/Traversal/Traversal.cpp105
-rw-r--r--ACE/contrib/utility/Example/Introspection/Traversal/Traversal.hpp157
-rw-r--r--ACE/contrib/utility/Example/Introspection/Traversal/driver.cpp93
-rw-r--r--ACE/contrib/utility/Example/Makefile16
-rw-r--r--ACE/contrib/utility/Makefile18
-rw-r--r--ACE/contrib/utility/Test/ExH/Compound/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ExH/Compound/compound.cpp115
-rw-r--r--ACE/contrib/utility/Test/ExH/Converter/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ExH/Converter/converter.cpp50
-rw-r--r--ACE/contrib/utility/Test/ExH/Inline/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ExH/Inline/inline.cpp19
-rw-r--r--ACE/contrib/utility/Test/ExH/Inline/unit.cpp8
-rw-r--r--ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp110
-rw-r--r--ACE/contrib/utility/Test/ExH/Logic/Makefile16
-rw-r--r--ACE/contrib/utility/Test/ExH/Makefile16
-rw-r--r--ACE/contrib/utility/Test/ExH/System/DescriptiveException/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ExH/System/DescriptiveException/descriptive_exception.cpp109
-rw-r--r--ACE/contrib/utility/Test/ExH/System/Makefile16
-rw-r--r--ACE/contrib/utility/Test/Introspection/Inline/Makefile24
-rw-r--r--ACE/contrib/utility/Test/Introspection/Inline/inline.cpp20
-rw-r--r--ACE/contrib/utility/Test/Introspection/Inline/unit.cpp8
-rw-r--r--ACE/contrib/utility/Test/Introspection/Makefile16
-rw-r--r--ACE/contrib/utility/Test/Makefile18
-rw-r--r--ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/default_impl.cpp132
-rw-r--r--ACE/contrib/utility/Test/ReferenceCounting/Inline/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ReferenceCounting/Inline/inline.cpp16
-rw-r--r--ACE/contrib/utility/Test/ReferenceCounting/Inline/unit.cpp8
-rw-r--r--ACE/contrib/utility/Test/ReferenceCounting/Interface/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ReferenceCounting/Interface/interface.cpp104
-rw-r--r--ACE/contrib/utility/Test/ReferenceCounting/Makefile16
-rw-r--r--ACE/contrib/utility/Test/ReferenceCounting/SmartPtr/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ReferenceCounting/SmartPtr/smart_ptr.cpp220
-rw-r--r--ACE/contrib/utility/Test/ReferenceCounting/StrictPtr/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ReferenceCounting/StrictPtr/strict_ptr.cpp218
-rw-r--r--ACE/contrib/utility/Test/Synch/Inline/Makefile24
-rw-r--r--ACE/contrib/utility/Test/Synch/Inline/inline.cpp20
-rw-r--r--ACE/contrib/utility/Test/Synch/Inline/unit.cpp8
-rw-r--r--ACE/contrib/utility/Test/Synch/Makefile16
-rw-r--r--ACE/contrib/utility/Utility/ExH/Compound.hpp49
-rw-r--r--ACE/contrib/utility/Utility/ExH/Compound.tpp74
-rw-r--r--ACE/contrib/utility/Utility/ExH/Converter.hpp24
-rw-r--r--ACE/contrib/utility/Utility/ExH/Converter.tpp19
-rw-r--r--ACE/contrib/utility/Utility/ExH/ExH.hpp22
-rw-r--r--ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.hpp65
-rw-r--r--ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp106
-rw-r--r--ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.tpp23
-rw-r--r--ACE/contrib/utility/Utility/ExH/Logic/Exception.hpp42
-rw-r--r--ACE/contrib/utility/Utility/ExH/Logic/Exception.ipp20
-rw-r--r--ACE/contrib/utility/Utility/ExH/StringStreamConverter.hpp26
-rw-r--r--ACE/contrib/utility/Utility/ExH/StringStreamConverter.ipp18
-rw-r--r--ACE/contrib/utility/Utility/ExH/System/DescriptiveException.hpp65
-rw-r--r--ACE/contrib/utility/Utility/ExH/System/DescriptiveException.ipp91
-rw-r--r--ACE/contrib/utility/Utility/ExH/System/DescriptiveException.tpp23
-rw-r--r--ACE/contrib/utility/Utility/ExH/System/Exception.hpp29
-rw-r--r--ACE/contrib/utility/Utility/Hetero/Container.hpp182
-rw-r--r--ACE/contrib/utility/Utility/Hetero/Shell.hpp86
-rw-r--r--ACE/contrib/utility/Utility/Hetero/TypeList.hpp46
-rw-r--r--ACE/contrib/utility/Utility/Hetero/TypedContainer.hpp57
-rw-r--r--ACE/contrib/utility/Utility/Hetero/Vector.hpp47
-rw-r--r--ACE/contrib/utility/Utility/Introspection/Introspection.hpp14
-rw-r--r--ACE/contrib/utility/Utility/Introspection/Makefile19
-rw-r--r--ACE/contrib/utility/Utility/Introspection/Object.cpp24
-rw-r--r--ACE/contrib/utility/Utility/Introspection/Object.hpp47
-rw-r--r--ACE/contrib/utility/Utility/Introspection/Object.ipp48
-rw-r--r--ACE/contrib/utility/Utility/Introspection/TypeId.cpp21
-rw-r--r--ACE/contrib/utility/Utility/Introspection/TypeId.hpp47
-rw-r--r--ACE/contrib/utility/Utility/Introspection/TypeId.ipp37
-rw-r--r--ACE/contrib/utility/Utility/Introspection/TypeId.tpp18
-rw-r--r--ACE/contrib/utility/Utility/Introspection/TypeInfo.hpp104
-rw-r--r--ACE/contrib/utility/Utility/Introspection/TypeInfo.ipp77
-rw-r--r--ACE/contrib/utility/Utility/Makefile16
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.hpp97
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.ipp105
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.hpp60
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.ipp122
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/Interface.hpp80
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/Interface.ipp22
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/Interface.tpp19
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/ReferenceCounting.hpp16
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.hpp97
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.tpp164
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.hpp102
-rw-r--r--ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.tpp161
-rw-r--r--ACE/contrib/utility/Utility/Synch/Policy/Null.hpp54
-rw-r--r--ACE/contrib/utility/Utility/Synch/Policy/Null.ipp20
-rw-r--r--ACE/contrib/utility/Vault/StringConverter.hpp27
-rw-r--r--ACE/contrib/utility/Vault/StringConverter.ipp18
-rw-r--r--ACE/contrib/utility/Vault/hetero/map13
-rw-r--r--ACE/contrib/utility/Vault/hetero/map.hpp249
-rw-r--r--ACE/contrib/utility/Vault/hetero/map.tpp12
-rw-r--r--ACE/contrib/utility/Version3
-rw-r--r--ACE/contrib/utility/license.html79
224 files changed, 17069 insertions, 0 deletions
diff --git a/ACE/contrib/FaCE/ACE.ico b/ACE/contrib/FaCE/ACE.ico
new file mode 100644
index 00000000000..3efedc9021b
--- /dev/null
+++ b/ACE/contrib/FaCE/ACE.ico
Binary files differ
diff --git a/ACE/contrib/FaCE/ACE_Racer.bmp b/ACE/contrib/FaCE/ACE_Racer.bmp
new file mode 100644
index 00000000000..a487f63f81c
--- /dev/null
+++ b/ACE/contrib/FaCE/ACE_Racer.bmp
Binary files differ
diff --git a/ACE/contrib/FaCE/CE_ARGV.CPP b/ACE/contrib/FaCE/CE_ARGV.CPP
new file mode 100644
index 00000000000..6b97a30b640
--- /dev/null
+++ b/ACE/contrib/FaCE/CE_ARGV.CPP
@@ -0,0 +1,118 @@
+// $Id$
+
+#include "CE_ARGV.H"
+
+
+CE_ARGV::CE_ARGV(wchar_t* cmdLine)
+: ce_argv_(0)
+, ce_argc_(0)
+{
+ const wchar_t* dummyArgv = L"root"; // dummy for the first argv
+ const wchar_t* separator = L" "; // blank space is a separator
+
+ int formattedCmdLineLength = wcslen(dummyArgv) +
+ wcslen(separator) +
+ 1; // 1 is for the NULL at the end
+
+ if (wcslen(cmdLine) > 0) {
+ formattedCmdLineLength += wcslen(cmdLine);
+ formattedCmdLineLength += wcslen(separator);
+ }
+
+ // formattedCmdLine will have dummyArgv and a separator at the beginning of cmdLine
+ // and a separator at the end to generalize format and reduce the amount of code
+ wchar_t* formattedCmdLine = 0;
+ formattedCmdLine = new wchar_t[formattedCmdLineLength];
+
+ wcscpy(formattedCmdLine, dummyArgv);
+ wcscat(formattedCmdLine, separator);
+
+ int max_possible_argc = 1; // start with 1 because of the dummyArgv at the beginning
+
+ if (wcslen(cmdLine) > 0) {
+ int formattedPos = wcslen(formattedCmdLine);
+ int cmdLineLength = wcslen(cmdLine);
+
+ // Inside of this for loop, it does same thing as strcat except it
+ // checks and puts only one single white space between two argv entries.
+ for (int i = 0; i < cmdLineLength; ++i) {
+ if (iswspace(cmdLine[i]) != 0) {
+ ++max_possible_argc; // counting the number of white spaces
+ }
+
+ formattedCmdLine[formattedPos++] = cmdLine[i];
+
+ if (iswspace(cmdLine[i]) != 0) {
+ // make sure there is only one white space between two argv entries.
+ while ((i < cmdLineLength) && (iswspace(cmdLine[i + 1]) != 0)) {
+ ++i;
+ }
+ }
+ }
+
+ formattedCmdLine[formattedPos] = 0;
+ wcscat(formattedCmdLine, separator); // make sure formattedCmdLine ends with a blank
+ }
+
+ int formattedCmdLength = wcslen(formattedCmdLine);
+
+ bool insideQuotation = false;
+ int* argv_strlen = 0;
+ int entry_size = 0;
+ argv_strlen = new int[max_possible_argc];
+
+ // determine argc
+ for (int i = 0; i < formattedCmdLength; ++i) {
+ if (formattedCmdLine[i] == '\\') {
+ ++i; // ignore the following character
+ ++entry_size;
+ }
+ else if (formattedCmdLine[i] == '"') {
+ insideQuotation = !insideQuotation;
+ }
+ else if ((!insideQuotation) && (iswspace(formattedCmdLine[i]) != 0)) {
+ // new argv entry end found
+ argv_strlen[ce_argc_++] = entry_size; // cache the size of this entry
+ entry_size = 0;
+ }
+ else {
+ ++entry_size;
+ }
+ }
+
+ ce_argv_ = new wchar_t*[ce_argc_ + 1];
+ ce_argv_[ce_argc_] = 0; // Last command line entry is a NULL.
+
+ for (int j = 0, cmdLinePos = 0; j < ce_argc_; ++j, ++cmdLinePos) {
+ int length = argv_strlen[j];
+
+ ce_argv_[j] = new wchar_t[length + 1];
+ ce_argv_[j][length] = 0; // string termination null
+
+ if (iswspace(formattedCmdLine[cmdLinePos]) != 0) {
+ // This is where prior argv has trailing '"' at the end.
+ ++cmdLinePos;
+ }
+
+ for (int n = 0; n < length; ++n, ++cmdLinePos) {
+ if ((formattedCmdLine[cmdLinePos] == '\\') || (formattedCmdLine[cmdLinePos] == '"')) {
+ ++cmdLinePos;
+ }
+
+ ce_argv_[j][n] = formattedCmdLine[cmdLinePos];
+ }
+ }
+
+ delete argv_strlen;
+ delete formattedCmdLine;
+}
+
+
+CE_ARGV::~CE_ARGV(void)
+{
+ for (int i = 0; i < ce_argc_; ++i) {
+ delete [] ce_argv_[i];
+ }
+
+ delete [] ce_argv_;
+}
diff --git a/ACE/contrib/FaCE/CE_ARGV.H b/ACE/contrib/FaCE/CE_ARGV.H
new file mode 100644
index 00000000000..78e848abae1
--- /dev/null
+++ b/ACE/contrib/FaCE/CE_ARGV.H
@@ -0,0 +1,90 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file CE_ARGV.H
+ *
+ * $Id$
+ *
+ * @author Si Mong Park <spark@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef CE_ARGV_H
+#define CE_ARGV_H
+
+#include <windows.h>
+
+
+/**
+ * @class CE_ARGV
+ *
+ * @brief This class is to hash input parameters, argc and argv, for WinCE platform.
+ *
+ * Since WinCE only supports wchar_t as an input from OS, some implementation detail,
+ * especially for CORBA spec, will not support wchar_t (wchar_t) type parameter.
+ * Moreover, WinCE's input parameter type is totally different than any other OS;
+ * all command line parameters will be stored in a single wide-character string with
+ * each unit parameter divided by blank space, and it does not provide the name of
+ * executable (generally known as argv[0]).
+ * This class is to convert CE's command line parameters and simulate as in the same
+ * manner as other general platforms, adding 'root' as a first argc, which is for the
+ * name of executable in other OS.
+ */
+class CE_ARGV
+{
+public:
+ /**
+ * Ctor accepts CE command line as a paramter.
+ */
+ CE_ARGV(wchar_t* cmdLine);
+
+ /**
+ * Default Dtor that deletes any memory allocated for the converted string.
+ */
+ ~CE_ARGV(void);
+
+ /**
+ * Returns the number of command line paramters, same as argc on Unix.
+ */
+ int argc(void);
+
+ /**
+ * Returns the 'char**' that contains the converted command line parameters.
+ */
+ wchar_t** const argv(void);
+
+private:
+ /**
+ * Copy Ctor is not allowed.
+ */
+ CE_ARGV(void);
+
+ /**
+ * Copy Ctor is not allowed.
+ */
+ CE_ARGV(CE_ARGV&);
+
+ /**
+ * Pointer of converted command line paramters.
+ */
+ wchar_t** ce_argv_;
+
+ /**
+ * Integer that is same as argc on other OS's.
+ */
+ int ce_argc_;
+};
+
+
+inline int CE_ARGV::argc()
+{
+ return ce_argc_;
+}
+
+
+inline wchar_t** const CE_ARGV::argv()
+{
+ return ce_argv_;
+}
+
+#endif // CE_ARGV_H
diff --git a/ACE/contrib/FaCE/CE_Screen_Output.cpp b/ACE/contrib/FaCE/CE_Screen_Output.cpp
new file mode 100644
index 00000000000..caeebed5e4d
--- /dev/null
+++ b/ACE/contrib/FaCE/CE_Screen_Output.cpp
@@ -0,0 +1,166 @@
+// $Id$
+
+#include "CE_Screen_Output.h"
+#include <string.h>
+
+// This utility does not use ACE, and shouldn't.
+//FUZZ: disable check_for_lack_ACE_OS
+
+HWND CE_Screen_Output::handler_ = 0;
+
+
+CE_Screen_Output::CE_Screen_Output()
+: pFile_(0)
+{
+}
+
+
+CE_Screen_Output::~CE_Screen_Output()
+{
+ if (pFile_ != 0) {
+ fclose(pFile_);
+ }
+}
+
+
+void CE_Screen_Output::SetOutputWindow(HWND hEdit)
+{
+ handler_ = hEdit;
+}
+
+
+void CE_Screen_Output::clear()
+{
+ SetWindowText(handler_, 0);
+}
+
+
+CE_Screen_Output& CE_Screen_Output::operator << (wchar_t* output)
+{
+ int length = GetWindowTextLength(handler_);
+ SendMessage(handler_, EM_SETSEL, length, length);
+ SendMessage(handler_, EM_REPLACESEL, 0, (LPARAM)output);
+
+ if (pFile_ != 0)
+ {
+ fwprintf(pFile_, L"%s", output);
+ }
+
+ return *this;
+}
+
+
+CE_Screen_Output& CE_Screen_Output::operator << (const wchar_t* output)
+{
+ wchar_t* buffer = _wcsdup(output);
+ if (buffer != 0)
+ {
+ *this << buffer;
+ delete buffer;
+ }
+ return *this;
+}
+
+
+CE_Screen_Output& CE_Screen_Output::operator << (char* output)
+{
+ int len = MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, output, -1, 0, 0);
+ wchar_t* w_output = new wchar_t[len];
+
+ MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, output, -1, w_output, len);
+ *this << w_output;
+
+ delete w_output;
+
+ return *this;
+}
+
+
+CE_Screen_Output& CE_Screen_Output::operator << (const char* output)
+{
+ int len = MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, output, -1, 0, 0);
+ wchar_t* w_output = new wchar_t[len];
+
+ MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, output, -1, w_output, len);
+ *this << w_output;
+
+ delete w_output;
+ return *this;
+}
+
+
+CE_Screen_Output& CE_Screen_Output::operator << (char output)
+{
+ *this << (int)output;
+ return *this;
+}
+
+
+CE_Screen_Output& CE_Screen_Output::operator << (unsigned char output)
+{
+ *this << (int)output;
+ return *this;
+}
+
+
+CE_Screen_Output& CE_Screen_Output::operator << (unsigned short output)
+{
+ wchar_t buffer[20];
+ wsprintf(buffer, L"%u", output);
+ *this << buffer;
+ return *this;
+}
+
+
+CE_Screen_Output& CE_Screen_Output::operator << (int output)
+{
+ wchar_t buffer[20];
+ wsprintf(buffer, L"%d", output);
+ *this << buffer;
+ return *this;
+}
+
+
+CE_Screen_Output& CE_Screen_Output::operator << (unsigned int output)
+{
+ wchar_t buffer[20];
+ wsprintf(buffer, L"%du", output);
+ *this << buffer;
+ return *this;
+}
+
+
+CE_Screen_Output& CE_Screen_Output::operator << (float output)
+{
+ wchar_t buffer[20];
+ swprintf(buffer, L"%f", output);
+ *this << buffer;
+ return *this;
+}
+
+
+CE_Screen_Output& CE_Screen_Output::operator << (long output)
+{
+ wchar_t buffer[20];
+ wsprintf(buffer, L"%l", output);
+ *this << buffer;
+ return *this;
+}
+
+
+CE_Screen_Output& CE_Screen_Output::operator << (unsigned long output)
+{
+ wchar_t buffer[20];
+ wsprintf(buffer, L"%lu", output);
+ *this << buffer;
+ return *this;
+}
+
+
+CE_Screen_Output& CE_Screen_Output::operator << (FILE* pFile)
+{
+ pFile_ = pFile;
+ return *this;
+}
+
+//FUZZ: enable check_for_lack_ACE_OS
diff --git a/ACE/contrib/FaCE/CE_Screen_Output.h b/ACE/contrib/FaCE/CE_Screen_Output.h
new file mode 100644
index 00000000000..9f29c9cf30f
--- /dev/null
+++ b/ACE/contrib/FaCE/CE_Screen_Output.h
@@ -0,0 +1,97 @@
+/**
+ * @file CE_Screen_Output.h
+ *
+ * $Id$
+ *
+ * @author Si Mong Park <spark@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef CE_Screen_Output_h
+#define CE_Screen_Output_h
+
+#include <windows.h>
+
+const wchar_t endl[] = L"\r\n";
+const wchar_t tab[] = L"\t";
+
+/**
+ * @class CE_Screen_Output
+ *
+ * @brief Replacement of text output for Windows CE.
+ *
+ * This class allows standard text output to be displayed on
+ * text window for Windows CE. Generally, all ACE output will
+ * go through under CE if and only if user uses WindozeCE
+ * implementation by using main_ce instead of main.
+ * Also, for the easier debugging purpose, object pointer of
+ * this class can be gotten from ACE_Log_Msg::msg_callback()
+ * and then can be used directly by user just like cout stream.
+ */
+class CE_Screen_Output
+{
+public:
+ /**
+ * Default Ctor
+ */
+ CE_Screen_Output();
+
+ /**
+ * Default Dtor
+ */
+ virtual ~CE_Screen_Output();
+
+ /**
+ * Interface to specify active window handle.
+ */
+ void SetOutputWindow(HWND hWnd);
+
+ /**
+ * Clears text screen.
+ */
+ void clear();
+
+ /**
+ * << operator that performs actual print out.
+ *
+ * Note: This is the only one operator that performs
+ * output. All other perators convert the type and
+ * use this operator underneath.
+ */
+ CE_Screen_Output& operator << (wchar_t*);
+ CE_Screen_Output& operator << (const wchar_t*);
+
+ CE_Screen_Output& operator << (char* output);
+ CE_Screen_Output& operator << (const char* output);
+
+ CE_Screen_Output& operator << (char output);
+ CE_Screen_Output& operator << (unsigned char output);
+
+ CE_Screen_Output& operator << (unsigned short output);
+
+ CE_Screen_Output& operator << (int output);
+ CE_Screen_Output& operator << (unsigned int output);
+
+ CE_Screen_Output& operator << (float output);
+
+ CE_Screen_Output& operator << (long output);
+ CE_Screen_Output& operator << (unsigned long output);
+
+ CE_Screen_Output& operator << (FILE* pFile);
+
+private:
+ /**
+ * Copy Ctor
+ */
+ CE_Screen_Output(CE_Screen_Output&);
+
+ static HWND handler_;
+
+ /**
+ * File pointer that used to save output to file.
+ * This class does not own the file handler pointer.
+ */
+ FILE* pFile_;
+};
+
+#endif // CE_Screen_Output_h
diff --git a/ACE/contrib/FaCE/FACE.ico b/ACE/contrib/FaCE/FACE.ico
new file mode 100644
index 00000000000..8a91925b128
--- /dev/null
+++ b/ACE/contrib/FaCE/FACE.ico
Binary files differ
diff --git a/ACE/contrib/FaCE/FaCE.cpp b/ACE/contrib/FaCE/FaCE.cpp
new file mode 100644
index 00000000000..75a982564bd
--- /dev/null
+++ b/ACE/contrib/FaCE/FaCE.cpp
@@ -0,0 +1,656 @@
+// $Id$
+
+#include "FaCE.h"
+
+#ifdef NO_ACE
+
+#include "CE_ARGV.H"
+
+#else
+
+#include <ace/ACE.h>
+#include <ace/ARGV.h>
+#include <ace/Log_Msg.h>
+
+#endif // NO_ACE
+
+#include <commctrl.h>
+#include <aygshell.h>
+#include <sipapi.h>
+
+// This utility does not use ACE, and shouldn't.
+//FUZZ: disable check_for_lack_ACE_OS
+
+ACE_TCHAR* g_ParameterFileName = ACE_TEXT("Parameters.txt");
+
+/**
+ * This simple and small class manages user-input command line
+ * parameters and parameter history file.
+ *
+ * @author Si Mong Park (spark@ociweb.com)
+ * @version $Revision$ $Date$
+ */
+class ParameterList
+{
+public:
+ /**
+ * Default Ctor.
+ */
+ ParameterList() : next_(0), param_(0) {};
+
+ /**
+ * Dtor: deletes all sub-PameterList objects as well as
+ * memory block allocated for the param_ by _wcsdup().
+ */
+ ~ParameterList() { free(param_); delete next_; };
+
+ /**
+ * Add a new parameter to the list.
+ */
+ void addParameter(char*);
+
+ /**
+ * Add a new parameter to the list.
+ */
+ void addParameter(ACE_TCHAR*);
+
+ /**
+ * Save all parameters stored in the list to the
+ * file.
+ * Note that 'outputFile' is only for the internal use
+ * and user must call this function without any parameter.
+ */
+ void saveParameter(FILE* outputFile = 0);
+
+ /**
+ * Send out windows message to load/update parameters.
+ */
+ void sendParameterMSG(HWND, UINT);
+
+private:
+ /**
+ * A pointer to the next ParameterList object.
+ * This attribute is totally hidden from user.
+ */
+ ParameterList* next_;
+
+ /**
+ * User-specified command line parameter.
+ * This attribute is totally hidden from user.
+ */
+ ACE_TCHAR* param_;
+};
+
+
+void ParameterList::addParameter(char* newParameter)
+{
+#ifdef NO_ACE
+ int len = MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, newParameter, -1, 0, 0);
+ wchar_t* w_output = new wchar_t[len];
+
+ MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, newParameter, -1, w_output, len);
+ this->addParameter(w_output);
+
+ delete w_output;
+#else
+ this->addParameter(ACE_TEXT_CHAR_TO_TCHAR(newParameter));
+#endif // NO_ACE
+}
+
+
+void ParameterList::addParameter(ACE_TCHAR* newParameter)
+{
+ if (this->param_ == 0) {
+ this->param_ = _wcsdup(newParameter);
+ this->next_ = new ParameterList(); // create and add a new ParameterList object
+ }
+ else {
+ if (wcscmp(this->param_, newParameter) != 0) {
+ this->next_->addParameter(newParameter);
+ }
+ }
+}
+
+
+void ParameterList::saveParameter(FILE* outputFile)
+{
+ if ( (outputFile == 0) && (this->param_ != 0) ) {
+ outputFile = _wfopen(g_ParameterFileName, ACE_TEXT("w+"));
+ }
+
+ if (outputFile != 0) {
+ if (this->param_ != 0) {
+ fwprintf(outputFile, ACE_TEXT("%s\n"), this->param_);
+ this->next_->saveParameter(outputFile);
+ }
+ else {
+ fclose(outputFile);
+ }
+ }
+}
+
+
+void ParameterList::sendParameterMSG(HWND hDlg, UINT message)
+{
+ if (param_ != 0) {
+ SendDlgItemMessage(hDlg, IDC_CMDEDIT, message, 0, (LPARAM)this->param_);
+ this->next_->sendParameterMSG(hDlg, message);
+ }
+}
+
+
+// Global Variables:
+HINSTANCE g_hInst; // The current instance
+HWND g_hwndCB; // The command bar handle
+HWND hWndEdit; // Read only edit box for output display
+FILE* g_OutputFile; // File handler for output save
+
+ParameterList g_Parameter; // command line parameter list
+
+ACE_CE_Screen_Output cout; // Replacement of std::cout
+
+ACE_TCHAR g_CommandLine[MAX_COMMAND_LINE]; // User-specified command line parameter
+ACE_TCHAR g_SaveFileName[MAX_LOADSTRING]; // Name of the output file
+
+static SHACTIVATEINFO s_sai;
+
+// Forward declarations of functions included in this code module:
+ATOM MyRegisterClass (HINSTANCE, ACE_TCHAR*);
+BOOL InitInstance (HINSTANCE, int);
+LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
+LRESULT CALLBACK About (HWND, UINT, WPARAM, LPARAM);
+LRESULT CALLBACK CommandLine (HWND, UINT, WPARAM, LPARAM);
+LRESULT CALLBACK SaveFileName (HWND, UINT, WPARAM, LPARAM);
+LRESULT CALLBACK FileError (HWND, UINT, WPARAM, LPARAM);
+LRESULT CALLBACK FileExist (HWND, UINT, WPARAM, LPARAM);
+HWND CreateRpCommandBar(HWND);
+
+
+void InitSetup()
+{
+ g_OutputFile = 0;
+ memset(g_CommandLine, 0, MAX_COMMAND_LINE * sizeof(ACE_TCHAR));
+ memset(g_SaveFileName, 0, MAX_LOADSTRING * sizeof(ACE_TCHAR));
+}
+
+
+void LoadParameterHistory()
+{
+ FILE* parameterFile = _wfopen(g_ParameterFileName, ACE_TEXT("r"));
+
+ if (parameterFile != 0) {
+ while (feof(parameterFile) == 0) {
+ // Note: Remember that fwprintf takes wide-character format specifier but
+ // save string as ASCII. Thus, history must be read as ASCII then converted
+ // to wide-character (Unicode on WinCE).
+ char singleParameter[MAX_COMMAND_LINE];
+ int size = 0;
+ fread(&singleParameter[size], sizeof(char), 1, parameterFile);
+
+ // WinCE does not have function that reads upto the end of line.
+ while (singleParameter[size] != '\n') {
+ fread(&singleParameter[++size], sizeof(char), 1, parameterFile);
+ }
+
+ if (size > 0) {
+ singleParameter[size] = 0; // NULL terminator
+ g_Parameter.addParameter(singleParameter);
+ }
+ }
+ fclose(parameterFile);
+ }
+}
+
+
+//
+// FUNCTION: MyRegisterClass()
+//
+// PURPOSE: Registers the window class.
+//
+// COMMENTS:
+//
+// It is important to call this function so that the application
+// will get 'well formed' small icons associated with it.
+//
+ATOM MyRegisterClass(HINSTANCE hInstance, ACE_TCHAR* szWindowClass)
+{
+ WNDCLASS wc;
+
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = (WNDPROC) WndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = hInstance;
+ wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_FACE));
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wc.lpszMenuName = 0;
+ wc.lpszClassName = szWindowClass;
+
+ return RegisterClass(&wc);
+}
+
+//
+// FUNCTION: InitInstance(HANDLE, int)
+//
+// PURPOSE: Saves instance handle and creates main window
+//
+// COMMENTS:
+//
+// In this function, we save the instance handle in a global variable and
+// create and display the main program window.
+//
+BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
+{
+ HWND hWnd = 0;
+
+ ACE_TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
+ ACE_TCHAR szWindowClass[MAX_LOADSTRING]; // The window class name
+
+ g_hInst = hInstance; // Store instance handle in our global variable
+ // Initialize global strings
+ LoadString(hInstance, IDC_FACE, szWindowClass, MAX_LOADSTRING);
+ LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
+
+ //If it is already running, then focus on the window
+ hWnd = FindWindow(szWindowClass, szTitle);
+ if (hWnd)
+ {
+ // set focus to foremost child window
+ // The "| 0x01" is used to bring any owned windows to the foreground and
+ // activate them.
+ SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));
+ return 0;
+ }
+
+ MyRegisterClass(hInstance, szWindowClass);
+
+ RECT rect;
+ GetClientRect(hWnd, &rect);
+
+ hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, hInstance, 0);
+
+ if (!hWnd)
+ {
+ int error = 0;
+ error = GetLastError();
+ return FALSE;
+ }
+ //When the main window is created using CW_USEDEFAULT the height of the menubar (if one
+ // is created is not taken into account). So we resize the window after creating it
+ // if a menubar is present
+ {
+ RECT rc;
+ GetWindowRect(hWnd, &rc);
+ rc.bottom -= MENU_HEIGHT;
+ if (g_hwndCB)
+ MoveWindow(hWnd, rc.left, rc.top, rc.right, rc.bottom, FALSE);
+ }
+
+ ShowWindow(hWnd, nCmdShow);
+ UpdateWindow(hWnd);
+
+ return TRUE;
+}
+
+//
+// FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
+//
+// PURPOSE: Processes messages for the main window.
+//
+// WM_COMMAND - process the application menu
+// WM_PAINT - Paint the main window
+// WM_DESTROY - post a quit message and return
+//
+//
+LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ HDC hdc;
+ int wmId, wmEvent, nCmdHt;
+ PAINTSTRUCT ps;
+ RECT textRect;
+
+ switch (message)
+ {
+ case WM_COMMAND:
+ wmId = LOWORD(wParam);
+ wmEvent = HIWORD(wParam);
+ // Parse the menu selections:
+ switch (wmId)
+ {
+ case IDM_HELP_ABOUT:
+ DialogBox(g_hInst, (const ACE_TCHAR*)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
+ break;
+
+ case IDOK:
+ SendMessage(hWnd, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, 0), (LPARAM)hWnd);
+ SendMessage(hWnd, WM_CLOSE, 0, 0);
+ break;
+
+ case ID_SETTING_RUN:
+ {
+#ifdef NO_ACE
+ cout << ACE_TEXT("START with command line: ") << g_CommandLine << endl;
+ CE_ARGV ce_argv(g_CommandLine);
+ main_i(ce_argv.argc(), ce_argv.argv());
+ cout << ACE_TEXT("END") << endl << endl;
+#else
+ cout << ACE_TEXT("START with command line: ") << g_CommandLine << endl;
+ ACE_ARGV ce_argv(g_CommandLine);
+ ACE::init();
+ ACE_LOG_MSG->msg_callback(&cout); // register call back
+ ACE_LOG_MSG->set_flags(ACE_Log_Msg::MSG_CALLBACK); // set call back flag
+ ace_main_i(ce_argv.argc(), ce_argv.argv());
+ ACE::fini();
+ cout << ACE_TEXT("END") << endl << endl;
+#endif // NO_ACE
+ }
+ break;
+
+ case ID_SETTING_EXIT:
+ SendMessage(hWnd, WM_DESTROY, 0, 0);
+ break;
+
+ case ID_TOOLS_SAVETOFILE:
+ // create a dialog box to get the file name
+ DialogBox(g_hInst, (const ACE_TCHAR*)IDD_OUTFILE, hWnd, (DLGPROC)SaveFileName);
+ break;
+
+ case ID_SETTING_COMMANDLINE:
+ // create a dialog box to get the command line
+ DialogBox(g_hInst, (const ACE_TCHAR*)IDD_CMDLINE, hWnd, (DLGPROC)CommandLine);
+ break;
+
+ default:
+ return DefWindowProc(hWnd, message, wParam, lParam);
+ }
+ break;
+
+ case WM_CREATE:
+ SHMENUBARINFO mbi;
+
+ memset(&mbi, 0, sizeof(SHMENUBARINFO));
+ mbi.cbSize = sizeof(SHMENUBARINFO);
+ mbi.hwndParent = hWnd;
+ mbi.nToolBarId = IDM_MENU;
+ mbi.hInstRes = g_hInst;
+ mbi.nBmpId = 0;
+ mbi.cBmpImages = 0;
+
+ if (!SHCreateMenuBar(&mbi))
+ return 0;
+
+ g_hwndCB = mbi.hwndMB;
+
+ // Initialize the shell activate info structure
+ memset (&s_sai, 0, sizeof (s_sai));
+ s_sai.cbSize = sizeof (s_sai);
+
+ GetClientRect(hWnd, &textRect);
+ nCmdHt = CommandBar_Height(mbi.hwndMB);
+
+ hWndEdit = CreateWindow(ACE_TEXT("EDIT"),
+ 0,
+ WS_CHILD | WS_VISIBLE | ES_READONLY | ES_MULTILINE | WS_VSCROLL | WS_HSCROLL,
+ 0,
+ 0,
+ textRect.right,
+ textRect.bottom - MENU_HEIGHT,
+ hWnd,
+ 0,
+ g_hInst,
+ 0);
+ cout.SetOutputWindow(hWndEdit);
+ LoadParameterHistory();
+ break;
+
+ case WM_PAINT:
+ RECT rt;
+ hdc = BeginPaint(hWnd, &ps);
+ GetClientRect(hWnd, &rt);
+ EndPaint(hWnd, &ps);
+ break;
+
+ case WM_ACTIVATE:
+ // Notify shell of our activate message
+ SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE);
+ break;
+
+ case WM_SETTINGCHANGE:
+ SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai);
+ break;
+
+ case WM_HIBERNATE: // low power
+ case WM_CLOSE:
+ case WM_DESTROY:
+ g_Parameter.saveParameter(); // save parameters to history file
+ CommandBar_Destroy(g_hwndCB);
+ PostQuitMessage(0);
+ break;
+
+ default:
+ return DefWindowProc(hWnd, message, wParam, lParam);
+ }
+ return 0;
+}
+
+
+HWND CreateRpCommandBar(HWND hwnd)
+{
+ SHMENUBARINFO mbi;
+
+ memset(&mbi, 0, sizeof(SHMENUBARINFO));
+ mbi.cbSize = sizeof(SHMENUBARINFO);
+ mbi.hwndParent = hwnd;
+ mbi.nToolBarId = IDM_MENU;
+ mbi.hInstRes = g_hInst;
+ mbi.nBmpId = 0;
+ mbi.cBmpImages = 0;
+
+ if (!SHCreateMenuBar(&mbi))
+ return 0;
+
+ return mbi.hwndMB;
+}
+
+// Mesage handler for the About box.
+LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ SHINITDLGINFO shidi;
+
+ ACE_TCHAR* copyrightNote = ACE_TEXT(
+"ACE® and TAO® are copyrighted by Dr. Douglas C. Schmidt and Center for Distributed Object \
+Computing at Washington University,© 1993-2002, all rights reserved. \
+FaCE is copyrighted by Object Computing, Inc.,© 2002,\n all rights reserved.\n\
+See License.txt for more information.");
+
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ // Create a Done button and size it.
+ shidi.dwMask = SHIDIM_FLAGS;
+ shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN;
+ shidi.hDlg = hDlg;
+ SHInitDialog(&shidi);
+ SetDlgItemText(hDlg, IDC_COPYRIGHT, copyrightNote);
+ return TRUE;
+
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDOK)
+ {
+ EndDialog(hDlg, LOWORD(wParam));
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}
+
+
+LRESULT CALLBACK CommandLine(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ int wmId;
+ int wmEvent;
+
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ g_Parameter.sendParameterMSG(hDlg, CB_INSERTSTRING);
+ SetDlgItemText(hDlg, IDC_CMDEDIT, g_CommandLine); // pass existing command line for display
+ return TRUE;
+
+ case WM_COMMAND:
+ wmId = LOWORD(wParam);
+ wmEvent = HIWORD(wParam);
+ // Parse the menu selections:
+ switch (wmId)
+ {
+ case IDOK:
+ // new command line accepted
+ GetDlgItemText(hDlg, IDC_CMDEDIT, g_CommandLine, MAX_COMMAND_LINE - 1);
+ EndDialog(hDlg, wmId);
+ g_Parameter.addParameter(g_CommandLine);
+ return TRUE;
+
+ case IDCANCEL:
+ EndDialog(hDlg, wmId);
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+ break;
+ default:
+ return FALSE;
+ }
+
+ return FALSE;
+}
+
+
+LRESULT CALLBACK SaveFileName(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ int wmId;
+ int wmEvent;
+
+ ACE_TCHAR tempBuffer[MAX_LOADSTRING];
+ ACE_TCHAR fileMode[3] = { 0, '+', 0 }; // mode will either be "a+" or "w+"
+ FILE* tempFile;
+
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ SetDlgItemText(hDlg, IDC_SAVEFILE, g_SaveFileName);
+ return TRUE;
+
+ case WM_COMMAND:
+ wmId = LOWORD(wParam);
+ wmEvent = HIWORD(wParam);
+ // Parse the menu selections:
+ switch (wmId)
+ {
+ case IDOK:
+ GetDlgItemText(hDlg, IDC_SAVEFILE, tempBuffer, MAX_LOADSTRING - 1);
+ EndDialog(hDlg, wmId);
+
+ tempFile = _wfopen(tempBuffer, ACE_TEXT("r"));
+
+ if (tempFile != 0) // if file exists
+ {
+ fclose(tempFile); // close temp handler
+ int choice = DialogBox(g_hInst, (const ACE_TCHAR*)IDD_FILEEXIST, hDlg, (DLGPROC)FileExist);
+ switch (choice)
+ {
+ case IDOVERWRITE: // overwrite existing file
+ fileMode[0] = 'w';
+ break;
+
+ case IDC_APPEND: // append to existing file
+ fileMode[0] = 'a';
+ break;
+
+ case IDCANCEL: // cancel operation without changing g_OutputFile
+ return TRUE;
+ }
+ }
+ else // if file does not exist
+ {
+ fileMode[0] = 'w';
+ }
+
+ tempFile = _wfopen(tempBuffer, fileMode);
+
+ if (tempFile == 0)
+ {
+ DialogBox(g_hInst, (const ACE_TCHAR*)IDD_ERRFILE, hDlg, (DLGPROC)FileError);
+ }
+ else
+ {
+ wcscpy(g_SaveFileName, tempBuffer);
+
+ if (g_OutputFile != 0)
+ {
+ fclose(g_OutputFile); // close any open file
+ }
+
+ g_OutputFile = tempFile;
+
+ cout << g_OutputFile; // update FILE* for the CE_Screen_Output class object.
+ }
+
+ return TRUE;
+
+ case IDCANCEL:
+ EndDialog(hDlg, wmId);
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+ break;
+ default:
+ return FALSE;
+ }
+
+ return FALSE;
+}
+
+
+LRESULT CALLBACK FileError(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ return TRUE;
+
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDOK)
+ {
+ EndDialog(hDlg, LOWORD(wParam));
+ return TRUE;
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
+
+LRESULT CALLBACK FileExist(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ return TRUE;
+ case WM_COMMAND:
+ EndDialog(hDlg, LOWORD(wParam));
+ return TRUE;
+ default:
+ return FALSE;
+ }
+
+ return FALSE;
+}
+
+//FUZZ: enable check_for_lack_ACE_OS
diff --git a/ACE/contrib/FaCE/FaCE.h b/ACE/contrib/FaCE/FaCE.h
new file mode 100644
index 00000000000..ef1842323c0
--- /dev/null
+++ b/ACE/contrib/FaCE/FaCE.h
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file FaCE.h
+ *
+ * $Id$
+ *
+ * @author Si Mong Park <spark@ociweb.com>
+ */
+//=============================================================================
+
+#if !defined(AFX_FACE_H__1043241E_A6A9_4246_A9E4_7A774E19EE73__INCLUDED_)
+#define AFX_FACE_H__1043241E_A6A9_4246_A9E4_7A774E19EE73__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#if (_WIN32_WCE <= 211)
+#error This project can not be built for H/PC Pro 2.11 or earlier platforms.
+#endif
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+//////
+// BEGIN FaCE specific preprocessor
+#ifdef NO_ACE
+
+#include <windows.h>
+#include "CE_Screen_Output.h"
+
+#define ACE_TCHAR wchar_t
+#define ACE_TEXT(STRING) L##STRING
+#define ACE_CE_Screen_Output CE_Screen_Output
+
+int main_i(int, wchar_t**);
+
+#else
+
+#include <ace/OS.h>
+#include <ace/CE_Screen_Output.h>
+
+int ace_main_i(int, ACE_TCHAR**);
+
+#endif // NO_ACE
+// END FaCE specific
+//////
+
+#include "resource.h"
+
+#define MENU_HEIGHT 26
+#define MAX_LOADSTRING 101
+#define MAX_COMMAND_LINE 1001 // Max number of characters + 1 (null at the end) for user-input argv
+
+extern ACE_CE_Screen_Output cout; // Replacement of std::cout
+
+#endif // !defined(AFX_FACE_H__1043241E_A6A9_4246_A9E4_7A774E19EE73__INCLUDED_)
diff --git a/ACE/contrib/FaCE/FaCE.mpc b/ACE/contrib/FaCE/FaCE.mpc
new file mode 100644
index 00000000000..6e1c9205a13
--- /dev/null
+++ b/ACE/contrib/FaCE/FaCE.mpc
@@ -0,0 +1,16 @@
+// -*- MPC -*-
+// $Id$
+
+project: aceexe {
+ exename = FaCE
+ // This is just a dummy_label to prevent the example from being compiled
+ // in MPC builds
+ requires += dummy_label
+ requires += wince
+ lit_libs += aygshell
+
+ Source_Files {
+ FaCE.cpp
+ Main.cpp
+ }
+}
diff --git a/ACE/contrib/FaCE/FaCE.rc b/ACE/contrib/FaCE/FaCE.rc
new file mode 100644
index 00000000000..1d1b40df81e
--- /dev/null
+++ b/ACE/contrib/FaCE/FaCE.rc
@@ -0,0 +1,268 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "newres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_FACE ICON DISCARDABLE "FACE.ico"
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""newres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Data
+//
+
+IDM_MENU SHMENUBAR MOVEABLE PURE
+BEGIN
+ IDM_MENU, 2,
+ I_IMAGENONE, ID_SETTING, TBSTATE_ENABLED,
+ TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_CAP_SETTING, 0, 0,
+ I_IMAGENONE, IDM_MAIN_COMMAND1, TBSTATE_ENABLED,
+ TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_HELP, 0, 1,
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menubar
+//
+
+IDM_MENU MENU DISCARDABLE
+BEGIN
+ POPUP "Setting"
+ BEGIN
+ MENUITEM "Command Line", ID_SETTING_COMMANDLINE
+ MENUITEM "Run", ID_SETTING_RUN
+ MENUITEM SEPARATOR
+ MENUITEM "Exit", ID_SETTING_EXIT
+ END
+ POPUP "Tools"
+ BEGIN
+ MENUITEM "About", IDM_HELP_ABOUT
+ MENUITEM "Save To File", ID_TOOLS_SAVETOFILE
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 148, 161
+STYLE WS_POPUP | WS_CAPTION
+EXSTYLE 0x80000000L
+CAPTION "About FACE"
+FONT 8, "System"
+BEGIN
+ CONTROL 113,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,33,6,
+ 69,52
+ CTEXT "Static",IDC_COPYRIGHT,7,86,128,68
+ CONTROL 114,IDC_TAO,"Static",SS_BITMAP,7,61,134,22
+END
+
+IDD_CMDLINE DIALOG DISCARDABLE 0, 0, 125, 50
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Command Line"
+FONT 8, "System"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,7,29,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,68,29,50,14
+ COMBOBOX IDC_CMDEDIT,7,7,111,80,CBS_DROPDOWN | CBS_AUTOHSCROLL |
+ CBS_OEMCONVERT | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL |
+ WS_TABSTOP
+END
+
+IDD_OUTFILE DIALOG DISCARDABLE 0, 0, 127, 49
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Output File Name"
+FONT 8, "System"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,7,28,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,70,28,50,14
+ EDITTEXT IDC_SAVEFILE,7,7,113,14,ES_AUTOHSCROLL
+END
+
+IDD_ERRFILE DIALOG DISCARDABLE 0, 0, 124, 49
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "ERROR"
+FONT 8, "System"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,37,28,50,14
+ CTEXT "File Creation Error!",IDC_ERRFILE,13,7,98,17,
+ SS_CENTERIMAGE
+END
+
+IDD_FILEEXIST DIALOG DISCARDABLE 0, 0, 114, 90
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "File Exists"
+FONT 8, "System"
+BEGIN
+ DEFPUSHBUTTON "Overwrite",IDOVERWRITE,32,32,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,32,68,50,14
+ PUSHBUTTON "Append",IDC_APPEND,32,50,50,14
+ CTEXT "File already exists!",IDC_STATIC,7,15,100,11
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+IDC_FACE ACCELERATORS DISCARDABLE
+BEGIN
+ "A", IDM_HELP_ABOUT, VIRTKEY, CONTROL, NOINVERT
+ "Q", IDOK, VIRTKEY, CONTROL, NOINVERT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_ABOUTBOX, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 141
+ TOPMARGIN, 6
+ BOTTOMMARGIN, 154
+ END
+
+ IDD_CMDLINE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 118
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 43
+ END
+
+ IDD_OUTFILE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 120
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 42
+ END
+
+ IDD_ERRFILE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 117
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 42
+ END
+
+ IDD_FILEEXIST, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 107
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 82
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+IDB_ACERACER BITMAP DISCARDABLE "ACE_Racer.bmp"
+IDB_TAO BITMAP DISCARDABLE "TAO.bmp"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_APP_TITLE "FaCE"
+ IDC_FACE "FaCE"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_HELP "Tools"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_COMMAND1 "Done "
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_CAP_SETTING "Setting"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/ACE/contrib/FaCE/FaCENOACE.mpc b/ACE/contrib/FaCE/FaCENOACE.mpc
new file mode 100644
index 00000000000..408c4f4e7d4
--- /dev/null
+++ b/ACE/contrib/FaCE/FaCENOACE.mpc
@@ -0,0 +1,16 @@
+// -*- MPC -*-
+// $Id$
+
+project {
+ exename = FaCENOACE
+ requires += wince
+ macros += NO_ACE
+ lit_libs += aygshell
+
+ Source_Files {
+ FaCE.cpp
+ Main.cpp
+ CE_ARGV.CPP
+ CE_Screen_Output.cpp
+ }
+}
diff --git a/ACE/contrib/FaCE/FaCE_OS.h b/ACE/contrib/FaCE/FaCE_OS.h
new file mode 100644
index 00000000000..ab29916a9e6
--- /dev/null
+++ b/ACE/contrib/FaCE/FaCE_OS.h
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file FaCE_OS.h
+ *
+ * $Id$
+ *
+ * @author Si Mong Park <spark@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef FaCE_OS_h
+#define FaCE_OS_h
+
+// This definition is for the "int FaCE_MAIN(int, wchar_t**)" using FaCE.
+# define FaCE_MAIN \
+ace_main_i (int, ACE_TCHAR**); \
+extern BOOL InitInstance (HINSTANCE, int); \
+extern void InitSetup(); \
+int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, ACE_TCHAR* lpCmdLine, int nCmdShow) \
+{ \
+ MSG msg; \
+ HACCEL hAccelTable; \
+ if (!InitInstance (hInstance, nCmdShow)) return FALSE; \
+ hAccelTable = LoadAccelerators(hInstance, (const ACE_TCHAR*)IDC_FACE); \
+ InitSetup(); \
+ while (GetMessage(&msg, 0, 0, 0)) { \
+ if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { \
+ TranslateMessage(&msg); \
+ DispatchMessage(&msg); \
+ } \
+ } \
+ return msg.wParam; \
+} \
+int ace_main_i
+
+#endif // FaCE_OS_h
diff --git a/ACE/contrib/FaCE/License.txt b/ACE/contrib/FaCE/License.txt
new file mode 100644
index 00000000000..ceaf85d3550
--- /dev/null
+++ b/ACE/contrib/FaCE/License.txt
@@ -0,0 +1,27 @@
+==
+== Copyright and Licensing Information
+==
+
+ACE(tm) and TAO(tm) are copyrighted by Dr. Douglas C. Schmidt and the Center for Distributed
+Object Computing ('DOC' group) at Washington University, Copyright (C) 1993 - 2002, all rights
+reserved. Since ACE and TAO are open source, free software, you are free to use, modify, and
+distribute the ACE and TAO source code and object code produced from the source, as long as
+you include this copyright statement along with code built using ACE and TAO. Please refer to
+ACE and TAO documentations for detailed copyright and license information on ACE and TAO.
+
+FaCE is an additional front-end shell package designed for ACE and TAO testing work for Pocket
+PC 2002 platform, created and released by Object Computing, Inc. (OCI) and distributed with ACE
+and TAO under the same licensing terms. You can modify and change the source of FaCE for your
+own use as long as you provide attribution to OCI by including its copyright statement in your
+distributions of source and object code. OCI welcomes submissions of improvements to the FaCE
+code base.
+
+FaCE is copyrighted by Object Computing, Inc., St. Louis Missouri, Copyright (C) 2002,
+all rights reserved.
+
+
+==
+== Warranty Information
+==
+
+FaCE is provided 'as is' without warranties of any kind.
diff --git a/ACE/contrib/FaCE/Main.cpp b/ACE/contrib/FaCE/Main.cpp
new file mode 100644
index 00000000000..84e041db5f8
--- /dev/null
+++ b/ACE/contrib/FaCE/Main.cpp
@@ -0,0 +1,49 @@
+// $Id$
+
+// ************************************************
+// ** This file is NOT to be used for framework. **
+// ************************************************
+
+// This file defines the entry point for Windows CE, which is defined in OS.h for real applications.
+
+
+#include "FaCE.h"
+
+extern BOOL InitInstance (HINSTANCE, int);
+extern void InitSetup();
+
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, ACE_TCHAR* lpCmdLine, int nCmdShow)
+{
+ MSG msg;
+ HACCEL hAccelTable;
+ if (!InitInstance (hInstance, nCmdShow)) return FALSE;
+ hAccelTable = LoadAccelerators(hInstance, (const ACE_TCHAR*)IDC_FACE);
+ InitSetup();
+ while (GetMessage(&msg, 0, 0, 0)) {
+ if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ return msg.wParam;
+}
+
+
+#ifdef NO_ACE
+
+int main_i(int, ACE_TCHAR**)
+{
+ // this function will be replaced by user's main_ce function
+ return 0;
+}
+
+#else
+
+int ace_main_i(int, ACE_TCHAR**)
+{
+ // this function will be replaced by user's main_ce function
+ return 0;
+}
+
+#endif // NO_ACE
diff --git a/ACE/contrib/FaCE/README b/ACE/contrib/FaCE/README
new file mode 100644
index 00000000000..a4bd2d981b1
--- /dev/null
+++ b/ACE/contrib/FaCE/README
@@ -0,0 +1,287 @@
+===
+=== FaCE (Front-end for ACE CE)
+===
+=== Object Computing, Inc. <http://www.ociweb.com>
+=== St. Louis, Missouri
+=== Copyright (C) 2002. All rights reserved.
+===
+=== V1.01, March 30th, 2002
+===
+
+
+== What's FaCE?
+
+FaCE is a simple front-end framework for testing and debugging non-Windows
+CE applications on the Pocket PC 2002 platform. Originally, FaCE was
+developed to test ACE and TAO components internally in Object Computing, Inc.
+However, since it has shown dramatic increase of productivity in a lot
+shorter amount of time, it has been prepared as a package for all programmers
+who want to test and run existing codes (non-WinCE native codes) on Pocket PC
+2002 and WinCE 3.0.
+
+The features of FaCE are:
+
+ 1. command line parameter support
+ 2. command line history support (never type in same command line again)
+ 3. output displayed on the windows screen
+ 4. output to file (with append and overwrite support)
+ 5. does not use MFC
+ 6. almost no modification to existing user code
+ 7. easy to enable and disable after install
+
+* Default project files only contain Pocket PC 2002 platform configuration.
+ A new configuration can be added for other WinCE 3.0 platform from eVC.
+
+
+== Package Contents
+
+Files contained in FaCE package are:
+
+ Main Framework Files for both ACE users and non-ACE users
+ - ACE_Racer.bmp
+ - FaCE.h & cpp
+ - FaCE.ico
+ - FaCE.rc
+ - newres.h
+ - resource.h
+ - TAO.bmp
+
+ ACE entry point definition file
+ - FaCE_OS.h
+
+ Additional Framework files for non-ACE users
+ - CE_ARGV.h & cpp
+ - CE_Screen_Output.h & cpp
+
+ Files for loading skeleton FaCE from eVC
+ - FaCE.vcp & vcw : FaCE Project files for ACE users
+ - FaCENOACE.vcp & vcw : FaCE Project files for non-ACE users
+ - Main.cpp : almost empty entry point function
+
+ Misc. Files
+ - ACE.ico : a bonus icon of ACE logo
+ - License.txt : license and warranty information
+ - ReadMe.txt : this document
+
+
+== Requirement
+
+ - Microsoft(C) eMbedded Visual Studio/C++ (eVC) 3.0
+ - Pocket PC 2002 SDK
+
+ ** For ACE-users only:
+ - ACE+TAO installed and configured for WinCE build only for ACE-users
+ - ace and ace_os libraries built for WinCE and loaded on machine
+
+
+== Important Note
+
+It has been reported that certain Pocket PC 2002 machines with ARM processor
+can be totally dead and will not even respond to the hard reset. While the
+real cause of this problem is unknown, HP has released a patch for this
+problem. We have tested it, and it seems working fine on our machine (HP
+Jornada 568), which is our 5th machine that has been running fine for the
+longest time.
+
+As this has been identified by hardware manufacturer and can be fixed as HP
+did, Object Computing, Inc. (OCI) or any member of ACE+TAO community cannot
+be responsible for this problem. If this problem happens during debugging,
+contact your hardware manufacturer for fix or replacement. It has found
+that almost all Pocket PC 2002 machines regardless of manufacturers have same
+problem.
+
+Also, Phil Mesnier at OCI has found that virtual function calls under certain
+situation can cause a problem that randomly changes parameter and pointer
+values over function calls. This is due to the incorrect instructions
+generated by eVC for ARM processor. So far, no solution or patch has been
+released by compiler vendor, although vendor is aware of this problem.
+
+Since Pocket PC 2002 is based on WinCE 3.0, ACE+TAO as well as FaCE should
+be able to run on any WinCE 3.0 platform by adding a new configuraion with
+minimal change.
+
+
+== Installation & Setup
+
+1. Create a subdirectory named 'FaCE' (or anything in your taste) under
+ your current project directory.
+
+2. Copy FaCE_OS.h to the ACE_ROOT/ace directory, and add following line at
+ the end of your ACE_ROOT/ace/config.h file:
+
+ #include "FaCE_OS.h"
+
+3. Copy main framework files listed above and add them into "your" project
+ (NOT FaCE.vcw/vcp). For non-ACE users, copy additional framework files
+ for non-ACE users in addition to the main framework files.
+ It would be a good idea to create a new folder in your project and put
+ all FaCE files into it. This way, it will be easy to disable FaCE by
+ setting the folder excluded from the build on the folder property option.
+
+ ** IMPORTANT! **
+ FaCE does NOT use MFC. Thus, if your project is already set for
+ 'Not using MFC', then do not change the setting.
+
+ * Note: Make sure those files are not shared by multiple executables.
+ Each project must have its own copy of those files.
+ It is a good idea to create a separate folder on your project
+ and put FaCE related files into that folder. In that case,
+ if you want to disable FaCE and run by using normal 'main',
+ then you can simply set the whole FaCE folder excluded from
+ build in the project setting menu.
+
+4. Change your 'main()' function part similar to the following example.
+
+ #ifdef ACE_HAS_WINCE
+ #include "FaCE/FaCE.h" // use the name of subdirectory you created
+ int FaCE_MAIN (int argc, ACE_TCHAR *argv[])
+ #else
+ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // ACE normal entry point
+ #endif
+
+ Change the directory name for "FaCE/FaCE.h" if necessary.
+ For non-ACE users, use 'UNDER_CE' instead of 'ACE_HAS_WINCE'.
+
+ == Possible Additional Change
+
+ Above change will be the only change if your program compiles and links
+ fine under eVC. It does not mean that your program is WinCE-ready but
+ just means that your program does not include the libraries that are not
+ supported by WinCE, such as iostream.
+
+ For ACE users, good examples will be the ACE test programs under
+ $ACE_ROOT/test.
+
+ For non-ACE users, I highly recommend to create a project for WinCE first
+ if it has not already been done and write your code using wmain.
+ Try compile and link your program without FaCE to check your program does
+ not include any libraries not supported by WinCE. FaCE supports text output
+ by aliasing 'cout' in FaCE.h; however, it is NOT a real iostream but an alias
+ for CE_Screen_Output class. You may need to use '#ifdef UNDER_CE' for your
+ iostream includes, if you want to share the code among different platforms.
+
+ Also, it is important to match the parameter types for 'wmain' function.
+ For WinCE, it MUST be in the format of:
+
+ int FaCE_MAIN (int, wchar_t**)
+
+ and you can leave your original wmain type as it was for non-CE platform
+ definition.
+
+5. Go to 'ResourceView' or double-click on the 'FaCE.rc'. Open 'String Table ->
+ String Table' from the resource browse view, and change the string value (caption)
+ defined for 'IDS_APP_TITLE' from 'FaCE' to your program name. This will
+ help identifying multiple FaCE-fied applications when you brose them
+ through system memory -> running programs in case of crash.
+
+6. That's it!
+
+** Optionally, you can personalize the icons defined for FaCE for your own.
+ To do this easily, load "FaCE.vcw" (requires ACE library) or "FaCENOACE.vcw"
+ from eVC. Also, FaCENOACE.vcw can be used as 'hello world'-type starting
+ frame-work for non-WinCE programmers.
+
+** Non-ACE users may see the warning messages saying, "Could not find the file xxx",
+ for ace.h, Log_Msg.h, OS.h, and CE_Screen_Output.h. This is due to the eVC's
+ not-so-perfect precompilation file checking and totally harmless.
+
+** Later if you don't want to use FaCE anymore, simply restore your original
+ main function and remove FaCE files from your project (or exclude FaCE files
+ from build). ACE library does not have to be rebuilt as FaCE_OS.h only
+ contains macro.
+
+== Running FaCE
+
+1. Command line option
+
+User can specify the command line option for the program by using 'Settings ->
+Command Line' from the FaCE menu. FaCE will automatically save all user-entered
+command line parameters as a ASCII format file named 'Parameters.txt' in the
+root directory of WinCE device/emulator. User can edit and change by openning
+this file from any text editor and save as a ASCII text file with DOS standard
+CR/LF combo. This will greatly save time especially when you are working on the
+Pocket PC machine that does not have keyboard. Remember NOT to convert file
+format to Unicode; it must be standard DOS ASCII text file.
+
+2. Output Saving
+
+You can save output to file by selecting 'Tools -> Save To File'. By default,
+FaCE will not create/save any file. Also, any output received before setting
+up this feature will not be saved.
+
+If the file with specified name exists, FaCE will ask whether you want to
+append to the end of file or erase and overwrite. All output files will be
+saved in the root directory of the system.
+
+3. Running Your Program
+
+'Setting -> Run' will execute your program. Two tags, 'START' and 'END'
+indicate the beginning and end of your code.
+
+For ACE users, any log message sent to ACE message log (ACE_DEBUG, for example)
+will be displayed on the screen. Also, if you have setup to save to file,
+the same contents will be saved to the file as well. Note that the output will
+NOT have ACE internal tags (i.e. Dec 04 14:51:12.000 2001@LM_DEBUG@) because
+FaCE uses callback message function, and ACE does not pass those tags along
+with the output message.
+
+For non-ACE users, you can declare your own local copy of CE_Screen_Output
+object. For example, you can declare CE_Screen_Output object in your cpp file
+like:
+
+ CE_Screen_Output cout;
+
+and use it like,
+
+ int a = 100;
+ wchar_t* strTemp = L"Hello, world!";
+ cout << L"String : " << strTemp << L"a = " << a << endl;
+
+Remember, CE_Screen_Output is just a simple text output function and does not
+have the full capabilities of iostream, which is not available for WinCE 3.0.
+
+4. In case of crash
+
+If you have started your code, but the code crashes, which can be easily
+identified by looking for the 'END' tag, then you can use Windows CE's memory
+program to kill the process (Start -> Settings -> System tag -> Memory ->
+Running Programs tag). If you have changed IDS_APP_TITLE in the resource
+viewer, then you will see the name you have specified; otherwise, FaCE will be
+listed. You can select the name and stop the process by clicking 'Stop' button.
+Sometimes, you may need to reset the machine if you cannot access memory program.
+
+
+== Note
+
+- This FaCE framework does not use any MFC; it only uses general Win32
+ API, thus, your project setting does not have to be changed.
+
+- FaCE is for the 'legacy' Unix/DOS style console applications that
+ do not use any Win32 and MFC for Windows OS. Programs that are already
+ using native Windows/WinCE API's will not need FaCE framework.
+
+- If you run your application from FaCE (Settings -> Run), 'START' and
+ 'END' will appear at the beginning and end of output messages from your
+ application. If you see 'END' lable after execution, you can run your
+ program again without exit and start up FaCE again.
+
+- Make sure to terminate FaCE by selecting 'Settings -> Exit'. It will
+ completely terminate FaCE session; Clicking on the 'X' button
+ at the top-left corner of the screen will not, just like most WinCE programs.
+
+- FaCE_MAIN is only for the WinCE port of ACE, ensuring proper windows system
+ message filtering along with proper registraion so that user can see the
+ process from memory setting and task switcher applications.
+
+- ACE and FaCE do not overrides native WinMain. If you are developing for
+ Windows OS only, your WinMain should be just safe from any overrides.
+ In this case, of course, you don't need to use FaCE package.
+
+
+== Question or Comment
+
+If you have question and/or comment specific to the FaCE, please contact
+Si Park at spark@ociweb.com or Justin Michel at michel_j@ociweb.com.
+
+For general ACE+TAO support, please refer to comp.soft-sys.ace or contact
+Object Computing, Inc. at http://www.ociweb.com.
diff --git a/ACE/contrib/FaCE/TAO.bmp b/ACE/contrib/FaCE/TAO.bmp
new file mode 100644
index 00000000000..1492f789509
--- /dev/null
+++ b/ACE/contrib/FaCE/TAO.bmp
Binary files differ
diff --git a/ACE/contrib/FaCE/newres.h b/ACE/contrib/FaCE/newres.h
new file mode 100644
index 00000000000..0fdbcaa3bb0
--- /dev/null
+++ b/ACE/contrib/FaCE/newres.h
@@ -0,0 +1,43 @@
+// $Id$
+
+#ifndef __NEWRES_H__
+#define __NEWRES_H__
+
+#if !defined(UNDER_CE)
+#define UNDER_CE _WIN32_WCE
+#endif
+
+#if defined(_WIN32_WCE)
+ #if !defined(WCEOLE_ENABLE_DIALOGEX)
+ #define DIALOGEX DIALOG DISCARDABLE
+ #endif
+ #include <commctrl.h>
+ #define SHMENUBAR RCDATA
+ #if defined(WIN32_PLATFORM_PSPC) && (_WIN32_WCE >= 300)
+ #include <aygshell.h>
+ #define AFXCE_IDR_SCRATCH_SHMENU 28700
+ #else
+ #define I_IMAGENONE (-2)
+ #define NOMENU 0xFFFF
+ #define IDS_SHNEW 1
+
+ #define IDM_SHAREDNEW 10
+ #define IDM_SHAREDNEWDEFAULT 11
+ #endif // _WIN32_WCE_PSPC
+ #define AFXCE_IDD_SAVEMODIFIEDDLG 28701
+#endif // _WIN32_WCE
+
+#ifdef RC_INVOKED
+#ifndef _INC_WINDOWS
+#define _INC_WINDOWS
+ #include "winuser.h" // extract from windows header
+ #include "winver.h"
+#endif
+#endif
+
+#ifdef IDC_STATIC
+#undef IDC_STATIC
+#endif
+#define IDC_STATIC (-1)
+
+#endif //__NEWRES_H__
diff --git a/ACE/contrib/FaCE/resource.h b/ACE/contrib/FaCE/resource.h
new file mode 100644
index 00000000000..a79d8345d1b
--- /dev/null
+++ b/ACE/contrib/FaCE/resource.h
@@ -0,0 +1,45 @@
+// $Id$
+
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by FaCE.rc
+//
+#define IDS_APP_TITLE 1
+#define IDC_FACE 3
+#define IDI_FACE 101
+#define IDM_MENU 102
+#define IDD_ABOUTBOX 103
+#define IDS_HELP 104
+#define IDD_CMDLINE 104
+#define IDD_OUTFILE 105
+#define IDD_ERRFILE 107
+#define IDD_FILEEXIST 109
+#define IDB_ACERACER 113
+#define IDB_TAO 114
+#define IDS_COMMAND1 301
+#define IDC_CMDEDIT 1001
+#define IDC_SAVEFILE 1002
+#define IDC_ERRFILE 1003
+#define IDOVERWRITE 1004
+#define IDC_APPEND 1005
+#define IDC_COPYRIGHT 1007
+#define IDC_TAO 1008
+#define IDM_MAIN_COMMAND1 40001
+#define IDM_HELP_ABOUT 40003
+#define ID_SETTING 40004
+#define IDS_CAP_SETTING 40006
+#define ID_SETTING_COMMANDLINE 40007
+#define ID_SETTING_RUN 40008
+#define ID_SETTING_EXIT 40011
+#define ID_TOOLS_SAVETOFILE 40012
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 116
+#define _APS_NEXT_COMMAND_VALUE 40013
+#define _APS_NEXT_CONTROL_VALUE 1009
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/ACE/contrib/minizip/ChangeLogUnzip b/ACE/contrib/minizip/ChangeLogUnzip
new file mode 100644
index 00000000000..50ca6a9e0f3
--- /dev/null
+++ b/ACE/contrib/minizip/ChangeLogUnzip
@@ -0,0 +1,67 @@
+Change in 1.01e (12 feb 05)
+- Fix in zipOpen2 for globalcomment (Rolf Kalbermatter)
+- Fix possible memory leak in unzip.c (Zoran Stevanovic)
+
+Change in 1.01b (20 may 04)
+- Integrate patch from Debian package (submited by Mark Brown)
+- Add tools mztools from Xavier Roche
+
+Change in 1.01 (8 may 04)
+- fix buffer overrun risk in unzip.c (Xavier Roche)
+- fix a minor buffer insecurity in minizip.c (Mike Whittaker)
+
+Change in 1.00: (10 sept 03)
+- rename to 1.00
+- cosmetic code change
+
+Change in 0.22: (19 May 03)
+- crypting support (unless you define NOCRYPT)
+- append file in existing zipfile
+
+Change in 0.21: (10 Mar 03)
+- bug fixes
+
+Change in 0.17: (27 Jan 02)
+- bug fixes
+
+Change in 0.16: (19 Jan 02)
+- Support of ioapi for virtualize zip file access
+
+Change in 0.15: (19 Mar 98)
+- fix memory leak in minizip.c
+
+Change in 0.14: (10 Mar 98)
+- fix bugs in minizip.c sample for zipping big file
+- fix problem in month in date handling
+- fix bug in unzlocal_GetCurrentFileInfoInternal in unzip.c for
+ comment handling
+
+Change in 0.13: (6 Mar 98)
+- fix bugs in zip.c
+- add real minizip sample
+
+Change in 0.12: (4 Mar 98)
+- add zip.c and zip.h for creates .zip file
+- fix change_file_date in miniunz.c for Unix (Jean-loup Gailly)
+- fix miniunz.c for file without specific record for directory
+
+Change in 0.11: (3 Mar 98)
+- fix bug in unzGetCurrentFileInfo for get extra field and comment
+- enhance miniunz sample, remove the bad unztst.c sample
+
+Change in 0.10: (2 Mar 98)
+- fix bug in unzReadCurrentFile
+- rename unzip* to unz* function and structure
+- remove Windows-like hungary notation variable name
+- modify some structure in unzip.h
+- add somes comment in source
+- remove unzipGetcCurrentFile function
+- replace ZUNZEXPORT by ZEXPORT
+- add unzGetLocalExtrafield for get the local extrafield info
+- add a new sample, miniunz.c
+
+Change in 0.4: (25 Feb 98)
+- suppress the type unzipFileInZip.
+ Only on file in the zipfile can be open at the same time
+- fix somes typo in code
+- added tm_unz structure in unzip_file_info (date/time in readable format)
diff --git a/ACE/contrib/minizip/crypt.h b/ACE/contrib/minizip/crypt.h
new file mode 100644
index 00000000000..736ffba35ba
--- /dev/null
+++ b/ACE/contrib/minizip/crypt.h
@@ -0,0 +1,136 @@
+/* crypt.h -- base code for crypt/uncrypt ZIPfile
+
+$Id$
+
+Version 1.01e, February 12th, 2005
+
+Copyright (C) 1998-2005 Gilles Vollant
+
+This code is a modified version of crypting code in Infozip distribution
+
+The encryption/decryption parts of this source code (as opposed to the
+non-echoing password parts) were originally written in Europe. The
+whole source package can be freely distributed, including from the USA.
+(Prior to January 2000, re-export from the US was a violation of US law.)
+
+This encryption code is a direct transcription of the algorithm from
+Roger Schlafly, described by Phil Katz in the file appnote.txt. This
+file (appnote.txt) is distributed with the PKZIP program (even in the
+version without encryption capabilities).
+
+If you don't need crypting in your application, just define symbols
+NOCRYPT and NOUNCRYPT.
+
+This code support the "Traditional PKWARE Encryption".
+
+The new AES encryption added on Zip format by Winzip (see the page
+http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
+Encryption is not supported.
+*/
+
+
+#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
+
+/***********************************************************************
+ * Return the next byte in the pseudo-random sequence
+ */
+static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
+{
+ unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
+ * unpredictable manner on 16-bit systems; not a problem
+ * with any known compiler so far, though */
+
+ MINIZIP_UNUSED_ARG(pcrc_32_tab);
+
+ temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
+ return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
+}
+
+/***********************************************************************
+ * Update the encryption keys with the next byte of plain text
+ */
+static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
+{
+ (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
+ (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
+ (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
+ {
+ register int keyshift = (int)((*(pkeys+1)) >> 24);
+ (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
+ }
+ return c;
+}
+
+
+/***********************************************************************
+ * Initialize the encryption keys and the random header according to
+ * the given password.
+ */
+static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
+{
+ *(pkeys+0) = 305419896L;
+ *(pkeys+1) = 591751049L;
+ *(pkeys+2) = 878082192L;
+ while (*passwd != '\0') {
+ update_keys(pkeys,pcrc_32_tab,(int)*passwd);
+ passwd++;
+ }
+}
+
+#define zdecode(pkeys,pcrc_32_tab,c) \
+ (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
+
+#define zencode(pkeys,pcrc_32_tab,c,t) \
+ (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
+
+#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
+
+#define RAND_HEAD_LEN 12
+/* "last resort" source for second part of crypt seed pattern */
+# ifndef ZCR_SEED2
+# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
+# endif
+
+static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
+ const char *passwd; /* password string */
+ unsigned char *buf; /* where to write header */
+ int bufSize;
+ unsigned long* pkeys;
+ const unsigned long* pcrc_32_tab;
+ unsigned long crcForCrypting;
+{
+ int n; /* index in random header */
+ int t; /* temporary */
+ int c; /* random byte */
+ unsigned char header[RAND_HEAD_LEN-2]; /* random header */
+ static unsigned calls = 0; /* ensure different random header each time */
+
+ if (bufSize<RAND_HEAD_LEN)
+ return 0;
+
+ /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
+ * output of rand() to get less predictability, since rand() is
+ * often poorly implemented.
+ */
+ if (++calls == 1)
+ {
+ srand((unsigned)(time(0) ^ ZCR_SEED2));
+ }
+ init_keys(passwd, pkeys, pcrc_32_tab);
+ for (n = 0; n < RAND_HEAD_LEN-2; n++)
+ {
+ c = (rand() >> 7) & 0xff;
+ header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
+ }
+ /* Encrypt random header (last two bytes is high word of crc) */
+ init_keys(passwd, pkeys, pcrc_32_tab);
+ for (n = 0; n < RAND_HEAD_LEN-2; n++)
+ {
+ buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
+ }
+ buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
+ buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
+ return n;
+}
+
+#endif
diff --git a/ACE/contrib/minizip/ioapi.c b/ACE/contrib/minizip/ioapi.c
new file mode 100644
index 00000000000..2e3ae874b02
--- /dev/null
+++ b/ACE/contrib/minizip/ioapi.c
@@ -0,0 +1,169 @@
+/* ioapi.c -- IO base function header for compress/uncompress .zip
+ files using zlib + zip or unzip API
+
+ Version 1.01e, February 12th, 2005
+
+ Copyright (C) 1998-2005 Gilles Vollant
+
+ $Id$
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "zlib.h"
+#include "ioapi.h"
+
+
+
+/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
+
+#ifndef SEEK_CUR
+#define SEEK_CUR 1
+#endif
+
+#ifndef SEEK_END
+#define SEEK_END 2
+#endif
+
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#endif
+
+voidpf ZCALLBACK fopen_file_func OF((
+ voidpf opaque,
+ const char* filename,
+ int mode));
+
+uLong ZCALLBACK fread_file_func OF((
+ voidpf opaque,
+ voidpf stream,
+ void* buf,
+ uLong size));
+
+uLong ZCALLBACK fwrite_file_func OF((
+ voidpf opaque,
+ voidpf stream,
+ const void* buf,
+ uLong size));
+
+long ZCALLBACK ftell_file_func OF((
+ voidpf opaque,
+ voidpf stream));
+
+long ZCALLBACK fseek_file_func OF((
+ voidpf opaque,
+ voidpf stream,
+ uLong offset,
+ int origin));
+
+int ZCALLBACK fclose_file_func OF((
+ voidpf opaque,
+ voidpf stream));
+
+int ZCALLBACK ferror_file_func OF((
+ voidpf opaque,
+ voidpf stream));
+
+
+voidpf ZCALLBACK fopen_file_func ( voidpf opaque,const char* filename,int mode)
+ {
+ FILE* file = 0;
+ const char* mode_fopen = 0;
+ MINIZIP_UNUSED_ARG (opaque);
+ if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
+ mode_fopen = "rb";
+ else
+ if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
+ mode_fopen = "r+b";
+ else
+ if (mode & ZLIB_FILEFUNC_MODE_CREATE)
+ mode_fopen = "wb";
+
+ if ((filename != 0) && (mode_fopen != 0))
+ file = fopen(filename, mode_fopen);
+ return file;
+}
+
+
+uLong ZCALLBACK fread_file_func (voidpf opaque,voidpf stream,void* buf,uLong size)
+{
+ uLong ret;
+
+ MINIZIP_UNUSED_ARG (opaque);
+
+ ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
+ return ret;
+}
+
+
+uLong ZCALLBACK fwrite_file_func (voidpf opaque,voidpf stream,const void* buf,uLong size)
+
+{
+ uLong ret;
+ MINIZIP_UNUSED_ARG (opaque);
+ ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
+ return ret;
+}
+
+long ZCALLBACK ftell_file_func (opaque, stream)
+ voidpf opaque;
+ voidpf stream;
+{
+ long ret;
+ MINIZIP_UNUSED_ARG (opaque);
+ ret = ftell((FILE *)stream);
+ return ret;
+}
+
+long ZCALLBACK fseek_file_func (voidpf opaque,voidpf stream,uLong offset,int origin)
+{
+ int fseek_origin=0;
+ long ret;
+ MINIZIP_UNUSED_ARG (opaque);
+ switch (origin)
+ {
+ case ZLIB_FILEFUNC_SEEK_CUR :
+ fseek_origin = SEEK_CUR;
+ break;
+ case ZLIB_FILEFUNC_SEEK_END :
+ fseek_origin = SEEK_END;
+ break;
+ case ZLIB_FILEFUNC_SEEK_SET :
+ fseek_origin = SEEK_SET;
+ break;
+ default: return -1;
+ }
+ ret = 0;
+ fseek((FILE *)stream, offset, fseek_origin);
+ return ret;
+}
+
+int ZCALLBACK fclose_file_func (voidpf opaque,voidpf stream)
+{
+ int ret;
+ MINIZIP_UNUSED_ARG (opaque);
+ ret = fclose((FILE *)stream);
+ return ret;
+}
+
+int ZCALLBACK ferror_file_func (voidpf opaque,voidpf stream)
+{
+ int ret;
+ MINIZIP_UNUSED_ARG (opaque);
+ ret = ferror((FILE *)stream);
+ return ret;
+}
+
+void fill_fopen_filefunc (zlib_filefunc_def* pzlib_filefunc_def)
+ {
+ pzlib_filefunc_def->zopen_file = fopen_file_func;
+ pzlib_filefunc_def->zread_file = fread_file_func;
+ pzlib_filefunc_def->zwrite_file = fwrite_file_func;
+ pzlib_filefunc_def->ztell_file = ftell_file_func;
+ pzlib_filefunc_def->zseek_file = fseek_file_func;
+ pzlib_filefunc_def->zclose_file = fclose_file_func;
+ pzlib_filefunc_def->zerror_file = ferror_file_func;
+ pzlib_filefunc_def->opaque = 0;
+}
diff --git a/ACE/contrib/minizip/ioapi.h b/ACE/contrib/minizip/ioapi.h
new file mode 100644
index 00000000000..9b695ffaa37
--- /dev/null
+++ b/ACE/contrib/minizip/ioapi.h
@@ -0,0 +1,78 @@
+/* ioapi.h -- IO base function header for compress/uncompress .zip
+ files using zlib + zip or unzip API
+
+ Version 1.01e, February 12th, 2005
+
+ Copyright (C) 1998-2005 Gilles Vollant
+
+ $Id$
+*/
+
+#ifndef _ZLIBIOAPI_H
+#define _ZLIBIOAPI_H
+
+#include "minizip_export.h"
+
+#define ZLIB_FILEFUNC_SEEK_CUR (1)
+#define ZLIB_FILEFUNC_SEEK_END (2)
+#define ZLIB_FILEFUNC_SEEK_SET (0)
+
+#define ZLIB_FILEFUNC_MODE_READ (1)
+#define ZLIB_FILEFUNC_MODE_WRITE (2)
+#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
+
+#define ZLIB_FILEFUNC_MODE_EXISTING (4)
+#define ZLIB_FILEFUNC_MODE_CREATE (8)
+
+
+#ifndef ZCALLBACK
+
+#if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
+#define ZCALLBACK CALLBACK
+#else
+#define ZCALLBACK
+#endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
+typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
+typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
+typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
+typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
+typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
+typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
+
+typedef struct zlib_filefunc_def_s
+{
+ open_file_func zopen_file;
+ read_file_func zread_file;
+ write_file_func zwrite_file;
+ tell_file_func ztell_file;
+ seek_file_func zseek_file;
+ close_file_func zclose_file;
+ testerror_file_func zerror_file;
+ voidpf opaque;
+} zlib_filefunc_def;
+
+
+
+void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
+
+#define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
+#define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
+#define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
+#define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
+#define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
+#define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/ACE/contrib/minizip/miniunz.c b/ACE/contrib/minizip/miniunz.c
new file mode 100644
index 00000000000..a78242a16c5
--- /dev/null
+++ b/ACE/contrib/minizip/miniunz.c
@@ -0,0 +1,587 @@
+/*
+ miniunz.c
+ Version 1.01e, February 12th, 2005
+
+ Copyright (C) 1998-2005 Gilles Vollant
+
+ $Id$
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#ifdef unix
+# include <unistd.h>
+# include <utime.h>
+#else
+# include <direct.h>
+# include <io.h>
+#endif
+
+#include "unzip.h"
+
+#define CASESENSITIVITY (0)
+#define WRITEBUFFERSIZE (8192)
+#define MAXFILENAME (256)
+
+#ifdef WIN32
+#define USEWIN32IOAPI
+#include "iowin32.h"
+#endif
+/*
+ mini unzip, demo of unzip package
+
+ usage :
+ Usage : miniunz [-exvlo] file.zip [file_to_extract] [-d extractdir]
+
+ list the file in the zipfile, and print the content of FILE_ID.ZIP or README.TXT
+ if it exists
+*/
+
+
+/* change_file_date : change the date/time of a file
+ filename : the filename of the file where date/time must be modified
+ dosdate : the new date at the MSDos format (4 bytes)
+ tmu_date : the SAME new date at the tm_unz format */
+void change_file_date(filename,dosdate,tmu_date)
+ const char *filename;
+ uLong dosdate;
+ tm_unz tmu_date;
+{
+#ifdef WIN32
+ HANDLE hFile;
+ FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
+
+ hFile = CreateFile(filename,GENERIC_READ | GENERIC_WRITE,
+ 0,0,OPEN_EXISTING,0,0);
+ GetFileTime(hFile,&ftCreate,&ftLastAcc,&ftLastWrite);
+ DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate,&ftLocal);
+ LocalFileTimeToFileTime(&ftLocal,&ftm);
+ SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
+ CloseHandle(hFile);
+#else
+#ifdef unix
+ struct utimbuf ut;
+ struct tm newdate;
+ newdate.tm_sec = tmu_date.tm_sec;
+ newdate.tm_min=tmu_date.tm_min;
+ newdate.tm_hour=tmu_date.tm_hour;
+ newdate.tm_mday=tmu_date.tm_mday;
+ newdate.tm_mon=tmu_date.tm_mon;
+ if (tmu_date.tm_year > 1900)
+ newdate.tm_year=tmu_date.tm_year - 1900;
+ else
+ newdate.tm_year=tmu_date.tm_year ;
+ newdate.tm_isdst=-1;
+
+ ut.actime=ut.modtime=mktime(&newdate);
+ utime(filename,&ut);
+#endif
+#endif
+}
+
+
+/* mymkdir and change_file_date are not 100 % portable
+ As I don't know well Unix, I wait feedback for the unix portion */
+
+int mymkdir(dirname)
+ const char* dirname;
+{
+ int ret=0;
+#ifdef WIN32
+ ret = mkdir(dirname);
+#else
+#ifdef unix
+ ret = mkdir (dirname,0775);
+#endif
+#endif
+ return ret;
+}
+
+int makedir (newdir)
+ char *newdir;
+{
+ char *buffer ;
+ char *p;
+ int len = (int)strlen(newdir);
+
+ if (len <= 0)
+ return 0;
+
+ buffer = (char*)malloc(len+1);
+ strcpy(buffer,newdir);
+
+ if (buffer[len-1] == '/') {
+ buffer[len-1] = '\0';
+ }
+ if (mymkdir(buffer) == 0)
+ {
+ free(buffer);
+ return 1;
+ }
+
+ p = buffer+1;
+ while (1)
+ {
+ char hold;
+
+ while(*p && *p != '\\' && *p != '/')
+ p++;
+ hold = *p;
+ *p = 0;
+ if ((mymkdir(buffer) == -1) && (errno == ENOENT))
+ {
+ printf("couldn't create directory %s\n",buffer);
+ free(buffer);
+ return 0;
+ }
+ if (hold == 0)
+ break;
+ *p++ = hold;
+ }
+ free(buffer);
+ return 1;
+}
+
+void do_banner()
+{
+ printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
+ printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
+}
+
+void do_help()
+{
+ printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
+ " -e Extract without pathname (junk paths)\n" \
+ " -x Extract with pathname\n" \
+ " -v list files\n" \
+ " -l list files\n" \
+ " -d directory to extract into\n" \
+ " -o overwrite files without prompting\n" \
+ " -p extract crypted file using password\n\n");
+}
+
+
+int do_list(uf)
+ unzFile uf;
+{
+ uLong i;
+ unz_global_info gi;
+ int err;
+
+ err = unzGetGlobalInfo (uf,&gi);
+ if (err!=UNZ_OK)
+ printf("error %d with zipfile in unzGetGlobalInfo \n",err);
+ printf(" Length Method Size Ratio Date Time CRC-32 Name\n");
+ printf(" ------ ------ ---- ----- ---- ---- ------ ----\n");
+ for (i=0;i<gi.number_entry;i++)
+ {
+ char filename_inzip[256];
+ unz_file_info file_info;
+ uLong ratio=0;
+ const char *string_method;
+ char charCrypt=' ';
+ err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),0,0,0,0);
+ if (err!=UNZ_OK)
+ {
+ printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
+ break;
+ }
+ if (file_info.uncompressed_size>0)
+ ratio = (file_info.compressed_size*100)/file_info.uncompressed_size;
+
+ /* display a '*' if the file is crypted */
+ if ((file_info.flag & 1) != 0)
+ charCrypt='*';
+
+ if (file_info.compression_method==0)
+ string_method="Stored";
+ else
+ if (file_info.compression_method==Z_DEFLATED)
+ {
+ uInt iLevel=(uInt)((file_info.flag & 0x6)/2);
+ if (iLevel==0)
+ string_method="Defl:N";
+ else if (iLevel==1)
+ string_method="Defl:X";
+ else if ((iLevel==2) || (iLevel==3))
+ string_method="Defl:F"; /* 2:fast , 3 : extra fast*/
+ }
+ else
+ string_method="Unkn. ";
+
+ printf("%7lu %6s%c%7lu %3lu%% %2.2lu-%2.2lu-%2.2lu %2.2lu:%2.2lu %8.8lx %s\n",
+ file_info.uncompressed_size,string_method,
+ charCrypt,
+ file_info.compressed_size,
+ ratio,
+ (uLong)file_info.tmu_date.tm_mon + 1,
+ (uLong)file_info.tmu_date.tm_mday,
+ (uLong)file_info.tmu_date.tm_year % 100,
+ (uLong)file_info.tmu_date.tm_hour,(uLong)file_info.tmu_date.tm_min,
+ (uLong)file_info.crc,filename_inzip);
+ if ((i+1)<gi.number_entry)
+ {
+ err = unzGoToNextFile(uf);
+ if (err!=UNZ_OK)
+ {
+ printf("error %d with zipfile in unzGoToNextFile\n",err);
+ break;
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
+ unzFile uf;
+ const int* popt_extract_without_path;
+ int* popt_overwrite;
+ const char* password;
+{
+ char filename_inzip[256];
+ char* filename_withoutpath;
+ char* p;
+ int err=UNZ_OK;
+ FILE *fout=0;
+ void* buf;
+ uInt size_buf;
+
+ unz_file_info file_info;
+ uLong ratio=0;
+ err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),0,0,0,0);
+
+ if (err!=UNZ_OK)
+ {
+ printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
+ return err;
+ }
+
+ size_buf = WRITEBUFFERSIZE;
+ buf = (void*)malloc(size_buf);
+ if (buf==0)
+ {
+ printf("Error allocating memory\n");
+ return UNZ_INTERNALERROR;
+ }
+
+ p = filename_withoutpath = filename_inzip;
+ while ((*p) != '\0')
+ {
+ if (((*p)=='/') || ((*p)=='\\'))
+ filename_withoutpath = p+1;
+ p++;
+ }
+
+ if ((*filename_withoutpath)=='\0')
+ {
+ if ((*popt_extract_without_path)==0)
+ {
+ printf("creating directory: %s\n",filename_inzip);
+ mymkdir(filename_inzip);
+ }
+ }
+ else
+ {
+ const char* write_filename;
+ int skip=0;
+
+ if ((*popt_extract_without_path)==0)
+ write_filename = filename_inzip;
+ else
+ write_filename = filename_withoutpath;
+
+ err = unzOpenCurrentFilePassword(uf,password);
+ if (err!=UNZ_OK)
+ {
+ printf("error %d with zipfile in unzOpenCurrentFilePassword\n",err);
+ }
+
+ if (((*popt_overwrite)==0) && (err==UNZ_OK))
+ {
+ char rep=0;
+ FILE* ftestexist;
+ ftestexist = fopen(write_filename,"rb");
+ if (ftestexist!=0)
+ {
+ fclose(ftestexist);
+ do
+ {
+ char answer[128];
+ int ret;
+
+ printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename);
+ ret = scanf("%1s",answer);
+ if (ret != 1)
+ {
+ exit(EXIT_FAILURE);
+ }
+ rep = answer[0] ;
+ if ((rep>='a') && (rep<='z'))
+ rep -= 0x20;
+ }
+ while ((rep!='Y') && (rep!='N') && (rep!='A'));
+ }
+
+ if (rep == 'N')
+ skip = 1;
+
+ if (rep == 'A')
+ *popt_overwrite=1;
+ }
+
+ if ((skip==0) && (err==UNZ_OK))
+ {
+ fout=fopen(write_filename,"wb");
+
+ /* some zipfile don't contain directory alone before file */
+ if ((fout==0) && ((*popt_extract_without_path)==0) &&
+ (filename_withoutpath!=(char*)filename_inzip))
+ {
+ char c=*(filename_withoutpath-1);
+ *(filename_withoutpath-1)='\0';
+ makedir(write_filename);
+ *(filename_withoutpath-1)=c;
+ fout=fopen(write_filename,"wb");
+ }
+
+ if (fout==0)
+ {
+ printf("error opening %s\n",write_filename);
+ }
+ }
+
+ if (fout!=0)
+ {
+ printf(" extracting: %s\n",write_filename);
+
+ do
+ {
+ err = unzReadCurrentFile(uf,buf,size_buf);
+ if (err<0)
+ {
+ printf("error %d with zipfile in unzReadCurrentFile\n",err);
+ break;
+ }
+ if (err>0)
+ if (fwrite(buf,err,1,fout)!=1)
+ {
+ printf("error in writing extracted file\n");
+ err=UNZ_ERRNO;
+ break;
+ }
+ }
+ while (err>0);
+ if (fout)
+ fclose(fout);
+
+ if (err==0)
+ change_file_date(write_filename,file_info.dosDate,
+ file_info.tmu_date);
+ }
+
+ if (err==UNZ_OK)
+ {
+ err = unzCloseCurrentFile (uf);
+ if (err!=UNZ_OK)
+ {
+ printf("error %d with zipfile in unzCloseCurrentFile\n",err);
+ }
+ }
+ else
+ unzCloseCurrentFile(uf); /* don't lose the error */
+ }
+
+ free(buf);
+ return err;
+}
+
+
+int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
+ unzFile uf;
+ int opt_extract_without_path;
+ int opt_overwrite;
+ const char* password;
+{
+ uLong i;
+ unz_global_info gi;
+ int err;
+ FILE* fout=0;
+
+ err = unzGetGlobalInfo (uf,&gi);
+ if (err!=UNZ_OK)
+ printf("error %d with zipfile in unzGetGlobalInfo \n",err);
+
+ for (i=0;i<gi.number_entry;i++)
+ {
+ if (do_extract_currentfile(uf,&opt_extract_without_path,
+ &opt_overwrite,
+ password) != UNZ_OK)
+ break;
+
+ if ((i+1)<gi.number_entry)
+ {
+ err = unzGoToNextFile(uf);
+ if (err!=UNZ_OK)
+ {
+ printf("error %d with zipfile in unzGoToNextFile\n",err);
+ break;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
+ unzFile uf;
+ const char* filename;
+ int opt_extract_without_path;
+ int opt_overwrite;
+ const char* password;
+{
+ int err = UNZ_OK;
+ if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
+ {
+ printf("file %s not found in the zipfile\n",filename);
+ return 2;
+ }
+
+ if (do_extract_currentfile(uf,&opt_extract_without_path,
+ &opt_overwrite,
+ password) == UNZ_OK)
+ return 0;
+ else
+ return 1;
+}
+
+
+int main(argc,argv)
+ int argc;
+ char *argv[];
+{
+ const char *zipfilename=0;
+ const char *filename_to_extract=0;
+ const char *password=0;
+ char filename_try[MAXFILENAME+16] = "";
+ int i;
+ int opt_do_list=0;
+ int opt_do_extract=1;
+ int opt_do_extract_withoutpath=0;
+ int opt_overwrite=0;
+ int opt_extractdir=0;
+ const char *dirname=0;
+ unzFile uf=0;
+
+ do_banner();
+ if (argc==1)
+ {
+ do_help();
+ return 0;
+ }
+ else
+ {
+ for (i=1;i<argc;i++)
+ {
+ if ((*argv[i])=='-')
+ {
+ const char *p=argv[i]+1;
+
+ while ((*p)!='\0')
+ {
+ char c=*(p++);;
+ if ((c=='l') || (c=='L'))
+ opt_do_list = 1;
+ if ((c=='v') || (c=='V'))
+ opt_do_list = 1;
+ if ((c=='x') || (c=='X'))
+ opt_do_extract = 1;
+ if ((c=='e') || (c=='E'))
+ opt_do_extract = opt_do_extract_withoutpath = 1;
+ if ((c=='o') || (c=='O'))
+ opt_overwrite=1;
+ if ((c=='d') || (c=='D'))
+ {
+ opt_extractdir=1;
+ dirname=argv[i+1];
+ }
+
+ if (((c=='p') || (c=='P')) && (i+1<argc))
+ {
+ password=argv[i+1];
+ i++;
+ }
+ }
+ }
+ else
+ {
+ if (zipfilename == 0)
+ zipfilename = argv[i];
+ else if ((filename_to_extract==0) && (!opt_extractdir))
+ filename_to_extract = argv[i] ;
+ }
+ }
+ }
+
+ if (zipfilename!=0)
+ {
+
+# ifdef USEWIN32IOAPI
+ zlib_filefunc_def ffunc;
+# endif
+
+ strncpy(filename_try, zipfilename,MAXFILENAME-1);
+ /* strncpy doesnt append the trailing NULL, of the string is too long. */
+ filename_try[ MAXFILENAME ] = '\0';
+
+# ifdef USEWIN32IOAPI
+ fill_win32_filefunc(&ffunc);
+ uf = unzOpen2(zipfilename,&ffunc);
+# else
+ uf = unzOpen(zipfilename);
+# endif
+ if (uf==0)
+ {
+ strcat(filename_try,".zip");
+# ifdef USEWIN32IOAPI
+ uf = unzOpen2(filename_try,&ffunc);
+# else
+ uf = unzOpen(filename_try);
+# endif
+ }
+ }
+
+ if (uf==0)
+ {
+ printf("Cannot open %s or %s.zip\n",zipfilename,zipfilename);
+ return 1;
+ }
+ printf("%s opened\n",filename_try);
+
+ if (opt_do_list==1)
+ return do_list(uf);
+ else if (opt_do_extract==1)
+ {
+ if (opt_extractdir && chdir(dirname))
+ {
+ printf("Error changing into %s, aborting\n", dirname);
+ exit(-1);
+ }
+
+ if (filename_to_extract == 0)
+ return do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,password);
+ else
+ return do_extract_onefile(uf,filename_to_extract,
+ opt_do_extract_withoutpath,opt_overwrite,password);
+ }
+ unzCloseCurrentFile(uf);
+
+ return 0;
+}
diff --git a/ACE/contrib/minizip/minizip.c b/ACE/contrib/minizip/minizip.c
new file mode 100644
index 00000000000..e30335b5186
--- /dev/null
+++ b/ACE/contrib/minizip/minizip.c
@@ -0,0 +1,422 @@
+/*
+ minizip.c
+ Version 1.01e, February 12th, 2005
+
+ Copyright (C) 1998-2005 Gilles Vollant
+
+ $Id$
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#ifdef unix
+# include <unistd.h>
+# include <utime.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+#else
+# include <direct.h>
+# include <io.h>
+#endif
+
+#include "zip.h"
+
+#ifdef WIN32
+#define USEWIN32IOAPI
+#include "iowin32.h"
+#endif
+
+
+
+#define WRITEBUFFERSIZE (16384)
+#define MAXFILENAME (256)
+
+#ifdef WIN32
+uLong filetime(f, tmzip, dt)
+ char *f; /* name of file to get info on */
+ tm_zip *tmzip; /* return value: access, modific. and creation times */
+ uLong *dt; /* dostime */
+{
+ int ret = 0;
+ {
+ FILETIME ftLocal;
+ HANDLE hFind;
+ WIN32_FIND_DATA ff32;
+
+ hFind = FindFirstFile(f,&ff32);
+ if (hFind != INVALID_HANDLE_VALUE)
+ {
+ FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal);
+ FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0);
+ FindClose(hFind);
+ ret = 1;
+ }
+ }
+ return ret;
+}
+#else
+#ifdef unix
+uLong filetime(f, tmzip, dt)
+ char *f; /* name of file to get info on */
+ tm_zip *tmzip; /* return value: access, modific. and creation times */
+ uLong *dt; /* dostime */
+{
+ int ret=0;
+ struct stat s; /* results of stat() */
+ struct tm* filedate;
+ time_t tm_t=0;
+
+ if (strcmp(f,"-")!=0)
+ {
+ char name[MAXFILENAME+1];
+ int len = strlen(f);
+ if (len > MAXFILENAME)
+ len = MAXFILENAME;
+
+ strncpy(name, f,MAXFILENAME-1);
+ /* strncpy doesnt append the trailing NULL, of the string is too long. */
+ name[ MAXFILENAME ] = '\0';
+
+ if (name[len - 1] == '/')
+ name[len - 1] = '\0';
+ /* not all systems allow stat'ing a file with / appended */
+ if (stat(name,&s)==0)
+ {
+ tm_t = s.st_mtime;
+ ret = 1;
+ }
+ }
+ filedate = localtime(&tm_t);
+
+ tmzip->tm_sec = filedate->tm_sec;
+ tmzip->tm_min = filedate->tm_min;
+ tmzip->tm_hour = filedate->tm_hour;
+ tmzip->tm_mday = filedate->tm_mday;
+ tmzip->tm_mon = filedate->tm_mon ;
+ tmzip->tm_year = filedate->tm_year;
+
+ return ret;
+}
+#else
+uLong filetime(f, tmzip, dt)
+ char *f; /* name of file to get info on */
+ tm_zip *tmzip; /* return value: access, modific. and creation times */
+ uLong *dt; /* dostime */
+{
+ return 0;
+}
+#endif
+#endif
+
+
+
+
+int check_exist_file(filename)
+ const char* filename;
+{
+ FILE* ftestexist;
+ int ret = 1;
+ ftestexist = fopen(filename,"rb");
+ if (ftestexist==0)
+ ret = 0;
+ else
+ fclose(ftestexist);
+ return ret;
+}
+
+void do_banner()
+{
+ printf("MiniZip 1.01b, demo of zLib + Zip package written by Gilles Vollant\n");
+ printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
+}
+
+void do_help()
+{
+ printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] file.zip [files_to_add]\n\n" \
+ " -o Overwrite existing file.zip\n" \
+ " -a Append to existing file.zip\n" \
+ " -0 Store only\n" \
+ " -1 Compress faster\n" \
+ " -9 Compress better\n\n");
+}
+
+/* calculate the CRC32 of a file,
+ because to encrypt a file, we need known the CRC32 of the file before */
+int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc)
+{
+ unsigned long calculate_crc=0;
+ int err=ZIP_OK;
+ FILE * fin = fopen(filenameinzip,"rb");
+ unsigned long size_read = 0;
+ unsigned long total_read = 0;
+ if (fin==0)
+ {
+ err = ZIP_ERRNO;
+ }
+
+ if (err == ZIP_OK)
+ do
+ {
+ err = ZIP_OK;
+ size_read = (int)fread(buf,1,size_buf,fin);
+ if (size_read < size_buf)
+ if (feof(fin)==0)
+ {
+ printf("error in reading %s\n",filenameinzip);
+ err = ZIP_ERRNO;
+ }
+
+ if (size_read>0)
+ calculate_crc = crc32(calculate_crc,buf,size_read);
+ total_read += size_read;
+
+ } while ((err == ZIP_OK) && (size_read>0));
+
+ if (fin)
+ fclose(fin);
+
+ *result_crc=calculate_crc;
+ printf("file %s crc %x\n",filenameinzip,calculate_crc);
+ return err;
+}
+
+int main(argc,argv)
+ int argc;
+ char *argv[];
+{
+ int i;
+ int opt_overwrite=0;
+ int opt_compress_level=Z_DEFAULT_COMPRESSION;
+ int zipfilenamearg = 0;
+ char filename_try[MAXFILENAME+16];
+ int zipok;
+ int err=0;
+ int size_buf=0;
+ void* buf=0;
+ const char* password=0;
+
+
+ do_banner();
+ if (argc==1)
+ {
+ do_help();
+ return 0;
+ }
+ else
+ {
+ for (i=1;i<argc;i++)
+ {
+ if ((*argv[i])=='-')
+ {
+ const char *p=argv[i]+1;
+
+ while ((*p)!='\0')
+ {
+ char c=*(p++);;
+ if ((c=='o') || (c=='O'))
+ opt_overwrite = 1;
+ if ((c=='a') || (c=='A'))
+ opt_overwrite = 2;
+ if ((c>='0') && (c<='9'))
+ opt_compress_level = c-'0';
+
+ if (((c=='p') || (c=='P')) && (i+1<argc))
+ {
+ password=argv[i+1];
+ i++;
+ }
+ }
+ }
+ else
+ if (zipfilenamearg == 0)
+ zipfilenamearg = i ;
+ }
+ }
+
+ size_buf = WRITEBUFFERSIZE;
+ buf = (void*)malloc(size_buf);
+ if (buf==0)
+ {
+ printf("Error allocating memory\n");
+ return ZIP_INTERNALERROR;
+ }
+
+ if (zipfilenamearg==0)
+ zipok=0;
+ else
+ {
+ int i,len;
+ int dot_found=0;
+
+ zipok = 1 ;
+ strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1);
+ /* strncpy doesnt append the trailing NULL, of the string is too long. */
+ filename_try[ MAXFILENAME ] = '\0';
+
+ len=(int)strlen(filename_try);
+ for (i=0;i<len;i++)
+ if (filename_try[i]=='.')
+ dot_found=1;
+
+ if (dot_found==0)
+ strcat(filename_try,".zip");
+
+ if (opt_overwrite==2)
+ {
+ /* if the file don't exist, we not append file */
+ if (check_exist_file(filename_try)==0)
+ opt_overwrite=1;
+ }
+ else
+ if (opt_overwrite==0)
+ if (check_exist_file(filename_try)!=0)
+ {
+ char rep=0;
+ do
+ {
+ char answer[128];
+ int ret;
+ printf("The file %s exists. Overwrite ? [y]es, [n]o, [a]ppend : ",filename_try);
+ ret = scanf("%1s",answer);
+ if (ret != 1)
+ {
+ exit(EXIT_FAILURE);
+ }
+ rep = answer[0] ;
+ if ((rep>='a') && (rep<='z'))
+ rep -= 0x20;
+ }
+ while ((rep!='Y') && (rep!='N') && (rep!='A'));
+ if (rep=='N')
+ zipok = 0;
+ if (rep=='A')
+ opt_overwrite = 2;
+ }
+ }
+
+ if (zipok==1)
+ {
+ zipFile zf;
+ int errclose;
+# ifdef USEWIN32IOAPI
+ zlib_filefunc_def ffunc;
+ fill_win32_filefunc(&ffunc);
+ zf = zipOpen2(filename_try,(opt_overwrite==2) ? 2 : 0,0,&ffunc);
+# else
+ zf = zipOpen(filename_try,(opt_overwrite==2) ? 2 : 0);
+# endif
+
+ if (zf == 0)
+ {
+ printf("error opening %s\n",filename_try);
+ err= ZIP_ERRNO;
+ }
+ else
+ printf("creating %s\n",filename_try);
+
+ for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++)
+ {
+ if (!((((*(argv[i]))=='-') || ((*(argv[i]))=='/')) &&
+ ((argv[i][1]=='o') || (argv[i][1]=='O') ||
+ (argv[i][1]=='a') || (argv[i][1]=='A') ||
+ (argv[i][1]=='p') || (argv[i][1]=='P') ||
+ ((argv[i][1]>='0') || (argv[i][1]<='9'))) &&
+ (strlen(argv[i]) == 2)))
+ {
+ FILE * fin;
+ int size_read;
+ const char* filenameinzip = argv[i];
+ zip_fileinfo zi;
+ unsigned long crcFile=0;
+
+ zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
+ zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
+ zi.dosDate = 0;
+ zi.internal_fa = 0;
+ zi.external_fa = 0;
+ filetime(filenameinzip,&zi.tmz_date,&zi.dosDate);
+
+/*
+ err = zipOpenNewFileInZip(zf,filenameinzip,&zi,
+ 0,0,0,0,0 / * comment * /,
+ (opt_compress_level != 0) ? Z_DEFLATED : 0,
+ opt_compress_level);
+*/
+ if ((password != 0) && (err==ZIP_OK))
+ err = getFileCrc(filenameinzip,buf,size_buf,&crcFile);
+
+ err = zipOpenNewFileInZip3(zf,filenameinzip,&zi,
+ 0,0,0,0,0 /* comment*/,
+ (opt_compress_level != 0) ? Z_DEFLATED : 0,
+ opt_compress_level,0,
+ /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */
+ -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
+ password,crcFile);
+
+ if (err != ZIP_OK)
+ printf("error in opening %s in zipfile\n",filenameinzip);
+ else
+ {
+ fin = fopen(filenameinzip,"rb");
+ if (fin==0)
+ {
+ err=ZIP_ERRNO;
+ printf("error in opening %s for reading\n",filenameinzip);
+ }
+ }
+
+ if (err == ZIP_OK)
+ do
+ {
+ err = ZIP_OK;
+ size_read = (int)fread(buf,1,size_buf,fin);
+ if (size_read < size_buf)
+ if (feof(fin)==0)
+ {
+ printf("error in reading %s\n",filenameinzip);
+ err = ZIP_ERRNO;
+ }
+
+ if (size_read>0)
+ {
+ err = zipWriteInFileInZip (zf,buf,size_read);
+ if (err<0)
+ {
+ printf("error in writing %s in the zipfile\n",
+ filenameinzip);
+ }
+
+ }
+ } while ((err == ZIP_OK) && (size_read>0));
+
+ if (fin)
+ fclose(fin);
+
+ if (err<0)
+ err=ZIP_ERRNO;
+ else
+ {
+ err = zipCloseFileInZip(zf);
+ if (err!=ZIP_OK)
+ printf("error in closing %s in the zipfile\n",
+ filenameinzip);
+ }
+ }
+ }
+ errclose = zipClose(zf,0);
+ if (errclose != ZIP_OK)
+ printf("error in closing %s\n",filename_try);
+ }
+ else
+ {
+ do_help();
+ }
+
+ free(buf);
+ return 0;
+}
diff --git a/ACE/contrib/minizip/minizip.mpc b/ACE/contrib/minizip/minizip.mpc
new file mode 100644
index 00000000000..d02914de641
--- /dev/null
+++ b/ACE/contrib/minizip/minizip.mpc
@@ -0,0 +1,23 @@
+// -*- MPC -*-
+// $Id$
+
+project (minizip) : zlib, vc_warnings {
+ sharedname = minizip
+ libout = $(ACE_ROOT)/lib
+ dynamicflags += MINIZIP_BUILD_DLL
+ requires += zlib
+
+ Source_Files {
+ zip.c
+ unzip.c
+ ioapi.c
+ }
+
+ Header_Files {
+ minizip_export.h
+ ioapi.h
+ unzip.h
+ zip.h
+ }
+}
+
diff --git a/ACE/contrib/minizip/minizip_export.h b/ACE/contrib/minizip/minizip_export.h
new file mode 100644
index 00000000000..84b77df4fda
--- /dev/null
+++ b/ACE/contrib/minizip/minizip_export.h
@@ -0,0 +1,33 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+
+#ifndef MINIZIP_EXPORT_H
+#define MINIZIP_EXPORT_H
+
+#if defined (MINIZIP_AS_STATIC_LIBS)
+# if !defined (MINIZIP_HAS_DLL)
+# define MINIZIP_HAS_DLL 0
+# endif /* ! MINIZIP_HAS_DLL */
+#else
+# if !defined (MINIZIP_HAS_DLL)
+# define MINIZIP_HAS_DLL 1
+# endif /* ! MINIZIP_HAS_DLL */
+#endif /* MINIZIP_AS_STATIC_LIBS */
+
+#if defined (MINIZIP_HAS_DLL)
+# if (MINIZIP_HAS_DLL == 1) && defined (_WINDOWS)
+# if defined (MINIZIP_BUILD_DLL)
+# define MINIZIP_EXPORT __declspec(dllexport)
+# else /* MINIZIP_BUILD_DLL */
+# define MINIZIP_EXPORT __declspec(dllimport)
+# endif /* MINIZIP_BUILD_DLL */
+# else /* MINIZIP_HAS_DLL == 1 */
+# define MINIZIP_EXPORT
+# endif /* MINIZIP_HAS_DLL == 1 */
+#endif /* MINIZIP_HAS_DLL */
+
+# define MINIZIP_UNUSED_ARG(a) do {/* null */} while (&a == 0)
+
+#endif /* MINIZIP_EXPORT_H */
diff --git a/ACE/contrib/minizip/mztools.c b/ACE/contrib/minizip/mztools.c
new file mode 100644
index 00000000000..1bb1cfb8fc8
--- /dev/null
+++ b/ACE/contrib/minizip/mztools.c
@@ -0,0 +1,282 @@
+/*
+ Additional tools for Minizip
+ Code: Xavier Roche '2004
+ License: Same as ZLIB (www.gzip.org)
+ $Id$
+*/
+
+/* Code */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "zlib.h"
+#include "unzip.h"
+
+#define READ_8(adr) ((unsigned char)*(adr))
+#define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) )
+#define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) )
+
+#define WRITE_8(buff, n) do { \
+ *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \
+} while(0)
+#define WRITE_16(buff, n) do { \
+ WRITE_8((unsigned char*)(buff), n); \
+ WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \
+} while(0)
+#define WRITE_32(buff, n) do { \
+ WRITE_16((unsigned char*)(buff), (n) & 0xffff); \
+ WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
+} while(0)
+
+extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)
+const char* file;
+const char* fileOut;
+const char* fileOutTmp;
+uLong* nRecovered;
+uLong* bytesRecovered;
+{
+ int err = Z_OK;
+ FILE* fpZip = fopen(file, "rb");
+ FILE* fpOut = fopen(fileOut, "wb");
+ FILE* fpOutCD = fopen(fileOutTmp, "wb");
+ if (fpZip != 0 && fpOut != 0) {
+ int entries = 0;
+ uLong totalBytes = 0;
+ char header[30];
+ char filename[256];
+ char extra[1024];
+ int offset = 0;
+ int offsetCD = 0;
+ while ( fread(header, 1, 30, fpZip) == 30 ) {
+ int currentOffset = offset;
+
+ /* File entry */
+ if (READ_32(header) == 0x04034b50) {
+ unsigned int version = READ_16(header + 4);
+ unsigned int gpflag = READ_16(header + 6);
+ unsigned int method = READ_16(header + 8);
+ unsigned int filetime = READ_16(header + 10);
+ unsigned int filedate = READ_16(header + 12);
+ unsigned int crc = READ_32(header + 14); /* crc */
+ unsigned int cpsize = READ_32(header + 18); /* compressed size */
+ unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */
+ unsigned int fnsize = READ_16(header + 26); /* file name length */
+ unsigned int extsize = READ_16(header + 28); /* extra field length */
+ filename[0] = extra[0] = '\0';
+
+ /* Header */
+ if (fwrite(header, 1, 30, fpOut) == 30) {
+ offset += 30;
+ } else {
+ err = Z_ERRNO;
+ break;
+ }
+
+ /* Filename */
+ if (fnsize > 0) {
+ if (fread(filename, 1, fnsize, fpZip) == fnsize) {
+ if (fwrite(filename, 1, fnsize, fpOut) == fnsize) {
+ offset += fnsize;
+ } else {
+ err = Z_ERRNO;
+ break;
+ }
+ } else {
+ err = Z_ERRNO;
+ break;
+ }
+ } else {
+ err = Z_STREAM_ERROR;
+ break;
+ }
+
+ /* Extra field */
+ if (extsize > 0) {
+ if (fread(extra, 1, extsize, fpZip) == extsize) {
+ if (fwrite(extra, 1, extsize, fpOut) == extsize) {
+ offset += extsize;
+ } else {
+ err = Z_ERRNO;
+ break;
+ }
+ } else {
+ err = Z_ERRNO;
+ break;
+ }
+ }
+
+ /* Data */
+ {
+ int dataSize = cpsize;
+ if (dataSize == 0) {
+ dataSize = uncpsize;
+ }
+ if (dataSize > 0) {
+ char* data = malloc(dataSize);
+ if (data != 0) {
+ if ((int)fread(data, 1, dataSize, fpZip) == dataSize) {
+ if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) {
+ offset += dataSize;
+ totalBytes += dataSize;
+ } else {
+ err = Z_ERRNO;
+ }
+ } else {
+ err = Z_ERRNO;
+ }
+ free(data);
+ if (err != Z_OK) {
+ break;
+ }
+ } else {
+ err = Z_MEM_ERROR;
+ break;
+ }
+ }
+ }
+
+ /* Central directory entry */
+ {
+ char header[46];
+ char* comment = "";
+ int comsize = (int) strlen(comment);
+ WRITE_32(header, 0x02014b50);
+ WRITE_16(header + 4, version);
+ WRITE_16(header + 6, version);
+ WRITE_16(header + 8, gpflag);
+ WRITE_16(header + 10, method);
+ WRITE_16(header + 12, filetime);
+ WRITE_16(header + 14, filedate);
+ WRITE_32(header + 16, crc);
+ WRITE_32(header + 20, cpsize);
+ WRITE_32(header + 24, uncpsize);
+ WRITE_16(header + 28, fnsize);
+ WRITE_16(header + 30, extsize);
+ WRITE_16(header + 32, comsize);
+ WRITE_16(header + 34, 0); /* disk # */
+ WRITE_16(header + 36, 0); /* int attrb */
+ WRITE_32(header + 38, 0); /* ext attrb */
+ WRITE_32(header + 42, currentOffset);
+ /* Header */
+ if (fwrite(header, 1, 46, fpOutCD) == 46) {
+ offsetCD += 46;
+
+ /* Filename */
+ if (fnsize > 0) {
+ if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) {
+ offsetCD += fnsize;
+ } else {
+ err = Z_ERRNO;
+ break;
+ }
+ } else {
+ err = Z_STREAM_ERROR;
+ break;
+ }
+
+ /* Extra field */
+ if (extsize > 0) {
+ if (fwrite(extra, 1, extsize, fpOutCD) == extsize) {
+ offsetCD += extsize;
+ } else {
+ err = Z_ERRNO;
+ break;
+ }
+ }
+
+ /* Comment field */
+ if (comsize > 0) {
+ if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) {
+ offsetCD += comsize;
+ } else {
+ err = Z_ERRNO;
+ break;
+ }
+ }
+
+
+ } else {
+ err = Z_ERRNO;
+ break;
+ }
+ }
+
+ /* Success */
+ entries++;
+
+ } else {
+ break;
+ }
+ }
+
+ /* Final central directory */
+ {
+ int entriesZip = entries;
+ char header[22];
+ char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools";
+ int comsize = (int) strlen(comment);
+ if (entriesZip > 0xffff) {
+ entriesZip = 0xffff;
+ }
+ WRITE_32(header, 0x06054b50);
+ WRITE_16(header + 4, 0); /* disk # */
+ WRITE_16(header + 6, 0); /* disk # */
+ WRITE_16(header + 8, entriesZip); /* hack */
+ WRITE_16(header + 10, entriesZip); /* hack */
+ WRITE_32(header + 12, offsetCD); /* size of CD */
+ WRITE_32(header + 16, offset); /* offset to CD */
+ WRITE_16(header + 20, comsize); /* comment */
+
+ /* Header */
+ if (fwrite(header, 1, 22, fpOutCD) == 22) {
+
+ /* Comment field */
+ if (comsize > 0) {
+ if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) {
+ err = Z_ERRNO;
+ }
+ }
+
+ } else {
+ err = Z_ERRNO;
+ }
+ }
+
+ /* Final merge (file + central directory) */
+ fclose(fpOutCD);
+ if (err == Z_OK) {
+ fpOutCD = fopen(fileOutTmp, "rb");
+ if (fpOutCD != 0) {
+ int nRead;
+ char buffer[8192];
+ while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) {
+ if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) {
+ err = Z_ERRNO;
+ break;
+ }
+ }
+ fclose(fpOutCD);
+ }
+ }
+
+ /* Close */
+ fclose(fpZip);
+ fclose(fpOut);
+
+ /* Wipe temporary file */
+ (void)remove(fileOutTmp);
+
+ /* Number of recovered entries */
+ if (err == Z_OK) {
+ if (nRecovered != 0) {
+ *nRecovered = entries;
+ }
+ if (bytesRecovered != 0) {
+ *bytesRecovered = totalBytes;
+ }
+ }
+ } else {
+ err = Z_STREAM_ERROR;
+ }
+ return err;
+}
diff --git a/ACE/contrib/minizip/mztools.h b/ACE/contrib/minizip/mztools.h
new file mode 100644
index 00000000000..6e0ddaaf796
--- /dev/null
+++ b/ACE/contrib/minizip/mztools.h
@@ -0,0 +1,32 @@
+/*
+ Additional tools for Minizip
+ Code: Xavier Roche '2004
+ License: Same as ZLIB (www.gzip.org)
+ $Id$
+*/
+
+#ifndef _zip_tools_H
+#define _zip_tools_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _ZLIB_H
+#include "zlib.h"
+#endif
+
+#include "unzip.h"
+
+/* Repair a ZIP file (missing central directory)
+ file: file to recover
+ fileOut: output file after recovery
+ fileOutTmp: temporary file name used for recovery
+*/
+extern int ZEXPORT unzRepair(const char* file,
+ const char* fileOut,
+ const char* fileOutTmp,
+ uLong* nRecovered,
+ uLong* bytesRecovered);
+
+#endif
diff --git a/ACE/contrib/minizip/unzip.c b/ACE/contrib/minizip/unzip.c
new file mode 100644
index 00000000000..171c2281562
--- /dev/null
+++ b/ACE/contrib/minizip/unzip.c
@@ -0,0 +1,1536 @@
+/* unzip.c -- IO for uncompress .zip files using zlib
+ Version 1.01e, February 12th, 2005
+
+ Copyright (C) 1998-2005 Gilles Vollant
+
+ Read unzip.h for more info
+ $Id$
+*/
+
+/* Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of
+compatibility with older software. The following is from the original crypt.c. Code
+woven in by Terry Thorsen 1/2003.
+*/
+/*
+ Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
+
+ See the accompanying file LICENSE, version 2000-Apr-09 or later
+ (the contents of which are also included in zip.h) for terms of use.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+/*
+ crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h]
+
+ The encryption/decryption parts of this source code (as opposed to the
+ non-echoing password parts) were originally written in Europe. The
+ whole source package can be freely distributed, including from the USA.
+ (Prior to January 2000, re-export from the US was a violation of US law.)
+ */
+
+/*
+ This encryption code is a direct transcription of the algorithm from
+ Roger Schlafly, described by Phil Katz in the file appnote.txt. This
+ file (appnote.txt) is distributed with the PKZIP program (even in the
+ version without encryption capabilities).
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "zlib.h"
+#include "unzip.h"
+
+#ifdef STDC
+# include <stddef.h>
+# include <string.h>
+# include <stdlib.h>
+#endif
+#ifdef NO_ERRNO_H
+ extern int errno;
+#else
+# include <errno.h>
+#endif
+
+
+#ifndef local
+# define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+
+#ifndef CASESENSITIVITYDEFAULT_NO
+# if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES)
+# define CASESENSITIVITYDEFAULT_NO
+# endif
+#endif
+
+
+#ifndef UNZ_BUFSIZE
+#define UNZ_BUFSIZE (16384)
+#endif
+
+#ifndef UNZ_MAXFILENAMEINZIP
+#define UNZ_MAXFILENAMEINZIP (256)
+#endif
+
+#ifndef ALLOC
+# define ALLOC(size) (malloc(size))
+#endif
+#ifndef TRYFREE
+# define TRYFREE(p) {if (p) free(p);}
+#endif
+
+#define SIZECENTRALDIRITEM (0x2e)
+#define SIZEZIPLOCALHEADER (0x1e)
+
+
+
+
+const char unz_copyright[] =
+ " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
+
+/* unz_file_info_interntal contain internal info about a file in zipfile*/
+typedef struct unz_file_info_internal_s
+{
+ uLong offset_curfile;/* relative offset of local header 4 bytes */
+} unz_file_info_internal;
+
+
+/* file_in_zip_read_info_s contain internal information about a file in zipfile,
+ when reading and decompress it */
+typedef struct
+{
+ char *read_buffer; /* internal buffer for compressed data */
+ z_stream stream; /* zLib stream structure for inflate */
+
+ uLong pos_in_zipfile; /* position in byte on the zipfile, for fseek*/
+ uLong stream_initialised; /* flag set if stream structure is initialised*/
+
+ uLong offset_local_extrafield;/* offset of the local extra field */
+ uInt size_local_extrafield;/* size of the local extra field */
+ uLong pos_local_extrafield; /* position in the local extra field in read*/
+
+ uLong crc32; /* crc32 of all data uncompressed */
+ uLong crc32_wait; /* crc32 we must obtain after decompress all */
+ uLong rest_read_compressed; /* number of byte to be decompressed */
+ uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/
+ zlib_filefunc_def z_filefunc;
+ voidpf filestream; /* io structore of the zipfile */
+ uLong compression_method; /* compression method (0==store) */
+ uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
+ int raw;
+} file_in_zip_read_info_s;
+
+
+/* unz_s contain internal information about the zipfile
+*/
+typedef struct
+{
+ zlib_filefunc_def z_filefunc;
+ voidpf filestream; /* io structore of the zipfile */
+ unz_global_info gi; /* public global information */
+ uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
+ uLong num_file; /* number of the current file in the zipfile*/
+ uLong pos_in_central_dir; /* pos of the current file in the central dir*/
+ uLong current_file_ok; /* flag about the usability of the current file*/
+ uLong central_pos; /* position of the beginning of the central dir*/
+
+ uLong size_central_dir; /* size of the central directory */
+ uLong offset_central_dir; /* offset of start of central directory with
+ respect to the starting disk number */
+
+ unz_file_info cur_file_info; /* public info about the current file in zip*/
+ unz_file_info_internal cur_file_info_internal; /* private info about it*/
+ file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current
+ file if we are decompressing it */
+ int encrypted;
+# ifndef NOUNCRYPT
+ unsigned long keys[3]; /* keys defining the pseudo-random sequence */
+ const unsigned long* pcrc_32_tab;
+# endif
+} unz_s;
+
+
+#ifndef NOUNCRYPT
+#include "crypt.h"
+#endif
+
+/* ===========================================================================
+ Read a byte from a gz_stream; update next_in and avail_in. Return EOF
+ for end of file.
+ IN assertion: the stream s has been sucessfully opened for reading.
+*/
+
+
+local int unzlocal_getByte OF((
+ const zlib_filefunc_def* pzlib_filefunc_def,
+ voidpf filestream,
+ int *pi));
+
+local int unzlocal_getByte(const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream,int *pi)
+
+{
+ unsigned char c;
+ int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
+ if (err==1)
+ {
+ *pi = (int)c;
+ return UNZ_OK;
+ }
+ else
+ {
+ if (ZERROR(*pzlib_filefunc_def,filestream))
+ return UNZ_ERRNO;
+ else
+ return UNZ_EOF;
+ }
+}
+
+
+/* ===========================================================================
+ Reads a long in LSB order from the given gz_stream. Sets
+*/
+local int unzlocal_getShort OF((
+ const zlib_filefunc_def* pzlib_filefunc_def,
+ voidpf filestream,
+ uLong *pX));
+
+local int unzlocal_getShort (const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream,uLong *pX)
+
+{
+ uLong x ;
+ int i = 0;
+ int err;
+
+ err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x = (uLong)i;
+
+ if (err==UNZ_OK)
+ err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x += ((uLong)i)<<8;
+
+ if (err==UNZ_OK)
+ *pX = x;
+ else
+ *pX = 0;
+ return err;
+}
+
+local int unzlocal_getLong OF((
+ const zlib_filefunc_def* pzlib_filefunc_def,
+ voidpf filestream,
+ uLong *pX));
+
+local int unzlocal_getLong (const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream,uLong *pX)
+
+{
+ uLong x ;
+ int i = 0;
+ int err;
+
+ err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x = (uLong)i;
+
+ if (err==UNZ_OK)
+ err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x += ((uLong)i)<<8;
+
+ if (err==UNZ_OK)
+ err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x += ((uLong)i)<<16;
+
+ if (err==UNZ_OK)
+ err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x += ((uLong)i)<<24;
+
+ if (err==UNZ_OK)
+ *pX = x;
+ else
+ *pX = 0;
+ return err;
+}
+
+
+/* My own strcmpi / strcasecmp */
+local int strcmpcasenosensitive_internal(const char* fileName1,const char* fileName2)
+
+{
+ for (;;)
+ {
+ char c1=*(fileName1++);
+ char c2=*(fileName2++);
+ if ((c1>='a') && (c1<='z'))
+ c1 -= 0x20;
+ if ((c2>='a') && (c2<='z'))
+ c2 -= 0x20;
+ if (c1=='\0')
+ return ((c2=='\0') ? 0 : -1);
+ if (c2=='\0')
+ return 1;
+ if (c1<c2)
+ return -1;
+ if (c1>c2)
+ return 1;
+ }
+}
+
+
+#ifdef CASESENSITIVITYDEFAULT_NO
+#define CASESENSITIVITYDEFAULTVALUE 2
+#else
+#define CASESENSITIVITYDEFAULTVALUE 1
+#endif
+
+#ifndef STRCMPCASENOSENTIVEFUNCTION
+#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
+#endif
+
+/*
+ Compare two filename (fileName1,fileName2).
+ If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
+ If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
+ or strcasecmp)
+ If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
+ (like 1 on Unix, 2 on Windows)
+
+*/
+extern MINIZIP_EXPORT int unzStringFileNameCompare (const char* fileName1,const char* fileName2,int iCaseSensitivity)
+
+{
+ if (iCaseSensitivity==0)
+ iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
+
+ if (iCaseSensitivity==1)
+ return strcmp(fileName1,fileName2);
+
+ return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
+}
+
+#ifndef BUFREADCOMMENT
+#define BUFREADCOMMENT (0x400)
+#endif
+
+/*
+ Locate the Central directory of a zipfile (at the end, just before
+ the global comment)
+*/
+local uLong unzlocal_SearchCentralDir OF((
+ const zlib_filefunc_def* pzlib_filefunc_def,
+ voidpf filestream));
+
+local uLong unzlocal_SearchCentralDir(const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream)
+
+{
+ unsigned char* buf;
+ uLong uSizeFile;
+ uLong uBackRead;
+ uLong uMaxBack=0xffff; /* maximum size of global comment */
+ uLong uPosFound=0;
+
+ if (ZSEEK(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
+ return 0;
+
+
+ uSizeFile = ZTELL(*pzlib_filefunc_def,filestream);
+
+ if (uMaxBack>uSizeFile)
+ uMaxBack = uSizeFile;
+
+ buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
+ if (buf==0)
+ return 0;
+
+ uBackRead = 4;
+ while (uBackRead<uMaxBack)
+ {
+ uLong uReadSize,uReadPos ;
+ int i;
+ if (uBackRead+BUFREADCOMMENT>uMaxBack)
+ uBackRead = uMaxBack;
+ else
+ uBackRead+=BUFREADCOMMENT;
+ uReadPos = uSizeFile-uBackRead ;
+
+ uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
+ (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
+ if (ZSEEK(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
+ break;
+
+ if (ZREAD(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
+ break;
+
+ for (i=(int)uReadSize-3; (i--)>0;)
+ if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
+ ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
+ {
+ uPosFound = uReadPos+i;
+ break;
+ }
+
+ if (uPosFound!=0)
+ break;
+ }
+ TRYFREE(buf);
+ return uPosFound;
+}
+
+/*
+ Open a Zip file. path contain the full pathname (by example,
+ on a Windows NT computer "c:\\test\\zlib114.zip" or on an Unix computer
+ "zlib/zlib114.zip".
+ If the zipfile cannot be opened (file doesn't exist or in not valid), the
+ return value is NULL.
+ Else, the return value is a unzFile Handle, usable with other function
+ of this unzip package.
+*/
+extern MINIZIP_EXPORT unzFile unzOpen2 (const char *path, zlib_filefunc_def* pzlib_filefunc_def)
+ {
+ unz_s us;
+ unz_s *s;
+ uLong central_pos,uL;
+
+ uLong number_disk; /* number of the current dist, used for
+ spaning ZIP, unsupported, always 0*/
+ uLong number_disk_with_CD; /* number the the disk with central dir, used
+ for spaning ZIP, unsupported, always 0*/
+ uLong number_entry_CD; /* total number of entries in
+ the central dir
+ (same than number_entry on nospan) */
+
+ int err=UNZ_OK;
+
+ if (unz_copyright[0]!=' ')
+ return 0;
+
+ if (pzlib_filefunc_def==0)
+ fill_fopen_filefunc(&us.z_filefunc);
+ else
+ us.z_filefunc = *pzlib_filefunc_def;
+
+ us.filestream= (*(us.z_filefunc.zopen_file))(us.z_filefunc.opaque,
+ path,
+ ZLIB_FILEFUNC_MODE_READ |
+ ZLIB_FILEFUNC_MODE_EXISTING);
+ if (us.filestream==0)
+ return 0;
+
+ central_pos = unzlocal_SearchCentralDir(&us.z_filefunc,us.filestream);
+ if (central_pos==0)
+ err=UNZ_ERRNO;
+
+ if (ZSEEK(us.z_filefunc, us.filestream,
+ central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
+ err=UNZ_ERRNO;
+
+ /* the signature, already checked */
+ if (unzlocal_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ /* number of this disk */
+ if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ /* number of the disk with the start of the central directory */
+ if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ /* total number of entries in the central dir on this disk */
+ if (unzlocal_getShort(&us.z_filefunc, us.filestream,&us.gi.number_entry)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ /* total number of entries in the central dir */
+ if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_entry_CD)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if ((number_entry_CD!=us.gi.number_entry) ||
+ (number_disk_with_CD!=0) ||
+ (number_disk!=0))
+ err=UNZ_BADZIPFILE;
+
+ /* size of the central directory */
+ if (unzlocal_getLong(&us.z_filefunc, us.filestream,&us.size_central_dir)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ /* offset of start of central directory with respect to the
+ starting disk number */
+ if (unzlocal_getLong(&us.z_filefunc, us.filestream,&us.offset_central_dir)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ /* zipfile comment length */
+ if (unzlocal_getShort(&us.z_filefunc, us.filestream,&us.gi.size_comment)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
+ (err==UNZ_OK))
+ err=UNZ_BADZIPFILE;
+
+ if (err!=UNZ_OK)
+ {
+ ZCLOSE(us.z_filefunc, us.filestream);
+ return 0;
+ }
+
+ us.byte_before_the_zipfile = central_pos -
+ (us.offset_central_dir+us.size_central_dir);
+ us.central_pos = central_pos;
+ us.pfile_in_zip_read = 0;
+ us.encrypted = 0;
+
+
+ s=(unz_s*)ALLOC(sizeof(unz_s));
+ *s=us;
+ unzGoToFirstFile((unzFile)s);
+ return (unzFile)s;
+}
+
+
+extern MINIZIP_EXPORT unzFile unzOpen (const char *path)
+
+{
+ return unzOpen2(path, 0);
+}
+
+/*
+ Close a ZipFile opened with unzipOpen.
+ If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
+ these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
+ return UNZ_OK if there is no problem. */
+ extern MINIZIP_EXPORT int unzClose (unzFile file)
+ {
+ unz_s* s;
+ if (file==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+
+ if (s->pfile_in_zip_read!=0)
+ unzCloseCurrentFile(file);
+
+ ZCLOSE(s->z_filefunc, s->filestream);
+ TRYFREE(s);
+ return UNZ_OK;
+}
+
+
+/*
+ Write info about the ZipFile in the *pglobal_info structure.
+ No preparation of the structure is needed
+ return UNZ_OK if there is no problem. */
+extern MINIZIP_EXPORT int unzGetGlobalInfo (unzFile file,unz_global_info *pglobal_info)
+ {
+ unz_s* s;
+ if (file==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ *pglobal_info=s->gi;
+ return UNZ_OK;
+}
+
+
+/*
+ Translate date/time from Dos format to tm_unz (readable more easilty)
+*/
+local void unzlocal_DosDateToTmuDate (uLong ulDosDate,tm_unz* ptm)
+ {
+ uLong uDate;
+ uDate = (uLong)(ulDosDate>>16);
+ ptm->tm_mday = (uInt)(uDate&0x1f) ;
+ ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ;
+ ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ;
+
+ ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800);
+ ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ;
+ ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ;
+}
+
+/*
+ Get Info about the current file in the zipfile, with internal only info
+*/
+local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
+ unz_file_info *pfile_info,
+ unz_file_info_internal
+ *pfile_info_internal,
+ char *szFileName,
+ uLong fileNameBufferSize,
+ void *extraField,
+ uLong extraFieldBufferSize,
+ char *szComment,
+ uLong commentBufferSize));
+
+local int unzlocal_GetCurrentFileInfoInternal (unzFile file,
+ unz_file_info *pfile_info,
+ unz_file_info_internal *pfile_info_internal,
+ char *szFileName,uLong fileNameBufferSize,
+ void *extraField,uLong extraFieldBufferSize,
+ char *szComment,uLong commentBufferSize)
+
+{
+ unz_s* s;
+ unz_file_info file_info;
+ unz_file_info_internal file_info_internal;
+ int err=UNZ_OK;
+ uLong uMagic;
+ long lSeek=0;
+
+ if (file==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ if (ZSEEK(s->z_filefunc, s->filestream,
+ s->pos_in_central_dir+s->byte_before_the_zipfile,
+ ZLIB_FILEFUNC_SEEK_SET)!=0)
+ err=UNZ_ERRNO;
+
+
+ /* we check the magic */
+ if (err==UNZ_OK)
+ {if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
+ err=UNZ_ERRNO;
+ else if (uMagic!=0x02014b50)
+ err=UNZ_BADZIPFILE;
+ }
+ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version_needed) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.flag) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.compression_method) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.dosDate) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date);
+
+ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.crc) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_filename) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_extra) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_comment) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.internal_fa) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ lSeek+=file_info.size_filename;
+ if ((err==UNZ_OK) && (szFileName!=0))
+ {
+ uLong uSizeRead ;
+ if (file_info.size_filename<fileNameBufferSize)
+ {
+ *(szFileName+file_info.size_filename)='\0';
+ uSizeRead = file_info.size_filename;
+ }
+ else
+ uSizeRead = fileNameBufferSize;
+
+ if ((file_info.size_filename>0) && (fileNameBufferSize>0))
+ if (ZREAD(s->z_filefunc, s->filestream,szFileName,uSizeRead)!=uSizeRead)
+ err=UNZ_ERRNO;
+ lSeek -= uSizeRead;
+ }
+
+
+ if ((err==UNZ_OK) && (extraField!=0))
+ {
+ uLong uSizeRead ;
+ if (file_info.size_file_extra<extraFieldBufferSize)
+ uSizeRead = file_info.size_file_extra;
+ else
+ uSizeRead = extraFieldBufferSize;
+
+ if (lSeek!=0)
+ {
+ if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+ lSeek=0;
+ else
+ err=UNZ_ERRNO;
+ }
+
+ if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
+ {
+ if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
+ err=UNZ_ERRNO;
+
+ lSeek += file_info.size_file_extra - uSizeRead;
+ }
+ }
+ else
+ lSeek+=file_info.size_file_extra;
+
+
+ if ((err==UNZ_OK) && (szComment!=0))
+ {
+ uLong uSizeRead ;
+ if (file_info.size_file_comment<commentBufferSize)
+ {
+ *(szComment+file_info.size_file_comment)='\0';
+ uSizeRead = file_info.size_file_comment;
+ }
+ else
+ uSizeRead = commentBufferSize;
+
+ if (lSeek!=0)
+ {if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+ lSeek=0;
+ else
+ err=UNZ_ERRNO;
+ }
+ if ((file_info.size_file_comment>0) && (commentBufferSize>0))
+ if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
+ err=UNZ_ERRNO;
+ lSeek+=file_info.size_file_comment - uSizeRead;
+ }
+ else
+ lSeek+=file_info.size_file_comment;
+
+ if ((err==UNZ_OK) && (pfile_info!=0))
+ *pfile_info=file_info;
+
+ if ((err==UNZ_OK) && (pfile_info_internal!=0))
+ *pfile_info_internal=file_info_internal;
+
+ return err;
+}
+
+
+
+/*
+ Write info about the ZipFile in the *pglobal_info structure.
+ No preparation of the structure is needed
+ return UNZ_OK if there is no problem.
+*/extern MINIZIP_EXPORT int unzGetCurrentFileInfo (unzFile file,
+ unz_file_info *pfile_info,
+ char *szFileName,uLong fileNameBufferSize,
+ void *extraField,uLong extraFieldBufferSize,
+ char *szComment,uLong commentBufferSize)
+{
+ return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,0,
+ szFileName,fileNameBufferSize,
+ extraField,extraFieldBufferSize,
+ szComment,commentBufferSize);
+}
+
+/*
+ Set the current file of the zipfile to the first file.
+ return UNZ_OK if there is no problem
+*/
+extern MINIZIP_EXPORT int unzGoToFirstFile (unzFile file)
+ {
+ int err=UNZ_OK;
+ unz_s* s;
+ if (file==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ s->pos_in_central_dir=s->offset_central_dir;
+ s->num_file=0;
+ err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
+ &s->cur_file_info_internal,
+ 0,0,0,0,0,0);
+ s->current_file_ok = (err == UNZ_OK);
+ return err;
+}
+
+/*
+ Set the current file of the zipfile to the next file.
+ return UNZ_OK if there is no problem
+ return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
+*/
+extern MINIZIP_EXPORT int unzGoToNextFile (unzFile file)
+ {
+ unz_s* s;
+ int err;
+
+ if (file==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ if (!s->current_file_ok)
+ return UNZ_END_OF_LIST_OF_FILE;
+ if (s->gi.number_entry != 0xffff) /* 2^16 files overflow hack */
+ if (s->num_file+1==s->gi.number_entry)
+ return UNZ_END_OF_LIST_OF_FILE;
+
+ s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +
+ s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ;
+ s->num_file++;
+ err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
+ &s->cur_file_info_internal,
+ 0,0,0,0,0,0);
+ s->current_file_ok = (err == UNZ_OK);
+ return err;
+}
+
+
+/*
+ Try locate the file szFileName in the zipfile.
+ For the iCaseSensitivity signification, see unzipStringFileNameCompare
+
+ return value :
+ UNZ_OK if the file is found. It becomes the current file.
+ UNZ_END_OF_LIST_OF_FILE if the file is not found
+*/
+extern MINIZIP_EXPORT int unzLocateFile (unzFile file,const char * szFileName,int iCaseSensitivity)
+ {
+ unz_s* s;
+ int err;
+
+ /* We remember the 'current' position in the file so that we can jump
+ * back there if we fail.
+ */
+ unz_file_info cur_file_infoSaved;
+ unz_file_info_internal cur_file_info_internalSaved;
+ uLong num_fileSaved;
+ uLong pos_in_central_dirSaved;
+
+
+ if (file==0)
+ return UNZ_PARAMERROR;
+
+ if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP)
+ return UNZ_PARAMERROR;
+
+ s=(unz_s*)file;
+ if (!s->current_file_ok)
+ return UNZ_END_OF_LIST_OF_FILE;
+
+ /* Save the current state */
+ num_fileSaved = s->num_file;
+ pos_in_central_dirSaved = s->pos_in_central_dir;
+ cur_file_infoSaved = s->cur_file_info;
+ cur_file_info_internalSaved = s->cur_file_info_internal;
+
+ err = unzGoToFirstFile(file);
+
+ while (err == UNZ_OK)
+ {
+ char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
+ err = unzGetCurrentFileInfo(file,0,
+ szCurrentFileName,sizeof(szCurrentFileName)-1,
+ 0,0,0,0);
+ if (err == UNZ_OK)
+ {
+ if (unzStringFileNameCompare(szCurrentFileName,
+ szFileName,iCaseSensitivity)==0)
+ return UNZ_OK;
+ err = unzGoToNextFile(file);
+ }
+ }
+
+ /* We failed, so restore the state of the 'current file' to where we
+ * were.
+ */
+ s->num_file = num_fileSaved ;
+ s->pos_in_central_dir = pos_in_central_dirSaved ;
+ s->cur_file_info = cur_file_infoSaved;
+ s->cur_file_info_internal = cur_file_info_internalSaved;
+ return err;
+}
+
+
+/*
+///////////////////////////////////////////
+// Contributed by Ryan Haksi (mailto://cryogen@infoserve.net)
+// I need random access
+//
+// Further optimization could be realized by adding an ability
+// to cache the directory in memory. The goal being a single
+// comprehensive file read to put the file I need in a memory.
+*/
+
+/*
+typedef struct unz_file_pos_s
+{
+ uLong pos_in_zip_directory; // offset in file
+ uLong num_of_file; // # of file
+} unz_file_pos;
+*/
+
+extern MINIZIP_EXPORT int unzGetFilePos(unzFile file,unz_file_pos* file_pos)
+ {
+ unz_s* s;
+
+ if (file==0 || file_pos==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ if (!s->current_file_ok)
+ return UNZ_END_OF_LIST_OF_FILE;
+
+ file_pos->pos_in_zip_directory = s->pos_in_central_dir;
+ file_pos->num_of_file = s->num_file;
+
+ return UNZ_OK;
+}
+
+extern MINIZIP_EXPORT int unzGoToFilePos(unzFile file,unz_file_pos* file_pos)
+ {
+ unz_s* s;
+ int err;
+
+ if (file==0 || file_pos==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+
+ /* jump to the right spot */
+ s->pos_in_central_dir = file_pos->pos_in_zip_directory;
+ s->num_file = file_pos->num_of_file;
+
+ /* set the current file */
+ err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
+ &s->cur_file_info_internal,
+ 0,0,0,0,0,0);
+ /* return results */
+ s->current_file_ok = (err == UNZ_OK);
+ return err;
+}
+
+/*
+// Unzip Helper Functions - should be here?
+///////////////////////////////////////////
+*/
+
+/*
+ Read the local header of the current zipfile
+ Check the coherency of the local header and info in the end of central
+ directory about this file
+ store in *piSizeVar the size of extra info in local header
+ (filename and size of extra field data)
+*/
+local int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s,uInt* piSizeVar,
+ uLong *poffset_local_extrafield,
+ uInt *psize_local_extrafield)
+ {
+ uLong uMagic,uData,uFlags;
+ uLong size_filename;
+ uLong size_extra_field;
+ int err=UNZ_OK;
+
+ *piSizeVar = 0;
+ *poffset_local_extrafield = 0;
+ *psize_local_extrafield = 0;
+
+ if (ZSEEK(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile +
+ s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)
+ return UNZ_ERRNO;
+
+
+ if (err==UNZ_OK)
+ {
+ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
+ err=UNZ_ERRNO;
+ else if (uMagic!=0x04034b50)
+ err=UNZ_BADZIPFILE;
+ }
+
+
+ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
+ err=UNZ_ERRNO;
+/*
+ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
+ err=UNZ_BADZIPFILE;
+*/
+ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
+ err=UNZ_ERRNO;
+ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method))
+ err=UNZ_BADZIPFILE;
+
+ if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
+ (s->cur_file_info.compression_method!=Z_DEFLATED))
+ err=UNZ_BADZIPFILE;
+
+ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */
+ err=UNZ_ERRNO;
+ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) &&
+ ((uFlags & 8)==0))
+ err=UNZ_BADZIPFILE;
+
+ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */
+ err=UNZ_ERRNO;
+ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) &&
+ ((uFlags & 8)==0))
+ err=UNZ_BADZIPFILE;
+
+ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */
+ err=UNZ_ERRNO;
+ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
+ ((uFlags & 8)==0))
+ err=UNZ_BADZIPFILE;
+
+
+ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_filename) != UNZ_OK)
+ err=UNZ_ERRNO;
+ else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename))
+ err=UNZ_BADZIPFILE;
+
+ *piSizeVar += (uInt)size_filename;
+
+ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK)
+ err=UNZ_ERRNO;
+ *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile +
+ SIZEZIPLOCALHEADER + size_filename;
+ *psize_local_extrafield = (uInt)size_extra_field;
+
+ *piSizeVar += (uInt)size_extra_field;
+
+ return err;
+}
+
+/*
+ Open for reading data the current file in the zipfile.
+ If there is no error and the file is opened, the return value is UNZ_OK.
+*/
+extern MINIZIP_EXPORT int unzOpenCurrentFile3 (unzFile file,int* method,int* level,int raw,const char* password)
+ {
+ int err=UNZ_OK;
+ uInt iSizeVar;
+ unz_s* s;
+ file_in_zip_read_info_s* pfile_in_zip_read_info;
+ uLong offset_local_extrafield; /* offset of the local extra field */
+ uInt size_local_extrafield; /* size of the local extra field */
+# ifndef NOUNCRYPT
+ char source[12];
+# else
+ if (password != 0)
+ return UNZ_PARAMERROR;
+# endif
+
+ if (file==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ if (!s->current_file_ok)
+ return UNZ_PARAMERROR;
+
+ if (s->pfile_in_zip_read != 0)
+ unzCloseCurrentFile(file);
+
+ if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar,
+ &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
+ return UNZ_BADZIPFILE;
+
+ pfile_in_zip_read_info = (file_in_zip_read_info_s*)
+ ALLOC(sizeof(file_in_zip_read_info_s));
+ if (pfile_in_zip_read_info==0)
+ return UNZ_INTERNALERROR;
+
+ pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE);
+ pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
+ pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
+ pfile_in_zip_read_info->pos_local_extrafield=0;
+ pfile_in_zip_read_info->raw=raw;
+
+ if (pfile_in_zip_read_info->read_buffer==0)
+ {
+ TRYFREE(pfile_in_zip_read_info);
+ return UNZ_INTERNALERROR;
+ }
+
+ pfile_in_zip_read_info->stream_initialised=0;
+
+ if (method!=0)
+ *method = (int)s->cur_file_info.compression_method;
+
+ if (level!=0)
+ {
+ *level = 6;
+ switch (s->cur_file_info.flag & 0x06)
+ {
+ case 6 : *level = 1; break;
+ case 4 : *level = 2; break;
+ case 2 : *level = 9; break;
+ }
+ }
+
+ if ((s->cur_file_info.compression_method!=0) &&
+ (s->cur_file_info.compression_method!=Z_DEFLATED))
+ err=UNZ_BADZIPFILE;
+
+ pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc;
+ pfile_in_zip_read_info->crc32=0;
+ pfile_in_zip_read_info->compression_method =
+ s->cur_file_info.compression_method;
+ pfile_in_zip_read_info->filestream=s->filestream;
+ pfile_in_zip_read_info->z_filefunc=s->z_filefunc;
+ pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile;
+
+ pfile_in_zip_read_info->stream.total_out = 0;
+
+ if ((s->cur_file_info.compression_method==Z_DEFLATED) &&
+ (!raw))
+ {
+ pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
+ pfile_in_zip_read_info->stream.zfree = (free_func)0;
+ pfile_in_zip_read_info->stream.opaque = (voidpf)0;
+ pfile_in_zip_read_info->stream.next_in = (voidpf)0;
+ pfile_in_zip_read_info->stream.avail_in = 0;
+
+ err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
+ if (err == Z_OK)
+ pfile_in_zip_read_info->stream_initialised=1;
+ else
+ {
+ TRYFREE(pfile_in_zip_read_info);
+ return err;
+ }
+ /* windowBits is passed < 0 to tell that there is no zlib header.
+ * Note that in this case inflate *requires* an extra "dummy" byte
+ * after the compressed stream in order to complete decompression and
+ * return Z_STREAM_END.
+ * In unzip, i don't wait absolutely Z_STREAM_END because I known the
+ * size of both compressed and uncompressed data
+ */
+ }
+ pfile_in_zip_read_info->rest_read_compressed =
+ s->cur_file_info.compressed_size ;
+ pfile_in_zip_read_info->rest_read_uncompressed =
+ s->cur_file_info.uncompressed_size ;
+
+
+ pfile_in_zip_read_info->pos_in_zipfile =
+ s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
+ iSizeVar;
+
+ pfile_in_zip_read_info->stream.avail_in = (uInt)0;
+
+ s->pfile_in_zip_read = pfile_in_zip_read_info;
+
+# ifndef NOUNCRYPT
+ if (password != 0)
+ {
+ int i;
+ s->pcrc_32_tab = get_crc_table();
+ init_keys(password,s->keys,s->pcrc_32_tab);
+ if (ZSEEK(s->z_filefunc, s->filestream,
+ s->pfile_in_zip_read->pos_in_zipfile +
+ s->pfile_in_zip_read->byte_before_the_zipfile,
+ SEEK_SET)!=0)
+ return UNZ_INTERNALERROR;
+ if(ZREAD(s->z_filefunc, s->filestream,source, 12)<12)
+ return UNZ_INTERNALERROR;
+
+ for (i = 0; i<12; i++)
+ zdecode(s->keys,s->pcrc_32_tab,source[i]);
+
+ s->pfile_in_zip_read->pos_in_zipfile+=12;
+ s->encrypted=1;
+ }
+# endif
+
+
+ return UNZ_OK;
+}
+
+extern MINIZIP_EXPORT int unzOpenCurrentFile (unzFile file)
+ {
+ return unzOpenCurrentFile3(file, 0, 0, 0, 0);
+}
+
+extern MINIZIP_EXPORT int unzOpenCurrentFilePassword (unzFile file,const char* password)
+{
+ return unzOpenCurrentFile3(file, 0, 0, 0, password);
+}
+
+extern MINIZIP_EXPORT int unzOpenCurrentFile2 (unzFile file,int* method,int* level,int raw)
+{
+ return unzOpenCurrentFile3(file, method, level, raw, 0);
+}
+
+/*
+ Read bytes from the current file.
+ buf contain buffer where data must be copied
+ len the size of buf.
+
+ return the number of byte copied if somes bytes are copied
+ return 0 if the end of file was reached
+ return <0 with error code if there is an error
+ (UNZ_ERRNO for IO error, or zLib error for uncompress error)
+*/
+extern MINIZIP_EXPORT int unzReadCurrentFile (unzFile file,voidp buf,unsigned len)
+ {
+ int err=UNZ_OK;
+ uInt iRead = 0;
+ unz_s* s;
+ file_in_zip_read_info_s* pfile_in_zip_read_info;
+ if (file==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+ if (pfile_in_zip_read_info==0)
+ return UNZ_PARAMERROR;
+
+
+ if ((pfile_in_zip_read_info->read_buffer == 0))
+ return UNZ_END_OF_LIST_OF_FILE;
+
+ if (len==0)
+ return 0;
+
+ pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
+
+ pfile_in_zip_read_info->stream.avail_out = (uInt)len;
+
+ if ((len>pfile_in_zip_read_info->rest_read_uncompressed) &&
+ (!(pfile_in_zip_read_info->raw)))
+ pfile_in_zip_read_info->stream.avail_out =
+ (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
+
+ if ((len>pfile_in_zip_read_info->rest_read_compressed+
+ pfile_in_zip_read_info->stream.avail_in) &&
+ (pfile_in_zip_read_info->raw))
+ pfile_in_zip_read_info->stream.avail_out =
+ (uInt)pfile_in_zip_read_info->rest_read_compressed+
+ pfile_in_zip_read_info->stream.avail_in;
+
+ while (pfile_in_zip_read_info->stream.avail_out>0)
+ {
+ if ((pfile_in_zip_read_info->stream.avail_in==0) &&
+ (pfile_in_zip_read_info->rest_read_compressed>0))
+ {
+ uInt uReadThis = UNZ_BUFSIZE;
+ if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
+ uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
+ if (uReadThis == 0)
+ return UNZ_EOF;
+ if (ZSEEK(pfile_in_zip_read_info->z_filefunc,
+ pfile_in_zip_read_info->filestream,
+ pfile_in_zip_read_info->pos_in_zipfile +
+ pfile_in_zip_read_info->byte_before_the_zipfile,
+ ZLIB_FILEFUNC_SEEK_SET)!=0)
+ return UNZ_ERRNO;
+ if (ZREAD(pfile_in_zip_read_info->z_filefunc,
+ pfile_in_zip_read_info->filestream,
+ pfile_in_zip_read_info->read_buffer,
+ uReadThis)!=uReadThis)
+ return UNZ_ERRNO;
+
+
+# ifndef NOUNCRYPT
+ if(s->encrypted)
+ {
+ uInt i;
+ for(i=0;i<uReadThis;i++)
+ pfile_in_zip_read_info->read_buffer[i] =
+ zdecode(s->keys,s->pcrc_32_tab,
+ pfile_in_zip_read_info->read_buffer[i]);
+ }
+# endif
+
+
+ pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
+
+ pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
+
+ pfile_in_zip_read_info->stream.next_in =
+ (Bytef*)pfile_in_zip_read_info->read_buffer;
+ pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
+ }
+
+ if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw))
+ {
+ uInt uDoCopy,i ;
+
+ if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
+ (pfile_in_zip_read_info->rest_read_compressed == 0))
+ return (iRead==0) ? UNZ_EOF : iRead;
+
+ if (pfile_in_zip_read_info->stream.avail_out <
+ pfile_in_zip_read_info->stream.avail_in)
+ uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
+ else
+ uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
+
+ for (i=0;i<uDoCopy;i++)
+ *(pfile_in_zip_read_info->stream.next_out+i) =
+ *(pfile_in_zip_read_info->stream.next_in+i);
+
+ pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
+ pfile_in_zip_read_info->stream.next_out,
+ uDoCopy);
+ pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy;
+ pfile_in_zip_read_info->stream.avail_in -= uDoCopy;
+ pfile_in_zip_read_info->stream.avail_out -= uDoCopy;
+ pfile_in_zip_read_info->stream.next_out += uDoCopy;
+ pfile_in_zip_read_info->stream.next_in += uDoCopy;
+ pfile_in_zip_read_info->stream.total_out += uDoCopy;
+ iRead += uDoCopy;
+ }
+ else
+ {
+ uLong uTotalOutBefore,uTotalOutAfter;
+ const Bytef *bufBefore;
+ uLong uOutThis;
+ int flush=Z_SYNC_FLUSH;
+
+ uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;
+ bufBefore = pfile_in_zip_read_info->stream.next_out;
+
+ /*
+ if ((pfile_in_zip_read_info->rest_read_uncompressed ==
+ pfile_in_zip_read_info->stream.avail_out) &&
+ (pfile_in_zip_read_info->rest_read_compressed == 0))
+ flush = Z_FINISH;
+ */
+ err=inflate(&pfile_in_zip_read_info->stream,flush);
+
+ if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=0))
+ err = Z_DATA_ERROR;
+
+ uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
+ uOutThis = uTotalOutAfter-uTotalOutBefore;
+
+ pfile_in_zip_read_info->crc32 =
+ crc32(pfile_in_zip_read_info->crc32,bufBefore,
+ (uInt)(uOutThis));
+
+ pfile_in_zip_read_info->rest_read_uncompressed -=
+ uOutThis;
+
+ iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
+
+ if (err==Z_STREAM_END)
+ return (iRead==0) ? UNZ_EOF : iRead;
+ if (err!=Z_OK)
+ break;
+ }
+ }
+
+ if (err==Z_OK)
+ return iRead;
+ return err;
+}
+
+
+/*
+ Give the current position in uncompressed data
+*/
+extern MINIZIP_EXPORT z_off_t unztell (unzFile file)
+{
+ unz_s* s;
+ file_in_zip_read_info_s* pfile_in_zip_read_info;
+ if (file==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+ if (pfile_in_zip_read_info==0)
+ return UNZ_PARAMERROR;
+
+ return (z_off_t)pfile_in_zip_read_info->stream.total_out;
+}
+
+
+/*
+ return 1 if the end of file was reached, 0 elsewhere
+*/
+extern MINIZIP_EXPORT int unzeof (unzFile file)
+{
+ unz_s* s;
+ file_in_zip_read_info_s* pfile_in_zip_read_info;
+ if (file==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+ if (pfile_in_zip_read_info==0)
+ return UNZ_PARAMERROR;
+
+ if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
+ return 1;
+ else
+ return 0;
+}
+
+
+//FUZZ: disable check_for_NULL
+/*
+ Read extra field from the current file (opened by unzOpenCurrentFile)
+ This is the local-header version of the extra field (sometimes, there is
+ more info in the local-header version than in the central-header)
+
+ if buf==NULL, it return the size of the local extra field that can be read
+
+ if buf!=NULL, len is the size of the buffer, the extra header is copied in
+ buf.
+ the return value is the number of bytes copied in buf, or (if <0)
+ the error code
+*/
+//FUZZ: enable check_for_NULL
+extern MINIZIP_EXPORT int unzGetLocalExtrafield (unzFile file,voidp buf,unsigned len)
+{
+ unz_s* s;
+ file_in_zip_read_info_s* pfile_in_zip_read_info;
+ uInt read_now;
+ uLong size_to_read;
+
+ if (file==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+ if (pfile_in_zip_read_info==0)
+ return UNZ_PARAMERROR;
+
+ size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
+ pfile_in_zip_read_info->pos_local_extrafield);
+
+ if (buf==0)
+ return (int)size_to_read;
+
+ if (len>size_to_read)
+ read_now = (uInt)size_to_read;
+ else
+ read_now = (uInt)len ;
+
+ if (read_now==0)
+ return 0;
+
+ if (ZSEEK(pfile_in_zip_read_info->z_filefunc,
+ pfile_in_zip_read_info->filestream,
+ pfile_in_zip_read_info->offset_local_extrafield +
+ pfile_in_zip_read_info->pos_local_extrafield,
+ ZLIB_FILEFUNC_SEEK_SET)!=0)
+ return UNZ_ERRNO;
+
+ if (ZREAD(pfile_in_zip_read_info->z_filefunc,
+ pfile_in_zip_read_info->filestream,
+ buf,read_now)!=read_now)
+ return UNZ_ERRNO;
+
+ return (int)read_now;
+}
+
+/*
+ Close the file in zip opened with unzipOpenCurrentFile
+ Return UNZ_CRCERROR if all the file was read but the CRC is not good
+*/
+extern MINIZIP_EXPORT int unzCloseCurrentFile (unzFile file)
+{
+ int err=UNZ_OK;
+
+ unz_s* s;
+ file_in_zip_read_info_s* pfile_in_zip_read_info;
+ if (file==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+ if (pfile_in_zip_read_info==0)
+ return UNZ_PARAMERROR;
+
+
+ if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) &&
+ (!pfile_in_zip_read_info->raw))
+ {
+ if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
+ err=UNZ_CRCERROR;
+ }
+
+
+ TRYFREE(pfile_in_zip_read_info->read_buffer);
+ pfile_in_zip_read_info->read_buffer = 0;
+ if (pfile_in_zip_read_info->stream_initialised)
+ inflateEnd(&pfile_in_zip_read_info->stream);
+
+ pfile_in_zip_read_info->stream_initialised = 0;
+ TRYFREE(pfile_in_zip_read_info);
+
+ s->pfile_in_zip_read=0;
+
+ return err;
+}
+
+
+/*
+ Get the global comment string of the ZipFile, in the szComment buffer.
+ uSizeBuf is the size of the szComment buffer.
+ return the number of byte copied or an error code <0
+*/
+extern MINIZIP_EXPORT int unzGetGlobalComment (unzFile file,char *szComment,uLong uSizeBuf)
+{
+ unz_s* s;
+ uLong uReadThis ;
+ if (file==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+
+ uReadThis = uSizeBuf;
+ if (uReadThis>s->gi.size_comment)
+ uReadThis = s->gi.size_comment;
+
+ if (ZSEEK(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0)
+ return UNZ_ERRNO;
+
+ if (uReadThis>0)
+ {
+ *szComment='\0';
+ if (ZREAD(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis)
+ return UNZ_ERRNO;
+ }
+
+ if ((szComment != 0) && (uSizeBuf > s->gi.size_comment))
+ *(szComment+s->gi.size_comment)='\0';
+ return (int)uReadThis;
+}
+
+/* Additions by RX '2004 */
+extern MINIZIP_EXPORT uLong unzGetOffset (unzFile file)
+{
+ unz_s* s;
+
+ if (file==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ if (!s->current_file_ok)
+ return 0;
+ if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff)
+ if (s->num_file==s->gi.number_entry)
+ return 0;
+ return s->pos_in_central_dir;
+}
+
+extern MINIZIP_EXPORT int unzSetOffset (unzFile file,uLong pos)
+{
+ unz_s* s;
+ int err;
+
+ if (file==0)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+
+ s->pos_in_central_dir = pos;
+ s->num_file = s->gi.number_entry; /* hack */
+ err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
+ &s->cur_file_info_internal,
+ 0,0,0,0,0,0);
+ s->current_file_ok = (err == UNZ_OK);
+ return err;
+}
diff --git a/ACE/contrib/minizip/unzip.h b/ACE/contrib/minizip/unzip.h
new file mode 100644
index 00000000000..670066dcdad
--- /dev/null
+++ b/ACE/contrib/minizip/unzip.h
@@ -0,0 +1,368 @@
+/* unzip.h -- IO for uncompress .zip files using zlib
+ Version 1.01e, February 12th, 2005
+
+ Copyright (C) 1998-2005 Gilles Vollant
+
+ This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
+ WinZip, InfoZip tools and compatible.
+
+ Multi volume ZipFile (span) are not supported.
+ Encryption compatible with pkzip 2.04g only supported
+ Old compressions used by old PKZip 1.x are not supported
+
+
+ I WAIT FEEDBACK at mail info@winimage.com
+ Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
+
+ Condition of use and distribution are the same than zlib :
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ $Id$
+
+*/
+
+/* for more info about .ZIP format, see
+ http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
+ http://www.info-zip.org/pub/infozip/doc/
+ PkWare has also a specification at :
+ ftp://ftp.pkware.com/probdesc.zip
+*/
+
+/* Modifications to minizip by ACE/TAO/CIAO developers:
+ 1. Added include of minizip_export.h to make minizip compile under Windows as a DLL
+ 2. Modified the function declarations to be conformant with ANSI C */
+
+#ifndef _unz_H
+#define _unz_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _ZLIB_H
+#include "zlib.h"
+#endif
+
+#include "minizip_export.h"
+
+#ifndef _ZLIBIOAPI_H
+#include "ioapi.h"
+#endif
+
+#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
+/* like the STRICT of WIN32, we define a pointer that cannot be converted
+ from (void*) without cast */
+typedef struct TagunzFile__ { int unused; } unzFile__;
+typedef unzFile__ *unzFile;
+#else
+typedef voidp unzFile;
+#endif
+
+
+#define UNZ_OK (0)
+#define UNZ_END_OF_LIST_OF_FILE (-100)
+#define UNZ_ERRNO (Z_ERRNO)
+#define UNZ_EOF (0)
+#define UNZ_PARAMERROR (-102)
+#define UNZ_BADZIPFILE (-103)
+#define UNZ_INTERNALERROR (-104)
+#define UNZ_CRCERROR (-105)
+
+/* tm_unz contain date/time info */
+typedef struct tm_unz_s
+{
+ uInt tm_sec; /* seconds after the minute - [0,59] */
+ uInt tm_min; /* minutes after the hour - [0,59] */
+ uInt tm_hour; /* hours since midnight - [0,23] */
+ uInt tm_mday; /* day of the month - [1,31] */
+ uInt tm_mon; /* months since January - [0,11] */
+ uInt tm_year; /* years - [1980..2044] */
+} tm_unz;
+
+/* unz_global_info structure contain global data about the ZIPfile
+ These data comes from the end of central dir */
+typedef struct unz_global_info_s
+{
+ uLong number_entry; /* total number of entries in
+ the central dir on this disk */
+ uLong size_comment; /* size of the global comment of the zipfile */
+} unz_global_info;
+
+
+/* unz_file_info contain information about a file in the zipfile */
+typedef struct unz_file_info_s
+{
+ uLong version; /* version made by 2 bytes */
+ uLong version_needed; /* version needed to extract 2 bytes */
+ uLong flag; /* general purpose bit flag 2 bytes */
+ uLong compression_method; /* compression method 2 bytes */
+ uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
+ uLong crc; /* crc-32 4 bytes */
+ uLong compressed_size; /* compressed size 4 bytes */
+ uLong uncompressed_size; /* uncompressed size 4 bytes */
+ uLong size_filename; /* filename length 2 bytes */
+ uLong size_file_extra; /* extra field length 2 bytes */
+ uLong size_file_comment; /* file comment length 2 bytes */
+
+ uLong disk_num_start; /* disk number start 2 bytes */
+ uLong internal_fa; /* internal file attributes 2 bytes */
+ uLong external_fa; /* external file attributes 4 bytes */
+
+ tm_unz tmu_date;
+} unz_file_info;
+
+extern int MINIZIP_EXPORT unzStringFileNameCompare OF ((const char* fileName1,
+ const char* fileName2,
+ int iCaseSensitivity));
+/*
+ Compare two filename (fileName1,fileName2).
+ If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
+ If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
+ or strcasecmp)
+ If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
+ (like 1 on Unix, 2 on Windows)
+*/
+
+
+extern unzFile MINIZIP_EXPORT unzOpen OF((const char *path));
+/*
+ Open a Zip file. path contain the full pathname (by example,
+ on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
+ "zlib/zlib113.zip".
+ If the zipfile cannot be opened (file don't exist or in not valid), the
+ return value is NULL.
+ Else, the return value is a unzFile Handle, usable with other function
+ of this unzip package.
+*/
+
+extern unzFile MINIZIP_EXPORT unzOpen2 OF((const char *path,
+ zlib_filefunc_def* pzlib_filefunc_def));
+/*
+ Open a Zip file, like unzOpen, but provide a set of file low level API
+ for read/write the zip file (see ioapi.h)
+*/
+
+extern int MINIZIP_EXPORT unzClose OF((unzFile file));
+/*
+ Close a ZipFile opened with unzipOpen.
+ If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
+ these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
+ return UNZ_OK if there is no problem. */
+
+extern int MINIZIP_EXPORT unzGetGlobalInfo OF((unzFile file,
+ unz_global_info *pglobal_info));
+/*
+ Write info about the ZipFile in the *pglobal_info structure.
+ No preparation of the structure is needed
+ return UNZ_OK if there is no problem. */
+
+
+extern int MINIZIP_EXPORT unzGetGlobalComment OF((unzFile file,
+ char *szComment,
+ uLong uSizeBuf));
+/*
+ Get the global comment string of the ZipFile, in the szComment buffer.
+ uSizeBuf is the size of the szComment buffer.
+ return the number of byte copied or an error code <0
+*/
+
+
+/***************************************************************************/
+/* Unzip package allow you browse the directory of the zipfile */
+
+extern int MINIZIP_EXPORT unzGoToFirstFile OF((unzFile file));
+/*
+ Set the current file of the zipfile to the first file.
+ return UNZ_OK if there is no problem
+*/
+
+extern int MINIZIP_EXPORT unzGoToNextFile OF((unzFile file));
+/*
+ Set the current file of the zipfile to the next file.
+ return UNZ_OK if there is no problem
+ return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
+*/
+
+extern int MINIZIP_EXPORT unzLocateFile OF((unzFile file,
+ const char *szFileName,
+ int iCaseSensitivity));
+/*
+ Try locate the file szFileName in the zipfile.
+ For the iCaseSensitivity signification, see unzStringFileNameCompare
+
+ return value :
+ UNZ_OK if the file is found. It becomes the current file.
+ UNZ_END_OF_LIST_OF_FILE if the file is not found
+*/
+
+
+/* ****************************************** */
+/* Ryan supplied functions */
+/* unz_file_info contain information about a file in the zipfile */
+typedef struct unz_file_pos_s
+{
+ uLong pos_in_zip_directory; /* offset in zip file directory */
+ uLong num_of_file; /* # of file */
+} unz_file_pos;
+
+extern int MINIZIP_EXPORT unzGetFilePos(
+ unzFile file,
+ unz_file_pos* file_pos);
+
+extern int MINIZIP_EXPORT unzGoToFilePos(
+ unzFile file,
+ unz_file_pos* file_pos);
+
+/* ****************************************** */
+
+extern int MINIZIP_EXPORT unzGetCurrentFileInfo OF((unzFile file,
+ unz_file_info *pfile_info,
+ char *szFileName,
+ uLong fileNameBufferSize,
+ void *extraField,
+ uLong extraFieldBufferSize,
+ char *szComment,
+ uLong commentBufferSize));
+//FUZZ: disable check_for_NULL
+/*
+ Get Info about the current file
+ if pfile_info!=NULL, the *pfile_info structure will contain somes info about
+ the current file
+ if szFileName!=NULL, the filemane string will be copied in szFileName
+ (fileNameBufferSize is the size of the buffer)
+ if extraField!=NULL, the extra field information will be copied in extraField
+ (extraFieldBufferSize is the size of the buffer).
+ This is the Central-header version of the extra field
+ if szComment!=NULL, the comment string of the file will be copied in szComment
+ (commentBufferSize is the size of the buffer)
+*/
+//FUZZ: enable check_for_NULL
+/***************************************************************************/
+/* for reading the content of the current zipfile, you can open it, read data
+ from it, and close it (you can close it before reading all the file)
+ */
+
+extern int MINIZIP_EXPORT unzOpenCurrentFile OF((unzFile file));
+/*
+ Open for reading data the current file in the zipfile.
+ If there is no error, the return value is UNZ_OK.
+*/
+
+extern int MINIZIP_EXPORT unzOpenCurrentFilePassword OF((unzFile file,
+ const char* password));
+/*
+ Open for reading data the current file in the zipfile.
+ password is a crypting password
+ If there is no error, the return value is UNZ_OK.
+*/
+
+extern int MINIZIP_EXPORT unzOpenCurrentFile2 OF((unzFile file,
+ int* method,
+ int* level,
+ int raw));
+//FUZZ: disable check_for_NULL
+/*
+ Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
+ if raw==1
+ *method will receive method of compression, *level will receive level of
+ compression
+ note : you can set level parameter as NULL (if you did not want known level,
+ but you CANNOT set method parameter as NULL
+*/
+//FUZZ: enable check_for_NULL
+
+extern int MINIZIP_EXPORT unzOpenCurrentFile3 OF((unzFile file,
+ int* method,
+ int* level,
+ int raw,
+ const char* password));
+//FUZZ: disable check_for_NULL
+/*
+ Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
+ if raw==1
+ *method will receive method of compression, *level will receive level of
+ compression
+ note : you can set level parameter as NULL (if you did not want known level,
+ but you CANNOT set method parameter as NULL
+*/
+//FUZZ: enable check_for_NULL
+
+
+extern int MINIZIP_EXPORT unzCloseCurrentFile OF((unzFile file));
+/*
+ Close the file in zip opened with unzOpenCurrentFile
+ Return UNZ_CRCERROR if all the file was read but the CRC is not good
+*/
+
+extern int MINIZIP_EXPORT unzReadCurrentFile OF((unzFile file,
+ voidp buf,
+ unsigned len));
+/*
+ Read bytes from the current file (opened by unzOpenCurrentFile)
+ buf contain buffer where data must be copied
+ len the size of buf.
+
+ return the number of byte copied if somes bytes are copied
+ return 0 if the end of file was reached
+ return <0 with error code if there is an error
+ (UNZ_ERRNO for IO error, or zLib error for uncompress error)
+*/
+
+extern z_off_t MINIZIP_EXPORT unztell OF((unzFile file));
+/*
+ Give the current position in uncompressed data
+*/
+
+extern int MINIZIP_EXPORT unzeof OF((unzFile file));
+/*
+ return 1 if the end of file was reached, 0 elsewhere
+*/
+
+extern int MINIZIP_EXPORT unzGetLocalExtrafield OF((unzFile file,
+ voidp buf,
+ unsigned len));
+//FUZZ: disable check_for_NULL
+/*
+ Read extra field from the current file (opened by unzOpenCurrentFile)
+ This is the local-header version of the extra field (sometimes, there is
+ more info in the local-header version than in the central-header)
+
+ if buf==NULL, it return the size of the local extra field
+
+ if buf!=NULL, len is the size of the buffer, the extra header is copied in
+ buf.
+ the return value is the number of bytes copied in buf, or (if <0)
+ the error code
+*/
+//FUZZ: enable check_for_NULL
+
+/***************************************************************************/
+
+/* Get the current file offset */
+extern uLong MINIZIP_EXPORT unzGetOffset (unzFile file);
+
+/* Set the current file offset */
+extern int MINIZIP_EXPORT unzSetOffset (unzFile file, uLong pos);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _unz_H */
diff --git a/ACE/contrib/minizip/zip.c b/ACE/contrib/minizip/zip.c
new file mode 100644
index 00000000000..b39b9bfd640
--- /dev/null
+++ b/ACE/contrib/minizip/zip.c
@@ -0,0 +1,1164 @@
+/* zip.c -- IO on .zip files using zlib
+ Version 1.01e, February 12th, 2005
+
+ 27 Dec 2004 Rolf Kalbermatter
+ Modification to zipOpen2 to support globalComment retrieval.
+
+ Copyright (C) 1998-2005 Gilles Vollant
+
+ Read zip.h for more info
+ $Id$
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include "zlib.h"
+#include "zip.h"
+
+#ifdef STDC
+# include <stddef.h>
+# include <string.h>
+# include <stdlib.h>
+#endif
+#ifdef NO_ERRNO_H
+extern int errno;
+#else
+# include <errno.h>
+#endif
+
+
+#ifndef local
+# define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+#ifndef VERSIONMADEBY
+# define VERSIONMADEBY (0x0) /* platform depedent */
+#endif
+
+#ifndef Z_BUFSIZE
+#define Z_BUFSIZE (16384)
+#endif
+
+#ifndef Z_MAXFILENAMEINZIP
+#define Z_MAXFILENAMEINZIP (256)
+#endif
+
+#ifndef ALLOC
+# define ALLOC(size) (malloc(size))
+#endif
+#ifndef TRYFREE
+# define TRYFREE(p) {if (p) free(p);}
+#endif
+
+/*
+ #define SIZECENTRALDIRITEM (0x2e)
+ #define SIZEZIPLOCALHEADER (0x1e)
+*/
+
+/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
+
+#ifndef SEEK_CUR
+#define SEEK_CUR 1
+#endif
+
+#ifndef SEEK_END
+#define SEEK_END 2
+#endif
+
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#endif
+
+#ifndef DEF_MEM_LEVEL
+#if MAX_MEM_LEVEL >= 8
+# define DEF_MEM_LEVEL 8
+#else
+# define DEF_MEM_LEVEL MAX_MEM_LEVEL
+#endif
+#endif
+const char zip_copyright[] =
+" zip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
+
+
+#define SIZEDATA_INDATABLOCK (4096-(4*4))
+
+#define LOCALHEADERMAGIC (0x04034b50)
+#define CENTRALHEADERMAGIC (0x02014b50)
+#define ENDHEADERMAGIC (0x06054b50)
+
+#define FLAG_LOCALHEADER_OFFSET (0x06)
+#define CRC_LOCALHEADER_OFFSET (0x0e)
+
+#define SIZECENTRALHEADER (0x2e) /* 46 */
+
+typedef struct linkedlist_datablock_internal_s
+{
+ struct linkedlist_datablock_internal_s* next_datablock;
+ uLong avail_in_this_block;
+ uLong filled_in_this_block;
+ uLong unused; /* for future use and alignement */
+ unsigned char data[SIZEDATA_INDATABLOCK];
+} linkedlist_datablock_internal;
+
+typedef struct linkedlist_data_s
+{
+ linkedlist_datablock_internal* first_block;
+ linkedlist_datablock_internal* last_block;
+} linkedlist_data;
+
+
+typedef struct
+{
+ z_stream stream; /* zLib stream structure for inflate */
+ int stream_initialised; /* 1 is stream is initialised */
+ uInt pos_in_buffered_data; /* last written byte in buffered_data */
+
+ uLong pos_local_header; /* offset of the local header of the file
+ currenty writing */
+ char* central_header; /* central header data for the current file */
+ uLong size_centralheader; /* size of the central header for cur file */
+ uLong flag; /* flag of the file currently writing */
+
+ int method; /* compression method of file currenty wr.*/
+ int raw; /* 1 for directly writing raw data */
+ Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
+ uLong dosDate;
+ uLong crc32;
+ int encrypt;
+#ifndef NOCRYPT
+ unsigned long keys[3]; /* keys defining the pseudo-random sequence */
+ const unsigned long* pcrc_32_tab;
+ int crypt_header_size;
+#endif
+} curfile_info;
+
+typedef struct
+{
+ zlib_filefunc_def z_filefunc;
+ voidpf filestream; /* io structore of the zipfile */
+ linkedlist_data central_dir;/* datablock with central dir in construction*/
+ int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/
+ curfile_info ci; /* info on the file curretly writing */
+
+ uLong begin_pos; /* position of the beginning of the zipfile */
+ uLong add_position_when_writting_offset;
+ uLong number_entry;
+#ifndef NO_ADDFILEINEXISTINGZIP
+ char *globalcomment;
+#endif
+} zip_internal;
+
+
+
+#ifndef NOCRYPT
+#define INCLUDECRYPTINGCODE_IFCRYPTALLOWED
+#include "crypt.h"
+#endif
+
+local linkedlist_datablock_internal* allocate_new_datablock()
+{
+ linkedlist_datablock_internal* ldi;
+ ldi = (linkedlist_datablock_internal*)
+ ALLOC(sizeof(linkedlist_datablock_internal));
+ if (ldi!=0)
+ {
+ ldi->next_datablock = 0;
+ ldi->filled_in_this_block = 0 ;
+ ldi->avail_in_this_block = SIZEDATA_INDATABLOCK ;
+ }
+ return ldi;
+}
+
+local void free_datablock( linkedlist_datablock_internal* ldi)
+{
+ while (ldi!=0)
+ {
+ linkedlist_datablock_internal* ldinext = ldi->next_datablock;
+ TRYFREE(ldi);
+ ldi = ldinext;
+ }
+}
+
+local void init_linkedlist(linkedlist_data* ll)
+{
+ ll->first_block = ll->last_block = 0;
+}
+
+/* local void free_linkedlist(linkedlist_data* ll) */
+/* { */
+/* free_datablock(ll->first_block); */
+/* ll->first_block = ll->last_block = 0; */
+/* } */
+
+
+local int add_data_in_datablock(linkedlist_data* ll,const void* buf,uLong len)
+
+{
+ linkedlist_datablock_internal* ldi;
+ const unsigned char* from_copy;
+
+ if (ll==0)
+ return ZIP_INTERNALERROR;
+
+ if (ll->last_block == 0)
+ {
+ ll->first_block = ll->last_block = allocate_new_datablock();
+ if (ll->first_block == 0)
+ return ZIP_INTERNALERROR;
+ }
+
+ ldi = ll->last_block;
+ from_copy = (unsigned char*)buf;
+
+ while (len>0)
+ {
+ uInt copy_this;
+ uInt i;
+ unsigned char* to_copy;
+
+ if (ldi->avail_in_this_block==0)
+ {
+ ldi->next_datablock = allocate_new_datablock();
+ if (ldi->next_datablock == 0)
+ return ZIP_INTERNALERROR;
+ ldi = ldi->next_datablock ;
+ ll->last_block = ldi;
+ }
+
+ if (ldi->avail_in_this_block < len)
+ copy_this = (uInt)ldi->avail_in_this_block;
+ else
+ copy_this = (uInt)len;
+
+ to_copy = &(ldi->data[ldi->filled_in_this_block]);
+
+ for (i=0;i<copy_this;i++)
+ *(to_copy+i)=*(from_copy+i);
+
+ ldi->filled_in_this_block += copy_this;
+ ldi->avail_in_this_block -= copy_this;
+ from_copy += copy_this ;
+ len -= copy_this;
+ }
+ return ZIP_OK;
+}
+
+
+
+/****************************************************************************/
+
+#ifndef NO_ADDFILEINEXISTINGZIP
+/* ===========================================================================
+ Inputs a long in LSB order to the given file
+ nbByte == 1, 2 or 4 (byte, short or long)
+*/
+
+local int ziplocal_putValue OF((const zlib_filefunc_def* pzlib_filefunc_def,
+ voidpf filestream, uLong x, int nbByte));
+local int ziplocal_putValue (const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream,uLong x,int nbByte)
+
+{
+ unsigned char buf[4];
+ int n;
+ for (n = 0; n < nbByte; n++)
+ {
+ buf[n] = (unsigned char)(x & 0xff);
+ x >>= 8;
+ }
+ if (x != 0)
+ { /* data overflow - hack for ZIP64 (X Roche) */
+ for (n = 0; n < nbByte; n++)
+ {
+ buf[n] = 0xff;
+ }
+ }
+
+ if (ZWRITE(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte)
+ return ZIP_ERRNO;
+ else
+ return ZIP_OK;
+}
+
+local void ziplocal_putValue_inmemory OF((void* dest, uLong x, int nbByte));
+local void ziplocal_putValue_inmemory (void* dest,uLong x,int nbByte)
+
+{
+ unsigned char* buf=(unsigned char*)dest;
+ int n;
+ for (n = 0; n < nbByte; n++) {
+ buf[n] = (unsigned char)(x & 0xff);
+ x >>= 8;
+ }
+
+ if (x != 0)
+ { /* data overflow - hack for ZIP64 */
+ for (n = 0; n < nbByte; n++)
+ {
+ buf[n] = 0xff;
+ }
+ }
+}
+
+/****************************************************************************/
+
+
+local uLong ziplocal_TmzDateToDosDate(const tm_zip* ptm,uLong dosDate)
+
+{
+ uLong year = (uLong)ptm->tm_year;
+ MINIZIP_UNUSED_ARG(dosDate);
+ if (year>1980)
+ year-=1980;
+ else if (year>80)
+ year-=80;
+ return
+ (uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) |
+ ((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
+}
+
+
+/****************************************************************************/
+
+local int ziplocal_getByte OF((const zlib_filefunc_def* pzlib_filefunc_def,
+ voidpf filestream,
+ int *pi));
+
+local int ziplocal_getByte(const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream,int *pi)
+
+{
+ unsigned char c;
+ int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
+ if (err==1)
+ {
+ *pi = (int)c;
+ return ZIP_OK;
+ }
+ else
+ {
+ if (ZERROR(*pzlib_filefunc_def,filestream))
+ return ZIP_ERRNO;
+ else
+ return ZIP_EOF;
+ }
+}
+
+
+/* ===========================================================================
+ Reads a long in LSB order from the given gz_stream. Sets
+*/
+local int ziplocal_getShort OF((const zlib_filefunc_def* pzlib_filefunc_def,
+ voidpf filestream,
+ uLong *pX));
+
+local int ziplocal_getShort (const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream,uLong *pX)
+
+{
+ uLong x ;
+ int i = 0;
+ int err;
+
+ err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x = (uLong)i;
+
+ if (err==ZIP_OK)
+ err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x += ((uLong)i)<<8;
+
+ if (err==ZIP_OK)
+ *pX = x;
+ else
+ *pX = 0;
+ return err;
+}
+
+local int ziplocal_getLong OF((const zlib_filefunc_def* pzlib_filefunc_def,
+ voidpf filestream,
+ uLong *pX));
+
+local int ziplocal_getLong (const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream,uLong *pX)
+
+{
+ uLong x ;
+ int i = 0;
+ int err;
+
+ err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x = (uLong)i;
+
+ if (err==ZIP_OK)
+ err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x += ((uLong)i)<<8;
+
+ if (err==ZIP_OK)
+ err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x += ((uLong)i)<<16;
+
+ if (err==ZIP_OK)
+ err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x += ((uLong)i)<<24;
+
+ if (err==ZIP_OK)
+ *pX = x;
+ else
+ *pX = 0;
+ return err;
+}
+
+#ifndef BUFREADCOMMENT
+#define BUFREADCOMMENT (0x400)
+#endif
+/*
+ Locate the Central directory of a zipfile (at the end, just before
+ the global comment)
+*/
+local uLong ziplocal_SearchCentralDir OF((const zlib_filefunc_def* pzlib_filefunc_def,
+ voidpf filestream));
+
+local uLong ziplocal_SearchCentralDir(const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream)
+
+{
+ unsigned char* buf;
+ uLong uSizeFile;
+ uLong uBackRead;
+ uLong uMaxBack=0xffff; /* maximum size of global comment */
+ uLong uPosFound=0;
+
+ if (ZSEEK(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
+ return 0;
+
+
+ uSizeFile = ZTELL(*pzlib_filefunc_def,filestream);
+
+ if (uMaxBack>uSizeFile)
+ uMaxBack = uSizeFile;
+
+ buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
+ if (buf==0)
+ return 0;
+
+ uBackRead = 4;
+ while (uBackRead<uMaxBack)
+ {
+ uLong uReadSize,uReadPos ;
+ int i;
+ if (uBackRead+BUFREADCOMMENT>uMaxBack)
+ uBackRead = uMaxBack;
+ else
+ uBackRead+=BUFREADCOMMENT;
+ uReadPos = uSizeFile-uBackRead ;
+
+ uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
+ (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
+ if (ZSEEK(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
+ break;
+
+ if (ZREAD(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
+ break;
+
+ for (i=(int)uReadSize-3; (i--)>0;)
+ if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
+ ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
+ {
+ uPosFound = uReadPos+i;
+ break;
+ }
+
+ if (uPosFound!=0)
+ break;
+ }
+ TRYFREE(buf);
+ return uPosFound;
+}
+#endif /* !NO_ADDFILEINEXISTINGZIP*/
+
+/************************************************************/
+extern MINIZIP_EXPORT zipFile zipOpen2 (const char *pathname,int append,zipcharpc* globalcomment,zlib_filefunc_def* pzlib_filefunc_def)
+
+{
+ zip_internal ziinit;
+ zip_internal* zi;
+ int err=ZIP_OK;
+
+
+ if (pzlib_filefunc_def==0)
+ fill_fopen_filefunc(&ziinit.z_filefunc);
+ else
+ ziinit.z_filefunc = *pzlib_filefunc_def;
+
+ ziinit.filestream = (*(ziinit.z_filefunc.zopen_file))
+ (ziinit.z_filefunc.opaque,
+ pathname,
+ (append == APPEND_STATUS_CREATE) ?
+ (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_CREATE) :
+ (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_EXISTING));
+
+ if (ziinit.filestream == 0)
+ return 0;
+ ziinit.begin_pos = ZTELL(ziinit.z_filefunc,ziinit.filestream);
+ ziinit.in_opened_file_inzip = 0;
+ ziinit.ci.stream_initialised = 0;
+ ziinit.number_entry = 0;
+ ziinit.add_position_when_writting_offset = 0;
+ init_linkedlist(&(ziinit.central_dir));
+
+
+ zi = (zip_internal*)ALLOC(sizeof(zip_internal));
+ if (zi==0)
+ {
+ ZCLOSE(ziinit.z_filefunc,ziinit.filestream);
+ return 0;
+ }
+
+ /* now we add file in a zipfile */
+# ifndef NO_ADDFILEINEXISTINGZIP
+ ziinit.globalcomment = 0;
+ if (append == APPEND_STATUS_ADDINZIP)
+ {
+ uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
+
+ uLong size_central_dir; /* size of the central directory */
+ uLong offset_central_dir; /* offset of start of central directory */
+ uLong central_pos,uL;
+
+ uLong number_disk; /* number of the current dist, used for
+ spaning ZIP, unsupported, always 0*/
+ uLong number_disk_with_CD; /* number the the disk with central dir, used
+ for spaning ZIP, unsupported, always 0*/
+ uLong number_entry;
+ uLong number_entry_CD; /* total number of entries in
+ the central dir
+ (same than number_entry on nospan) */
+ uLong size_comment;
+
+ central_pos = ziplocal_SearchCentralDir(&ziinit.z_filefunc,ziinit.filestream);
+ if (central_pos==0)
+ err=ZIP_ERRNO;
+
+ if (ZSEEK(ziinit.z_filefunc, ziinit.filestream,
+ central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
+ err=ZIP_ERRNO;
+
+ /* the signature, already checked */
+ if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&uL)!=ZIP_OK)
+ err=ZIP_ERRNO;
+
+ /* number of this disk */
+ if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_disk)!=ZIP_OK)
+ err=ZIP_ERRNO;
+
+ /* number of the disk with the start of the central directory */
+ if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_disk_with_CD)!=ZIP_OK)
+ err=ZIP_ERRNO;
+
+ /* total number of entries in the central dir on this disk */
+ if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_entry)!=ZIP_OK)
+ err=ZIP_ERRNO;
+
+ /* total number of entries in the central dir */
+ if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_entry_CD)!=ZIP_OK)
+ err=ZIP_ERRNO;
+
+ if ((number_entry_CD!=number_entry) ||
+ (number_disk_with_CD!=0) ||
+ (number_disk!=0))
+ err=ZIP_BADZIPFILE;
+
+ /* size of the central directory */
+ if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&size_central_dir)!=ZIP_OK)
+ err=ZIP_ERRNO;
+
+ /* offset of start of central directory with respect to the
+ starting disk number */
+ if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&offset_central_dir)!=ZIP_OK)
+ err=ZIP_ERRNO;
+
+ /* zipfile global comment length */
+ if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&size_comment)!=ZIP_OK)
+ err=ZIP_ERRNO;
+
+ if ((central_pos<offset_central_dir+size_central_dir) &&
+ (err==ZIP_OK))
+ err=ZIP_BADZIPFILE;
+
+ if (err!=ZIP_OK)
+ {
+ ZCLOSE(ziinit.z_filefunc, ziinit.filestream);
+ return 0;
+ }
+
+ if (size_comment>0)
+ {
+ ziinit.globalcomment = ALLOC(size_comment+1);
+ if (ziinit.globalcomment)
+ {
+ size_comment = ZREAD(ziinit.z_filefunc,
+ ziinit.filestream,
+ ziinit.globalcomment,
+ size_comment);
+ ziinit.globalcomment[size_comment]=0;
+ }
+ }
+
+ byte_before_the_zipfile = central_pos -
+ (offset_central_dir+size_central_dir);
+ ziinit.add_position_when_writting_offset = byte_before_the_zipfile;
+
+ {
+ uLong size_central_dir_to_read = size_central_dir;
+ size_t buf_size = SIZEDATA_INDATABLOCK;
+ void* buf_read = (void*)ALLOC(buf_size);
+ if (ZSEEK(ziinit.z_filefunc, ziinit.filestream,
+ offset_central_dir + byte_before_the_zipfile,
+ ZLIB_FILEFUNC_SEEK_SET) != 0)
+ err=ZIP_ERRNO;
+
+ while ((size_central_dir_to_read>0) && (err==ZIP_OK))
+ {
+ uLong read_this = SIZEDATA_INDATABLOCK;
+ if (read_this > size_central_dir_to_read)
+ read_this = size_central_dir_to_read;
+ if (ZREAD(ziinit.z_filefunc,
+ ziinit.filestream,
+ buf_read,
+ read_this) != read_this)
+ err=ZIP_ERRNO;
+
+ if (err==ZIP_OK)
+ err = add_data_in_datablock(&ziinit.central_dir,buf_read,
+ (uLong)read_this);
+ size_central_dir_to_read-=read_this;
+ }
+ TRYFREE(buf_read);
+ }
+ ziinit.begin_pos = byte_before_the_zipfile;
+ ziinit.number_entry = number_entry_CD;
+
+ if (ZSEEK(ziinit.z_filefunc, ziinit.filestream,
+ offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)
+ err=ZIP_ERRNO;
+ }
+
+ if (globalcomment)
+ {
+ *globalcomment = ziinit.globalcomment;
+ }
+# endif /* !NO_ADDFILEINEXISTINGZIP*/
+
+ if (err != ZIP_OK)
+ {
+# ifndef NO_ADDFILEINEXISTINGZIP
+ TRYFREE(ziinit.globalcomment);
+# endif /* !NO_ADDFILEINEXISTINGZIP*/
+ TRYFREE(zi);
+ return 0;
+ }
+ else
+ {
+ *zi = ziinit;
+ return (zipFile)zi;
+ }
+}
+
+extern MINIZIP_EXPORT zipFile zipOpen (const char *pathname,int append)
+{
+ return zipOpen2(pathname,append,0,0);
+}
+
+extern MINIZIP_EXPORT int zipOpenNewFileInZip3 (zipFile file,const char* filename,const zip_fileinfo* zipfi,
+ const void* extrafield_local,uInt size_extrafield_local,
+ const void* extrafield_global,uInt size_extrafield_global,
+ const char* comment,int method,int level,int raw,
+ int windowBits,int memLevel,int strategy,
+ const char* password,uLong crcForCrypting)
+
+{
+ zip_internal* zi;
+ uInt size_filename;
+ uInt size_comment;
+ uInt i;
+ int err = ZIP_OK;
+
+# ifdef NOCRYPT
+ if (password != 0)
+ return ZIP_PARAMERROR;
+# endif
+
+ if (file == 0)
+ return ZIP_PARAMERROR;
+ if ((method!=0) && (method!=Z_DEFLATED))
+ return ZIP_PARAMERROR;
+
+ zi = (zip_internal*)file;
+
+ if (zi->in_opened_file_inzip == 1)
+ {
+ err = zipCloseFileInZip (file);
+ if (err != ZIP_OK)
+ return err;
+ }
+
+
+ if (filename==0)
+ filename="-";
+
+ if (comment==0)
+ size_comment = 0;
+ else
+ size_comment = (uInt)strlen(comment);
+
+ size_filename = (uInt)strlen(filename);
+
+ if (zipfi == 0)
+ zi->ci.dosDate = 0;
+ else
+ {
+ if (zipfi->dosDate != 0)
+ zi->ci.dosDate = zipfi->dosDate;
+ else zi->ci.dosDate = ziplocal_TmzDateToDosDate(&zipfi->tmz_date,zipfi->dosDate);
+ }
+
+ zi->ci.flag = 0;
+ if ((level==8) || (level==9))
+ zi->ci.flag |= 2;
+ if ((level==2))
+ zi->ci.flag |= 4;
+ if ((level==1))
+ zi->ci.flag |= 6;
+ if (password != 0)
+ zi->ci.flag |= 1;
+
+ zi->ci.crc32 = 0;
+ zi->ci.method = method;
+ zi->ci.encrypt = 0;
+ zi->ci.stream_initialised = 0;
+ zi->ci.pos_in_buffered_data = 0;
+ zi->ci.raw = raw;
+ zi->ci.pos_local_header = ZTELL(zi->z_filefunc,zi->filestream) ;
+ zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename +
+ size_extrafield_global + size_comment;
+ zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader);
+
+ ziplocal_putValue_inmemory(zi->ci.central_header,(uLong)CENTRALHEADERMAGIC,4);
+ /* version info */
+ ziplocal_putValue_inmemory(zi->ci.central_header+4,(uLong)VERSIONMADEBY,2);
+ ziplocal_putValue_inmemory(zi->ci.central_header+6,(uLong)20,2);
+ ziplocal_putValue_inmemory(zi->ci.central_header+8,(uLong)zi->ci.flag,2);
+ ziplocal_putValue_inmemory(zi->ci.central_header+10,(uLong)zi->ci.method,2);
+ ziplocal_putValue_inmemory(zi->ci.central_header+12,(uLong)zi->ci.dosDate,4);
+ ziplocal_putValue_inmemory(zi->ci.central_header+16,(uLong)0,4); /*crc*/
+ ziplocal_putValue_inmemory(zi->ci.central_header+20,(uLong)0,4); /*compr size*/
+ ziplocal_putValue_inmemory(zi->ci.central_header+24,(uLong)0,4); /*uncompr size*/
+ ziplocal_putValue_inmemory(zi->ci.central_header+28,(uLong)size_filename,2);
+ ziplocal_putValue_inmemory(zi->ci.central_header+30,(uLong)size_extrafield_global,2);
+ ziplocal_putValue_inmemory(zi->ci.central_header+32,(uLong)size_comment,2);
+ ziplocal_putValue_inmemory(zi->ci.central_header+34,(uLong)0,2); /*disk nm start*/
+
+ if (zipfi==0)
+ ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)0,2);
+ else
+ ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)zipfi->internal_fa,2);
+
+ if (zipfi==0)
+ ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)0,4);
+ else
+ ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)zipfi->external_fa,4);
+
+ ziplocal_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header- zi->add_position_when_writting_offset,4);
+
+ for (i=0;i<size_filename;i++)
+ *(zi->ci.central_header+SIZECENTRALHEADER+i) = *(filename+i);
+
+ for (i=0;i<size_extrafield_global;i++)
+ *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+i) =
+ *(((const char*)extrafield_global)+i);
+
+ for (i=0;i<size_comment;i++)
+ *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+
+ size_extrafield_global+i) = *(comment+i);
+ if (zi->ci.central_header == 0)
+ return ZIP_INTERNALERROR;
+
+ /* write the local header */
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)LOCALHEADERMAGIC,4);
+
+ if (err==ZIP_OK)
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)20,2);/* version needed to extract */
+ if (err==ZIP_OK)
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.flag,2);
+
+ if (err==ZIP_OK)
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.method,2);
+
+ if (err==ZIP_OK)
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.dosDate,4);
+
+ if (err==ZIP_OK)
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* crc 32, unknown */
+ if (err==ZIP_OK)
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* compressed size, unknown */
+ if (err==ZIP_OK)
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* uncompressed size, unknown */
+
+ if (err==ZIP_OK)
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_filename,2);
+
+ if (err==ZIP_OK)
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_extrafield_local,2);
+
+ if ((err==ZIP_OK) && (size_filename>0))
+ if (ZWRITE(zi->z_filefunc,zi->filestream,filename,size_filename)!=size_filename)
+ err = ZIP_ERRNO;
+
+ if ((err==ZIP_OK) && (size_extrafield_local>0))
+ if (ZWRITE(zi->z_filefunc,zi->filestream,extrafield_local,size_extrafield_local)
+ !=size_extrafield_local)
+ err = ZIP_ERRNO;
+
+ zi->ci.stream.avail_in = (uInt)0;
+ zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
+ zi->ci.stream.next_out = zi->ci.buffered_data;
+ zi->ci.stream.total_in = 0;
+ zi->ci.stream.total_out = 0;
+
+ if ((err==ZIP_OK) && (zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
+ {
+ zi->ci.stream.zalloc = (alloc_func)0;
+ zi->ci.stream.zfree = (free_func)0;
+ zi->ci.stream.opaque = (voidpf)0;
+
+ if (windowBits>0)
+ windowBits = -windowBits;
+
+ err = deflateInit2(&zi->ci.stream, level,
+ Z_DEFLATED, windowBits, memLevel, strategy);
+
+ if (err==Z_OK)
+ zi->ci.stream_initialised = 1;
+ }
+# ifndef NOCRYPT
+ zi->ci.crypt_header_size = 0;
+ if ((err==Z_OK) && (password != 0))
+ {
+ unsigned char bufHead[RAND_HEAD_LEN];
+ unsigned int sizeHead;
+ zi->ci.encrypt = 1;
+ zi->ci.pcrc_32_tab = get_crc_table();
+ /*init_keys(password,zi->ci.keys,zi->ci.pcrc_32_tab);*/
+
+ sizeHead=crypthead(password,bufHead,RAND_HEAD_LEN,zi->ci.keys,zi->ci.pcrc_32_tab,crcForCrypting);
+ zi->ci.crypt_header_size = sizeHead;
+
+ if (ZWRITE(zi->z_filefunc,zi->filestream,bufHead,sizeHead) != sizeHead)
+ err = ZIP_ERRNO;
+ }
+# endif
+
+ if (err==Z_OK)
+ zi->in_opened_file_inzip = 1;
+ return err;
+}
+
+extern MINIZIP_EXPORT int zipOpenNewFileInZip2(zipFile file,const char* filename,const zip_fileinfo* zipfi,
+ const void* extrafield_local,uInt size_extrafield_local,
+ const void* extrafield_global,uInt size_extrafield_global,
+ const char* comment,int method,int level,int raw)
+
+{
+ return zipOpenNewFileInZip3 (file, filename, zipfi,
+ extrafield_local, size_extrafield_local,
+ extrafield_global, size_extrafield_global,
+ comment, method, level, raw,
+ -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
+ 0, 0);
+}
+
+extern MINIZIP_EXPORT int zipOpenNewFileInZip (zipFile file,const char* filename,const zip_fileinfo* zipfi,
+ const void* extrafield_local,uInt size_extrafield_local,
+ const void* extrafield_global,uInt size_extrafield_global,
+ const char* comment,int method,int level)
+
+{
+ return zipOpenNewFileInZip2 (file, filename, zipfi,
+ extrafield_local, size_extrafield_local,
+ extrafield_global, size_extrafield_global,
+ comment, method, level, 0);
+}
+
+local int zipFlushWriteBuffer(zi)
+ zip_internal* zi;
+{
+ int err=ZIP_OK;
+
+ if (zi->ci.encrypt != 0)
+ {
+#ifndef NOCRYPT
+ uInt i;
+ int t;
+ for (i=0;i<zi->ci.pos_in_buffered_data;i++)
+ zi->ci.buffered_data[i] = zencode(zi->ci.keys, zi->ci.pcrc_32_tab,
+ zi->ci.buffered_data[i],t);
+#endif
+ }
+ if (ZWRITE(zi->z_filefunc,zi->filestream,zi->ci.buffered_data,zi->ci.pos_in_buffered_data)
+ !=zi->ci.pos_in_buffered_data)
+ err = ZIP_ERRNO;
+ zi->ci.pos_in_buffered_data = 0;
+ return err;
+}
+
+extern MINIZIP_EXPORT int zipWriteInFileInZip (zipFile file,const void* buf,unsigned len)
+{
+ zip_internal* zi;
+ int err=ZIP_OK;
+
+ if (file == 0)
+ return ZIP_PARAMERROR;
+ zi = (zip_internal*)file;
+
+ if (zi->in_opened_file_inzip == 0)
+ return ZIP_PARAMERROR;
+
+ zi->ci.stream.next_in = (void*)buf;
+ zi->ci.stream.avail_in = len;
+ zi->ci.crc32 = crc32(zi->ci.crc32,buf,len);
+
+ while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
+ {
+ if (zi->ci.stream.avail_out == 0)
+ {
+ if (zipFlushWriteBuffer(zi) == ZIP_ERRNO)
+ err = ZIP_ERRNO;
+ zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
+ zi->ci.stream.next_out = zi->ci.buffered_data;
+ }
+
+
+ if(err != ZIP_OK)
+ break;
+
+ if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
+ {
+ uLong uTotalOutBefore = zi->ci.stream.total_out;
+ err=deflate(&zi->ci.stream, Z_NO_FLUSH);
+ zi->ci.pos_in_buffered_data +=
+ (uInt)(zi->ci.stream.total_out - uTotalOutBefore);
+ }
+ else
+ {
+ uInt copy_this,i;
+ if (zi->ci.stream.avail_in < zi->ci.stream.avail_out)
+ copy_this = zi->ci.stream.avail_in;
+ else
+ copy_this = zi->ci.stream.avail_out;
+ for (i=0;i<copy_this;i++)
+ *(((char*)zi->ci.stream.next_out)+i) =
+ *(((const char*)zi->ci.stream.next_in)+i);
+
+ {
+ zi->ci.stream.avail_in -= copy_this;
+ zi->ci.stream.avail_out-= copy_this;
+ zi->ci.stream.next_in+= copy_this;
+ zi->ci.stream.next_out+= copy_this;
+ zi->ci.stream.total_in+= copy_this;
+ zi->ci.stream.total_out+= copy_this;
+ zi->ci.pos_in_buffered_data += copy_this;
+ }
+ }
+ }
+
+ return err;
+}
+
+extern MINIZIP_EXPORT int zipCloseFileInZipRaw (zipFile file,uLong uncompressed_size,uLong crc32)
+
+{
+ zip_internal* zi;
+ uLong compressed_size;
+ int err=ZIP_OK;
+
+ if (file == 0)
+ return ZIP_PARAMERROR;
+ zi = (zip_internal*)file;
+
+ if (zi->in_opened_file_inzip == 0)
+ return ZIP_PARAMERROR;
+ zi->ci.stream.avail_in = 0;
+
+ if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
+ while (err==ZIP_OK)
+ {
+ uLong uTotalOutBefore;
+ if (zi->ci.stream.avail_out == 0)
+ {
+ if (zipFlushWriteBuffer(zi) == ZIP_ERRNO)
+ err = ZIP_ERRNO;
+ zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
+ zi->ci.stream.next_out = zi->ci.buffered_data;
+ }
+ uTotalOutBefore = zi->ci.stream.total_out;
+ err=deflate(&zi->ci.stream, Z_FINISH);
+ zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
+ }
+
+ if (err==Z_STREAM_END)
+ err=ZIP_OK; /* this is normal */
+
+ if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK))
+ if (zipFlushWriteBuffer(zi)==ZIP_ERRNO)
+ err = ZIP_ERRNO;
+
+ if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
+ {
+ err=deflateEnd(&zi->ci.stream);
+ zi->ci.stream_initialised = 0;
+ }
+
+ if (!zi->ci.raw)
+ {
+ crc32 = (uLong)zi->ci.crc32;
+ uncompressed_size = (uLong)zi->ci.stream.total_in;
+ }
+ compressed_size = (uLong)zi->ci.stream.total_out;
+# ifndef NOCRYPT
+ compressed_size += zi->ci.crypt_header_size;
+# endif
+
+ ziplocal_putValue_inmemory(zi->ci.central_header+16,crc32,4); /*crc*/
+ ziplocal_putValue_inmemory(zi->ci.central_header+20,
+ compressed_size,4); /*compr size*/
+ if (zi->ci.stream.data_type == Z_ASCII)
+ ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)Z_ASCII,2);
+ ziplocal_putValue_inmemory(zi->ci.central_header+24,
+ uncompressed_size,4); /*uncompr size*/
+
+ if (err==ZIP_OK)
+ err = add_data_in_datablock(&zi->central_dir,zi->ci.central_header,
+ (uLong)zi->ci.size_centralheader);
+ free(zi->ci.central_header);
+
+ if (err==ZIP_OK)
+ {
+ long cur_pos_inzip = ZTELL(zi->z_filefunc,zi->filestream);
+ if (ZSEEK(zi->z_filefunc,zi->filestream,
+ zi->ci.pos_local_header + 14,ZLIB_FILEFUNC_SEEK_SET)!=0)
+ err = ZIP_ERRNO;
+
+ if (err==ZIP_OK)
+ err = ziplocal_putValue(&zi->z_filefunc,
+ zi->filestream,
+ crc32,
+ 4); /* crc 32, unknown */
+
+ if (err==ZIP_OK) /* compressed size, unknown */
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,compressed_size,4);
+
+ if (err==ZIP_OK) /* uncompressed size, unknown */
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,uncompressed_size,4);
+
+ if (ZSEEK(zi->z_filefunc,zi->filestream,
+ cur_pos_inzip,ZLIB_FILEFUNC_SEEK_SET)!=0)
+ err = ZIP_ERRNO;
+ }
+
+ zi->number_entry ++;
+ zi->in_opened_file_inzip = 0;
+
+ return err;
+}
+
+extern MINIZIP_EXPORT int zipCloseFileInZip (zipFile file)
+
+{
+ return zipCloseFileInZipRaw (file,0,0);
+}
+
+extern MINIZIP_EXPORT int zipClose (zipFile file,const char* global_comment)
+{
+ zip_internal* zi;
+ int err = 0;
+ uLong size_centraldir = 0;
+ uLong centraldir_pos_inzip;
+ uInt size_global_comment;
+ if (file == 0)
+ return ZIP_PARAMERROR;
+ zi = (zip_internal*)file;
+
+ if (zi->in_opened_file_inzip == 1)
+ {
+ err = zipCloseFileInZip (file);
+ }
+
+#ifndef NO_ADDFILEINEXISTINGZIP
+ if (global_comment==0)
+ global_comment = zi->globalcomment;
+#endif
+ if (global_comment==0)
+ size_global_comment = 0;
+ else
+ size_global_comment = (uInt)strlen(global_comment);
+
+ centraldir_pos_inzip = ZTELL(zi->z_filefunc,zi->filestream);
+ if (err==ZIP_OK)
+ {
+ linkedlist_datablock_internal* ldi = zi->central_dir.first_block ;
+ while (ldi!=0)
+ {
+ if ((err==ZIP_OK) && (ldi->filled_in_this_block>0))
+ if (ZWRITE(zi->z_filefunc,zi->filestream,
+ ldi->data,ldi->filled_in_this_block)
+ !=ldi->filled_in_this_block )
+ err = ZIP_ERRNO;
+
+ size_centraldir += ldi->filled_in_this_block;
+ ldi = ldi->next_datablock;
+ }
+ }
+ free_datablock(zi->central_dir.first_block);
+
+ if (err==ZIP_OK) /* Magic End */
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4);
+
+ if (err==ZIP_OK) /* number of this disk */
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2);
+
+ if (err==ZIP_OK) /* number of the disk with the start of the central directory */
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2);
+
+ if (err==ZIP_OK) /* total number of entries in the central dir on this disk */
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2);
+
+ if (err==ZIP_OK) /* total number of entries in the central dir */
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2);
+
+ if (err==ZIP_OK) /* size of the central directory */
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_centraldir,4);
+
+ if (err==ZIP_OK) /* offset of start of central directory with respect to the
+ starting disk number */
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,
+ (uLong)(centraldir_pos_inzip - zi->add_position_when_writting_offset),
+ 4);
+
+ if (err==ZIP_OK) /* zipfile comment length */
+ err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_global_comment,2);
+
+ if ((err==ZIP_OK) && (size_global_comment>0))
+ if (ZWRITE(zi->z_filefunc,zi->filestream,
+ global_comment,size_global_comment) != size_global_comment)
+ err = ZIP_ERRNO;
+
+ if (ZCLOSE(zi->z_filefunc,zi->filestream) != 0)
+ if (err == ZIP_OK)
+ err = ZIP_ERRNO;
+
+#ifndef NO_ADDFILEINEXISTINGZIP
+ TRYFREE(zi->globalcomment);
+#endif
+ TRYFREE(zi);
+
+ return err;
+}
diff --git a/ACE/contrib/minizip/zip.h b/ACE/contrib/minizip/zip.h
new file mode 100644
index 00000000000..d5d0c87c595
--- /dev/null
+++ b/ACE/contrib/minizip/zip.h
@@ -0,0 +1,245 @@
+/* zip.h -- IO for compress .zip files using zlib
+ Version 1.01e, February 12th, 2005
+
+ Copyright (C) 1998-2005 Gilles Vollant
+
+ This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
+ WinZip, InfoZip tools and compatible.
+ Multi volume ZipFile (span) are not supported.
+ Encryption compatible with pkzip 2.04g only supported
+ Old compressions used by old PKZip 1.x are not supported
+
+ For uncompress .zip file, look at unzip.h
+
+
+ I WAIT FEEDBACK at mail info@winimage.com
+ Visit also http://www.winimage.com/zLibDll/unzip.html for evolution
+
+ Condition of use and distribution are the same than zlib :
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ $Id$
+
+*/
+
+/* for more info about .ZIP format, see
+ http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
+ http://www.info-zip.org/pub/infozip/doc/
+ PkWare has also a specification at :
+ ftp://ftp.pkware.com/probdesc.zip
+*/
+
+/* Modifications to minizip by ACE/TAO/CIAO developers:
+ 1. Added include of minizip_export.h to make minizip compile under Windows as a DLL
+ 2. Modified the function declarations to be conformant with ANSI C */
+
+#ifndef _zip_H
+#define _zip_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _ZLIB_H
+#include "zlib.h"
+#endif
+
+#include "minizip_export.h"
+
+#ifndef _ZLIBIOAPI_H
+#include "ioapi.h"
+#endif
+
+#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
+/* like the STRICT of WIN32, we define a pointer that cannot be converted
+ from (void*) without cast */
+typedef struct TagzipFile__ { int unused; } zipFile__;
+typedef zipFile__ *zipFile;
+#else
+typedef voidp zipFile;
+#endif
+
+#define ZIP_OK (0)
+#define ZIP_EOF (0)
+#define ZIP_ERRNO (Z_ERRNO)
+#define ZIP_PARAMERROR (-102)
+#define ZIP_BADZIPFILE (-103)
+#define ZIP_INTERNALERROR (-104)
+
+#ifndef DEF_MEM_LEVEL
+# if MAX_MEM_LEVEL >= 8
+# define DEF_MEM_LEVEL 8
+# else
+# define DEF_MEM_LEVEL MAX_MEM_LEVEL
+# endif
+#endif
+/* default memLevel */
+
+/* tm_zip contain date/time info */
+typedef struct tm_zip_s
+{
+ uInt tm_sec; /* seconds after the minute - [0,59] */
+ uInt tm_min; /* minutes after the hour - [0,59] */
+ uInt tm_hour; /* hours since midnight - [0,23] */
+ uInt tm_mday; /* day of the month - [1,31] */
+ uInt tm_mon; /* months since January - [0,11] */
+ uInt tm_year; /* years - [1980..2044] */
+} tm_zip;
+
+typedef struct
+{
+ tm_zip tmz_date; /* date in understandable format */
+ uLong dosDate; /* if dos_date == 0, tmu_date is used */
+/* uLong flag; */ /* general purpose bit flag 2 bytes */
+
+ uLong internal_fa; /* internal file attributes 2 bytes */
+ uLong external_fa; /* external file attributes 4 bytes */
+} zip_fileinfo;
+
+typedef const char* zipcharpc;
+
+
+#define APPEND_STATUS_CREATE (0)
+#define APPEND_STATUS_CREATEAFTER (1)
+#define APPEND_STATUS_ADDINZIP (2)
+
+extern zipFile MINIZIP_EXPORT zipOpen OF((const char *pathname, int append));
+/*
+ Create a zipfile.
+ pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
+ an Unix computer "zlib/zlib113.zip".
+ if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
+ will be created at the end of the file.
+ (useful if the file contain a self extractor code)
+ if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
+ add files in existing zip (be sure you don't add file that doesn't exist)
+ If the zipfile cannot be opened, the return value is NULL.
+ Else, the return value is a zipFile Handle, usable with other function
+ of this zip package.
+*/
+
+/* Note : there is no delete function into a zipfile.
+ If you want delete file into a zipfile, you must open a zipfile, and create another
+ Of couse, you can use RAW reading and writing to copy the file you did not want delte
+*/
+
+extern zipFile MINIZIP_EXPORT zipOpen2 OF((const char *pathname,
+ int append,
+ zipcharpc* globalcomment,
+ zlib_filefunc_def* pzlib_filefunc_def));
+
+extern int MINIZIP_EXPORT zipOpenNewFileInZip OF((zipFile file,
+ const char* filename,
+ const zip_fileinfo* zipfi,
+ const void* extrafield_local,
+ uInt size_extrafield_local,
+ const void* extrafield_global,
+ uInt size_extrafield_global,
+ const char* comment,
+ int method,
+ int level));
+//FUZZ: disable check_for_NULL
+/*
+ Open a file in the ZIP for writing.
+ filename : the filename in zip (if NULL, '-' without quote will be used
+ *zipfi contain supplemental information
+ if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
+ contains the extrafield data the the local header
+ if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
+ contains the extrafield data the the local header
+ if comment != NULL, comment contain the comment string
+ method contain the compression method (0 for store, Z_DEFLATED for deflate)
+ level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
+*/
+//FUZZ: enable check_for_NULL
+
+
+extern int MINIZIP_EXPORT zipOpenNewFileInZip2 OF((zipFile file,
+ const char* filename,
+ const zip_fileinfo* zipfi,
+ const void* extrafield_local,
+ uInt size_extrafield_local,
+ const void* extrafield_global,
+ uInt size_extrafield_global,
+ const char* comment,
+ int method,
+ int level,
+ int raw));
+
+/*
+ Same than zipOpenNewFileInZip, except if raw=1, we write raw file
+ */
+
+extern int MINIZIP_EXPORT zipOpenNewFileInZip3 OF((zipFile file,
+ const char* filename,
+ const zip_fileinfo* zipfi,
+ const void* extrafield_local,
+ uInt size_extrafield_local,
+ const void* extrafield_global,
+ uInt size_extrafield_global,
+ const char* comment,
+ int method,
+ int level,
+ int raw,
+ int windowBits,
+ int memLevel,
+ int strategy,
+ const char* password,
+ uLong crcForCtypting));
+//FUZZ: disable check_for_NULL
+/*
+ Same than zipOpenNewFileInZip2, except
+ windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
+ password : crypting password (NULL for no crypting)
+ crcForCtypting : crc of file to compress (needed for crypting)
+ */
+//FUZZ: enable check_for_NULL
+
+
+extern int MINIZIP_EXPORT zipWriteInFileInZip OF((zipFile file,
+ const void* buf,
+ unsigned len));
+/*
+ Write data in the zipfile
+*/
+
+extern int MINIZIP_EXPORT zipCloseFileInZip OF((zipFile file));
+/*
+ Close the current file in the zipfile
+*/
+
+extern int MINIZIP_EXPORT zipCloseFileInZipRaw OF((zipFile file,
+ uLong uncompressed_size,
+ uLong crc32));
+/*
+ Close the current file in the zipfile, for fiel opened with
+ parameter raw=1 in zipOpenNewFileInZip2
+ uncompressed_size and crc32 are value for the uncompressed size
+*/
+
+extern int MINIZIP_EXPORT zipClose OF((zipFile file,
+ const char* global_comment));
+/*
+ Close the zipfile
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _zip_H */
diff --git a/ACE/contrib/utility/BuildRules/Archive.gcc.post.rules b/ACE/contrib/utility/BuildRules/Archive.gcc.post.rules
new file mode 100644
index 00000000000..11b052d5200
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Archive.gcc.post.rules
@@ -0,0 +1,47 @@
+# file : BuildRules/Archive.gcc.post.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+
+#
+# Note: normally you wouldn't want to change anything below.
+#
+
+FULL_MODULE_PREFIX := $(MODULE_PREFIX)$(module_prefix)
+FULL_MODULE_SUFFIX := $(module_suffix)$(MODULE_SUFFIX)
+MODULE := $(FULL_MODULE_PREFIX)$(module_base)$(FULL_MODULE_SUFFIX)
+
+#
+# Pattern rules catalog.
+# {
+
+# Defined pattern rule to build .o from .cpp
+%.o : %.cpp
+ $(CXX) $(CXX_PREPROCESS_FLAGS) $(CXX_COMPILE_FLAGS) -MD -MP -MT $(@:.o=.d) -MF $(@:.o=.d) -c $< -o $@
+
+# }
+
+# Defines the rule to build module from tarnslated c++ translation units.
+$(MODULE) : $(cxx_translation_units:.cpp=.o) $(translated_units)
+ $(AR) $(AR_FLAGS) $@ $^
+
+# Defines a phony target to clean all what's been generated
+.PHONY : clean
+clean :
+ -rm -f $(cxx_translation_units:.cpp=.o)
+ -rm -f $(cxx_translation_units:.cpp=.d)
+ -rm -f $(MODULE)
+
+
+# Include dependencies for c++ translation units.
+# @@ empty-check should be done in all cases.
+##
+ifneq ($(strip $(cxx_translation_units)),)
+-include $(cxx_translation_units:.cpp=.d)
+endif
+
+
+# The following catch-all rule will skip unknown targets
+%:: ;@:
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Archive.gcc.pre.rules b/ACE/contrib/utility/BuildRules/Archive.gcc.pre.rules
new file mode 100644
index 00000000000..fbeb0329055
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Archive.gcc.pre.rules
@@ -0,0 +1,28 @@
+# file : BuildRules/Archive.gcc.pre.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+# Forces make to delete targets whos rebuild commands failed but
+# updated the target.
+.DELETE_ON_ERROR:
+
+# Empties the suffix list for which old-fassion implicit rules would
+# be used. The net effect is that all predefined implicit rules are
+# disabled now.
+.SUFFIXES:
+
+CXX ?= g++
+CXX_DEP ?= $(CXX) -M
+
+CXX_PREPROCESS_FLAGS :=
+CXX_COMPILE_FLAGS := -Wall
+CXX_LINK_FLAGS :=
+CXX_LINK_LIBS :=
+
+AR ?= ar
+AR_FLAGS := -rc
+
+MODULE_PREFIX := lib
+MODULE_SUFFIX := .a
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Archive.post.rules b/ACE/contrib/utility/BuildRules/Archive.post.rules
new file mode 100644
index 00000000000..ffd1dc833f0
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Archive.post.rules
@@ -0,0 +1,7 @@
+# file : BuildRules/Archive.post.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+$(call include, $(dir $(MAKEFILE))/Archive.gcc.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Archive.pre.rules b/ACE/contrib/utility/BuildRules/Archive.pre.rules
new file mode 100644
index 00000000000..7547d7176f6
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Archive.pre.rules
@@ -0,0 +1,7 @@
+# file : BuildRules/Archive.pre.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+$(call include, $(dir $(MAKEFILE))/Archive.gcc.pre.rules)
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Bootstrap.rules b/ACE/contrib/utility/BuildRules/Bootstrap.rules
new file mode 100644
index 00000000000..32d28e12038
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Bootstrap.rules
@@ -0,0 +1,95 @@
+# file : BuildRules/Bootstrap.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+# basics
+#
+#
+
+define set
+$(eval $1 := $(strip $2))
+endef
+
+define get
+$(value $(strip $1))
+endef
+
+define sub
+$(shell expr $1 - $2)
+endef
+
+define add
+$(shell expr $1 + $2)
+endef
+
+# stack
+#
+#
+
+define push
+$(eval $1 +=$(strip $2))
+endef
+
+define pop
+$(eval $1 :=$(wordlist 1,$(call sub, $(words $(value $(strip $1))), 1),$(value $(strip $1))))
+endef
+
+define top
+$(word $(words $(value $(strip $1))),$(value $(strip $1)))
+endef
+
+# local
+#
+#
+
+define path_to_id
+$(subst /,_,$(subst .,_,$(strip $1)))
+endef
+
+MAKEFILE := $(word $(call sub,$(words $(MAKEFILE_LIST)),1),$(MAKEFILE_LIST))
+INCLUSION_ID := $(call path_to_id,$(MAKEFILE))
+
+define get_inclusion_id
+$(INCLUSION_ID)
+endef
+
+define local_set
+$(eval $(strip $(call get_inclusion_id))_$1 := $(strip $2))
+endef
+
+define local_get
+$($(strip $(call get_inclusion_id))_$1)
+endef
+
+define local_origin
+$(origin $(strip $(call get_inclusion_id))_$1)
+endef
+
+
+define _get_inclusion_count
+$(if $(call local_get,INCLUSION_COUNT),$(call local_get,INCLUSION_COUNT),0)
+endef
+
+define _set_inclusion_count
+$(call local_set,INCLUSION_COUNT,$1)
+endef
+
+# include
+#
+#
+
+define include
+$(strip
+ $(eval $(call push, include_stack, $(MAKEFILE))) \
+ $(eval MAKEFILE :=$(strip $1)) \
+ $(eval $(call push, inclusion_id_stack, $(INCLUSION_ID))) \
+ $(eval $(call _set_inclusion_count,$(call add,$(call _get_inclusion_count),1))) \
+ $(eval INCLUSION_ID :=$(INCLUSION_ID)_$(call local_get,INCLUSION_COUNT)_$(call path_to_id,$1)) \
+ $(eval include $1) \
+ $(eval INCLUSION_ID :=$(call top, inclusion_id_stack)) \
+ $(eval $(call pop, inclusion_id_stack)) \
+ $(eval MAKEFILE :=$(call top, include_stack)) \
+ $(eval $(call pop, include_stack)))
+endef
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Documentation.post.rules b/ACE/contrib/utility/BuildRules/Documentation.post.rules
new file mode 100644
index 00000000000..33fd0c2942f
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Documentation.post.rules
@@ -0,0 +1,35 @@
+# file : BuildRules/Documentation.post.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+#
+# Note: normally you wouldn't want to change anything below.
+#
+
+#
+# Pattern rules catalog.
+# {
+
+# Defined pattern rule to build .hpp.html from .hpp
+%.html : %
+ $(DOC) $(DOC_FLAGS) -o $@ $<
+
+# }
+
+# The following rule will inhibit treatment of documentation as
+# default target.
+.PHONY : all
+all: ;@:
+
+.PHONY : documentation
+documentation : $(patsubst %,%.html,$(doc_translation_units))
+
+# Defines a phony target to clean all what's been generated
+.PHONY : clean
+clean :
+ -rm -f $(patsubst %,%.html,$(doc_translation_units))
+
+# The following catch-all rule will skip unknown targets
+%:: ;@:
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Documentation.pre.rules b/ACE/contrib/utility/BuildRules/Documentation.pre.rules
new file mode 100644
index 00000000000..33161d03d40
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Documentation.pre.rules
@@ -0,0 +1,18 @@
+# file : BuildRules/Documentation.pre.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+# Forces make to delete targets whos rebuild commands failed but
+# updated the target.
+.DELETE_ON_ERROR:
+
+# Empties the suffix list for which old-fassion implicit rules would
+# be used. The net effect is that all predefined implicit rules are
+# disabled now.
+.SUFFIXES:
+
+DOC ?= cpp_to_html
+CXX_FLAGS :=
+
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Executable.gcc.post.rules b/ACE/contrib/utility/BuildRules/Executable.gcc.post.rules
new file mode 100644
index 00000000000..6587cbf0757
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Executable.gcc.post.rules
@@ -0,0 +1,46 @@
+# file : BuildRules/Executable.gcc.post.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+#
+# Note: normally you wouldn't want to change anything below.
+#
+
+FULL_MODULE_PREFIX := $(MODULE_PREFIX)$(module_prefix)
+FULL_MODULE_SUFFIX := $(module_suffix)$(MODULE_SUFFIX)
+MODULE := $(FULL_MODULE_PREFIX)$(module_base)$(FULL_MODULE_SUFFIX)
+
+#
+# Pattern rules catalog.
+# {
+
+# Defined pattern rule to build .o from .cpp
+%.o : %.cpp
+ $(CXX) $(CXX_PREPROCESS_FLAGS) $(CXX_COMPILE_FLAGS) -MD -MP -MT $(@:.o=.d) -MF $(@:.o=.d) -c $< -o $@
+
+# }
+
+# Defines the rule to build module from tarnslated c++ translation units.
+$(MODULE) : $(cxx_translation_units:.cpp=.o) $(translated_units)
+ $(CXX) $(CXX_LINK_FLAGS) -o $@ $^ $(CXX_LINK_LIBS)
+
+# Defines a phony target to clean all what's been generated
+.PHONY : clean
+clean :
+ -rm -f $(cxx_translation_units:.cpp=.o)
+ -rm -f $(cxx_translation_units:.cpp=.d)
+ -rm -f $(MODULE)
+
+
+# Define a phony target to invoke the test driver.
+.PHONY : test
+test : $(MODULE)
+ ./$(MODULE)
+
+# Include dependencies for c++ translation units.
+-include $(cxx_translation_units:.cpp=.d)
+
+# The following catch-all rule will skip unknown targets
+%:: ;@:
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Executable.gcc.pre.rules b/ACE/contrib/utility/BuildRules/Executable.gcc.pre.rules
new file mode 100644
index 00000000000..f7a0798c824
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Executable.gcc.pre.rules
@@ -0,0 +1,26 @@
+# file : BuildRules/Executable.gcc.pre.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+# Forces make to delete targets whos rebuild commands failed but
+# updated the target.
+.DELETE_ON_ERROR:
+
+# Empties the suffix list for which old-fassion implicit rules would
+# be used. The net effect is that all predefined implicit rules are
+# disabled now.
+.SUFFIXES:
+
+CXX ?= g++
+
+CXX_PREPROCESS_FLAGS :=
+CXX_COMPILE_FLAGS := -Wall
+CXX_LINK_FLAGS :=
+CXX_LINK_LIBS :=
+
+
+MODULE_PREFIX :=
+MODULE_SUFFIX :=
+
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Executable.generic.post.rules b/ACE/contrib/utility/BuildRules/Executable.generic.post.rules
new file mode 100644
index 00000000000..26fa9b3b515
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Executable.generic.post.rules
@@ -0,0 +1,55 @@
+# file : BuildRules/Executable.generic.post.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+#
+# Note: normally you wouldn't want to change anything below.
+#
+
+FULL_MODULE_PREFIX := $(MODULE_PREFIX)$(module_prefix)
+FULL_MODULE_SUFFIX := $(module_suffix)$(MODULE_SUFFIX)
+MODULE := $(FULL_MODULE_PREFIX)$(module_base)$(FULL_MODULE_SUFFIX)
+
+#
+# Pattern rules catalog.
+# {
+
+# Defines pattern rule to build .d from .cpp
+%.d: %.cpp
+ set -e; $(CXX_DEP) $(CXX_PREPROCESS_FLAGS) $< \
+ | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
+ [ -s $@ ] || rm -f $@
+
+
+
+# Defined pattern rule to build .o from .cpp
+%.o : %.cpp
+ $(CXX) $(CXX_PREPROCESS_FLAGS) $(CXX_COMPILE_FLAGS) -c $< -o $@
+
+# }
+
+# Defines the rule to build module from tarnslated c++ translation units.
+$(MODULE) : $(cxx_translation_units:.cpp=.o)
+ $(CXX) $(CXX_LINK_FLAGS) -o $@ $^ $(CXX_LINK_LIBS)
+
+# Defines a phony target to clean all what's been generated
+.PHONY : clean
+clean :
+ -rm -f $(cxx_translation_units:.cpp=.o)
+ -rm -f $(cxx_translation_units:.cpp=.d)
+ -rm -f $(MODULE)
+
+
+# Define a phony target to invoke the test driver.
+.PHONY : test
+test : $(MODULE)
+ ./$(MODULE)
+
+# Include dependencies for c++ translation units.
+# Optimization: if we are cleaning there is no reason to calculate
+# dependencies because they will be removed a second later.
+ifneq ($(MAKECMDGOALS),clean)
+ include $(cxx_translation_units:.cpp=.d)
+endif
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Executable.generic.pre.rules b/ACE/contrib/utility/BuildRules/Executable.generic.pre.rules
new file mode 100644
index 00000000000..995dabeebda
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Executable.generic.pre.rules
@@ -0,0 +1,26 @@
+# file : BuildRules/Executable.generic.pre.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+# Forces make to delete targets whos rebuild commands failed but
+# updated the target.
+.DELETE_ON_ERROR:
+
+# Empties the suffix list for which old-fassion implicit rules would
+# be used. The net effect is that all predefined implicit rules are
+# disabled now.
+.SUFFIXES:
+
+CXX ?= g++
+CXX_DEP ?= $(CXX) -M
+
+CXX_PREPROCESS_FLAGS :=
+CXX_COMPILE_FLAGS := -Wall
+CXX_LINK_FLAGS :=
+CXX_LINK_LIBS :=
+
+
+MODULE_PREFIX :=
+MODULE_SUFFIX :=
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Executable.post.rules b/ACE/contrib/utility/BuildRules/Executable.post.rules
new file mode 100644
index 00000000000..da146baf162
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Executable.post.rules
@@ -0,0 +1,8 @@
+# file : BuildRules/Executable.post.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+$(call include, $(dir $(MAKEFILE))/Executable.gcc.post.rules)
+
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Executable.pre.rules b/ACE/contrib/utility/BuildRules/Executable.pre.rules
new file mode 100644
index 00000000000..10a1796450b
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Executable.pre.rules
@@ -0,0 +1,8 @@
+# file : BuildRules/Executable.pre.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+$(call include, $(dir $(MAKEFILE))/Executable.gcc.pre.rules)
+
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Object.gcc.post.rules b/ACE/contrib/utility/BuildRules/Object.gcc.post.rules
new file mode 100644
index 00000000000..a58c2369435
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Object.gcc.post.rules
@@ -0,0 +1,38 @@
+# file : BuildRules/Object.gcc.post.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+
+#
+# Note: normally you wouldn't want to change anything below.
+#
+
+#
+# Pattern rules catalog.
+# {
+
+# Defined pattern rule to build .o from .cpp
+%.o : %.cpp
+ $(CXX) $(CXX_PREPROCESS_FLAGS) $(CXX_COMPILE_FLAGS) -MD -MP -MT $(@:.o=.d) -MF $(@:.o=.d) -c $< -o $@
+
+# }
+
+# Defines the rule to build object files from c++ translation units.
+.PHONY : object
+object : $(cxx_translation_units:.cpp=.o)
+
+# Defines a phony target to clean all that's been generated
+.PHONY : clean
+clean :
+ -rm -f $(cxx_translation_units:.cpp=.o)
+ -rm -f $(cxx_translation_units:.cpp=.d)
+
+
+# Include dependencies for c++ translation units.
+-include $(cxx_translation_units:.cpp=.d)
+
+
+# The following catch-all rule will skip unknown targets
+%:: ;@:
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Object.gcc.pre.rules b/ACE/contrib/utility/BuildRules/Object.gcc.pre.rules
new file mode 100644
index 00000000000..8b8d5527abd
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Object.gcc.pre.rules
@@ -0,0 +1,22 @@
+# file : BuildRules/Object.gcc.pre.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+# Forces make to delete targets whos rebuild commands failed but
+# updated the target.
+.DELETE_ON_ERROR:
+
+# Empties the suffix list for which old-fassion implicit rules would
+# be used. The net effect is that all predefined implicit rules are
+# disabled now.
+.SUFFIXES:
+
+CXX ?= g++
+CXX_DEP ?= $(CXX) -M
+
+CXX_PREPROCESS_FLAGS :=
+CXX_COMPILE_FLAGS := -Wall
+CXX_LINK_FLAGS :=
+CXX_LINK_LIBS :=
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Object.post.rules b/ACE/contrib/utility/BuildRules/Object.post.rules
new file mode 100644
index 00000000000..383f759a25a
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Object.post.rules
@@ -0,0 +1,7 @@
+# file : BuildRules/Object.post.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+$(call include, $(dir $(MAKEFILE))/Object.gcc.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Object.pre.rules b/ACE/contrib/utility/BuildRules/Object.pre.rules
new file mode 100644
index 00000000000..54c75e0643d
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Object.pre.rules
@@ -0,0 +1,7 @@
+# file : BuildRules/Object.pre.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+$(call include, $(dir $(MAKEFILE))/Object.gcc.pre.rules)
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Recursion.post.rules b/ACE/contrib/utility/BuildRules/Recursion.post.rules
new file mode 100644
index 00000000000..e842f0f4b67
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Recursion.post.rules
@@ -0,0 +1,37 @@
+# file : BuildRules/Recursion.post.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+.PHONY: $(target_directory_list) $(target_makefile_list)
+
+_submodules:: $(target_directory_list) $(target_makefile_list)
+
+ifneq ($(strip $(target_directory_list)),)
+$(target_directory_list):
+ $(MAKE) -C $@ -f $(default_makefile_name) $(MAKECMDGOALS)
+endif
+
+ifneq ($(strip $(target_makefile_list)),)
+$(target_makefile_list):
+ $(MAKE) --no-print-directory -f $@ $(MAKECMDGOALS)
+endif
+
+# These rules keep make from trying to use the match-anything rule below to
+# rebuild the makefiles.
+#
+ifneq ($(strip $(default_makefile_name)),)
+$(default_makefile_name) : ;
+endif
+
+%.mk :: ;
+%.rules :: ;
+
+
+# Anything we don't know how to build will use this rule. The command is a
+# do-nothing command, but the prerequisites ensure that the appropriate
+# recursive invocations of make will occur.
+#
+% :: $(target_directory_list) $(target_makefile_list) ;
+
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Recursion.pre.rules b/ACE/contrib/utility/BuildRules/Recursion.pre.rules
new file mode 100644
index 00000000000..1f03311fbc8
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Recursion.pre.rules
@@ -0,0 +1,13 @@
+# file : BuildRules/Recursion.pre.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+.SUFFIXES:
+
+.PHONY: _submodules
+
+_submodules::
+
+default_makefile_name := Makefile
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Shared.gcc.post.rules b/ACE/contrib/utility/BuildRules/Shared.gcc.post.rules
new file mode 100644
index 00000000000..641f79dfc1d
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Shared.gcc.post.rules
@@ -0,0 +1,43 @@
+# file : BuildRules/Shared.gcc.post.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+
+#
+# Note: normally you wouldn't want to change anything below.
+#
+
+FULL_MODULE_PREFIX := $(MODULE_PREFIX)$(module_prefix)
+FULL_MODULE_SUFFIX := $(module_suffix)$(MODULE_SUFFIX)
+MODULE := $(FULL_MODULE_PREFIX)$(module_base)$(FULL_MODULE_SUFFIX)
+
+#
+# Pattern rules catalog.
+# {
+
+# Defined pattern rule to build .o from .cpp
+%.o : %.cpp
+ $(CXX) $(CXX_PREPROCESS_FLAGS) $(CXX_COMPILE_FLAGS) -MD -MP -MT $(@:.o=.d) -MF $(@:.o=.d) -c $< -o $@
+
+# }
+
+# Defines the rule to build module from tarnslated c++ translation units.
+$(MODULE) : $(cxx_translation_units:.cpp=.o) $(translated_units)
+ $(CXX) $(CXX_LINK_FLAGS) -o $@ $^ $(CXX_LINK_LIBS)
+
+# Defines a phony target to clean all what's been generated
+.PHONY : clean
+clean :
+ -rm -f $(cxx_translation_units:.cpp=.o)
+ -rm -f $(cxx_translation_units:.cpp=.d)
+ -rm -f $(MODULE)
+
+
+# Include dependencies for c++ translation units.
+-include $(cxx_translation_units:.cpp=.d)
+
+
+# The following catch-all rule will skip unknown targets
+%:: ;@:
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Shared.gcc.pre.rules b/ACE/contrib/utility/BuildRules/Shared.gcc.pre.rules
new file mode 100644
index 00000000000..d32c42f5260
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Shared.gcc.pre.rules
@@ -0,0 +1,26 @@
+# file : BuildRules/Shared.gcc.pre.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+# Forces make to delete targets whos rebuild commands failed but
+# updated the target.
+.DELETE_ON_ERROR:
+
+# Empties the suffix list for which old-fassion implicit rules would
+# be used. The net effect is that all predefined implicit rules are
+# disabled now.
+.SUFFIXES:
+
+CXX ?= g++
+CXX_DEP ?= $(CXX) -M
+
+CXX_PREPROCESS_FLAGS :=
+CXX_COMPILE_FLAGS := -fPIC -Wall
+CXX_LINK_FLAGS := -shared
+CXX_LINK_LIBS :=
+
+
+MODULE_PREFIX := lib
+MODULE_SUFFIX := .so
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Shared.generic.post.rules b/ACE/contrib/utility/BuildRules/Shared.generic.post.rules
new file mode 100644
index 00000000000..19315b5d7ec
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Shared.generic.post.rules
@@ -0,0 +1,51 @@
+# file : BuildRules/Shared.generic.post.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+
+#
+# Note: normally you wouldn't want to change anything below.
+#
+
+FULL_MODULE_PREFIX := $(MODULE_PREFIX)$(module_prefix)
+FULL_MODULE_SUFFIX := $(module_suffix)$(MODULE_SUFFIX)
+MODULE := $(FULL_MODULE_PREFIX)$(module_base)$(FULL_MODULE_SUFFIX)
+
+#
+# Pattern rules catalog.
+# {
+
+# Defines pattern rule to build .d from .cpp
+%.d: %.cpp
+ set -e; $(CXX_DEP) $(CXX_PREPROCESS_FLAGS) $< \
+ | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
+ [ -s $@ ] || rm -f $@
+
+
+
+# Defined pattern rule to build .o from .cpp
+%.o : %.cpp
+ $(CXX) $(CXX_PREPROCESS_FLAGS) $(CXX_COMPILE_FLAGS) -c $< -o $@
+
+# }
+
+# Defines the rule to build module from tarnslated c++ translation units.
+$(MODULE) : $(cxx_translation_units:.cpp=.o)
+ $(CXX) $(CXX_LINK_FLAGS) -o $@ $^ $(CXX_LINK_LIBS)
+
+# Defines a phony target to clean all what's been generated
+.PHONY : clean
+clean :
+ -rm -f $(cxx_translation_units:.cpp=.o)
+ -rm -f $(cxx_translation_units:.cpp=.d)
+ -rm -f $(MODULE)
+
+
+# Include dependencies for c++ translation units.
+# Optimization: if we are cleaning there is no reason to calculate
+# dependencies because they will be removed a second later.
+ifneq ($(MAKECMDGOALS),clean)
+ include $(cxx_translation_units:.cpp=.d)
+endif
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Shared.generic.pre.rules b/ACE/contrib/utility/BuildRules/Shared.generic.pre.rules
new file mode 100644
index 00000000000..77b2a055956
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Shared.generic.pre.rules
@@ -0,0 +1,26 @@
+# file : BuildRules/Shared.generic.pre.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+# Forces make to delete targets whos rebuild commands failed but
+# updated the target.
+.DELETE_ON_ERROR:
+
+# Empties the suffix list for which old-fassion implicit rules would
+# be used. The net effect is that all predefined implicit rules are
+# disabled now.
+.SUFFIXES:
+
+CXX ?= g++
+
+CXX_PREPROCESS_FLAGS :=
+CXX_COMPILE_FLAGS := -fPIC -Wall
+CXX_LINK_FLAGS := -shared
+CXX_LINK_LIBS :=
+
+
+MODULE_PREFIX := lib
+MODULE_SUFFIX := .so
+
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Shared.post.rules b/ACE/contrib/utility/BuildRules/Shared.post.rules
new file mode 100644
index 00000000000..1f098c99b7b
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Shared.post.rules
@@ -0,0 +1,7 @@
+# file : BuildRules/Shared.post.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+$(call include, $(dir $(MAKEFILE))/Shared.gcc.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Shared.pre.rules b/ACE/contrib/utility/BuildRules/Shared.pre.rules
new file mode 100644
index 00000000000..9ebbeb534dd
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Shared.pre.rules
@@ -0,0 +1,7 @@
+# file : BuildRules/Shared.pre.rules
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+$(call include, $(dir $(MAKEFILE))/Shared.gcc.pre.rules)
+# $Id$
diff --git a/ACE/contrib/utility/BuildRules/Thoughts b/ACE/contrib/utility/BuildRules/Thoughts
new file mode 100644
index 00000000000..486a44f108b
--- /dev/null
+++ b/ACE/contrib/utility/BuildRules/Thoughts
@@ -0,0 +1,55 @@
+
+Makefile variable naming style.
+
+* Each target is usually invoking one or more commands of the following type:
+
+ (1) translator which translates target's prerequsites to target(s)
+
+ (2) arbitrary command which doesn't create target (aka PHONY targets)
+
+Examples of type (1) are:
+
+ - translation of c++ source to object code
+
+ - translation of object code to executable/shared
+
+Examples of type (2) are:
+
+ - test: terget
+
+ - clean: target
+
+
+Some properties of these types of targets:
+
+ (1) - usually implemented as an implicit rule
+
+ - sometimes the same program is used as two separate translators
+ (e.g. CXX is used as a compiler and as a linker)
+
+
+
+ (2) - seldom (never?) implemented as an implicit rule
+
+
+
+Approach #1
+
+For type (1) name is derived from the translator's name e.g.
+
+CXX_COMPILE_FLAGS
+CXX_PREPROCESS_FLAGS
+CXX_LINK_FLAGS
+CXX_LINK_LIBS
+
+CC_
+LD_
+
+
+For type (2) name is derived from the target's name e.g.
+
+TEST_FLAGS
+CLEAN_FLAGS
+INSTALL_FLAGS
+
+$Id$
diff --git a/ACE/contrib/utility/Documentation/Build.xhtml b/ACE/contrib/utility/Documentation/Build.xhtml
new file mode 100644
index 00000000000..97e759bdeb7
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Build.xhtml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/Build.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Building Utility Library</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="build,utility,library"/>
+ <meta name="description" content="Building Utility Library"/>
+
+ <link rel="stylesheet" type="text/css" href="Style/Default.css"/>
+
+</head>
+
+<body>
+
+<h1>Introduction</h1>
+
+<p>Utility Library mostly consists of a header-only sub-libraries
+(the only exception is Introspection Library) so you don't need to
+build anything to start using it. However you may want to build
+examples or libraries that require compilation. This section describes
+how to do that.</p>
+
+<h1>Prerequisites</h1>
+
+<p>To build libraries or examples you will need GNU make and a C++
+compiler with good support of ISO C++ standard.</p>
+
+<p>Utility Library building environment requires latest features of
+GNU make so you have the following options (in the order of increasing
+complexity):</p>
+
+<ul>
+<li>Use GNU make 3.81 or later (not available at the time this is written).</li>
+<li>Use GNU make 3.80 with patches for bug
+<a href="http://savannah.gnu.org/bugs/?func=detailbug&amp;bug_id=1516&amp;group_id=71">1516</a>
+and
+<a href="http://savannah.gnu.org/bugs/?func=detailbug&amp;bug_id=1517&amp;group_id=71">1517</a>.
+</li>
+<li>Use GNU make from CVS.</li>
+</ul>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/CommandLine/News.xhtml b/ACE/contrib/utility/Documentation/CommandLine/News.xhtml
new file mode 100644
index 00000000000..31738f2150d
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/CommandLine/News.xhtml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/CommandLine/News.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Command Line Processing Library News</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="commandline,command,line,option,argument,parameter,operand,argc,argv,news"/>
+ <meta name="description" content="Command Line Processing Library News"/>
+
+ <link rel="stylesheet" type="text/css" href="../Style/Default.css"/>
+
+</head>
+
+<body>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/CommandLine/Terminology.xhtml b/ACE/contrib/utility/Documentation/CommandLine/Terminology.xhtml
new file mode 100644
index 00000000000..6c250f1fa70
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/CommandLine/Terminology.xhtml
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/CommandLine/Terminology.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Command Line Processing Model and Terminology</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2002-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="command,line,terminology,model,argv,argc,argument,command,option,operand"/>
+ <meta name="description" content="Command Line Processing Model and Terminology"/>
+
+ <link rel="stylesheet" type="text/css" href="../Style/Default.css"/>
+
+ <style type="text/css">
+
+ table.center {
+ border-collapse : collapse;
+ }
+
+ table.center * td {
+ text-align : center;
+ vertical-align : middle;
+ }
+
+ </style>
+
+</head>
+
+<body>
+
+<h1>Introduction</h1>
+
+<p>
+Command line is probably the most universal way of passing information from
+caller to the program. Concept of a command line is part of most operating
+systems and programming languages including C and C++. However model and
+terminology for command line processing vary greatly among different
+systems.</p>
+
+<p>
+<a href="http://unix.org/online.html">Single UNIX Specification</a> contains
+<a href="http://opengroup.org/onlinepubs/007904975/basedefs/xbd_chap12.html">
+Utility Argument Syntax Conventions and Guidelines</a> which document basic
+terminology for command line processing. Single UNIX Specification model is
+a "common denominator" for different UNIX implementations. It is somewhat
+minimal and targets system utilities rather than a wide spectrum of
+applications. Another de-facto command line processing model is
+<a href="http://gnu.org/prep/standards_18.html"> GNU Standard for Command
+Line Interfaces</a> which generally encourages conformance to the Single UNIX
+Specification but adds few extensions and uses different terminology.</p>
+
+<p>
+The idea behind this document is to establish terminology and complete model
+for command line processing. Terms translation between this document, Single
+UNIX Specification and GNU Standard for Command Line Interfaces is provided
+in Appendix A.</p>
+
+
+<h1>Model and Terminology</h1>
+
+<p>
+<em>Command line</em> is an array of character strings and not just
+a string with spaces between words as some people tend to think.</p>
+
+<p>
+Each string in a command line array is referred to as <em>argument
+</em>. First argument usually contains a string that refers to an executable.
+</p>
+
+<p>
+Interpretation of arguments is completely up to a program logic however
+conventions exist that vary among different systems. Usually groups of
+arguments are translated into a higher-level objects such as commands,
+options, and operands. These objects form a model for command line processing.
+All of them are defined below.</p>
+
+
+<p>
+<em>Command</em> is usually a word, or a single letter that represents
+a command to the program logic. Neither Single UNIX Specification nor GNU
+Standard for Command Line Interfaces has the notion of a command. Other terms
+for command include <em>action</em> and <em>function</em>. Command is usually
+(but not necessarily) the first argument after executable name. Here are few
+examples:</p>
+
+<p><code>tar x</code></p>
+
+<p class="indent">
+Here we have a one letter command <code>'x'</code> (extract). In GNU tar
+manual it is called <em>functional letter</em>.</p>
+
+<p><code>tar xvf</code></p>
+
+<p class="indent">
+Here we have three commands encoded as a single letter each. Actually
+semantically only <code>'x'</code> is a command while <code>'v'</code>
+(verbose) and <code>'f'</code> (read from a file) are options.</p>
+
+<p><code>openssl req</code></p>
+
+<p class="indent">
+Here we have a word command <code>'req'</code> (operations with certificate
+requests).</p>
+
+<p><code>cvs checkout foo</code></p>
+
+<p class="indent">
+Here we have a word command <code>'checkout'</code> and command operand
+<code>foo</code>.</p>
+
+
+<p><code>tar --help</code></p>
+
+<p class="indent">
+Even though <code>'--help'</code> is usually considered to be an option
+semantically it is a command.</p>
+
+
+<p>
+<em>Option</em> consists of <em>option name</em> and optionally
+one or more <em>option values</em>. Options are usually optional.
+Non-optional options are usually better represented by commands or operands.
+</p>
+
+<p>Option name usually takes up one argument. Option names usually start with
+a prefix (e.g. <code>'--compile-only'</code>, <code>'-c'</code> or <code>'/c'
+</code>). This helps distinguish them from commands and operands. Option name
+may have aliases (e.g. for option name <code>'--output-dir'</code> there could
+be an <code>'-o'</code> alias).</p>
+
+<p>
+Option without a value is alway optional and represents an option with implied
+binary value (e.g. {0, 1} or {false, true} etc.). Such option is sometimes
+called <em>flag</em>.</p>
+
+<p>
+Option can be associated with a program or a command. Thus the concept of
+option can be further refined to <em>program option</em> and <em>
+command option</em>. Program option alters behavior of the program as a
+whole while command option is only affecting particular command.</p>
+
+
+<p>Following are some examples:</p>
+
+<p><code>g++ -o hello.o hello.cpp</code></p>
+
+<p class="indent">
+Here we have an option with name <code>'-o'</code> which has a value
+<code>'hello.o'</code>. <code>'hello.cpp'</code> is an operand.</p>
+
+
+<p><code>ls -l</code></p>
+
+<p class="indent">Here we have a flag with name <code>'-l'</code>.</p>
+
+<p>
+<code>foo --bar=a,b,c</code><br/>
+<code>foo -b "a,b,c"</code><br/>
+<code>foo /baz a b c</code>
+</p>
+
+<p class="indent">
+Here we have a more elaborate example of a multi-format option. It has
+a name <code>'--bar'</code> and two aliases: <code>'-b'</code> and
+<code>'/baz'</code>. It also has three values (in our case they are
+<code>'a'</code>, <code>'b'</code>, and <code>'c'</code>).</p>
+
+<p><code>cvs -z 6 checkout -P foo</code></p>
+
+<p class="indent">
+Here we have a program option with name <code>'-z'</code> and value
+<code>'6'</code> (set compression level to be 6). <code>'checkout'</code>
+is a command. <code>-P</code> is a command flag (prune empty directories).
+<code>'foo'</code> is a command operand.</p>
+
+<p>
+<em>operand</em> usually represents an input value or a parameter.
+Operands can be mandatory or optional. Interpretation of operands is usually
+application-specific.</p>
+
+<p>
+Same as with option the concept of operand can be further refined to
+<em>program operand</em> and <em>command operand</em>.</p>
+
+<h1>Appendix A: Terms Translation</h1>
+
+<table summary="Terms Translation"
+ border="1"
+ cellspacing="0"
+ cellpadding="4"
+ class="center">
+
+ <col width="34%" />
+ <col width="33%" />
+ <col width="33%" />
+
+ <tr>
+ <th>Term</th>
+ <th>Single UNIX Specification</th>
+ <th>GNU</th>
+ </tr>
+ <tr>
+ <td>command line</td>
+ <td>command line</td>
+ <td>command line</td>
+ </tr>
+ <tr>
+ <td>argument</td>
+ <td>argument</td>
+ <td>argument</td>
+ </tr>
+ <tr>
+ <td>command</td>
+ <td>--</td>
+ <td>--</td>
+ </tr>
+ <tr>
+ <td>option</td>
+ <td>--</td>
+ <td>option</td>
+ </tr>
+ <tr>
+ <td>option name</td>
+ <td>option</td>
+ <td>name</td>
+ </tr>
+ <tr>
+ <td>option value</td>
+ <td>option-argument</td>
+ <td>--</td>
+ </tr>
+ <tr>
+ <td>program option</td>
+ <td>--</td>
+ <td>--</td>
+ </tr>
+ <tr>
+ <td>command option</td>
+ <td>--</td>
+ <td>--</td>
+ </tr>
+ <tr>
+ <td>operand</td>
+ <td>operand</td>
+ <td>argument</td>
+ </tr>
+ <tr>
+ <td>program operand</td>
+ <td>--</td>
+ <td>--</td>
+ </tr>
+ <tr>
+ <td>command operand</td>
+ <td>--</td>
+ <td>--</td>
+ </tr>
+</table>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/CommandLine/Thoughts b/ACE/contrib/utility/Documentation/CommandLine/Thoughts
new file mode 100644
index 00000000000..a10675f5945
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/CommandLine/Thoughts
@@ -0,0 +1,8 @@
+
+@@ I should not assume that Utility::CommandLine is the only mechanism
+ used to parse command line. Application developer may be using
+ different components that employ different command line parsers.
+ Thus it seem to me that I should use argv/argc as input/output
+ format.
+
+$Id$
diff --git a/ACE/contrib/utility/Documentation/CommandLine/index.xhtml b/ACE/contrib/utility/Documentation/CommandLine/index.xhtml
new file mode 100644
index 00000000000..7caf91689aa
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/CommandLine/index.xhtml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/CommandLine/index.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Command Line Processing Library</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="commandline,command,line,option,argument,parameter,operand,argc,argv"/>
+ <meta name="description" content="Command Line Processing Library"/>
+
+ <link rel="stylesheet" type="text/css" href="../Style/Default.css"/>
+
+</head>
+
+<body>
+
+<h1>Introduction</h1>
+
+<p>
+Command Line Processing library is in early development stage. You may want
+to take a look at <a href="Terminology.xhtml">Command Line Processing Model
+and Terminology</a> page.
+</p>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ExH/Compound.hpp.html b/ACE/contrib/utility/Documentation/ExH/Compound.hpp.html
new file mode 100644
index 00000000000..b8996f89552
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/Compound.hpp.html
@@ -0,0 +1,50 @@
+<html>
+<head>
+<!-- Generated by the Spirit (http://spirit.sf.net) C++ to HTML Converter -->
+<title>
+Compound.hpp</title>
+<link rel="stylesheet" href="../../Documentation/Style/CXX.css" type="text/css"></head>
+<body>
+<pre>
+<span class=comment>// file : Utility/ExH/Compound.hpp
+// author : Boris Kolpackov &lt;boris@kolpackov.net&gt;
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+</span><span class=keyword>namespace </span><span class=identifier>Utility
+</span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>ExH
+ </span><span class=special>{
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>Type</span><span class=special>, </span><span class=keyword>typename </span><span class=identifier>Base</span><span class=special>&gt;
+ </span><span class=keyword>class </span><span class=identifier>Compound </span><span class=special>: </span><span class=keyword>public </span><span class=keyword>virtual </span><span class=identifier>Base
+ </span><span class=special>{
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>explicit
+ </span><span class=identifier>Compound </span><span class=special>(</span><span class=keyword>char </span><span class=keyword>const</span><span class=special>* </span><span class=identifier>description</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>explicit
+ </span><span class=identifier>Compound </span><span class=special>(</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>description</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>T</span><span class=special>&gt;
+ </span><span class=keyword>explicit
+ </span><span class=identifier>Compound </span><span class=special>(</span><span class=identifier>T </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>description</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=identifier>Compound </span><span class=special>(</span><span class=identifier>Compound </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>src</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>virtual
+ </span><span class=special>~</span><span class=identifier>Compound </span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=identifier>Compound</span><span class=special>&amp;
+ </span><span class=keyword>operator</span><span class=special>= </span><span class=special>(</span><span class=identifier>Compound </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>src</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>protected</span><span class=special>:
+ </span><span class=identifier>Compound </span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+ </span><span class=special>};
+ </span><span class=special>}
+</span><span class=special>}
+
+</span></pre>
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ExH/Example/Makefile b/ACE/contrib/utility/Documentation/ExH/Example/Makefile
new file mode 100644
index 00000000000..e0188a81fbf
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/Example/Makefile
@@ -0,0 +1,26 @@
+# file : Documentation/ExH/Example/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Documentation.pre.rules)
+
+vpath %.cpp $(root)/Example/ExH/BadCast
+vpath %.cpp $(root)/Example/ExH/Compound
+vpath %.cpp $(root)/Example/ExH/HelloWorld
+vpath %.cpp $(root)/Example/ExH/LogicToSystem
+
+doc_translation_units := bad_cast.cpp \
+ compound.cpp \
+ hello_world.cpp \
+ logic_to_system.cpp
+
+DOC_FLAGS := -css $(root)/Documentation/Style/CXX.css
+
+$(call include, $(root)/BuildRules/Documentation.post.rules)
+
+# $Id$
diff --git a/ACE/contrib/utility/Documentation/ExH/Example/bad_cast.cpp.html b/ACE/contrib/utility/Documentation/ExH/Example/bad_cast.cpp.html
new file mode 100644
index 00000000000..ba5044e358a
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/Example/bad_cast.cpp.html
@@ -0,0 +1,63 @@
+<html>
+<head>
+<!-- Generated by the Spirit (http://spirit.sf.net) C++ to HTML Converter -->
+<title>
+bad_cast.cpp</title>
+<link rel="stylesheet" href="../../../Documentation/Style/CXX.css" type="text/css"></head>
+<body>
+<pre>
+<span class=comment>// file : Example/ExH/BadCast/bad_cast.cpp
+// author : Boris Kolpackov &lt;boris@kolpackov.net&gt;
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+</span><span class=preprocessor>#include &quot;Utility/ExH/System/Exception.hpp&quot;
+
+</span><span class=preprocessor>#include &lt;iostream&gt;
+
+</span><span class=keyword>using </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>cerr</span><span class=special>;
+</span><span class=keyword>using </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>endl</span><span class=special>;
+
+
+</span><span class=keyword>struct </span><span class=identifier>A
+</span><span class=special>{
+ </span><span class=keyword>virtual
+ </span><span class=special>~</span><span class=identifier>A</span><span class=special>() </span><span class=special>{}
+</span><span class=special>};
+
+</span><span class=keyword>struct </span><span class=identifier>B
+</span><span class=special>{
+ </span><span class=keyword>void
+ </span><span class=identifier>foo </span><span class=special>() </span><span class=special>{}
+</span><span class=special>};
+
+</span><span class=keyword>void
+</span><span class=identifier>foo </span><span class=special>() </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Utility</span><span class=special>::</span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>System</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>)
+</span><span class=special>{
+ </span><span class=identifier>A </span><span class=identifier>a</span><span class=special>;
+
+ </span><span class=identifier>A</span><span class=special>&amp; </span><span class=identifier>ar </span><span class=special>(</span><span class=identifier>a</span><span class=special>);
+
+ </span><span class=identifier>B</span><span class=special>&amp; </span><span class=identifier>br </span><span class=special>(</span><span class=keyword>dynamic_cast</span><span class=special>&lt;</span><span class=identifier>B</span><span class=special>&amp;&gt; </span><span class=special>(</span><span class=identifier>ar</span><span class=special>));
+
+ </span><span class=identifier>br</span><span class=special>.</span><span class=identifier>foo </span><span class=special>();
+</span><span class=special>}
+
+</span><span class=keyword>int
+</span><span class=identifier>main </span><span class=special>()
+</span><span class=special>{
+ </span><span class=keyword>try
+ </span><span class=special>{
+ </span><span class=identifier>foo </span><span class=special>();
+ </span><span class=special>}
+ </span><span class=keyword>catch </span><span class=special>(</span><span class=identifier>Utility</span><span class=special>::</span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>System</span><span class=special>::</span><span class=identifier>Exception </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>ex</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=identifier>cerr </span><span class=special>&lt;&lt; </span><span class=string>&quot;Caught Utility::ExH::System::Exception: &quot;
+ </span><span class=special>&lt;&lt; </span><span class=identifier>ex</span><span class=special>.</span><span class=identifier>what </span><span class=special>()
+ </span><span class=special>&lt;&lt; </span><span class=identifier>endl</span><span class=special>;
+ </span><span class=special>}
+</span><span class=special>}
+</span></pre>
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ExH/Example/compound.cpp.html b/ACE/contrib/utility/Documentation/ExH/Example/compound.cpp.html
new file mode 100644
index 00000000000..40ecf71eee9
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/Example/compound.cpp.html
@@ -0,0 +1,153 @@
+<html>
+<head>
+<!-- Generated by the Spirit (http://spirit.sf.net) C++ to HTML Converter -->
+<title>
+compound.cpp</title>
+<link rel="stylesheet" href="../../../Documentation/Style/CXX.css" type="text/css"></head>
+<body>
+<pre>
+<span class=comment>// file : Example/ExH/Compound/compound.cpp
+// author : Boris Kolpackov &lt;boris@kolpackov.net&gt;
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+</span><span class=preprocessor>#include &quot;Utility/ExH/Compound.hpp&quot;
+</span><span class=preprocessor>#include &quot;Utility/ExH/System/Exception.hpp&quot;
+</span><span class=preprocessor>#include &quot;Utility/ExH/Logic/DescriptiveException.hpp&quot;
+
+</span><span class=comment>// Include some helper converters to allow exception initialization
+// with std::ostringstream
+
+</span><span class=preprocessor>#include &quot;Utility/ExH/StringStreamConverter.hpp&quot;
+
+</span><span class=preprocessor>#include &lt;iostream&gt;
+
+</span><span class=keyword>using </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>cerr</span><span class=special>;
+</span><span class=keyword>using </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>endl</span><span class=special>;
+</span><span class=keyword>using </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>;
+</span><span class=keyword>using </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>ostringstream</span><span class=special>;
+
+</span><span class=keyword>using </span><span class=keyword>namespace </span><span class=identifier>Utility</span><span class=special>::</span><span class=identifier>ExH</span><span class=special>;
+
+</span><span class=comment>// Here are our components
+
+</span><span class=keyword>class </span><span class=identifier>Base
+</span><span class=special>{
+</span><span class=keyword>public</span><span class=special>:
+
+ </span><span class=comment>//
+ // Exception definitions.
+ //
+
+ // Base logic exception class for component.
+ </span><span class=keyword>class </span><span class=identifier>Exception_ </span><span class=special>{};
+ </span><span class=keyword>typedef
+ </span><span class=identifier>Compound </span><span class=special>&lt;</span><span class=identifier>Exception_</span><span class=special>, </span><span class=identifier>Logic</span><span class=special>::</span><span class=identifier>DescriptiveException</span><span class=special>&gt;
+ </span><span class=identifier>Exception</span><span class=special>;
+
+ </span><span class=keyword>class </span><span class=identifier>InvalidArgument_ </span><span class=special>{};
+ </span><span class=keyword>typedef
+ </span><span class=identifier>Compound </span><span class=special>&lt;</span><span class=identifier>InvalidArgument_</span><span class=special>, </span><span class=identifier>Exception</span><span class=special>&gt;
+ </span><span class=identifier>InvalidArgument</span><span class=special>;
+
+ </span><span class=keyword>class </span><span class=identifier>NotInitialized_ </span><span class=special>{};
+ </span><span class=keyword>typedef
+ </span><span class=identifier>Compound </span><span class=special>&lt;</span><span class=identifier>NotInitialized_</span><span class=special>, </span><span class=identifier>Exception</span><span class=special>&gt;
+ </span><span class=identifier>NotInitialized</span><span class=special>;
+
+</span><span class=keyword>public</span><span class=special>:
+
+ </span><span class=keyword>void
+ </span><span class=identifier>foo </span><span class=special>(</span><span class=keyword>char </span><span class=keyword>const</span><span class=special>* </span><span class=identifier>str</span><span class=special>) </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>InvalidArgument</span><span class=special>, </span><span class=identifier>NotInitialized</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=comment>// This is just an example.
+
+ </span><span class=keyword>if </span><span class=special>(</span><span class=identifier>str </span><span class=special>== </span><span class=number>0</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=keyword>throw </span><span class=identifier>InvalidArgument </span><span class=special>(</span><span class=string>&quot;Base::foo: first parameter is zero.&quot;</span><span class=special>);
+ </span><span class=special>}
+ </span><span class=keyword>else
+ </span><span class=special>{
+ </span><span class=identifier>ostringstream </span><span class=identifier>ostr</span><span class=special>;
+ </span><span class=identifier>ostr </span><span class=special>&lt;&lt; </span><span class=string>&quot;Base::foo [this = &quot; </span><span class=special>&lt;&lt; </span><span class=keyword>this </span><span class=special>&lt;&lt; </span><span class=string>&quot;]: object is not initialized.&quot;</span><span class=special>;
+
+ </span><span class=keyword>throw </span><span class=identifier>NotInitialized </span><span class=special>(</span><span class=identifier>ostr</span><span class=special>);
+ </span><span class=special>}
+ </span><span class=special>}
+
+
+ </span><span class=comment>// We don't know what implementation may decide to throw so
+ // we allow to throw System exception and any logic exception
+ // derived from Base::Exception
+ </span><span class=keyword>virtual </span><span class=keyword>void
+ </span><span class=identifier>vfoo </span><span class=special>() </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>System</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>) </span><span class=special>= </span><span class=number>0</span><span class=special>;
+</span><span class=special>};
+
+</span><span class=keyword>class </span><span class=identifier>Derived </span><span class=special>: </span><span class=keyword>public </span><span class=identifier>Base
+</span><span class=special>{
+</span><span class=keyword>public</span><span class=special>:
+
+ </span><span class=comment>// Define some Derived-specific logic exception.
+ </span><span class=keyword>class </span><span class=identifier>NotImplemented_ </span><span class=special>{};
+ </span><span class=keyword>typedef
+ </span><span class=identifier>Compound </span><span class=special>&lt;</span><span class=identifier>NotImplemented_</span><span class=special>, </span><span class=identifier>Exception</span><span class=special>&gt;
+ </span><span class=identifier>NotImplemented</span><span class=special>;
+
+</span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>virtual </span><span class=keyword>void
+ </span><span class=identifier>vfoo </span><span class=special>() </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>NotImplemented</span><span class=special>, </span><span class=identifier>System</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string </span><span class=identifier>str </span><span class=special>(</span><span class=string>&quot;Derived::vfoo: not implemented yet.&quot;</span><span class=special>);
+ </span><span class=keyword>throw </span><span class=identifier>NotImplemented </span><span class=special>(</span><span class=identifier>str</span><span class=special>);
+ </span><span class=special>}
+</span><span class=special>};
+
+</span><span class=keyword>int
+</span><span class=identifier>main </span><span class=special>()
+</span><span class=special>{
+ </span><span class=keyword>try
+ </span><span class=special>{
+
+ </span><span class=identifier>Derived </span><span class=identifier>d</span><span class=special>;
+ </span><span class=identifier>Base</span><span class=special>* </span><span class=identifier>pb </span><span class=special>(&amp;</span><span class=identifier>d</span><span class=special>);
+
+ </span><span class=comment>// We can use generic handler.
+ </span><span class=keyword>try
+ </span><span class=special>{
+ </span><span class=identifier>pb</span><span class=special>-&gt;</span><span class=identifier>vfoo </span><span class=special>();
+ </span><span class=special>}
+ </span><span class=keyword>catch </span><span class=special>(</span><span class=identifier>Base</span><span class=special>::</span><span class=identifier>Exception </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>ex</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=identifier>cerr </span><span class=special>&lt;&lt; </span><span class=string>&quot;Caught Base::Exception: &quot; </span><span class=special>&lt;&lt; </span><span class=identifier>ex</span><span class=special>.</span><span class=identifier>what </span><span class=special>() </span><span class=special>&lt;&lt; </span><span class=identifier>endl</span><span class=special>;
+ </span><span class=special>}
+
+
+ </span><span class=comment>// Or use more precise control.
+ </span><span class=keyword>try
+ </span><span class=special>{
+ </span><span class=identifier>pb</span><span class=special>-&gt;</span><span class=identifier>foo </span><span class=special>(</span><span class=string>&quot;hello&quot;</span><span class=special>);
+ </span><span class=special>}
+ </span><span class=keyword>catch </span><span class=special>(</span><span class=identifier>Base</span><span class=special>::</span><span class=identifier>NotInitialized </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>ex</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=identifier>cerr </span><span class=special>&lt;&lt; </span><span class=string>&quot;Caught Base::NotInitialized: &quot; </span><span class=special>&lt;&lt; </span><span class=identifier>ex</span><span class=special>.</span><span class=identifier>what </span><span class=special>() </span><span class=special>&lt;&lt; </span><span class=identifier>endl</span><span class=special>;
+ </span><span class=special>}
+
+ </span><span class=comment>// Or use application-level handler.
+ </span><span class=identifier>pb</span><span class=special>-&gt;</span><span class=identifier>foo </span><span class=special>(</span><span class=number>0</span><span class=special>);
+
+ </span><span class=special>}
+ </span><span class=keyword>catch </span><span class=special>(</span><span class=identifier>Logic</span><span class=special>::</span><span class=identifier>Exception </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>ex</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=identifier>cerr </span><span class=special>&lt;&lt; </span><span class=string>&quot;Caught Logic::Exception: &quot; </span><span class=special>&lt;&lt; </span><span class=identifier>ex</span><span class=special>.</span><span class=identifier>what </span><span class=special>() </span><span class=special>&lt;&lt; </span><span class=identifier>endl</span><span class=special>;
+ </span><span class=special>}
+ </span><span class=keyword>catch </span><span class=special>(...)
+ </span><span class=special>{
+ </span><span class=identifier>cerr </span><span class=special>&lt;&lt; </span><span class=string>&quot;Caught unknown exception using catch-all handler&quot; </span><span class=special>&lt;&lt; </span><span class=identifier>endl</span><span class=special>;
+ </span><span class=keyword>return </span><span class=special>-</span><span class=number>1</span><span class=special>;
+ </span><span class=special>}
+
+</span><span class=special>}
+</span></pre>
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ExH/Example/hello_world.cpp.html b/ACE/contrib/utility/Documentation/ExH/Example/hello_world.cpp.html
new file mode 100644
index 00000000000..3d2497f325e
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/Example/hello_world.cpp.html
@@ -0,0 +1,152 @@
+<html>
+<head>
+<!-- Generated by the Spirit (http://spirit.sf.net) C++ to HTML Converter -->
+<title>
+hello_world.cpp</title>
+<link rel="stylesheet" href="../../../Documentation/Style/CXX.css" type="text/css"></head>
+<body>
+<pre>
+<span class=comment>// file : Example/ExH/HelloWorld/hello_world.cpp
+// author : Boris Kolpackov &lt;boris@kolpackov.net&gt;
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+</span><span class=preprocessor>#include &lt;cstdlib&gt; // for std::abort ()
+
+</span><span class=preprocessor>#include &lt;string&gt;
+</span><span class=preprocessor>#include &lt;iostream&gt;
+
+</span><span class=preprocessor>#include &quot;Utility/ExH/System/Exception.hpp&quot;
+</span><span class=preprocessor>#include &quot;Utility/ExH/Logic/Exception.hpp&quot;
+
+</span><span class=keyword>using </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>cerr</span><span class=special>;
+</span><span class=keyword>using </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>cout</span><span class=special>;
+</span><span class=keyword>using </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>endl</span><span class=special>;
+
+</span><span class=keyword>using </span><span class=keyword>namespace </span><span class=identifier>Utility</span><span class=special>;
+
+</span><span class=keyword>class </span><span class=identifier>Application
+</span><span class=special>{
+</span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>class </span><span class=identifier>Exception </span><span class=special>: </span><span class=keyword>public </span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>Logic</span><span class=special>::</span><span class=identifier>Exception </span><span class=special>{};
+
+ </span><span class=comment>// Hint: you may want to try again...
+ </span><span class=keyword>class </span><span class=identifier>FeelingDizzy </span><span class=special>: </span><span class=keyword>public </span><span class=identifier>Exception </span><span class=special>{};
+
+ </span><span class=keyword>class </span><span class=identifier>InvalidArg </span><span class=special>: </span><span class=keyword>public </span><span class=identifier>Exception </span><span class=special>{};
+
+</span><span class=keyword>public</span><span class=special>:
+ </span><span class=identifier>Application </span><span class=special>() </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>System</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>)
+ </span><span class=special>: </span><span class=comment>// The std::string c-tor may throw any kind of exceptions besides
+ // quite possible std::bad_alloc.
+ </span><span class=identifier>greeting_ </span><span class=special>(</span><span class=string>&quot;Hello, world!&quot;</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=special>}
+
+ </span><span class=identifier>Application </span><span class=special>(</span><span class=keyword>char </span><span class=keyword>const </span><span class=special>* </span><span class=identifier>greeting</span><span class=special>) </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>InvalidArg</span><span class=special>,
+ </span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>System</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>)
+ </span><span class=special>: </span><span class=identifier>greeting_ </span><span class=special>(</span><span class=identifier>greeting </span><span class=special>== </span><span class=number>0 </span><span class=special>? </span><span class=string>&quot;&quot; </span><span class=special>: </span><span class=identifier>greeting</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=keyword>if </span><span class=special>(</span><span class=identifier>greeting </span><span class=special>== </span><span class=number>0</span><span class=special>) </span><span class=keyword>throw </span><span class=identifier>InvalidArg </span><span class=special>();
+ </span><span class=special>}
+
+</span><span class=keyword>public</span><span class=special>:
+
+ </span><span class=keyword>void
+ </span><span class=identifier>run </span><span class=special>() </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>FeelingDizzy</span><span class=special>, </span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>System</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=keyword>static </span><span class=keyword>unsigned </span><span class=keyword>int </span><span class=identifier>dizzy_count </span><span class=special>(</span><span class=number>0</span><span class=special>);
+
+ </span><span class=keyword>if </span><span class=special>(</span><span class=identifier>dizzy_count</span><span class=special>++ </span><span class=special>&lt; </span><span class=number>5</span><span class=special>) </span><span class=keyword>throw </span><span class=identifier>FeelingDizzy </span><span class=special>();
+
+ </span><span class=comment>// The next line can throw full bucket of exceptions
+ // not to mention ios_base::failure.
+ </span><span class=identifier>cout </span><span class=special>&lt;&lt; </span><span class=identifier>greeting_</span><span class=special>.</span><span class=identifier>c_str </span><span class=special>() </span><span class=special>&lt;&lt; </span><span class=identifier>endl</span><span class=special>;
+ </span><span class=special>}
+
+</span><span class=keyword>private</span><span class=special>:
+
+ </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string </span><span class=identifier>greeting_</span><span class=special>;
+</span><span class=special>};
+
+
+
+</span><span class=keyword>int
+</span><span class=identifier>main </span><span class=special>()
+</span><span class=special>{
+ </span><span class=comment>// This is a catch-all layer that should be in use only
+ // if we are really in trouble.
+ </span><span class=keyword>try
+ </span><span class=special>{
+ </span><span class=comment>// This is a catch-system layer. Here we will catch exceptions like
+ // bad_alloc, etc. If we get here it means that nobody wanted/managed
+ // to recover from this kind of errors.
+ </span><span class=keyword>try
+ </span><span class=special>{
+ </span><span class=comment>// This is a catch-logic layer. If we get here it usually
+ // indicates an application logic error.
+ </span><span class=keyword>try
+ </span><span class=special>{
+
+ </span><span class=comment>// Ok, here we go about our application logic.
+ </span><span class=keyword>try
+ </span><span class=special>{
+ </span><span class=keyword>for </span><span class=special>(</span><span class=keyword>int </span><span class=identifier>i </span><span class=special>= </span><span class=number>0</span><span class=special>; </span><span class=identifier>i </span><span class=special>&lt; </span><span class=number>10</span><span class=special>; </span><span class=identifier>i</span><span class=special>++)
+ </span><span class=special>{
+ </span><span class=keyword>try
+ </span><span class=special>{
+ </span><span class=identifier>Application </span><span class=identifier>app </span><span class=special>(</span><span class=string>&quot;Hi dude!&quot;</span><span class=special>);
+ </span><span class=identifier>app</span><span class=special>.</span><span class=identifier>run </span><span class=special>();
+ </span><span class=keyword>break</span><span class=special>;
+ </span><span class=special>}
+ </span><span class=keyword>catch </span><span class=special>(</span><span class=identifier>Application</span><span class=special>::</span><span class=identifier>FeelingDizzy </span><span class=keyword>const</span><span class=special>&amp; </span><span class=special>)
+ </span><span class=special>{
+ </span><span class=keyword>if </span><span class=special>(</span><span class=identifier>i </span><span class=special>== </span><span class=number>9</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=identifier>cerr </span><span class=special>&lt;&lt; </span><span class=string>&quot;Given up!&quot; </span><span class=special>&lt;&lt; </span><span class=identifier>endl</span><span class=special>;
+ </span><span class=keyword>return </span><span class=special>-</span><span class=number>1</span><span class=special>;
+ </span><span class=special>}
+ </span><span class=keyword>else
+ </span><span class=special>{
+ </span><span class=identifier>cerr </span><span class=special>&lt;&lt; </span><span class=string>&quot;Application is feeling dizzy. Trying again...&quot;
+ </span><span class=special>&lt;&lt; </span><span class=identifier>endl</span><span class=special>;
+ </span><span class=special>}
+ </span><span class=special>}
+ </span><span class=special>}
+ </span><span class=special>}
+ </span><span class=keyword>catch </span><span class=special>(</span><span class=identifier>Application</span><span class=special>::</span><span class=identifier>InvalidArg </span><span class=keyword>const</span><span class=special>&amp; </span><span class=special>)
+ </span><span class=special>{
+ </span><span class=identifier>cerr </span><span class=special>&lt;&lt; </span><span class=string>&quot;Cought Application::InvalidArg : ...hmm... strange!&quot;
+ </span><span class=special>&lt;&lt; </span><span class=identifier>endl</span><span class=special>;
+ </span><span class=keyword>return </span><span class=special>-</span><span class=number>1</span><span class=special>;
+ </span><span class=special>}
+ </span><span class=special>}
+ </span><span class=keyword>catch </span><span class=special>(</span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>Logic</span><span class=special>::</span><span class=identifier>Exception </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>e</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=identifier>cerr </span><span class=special>&lt;&lt; </span><span class=string>&quot;Caught Logic::Exception : &quot; </span><span class=special>&lt;&lt; </span><span class=identifier>e</span><span class=special>.</span><span class=identifier>what </span><span class=special>() </span><span class=special>&lt;&lt; </span><span class=identifier>endl</span><span class=special>;
+ </span><span class=keyword>return </span><span class=special>-</span><span class=number>1</span><span class=special>;
+ </span><span class=special>}
+ </span><span class=special>}
+ </span><span class=keyword>catch </span><span class=special>(</span><span class=keyword>const </span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>System</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>&amp; </span><span class=identifier>e</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=identifier>cerr </span><span class=special>&lt;&lt; </span><span class=string>&quot;Caught System::Exception : &quot; </span><span class=special>&lt;&lt; </span><span class=identifier>e</span><span class=special>.</span><span class=identifier>what </span><span class=special>() </span><span class=special>&lt;&lt; </span><span class=identifier>endl</span><span class=special>;
+ </span><span class=keyword>return </span><span class=special>-</span><span class=number>1</span><span class=special>;
+ </span><span class=special>}
+ </span><span class=keyword>catch </span><span class=special>(...)
+ </span><span class=special>{
+ </span><span class=identifier>cerr </span><span class=special>&lt;&lt; </span><span class=string>&quot;Caught unknown exception using catch-all handler. &quot; </span><span class=special>&lt;&lt; </span><span class=identifier>endl</span><span class=special>;
+ </span><span class=keyword>return </span><span class=special>-</span><span class=number>1</span><span class=special>;
+ </span><span class=special>}
+ </span><span class=special>}
+ </span><span class=keyword>catch </span><span class=special>(...)
+ </span><span class=special>{
+ </span><span class=comment>// We get here in cases of some hard failure. For example when handling
+ // exception, operator &lt;&lt; throws another exception. Usually application
+ // cannot handle such failures itself so we just propagate it futher.
+ </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>abort </span><span class=special>();
+ </span><span class=special>}
+</span><span class=special>}
+</span></pre>
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ExH/Example/logic_to_system.cpp.html b/ACE/contrib/utility/Documentation/ExH/Example/logic_to_system.cpp.html
new file mode 100644
index 00000000000..d29794d4c2c
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/Example/logic_to_system.cpp.html
@@ -0,0 +1,69 @@
+<html>
+<head>
+<!-- Generated by the Spirit (http://spirit.sf.net) C++ to HTML Converter -->
+<title>
+logic_to_system.cpp</title>
+<link rel="stylesheet" href="../../../Documentation/Style/CXX.css" type="text/css"></head>
+<body>
+<pre>
+<span class=comment>// file : Example/ExH/LogicToSystem/logic_to_system.cpp
+// author : Boris Kolpackov &lt;boris@kolpackov.net&gt;
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+</span><span class=preprocessor>#include &quot;Utility/ExH/System/Exception.hpp&quot;
+</span><span class=preprocessor>#include &quot;Utility/ExH/Logic/Exception.hpp&quot;
+
+</span><span class=preprocessor>#include &lt;iostream&gt;
+
+</span><span class=keyword>using </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>cerr</span><span class=special>;
+</span><span class=keyword>using </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>endl</span><span class=special>;
+
+
+</span><span class=keyword>struct </span><span class=identifier>SubsystemA
+</span><span class=special>{
+ </span><span class=keyword>class </span><span class=identifier>Exception </span><span class=special>: </span><span class=keyword>public </span><span class=identifier>Utility</span><span class=special>::</span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>Logic</span><span class=special>::</span><span class=identifier>Exception </span><span class=special>{};
+
+ </span><span class=keyword>void
+ </span><span class=identifier>foo </span><span class=special>() </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Exception</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=keyword>throw </span><span class=identifier>Exception </span><span class=special>();
+ </span><span class=special>}
+</span><span class=special>};
+
+
+</span><span class=keyword>struct </span><span class=identifier>SubsystemB
+</span><span class=special>{
+ </span><span class=keyword>void
+ </span><span class=identifier>foo </span><span class=special>() </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Utility</span><span class=special>::</span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>System</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=identifier>SubsystemA </span><span class=identifier>a</span><span class=special>;
+ </span><span class=identifier>a</span><span class=special>.</span><span class=identifier>foo </span><span class=special>();
+
+ </span><span class=comment>// Here SubsystemB is using SunsystemA but cannot (forgot, doesnt't
+ // want to, doesn't know how to, etc - pick your favorite) handle
+ // exception thrown by SubsystemA. As a result exception is
+ // 'converted' to System::Exception.
+ </span><span class=special>}
+</span><span class=special>};
+
+
+</span><span class=keyword>int
+</span><span class=identifier>main </span><span class=special>()
+</span><span class=special>{
+ </span><span class=keyword>try
+ </span><span class=special>{
+ </span><span class=identifier>SubsystemB </span><span class=identifier>b</span><span class=special>;
+ </span><span class=identifier>b</span><span class=special>.</span><span class=identifier>foo </span><span class=special>();
+ </span><span class=special>}
+ </span><span class=keyword>catch </span><span class=special>(</span><span class=identifier>Utility</span><span class=special>::</span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>System</span><span class=special>::</span><span class=identifier>Exception </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>ex</span><span class=special>)
+ </span><span class=special>{
+ </span><span class=identifier>cerr </span><span class=special>&lt;&lt; </span><span class=string>&quot;Caught Utility::ExH::System::Exception: &quot;
+ </span><span class=special>&lt;&lt; </span><span class=identifier>ex</span><span class=special>.</span><span class=identifier>what </span><span class=special>()
+ </span><span class=special>&lt;&lt; </span><span class=identifier>endl</span><span class=special>;
+ </span><span class=special>}
+</span><span class=special>}
+</span></pre>
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ExH/Logic/DescriptiveException.hpp.html b/ACE/contrib/utility/Documentation/ExH/Logic/DescriptiveException.hpp.html
new file mode 100644
index 00000000000..b54dbd30936
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/Logic/DescriptiveException.hpp.html
@@ -0,0 +1,61 @@
+<html>
+<head>
+<!-- Generated by the Spirit (http://spirit.sf.net) C++ to HTML Converter -->
+<title>
+DescriptiveException.hpp</title>
+<link rel="stylesheet" href="../../../Documentation/Style/CXX.css" type="text/css"></head>
+<body>
+<pre>
+<span class=comment>// file : Utility/ExH/Logic/DescriptiveException.hpp
+// author : Boris Kolpackov &lt;boris@kolpackov.net&gt;
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+</span><span class=keyword>namespace </span><span class=identifier>Utility
+</span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>ExH
+ </span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>Logic
+ </span><span class=special>{
+ </span><span class=keyword>class </span><span class=identifier>DescriptiveException </span><span class=special>: </span><span class=keyword>public </span><span class=keyword>virtual </span><span class=identifier>Exception
+ </span><span class=special>{
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>explicit
+ </span><span class=identifier>DescriptiveException </span><span class=special>(</span><span class=keyword>char </span><span class=keyword>const</span><span class=special>* </span><span class=identifier>description</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>explicit
+ </span><span class=identifier>DescriptiveException </span><span class=special>(</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>description</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>T</span><span class=special>&gt;
+ </span><span class=keyword>explicit
+ </span><span class=identifier>DescriptiveException </span><span class=special>(</span><span class=identifier>T </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>description</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=identifier>DescriptiveException </span><span class=special>(</span><span class=identifier>DescriptiveException </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>src</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>virtual
+ </span><span class=special>~</span><span class=identifier>DescriptiveException </span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=identifier>DescriptiveException</span><span class=special>&amp;
+ </span><span class=keyword>operator</span><span class=special>= </span><span class=special>(</span><span class=identifier>DescriptiveException </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>src</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>protected</span><span class=special>:
+ </span><span class=identifier>DescriptiveException </span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>void
+ </span><span class=identifier>init </span><span class=special>(</span><span class=keyword>char </span><span class=keyword>const</span><span class=special>* </span><span class=identifier>description</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>virtual </span><span class=keyword>char </span><span class=keyword>const</span><span class=special>*
+ </span><span class=identifier>what </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>private</span><span class=special>:
+ </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>auto_ptr</span><span class=special>&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>&gt; </span><span class=identifier>description_</span><span class=special>;
+ </span><span class=special>};
+ </span><span class=special>}
+ </span><span class=special>}
+</span><span class=special>}
+
+</span></pre>
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ExH/Logic/Exception.hpp.html b/ACE/contrib/utility/Documentation/ExH/Logic/Exception.hpp.html
new file mode 100644
index 00000000000..5b4b56aa46d
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/Logic/Exception.hpp.html
@@ -0,0 +1,43 @@
+<html>
+<head>
+<!-- Generated by the Spirit (http://spirit.sf.net) C++ to HTML Converter -->
+<title>
+Exception.hpp</title>
+<link rel="stylesheet" href="../../../Documentation/Style/CXX.css" type="text/css"></head>
+<body>
+<pre>
+<span class=comment>// file : Utility/ExH/Logic/Exception.hpp
+// author : Boris Kolpackov &lt;boris@kolpackov.net&gt;
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+</span><span class=keyword>namespace </span><span class=identifier>Utility
+</span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>ExH
+ </span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>Logic
+ </span><span class=special>{
+
+ </span><span class=comment>// Logic::Exception inherits from System::Exception for the
+ // following reason. Semantically for some part of the
+ // system particular instance of Logic::Exception may seem as
+ // opaque System::Exception and the only way to handle it would
+ // be to propagate it further. In other words Logic::Exception
+ // can be seemlesly &quot;converted&quot; to System::Exception if there is
+ // no part of the system interested in handling it.
+ //
+
+ </span><span class=keyword>class </span><span class=identifier>Exception </span><span class=special>: </span><span class=keyword>public </span><span class=keyword>virtual </span><span class=identifier>System</span><span class=special>::</span><span class=identifier>Exception
+ </span><span class=special>{
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>virtual
+ </span><span class=special>~</span><span class=identifier>Exception </span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+ </span><span class=special>};
+ </span><span class=special>}
+ </span><span class=special>}
+</span><span class=special>}
+
+</span></pre>
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ExH/Logic/Makefile b/ACE/contrib/utility/Documentation/ExH/Logic/Makefile
new file mode 100644
index 00000000000..d2d48d406bf
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/Logic/Makefile
@@ -0,0 +1,20 @@
+# file : Documentation/ExH/Logic/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Documentation.pre.rules)
+
+vpath %.hpp $(root)/Utility/ExH/Logic
+
+doc_translation_units := Exception.hpp DescriptiveException.hpp
+
+DOC_FLAGS := --strip-preprocessor -css $(root)/Documentation/Style/CXX.css
+
+$(call include, $(root)/BuildRules/Documentation.post.rules)
+
+# $Id$
diff --git a/ACE/contrib/utility/Documentation/ExH/Makefile b/ACE/contrib/utility/Documentation/ExH/Makefile
new file mode 100644
index 00000000000..c4a5bc5f6c0
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/Makefile
@@ -0,0 +1,16 @@
+# file : Documentation/ExH/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list := Makefile.documentation
+target_directory_list := Logic System Example
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Documentation/ExH/Makefile.documentation b/ACE/contrib/utility/Documentation/ExH/Makefile.documentation
new file mode 100644
index 00000000000..3ebf1511555
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/Makefile.documentation
@@ -0,0 +1,20 @@
+# file : Documentation/ExH/Make.doc.mk
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Documentation.pre.rules)
+
+vpath %.hpp $(root)/Utility/ExH
+
+doc_translation_units := Compound.hpp
+
+DOC_FLAGS := --strip-preprocessor -css $(root)/Documentation/Style/CXX.css
+
+$(call include, $(root)/BuildRules/Documentation.post.rules)
+
+# $Id$
diff --git a/ACE/contrib/utility/Documentation/ExH/News.xhtml b/ACE/contrib/utility/Documentation/ExH/News.xhtml
new file mode 100644
index 00000000000..b86f821c992
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/News.xhtml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/ExH/News.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Exception Handling Library News</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="news,C++,exception,handling,model"/>
+ <meta name="description" content="Exception Handling Library News"/>
+
+ <link rel="stylesheet" type="text/css" href="../Style/Default.css"/>
+
+</head>
+
+<body>
+
+<h1>1.2.0</h1>
+
+<ul class="multiline">
+ <li>
+ Fixed incorrect initialization of <code>DescriptiveException</code> with
+ <code>std::ostringstream</code> object. Thanks to Karen Aroutiounov
+ &lt;karen@ipmce.ru&gt; for reporting this.
+ </li>
+</ul>
+
+<h1>1.1.0</h1>
+
+<ul class="multiline">
+ <li>New regression test coverage.</li>
+</ul>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ExH/System/DescriptiveException.hpp.html b/ACE/contrib/utility/Documentation/ExH/System/DescriptiveException.hpp.html
new file mode 100644
index 00000000000..fb6b35d4143
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/System/DescriptiveException.hpp.html
@@ -0,0 +1,64 @@
+<html>
+<head>
+<!-- Generated by the Spirit (http://spirit.sf.net) C++ to HTML Converter -->
+<title>
+DescriptiveException.hpp</title>
+<link rel="stylesheet" href="../../../Documentation/Style/CXX.css" type="text/css"></head>
+<body>
+<pre>
+<span class=comment>// file : Utility/ExH/System/DescriptiveException.hpp
+// author : Boris Kolpackov &lt;boris@kolpackov.net&gt;
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+</span><span class=keyword>namespace </span><span class=identifier>Utility
+</span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>ExH
+ </span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>System
+ </span><span class=special>{
+ </span><span class=keyword>class </span><span class=identifier>DescriptiveException </span><span class=special>: </span><span class=keyword>public </span><span class=keyword>virtual </span><span class=identifier>Exception
+ </span><span class=special>{
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>explicit
+ </span><span class=identifier>DescriptiveException </span><span class=special>(</span><span class=keyword>char </span><span class=keyword>const</span><span class=special>* </span><span class=identifier>description</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>explicit
+ </span><span class=identifier>DescriptiveException </span><span class=special>(</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>description</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>T</span><span class=special>&gt;
+ </span><span class=keyword>explicit
+ </span><span class=identifier>DescriptiveException </span><span class=special>(</span><span class=identifier>T </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>description</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=identifier>DescriptiveException </span><span class=special>(</span><span class=identifier>DescriptiveException </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>src</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>virtual
+ </span><span class=special>~</span><span class=identifier>DescriptiveException </span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=identifier>DescriptiveException</span><span class=special>&amp;
+ </span><span class=keyword>operator</span><span class=special>= </span><span class=special>(</span><span class=identifier>DescriptiveException </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>src</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>protected</span><span class=special>:
+ </span><span class=identifier>DescriptiveException </span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>void
+ </span><span class=identifier>init </span><span class=special>(</span><span class=keyword>char </span><span class=keyword>const</span><span class=special>* </span><span class=identifier>description</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>virtual </span><span class=keyword>char </span><span class=keyword>const</span><span class=special>*
+ </span><span class=identifier>what </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>private</span><span class=special>:
+
+ </span><span class=keyword>static </span><span class=keyword>unsigned </span><span class=keyword>long </span><span class=keyword>const </span><span class=identifier>DESCRIPTION_SIZE </span><span class=special>= </span><span class=number>256</span><span class=special>;
+
+ </span><span class=keyword>char </span><span class=identifier>description_ </span><span class=special>[</span><span class=identifier>DESCRIPTION_SIZE</span><span class=special>];
+ </span><span class=special>};
+ </span><span class=special>}
+ </span><span class=special>}
+</span><span class=special>}
+
+</span></pre>
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ExH/System/Exception.hpp.html b/ACE/contrib/utility/Documentation/ExH/System/Exception.hpp.html
new file mode 100644
index 00000000000..60d6bd733f5
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/System/Exception.hpp.html
@@ -0,0 +1,32 @@
+<html>
+<head>
+<!-- Generated by the Spirit (http://spirit.sf.net) C++ to HTML Converter -->
+<title>
+Exception.hpp</title>
+<link rel="stylesheet" href="../../../Documentation/Style/CXX.css" type="text/css"></head>
+<body>
+<pre>
+<span class=comment>// file : Utility/ExH/System/Exception.hpp
+// author : Boris Kolpackov &lt;boris@kolpackov.net&gt;
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+</span><span class=keyword>namespace </span><span class=identifier>Utility
+</span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>ExH
+ </span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>System
+ </span><span class=special>{
+ </span><span class=comment>// This is the only way to make predefined exceptions like
+ // std::bad_alloc, etc to appear in the right place of the hierarchy.
+ //
+
+ </span><span class=keyword>typedef </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>exception </span><span class=identifier>Exception</span><span class=special>;
+ </span><span class=special>}
+ </span><span class=special>}
+</span><span class=special>}
+
+</span></pre>
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ExH/System/Makefile b/ACE/contrib/utility/Documentation/ExH/System/Makefile
new file mode 100644
index 00000000000..7c7bfbc8e8d
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/System/Makefile
@@ -0,0 +1,20 @@
+# file : Documentation/ExH/System/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Documentation.pre.rules)
+
+vpath %.hpp $(root)/Utility/ExH/System
+
+doc_translation_units := Exception.hpp DescriptiveException.hpp
+
+DOC_FLAGS := --strip-preprocessor -css $(root)/Documentation/Style/CXX.css
+
+$(call include, $(root)/BuildRules/Documentation.post.rules)
+
+# $Id$
diff --git a/ACE/contrib/utility/Documentation/ExH/index.xhtml b/ACE/contrib/utility/Documentation/ExH/index.xhtml
new file mode 100644
index 00000000000..c2d40d9fbaa
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ExH/index.xhtml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/ExH/index.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Exception Handling Library</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="C++,utility,exception,handling,model,ExH"/>
+ <meta name="description" content="Exception Handling Library"/>
+
+ <link rel="stylesheet" type="text/css" href="../Style/Default.css"/>
+
+</head>
+
+<body>
+
+<h1>Introduction</h1>
+
+<p>
+Exception Handling library was designed to promote consistent usage of
+exceptions and exception handling mechanisms throughout the project.
+For a quick overview of the basic idea you may want to look at some
+examples.</p>
+
+<h1>Examples</h1>
+
+<ul class="menu">
+ <li><a href="Example/bad_cast.cpp.html">bad_cast.cpp</a></li>
+ <li><a href="Example/compound.cpp.html">compound.cpp</a></li>
+ <li><a href="Example/hello_world.cpp.html">hello_world.cpp</a></li>
+ <li><a href="Example/logic_to_system.cpp.html">logic_to_system.cpp</a></li>
+</ul>
+
+<h1>Definitions</h1>
+
+<p>Following are the definitions of the main blocks of the model:</p>
+
+<ul class="menu">
+ <li><a href="Compound.hpp.html">ExH::Compound</a></li>
+ <li><a href="System/Exception.hpp.html">ExH::System::Exception</a></li>
+ <li><a href="System/DescriptiveException.hpp.html">ExH::System::DescriptiveException</a></li>
+ <li><a href="Logic/Exception.hpp.html">ExH::Logic::Exception</a></li>
+ <li><a href="Logic/DescriptiveException.hpp.html">ExH::Logic::DescriptiveException</a></li>
+</ul>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/Hetero/News.xhtml b/ACE/contrib/utility/Documentation/Hetero/News.xhtml
new file mode 100644
index 00000000000..b99645d704d
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Hetero/News.xhtml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/Hetero/News.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Heterogeneous Container Library News</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="c++,heterogeneous,container,news"/>
+ <meta name="description" content="Heterogeneous Container Library News"/>
+
+ <link rel="stylesheet" type="text/css" href="../Style/Default.css"/>
+
+</head>
+
+<body>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/Hetero/index.xhtml b/ACE/contrib/utility/Documentation/Hetero/index.xhtml
new file mode 100644
index 00000000000..d45a7b6e82d
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Hetero/index.xhtml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/Hetero/index.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Heterogeneous Container Library</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="c++,heterogeneous,container"/>
+ <meta name="description" content="Heterogeneous Container Library"/>
+
+ <link rel="stylesheet" type="text/css" href="../Style/Default.css"/>
+
+</head>
+
+<body>
+
+<h1>Introduction</h1>
+
+<p>Have you ever wanted to write something like this:</p>
+
+<pre>
+vector v;
+
+v.push_back (10);
+v.push_back (true);
+v.push_back ("hello");
+</pre>
+
+<p>Or maybe even something like this:</p>
+
+<pre>
+template &lt;typename T&gt;
+void print (T const&amp; t)
+{
+ cout &lt;&lt; t &lt;&lt; endl;
+}
+
+for (vector::const_iterator i = v.begin (); i != v.end (); i++)
+{
+ print (*i);
+}
+</pre>
+
+<p>If so then you may be interested in Heterogeneous Container Library.
+It is still in active development but you can take a look for some
+examples in Example/Hetero directory.</p>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/Introspection/News.xhtml b/ACE/contrib/utility/Documentation/Introspection/News.xhtml
new file mode 100644
index 00000000000..257c790766c
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Introspection/News.xhtml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/Introspection/News.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Introspection Library News</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="introspection,library,news"/>
+ <meta name="description" content="Introspection Library News"/>
+
+ <link rel="stylesheet" type="text/css" href="../Style/Default.css"/>
+
+</head>
+
+<body>
+
+<h1>1.2.2</h1>
+<ul class="multiline">
+ <li>
+ Removed no-throw specification from <code>Introspection::Object::~Object()</code>.
+ </li>
+</ul>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/Introspection/index.xhtml b/ACE/contrib/utility/Documentation/Introspection/index.xhtml
new file mode 100644
index 00000000000..462b2c87321
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Introspection/index.xhtml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/Introspection/index.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Introspection Library</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="c++,type,object,class,introspection"/>
+ <meta name="description" content="Introspection Library"/>
+
+ <link rel="stylesheet" type="text/css" href="../Style/Default.css"/>
+
+</head>
+
+<body>
+
+<h1>Introduction</h1>
+
+<p>
+Sometimes there is a need to analyze object's type at runtime. ISO C++
+provides some capabilities for this kind of introspection however they
+are limited to basic type information. Such information as type
+inheritance graph is not accessible in standard C++. Introspection
+Library provides a framework that enables discovery of type structure
+at runtime. The library is still in development stage but a few meaningful
+examples are available in Example/Introspection directory.</p>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/Makefile b/ACE/contrib/utility/Documentation/Makefile
new file mode 100644
index 00000000000..6a2caae9002
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Makefile
@@ -0,0 +1,16 @@
+# file : Documentation/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := ExH ReferenceCounting Synch
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Documentation/News.xhtml b/ACE/contrib/utility/Documentation/News.xhtml
new file mode 100644
index 00000000000..b3ea1389e53
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/News.xhtml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/News.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Utility Library News</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="news,C++,utility,exception,handling,model,reference,counting,thread,synchronization"/>
+ <meta name="description" content="Utility Library News"/>
+
+ <link rel="stylesheet" type="text/css" href="Style/Default.css"/>
+
+</head>
+
+<body>
+
+<h1>Sub-Library News</h1>
+
+<ul class="menu">
+ <li><a href="ExH/News.xhtml">Exception Handling</a></li>
+ <li><a href="ReferenceCounting/News.xhtml">Reference Counting</a></li>
+ <li><a href="Synch/News.xhtml">Synchronization</a></li>
+ <li><a href="Introspection/News.xhtml">Introspection</a></li>
+</ul>
+
+<h1>1.2.2</h1>
+<ul class="multiline">
+ <li>Bug fixes in build system.</li>
+</ul>
+
+
+<h1>1.2.1</h1>
+<ul class="multiline">
+ <li>
+ Documentation bug fixes.
+ </li>
+</ul>
+
+
+<h1>1.2.0</h1>
+<ul class="multiline">
+ <li>
+ Added new <a href="Hetero/index.xhtml">Heterogeneous Container Library</a>.
+ </li>
+ <li>
+ Added new <a href="Introspection/index.xhtml">Introspection Library</a>.
+ </li>
+</ul>
+
+
+<h1>1.1.0</h1>
+<ul class="multiline">
+ <li>New directory structure.</li>
+ <li>New dependency generation mechanism.</li>
+ <li>Automatic documentation generation (<code>make documentation</code>).</li>
+</ul>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ReferenceCounting/DefaultImpl.hpp.html b/ACE/contrib/utility/Documentation/ReferenceCounting/DefaultImpl.hpp.html
new file mode 100644
index 00000000000..86edcd70ec2
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ReferenceCounting/DefaultImpl.hpp.html
@@ -0,0 +1,93 @@
+<html>
+<head>
+<!-- Generated by the Spirit (http://spirit.sf.net) C++ to HTML Converter -->
+<title>
+DefaultImpl.hpp</title>
+<link rel="stylesheet" href="../../Documentation/Style/CXX.css" type="text/css"></head>
+<body>
+<pre>
+<span class=comment>// file : Utility/ReferenceCounting/DefaultImpl.hpp
+// author : Boris Kolpackov &lt;boris@kolpackov.net&gt;
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+</span><span class=keyword>namespace </span><span class=identifier>Utility
+</span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>ReferenceCounting
+ </span><span class=special>{
+ </span><span class=comment>// Default reference counter implementation with parameterised
+ // synchronization policy. It is assumed that none of the SynchPolicy
+ // types throw any logic exceptions. If in fact they do then these
+ // exceptions won't be handled and will be automatically converted
+ // to system exceptions.
+
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>SynchPolicy </span><span class=special>= </span><span class=identifier>Utility</span><span class=special>::</span><span class=identifier>Synch</span><span class=special>::</span><span class=identifier>Policy</span><span class=special>::</span><span class=identifier>Null</span><span class=special>&gt;
+ </span><span class=keyword>class </span><span class=identifier>DefaultImpl </span><span class=special>: </span><span class=keyword>public </span><span class=keyword>virtual </span><span class=identifier>Interface
+ </span><span class=special>{
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>class </span><span class=identifier>InconsistentState_ </span><span class=special>{};
+ </span><span class=keyword>typedef
+ </span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>Compound</span><span class=special>&lt;</span><span class=identifier>InconsistentState_</span><span class=special>, </span><span class=identifier>Exception</span><span class=special>&gt;
+ </span><span class=identifier>InconsistentState</span><span class=special>;
+
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=identifier>DefaultImpl </span><span class=special>() </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=keyword>virtual
+ </span><span class=special>~</span><span class=identifier>DefaultImpl </span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>virtual </span><span class=keyword>void
+ </span><span class=identifier>add_ref </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=keyword>virtual </span><span class=keyword>void
+ </span><span class=identifier>remove_ref </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>virtual </span><span class=identifier>count_t
+ </span><span class=identifier>refcount_value </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=keyword>protected</span><span class=special>:
+ </span><span class=keyword>virtual </span><span class=keyword>void
+ </span><span class=identifier>add_ref_i </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=keyword>virtual </span><span class=keyword>bool
+ </span><span class=identifier>remove_ref_i </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=keyword>virtual </span><span class=identifier>count_t
+ </span><span class=identifier>refcount_value_i </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=keyword>typename </span><span class=identifier>SynchPolicy</span><span class=special>::</span><span class=identifier>Mutex</span><span class=special>&amp;
+ </span><span class=identifier>lock_i </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>protected</span><span class=special>:
+ </span><span class=keyword>typedef
+ </span><span class=keyword>typename </span><span class=identifier>SynchPolicy</span><span class=special>::</span><span class=identifier>Mutex
+ </span><span class=identifier>Mutex_</span><span class=special>;
+
+ </span><span class=keyword>typedef
+ </span><span class=keyword>typename </span><span class=identifier>SynchPolicy</span><span class=special>::</span><span class=identifier>ReadGuard
+ </span><span class=identifier>ReadGuard_</span><span class=special>;
+
+ </span><span class=keyword>typedef
+ </span><span class=keyword>typename </span><span class=identifier>SynchPolicy</span><span class=special>::</span><span class=identifier>WriteGuard
+ </span><span class=identifier>WriteGuard_</span><span class=special>;
+
+ </span><span class=keyword>protected</span><span class=special>:
+ </span><span class=keyword>mutable </span><span class=identifier>count_t </span><span class=identifier>ref_count_</span><span class=special>;
+
+ </span><span class=keyword>private</span><span class=special>:
+ </span><span class=keyword>mutable </span><span class=identifier>Mutex_ </span><span class=identifier>lock_</span><span class=special>;
+
+ </span><span class=keyword>private</span><span class=special>:
+ </span><span class=comment>// Copy semanic is not supported.
+ </span><span class=identifier>DefaultImpl </span><span class=special>(</span><span class=identifier>DefaultImpl </span><span class=keyword>const</span><span class=special>&amp;) </span><span class=keyword>throw </span><span class=special>();
+ </span><span class=identifier>DefaultImpl</span><span class=special>&amp;
+ </span><span class=keyword>operator</span><span class=special>= </span><span class=special>(</span><span class=identifier>DefaultImpl </span><span class=keyword>const</span><span class=special>&amp;) </span><span class=keyword>throw </span><span class=special>();
+ </span><span class=special>};
+ </span><span class=special>}
+</span><span class=special>}
+
+</span></pre>
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ReferenceCounting/Interface.hpp.html b/ACE/contrib/utility/Documentation/ReferenceCounting/Interface.hpp.html
new file mode 100644
index 00000000000..f81c1dc737c
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ReferenceCounting/Interface.hpp.html
@@ -0,0 +1,82 @@
+<html>
+<head>
+<!-- Generated by the Spirit (http://spirit.sf.net) C++ to HTML Converter -->
+<title>
+Interface.hpp</title>
+<link rel="stylesheet" href="../../Documentation/Style/CXX.css" type="text/css"></head>
+<body>
+<pre>
+<span class=comment>// file : Utility/ReferenceCounting/Interface.hpp
+// author : Boris Kolpackov &lt;boris@kolpackov.net&gt;
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+</span><span class=keyword>namespace </span><span class=identifier>Utility
+</span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>ReferenceCounting
+ </span><span class=special>{
+ </span><span class=comment>// Interface to a reference-countable object. Note that _remove_ref ()
+ // member function has a no-throw semantic. Even though it can lead to
+ // a diagnostic loss it was made no-throw because it has a destructor
+ // semantic.
+
+ </span><span class=keyword>class </span><span class=identifier>Interface
+ </span><span class=special>{
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>typedef
+ </span><span class=keyword>unsigned </span><span class=keyword>long
+ </span><span class=identifier>count_t</span><span class=special>;
+
+ </span><span class=keyword>typedef
+ </span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>System</span><span class=special>::</span><span class=identifier>Exception
+ </span><span class=identifier>SystemException</span><span class=special>;
+
+ </span><span class=keyword>class </span><span class=identifier>Exception_ </span><span class=special>{};
+ </span><span class=keyword>typedef
+ </span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>Compound</span><span class=special>&lt;</span><span class=identifier>Exception_</span><span class=special>, </span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>Logic</span><span class=special>::</span><span class=identifier>DescriptiveException</span><span class=special>&gt;
+ </span><span class=identifier>Exception</span><span class=special>;
+
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>virtual </span><span class=keyword>void
+ </span><span class=identifier>add_ref </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>SystemException</span><span class=special>) </span><span class=special>= </span><span class=number>0</span><span class=special>;
+
+ </span><span class=keyword>virtual </span><span class=keyword>void
+ </span><span class=identifier>remove_ref </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>() </span><span class=special>= </span><span class=number>0</span><span class=special>;
+
+ </span><span class=keyword>virtual </span><span class=identifier>count_t
+ </span><span class=identifier>refcount_value </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>SystemException</span><span class=special>) </span><span class=special>= </span><span class=number>0</span><span class=special>;
+
+ </span><span class=keyword>protected</span><span class=special>:
+ </span><span class=identifier>Interface </span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>virtual
+ </span><span class=special>~</span><span class=identifier>Interface </span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>protected</span><span class=special>:
+ </span><span class=keyword>virtual </span><span class=keyword>void
+ </span><span class=identifier>add_ref_i </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>SystemException</span><span class=special>) </span><span class=special>= </span><span class=number>0</span><span class=special>;
+
+ </span><span class=keyword>virtual </span><span class=keyword>bool
+ </span><span class=identifier>remove_ref_i </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>SystemException</span><span class=special>) </span><span class=special>= </span><span class=number>0</span><span class=special>;
+
+ </span><span class=keyword>virtual </span><span class=identifier>count_t
+ </span><span class=identifier>refcount_value_i </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>SystemException</span><span class=special>) </span><span class=special>= </span><span class=number>0</span><span class=special>;
+
+ </span><span class=keyword>private</span><span class=special>:
+ </span><span class=comment>// Copy semanic is not supported.
+ </span><span class=identifier>Interface </span><span class=special>(</span><span class=identifier>Interface </span><span class=keyword>const</span><span class=special>&amp;) </span><span class=keyword>throw </span><span class=special>();
+ </span><span class=identifier>Interface</span><span class=special>&amp;
+ </span><span class=keyword>operator</span><span class=special>= </span><span class=special>(</span><span class=identifier>Interface </span><span class=keyword>const</span><span class=special>&amp;) </span><span class=keyword>throw </span><span class=special>();
+ </span><span class=special>};
+
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>Type</span><span class=special>&gt;
+ </span><span class=identifier>Type</span><span class=special>*
+ </span><span class=identifier>add_ref </span><span class=special>(</span><span class=identifier>Type</span><span class=special>* </span><span class=identifier>ptr</span><span class=special>)
+ </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>SystemException</span><span class=special>);
+ </span><span class=special>}
+</span><span class=special>}
+
+</span></pre>
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ReferenceCounting/Makefile b/ACE/contrib/utility/Documentation/ReferenceCounting/Makefile
new file mode 100644
index 00000000000..3202f185418
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ReferenceCounting/Makefile
@@ -0,0 +1,22 @@
+# file : Documentation/ReferenceCounting/Make.doc.mk
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Documentation.pre.rules)
+
+vpath %.hpp $(root)/Utility/ReferenceCounting
+
+doc_translation_units := DefaultImpl.hpp \
+ Interface.hpp \
+ SmartPtr.hpp \
+ StrictPtr.hpp
+
+DOC_FLAGS := --strip-preprocessor -css $(root)/Documentation/Style/CXX.css
+
+$(call include, $(root)/BuildRules/Documentation.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Documentation/ReferenceCounting/News.xhtml b/ACE/contrib/utility/Documentation/ReferenceCounting/News.xhtml
new file mode 100644
index 00000000000..472a97e9e66
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ReferenceCounting/News.xhtml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/ReferenceCounting/News.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Reference Counting Library News</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="news,C++,reference,counting,smart,pointer"/>
+ <meta name="description" content="Reference Counting Library News"/>
+
+ <link rel="stylesheet" type="text/css" href="../Style/Default.css"/>
+
+</head>
+
+<body>
+
+<h1>1.1.0</h1>
+<ul class="multiline">
+<li>New regression test coverage.</li>
+
+<li>
+<code>
+<a href="SmartPtr.hpp.html">Utility::ReferenceCounting::SmartPtr</a>
+</code>
+: added
+<pre class="cpp-code">
+template&lt;typename Other&gt;
+SmartPtr (SmartPtr&lt;Other&gt; const&amp;)
+</pre>
+and
+<pre class="cpp-code">
+template&lt;typename Other&gt;
+operator= (SmartPtr&lt;Other&gt; const&amp;)
+</pre>
+</li>
+
+<li>
+<code>
+<a href="SmartPtr.hpp.html">Utility::ReferenceCounting::SmartPtr</a>
+</code>
+: added
+<pre class="cpp-code">typedef T Type;</pre>
+in order to provide access to underlying type.
+</li>
+
+<li>
+<code><a href="index.xhtml">Utility::ReferenceCounting</a></code>
+: added
+<pre class="cpp-code">
+template &lt;typename D, typename S&gt;
+D*
+smart_cast (SmartPtr&lt;S&gt; const&amp;)
+</pre>
+to provide more convenient <code>dynamic_cast</code> functionality.
+</li>
+
+<li>
+<code><a href="index.xhtml">Utility::ReferenceCounting</a></code>
+: added
+<pre class="cpp-code">
+template &lt;typename T&gt;
+SmartPtr&lt;T&gt; acquire (T*)
+</pre>
+</li>
+
+<li>
+New
+<code>
+<a href="StrictPtr.hpp.html">Utility::ReferenceCounting::StrictPtr</a>
+</code>
+automatic pointer.
+</li>
+
+</ul>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ReferenceCounting/SmartPtr.hpp.html b/ACE/contrib/utility/Documentation/ReferenceCounting/SmartPtr.hpp.html
new file mode 100644
index 00000000000..a2ef9342441
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ReferenceCounting/SmartPtr.hpp.html
@@ -0,0 +1,103 @@
+<html>
+<head>
+<!-- Generated by the Spirit (http://spirit.sf.net) C++ to HTML Converter -->
+<title>
+SmartPtr.hpp</title>
+<link rel="stylesheet" href="../../Documentation/Style/CXX.css" type="text/css"></head>
+<body>
+<pre>
+<span class=comment>// file : Utility/ReferenceCounting/SmartPtr.hpp
+// author : Boris Kolpackov &lt;boris@kolpackov.net&gt;
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+</span><span class=keyword>namespace </span><span class=identifier>Utility
+</span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>ReferenceCounting
+ </span><span class=special>{
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>T</span><span class=special>&gt;
+ </span><span class=keyword>class </span><span class=identifier>SmartPtr
+ </span><span class=special>{
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>typedef
+ </span><span class=identifier>T
+ </span><span class=identifier>Type</span><span class=special>;
+
+ </span><span class=keyword>class </span><span class=identifier>NotInitialized_ </span><span class=special>{};
+ </span><span class=keyword>typedef
+ </span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>Compound</span><span class=special>&lt;</span><span class=identifier>NotInitialized_</span><span class=special>, </span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>Logic</span><span class=special>::</span><span class=identifier>DescriptiveException</span><span class=special>&gt;
+ </span><span class=identifier>NotInitialized</span><span class=special>;
+
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=comment>// c-tor's
+
+ </span><span class=identifier>SmartPtr </span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+ </span><span class=identifier>SmartPtr </span><span class=special>(</span><span class=identifier>Type</span><span class=special>* </span><span class=identifier>ptr</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+ </span><span class=identifier>SmartPtr </span><span class=special>(</span><span class=identifier>SmartPtr</span><span class=special>&lt;</span><span class=identifier>Type</span><span class=special>&gt; </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>s_ptr</span><span class=special>)
+ </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>Other</span><span class=special>&gt;
+ </span><span class=identifier>SmartPtr </span><span class=special>(</span><span class=identifier>SmartPtr</span><span class=special>&lt;</span><span class=identifier>Other</span><span class=special>&gt; </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>s_ptr</span><span class=special>)
+ </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=comment>// d-tor
+
+ </span><span class=special>~</span><span class=identifier>SmartPtr </span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=comment>// assignment &amp; copy-assignment operators
+
+ </span><span class=identifier>SmartPtr</span><span class=special>&lt;</span><span class=identifier>Type</span><span class=special>&gt;&amp;
+ </span><span class=keyword>operator</span><span class=special>= </span><span class=special>(</span><span class=identifier>Type</span><span class=special>* </span><span class=identifier>ptr</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=identifier>SmartPtr</span><span class=special>&lt;</span><span class=identifier>Type</span><span class=special>&gt;&amp;
+ </span><span class=keyword>operator</span><span class=special>= </span><span class=special>(</span><span class=identifier>SmartPtr</span><span class=special>&lt;</span><span class=identifier>Type</span><span class=special>&gt; </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>s_ptr</span><span class=special>)
+ </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>Other</span><span class=special>&gt;
+ </span><span class=identifier>SmartPtr</span><span class=special>&lt;</span><span class=identifier>Type</span><span class=special>&gt;&amp;
+ </span><span class=keyword>operator</span><span class=special>= </span><span class=special>(</span><span class=identifier>SmartPtr</span><span class=special>&lt;</span><span class=identifier>Other</span><span class=special>&gt; </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>s_ptr</span><span class=special>)
+ </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=comment>//conversions
+
+ </span><span class=keyword>operator </span><span class=identifier>Type</span><span class=special>* </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=comment>// accessors
+
+ </span><span class=identifier>Type</span><span class=special>*
+ </span><span class=keyword>operator</span><span class=special>-&gt; </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>NotInitialized</span><span class=special>);
+
+ </span><span class=identifier>Type</span><span class=special>*
+ </span><span class=identifier>in </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=identifier>Type</span><span class=special>*
+ </span><span class=identifier>retn</span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>private</span><span class=special>:
+ </span><span class=identifier>Type</span><span class=special>* </span><span class=identifier>ptr_</span><span class=special>;
+ </span><span class=special>};
+
+ </span><span class=comment>// Specialization of add_ref function for SmartPtr&lt;T&gt;
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>T</span><span class=special>&gt;
+ </span><span class=identifier>T</span><span class=special>*
+ </span><span class=identifier>add_ref </span><span class=special>(</span><span class=identifier>SmartPtr</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt; </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>ptr</span><span class=special>)
+ </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>SystemException</span><span class=special>);
+
+
+ </span><span class=comment>// Dynamic type conversion function for SmartPtr's
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>D</span><span class=special>, </span><span class=keyword>typename </span><span class=identifier>S</span><span class=special>&gt;
+ </span><span class=identifier>D</span><span class=special>*
+ </span><span class=identifier>smart_cast </span><span class=special>(</span><span class=identifier>SmartPtr</span><span class=special>&lt;</span><span class=identifier>S</span><span class=special>&gt; </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>s</span><span class=special>)
+ </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=comment>// Acquisition function
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>T</span><span class=special>&gt;
+ </span><span class=identifier>SmartPtr</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;
+ </span><span class=identifier>acquire </span><span class=special>(</span><span class=identifier>T</span><span class=special>* </span><span class=identifier>ptr</span><span class=special>) </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>SystemException</span><span class=special>);
+ </span><span class=special>}
+</span><span class=special>}
+
+</span></pre>
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ReferenceCounting/StrictPtr.hpp.html b/ACE/contrib/utility/Documentation/ReferenceCounting/StrictPtr.hpp.html
new file mode 100644
index 00000000000..13211b6e3c7
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ReferenceCounting/StrictPtr.hpp.html
@@ -0,0 +1,107 @@
+<html>
+<head>
+<!-- Generated by the Spirit (http://spirit.sf.net) C++ to HTML Converter -->
+<title>
+StrictPtr.hpp</title>
+<link rel="stylesheet" href="../../Documentation/Style/CXX.css" type="text/css"></head>
+<body>
+<pre>
+<span class=comment>// file : Utility/ReferenceCounting/StrictPtr.hpp
+// author : Boris Kolpackov &lt;boris@kolpackov.net&gt;
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+</span><span class=keyword>namespace </span><span class=identifier>Utility
+</span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>ReferenceCounting
+ </span><span class=special>{
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>T</span><span class=special>&gt;
+ </span><span class=keyword>class </span><span class=identifier>StrictPtr
+ </span><span class=special>{
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>typedef
+ </span><span class=identifier>T
+ </span><span class=identifier>Type</span><span class=special>;
+
+ </span><span class=keyword>class </span><span class=identifier>NotInitialized_ </span><span class=special>{};
+ </span><span class=keyword>typedef
+ </span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>Compound</span><span class=special>&lt;</span><span class=identifier>NotInitialized_</span><span class=special>, </span><span class=identifier>ExH</span><span class=special>::</span><span class=identifier>Logic</span><span class=special>::</span><span class=identifier>DescriptiveException</span><span class=special>&gt;
+ </span><span class=identifier>NotInitialized</span><span class=special>;
+
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=comment>// c-tor's
+
+ </span><span class=identifier>StrictPtr </span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>explicit
+ </span><span class=identifier>StrictPtr </span><span class=special>(</span><span class=identifier>Type</span><span class=special>* </span><span class=identifier>ptr</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=identifier>StrictPtr </span><span class=special>(</span><span class=identifier>StrictPtr</span><span class=special>&lt;</span><span class=identifier>Type</span><span class=special>&gt; </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>s_ptr</span><span class=special>)
+ </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>Other</span><span class=special>&gt;
+ </span><span class=identifier>StrictPtr </span><span class=special>(</span><span class=identifier>StrictPtr</span><span class=special>&lt;</span><span class=identifier>Other</span><span class=special>&gt; </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>s_ptr</span><span class=special>)
+ </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>SystemException</span><span class=special>);
+ </span><span class=comment>// d-tor
+
+ </span><span class=special>~</span><span class=identifier>StrictPtr </span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=comment>// assignment &amp; copy-assignment operators
+
+ </span><span class=identifier>StrictPtr</span><span class=special>&lt;</span><span class=identifier>Type</span><span class=special>&gt;&amp;
+ </span><span class=keyword>operator</span><span class=special>= </span><span class=special>(</span><span class=identifier>Type</span><span class=special>* </span><span class=identifier>ptr</span><span class=special>) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=identifier>StrictPtr</span><span class=special>&lt;</span><span class=identifier>Type</span><span class=special>&gt;&amp;
+ </span><span class=keyword>operator</span><span class=special>= </span><span class=special>(</span><span class=identifier>StrictPtr</span><span class=special>&lt;</span><span class=identifier>Type</span><span class=special>&gt; </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>s_ptr</span><span class=special>)
+ </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>Other</span><span class=special>&gt;
+ </span><span class=identifier>StrictPtr</span><span class=special>&lt;</span><span class=identifier>Type</span><span class=special>&gt;&amp;
+ </span><span class=keyword>operator</span><span class=special>= </span><span class=special>(</span><span class=identifier>StrictPtr</span><span class=special>&lt;</span><span class=identifier>Other</span><span class=special>&gt; </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>s_ptr</span><span class=special>)
+ </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=comment>// conversions
+
+ // Note: implicit conversion (operator Type* ()) is not supported.
+
+ // comparison
+
+ </span><span class=keyword>bool
+ </span><span class=keyword>operator</span><span class=special>== </span><span class=special>(</span><span class=identifier>Type</span><span class=special>* </span><span class=identifier>other</span><span class=special>) </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>bool
+ </span><span class=keyword>operator</span><span class=special>!= </span><span class=special>(</span><span class=identifier>Type</span><span class=special>* </span><span class=identifier>other</span><span class=special>) </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=comment>// accessors
+
+ </span><span class=identifier>Type</span><span class=special>*
+ </span><span class=keyword>operator</span><span class=special>-&gt; </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>NotInitialized</span><span class=special>);
+
+ </span><span class=identifier>Type</span><span class=special>*
+ </span><span class=identifier>in </span><span class=special>() </span><span class=keyword>const </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=identifier>Type</span><span class=special>*
+ </span><span class=identifier>retn</span><span class=special>() </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>private</span><span class=special>:
+ </span><span class=identifier>Type</span><span class=special>* </span><span class=identifier>ptr_</span><span class=special>;
+ </span><span class=special>};
+
+ </span><span class=comment>// Specialization of add_ref function for StrictPtr&lt;T&gt;
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>T</span><span class=special>&gt;
+ </span><span class=identifier>T</span><span class=special>*
+ </span><span class=identifier>add_ref </span><span class=special>(</span><span class=identifier>StrictPtr</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt; </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>ptr</span><span class=special>)
+ </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>SystemException</span><span class=special>);
+
+ </span><span class=comment>// Dynamic type conversion function for StrictPtr's
+ </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>D</span><span class=special>, </span><span class=keyword>typename </span><span class=identifier>S</span><span class=special>&gt;
+ </span><span class=identifier>StrictPtr</span><span class=special>&lt;</span><span class=identifier>D</span><span class=special>&gt;
+ </span><span class=identifier>strict_cast </span><span class=special>(</span><span class=identifier>StrictPtr</span><span class=special>&lt;</span><span class=identifier>S</span><span class=special>&gt; </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>s</span><span class=special>)
+ </span><span class=keyword>throw </span><span class=special>(</span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>Exception</span><span class=special>, </span><span class=identifier>Interface</span><span class=special>::</span><span class=identifier>SystemException</span><span class=special>);
+ </span><span class=special>}
+</span><span class=special>}
+
+</span></pre>
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ReferenceCounting/index.xhtml b/ACE/contrib/utility/Documentation/ReferenceCounting/index.xhtml
new file mode 100644
index 00000000000..43ead969460
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ReferenceCounting/index.xhtml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/ReferenceCounting/index.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Reference Counting Library</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="C++,utility,reference,counting"/>
+ <meta name="description" content="Reference Counting Library"/>
+
+ <link rel="stylesheet" type="text/css" href="../Style/Default.css"/>
+
+</head>
+
+<body>
+
+<h1>Introduction</h1>
+
+<p>Reference Counting Library provides basic building blocks for
+reference-countable objects. Implementation is modeled after CORBA
+IDL-to-C++ mapping's reference-countable objects and significantly
+extended.</p>
+
+
+<h1>Definitions</h1>
+
+<p>Below are the definitions of the key classes:</p>
+
+<ul class="menu">
+ <li><a href="Interface.hpp.html">ReferenceCounting::Interface</a></li>
+ <li><a href="DefaultImpl.hpp.html">ReferenceCounting::DefaultImpl</a></li>
+ <li><a href="SmartPtr.hpp.html">ReferenceCounting::SmartPtr</a></li>
+ <li><a href="StrictPtr.hpp.html">ReferenceCounting::StrictPtr</a></li>
+</ul>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/ReleaseProcess b/ACE/contrib/utility/Documentation/ReleaseProcess
new file mode 100644
index 00000000000..9b42a762902
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/ReleaseProcess
@@ -0,0 +1,13 @@
+1) go thru '@@' in source code
+
+2) build & test with g++ and cxx
+
+3) update news pages
+
+4) spellcheck/tidy/validate all xhtml files
+
+5) copy Utility to Utility-x.y.z; make documentation
+
+6) go manually thru all documentation pages with lynx & gui ua
+
+$Id$
diff --git a/ACE/contrib/utility/Documentation/Style/CXX.css b/ACE/contrib/utility/Documentation/Style/CXX.css
new file mode 100644
index 00000000000..49bf0f34e51
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Style/CXX.css
@@ -0,0 +1,9 @@
+pre { BORDER-RIGHT: gray 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: gray 1pt solid; DISPLAY: block; PADDING-LEFT: 2pt; PADDING-BOTTOM: 2pt; MARGIN-LEFT: 32pt; BORDER-LEFT: gray 1pt solid; MARGIN-RIGHT: 32pt; PADDING-TOP: 2pt; BORDER-BOTTOM: gray 1pt solid; FONT-FAMILY: "Courier New", Courier, mono; background-color: #EEEEEE; font-size: small}
+.keyword { color: #000099}
+.identifier { }
+.comment { color: #990000}
+.special { color: #800040}
+.preprocessor { color: #006600}
+.string { color: #666666}
+.number { color: #666666}
+/* $Id$ */
diff --git a/ACE/contrib/utility/Documentation/Style/CXX_Blue.css b/ACE/contrib/utility/Documentation/Style/CXX_Blue.css
new file mode 100644
index 00000000000..52b58d54119
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Style/CXX_Blue.css
@@ -0,0 +1,25 @@
+pre {
+ BORDER-RIGHT: gray 1pt solid;
+ PADDING-RIGHT: 2pt;
+ BORDER-TOP: gray 1pt solid;
+ DISPLAY: block;
+ PADDING-LEFT: 2pt;
+ PADDING-BOTTOM: 2pt;
+ MARGIN-LEFT: 32pt;
+ BORDER-LEFT: gray 1pt solid;
+ MARGIN-RIGHT: 32pt;
+ PADDING-TOP: 2pt;
+ BORDER-BOTTOM: gray 1pt solid;
+ FONT-FAMILY: "Courier New", Courier, mono; background-color: #191970;
+ font-size: small
+}
+
+.keyword { font-weight: bold; color: #afeeee}
+.identifier { color: #98fb98 }
+.comment { color: #add8e6}
+.special { color: #bebebe}
+.preprocessor { color: #7fffd4}
+.string { color: #87cefa}
+.number { color: #bebebe}
+.literal { color: #FF0000}
+/* $Id$ */
diff --git a/ACE/contrib/utility/Documentation/Style/Default.css b/ACE/contrib/utility/Documentation/Style/Default.css
new file mode 100644
index 00000000000..2c90197f340
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Style/Default.css
@@ -0,0 +1,45 @@
+body {
+ font-family : sans-serif;
+
+ color : black;
+ background : white;
+
+ max-width : 40em;
+ padding : 2em 2em 2em 3em;
+ margin : 0;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ font-family : sans-serif;
+ font-weight : 500;
+}
+
+h1 { font-size : 170%; }
+h2 { font-size : 145%; }
+h3 { font-size : 125%; }
+h4 { font-size : 110%; }
+h5 { font-size : 106%; }
+h6 { font-size : 100%; }
+
+p.indent {
+ margin-left : 1.5em;
+}
+
+/* list of links */
+
+ul.menu {
+ list-style-type : none;
+}
+
+ul.menu li {
+ padding-top : 0.3em;
+ padding-bottom : 0.3em;
+}
+
+/* */
+
+ul.multiline li {
+ padding-top : 0.4em;
+ padding-bottom : 0.4em;
+}
+/* $Id$ */
diff --git a/ACE/contrib/utility/Documentation/Synch/Makefile b/ACE/contrib/utility/Documentation/Synch/Makefile
new file mode 100644
index 00000000000..a35e28b530d
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Synch/Makefile
@@ -0,0 +1,16 @@
+# file : Documentation/Synch/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := Policy
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Documentation/Synch/News.xhtml b/ACE/contrib/utility/Documentation/Synch/News.xhtml
new file mode 100644
index 00000000000..f7bf4f01285
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Synch/News.xhtml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/Synch/News.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Synchronization Library News</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="news,C++,synchronization,policy,thread"/>
+ <meta name="description" content="Synchronization Library News"/>
+
+ <link rel="stylesheet" type="text/css" href="../Style/Default.css"/>
+
+</head>
+
+<body>
+
+<h1>1.1.0</h1>
+<ul class="multiline">
+ <li>New regression test coverage.</li>
+</ul>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/Synch/Policy/Makefile b/ACE/contrib/utility/Documentation/Synch/Policy/Makefile
new file mode 100644
index 00000000000..175d207b06e
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Synch/Policy/Makefile
@@ -0,0 +1,20 @@
+# file : Documentation/Synch/Policy/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Documentation.pre.rules)
+
+vpath %.hpp $(root)/Utility/Synch/Policy
+
+doc_translation_units := Null.hpp
+
+DOC_FLAGS := --strip-preprocessor -css $(root)/Documentation/Style/CXX.css
+
+$(call include, $(root)/BuildRules/Documentation.post.rules)
+
+# $Id$
diff --git a/ACE/contrib/utility/Documentation/Synch/Policy/Null.hpp.html b/ACE/contrib/utility/Documentation/Synch/Policy/Null.hpp.html
new file mode 100644
index 00000000000..21173a5951b
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Synch/Policy/Null.hpp.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<!-- Generated by the Spirit (http://spirit.sf.net) C++ to HTML Converter -->
+<title>
+Null.hpp</title>
+<link rel="stylesheet" href="../../../Documentation/Style/CXX.css" type="text/css"></head>
+<body>
+<pre>
+<span class=comment>// file : Utility/Synch/Policy/Null.hpp
+// author : Boris Kolpackov &lt;boris@kolpackov.net&gt;
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+</span><span class=keyword>namespace </span><span class=identifier>Utility
+</span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>Synch
+ </span><span class=special>{
+ </span><span class=keyword>namespace </span><span class=identifier>Policy
+ </span><span class=special>{
+
+ </span><span class=keyword>class </span><span class=identifier>NullMutex
+ </span><span class=special>{
+ </span><span class=special>};
+
+ </span><span class=keyword>class </span><span class=identifier>NullGuard
+ </span><span class=special>{
+ </span><span class=keyword>public</span><span class=special>:
+ </span><span class=keyword>explicit
+ </span><span class=identifier>NullGuard </span><span class=special>(</span><span class=identifier>NullMutex</span><span class=special>&amp;) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=keyword>private</span><span class=special>:
+ </span><span class=identifier>NullGuard </span><span class=special>(</span><span class=identifier>NullGuard </span><span class=keyword>const</span><span class=special>&amp;) </span><span class=keyword>throw </span><span class=special>();
+
+ </span><span class=identifier>NullGuard</span><span class=special>&amp;
+ </span><span class=keyword>operator</span><span class=special>= </span><span class=special>(</span><span class=identifier>NullGuard </span><span class=keyword>const</span><span class=special>&amp;) </span><span class=keyword>throw </span><span class=special>();
+ </span><span class=special>};
+
+ </span><span class=keyword>struct </span><span class=identifier>Null
+ </span><span class=special>{
+ </span><span class=keyword>typedef
+ </span><span class=identifier>NullMutex
+ </span><span class=identifier>Mutex</span><span class=special>;
+
+ </span><span class=keyword>typedef
+ </span><span class=identifier>NullGuard
+ </span><span class=identifier>ReadGuard</span><span class=special>;
+
+ </span><span class=keyword>typedef
+ </span><span class=identifier>NullGuard
+ </span><span class=identifier>WriteGuard</span><span class=special>;
+ </span><span class=special>};
+ </span><span class=special>}
+ </span><span class=special>}
+</span><span class=special>}
+
+</span></pre>
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/Synch/index.xhtml b/ACE/contrib/utility/Documentation/Synch/index.xhtml
new file mode 100644
index 00000000000..dd4a685ccc0
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Synch/index.xhtml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/Synch/index.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Synchronization Library</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="C++,utility,thread,synchronization,policy"/>
+ <meta name="description" content="Synchronization Library"/>
+
+ <link rel="stylesheet" type="text/css" href="../Style/Default.css"/>
+
+</head>
+
+<body>
+
+<h1>Introduction</h1>
+
+<p>
+Synchronization library provides a compile-time policy-based configurable
+facility of selecting synchronization mechanisms. For now there is only
+no-op synchronization policy provided which is suitable only for
+single-threaded applications. However it shouldn't be difficult to provide
+a wrapper policy for synchronization mechanisms used in a particular project.
+</p>
+
+<h1>Definitions</h1>
+<p>Below are the definitions of the key classes:</p>
+
+<ul class="menu">
+ <li><a href="Policy/Null.hpp.html">Synch::Policy::Null</a></li>
+</ul>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/TODO b/ACE/contrib/utility/Documentation/TODO
new file mode 100644
index 00000000000..984a0cddb56
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/TODO
@@ -0,0 +1,53 @@
+
+New features/changes
+---------------------------------------------------------------------------
+
+@@ DefaultImpl<> looks ugly. Is there a way to just write DefaultImpl
+ (or, perhaps some other name)? Maybe also rename Interface to Object
+ (will be consistent with Introspection::Object).
+
+@@ Abort facility
+
+@@ Maybe rename converter to convert
+
+@@ Maybe make reference counting object implement Introspection. However it
+ will introduce inter-library dependency. Nop, this is a bad idea.
+
+@@ Maybe move <library>.hpp one level up to Utility/.
+
+@@ Go thru C++Templates chapter on RefCounting and SmartPointers and see if
+ anything can be applied?
+
+@@ Examples for many features are missing
+
+@@ Introspection::TypeInfo should use set instead of vector for bases.
+
+
+Documentation
+---------------------------------------------------------------------------
+
+@@ code in <pre> does not look nice in lynx (see Hetero/index.html for example)
+
+
+Building environment
+---------------------------------------------------------------------------
+
+@@ Should probably make lib rules to build library when target is test (try to
+ run 'make clean && make test' from Utility root).
+
+@@ Makefile variable names inconsistency (e.g. cxx_translation_units and CXX_PREPROCESS_FLAGS)
+
+%% Rename Config to Build or rather BuildRules?
+
+@@ Compiler-specific stuff is left after make clean. Potentially dangerous
+ idea would be to remove everything except known files
+
+@@ Multi-compiler configuration
+
+@@ Building library with sources in sub-directories.
+
+
+Pre-release fixes
+---------------------------------------------------------------------------
+
+$Id$
diff --git a/ACE/contrib/utility/Documentation/Template.xhtml b/ACE/contrib/utility/Documentation/Template.xhtml
new file mode 100644
index 00000000000..41c9857dabf
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Template.xhtml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>@@</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="@@"/>
+ <meta name="description" content="@@"/>
+
+ <link rel="stylesheet" type="text/css" href="../Style/Default.css"/>
+
+</head>
+
+<body>
+
+<h1>@@</h1>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Documentation/Thoughts/Enum/EnumCount b/ACE/contrib/utility/Documentation/Thoughts/Enum/EnumCount
new file mode 100644
index 00000000000..be8b252d4de
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Thoughts/Enum/EnumCount
@@ -0,0 +1,95 @@
+From: Gianni Mariani <gi2nospam@mariani.ws>
+Date: 26 Jul 2003 04:52:43 GMT
+Newsgroups: comp.lang.c++
+Subject: Re: enum count
+
+Clive wrote:
+> If you have an enum, is there any way during execution to find the number of
+> values in the enum?
+> Say I have,
+>
+> enum great { five, ten, fifteen };
+>
+> How could I get the number 3 from that?
+>
+>
+
+replace the enums with objects that report themselves to a registry.
+
+
+I have done it in the past using a template ...
+
+templace <typename base>
+class ExposedEnum : public base
+{
+ public:
+ int enum_val;
+ ExposedEnum( int number )
+ : enum_val( number )
+ {
+ ExposedEnumRegister<base>::Register( *this );
+ }
+
+ ExposedEnum( int number )
+ : enum_val( ExposedEnumRegister<base>::GetNextNumber() )
+ {
+ ExposedEnumRegister<base>::Register( *this );
+ }
+
+
+
+// some more stuff ...
+
+ operator int () const
+ {
+ return enum_val;
+ }
+
+ explicit ExposedEnum( const ExposedEnum & foo );
+};
+
+
+template <typename base>
+class ExposedEnumRegister
+{
+
+ static int GetNextNumber ....
+
+ static void Register ....
+
+ static int Count ....
+
+}
+
+
+Now you can forward declare them...
+
+extern ExposedEnum< great > five;
+
+extern ExposedEnum< great > ten;
+
+extern ExposedEnum< great > fifteen;
+
+
+
+
+In a cpp file you can instantiate them.
+
+ExposedEnum< great > five( 5 );
+
+ExposedEnum< great > ten( 10 );
+
+ExposedEnum< great > fifteen;
+
+
+Now, if you want to know how many you have :
+
+ExposedEnumRegister< great >::Count();
+
+
+
+Disclaimer - it's an outline only, yes it's incomplete.
+
+G
+
+$Id$
diff --git a/ACE/contrib/utility/Documentation/Thoughts/Enum/EnumCount2 b/ACE/contrib/utility/Documentation/Thoughts/Enum/EnumCount2
new file mode 100644
index 00000000000..d23e790b6d4
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Thoughts/Enum/EnumCount2
@@ -0,0 +1,17 @@
+From: Alexander Terekhov <terekhov@web.de>
+Date: Sat, 26 Jul 2003 19:17:52 +0200
+Newsgroups: comp.lang.c++
+Subject: Re: enum count
+
+
+Steve Pinard wrote:
+>
+> Wouldn't that be nice? And wouldn't it be nice to be able to get the
+> strings "five", "ten", and "fifteen" too?
+
+http://lcgapp.cern.ch/project/architecture/XTI_accu.pdf
+
+regards,
+alexander.
+
+$Id$
diff --git a/ACE/contrib/utility/Documentation/Thoughts/Enum/EnumInfo b/ACE/contrib/utility/Documentation/Thoughts/Enum/EnumInfo
new file mode 100644
index 00000000000..e59a27c0820
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/Thoughts/Enum/EnumInfo
@@ -0,0 +1,45 @@
+From: "Klaus Eichner" <klaus_gb@yahoo.com>
+Date: Sat, 26 Jul 2003 14:53:23 +0100
+Newsgroups: comp.lang.c++
+Subject: Re: enum count
+
+"Clive" <clive@clive.clive> wrote in message
+news:3f21e5cc$0$23611$5a62ac22@freenews.iinet.net.au...
+> If you have an enum, is there any way during execution to find the number
+of
+> values in the enum?
+> Say I have,
+>
+> enum great { five, ten, fifteen };
+>
+> How could I get the number 3 from that?
+
+You could get the number 3 from 'great' with your own, user-defined
+'Enum_Info' template:
+
+cout << "The number of values in enum great is "
+ << Enum_Info<great>::number_of_elements
+ << endl;
+
+The 'Enum_Info' template is defined as follows.
+Suppose you have the following enums:
+
+enum great { five, ten, fifteen };
+enum greater { none, one, fourtytwo, fourtythree, fourtyfour };
+enum even_greater { minusone, minustwo, minusthree, minusfour, minusfive,
+minussix, minusseven };
+
+You could build a template class 'Enum_Info' which uses specialisation to
+register the number of elements in each enum
+
+template <class T> class Enum_Info { };
+template <> class Enum_Info<great> { static const int number_of_elements =
+3; };
+template <> class Enum_Info<greater> { static const int number_of_elements =
+5; };
+template <> class Enum_Info<even_greater> { static const int
+number_of_elements = 7; };
+
+
+
+$Id$
diff --git a/ACE/contrib/utility/Documentation/index.xhtml b/ACE/contrib/utility/Documentation/index.xhtml
new file mode 100644
index 00000000000..87e82d228dc
--- /dev/null
+++ b/ACE/contrib/utility/Documentation/index.xhtml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<!--
+
+file : Documentation/index.xhtml
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2002-2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<head>
+
+ <title>Utility Library</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="C++,utility,exception,handling,model,reference,counting,thread,synchronization"/>
+ <meta name="description" content="Utility Library"/>
+
+ <link rel="stylesheet" type="text/css" href="Style/Default.css"/>
+
+</head>
+
+<body>
+
+<h1>Introduction</h1>
+<p>
+Utility library is a place for generic C++ facilities that I found useful
+in more than one project.
+
+Here you can download the
+<a href="http://kolpackov.net/projects/Utility/Download.xhtml">
+latest version</a>.
+
+Utility library is a
+<a href="http://gnu.org/philosophy/categories.html#Non-CopyleftedFreeSoftware">
+non-copylefted free software</a> with zlib-like
+<a href="http://kolpackov.net/license.html">license</a>.
+
+For changes and new features check out <a href="News.xhtml">News section</a>.
+</p>
+
+<h1>Supported Platforms</h1>
+
+<p>
+For the time being I test Utility library with at least GNU G++ on Linux and
+Compaq (Digital) C++ (-std strict_ansi) on Tru64 UNIX. It also should compile
+and work fine with any decent C++ compiler. Also note that I don't have any
+plans to bloat source code in attempt to support broken compilers.</p>
+
+<h1>Building</h1>
+
+<p>
+Utility library mostly consists of header-only sub-libraries so you don't
+actually need to build anything to start using it. See <a href="Build.xhtml">
+Building Utility Library</a> section for more information.</p>
+
+<h1>Content</h1>
+
+<p>Utility Library consists of the following sub-libraries:</p>
+
+<ul class="menu">
+ <li><a href="CommandLine/index.xhtml">Command Line Processing</a></li>
+
+ <li><a href="ExH/index.xhtml">Exception Handling</a></li>
+
+ <li><a href="Hetero/index.xhtml">Heterogeneous Container</a></li>
+
+ <li><a href="Introspection/index.xhtml">Introspection</a></li>
+
+ <li><a href="ReferenceCounting/index.xhtml">Reference Counting</a></li>
+
+ <li><a href="Synch/index.xhtml">Synchronization</a></li>
+</ul>
+
+</body>
+</html>
+<!-- $Id$ -->
diff --git a/ACE/contrib/utility/Example/CommandLine/Foo/command.cpp b/ACE/contrib/utility/Example/CommandLine/Foo/command.cpp
new file mode 100644
index 00000000000..db829909f37
--- /dev/null
+++ b/ACE/contrib/utility/Example/CommandLine/Foo/command.cpp
@@ -0,0 +1,88 @@
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include <string>
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+class Command
+{
+public:
+ enum Value
+ {
+ HELP = 0,
+ VERSION,
+ DEFAULT
+ };
+
+ Command (Value v = Command::DEFAULT)
+ : v_ (v)
+ {
+ }
+
+ operator Value () const
+ {
+ return v_;
+ }
+
+ friend std::ostream&
+ operator<< (std::ostream& os, Command c);
+
+ friend std::istream&
+ operator>> (std::istream& is, Command& c);
+
+private:
+ Value v_;
+ static char* labels_[];
+};
+
+char* Command::labels_[] = {"help", "version", "default"};
+
+
+std::ostream&
+operator<< (std::ostream& os, Command c)
+{
+ return os << Command::labels_[c.v_];
+}
+
+std::istream&
+operator>> (std::istream& is, Command& c)
+{
+ std::string s;
+ is >> s;
+ if (is)
+ {
+ if (s == Command::labels_[Command::HELP]) c.v_ = Command::HELP;
+ else if (s == Command::labels_[Command::VERSION]) c.v_ = Command::VERSION;
+ else is.setstate (std::ios::failbit);
+ }
+ return is;
+}
+
+int
+main ()
+{
+ Command c = Command::HELP;
+
+ c = Command::DEFAULT;
+
+ Command c1 (Command::HELP);
+
+ c = c1;
+
+ cerr << c << endl;
+
+ switch (c)
+ {
+ case Command::HELP:
+ {
+ cerr << "iiihuuu!!!" << endl;
+ }
+ }
+
+ std::cin >> c1;
+ if (std::cin) cerr << c1 << endl;
+ else cerr << "*failed" << endl;
+}
+//$Id$
diff --git a/ACE/contrib/utility/Example/CommandLine/Foo/foo.cpp b/ACE/contrib/utility/Example/CommandLine/Foo/foo.cpp
new file mode 100644
index 00000000000..550d1f6f170
--- /dev/null
+++ b/ACE/contrib/utility/Example/CommandLine/Foo/foo.cpp
@@ -0,0 +1,184 @@
+#include <typeinfo>
+#include <string>
+#include <iostream>
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+namespace CommandLine
+{
+ struct Parser
+ {
+ };
+}
+
+using std::string;
+using std::cerr;
+using std::endl;
+
+using namespace CommandLine;
+
+class Command
+{
+public:
+ enum Value
+ {
+ HELP,
+ VERSION,
+ DEFAULT
+ };
+
+ Command (Value v = Command::DEFAULT)
+ : v_ (v)
+ {
+ }
+
+ operator Value () const
+ {
+ return v_;
+ }
+
+private:
+ Value v_;
+};
+
+
+int
+version ();
+
+int
+help (int argc, char* argv[]);
+
+int
+main (int argc, char* argv[])
+{
+
+ // Step 1: determine command
+ //
+ // * there is usually one command
+ // * command can be optional
+ // * command usually takes up one argument
+ //
+
+ CommandParser<Command> cp;
+
+ switch (cp.parse (argc, argv))
+ {
+ case Command::VERSION:
+ {
+ return version ();
+ }
+ case Command::HELP:
+ {
+ return help (argc, argv);
+ }
+ }
+
+ // Step 2: parse options
+ //
+ // * options are usually optional
+ // * options are usually position-independant
+ // * options usually do not repeat
+ // * options can take up more than one argument
+ //
+
+ OptionMap om;
+
+ CompositeParser op;
+
+ op.add (OptionParser<string> ("string", "--string", "-s"));
+ op.add (OptionParser<unsigned long> ("number", "--number", "-n"));
+
+ while (argc != 1 && !op.empty ())
+ {
+ om.insert (op.parse (argc, argv));
+ }
+
+ // Step 3: parse operands
+ //
+ // * operands usually position-dependant
+ // * operand usually take up one argument
+ //
+
+ OperandParser<string> odp;
+
+ string str = odp.parse (argc, argv);
+
+ unsigned long num = 0;
+
+ if (argc != 1)
+ {
+ OperandParser<unsigned long> op;
+ num = op.parse (argc, argv);
+ }
+
+ string s = om.count ("string") ? om["string"] : "default";
+ unsigned long l = om["number"];
+
+ // om.at ()
+ // om.get ()
+ // om.resolve ()
+ // om.option ()
+ // om.value ()
+
+ cerr << "opreation settings are:" << endl << endl
+ << "option string : " << om.get<string> ("string", "default") << endl
+ << "option number : " << om.get ("number", 10UL) << endl
+ << "operand string : " << str << endl
+ << "operand number : " << num << endl;
+}
+
+
+//
+//
+//
+int
+version ()
+{
+ cerr << "foo 1.0" << endl;
+ return 0;
+}
+
+
+//
+//
+//
+int
+help (int argc, char* argv[])
+{
+ Command subject;
+
+ if (argc != 1)
+ {
+ OperandParser<Command> op;
+ subject = op.parse (argc, argv);
+ }
+
+ switch (subject)
+ {
+ case Command::HELP:
+ {
+ cerr << "foo help [<command>]" << endl << endl
+ << "\t If <command> is specified then print extended help" << endl
+ << "\t information for specified command. Otherwise print" << endl
+ << "\t general usage information." << endl;
+ break;
+ }
+ case Command::VERSION:
+ {
+ cerr << "foo version" << endl << endl
+ << "\t Print version information." << endl;
+ break;
+ }
+ default:
+ {
+ cerr << "foo version" << endl
+ << "foo help [<command>]" << endl
+ << "foo [-s|--string <str>] [-n|--number <num>] <str> [<num>]"
+ << endl;
+ break;
+ }
+ }
+
+ return 0;
+}
+//$Id$
diff --git a/ACE/contrib/utility/Example/ExH/BadCast/Makefile b/ACE/contrib/utility/Example/ExH/BadCast/Makefile
new file mode 100644
index 00000000000..9963d9708a1
--- /dev/null
+++ b/ACE/contrib/utility/Example/ExH/BadCast/Makefile
@@ -0,0 +1,24 @@
+# file : Example/ExH/BadCast/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := bad_cast.cpp
+
+module_base := bad_cast
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Example/ExH/BadCast/bad_cast.cpp b/ACE/contrib/utility/Example/ExH/BadCast/bad_cast.cpp
new file mode 100644
index 00000000000..699add03047
--- /dev/null
+++ b/ACE/contrib/utility/Example/ExH/BadCast/bad_cast.cpp
@@ -0,0 +1,54 @@
+// file : Example/ExH/BadCast/bad_cast.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include "Utility/ExH/System/Exception.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+
+struct A
+{
+ virtual
+ ~A() {}
+};
+
+struct B
+{
+ void
+ foo () {}
+};
+
+void
+foo ()
+{
+ A a;
+
+ A& ar (a);
+
+ B& br (dynamic_cast<B&> (ar));
+
+ br.foo ();
+}
+
+int
+main ()
+{
+ try
+ {
+ foo ();
+ }
+ catch (Utility::ExH::System::Exception const& ex)
+ {
+ cerr << "Caught Utility::ExH::System::Exception: "
+ << ex.what ()
+ << endl;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Example/ExH/Compound/Makefile b/ACE/contrib/utility/Example/ExH/Compound/Makefile
new file mode 100644
index 00000000000..8bd588587d5
--- /dev/null
+++ b/ACE/contrib/utility/Example/ExH/Compound/Makefile
@@ -0,0 +1,24 @@
+# file : Example/ExH/Compound/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := compound.cpp
+
+module_base := compound
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Example/ExH/Compound/compound.cpp b/ACE/contrib/utility/Example/ExH/Compound/compound.cpp
new file mode 100644
index 00000000000..e9f585ce6d3
--- /dev/null
+++ b/ACE/contrib/utility/Example/ExH/Compound/compound.cpp
@@ -0,0 +1,144 @@
+// file : Example/ExH/Compound/compound.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include "Utility/ExH/Compound.hpp"
+#include "Utility/ExH/System/Exception.hpp"
+#include "Utility/ExH/Logic/DescriptiveException.hpp"
+
+// Include some helper converters to allow exception initialization
+// with std::ostringstream
+
+#include "Utility/ExH/StringStreamConverter.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+using std::string;
+using std::ostringstream;
+
+using namespace Utility::ExH;
+
+// Here are our components
+
+class Base
+{
+public:
+
+ //
+ // Exception definitions.
+ //
+
+ // Base logic exception class for component.
+ class Exception_ {};
+ typedef
+ Compound <Exception_, Logic::DescriptiveException>
+ Exception;
+
+ class InvalidArgument_ {};
+ typedef
+ Compound <InvalidArgument_, Exception>
+ InvalidArgument;
+
+ class NotInitialized_ {};
+ typedef
+ Compound <NotInitialized_, Exception>
+ NotInitialized;
+
+public:
+
+ void
+ foo (char const* str)
+ {
+ // This is just an example.
+
+ if (str == 0)
+ {
+ throw InvalidArgument ("Base::foo: first parameter is zero.");
+ }
+ else
+ {
+ ostringstream ostr;
+ ostr << "Base::foo [this = " << this << "]: object is not initialized.";
+
+ throw NotInitialized (ostr);
+ }
+ }
+
+
+ // We don't know what implementation may decide to throw so
+ // we allow to throw System exception and any logic exception
+ // derived from Base::Exception
+ virtual void
+ vfoo () = 0;
+};
+
+class Derived : public Base
+{
+public:
+
+ // Define some Derived-specific logic exception.
+ class NotImplemented_ {};
+ typedef
+ Compound <NotImplemented_, Exception>
+ NotImplemented;
+
+public:
+ virtual void
+ vfoo ()
+ {
+ std::string str ("Derived::vfoo: not implemented yet.");
+ throw NotImplemented (str);
+ }
+};
+
+int
+main ()
+{
+ try
+ {
+
+ Derived d;
+ Base* pb (&d);
+
+ // We can use generic handler.
+ try
+ {
+ pb->vfoo ();
+ }
+ catch (Base::Exception const& ex)
+ {
+ cerr << "Caught Base::Exception: " << ex.what () << endl;
+ }
+
+
+ // Or use more precise control.
+ try
+ {
+ pb->foo ("hello");
+ }
+ catch (Base::NotInitialized const& ex)
+ {
+ cerr << "Caught Base::NotInitialized: " << ex.what () << endl;
+ }
+
+ // Or use application-level handler.
+ pb->foo (0);
+
+ }
+ catch (Logic::Exception const& ex)
+ {
+ cerr << "Caught Logic::Exception: " << ex.what () << endl;
+ }
+ catch (...)
+ {
+ cerr << "Caught unknown exception using catch-all handler" << endl;
+ return -1;
+ }
+
+}
+//$Id$
diff --git a/ACE/contrib/utility/Example/ExH/HelloWorld/Makefile b/ACE/contrib/utility/Example/ExH/HelloWorld/Makefile
new file mode 100644
index 00000000000..93debef0e7c
--- /dev/null
+++ b/ACE/contrib/utility/Example/ExH/HelloWorld/Makefile
@@ -0,0 +1,24 @@
+# file : Example/ExH/HelloWorld/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := hello_world.cpp
+
+module_base := hello_world
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Example/ExH/HelloWorld/hello_world.cpp b/ACE/contrib/utility/Example/ExH/HelloWorld/hello_world.cpp
new file mode 100644
index 00000000000..9499bf09fe1
--- /dev/null
+++ b/ACE/contrib/utility/Example/ExH/HelloWorld/hello_world.cpp
@@ -0,0 +1,142 @@
+// file : Example/ExH/HelloWorld/hello_world.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include <cstdlib> // for std::abort ()
+
+#include <string>
+#include <iostream>
+
+#include "Utility/ExH/System/Exception.hpp"
+#include "Utility/ExH/Logic/Exception.hpp"
+
+using std::cerr;
+using std::cout;
+using std::endl;
+
+using namespace Utility;
+
+class Application
+{
+public:
+ class Exception : public ExH::Logic::Exception {};
+
+ // Hint: you may want to try again...
+ class FeelingDizzy : public Exception {};
+
+ class InvalidArg : public Exception {};
+
+public:
+ Application ()
+ : // The std::string c-tor may throw any kind of exceptions besides
+ // quite possible std::bad_alloc.
+ greeting_ ("Hello, world!")
+ {
+ }
+
+ Application (char const * greeting)
+ : greeting_ (greeting == 0 ? "" : greeting)
+ {
+ if (greeting == 0) throw InvalidArg ();
+ }
+
+public:
+
+ void
+ run ()
+ {
+ static unsigned int dizzy_count (0);
+
+ if (dizzy_count++ < 5) throw FeelingDizzy ();
+
+ // The next line can throw full bucket of exceptions
+ // not to mention ios_base::failure.
+ cout << greeting_.c_str () << endl;
+ }
+
+private:
+
+ std::string greeting_;
+};
+
+
+
+int
+main ()
+{
+ // This is a catch-all layer that should be in use only
+ // if we are really in trouble.
+ try
+ {
+ // This is a catch-system layer. Here we will catch exceptions like
+ // bad_alloc, etc. If we get here it means that nobody wanted/managed
+ // to recover from this kind of errors.
+ try
+ {
+ // This is a catch-logic layer. If we get here it usually
+ // indicates an application logic error.
+ try
+ {
+
+ // Ok, here we go about our application logic.
+ try
+ {
+ for (int i = 0; i < 10; i++)
+ {
+ try
+ {
+ Application app ("Hi dude!");
+ app.run ();
+ break;
+ }
+ catch (Application::FeelingDizzy const& )
+ {
+ if (i == 9)
+ {
+ cerr << "Given up!" << endl;
+ return -1;
+ }
+ else
+ {
+ cerr << "Application is feeling dizzy. Trying again..."
+ << endl;
+ }
+ }
+ }
+ }
+ catch (Application::InvalidArg const& )
+ {
+ cerr << "Cought Application::InvalidArg : ...hmm... strange!"
+ << endl;
+ return -1;
+ }
+ }
+ catch (ExH::Logic::Exception const& e)
+ {
+ cerr << "Caught Logic::Exception : " << e.what () << endl;
+ return -1;
+ }
+ }
+ catch (const ExH::System::Exception& e)
+ {
+ cerr << "Caught System::Exception : " << e.what () << endl;
+ return -1;
+ }
+ catch (...)
+ {
+ cerr << "Caught unknown exception using catch-all handler. " << endl;
+ return -1;
+ }
+ }
+ catch (...)
+ {
+ // We get here in cases of some hard failure. For example when handling
+ // exception, operator << throws another exception. Usually application
+ // cannot handle such failures itself so we just propagate it futher.
+ std::abort ();
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Example/ExH/LogicToSystem/Makefile b/ACE/contrib/utility/Example/ExH/LogicToSystem/Makefile
new file mode 100644
index 00000000000..789413c0a3c
--- /dev/null
+++ b/ACE/contrib/utility/Example/ExH/LogicToSystem/Makefile
@@ -0,0 +1,24 @@
+# file : Example/ExH/LogicToSystem/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := logic_to_system.cpp
+
+module_base := logic_to_system
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Example/ExH/LogicToSystem/logic_to_system.cpp b/ACE/contrib/utility/Example/ExH/LogicToSystem/logic_to_system.cpp
new file mode 100644
index 00000000000..6f718e9c694
--- /dev/null
+++ b/ACE/contrib/utility/Example/ExH/LogicToSystem/logic_to_system.cpp
@@ -0,0 +1,60 @@
+// file : Example/ExH/LogicToSystem/logic_to_system.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include "Utility/ExH/System/Exception.hpp"
+#include "Utility/ExH/Logic/Exception.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+
+struct SubsystemA
+{
+ class Exception : public Utility::ExH::Logic::Exception {};
+
+ void
+ foo ()
+ {
+ throw Exception ();
+ }
+};
+
+
+struct SubsystemB
+{
+ void
+ foo ()
+ {
+ SubsystemA a;
+ a.foo ();
+
+ // Here SubsystemB is using SunsystemA but cannot (forgot, doesnt't
+ // want to, doesn't know how to, etc - pick your favorite) handle
+ // exception thrown by SubsystemA. As a result exception is
+ // 'converted' to System::Exception.
+ }
+};
+
+
+int
+main ()
+{
+ try
+ {
+ SubsystemB b;
+ b.foo ();
+ }
+ catch (Utility::ExH::System::Exception const& ex)
+ {
+ cerr << "Caught Utility::ExH::System::Exception: "
+ << ex.what ()
+ << endl;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Example/ExH/Makefile b/ACE/contrib/utility/Example/ExH/Makefile
new file mode 100644
index 00000000000..99eb95cf62f
--- /dev/null
+++ b/ACE/contrib/utility/Example/ExH/Makefile
@@ -0,0 +1,16 @@
+# file : Example/ExH/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := BadCast Compound HelloWorld LogicToSystem
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Example/Hetero/Container/Makefile b/ACE/contrib/utility/Example/Hetero/Container/Makefile
new file mode 100644
index 00000000000..29135f54046
--- /dev/null
+++ b/ACE/contrib/utility/Example/Hetero/Container/Makefile
@@ -0,0 +1,24 @@
+# file : Example/Hetero/Container/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := container.cpp
+
+module_base := container
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Example/Hetero/Container/container.cpp b/ACE/contrib/utility/Example/Hetero/Container/container.cpp
new file mode 100644
index 00000000000..30bc05fc1b9
--- /dev/null
+++ b/ACE/contrib/utility/Example/Hetero/Container/container.cpp
@@ -0,0 +1,112 @@
+// file : Example/Hetero/Container/container.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include "Utility/Hetero/Container.hpp"
+#include "Utility/Hetero/TypedContainer.hpp"
+#include "Utility/Hetero/Vector.hpp"
+#include "Utility/Hetero/Shell.hpp"
+
+#include <string>
+#include <iostream>
+#include <algorithm>
+
+using std::string;
+
+using std::cout;
+using std::cerr;
+using std::endl;
+
+namespace Hetero = Utility::Hetero;
+
+using Hetero::Container;
+using Hetero::TypedContainer;
+using Hetero::TypeList;
+using Hetero::Shell;
+
+
+struct PrintCore
+{
+ typedef void RetType;
+
+ template <typename T>
+ void
+ operator() (T const& t)
+ {
+ cout << t << endl;
+ }
+};
+
+typedef Shell<PrintCore> Print;
+
+void
+print (bool b)
+{
+ cout << (b ? "T" : "NIL") << endl;
+}
+
+int
+main ()
+{
+ try
+ {
+ Container a (10L);
+ Container b (true);
+ Container c (string ("hello"));
+
+ string s = c + string (" world");
+
+ long l = a + 20L;
+
+ cout << s << "; " << l << endl;
+
+ print (b);
+
+ //
+ //
+ //
+
+ typedef
+ TypedContainer <TypeList<long, bool, string> >
+ MyContainer;
+
+ MyContainer x (true);
+ MyContainer y (10L);
+ MyContainer z (string ("hey dude"));
+
+ Print print;
+
+ print (x);
+ print (y);
+ print (z);
+
+ //
+ //
+ //
+
+ typedef
+ Hetero::Vector<long, bool, string>
+ vector;
+
+ vector v;
+ v.push_back (10L);
+ v.push_back (true);
+ v.push_back (false);
+ v.push_back (string ("hey"));
+
+ for (vector::iterator i = v.begin (); i != v.end (); i++)
+ {
+ print (*i);
+ }
+
+ std::for_each (v.begin (), v.end (), print);
+ }
+ catch (Hetero::Typing const&)
+ {
+ cerr << "typing error" << endl;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Example/Hetero/Makefile b/ACE/contrib/utility/Example/Hetero/Makefile
new file mode 100644
index 00000000000..a55938e9502
--- /dev/null
+++ b/ACE/contrib/utility/Example/Hetero/Makefile
@@ -0,0 +1,16 @@
+# file : Example/Hetero/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := Container
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Example/Introspection/InheritanceTree/Hierarchy.cpp b/ACE/contrib/utility/Example/Introspection/InheritanceTree/Hierarchy.cpp
new file mode 100644
index 00000000000..0dbc616483e
--- /dev/null
+++ b/ACE/contrib/utility/Example/Introspection/InheritanceTree/Hierarchy.cpp
@@ -0,0 +1,104 @@
+// file : Hierarchy.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Hierarchy.hpp"
+
+// A
+//
+//
+
+using Introspection::Object;
+using Introspection::Access;
+
+namespace
+{
+ TypeInfo
+ a_init_ ()
+ {
+ TypeInfo ti (typeid (A));
+ ti.add_base (Access::PUBLIC, true, Object::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo a_ (a_init_ ());
+}
+
+TypeInfo const& A::
+static_type_info ()
+{
+ return a_;
+}
+
+// B
+//
+//
+
+namespace
+{
+ TypeInfo
+ b_init_ ()
+ {
+ TypeInfo ti (typeid (B));
+ ti.add_base (Access::PUBLIC, false, A::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo b_ (b_init_ ());
+}
+
+TypeInfo const& B::
+static_type_info ()
+{
+ return b_;
+}
+
+// C
+//
+//
+
+namespace
+{
+ TypeInfo
+ c_init_ ()
+ {
+ TypeInfo ti (typeid (C));
+ ti.add_base (Access::PUBLIC, true, A::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo c_ (c_init_ ());
+}
+
+TypeInfo const& C::
+static_type_info ()
+{
+ return c_;
+}
+
+
+// D
+//
+//
+
+namespace
+{
+ TypeInfo
+ d_init_ ()
+ {
+ TypeInfo ti (typeid (D));
+ ti.add_base (Access::PUBLIC, true, B::static_type_info ());
+ ti.add_base (Access::PUBLIC, false, C::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo d_ (d_init_ ());
+}
+
+TypeInfo const& D::
+static_type_info ()
+{
+ return d_;
+}
+//$Id$
diff --git a/ACE/contrib/utility/Example/Introspection/InheritanceTree/Hierarchy.hpp b/ACE/contrib/utility/Example/Introspection/InheritanceTree/Hierarchy.hpp
new file mode 100644
index 00000000000..213e0593f6b
--- /dev/null
+++ b/ACE/contrib/utility/Example/Introspection/InheritanceTree/Hierarchy.hpp
@@ -0,0 +1,61 @@
+// file : Example/Introspection/InheritanceTree/Hierarchy.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef HIERARCHY_HPP
+#define HIERARCHY_HPP
+
+#include "Utility/Introspection/Introspection.hpp"
+
+namespace Introspection = Utility::Introspection;
+
+using Introspection::TypeInfo;
+using Introspection::TypeId;
+
+struct A : virtual Introspection::Object
+{
+ A ()
+ {
+ type_info (static_type_info ());
+ }
+
+ static TypeInfo const&
+ static_type_info ();
+};
+
+struct B : virtual A
+{
+ B ()
+ {
+ type_info (static_type_info ());
+ }
+
+ static TypeInfo const&
+ static_type_info ();
+};
+
+struct C : virtual A
+{
+ C ()
+ {
+ type_info (static_type_info ());
+ }
+
+ static TypeInfo const&
+ static_type_info ();
+};
+
+struct D : virtual B, C
+{
+ D ()
+ {
+ type_info (static_type_info ());
+ }
+
+ static TypeInfo const&
+ static_type_info ();
+};
+
+#endif // HIERARCHY_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Example/Introspection/InheritanceTree/Makefile b/ACE/contrib/utility/Example/Introspection/InheritanceTree/Makefile
new file mode 100644
index 00000000000..9b839c2111f
--- /dev/null
+++ b/ACE/contrib/utility/Example/Introspection/InheritanceTree/Makefile
@@ -0,0 +1,22 @@
+# file : Example/Introspection/InheritanceTree/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := Hierarchy.cpp inheritance_tree.cpp
+
+module_base := inheritance_tree
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+CXX_LINK_LIBS += -L$(root)/Utility/Introspection -lIntrospection
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Example/Introspection/InheritanceTree/inheritance_tree.cpp b/ACE/contrib/utility/Example/Introspection/InheritanceTree/inheritance_tree.cpp
new file mode 100644
index 00000000000..61f68ab6aa5
--- /dev/null
+++ b/ACE/contrib/utility/Example/Introspection/InheritanceTree/inheritance_tree.cpp
@@ -0,0 +1,65 @@
+// file : Example/Introspection/InheritanceTree/inheritance_tree.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+// Note: This example is by no means complete. In fact properly printing
+// arbitrary C++ inheritance tree is a non-trivial task. If you would like
+// to improve this example please feel free to send your results back ;-).
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include "Hierarchy.hpp"
+
+#include <set>
+#include <iostream>
+
+using std::endl;
+
+typedef
+std::set<TypeId>
+TypeIdSet;
+
+void
+print_inheritance_tree_core (std::ostream& os,
+ TypeInfo const& ti,
+ TypeIdSet& set)
+{
+ bool nl = false;
+
+ for (TypeInfo::BaseIterator i = ti.begin_base ();
+ i != ti.end_base ();
+ i++)
+ {
+ TypeId tid (i->type_info ().type_id ());
+
+ if (set.find (tid) != set.end ()) continue;
+
+ nl = true;
+ set.insert (tid);
+ print_inheritance_tree_core (os, i->type_info (), set);
+ }
+
+ if (nl) os << endl;
+
+ os << ti.type_id () << " ";
+}
+
+void
+print_inheritance_tree (std::ostream& os, TypeInfo const& ti)
+{
+ TypeIdSet set;
+ print_inheritance_tree_core (os, ti, set);
+ os << endl;
+}
+
+int
+main ()
+{
+ B* b = new D;
+
+ print_inheritance_tree (std::cout, b->type_info ());
+
+ delete b;
+}
+//$Id$
diff --git a/ACE/contrib/utility/Example/Introspection/Makefile b/ACE/contrib/utility/Example/Introspection/Makefile
new file mode 100644
index 00000000000..2dc0a1f809e
--- /dev/null
+++ b/ACE/contrib/utility/Example/Introspection/Makefile
@@ -0,0 +1,16 @@
+# file : Example/Introspection/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := InheritanceTree Traversal
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Example/Introspection/Traversal/Makefile b/ACE/contrib/utility/Example/Introspection/Traversal/Makefile
new file mode 100644
index 00000000000..c9b1a8da46a
--- /dev/null
+++ b/ACE/contrib/utility/Example/Introspection/Traversal/Makefile
@@ -0,0 +1,22 @@
+# file : Example/Introspection/Traversal/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := SyntaxTree.cpp Traversal.cpp driver.cpp
+
+module_base := driver
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+CXX_LINK_LIBS += -L$(root)/Utility/Introspection -lIntrospection
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Example/Introspection/Traversal/SyntaxTree.cpp b/ACE/contrib/utility/Example/Introspection/Traversal/SyntaxTree.cpp
new file mode 100644
index 00000000000..71115ff2b24
--- /dev/null
+++ b/ACE/contrib/utility/Example/Introspection/Traversal/SyntaxTree.cpp
@@ -0,0 +1,119 @@
+// file : Example/Introspection/Traversal/SyntaxTree.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "SyntaxTree.hpp"
+
+using namespace Utility::Introspection;
+
+namespace SyntaxTree
+{
+
+ // Node
+ //
+ //
+
+ namespace
+ {
+ TypeInfo
+ node_init_ ()
+ {
+ TypeInfo ti (typeid (Node));
+ ti.add_base (Access::PUBLIC, true, Object::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo node_ (node_init_ ());
+ }
+
+ TypeInfo const& Node::
+ static_type_info () { return node_; }
+
+
+ // Declaration
+ //
+ //
+
+ namespace
+ {
+ TypeInfo
+ declaration_init_ ()
+ {
+ TypeInfo ti (typeid (Declaration));
+ ti.add_base (Access::PUBLIC, true, Node::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo declaration_ (declaration_init_ ());
+ }
+
+ TypeInfo const& Declaration::
+ static_type_info () { return declaration_; }
+
+
+ // Scope
+ //
+ //
+
+ namespace
+ {
+ TypeInfo
+ scope_init_ ()
+ {
+ TypeInfo ti (typeid (Scope));
+ ti.add_base (Access::PUBLIC, true, Declaration::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo scope_ (scope_init_ ());
+ }
+
+ TypeInfo const& Scope::
+ static_type_info () { return scope_; }
+
+
+ // InterfaceDecl
+ //
+ //
+
+ namespace
+ {
+ TypeInfo
+ interface_decl_init_ ()
+ {
+ TypeInfo ti (typeid (InterfaceDecl));
+ ti.add_base (Access::PUBLIC, true, Declaration::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo interface_decl_ (interface_decl_init_ ());
+ }
+
+ TypeInfo const& InterfaceDecl::
+ static_type_info () { return interface_decl_; }
+
+
+ // InterfaceDef
+ //
+ //
+
+ namespace
+ {
+ TypeInfo
+ interface_def_init_ ()
+ {
+ TypeInfo ti (typeid (InterfaceDef));
+ ti.add_base (Access::PUBLIC, true, InterfaceDecl::static_type_info ());
+ ti.add_base (Access::PUBLIC, true, Scope::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo interface_def_ (interface_def_init_ ());
+ }
+
+ TypeInfo const& InterfaceDef::
+ static_type_info () { return interface_def_; }
+
+}
+//$Id$
diff --git a/ACE/contrib/utility/Example/Introspection/Traversal/SyntaxTree.hpp b/ACE/contrib/utility/Example/Introspection/Traversal/SyntaxTree.hpp
new file mode 100644
index 00000000000..7bd824ce683
--- /dev/null
+++ b/ACE/contrib/utility/Example/Introspection/Traversal/SyntaxTree.hpp
@@ -0,0 +1,95 @@
+// file : Example/Introspection/Traversal/SyntaxTree.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef SYNTAX_TREE_HPP
+#define SYNTAX_TREE_HPP
+
+#include <vector>
+
+#include "Utility/Introspection/Introspection.hpp"
+
+namespace SyntaxTree
+{
+ //
+ //
+ //
+
+ struct Node : virtual Utility::Introspection::Object
+ {
+ Node ()
+ {
+ type_info (static_type_info ());
+ }
+
+ static Utility::Introspection::TypeInfo const&
+ static_type_info ();
+ };
+
+ //
+ //
+ //
+
+ struct Declaration : virtual Node
+ {
+ Declaration ()
+ {
+ type_info (static_type_info ());
+ }
+
+ static Utility::Introspection::TypeInfo const&
+ static_type_info ();
+ };
+
+ typedef
+ std::vector<Declaration*>
+ DeclarationList;
+
+ //
+ //
+ //
+ struct Scope : virtual Declaration
+ {
+ Scope ()
+ {
+ type_info (static_type_info ());
+ }
+
+ static Utility::Introspection::TypeInfo const&
+ static_type_info ();
+
+ DeclarationList content_;
+ };
+
+ //
+ //
+ //
+ struct InterfaceDecl : virtual Declaration
+ {
+ InterfaceDecl ()
+ {
+ type_info (static_type_info ());
+ }
+
+ static Utility::Introspection::TypeInfo const&
+ static_type_info ();
+ };
+
+ //
+ //
+ //
+ struct InterfaceDef : virtual InterfaceDecl, virtual Scope
+ {
+ InterfaceDef ()
+ {
+ type_info (static_type_info ());
+ }
+
+ static Utility::Introspection::TypeInfo const&
+ static_type_info ();
+ };
+}
+
+#endif // SYNTAX_TREE_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Example/Introspection/Traversal/Traversal.cpp b/ACE/contrib/utility/Example/Introspection/Traversal/Traversal.cpp
new file mode 100644
index 00000000000..9fa94327c2c
--- /dev/null
+++ b/ACE/contrib/utility/Example/Introspection/Traversal/Traversal.cpp
@@ -0,0 +1,105 @@
+// file : Example/Introspection/Traversal/Traversal.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Traversal.hpp"
+
+#include <set>
+#include <map>
+
+using namespace Utility::Introspection;
+
+namespace Traversal
+{
+ // Dispatcher
+ //
+ //
+
+ struct TypeInfoComparator
+ {
+ bool
+ operator () (TypeInfo const& x, TypeInfo const& y) const
+ {
+ return x.type_id () < y.type_id ();
+ }
+ };
+
+ typedef
+ std::map<TypeInfo, unsigned long, TypeInfoComparator>
+ LevelMap;
+
+ typedef
+ std::set<TypeInfo, TypeInfoComparator>
+ TypeInfoSet;
+
+ unsigned long
+ compute_levels (TypeInfo const& ti, unsigned long cur, LevelMap& map)
+ {
+ unsigned long ret = cur;
+
+ if (map.find (ti) == map.end () || map[ti] < cur) map[ti] = cur;
+
+ for (TypeInfo::BaseIterator i = ti.begin_base ();
+ i != ti.end_base ();
+ i++)
+ {
+ unsigned long t = compute_levels (i->type_info (), cur + 1, map);
+ if (t > ret) ret = t;
+ }
+
+ return ret;
+ }
+
+ void
+ flatten_tree (TypeInfo const& ti, TypeInfoSet& set)
+ {
+ set.insert (ti);
+
+ for (TypeInfo::BaseIterator i = ti.begin_base ();
+ i != ti.end_base ();
+ i++)
+ {
+ flatten_tree (i->type_info (), set);
+ }
+ }
+
+ void Dispatcher::
+ dispatch (SyntaxTree::Node* n)
+ {
+ LevelMap levels;
+
+ unsigned long max = compute_levels (n->type_info (), 0, levels);
+
+ for (unsigned long l = 0; l < max + 1; l++)
+ {
+ TypeInfoSet dispatched;
+
+ for (LevelMap::const_iterator i = levels.begin ();
+ i != levels.end ();
+ i++)
+ {
+ if (i->second == l)
+ {
+ TraversalMap::const_iterator v =
+ traversal_map_.find (i->first.type_id ());
+
+ if (v != traversal_map_.end ())
+ {
+ v->second->traverse (n);
+ flatten_tree (i->first, dispatched);
+ }
+ }
+ }
+
+ // Remove traversed types from level map.
+ for (TypeInfoSet::const_iterator i = dispatched.begin ();
+ i != dispatched.end ();
+ i++)
+ {
+ levels.erase (*i);
+ }
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Example/Introspection/Traversal/Traversal.hpp b/ACE/contrib/utility/Example/Introspection/Traversal/Traversal.hpp
new file mode 100644
index 00000000000..7ee84523fc0
--- /dev/null
+++ b/ACE/contrib/utility/Example/Introspection/Traversal/Traversal.hpp
@@ -0,0 +1,157 @@
+// file : Example/Introspection/Traversal/Traversal.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef TRAVERSAL_HPP
+#define TRAVERSAL_HPP
+
+#include <map>
+#include <iostream>
+
+#include "Utility/Introspection/Introspection.hpp"
+
+#include "SyntaxTree.hpp"
+
+namespace Traversal
+{
+ class Traverser;
+
+ //
+ //
+ //
+ class Dispatcher
+ {
+ public:
+ virtual
+ ~Dispatcher ()
+ {
+ }
+
+ virtual void
+ dispatch (SyntaxTree::Node* n);
+
+ protected:
+ void
+ map (Utility::Introspection::TypeId id, Traverser* t)
+ {
+ traversal_map_[id] = t;
+ }
+
+ private:
+ typedef
+ std::map<Utility::Introspection::TypeId, Traverser*>
+ TraversalMap;
+
+ TraversalMap traversal_map_;
+ };
+
+
+ //
+ //
+ //
+ class Traverser : public virtual Dispatcher
+ {
+ public:
+ virtual void
+ traverse (SyntaxTree::Node* n) = 0;
+ };
+
+ //
+ //
+ //
+ struct Node : Traverser
+ {
+ Node ()
+ {
+ map (typeid (SyntaxTree::Node), this);
+ }
+
+ virtual void
+ traverse (SyntaxTree::Node*)
+ {
+ std::cerr << "node" << std::endl;
+ }
+ };
+
+
+ //
+ //
+ //
+ struct Declaration : Traverser
+ {
+ Declaration ()
+ {
+ map (typeid (SyntaxTree::Declaration), this);
+ }
+
+ virtual void
+ traverse (SyntaxTree::Node*)
+ {
+ std::cerr << "declaration" << std::endl;
+ }
+ };
+
+ //
+ //
+ //
+ struct Scope : Traverser
+ {
+ Scope ()
+ {
+ map (typeid (SyntaxTree::Scope), this);
+ }
+
+ virtual void
+ traverse (SyntaxTree::Node* n)
+ {
+ std::cerr << "scope" << std::endl;
+
+ SyntaxTree::Scope* s = dynamic_cast<SyntaxTree::Scope*> (n);
+
+ for (SyntaxTree::DeclarationList::iterator i = s->content_.begin ();
+ i != s->content_.end ();
+ i++)
+ {
+ dispatch (*i);
+ }
+ }
+ };
+
+ //
+ //
+ //
+ struct InterfaceDecl : Traverser
+ {
+ InterfaceDecl ()
+ {
+ map (typeid (SyntaxTree::InterfaceDecl), this);
+ }
+
+ virtual void
+ traverse (SyntaxTree::Node*)
+ {
+ std::cerr << "interface declaration" << std::endl;
+ }
+ };
+
+ //
+ //
+ //
+ struct InterfaceDef : Traverser
+ {
+ InterfaceDef ()
+ {
+ map (typeid (SyntaxTree::InterfaceDef), this);
+ }
+
+ virtual void
+ traverse (SyntaxTree::Node*)
+ {
+ std::cerr << "interface definition" << std::endl;
+ }
+ };
+}
+
+#endif // TRAVERSAL_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Example/Introspection/Traversal/driver.cpp b/ACE/contrib/utility/Example/Introspection/Traversal/driver.cpp
new file mode 100644
index 00000000000..30e1a4a3ab7
--- /dev/null
+++ b/ACE/contrib/utility/Example/Introspection/Traversal/driver.cpp
@@ -0,0 +1,93 @@
+// file : Example/Introspection/Traversal/driver.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include <iostream>
+
+#include "SyntaxTree.hpp"
+#include "Traversal.hpp"
+
+int
+main ()
+{
+ using namespace SyntaxTree;
+
+ /*
+ Create a syntax tree that looks something like this:
+
+ scope
+ {
+ interface declaration;
+
+ scope
+ {
+ interface definition
+ {
+ decalartion;
+ };
+ };
+ };
+
+ */
+
+ Scope s1;
+
+ InterfaceDecl i1;
+ s1.content_.push_back (&i1);
+
+ Scope s2;
+ s1.content_.push_back (&s2);
+
+ InterfaceDef i2;
+ s2.content_.push_back (&i2);
+
+ Declaration d1;
+ i2.content_.push_back (&d1);
+
+ SyntaxTree::Node* root = &s1;
+
+ // Now different ways of traversing this tree:
+
+ {
+ std::cout << "test #1" << std::endl;
+
+ struct Generator : Traversal::Declaration, Traversal::Scope
+ {
+ };
+
+ Generator g;
+ g.dispatch (root);
+
+ std::cout << std::endl;
+ }
+
+ {
+ std::cout << "test #2" << std::endl;
+
+ struct Generator : Traversal::Scope, Traversal::InterfaceDecl
+ {
+ };
+
+ Generator g;
+ g.dispatch (root);
+
+ std::cout << std::endl;
+ }
+
+ {
+ std::cout << "test #3" << std::endl;
+
+ struct Generator : Traversal::Scope, Traversal::InterfaceDef
+ {
+ };
+
+ Generator g;
+ g.dispatch (root);
+
+ std::cout << std::endl;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Example/Makefile b/ACE/contrib/utility/Example/Makefile
new file mode 100644
index 00000000000..1caefc91a39
--- /dev/null
+++ b/ACE/contrib/utility/Example/Makefile
@@ -0,0 +1,16 @@
+# file : Example/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := ExH Hetero Introspection
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Makefile b/ACE/contrib/utility/Makefile
new file mode 100644
index 00000000000..d23e380254b
--- /dev/null
+++ b/ACE/contrib/utility/Makefile
@@ -0,0 +1,18 @@
+# file : Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := .
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := Utility Test Example Documentation
+
+Test Example Documentation : Utility
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/Compound/Makefile b/ACE/contrib/utility/Test/ExH/Compound/Makefile
new file mode 100644
index 00000000000..b596cd2fbce
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Compound/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ExH/Compound/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := compound.cpp
+
+module_base := compound
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/Compound/compound.cpp b/ACE/contrib/utility/Test/ExH/Compound/compound.cpp
new file mode 100644
index 00000000000..df06353d4b9
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Compound/compound.cpp
@@ -0,0 +1,115 @@
+// file : Test/ExH/Compound/compound.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ExH/Compound.hpp"
+
+#include <string>
+
+using namespace Utility::ExH;
+
+struct E {};
+
+void postcondition (bool p)
+{
+ if (!p) throw E ();
+}
+
+class Base
+{
+protected:
+ Base () throw ()
+ {
+ }
+
+ void
+ init (char const* description) throw ()
+ {
+ str_ = description;
+ }
+
+ char const*
+ what () const throw ()
+ {
+ return str_.c_str ();
+ }
+
+public:
+ std::string str_;
+};
+
+class A_ {};
+typedef
+Compound<A_, Base>
+A;
+
+struct StringHolder
+{
+ StringHolder (char const* s)
+ : str_ (s)
+ {
+ }
+
+ operator std::string () const
+ {
+ return str_;
+ }
+
+ std::string str_;
+};
+
+
+int main ()
+{
+ try
+ {
+ // Compound (char const*)
+ //
+ {
+ A a ("hello");
+
+ postcondition (a.str_ == "hello");
+ }
+
+ // Compound (T const&)
+ //
+ {
+ StringHolder a ("hello");
+ A b (a);
+
+ postcondition (b.str_ == "hello");
+ }
+
+ // Compound (Compound const&)
+ //
+ {
+ A a ("hello");
+ A b (a);
+
+ postcondition (b.str_ == "hello");
+ }
+
+ // ~Compound ()
+ //
+
+ // operator= (Compound const&)
+ //
+ {
+ A a ("hello");
+ A b ("foo");
+ b = a;
+
+ postcondition (b.str_ == "hello");
+ }
+
+ // Compound ()
+ //
+
+ }
+ catch (...)
+ {
+ return -1;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Test/ExH/Converter/Makefile b/ACE/contrib/utility/Test/ExH/Converter/Makefile
new file mode 100644
index 00000000000..3f37652482d
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Converter/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ExH/Converter/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := converter.cpp
+
+module_base := converter
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/Converter/converter.cpp b/ACE/contrib/utility/Test/ExH/Converter/converter.cpp
new file mode 100644
index 00000000000..5e2fdc20db6
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Converter/converter.cpp
@@ -0,0 +1,50 @@
+// file : Test/ExH/Converter/converter.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include "Utility/ExH/Converter.hpp"
+#include "Utility/ExH/StringStreamConverter.hpp"
+
+#include <string>
+#include <sstream>
+
+using std::string;
+using namespace Utility::ExH;
+
+struct E {};
+
+void postcondition (bool p)
+{
+ if (!p) throw E ();
+}
+
+int
+main ()
+{
+ try
+ {
+ // template<T>
+ // converter (T const&)
+ //
+ {
+ postcondition (converter ("hello") == string("hello"));
+ }
+
+ // template<>
+ // converter (std::ostringstream const&)
+ //
+ {
+ std::ostringstream ostr;
+ ostr << "hello";
+ postcondition (converter (ostr) == string("hello"));
+ }
+ }
+ catch (...)
+ {
+ return -1;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Test/ExH/Inline/Makefile b/ACE/contrib/utility/Test/ExH/Inline/Makefile
new file mode 100644
index 00000000000..26606c35669
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Inline/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ExH/Inline/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := inline.cpp unit.cpp
+
+module_base := inline
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/Inline/inline.cpp b/ACE/contrib/utility/Test/ExH/Inline/inline.cpp
new file mode 100644
index 00000000000..10ca764a34f
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Inline/inline.cpp
@@ -0,0 +1,19 @@
+// file : Test/ExH/Inline/inline.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+//
+// This is a link-time test to detect any problems with inline functions
+// (notably missing inline specifier).
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include "Utility/ExH/ExH.hpp"
+
+int
+main ()
+{
+}
+
+//$Id$
diff --git a/ACE/contrib/utility/Test/ExH/Inline/unit.cpp b/ACE/contrib/utility/Test/ExH/Inline/unit.cpp
new file mode 100644
index 00000000000..8a57af7d759
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Inline/unit.cpp
@@ -0,0 +1,8 @@
+// file : Test/ExH/Inline/unit.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ExH/ExH.hpp"
+
+//$Id$
diff --git a/ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/Makefile b/ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/Makefile
new file mode 100644
index 00000000000..6ca8e6029ee
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ExH/Logic/DescriptiveException/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := descriptive_exception.cpp
+
+module_base := descriptive_exception
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp b/ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp
new file mode 100644
index 00000000000..c8ed217b824
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp
@@ -0,0 +1,110 @@
+// file : Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include "Utility/ExH/Logic/DescriptiveException.hpp"
+
+#include <string>
+
+using std::string;
+using namespace Utility::ExH::Logic;
+
+struct E {};
+
+void postcondition (bool p)
+{
+ if (!p) throw E ();
+}
+
+struct StringHolder
+{
+ StringHolder (char const* s)
+ : str_ (s)
+ {
+ }
+
+ operator std::string () const
+ {
+ return str_;
+ }
+
+ string str_;
+};
+
+int
+main ()
+{
+ try
+ {
+ // DescriptiveException (char const*)
+ //
+ {
+ DescriptiveException a ("hello");
+
+ postcondition (a.what () == string ("hello"));
+ }
+
+ // DescriptiveException (std::string const&)
+ //
+ {
+ DescriptiveException a (string ("hello"));
+
+ postcondition (a.what () == string ("hello"));
+ }
+
+
+ // DescriptiveException (T const&)
+ //
+ {
+ StringHolder a ("hello");
+
+ DescriptiveException b (a);
+
+ postcondition (b.what () == string ("hello"));
+ }
+
+ // DescriptiveException (DescriptiveException const&)
+ //
+ {
+ DescriptiveException a ("hello");
+ DescriptiveException b (a);
+
+ postcondition (b.what () == string ("hello"));
+ }
+
+ // ~DescriptiveException
+ //
+
+ // operator= (DescriptiveException const&)
+ //
+ {
+ DescriptiveException a ("hello");
+ DescriptiveException b ("foo");
+ b = a;
+
+ postcondition (b.what () == string ("hello"));
+ }
+
+ // DescriptiveException ()
+ //
+
+ // init (char const*)
+ //
+
+ // what ()
+ //
+ {
+ DescriptiveException a ("hello");
+
+ postcondition (a.what () == string ("hello"));
+ }
+ }
+ catch (...)
+ {
+ return -1;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Test/ExH/Logic/Makefile b/ACE/contrib/utility/Test/ExH/Logic/Makefile
new file mode 100644
index 00000000000..042b3a172a4
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Logic/Makefile
@@ -0,0 +1,16 @@
+# file : Test/ExH/Logic/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := DescriptiveException
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/Makefile b/ACE/contrib/utility/Test/ExH/Makefile
new file mode 100644
index 00000000000..161884a439c
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Makefile
@@ -0,0 +1,16 @@
+# file : Test/ExH/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := Compound Converter Inline Logic System
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/System/DescriptiveException/Makefile b/ACE/contrib/utility/Test/ExH/System/DescriptiveException/Makefile
new file mode 100644
index 00000000000..9fd89d86ade
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/System/DescriptiveException/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ExH/System/DescriptiveException/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := descriptive_exception.cpp
+
+module_base := descriptive_exception
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/System/DescriptiveException/descriptive_exception.cpp b/ACE/contrib/utility/Test/ExH/System/DescriptiveException/descriptive_exception.cpp
new file mode 100644
index 00000000000..5ae1c86803e
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/System/DescriptiveException/descriptive_exception.cpp
@@ -0,0 +1,109 @@
+// file : Test/ExH/System/DescriptiveException/descriptive_exception.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include "Utility/ExH/System/DescriptiveException.hpp"
+
+#include <string>
+
+using std::string;
+using namespace Utility::ExH::System;
+
+struct E {};
+
+void postcondition (bool p)
+{
+ if (!p) throw E ();
+}
+
+struct StringHolder
+{
+ StringHolder (char const* s)
+ : str_ (s)
+ {
+ }
+
+ operator std::string () const
+ {
+ return str_;
+ }
+
+ string str_;
+};
+
+int
+main ()
+{
+ try
+ {
+ // DescriptiveException (char const*)
+ //
+ {
+ DescriptiveException a ("hello");
+
+ postcondition (a.what () == string ("hello"));
+ }
+
+ // DescriptiveException (std::string const&)
+ //
+ {
+ DescriptiveException a (string ("hello"));
+
+ postcondition (a.what () == string ("hello"));
+ }
+
+ // DescriptiveException (T const&)
+ //
+ {
+ StringHolder a ("hello");
+
+ DescriptiveException b (a);
+
+ postcondition (b.what () == string ("hello"));
+ }
+
+ // DescriptiveException (DescriptiveException const&)
+ //
+ {
+ DescriptiveException a ("hello");
+ DescriptiveException b (a);
+
+ postcondition (b.what () == string ("hello"));
+ }
+
+ // ~DescriptiveException
+ //
+
+ // operator= (DescriptiveException const&)
+ //
+ {
+ DescriptiveException a ("hello");
+ DescriptiveException b ("foo");
+ b = a;
+
+ postcondition (b.what () == string ("hello"));
+ }
+
+ // DescriptiveException ()
+ //
+
+ // init (char const*)
+ //
+
+ // what ()
+ //
+ {
+ DescriptiveException a ("hello");
+
+ postcondition (a.what () == string ("hello"));
+ }
+ }
+ catch (...)
+ {
+ return -1;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Test/ExH/System/Makefile b/ACE/contrib/utility/Test/ExH/System/Makefile
new file mode 100644
index 00000000000..2ffea12a6ed
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/System/Makefile
@@ -0,0 +1,16 @@
+# file : Test/ExH/System/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := DescriptiveException
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/Introspection/Inline/Makefile b/ACE/contrib/utility/Test/Introspection/Inline/Makefile
new file mode 100644
index 00000000000..fb7a72c1e2f
--- /dev/null
+++ b/ACE/contrib/utility/Test/Introspection/Inline/Makefile
@@ -0,0 +1,24 @@
+# file : Test/Introspection/Inline/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := inline.cpp unit.cpp
+
+module_base := inline
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/Introspection/Inline/inline.cpp b/ACE/contrib/utility/Test/Introspection/Inline/inline.cpp
new file mode 100644
index 00000000000..9d2b4828f17
--- /dev/null
+++ b/ACE/contrib/utility/Test/Introspection/Inline/inline.cpp
@@ -0,0 +1,20 @@
+// file : Test/Introspection/Inline/inline.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+//
+// This is a link-time test to detect any problems with inline functions
+// (notably missing inline specifier).
+//
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include "Utility/Introspection/Introspection.hpp"
+
+int
+main ()
+{
+}
+
+//$Id$
diff --git a/ACE/contrib/utility/Test/Introspection/Inline/unit.cpp b/ACE/contrib/utility/Test/Introspection/Inline/unit.cpp
new file mode 100644
index 00000000000..a5fe6f95b65
--- /dev/null
+++ b/ACE/contrib/utility/Test/Introspection/Inline/unit.cpp
@@ -0,0 +1,8 @@
+// file : Test/Introspection/Inline/unit.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/Introspection/Introspection.hpp"
+
+//$Id$
diff --git a/ACE/contrib/utility/Test/Introspection/Makefile b/ACE/contrib/utility/Test/Introspection/Makefile
new file mode 100644
index 00000000000..8ed18da5c41
--- /dev/null
+++ b/ACE/contrib/utility/Test/Introspection/Makefile
@@ -0,0 +1,16 @@
+# file : Test/Introspection/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := Inline
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/Makefile b/ACE/contrib/utility/Test/Makefile
new file mode 100644
index 00000000000..4ac5c3530b8
--- /dev/null
+++ b/ACE/contrib/utility/Test/Makefile
@@ -0,0 +1,18 @@
+# file : Test/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := ExH Introspection ReferenceCounting Synch
+
+ReferenceCounting : ExH Synch
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/Makefile b/ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/Makefile
new file mode 100644
index 00000000000..c3f89dc7a9c
--- /dev/null
+++ b/ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ReferenceCounting/DefaultImpl/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := default_impl.cpp
+
+module_base := default_impl
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/default_impl.cpp b/ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/default_impl.cpp
new file mode 100644
index 00000000000..428e78cd061
--- /dev/null
+++ b/ACE/contrib/utility/Test/ReferenceCounting/DefaultImpl/default_impl.cpp
@@ -0,0 +1,132 @@
+// file : Test/ReferenceCounting/DefaultImpl/default_impl.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ReferenceCounting/DefaultImpl.hpp"
+
+using namespace Utility::ReferenceCounting;
+
+struct Base : public virtual Interface
+{
+ virtual
+ ~Base () throw ()
+ {
+ }
+};
+
+
+class Impl : public virtual Base,
+ public virtual DefaultImpl <>
+{
+public:
+ Impl (bool& destroyed)
+ : dummy_ (false),
+ destroyed_ (destroyed)
+ {
+ }
+
+ Impl ()
+ : dummy_ (false),
+ destroyed_ (dummy_)
+ {
+ }
+
+ virtual
+ ~Impl () throw ()
+ {
+ destroyed_ = true;
+ }
+
+public:
+ void
+ lock ()
+ {
+ lock_i ();
+ }
+
+private:
+ bool dummy_;
+ bool& destroyed_;
+};
+
+struct E {};
+
+void postcondition (bool p)
+{
+ if (!p) throw E ();
+}
+
+int main ()
+{
+ try
+ {
+ // DefaultImpl
+ //
+ {
+ Impl* a (new Impl);
+
+ postcondition (a->refcount_value () == 1);
+
+ a->remove_ref ();
+ }
+
+ // ~DefaultImpl
+ //
+ {
+ Impl* a (new Impl);
+ a->remove_ref ();
+ }
+
+ // add_ref
+ //
+ {
+ Impl* a (new Impl);
+
+ a->add_ref ();
+
+ postcondition (a->refcount_value () == 2);
+
+ a->remove_ref ();
+ a->remove_ref ();
+ }
+
+
+ // remove_ref
+ //
+ {
+ bool destroyed (false);
+ Impl* a (new Impl (destroyed));
+
+ a->add_ref ();
+ a->remove_ref ();
+
+ postcondition (destroyed == false && a->refcount_value () == 1);
+
+ a->remove_ref ();
+
+ postcondition (destroyed == true);
+ }
+
+
+ // refcount_value
+ //
+ {
+ Impl* a (new Impl);
+
+ postcondition (a->refcount_value () == 1);
+ }
+
+ // lock_i
+ //
+ {
+ Impl* a (new Impl);
+ a->lock ();
+ }
+ }
+ catch (...)
+ {
+ return -1;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Test/ReferenceCounting/Inline/Makefile b/ACE/contrib/utility/Test/ReferenceCounting/Inline/Makefile
new file mode 100644
index 00000000000..5ae9a840c8d
--- /dev/null
+++ b/ACE/contrib/utility/Test/ReferenceCounting/Inline/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ReferenceCounting/Inline/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := inline.cpp unit.cpp
+
+module_base := inline
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ReferenceCounting/Inline/inline.cpp b/ACE/contrib/utility/Test/ReferenceCounting/Inline/inline.cpp
new file mode 100644
index 00000000000..0ff2dfa9986
--- /dev/null
+++ b/ACE/contrib/utility/Test/ReferenceCounting/Inline/inline.cpp
@@ -0,0 +1,16 @@
+// file : Test/ReferenceCounting/Inline/inline.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+//
+// This is a link-time test to detect any problems with inline functions
+// (notably missing inline specifier).
+//
+
+#include "Utility/ReferenceCounting/ReferenceCounting.hpp"
+
+int main ()
+{
+}
+//$Id$
diff --git a/ACE/contrib/utility/Test/ReferenceCounting/Inline/unit.cpp b/ACE/contrib/utility/Test/ReferenceCounting/Inline/unit.cpp
new file mode 100644
index 00000000000..31dbfdb8708
--- /dev/null
+++ b/ACE/contrib/utility/Test/ReferenceCounting/Inline/unit.cpp
@@ -0,0 +1,8 @@
+// file : Test/ReferenceCounting/Inline/unit.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ReferenceCounting/ReferenceCounting.hpp"
+
+//$Id$
diff --git a/ACE/contrib/utility/Test/ReferenceCounting/Interface/Makefile b/ACE/contrib/utility/Test/ReferenceCounting/Interface/Makefile
new file mode 100644
index 00000000000..4327774eb54
--- /dev/null
+++ b/ACE/contrib/utility/Test/ReferenceCounting/Interface/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ReferenceCounting/Interface/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := interface.cpp
+
+module_base := interface
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ReferenceCounting/Interface/interface.cpp b/ACE/contrib/utility/Test/ReferenceCounting/Interface/interface.cpp
new file mode 100644
index 00000000000..8299881424e
--- /dev/null
+++ b/ACE/contrib/utility/Test/ReferenceCounting/Interface/interface.cpp
@@ -0,0 +1,104 @@
+// file : Test/ReferenceCounting/Interface/interface.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ReferenceCounting/Interface.hpp"
+
+using namespace Utility::ReferenceCounting;
+
+struct Obj : public virtual Interface
+{
+ Obj ()
+ : ref_count_ (1)
+ {
+ }
+
+ virtual
+ ~Obj () throw ()
+ {
+ }
+
+public:
+ virtual void
+ add_ref () const throw ()
+ {
+ add_ref_i ();
+ }
+
+
+ virtual void
+ remove_ref () const throw ()
+ {
+ if (remove_ref_i ()) delete this;
+ }
+
+ virtual count_t
+ refcount_value () const throw ()
+ {
+ return refcount_value_i ();
+ }
+
+protected:
+ virtual void
+ add_ref_i () const throw ()
+ {
+ ++ref_count_;
+ }
+
+
+ virtual bool
+ remove_ref_i () const throw ()
+ {
+ return --ref_count_ == 0;
+ }
+
+ virtual count_t
+ refcount_value_i () const throw ()
+ {
+ return ref_count_;
+ }
+
+private:
+ mutable count_t ref_count_;
+};
+
+
+struct E {};
+
+void postcondition (bool p)
+{
+ if (!p) throw E ();
+}
+
+int main ()
+{
+ try
+ {
+ // add_ref
+ //
+ {
+ Obj* a (new Obj);
+
+ Obj* b (add_ref (a));
+
+ postcondition (a == b && a->refcount_value () == 2);
+
+ a->remove_ref ();
+ b->remove_ref ();
+ }
+
+ {
+ Obj* a (0);
+
+ Obj* b (add_ref (a));
+
+ postcondition (b == 0);
+ }
+ }
+ catch (...)
+ {
+ return -1;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Test/ReferenceCounting/Makefile b/ACE/contrib/utility/Test/ReferenceCounting/Makefile
new file mode 100644
index 00000000000..1f7d981c87f
--- /dev/null
+++ b/ACE/contrib/utility/Test/ReferenceCounting/Makefile
@@ -0,0 +1,16 @@
+# file : Test/ReferenceCounting/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := Interface DefaultImpl Inline SmartPtr StrictPtr
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ReferenceCounting/SmartPtr/Makefile b/ACE/contrib/utility/Test/ReferenceCounting/SmartPtr/Makefile
new file mode 100644
index 00000000000..7bbc0456949
--- /dev/null
+++ b/ACE/contrib/utility/Test/ReferenceCounting/SmartPtr/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ReferenceCounting/SmartPtr/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := smart_ptr.cpp
+
+module_base := smart_ptr
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ReferenceCounting/SmartPtr/smart_ptr.cpp b/ACE/contrib/utility/Test/ReferenceCounting/SmartPtr/smart_ptr.cpp
new file mode 100644
index 00000000000..e03a0a06cfd
--- /dev/null
+++ b/ACE/contrib/utility/Test/ReferenceCounting/SmartPtr/smart_ptr.cpp
@@ -0,0 +1,220 @@
+// file : Test/ReferenceCounting/SmartPtr/smart_ptr.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ReferenceCounting/SmartPtr.hpp"
+#include "Utility/ReferenceCounting/DefaultImpl.hpp"
+
+using namespace Utility::ReferenceCounting;
+
+struct Base : public virtual Interface
+{
+ virtual
+ ~Base () throw ()
+ {
+ }
+};
+
+typedef
+SmartPtr<Base>
+BasePtr;
+
+class Impl : public virtual Base,
+ public virtual DefaultImpl <>
+{
+public:
+ Impl (bool& destroyed)
+ : dummy_ (false),
+ destroyed_ (destroyed)
+ {
+ }
+
+ Impl ()
+ : dummy_ (false),
+ destroyed_ (dummy_)
+ {
+ }
+
+ virtual
+ ~Impl () throw ()
+ {
+ destroyed_ = true;
+ }
+
+private:
+ bool dummy_;
+ bool& destroyed_;
+};
+
+typedef
+SmartPtr<Impl>
+ImplPtr;
+
+struct E {};
+
+void postcondition (bool p)
+{
+ if (!p) throw E ();
+}
+
+int main ()
+{
+ try
+ {
+ // SmartPtr ()
+ //
+ {
+ BasePtr a;
+
+ postcondition (a.in () == 0);
+ }
+
+ // SmartPtr (Type*)
+ //
+ {
+ Impl* a (new Impl);
+ ImplPtr b (a);
+
+ postcondition (b.in () == a && a->refcount_value () == 1);
+ }
+
+ // SmartPtr (SmartPtr<Type> const&)
+ //
+ {
+ ImplPtr a (new Impl);
+ ImplPtr b (a);
+
+ postcondition (a.in () == b.in () && a->refcount_value () == 2);
+ }
+
+ // SmartPtr (SmartPtr<Other> const&)
+ //
+ {
+ ImplPtr a (new Impl);
+ BasePtr b (a);
+
+ postcondition (b.in () == static_cast<Base*>(a.in ()) &&
+ b->refcount_value () == 2);
+ }
+
+ // ~SmartPtr
+ //
+ {
+ bool destroyed (false);
+ {
+ ImplPtr a (new Impl (destroyed));
+ }
+
+ postcondition (destroyed == true);
+ }
+
+ // operator= (Type* ptr)
+ //
+ {
+ Impl* a (new Impl);
+ ImplPtr b;
+ b = a;
+
+ postcondition (b.in () == a && a->refcount_value () == 1);
+ }
+
+ // operator= (SmartPtr<Type> const&)
+ //
+ {
+ ImplPtr a (new Impl);
+ ImplPtr b;
+ b = a;
+
+ postcondition (b.in () == a.in () && a->refcount_value () == 2);
+ }
+
+ // operator= (SmartPtr<Other> const&)
+ //
+ {
+ ImplPtr a (new Impl);
+ BasePtr b;
+ b = a;
+
+ postcondition (b.in () == static_cast<Base*>(a.in ()) &&
+ b->refcount_value () == 2);
+ }
+
+ // operator Type*
+ //
+ {
+ Impl* a (new Impl);
+ ImplPtr b (a);
+ Impl* c (b);
+
+ postcondition (a == c);
+ }
+
+ // operator->
+ //
+ {
+ Impl* a (new Impl);
+ ImplPtr b (a);
+ Impl* c (b.operator-> ());
+
+ postcondition (a == c);
+ }
+
+ // in
+ //
+ {
+ Impl* a (new Impl);
+ ImplPtr b (a);
+ Impl* c (b.in ());
+
+ postcondition (a == c);
+ }
+
+ // retn
+ //
+ {
+ Impl* a (new Impl);
+ ImplPtr b (a);
+ Impl* c (b.retn ());
+
+ postcondition (a == c);
+
+ b = a; // give ownership back
+ }
+
+ // add_ref
+ //
+ {
+ ImplPtr a (new Impl);
+ ImplPtr b (add_ref (a));
+
+ postcondition (a.in () == b.in () && b->refcount_value () == 2);
+ }
+
+ // smart_cast
+ //
+ {
+ BasePtr a (new Impl);
+ ImplPtr b (smart_cast<Impl>(a));
+
+ postcondition (b != 0 && b->refcount_value () == 2);
+ }
+
+ // acquire
+ //
+ {
+ bool destroyed (false);
+ Base::count_t c (0);
+ {
+ c = acquire (new Impl (destroyed))->refcount_value ();
+ }
+
+ postcondition (c == 1 && destroyed == true);
+ }
+ }
+ catch (...)
+ {
+ return -1;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Test/ReferenceCounting/StrictPtr/Makefile b/ACE/contrib/utility/Test/ReferenceCounting/StrictPtr/Makefile
new file mode 100644
index 00000000000..e078ef688fe
--- /dev/null
+++ b/ACE/contrib/utility/Test/ReferenceCounting/StrictPtr/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ReferenceCounting/StrictPtr/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := strict_ptr.cpp
+
+module_base := strict_ptr
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ReferenceCounting/StrictPtr/strict_ptr.cpp b/ACE/contrib/utility/Test/ReferenceCounting/StrictPtr/strict_ptr.cpp
new file mode 100644
index 00000000000..76fe667900f
--- /dev/null
+++ b/ACE/contrib/utility/Test/ReferenceCounting/StrictPtr/strict_ptr.cpp
@@ -0,0 +1,218 @@
+// file : Test/ReferenceCounting/StrictPtr/strict_ptr.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ReferenceCounting/StrictPtr.hpp"
+#include "Utility/ReferenceCounting/DefaultImpl.hpp"
+
+using namespace Utility::ReferenceCounting;
+
+struct Base : public virtual Interface
+{
+ virtual
+ ~Base () throw ()
+ {
+ }
+};
+
+typedef
+StrictPtr<Base>
+BasePtr;
+
+class Impl : public virtual Base,
+ public virtual DefaultImpl <>
+{
+public:
+ Impl (bool& destroyed)
+ : dummy_ (false),
+ destroyed_ (destroyed)
+ {
+ }
+
+ Impl ()
+ : dummy_ (false),
+ destroyed_ (dummy_)
+ {
+ }
+
+ virtual
+ ~Impl () throw ()
+ {
+ destroyed_ = true;
+ }
+
+private:
+ bool dummy_;
+ bool& destroyed_;
+};
+
+typedef
+StrictPtr<Impl>
+ImplPtr;
+
+struct E {};
+
+void postcondition (bool p)
+{
+ if (!p) throw E ();
+}
+
+int main ()
+{
+ try
+ {
+ // StrictPtr ()
+ //
+ {
+ BasePtr a;
+
+ postcondition (a.in () == 0);
+ }
+
+ // StrictPtr (Type*)
+ //
+ {
+ Impl* a (new Impl);
+ ImplPtr b (a);
+
+ postcondition (b.in () == a && a->refcount_value () == 1);
+ }
+
+ // StrictPtr (StrictPtr<Type> const&)
+ //
+ {
+ ImplPtr a (new Impl);
+ ImplPtr b (a);
+
+ postcondition (a.in () == b.in () && a->refcount_value () == 2);
+ }
+
+ // StrictPtr (StrictPtr<Other> const&)
+ //
+ {
+ ImplPtr a (new Impl);
+ BasePtr b (a);
+
+ postcondition (b.in () == static_cast<Base*>(a.in ()) &&
+ b->refcount_value () == 2);
+ }
+
+ // ~StrictPtr
+ //
+ {
+ bool destroyed (false);
+ {
+ ImplPtr a (new Impl (destroyed));
+ }
+
+ postcondition (destroyed == true);
+ }
+
+ // operator= (Type* ptr)
+ //
+ {
+ Impl* a (new Impl);
+ ImplPtr b;
+ b = a;
+
+ postcondition (b.in () == a && a->refcount_value () == 1);
+ }
+
+ // operator= (StrictPtr<Type> const&)
+ //
+ {
+ ImplPtr a (new Impl);
+ ImplPtr b;
+ b = a;
+
+ postcondition (b.in () == a.in () && a->refcount_value () == 2);
+ }
+
+ // operator= (StrictPtr<Other> const&)
+ //
+ {
+ ImplPtr a (new Impl);
+ BasePtr b;
+ b = a;
+
+ postcondition (b.in () == static_cast<Base*>(a.in ()) &&
+ b->refcount_value () == 2);
+ }
+
+ // operator==
+ //
+ {
+ Impl* a (new Impl);
+ ImplPtr b (a);
+ bool r (b.in () == a);
+
+ postcondition (r == true);
+ }
+
+ // operator!=
+ //
+ {
+ Impl* a (new Impl);
+ ImplPtr b (a);
+ bool r (b.in () != a);
+
+ postcondition (r == false);
+ }
+
+ // operator->
+ //
+ {
+ Impl* a (new Impl);
+ ImplPtr b (a);
+ Impl* c (b.operator-> ());
+
+ postcondition (a == c);
+ }
+
+ // in
+ //
+ {
+ Impl* a (new Impl);
+ ImplPtr b (a);
+ Impl* c (b.in ());
+
+ postcondition (a == c);
+ }
+
+ // retn
+ //
+ {
+ Impl* a (new Impl);
+ ImplPtr b (a);
+ Impl* c (b.retn ());
+
+ postcondition (a == c);
+
+ b = a; // give ownership back
+ }
+
+ // add_ref
+ //
+ {
+ ImplPtr a (new Impl);
+ ImplPtr b (add_ref (a));
+
+ postcondition (a.in () == b.in () && b->refcount_value () == 2);
+ }
+
+ // strict_cast
+ //
+ {
+ BasePtr a (new Impl);
+ ImplPtr b (strict_cast<Impl>(a));
+
+ postcondition (b != 0 && b->refcount_value () == 2);
+ }
+ }
+ catch (...)
+ {
+ return -1;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Test/Synch/Inline/Makefile b/ACE/contrib/utility/Test/Synch/Inline/Makefile
new file mode 100644
index 00000000000..2101cc3ee8c
--- /dev/null
+++ b/ACE/contrib/utility/Test/Synch/Inline/Makefile
@@ -0,0 +1,24 @@
+# file : Test/Synch/Inline/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := inline.cpp unit.cpp
+
+module_base := inline
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/Synch/Inline/inline.cpp b/ACE/contrib/utility/Test/Synch/Inline/inline.cpp
new file mode 100644
index 00000000000..a70dd06d739
--- /dev/null
+++ b/ACE/contrib/utility/Test/Synch/Inline/inline.cpp
@@ -0,0 +1,20 @@
+// file : Test/Synch/Inline/inline.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+//
+// This is a link-time test to detect any problems with inline functions
+// (notably missing inline specifier).
+//
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include "Utility/Synch/Policy/Null.hpp"
+
+int
+main ()
+{
+}
+
+//$Id$
diff --git a/ACE/contrib/utility/Test/Synch/Inline/unit.cpp b/ACE/contrib/utility/Test/Synch/Inline/unit.cpp
new file mode 100644
index 00000000000..b570c97ae5e
--- /dev/null
+++ b/ACE/contrib/utility/Test/Synch/Inline/unit.cpp
@@ -0,0 +1,8 @@
+// file : Test/Synch/Inline/unit.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/Synch/Policy/Null.hpp"
+
+//$Id$
diff --git a/ACE/contrib/utility/Test/Synch/Makefile b/ACE/contrib/utility/Test/Synch/Makefile
new file mode 100644
index 00000000000..c4b730ca6a5
--- /dev/null
+++ b/ACE/contrib/utility/Test/Synch/Makefile
@@ -0,0 +1,16 @@
+# file : Test/Synch/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := Inline
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Compound.hpp b/ACE/contrib/utility/Utility/ExH/Compound.hpp
new file mode 100644
index 00000000000..c21f5013853
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Compound.hpp
@@ -0,0 +1,49 @@
+// file : Utility/ExH/Compound.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_COMPOUND_HPP
+#define UTILITY_EX_H_COMPOUND_HPP
+
+#include <string>
+
+namespace Utility
+{
+ namespace ExH
+ {
+ template <typename Type, typename _Base>
+ class Compound : public virtual _Base
+ {
+ public:
+ typedef _Base Base;
+
+ explicit
+ Compound (char const* description) throw ();
+
+ explicit
+ Compound (std::string const& description) throw ();
+
+ template <typename T>
+ explicit
+ Compound (T const& description) throw ();
+
+ Compound (Compound const& src) throw ();
+
+ virtual
+ ~Compound () throw ();
+
+ public:
+ Compound&
+ operator= (Compound const& src) throw ();
+
+ protected:
+ Compound () throw ();
+ };
+ }
+}
+
+#include "Utility/ExH/Compound.tpp"
+
+#endif // UTILITY_EX_H_COMPOUND_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Compound.tpp b/ACE/contrib/utility/Utility/ExH/Compound.tpp
new file mode 100644
index 00000000000..08c9f8194a9
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Compound.tpp
@@ -0,0 +1,74 @@
+// file : Utility/ExH/Compound.tpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ExH/Converter.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ // c-tor's & d-tor
+ template <typename Type, typename Base>
+ Compound<Type, Base>::
+ Compound () throw ()
+ {
+ }
+
+ template <typename Type, typename Base>
+ Compound<Type, Base>::
+ Compound (char const* description) throw ()
+ {
+ Base::init (description);
+ }
+
+ template <typename Type, typename Base>
+ Compound<Type, Base>::
+ Compound (std::string const& description) throw ()
+ {
+ try
+ {
+ Base::init (description.c_str ());
+ }
+ catch (...)
+ {
+ }
+ }
+
+ template <typename Type, typename Base>
+ template <typename T>
+ Compound<Type, Base>::
+ Compound (T const& description) throw ()
+ {
+ Base::init (converter<T> (description).c_str ());
+ }
+
+ template <typename Type, typename Base>
+ Compound<Type, Base>::
+ Compound (Compound const& src) throw ()
+ : Base::Base::Base (),
+ Base::Base (),
+ Base ()
+ {
+ Base::init (src.what ());
+ }
+
+ template <typename Type, typename Base>
+ Compound<Type, Base>::
+ ~Compound () throw ()
+ {
+ }
+
+ // operator=
+
+ template <typename Type, typename Base>
+ Compound<Type, Base>& Compound<Type, Base>::
+ operator= (Compound const& src) throw ()
+ {
+ Base::init (src.what ());
+ return *this;
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Converter.hpp b/ACE/contrib/utility/Utility/ExH/Converter.hpp
new file mode 100644
index 00000000000..563114fd1c4
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Converter.hpp
@@ -0,0 +1,24 @@
+// file : Utility/ExH/Converter.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_CONVERTER_HPP
+#define UTILITY_EX_H_CONVERTER_HPP
+
+#include <string>
+
+namespace Utility
+{
+ namespace ExH
+ {
+ template <typename T>
+ std::string
+ converter (T const& t);
+ }
+}
+
+#include "Utility/ExH/Converter.tpp"
+
+#endif // UTILITY_EX_H_CONVERTER_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Converter.tpp b/ACE/contrib/utility/Utility/ExH/Converter.tpp
new file mode 100644
index 00000000000..2d48015fe80
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Converter.tpp
@@ -0,0 +1,19 @@
+// file : Utility/ExH/Converter.tpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ExH
+ {
+ template <typename T>
+ std::string
+ converter (T const& t)
+ {
+ // Default implementation just assumes that implicit converion exist.
+ return t;
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/ExH.hpp b/ACE/contrib/utility/Utility/ExH/ExH.hpp
new file mode 100644
index 00000000000..722ecd02d25
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/ExH.hpp
@@ -0,0 +1,22 @@
+// file : Utility/ExH/ExH.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_EX_H_HPP
+#define UTILITY_EX_H_EX_H_HPP
+
+#include "Utility/ExH/System/Exception.hpp"
+#include "Utility/ExH/System/DescriptiveException.hpp"
+
+#include "Utility/ExH/Logic/Exception.hpp"
+#include "Utility/ExH/Logic/DescriptiveException.hpp"
+
+#include "Utility/ExH/Compound.hpp"
+
+#include "Utility/ExH/Converter.hpp"
+#include "Utility/ExH/StringStreamConverter.hpp"
+
+#endif // UTILITY_EX_H_EX_H_HPP
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.hpp b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.hpp
new file mode 100644
index 00000000000..160ad74182d
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.hpp
@@ -0,0 +1,65 @@
+// file : Utility/ExH/Logic/DescriptiveException.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_LOGIC_DESCRIPTIVE_EXCEPTION_HPP
+#define UTILITY_EX_H_LOGIC_DESCRIPTIVE_EXCEPTION_HPP
+
+#include <memory>
+#include <string>
+
+
+#include "Utility/ExH/Logic/Exception.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace Logic
+ {
+ class DescriptiveException : public virtual Exception
+ {
+ public:
+ typedef Exception Base;
+
+ explicit
+ DescriptiveException (char const* description) throw ();
+
+ explicit
+ DescriptiveException (std::string const& description) throw ();
+
+ template <typename T>
+ explicit
+ DescriptiveException (T const& description) throw ();
+
+ DescriptiveException (DescriptiveException const& src) throw ();
+
+ virtual
+ ~DescriptiveException () throw ();
+
+ DescriptiveException&
+ operator= (DescriptiveException const& src) throw ();
+
+ protected:
+ DescriptiveException () throw ();
+
+ void
+ init (char const* description) throw ();
+
+ public:
+ virtual char const*
+ what () const throw ();
+
+ private:
+ std::auto_ptr<std::string> description_;
+ };
+ }
+ }
+}
+
+#include "Utility/ExH/Logic/DescriptiveException.ipp"
+#include "Utility/ExH/Logic/DescriptiveException.tpp"
+
+#endif // UTILITY_EX_H_LOGIC_DESCRIPTIVE_EXCEPTION_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp
new file mode 100644
index 00000000000..0e2fc1e8916
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp
@@ -0,0 +1,106 @@
+// file : Utility/ExH/Logic/DescriptiveException.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace Logic
+ {
+ // c-tor's & d-tor
+
+ inline DescriptiveException::
+ DescriptiveException () throw ()
+ {
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (char const* description) throw ()
+ {
+ init (description);
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (std::string const& description) throw ()
+ {
+ try
+ {
+ init (description.c_str ());
+ }
+ catch (...)
+ {
+ }
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (DescriptiveException const& src) throw ()
+ : std::exception (),
+ Exception ()
+ {
+ init (src.what ());
+ }
+
+ inline DescriptiveException::
+ ~DescriptiveException () throw ()
+ {
+ }
+
+ inline DescriptiveException& DescriptiveException::
+ operator= (DescriptiveException const& src) throw ()
+ {
+ init (src.what ());
+ return *this;
+ }
+
+
+ // accessors / modifiers
+
+ inline void
+ DescriptiveException::init (char const* description) throw ()
+ {
+ try
+ {
+ if (description == 0 || description[0] == '\0')
+ {
+ description_.reset (0);
+ }
+ else
+ {
+ if (description_.get () != 0)
+ {
+ *description_ = description;
+ }
+ else
+ {
+ description_.reset (new std::string (description));
+ }
+ }
+ }
+ catch (...)
+ {
+ description_.reset (0);
+ }
+ }
+
+ inline char const*
+ DescriptiveException::what () const throw ()
+ {
+ try
+ {
+ if (description_.get () != 0)
+ {
+ return description_->c_str ();
+ }
+ }
+ catch (...)
+ {
+ }
+
+ return Exception::what ();
+ }
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.tpp b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.tpp
new file mode 100644
index 00000000000..02c65a67e2b
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.tpp
@@ -0,0 +1,23 @@
+// file : Utility/ExH/Logic/DescriptiveException.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ExH/Converter.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace Logic
+ {
+ template <typename T>
+ DescriptiveException::
+ DescriptiveException (T const& description) throw ()
+ {
+ init (converter<T> (description).c_str ());
+ }
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Logic/Exception.hpp b/ACE/contrib/utility/Utility/ExH/Logic/Exception.hpp
new file mode 100644
index 00000000000..613945c09b3
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Logic/Exception.hpp
@@ -0,0 +1,42 @@
+// file : Utility/ExH/Logic/Exception.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_LOGIC_EXCEPTION_HPP
+#define UTILITY_EX_H_LOGIC_EXCEPTION_HPP
+
+#include "Utility/ExH/System/Exception.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace Logic
+ {
+
+ // Logic::Exception inherits from System::Exception for the
+ // following reason. Semantically for some part of the
+ // system particular instance of Logic::Exception may seem as
+ // opaque System::Exception and the only way to handle it would
+ // be to propagate it further. In other words Logic::Exception
+ // can be seemlesly "converted" to System::Exception if there is
+ // no part of the system interested in handling it.
+ //
+
+ class Exception : public virtual System::Exception
+ {
+ public:
+ typedef System::Exception Base;
+
+ virtual
+ ~Exception () throw ();
+ };
+ }
+ }
+}
+
+#include "Utility/ExH/Logic/Exception.ipp"
+
+#endif // UTILITY_EX_H_LOGIC_EXCEPTION_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/Logic/Exception.ipp b/ACE/contrib/utility/Utility/ExH/Logic/Exception.ipp
new file mode 100644
index 00000000000..d3b774be937
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Logic/Exception.ipp
@@ -0,0 +1,20 @@
+// file : Utility/ExH/Logic/Exception.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace Logic
+ {
+ inline Exception::
+ ~Exception () throw ()
+ {
+ }
+ }
+ }
+}
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/StringStreamConverter.hpp b/ACE/contrib/utility/Utility/ExH/StringStreamConverter.hpp
new file mode 100644
index 00000000000..a9a495f22e2
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/StringStreamConverter.hpp
@@ -0,0 +1,26 @@
+// file : Utility/ExH/StringStreamConverter.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_STRING_STREAM_CONVERTER_HPP
+#define UTILITY_EX_H_STRING_STREAM_CONVERTER_HPP
+
+#include <sstream>
+
+#include "Utility/ExH/Converter.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ template <>
+ std::string
+ converter (std::ostringstream const& t);
+ }
+}
+
+#include "Utility/ExH/StringStreamConverter.ipp"
+
+#endif // UTILITY_EX_H_STRING_STREAM_CONVERTER_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/StringStreamConverter.ipp b/ACE/contrib/utility/Utility/ExH/StringStreamConverter.ipp
new file mode 100644
index 00000000000..e454ac3f96c
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/StringStreamConverter.ipp
@@ -0,0 +1,18 @@
+// file : Utility/ExH/StringStreamConverter.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ExH
+ {
+ template <>
+ inline std::string
+ converter (std::ostringstream const& t)
+ {
+ return t.str ();
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.hpp b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.hpp
new file mode 100644
index 00000000000..1045d0ee9ae
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.hpp
@@ -0,0 +1,65 @@
+// file : Utility/ExH/System/DescriptiveException.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_SYSTEM_DESCRIPTIVE_EXCEPTION_HPP
+#define UTILITY_EX_H_SYSTEM_DESCRIPTIVE_EXCEPTION_HPP
+
+#include <string>
+#include "Utility/ExH/System/Exception.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace System
+ {
+ class DescriptiveException : public virtual Exception
+ {
+ public:
+ typedef Exception Base;
+
+ explicit
+ DescriptiveException (char const* description) throw ();
+
+ explicit
+ DescriptiveException (std::string const& description) throw ();
+
+ template <typename T>
+ explicit
+ DescriptiveException (T const& description) throw ();
+
+ DescriptiveException (DescriptiveException const& src) throw ();
+
+ virtual
+ ~DescriptiveException () throw ();
+
+ DescriptiveException&
+ operator= (DescriptiveException const& src) throw ();
+
+ protected:
+ DescriptiveException () throw ();
+
+ void
+ init (char const* description) throw ();
+
+ public:
+ virtual char const*
+ what () const throw ();
+
+ private:
+
+ static unsigned long const DESCRIPTION_SIZE = 256;
+
+ char description_ [DESCRIPTION_SIZE];
+ };
+ }
+ }
+}
+
+#include "Utility/ExH/System/DescriptiveException.ipp"
+#include "Utility/ExH/System/DescriptiveException.tpp"
+
+#endif // UTILITY_EX_H_SYSTEM_DESCRIPTIVE_EXCEPTION_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.ipp b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.ipp
new file mode 100644
index 00000000000..cedaeacc937
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.ipp
@@ -0,0 +1,91 @@
+// file : Utility/ExH/System/DescriptiveException.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include <cstring>
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace System
+ {
+ // c-tor's & d-tor
+
+ inline DescriptiveException::
+ DescriptiveException () throw ()
+ {
+ description_[0] = '\0';
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (char const* description) throw ()
+ {
+ init (description);
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (std::string const& description) throw ()
+ {
+ try
+ {
+ init (description.c_str ());
+ }
+ catch (...)
+ {
+ }
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (DescriptiveException const& src) throw ()
+ : Base ()
+ {
+ init (src.what ());
+ }
+
+ inline DescriptiveException::
+ ~DescriptiveException () throw ()
+ {
+ }
+
+ inline DescriptiveException& DescriptiveException::
+ operator= (DescriptiveException const& src) throw ()
+ {
+ init (src.what ());
+ return *this;
+ }
+
+
+ // accessors / modifiers
+
+ inline void DescriptiveException::
+ init (char const* description) throw ()
+ {
+ if (description != 0)
+ {
+ std::strncpy (description_, description, DESCRIPTION_SIZE - 1);
+ description_[DESCRIPTION_SIZE - 1] = '\0';
+ }
+ else
+ {
+ description_[0] = '\0';
+ }
+ }
+
+ inline char const* DescriptiveException::
+ what () const throw ()
+ {
+ if (description_[0] != '\0')
+ {
+ return description_;
+ }
+ else
+ {
+ return Exception::what ();
+ }
+ }
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.tpp b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.tpp
new file mode 100644
index 00000000000..320216acc2e
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/System/DescriptiveException.tpp
@@ -0,0 +1,23 @@
+// file : Utility/ExH/System/DescriptiveException.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ExH/Converter.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace System
+ {
+ template <typename T>
+ inline DescriptiveException::
+ DescriptiveException (T const& description) throw ()
+ {
+ init (converter<T> (description).c_str ());
+ }
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ExH/System/Exception.hpp b/ACE/contrib/utility/Utility/ExH/System/Exception.hpp
new file mode 100644
index 00000000000..0ed7fbfa975
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/System/Exception.hpp
@@ -0,0 +1,29 @@
+// file : Utility/ExH/System/Exception.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_SYSTEM_EXCEPTION_HPP
+#define UTILITY_EX_H_SYSTEM_EXCEPTION_HPP
+
+#include <exception>
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace System
+ {
+ // This is the only way to make predefined exceptions like
+ // std::bad_alloc, etc to appear in the right place of the hierarchy.
+ //
+
+ typedef std::exception Exception;
+ }
+ }
+}
+
+#endif // UTILITY_EX_H_SYSTEM_EXCEPTION_HPP
+
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Hetero/Container.hpp b/ACE/contrib/utility/Utility/Hetero/Container.hpp
new file mode 100644
index 00000000000..d28d5fff0c4
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Hetero/Container.hpp
@@ -0,0 +1,182 @@
+// file : Utility/Hetero/Container.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_HETERO_CONTAINER_HPP
+#define UTILITY_HETERO_CONTAINER_HPP
+
+#include <typeinfo>
+
+namespace Utility
+{
+ namespace Hetero
+ {
+ //
+ //
+ //
+ class Typing {};
+
+ //
+ //
+ //
+ class Container
+ {
+ public:
+ ~Container ()
+ {
+ delete holder_;
+ }
+
+ public:
+ template <typename T>
+ Container (T const& t)
+ : holder_ (new TypedHolder<T> (t))
+ {
+ }
+
+ Container (Container const& c)
+ : holder_ (c.holder_->clone ())
+ {
+ }
+
+ public:
+ template <typename T>
+ Container&
+ operator= (T const& t)
+ {
+ delete holder_;
+ holder_ = 0;
+ holder_ = new TypedHolder<T> (t);
+ return *this;
+ }
+
+ Container&
+ operator= (Container const& c)
+ {
+ delete holder_;
+ holder_ = 0;
+ holder_ = c.holder_->clone ();
+ return *this;
+ }
+
+ public:
+ template <typename T>
+ operator T& ()
+ {
+ return value<T> ();
+ }
+
+ template <typename T>
+ operator T const& () const
+ {
+ return value<T> ();
+ }
+
+ public:
+ template <typename T>
+ T&
+ value ()
+ {
+ if (holder_->type () == typeid (T))
+ {
+ return dynamic_cast<TypedHolder<T>*>(holder_)->value ();
+ }
+ else
+ {
+ throw Typing ();
+ }
+ }
+
+ template <typename T>
+ T const&
+ value () const
+ {
+ if (holder_->type () == typeid (T))
+ {
+ return dynamic_cast<TypedHolder<T>*>(holder_)->value ();
+ }
+ else
+ {
+ throw Typing ();
+ }
+ }
+
+ public:
+ std::type_info const&
+ type () const
+ {
+ return holder_->type ();
+ }
+
+ public:
+ template <typename T>
+ friend T
+ operator+ (Container const& a, T const& b)
+ {
+ return a.value<T> () + b;
+ }
+
+ template <typename T>
+ friend T
+ operator+ (T const& a, Container const& b)
+ {
+ return a + b.value<T> ();
+ }
+
+ private:
+ struct Holder
+ {
+ virtual
+ ~Holder () {}
+
+ virtual Holder*
+ clone () const = 0;
+
+ virtual std::type_info const&
+ type () const = 0;
+ };
+
+ template <typename T>
+ struct TypedHolder : public Holder
+ {
+ TypedHolder (T const& value)
+ : value_ (value)
+ {
+ }
+
+ virtual Holder*
+ clone () const
+ {
+ return new TypedHolder<T> (value_);
+ }
+
+ virtual std::type_info const&
+ type () const
+ {
+ return typeid (T);
+ }
+
+ T const&
+ value () const
+ {
+ return value_;
+ }
+
+ T&
+ value ()
+ {
+ return value_;
+ }
+
+ private:
+ T value_;
+ };
+
+ Holder* holder_;
+ };
+ }
+}
+
+#endif // UTILITY_HETERO_CONTAINER_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Hetero/Shell.hpp b/ACE/contrib/utility/Utility/Hetero/Shell.hpp
new file mode 100644
index 00000000000..0d37a6ba09d
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Hetero/Shell.hpp
@@ -0,0 +1,86 @@
+// file : Utility/Hetero/Shell.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_HETERO_SHELL_HPP
+#define UTILITY_HETERO_SHELL_HPP
+
+namespace Utility
+{
+ namespace Hetero
+ {
+
+ //
+ //
+ //
+ class ShellCore
+ {
+ protected:
+ template <typename F, typename T0>
+ static typename F::RetType
+ apply (F& f, TypedContainer<TypeList<T0> >& c)
+ {
+ if (type_check <T0> (c)) return type_apply<T0> (f, c);
+
+ throw Utility::Hetero::Typing ();
+ }
+
+ template <typename F, typename T0, typename T1>
+ static typename F::RetType
+ apply (F& f, TypedContainer<TypeList<T0, T1> >& c)
+ {
+ if (type_check <T0> (c)) return type_apply<T0> (f, c);
+ if (type_check <T1> (c)) return type_apply<T1> (f, c);
+
+ throw Utility::Hetero::Typing ();
+ }
+
+ template <typename F, typename T0, typename T1, typename T2>
+ static typename F::RetType
+ apply (F& f, TypedContainer<TypeList<T0, T1, T2> >& c)
+ {
+ if (type_check <T0> (c)) return type_apply<T0> (f, c);
+ if (type_check <T1> (c)) return type_apply<T1> (f, c);
+ if (type_check <T2> (c)) return type_apply<T2> (f, c);
+
+ throw Utility::Hetero::Typing ();
+ }
+
+ private:
+ template <typename T>
+ static bool
+ type_check (Container& c)
+ {
+ return c.type () == typeid (T);
+ }
+
+ template <typename T, typename F>
+ static typename F::RetType
+ type_apply (F& f, Container& c)
+ {
+ return f (c. template value<T> ());
+ }
+ };
+
+
+ //
+ //
+ //
+ template <typename F>
+ struct Shell : F, ShellCore
+ {
+ using F::operator ();
+
+ template <typename T>
+ typename F::RetType
+ operator () (TypedContainer<T>& p)
+ {
+ return apply (*this, p);
+ }
+ };
+ }
+}
+
+#endif // UTILITY_HETERO_SHELL_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Hetero/TypeList.hpp b/ACE/contrib/utility/Utility/Hetero/TypeList.hpp
new file mode 100644
index 00000000000..ee7e96c2bcd
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Hetero/TypeList.hpp
@@ -0,0 +1,46 @@
+// file : Utility/Hetero/TypeList.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_HETERO_TYPE_LIST_HPP
+#define UTILITY_HETERO_TYPE_LIST_HPP
+
+namespace Utility
+{
+ namespace Hetero
+ {
+ class NullType {};
+
+ template <typename t0 = NullType,
+ typename t1 = NullType,
+ typename t2 = NullType>
+ struct TypeList
+ {
+ typedef t0 T0;
+ typedef t1 T1;
+ typedef t2 T2;
+ };
+
+ template <typename t0, typename t1>
+ struct TypeList<t0, t1, NullType>
+ {
+ typedef t0 T0;
+ typedef t1 T1;
+ };
+
+ template <typename t0>
+ struct TypeList<t0, NullType, NullType>
+ {
+ typedef t0 T0;
+ };
+
+ template <>
+ struct TypeList<NullType, NullType, NullType>
+ {
+ };
+ }
+}
+
+#endif // UTILITY_HETERO_TYPE_LIST_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Hetero/TypedContainer.hpp b/ACE/contrib/utility/Utility/Hetero/TypedContainer.hpp
new file mode 100644
index 00000000000..67f94bda0ec
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Hetero/TypedContainer.hpp
@@ -0,0 +1,57 @@
+// file : Utility/Hetero/TypedContainer.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_HETERO_TYPED_CONTAINER_HPP
+#define UTILITY_HETERO_TYPED_CONTAINER_HPP
+
+#include "Utility/Hetero/Container.hpp"
+#include "Utility/Hetero/TypeList.hpp"
+
+namespace Utility
+{
+ namespace Hetero
+ {
+ template <typename TL>
+ class TypedContainer : public Container
+ {
+ public:
+ typedef TL Types;
+
+ public:
+ template <typename T>
+ TypedContainer (T const& t)
+ : Container (t)
+ {
+ }
+
+ TypedContainer (TypedContainer const& c)
+ : Container (static_cast<Container const&> (c))
+ {
+ }
+
+ public:
+ template <typename T>
+ TypedContainer&
+ operator= (T const& t)
+ {
+ Container& self = *this;
+ self = t;
+ return *this;
+ }
+
+ TypedContainer&
+ operator= (TypedContainer const& c)
+ {
+ Container& self = *this;
+ Container const& other = c;
+ self = other;
+ return *this;
+ }
+ };
+ }
+}
+
+#endif // UTILITY_HETERO_TYPED_CONTAINER_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Hetero/Vector.hpp b/ACE/contrib/utility/Utility/Hetero/Vector.hpp
new file mode 100644
index 00000000000..3826bd6bb1f
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Hetero/Vector.hpp
@@ -0,0 +1,47 @@
+// file : Utility/Hetero/Vector.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_HETERO_VECTOR_HPP
+#define UTILITY_HETERO_VECTOR_HPP
+
+#include <vector>
+
+#include "Utility/Hetero/TypeList.hpp"
+#include "Utility/Hetero/TypedContainer.hpp"
+
+namespace Utility
+{
+ namespace Hetero
+ {
+ template <typename T0 = NullType,
+ typename T1 = NullType,
+ typename T2 = NullType>
+ class Vector;
+
+ template <>
+ class Vector<NullType, NullType, NullType>;
+
+ template <typename T0>
+ class Vector<T0, NullType, NullType> :
+ public std::vector<TypedContainer<TypeList<T0> > >
+ {
+ };
+
+ template <typename T0, typename T1>
+ class Vector<T0, T1, NullType> :
+ public std::vector<TypedContainer<TypeList<T0, T1> > >
+ {
+ };
+
+ template <typename T0, typename T1, typename T2>
+ class Vector :
+ public std::vector<TypedContainer<TypeList<T0, T1, T2> > >
+ {
+ };
+ }
+}
+
+#endif // UTILITY_HETERO_VECTOR_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/Introspection.hpp b/ACE/contrib/utility/Utility/Introspection/Introspection.hpp
new file mode 100644
index 00000000000..d514f62837a
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/Introspection.hpp
@@ -0,0 +1,14 @@
+// file : Utility/Introspection/Introspection.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_INTROSPECTION_INTROSPECTION_HPP
+#define UTILITY_INTROSPECTION_INTROSPECTION_HPP
+
+#include "Utility/Introspection/TypeId.hpp"
+#include "Utility/Introspection/TypeInfo.hpp"
+#include "Utility/Introspection/Object.hpp"
+
+#endif // UTILITY_INTROSPECTION_INTROSPECTION_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/Makefile b/ACE/contrib/utility/Utility/Introspection/Makefile
new file mode 100644
index 00000000000..43f2f67cb51
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/Makefile
@@ -0,0 +1,19 @@
+# file : Utility/Introspection/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Archive.pre.rules)
+
+cxx_translation_units := TypeId.cpp Object.cpp
+
+module_base := Introspection
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+$(call include, $(root)/BuildRules/Archive.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/Object.cpp b/ACE/contrib/utility/Utility/Introspection/Object.cpp
new file mode 100644
index 00000000000..015a2736aad
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/Object.cpp
@@ -0,0 +1,24 @@
+// file : Utility/Introspection/Object.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/Introspection/Object.hpp"
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ namespace
+ {
+ TypeInfo object_ (typeid (Object));
+ }
+
+ TypeInfo const& Object::
+ static_type_info () throw ()
+ {
+ return object_;
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/Object.hpp b/ACE/contrib/utility/Utility/Introspection/Object.hpp
new file mode 100644
index 00000000000..fdf8228c9f3
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/Object.hpp
@@ -0,0 +1,47 @@
+// file : Utility/Introspection/Object.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_INTROSPECTION_OBJECT_HPP
+#define UTILITY_INTROSPECTION_OBJECT_HPP
+
+#include "Utility/Introspection/TypeInfo.hpp"
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ class Object
+ {
+ public:
+ static TypeInfo const&
+ static_type_info () throw ();
+
+ virtual TypeInfo const&
+ type_info () const throw ();
+
+ protected:
+ virtual
+ ~Object ();
+
+ Object () throw ();
+ Object (Object const&) throw ();
+
+ Object&
+ operator= (Object const&) throw ();
+
+ protected:
+ virtual void
+ type_info (TypeInfo const& tid) throw ();
+
+ private:
+ TypeInfo const* type_info_;
+ };
+ }
+}
+
+#include "Utility/Introspection/Object.ipp"
+
+#endif // UTILITY_INTROSPECTION_OBJECT_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/Object.ipp b/ACE/contrib/utility/Utility/Introspection/Object.ipp
new file mode 100644
index 00000000000..7b5de978c6e
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/Object.ipp
@@ -0,0 +1,48 @@
+// file : Utility/Introspection/Object.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ inline TypeInfo const& Object::
+ type_info () const throw ()
+ {
+ return *type_info_;
+ }
+
+ inline Object::
+ ~Object ()
+ {
+ }
+
+ inline Object::
+ Object () throw ()
+ {
+ type_info (static_type_info ());
+ }
+
+
+ inline Object::
+ Object (Object const&) throw ()
+ {
+ type_info (static_type_info ());
+ }
+
+
+ inline Object& Object::
+ operator= (Object const&) throw ()
+ {
+ return *this;
+ }
+
+ inline void Object::
+ type_info (TypeInfo const& tid) throw ()
+ {
+ type_info_ = &tid;
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/TypeId.cpp b/ACE/contrib/utility/Utility/Introspection/TypeId.cpp
new file mode 100644
index 00000000000..a0ceddac2a1
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/TypeId.cpp
@@ -0,0 +1,21 @@
+// file : Utility/Introspection/TypeId.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/Introspection/TypeId.hpp"
+
+#include <ostream>
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ std::ostream&
+ operator << (std::ostream& os, TypeId const& t)
+ {
+ return os << t.tid_->name ();
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/TypeId.hpp b/ACE/contrib/utility/Utility/Introspection/TypeId.hpp
new file mode 100644
index 00000000000..51f66f99a0b
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/TypeId.hpp
@@ -0,0 +1,47 @@
+// file : Utility/Introspection/TypeId.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_INTROSPECTION_TYPE_ID_HPP
+#define UTILITY_INTROSPECTION_TYPE_ID_HPP
+
+#include <typeinfo>
+#include <iosfwd>
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ class TypeId
+ {
+ public:
+ template<typename T>
+ TypeId (T const& t);
+
+ TypeId (std::type_info const& tid);
+
+ public:
+ bool
+ operator == (TypeId const& other) const;
+
+ bool
+ operator != (TypeId const& other) const;
+
+ bool
+ operator < (TypeId const& other) const;
+
+ friend std::ostream&
+ operator << (std::ostream& os, TypeId const& t);
+
+ private:
+ std::type_info const* tid_;
+ };
+ }
+}
+
+#include "Utility/Introspection/TypeId.tpp"
+#include "Utility/Introspection/TypeId.ipp"
+
+#endif // UTILITY_INTROSPECTION_TYPE_ID_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/TypeId.ipp b/ACE/contrib/utility/Utility/Introspection/TypeId.ipp
new file mode 100644
index 00000000000..83a5a503517
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/TypeId.ipp
@@ -0,0 +1,37 @@
+// file : Utility/Introspection/TypeId.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+// cvs-id : $Id$
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ inline TypeId::
+ TypeId (std::type_info const& tid)
+ : tid_ (&tid)
+ {
+ }
+
+
+ inline bool TypeId::
+ operator == (TypeId const& other) const
+ {
+ return *tid_ == *other.tid_;
+ }
+
+ inline bool TypeId::
+ operator != (TypeId const& other) const
+ {
+ return *tid_ != *other.tid_;
+ }
+
+ inline bool TypeId::
+ operator < (TypeId const& other) const
+ {
+ return tid_->before (*other.tid_);
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/TypeId.tpp b/ACE/contrib/utility/Utility/Introspection/TypeId.tpp
new file mode 100644
index 00000000000..7c3daef603c
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/TypeId.tpp
@@ -0,0 +1,18 @@
+// file : Utility/Introspection/TypeId.tpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ template<typename T>
+ inline TypeId::
+ TypeId (T const& t)
+ : tid_ (&typeid (t))
+ {
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/TypeInfo.hpp b/ACE/contrib/utility/Utility/Introspection/TypeInfo.hpp
new file mode 100644
index 00000000000..4321fdc522c
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/TypeInfo.hpp
@@ -0,0 +1,104 @@
+// file : Utility/Introspection/TypeInfo.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_INTROSPECTION_TYPE_INFO_HPP
+#define UTILITY_INTROSPECTION_TYPE_INFO_HPP
+
+#include <vector>
+
+#include "Utility/Introspection/TypeId.hpp"
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ //
+ //
+ //
+ struct Access
+ {
+ enum Value
+ {
+ PRIVATE,
+ PROTECTED,
+ PUBLIC
+ };
+ };
+
+ // Forward declaration of class TypeInfo.
+ //
+ //
+ class TypeInfo;
+
+ //
+ //
+ //
+ class BaseInfo
+ {
+ public:
+ BaseInfo (Access::Value access,
+ bool virtual_base,
+ TypeInfo const& ti);
+
+ public:
+ TypeInfo const&
+ type_info () const;
+
+ Access::Value
+ access () const;
+
+ bool
+ virtual_base () const;
+
+ private:
+ TypeInfo const* ti_;
+ bool virtual_base_;
+ Access::Value access_;
+ };
+
+
+ //
+ //
+ //
+ class TypeInfo
+ {
+ private:
+ typedef
+ std::vector<BaseInfo>
+ BaseInfoList;
+
+ public:
+ typedef
+ BaseInfoList::const_iterator
+ BaseIterator;
+
+ public:
+ TypeInfo (TypeId const& tid);
+
+ TypeId
+ type_id () const;
+
+ BaseIterator
+ begin_base () const;
+
+ BaseIterator
+ end_base () const;
+
+ void
+ add_base (Access::Value access,
+ bool virtual_base,
+ TypeInfo const& ti);
+
+ private:
+ TypeId tid_;
+ BaseInfoList base_;
+ };
+ }
+}
+
+#include "Utility/Introspection/TypeInfo.ipp"
+
+#endif // UTILITY_INTROSPECTION_TYPE_INFO_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Introspection/TypeInfo.ipp b/ACE/contrib/utility/Utility/Introspection/TypeInfo.ipp
new file mode 100644
index 00000000000..395cf7d6539
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Introspection/TypeInfo.ipp
@@ -0,0 +1,77 @@
+// file : Utility/Introspection/TypeInfo.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace Introspection
+ {
+ // BaseInfo
+ //
+ //
+
+ inline BaseInfo::
+ BaseInfo (Access::Value access, bool virtual_base, TypeInfo const& ti)
+ : ti_ (&ti),
+ virtual_base_ (virtual_base),
+ access_ (access)
+ {
+ }
+
+ inline TypeInfo const& BaseInfo::
+ type_info () const
+ {
+ return *ti_;
+ }
+
+
+ inline Access::Value BaseInfo::
+ access () const
+ {
+ return access_;
+ }
+
+ inline bool BaseInfo::
+ virtual_base () const
+ {
+ return virtual_base_;
+ }
+
+
+ // TypeInfo
+ //
+ //
+ inline TypeInfo::
+ TypeInfo (TypeId const& tid)
+ : tid_ (tid)
+ {
+ }
+
+ inline TypeId TypeInfo::
+ type_id () const
+ {
+ return tid_;
+ }
+
+ inline TypeInfo::BaseIterator TypeInfo::
+ begin_base () const
+ {
+ return base_.begin ();
+ }
+
+
+ inline TypeInfo::BaseIterator TypeInfo::
+ end_base () const
+ {
+ return base_.end ();
+ }
+
+ inline void TypeInfo::
+ add_base (Access::Value access, bool virtual_base, TypeInfo const& ti)
+ {
+ base_.push_back (BaseInfo (access, virtual_base, ti));
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Makefile b/ACE/contrib/utility/Utility/Makefile
new file mode 100644
index 00000000000..e6951f317fa
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Makefile
@@ -0,0 +1,16 @@
+# file : Utility/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := Introspection
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.hpp b/ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.hpp
new file mode 100644
index 00000000000..f6fac55a359
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.hpp
@@ -0,0 +1,97 @@
+// file : Utility/ReferenceCounting/DefaultImpl.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_REFERENCE_COUNTING_DEFAULT_IMPL_HPP
+#define UTILITY_REFERENCE_COUNTING_DEFAULT_IMPL_HPP
+
+#include "Utility/ExH/Compound.hpp"
+#include "Utility/ExH/Logic/DescriptiveException.hpp"
+
+#include "Utility/Synch/Policy/Null.hpp"
+
+#include "Utility/ReferenceCounting/Interface.hpp"
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ // Default reference counter implementation with parameterised
+ // synchronization policy. It is assumed that none of the SynchPolicy
+ // types throw any logic exceptions. If in fact they do then these
+ // exceptions won't be handled and will be automatically converted
+ // to system exceptions.
+
+ template <typename SynchPolicy = Utility::Synch::Policy::Null>
+ class DefaultImpl : public virtual Interface
+ {
+ public:
+ class InconsistentState_ {};
+
+ typedef
+ ExH::Compound<InconsistentState_, Exception>
+ InconsistentState;
+
+ public:
+ DefaultImpl ();
+
+ virtual
+ ~DefaultImpl () throw ();
+
+ public:
+ virtual void
+ add_ref () const;
+
+ virtual void
+ remove_ref () const throw ();
+
+ virtual count_t
+ refcount_value () const;
+
+ protected:
+ virtual void
+ add_ref_i () const;
+
+ virtual bool
+ remove_ref_i () const;
+
+ virtual count_t
+ refcount_value_i () const;
+
+ typename SynchPolicy::Mutex&
+ lock_i () const throw ();
+
+ protected:
+ typedef
+ typename SynchPolicy::Mutex
+ Mutex_;
+
+ typedef
+ typename SynchPolicy::ReadGuard
+ ReadGuard_;
+
+ typedef
+ typename SynchPolicy::WriteGuard
+ WriteGuard_;
+
+ protected:
+ mutable count_t ref_count_;
+
+ private:
+ mutable Mutex_ lock_;
+
+ private:
+ // Copy semanic is not supported.
+ DefaultImpl (DefaultImpl const&) throw ();
+ DefaultImpl&
+ operator= (DefaultImpl const&) throw ();
+ };
+ }
+}
+
+#include "Utility/ReferenceCounting/DefaultImpl.ipp"
+
+#endif // UTILITY_REFERENCE_COUNTING_DEFAULT_IMPL_HPP
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.ipp b/ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.ipp
new file mode 100644
index 00000000000..eaed51a644a
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/DefaultImpl.ipp
@@ -0,0 +1,105 @@
+// file : Utility/ReferenceCounting/DefaultImpl.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ // c-tor & d-tor
+
+ template <typename SynchPolicy>
+ DefaultImpl<SynchPolicy>::
+ DefaultImpl ()
+ : ref_count_ (1),
+ lock_ ()
+ {
+ }
+
+ template <typename SynchPolicy>
+ DefaultImpl<SynchPolicy>::
+ ~DefaultImpl () throw ()
+ {
+ }
+
+ // add_ref, remove_ref and refcount_value member functions
+
+ template <typename SynchPolicy>
+ void DefaultImpl<SynchPolicy>::
+ add_ref () const
+ {
+ WriteGuard_ guard (lock_);
+ add_ref_i ();
+ }
+
+ template <typename SynchPolicy>
+ void DefaultImpl<SynchPolicy>::
+ remove_ref () const throw ()
+ {
+ bool destroy (false);
+ try
+ {
+ WriteGuard_ guard (lock_);
+ destroy = remove_ref_i ();
+ }
+ catch (...)
+ {
+ // there is nothing we can do
+ }
+
+ if (destroy) delete this;
+ }
+
+ template <typename SynchPolicy>
+ Interface::count_t DefaultImpl<SynchPolicy>::
+ refcount_value () const
+ {
+ ReadGuard_ guard (lock_);
+ return refcount_value_i ();
+ }
+
+ // add_ref_i, remove_ref_i and refcount_value_i member functions
+
+ template <typename SynchPolicy>
+ void DefaultImpl<SynchPolicy>::
+ add_ref_i () const
+ {
+ ref_count_++;
+ }
+
+ template <typename SynchPolicy>
+ bool DefaultImpl<SynchPolicy>::
+ remove_ref_i () const
+ {
+ bool destroy (false);
+ if (ref_count_ > 0)
+ {
+ if (--ref_count_ == 0) destroy = true;
+ }
+ else
+ {
+ throw InconsistentState (
+ "Utility::ReferenceCounting::DefaultImpl::_remove_ref_i: "
+ "reference counter is zero.");
+ }
+ return destroy;
+
+ }
+
+ template <typename SynchPolicy>
+ Interface::count_t DefaultImpl<SynchPolicy>::
+ refcount_value_i () const
+ {
+ return ref_count_;
+ }
+
+ template <typename SynchPolicy>
+ typename SynchPolicy::Mutex& DefaultImpl<SynchPolicy>::
+ lock_i() const throw ()
+ {
+ return lock_;
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.hpp b/ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.hpp
new file mode 100644
index 00000000000..20346e859b3
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.hpp
@@ -0,0 +1,60 @@
+// file : Utility/ReferenceCounting/ExternalLockImpl.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_REFERENCE_COUNTING_EXTERNAL_LOCK_IMPL_HPP
+#define UTILITY_REFERENCE_COUNTING_EXTERNAL_LOCK_IMPL_HPP
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+
+ /*
+
+ Not ported yet.
+
+ class ExternalLockRefCounter : public virtual Util::RefCountBase
+ {
+ public:
+ ExternalLockRefCounter (ACE_Lock* lock = 0);
+ virtual ~ExternalLockRefCounter ();
+
+ void init (ACE_Lock* lock);
+
+ public:
+
+ virtual void _add_ref ();
+ virtual void _remove_ref ();
+ virtual unsigned long _refcount_value ();
+
+ protected:
+
+ virtual void _add_ref_i ();
+ virtual bool _remove_ref_i ();
+ virtual unsigned long _refcount_value_i ();
+
+ ACE_Lock* lock_i ();
+
+ private:
+
+ typedef ACE_Guard <ACE_Lock> Guard_;
+
+ ACE_Lock* lock_;
+ unsigned long ref_count_;
+
+ private:
+ ExternalLockRefCounter (const ExternalLockRefCounter& );
+ void operator= (const ExternalLockRefCounter& );
+ };
+
+ */
+ }
+}
+
+#include "Utility/ReferenceCounting/ExternalLockImpl.ipp"
+
+#endif // UTILITY_REFERENCE_COUNTING_EXTERNAL_LOCK_IMPL_HPP
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.ipp b/ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.ipp
new file mode 100644
index 00000000000..7552d411f27
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/ExternalLockImpl.ipp
@@ -0,0 +1,122 @@
+// file : Utility/ReferenceCounting/ExternalLockImpl.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ /*
+ inline
+ ExternalLockRefCounter::ExternalLockRefCounter (ACE_Lock* lock)
+ : lock_ (lock),
+ ref_count_ (1)
+ {
+ }
+
+ inline
+ void
+ ExternalLockRefCounter::init (ACE_Lock* lock)
+ {
+ lock_ = lock;
+ }
+
+ inline
+ ExternalLockRefCounter::~ExternalLockRefCounter ()
+ {
+ }
+
+ inline
+ ACE_Lock*
+ ExternalLockRefCounter::lock_i ()
+ {
+ return lock_;
+ }
+
+ inline
+ void
+ ExternalLockRefCounter::_add_ref ()
+ {
+ if (lock_)
+ {
+ Guard_ guard (*lock_);
+ _add_ref_i ();
+ }
+ else
+ {
+ _add_ref_i ();
+ }
+ }
+
+ inline
+ void
+ ExternalLockRefCounter::_remove_ref ()
+ {
+ bool destroy = false;
+ {
+ if (lock_)
+ {
+ Guard_ guard (*lock_);
+ destroy = _remove_ref_i ();
+ }
+ else
+ {
+ destroy = _remove_ref_i ();
+ }
+ }
+ if (destroy) delete this;
+ }
+
+ inline
+ unsigned long
+ ExternalLockRefCounter::_refcount_value ()
+ {
+ if (lock_)
+ {
+ Guard_ guard (*lock_);
+ return _refcount_value_i ();
+ }
+ else
+ {
+ return _refcount_value_i ();
+ }
+ }
+
+ inline
+ void
+ ExternalLockRefCounter::_add_ref_i ()
+ {
+ ref_count_++;
+ }
+
+ inline
+ bool
+ ExternalLockRefCounter::_remove_ref_i ()
+ {
+ bool destroy = false;
+ if (ref_count_ > 0)
+ {
+ if (--ref_count_ == 0) destroy = true;
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "ExternalLockRefCounter::_remove_ref() "
+ " _remove_ref() called while ref_coundt == 0\n"
+ ));
+ }
+ return destroy;
+ }
+
+ inline
+ unsigned long
+ ExternalLockRefCounter::_refcount_value_i ()
+ {
+ return ref_count_;
+ }
+ */
+ }
+}
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/Interface.hpp b/ACE/contrib/utility/Utility/ReferenceCounting/Interface.hpp
new file mode 100644
index 00000000000..4f0a8f24201
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/Interface.hpp
@@ -0,0 +1,80 @@
+// file : Utility/ReferenceCounting/Interface.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_REFERENCE_COUNTING_INTERFACE_HPP
+#define UTILITY_REFERENCE_COUNTING_INTERFACE_HPP
+
+#include "Utility/ExH/Compound.hpp"
+#include "Utility/ExH/System/Exception.hpp"
+#include "Utility/ExH/Logic/Exception.hpp"
+#include "Utility/ExH/Logic/DescriptiveException.hpp"
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ // Interface to a reference-countable object. Note that _remove_ref ()
+ // member function has a no-throw semantic. Even though it can lead to
+ // a diagnostic loss it was made no-throw because it has a destructor
+ // semantic.
+
+ class Interface
+ {
+ public:
+ typedef
+ unsigned long
+ count_t;
+
+ typedef
+ ExH::System::Exception
+ SystemException;
+
+ typedef ExH::Logic::DescriptiveException Exception;
+
+ public:
+ virtual void
+ add_ref () const = 0;
+
+ virtual void
+ remove_ref () const throw () = 0;
+
+ virtual count_t
+ refcount_value () const = 0;
+
+ protected:
+ Interface () throw ();
+
+ virtual
+ ~Interface () throw ();
+
+ protected:
+ virtual void
+ add_ref_i () const = 0;
+
+ virtual bool
+ remove_ref_i () const = 0;
+
+ virtual count_t
+ refcount_value_i () const = 0;
+
+ private:
+ // Copy semanic is not supported.
+ Interface (Interface const&) throw ();
+ Interface&
+ operator= (Interface const&) throw ();
+ };
+
+ template <typename Type>
+ Type*
+ add_ref (Type* ptr);
+ }
+}
+
+#include "Utility/ReferenceCounting/Interface.tpp"
+#include "Utility/ReferenceCounting/Interface.ipp"
+
+#endif // UTILITY_REFERENCE_COUNTING_INTERFACE_HPP
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/Interface.ipp b/ACE/contrib/utility/Utility/ReferenceCounting/Interface.ipp
new file mode 100644
index 00000000000..f901db4b248
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/Interface.ipp
@@ -0,0 +1,22 @@
+// file : Utility/ReferenceCounting/Interface.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ inline Interface::
+ ~Interface () throw ()
+ {
+ }
+
+ inline Interface::
+ Interface () throw ()
+ {
+ }
+ }
+}
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/Interface.tpp b/ACE/contrib/utility/Utility/ReferenceCounting/Interface.tpp
new file mode 100644
index 00000000000..ff426ff7bcc
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/Interface.tpp
@@ -0,0 +1,19 @@
+// file : Utility/ReferenceCounting/Interface.tpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ template <typename Type>
+ inline Type*
+ add_ref (Type* ptr)
+ {
+ if (ptr != 0) ptr->add_ref ();
+ return ptr;
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/ReferenceCounting.hpp b/ACE/contrib/utility/Utility/ReferenceCounting/ReferenceCounting.hpp
new file mode 100644
index 00000000000..a20fe0d888c
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/ReferenceCounting.hpp
@@ -0,0 +1,16 @@
+// file : Utility/ReferenceCounting/ReferenceCounting.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_REFERENCE_COUNTING_REFERENCE_COUNTING_HPP
+#define UTILITY_REFERENCE_COUNTING_REFERENCE_COUNTING_HPP
+
+#include "Utility/ReferenceCounting/Interface.hpp"
+#include "Utility/ReferenceCounting/DefaultImpl.hpp"
+#include "Utility/ReferenceCounting/SmartPtr.hpp"
+#include "Utility/ReferenceCounting/StrictPtr.hpp"
+
+#endif // UTILITY_REFERENCE_COUNTING_REFERENCE_COUNTING_HPP
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.hpp b/ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.hpp
new file mode 100644
index 00000000000..ab6163e5d18
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.hpp
@@ -0,0 +1,97 @@
+// file : Utility/ReferenceCounting/SmartPtr.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_REFERENCE_COUNTING_SMART_PTR_HPP
+#define UTILITY_REFERENCE_COUNTING_SMART_PTR_HPP
+
+#include "Utility/ExH/Compound.hpp"
+#include "Utility/ExH/Logic/DescriptiveException.hpp"
+
+#include "Utility/ReferenceCounting/Interface.hpp"
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ template <typename T>
+ class SmartPtr
+ {
+ public:
+ typedef
+ T
+ Type;
+
+ class NotInitialized_ {};
+ typedef
+ ExH::Compound<NotInitialized_, ExH::Logic::DescriptiveException>
+ NotInitialized;
+
+ public:
+ // c-tor's
+
+ SmartPtr () throw ();
+ SmartPtr (Type* ptr) throw ();
+ SmartPtr (SmartPtr<Type> const& s_ptr);
+
+ template <typename Other>
+ SmartPtr (SmartPtr<Other> const& s_ptr);
+
+ // d-tor
+
+ ~SmartPtr () throw ();
+
+ // assignment & copy-assignment operators
+
+ SmartPtr<Type>&
+ operator= (Type* ptr) throw ();
+
+ SmartPtr<Type>&
+ operator= (SmartPtr<Type> const& s_ptr);
+
+ template <typename Other>
+ SmartPtr<Type>&
+ operator= (SmartPtr<Other> const& s_ptr);
+
+ //conversions
+
+ operator Type* () const throw ();
+
+ // accessors
+
+ Type*
+ operator-> () const;
+
+ Type*
+ in () const throw ();
+
+ Type*
+ retn() throw ();
+
+ private:
+ Type* ptr_;
+ };
+
+ // Specialization of add_ref function for SmartPtr<T>
+ template <typename T>
+ T*
+ add_ref (SmartPtr<T> const& ptr);
+
+
+ // Dynamic type conversion function for SmartPtr's
+ template <typename D, typename S>
+ D*
+ smart_cast (SmartPtr<S> const& s);
+
+ // Acquisition function
+ template <typename T>
+ SmartPtr<T>
+ acquire (T* ptr);
+ }
+}
+
+#include "Utility/ReferenceCounting/SmartPtr.tpp"
+
+#endif // UTILITY_REFERENCE_COUNTING_SMART_PTR_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.tpp b/ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.tpp
new file mode 100644
index 00000000000..515eee7c1a9
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/SmartPtr.tpp
@@ -0,0 +1,164 @@
+// file : Utility/ReferenceCounting/SmartPtr.tpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ // c-tor's & d-tor
+
+ template <typename T>
+ SmartPtr<T>::
+ SmartPtr () throw ()
+ : ptr_ (0)
+ {
+ }
+
+ template <typename T>
+ SmartPtr<T>::
+ SmartPtr (Type* ptr) throw ()
+ : ptr_ (ptr)
+ {
+ }
+
+ template <typename T>
+ SmartPtr<T>::
+ SmartPtr (SmartPtr<Type> const& s_ptr)
+ : ptr_ (add_ref (s_ptr.in ()))
+ {
+ }
+
+ template <typename T>
+ template <typename Other>
+ SmartPtr<T>::
+ SmartPtr (SmartPtr<Other> const& s_ptr)
+ : ptr_ (add_ref (s_ptr.in ()))
+ {
+ }
+
+
+ template <typename T>
+ SmartPtr<T>::
+ ~SmartPtr () throw ()
+ {
+ // This is an additional catch-all layer to protect from
+ // non-conformant Type.
+ try
+ {
+ if (ptr_ != 0) ptr_->remove_ref ();
+ }
+ catch (...)
+ {
+ }
+ }
+
+ // operator=
+
+ template <typename T>
+ SmartPtr<T>& SmartPtr<T>::
+ operator= (Type* ptr) throw ()
+ {
+ if (ptr_ != 0) ptr_->remove_ref ();
+ ptr_ = ptr;
+ return *this;
+ }
+
+
+ template <typename T>
+ SmartPtr<T>& SmartPtr<T>::
+ operator= (SmartPtr<Type> const& s_ptr)
+ {
+ Type* old_ptr (ptr_);
+ Type* new_ptr (add_ref (s_ptr.in ())); // this can throw
+ if (old_ptr != 0) old_ptr->remove_ref ();
+
+ ptr_ = new_ptr; // commit
+
+ return *this;
+ }
+
+
+ template <typename T>
+ template <typename Other>
+ SmartPtr<T>& SmartPtr<T>::
+ operator= (SmartPtr<Other> const& s_ptr)
+ {
+ Type* old_ptr (ptr_);
+ Other* new_ptr (add_ref (s_ptr.in ())); // this can throw
+ if (old_ptr != 0) old_ptr->remove_ref ();
+
+ ptr_ = new_ptr; // commit
+
+ return *this;
+ }
+
+ // conversions
+
+ template <typename T>
+ SmartPtr<T>::
+ operator T* () const throw ()
+ {
+ return ptr_;
+ }
+
+
+ // accessors
+
+ template <typename T>
+ T* SmartPtr<T>::
+ operator-> () const
+ {
+ if (ptr_ == 0)
+ {
+ throw NotInitialized(
+ "Utility::ReferenceCounting::SmartPtr::operator-> : "
+ "unable to dereference NULL pointer.");
+ }
+ return ptr_;
+ }
+
+ template <typename T>
+ T* SmartPtr<T>::
+ in () const throw ()
+ {
+ return ptr_;
+ }
+
+ template <typename T>
+ T* SmartPtr<T>::
+ retn() throw ()
+ {
+ Type* ret (ptr_);
+ ptr_ = 0;
+ return ret;
+ }
+
+ // Specialization of add_ref function for SmartPtr<T>
+ template <typename T>
+ T*
+ add_ref (SmartPtr<T> const& ptr)
+ {
+ // delegate to generic implementation
+ return add_ref (ptr.in ());
+ }
+
+ // Dynamic type conversion function for SmartPtr's
+ template <typename D, typename S>
+ D*
+ smart_cast (SmartPtr<S> const& s)
+ {
+ return add_ref (dynamic_cast<D*>(s.in ()));
+ }
+
+ // Acquisition function
+ template <typename T>
+ SmartPtr<T>
+ acquire (T* ptr)
+ {
+ return SmartPtr<T> (ptr);
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.hpp b/ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.hpp
new file mode 100644
index 00000000000..76b1781f911
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.hpp
@@ -0,0 +1,102 @@
+// file : Utility/ReferenceCounting/StrictPtr.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_REFERENCE_COUNTING_STRICT_PTR_HPP
+#define UTILITY_REFERENCE_COUNTING_STRICT_PTR_HPP
+
+#include "Utility/ExH/Compound.hpp"
+#include "Utility/ExH/Logic/DescriptiveException.hpp"
+
+#include "Utility/ReferenceCounting/Interface.hpp"
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ template <typename T>
+ class StrictPtr
+ {
+ public:
+ typedef
+ T
+ Type;
+
+ class NotInitialized_ {};
+ typedef
+ ExH::Compound<NotInitialized_, ExH::Logic::DescriptiveException>
+ NotInitialized;
+
+ public:
+ // c-tor's
+
+ StrictPtr () throw ();
+
+ explicit
+ StrictPtr (Type* ptr) throw ();
+
+ StrictPtr (StrictPtr<Type> const& s_ptr);
+
+ template <typename Other>
+ StrictPtr (StrictPtr<Other> const& s_ptr);
+ // d-tor
+
+ ~StrictPtr () throw ();
+
+ // assignment & copy-assignment operators
+
+ StrictPtr<Type>&
+ operator= (Type* ptr) throw ();
+
+ StrictPtr<Type>&
+ operator= (StrictPtr<Type> const& s_ptr);
+
+ template <typename Other>
+ StrictPtr<Type>&
+ operator= (StrictPtr<Other> const& s_ptr);
+
+ // conversions
+
+ // Note: implicit conversion (operator Type* ()) is not supported.
+
+ // comparison
+
+ bool
+ operator== (Type* other) const throw ();
+
+ bool
+ operator!= (Type* other) const throw ();
+
+ // accessors
+
+ Type*
+ operator-> () const;
+
+ Type*
+ in () const throw ();
+
+ Type*
+ retn() throw ();
+
+ private:
+ Type* ptr_;
+ };
+
+ // Specialization of add_ref function for StrictPtr<T>
+ template <typename T>
+ T*
+ add_ref (StrictPtr<T> const& ptr);
+
+ // Dynamic type conversion function for StrictPtr's
+ template <typename D, typename S>
+ StrictPtr<D>
+ strict_cast (StrictPtr<S> const& s);
+ }
+}
+
+#include "Utility/ReferenceCounting/StrictPtr.tpp"
+
+#endif // UTILITY_REFERENCE_COUNTING_STRICT_PTR_HPP
+
+//$Id$
diff --git a/ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.tpp b/ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.tpp
new file mode 100644
index 00000000000..9e15632e7a6
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ReferenceCounting/StrictPtr.tpp
@@ -0,0 +1,161 @@
+// file : Utility/ReferenceCounting/StrictPtr.tpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ReferenceCounting
+ {
+ // c-tor's & d-tor
+
+ template <typename T>
+ StrictPtr<T>::
+ StrictPtr () throw ()
+ : ptr_ (0)
+ {
+ }
+
+ template <typename T>
+ StrictPtr<T>::
+ StrictPtr (Type* ptr) throw ()
+ : ptr_ (ptr)
+ {
+ }
+
+ template <typename T>
+ StrictPtr<T>::
+ StrictPtr (StrictPtr<Type> const& s_ptr)
+ : ptr_ (add_ref (s_ptr.in ()))
+ {
+ }
+
+ template <typename T>
+ template <typename Other>
+ StrictPtr<T>::
+ StrictPtr (StrictPtr<Other> const& s_ptr)
+ : ptr_ (add_ref (s_ptr.in ()))
+ {
+ }
+
+
+ template <typename T>
+ StrictPtr<T>::
+ ~StrictPtr () throw ()
+ {
+ // This is an additional catch-all layer to protect from
+ // non-conformant Type.
+ try
+ {
+ if (ptr_ != 0) ptr_->remove_ref ();
+ }
+ catch (...)
+ {
+ }
+ }
+
+ // operator=
+
+ template <typename T>
+ StrictPtr<T>&
+ StrictPtr<T>::operator= (Type* ptr) throw ()
+ {
+ if (ptr_ != 0) ptr_->remove_ref ();
+ ptr_ = ptr;
+ return *this;
+ }
+
+ template <typename T>
+ StrictPtr<T>& StrictPtr<T>::
+ operator= (StrictPtr<Type> const& s_ptr)
+ {
+ Type* old_ptr (ptr_);
+ Type* new_ptr (add_ref (s_ptr.in ())); // this can throw
+ if (old_ptr != 0) old_ptr->remove_ref ();
+
+ ptr_ = new_ptr; // commit
+
+ return *this;
+ }
+
+
+ template <typename T>
+ template <typename Other>
+ StrictPtr<T>& StrictPtr<T>::
+ operator= (StrictPtr<Other> const& s_ptr)
+ {
+ Type* old_ptr (ptr_);
+ Other* new_ptr (add_ref (s_ptr.in ())); // this can throw
+ if (old_ptr != 0) old_ptr->remove_ref ();
+
+ ptr_ = new_ptr; // commit
+
+ return *this;
+ }
+
+ // comparison
+
+ template <typename T>
+ bool StrictPtr<T>::
+ operator== (Type* other) const throw ()
+ {
+ return ptr_ == other;
+ }
+
+ template <typename T>
+ bool StrictPtr<T>::
+ operator!= (Type* other) const throw ()
+ {
+ return ptr_ != other;
+ }
+
+ // accessors
+
+ template <typename T>
+ T* StrictPtr<T>::
+ operator-> () const
+ {
+ if (ptr_ == 0)
+ {
+ throw NotInitialized(
+ "Utility::ReferenceCounting::StrictPtr::operator-> : "
+ "unable to dereference NULL pointer.");
+ }
+ return ptr_;
+ }
+
+ template <typename T>
+ T* StrictPtr<T>::
+ in () const throw ()
+ {
+ return ptr_;
+ }
+
+ template <typename T>
+ T* StrictPtr<T>::
+ retn() throw ()
+ {
+ Type* ret (ptr_);
+ ptr_ = 0;
+ return ret;
+ }
+
+ // Specialization of add_ref function for StrictPtr<T>
+ template <typename T>
+ T*
+ add_ref (StrictPtr<T> const& ptr)
+ {
+ // delegate to generic implementation
+ return add_ref (ptr.in ());
+ }
+
+ // Dynamic type conversion function for StrictPtr's
+ template <typename D, typename S>
+ StrictPtr<D>
+ strict_cast (StrictPtr<S> const& s)
+ {
+ return StrictPtr<D>(add_ref (dynamic_cast<D*>(s.in ())));
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Synch/Policy/Null.hpp b/ACE/contrib/utility/Utility/Synch/Policy/Null.hpp
new file mode 100644
index 00000000000..cfc9c8f788e
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Synch/Policy/Null.hpp
@@ -0,0 +1,54 @@
+// file : Utility/Synch/Policy/Null.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_SYNCH_POLICY_NULL_HPP
+#define UTILITY_SYNCH_POLICY_NULL_HPP
+
+namespace Utility
+{
+ namespace Synch
+ {
+ namespace Policy
+ {
+
+ class NullMutex
+ {
+ };
+
+ class NullGuard
+ {
+ public:
+ explicit
+ NullGuard (NullMutex&) throw ();
+
+ private:
+ NullGuard (NullGuard const&) throw ();
+
+ NullGuard&
+ operator= (NullGuard const&) throw ();
+ };
+
+ struct Null
+ {
+ typedef
+ NullMutex
+ Mutex;
+
+ typedef
+ NullGuard
+ ReadGuard;
+
+ typedef
+ NullGuard
+ WriteGuard;
+ };
+ }
+ }
+}
+
+#include "Utility/Synch/Policy/Null.ipp"
+
+#endif // UTILITY_SYNCH_POLICY_NULL_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Utility/Synch/Policy/Null.ipp b/ACE/contrib/utility/Utility/Synch/Policy/Null.ipp
new file mode 100644
index 00000000000..dbc4c78b698
--- /dev/null
+++ b/ACE/contrib/utility/Utility/Synch/Policy/Null.ipp
@@ -0,0 +1,20 @@
+// file : Utility/Synch/Policy/Null.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace Synch
+ {
+ namespace Policy
+ {
+ inline NullGuard::
+ NullGuard (NullMutex&) throw ()
+ {
+ }
+ }
+ }
+}
+
+//$Id$
diff --git a/ACE/contrib/utility/Vault/StringConverter.hpp b/ACE/contrib/utility/Vault/StringConverter.hpp
new file mode 100644
index 00000000000..0bcb94676b7
--- /dev/null
+++ b/ACE/contrib/utility/Vault/StringConverter.hpp
@@ -0,0 +1,27 @@
+// file : Utility/ExH/StringConverter.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_EX_H_STRING_CONVERTER_HPP
+#define UTILITY_EX_H_STRING_CONVERTER_HPP
+
+#include <string>
+
+#include "Utility/ExH/Converter.hpp"
+
+namespace Utility
+{
+ namespace ExH
+ {
+ template <>
+ char const*
+ converter (std::string const& t) throw ();
+ }
+}
+
+#include "Utility/ExH/StringConverter.ipp"
+
+#endif // UTILITY_EX_H_STRING_CONVERTER_HPP
+
+//$Id$
diff --git a/ACE/contrib/utility/Vault/StringConverter.ipp b/ACE/contrib/utility/Vault/StringConverter.ipp
new file mode 100644
index 00000000000..c508c8c752a
--- /dev/null
+++ b/ACE/contrib/utility/Vault/StringConverter.ipp
@@ -0,0 +1,18 @@
+// file : Utility/ExH/StringConverter.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ExH
+ {
+ template <>
+ inline char const*
+ converter (std::string const& t) throw ()
+ {
+ return t.c_str ();
+ }
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Vault/hetero/map b/ACE/contrib/utility/Vault/hetero/map
new file mode 100644
index 00000000000..0a6113e5c31
--- /dev/null
+++ b/ACE/contrib/utility/Vault/hetero/map
@@ -0,0 +1,13 @@
+// file : Utility/hetero/map
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_HETERO_MAP
+#define UTILITY_HETERO_MAP
+
+#include "Utility/hetero/map.hpp"
+
+#endif // UTILITY_HETERO_MAP
+
+// $Id$
diff --git a/ACE/contrib/utility/Vault/hetero/map.hpp b/ACE/contrib/utility/Vault/hetero/map.hpp
new file mode 100644
index 00000000000..2959c06fbd8
--- /dev/null
+++ b/ACE/contrib/utility/Vault/hetero/map.hpp
@@ -0,0 +1,249 @@
+// file : Utility/hetero/map.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#ifndef UTILITY_HETERO_MAP_HPP
+#define UTILITY_HETERO_MAP_HPP
+
+#include <typeinfo>
+#include <map>
+
+namespace Utility
+{
+ namespace hetero
+ {
+ template <typename Key>
+ class map
+ {
+ private:
+ struct ValueBase
+ {
+ virtual
+ ~ValueBase () {}
+ };
+
+ template <typename T>
+ class Value : public ValueBase
+ {
+ public:
+ Value (T const& t)
+ : t_ (t)
+ {
+ }
+
+ T t_;
+ };
+
+ typedef
+ std::map<Key, ValueBase*>
+ ValueMap;
+
+ typedef
+ typename std::map<Key, ValueBase*>::value_type
+ ValueType;
+
+ public:
+
+ class Typing {};
+
+ template <typename T>
+ struct type
+ {
+ typedef std::pair <Key const, T> value_type;
+ };
+
+ template <typename First>
+ struct Pair
+ {
+ First first;
+
+ Pair ()
+ : first (),
+ second_ (0)
+ {
+ }
+
+ Pair (First const& k, ValueBase* v)
+ : first (k),
+ second_ (v)
+ {
+ }
+
+ template <typename T>
+ T&
+ second ()
+ {
+ Value<T>* v = dynamic_cast<Value<T>*> (second_);
+ if (v == 0) throw Typing ();
+
+ return v->t_;
+ }
+
+ template <typename T>
+ T const&
+ second () const
+ {
+ Value<T>* v = dynamic_cast<Value<T>*> (second_);
+ if (v == 0) throw Typing ();
+
+ return v->t_;
+ }
+
+ private:
+ ValueBase* second_;
+ };
+
+ friend
+ class iterator
+ {
+ public:
+ iterator (typename ValueMap::iterator const& i)
+ : i_ (i)
+ {
+ }
+
+ public:
+
+ Pair<Key>&
+ operator* ()
+ {
+ current_ = Pair<Key> (i_->first, i_->second);
+ return current_;
+ }
+
+ Pair<Key>*
+ operator-> ()
+ {
+ current_ = Pair<Key> (i_->first, i_->second);
+ return &current_;
+ }
+
+ public:
+ bool
+ operator== (iterator const& other)
+ {
+ return i_ == other.i_;
+ }
+
+ bool
+ operator!= (iterator const& other)
+ {
+ return i_ != other.i_;
+ }
+
+ private:
+ typename ValueMap::iterator i_;
+ Pair<Key> current_;
+ };
+
+
+ friend
+ class const_iterator
+ {
+ public:
+ const_iterator (typename ValueMap::const_iterator const& i)
+ : i_ (i)
+ {
+ }
+
+ public:
+
+ Pair<Key> const&
+ operator* ()
+ {
+ current_ = Pair<Key> (i_->first, i_->second);
+ return current_;
+ }
+
+ Pair<Key> const*
+ operator-> ()
+ {
+ current_ = Pair<Key> (i_->first, i_->second);
+ return &current_;
+ }
+
+ public:
+ bool
+ operator== (const_iterator const& other)
+ {
+ return i_ == other.i_;
+ }
+
+ bool
+ operator!= (const_iterator const& other)
+ {
+ return i_ != other.i_;
+ }
+
+ private:
+ typename ValueMap::const_iterator i_;
+ Pair<Key> current_;
+ };
+
+ public:
+ iterator
+ begin ()
+ {
+ return iterator (map_.begin ());
+ }
+
+ const_iterator
+ begin () const
+ {
+ return const_iterator (map_.begin ());
+ }
+
+ iterator
+ end ()
+ {
+ return iterator (map_.end ());
+ }
+
+ const_iterator
+ end () const
+ {
+ return const_iterator (map_.end ());
+ }
+
+ public:
+
+ template <typename T>
+ bool
+ insert (std::pair <Key, T> const& x)
+ {
+ ValueType v (x.first, new Value<T> (x.second));
+ return map_.insert (v).second;
+ }
+
+ template <typename T>
+ bool
+ insert (Key const& k, T const& t)
+ {
+ ValueType v (k, new Value<T> (t));
+ return map_.insert (v).second;
+ }
+
+ public:
+ iterator
+ find (Key const& k)
+ {
+ return iterator (map_.find (k));
+ }
+
+ const_iterator
+ find (Key const& k) const
+ {
+ return const_iterator (map_.find (k));
+ }
+
+ private:
+ ValueMap map_;
+ };
+ }
+}
+
+#include "Utility/hetero/map.tpp"
+
+#endif // UTILITY_HETERO_MAP_HPP
+//$Id$
diff --git a/ACE/contrib/utility/Vault/hetero/map.tpp b/ACE/contrib/utility/Vault/hetero/map.tpp
new file mode 100644
index 00000000000..f2e0dfe69b8
--- /dev/null
+++ b/ACE/contrib/utility/Vault/hetero/map.tpp
@@ -0,0 +1,12 @@
+// file : utility/hetero/map.tpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace hetero
+ {
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Version b/ACE/contrib/utility/Version
new file mode 100644
index 00000000000..937a6c086f5
--- /dev/null
+++ b/ACE/contrib/utility/Version
@@ -0,0 +1,3 @@
+1.2.2
+
+$Id$
diff --git a/ACE/contrib/utility/license.html b/ACE/contrib/utility/license.html
new file mode 100644
index 00000000000..89388e0aff1
--- /dev/null
+++ b/ACE/contrib/utility/license.html
@@ -0,0 +1,79 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+
+file : kolpackov.net/license.html
+author : Boris Kolpackov <boris@kolpackov.net>
+copyright : Copyright (c) 2003 Boris Kolpackov
+license : http://kolpackov.net/license.html
+
+-->
+
+<html>
+
+<head>
+
+ <title>kolpackov.net/license.html</title>
+
+ <meta name="author" content="Boris Kolpackov"/>
+ <meta name="copyright" content="&copy; 2001-2003 Boris Kolpackov"/>
+ <meta name="keywords" content="Boris,Kolpackov,Kolpakov,software,license,copyright"/>
+ <meta name="description" content="software license"/>
+ <meta http-equiv="Content-Language" content="en"/>
+
+ <style type="text/css">
+ body {
+ font-family: monospace;
+ }
+ </style>
+
+</head>
+
+<body>
+
+<div align="left">
+<table width="640" border="0" cellspacing="0" cellpadding="0">
+<tr>
+<td>
+
+ <p>This software or documentation is provided 'as-is', without any
+ express or implied warranty. In no event will the author or contributors
+ be held liable for any damages arising from the use of this software
+ or documentation.</p>
+
+ <p>Permission is granted to anyone to use this software or documentation
+ for any purpose, including commercial applications, and to alter it and
+ redistribute it freely, subject to the following restrictions:</p>
+
+<blockquote>
+
+ <p>1. The origin of this software or documentation must not be
+ misrepresented; you must not claim that you wrote the original
+ software or documentation. If you use this software or
+ documentation in a product, an acknowledgment in the product
+ documentation would be appreciated but is not required.</p>
+
+ <p>2. Altered source versions must be plainly marked as such, and must
+ not be misrepresented as being the original software or documentation.
+ Altered source versions may be contributed back to the author to be
+ integrated into the original software or documentation at the
+ author's discretion.</p>
+
+ <p>3. Neither this notice or reference to it nor any copyright, author or
+ contributor clause may be removed from or altered in any software
+ source distribution or documentation covered by this license.</p>
+
+ <p>4. Neither the name of the author, nor the names of contributors may be
+ used to endorse or promote products derived from this software or
+ documentation without specific prior written permission.</p>
+
+</blockquote>
+
+</td>
+</tr>
+</table>
+</div>
+</body>
+</html>
+
+<!-- $Id$ -->