]> OCCT Git - occt-wok.git/commitdiff
0024713: adopt WOK for tcl8.6
authorkgv <kgv@opencascade.com>
Tue, 11 Mar 2014 14:37:05 +0000 (18:37 +0400)
committerabv <abv@opencascade.com>
Wed, 28 May 2014 05:34:30 +0000 (09:34 +0400)
src/WOKSH/wokprocess.cxx
src/WOKSH/woksh.cxx
src/WOKTCL/WOKTCL_Interpretor.cxx
src/WOKTclTools/WOKTclTools_Interpretor.cxx

index 802380b4524dc24cd38c49c6a1558208548c9433..7a35001ea19b7be143bf08d43450e21243e00ee1 100755 (executable)
@@ -5,11 +5,17 @@
 
 #include <tcl.h>
 
-#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 <Standard_ErrorHandler.hxx>
 #include <Standard_Failure.hxx>
index 912de228904c647fd6752382b9785291e3f961ad..605fb1034c8aca5770f346b1a53428ce06394d91 100755 (executable)
@@ -3,16 +3,19 @@
 // Author:     Jean GAUTIER
 //             <jga@cobrax>
 
-
-
-
-
 #include <tcl.h>
 
-#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
index f867cfd26602d15bf018a89dd2ebb14929de3f4a..db66e872895bb3e6a9230e85a92440c1b3bd7b52 100755 (executable)
 #include <WOKTools_ChDirValue.hxx>
 #include <WOKTools_Messages.hxx>
 
-#ifdef WNT
-#include <WOKUtils_ShellManager.hxx>
-#define WOKUtils_ProcessManager WOKUtils_ShellManager
+#ifdef _WIN32
+  #include <WOKUtils_ShellManager.hxx>
+  #define WOKUtils_ProcessManager WOKUtils_ShellManager
 #else
-#include <WOKUtils_ProcessManager.hxx>
-#endif  // WNT
+  #include <WOKUtils_ProcessManager.hxx>
+#endif
 
 #include <TCollection_HAsciiString.hxx>
 
 
 #include <WOKTCL_DefaultCommand.hxx>
 
+// 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  : 
index 13805ba1c87d1aa1edfabbbdd3f4a848d8d33eaf..61b87f210e78380d1ac81f25183880620fd48cfb 100755 (executable)
@@ -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<argc; i++)
     {