• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ NextArg函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中NextArg函数的典型用法代码示例。如果您正苦于以下问题:C++ NextArg函数的具体用法?C++ NextArg怎么用?C++ NextArg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NextArg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Initialise

/* Initialise: initialise global data structures */
void Initialise(void)
{
   float weight;
   char *fn;

   CreateWordMap(mapFN,&wmap,1);
   SortWordMap(&wmap);

   weight = 1.0;
   CreateInputSet(&gstack,&wmap,&inSet);
   while (NextArg() == STRINGARG || NextArg() == FLOATARG) {
      if (NextArg() == FLOATARG)  
	 weight = GetFltArg();
      if (weight==0.0 || weight<-10000.0 || weight>10000.0)
         HError(-16719,"Unlikely ngram weight[%.4f]",weight);
      if (NextArg()!=STRINGARG)
         HError(16719,"Gram base file name expected");
      fn = GetStrArg();
      AddInputGFile(&inSet,fn,weight);
      if (trace&T_TOP)
         printf("Input file %s added, weight=%.4f\n",fn,weight);
   }
   if (nSize==0) 
      nSize = inSet.N;
}
开发者ID:2hanson,项目名称:voice_dialling,代码行数:26,代码来源:LFoF.c


示例2: main

int main(int argc, char *argv[])
{
   char *s;

   void Initialise(void);

   InitShell(argc,argv,lfof_version,lfof_vc_id);
   InitMem();
   InitMath();
   InitWave();
   InitLabel();
   InitWMap();
   InitGBase();
   InitPCalc();

   if (!InfoPrinted() && NumArgs() == 0)
      ReportUsage();
   if (NumArgs() == 0) Exit(EXIT_SUCCESS);

   SetConfParms();

   while (NextArg() == SWITCHARG) {
      s = GetSwtArg();
      if (strlen(s)!=1) 
         HError(16719,"Bad switch %s; must be single letter",s);
      switch(s[0]){
         case 'f':
            fofSize = GetChkedInt(1, 1000, s); break;
         case 'n':
            nSize = GetChkedInt(1, MAXNG, s); break;
         case 'T':
            trace = GetChkedInt(0,077,s); break;
         default:
            HError(16719,"LFoF: Unknown switch %s",s);
      }
   }
   if (NextArg() != STRINGARG)
      HError(16719,"LFoF: map file name expected");
   mapFN = GetStrArg();
   if (NextArg() != STRINGARG)
      HError(16719,"LFoF: FoF file name expected");
   fofFN = GetStrArg();
   Initialise();
   if (trace&T_TOP) {
      printf("Calculating FoF table\n"); fflush(stdout);
   }
   fofTab = CreateFoFTab(&gstack,fofSize,nSize);
   ComputeFoFTab(fofTab,nSize,&inSet);
   WriteFoFTab(fofFN,fofTab,NULL);

   Exit(EXIT_SUCCESS);
   return EXIT_SUCCESS; /* never reached -- make compiler happy */
}
开发者ID:2hanson,项目名称:voice_dialling,代码行数:53,代码来源:LFoF.c


示例3: fontpane_popup

void
fontpane_popup(int *psfont_adr, int *latexfont_adr, int *psflag_adr, void (*showfont_fn) (/* ??? */), Widget show_widget)
{
    DeclareArgs(2);
    Position	    xposn, yposn;
    Widget	    widg;

    font_ps_sel = psfont_adr;
    font_latex_sel = latexfont_adr;
    flag_sel = psflag_adr;
    font_setimage = showfont_fn;
    font_widget = show_widget;
    if (first_fontmenu) {
	first_fontmenu = False;	/* don't reposition it if user has already popped it */
	XtTranslateCoords(tool, CANVAS_WD/4, CANVAS_HT/4, &xposn, &yposn);
	FirstArg(XtNx, xposn);	/* position about 1/4 from upper-left corner of canvas */
	NextArg(XtNy, yposn);
	SetValues(ps_fontmenu);
	SetValues(latex_fontmenu);
    }
    widg = *flag_sel ? ps_fontmenu : latex_fontmenu;
    XtPopup(widg, XtGrabExclusive);
    /* if the file message window is up add it to the grab */
    file_msg_add_grab();
    /* insure that the most recent colormap is installed */
    set_cmap(XtWindow(widg));
    XSetWMProtocols(tool_d, XtWindow(widg), &wm_delete_window, 1);
}
开发者ID:coliveira,项目名称:xfignew,代码行数:28,代码来源:w_fontpanel.c


示例4: main

int main(int argc, char *argv[])
{
	char *s;

   Initialise(argc,argv);

	CreateHeap(&modelHeap, "Model heap",  MSTAK, 1, 0.0, 100000, 800000 );
   CreateHMMSet(&hset,&modelHeap,TRUE);

   while (NextArg() == SWITCHARG) {
      s = GetSwtArg();
      if (strlen(s)!=1)
         HError(3219,"HNetTest: Bad switch %s; must be single letter",s);
      switch(s[0]){

      case 'H':
         if (NextArg() != STRINGARG)
            HError(3219,"HNetTest: MMF File name expected");
         AddMMF(&hset,GetStrArg());
         break;
		default:
         HError(3219,"HNetTest: Unknown switch %s",s);
      }
   }

	if (NextArg()!=STRINGARG)
      HError(999,"HNetTest: Dictionary file name expected");
   dictFn = GetStrArg();
	if (NextArg()!=STRINGARG)
      HError(999,"HNetTest: Word Net file name expected");
   wdNetFn = GetStrArg();
   if (NextArg()!=STRINGARG)
      HError(999,"HNetTest: HMM list  file name expected");
   hmmListFn = GetStrArg();

	if(MakeHMMSet(&hset,hmmListFn)<SUCCESS)
      HError(999,"HNetTest: MakeHMMSet failed");
   if(LoadHMMSet(&hset,NULL,NULL)<SUCCESS)
      HError(999,"HNetTest: LoadHMMSet failed");

   InitVocab(&vocab);
   if(ReadDict(dictFn,&vocab)<SUCCESS)
      HError(3213, "HNetTest: ReadDict failed");

	LoadNetwork();

}
开发者ID:deardaniel,项目名称:PizzaTest,代码行数:47,代码来源:HNetTest.c


