← Back to team overview

kicad-developers team mailing list archive

Re: Bug #1752298: Clean up sorting functions for mixed text and numbers

 

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


Follow ups

References