Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
New code completion remarks/issues
ollydbg:
--- Quote from: blueshake on October 11, 2009, 02:40:12 pm ---What I want to know is if doing this wil slow down the parse process?
--- End quote ---
parse C::B source code.
before patch
Parsing stage done (1511 total parsed files, 84442 tokens in 0 minute(s), 12.468 seconds).
after patch
Parsing stage done (1510 total parsed files, 84506 tokens in 0 minute(s), 12.578 seconds).
koso:
When you are talking about performance ...
I was using Symbol browser with view set to "Everything". Problem is, that now when I open project, first few seconds is C::B parsing files, and then it starts to update data in symbol browser. Becase of setting it to "Everything", it takes minutes .. and problem is, that during this operation is C::B dead = marked as "Not responding" = so I can do nothing, only look at white window (even draw events are ignored during this operation) or exit. So is there some way, how to do this more in background and not freeze whole UI?
And btw. this happens also when symbol browser is hidden.
blueshake:
Dear Morten:
Have you started the plan on macro replacement and template parse?
ollydbg:
Hi, morten, I find some bugs in CC, but I'm sorry, I can't create a patch, because my local copy was changed a lot. so, here are the modified code:
1.
plugins\codecompletion\classbrowser.cpp
function:
--- Code: ---void ClassBrowser::UpdateView()
{
m_pActiveProject = 0;
m_ActiveFilename.Clear();
if (m_pParser && !Manager::IsAppShuttingDown())
{
m_pActiveProject = Manager::Get()->GetProjectManager()->GetActiveProject();
cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
if (ed)
{
//m_ActiveFilename = ed->GetFilename().BeforeLast(_T('.'));
// the above line is a bug (see https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1559&group_id=5358)
m_ActiveFilename = ed->GetFilename().AfterLast(wxFILE_SEP_PATH);
if( m_ActiveFilename.Find(_T('.')) != wxNOT_FOUND )
{
m_ActiveFilename = ed->GetFilename().BeforeLast(wxFILE_SEP_PATH) + wxFILE_SEP_PATH + m_ActiveFilename.BeforeLast(_T('.'));
m_ActiveFilename.Append(_T('.'));
}
else
m_ActiveFilename = ed->GetFilename();
}
BuildTree();
wxSplitterWindow* splitter = XRCCTRL(*this, "splitterWin", wxSplitterWindow);
if (m_pParser->ClassBrowserOptions().treeMembers)
{
splitter->SplitHorizontally(m_Tree, m_TreeBottom);
m_TreeBottom->Show(true);
}
else
{
splitter->Unsplit();
m_TreeBottom->Show(false);
}
}
else
m_Tree->DeleteAllItems();
}
--- End code ---
For example, I have a file:
d:\MinGW\lib\gcc\mingw32\4.4.1\include\c++\vector
So, I would like to see the tokens in this file.
2. Also, the function can give the right tokens in the right file, but it seems the Browser build thread still remove all the nodes.
For example:
d:\MinGW\lib\gcc\mingw32\4.4.1\include\c++\bits\stl_vector.h
Loot at the symbol browser tree window, there is no node shown there. :(
3.
I have change the SkipComments function in tokenizer.cpp
See here
--- Code: ---bool Tokenizer::SkipComment(bool skipEndWhite)
{
bool cstyle; // C or C++ style comments
//check the comment prompt
if(CurrentChar() == '/')
{
if(NextChar() == '*')
cstyle = true;
else if(NextChar() == '/')
cstyle = false;
else
return true; //Not the comment prompt, return true;
}
else
return true; //Not the comment prompt, return true;
MoveToNextChar(2); //skip the comment prompt
while(true)
{
if (cstyle) //c style comment
{
SkipToChar('/');
if (PreviousChar() == '*')//the end of C style comments
{
MoveToNextChar();
break;
}
if(!MoveToNextChar())
break;
}
else //c++ style comment
{
SkipToEOL(false, true);//nestBrace = false skipcomment = true
MoveToNextChar();
break;
}
}
if (IsEOF())
return false;
if (skipEndWhite)
{
if(!SkipWhiteSpace())
return false;
}
else
return true;
return SkipComment(); // handle chained comments
}
--- End code ---
For the old code, if skipEndWhite == false, the function will always return false, this is something wrong.
...
Bed time,,,, I will add more tomorrow. :D
ollydbg:
1. In Tokenizer.cpp. the if condition never be true in the DoGetToken function
--- Code: --- if ( m_LastWasPreprocessor
&& !str.IsSameAs(_T("#"))
&& !m_LastPreprocessor.IsSameAs(_T("#")) )
{
if (!m_LastPreprocessor.IsSameAs(TokenizerConsts::include_str))
{
// except for #include and #if[[n]def], all other preprocessor directives need only
// one word exactly after the directive, e.g. #define THIS_WORD
SkipToEOL();
}
m_LastPreprocessor.Clear();
}
--- End code ---
So, these code can be deleted.
2, I tokenizer.h think in the CurrentChar function, we don't need to check index value, because MoveToNextChar already do this.
--- Code: --- bool MoveToNextChar(const unsigned int amount = 1)
{
assert(amount);
if(amount == 1) // compiler will dead-strip this
{
++m_TokenIndex;
if (IsEOF())
{
m_TokenIndex = m_BufferLen;
return false;
}
if (CurrentChar() == _T('\n'))
++m_LineNumber;
return true;
}
else
{
m_TokenIndex += amount;
if (IsEOF())
{
m_TokenIndex = m_BufferLen;
return false;
}
if (CurrentChar() == _T('\n'))
++m_LineNumber;
return true;
}
};
wxChar CurrentChar() const
{
if(m_TokenIndex < m_BufferLen)
return m_Buffer.GetChar(m_TokenIndex);
return 0;
};
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version