示例5: spell_select_word

static void
spell_select_word(Widget widget, XtPointer closure, XtPointer call_data)
{
    XawListReturnStruct *ret_struct = (XawListReturnStruct *) call_data;

    /* make correct button and correction entry sensitive */
    XtSetSensitive(correct_button, True);
    XtSetSensitive(correct_word, True);

    /* save the selected word */
    strcpy(selected_word, ret_struct->string);
    /* copy the word to the correct_word ascii widget */
    FirstArg(XtNstring, ret_struct->string);
    NextArg(XtNeditType, XawtextEdit);		/* make editable now */
    NextArg(XtNsensitive, True);		/* and sensitive */
    SetValues(correct_word);
}
开发者ID:coliveira,项目名称:xfignew,代码行数:17,代码来源:w_srchrepl.c


示例6: SafeFree

bool CConEmuStart::GetCfgParm(LPCWSTR& cmdLineRest, CESwitch& Val, int nMaxLen, bool bExpandAndDup /*= false*/)
{
	if (Val.Type == sw_Str || Val.Type == sw_EnvStr || Val.Type == sw_PathStr)
	{
		SafeFree(Val.Str);
	}
	else
	{
		Val.Type = bExpandAndDup ? sw_EnvStr : sw_Str;
	}
	Val.Exists = false;

	if (!cmdLineRest || !*cmdLineRest)
	{
		_ASSERTE(cmdLineRest && *cmdLineRest);
		return false;
	}

	// Сохраним, может для сообщения об ошибке понадобится
	LPCWSTR pszName = cmdLineRest;
	CmdArg szGetCfgParmTemp;

	if (!(cmdLineRest = NextArg(cmdLineRest, szGetCfgParmTemp)))
	{
		return false;
	}

	LPCWSTR curCommand = szGetCfgParmTemp.ms_Val;
	int nLen = _tcslen(curCommand);

	if (nLen >= nMaxLen)
	{
		int nCchSize = nLen+100+_tcslen(pszName);
		wchar_t* psz = (wchar_t*)calloc(nCchSize,sizeof(wchar_t));
		if (psz)
		{
			swprintf_c(psz, nCchSize/*#SECURELEN*/, L"Too long %s value (%i chars).\r\n", pszName, nLen);
			_wcscat_c(psz, nCchSize, curCommand);
			MBoxA(psz);
			free(psz);
		}
		return false;
	}

	// We need independent absolute file paths, Working dir changes during ConEmu session
	if (bExpandAndDup)
		Val.Str = GetFullPathNameEx(curCommand); // it allocates memory
	else
		Val.SetStr(curCommand, Val.Type);

	// Ok
	Val.Exists = (Val.Str && *Val.Str);

	return true;
}
开发者ID:Maximus5,项目名称:ConEmu,代码行数:55,代码来源:ConEmuStart.cpp


示例7: GetNextSwitch

	Switch* GetNextSwitch(LPCWSTR& rpsz, CEStr& szArg)
	{
		LPCWSTR psz = rpsz;
		CEStr szNext;

		if ((0 == NextArg(&psz, szNext)) && !szNext.IsPossibleSwitch())
			rpsz = psz;
		else
			szNext.Clear();

		Switch* ps = new Switch(szArg.Detach(), szNext.Detach());
		return ps;
	};
开发者ID:amynbe,项目名称:ConEmu,代码行数:13,代码来源:SetPgIntegr.cpp


示例8: background_select

static void
background_select(Widget w, XtPointer closure, XtPointer call_data)
{
    Pixel	    bgcolor, fgcolor;

    /* get the colors from the color button just pressed */
    FirstArg(XtNbackground, &bgcolor);
    NextArg(XtNforeground, &fgcolor);
    GetValues(w);

    /* get the colorname from the color button and put it and the colors 
       in the menu button */
    FirstArg(XtNlabel, XtName(w));
    NextArg(XtNbackground, bgcolor);
    NextArg(XtNforeground, fgcolor);
    SetValues(print_background_panel);
    /* update the export panel too if it exists */
    if (export_background_panel)
	SetValues(export_background_panel);
    export_background_color = (int)closure;

    XtPopdown(background_menu);
}
开发者ID:hhoeflin,项目名称:xfig,代码行数:23,代码来源:w_print.c


示例9: CreateDataFileList

/* CreateDataFileList: */
static void CreateDataFileList()
{
   char *datafn;
   g_nDataFileNum = 0;
   do {
      if (NextArg() != STRINGARG)
         HError(2319, "HMGenS: data file name expected");
      datafn = GetStrArg();

      g_pDataFileList[g_nDataFileNum] = (TDataFile *) New(&gstack, sizeof(TDataFile));
      strcpy(g_pDataFileList[g_nDataFileNum]->datafn, datafn);
      g_pDataFileList[g_nDataFileNum]->bValid = TRUE;
      g_nDataFileNum++;
   } while (NumArgs() > 0);
}
开发者ID:nlphacker,项目名称:OpenSpeech,代码行数:16,代码来源:HMgeTool.c


示例10: main

