コード例 #1
0
void ScriptingManager::OnScriptMenu(wxCommandEvent& event)
{
    MenuIDToScript::iterator it = m_MenuIDToScript.find(event.GetId());
    if (it == m_MenuIDToScript.end())
    {
        cbMessageBox(_("No script associated with this menu?!?"), _("Error"), wxICON_ERROR);
        return;
    }

    MenuBoundScript& mbs = it->second;

    // is it a function?
    if (mbs.isFunc)
    {
        try
        {
            SqPlus::SquirrelFunction<void> f(cbU2C(mbs.scriptOrFunc));
            f();
        }
        catch (SquirrelError exception)
        {
            DisplayErrors(&exception);
        }
        return;
    }

    // script loading below

    if (wxGetKeyState(WXK_SHIFT))
    {
        wxString script = ConfigManager::LocateDataFile(mbs.scriptOrFunc, sdScriptsUser | sdScriptsGlobal);
        Manager::Get()->GetEditorManager()->Open(script);
        return;
    }

    // run script
    try
    {
        if (!LoadScript(mbs.scriptOrFunc))
            cbMessageBox(_("Could not run script: ") + mbs.scriptOrFunc, _("Error"), wxICON_ERROR);
    }
    catch (SquirrelError exception)
    {
        DisplayErrors(&exception);
    }
}
コード例 #2
0
void CompilerMain::Compile()
{
	errorList.clear();
	if(QFile::exists("OutPut.j"))
		QFile::remove("OutPut.j");
	output = new QFile("OutPut.j");
	output->open( QIODevice::WriteOnly);
	outStream = new QTextStream(output);

	nextIDIndex = 0;
	nextTemp = 0;
	nextLabel = 0;
    currentScope = NULL;
	AddScope();

    nextTokenIndex= 0;
    qDebug ("Compiler Main");
    tokenList = new QVector<Token*>;

	if(QFile::exists("TEMPFILE"))
		QFile::remove("TEMPFILE");
	QFile input("TEMPFILE");
	input.open(QIODevice::WriteOnly);
	QTextStream inputStream(&input);
	inputStream<<editor->toPlainText();
	inputStream.flush();
	input.close();

	lexicalAnalyzer->StartLexing("TEMPFILE");
	syntaxAnalyzer->StartParsing();

	if(!errorList.isEmpty())
	{
		if(QFile::exists("OutPut.j"))
		QFile::remove("OutPut.j");
		DisplayErrors();
	}
	else
	{
		mainwindow->statusBar()->showMessage("Build Successful!");
	}

	if(QFile::exists("TEMPFILE"))
		QFile::remove("TEMPFILE");

}
コード例 #3
0
void
SVNListBase::ReceiveGoingAway
	(
	JBroadcaster* sender
	)
{
	if (sender == itsProcess)
		{
		itsProcess = NULL;
		DeleteLinks();

		DisplayErrors();
		if (itsDisplayState.vMax > 0)
			{
			RestoreDisplayState(itsDisplayState);
			}
		}
	else
		{
		JXStringList::ReceiveGoingAway(sender);
		}
}