summaryrefslogtreecommitdiff
path: root/kicad/pl-parse.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-22 04:40:40 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-22 04:40:40 -0300
commitf4e780e0101b81d373a6fec3fc41bd8e382f9c21 (patch)
tree7a04e437be2ca642758e6bfb012777e3fa4eaeb2 /kicad/pl-parse.c
parent01e563c537c8503b86c833d351207396ec6c9fc2 (diff)
downloadeeshow-f4e780e0101b81d373a6fec3fc41bd8e382f9c21.tar.gz
eeshow-f4e780e0101b81d373a6fec3fc41bd8e382f9c21.tar.bz2
eeshow-f4e780e0101b81d373a6fec3fc41bd8e382f9c21.zip
eeshow/kicad/: begin text support for page layout (WIP); add missing pl-common.h
Diffstat (limited to 'kicad/pl-parse.c')
-rw-r--r--kicad/pl-parse.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/kicad/pl-parse.c b/kicad/pl-parse.c
index b8376f5..5b75f64 100644
--- a/kicad/pl-parse.c
+++ b/kicad/pl-parse.c
@@ -140,6 +140,43 @@ static bool process_setup(struct pl_ctx *p, const struct expr *e)
}
+static bool process_font(struct pl_obj *obj, const struct expr *e)
+{
+ const char *s;
+ const struct expr *next;
+
+ for (; e; e = e->next) {
+ if (e->s) {
+ if (!strcmp(e->s, "bold"))
+ obj->font |= font_bold;
+ else if (!strcmp(e->s, "italic"))
+ obj->font |= font_italic;
+ else
+ warning("ignoring \"%s\"\n", e->s);
+ continue;
+ }
+
+ if (!e->e) {
+ warning("ignoring empty list\n");
+ continue;
+ }
+ s = e->e->s;
+ next = e->e->next;
+
+ if (!strcmp(s, "comment"))
+ continue;
+
+ if (!strcmp(s, "size")) {
+ if (!get_coord(next, &obj->ex, &obj->ey,
+ &obj->edx, &obj->edy))
+ return 0;
+ } else
+ warning("ignoring \"%s\"\n", s);
+ }
+ return 1;
+}
+
+
static bool process_obj(struct pl_ctx *pl, const struct expr *e,
enum pl_obj_type type)
{
@@ -156,10 +193,19 @@ static bool process_obj(struct pl_ctx *pl, const struct expr *e,
obj->incrx = 0;
obj->incry = 0;
obj->incrlabel = 0;
+ obj->font = 0;
for (; e; e = e->next) {
+ if (e->s) {
+ if (obj->s) {
+ error("multiple strings\n");
+ return 0;
+ }
+ obj->s = stralloc(e->s);
+ continue;
+ }
if (!e->e) {
- warning("ignoring non-list\n");
+ warning("ignoring empty list\n");
continue;
}
@@ -193,6 +239,9 @@ static bool process_obj(struct pl_ctx *pl, const struct expr *e,
} else if (!strcmp(s, "incrlabel")) {
if (!get_int(next, &obj->incrlabel))
return 0;
+ } else if (!strcmp(s, "font")) {
+ if (!process_font(obj, next))
+ return 0;
} else
warning("ignoring \"%s\"\n", s);
}