33 #include <glib/gstdio.h>
37 #define dprintf if(DEBUG) printf
39 #define round(x) floor(x+0.5)
45 GArray *apertureTable = g_array_new(FALSE, FALSE,
sizeof(
int));
49 setlocale(LC_NUMERIC,
"C");
51 if ((fd = g_fopen(filename,
"w")) == NULL) {
52 GERB_MESSAGE(_(
"Can't open file for writing: %s"), filename);
61 fprintf(fd,
"INCH,TZ\n");
64 gerbv_aperture_t *aperture;
69 for (i = APERTURE_MIN; i < APERTURE_MAX; i++) {
75 switch (aperture->type) {
77 fprintf(fd,
"T%dC%1.3f\n", i, aperture->parameter[0]);
79 g_array_append_val(apertureTable, i);
89 for (i = 0; i < apertureTable->len; i++) {
90 int aperture_idx = g_array_index(apertureTable,
int, i);
93 fprintf(fd,
"T%d\n", aperture_idx);
102 fprintf(fd,
"X%06ldY%06ld\n",
103 (
long)round(net->
stop_x * 10000.0),
104 (
long)round(net->
stop_y * 10000.0));
107 fprintf(fd,
"X%06ldY%06ldG85X%06ldY%06ld\n",
108 (
long)round(net->
start_x * 10000.0),
109 (
long)round(net->
start_y * 10000.0),
110 (
long)round(net->
stop_x * 10000.0),
111 (
long)round(net->
stop_y * 10000.0));
118 g_array_free (apertureTable, TRUE);
121 fprintf(fd,
"M30\n\n");
126 setlocale(LC_NUMERIC,
"");