[Mobies-commit] [commit] r3828 - in UDM/trunk/src/UIntWizVS: Scripts/1033 Templates/1033

ksmyth at redhat1.isis.vanderbilt.edu ksmyth at redhat1.isis.vanderbilt.edu
Tue Aug 16 11:36:56 CDT 2011


Author: ksmyth
Date: Tue Aug 16 11:36:55 2011
New Revision: 3828

Log:
GME10 compat, print to stdout and stderr if not running in GME

Modified:
   UDM/trunk/src/UIntWizVS/Scripts/1033/default.js
   UDM/trunk/src/UIntWizVS/Templates/1033/UdmConsole.cpp
   UDM/trunk/src/UIntWizVS/Templates/1033/UdmConsole.h

Modified: UDM/trunk/src/UIntWizVS/Scripts/1033/default.js
==============================================================================
--- UDM/trunk/src/UIntWizVS/Scripts/1033/default.js	Mon Aug 15 16:54:48 2011	(r3827)
+++ UDM/trunk/src/UIntWizVS/Scripts/1033/default.js	Tue Aug 16 11:36:55 2011	(r3828)
@@ -260,7 +260,7 @@
             // DEBUG COMPILER SETTINGS
 		    var CLTool = config.Tools('VCCLCompilerTool');
 		    CLTool.Optimization = optimizeOption.optimizeDisabled;
-		    CLTool.AdditionalIncludeDirectories = ".;$(GME_ROOT)/SDK/BON/Common;$(UDM_PATH)/include;$(GME_ROOT)/Interfaces;$(GME_ROOT)/Gme/Interfaces";
+		    CLTool.AdditionalIncludeDirectories = ".;$(GME_ROOT)/SDK/BON/Common;$(UDM_PATH)/include;$(GME_ROOT)/Interfaces;$(GME_ROOT)/Gme/Interfaces;$(GME_ROOT)\\GME\\Gme";
 		    CLTool.PreprocessorDefinitions = "WIN32;_DEBUG;_WINDOWS;_USRDLL";
 		    CLTool.BasicRuntimeChecks = basicRuntimeCheckOption.runtimeBasicCheckAll;
 		    CLTool.RuntimeLibrary = runtimeLibraryOption.rtMultiThreadedDebugDLL;
@@ -322,7 +322,7 @@
 		    // RELEASE COMPILER SETTINGS
 		    var CLTool = config.Tools('VCCLCompilerTool');
 		    CLTool.Optimization = optimizeOption.optimizeMaxSpeed;
-		    CLTool.AdditionalIncludeDirectories = ".;$(GME_ROOT)/SDK/BON/Common;$(UDM_PATH)/include;$(GME_ROOT)/Interfaces;$(GME_ROOT)/Gme/Interfaces";
+		    CLTool.AdditionalIncludeDirectories = ".;$(GME_ROOT)/SDK/BON/Common;$(UDM_PATH)/include;$(GME_ROOT)/Interfaces;$(GME_ROOT)/Gme/Interfaces;$(GME_ROOT)\\GME\\Gme";
 		    CLTool.PreprocessorDefinitions = "WIN32;NDEBUG;_WINDOWS;_USRDLL";
 		    CLTool.RuntimeLibrary = runtimeLibraryOption.rtMultiThreadedDLL;
 		    CLTool.TreatWChar_tAsBuiltInType = "true";

Modified: UDM/trunk/src/UIntWizVS/Templates/1033/UdmConsole.cpp
==============================================================================
--- UDM/trunk/src/UIntWizVS/Templates/1033/UdmConsole.cpp	Mon Aug 15 16:54:48 2011	(r3827)
+++ UDM/trunk/src/UIntWizVS/Templates/1033/UdmConsole.cpp	Tue Aug 16 11:36:55 2011	(r3828)
@@ -7,7 +7,7 @@
 {
 	CComPtr<IGMEOLEApp> Console::gmeoleapp=0;
 
-	void Console::SetupConsole(CComPtr<IMgaProject> project)
+	void Console::setupConsole(CComPtr<IMgaProject> project)
 	{
 		CComPtr<IMgaClient> client;	
 		CComQIPtr<IDispatch> pDispatch;

Modified: UDM/trunk/src/UIntWizVS/Templates/1033/UdmConsole.h
==============================================================================
--- UDM/trunk/src/UIntWizVS/Templates/1033/UdmConsole.h	Mon Aug 15 16:54:48 2011	(r3827)
+++ UDM/trunk/src/UIntWizVS/Templates/1033/UdmConsole.h	Tue Aug 16 11:36:55 2011	(r3828)
@@ -3,10 +3,12 @@
 #include "ComHelp.h"
 #include "GMECOM.h"
 #include "UdmBase.h"
-#include "UdmFormatter.h"
 #include <string>
+#include "GMEVersion.h"
 
+#if GME_VERSION_MAJOR >= 11
 #include "Gme.h"
+#endif
 
 namespace GMEConsole
 {
@@ -14,24 +16,47 @@
 	{
 	friend class RawComponent;
 
+#if GME_VERSION_MAJOR <= 10 && GME_VERSION_MINOR <= 2
+	private:
+#else
 	public:
-		static void SetupConsole(CComPtr<IMgaProject> project); 
+#endif
 		static CComPtr<IGMEOLEApp> gmeoleapp;
+	public:
+		static void setupConsole(CComPtr<IMgaProject> project);
+		static void freeConsole()
+		{
+			if(gmeoleapp!=0)
+			{
+				gmeoleapp.Release();
+				gmeoleapp=0;
+			}
+		}
+		static void SetupConsole(CComPtr<IMgaProject> project) { setupConsole(project); }
 
 		static void writeLine(const std::string& message, msgtype_enum type)
 		{
-			if(S_OK != gmeoleapp->ConsoleMessage( CComBSTR(message.length(),message.c_str()),type))
-				throw udm_exception("Could not write GME console.");
+			if (gmeoleapp == 0) {
+				switch (type) {
+				case MSG_NORMAL:
+				case MSG_INFO:
+				case MSG_WARNING:
+					_tprintf("%s", message.c_str());
+					break;
+				case MSG_ERROR:
+					_ftprintf(stderr, "%s", message.c_str());
+					break;
+				}
+			} else {
+				if(S_OK != gmeoleapp->ConsoleMessage( CComBSTR(message.length(),message.c_str()),type))
+					throw udm_exception("Could not write GME console.");
+			}
 		}
 
 		static void clear()
 		{
-			/* Does not work:
-			if(S_OK != gmeoleapp->ConsoleClear())
-				throw udm_exception("Could not clear GME console.");
-				*/
-			CComBSTR empty(L"");
-			gmeoleapp->put_ConsoleContents(empty);
+			if(gmeoleapp!=0)
+				gmeoleapp->put_ConsoleContents(NULL);
 		}
 
 		static void setContents(const std::string& contents)


More information about the Mobies-commit mailing list