VOID ComboUpdate(HWND hDlg, COMBO ptr) { Combo *c = (Combo*) ptr; TCHAR Buf[MAX_BUF_LEN]; ComboGetDlgText(hDlg, ptr, Buf, MAX_BUF_LEN); ComboAdd(ptr,Buf); }
VOID PreprocessCommand(LPCTSTR InputCommand, LPTSTR NewCommand) { LPTSTR path, opt, prompt, flag, editor, Command = (LPTSTR) InputCommand; TCHAR Buffer[MAX_PATH]; StringCpy(NewCommand,Command); // skip initial spaces while(*Command == TEXT(' ')) Command++; if(*Command == TEXT(':')) Command++; else // it is not a command return; if (path=IsCommand(TEXT("cd"), Command)) { // in case the user typed ":cd <dir>", update WinGHCi current dir if(StringIsEmpty(path)) { // get user home dir SHGetFolderPath(NULL,CSIDL_PROFILE,NULL,SHGFP_TYPE_CURRENT,Buffer); path = Buffer; } SetCurrentDirectory(path); StringCpy(LastFileLoaded,TEXT("")); // no file loaded after changing dir } else if (IsCommand(TEXT("quit"), Command)) { SendMessage(hWndMain,WM_CLOSE,0,0); } else if (opt=IsCommand(TEXT("set"),Command)) { if(prompt=StringIsPreffix(TEXT("prompt "), opt)) { //skip whitespaces while(*prompt==TEXT(' ')) prompt++; // in case the user wants to change the prompt, add markers ComboAdd(GHCi_Combo_Prompt,prompt); MakeGHCiPromptCommand(prompt, NewCommand, TRUE); } else if (editor=StringIsPreffix(TEXT("editor "), opt)) { ComboAdd(GHCi_Combo_Editor,editor); MakeGHCiExpandedEditorCommand(editor, NewCommand); } else if (flag=StringIsPreffix(TEXT("+r"), opt)) { GHCi_Flag_RevertCAFs = TRUE; } else if (flag=StringIsPreffix(TEXT("+s"), opt)) { GHCi_Flag_PrintStats = TRUE; } else if (flag=StringIsPreffix(TEXT("+t"), opt)) { GHCi_Flag_PrintTypes = TRUE; } } else if (opt=IsCommand(TEXT("unset"),Command)) { if (flag=StringIsPreffix(TEXT("+r"), opt)) { GHCi_Flag_RevertCAFs = FALSE; } else if (flag=StringIsPreffix(TEXT("+s"), opt)) { GHCi_Flag_PrintStats = FALSE; } else if (flag=StringIsPreffix(TEXT("+t"), opt)) { GHCi_Flag_PrintTypes = FALSE; } } else if (path=IsCommand(TEXT("load"),Command)) { StringCpy(LastFileLoaded,path); // a new file is loaded } /* else if (path=IsCommand(TEXT("load"), Command)) { LoadFile(path); StringCpy(NewCommand,TEXT("")); }*/ }