1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2025-04-21 12:27:27 +03:00

cameo/: new gnuplot tag #%id= with generator-assigned identifier

Excellon and Gerber store the file name there.
This commit is contained in:
Werner Almesberger
2011-09-05 05:46:25 -03:00
parent 41bffa8f79
commit a42a18fef3
8 changed files with 40 additions and 25 deletions

View File

@@ -159,7 +159,7 @@ static void header(FILE *file)
/* ----- body parsing ------------------------------------------------------ */
static int do_cmd(char cmd, double v, int nl)
static int do_cmd(char cmd, double v, int nl, const char *name)
{
static int metric = 1;
static int slotting = 0;
@@ -220,7 +220,7 @@ static int do_cmd(char cmd, double v, int nl)
if (!metric)
v = IN2MM(v);
if (slotting) {
*anchor = path_new(d/2);
*anchor = path_new(d/2, name);
path_add(*anchor, x0, y, 0);
path_add(*anchor, x, v, 0);
anchor = &(*anchor)->next;
@@ -229,7 +229,7 @@ static int do_cmd(char cmd, double v, int nl)
}
if (nl) {
assert(d);
*anchor = path_new(d/2);
*anchor = path_new(d/2, name);
path_add(*anchor, x, v, 0);
anchor = &(*anchor)->next;
break;
@@ -245,7 +245,7 @@ static int do_cmd(char cmd, double v, int nl)
}
static void body(FILE *file)
static void body(FILE *file, const char *name)
{
char cmd = 0;
double v = 0, f = 1;
@@ -255,7 +255,7 @@ static void body(FILE *file)
if (c == '\n') {
lineno++;
if (cmd)
do_cmd(cmd, s ? -v : v, 1);
do_cmd(cmd, s ? -v : v, 1, name);
cmd = 0;
} else if (isdigit(c)) {
if (f == 1)
@@ -270,7 +270,7 @@ static void body(FILE *file)
s = !s;
} else {
if (cmd)
if (!do_cmd(cmd, s ? -v : v, 0))
if (!do_cmd(cmd, s ? -v : v, 0, name))
return;
cmd = c;
v = 0;
@@ -296,7 +296,7 @@ struct path *excellon_read(const char *name)
anchor = &paths;
header(file);
body(file);
body(file, name);
fclose(file);
return paths;