summaryrefslogtreecommitdiff
path: root/cpp/src/slice2docbook/Gen.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2008-01-18 10:27:58 -0330
committerDwayne Boone <dwayne@zeroc.com>2008-01-18 10:27:58 -0330
commit40da4a3aecbc259c472d77f58d1d6466af42e5ef (patch)
tree3780215d0441c84682c9c281b3187b78973a6b9e /cpp/src/slice2docbook/Gen.cpp
parentAdded Windows signal handling (diff)
downloadice-40da4a3aecbc259c472d77f58d1d6466af42e5ef.tar.bz2
ice-40da4a3aecbc259c472d77f58d1d6466af42e5ef.tar.xz
ice-40da4a3aecbc259c472d77f58d1d6466af42e5ef.zip
Windows fixes for translator interrupt cleanup
Diffstat (limited to 'cpp/src/slice2docbook/Gen.cpp')
-rw-r--r--cpp/src/slice2docbook/Gen.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/cpp/src/slice2docbook/Gen.cpp b/cpp/src/slice2docbook/Gen.cpp
index 926c4f4e434..3f634dbef1f 100644
--- a/cpp/src/slice2docbook/Gen.cpp
+++ b/cpp/src/slice2docbook/Gen.cpp
@@ -9,6 +9,7 @@
#include <IceUtil/DisableWarnings.h>
#include <IceUtil/Functional.h>
+#include <Slice/SignalHandler.h>
#include <Gen.h>
#ifdef __BCPLUSPLUS__
@@ -20,12 +21,28 @@ using namespace Slice;
using namespace IceUtil;
using namespace IceUtilInternal;
+//
+// Callback for Crtl-C signal handling
+//
+static Gen* _gen = 0;
+
+static void closeCallback()
+{
+ if(_gen != 0)
+ {
+ _gen->closeOutput();
+ }
+}
+
Slice::Gen::Gen(const string& name, const string& file, bool standAlone, bool chapter,
bool noIndex, bool sortFields) :
_standAlone(standAlone),
_noIndex(noIndex),
_sortFields(sortFields)
{
+ _gen = this;
+ SignalHandler::setCallback(closeCallback);
+
if(chapter)
{
_chapter = "chapter";
@@ -45,6 +62,7 @@ Slice::Gen::Gen(const string& name, const string& file, bool standAlone, bool ch
Slice::Gen::~Gen()
{
+ SignalHandler::setCallback(0);
}
bool
@@ -67,6 +85,12 @@ Slice::Gen::generate(const UnitPtr& p)
p->visit(this, false);
}
+void
+Slice::Gen::closeOutput()
+{
+ O.close();
+}
+
bool
Slice::Gen::visitUnitStart(const UnitPtr& p)
{