int wmain(int argc, wchar_t* argv[]) { CArguments args; if(!args.Parse(argc, argv)) { _putws(g_wszUsage); return 1; } CTokenReader tokenReader; return 0; }
bool CChangeArgumentsAction::ActionPerformed(CEntity* pEntity) { CString command; CString results; bool bRes = false; if(CImpactAction::ActionPerformed(pEntity)==true) { CString command = "args " + PrepareQuery(pEntity->GetEtag()); results = m_pCtrl->ExecCommand(command); CArguments Args; Args.Parse(results); CArgumentsInfoDlg dlg(m_pCtrl); dlg.SetArguments(&Args); int nRes = dlg.DoModal(); if(nRes == IDOK) { CString szArguments = "("; CArguments* pArgs = dlg.GetArguments(); POSITION nPos = pArgs->GetHeadPosition(); while(nPos!=NULL) { CArgument* pArg = pArgs->GetNext(nPos); szArguments += pArg->GetType(); szArguments += " "; szArguments += pArg->GetName(); if(nPos!=NULL) szArguments += ","; } szArguments += ")"; CString description = GetName(); description += " to " + szArguments; SetDescription(description); command = "Impact:ChangeFunctionArguments " + PrepareQuery(pEntity->GetEtag()) + " " + PrepareQuery(szArguments); results = m_pCtrl->ExecPrint(command); ParseResult(results); bRes = true; } else { SetExecuted(false); } } return bRes; }
static void AcmCmdFunc_LsDomain(CCmdSession* pSession, const char *sCmdLine, const char* sCmdArg) { CArguments oArgs; oArgs.SetCmdLine(sCmdLine); int32 nArgc = oArgs.GetArgc(); if(nArgc == 1) { CVector<uint32> oDomains; CAcmUdp::GetAllDomains(oDomains); uint32 nSize = oDomains.GetSize(); pSession->Print("There are %u domains:\r\n", nSize); for(uint32 i=0; i<nSize; ++i) { uint32 nDomain = oDomains[i]; pSession->Print("\tDomain:%u\r\n", nDomain); } pSession->Print("\r\n"); } else if(nArgc == 2) { const char* sArg = oArgs.GetArgv()[1]; uint32 nDomain = CString::Atoi(sArg); CAcmUdp* pUdp = CAcmUdp::QueryUdp(nDomain); if(pUdp == NULL) pSession->Print("There isn't the domain '%u'\r\n", nDomain); else { if(pUdp->IsMultiCast()) { CIpAddr oAddr; CString oFileName; uint32 nTTL = pUdp->GetMultiCastAddr(oAddr); CFile::GetIpFileName(oAddr, oFileName); pSession->Print("The domain %u is multicast domain, and the multicast addr is %s, and the TTL is %u\r\n", nDomain, oFileName.GetStr(), nTTL); } else pSession->Print("The domain %u is unicast domain\r\n", nDomain); CAcmService* pService = (CAcmService*)CServiceManager::GetInstance()->QueryService("AcmService"); pService->SetSession(pSession); pUdp->Walk(); uint32 nSize = pService->GetWalkSize(); pSession->Print("There are %u nodes in the domain %u\r\n", nSize, nDomain); } } }
static void AcmCmdFunc_LsSerial(CCmdSession* pSession, const char *sCmdLine, const char* sCmdArg) { CArguments oArgs; oArgs.SetCmdLine(sCmdLine); int32 nArgc = oArgs.GetArgc(); if(nArgc == 1) pSession->Print("This lack of domain parameters\r\n"); else { const char* sArg = oArgs.GetArgv()[1]; uint32 nDomain = CString::Atoi(sArg); CAcmUdp* pUdp = CAcmUdp::QueryUdp(nDomain); if(pUdp == NULL) pSession->Print("There isn't the domain '%u'\r\n", nDomain); else { CAcmSequenceModule* pModule = (CAcmSequenceModule*)pUdp->QueryModule(ACM_SERIAL_MODULE); if(pModule == NULL) pSession->Print("This domain %u doesn't support the serial function\r\n", nDomain); else { bool bSupportSend = pModule->SupportSend(); bool bSupportRecv = pModule->SupportRecv(); bool bSupportAck = pModule->SupportUniCastSend(); uint32 nCapacity = 0, nRecvCapacity, nSendCapacity, nRecvSize, nSendSize; nRecvCapacity = pModule->GetRecvCapacity(nRecvSize); nSendCapacity = pModule->GetRecvCapacity(nSendSize); if(nRecvCapacity) nCapacity = nRecvCapacity; else if(nSendCapacity) nCapacity = nSendCapacity; pSession->Print("This domain %u", nDomain); if(bSupportSend) { pSession->Print(" supports serial send"); if(bSupportAck) pSession->Print("(ack)"); } if(bSupportRecv) { if(bSupportSend) pSession->Print(", and serial receive"); else pSession->Print(" supports serial receive"); } pSession->Print("\r\nThe capacity is %u\r\n", nCapacity); if(bSupportAck) pSession->Print("the send queue is %u\r\n", nSendSize); if(bSupportRecv) pSession->Print("the receive queue is %u\r\n", nRecvSize); CAcmService* pService = (CAcmService*)CServiceManager::GetInstance()->QueryService("AcmService"); pService->SetSession(pSession); pModule->Walk(*pService); uint32 nSize = pService->GetWalkSize(); pSession->Print("There are %u nodes in the serial domain %u\r\n", nSize, nDomain); pUdp->ReleaseModule(ACM_SERIAL_MODULE); } } } }
static bln ArgsTestCmd( const CArguments *ags ) { CArguments args; args.AddAgsAL( "124.45 fp" ); args.AddAgsAL( "124 dec" ); args.AddAgsAL( "254e str" ); args.AddAgsAL( "245.e str" ); args.AddAgsAL( "2134234e5 fp" ); args.AddAgsAL( "32523.e235 fp" ); args.AddAgsAL( "23525e+ str" ); args.AddAgsAL( "2342e+5 fp" ); args.AddAgsAL( "213525e+15.5 str" ); args.AddAgsAL( "3434.e-235 fp" ); args.AddAgsAL( "23523.2135e-445 fp" ); args.AddAgsAL( ".e+18 str" ); args.AddAgsAL( "..e+18 str" ); args.AddAgsAL( ".ee+18 str" ); args.AddAgsAL( ".e++18 str" ); args.AddAgsAL( "+.e+18 str" ); args.AddAgsAL( "-.e+18 str" ); args.AddAgsAL( ".e+-18 str" ); args.AddAgsAL( ".4e+18 fp" ); args.AddAgsAL( "+.4e+18 fp" ); args.AddAgsAL( "-.4e+18 fp" ); args.AddAgsAL( ".4ee+18 str" ); args.AddAgsAL( "..4e+18 str" ); args.AddAgsAL( ".4e+-18 str" ); args.AddAgsAL( ".4e++18 str" ); args.AddAgsAL( "0x45 hex" ); args.AddAgsAL( "0x4fe hex" ); args.AddAgsAL( "0x4aq str" ); args.AddAgsAL( "0x str" ); args.AddAgsAL( " str" ); args.AddAgsAL( "0b00101 bin" ); args.AddAgsAL( "0b02w str" ); args.AddAgsAL( "0b str" ); return CommandsManager::ExecuteCommand( "agsparsertest", &args ); }