Commit d24caad2 authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

++eeschema netlist.cpp and netform.cpp:

  * Found several speed optimizations in the netlist export code.
  * Fixed a bug in EXPORT_HELP::FindAllInstancesOfComponent() that I had broke.
  * Now sort the pins properly if they have pin numbers like A1 and A10,
    i.e. alphanumerics in them.
parents 7146863b df9dae6d
Loading
Loading
Loading
Loading
+11 −4
Original line number Original line Diff line number Diff line
@@ -4,18 +4,25 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.


2010-Jul-30 UPDATE Dick Hollenbeck <dick@softplc.com>
2010-Aug-3 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++eeschema netlist.cpp and netform.cpp:
  * Found several speed optimizations in the netlist export code.
  * Now sort the pins properly if they have pin numbers like A1 and A10,
    i.e. alphanumerics in them.


2010-Jul-30 & 31 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
================================================================================
++eeschema:
++eeschema:
  * Now link with XML support within wxWidgets.
  * Now link with XML support within wxWidgets.
  * Start of export the generic netlist in XML.  Still need to rework the chain
  * Export the generic netlist in XML.  Only the libpart elements are missing now.
    loaded netlist plugin.
    Still need to rework the chain loaded netlist plugin, but may do that in XSL.
  * OBJ_CMP_TO_LIST class now uses a std::string to hold the 8 bit string m_Ref,
  * OBJ_CMP_TO_LIST class now uses a std::string to hold the 8 bit string m_Ref,
    but hides this behind accessors which provide for both Unicode and 8 bit
    but hides this behind accessors which provide for both Unicode and 8 bit
    set and get functions.
    set and get functions.
  * build_BOM.cpp retains the selected filename on subsequent runs as a default.
  * build_BOM.cpp retains the selected filename on subsequent runs as a default.
  * Code cleaning, especially in build_BOM.cpp.
  * Code cleaning, especially in build_BOM.cpp.
  * Will work tomorrow also.




2010-jul-27, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
2010-jul-27, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
+110 −0
Original line number Original line Diff line number Diff line
@@ -320,3 +320,113 @@ char* strupper( char* Text )


    return Text;
    return Text;
}
}


int RefDesStringCompare( const wxString& strFWord, const wxString& strSWord )
{
    // The different sections of the first string
    wxString strFWordBeg, strFWordMid, strFWordEnd;

    // The different sections of the second string
    wxString strSWordBeg, strSWordMid, strSWordEnd;

    int isEqual = 0;            // The numerical results of a string compare
    int iReturn = 0;            // The variable that is being returned

    long lFirstDigit  = 0;      /* The converted middle section of the first
                                 *string */
    long lSecondDigit = 0;      /* The converted middle section of the second
                                 *string */

    // Split the two strings into separate parts
    SplitString( strFWord, &strFWordBeg, &strFWordMid, &strFWordEnd );
    SplitString( strSWord, &strSWordBeg, &strSWordMid, &strSWordEnd );

    // Compare the Beginning section of the strings
    isEqual = strFWordBeg.CmpNoCase( strSWordBeg );

    if( isEqual > 0 )
        iReturn = 1;
    else if( isEqual < 0 )
        iReturn = -1;
    else
    {
        // If the first sections are equal compare their digits
        strFWordMid.ToLong( &lFirstDigit );
        strSWordMid.ToLong( &lSecondDigit );

        if( lFirstDigit > lSecondDigit )
            iReturn = 1;
        else if( lFirstDigit < lSecondDigit )
            iReturn = -1;
        else
        {
            // If the first two sections are equal compare the endings
            isEqual = strFWordEnd.CmpNoCase( strSWordEnd );

            if( isEqual > 0 )
                iReturn = 1;
            else if( isEqual < 0 )
                iReturn = -1;
            else
                iReturn = 0;
        }
    }

    return iReturn;
}


