X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/eb7b690a4f6268d569d6cd52c51e13982aca094e..b8885bb39b61f599b16d059a17ea4d9cae7018e7:/utils/ifacecheck/src/xmlparser.cpp?ds=sidebyside diff --git a/utils/ifacecheck/src/xmlparser.cpp b/utils/ifacecheck/src/xmlparser.cpp index b5c752d48f..86247d1122 100644 --- a/utils/ifacecheck/src/xmlparser.cpp +++ b/utils/ifacecheck/src/xmlparser.cpp @@ -68,6 +68,7 @@ void wxType::SetTypeFromString(const wxString& t) m_strType.Replace("[]", "*"); m_strType.Replace("long int", "long"); // in wx typically we never write "long int", just "long" m_strType.Replace("long unsigned int", "unsigned long"); + m_strType.Replace("short unsigned int", "unsigned short"); // make sure the * and & operator always use the same spacing rules // (to make sure GetAsString() output is always consistent) @@ -83,6 +84,7 @@ void wxType::SetTypeFromString(const wxString& t) // ADHOC-FIX m_strType.Replace("_wxArraywxArrayStringBase", "wxString"); + m_strType.Replace("ExitCode", "void*"); // used in wxThread stuff m_strType = m_strType.Strip(wxString::both); @@ -163,13 +165,13 @@ void wxArgumentType::SetDefaultValue(const wxString& defval, const wxString& def // Note: we adjust the aesthetic form of the m_strDefaultValue string for the "modify mode" // of ifacecheck: we may need to write it out in an interface header - wxString *p; + wxString *p = NULL; for (int i=0; i<2; i++) // to avoid copying&pasting the code! { if (i == 0) p = &m_strDefaultValue; if (i == 1) p = &m_strDefaultValueForCmp; - if (*p == "0u") *p = "0"; + if (*p == "0u" || *p == "0l") *p = "0"; p->Replace("0x000000001", "1"); p->Replace("\\000\\000\\000", ""); // fix for unicode strings: @@ -232,8 +234,10 @@ bool wxArgumentType::operator==(const wxArgumentType& m) const (m.m_strDefaultValueForCmp.IsNumber() && m_strDefaultValueForCmp.StartsWith("wx"))) { if (g_verbose) + { wxLogMessage("Supposing '%s' default value to be the same of '%s'...", m_strDefaultValueForCmp, m.m_strDefaultValueForCmp); + } return true; } @@ -258,8 +262,10 @@ bool wxArgumentType::operator==(const wxArgumentType& m) const } if (g_verbose) + { wxLogMessage("Argument type '%s = %s' has different default value from '%s = %s'", m_strType, m_strDefaultValueForCmp, m.m_strType, m.m_strDefaultValueForCmp); + } return false; } @@ -328,14 +334,18 @@ bool wxMethod::MatchesExceptForAttributes(const wxMethod& m) const GetName() != m.GetName()) { if (g_verbose) + { wxLogMessage("The method '%s' does not match method '%s'; different names/rettype", GetName(), m.GetName()); + } return false; } if (m_args.GetCount()!=m.m_args.GetCount()) { if (g_verbose) + { wxLogMessage("Method '%s' has %d arguments while '%s' has %d arguments", m_strName, m_args.GetCount(), m_strName, m.m_args.GetCount()); + } return false; } @@ -370,7 +380,9 @@ bool wxMethod::operator==(const wxMethod& m) const GetAccessSpecifier() != m.GetAccessSpecifier()) { if (g_verbose) + { wxLogMessage("The method '%s' does not match method '%s'; different attributes", GetName(), m.GetName()); + } return false; } @@ -748,7 +760,7 @@ bool getID(unsigned long *id, const wxString& str) } // utility specialized to parse efficiently the gccXML list of IDs which occur -// in nodes like ones... i.e. numeric values separed by " _" token +// in nodes like ones... i.e. numeric values separated by " _" token bool getMemberIDs(wxClassMemberIdHashMap* map, wxClass* p, const wxString& str) { const wxStringCharType * const start = str.wx_str(); @@ -1007,8 +1019,10 @@ bool wxXmlGccInterface::Parse(const wxString& filename) // they're never used as return/argument types by wxWidgets methods if (g_verbose) + { wxLogWarning("Type node '%s' with ID '%s' does not have name attribute", n, child->GetAttribute("id")); + } types[id] = "TOFIX"; } @@ -1026,8 +1040,10 @@ bool wxXmlGccInterface::Parse(const wxString& filename) while (toResolveTypes.size()>0) { if (g_verbose) + { wxLogMessage("%d types were collected; %d types need yet to be resolved...", types.size(), toResolveTypes.size()); + } for (wxToResolveTypeHashMap::iterator i = toResolveTypes.begin(); i != toResolveTypes.end();) @@ -1264,7 +1280,7 @@ bool wxXmlGccInterface::ParseMethod(const wxXmlNode *p, // NOTE: gccxml is smart enough to mark as virtual those functions // which are declared virtual in base classes but don't have - // the "virtual" keyword explicitely indicated in the derived + // the "virtual" keyword explicitly indicated in the derived // classes... so we don't need any further logic for virtuals m.SetVirtual(p->GetAttribute("virtual") == "1"); @@ -1466,7 +1482,9 @@ bool wxXmlDoxygenInterface::ParseCompoundDefinition(const wxString& filename) int nodes = 0; if (g_verbose) + { wxLogMessage("Parsing %s...", filename); + } if (!doc.Load(filename)) { wxLogError("can't load %s", filename); @@ -1493,41 +1511,47 @@ bool wxXmlDoxygenInterface::ParseCompoundDefinition(const wxString& filename) wxXmlNode *subchild = child->GetChildren(); while (subchild) { - wxString kind = subchild->GetAttribute("kind"); - - // parse only public&protected functions: - if (subchild->GetName() == "sectiondef" && - (kind == "public-func" || kind == "protected-func")) + // NOTE: when documenting functions using the //@{ and //@} + // tags to create function groups, doxygen puts the + // contained methods into a "user-defined" section + // so we _must_ use the "prot" attribute to distinguish + // public/protected methods from private ones and cannot + // rely on the kind="public" attribute of + if (subchild->GetName() == "sectiondef") { - wxXmlNode *membernode = subchild->GetChildren(); while (membernode) { + const wxString& accessSpec = membernode->GetAttribute("prot"); + + // parse only public&protected functions: if (membernode->GetName() == "memberdef" && - membernode->GetAttribute("kind") == "function") + membernode->GetAttribute("kind") == "function" && + (accessSpec == "public" || accessSpec == "protected")) { - wxMethod m; if (!ParseMethod(membernode, m, header)) { wxLogError("The method '%s' could not be added to class '%s'", - m.GetName(), klass.GetName()); + m.GetName(), klass.GetName()); return false; } - if (kind == "public-func") + if (accessSpec == "public") m.SetAccessSpecifier(wxMAS_PUBLIC); - else if (kind == "protected-func") + else if (accessSpec == "protected") m.SetAccessSpecifier(wxMAS_PROTECTED); - else if (kind == "private-func") + else if (accessSpec == "private") m.SetAccessSpecifier(wxMAS_PRIVATE); if (absoluteFile.IsEmpty()) absoluteFile = header; else if (header != absoluteFile) { - wxLogError("The method '%s' is documented in a different " - "file from others (which belong to '%s') ?", - header, absoluteFile); + wxLogError("Found inconsistency in the XML file '%s': " + "the method '%s' is documented in the " + "file '%s' but the other methods of the same " + "class are documented in the file '%s'", + filename, m.GetName(), header, absoluteFile); return false; } @@ -1569,10 +1593,14 @@ bool wxXmlDoxygenInterface::ParseCompoundDefinition(const wxString& filename) // add a new class if (klass.IsOk()) + { m_classes.Add(klass); + } else if (g_verbose) + { wxLogWarning("discarding class '%s' with %d methods...", klass.GetName(), klass.GetMethodCount()); + } } child = child->GetNext(); @@ -1658,7 +1686,7 @@ bool wxXmlDoxygenInterface::ParseMethod(const wxXmlNode* p, wxMethod& m, wxStrin // NOTE: Doxygen is smart enough to mark as virtual those functions // which are declared virtual in base classes but don't have - // the "virtual" keyword explicitely indicated in the derived + // the "virtual" keyword explicitly indicated in the derived // classes... so we don't need any further logic for virtuals m.SetVirtual(p->GetAttribute("virt")=="virtual");