Example #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();
}
Example #2
0
DWORD WINAPI AbortExecutionThread(LPVOID lpParam)
{
	INT i=0;
	#define MAX_TRIES 4


	SetEvent(hEventCtrlBreak);
	MessageBox(hWndMain,TEXT("Interrupted"), TEXT("WinGHCi"), MB_ICONSTOP);

	while(Running && (i<MAX_TRIES)) {
		//SetEvent(hSigStopPrintGHCiOutput);
		//if(!CreateThread(NULL,0,SendLn,NULL,0,&ThreadId))
		//	ErrorExit(TEXT("CreateThread SendLn failed\n"));
		SetEvent(hEventCtrlBreak);
		Sleep(100);
		i++;

	}	
	

	if(Running) {
		SetEvent(hSigStopPrintGHCiOutput);		
		SendToGHCiStdinLn(TEXT(" "));	
	}

	return 0;


}
Example #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);
	}
}
Example #4
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);

}