int main(int argc, char *argv[])
{
	int n,a1,a2,a3,a4;

	InitThreads(sMon);
	if(InitShell(argc,argv,hthreadtest_version)<SUCCESS)
		HError(1100,"HThreadTest: InitShell failed");
	if (NumArgs() < 1) ReportUsage();
	InitMem();   InitLabel();
	InitMath();  InitSigP();
	InitWave();  InitAudio();
	InitVQ();
	if(InitParm()<SUCCESS)
		HError(3200,"HThreadTest: InitParm failed");
	InitGraf(FALSE);
   if (sMon==HT_MSGMON) HCreateMonitor(tmon4,(void *)0);
	if (NextArg() == INTARG){
		n = GetIntArg();
		switch(n){
		case 1:
			a1 = GetIntArg(); a2 = GetIntArg();
			ParallelForkAndJoin(a1,a2); break;
		case 2:
			a1 = GetIntArg(); a2 = GetIntArg();
			SimpleMutex(a1,a2); break;
		case 3:
			SimpleSignal(); break;
		case 4:
			a1 = GetIntArg(); a2 = GetIntArg();
			a3 = GetIntArg(); a4 = GetIntArg();
			BufferTest(a1,a2,a3,a4,GetStrArg()); break;
		default:
			printf("Bad test number %d\n",n); ReportUsage();
		}
	}
	if (sMon>0){
		AccessStatus();
		PrintThreadStatus("Final");
		ReleaseStatusAccess();
		if (sMon==HT_MSGMON)HJoinMonitor();
	}
}
开发者ID:deardaniel,项目名称:PizzaTest,代码行数:42,代码来源:HThreadTest.c


示例11: GetNextPair

	Switch* GetNextPair(LPCWSTR& rpsz)
	{
		LPCWSTR psz = rpsz;
		CEStr szArg;

		if (0 != NextArg(&psz, szArg))
		{
			return NULL;
		}

		// Invalid switch? or first argument (our executable)
		if (!szArg.IsPossibleSwitch())
		{
			rpsz = psz;
			return NULL;
		}

		rpsz = psz;

		return GetNextSwitch(rpsz, szArg);
	};
开发者ID:amynbe,项目名称:ConEmu,代码行数:21,代码来源:SetPgIntegr.cpp


示例12:

bool CConEmuUpdate::Check7zipInstalled()
{
	if (mp_Set->UpdateDownloadSetup() == 1)
		return true; // Инсталлер, архиватор не требуется!

	LPCWSTR pszCmd = mp_Set->UpdateArcCmdLine();
	CmdArg sz7zip; sz7zip.GetBuffer(MAX_PATH);
	if (NextArg(&pszCmd, sz7zip) != 0)
	{
		ReportError(L"Invalid update command\nGoto 'Update' page and check 7-zip command", 0);
		return false;
	}

	if (FileExistsSearch(sz7zip.GetBuffer(MAX_PATH), MAX_PATH))
		return true;

	WARNING("TODO: Suggest to download 7zip");

	ReportError(L"7zip or WinRar not found! Not installed?\n%s\nGoto 'Update' page and check 7-zip command", sz7zip, 0);
	return false;
}
开发者ID:NickLatysh,项目名称:conemu,代码行数:21,代码来源:Update.cpp


示例13: IsNeedCmd

