kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #41304
Re: Bug #1752298: Clean up sorting functions for mixed text and numbers
I think Simon’s example are great, and also whoever mentioned doubling up letters /after/ cycling through the 26 (so AA follows Z).
Note also that there may only be the two or three in the bug report. I’ve folded in at least two other examples over the last year or so.
Cheers,
Jeff.
> On 1 Jul 2019, at 16:54, Simon Richter <Simon.Richter@xxxxxxxxxx> wrote:
>
> Hi Wayne,
>
> On Mon, Jul 01, 2019 at 09:22:15AM -0400, Wayne Stambaugh wrote:
>
>> We already have a string comparison function that handles this. Take a
>> look at StrNumCmp()[1] in common/string.cpp[2]. We use this function in
>> many places for mixed text and number comparisons so I see no reason not
>> to use it in this case unless there is a bug in StrNumCmp().
>
> I wrote that bug report because we have more than one function for that, so
> there is some duplication. This will probably need multiple modes that
> modify it, e.g. for BGA balls or voltages being used as net names.
>
> Examples where I think the current order is nonintuitive:
>
> - [ "A1", "A2", "AA1", "AA2", "B1", "B2", ... ]
> - [ "+1.2V", "+1V", "-1.2V", "-1V", "-12V", "1V", "12V" ]
>
> eeschema/pin_number.cpp has PinNumbers::Compare, which aims to handle the
> latter case, but it has a hardcoded rule that "V" can be used as a decimal
> point, which is also too broad and too narrow at the same time (e.g. we
> might want a mode where "R" is a decimal point, but "V" isn't).
>
> Simon
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
References