X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/eb4200905ffdbf005174772ffee343635c97d69b..18d491685c8e13a5536f2f9dd6c8041c110a76d9:/utils/HelpGen/src/HelpGen.cpp diff --git a/utils/HelpGen/src/HelpGen.cpp b/utils/HelpGen/src/HelpGen.cpp index 1cada46acb..e283903f8a 100644 --- a/utils/HelpGen/src/HelpGen.cpp +++ b/utils/HelpGen/src/HelpGen.cpp @@ -78,23 +78,6 @@ #undef GetCurrentTime #endif -// ----------------------------------------------------------------------------- -// global vars -// ----------------------------------------------------------------------------- - -class HelpGenApp: public wxApp -{ -public: - HelpGenApp() {}; - - // don't let wxWin parse our cmd line, we do it ourselves - virtual bool OnInit() { return TRUE; } - - virtual int OnRun(); -}; - -// IMPLEMENT_APP(HelpGenApp); - // ----------------------------------------------------------------------------- // private functions // ----------------------------------------------------------------------------- @@ -581,8 +564,16 @@ static void usage() exit(1); } -int HelpGenApp::OnRun() +int main(int argc, char **argv) { + wxInitializer initializer; + if ( !initializer ) + { + fprintf(stderr, "Failed to initialize the wxWindows library, aborting."); + + return -1; + } + enum { Mode_None, @@ -788,21 +779,6 @@ int HelpGenApp::OnRun() return 0; } -int main(int argc, char **argv) -{ - wxInitializer initializer; - if ( !initializer ) - { - fprintf(stderr, "Failed to initialize the wxWindows library, aborting."); - - return -1; - } - HelpGenApp app; - app.argc = argc; - app.argv = argv; - return app.OnRun(); -} - // ----------------------------------------------------------------------------- // HelpGenVisitor implementation // ----------------------------------------------------------------------------- @@ -894,13 +870,43 @@ void HelpGenVisitor::CloseFunction() void HelpGenVisitor::CloseClass() { + CloseFunction(); + if ( m_inClass ) { size_t count = m_arrayFuncDocs.GetCount(); if ( count ) { + size_t n; FunctionDocEntry::classname = m_classname; + m_arrayFuncDocs.Sort(FunctionDocEntry::Compare); - for ( size_t n = 0; n < count; n++ ) { + // Now examine each first line and if it's been seen, cut it + // off (it's a duplicate \membersection) + wxHashTable membersections(wxKEY_STRING); + + for ( n = 0; n < count; n++ ) + { + wxString section(m_arrayFuncDocs[n].text); + + // Strip leading whitespace + int pos = section.Find("\\membersection"); + if (pos > -1) + { + section = section.Mid(pos); + } + + wxString ms(section.BeforeFirst(wxT('\n'))); + if (membersections.Get(ms)) + { + m_arrayFuncDocs[n].text = section.AfterFirst(wxT('\n')); + } + else + { + membersections.Put(ms, & membersections); + } + } + + for ( n = 0; n < count; n++ ) { m_file.WriteTeX(m_arrayFuncDocs[n].text); } @@ -1110,6 +1116,12 @@ void HelpGenVisitor::VisitClass( spClass& cl ) } totalText << derived << "\n\n"; + // include file section + wxString includeFile = "\\wxheading{Include files}\n\n"; + includeFile << "<" << m_fileHeader << ">"; + + totalText << includeFile << "\n\n"; + // write all this to file m_file.WriteTeX(totalText); @@ -1118,7 +1130,7 @@ void HelpGenVisitor::VisitClass( spClass& cl ) InsertTypedefDocs(); InsertEnumDocs(); - m_file.Flush(); + //m_file.Flush(); } void HelpGenVisitor::VisitEnumeration( spEnumeration& en ) @@ -1265,19 +1277,10 @@ void HelpGenVisitor::VisitOperation( spOperation& op ) funcname = dtor; } - static wxHashTable sg_MemberSectionsDone(wxKEY_STRING); - wxString memberSectionName; - memberSectionName.Printf("%s::%s", m_classname.c_str(), funcname.c_str()); - - m_textFunc = wxEmptyString; - if (!sg_MemberSectionsDone.Get(memberSectionName)) - { - m_textFunc.Printf("\n" - "\\membersection{%s::%s}\\label{%s}\n", - m_classname.c_str(), funcname.c_str(), - MakeLabel(m_classname, funcname).c_str()); - sg_MemberSectionsDone.Put(memberSectionName, (wxObject*) & sg_MemberSectionsDone); - } + m_textFunc.Printf("\n" + "\\membersection{%s::%s}\\label{%s}\n", + m_classname.c_str(), funcname.c_str(), + MakeLabel(m_classname, funcname).c_str()); wxString func; func.Printf("\n" @@ -2126,7 +2129,7 @@ static void TeXUnfilter(wxString* str) // undo TeXFilter static wxRegEx reNonSpecialSpecials("\\\\([#$%&_{}])"), - reAccents("\\\\verb|([~^])|"); + reAccents("\\\\verb\\|([~^])\\|"); reNonSpecialSpecials.ReplaceAll(str, "\\1"); reAccents.ReplaceAll(str, "\\1"); @@ -2176,6 +2179,16 @@ static const wxString GetVersionString() /* $Log$ + Revision 1.23 2003/06/13 17:05:43 VZ + quote '|' inside regexes (fixes dump mode); fixed crash due to strange HelpGenApp code + + Revision 1.22 2002/01/21 21:18:50 JS + Now adds 'include file' heading + + Revision 1.21 2002/01/04 11:06:09 JS + Fixed missing membersections bug and also bug with functions not being written + in the right class + Revision 1.20 2002/01/03 14:23:33 JS Added code to make it not duplicate membersections for overloaded functions