More warning and error fixes (work in progress with Tinderbox).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -241,7 +241,7 @@ public:
|
|||||||
// return true if we ignore this class entirely
|
// return true if we ignore this class entirely
|
||||||
bool IgnoreClass(const wxString& classname) const
|
bool IgnoreClass(const wxString& classname) const
|
||||||
{
|
{
|
||||||
IgnoreListEntry ignore(classname, _T(""));
|
IgnoreListEntry ignore(classname, wxEmptyString);
|
||||||
|
|
||||||
return m_ignore.Index(&ignore) != wxNOT_FOUND;
|
return m_ignore.Index(&ignore) != wxNOT_FOUND;
|
||||||
}
|
}
|
||||||
@@ -757,7 +757,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
if ( 0 && ctxTop )
|
if ( 0 && ctxTop )
|
||||||
ctxTop->Dump("");
|
ctxTop->Dump(wxEmptyString);
|
||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -813,7 +813,7 @@ void HelpGenVisitor::Reset()
|
|||||||
m_funcName =
|
m_funcName =
|
||||||
m_textFunc =
|
m_textFunc =
|
||||||
m_textStoredTypedefs =
|
m_textStoredTypedefs =
|
||||||
m_textStoredFunctionComment = "";
|
m_textStoredFunctionComment = wxEmptyString;
|
||||||
|
|
||||||
m_arrayFuncDocs.Empty();
|
m_arrayFuncDocs.Empty();
|
||||||
|
|
||||||
@@ -1318,7 +1318,7 @@ void HelpGenVisitor::VisitParameter( spParameter& param )
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_textFunc << "\\param{" << param.m_Type << " }{" << param.GetName();
|
m_textFunc << "\\param{" << param.m_Type << " }{" << param.GetName();
|
||||||
wxString defvalue = param.mInitVal;
|
wxString defvalue = param.m_InitVal;
|
||||||
if ( !defvalue.empty() ) {
|
if ( !defvalue.empty() ) {
|
||||||
m_textFunc << " = " << defvalue;
|
m_textFunc << " = " << defvalue;
|
||||||
}
|
}
|
||||||
@@ -1897,14 +1897,14 @@ bool DocManager::DumpDifferences(spContext *ctxTop) const
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( param.GetDefValue() != ctxParam->mInitVal.c_str() ) {
|
if ( param.GetDefValue() != ctxParam->m_InitVal.c_str() ) {
|
||||||
wxLogWarning("Default value of parameter '%s' of "
|
wxLogWarning("Default value of parameter '%s' of "
|
||||||
"'%s::%s' should be '%s' and not "
|
"'%s::%s' should be '%s' and not "
|
||||||
"'%s'.",
|
"'%s'.",
|
||||||
ctxParam->m_Name.c_str(),
|
ctxParam->m_Name.c_str(),
|
||||||
nameClass.c_str(),
|
nameClass.c_str(),
|
||||||
nameMethod.c_str(),
|
nameMethod.c_str(),
|
||||||
ctxParam->mInitVal.c_str(),
|
ctxParam->m_InitVal.c_str(),
|
||||||
param.GetDefValue().c_str());
|
param.GetDefValue().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2022,7 +2022,7 @@ bool IgnoreNamesHandler::AddNamesFromFile(const wxString& filename)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// entire class
|
// entire class
|
||||||
m_ignore.Add(new IgnoreListEntry(line, ""));
|
m_ignore.Add(new IgnoreListEntry(line, wxEmptyString));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//else: comment
|
//else: comment
|
||||||
@@ -2197,6 +2197,9 @@ static const wxString GetVersionString()
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.42 2005/05/31 15:32:49 ABX
|
||||||
|
More warning and error fixes (work in progress with Tinderbox).
|
||||||
|
|
||||||
Revision 1.41 2005/05/30 13:06:15 ABX
|
Revision 1.41 2005/05/30 13:06:15 ABX
|
||||||
More warning and error fixes (work in progress with Tinderbox).
|
More warning and error fixes (work in progress with Tinderbox).
|
||||||
|
|
||||||
|
@@ -1734,7 +1734,7 @@ bool CJSourceParser::ParseArguments( char*& cur )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pPar->mInitVal = string( blocks[nameBlock], blockSizes[nameBlock] );
|
pPar->m_InitVal = wxString( blocks[nameBlock], blockSizes[nameBlock] );
|
||||||
|
|
||||||
nameBlock = nameBlock - 2; // skip '=' token and default value block
|
nameBlock = nameBlock - 2; // skip '=' token and default value block
|
||||||
typeBlock = nameBlock - 1;
|
typeBlock = nameBlock - 1;
|
||||||
@@ -1880,12 +1880,11 @@ void CJSourceParser::ParseMemberVar( char*& cur )
|
|||||||
// if comma, than variable list continues
|
// if comma, than variable list continues
|
||||||
// otherwise the variable type reached - stop
|
// otherwise the variable type reached - stop
|
||||||
|
|
||||||
if ( *cur == '=' )
|
if ( *cur == _T('=') )
|
||||||
{
|
{
|
||||||
// yes, we've mistaken, it was not a identifier,
|
// yes, we've mistaken, it was not a identifier,
|
||||||
// but it's default value
|
// but it's default value
|
||||||
pAttr->mInitVal =
|
pAttr->m_InitVal = pAttr->m_Name;
|
||||||
pAttr->m_Name;
|
|
||||||
|
|
||||||
// skip default value and '=' symbol
|
// skip default value and '=' symbol
|
||||||
skip_next_token_back( cur );
|
skip_next_token_back( cur );
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 27/12/98
|
// Created: 27/12/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Aleskandars Gluchovas
|
// Copyright: (c) Aleskandars Gluchovas
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -35,23 +35,25 @@
|
|||||||
|
|
||||||
size_t spInterFileContext::GetFileNo( const string& fname )
|
size_t spInterFileContext::GetFileNo( const string& fname )
|
||||||
{
|
{
|
||||||
size_t i;
|
for ( size_t i = 0; i != mFiles.size(); ++i )
|
||||||
for ( i = 0; i != mFiles.size(); ++i )
|
{
|
||||||
if ( fname == mFiles[i] )
|
if ( fname == mFiles[i] )
|
||||||
return i;
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
wxFAIL_MSG("File not found in array in function spInterFileContext::GetFileNo()");
|
wxFAIL_MSG("File not found in array in function spInterFileContext::GetFileNo()");
|
||||||
return 0;
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t spInterFileContext::GetFileNoOfContext( spContext& ctx )
|
size_t spInterFileContext::GetFileNoOfContext( spContext& ctx )
|
||||||
{
|
{
|
||||||
spContext* pCtx = ctx.GetEnclosingContext( SP_CTX_FILE );
|
spContext* pCtx = ctx.GetEnclosingContext( SP_CTX_FILE );
|
||||||
|
|
||||||
// DBG:: outer-file context should be present
|
// DBG:: outer-file context should be present
|
||||||
wxASSERT( pCtx && pCtx->GetType() == SP_CTX_FILE );
|
wxASSERT( pCtx && pCtx->GetType() == SP_CTX_FILE );
|
||||||
|
|
||||||
return GetFileNo( ((spFile*)pCtx)->mFileName );
|
return GetFileNo( ((spFile*)pCtx)->mFileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** public interface ***/
|
/*** public interface ***/
|
||||||
@@ -64,234 +66,232 @@ spInterFileContext::~spInterFileContext()
|
|||||||
|
|
||||||
void spInterFileContext::AddFile( const string& fname, const string& content )
|
void spInterFileContext::AddFile( const string& fname, const string& content )
|
||||||
{
|
{
|
||||||
mFiles.push_back( fname );
|
mFiles.push_back( fname );
|
||||||
mContents.push_back( content );
|
mContents.push_back( content );
|
||||||
}
|
}
|
||||||
|
|
||||||
void spInterFileContext::RemoveContext( spContext& ctx )
|
void spInterFileContext::RemoveContext( spContext& ctx )
|
||||||
{
|
{
|
||||||
wxASSERT( ctx.PositionIsKnown() ); // DBG:: should be checked by-user code
|
wxASSERT( ctx.PositionIsKnown() ); // DBG:: should be checked by-user code
|
||||||
|
|
||||||
size_t fNo = GetFileNoOfContext( ctx );
|
size_t fNo = GetFileNoOfContext( ctx );
|
||||||
|
|
||||||
mDeletionMarks.push_back( spBookmark( ctx.mSrcOffset, ctx.mContextLength, fNo ) );
|
mDeletionMarks.push_back( spBookmark( ctx.mSrcOffset, ctx.mContextLength, fNo ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void spInterFileContext::InsertBookmarkSorted( BookmarkListT& lst, spBookmark& mark )
|
void spInterFileContext::InsertBookmarkSorted( BookmarkListT& lst, spBookmark& mark )
|
||||||
{
|
{
|
||||||
for( size_t i = 0; i != lst.size(); ++i )
|
for( size_t i = 0; i != lst.size(); ++i )
|
||||||
|
|
||||||
if ( lst[i].mFrom > mark.mFrom )
|
|
||||||
{
|
|
||||||
lst.insert( &lst[i], mark );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
lst.push_back( mark );
|
if ( lst[i].mFrom > mark.mFrom )
|
||||||
}
|
{
|
||||||
|
lst.insert( &lst[i], mark );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lst.push_back( mark );
|
||||||
|
}
|
||||||
|
|
||||||
void spInterFileContext::DoAppendSourceFragment( string& source,
|
void spInterFileContext::DoAppendSourceFragment( string& source,
|
||||||
string& result,
|
string& result,
|
||||||
size_t pos, size_t len )
|
size_t pos, size_t len )
|
||||||
{
|
{
|
||||||
mFiltered.erase( mFiltered.begin(), mFiltered.end() );
|
mFiltered.erase( mFiltered.begin(), mFiltered.end() );
|
||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for( i = 0; i != mDeletionMarks.size(); ++i )
|
for( i = 0; i != mDeletionMarks.size(); ++i )
|
||||||
{
|
{
|
||||||
spBookmark& mark = mDeletionMarks[i];
|
spBookmark& mark = mDeletionMarks[i];
|
||||||
|
|
||||||
if ( mark.mFileNo == mCurFileNo &&
|
if ( mark.mFileNo == mCurFileNo &&
|
||||||
mark.mFrom >= pos && mark.mFrom < pos + len )
|
mark.mFrom >= pos && mark.mFrom < pos + len )
|
||||||
|
|
||||||
InsertBookmarkSorted( mFiltered, mark );
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t cur = pos;
|
InsertBookmarkSorted( mFiltered, mark );
|
||||||
|
}
|
||||||
for( i = 0; i != mFiltered.size(); ++ i )
|
|
||||||
{
|
|
||||||
spBookmark& mark = mFiltered[i];
|
|
||||||
|
|
||||||
result.append( source, cur, ( (size_t)mark.mFrom - cur ) );
|
size_t cur = pos;
|
||||||
|
|
||||||
cur = size_t( mark.mFrom + mark.mLen );
|
for( i = 0; i != mFiltered.size(); ++ i )
|
||||||
|
{
|
||||||
|
spBookmark& mark = mFiltered[i];
|
||||||
|
|
||||||
if ( cur >= pos + len ) // check if we've overstepped the current source-fragment
|
result.append( source, cur, ( (size_t)mark.mFrom - cur ) );
|
||||||
{
|
|
||||||
// wxASSERT(0); // DBG:: with current imp. this should not happen
|
|
||||||
wxFAIL_MSG("Overstepped the current source fragment in function\nspInterFileContext::DoAppendSourceFragment()");
|
|
||||||
cur = pos + len; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result.append( source, cur, ( pos + len ) - cur );
|
cur = size_t( mark.mFrom + mark.mLen );
|
||||||
|
|
||||||
|
if ( cur >= pos + len ) // check if we've overstepped the current source-fragment
|
||||||
|
{
|
||||||
|
// wxASSERT(0); // DBG:: with current imp. this should not happen
|
||||||
|
wxFAIL_MSG("Overstepped the current source fragment in function\nspInterFileContext::DoAppendSourceFragment()");
|
||||||
|
cur = pos + len; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.append( source, cur, ( pos + len ) - cur );
|
||||||
}
|
}
|
||||||
|
|
||||||
void spInterFileContext::GenerateContextBody( spContext& ctx,
|
void spInterFileContext::GenerateContextBody( spContext& ctx,
|
||||||
string& source,
|
string& source,
|
||||||
string& result,
|
string& result,
|
||||||
size_t& lastSavedPos,
|
size_t& lastSavedPos,
|
||||||
size_t& lastKnownPos )
|
size_t& lastKnownPos )
|
||||||
{
|
{
|
||||||
if ( ctx.PositionIsKnown() )
|
if ( ctx.PositionIsKnown() )
|
||||||
|
lastKnownPos = ctx.mSrcOffset;
|
||||||
|
|
||||||
lastKnownPos = ctx.mSrcOffset;
|
if ( ctx.IsVirtualContext() )
|
||||||
|
{
|
||||||
|
// add fragment accumulated before this context
|
||||||
|
|
||||||
if ( ctx.IsVirtualContext() )
|
DoAppendSourceFragment( source, result,
|
||||||
{
|
size_t(lastSavedPos),
|
||||||
// add fragment accumulated before this context
|
size_t(lastKnownPos - lastSavedPos) );
|
||||||
|
|
||||||
DoAppendSourceFragment( source, result,
|
// add context body
|
||||||
size_t(lastSavedPos),
|
|
||||||
size_t(lastKnownPos - lastSavedPos) );
|
|
||||||
|
|
||||||
// add context body
|
result += ctx.GetVirtualContextBody();
|
||||||
|
|
||||||
result += ctx.GetVirtualContextBody();
|
lastSavedPos = lastKnownPos;
|
||||||
|
|
||||||
lastSavedPos = lastKnownPos;
|
if ( ctx.PositionIsKnown() )
|
||||||
|
{
|
||||||
|
if ( ctx.VitualContextHasChildren() )
|
||||||
|
{
|
||||||
|
lastKnownPos = ctx.mSrcOffset + ctx.mHeaderLength;
|
||||||
|
|
||||||
if ( ctx.PositionIsKnown() )
|
lastSavedPos = lastKnownPos;
|
||||||
{
|
}
|
||||||
if ( ctx.VitualContextHasChildren() )
|
else
|
||||||
{
|
{
|
||||||
lastKnownPos = ctx.mSrcOffset + ctx.mHeaderLength;
|
lastKnownPos = ctx.mSrcOffset + ctx.mContextLength;
|
||||||
|
|
||||||
lastSavedPos = lastKnownPos;
|
lastSavedPos = lastKnownPos;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lastKnownPos = ctx.mSrcOffset + ctx.mContextLength;
|
|
||||||
|
|
||||||
lastSavedPos = lastKnownPos;
|
return; // have not children
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return; // have not children
|
MMemberListT& lst = ctx.GetMembers();
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MMemberListT& lst = ctx.GetMembers();
|
for( size_t i = 0; i != lst.size(); ++i )
|
||||||
|
{
|
||||||
|
GenerateContextBody( *lst[i], source, result, lastSavedPos, lastKnownPos );
|
||||||
|
}
|
||||||
|
|
||||||
for( size_t i = 0; i != lst.size(); ++i )
|
if ( ctx.IsVirtualContext() )
|
||||||
|
{
|
||||||
GenerateContextBody( *lst[i], source, result, lastSavedPos, lastKnownPos );
|
if ( ctx.VitualContextHasChildren() && !ctx.GetFooterOfVirtualContextBody().empty() )
|
||||||
|
{
|
||||||
if ( ctx.IsVirtualContext() )
|
// append the reminder space after children of the context
|
||||||
{
|
|
||||||
if ( ctx.VitualContextHasChildren() &&
|
|
||||||
|
|
||||||
ctx.GetFooterOfVirtualContextBody() != "" )
|
DoAppendSourceFragment( result, source,
|
||||||
{
|
size_t(lastSavedPos),
|
||||||
// append the reminder space after children of the context
|
size_t(lastKnownPos - lastSavedPos) );
|
||||||
|
|
||||||
DoAppendSourceFragment( result, source,
|
// add footer
|
||||||
size_t(lastSavedPos),
|
result += ctx.GetFooterOfVirtualContextBody();
|
||||||
size_t(lastKnownPos - lastSavedPos) );
|
|
||||||
|
|
||||||
// add footer
|
lastKnownPos = ctx.mSrcOffset + ctx.mContextLength;
|
||||||
result += ctx.GetFooterOfVirtualContextBody();
|
|
||||||
|
|
||||||
lastKnownPos = ctx.mSrcOffset + ctx.mContextLength;
|
lastSavedPos = lastKnownPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lastSavedPos = lastKnownPos;
|
if ( ctx.PositionIsKnown() )
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ctx.PositionIsKnown() )
|
lastKnownPos = ctx.mSrcOffset + ctx.mContextLength;
|
||||||
|
|
||||||
lastKnownPos = ctx.mSrcOffset + ctx.mContextLength;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void spInterFileContext::GenrateContents()
|
void spInterFileContext::GenrateContents()
|
||||||
{
|
{
|
||||||
MMemberListT& lst = GetMembers();
|
MMemberListT& lst = GetMembers();
|
||||||
|
|
||||||
for( size_t f = 0; f != lst.size(); ++f )
|
for( size_t f = 0; f != lst.size(); ++f )
|
||||||
{
|
{
|
||||||
string& fname = ((spFile*)lst[f])->mFileName;
|
string& fname = ((spFile*)lst[f])->mFileName;
|
||||||
|
|
||||||
size_t fileNo = GetFileNo( fname );
|
size_t fileNo = GetFileNo( fname );
|
||||||
|
|
||||||
string& source = mContents[ fileNo ];
|
string& source = mContents[ fileNo ];
|
||||||
|
|
||||||
string result;
|
string result;
|
||||||
|
|
||||||
size_t lastKnownPos = 0, // the begining of the file is always "known"
|
size_t lastKnownPos = 0, // the begining of the file is always "known"
|
||||||
lastSavedPos = 0;
|
lastSavedPos = 0;
|
||||||
|
|
||||||
mCurFileNo = fileNo;
|
mCurFileNo = fileNo;
|
||||||
|
|
||||||
GenerateContextBody( *lst[f], source, result, lastSavedPos, lastKnownPos );
|
GenerateContextBody( *lst[f], source, result, lastSavedPos, lastKnownPos );
|
||||||
|
|
||||||
// the end of file is always known
|
// the end of file is always known
|
||||||
|
|
||||||
lastKnownPos = mContents[ fileNo ].length();
|
lastKnownPos = mContents[ fileNo ].length();
|
||||||
|
|
||||||
// append the reminder
|
// append the reminder
|
||||||
|
|
||||||
DoAppendSourceFragment( source, result,
|
DoAppendSourceFragment( source, result,
|
||||||
size_t(lastSavedPos),
|
size_t(lastSavedPos),
|
||||||
size_t(lastKnownPos - lastSavedPos) );
|
size_t(lastKnownPos - lastSavedPos) );
|
||||||
|
|
||||||
// replace original contnet with newly generated one
|
// replace original contnet with newly generated one
|
||||||
|
|
||||||
mContents[ fileNo ] = result;
|
mContents[ fileNo ] = result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void spInterFileContext::ParseContents( SourceParserPlugin* pPlugin )
|
void spInterFileContext::ParseContents( SourceParserPlugin* pPlugin )
|
||||||
{
|
{
|
||||||
mDeletionMarks.erase( mDeletionMarks.begin(), mDeletionMarks.end() );
|
mDeletionMarks.erase( mDeletionMarks.begin(), mDeletionMarks.end() );
|
||||||
|
|
||||||
RemoveChildren(); // clean up top-level context
|
RemoveChildren(); // clean up top-level context
|
||||||
|
|
||||||
mParser.SetPlugin( pPlugin );
|
mParser.SetPlugin( pPlugin );
|
||||||
|
|
||||||
for( size_t i = 0; i != mFiles.size(); ++i )
|
for( size_t i = 0; i != mFiles.size(); ++i )
|
||||||
{
|
{
|
||||||
char* s = (char*)(mContents[i].c_str());
|
char* s = (char*)(mContents[i].c_str());
|
||||||
|
|
||||||
spFile* pFCtx = mParser.Parse( s, s + mContents[i].length() );
|
spFile* pFCtx = mParser.Parse( s, s + mContents[i].length() );
|
||||||
|
|
||||||
pFCtx->mFileName = mFiles[i];
|
pFCtx->mFileName = mFiles[i];
|
||||||
|
|
||||||
AddMember( pFCtx );
|
AddMember( pFCtx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void spInterFileContext::WriteToFiles()
|
void spInterFileContext::WriteToFiles()
|
||||||
{
|
{
|
||||||
for( size_t i = 0; i != mFiles.size(); ++i )
|
for( size_t i = 0; i != mFiles.size(); ++i )
|
||||||
{
|
{
|
||||||
FILE* fp = fopen( mFiles[i].c_str(), "w+t" );
|
FILE* fp = fopen( mFiles[i].c_str(), "w+t" );
|
||||||
|
|
||||||
if ( fp != NULL )
|
if ( fp != NULL )
|
||||||
{
|
{
|
||||||
fwrite( mContents[i].c_str(), sizeof(char), mContents[i].length(), fp );
|
fwrite( mContents[i].c_str(), sizeof(char), mContents[i].length(), fp );
|
||||||
|
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string spInterFileContext::GetBody( spContext* pCtx )
|
wxString spInterFileContext::GetBody( spContext* pCtx )
|
||||||
{
|
{
|
||||||
wxASSERT( pCtx->PositionIsKnown() ); // DBG:: should be checked by-user code
|
wxASSERT( pCtx->PositionIsKnown() ); // DBG:: should be checked by-user code
|
||||||
|
|
||||||
string& source = mContents[ GetFileNoOfContext( *pCtx ) ];
|
wxString& source = mContents[ GetFileNoOfContext( *pCtx ) ];
|
||||||
|
|
||||||
return string( source.c_str() + pCtx->mSrcOffset, pCtx->mContextLength );
|
return wxString( source.c_str() + pCtx->mSrcOffset, pCtx->mContextLength );
|
||||||
}
|
}
|
||||||
|
|
||||||
string spInterFileContext::GetHeader( spContext* pCtx )
|
wxString spInterFileContext::GetHeader( spContext* pCtx )
|
||||||
{
|
{
|
||||||
wxASSERT( pCtx->PositionIsKnown() ); // DBG:: should be checked by-user code
|
wxASSERT( pCtx->PositionIsKnown() ); // DBG:: should be checked by-user code
|
||||||
|
|
||||||
wxASSERT( pCtx->mHeaderLength != -1 ); // DBG:: -/-
|
wxASSERT( pCtx->mHeaderLength != -1 ); // DBG:: -/-
|
||||||
|
|
||||||
string& source = mContents[ GetFileNoOfContext( *pCtx ) ];
|
wxString& source = mContents[ GetFileNoOfContext( *pCtx ) ];
|
||||||
|
|
||||||
return string( source.c_str() + pCtx->mSrcOffset, pCtx->mHeaderLength );
|
return wxString( source.c_str() + pCtx->mSrcOffset, pCtx->mHeaderLength );
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 27/12/98
|
// Created: 27/12/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Aleskandars Gluchovas
|
// Copyright: (c) Aleskandars Gluchovas
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef __IFCONTEXT_G__
|
#ifndef __IFCONTEXT_G__
|
||||||
@@ -18,24 +18,24 @@
|
|||||||
class spBookmark
|
class spBookmark
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
size_t mFrom;
|
size_t mFrom;
|
||||||
size_t mLen;
|
size_t mLen;
|
||||||
size_t mFileNo;
|
size_t mFileNo;
|
||||||
|
|
||||||
inline spBookmark() {}
|
inline spBookmark() {}
|
||||||
|
|
||||||
inline spBookmark( int from, int len, int fileNo )
|
inline spBookmark( int from, int len, int fileNo )
|
||||||
: mFrom( from ), mLen( len ), mFileNo( fileNo )
|
: mFrom( from ), mLen( len ), mFileNo( fileNo )
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined( wxUSE_TEMPLATE_STL )
|
#if defined( wxUSE_TEMPLATE_STL )
|
||||||
|
|
||||||
typedef vector<spBookmark) BookmarkListT
|
typedef vector<spBookmark) BookmarkListT
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
typedef WXSTL_VECTOR_SHALLOW_COPY(spBookmark) BookmarkListT;
|
typedef WXSTL_VECTOR_SHALLOW_COPY(spBookmark) BookmarkListT;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -44,56 +44,56 @@ class spInterFileContext : public spContext
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
BookmarkListT mDeletionMarks;
|
BookmarkListT mDeletionMarks;
|
||||||
|
|
||||||
BookmarkListT mFiltered;
|
BookmarkListT mFiltered;
|
||||||
|
|
||||||
size_t mCurFileNo;
|
size_t mCurFileNo;
|
||||||
|
|
||||||
CJSourceParser mParser;
|
CJSourceParser mParser;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
size_t GetFileNoOfContext( spContext& ctx );
|
size_t GetFileNoOfContext( spContext& ctx );
|
||||||
size_t GetFileNo( const string& fname );
|
size_t GetFileNo( const string& fname );
|
||||||
|
|
||||||
void InsertBookmarkSorted( BookmarkListT& lst, spBookmark& mark );
|
void InsertBookmarkSorted( BookmarkListT& lst, spBookmark& mark );
|
||||||
|
|
||||||
void DoAppendSourceFragment( string& source,
|
void DoAppendSourceFragment( string& source,
|
||||||
string& result,
|
string& result,
|
||||||
size_t pos, size_t len );
|
size_t pos, size_t len );
|
||||||
|
|
||||||
void GenerateContextBody( spContext& ctx,
|
void GenerateContextBody( spContext& ctx,
|
||||||
string& source,
|
string& source,
|
||||||
string& result,
|
string& result,
|
||||||
size_t& lastSavedPos,
|
size_t& lastSavedPos,
|
||||||
size_t& lastKnownPos );
|
size_t& lastKnownPos );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
StrListT mFiles;
|
StrListT mFiles;
|
||||||
StrListT mContents;
|
StrListT mContents;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
spInterFileContext();
|
spInterFileContext();
|
||||||
~spInterFileContext();
|
~spInterFileContext();
|
||||||
|
|
||||||
void AddFile( const string& fname, const string& content );
|
void AddFile( const string& fname, const string& content );
|
||||||
|
|
||||||
void RemoveContext( spContext& ctx );
|
void RemoveContext( spContext& ctx );
|
||||||
|
|
||||||
void GenrateContents();
|
void GenrateContents();
|
||||||
|
|
||||||
void ParseContents( SourceParserPlugin* pPlugin = NULL );
|
void ParseContents( SourceParserPlugin* pPlugin = NULL );
|
||||||
|
|
||||||
void WriteToFiles();
|
void WriteToFiles();
|
||||||
|
|
||||||
// overriden method of the base class (finds out the source fragment)
|
// overriden method of the base class (finds out the source fragment)
|
||||||
|
|
||||||
virtual string GetBody( spContext* pCtx = NULL );
|
virtual wxString GetBody( spContext* pCtx = NULL );
|
||||||
|
|
||||||
virtual string GetHeader( spContext* pCtx = NULL );
|
virtual wxString GetHeader( spContext* pCtx = NULL );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -260,26 +260,23 @@ void spContext::SetVirtualContextBody( const string& body,
|
|||||||
mIsVirtualContext = true;
|
mIsVirtualContext = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
string spContext::GetBody( spContext* pCtx )
|
wxString spContext::GetBody( spContext* pCtx )
|
||||||
{
|
{
|
||||||
if ( ( pCtx == NULL || pCtx == this ) && mIsVirtualContext )
|
if ( ( pCtx == NULL || pCtx == this ) && mIsVirtualContext )
|
||||||
|
|
||||||
return mVirtualContextBody;
|
return mVirtualContextBody;
|
||||||
|
|
||||||
if ( GetParent() )
|
if ( GetParent() )
|
||||||
|
|
||||||
return GetParent()->GetBody( ( pCtx != NULL ) ? pCtx : this );
|
return GetParent()->GetBody( ( pCtx != NULL ) ? pCtx : this );
|
||||||
else
|
else
|
||||||
return ""; // source-fragment cannot be found
|
return wxEmptyString; // source-fragment cannot be found
|
||||||
}
|
}
|
||||||
|
|
||||||
string spContext::GetHeader( spContext* pCtx )
|
wxString spContext::GetHeader( spContext* pCtx )
|
||||||
{
|
{
|
||||||
if ( GetParent() )
|
if ( GetParent() )
|
||||||
|
|
||||||
return GetParent()->GetHeader( ( pCtx != NULL ) ? pCtx : this );
|
return GetParent()->GetHeader( ( pCtx != NULL ) ? pCtx : this );
|
||||||
else
|
else
|
||||||
return ""; // source-fragment cannot be found
|
return wxEmptyString; // source-fragment cannot be found
|
||||||
}
|
}
|
||||||
|
|
||||||
bool spContext::IsFirstOccurence()
|
bool spContext::IsFirstOccurence()
|
||||||
@@ -421,12 +418,12 @@ spOperation::spOperation()
|
|||||||
mHasDefinition = false;
|
mHasDefinition = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
string spOperation::GetFullName(MarkupTagsT tags)
|
wxString spOperation::GetFullName(MarkupTagsT tags)
|
||||||
{
|
{
|
||||||
string txt = tags[TAG_BOLD].start + m_RetType;
|
wxString txt = tags[TAG_BOLD].start + m_RetType;
|
||||||
txt += " ";
|
txt += _T(" ");
|
||||||
txt += m_Name;
|
txt += m_Name;
|
||||||
txt += "( ";
|
txt += _T("( ");
|
||||||
txt += tags[TAG_BOLD].end;
|
txt += tags[TAG_BOLD].end;
|
||||||
|
|
||||||
for( size_t i = 0; i != mMembers.size(); ++i )
|
for( size_t i = 0; i != mMembers.size(); ++i )
|
||||||
@@ -437,7 +434,7 @@ string spOperation::GetFullName(MarkupTagsT tags)
|
|||||||
spParameter& param = *((spParameter*)mMembers[i]);
|
spParameter& param = *((spParameter*)mMembers[i]);
|
||||||
|
|
||||||
if ( i != 0 )
|
if ( i != 0 )
|
||||||
txt += ", ";
|
txt += _T(", ");
|
||||||
|
|
||||||
txt += tags[TAG_BOLD].start;
|
txt += tags[TAG_BOLD].start;
|
||||||
|
|
||||||
@@ -446,15 +443,15 @@ string spOperation::GetFullName(MarkupTagsT tags)
|
|||||||
txt += tags[TAG_BOLD].end;
|
txt += tags[TAG_BOLD].end;
|
||||||
txt += tags[TAG_ITALIC].start;
|
txt += tags[TAG_ITALIC].start;
|
||||||
|
|
||||||
txt += " ";
|
txt += _T(" ");
|
||||||
txt += param.m_Name;
|
txt += param.m_Name;
|
||||||
|
|
||||||
if ( param.mInitVal != "" )
|
if ( !param.m_InitVal.empty() )
|
||||||
{
|
{
|
||||||
txt += " = ";
|
txt += _T(" = ");
|
||||||
txt += tags[TAG_BOLD].start;
|
txt += tags[TAG_BOLD].start;
|
||||||
|
|
||||||
txt += param.mInitVal;
|
txt += param.m_InitVal;
|
||||||
|
|
||||||
txt += tags[TAG_BOLD].end;
|
txt += tags[TAG_BOLD].end;
|
||||||
}
|
}
|
||||||
@@ -473,13 +470,13 @@ string spOperation::GetFullName(MarkupTagsT tags)
|
|||||||
|
|
||||||
/***** Implemenentation for class spPreprocessorLine *****/
|
/***** Implemenentation for class spPreprocessorLine *****/
|
||||||
|
|
||||||
string spPreprocessorLine::CPP_GetIncludedFileNeme() const
|
wxString spPreprocessorLine::CPP_GetIncludedFileNeme() const
|
||||||
{
|
{
|
||||||
wxASSERT( GetStatementType() == SP_PREP_DEF_INCLUDE_FILE );
|
wxASSERT( GetStatementType() == SP_PREP_DEF_INCLUDE_FILE );
|
||||||
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
while( i < m_Line.length() && m_Line[i] != '"' && m_Line[i] != '<' )
|
while( i < m_Line.length() && m_Line[i] != _T('"') && m_Line[i] != _T('<') )
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
@@ -487,19 +484,19 @@ string spPreprocessorLine::CPP_GetIncludedFileNeme() const
|
|||||||
|
|
||||||
size_t start = i;
|
size_t start = i;
|
||||||
|
|
||||||
while( i < m_Line.length() && m_Line[i] != '"' && m_Line[i] != '>' )
|
while( i < m_Line.length() && m_Line[i] != _T('"') && m_Line[i] != _T('>') )
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
if ( start < m_Line.length() )
|
if ( start < m_Line.length() )
|
||||||
{
|
{
|
||||||
string fname;
|
wxString fname;
|
||||||
fname.append( m_Line, start, ( i - start ) );
|
fname.append( m_Line, start, ( i - start ) );
|
||||||
|
|
||||||
return fname;
|
return fname;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return ""; // syntax error probably
|
return wxEmptyString; // syntax error probably
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -233,23 +233,23 @@ public:
|
|||||||
class spComment
|
class spComment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxString m_Text;
|
wxString m_Text;
|
||||||
bool mIsMultiline; // multiline comments ar those with /**/'s
|
bool mIsMultiline; // multiline comments ar those with /**/'s
|
||||||
|
|
||||||
// true, if these was an empty empty
|
// true, if these was an empty empty
|
||||||
// line above single line comment
|
// line above single line comment
|
||||||
|
|
||||||
bool mStartsPar;
|
bool mStartsPar;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
bool IsMultiline() const;
|
bool IsMultiline() const;
|
||||||
bool StartsParagraph() const;
|
bool StartsParagraph() const;
|
||||||
|
|
||||||
string& GetText();
|
wxString& GetText();
|
||||||
|
|
||||||
// contstant version of GetText()
|
// contstant version of GetText()
|
||||||
string GetText() const;
|
wxString GetText() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
// abstract base class for common (to most languages) code
|
// abstract base class for common (to most languages) code
|
||||||
@@ -369,9 +369,9 @@ public:
|
|||||||
// can be overriden by top-level context classes
|
// can be overriden by top-level context classes
|
||||||
// to find-out ot the source-fragment of this
|
// to find-out ot the source-fragment of this
|
||||||
// context using it's position information
|
// context using it's position information
|
||||||
virtual string GetBody( spContext* pCtx = NULL );
|
virtual wxString GetBody( spContext* pCtx = NULL );
|
||||||
|
|
||||||
virtual string GetHeader( spContext* pCtx = NULL );
|
virtual wxString GetHeader( spContext* pCtx = NULL );
|
||||||
|
|
||||||
// true, if there is at least one entry
|
// true, if there is at least one entry
|
||||||
// in the comment list of this context
|
// in the comment list of this context
|
||||||
@@ -503,7 +503,7 @@ public:
|
|||||||
wxString m_Type;
|
wxString m_Type;
|
||||||
|
|
||||||
// "stringified" initial value
|
// "stringified" initial value
|
||||||
string mInitVal;
|
wxString m_InitVal;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual int GetContextType() const { return SP_CTX_PARAMETER; }
|
virtual int GetContextType() const { return SP_CTX_PARAMETER; }
|
||||||
@@ -524,7 +524,7 @@ public:
|
|||||||
wxString m_Type;
|
wxString m_Type;
|
||||||
|
|
||||||
// it's initial value
|
// it's initial value
|
||||||
string mInitVal;
|
wxString m_InitVal;
|
||||||
|
|
||||||
// constantness
|
// constantness
|
||||||
bool mIsConstant;
|
bool mIsConstant;
|
||||||
@@ -580,7 +580,7 @@ public:
|
|||||||
// the default implementation outputs name in
|
// the default implementation outputs name in
|
||||||
// C++/Java syntax
|
// C++/Java syntax
|
||||||
|
|
||||||
virtual string GetFullName(MarkupTagsT tags);
|
virtual wxString GetFullName(MarkupTagsT tags);
|
||||||
|
|
||||||
virtual int GetContextType() const { return SP_CTX_OPERATION; }
|
virtual int GetContextType() const { return SP_CTX_OPERATION; }
|
||||||
|
|
||||||
@@ -609,7 +609,7 @@ public:
|
|||||||
|
|
||||||
virtual int GetStatementType() const { return mDefType; }
|
virtual int GetStatementType() const { return mDefType; }
|
||||||
|
|
||||||
string CPP_GetIncludedFileNeme() const;
|
wxString CPP_GetIncludedFileNeme() const;
|
||||||
|
|
||||||
virtual void AcceptVisitor( spVisitor& visitor )
|
virtual void AcceptVisitor( spVisitor& visitor )
|
||||||
{ visitor.VisitPreprocessorLine( *this ); }
|
{ visitor.VisitPreprocessorLine( *this ); }
|
||||||
|
Reference in New Issue
Block a user