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/slice2cs/Gen.cpp | |
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/slice2cs/Gen.cpp')
-rwxr-xr-x | cpp/src/slice2cs/Gen.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index a68b54f7da5..9c7dffbc7e6 100755 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -39,6 +39,19 @@ using IceUtilInternal::eb; using IceUtilInternal::spar; using IceUtilInternal::epar; +// +// Callback for Crtl-C signal handling +// +static Gen* _gen = 0; + +static void closeCallback() +{ + if(_gen != 0) + { + _gen->closeOutput(); + } +} + static string // Should be an anonymous namespace, but VC++ 6 can't handle that. sliceModeToIceMode(Operation::Mode opMode) { @@ -1059,6 +1072,9 @@ Slice::Gen::Gen(const string& name, const string& base, const vector<string>& in : _includePaths(includePaths), _stream(stream) { + _gen = this; + SignalHandler::setCallback(closeCallback); + string fileBase = base; string::size_type pos = base.find_last_of("/\\"); if(pos != string::npos) @@ -1130,6 +1146,8 @@ Slice::Gen::~Gen() { _impl << '\n'; } + + SignalHandler::setCallback(0); } bool @@ -1240,6 +1258,13 @@ Slice::Gen::generateChecksums(const UnitPtr& u) } void +Slice::Gen::closeOutput() +{ + _out.close(); + _impl.close(); +} + +void Slice::Gen::printHeader() { static const char* header = |