#include "compileconfig.h" #include "parsermanager.h" #include /*! the function for the second thread */ //DWORD WINAPI CalculationsProcedure(LPVOID lpParameter) unsigned __stdcall CalculationsProcedure(void *) { /* using namespace ttmath; Parser > parser; parser.Parse("6"); std::string buf; parser.stack[0].value.ToString(buf); MessageBox(0, buf.c_str(), "", 0); */ ParserManager parser_manager; parser_manager.Init(); // the main loop of calculations while( GetPrgRes()->GetThreadController()->WaitForCalculatingAndBlockForStop() ) { // for the first we must copy all variables which we're using // (at this moment all calling from the main thread are stopped) parser_manager.MakeCopyOfVariables(); // then we can set 'thread_controller' as being ready for 'stop' signal GetPrgRes()->GetThreadController()->ReadyForStop(); // (now the main thread can call various methods for changing state) // and finally we're cleaning the output window and parsing the input string SetDlgItemText(GetPrgRes()->GetMainWindow(),IDC_OUTPUT_EDIT,""); parser_manager.Parse(); // if there was a stop signal we continue the main loop without printing any values if( GetPrgRes()->GetThreadController()->WasStopSignal() ) continue; // at the end we're printing the result parser_manager.PrintResult(); } _endthreadex(0); return 0; }