bool IsNeedCmd(BOOL bRootCmd, LPCWSTR asCmdLine, CEStr &szExe,
			   LPCWSTR* rsArguments /*= NULL*/, BOOL* rpbNeedCutStartEndQuot /*= NULL*/,
			   BOOL* rpbRootIsCmdExe /*= NULL*/, BOOL* rpbAlwaysConfirmExit /*= NULL*/, BOOL* rpbAutoDisableConfirmExit /*= NULL*/)
{
	bool rbNeedCutStartEndQuot = false;
	bool rbRootIsCmdExe = true;
	bool rbAlwaysConfirmExit = false;
	bool rbAutoDisableConfirmExit = false;

	wchar_t *pwszEndSpace;

	if (rsArguments) *rsArguments = NULL;

	bool lbRc = false;
	int iRc = 0;
	BOOL lbFirstWasGot = FALSE;
	LPCWSTR pwszCopy;
	int nLastChar;
	#ifdef _DEBUG
	CEStr szDbgFirst;
	#endif

	if (!asCmdLine || !*asCmdLine)
	{
		_ASSERTE(asCmdLine && *asCmdLine);
		goto wrap;
	}

	#ifdef _DEBUG
	// Это минимальные проверки, собственно к коду - не относятся
	bool bIsBatch = false;
	{
		LPCWSTR psz = asCmdLine;
		NextArg(&psz, szDbgFirst);
		psz = PointToExt(szDbgFirst);
		if (lstrcmpi(psz, L".cmd")==0 || lstrcmpi(psz, L".bat")==0)
			bIsBatch = true;
	}
	#endif

	if (!szExe.GetBuffer(MAX_PATH))
	{
		_ASSERTE(FALSE && "Failed to allocate MAX_PATH");
		lbRc = true;
		goto wrap;
	}
	szExe.Empty();

	if (!asCmdLine || *asCmdLine == 0)
	{
		_ASSERTE(asCmdLine && *asCmdLine);
		lbRc = true;
		goto wrap;
	}


	pwszCopy = asCmdLine;
	// cmd /c ""c:\program files\arc\7z.exe" -?"   // да еще и внутри могут быть двойными...
	// cmd /c "dir c:\"
	nLastChar = lstrlenW(pwszCopy) - 1;

	if (pwszCopy[0] == L'"' && pwszCopy[nLastChar] == L'"')
	{
		//if (pwszCopy[1] == L'"' && pwszCopy[2])
		//{
		//	pwszCopy ++; // Отбросить первую кавычку в командах типа: ""c:\program files\arc\7z.exe" -?"

		//	if (rbNeedCutStartEndQuot) *rbNeedCutStartEndQuot = TRUE;
		//}
		//else
			// глючила на ""F:\VCProject\FarPlugin\#FAR180\far.exe  -new_console""
			//if (wcschr(pwszCopy+1, L'"') == (pwszCopy+nLastChar)) {
			//	LPCWSTR pwszTemp = pwszCopy;
			//	// Получим первую команду (исполняемый файл?)
			//	if ((iRc = NextArg(&pwszTemp, szArg)) != 0) {
			//		//Parsing command line failed
			//		lbRc = true; goto wrap;
			//	}
			//	pwszCopy ++; // Отбросить первую кавычку в командах типа: "c:\arc\7z.exe -?"
			//	lbFirstWasGot = TRUE;
			//	if (rbNeedCutStartEndQuot) *rbNeedCutStartEndQuot = TRUE;
			//} else
		{
			// Will be dequoted in 'NextArg' function. Examples
			// "C:\GCC\msys\bin\make.EXE -f "makefile" COMMON="../../../plugins/common""
			// ""F:\VCProject\FarPlugin\#FAR180\far.exe  -new_console""
			// ""cmd""
			// cmd /c ""c:\program files\arc\7z.exe" -?"   // да еще и внутри могут быть двойными...
			// cmd /c "dir c:\"

			LPCWSTR pwszTemp = pwszCopy;

			// Получим первую команду (исполняемый файл?)
			if ((iRc = NextArg(&pwszTemp, szExe)) != 0)
			{
				//Parsing command line failed
				#ifdef WARN_NEED_CMD
				_ASSERTE(FALSE);
				#endif
				lbRc = true; goto wrap;
//.........这里部分代码省略.........
开发者ID:DreamersStudio,项目名称:ConEmu,代码行数:101,代码来源:CmdLine.cpp


示例14: QueryNextArg

// Returns PTR to next arg or NULL on error
LPCWSTR QueryNextArg(const wchar_t* asCmdLine, CEStr &rsArg, const wchar_t** rsArgStart/*=NULL*/)
{
	if (0 != NextArg(&asCmdLine, rsArg, rsArgStart))
		return NULL;
	return asCmdLine;
}
开发者ID:DreamersStudio,项目名称:ConEmu,代码行数:7,代码来源:CmdLine.cpp


示例15: OurShellExecCmdLine

// Called from OnShellExecCmdLine
HRESULT OurShellExecCmdLine(HWND hwnd, LPCWSTR pwszCommand, LPCWSTR pwszStartDir, bool bRunAsAdmin, bool bForce)
{
	HRESULT hr = E_UNEXPECTED;
	BOOL bShell = FALSE;

	CEStr lsLog = lstrmerge(L"OnShellExecCmdLine", bRunAsAdmin ? L"(RunAs): " : L": ", pwszCommand);
	DefTermLogString(lsLog);

	// Bad thing, ShellExecuteEx needs File&Parm, but we get both in pwszCommand
	CmdArg szExe;
	LPCWSTR pszFile = pwszCommand;
	LPCWSTR pszParm = pwszCommand;
	if (NextArg(&pszParm, szExe) == 0)
	{
		pszFile = szExe; pszParm = SkipNonPrintable(pszParm);
	}
	else
	{
		// Failed
		pszFile = pwszCommand; pszParm = NULL;
	}

	if (!bForce)
	{
		DWORD nCheckSybsystem1 = 0, nCheckBits1 = 0;
		if (!FindImageSubsystem(pszFile, nCheckSybsystem1, nCheckBits1))
		{
			hr = (HRESULT)-1;
			DefTermLogString(L"OnShellExecCmdLine: FindImageSubsystem failed");
			goto wrap;
		}
		if (nCheckSybsystem1 != IMAGE_SUBSYSTEM_WINDOWS_CUI)
		{
			hr = (HRESULT)-1;
			DefTermLogString(L"OnShellExecCmdLine: !=IMAGE_SUBSYSTEM_WINDOWS_CUI");
			goto wrap;
		}
	}

	// "Run as admin" was requested?
	if (bRunAsAdmin)
	{
		SHELLEXECUTEINFO sei = {sizeof(sei), 0, hwnd, L"runas", pszFile, pszParm, pwszStartDir, SW_SHOWNORMAL};
		bShell = OnShellExecuteExW(&sei);
	}
	else
	{
		wchar_t* pwCommand = lstrdup(pwszCommand);
		DWORD nCreateFlags = CREATE_NEW_CONSOLE|CREATE_UNICODE_ENVIRONMENT|CREATE_DEFAULT_ERROR_MODE;
		STARTUPINFO si = {sizeof(si)};
		PROCESS_INFORMATION pi = {};
		bShell = OnCreateProcessW(NULL, pwCommand, NULL, NULL, FALSE, nCreateFlags, NULL, pwszStartDir, &si, &pi);
		if (bShell)
		{
			CloseHandle(pi.hProcess);
			CloseHandle(pi.hThread);
		}
	}

	hr = bShell ? S_OK : HRESULT_FROM_WIN32(GetLastError());
wrap:
	return hr;
}
开发者ID:AITW,项目名称:ConEmu,代码行数:64,代码来源:hkProcess.cpp


示例16: main

int main(int argc, char *argv[])
{
   int i;
   char *c,*s,*fn;
   char sBuf[256],fmt[256];

   void       Initialise(void);
   void       ProcessText(char *fn,bool lastFile);
   bool    Exists(char *fn);
   BackOffLM *CombineModels(MemHeap *heap,LMInfo *lmi,int nLModel,int nSize,WordMap *wl) ;

   InitShell(argc,argv,ladapt_version,ladapt_vc_id);
   InitMem();
   InitMath();
   InitWave();
   InitLabel();
   InitLUtil();
   InitWMap();
   InitGBase();
   InitLModel();
   InitPCalc();
   InitPMerge();

   SetConfParms();

   if (!InfoPrinted() && NumArgs() == 0)
      ReportUsage();
   if (NumArgs() == 0) Exit(EXIT_SUCCESS);

   InitBuildInfo(&binfo); 
   binfo.dctype = DC_ABSOLUTE;
   nLModel = 1;
   while (NextArg() == SWITCHARG) {
      s = GetSwtArg();
      if (strlen(s)!=1) 
         HError(16419,"Bad switch %s; must be single letter",s);
      switch(s[0]){
         case 'a':
            newWords = GetChkedInt(10,10000000,s); break;
         case 'b':
            ngbSize = GetChkedInt(10,10000000,s); break;
         case 'c':
            i = GetChkedInt(2,LM_NSIZE,s); 
	    binfo.cutOff[i] = GetChkedInt(0,1000,s);
	    break;
         case 'd':
            if (NextArg()!=STRINGARG)
               HError(16419,"Gram base root file name expected");
            rootFN = GetStrArg(); 
	    break;
         case 'f':
	    strcpy(fmt, GetStrArg());
	    for (c=fmt; *c; *c=toupper(*c), c++); /* To uppercase */
	    if (strcmp(fmt, LM_TXT_TEXT)==0)
	      binfo.saveFmt = LMF_TEXT;
	    else if (strcmp(fmt, LM_TXT_BINARY)==0)
	       binfo.saveFmt = LMF_BINARY;
	    else if (strcmp(fmt, LM_TXT_ULTRA)==0)
	       binfo.saveFmt = LMF_ULTRA;
	    else
	       HError(16419,"Unrecognised LM format, should be one of [%s, %s, %s]",
		      LM_TXT_TEXT, LM_TXT_BINARY, LM_TXT_ULTRA);
	    break;
         case 'g':
            processText = FALSE; break;
	 case 'i':
            if (NextArg()!=FLOATARG)
	       HError(16419,"Interpolation weight expected");
	    lmInfo[nLModel].weight = GetChkedFlt(0.0,1.0,s);
            if (NextArg()!=STRINGARG)
	       HError(16419,"Interpolation LM filename expected");
	    lmInfo[nLModel].fn = GetStrArg();
	    nLModel++;
	    break;
         case 'j':
            i = GetChkedInt(2,LM_NSIZE,s); 
	    binfo.wdThresh[i] = GetChkedFlt(0.0,1E10,s);
	    break;
         case 'n':
            nSize = GetChkedInt(1, MAXNG, s); break;
#ifdef HTK_TRANSCRIBER
         case 's':
            if (NextArg()!=STRINGARG)
               HError(16419,"Gram file text source descriptor expected");
            txtSrc = GetStrArg(); break;
         case 't':
	    binfo.dctype = DC_KATZ; break;
#endif
         case 'w':
            if (NextArg()!=STRINGARG)
               HError(16419,"Word list file name expected");
            wlistFN = GetStrArg(); break;
#ifndef HTK_TRANSCRIBER
         case 'x':
            binfo.ptype = LMP_COUNT; break;
#endif
         case 'T':
            trace = GetChkedInt(0,077,s); break;
         default:
            HError(16419,"LAdapt: Unknown switch %s",s);
//.........这里部分代码省略.........
开发者ID:botonchou,项目名称:AlgoFinal,代码行数:101,代码来源:LAdapt.c


示例17: _ASSERTE

// Returns ">0" - when changes was made
//  0 - no changes
// -1 - error
// bForceCurConsole==true, если разбор параметров идет 
//   при запуске Tasks из GUI
int RConStartArgs::ProcessNewConArg(bool bForceCurConsole /*= false*/)
{
	NewConsole = crb_Undefined;

	if (!pszSpecialCmd || !*pszSpecialCmd)
	{
		_ASSERTE(pszSpecialCmd && *pszSpecialCmd);
		return -1;
	}

	int nChanges = 0;

	// 140219 - Остановить обработку, если встретим любой из: ConEmu[.exe], ConEmu64[.exe], ConEmuC[.exe], ConEmuC64[.exe]
	LPCWSTR pszStopAt = NULL;
	{
		LPCWSTR pszTemp = pszSpecialCmd;
		LPCWSTR pszSave = pszSpecialCmd;
		LPCWSTR pszName;
		CmdArg szExe;
		LPCWSTR pszWords[] = {L"ConEmu", L"ConEmu.exe", L"ConEmu64", L"ConEmu64.exe", L"ConEmuC", L"ConEmuC.exe", L"ConEmuC64", L"ConEmuC64.exe", L"ConEmuPortable.exe", L"ConEmuPortable", NULL};
		while (!pszStopAt && (0 == NextArg(&pszTemp, szExe)))
		{
			pszName = PointToName(szExe);
			for (size_t i = 0; pszWords[i]; i++)
			{
				if (lstrcmpi(pszName, pszWords[i]) == 0)
				{
					pszStopAt = pszSave;
					break;
				}
			}
			pszSave = pszTemp;
		}
	}

	#if 0
	// 140219 - Остановить обработку, если встретим любой из: ConEmu[.exe], ConEmu64[.exe], ConEmuC[.exe], ConEmuC64[.exe]
	if (!hShlwapi)
	{
		hShlwapi = LoadLibrary(L"Shlwapi.dll");
		WcsStrI = hShlwapi ? (StrStrI_t)GetProcAddress(hShlwapi, "StrStrIW") : NULL;
	}
	#endif


	// 111211 - здесь может быть передан "-new_console:..."
	LPCWSTR pszNewCon = L"-new_console";
	// 120108 - или "-cur_console:..." для уточнения параметров запуска команд (из фара например)
	LPCWSTR pszCurCon = L"-cur_console";
	int nNewConLen = lstrlen(pszNewCon);
	_ASSERTE(lstrlen(pszCurCon)==nNewConLen);

	wchar_t* pszFrom = pszSpecialCmd;

	bool bStop = false;
	while (!bStop)
	{
		wchar_t* pszSwitch = wcschr(pszFrom, L'-');
		if (!pszSwitch)
			break;
		// Pre-validation
		if (((pszSwitch[1] != L'n') && (pszSwitch[1] != L'c')) // -new_... or -cur_...
			|| (((pszSwitch != /* > */ pszFrom) // If it is started from pszFrom - no need to check previous symbols
				&& (*(pszSwitch-1) != L'"') || (((pszSwitch-2) >= pszFrom) && (*(pszSwitch-2) == L'\\'))) // Found: \"-new...
				&& (*(pszSwitch-1) != L' '))) // Prev symbol was space
		{
			// НЕ наш аргумент
			pszSwitch = wcschr(pszSwitch+1, L' ');
			if (!pszSwitch)
				break;
			pszFrom = pszSwitch;
			continue;
		}

		wchar_t* pszFindNew = NULL;
		wchar_t* pszFind = NULL;
		wchar_t szTest[12]; lstrcpyn(szTest, pszSwitch+1, countof(szTest));

		if (lstrcmp(szTest, L"new_console") == 0)
			pszFindNew = pszFind = pszSwitch;
		else if (lstrcmp(szTest, L"cur_console") == 0)
			pszFind = pszSwitch;
		else
		{
			// НЕ наш аргумент
			pszSwitch = wcschr(pszSwitch+1, L' ');
			if (!pszSwitch)
				break;
			pszFrom = pszSwitch;
			continue;
		}

		if (!pszFind)
			break;
		if (pszStopAt && (pszFind >= pszStopAt))
//.........这里部分代码省略.........
开发者ID:rheostat2718,项目名称:conemu-maximus5,代码行数:101,代码来源:RConStartArgs.cpp


示例18: lstrcmp

void RConStartArgs::RunArgTests()
{
	CmdArg s;
	s.Set(L"Abcdef", 3);
	int nDbg = lstrcmp(s, L"Abc");
	_ASSERTE(nDbg==0);
	s.Set(L"qwerty");
	nDbg = lstrcmp(s, L"qwerty");
	_ASSERTE(nDbg==0);
	s.Empty();
	//s.Set(L""); // !! Set("") must trigger ASSERT !!
	nDbg = s.ms_Arg ? lstrcmp(s, L"") : -2;
	_ASSERTE(nDbg==0);

	struct { LPCWSTR pszWhole; LPCWSTR pszCmp[10]; } lsArgTest[] = {
		{L"\"C:\\ConEmu\\ConEmuC64.exe\"  /PARENTFARPID=1 /C \"C:\\GIT\\cmdw\\ad.cmd CE12.sln & ci -m \"Solution debug build properties\"\"",
			{L"C:\\ConEmu\\ConEmuC64.exe", L"/PARENTFARPID=1", L"/C", L"C:\\GIT\\cmdw\\ad.cmd", L"CE12.sln", L"&", L"ci", L"-m", L"Solution debug build properties"}},
		{L"/C \"C:\\ad.cmd file.txt & ci -m \"Commit message\"\"",
			{L"/C", L"C:\\ad.cmd", L"file.txt", L"&", L"ci", L"-m", L"Commit message"}},
		{L"\"This is test\" Next-arg \t\n \"Third Arg +++++++++++++++++++\" ++", {L"This is test", L"Next-arg", L"Third Arg +++++++++++++++++++"}},
		{L"\"\"cmd\"\"", {L"cmd"}},
		{L"\"\"c:\\Windows\\System32\\cmd.exe\" /?\"", {L"c:\\Windows\\System32\\cmd.exe", L"/?"}},
		// Following example is crazy, but quotation issues may happens
		//{L"First Sec\"\"ond \"Thi\"rd\" \"Fo\"\"rth\"", {L"First", L"Sec\"\"ond", L"Thi\"rd", L"Fo\"\"rth"}},
		{L"First \"Fo\"\"rth\"", {L"First", L"Fo\"\"rth"}},
		// Multiple commands
		{L"set ConEmuReportExe=VIM.EXE & SH.EXE", {L"set", L"ConEmuReportExe=VIM.EXE", L"&", L"SH.EXE"}},
		// Inside escaped arguments
		{L"reg.exe add \"HKCU\\MyCo\" /ve /t REG_EXPAND_SZ /d \"\\\"C:\\ConEmu\\ConEmuPortable.exe\\\" /Dir \\\"%V\\\" /cmd \\\"cmd.exe\\\" \\\"-new_console:nC:cmd.exe\\\" \\\"-cur_console:d:%V\\\"\" /f",
			// Для наглядности:
			// reg.exe add "HKCU\MyCo" /ve /t REG_EXPAND_SZ
			//    /d "\"C:\ConEmu\ConEmuPortable.exe\" /Dir \"%V\" /cmd \"cmd.exe\" \"-new_console:nC:cmd.exe\" \"-cur_console:d:%V\"" /f
			{L"reg.exe", L"add", L"HKCU\\MyCo", L"/ve", L"/t", L"REG_EXPAND_SZ", L"/d",
			 L"\\\"C:\\ConEmu\\ConEmuPortable.exe\\\" /Dir \\\"%V\\\" /cmd \\\"cmd.exe\\\" \\\"-new_console:nC:cmd.exe\\\" \\\"-cur_console:d:%V\\\"",
			 L"/f"}},
		// After 'Inside escaped arguments' regression bug appears
		{L"/dir \"C:\\\" /icon \"cmd.exe\" /single", {L"/dir", L"C:\\", L"/icon", L"cmd.exe", L"/single"}},
		{L"cmd \"one.exe /dir \\\"C:\\\\\" /log\" \"two.exe /dir \\\"C:\\\" /log\" end", {L"cmd", L"one.exe /dir \\\"C:\\\\\" /log", L"two.exe /dir \\\"C:\\\" /log", L"end"}},
		{NULL}
	};
	for (int i = 0; lsArgTest[i].pszWhole; i++)
	{
		s.Empty();
		LPCWSTR pszTestCmd = lsArgTest[i].pszWhole;
		int j = -1;
		while (lsArgTest[i].pszCmp[++j])
		{
			if (NextArg(&pszTestCmd, s) != 0)
			{
				_ASSERTE(FALSE && "Fails on token!");
			}
			else
			{
				nDbg = lstrcmp(s, lsArgTest[i].pszCmp[j]);
				_ASSERTE(nDbg==0);
			}
		}
	}

	bool bTest = true;
	for (size_t i = 0; bTest; i++)
	{
		RConStartArgs arg;
		int nDbg;
		LPCWSTR pszCmp;

		switch (i)
		{
		case 21:
			pszCmp = L"cmd '-new_console' `-new_console` \\\"-new_console\\\"";
			arg.pszSpecialCmd = lstrdup(pszCmp);
			arg.ProcessNewConArg();
			_ASSERTE(0==lstrcmp(arg.pszSpecialCmd, pszCmp) && arg.NewConsole==crb_Undefined);
			break;
		case 20:
			arg.pszSpecialCmd = lstrdup(L"\"c:\\cmd.exe\" \"-new_console\" \"c:\\file.txt\"");
			arg.ProcessNewConArg();
			_ASSERTE(0==lstrcmp(arg.pszSpecialCmd, L"\"c:\\cmd.exe\" \"c:\\file.txt\""));
			break;
		case 19:
			arg.pszSpecialCmd = lstrdup(L"\"c:\\cmd.exe\" -new_console:n \"c:\\file.txt\"");
			arg.ProcessNewConArg();
			_ASSERTE(0==lstrcmp(arg.pszSpecialCmd, L"\"c:\\cmd.exe\" \"c:\\file.txt\""));
			break;
		case 18:
			arg.pszSpecialCmd = lstrdup(L"\"c:\\cmd.exe\" \"-new_console:n\" \"c:\\file.txt\"");
			arg.ProcessNewConArg();
			_ASSERTE(0==lstrcmp(arg.pszSpecialCmd, L"\"c:\\cmd.exe\" \"c:\\file.txt\""));
			break;
		case 17:
			arg.pszSpecialCmd = lstrdup(L"c:\\cmd.exe \"-new_console:n\" \"c:\\file.txt\"");
			arg.ProcessNewConArg();
			_ASSERTE(0==lstrcmp(arg.pszSpecialCmd, L"c:\\cmd.exe \"c:\\file.txt\""));
			break;
		case 16:
			arg.pszSpecialCmd = lstrdup(L"\"c:\\cmd.exe\" \"-new_console:n\" c:\\file.txt");
			arg.ProcessNewConArg();
			_ASSERTE(0==lstrcmp(arg.pszSpecialCmd, L"\"c:\\cmd.exe\" c:\\file.txt"));
			break;
		case 15:
//.........这里部分代码省略.........
开发者ID:rheostat2718,项目名称:conemu-maximus5,代码行数:101,代码来源:RConStartArgs.cpp


示例19: main

int main(int argc, char *argv[])
{
   char *datafn, *s;
   int stream = 0;
   void Initialise(char *datafn);
   void LoadFile(char *fn);
   void CalcMeanCov(Sequence seq[], int s);
   void ClusterVecs(Sequence seq[], int s);
   void WriteVQTable(ClusterSet *cs[], char *fn);  

   if(InitShell(argc,argv,hquant_version,hquant_vc_id)<SUCCESS)
      HError(2500,"HQuant: InitShell failed");

   InitMem();   InitLabel();
   InitMath();  InitSigP();
   InitWave();  InitAudio();
   InitVQ();    InitModel();
   if(InitParm()<SUCCESS)  
      HError(2500,"HQuant: InitParm failed");
   InitTrain();

   if (!InfoPrinted() && NumArgs() == 0)
      ReportUsage();
   if (NumArgs() == 0) Exit(0);
   SetConfParms();
   InitStreamVars();

   while (NextArg() == SWITCHARG) {
      s = GetSwtArg();
      if (strlen(s)!=1) 
         HError(2519,"HQuant: Bad switch %s; must be single letter",s);
      switch(s[0]){
      case 'd':
         if ( ck != NULLC) HError(2519,"HQuant: Specify one of -d or -f, not both");
         ck = INVDIAGC;
         break;
      case 'f':
         if ( ck != NULLC) HError(2519,"HQuant: Specify one of -d or -f, not both");
         ck = FULLC;
         break;
      case 'g':
         globClustVar = TRUE;
         break;
      case 'l':
         if (NextArg() != STRINGARG)
            HError(2519,"HQuant: Segment label expected");
         segLab = GetStrArg();
         break;
      case 'n':
         if (NextArg() != INTARG)
            HError(2519,"HQuant: Stream number expected");
         stream = GetChkedInt(1,SMAX,s);
         if (NextArg() != INTARG)
            HError(2519,"HQuant: Codebook size expected");
         cbSizes[stream]= GetChkedInt(1,32768,s);
         break;
      case 's':
         if (NextArg() != INTARG)
            HError(2519,"HQuant: Number of streams expected");
         swidth[0] = GetChkedInt(1,SMAX,s);
         break;
      case 't':
         tType = binTree;
         break;
      case 'w':
         if (NextArg() != INTARG)
            HError(2519,"HQuant: Stream number expected");
         stream = GetChkedInt(1,SMAX,s);
         if(swidth[0] < stream) swidth[0] = stream;
         widthSet = TRUE;
         if (NextArg() != INTARG)
            HError(2519,"HQuant: Stream width expected");
         swidth[stream]= GetChkedInt(1,256,s);
         break;
      case 'F':
         if (NextArg() != STRINGARG)
            HError(2519,"HQuant: Data File format expected");
         if((dff = Str2Format(GetStrArg())) == ALIEN)
            HError(-2589,"HQuant: Warning ALIEN Data file format set");
         break;
      case 'G':
         if (NextArg() != STRINGARG)
            HError(2519,"HQuant: Label File format expected");
         if((lff = Str2Format(GetStrArg())) == ALIEN)
            HError(-2589,"HQuant: Warning ALIEN Label file format set");
         break;
      case 'I':
         if (NextArg() != STRINGARG)
            HError(2519,"HQuant: MLF file name expected");
         LoadMasterFile(GetStrArg());
         break;
      case 'L':
         if (NextArg()!=STRINGARG)
            HError(2519,"HQuant: Label file directory expected");
         labDir = GetStrArg();
         break;
      case 'T':
         if (NextArg() != INTARG)
            HError(2519,"HQuant: Trace value expected");
         trace = GetChkedInt(0,077,s); 
//.........这里部分代码省略.........
开发者ID:nlphacker,项目名称:OpenSpeech,代码行数:101,代码来源:HQuant.c


示例20: _tWinMain

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
#endif
{
	hInst = hInstance;
	isWin64 = IsWindows64();

	GetVersionEx(&gOSVer);

	int nInstallVer = 0;

	wsprintf(gsTitle, msgConEmuInstaller, CONEMUVERL);
	lstrcpyn(gsRunAsAdm, msgRunSetupAsAdmin, countof(gsRunAsAdm));

	wchar_t szArg[MAX_PATH+1];
	LPCWSTR pszCmdToken = GetCommandLine();
	LPCWSTR pszCmdLineW = pszCmdToken;

	CTempDir temp_dir; // gsTempFolder[0] = 0;

	while (0 == NextArg(&pszCmdToken, szArg))
	{
		if (lstrcmp(szArg, L"/?") == 0 || lstrcmp(szArg, L"-?") == 0 || lstrcmp(szArg, L"-h") == 0
			|| lstrcmp(szArg, L"-help") == 0 || lstrcmp(szArg, L"--help") == 0)
		{
			MessageBox(NULL, msgUsageExample, gsTitle, MB_ICONINFORMATION);
			return exit_Cancelled;
		}

		if (*szArg == L'/')
		{
			if (szArg[1] == L'e' || szArg[1] == L'E')
			{
				gbExtractOnly = true;
				if (szArg[2] == L':' && szArg[3])
				{
					lstrcpyn(gsTempFolder, (szArg[3]==L'"') ? (szArg+4) : (szArg+3), countof(gsTempFolder));
				}
				continue;
			}

		    if (memcmp(szArg, L"/p:x", 4*sizeof(*szArg)) == 0)
		    {
		    	gbAlreadyAdmin = IsUserAdmin();
				if (lstrcmpi(szArg+4, L"86") == 0)
				{
					nInstallVer = Ver86;
				}
				else if (lstrcmpi(szArg+4, L"86,adm") == 0)
				{
					nInstallVer = Ver86;
					gbUseElevation = !gbAlreadyAdmin;
				}
				else if (lstrcmpi(szArg+4, L"64") == 0)
				{
					nInstallVer = Ver64;
				}
				else if (lstrcmpi(szArg+4, L"64,adm") == 0)
				{
					nInstallVer = Ver64;
					gbUseElevation = !gbAlreadyAdmin;
				}
			}
			else
				pszCmdToken = pszCmdLineW;
			break;
		}
		else if (*szArg == L'-')
		{
			pszCmdToken = pszCmdLineW;
			break;
		}

		pszCmdLineW = pszCmdToken;
	}

	if (!temp_dir.Acquire())
	{
		return exit_CreateDirectory;
	}

	if (!gbExtractOnly)
	{
		// If pszCmdToken is not empty - set global var
		gbAutoMode = (pszCmdToken && *pszCmdToken);

		wchar_t szInstallPath[MAX_PATH+32];
		bool bInstalled;
		HKEY hk;

		lstrcpyn(gsMessage, msgChooseInstallVer, countof(gsMessage));

			szInstallPath[0] = 0; bInstalled = false;
			struct {HKEY hk; LPCWSTR path; LPCWSTR name; bool our;}
				Keys[] = {
					{HKEY_LOCAL_MACHINE,L"SOFTWARE\\ConEmu",L"InstallDir",true},
					//Current installer does not use FarManager installation dir anymore
					//{HKEY_LOCAL_MACHINE,L"SOFTWARE\\Far Manager",L"InstallDir"},
					//{HKEY_LOCAL_MACHINE,L"SOFTWARE\\Far2",L"InstallDir"},
					//{HKEY_LOCAL_MACHINE,L"SOFTWARE\\Far",L"InstallDir"},
				};
//.........这里部分代码省略.........
开发者ID:2asoft,项目名称:ConEmu,代码行数:101,代码来源:Setupper.cpp



注:本文中的NextArg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NextCh函数代码示例发布时间:2022-05-30
下一篇:
C++ NewtonBodyGetUserData函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap