Mail Archives: geda-user/2015/10/21/13:42:50
--Apple-Mail=_EA9F2FD6-D948-41E0-B2D1-D989E4F4C0B5
Content-Type: multipart/mixed;
boundary="Apple-Mail=_B4E80FD0-EAF1-46E0-8311-6F9CE62D1269"
--Apple-Mail=_B4E80FD0-EAF1-46E0-8311-6F9CE62D1269
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=windows-1252
On Oct 19, 2015, at 5:40 PM, DJ Delorie <dj AT delorie DOT com> wrote:
>>>=20
>>> If the tool *requires* that each symbol be unique, then either...
>>>=20
>>> 1. It must not let the user provide non-unique symbols, or
>>>=20
>>> 2. It must produce a hard error when it detects non-unique symbols, =
or
>>>=20
>>> 3. It must provide some user-independent way of making the symbols =
unique.
>>>=20
>>> gaf currently does none of these.
>>=20
>> But that's not how geda-gaf works.
>=20
> That's *exactly* how geda-gaf doesn't work. It allows the user to
> make invalid schematics and doesn't complain when it can't figure out
> what to do.
What common rules separate valid schematics from invalid for *every* =
flow? No, I don=92t know either. I=92m generally not willing to inflict =
rules that apply only to the subset of flows I know on everybody. Are =
you?
> Given that one of those three conditions must be met to
> avoid errors (unless there is a fourth way to avoid errors, which you
> haven't mentioned), then the geda-gaf problem is that it doesn't avoid
> errors. This normally isn't a problem when we make the user
> responsible for the results, but if we want to add something that
> needs uniqueness, we can't rely on the user any more.
Use The Force, Luke. Here=92s an alpha gnetlist back end that detects =
duplicate refdes-pin combinations, lists them, and exits with nonzero =
status if there are any. For your scripting pleasure in flows for which =
this is appropriate.
I have not found a case it fails to detect, but it correctly detects =
nothing for a big project where drc2 spews out hundreds of spurious =
errors.
--Apple-Mail=_B4E80FD0-EAF1-46E0-8311-6F9CE62D1269
Content-Disposition: attachment;
filename=gnet-check-duplicates.scm
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="gnet-check-duplicates.scm"
Content-Transfer-Encoding: 7bit
(use-modules (srfi srfi-1))
;; Run the stuff below and issue a diagnostic if any duplicates are found.
;; This exits gnetlist with a status of 1 if it has detected an error.
;; The only output is to (current-error-port).
;;
(define (check-duplicates unused-filename)
(let
(
(dups (find-duplicates (every-connection)))
)
(if (not (null? dups))
(begin
(format (current-error-port)
"Duplicate refdes-pin combinations:\n ~A\n"
dups
)
(primitive-exit 1)
)
)
)
)
;; Make a sorted list of every connection to non-graphical symbols in the design.
;; The connections are coded as text in the form refdes-pin.
;;
(define (every-connection)
(sort
(map refdes-pin
(apply append
(map pins-on-package
(gnetlist:get-packages "dummy")
)
)
)
string<
)
)
;; Make a list of (refdes pin) for each pin on the "package" identified by refdes.
;; Utilizes the fact that (gnetlist:get-pins-nets) does not remove duplicates.
;;
(define (pins-on-package refdes)
(map
(lambda (pn)
(list refdes (car pn))
)
(gnetlist:get-pins-nets refdes)
)
)
;; Make a refdes-pin string from a (refdes pin) list.
;;
(define (refdes-pin rp)
(string-append (car rp) "-" (cadr rp))
)
;; Make a list of duplicates from a sorted list
;; This works by zipping a list with itself with the first object dropped,
;; creating a list of pairs of neighbors.
;; It filters that list to find pairs of (equal?) objects.
;; It does not remove duplicated duplicates from the result.
;;
(define (find-duplicates l)
(if
(null? l)
; then do nothing gracefully
'()
; else
(unzip1
(filter
(lambda (x)
(apply equal? x)
)
(zip l (cdr l))
)
)
)
)
--Apple-Mail=_B4E80FD0-EAF1-46E0-8311-6F9CE62D1269
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=windows-1252
Usage:
gnetlist -L . -g check-duplicates files.sch
(assuming gnet-check-duplicates.scm is in the working directory).
For antiques like me who are fans of the =93lint" approach, making this =
a separate back end makes good sense. For fans of the integrated =
approach, gnetlist -m loads things a bit too soon for this sort of check =
to work as a plugin. You could have your back end load it. I also think =
just a few lines added to gnetlist.scm and gnetlist-post.scm could =
enable plugins of this sort, but I haven=92t experimented with that yet.
John Doty Noqsi Aerospace, Ltd.
http://www.noqsi.com/
jpd AT noqsi DOT com
--Apple-Mail=_B4E80FD0-EAF1-46E0-8311-6F9CE62D1269--
--Apple-Mail=_EA9F2FD6-D948-41E0-B2D1-D989E4F4C0B5
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org
iQIcBAEBCgAGBQJWJ85+AAoJEF1Aj/0UKykRgvoP/jEMFYChKzrtHKiDV9uiawqp
H+1U8QMGCBqhouVNqq9EWtnw2EdngY8E2pPo8YonJ4blkVArFGe+yzRILV6EFvwy
bx6WiCpwyGTMuTi6Fq6S3VevzUE8SSHsskc87jrmPCoHJTgXHDk64vcURkermWTF
3aNS++c4pEgT2VOQD7uxbQJlcRD8fMc0p8T4FB0EUDeWO2RZdTIYw6VF8FtVxe6i
9nkeXh6U9eP2iN1HbQgSnkpwqu0LCkpuAqxpB4ZpetZHjb9PJsZ5n3Yg5E/FcfXc
RoSLeNvdtqbP4L3FnL2SxOSv1EQgcZAkeCOlKYWqllYsuVGT19okVSV1Q6NRYocm
bWBDaLEyurwzOJdgCuY7cKMCd+YKk9PklzbdqLBKYtsyZUG43jw6Xl1o40uuCzkY
MnsHf+OwaXqgV99f1N30//5I7pvpuZYlNBOC01Lce4N25fP2TI/DEBnWH+TfK3JG
k1JEMtVFDwZUykzjfZXQaqZOyv7tUKQbIRHeCiKqY7875o3fSJ09xAgFR2aexPcE
gvhtjAxksdRa2RnSBYri/UPlSXSt7ZzYPRBNDsm2F5k7wKxn9RabIMIu5DutB8wa
v6iQCzoTB3fx6/d6m/0yuBgFkUFSslJt0JXwO+tKoBBOqOtXPlaF9Oyeu8BHKiPL
0bDjNFe2+lWX6kZIiE1/
=2rC8
-----END PGP SIGNATURE-----
--Apple-Mail=_EA9F2FD6-D948-41E0-B2D1-D989E4F4C0B5--
- Raw text -