summaryrefslogtreecommitdiff
path: root/kicad
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-09-19 05:27:09 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-09-19 05:27:09 (GMT)
commitb71e69c151b62d77e8cb8a8d97d3ce2bb4b6cc2e (patch)
tree694c5c759aa66c135ff0da7bb73befe8405f0818 /kicad
parent05eb800a657fd7b24ed796332c74fd550be86b14 (diff)
downloadeeshow-b71e69c151b62d77e8cb8a8d97d3ce2bb4b6cc2e.zip
eeshow-b71e69c151b62d77e8cb8a8d97d3ce2bb4b6cc2e.tar.gz
eeshow-b71e69c151b62d77e8cb8a8d97d3ce2bb4b6cc2e.tar.bz2
kicad/pl-render.c (expand): support %Cn (comment)
Diffstat (limited to 'kicad')
-rw-r--r--kicad/pl-render.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/kicad/pl-render.c b/kicad/pl-render.c
index 135a19c..bac47f7 100644
--- a/kicad/pl-render.c
+++ b/kicad/pl-render.c
@@ -75,7 +75,19 @@ static char *expand(const struct pl_ctx *pl, const char *s,
x = "%";
break;
case 'C': // comment #n
- x = "%C";
+ if (isdigit(p[2])) {
+ n = p[2] - '0';
+ if (n >= sheet->n_comments) {
+ x = "";
+ } else {
+ x = (char *) sheet->comments[n];
+ if (!x)
+ x = "";
+ }
+ } else {
+ warning("%%C without number");
+ x = "???";
+ }
break;
case 'D': // date
x = "%D";
@@ -124,7 +136,7 @@ static char *expand(const struct pl_ctx *pl, const char *s,
res = realloc_size(res, size + p - s + len);
memcpy(res + size, s, p - s);
size += p - s;
- s = p + 2;
+ s = p[1] == 'C' && p[2] ? p + 3 : p + 2;
memcpy(res + size, x, len);
size += len;
if (do_free)