From 32151fc967a6c9ce4d926d328320d8d29546a809 Mon Sep 17 00:00:00 2001 From: kgv Date: Tue, 11 Mar 2014 18:37:05 +0400 Subject: [PATCH] 0024713: adopt WOK for tcl8.6 --- src/WOKSH/wokprocess.cxx | 16 +++++++++++----- src/WOKSH/woksh.cxx | 19 +++++++++++-------- src/WOKTCL/WOKTCL_Interpretor.cxx | 21 ++++++++++++++++----- src/WOKTclTools/WOKTclTools_Interpretor.cxx | 9 ++++++--- 4 files changed, 44 insertions(+), 21 deletions(-) diff --git a/src/WOKSH/wokprocess.cxx b/src/WOKSH/wokprocess.cxx index 802380b..7a35001 100755 --- a/src/WOKSH/wokprocess.cxx +++ b/src/WOKSH/wokprocess.cxx @@ -5,11 +5,17 @@ #include -#ifdef WNT -# pragma message( "Information: tcl"TCL_VERSION".lib is using as TCL library" ) -#endif // WNT - - +// on MSVC, use #pragma to define name of the Tcl library to link with, +// depending on Tcl version number +#ifdef _MSC_VER + // two helper macros are needed to convert version number macro to string literal + #define STRINGIZE1(a) #a + #define STRINGIZE2(a) STRINGIZE1(a) + #pragma comment (lib, "tcl" STRINGIZE2(TCL_MAJOR_VERSION) STRINGIZE2(TCL_MINOR_VERSION) ".lib") + #undef STRINGIZE2 + #undef STRINGIZE1 + #pragma message ("Information: tcl"TCL_VERSION".lib is using as TCL library") +#endif #include #include diff --git a/src/WOKSH/woksh.cxx b/src/WOKSH/woksh.cxx index 912de22..605fb10 100755 --- a/src/WOKSH/woksh.cxx +++ b/src/WOKSH/woksh.cxx @@ -3,16 +3,19 @@ // Author: Jean GAUTIER // - - - - #include -#ifdef WNT -# pragma message( "Information: tcl"TCL_VERSION".lib is using as TCL library" ) -#endif // WNT - +// on MSVC, use #pragma to define name of the Tcl library to link with, +// depending on Tcl version number +#ifdef _MSC_VER + // two helper macros are needed to convert version number macro to string literal + #define STRINGIZE1(a) #a + #define STRINGIZE2(a) STRINGIZE1(a) + #pragma comment (lib, "tcl" STRINGIZE2(TCL_MAJOR_VERSION) STRINGIZE2(TCL_MINOR_VERSION) ".lib") + #undef STRINGIZE2 + #undef STRINGIZE1 + #pragma message ("Information: tcl"TCL_VERSION".lib is using as TCL library") +#endif //extern "C" { //#ifdef NEED_MATHERR diff --git a/src/WOKTCL/WOKTCL_Interpretor.cxx b/src/WOKTCL/WOKTCL_Interpretor.cxx index f867cfd..db66e87 100755 --- a/src/WOKTCL/WOKTCL_Interpretor.cxx +++ b/src/WOKTCL/WOKTCL_Interpretor.cxx @@ -11,12 +11,12 @@ #include #include -#ifdef WNT -#include -#define WOKUtils_ProcessManager WOKUtils_ShellManager +#ifdef _WIN32 + #include + #define WOKUtils_ProcessManager WOKUtils_ShellManager #else -#include -#endif // WNT + #include +#endif #include @@ -28,6 +28,17 @@ #include +// on MSVC, use #pragma to define name of the Tcl library to link with, +// depending on Tcl version number +#ifdef _MSC_VER + // two helper macros are needed to convert version number macro to string literal + #define STRINGIZE1(a) #a + #define STRINGIZE2(a) STRINGIZE1(a) + #pragma comment (lib, "tcl" STRINGIZE2(TCL_MAJOR_VERSION) STRINGIZE2(TCL_MINOR_VERSION) ".lib") + #undef STRINGIZE2 + #undef STRINGIZE1 +#endif + //======================================================================= //function : WOKTCL_Interpretor //purpose : diff --git a/src/WOKTclTools/WOKTclTools_Interpretor.cxx b/src/WOKTclTools/WOKTclTools_Interpretor.cxx index 13805ba..61b87f2 100755 --- a/src/WOKTclTools/WOKTclTools_Interpretor.cxx +++ b/src/WOKTclTools/WOKTclTools_Interpretor.cxx @@ -471,7 +471,7 @@ Standard_Integer WOKTclTools_Interpretor::TreatReturn(const WOKTools_Return& ret //======================================================================= Standard_CString WOKTclTools_Interpretor::Result() const { - return myInterp->result; + return Tcl_GetStringResult (myInterp); } //======================================================================= @@ -487,8 +487,11 @@ Standard_Boolean WOKTclTools_Interpretor::GetReturnValues(WOKTools_Return& retva #else Standard_PCharacter* argv; #endif - - if(Tcl_SplitList(myInterp, myInterp->result, &argc, &argv)) return Standard_True; + + if (Tcl_SplitList (myInterp, Tcl_GetStringResult (myInterp), &argc, &argv)) + { + return Standard_True; + } for(i=0; i