int SplitString( wxString  strToSplit,
                 wxString* strBeginning,
                 wxString* strDigits,
                 wxString* strEnd )
{
    // Clear all the return strings
    strBeginning->Empty();
    strDigits->Empty();
    strEnd->Empty();

    // There no need to do anything if the string is empty
    if( strToSplit.length() == 0 )
        return 0;

    // Starting at the end of the string look for the first digit
    int ii;
    for( ii = (strToSplit.length() - 1); ii >= 0; ii-- )
    {
        if( isdigit( strToSplit[ii] ) )
            break;
    }

    // If there were no digits then just set the single string
    if( ii < 0 )
        *strBeginning = strToSplit;
    else
    {
        // Since there is at least one digit this is the trailing string
        *strEnd = strToSplit.substr( ii + 1 );

        // Go to the end of the digits
        int position = ii + 1;
        for( ; ii >= 0; ii-- )
        {
            if( !isdigit( strToSplit[ii] ) )
                break;
        }

        // If all that was left was digits, then just set the digits string
        if( ii < 0 )
            *strDigits = strToSplit.substr( 0, position );

        /* We were only looking for the last set of digits everything else is
         *part of the preamble */
        else
        {
            *strDigits    = strToSplit.substr( ii + 1, position - ii - 1 );
            *strBeginning = strToSplit.substr( 0, ii + 1 );
        }
    }

    return 0;
}
+0 −125
Original line number Original line Diff line number Diff line
@@ -71,12 +71,6 @@ static bool SortLabelsBySheet( const LABEL_OBJECT& obj1,
static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList );
static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList );
static int  PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList );
static int  PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList );


int         RefDesStringCompare( const wxString& lhs, const wxString& rhs );
int         SplitString( wxString  strToSplit,
                         wxString* strBeginning,
                         wxString* strDigits,
                         wxString* strEnd );



// separator used in bom export to spreadsheet
// separator used in bom export to spreadsheet
static char s_ExportSeparatorSymbol;
static char s_ExportSeparatorSymbol;
@@ -1049,122 +1043,3 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
}
}


/* This function will act just like the strcmp function but correctly sort
 * the numerical order in the string
 * return -1 if first string is less than the second
 * return 0 if the strings are equal
 * return 1 if the first string is greater than the second
 */
int RefDesStringCompare( const wxString& strFWord, const wxString& strSWord )
{
    // The different sections of the first string
    wxString strFWordBeg, strFWordMid, strFWordEnd;

    // The different sections of the second string
    wxString strSWordBeg, strSWordMid, strSWordEnd;

    int isEqual = 0;            // The numerical results of a string compare
    int iReturn = 0;            // The variable that is being returned

    long lFirstDigit  = 0;      /* The converted middle section of the first
                                 *string */
    long lSecondDigit = 0;      /* The converted middle section of the second
                                 *string */

    // Split the two string into separate parts
    SplitString( strFWord, &strFWordBeg, &strFWordMid, &strFWordEnd );
    SplitString( strSWord, &strSWordBeg, &strSWordMid, &strSWordEnd );

    // Compare the Beginning section of the strings
    isEqual = strFWordBeg.CmpNoCase( strSWordBeg );
    if( isEqual > 0 )
        iReturn = 1;
    else if( isEqual < 0 )
        iReturn = -1;
    else
    {
        // If the first sections are equal compare there digits
        strFWordMid.ToLong( &lFirstDigit );
        strSWordMid.ToLong( &lSecondDigit );

        if( lFirstDigit > lSecondDigit )
            iReturn = 1;
        else if( lFirstDigit < lSecondDigit )
            iReturn = -1;
        else
        {
            // If the first two sections are equal compare the endings
            isEqual = strFWordEnd.CmpNoCase( strSWordEnd );

            if( isEqual > 0 )
                iReturn = 1;
            else if( isEqual < 0 )
                iReturn = -1;
            else
                iReturn = 0;
        }
    }

    return iReturn;
}


/* This is the function that breaks a string into three parts.
 * The alphabetic preamble
 * The numeric part
 * Any alphabetic ending
 * For example C10A is split to C 10 A
 */
