Warning fixes. Code cleanup. Whitespaces and tabs removed.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27857 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-06-17 19:00:22 +00:00
parent e5a9c66398
commit 8ad74db31e
5 changed files with 1253 additions and 1280 deletions

View File

@@ -191,17 +191,17 @@ public:
bool FlushAll() bool FlushAll()
{ {
if ( m_text.empty() ) if ( m_text.empty() )
return TRUE; return true;
if ( !Write(m_text) ) { if ( !Write(m_text) ) {
wxLogError("Failed to output generated documentation."); wxLogError("Failed to output generated documentation.");
return FALSE; return false;
} }
m_text.clear(); m_text.clear();
return TRUE; return true;
} }
private: private:
@@ -223,19 +223,19 @@ public:
// already have) // already have)
bool AddNamesFromFile(const wxString& filename); bool AddNamesFromFile(const wxString& filename);
// return TRUE if we ignore this function // return true if we ignore this function
bool IgnoreMethod(const wxString& classname, bool IgnoreMethod(const wxString& classname,
const wxString& funcname) const const wxString& funcname) const
{ {
if ( IgnoreClass(classname) ) if ( IgnoreClass(classname) )
return TRUE; return true;
IgnoreListEntry ignore(classname, funcname); IgnoreListEntry ignore(classname, funcname);
return m_ignore.Index(&ignore) != wxNOT_FOUND; return m_ignore.Index(&ignore) != wxNOT_FOUND;
} }
// 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, ""); IgnoreListEntry ignore(classname, "");
@@ -321,7 +321,7 @@ protected:
wxTeXFile m_file; // file we're writing to now wxTeXFile m_file; // file we're writing to now
// state variables // state variables
bool m_inClass, // TRUE after file successfully opened bool m_inClass, // true after file successfully opened
m_inTypesSection, // enums & typedefs go there m_inTypesSection, // enums & typedefs go there
m_inMethodSection, // functions go here m_inMethodSection, // functions go here
m_isFirstParam; // first parameter of current function? m_isFirstParam; // first parameter of current function?
@@ -367,10 +367,10 @@ public:
DocManager(bool checkParamNames); DocManager(bool checkParamNames);
~DocManager(); ~DocManager();
// returns FALSE on failure // returns false on failure
bool ParseTeXFile(const wxString& filename); bool ParseTeXFile(const wxString& filename);
// returns FALSE if there were any differences // returns false if there were any differences
bool DumpDifferences(spContext *ctxTop) const; bool DumpDifferences(spContext *ctxTop) const;
// get our `ignore' object // get our `ignore' object
@@ -397,12 +397,12 @@ protected:
} }
// skips characters until the next 'c' in '*pp' unless it ends before in // skips characters until the next 'c' in '*pp' unless it ends before in
// which case FALSE is returned and pp points to '\0', otherwise TRUE is // which case false is returned and pp points to '\0', otherwise true is
// returned and pp points to 'c' // returned and pp points to 'c'
bool SkipUntil(const char **pp, char c); bool SkipUntil(const char **pp, char c);
// the same as SkipUntil() but only spaces are skipped: on first non space // the same as SkipUntil() but only spaces are skipped: on first non space
// character different from 'c' the function stops and returns FALSE // character different from 'c' the function stops and returns false
bool SkipSpaceUntil(const char **pp, char c); bool SkipSpaceUntil(const char **pp, char c);
// extract the string between {} and modify '*pp' to point at the // extract the string between {} and modify '*pp' to point at the
@@ -463,7 +463,7 @@ protected:
}; };
public: // FIXME: macro requires it public: // FIXME: macro requires it
WX_DEFINE_ARRAY(ParamInfo *, ArrayParamInfo); WX_DEFINE_ARRAY_PTR(ParamInfo *, ArrayParamInfo);
// info about a function // info about a function
struct MethodInfo struct MethodInfo
@@ -505,8 +505,8 @@ public: // FIXME: macro requires it
ArrayParamInfo m_params; ArrayParamInfo m_params;
}; };
WX_DEFINE_ARRAY(MethodInfo *, ArrayMethodInfo); WX_DEFINE_ARRAY_PTR(MethodInfo *, ArrayMethodInfo);
WX_DEFINE_ARRAY(ArrayMethodInfo *, ArrayMethodInfos); WX_DEFINE_ARRAY_PTR(ArrayMethodInfo *, ArrayMethodInfos);
private: private:
// first array contains the names of all classes we found, the second has a // first array contains the names of all classes we found, the second has a
@@ -594,8 +594,8 @@ int main(int argc, char **argv)
wxArrayString filesH, filesTeX; wxArrayString filesH, filesTeX;
wxString directoryOut, // directory for 'dmup' output wxString directoryOut, // directory for 'dmup' output
ignoreFile; // file with classes/functions to ignore ignoreFile; // file with classes/functions to ignore
bool overwrite = FALSE, // overwrite existing files during 'dump'? bool overwrite = false, // overwrite existing files during 'dump'?
paramNames = FALSE; // check param names during 'diff'? paramNames = false; // check param names during 'diff'?
for ( int current = 1; current < argc ; current++ ) { for ( int current = 1; current < argc ; current++ ) {
// all options have one letter // all options have one letter
@@ -609,7 +609,7 @@ int main(int argc, char **argv)
case 'q': case 'q':
// be quiet // be quiet
wxLog::GetActiveTarget()->SetVerbose(FALSE); wxLog::GetActiveTarget()->SetVerbose(false);
continue; continue;
case 'H': case 'H':
@@ -642,7 +642,7 @@ int main(int argc, char **argv)
break; break;
} }
paramNames = TRUE; paramNames = true;
continue; continue;
case 'f': case 'f':
@@ -652,7 +652,7 @@ int main(int argc, char **argv)
break; break;
} }
overwrite = TRUE; overwrite = true;
continue; continue;
case 'o': case 'o':
@@ -762,7 +762,7 @@ int main(int argc, char **argv)
wxLogError("Can't complete diff."); wxLogError("Can't complete diff.");
// failure // failure
return FALSE; return false;
} }
DocManager docman(paramNames); DocManager docman(paramNames);
@@ -802,7 +802,7 @@ void HelpGenVisitor::Reset()
{ {
m_inClass = m_inClass =
m_inTypesSection = m_inTypesSection =
m_inMethodSection = FALSE; m_inMethodSection = false;
m_classname = m_classname =
m_funcName = m_funcName =
@@ -839,7 +839,7 @@ void HelpGenVisitor::InsertEnumDocs()
void HelpGenVisitor::InsertDataStructuresHeader() void HelpGenVisitor::InsertDataStructuresHeader()
{ {
if ( !m_inTypesSection ) { if ( !m_inTypesSection ) {
m_inTypesSection = TRUE; m_inTypesSection = true;
m_file.WriteVerbatim("\\wxheading{Data structures}\n\n"); m_file.WriteVerbatim("\\wxheading{Data structures}\n\n");
} }
@@ -848,7 +848,7 @@ void HelpGenVisitor::InsertDataStructuresHeader()
void HelpGenVisitor::InsertMethodsHeader() void HelpGenVisitor::InsertMethodsHeader()
{ {
if ( !m_inMethodSection ) { if ( !m_inMethodSection ) {
m_inMethodSection = TRUE; m_inMethodSection = true;
m_file.WriteVerbatim( "\\latexignore{\\rtfignore{\\wxheading{Members}}}\n\n"); m_file.WriteVerbatim( "\\latexignore{\\rtfignore{\\wxheading{Members}}}\n\n");
} }
@@ -878,9 +878,11 @@ void HelpGenVisitor::CloseClass()
{ {
CloseFunction(); CloseFunction();
if ( m_inClass ) { if ( m_inClass )
{
size_t count = m_arrayFuncDocs.GetCount(); size_t count = m_arrayFuncDocs.GetCount();
if ( count ) { if ( count )
{
size_t n; size_t n;
FunctionDocEntry::classname = m_classname; FunctionDocEntry::classname = m_classname;
@@ -919,7 +921,7 @@ void HelpGenVisitor::CloseClass()
m_arrayFuncDocs.Empty(); m_arrayFuncDocs.Empty();
} }
m_inClass = FALSE; m_inClass = false;
m_classname.clear(); m_classname.clear();
} }
m_file.FlushAll(); m_file.FlushAll();
@@ -999,7 +1001,7 @@ void HelpGenVisitor::VisitClass( spClass& cl )
} }
m_inMethodSection = m_inMethodSection =
m_inTypesSection = FALSE; m_inTypesSection = false;
wxLogInfo("Created new file '%s' for class '%s'.", wxLogInfo("Created new file '%s' for class '%s'.",
filename.c_str(), name.c_str()); filename.c_str(), name.c_str());
@@ -1103,7 +1105,7 @@ void HelpGenVisitor::VisitClass( spClass& cl )
derived << "No base class"; derived << "No base class";
} }
else { else {
bool first = TRUE; bool first = true;
for ( StrListT::const_iterator i = baseClasses.begin(); for ( StrListT::const_iterator i = baseClasses.begin();
i != baseClasses.end(); i != baseClasses.end();
i++ ) { i++ ) {
@@ -1112,7 +1114,7 @@ void HelpGenVisitor::VisitClass( spClass& cl )
derived << "\\\\\n"; derived << "\\\\\n";
} }
else { else {
first = FALSE; first = false;
} }
wxString baseclass = *i; wxString baseclass = *i;
@@ -1269,7 +1271,7 @@ void HelpGenVisitor::VisitOperation( spOperation& op )
// save state info // save state info
m_funcName = funcname; m_funcName = funcname;
m_isFirstParam = TRUE; m_isFirstParam = true;
m_textStoredFunctionComment = GetAllComments(op); m_textStoredFunctionComment = GetAllComments(op);
@@ -1304,7 +1306,7 @@ void HelpGenVisitor::VisitParameter( spParameter& param )
return; return;
if ( m_isFirstParam ) { if ( m_isFirstParam ) {
m_isFirstParam = FALSE; m_isFirstParam = false;
} }
else { else {
m_textFunc << ", "; m_textFunc << ", ";
@@ -1407,11 +1409,11 @@ bool DocManager::ParseTeXFile(const wxString& filename)
wxFile file(m_filename, wxFile::read); wxFile file(m_filename, wxFile::read);
if ( !file.IsOpened() ) if ( !file.IsOpened() )
return FALSE; return false;
off_t len = file.Length(); off_t len = file.Length();
if ( len == wxInvalidOffset ) if ( len == wxInvalidOffset )
return FALSE; return false;
char *buf = new char[len + 1]; char *buf = new char[len + 1];
buf[len] = '\0'; buf[len] = '\0';
@@ -1419,7 +1421,7 @@ bool DocManager::ParseTeXFile(const wxString& filename)
if ( file.Read(buf, len) == wxInvalidOffset ) { if ( file.Read(buf, len) == wxInvalidOffset ) {
delete [] buf; delete [] buf;
return FALSE; return false;
} }
// reinit everything // reinit everything
@@ -1545,8 +1547,8 @@ bool DocManager::ParseTeXFile(const wxString& filename)
current = funcEnd + 1; current = funcEnd + 1;
// trim spaces from both sides // trim spaces from both sides
funcName.Trim(FALSE); funcName.Trim(false);
funcName.Trim(TRUE); funcName.Trim(true);
// special cases: '$...$' may be used for LaTeX inline math, remove the // special cases: '$...$' may be used for LaTeX inline math, remove the
// '$'s // '$'s
@@ -1597,7 +1599,7 @@ bool DocManager::ParseTeXFile(const wxString& filename)
wxArrayString paramNames, paramTypes, paramValues; wxArrayString paramNames, paramTypes, paramValues;
bool isVararg = FALSE; bool isVararg = false;
current++; // skip '\\' current++; // skip '\\'
lenMatch = TryMatch(current, "void"); lenMatch = TryMatch(current, "void");
@@ -1629,7 +1631,7 @@ bool DocManager::ParseTeXFile(const wxString& filename)
// vararg function? // vararg function?
wxString paramText = ExtractStringBetweenBraces(&current); wxString paramText = ExtractStringBetweenBraces(&current);
if ( paramText == "..." ) { if ( paramText == "..." ) {
isVararg = TRUE; isVararg = true;
} }
else { else {
wxLogWarning("Parameters of '%s::%s' are in " wxLogWarning("Parameters of '%s::%s' are in "
@@ -1715,20 +1717,20 @@ bool DocManager::ParseTeXFile(const wxString& filename)
wxLogVerbose("%s: finished parsing doc file '%s'.\n", wxLogVerbose("%s: finished parsing doc file '%s'.\n",
GetCurrentTime("%H:%M:%S"), m_filename.c_str()); GetCurrentTime("%H:%M:%S"), m_filename.c_str());
return TRUE; return true;
} }
bool DocManager::DumpDifferences(spContext *ctxTop) const bool DocManager::DumpDifferences(spContext *ctxTop) const
{ {
typedef MMemberListT::const_iterator MemberIndex; typedef MMemberListT::const_iterator MemberIndex;
bool foundDiff = FALSE; bool foundDiff = false;
// flag telling us whether the given class was found at all in the header // flag telling us whether the given class was found at all in the header
size_t nClass, countClassesInDocs = m_classes.GetCount(); size_t nClass, countClassesInDocs = m_classes.GetCount();
bool *classExists = new bool[countClassesInDocs]; bool *classExists = new bool[countClassesInDocs];
for ( nClass = 0; nClass < countClassesInDocs; nClass++ ) { for ( nClass = 0; nClass < countClassesInDocs; nClass++ ) {
classExists[nClass] = FALSE; classExists[nClass] = false;
} }
// ctxTop is normally an spFile // ctxTop is normally an spFile
@@ -1747,7 +1749,7 @@ bool DocManager::DumpDifferences(spContext *ctxTop) const
int index = m_classes.Index(nameClass); int index = m_classes.Index(nameClass);
if ( index == wxNOT_FOUND ) { if ( index == wxNOT_FOUND ) {
if ( !m_ignoreNames.IgnoreClass(nameClass) ) { if ( !m_ignoreNames.IgnoreClass(nameClass) ) {
foundDiff = TRUE; foundDiff = true;
wxLogError("Class '%s' is not documented at all.", wxLogError("Class '%s' is not documented at all.",
nameClass.c_str()); nameClass.c_str());
@@ -1757,7 +1759,7 @@ bool DocManager::DumpDifferences(spContext *ctxTop) const
continue; continue;
} }
else { else {
classExists[index] = TRUE; classExists[index] = true;
} }
// array of method descriptions for this class // array of method descriptions for this class
@@ -1767,7 +1769,7 @@ bool DocManager::DumpDifferences(spContext *ctxTop) const
// flags telling if we already processed given function // flags telling if we already processed given function
bool *methodExists = new bool[countMethods]; bool *methodExists = new bool[countMethods];
for ( nMethod = 0; nMethod < countMethods; nMethod++ ) { for ( nMethod = 0; nMethod < countMethods; nMethod++ ) {
methodExists[nMethod] = FALSE; methodExists[nMethod] = false;
} }
wxArrayString aOverloadedMethods; wxArrayString aOverloadedMethods;
@@ -1790,7 +1792,7 @@ bool DocManager::DumpDifferences(spContext *ctxTop) const
if ( aMethodsWithSameName.IsEmpty() && ctxMethod->IsPublic() ) { if ( aMethodsWithSameName.IsEmpty() && ctxMethod->IsPublic() ) {
if ( !m_ignoreNames.IgnoreMethod(nameClass, nameMethod) ) { if ( !m_ignoreNames.IgnoreMethod(nameClass, nameMethod) ) {
foundDiff = TRUE; foundDiff = true;
wxLogError("'%s::%s' is not documented.", wxLogError("'%s::%s' is not documented.",
nameClass.c_str(), nameClass.c_str(),
@@ -1802,7 +1804,7 @@ bool DocManager::DumpDifferences(spContext *ctxTop) const
} }
else if ( aMethodsWithSameName.GetCount() == 1 ) { else if ( aMethodsWithSameName.GetCount() == 1 ) {
index = (size_t)aMethodsWithSameName[0u]; index = (size_t)aMethodsWithSameName[0u];
methodExists[index] = TRUE; methodExists[index] = true;
if ( m_ignoreNames.IgnoreMethod(nameClass, nameMethod) ) if ( m_ignoreNames.IgnoreMethod(nameClass, nameMethod) )
continue; continue;
@@ -1858,7 +1860,7 @@ bool DocManager::DumpDifferences(spContext *ctxTop) const
const ParamInfo& param = method.GetParam(nParam); const ParamInfo& param = method.GetParam(nParam);
if ( m_checkParamNames && if ( m_checkParamNames &&
(param.GetName() != ctxParam->mName) ) { (param.GetName() != ctxParam->mName) ) {
foundDiff = TRUE; foundDiff = true;
wxLogError("Parameter #%d of '%s::%s' should be " wxLogError("Parameter #%d of '%s::%s' should be "
"'%s' and not '%s'.", "'%s' and not '%s'.",
@@ -1872,7 +1874,7 @@ bool DocManager::DumpDifferences(spContext *ctxTop) const
} }
if ( param.GetType() != ctxParam->mType ) { if ( param.GetType() != ctxParam->mType ) {
foundDiff = TRUE; foundDiff = true;
wxLogError("Type of parameter '%s' of '%s::%s' " wxLogError("Type of parameter '%s' of '%s::%s' "
"should be '%s' and not '%s'.", "should be '%s' and not '%s'.",
@@ -1908,7 +1910,7 @@ bool DocManager::DumpDifferences(spContext *ctxTop) const
// mark all methods with this name as existing // mark all methods with this name as existing
for ( nMethod = 0; nMethod < countMethods; nMethod++ ) { for ( nMethod = 0; nMethod < countMethods; nMethod++ ) {
if ( methods[nMethod]->GetName() == nameMethod ) if ( methods[nMethod]->GetName() == nameMethod )
methodExists[nMethod] = TRUE; methodExists[nMethod] = true;
} }
aOverloadedMethods.Add(nameMethod); aOverloadedMethods.Add(nameMethod);
@@ -1927,7 +1929,7 @@ bool DocManager::DumpDifferences(spContext *ctxTop) const
if ( !methodExists[nMethod] ) { if ( !methodExists[nMethod] ) {
const wxString& nameMethod = methods[nMethod]->GetName(); const wxString& nameMethod = methods[nMethod]->GetName();
if ( !m_ignoreNames.IgnoreMethod(nameClass, nameMethod) ) { if ( !m_ignoreNames.IgnoreMethod(nameClass, nameMethod) ) {
foundDiff = TRUE; foundDiff = true;
wxLogError("'%s::%s' is documented but doesn't exist.", wxLogError("'%s::%s' is documented but doesn't exist.",
nameClass.c_str(), nameClass.c_str(),
@@ -1942,7 +1944,7 @@ bool DocManager::DumpDifferences(spContext *ctxTop) const
// check that all classes we found in the docs really exist // check that all classes we found in the docs really exist
for ( nClass = 0; nClass < countClassesInDocs; nClass++ ) { for ( nClass = 0; nClass < countClassesInDocs; nClass++ ) {
if ( !classExists[nClass] ) { if ( !classExists[nClass] ) {
foundDiff = TRUE; foundDiff = true;
wxLogError("Class '%s' is documented but doesn't exist.", wxLogError("Class '%s' is documented but doesn't exist.",
m_classes[nClass].c_str()); m_classes[nClass].c_str());
@@ -1978,11 +1980,11 @@ bool IgnoreNamesHandler::AddNamesFromFile(const wxString& filename)
{ {
wxFile file(filename, wxFile::read); wxFile file(filename, wxFile::read);
if ( !file.IsOpened() ) if ( !file.IsOpened() )
return FALSE; return false;
off_t len = file.Length(); off_t len = file.Length();
if ( len == wxInvalidOffset ) if ( len == wxInvalidOffset )
return FALSE; return false;
char *buf = new char[len + 1]; char *buf = new char[len + 1];
buf[len] = '\0'; buf[len] = '\0';
@@ -1990,7 +1992,7 @@ bool IgnoreNamesHandler::AddNamesFromFile(const wxString& filename)
if ( file.Read(buf, len) == wxInvalidOffset ) { if ( file.Read(buf, len) == wxInvalidOffset ) {
delete [] buf; delete [] buf;
return FALSE; return false;
} }
wxString line; wxString line;
@@ -2027,7 +2029,7 @@ bool IgnoreNamesHandler::AddNamesFromFile(const wxString& filename)
delete [] buf; delete [] buf;
return TRUE; return true;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@@ -2130,8 +2132,8 @@ static void TeXFilter(wxString* str)
static void TeXUnfilter(wxString* str) static void TeXUnfilter(wxString* str)
{ {
// FIXME may be done much more quickly // FIXME may be done much more quickly
str->Trim(TRUE); str->Trim(true);
str->Trim(FALSE); str->Trim(false);
// undo TeXFilter // undo TeXFilter
static wxRegEx reNonSpecialSpecials("\\\\([#$%&_{}])"), static wxRegEx reNonSpecialSpecials("\\\\([#$%&_{}])"),
@@ -2151,7 +2153,7 @@ static wxString GetAllComments(const spContext& ctx)
wxString comment = (*i)->GetText(); wxString comment = (*i)->GetText();
// don't take comments like "// ----------" &c // don't take comments like "// ----------" &c
comment.Trim(FALSE); comment.Trim(false);
if ( !!comment && if ( !!comment &&
comment == wxString(comment[0u], comment.length() - 1) + '\n' ) comment == wxString(comment[0u], comment.length() - 1) + '\n' )
comments << "\n"; comments << "\n";
@@ -2185,6 +2187,9 @@ static const wxString GetVersionString()
/* /*
$Log$ $Log$
Revision 1.29 2004/06/17 19:00:22 ABX
Warning fixes. Code cleanup. Whitespaces and tabs removed.
Revision 1.28 2004/05/25 11:19:57 JS Revision 1.28 2004/05/25 11:19:57 JS
More name changes More name changes

View File

@@ -161,12 +161,12 @@ static inline bool skip_to_next_comment_in_the_line( char*& cur )
*cur != '/' *cur != '/'
) ++cur; ) ++cur;
if ( cur == _gSrcEnd ) return FALSE; if ( cur == _gSrcEnd ) return false;
if ( *cur == '/' ) if ( *cur == '/' )
{ {
if ( (*(cur+1) == '*') || if ( (*(cur+1) == '*') ||
(*(cur+1) == '/') ) return TRUE; (*(cur+1) == '/') ) return true;
else else
{ {
++cur; ++cur;
@@ -174,7 +174,7 @@ static inline bool skip_to_next_comment_in_the_line( char*& cur )
} }
} }
return FALSE; return false;
} while(1); } while(1);
} }
@@ -381,10 +381,9 @@ static inline bool get_next_token( char*& cur )
} }
if ( cur >= _gSrcEnd ) if ( cur >= _gSrcEnd )
return false;
return FALSE;
else else
return TRUE; return true;
} }
static inline void skip_preprocessor_dir( char*& cur ) static inline void skip_preprocessor_dir( char*& cur )
@@ -497,13 +496,13 @@ static inline bool cmp_tokens( char* tok1, char* tok2 )
do do
{ {
if ( *(tok1++) != *(tok2++) ) if ( *(tok1++) != *(tok2++) )
return FALSE; return false;
--len; --len;
} while ( --len ); } while ( --len );
return TRUE; return true;
} }
static inline bool cmp_tokens_fast( char* tok1, char* tok2, size_t len ) static inline bool cmp_tokens_fast( char* tok1, char* tok2, size_t len )
@@ -511,11 +510,11 @@ static inline bool cmp_tokens_fast( char* tok1, char* tok2, size_t len )
do do
{ {
if ( *(tok1++) != *(tok2++) ) if ( *(tok1++) != *(tok2++) )
return FALSE; return false;
} while ( --len ); } while ( --len );
return TRUE; return true;
} }
static inline void skip_tempalate_statement( char*& cur ) static inline void skip_tempalate_statement( char*& cur )
@@ -741,18 +740,18 @@ static inline bool skip_imp_block( char*& cur )
while( *cur != '{' && cur < _gSrcEnd ) while( *cur != '{' && cur < _gSrcEnd )
{ {
skip_token( cur ); skip_token( cur );
if ( !get_next_token( cur ) ) return FALSE; if ( !get_next_token( cur ) ) return false;
} }
while( *cur != '}' && cur < _gSrcEnd ) while( *cur != '}' && cur < _gSrcEnd )
{ {
skip_token( cur ); skip_token( cur );
if ( !get_next_token( cur ) ) return FALSE; if ( !get_next_token( cur ) ) return false;
} }
++cur; ++cur;
return TRUE; return true;
} }
static bool is_class_token( char*& cur ) static bool is_class_token( char*& cur )
@@ -779,7 +778,7 @@ static bool is_class_token( char*& cur )
return cmp_tokens_fast( cur, "union", 5 ); return cmp_tokens_fast( cur, "union", 5 );
return FALSE; return false;
} }
inline static bool is_forward_decl( char* cur ) inline static bool is_forward_decl( char* cur )
@@ -788,11 +787,11 @@ inline static bool is_forward_decl( char* cur )
{ {
switch( *cur ) switch( *cur )
{ {
case ':' : return FALSE; case ':' : return false;
case '{' : return FALSE; case '{' : return false;
case '(' : return FALSE; case '(' : return false;
case ';' : return TRUE; case ';' : return true;
default : break; default : break;
}; };
@@ -801,12 +800,12 @@ inline static bool is_forward_decl( char* cur )
} while (cur < _gSrcEnd); // prevent running out of bounds } while (cur < _gSrcEnd); // prevent running out of bounds
return FALSE; return false;
} }
inline static bool is_function( char* cur, bool& isAMacro ) inline static bool is_function( char* cur, bool& isAMacro )
{ {
isAMacro = FALSE; isAMacro = false;
int tmpLnNo; int tmpLnNo;
store_line_no( tmpLnNo ); store_line_no( tmpLnNo );
@@ -825,10 +824,10 @@ inline static bool is_function( char* cur, bool& isAMacro )
if ( cur > eol ) if ( cur > eol )
{ {
isAMacro = TRUE; isAMacro = true;
restore_line_no( tmpLnNo ); restore_line_no( tmpLnNo );
return TRUE; return true;
} }
// it's not a macro, go to the begining of arg. list // it's not a macro, go to the begining of arg. list
@@ -840,7 +839,7 @@ inline static bool is_function( char* cur, bool& isAMacro )
if ( *cur == '(' ) if ( *cur == '(' )
{ {
restore_line_no( tmpLnNo ); restore_line_no( tmpLnNo );
return TRUE; return true;
} }
// end of statement found without any brackets in it // end of statement found without any brackets in it
@@ -849,7 +848,7 @@ inline static bool is_function( char* cur, bool& isAMacro )
if ( *cur == ';' ) if ( *cur == ';' )
{ {
restore_line_no( tmpLnNo ); restore_line_no( tmpLnNo );
return FALSE; return false;
} }
++cur; ++cur;
@@ -859,7 +858,7 @@ inline static bool is_function( char* cur, bool& isAMacro )
isAMacro = 1; isAMacro = 1;
restore_line_no( tmpLnNo ); restore_line_no( tmpLnNo );
return FALSE; return false;
} }
// upon return the cursor is positioned after the // upon return the cursor is positioned after the
@@ -1018,8 +1017,8 @@ spFile* CJSourceParser::Parse( char* start, char* end )
) == 0 ) == 0
) )
{ {
int o = 0; // int o = 0;
++o; // ++o;
} }
switch (*cur) switch (*cur)
@@ -1118,7 +1117,7 @@ spFile* CJSourceParser::Parse( char* start, char* end )
continue; continue;
} }
bool isAMacro = 0; bool isAMacro = false;
if ( is_function( cur, isAMacro ) ) if ( is_function( cur, isAMacro ) )
{ {
@@ -1132,8 +1131,9 @@ spFile* CJSourceParser::Parse( char* start, char* end )
int tmpLnNo; int tmpLnNo;
store_line_no( tmpLnNo ); store_line_no( tmpLnNo );
wxUnusedVar( tmpLnNo );
isAMacro = FALSE; isAMacro = false;
if ( !ParseNameAndRetVal( cur, isAMacro ) ) if ( !ParseNameAndRetVal( cur, isAMacro ) )
{ {
@@ -1219,11 +1219,11 @@ void CJSourceParser::AttachComments( spContext& ctx, char* cur )
if ( i == 0 ) if ( i == 0 )
pComment->mStartsPar = TRUE; pComment->mStartsPar = true;
else else
if ( pComment->mIsMultiline ) if ( pComment->mIsMultiline )
pComment->mStartsPar = TRUE; pComment->mStartsPar = true;
else else
{ {
// find out wheather there is a new-line // find out wheather there is a new-line
@@ -1235,9 +1235,9 @@ void CJSourceParser::AttachComments( spContext& ctx, char* cur )
if ( prevLine >= prevComEnd ) if ( prevLine >= prevComEnd )
pComment->mStartsPar = TRUE; pComment->mStartsPar = true;
else else
pComment->mStartsPar = FALSE; pComment->mStartsPar = false;
} }
prevComEnd = set_comment_text( pComment->mText, start ); prevComEnd = set_comment_text( pComment->mText, start );
@@ -1521,7 +1521,7 @@ void CJSourceParser::ParseKeyword( char*& cur )
bool CJSourceParser::ParseNameAndRetVal( char*& cur, bool& isAMacro ) bool CJSourceParser::ParseNameAndRetVal( char*& cur, bool& isAMacro )
{ {
isAMacro = FALSE; isAMacro = false;
// FOR NOW:: all functions in the global // FOR NOW:: all functions in the global
// scope are ignored // scope are ignored
@@ -1537,7 +1537,7 @@ bool CJSourceParser::ParseNameAndRetVal( char*& cur, bool& isAMacro )
isVirtual = true; isVirtual = true;
skip_token( cur ); skip_token( cur );
if ( !get_next_token( cur ) ) return FALSE; if ( !get_next_token( cur ) ) return false;
} }
char* bracketPos = cur; char* bracketPos = cur;
@@ -1564,9 +1564,9 @@ bool CJSourceParser::ParseNameAndRetVal( char*& cur, bool& isAMacro )
mpPlugin->ParseContext( _gSrcStart, cur, _gSrcEnd, mpCurCtx ); mpPlugin->ParseContext( _gSrcStart, cur, _gSrcEnd, mpCurCtx );
isAMacro = TRUE; isAMacro = true;
return FALSE; return false;
} }
} }
@@ -1633,7 +1633,7 @@ bool CJSourceParser::ParseNameAndRetVal( char*& cur, bool& isAMacro )
// now, enter operation context // now, enter operation context
mpCurCtx = pOp; mpCurCtx = pOp;
return TRUE; return true;
} }
bool CJSourceParser::ParseArguments( char*& cur ) bool CJSourceParser::ParseArguments( char*& cur )
@@ -1655,7 +1655,7 @@ bool CJSourceParser::ParseArguments( char*& cur )
get_next_token( cur ); get_next_token( cur );
bool first_blk = 1; bool first_blk = true;
while( *cur != ')' && *cur != ',' ) while( *cur != ')' && *cur != ',' )
{ {
@@ -1693,7 +1693,7 @@ bool CJSourceParser::ParseArguments( char*& cur )
// if only one block enclosed, than it's probably // if only one block enclosed, than it's probably
// some macro, there should be at least two blocks, // some macro, there should be at least two blocks,
// one for argument type and another for it's identifier // one for argument type and another for it's identifier
return FALSE; return false;
} }
if ( blocksSkipped == 0 ) if ( blocksSkipped == 0 )
@@ -1777,29 +1777,31 @@ bool CJSourceParser::ParseArguments( char*& cur )
int tmpLnNo; int tmpLnNo;
store_line_no( tmpLnNo ); store_line_no( tmpLnNo );
bool result = true;
do do
{ {
if ( *tok == '{' || *tok == ';' ) if ( *tok == '{' || *tok == ';' )
{ {
restore_line_no(tmpLnNo); restore_line_no(tmpLnNo);
return TRUE; break;
} }
// check for unexpected tokens // check for unexpected tokens
if ( *tok == '=' || *tok == '0' ) if ( *tok == '=' || *tok == '0' )
{ {
skip_token(tok); skip_token(tok);
if ( !get_next_token(tok) ) return FALSE; if ( !get_next_token(tok) ) return false;
continue; continue;
} }
if ( *tok == '}' ) return FALSE; if ( *tok == '}' ) return false;
// if initialization list found // if initialization list found
if ( *tok == ':' ) if ( *tok == ':' )
{ {
restore_line_no(tmpLnNo); restore_line_no(tmpLnNo);
return TRUE; break;
} }
if ( cmp_tokens_fast( tok, "const", 5 ) ) if ( cmp_tokens_fast( tok, "const", 5 ) )
@@ -1807,30 +1809,28 @@ bool CJSourceParser::ParseArguments( char*& cur )
((spOperation*)mpCurCtx)->mIsConstant = true; ((spOperation*)mpCurCtx)->mIsConstant = true;
skip_token(tok); skip_token(tok);
if ( !get_next_token(tok) ) return FALSE; if ( !get_next_token(tok) ) return false;
continue; continue;
} }
if ( CheckVisibilty( tok ) ) return FALSE; if ( CheckVisibilty( tok ) ) return false;
// if next context found // if next context found
if ( is_keyword( tok ) ) return FALSE; if ( is_keyword( tok ) ) return false;
skip_token(tok); skip_token(tok);
if ( !get_next_token(tok) ) return FALSE; if ( !get_next_token(tok) ) return false;
} while(1); } while(1);
return TRUE; return result;
} }
void CJSourceParser::ParseMemberVar( char*& cur ) void CJSourceParser::ParseMemberVar( char*& cur )
{ {
MMemberListT& members = mpCurCtx->GetMembers(); MMemberListT& members = mpCurCtx->GetMembers();
bool firstMember = 1; bool firstMember = true;
size_t first = 0;
string type; string type;
@@ -1860,7 +1860,6 @@ void CJSourceParser::ParseMemberVar( char*& cur )
if ( firstMember ) if ( firstMember )
{ {
firstMember = 0; firstMember = 0;
first = members.size() - 1;;
} }
skip_token_back( cur ); skip_token_back( cur );
@@ -1904,7 +1903,7 @@ void CJSourceParser::ParseMemberVar( char*& cur )
} while(1); } while(1);
first = 0; size_t first = 0;
// set up types for all collected (same-type) attributes; // set up types for all collected (same-type) attributes;
while ( first != members.size() - 1 ) while ( first != members.size() - 1 )
@@ -1950,7 +1949,7 @@ void CJSourceParser::SkipFunctionBody( char*& cur )
{ {
// FIXME:: check for comments and quoted stirngs here // FIXME:: check for comments and quoted stirngs here
bool hasDefinition = FALSE; bool hasDefinition = false;
while( *cur != '{' && *cur != ';' ) while( *cur != '{' && *cur != ';' )
{ {
@@ -1964,7 +1963,7 @@ void CJSourceParser::SkipFunctionBody( char*& cur )
} }
else else
{ {
hasDefinition = TRUE; hasDefinition = true;
skip_scope_block( cur ); // skip the whole imp. skip_scope_block( cur ); // skip the whole imp.
} }
@@ -2004,22 +2003,22 @@ bool CJSourceParser::CheckVisibilty( char*& cur )
if ( cmp_tokens_fast( cur, "public:", len ) ) if ( cmp_tokens_fast( cur, "public:", len ) )
{ {
mCurVis = SP_VIS_PUBLIC; mCurVis = SP_VIS_PUBLIC;
return TRUE; return true;
} }
if ( cmp_tokens_fast( cur, "protected:", len ) ) if ( cmp_tokens_fast( cur, "protected:", len ) )
{ {
mCurVis = SP_VIS_PROTECTED; mCurVis = SP_VIS_PROTECTED;
return TRUE; return true;
} }
if ( cmp_tokens_fast( cur, "private:", len ) ) if ( cmp_tokens_fast( cur, "private:", len ) )
{ {
mCurVis = SP_VIS_PRIVATE; mCurVis = SP_VIS_PRIVATE;
return TRUE; return true;
} }
return FALSE; return false;
} }
void CJSourceParser::AddClassNode( char*& cur ) void CJSourceParser::AddClassNode( char*& cur )

View File

@@ -115,7 +115,8 @@ RipperDocGen::RipperDocGen()
mDeadRefTempl ( HTM_DeadRefTempl ), mDeadRefTempl ( HTM_DeadRefTempl ),
mpCurClassSect(0) mpCurClassSect(0)
{ // topIndex is not referenced {
// topIndex is not referenced
mpTopIdx = new ScriptSection( "Source Code Contents" , "", &mTopTempl , 0 ); mpTopIdx = new ScriptSection( "Source Code Contents" , "", &mTopTempl , 0 );
mpClassIdx = new ScriptSection( "Classes Reference" , "", &mContentIdxTempl, &mRefTempl ); mpClassIdx = new ScriptSection( "Classes Reference" , "", &mContentIdxTempl, &mRefTempl );
mpEnumIdx = new ScriptSection( "Enumerations Reference" , "", &mContentIdxTempl, &mRefTempl ); mpEnumIdx = new ScriptSection( "Enumerations Reference" , "", &mContentIdxTempl, &mRefTempl );
@@ -182,7 +183,6 @@ void RipperDocGen::AppendComments( spContext& fromContext, string& str )
if ( lst[i]->StartsParagraph() ) if ( lst[i]->StartsParagraph() )
{ {
str += mTags[TAG_PARAGRAPH].start; str += mTags[TAG_PARAGRAPH].start;
} }
str += lst[i]->mText; str += lst[i]->mText;
@@ -198,38 +198,20 @@ void RipperDocGen::AppendComments( spContext& fromContext, string& str )
if ( str[n] == 10 || if ( str[n] == 10 ||
str[n] == 13 ) str[n] == 13 )
{ {
if ( n + 2 < len ) if ( n + 2 < len )
{ {
if ( ( str[n] == 13 && str[n+1] == 10 && // FIXME:: quick-hack if ( ( str[n] == 13 && str[n+1] == 10 && // FIXME:: quick-hack
str[n+2] == 13 ) || str[n+2] == 13 ) ||
( str[n] == 10 && str[n+1] == 10 ) ( str[n] == 10 && str[n+1] == 10 )
) )
{ {
str.insert( n + 1, "<p>" ); // FIXME:: quick-hack str.insert( n + 1, "<p>" ); // FIXME:: quick-hack
len += 3; len += 3;
} }
} }
str[n] = ' '; str[n] = ' ';
} }
str += mTags[TAG_PARAGRAPH].end; str += mTags[TAG_PARAGRAPH].end;
} }
@@ -270,7 +252,6 @@ bool RipperDocGen::CheckIfUncommented( spContext& ctx, ScriptSection& toSect )
ScriptTemplate* RipperDocGen::GetRefTemplFor( spContext& ctx ) ScriptTemplate* RipperDocGen::GetRefTemplFor( spContext& ctx )
{ {
if ( ctx.HasComments() ) if ( ctx.HasComments() )
return &mRefTempl; return &mRefTempl;
else else
return &mDeadRefTempl; return &mDeadRefTempl;
@@ -278,7 +259,8 @@ ScriptTemplate* RipperDocGen::GetRefTemplFor( spContext& ctx )
string RipperDocGen::GetScopedName( spContext& ofCtx ) string RipperDocGen::GetScopedName( spContext& ofCtx )
{ {
if ( ofCtx.IsInFile() ) return ofCtx.GetName(); if ( ofCtx.IsInFile() )
return ofCtx.GetName();
else else
return ofCtx.GetOutterContext()->GetName() + return ofCtx.GetOutterContext()->GetName() +
"::" + ofCtx.GetName(); "::" + ofCtx.GetName();
@@ -290,11 +272,9 @@ void RipperDocGen::AddToCurrentClass( ScriptSection* pSection, spContext& ctx,
string sName; string sName;
if ( ctx.mVisibility == SP_VIS_PROTECTED ) if ( ctx.mVisibility == SP_VIS_PROTECTED )
sName = "Protected members/"; sName = "Protected members/";
else else
if ( ctx.mVisibility == SP_VIS_PRIVATE ) if ( ctx.mVisibility == SP_VIS_PRIVATE )
sName = "Private members/"; sName = "Private members/";
else else
sName = "Public members/"; sName = "Public members/";
@@ -338,12 +318,8 @@ void RipperDocGen::LinkSuperClassRefs()
spClass* pFound = NULL; spClass* pFound = NULL;
string* name;
for( size_t k = 0; k != clLst.size(); ++k ) for( size_t k = 0; k != clLst.size(); ++k )
{ {
name = &clLst[k]->GetName();
if ( clLst[k]->GetName() == superClName ) if ( clLst[k]->GetName() == superClName )
{ {
pFound = (spClass*)clLst[k]; pFound = (spClass*)clLst[k];
@@ -380,7 +356,7 @@ void RipperDocGen::ProcessFile( const char* sourceFile )
return; return;
} }
VisitAll( *pCtx, TRUE ); VisitAll( *pCtx, true );
mpFileBinderCtx->AddMember( pCtx ); mpFileBinderCtx->AddMember( pCtx );
} }
@@ -438,19 +414,15 @@ void RipperDocGen::VisitTypeDef( spTypeDef& td )
mpTypeDefIdx->AddSection( mpTypeDefIdx->AddSection(
new ScriptSection( td.GetName(), line, new ScriptSection( td.GetName(), line,
&mSubContentTempl, &mSubContentTempl,
GetRefTemplFor( td ) ), TRUE GetRefTemplFor( td ) ), true
); );
} }
void RipperDocGen::VisitPreprocessorLine( spPreprocessorLine& pd ) void RipperDocGen::VisitPreprocessorLine( spPreprocessorLine& pd )
{ {
if ( pd.mDefType != SP_PREP_DEF_REDEFINE_SYMBOL ) if ( pd.mDefType != SP_PREP_DEF_REDEFINE_SYMBOL )
return; return;
if ( CheckIfUncommented( pd, *mpMacroIdx ) ) if ( CheckIfUncommented( pd, *mpMacroIdx ) )
return; return;
@@ -469,7 +441,7 @@ void RipperDocGen::VisitPreprocessorLine( spPreprocessorLine& pd )
mpMacroIdx->AddSection( mpMacroIdx->AddSection(
new ScriptSection( pd.GetName(), body, new ScriptSection( pd.GetName(), body,
&mSubContentTempl, &mSubContentTempl,
GetRefTemplFor( pd ) ), TRUE GetRefTemplFor( pd ) ), true
); );
} }
@@ -503,11 +475,9 @@ void RipperDocGen::VisitClass( spClass& cl )
pPublic->AddSection( new ScriptSection( "Operations", "", &mOutLine1Templ, 0, 1 ) ); pPublic->AddSection( new ScriptSection( "Operations", "", &mOutLine1Templ, 0, 1 ) );
pPublic->AddSection( new ScriptSection( "Attributes", "", &mOutLine1Templ, 0, 1 ) ); pPublic->AddSection( new ScriptSection( "Attributes", "", &mOutLine1Templ, 0, 1 ) );
pProtected->AddSection( new ScriptSection( "Operations", "", &mOutLine1Templ, 0, 1 ) ); pProtected->AddSection( new ScriptSection( "Operations", "", &mOutLine1Templ, 0, 1 ) );
pProtected->AddSection( new ScriptSection( "Attributes", "", &mOutLine1Templ, 0, 1 ) ); pProtected->AddSection( new ScriptSection( "Attributes", "", &mOutLine1Templ, 0, 1 ) );
pPrivate->AddSection( new ScriptSection( "Operations", "", &mOutLine1Templ, 0, 1 ) ); pPrivate->AddSection( new ScriptSection( "Operations", "", &mOutLine1Templ, 0, 1 ) );
pPrivate->AddSection( new ScriptSection( "Attributes", "", &mOutLine1Templ, 0, 1 ) ); pPrivate->AddSection( new ScriptSection( "Attributes", "", &mOutLine1Templ, 0, 1 ) );
@@ -516,7 +486,7 @@ void RipperDocGen::VisitClass( spClass& cl )
mpCurClassSect->AddSection( pProtected ); mpCurClassSect->AddSection( pProtected );
mpCurClassSect->AddSection( pPrivate ); mpCurClassSect->AddSection( pPrivate );
mpClassIdx->AddSection( mpCurClassSect, TRUE ); mpClassIdx->AddSection( mpCurClassSect, true );
} }
void RipperDocGen::VisitAttribute( spAttribute& attr ) void RipperDocGen::VisitAttribute( spAttribute& attr )
@@ -541,19 +511,15 @@ void RipperDocGen::VisitAttribute( spAttribute& attr )
GetRefTemplFor( attr ) ); GetRefTemplFor( attr ) );
if ( attr.mIsConstant ) if ( attr.mIsConstant )
mpConstIdx->AddSection( pSection, true );
mpConstIdx->AddSection( pSection, TRUE );
else else
if ( !attr.IsInClass() ) if ( !attr.IsInClass() )
{ {
if ( CheckIfUncommented( attr, *mpGlobalVarsIdx ) ) if ( CheckIfUncommented( attr, *mpGlobalVarsIdx ) )
return; return;
mpGlobalVarsIdx->AddSection( pSection, true );
mpGlobalVarsIdx->AddSection( pSection, TRUE );
} }
else else
AddToCurrentClass( pSection, attr, "Attributes" ); AddToCurrentClass( pSection, attr, "Attributes" );
} }
@@ -581,7 +547,7 @@ void RipperDocGen::VisitOperation( spOperation& op )
AddToCurrentClass( pSection, op, "Operations" ); AddToCurrentClass( pSection, op, "Operations" );
} }
bool RipperDocGen::OnSaveDocument( ScriptStream& stm ) bool RipperDocGen::OnSaveDocument( ScriptStream& WXUNUSED(stm) )
{ {
LinkSuperClassRefs(); LinkSuperClassRefs();

View File

@@ -293,7 +293,7 @@ void ScriptTemplate::PrintScript( void* dataObj, ScriptStream& stm )
// look up variable // look up variable
size_t sz = mVars.size(); size_t sz = mVars.size();
bool found = 0; // bool found = false;
for( size_t i = 0; i != sz; ++i ) for( size_t i = 0; i != sz; ++i )
{ {
@@ -303,7 +303,7 @@ void ScriptTemplate::PrintScript( void* dataObj, ScriptStream& stm )
*cur = ')'; // remove terminating zero *cur = ')'; // remove terminating zero
++cur; ++cur;
found = 1; // found = 1;
break; break;
} }
} }
@@ -514,7 +514,7 @@ void ScriptSection::DoRemoveEmptySections(int& nRemoved, SectListT& removedLst)
if ( sect.mReferences.size() == 0 ) if ( sect.mReferences.size() == 0 )
{ {
bool found = 0; bool found = false;
for( size_t k = 0; k != removedLst.size(); ++k ) for( size_t k = 0; k != removedLst.size(); ++k )
if ( removedLst[k] == &sect ) if ( removedLst[k] == &sect )

View File

@@ -391,7 +391,7 @@ struct less_c_str
static KeywordMapT __gMultiLangMap; static KeywordMapT __gMultiLangMap;
static int __gMapReady = 0; static int __gMapReady = 0;
void check_keyword_map( int keywordMapNr ) void check_keyword_map( int WXUNUSED(keywordMapNr) )
{ {
if ( !__gMapReady ) if ( !__gMapReady )
{ {
@@ -452,7 +452,8 @@ static inline void store_range( SPBlockListT& results, int rank, int range_len )
#define STORE_RANGE store_range( results, cur_rank, cur_range_len ); \ #define STORE_RANGE store_range( results, cur_rank, cur_range_len ); \
cur_rank = cur_range_len = 0; cur_rank = cur_range_len = 0; \
wxUnusedVar( cur_rank );
#define NEXT_CHAR cur_range_len++; \ #define NEXT_CHAR cur_range_len++; \
++cur; \ ++cur; \
@@ -471,7 +472,7 @@ static inline int is_alpha( char ch )
static void heighlight_syntax( char* str, int strLen, static void heighlight_syntax( char* str, int strLen,
SPBlockListT& results, bool& isComment ) SPBlockListT& results, bool& isComment )
{ {
bool isMultiline = 0; bool isMultiline = false;
char* cur = str; char* cur = str;
char* end = str + strLen; char* end = str + strLen;
@@ -583,14 +584,16 @@ static void heighlight_syntax( char* str, int strLen,
} }
if ( cur_range_len > 0 ) STORE_RANGE; if ( cur_range_len > 0 ) STORE_RANGE;
wxUnusedVar(isMultiline);
} }
/***** Implementation for class SourcePainter ******/ /***** Implementation for class SourcePainter ******/
SourcePainter::SourcePainter( bool assembleResultString ) SourcePainter::SourcePainter( bool assembleResultString )
: mCollectResultsOn( assembleResultString ), : mCollectResultsOn( assembleResultString ),
mIsInComment( FALSE ), mIsInComment( false ),
mCommentIsMultiline( FALSE ) mCommentIsMultiline( false )
{ {
check_keyword_map(0); check_keyword_map(0);
} }