35 #define CC_DEBUGINFO_DEBUG_OUTPUT 0 37 #if defined(CC_GLOBAL_DEBUG_OUTPUT) 38 #if CC_GLOBAL_DEBUG_OUTPUT == 1 39 #undef CC_DEBUGINFO_DEBUG_OUTPUT 40 #define CC_DEBUGINFO_DEBUG_OUTPUT 1 41 #elif CC_GLOBAL_DEBUG_OUTPUT == 2 42 #undef CC_DEBUGINFO_DEBUG_OUTPUT 43 #define CC_DEBUGINFO_DEBUG_OUTPUT 2 47 #if CC_DEBUGINFO_DEBUG_OUTPUT == 1 48 #define TRACE(format, args...) \ 49 CCLogger::Get()->DebugLog(F(format, ##args)) 50 #define TRACE2(format, args...) 51 #elif CC_DEBUGINFO_DEBUG_OUTPUT == 2 52 #define TRACE(format, args...) \ 55 if (g_EnableDebugTrace) \ 56 CCLogger::Get()->DebugLog(F(format, ##args)); \ 59 #define TRACE2(format, args...) \ 60 CCLogger::Get()->DebugLog(F(format, ##args)) 62 #define TRACE(format, args...) 63 #define TRACE2(format, args...) 75 _T(
"Text files (*.txt)|*.txt|Any file (*)|*"),
89 cbMessageBox(
_(
"Cannot create file ") + fname,
_(
"CC Debug Info"));
205 btnFind->SetDefault();
229 FlexGridSizer1->Add(lblFullType, 0,
wxALIGN_TOP, 0);
231 FlexGridSizer1->Add(txtFullType, 0,
wxALIGN_TOP, 0);
233 FlexGridSizer1->Add(lblBaseType, 0,
wxALIGN_TOP, 0);
235 FlexGridSizer1->Add(txtBaseType, 0,
wxALIGN_TOP, 0);
241 FlexGridSizer1->Add(lblArgsStripped, 0,
wxALIGN_TOP, 0);
243 FlexGridSizer1->Add(txtArgsStripped, 0,
wxALIGN_TOP, 0);
245 FlexGridSizer1->Add(lblTemplateArg, 0,
wxALIGN_TOP, 0);
247 FlexGridSizer1->Add(txtTemplateArg, 0,
wxALIGN_TOP, 0);
253 FlexGridSizer1->Add(lblIsLocal, 0,
wxALIGN_TOP, 0);
255 FlexGridSizer1->Add(txtIsLocal, 0,
wxALIGN_TOP, 0);
261 FlexGridSizer1->Add(lblIsConst, 0,
wxALIGN_TOP, 0);
263 FlexGridSizer1->Add(txtIsConst, 0,
wxALIGN_TOP, 0);
265 FlexGridSizer1->Add(lblIsNoExcept, 0,
wxALIGN_TOP, 0);
267 FlexGridSizer1->Add(txtIsNoExcept, 0,
wxALIGN_TOP, 0);
269 FlexGridSizer1->Add(lblNameSpace, 0,
wxALIGN_TOP, 0);
271 FlexGridSizer1->Add(txtNamespace, 0,
wxALIGN_TOP, 0);
279 FlexGridSizer1->Add(BoxSizer7, 0,
wxEXPAND, 0);
287 FlexGridSizer1->Add(BoxSizer8, 0,
wxEXPAND, 0);
295 FlexGridSizer1->Add(BoxSizer6, 0,
wxEXPAND, 0);
303 FlexGridSizer1->Add(BoxSizer5, 0,
wxEXPAND, 0);
305 FlexGridSizer1->Add(lblDeclFile, 0,
wxALIGN_TOP, 0);
311 FlexGridSizer1->Add(BoxSizer11, 0,
wxEXPAND, 0);
313 FlexGridSizer1->Add(lblImplfile, 0,
wxALIGN_TOP, 0);
319 FlexGridSizer1->Add(BoxSizer12, 0,
wxEXPAND, 0);
321 FlexGridSizer1->Add(lblUserData, 0,
wxALIGN_TOP, 0);
323 FlexGridSizer1->Add(txtUserData, 0,
wxALIGN_TOP, 0);
325 Panel1->SetSizer(BoxSizer2);
326 BoxSizer2->
Fit(Panel1);
332 Panel2->SetSizer(BoxSizer3);
333 BoxSizer3->
Fit(Panel2);
339 Panel3->SetSizer(BoxSizer9);
340 BoxSizer9->
Fit(Panel3);
346 Panel4->SetSizer(BoxSizer13);
347 BoxSizer13->
Fit(Panel4);
349 Notebook1->
AddPage(Panel1,
_(
"Tokens"),
false);
350 Notebook1->
AddPage(Panel2,
_(
"Files list"),
false);
351 Notebook1->
AddPage(Panel3,
_(
"Search dirs"),
false);
352 Notebook1->
AddPage(Panel4,
_(
"Predefined macros"),
false);
364 StdDialogButtonSizer1->
Realize();
367 BoxSizer1->
Fit(
this);
378 Connect(ID_BUTTON6,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&
CCDebugInfo::OnSave);
391 TokenTree* tree = m_Parser->GetTokenTree();
413 for (
size_t i = 0; i < dirs.
GetCount(); ++i)
417 lstDirs->Append(file);
429 while ( tknzr.HasMoreTokens() )
431 wxString macro = tknzr.GetNextToken();
456 cmbChildren->Clear();
457 cmbAncestors->Clear();
458 cmbDescendants->Clear();
464 TokenTree* tree = m_Parser->GetTokenTree();
467 const Token* parent = tree->
at(m_Token->m_ParentIndex);
470 wxString args = m_Token->GetFormattedArgs();
471 wxString argsStr = m_Token->m_BaseArgs;
472 wxString tmplArg = m_Token->m_TemplateArgument;
473 wxString fullType = m_Token->m_FullType;
482 txtName->SetLabel(m_Token->m_Name);
483 txtKind->SetLabel(m_Token->GetTokenKindString());
484 txtScope->SetLabel(m_Token->GetTokenScopeString());
485 txtFullType->SetLabel(fullType);
486 txtBaseType->SetLabel(m_Token->m_BaseType);
487 txtArgs->SetLabel(args);
488 txtArgsStripped->SetLabel(argsStr);
489 txtTemplateArg->SetLabel(tmplArg);
490 txtIsOp->SetLabel(m_Token->m_IsOperator ?
_(
"Yes") :
_(
"No"));
491 txtIsLocal->SetLabel(m_Token->m_IsLocal ?
_(
"Yes") :
_(
"No"));
492 txtIsTemp->SetLabel(m_Token->m_IsTemp ?
_(
"Yes") :
_(
"No"));
493 txtIsConst->SetLabel(m_Token->m_IsConst ?
_(
"Yes") :
_(
"No"));
494 txtIsNoExcept->SetLabel(m_Token->m_IsNoExcept ?
_(
"Yes") :
_(
"No"));
495 txtNamespace->SetLabel(m_Token->GetNamespace());
500 label =
_(
"<Global namespace>");
507 if (!m_Token->GetFilename().IsEmpty())
508 txtDeclFile->SetLabel(
wxString::Format(
_T(
"%s : %u"), m_Token->GetFilename().c_str(), m_Token->m_Line));
511 if (!m_Token->GetImplFilename().IsEmpty())
512 txtImplFile->SetLabel(
wxString::Format(
_(
"%s : %u (code lines: %u to %u)"), m_Token->GetImplFilename().
c_str(), m_Token->m_ImplLine, m_Token->m_ImplLineStart, m_Token->m_ImplLineEnd));
520 TokenTree* tree = m_Parser->GetTokenTree();
523 cmbChildren->
Clear();
525 for (TokenIdxSet::const_iterator it = m_Token->m_Children.begin(); it != m_Token->m_Children.end(); ++it)
527 const Token* child = tree->
at(*it);
528 const wxString msgInvalidToken =
_(
"<invalid token>");
531 cmbChildren->SetSelection(0);
536 TokenTree* tree = m_Parser->GetTokenTree();
539 cmbAncestors->
Clear();
541 for (TokenIdxSet::const_iterator it = m_Token->m_Ancestors.begin(); it != m_Token->m_Ancestors.end(); ++it)
543 const Token* ancestor = tree->
at(*it);
544 const wxString msgInvalidToken =
_(
"<invalid token>");
547 cmbAncestors->SetSelection(0);
552 TokenTree* tree = m_Parser->GetTokenTree();
555 cmbDescendants->
Clear();
557 for (TokenIdxSet::const_iterator it = m_Token->m_Descendants.begin(); it != m_Token->m_Descendants.end(); ++it)
559 const Token* descendant = tree->
at(*it);
560 const wxString msgInvalidToken =
_(
"<invalid token>");
563 cmbDescendants->SetSelection(0);
568 if (!m_Parser || !m_Parser->GetTokenTree())
571 txtInfo->SetLabel(
wxString::Format(
_(
"The parser contains %lu tokens, found in %lu files"),
572 static_cast<unsigned long>(m_Parser->GetTokenTree()->size()),
573 static_cast<unsigned long>(m_Parser->GetTokenTree()->m_FileMap.size())));
580 txtFilter->SetFocus();
585 TokenTree* tree = m_Parser->GetTokenTree();
588 wxString search = txtFilter->GetValue();
597 m_Token = tree->
at(
id);
603 for (
size_t i = 0; i < tree->
size(); ++i)
605 const Token* token = tree->
at(i);
611 if (result.size() == 1)
612 m_Token = tree->
at(*(result.begin()));
618 for (TokenIdxSet::const_iterator it = result.begin(); it != result.end(); ++it)
620 const Token* token = tree->
at(*it);
629 m_Token = tree->
at(intarr[sel]);
638 int idx = cmbAncestors->GetSelection();
639 if (!m_Token || idx == -1)
643 for (TokenIdxSet::const_iterator it = m_Token->m_Ancestors.begin(); it != m_Token->m_Ancestors.end(); ++it)
646 m_Token = m_Parser->GetTokenTree()->at(*it);
657 int idx = cmbDescendants->GetSelection();
658 if (!m_Token || idx == -1)
662 for (TokenIdxSet::const_iterator it = m_Token->m_Descendants.begin(); it != m_Token->m_Descendants.end(); ++it)
666 m_Token = m_Parser->GetTokenTree()->at(*it);
676 if (!m_Token || m_Token->m_ParentIndex == -1)
679 m_Token = m_Parser->GetTokenTree()->at(m_Token->m_ParentIndex);
685 int idx = cmbChildren->GetSelection();
686 if (!m_Token || idx == -1)
690 for (TokenIdxSet::const_iterator it = m_Token->m_Children.begin(); it != m_Token->m_Children.end(); ++it)
694 m_Token = m_Parser->GetTokenTree()->at(*it);
704 TokenTree* tree = m_Parser->GetTokenTree();
707 saveWhat.
Add(
_(
"Dump the tokens tree"));
708 saveWhat.
Add(
_(
"Dump the serialised tokens tree"));
709 saveWhat.
Add(
_(
"Dump the file list"));
710 saveWhat.
Add(
_(
"Dump the list of include directories"));
711 saveWhat.
Add(
_(
"Dump the token list of files"));
714 saveWhat,
this,
wxSize(400, 400));
727 wxBusyInfo running(
_(
"Obtaining tokens tree... please wait (this may take several seconds)..."),
740 wxBusyInfo running(
_(
"Serialising tokens tree... please wait (this may take several seconds)..."),
755 files += file +
_T(
"\r\n");
765 for (
size_t i = 0; i < dirsArray.
GetCount(); ++i)
769 dirs += dir +
_T(
"\r\n");
779 wxBusyInfo running(
_(
"Obtaining tokens tree... please wait (this may take several seconds)..."),
786 fileTokens += file +
_T(
"\r\n");
790 for (TokenIdxSet::const_iterator it = result.begin(); it != result.end(); ++it)
792 const Token* token = tree->
at(*it);
798 fileTokens << _T(
"[") << token->
m_Line << _T(
",") << token->
m_ImplLine << _T(
"]");
799 fileTokens << _T(
"\r\n");
802 fileTokens +=
_T(
"\r\n");
819 if (m_Token && !m_Token->GetFilename().IsEmpty())
821 file = m_Token->GetFilename();
822 line = m_Token->m_Line;
843 if (m_Token && !m_Token->GetImplFilename().IsEmpty())
845 file = m_Token->GetImplFilename();
846 line = m_Token->m_ImplLine;
static const long ID_STATICTEXT14
wxSize Fit(wxWindow *window)
cbEditor * IsBuiltinOpen(const wxString &filename)
void SaveCCDebugInfo(const wxString &fileDesc, const wxString &content)
static const long ID_PANEL4
virtual bool AddPage(wxWindow *page, const wxString &text, bool select=false, int imageId=NO_IMAGE)
bool Matches(const wxString &mask) const
static const long ID_TEXTCTRL1
static const long ID_STATICTEXT37
TokenSearchTree m_Tree
This is a string->TokenIndexSet map.
static const long ID_STATICTEXT26
void OnGoDescClick(wxCommandEvent &event)
static const long ID_STATICTEXT41
const wxValidator wxDefaultValidator
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
wxString m_Name
Token's name, it can be searched in the TokenTree.
unsigned int m_ImplLine
function implementation line index
static const long ID_STATICTEXT18
static const long ID_STATICTEXT28
static const long ID_LISTBOX2
static const long ID_PANEL2
void GotoLine(int line, bool centerOnScreen=true) override
Move the caret at the specified line.
void OnGoAscClick(wxCommandEvent &event)
a container class to hold all the Tokens getting from parsing stage
static const long ID_PANEL1
virtual void Activate()
Activate this editor.
DLLIMPORT int cbGetSingleChoiceIndex(const wxString &message, const wxString &caption, const wxArrayString &choices, wxWindow *parent=NULL, const wxSize &size=wxSize(300, 300), int initialSelection=0)
static const long ID_STATICTEXT33
unsigned int m_Line
Line index where the token was met, which is 1 based.
void OnGoDeclClick(wxCommandEvent &event)
size_t size()
total size of std::vector<Token*>
void AddGrowableCol(size_t idx, int proportion=0)
bool ToULong(unsigned long *val, int base=10) const
wxString DisplayName() const
a short simple string to show the token information, this usually generate for show the tip message w...
static const long ID_COMBOBOX2
static const long ID_STATICTEXT35
EditorManager * GetEditorManager() const
void RecalcInheritanceChain(Token *token)
convert the Token's ancestor string to it's IDs this contains recursive calls, for example in such co...
static const long ID_LISTBOX3
static const long ID_STATICTEXT8
static const long ID_STATICTEXT2
static const long ID_STATICTEXT10
a symbol found in the parsed files, it can be many kinds, such as a variable, a class and so on...
std::set< int, std::less< int > > TokenIdxSet
wxSizerItem * Add(wxWindow *window, const wxSizerFlags &flags)
static const long ID_STATICTEXT16
size_t Replace(const wxString &strOld, const wxString &strNew, bool replaceAll=true)
void OnFindClick(wxCommandEvent &event)
const wxSize wxDefaultSize
size_t FindTokensInFile(const wxString &filename, TokenIdxSet &result, short int kindMask)
find tokens belong to a specified file
const wxPoint wxDefaultPosition
static const long ID_STATICTEXT4
const wxStringCharType * wx_str() const
#define wxDEFAULT_DIALOG_STYLE
static const long ID_COMBOBOX3
virtual wxString GetPath() const
wxString dump()
Dumps a graphical version of the tree.
static const long ID_COMBOBOX1
cbEditor * Open(const wxString &filename, int pos=0, ProjectFile *data=nullptr)
const wxString & _(const wxString &string)
void OnGoParentClick(wxCommandEvent &event)
static const long ID_STATICTEXT20
void OnInit(wxInitDialogEvent &event)
wxArray< int > wxArrayInt
wxString Serialize()
Loads the Tree and items from a file.
wxEventType wxEVT_INIT_DIALOG
wxString & Append(const char *psz)
DLLIMPORT void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode=pdlBest, bool enforce=false)
void OnGoImplClick(wxCommandEvent &event)
TokenKind m_TokenKind
See TokenKind class.
static const long ID_PANEL3
void SetSizeHints(wxWindow *window)
general function, not constructor nor destructor
size_t Add(const wxString &str, size_t copies=1)
void OnGoChildrenClick(wxCommandEvent &event)
static const long ID_NOTEBOOK1
static const long ID_STATICTEXT6
static const long ID_STATICTEXT24
static const long ID_STATICTEXT1
TokenFilenameMap m_FilenameMap
Map: file names -> file indices.
void OnSave(wxCommandEvent &event)
const wxString GetString(size_t n) const
Gets the key string for item n.
static const long ID_STATICTEXT39
wxString GetTokenKindString() const
the token kind string, e.g.
static wxString Format(const wxString &format,...)
size_t Write(const void *buffer, size_t count)
static const long ID_LISTBOX1
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
static const long ID_STATICTEXT12
virtual size_t size() const