[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: gaf.git: branch: master updated (1.5.2-20090328-111-g7d719eb)
The branch, master has been updated
via 7d719ebe1767d2ba802174fb172f0e1a896a857b (commit)
from 605ace65a691d3960e258a9b52fa940be3517448 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
gnetlist/scheme/gnet-pcbpins.scm | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
=================
Commit Messages
=================
commit 7d719ebe1767d2ba802174fb172f0e1a896a857b
Author: Jared Casper <jaredcasper@xxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
Quote pins names if they contain comma or close parenthesis. [2823703]
A comma or close parenthesis will cause problems with the pcb action
script, so if one of the arguments to ChangePinName contains one it
should be quoted. Any quote characters within the argument are
escaped.
Right now it only quotes if there is a comma or close parenthesis. We
could just quote all pin names to future proof it against more special
characters in the action argument, but this seems less intrusive and
doesn't affect those without a new pcb that accepts quotes in the
arguments.
(Minor formatting changes and addition of comments made by Peter B
prior to committing).
:100644 100644 67f951e... 2c675a6... M gnetlist/scheme/gnet-pcbpins.scm
=========
Changes
=========
commit 7d719ebe1767d2ba802174fb172f0e1a896a857b
Author: Jared Casper <jaredcasper@xxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
Quote pins names if they contain comma or close parenthesis. [2823703]
A comma or close parenthesis will cause problems with the pcb action
script, so if one of the arguments to ChangePinName contains one it
should be quoted. Any quote characters within the argument are
escaped.
Right now it only quotes if there is a comma or close parenthesis. We
could just quote all pin names to future proof it against more special
characters in the action argument, but this seems less intrusive and
doesn't affect those without a new pcb that accepts quotes in the
arguments.
(Minor formatting changes and addition of comments made by Peter B
prior to committing).
diff --git a/gnetlist/scheme/gnet-pcbpins.scm b/gnetlist/scheme/gnet-pcbpins.scm
index 67f951e..2c675a6 100644
--- a/gnetlist/scheme/gnet-pcbpins.scm
+++ b/gnetlist/scheme/gnet-pcbpins.scm
@@ -18,6 +18,24 @@
;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+(use-modules (ice-9 regex))
+
+;; A comma or close parenthesis will cause problems with the pcb
+;; action script, so if one of the arguments to ChangePinName contains
+;; one it should be quoted. Any quote characters within the argument
+;; are escaped.
+;;
+;; At present, this function only quotes if there is a comma or close
+;; parenthesis present in the string.
+(define pcbpins:quote_string
+ (lambda (s)
+ (if (string-match "[,)]" s)
+ (string-join (list "\""
+ (regexp-substitute/global #f "\"" s 'pre "\\\"" 'post)
+ "\"")
+ "")
+ s)))
+
;; write out the pins for a particular component
(define pcbpins:component_pins
(lambda (port package pins)
@@ -29,19 +47,19 @@
(pinnum #f)
)
(display "ChangePinName(" port)
- (display package port)
+ (display (pcbpins:quote_string package) port)
(display ", " port)
(set! pinnum (gnetlist:get-attribute-by-pinnumber package pin "pinnumber"))
- (display pinnum port)
+ (display (pcbpins:quote_string pinnum) port)
(display ", " port)
(set! label (gnetlist:get-attribute-by-pinnumber package pin "pinlabel"))
(if (string=? label "unknown")
(set! label pinnum)
)
- (display label port)
+ (display (pcbpins:quote_string label) port)
(display ")\n" port)
)
(pcbpins:component_pins port package (cdr pins))
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs