diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2008-01-18 10:27:58 -0330 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2008-01-18 10:27:58 -0330 |
commit | 40da4a3aecbc259c472d77f58d1d6466af42e5ef (patch) | |
tree | 3780215d0441c84682c9c281b3187b78973a6b9e /cpp/src/slice2html | |
parent | Added Windows signal handling (diff) | |
download | ice-40da4a3aecbc259c472d77f58d1d6466af42e5ef.tar.bz2 ice-40da4a3aecbc259c472d77f58d1d6466af42e5ef.tar.xz ice-40da4a3aecbc259c472d77f58d1d6466af42e5ef.zip |
Windows fixes for translator interrupt cleanup
Diffstat (limited to 'cpp/src/slice2html')
-rw-r--r-- | cpp/src/slice2html/Gen.cpp | 31 | ||||
-rw-r--r-- | cpp/src/slice2html/Gen.h | 2 |
2 files changed, 29 insertions, 4 deletions
diff --git a/cpp/src/slice2html/Gen.cpp b/cpp/src/slice2html/Gen.cpp index e477449255d..c3c51ae2868 100644 --- a/cpp/src/slice2html/Gen.cpp +++ b/cpp/src/slice2html/Gen.cpp @@ -30,15 +30,30 @@ using namespace Slice; using namespace IceUtil; using namespace IceUtilInternal; +// +// Callback for Crtl-C signal handling +// +static GeneratorBase* _genBase = 0; + +static void closeCallback() +{ + if(_genBase != 0) + { + _genBase->closeStream(); + } +} + + namespace Slice { void -generate(const UnitPtr& unit, const string& dir, - const string& header, const string& footer, - const string& indexHeader, const string& indexFooter, - const string& imageDir, const string& logoURL, const string& searchAction, unsigned indexCount, unsigned warnSummary) +generate(const UnitPtr& unit, const string& dir, const string& header, const string& footer, + const string& indexHeader, const string& indexFooter, const string& imageDir, const string& logoURL, + const string& searchAction, unsigned indexCount, unsigned warnSummary) { + SignalHandler::setCallback(closeCallback); + unit->mergeModules(); // @@ -197,10 +212,12 @@ Slice::GeneratorBase::setSymbols(const ContainedList& symbols) Slice::GeneratorBase::GeneratorBase(XMLOutput& o, const Files& files) : _out(o), _files(files) { + _genBase = this; } Slice::GeneratorBase::~GeneratorBase() { + _genBase = 0; } // @@ -1203,6 +1220,12 @@ Slice::GeneratorBase::openStream(const string& path) } } +void +Slice::GeneratorBase::closeStream() +{ + _out.close(); +} + string Slice::GeneratorBase::containedToId(const ContainedPtr& contained, bool asTarget) { diff --git a/cpp/src/slice2html/Gen.h b/cpp/src/slice2html/Gen.h index 665f08a08f5..fcdbc63bba4 100644 --- a/cpp/src/slice2html/Gen.h +++ b/cpp/src/slice2html/Gen.h @@ -36,6 +36,8 @@ public: static void warnSummary(int); static void setSymbols(const ContainedList&); + void closeStream(); + protected: GeneratorBase(::IceUtilInternal::XMLOutput&, const Files&); |