From 072b7804ee1434738dd84417f094350ea99f3223 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Tue, 12 Jun 2012 15:23:01 -0300 Subject: [PATCH] cameo/: experimental command "outside" to detect real outer borders Should be merged into tool_comp_paths later. --- cameo/lang.l | 1 + cameo/lang.y | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cameo/lang.l b/cameo/lang.l index eb7ccbc..a6048b9 100644 --- a/cameo/lang.l +++ b/cameo/lang.l @@ -49,6 +49,7 @@ NUM -?[0-9]+\.?[0-9]* mill return TOK_MILL; offset return TOK_OFFSET; optimize return TOK_OPTIMIZE; +outside return TOK_OUTSIDE; remainder return TOK_REMAINDER; remore return TOK_REMOVE; reset return TOK_RESET; diff --git a/cameo/lang.y b/cameo/lang.y index e3c9c00..1c12aae 100644 --- a/cameo/lang.y +++ b/cameo/lang.y @@ -188,7 +188,8 @@ static struct path **classify(struct path **anchor, struct path *path) %token TOK_ALIGN TOK_AREA TOK_ARRAY TOK_CLEAR TOK_DRILL TOK_EMPTY -%token TOK_KEEP TOK_MILL TOK_OFFSET TOK_OPTIMIZE TOK_REMAINDER +%token TOK_KEEP TOK_MILL TOK_OFFSET TOK_OPTIMIZE +%token TOK_OUTSIDE TOK_REMAINDER %token TOK_REMOVE TOK_RESET %token TOK_REVERSE TOK_ROTATE TOK_STATS TOK_TRANSLATE TOK_Z %token TOK_APPEND TOK_GERBER TOK_GNUPLOT TOK_EXCELLON TOK_WRITE @@ -256,6 +257,19 @@ command: { paths = optimize_paths(paths); } + | TOK_OUTSIDE + { + struct path *a; + struct path *b; + + for (a = paths; a; a = a->next) { + for (b = paths; b; b = b->next) + if (a != b && path_is_inside(a, b)) + break; + if (!b) + a->outside = 1; + } + } | TOK_REVERSE { struct path *tmp;