int SplitString( wxString  strToSplit,
                 wxString* strBeginning,
                 wxString* strDigits,
                 wxString* strEnd )
{
    // Clear all the return strings
    strBeginning->Clear();
    strDigits->Clear();
    strEnd->Clear();

    // There no need to do anything if the string is empty
    if( strToSplit.length() == 0 )
        return 0;

    // Starting at the end of the string look for the first digit
    int ii;
    for( ii = (strToSplit.length() - 1); ii >= 0; ii-- )
    {
        if( isdigit( strToSplit[ii] ) )
            break;
    }

    // If there were no digits then just set the single string
    if( ii < 0 )
        *strBeginning = strToSplit;
    else
    {
        // Since there is at least one digit this is the trailing string
        *strEnd = strToSplit.substr( ii + 1 );

        // Go to the end of the digits
        int position = ii + 1;
        for( ; ii >= 0; ii-- )
        {
            if( !isdigit( strToSplit[ii] ) )
                break;
        }

        // If all that was left was digits, then just set the digits string
        if( ii < 0 )
            *strDigits = strToSplit.substr( 0, position );

        /* We were only looking for the last set of digits everything else is
         *part of the preamble */
        else
        {
            *strDigits    = strToSplit.substr( ii + 1, position - ii - 1 );
            *strBeginning = strToSplit.substr( 0, ii + 1 );
        }
    }

    return 0;
}
+14 −3
Original line number Original line Diff line number Diff line
@@ -220,7 +220,7 @@ wxString SCH_SHEET_PATH::Path()
 * (the "normal" path uses the time stamps which do not changes even when
 * (the "normal" path uses the time stamps which do not changes even when
 * editing sheet parameters)
 * editing sheet parameters)
 */
 */
wxString SCH_SHEET_PATH::PathHumanReadable()
wxString SCH_SHEET_PATH::PathHumanReadable() const
{
{
    wxString s, t;
    wxString s, t;


@@ -355,6 +355,7 @@ SCH_ITEM* SCH_SHEET_PATH::MatchNextItem( wxFindReplaceData& aSearchData,
bool SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& d1 )
bool SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& d1 )
{
{
    m_numSheets = d1.m_numSheets;
    m_numSheets = d1.m_numSheets;

    unsigned i;
    unsigned i;
    for( i = 0; i < m_numSheets; i++ )
    for( i = 0; i < m_numSheets; i++ )
    {
    {
@@ -370,10 +371,11 @@ bool SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& d1 )
}
}




bool SCH_SHEET_PATH::operator==( const SCH_SHEET_PATH& d1 )
bool SCH_SHEET_PATH::operator==( const SCH_SHEET_PATH& d1 ) const
{
{
    if( m_numSheets != d1.m_numSheets )
    if( m_numSheets != d1.m_numSheets )
        return false;
        return false;

    for( unsigned i = 0; i < m_numSheets; i++ )
    for( unsigned i = 0; i < m_numSheets; i++ )
    {
    {
        if( m_sheets[i] != d1.m_sheets[i] )
        if( m_sheets[i] != d1.m_sheets[i] )
@@ -384,15 +386,24 @@ bool SCH_SHEET_PATH::operator==( const SCH_SHEET_PATH& d1 )
}
}




bool SCH_SHEET_PATH::operator!=( const SCH_SHEET_PATH& d1 )
bool SCH_SHEET_PATH::operator!=( const SCH_SHEET_PATH& d1 ) const
{
{
    if( m_numSheets != d1.m_numSheets )
    if( m_numSheets != d1.m_numSheets )
        return true;
        return true;

    for( unsigned i = 0; i < m_numSheets; i++ )
    for( unsigned i = 0; i < m_numSheets; i++ )
    {
    {
        if( m_sheets[i] != d1.m_sheets[i] )
        if( m_sheets[i] != d1.m_sheets[i] )
        {
            /*
            printf( "micompare this:'%s' d1:'%s'\n",
                CONV_TO_UTF8( PathHumanReadable() ),
                CONV_TO_UTF8( d1.PathHumanReadable() ) );
            */

            return true;
            return true;
        }
        }
    }


    return false;
    return false;
}
}
+3 −3
Original line number Original line Diff line number Diff line
@@ -150,7 +150,7 @@ public:
     * stamps in the path.  (Time stamps do not change even when editing
     * stamps in the path.  (Time stamps do not change even when editing
     * sheet parameters).
     * sheet parameters).
     */
     */
    wxString         PathHumanReadable();
    wxString         PathHumanReadable()  const;


    /** Function BuildSheetPathInfoFromSheetPathValue
    /** Function BuildSheetPathInfoFromSheetPathValue
     * Fill this with data to access to the hierarchical sheet known by its
     * Fill this with data to access to the hierarchical sheet known by its
@@ -207,9 +207,9 @@ public:


    bool operator=( const SCH_SHEET_PATH& d1 );
    bool operator=( const SCH_SHEET_PATH& d1 );


    bool operator==( const SCH_SHEET_PATH& d1 );
    bool operator==( const SCH_SHEET_PATH& d1 ) const;


    bool operator!=( const SCH_SHEET_PATH& d1 );
    bool operator!=( const SCH_SHEET_PATH& d1 ) const;
};
};




Loading