diff options
Diffstat (limited to 'cpp/src/slice2cpp/Gen.cpp')
-rwxr-xr-x | cpp/src/slice2cpp/Gen.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 91473852683..c8f759b8170 100755 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -22,6 +22,19 @@ 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(); + } +} + static string getDeprecateSymbol(const ContainedPtr& p1, const ContainedPtr& p2) { @@ -50,6 +63,9 @@ Slice::Gen::Gen(const string& name, const string& base, const string& headerExte _stream(stream), _ice(ice) { + _gen = this; + SignalHandler::setCallback(closeCallback); + for(vector<string>::iterator p = _includePaths.begin(); p != _includePaths.end(); ++p) { if(p->length() && (*p)[p->length() - 1] != '/') @@ -163,6 +179,8 @@ Slice::Gen::~Gen() implH << "\n\n#endif\n"; implC << '\n'; } + + SignalHandler::setCallback(0); } bool @@ -381,6 +399,15 @@ Slice::Gen::generate(const UnitPtr& p) } void +Slice::Gen::closeOutput() +{ + H.close(); + C.close(); + implH.close(); + implC.close(); +} + +void Slice::Gen::writeExtraHeaders(IceUtilInternal::Output& out) { for(vector<string>::const_iterator i = _extraHeaders.begin(); i != _extraHeaders.end(); ++i) |