X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com X-TCPREMOTEIP: 207.224.51.38 X-Authenticated-UID: jpd AT noqsi DOT com Content-Type: multipart/signed; boundary="Apple-Mail=_EA9F2FD6-D948-41E0-B2D1-D989E4F4C0B5"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: [geda-user] Pin mapping (separate symbols from mappings) X-Pgp-Agent: GPGMail 2.5.2 From: John Doty In-Reply-To: <201510192340.t9JNeo6n020302@envy.delorie.com> Date: Wed, 21 Oct 2015 11:42:21 -0600 Message-Id: References: <20151018204010 DOT 9cce6a231dcc296256e187bd AT gmail DOT com> <201510181843 DOT t9IIhmWo025346 AT envy DOT delorie DOT com> <20151018234424 DOT c0551dad9bef0859130239d9 AT gmail DOT com> <36B94694-F2AC-4A75-A8EB-40A1CE9A534C AT noqsi DOT com> <201510182225 DOT t9IMPkxK032763 AT envy DOT delorie DOT com> <20151019003814 DOT f62620bf0fec77e65104c105 AT gmail DOT com> <201510190242 DOT t9J2gl7w009345 AT envy DOT delorie DOT com> <20151019092555 DOT 46eed4540c2d2044bbeab878 AT gmail DOT com> <1A419AED-FCCA-4B1F-8589-912435534E2E AT noqsi DOT com> <201510191647 DOT t9JGlu4j024585 AT envy DOT delorie DOT com> <041FF42A-691F-4E6B-9DEB-8C6B3C2F3E53 AT noqsi DOT com> <201510191850 DOT t9JIop8Y029095 AT envy DOT delorie DOT com> <201510192055 DOT t9JKt2o6005861 AT envy DOT delorie DOT com> <1E816300-E31E-4B85-B51D-7EAEC5A466BF AT noqsi DOT com> <201510192110 DOT t9JLAFKG007281 AT envy DOT delorie DOT com> <201510192340 DOT t9JNeo6n020302 AT envy DOT delorie DOT com> To: geda-user AT delorie DOT com X-Mailer: Apple Mail (2.1878.6) Reply-To: geda-user AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: geda-user AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk --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 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--