[commit] r2094 - in trunk/GME: Console Gme
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Tue Oct 30 16:40:11 CDT 2012
Author: ksmyth
Date: Tue Oct 30 16:40:11 2012
New Revision: 2094
Log:
Add /run: switch to run code in the console on startup (useful for debugging interpreters on specific models). Dont show welcome screen with /Automation.
Modified:
trunk/GME/Console/Console.odl
trunk/GME/Console/ConsoleCtl.cpp
trunk/GME/Console/ConsoleCtl.h
trunk/GME/Console/ScriptEdit.cpp
trunk/GME/Gme/GMEApp.cpp
trunk/GME/Gme/console.cpp
trunk/GME/Gme/console.h
Modified: trunk/GME/Console/Console.odl
==============================================================================
--- trunk/GME/Console/Console.odl Mon Oct 29 09:55:51 2012 (r2093)
+++ trunk/GME/Console/Console.odl Tue Oct 30 16:40:11 2012 (r2094)
@@ -48,6 +48,7 @@
[id(8)] void LoadScript(BSTR filename);
[id(9)] void RunLoadedScript();
[id(10)] void SetContents(BSTR Contents);
+ [id(11)] void RunCode(BSTR Code);
[id(DISPID_ABOUTBOX)] void AboutBox();
};
Modified: trunk/GME/Console/ConsoleCtl.cpp
==============================================================================
--- trunk/GME/Console/ConsoleCtl.cpp Mon Oct 29 09:55:51 2012 (r2093)
+++ trunk/GME/Console/ConsoleCtl.cpp Tue Oct 30 16:40:11 2012 (r2094)
@@ -62,6 +62,7 @@
DISP_FUNCTION(CConsoleCtrl, "LoadScript", LoadScript, VT_EMPTY, VTS_BSTR)
DISP_FUNCTION(CConsoleCtrl, "RunLoadedScript", RunScript, VT_EMPTY, VTS_NONE)
DISP_FUNCTION(CConsoleCtrl, "SetContents", SetContents, VT_EMPTY, VTS_BSTR)
+ DISP_FUNCTION(CConsoleCtrl, "RunCode", RunCode, VT_EMPTY, VTS_BSTR)
DISP_PROPERTY_EX_ID(CConsoleCtrl, "GetCWnd", 0x43576E64, GetCWnd, SetCWnd, VT_I8)
DISP_FUNCTION_ID(CConsoleCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
//}}AFX_DISPATCH_MAP
Modified: trunk/GME/Console/ConsoleCtl.h
==============================================================================
--- trunk/GME/Console/ConsoleCtl.h Mon Oct 29 09:55:51 2012 (r2093)
+++ trunk/GME/Console/ConsoleCtl.h Tue Oct 30 16:40:11 2012 (r2094)
@@ -30,6 +30,10 @@
~CConsoleCtrl();
void LoadScript(BSTR fileName);
void RunScript();
+ void RunCode(BSTR code)
+ {
+ m_edit.ExecuteScript(CString(code));
+ }
CHtmlCtrl m_browser;
CScriptEdit m_edit;
Modified: trunk/GME/Console/ScriptEdit.cpp
==============================================================================
--- trunk/GME/Console/ScriptEdit.cpp Mon Oct 29 09:55:51 2012 (r2093)
+++ trunk/GME/Console/ScriptEdit.cpp Tue Oct 30 16:40:11 2012 (r2094)
@@ -41,7 +41,7 @@
_bstr_t engine(L"JScript");
// _bstr_t engine(L"Python.AXScript.2");
COMTHROW(m_host->InitEngine(m_console->GetIDispatch(false), engine));
- this->LimitText( 256);
+ this->LimitText(1024 * 4);
this->SetWindowText( defPrompt); // to attract user attention
}
catch(hresult_exception &e)
Modified: trunk/GME/Gme/GMEApp.cpp
==============================================================================
--- trunk/GME/Gme/GMEApp.cpp Mon Oct 29 09:55:51 2012 (r2093)
+++ trunk/GME/Gme/GMEApp.cpp Tue Oct 30 16:40:11 2012 (r2094)
@@ -180,12 +180,14 @@
class CGMECommandLineInfo : public CCommandLineInfo {
public:
bool bNoProtect, bOpenLast;
+ CString run;
CGMECommandLineInfo() : bNoProtect(false), bOpenLast(false) { ; }
- virtual void ParseParam(const char* pszParam, BOOL bFlag, BOOL bLast) {
- if(bFlag && !strcmp(pszParam, "d")) bNoProtect = true;
- else if(bFlag && !strcmp(pszParam, "l")) bOpenLast = true;
- else if(bFlag && !strcmp(pszParam, "REGSERVER")) {
+ virtual void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast) {
+
+ if(bFlag && !wcsicmp(pszParam, L"d")) bNoProtect = true;
+ else if(bFlag && !wcsicmp(pszParam, L"l")) bOpenLast = true;
+ else if(bFlag && !wcsicmp(pszParam, L"REGSERVER")) {
TCHAR c[200];
GetModuleFileName(NULL, c, sizeof(c)/sizeof(c[0]));
CComPtr<ITypeLib> it;
@@ -193,11 +195,15 @@
if(hr == S_OK) { AfxMessageBox(_T("Registered")); exit(0); }
else { AfxMessageBox(_T("Registration error: ") + hr); exit(-1); }
}
- else if(bFlag && !strcmp(pszParam, "UNREGSERVER")) {
+ else if(bFlag && !wcsicmp(pszParam, L"UNREGSERVER")) {
HRESULT hr = UnRegisterTypeLib(__uuidof(__GmeLib), 1, 0, LANG_NEUTRAL, SYS_WIN32);
if(hr == S_OK) { AfxMessageBox(_T("Unregistered")); exit(0); }
else { AfxMessageBox(_T("Unregistration error: ") + hr); exit(-1); }
}
+ else if(bFlag && wcsnicmp(pszParam, L"run:", 4) == 0)
+ {
+ run = pszParam + 4;
+ }
else CCommandLineInfo::ParseParam(pszParam, bFlag, bLast);
}
@@ -537,11 +543,20 @@
OpenProject(m_RecentProjectList[0]);
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
return TRUE;
- }
+ } else if(cmdInfo.run != "")
+ {
+ if (CMainFrame::theInstance)
+ CMainFrame::theInstance->m_console.m_Console.RunCode(CComBSTR(cmdInfo.run));
+ return TRUE;
+ }
// Dispatch commands specified on the command line
//if (!ProcessShellCommand(cmdInfo))
// return FALSE;
+ if (!(cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated))
+ {
+ ShowWelcomeWindow();
+ }
return FALSE;
}
@@ -626,7 +641,7 @@
}
}
- OpenCommandLineProject() || ShowWelcomeWindow();
+ OpenCommandLineProject();
int retVal = 0;
if (bNoProtect) {
Modified: trunk/GME/Gme/console.cpp
==============================================================================
--- trunk/GME/Gme/console.cpp Mon Oct 29 09:55:51 2012 (r2093)
+++ trunk/GME/Gme/console.cpp Tue Oct 30 16:40:11 2012 (r2094)
@@ -84,4 +84,10 @@
static BYTE parms[] = VTS_BSTR;
InvokeHelper(7, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
url);
-}
\ No newline at end of file
+}
+
+void CConsole::RunCode(BSTR code)
+{
+ static BYTE parms[] = VTS_BSTR;
+ InvokeHelper(11, DISPATCH_METHOD, VT_EMPTY, NULL, parms, code);
+}
Modified: trunk/GME/Gme/console.h
==============================================================================
--- trunk/GME/Gme/console.h Mon Oct 29 09:55:51 2012 (r2093)
+++ trunk/GME/Gme/console.h Tue Oct 30 16:40:11 2012 (r2094)
@@ -53,6 +53,7 @@
void SetGMEApp(IDispatch *idp);
void SetGMEProj(IDispatch *idp);
void NavigateTo(LPCTSTR url);
+ void RunCode(BSTR code);
};
//{{AFX_INSERT_LOCATION}}
More information about the gme-commit
mailing list