Пример #1
0
/**
 * The base constructor sets up the default help and
 * version options that should be available on all platforms.
 */
BaseCmd::BaseCmd(int _argc, char* _argv[]) : desc("Allowed options")
{
	argc = _argc;
	argv = _argv;

	AddSwitch('h', "help", "This help message");
	AddSwitch('V', "version", "Display program version");
}
Пример #2
0
CmdLineParser :: CmdLineParser ()
   : wxCmdLineParser ()
{
   action   = Action_RUN;
   
   AddSwitch   ( "Install"    , wxEmptyString, "Install wxWidgets Service"             , wxCMD_LINE_PARAM_OPTIONAL );
   AddSwitch   ( "UnInstall"  , wxEmptyString, "UnInstall wxWidgets Service"           , wxCMD_LINE_PARAM_OPTIONAL );
   AddSwitch   ( "Debug"      , wxEmptyString, "Debug i.e. Run as Console Application" , wxCMD_LINE_PARAM_OPTIONAL );
}   
Пример #3
0
void wxCmdLineParser::SetDesc(const wxCmdLineEntryDesc *desc)
{
    for ( ;; desc++ )
    {
        switch ( desc->kind )
        {
            case wxCMD_LINE_SWITCH:
                AddSwitch(desc->shortName, desc->longName, desc->description,
                          desc->flags);
                break;

            case wxCMD_LINE_OPTION:
                AddOption(desc->shortName, desc->longName, desc->description,
                          desc->type, desc->flags);
                break;

            case wxCMD_LINE_PARAM:
                AddParam(desc->description, desc->type, desc->flags);
                break;

            default:
                wxFAIL_MSG( _T("unknown command line entry type") );
                // still fall through

            case wxCMD_LINE_NONE:
                return;
        }
    }
}
Пример #4
0
void CompilerMainPage::InitializeSwitches()
{
    // Clear content
    wxWindowUpdateLocker locker(m_listSwitches);
    m_listSwitches->DeleteAllItems();
    m_selSwitchName.Clear();
    m_selSwitchValue.Clear();

    // Validate compiler and add new content
    CHECK_PTR_RET(m_compiler);

    Compiler::ConstIterator iter = m_compiler->SwitchesBegin();
    for(; iter != m_compiler->SwitchesEnd(); iter++) {
        AddSwitch(iter->first, iter->second, iter == m_compiler->SwitchesBegin());
    }
    m_listSwitches->SetColumnWidth(0, wxLIST_AUTOSIZE);
}
Пример #5
0
BOOL SYSTEM::Init( )
{
    ERRCOD_T r = E_SUCC;
    xcpPtr = new Exception(32, EXCEPTION_LOG_FILE);
    if (NULL == xcpPtr)
    {
        LOG4CXX_ERROR(rootlog, "Not enough memory to create EXCEPTION object.");
        return FALSE;
    }

    /*
    * Read config
    */
    LOG4CXX_DEBUG(rootlog, "Reading configuration......");
    ReadConfig();

    /*
     * Create IPC agent object and try to register to SYSMGR.
     */
    ipcPtr = new CIPCClient;
    if (NULL == ipcPtr)
    {
        LOG4CXX_ERROR(rootlog, "Not enough memory to create IPCCLIENT!");
        return FALSE;
    }

    /*
    * Connect to DB
    */
    if(m_sConfigPara.ucDbEnable > 0)
    {
//		//start db thread
//		if(m_pDBThrd->start() < 0)
//		{
//            LOG4CXX_ERROR(rootlog, "Start DB thread failed!");
//			return FALSE;
//		}
//		else
//		{
//			LOG4CXX_DEBUG(rootlog, "Start DB thread OK, waiting thread initialize......");
//            int iRet = 0;
//            //
//            while(!m_pDBThrd->IsInitialized())
//            {
//                Delay(1, 0);
//            }
//            //
//            if(iRet < 0)
//            {
//                LOG4CXX_WARN(rootlog, "DB thread initialize failed!");
//            }
//            else
//            {
//                LOG4CXX_DEBUG(rootlog, "DB thread initialize OK!");
//            }
//		}
    }

    //解除被SYBASE屏蔽的信号
    sigset_t newmask, oldmask;
    sigemptyset(&newmask);
    sigaddset(&newmask, SIGINT);
    sigaddset(&newmask, SIGQUIT);
    sigaddset(&newmask, SIGTERM);
    sigaddset(&newmask, SIGALRM);
    //unblock SIGINT/SIGQUIT/SIGTERM/SIGALRM and save current signal mask
    if (sigprocmask(SIG_UNBLOCK, &newmask, &oldmask) < 0)
    {
        LOG4CXX_WARN(rootlog, "Unblock SIGINT/SIGQUIT/SIGTERM/SIGALRM failed: "<<strerror(errno));
    }
    //
//    /*
//    * Start packet preprocess thread
//    */
//    if(m_pPrePThrd->start() < 0)
//    {
//        LOG4CXX_ERROR(rootlog, "Start packet preprocess thread failed!");
//        return FALSE;
//    }

    //initialize switch
    vector<SSPC>::iterator it = sysPtr->getSysCfg().spcs.begin();
    for(; it != sysPtr->getSysCfg().spcs.end(); ++it)
    {
        AddSwitch(it->spc, it->aspc, it->spcType, it->mssID, it->switchCenterID);
    }
    //map ip to switch
    MapIP2Switch();
    //
    for(int ii = 0; ii < MAX_SWITCH_CNT; ++ii)
    {
        if(NULL != m_pSwitchs[ii]) m_pSwitchs[ii]->start();
    }
    //
    return TRUE;
}