Added debugging.
This commit is contained in:
parent
cb4f04c94e
commit
d42ded5b16
@ -38,13 +38,21 @@ void CMakeErrorHandler(const char* message, const char* title, bool& disable)
|
|||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
bool debug = false;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int j;
|
int j;
|
||||||
cmake msg;
|
cmake msg;
|
||||||
std::vector<std::string> args;
|
std::vector<std::string> args;
|
||||||
for(j =0; j < argc; ++j)
|
for(j =0; j < argc; ++j)
|
||||||
{
|
{
|
||||||
args.push_back(argv[j]);
|
if(strcmp(argv[j], "-debug") == 0)
|
||||||
|
{
|
||||||
|
debug = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
args.push_back(argv[j]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=1; i < args.size(); ++i)
|
for(i=1; i < args.size(); ++i)
|
||||||
@ -64,6 +72,11 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
cmCacheManager::GetInstance()->LoadCache(cmSystemTools::GetCurrentWorkingDirectory().c_str());
|
cmCacheManager::GetInstance()->LoadCache(cmSystemTools::GetCurrentWorkingDirectory().c_str());
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
cmCursesForm::DebugStart();
|
||||||
|
}
|
||||||
|
|
||||||
initscr(); /* Initialization */
|
initscr(); /* Initialization */
|
||||||
noecho(); /* Echo off */
|
noecho(); /* Echo off */
|
||||||
cbreak(); /* nl- or cr not needed */
|
cbreak(); /* nl- or cr not needed */
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#include "cmCursesForm.h"
|
#include "cmCursesForm.h"
|
||||||
|
|
||||||
|
std::ofstream cmCursesForm::DebugFile;
|
||||||
|
bool cmCursesForm::Debug = false;
|
||||||
|
|
||||||
cmCursesForm::cmCursesForm()
|
cmCursesForm::cmCursesForm()
|
||||||
{
|
{
|
||||||
m_Form = 0;
|
m_Form = 0;
|
||||||
@ -14,3 +17,30 @@ cmCursesForm::~cmCursesForm()
|
|||||||
m_Form = 0;
|
m_Form = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmCursesForm::DebugStart()
|
||||||
|
{
|
||||||
|
cmCursesForm::Debug = true;
|
||||||
|
cmCursesForm::DebugFile.open("ccmakelog.txt");
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmCursesForm::DebugEnd()
|
||||||
|
{
|
||||||
|
if (!cmCursesForm::Debug)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmCursesForm::Debug = false;
|
||||||
|
cmCursesForm::DebugFile.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmCursesForm::LogMessage(const char* msg)
|
||||||
|
{
|
||||||
|
if (!cmCursesForm::Debug)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmCursesForm::DebugFile << msg << std::endl;
|
||||||
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef __cmCursesForm_h
|
#ifndef __cmCursesForm_h
|
||||||
#define __cmCursesForm_h
|
#define __cmCursesForm_h
|
||||||
|
|
||||||
|
#include "../cmStandardIncludes.h"
|
||||||
#include "cmCursesStandardIncludes.h"
|
#include "cmCursesStandardIncludes.h"
|
||||||
|
|
||||||
class cmCursesForm
|
class cmCursesForm
|
||||||
@ -22,13 +23,31 @@ public:
|
|||||||
// The only exception is during a resize.
|
// The only exception is during a resize.
|
||||||
virtual void UpdateStatusBar() = 0;
|
virtual void UpdateStatusBar() = 0;
|
||||||
|
|
||||||
|
// Description:
|
||||||
// During a CMake run, an error handle should add errors
|
// During a CMake run, an error handle should add errors
|
||||||
// to be displayed afterwards.
|
// to be displayed afterwards.
|
||||||
virtual void AddError(const char* message, const char* title) {};
|
virtual void AddError(const char* message, const char* title) {};
|
||||||
|
|
||||||
|
// Description:
|
||||||
|
// Turn debugging on. This will create ccmakelog.txt.
|
||||||
|
static void DebugStart();
|
||||||
|
|
||||||
|
// Description:
|
||||||
|
// Turn debugging off. This will close ccmakelog.txt.
|
||||||
|
static void DebugEnd();
|
||||||
|
|
||||||
|
// Description:
|
||||||
|
// Write a debugging message.
|
||||||
|
static void LogMessage(const char* msg);
|
||||||
|
|
||||||
static cmCursesForm* CurrentForm;
|
static cmCursesForm* CurrentForm;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
static std::ofstream DebugFile;
|
||||||
|
static bool Debug;
|
||||||
|
|
||||||
cmCursesForm(const cmCursesForm& from);
|
cmCursesForm(const cmCursesForm& from);
|
||||||
void operator=(const cmCursesForm&);
|
void operator=(const cmCursesForm&);
|
||||||
|
|
||||||
|
@ -156,10 +156,15 @@ void cmCursesLongMessageForm::HandleInput()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char debugMessage[128];
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
int key = getch();
|
int key = getch();
|
||||||
|
|
||||||
|
sprintf(debugMessage, "Message widget handling input, key: %d", key);
|
||||||
|
cmCursesForm::LogMessage(debugMessage);
|
||||||
|
|
||||||
// quit
|
// quit
|
||||||
if ( key == 'o' )
|
if ( key == 'o' )
|
||||||
{
|
{
|
||||||
|
@ -539,6 +539,9 @@ void cmCursesMainForm::HandleInput()
|
|||||||
|
|
||||||
FIELD* currentField;
|
FIELD* currentField;
|
||||||
cmCursesWidget* currentWidget;
|
cmCursesWidget* currentWidget;
|
||||||
|
|
||||||
|
char debugMessage[128];
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
this->UpdateStatusBar();
|
this->UpdateStatusBar();
|
||||||
@ -551,6 +554,8 @@ void cmCursesMainForm::HandleInput()
|
|||||||
|
|
||||||
if (!currentWidget || !currentWidget->HandleInput(key, m_Form, stdscr))
|
if (!currentWidget || !currentWidget->HandleInput(key, m_Form, stdscr))
|
||||||
{
|
{
|
||||||
|
sprintf(debugMessage, "Main form handling input, key: %d", key);
|
||||||
|
cmCursesForm::LogMessage(debugMessage);
|
||||||
// quit
|
// quit
|
||||||
if ( key == 'q' )
|
if ( key == 'q' )
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include "cmCursesStringWidget.h"
|
#include "cmCursesStringWidget.h"
|
||||||
|
#include "cmCursesForm.h"
|
||||||
|
|
||||||
inline int ctrl(int z)
|
inline int ctrl(int z)
|
||||||
{
|
{
|
||||||
return (z&037);
|
return (z&037);
|
||||||
@ -26,9 +28,13 @@ bool cmCursesStringWidget::HandleInput(int& key, FORM* form, WINDOW* w)
|
|||||||
|
|
||||||
char* originalStr=0;
|
char* originalStr=0;
|
||||||
|
|
||||||
|
char debugMessage[128];
|
||||||
|
|
||||||
// <Enter> is used to change edit mode (like <Esc> in vi).
|
// <Enter> is used to change edit mode (like <Esc> in vi).
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
sprintf(debugMessage, "String widget handling input, key: %d", key);
|
||||||
|
cmCursesForm::LogMessage(debugMessage);
|
||||||
// If resize occured during edit, move out of edit mode
|
// If resize occured during edit, move out of edit mode
|
||||||
if (!m_InEdit && ( key != 10 && key != KEY_ENTER ) )
|
if (!m_InEdit && ( key != 10 && key != KEY_ENTER ) )
|
||||||
{
|
{
|
||||||
@ -39,6 +45,7 @@ bool cmCursesStringWidget::HandleInput(int& key, FORM* form, WINDOW* w)
|
|||||||
{
|
{
|
||||||
if (m_InEdit)
|
if (m_InEdit)
|
||||||
{
|
{
|
||||||
|
cmCursesForm::LogMessage("String widget leaving edit.");
|
||||||
m_InEdit = false;
|
m_InEdit = false;
|
||||||
delete[] originalStr;
|
delete[] originalStr;
|
||||||
// trick to force forms to update the field buffer
|
// trick to force forms to update the field buffer
|
||||||
@ -48,6 +55,7 @@ bool cmCursesStringWidget::HandleInput(int& key, FORM* form, WINDOW* w)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
cmCursesForm::LogMessage("String widget entering edit.");
|
||||||
m_InEdit = true;
|
m_InEdit = true;
|
||||||
char* buf = field_buffer(m_Field, 0);
|
char* buf = field_buffer(m_Field, 0);
|
||||||
originalStr = new char[strlen(buf)+1];
|
originalStr = new char[strlen(buf)+1];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user