[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: spice-sdb connection order confusion



> > Why don't you just name them P01, P02, etc.??

Hmmm....

You might want to be careful with this work-around.  It will probably
work with the old spice-sdb, but with the fixed one in CVS I would be
curious to see what it does with refdeses like P01, P02, etc.

FWIW, the new version's algorithm is straightforward:

0.  Receive the list of package refdeses
1.  Strip the first char ('P') off each list item.
2.  Take the remainder of the list items, and convert them to numbers.
3.  Sort the numbers.
4.  Convert the numbers back to strings.
5.  Replace the first char ('P') on the strings.
6.  Return.

This fcn can be a little brittle in a couple of ways:

*  It assumes that the user uses the same, one character prefix for
each refdes.  If the user re-names the pin refdeses to PN1 or
something like that, the algorithm fails.  Also, if the user mixes pin
refdes prefixes (P1, J1, say), then the algorithm mixes up the refdes
prefixes.  

Note that these shouldn't occur in ordinary usage since the pins come
with refdes P? attached, and the user is expected to treat them
correctly.  Problems will arise if the user does 
something unexpected.   Yes, I agree that a well-written program would
check for these unexpected cases.  However, Scheme doesn't really lend
itself to doing sanity checks (functional programming languages have
this defect) [1], and I also didn't want to spend days just coding up
this little feature.

*  I rely upon Scheme's built-in string <-> number conversion fncs.
If they do something funky with string->number conversion of a string
like 01, then you might have a problem.  At the very least, the new
version will likely rename your pin from P01 to P1.

Stuart

[1]  Does Scheme even have an "assert" function?  Does guile?  Anyway,
a functional language like Scheme doesn't easily support a
step-by-step method of solving a problem.  Therefore, doing something
like this:

1.  Make sanity check 1.
2.  Make sanity check 2.
3.  Make sanity check 3.
4.  Do work.

which is trivial in a procedural language like C is a real PITA in
Scheme.  And counting all those parens would be a nightmare!

Comments?  Flames?



> 
> 
> On Dec 27, 2005, at 8:01 AM, Al Davis wrote:
> 
> > On Monday 26 December 2005 10:00 pm, Stuart Brorson wrote:
> >> Oh oh.  Sounds like a bug.  I never anticipated more than 9
> >> pins, or at least never thought about doing anything more
> >> than a stupid string comparison.
> >>
> >> I'll see about fixing it and sticking the fix into CVS.
> >> Thanks for the bug report.
> >
> >
> >>> The ordering of "SUBCKT IO Pin" connections on the .SUBCKT
> >>> line apparently depends on *textual* ordering of the refdes
> >>> attributes. This gets a bit confusing for more than 9 pins:
> >>> P10 winds up between P1 and P2!
> >>>
> >>> John Doty              Noqsi Aerospace, Ltd.
> >>> jpd@xxxxxxxxxxxxx
> >
> >
> > Why don't you just name them P01, P02, etc.??
> >
> 
> Well, that is exactly what I did once I understood the problem. The  
> reason to fix this is to make it unnecessary for the next person to  
> figure it out...
> 
> John Doty              Noqsi Aerospace, Ltd.
> jpd@xxxxxxxxxxxxx
> 
> 
>