← Back to team overview

kicad-developers team mailing list archive

Re: sorting pins in .lib files

 

On 02/23/2012 03:01 PM, Laurent GONZALEZ wrote:
> hi there,
>
> I am a very new user to kicad, and at my first try something bugged me.
>
> When creating a big component (mine is TQFP100), I find it very useful
> to tap directly into the .lib file to tune labels, pin position, etc ...
>
> Unfortunately, when a hand modified component is re-imported into the
> library editor, and saved, most of previous efforts to sort pins are
> void, which makes the .lib file difficult to read back.
>
> After having a look into the code (thanks doxygen), I think that the
> DoCompare method for pins is worth to be modified, in particular
> regarding how m_number members are compared.
>
> My guess is that m_number must be sorted alphabetically until numeric
> digit are encountered. Then, a numeric part must be compared as a
> number. The goal is to sort correctly A9, A10, B9, B10 on a BGA chip.
>
> Of course, I would be happy to propose a patch, if other share my
> opinion about this improvement.

I am unable to think of any downsides to this plan.

But I have been wrong before, suggest getting one more opinion.

If nothing comes, then:

some building blocks for your patch:

include <kicad_string.h>


compare( LIB_PIN* pin1, LIB_PIN* pin2 )
{
    RefDesStringCompare( pin1->GetNumberString(), pin2->GetNumberString() );
}





References