Date:2010-12-15 10:34:53 (13 years 3 months ago)
Author:Werner Almesberger
Commit:7cb25c5a3fe36eba8466e38c37c9f11c9aabc99b
Message:cameo: apply translation after loading a file only to the new file

- lang.y (translate): list of paths is now an argument (instead of always
using the global path list)
- lang.y: on "gerber", "gnuplot", and "excellon", only translate the new
paths
Files: cameo/lang.y (5 diffs)

Change Details

cameo/lang.y
4141}
4242
4343
44static void translate(double x, double y, double z)
44static void translate(struct path *list, double x, double y, double z)
4545{
4646    struct path *path;
4747    struct point *p;
4848
49    for (path = paths; path; path = path->next)
49    for (path = list; path; path = path->next)
5050        for (p = path->first; p; p = p->next) {
5151            p->x += x;
5252            p->y += y;
...... 
103103    xd = x-xr;
104104    yd = y-yr;
105105
106    translate(xd, yd, 0);
106    translate(paths, xd, yd, 0);
107107    xo += xd;
108108    yo += yd;
109109}
...... 
191191            double x = $2*$4;
192192            double y = $3*$5;
193193
194            translate(x, y, 0);
194            translate(paths, x, y, 0);
195195            xo += x;
196196            yo += y;
197197        }
...... 
210210        }
211211    | TOK_TRANSLATE dimen dimen
212212        {
213            translate($2, $3, 0);
213            translate(paths, $2, $3, 0);
214214            xo += $2;
215215            yo += $3;
216216        }
...... 
224224        }
225225    | TOK_GERBER dimen opt_filename
226226        {
227            add_paths(gerber_read($3, $2/2));
228            translate(xo, yo, 0);
227            struct path *new;
228
229            new = gerber_read($3, $2/2);
230            translate(new, xo, yo, 0);
231            add_paths(new);
229232        }
230233    | TOK_GNUPLOT dimen opt_filename
231234        {
232            add_paths(gnuplot_read($3, $2/2));
233            translate(xo, yo, 0);
235            struct path *new;
236
237            new = gnuplot_read($3, $2/2);
238            translate(new, xo, yo, 0);
239            add_paths(new);
234240        }
235241    | TOK_EXCELLON opt_filename
236242        {
237            add_paths(excellon_read($2));
238            translate(xo, yo, 0);
243            struct path *new;
244
245            new = excellon_read($2);
246            translate(new, xo, yo, 0);
247            add_paths(new);
239248        }
240249    | TOK_WRITE opt_filename
241250        {
242            translate(0, 0, zo);
251            translate(paths, 0, 0, zo);
243252            gnuplot_write($2, paths);
244            translate(0, 0, -zo);
253            translate(paths, 0, 0, -zo);
245254        }
246255    | TOK_APPEND opt_filename
247256        {
248            translate(0, 0, zo);
257            translate(paths, 0, 0, zo);
249258            gnuplot_append($2, paths);
250            translate(0, 0, -zo);
259            translate(paths, 0, 0, -zo);
251260        }
252261    | TOK_DRILL dimen dimen
253262        {

Archive Download the corresponding diff file

Branches:
master



interactive