Beispiel #1
0
VOID LoadFile(LPTSTR File)
{
	TCHAR Command[2*MAX_PATH], fName[MAX_PATH], fExt[MAX_PATH], Buffer[MAX_PATH];

	//Move the current directory
	SetWorkingDirToFileLoc(File);

	

	// get file name and extension
	_tsplitpath (File, NULL, NULL, fName, fExt);
	wsprintf(Buffer,TEXT("%s%s"),fName,fExt);

	wsprintf(Command, TEXT(":load %s"), ExpandFileName(Buffer));
	AddMruFile(File);


	RtfWindowSetCommand(TEXT(":load "));
	StartOfInput += 6;	
	WinGHCiHyperlink(ExpandFileName(Buffer));
	StartOfInput += StringLen(ExpandFileName(Buffer));
	
	RtfWindowStartNextOutput();
	AddHistory(Command);
	SendToGHCiStdinLn(Command);

	Running = TRUE;
	EnableButtons();
	
	PrintGHCiOutputIfAvailable(hChildStderrRd, ErrorColor);
	PrintGHCiOutput(hChildStdoutRd, ForegroundColor);
	
	Running = FALSE;
	EnableButtons();
}
Beispiel #2
0
VOID SendOptions2GHCi(VOID)
{
	FLAG *fs;
	TCHAR Buffer[1024];

	for(fs = flags; fs->FlagState != NULL; fs++) {
		MakeGHCiFlagCommand(fs,Buffer);
		SendToGHCiStdinLn(Buffer);
	}

	MakeGHCiExpandedEditorCommand(ComboGetValue(GHCi_Combo_Editor), Buffer);
	SendToGHCiStdinLn(Buffer);
	 
	MakeGHCiPromptCommand(ComboGetValue(GHCi_Combo_Prompt), Buffer, TRUE);
	SendToGHCiStdinLn(Buffer);

	PrintGHCiOutput(hChildStdoutRd, STDOUT_COLOR);

	// clear screen, so that only one instance of the prompt is shown
	RtfWindowClearLastLine();
	SendToGHCiStdinLn(TEXT(""));
	PrintGHCiOutput(hChildStdoutRd, STDOUT_COLOR);

}
Beispiel #3
0
VOID FireCommandAux(LPCTSTR Command, BOOL WaitForResponse, BOOL startThread, BOOL StopStdoutPrinterThread, BOOL WantPreprocess, FireCommandThreadArgs *pArgs) 
{

	#define MAXLEN    (3*1024)

	TCHAR NewCommand[MAXLEN];

	if(StopStdoutPrinterThread)
		//stop StdoutPrinterThread
		SignalObjectAndWait( hSigSuspendStdoutPrinterThread
			                ,hSigStdoutPrinterThreadSuspended, INFINITE, FALSE);


	RtfWindowSetCommand(Command);
	RtfWindowStartNextOutput();
	AddHistory(Command);

	if(WantPreprocess) {
		PreprocessCommand(Command, NewCommand);
		SendToGHCiStdinLn(NewCommand);
	}
	else
		SendToGHCiStdinLn(Command);


	if(WaitForResponse) {
		Running = TRUE;
		EnableButtons();
		
		PrintGHCiOutput(hChildStdoutRd, ForegroundColor);
		
		Running = FALSE;
		EnableButtons();

	}

	// resume StdoutPrinterThread
	if(StopStdoutPrinterThread)
		SetEvent(hSigResumeStdoutPrinterThread);

	if(startThread) {
		// free arguments
		free((LPTSTR)Command);
		free(pArgs);
	}
}