コード例 #1
0
ファイル: main.cpp プロジェクト: mgaldzic/antimony
int main(int argc, char *argv[])
{

#ifdef SBW_INTEGRATION
  bool sbwon = true;

	static const char* Name("QTAntimony");
	static const char* ServiceName("QTAntimony");
	static const char* DisplayName("QTAntimony 1.0");
	static const char* HelpString("Antimony analyzer");
	static const char* CategoryName("/Analysis");

	SBWCreateModuleImpl( Name, DisplayName, SBW_UniqueModule, HelpString);

	SBWModuleImplAddService( ServiceName, DisplayName, CategoryName, HelpString);

	SBWModuleImplSetHandler( ServiceName, doAnalysis, 0, "void doAnalysis(string)", 1, HelpString);
	
	int sbwModuleIndex = -1;
	try 
	{
		// register if neccessary
		for (int arg=1; arg<argc; arg++) 
		{
			std::string sArg(argv[arg]);
			if (sArg == "-sbwregister" || sArg == "--sbwregister")
			{
				SBWModuleImplRun(argc, argv, 1);
				return 0;
			}
			else if (sArg == "-sbwregister" || sArg == "--sbwregister")
				sbwModuleIndex = arg;
		}
		// otherwise enable SBW service
		SBWModuleImplEnableServices();
	}
	catch (...) 
	{
		sbwon = false;
	}

#endif

	qInstallMsgHandler(myMessageOutput);
	QTAntimony a(argc, argv);
  //QString sheet = a.styleSheet();
  //sheet.append("QMessageBox { messagebox-text-interaction-flags: 1 }");
  //a.setStyleSheet(sheet);

#ifdef SBW_INTEGRATION
	// install an event filter that will display a new window when SBML is loaded
	if (sbwon) {
		a.installEventFilter(&a);
	}
	else {
		a.SetUseSBW(false);
	}
	for (int arg=1; arg<argc; arg++) {
		if (sbwModuleIndex != arg) a.OpenFile(argv[arg]);
	}
#else
  a.SetUseSBW(false);
#endif
  if (argc==1) {
		a.NewWindow();
	}
  else {
    a.NewWindow(argv[1]);
  }

	return a.exec();
}
コード例 #2
0
ファイル: paraminfo.cpp プロジェクト: mildrock/dummy
BOOL CCoderParamInfo::ParseParam(int iArgNum, char** pszParams)
{
    if (iArgNum <= 1)
    {
        return FALSE;
    }
    for (int i = 1; i < iArgNum; i++)
    {
        BOOL bType = m_bJAVA || m_bAS || m_bCPP;
        CString sArg(pszParams[i]);

        if (!m_bHelp)
        {
            m_bHelp = !sArg.CompareNoCase("/h");
            if (m_bHelp)
            {
                return TRUE;
            }
        }

        if (!m_bSilence)
        {
            m_bSilence = !sArg.CompareNoCase("/s");
        }

        // determine output type
        if (!bType)
        {
            m_bJAVA = !sArg.CompareNoCase("/java");
            m_bAS   = !sArg.CompareNoCase("/as");
            m_bCPP  = !sArg.CompareNoCase("/cpp");
        }

        // get config file full path
        if (!m_bConfig)
        {
            m_bConfig = !sArg.CompareNoCase("/config");
            if (m_bConfig)
            {
                if (i + 1 < iArgNum)
                {
                    m_strConfigFullName = pszParams[++i];
                    continue;
                }
                else
                {
                    return FALSE;
                }
            }
        }

        // get output dir
        if (!m_bOutput)
        {
            m_bOutput = !sArg.CompareNoCase("/out");
            if (m_bOutput)
            {
                if (i + 1 < iArgNum)
                {
                    m_strOutputPath = pszParams[++i];
                    continue;
                }
                else
                {
                    return FALSE;
                }
            }
        }

        if ( 0==sArg.CompareNoCase("/net") )
        {
            if (i + 1 < iArgNum)
            {
                m_strCharsetNet = pszParams[++i];
                m_nCharsetNet   = GetCharsetIndex(m_strCharsetNet.GetString());
                continue;
            }
            else
            {
                return FALSE;
            }
        }

        auto nRet=sArg.CompareNoCase("/host");
        if (0==nRet)
        {
            if (i + 1 < iArgNum)
            {
                m_strCharsetHost = pszParams[++i];
                m_nCharsetHost   = GetCharsetIndex(m_strCharsetHost.GetString());
                continue;
            }
            else
            {
                return FALSE;
            }
        }

        if (!m_bSaveEnDe)
        {
            m_bSaveEnDe = !sArg.CompareNoCase("/ENDN");
        }

        if (!m_bCliEnDe)
        {
            m_bCliEnDe = !sArg.CompareNoCase("/CLI");
        }

        if (0 == m_nSidOffset && !sArg.CompareNoCase("/SID")) {
            m_nSidOffset = atoi(pszParams[++i]);
        }
    }

    return TRUE;
}