Example #1
0
void IfaceCheckApp::PrintStatistics(long secs)
{
    // these stats, for what regards the gcc XML, are all referred to the wxWidgets
    // classes only!

    wxLogMessage("wx real headers contains declaration of %d classes (%d methods)",
               m_gccInterface.GetClassesCount(), m_gccInterface.GetMethodCount());
    wxLogMessage("wx interface headers contains declaration of %d classes (%d methods)",
               m_doxyInterface.GetClassesCount(), m_doxyInterface.GetMethodCount());

    // build a list of the undocumented wx classes
    wxString list;
    int undoc = 0;
    const wxClassArray& arr = m_gccInterface.GetClasses();
    for (unsigned int i=0; i<arr.GetCount(); i++) {
        if (m_doxyInterface.FindClass(arr[i].GetName()) == NULL) {
            list += arr[i].GetName() + ", ";
            undoc++;
        }
    }

    list.RemoveLast();
    list.RemoveLast();

    wxLogMessage("the list of the %d undocumented wx classes is: %s", undoc, list);
    wxLogMessage("total processing took %d seconds.", secs);
}
bool IfaceCheckApp::Compare()
{
    const wxClassArray& interfaces = m_doxyInterface.GetClasses();
    const wxClass* c;
    int mcount = 0, ccount = 0;

    wxLogMessage("Comparing the interface API to the real API (%d classes to compare)...",
                 interfaces.GetCount());

    if (!m_strToMatch.IsEmpty())
    {
        wxLogMessage("Processing only header files matching '%s' expression.", m_strToMatch);
    }

#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
    for (unsigned int i=0; i<interfaces.GetCount(); i++)
    {
        // only compare the methods which are available for the port
        // for which the gcc XML was produced
        if (interfaces[i].GetAvailability() != wxPORT_UNKNOWN &&
            (interfaces[i].GetAvailability() & m_gccInterface.GetInterfacePort()) == 0) {

            if (g_verbose)
            {
                wxLogMessage("skipping class '%s' since it's not available for the %s port.",
                           interfaces[i].GetName(), m_gccInterface.GetInterfacePortName());
            }

            continue;       // skip this method
        }

        // shorten the name of the header so the log file is more readable
        // and also for calling IsToProcess() against it
        wxString header = wxFileName(interfaces[i].GetHeader()).GetFullName();

        if (!IsToProcess(header))
            continue;       // skip this one

        wxString cname = interfaces[i].GetName();

        // search in the real headers for i-th interface class; we search for
        // both class cname and cnameBase since in wxWidgets world tipically
        // class cname is platform-specific while the real public interface of
        // that class is part of the cnameBase class.
        /*c = m_gccInterface.FindClass(cname + "Base");
        if (c) api.Add(c);*/

        c = m_gccInterface.FindClass(cname);
        if (!c)
        {
            // sometimes the platform-specific class is named "wxGeneric" + cname
            // or similar:
            c = m_gccInterface.FindClass("wxGeneric" + cname.Mid(2));
            if (!c)
            {
                c = m_gccInterface.FindClass("wxGtk" + cname.Mid(2));
            }
        }

        if (c) {

            // there is a class with the same (logic) name!
            mcount += CompareClasses(&interfaces[i], c);

        } else {

            wxLogMessage("%s: couldn't find the real interface for the '%s' class",
                       header, cname);
            ccount++;
        }
    }

    wxLogMessage("%d on a total of %d methods (%.1f%%) of the interface headers do not exist in the real headers",
               mcount, m_doxyInterface.GetMethodCount(), (float)(100.0 * mcount/m_doxyInterface.GetMethodCount()));
    wxLogMessage("%d on a total of %d classes (%.1f%%) of the interface headers do not exist in the real headers",
               ccount, m_doxyInterface.GetClassesCount(), (float)(100.0 * ccount/m_doxyInterface.GetClassesCount()));

    return true;
}