39 #define dprintf if(DEBUG) printf
61 drill_list = gerbv_drill_stats_new_drill_list();
62 if (drill_list == NULL)
63 GERB_FATAL_ERROR(_(
"malloc drill_list failed"));
67 error_list = gerbv_drill_stats_new_error_list();
68 if (error_list == NULL)
69 GERB_FATAL_ERROR(_(
"malloc error_list failed"));
82 tempError = nextError->next;
83 g_free (nextError->error_text);
85 nextError = tempError;
93 while (nextAperture) {
94 tempAperture = nextAperture->next;
95 g_free(nextAperture->drill_unit);
96 g_free (nextAperture);
97 nextAperture = tempAperture;
105 gerbv_drill_destroy_error_list (stats->error_list);
106 gerbv_drill_destroy_drill_list (stats->drill_list);
120 dprintf(
"---> Entering gerbv_drill_stats_add_layer ..... \n");
122 accum_stats->layer_count++;
124 accum_stats->comment += input_stats->comment;
127 accum_stats->G00 += input_stats->G00;
128 accum_stats->G01 += input_stats->G01;
129 accum_stats->G02 += input_stats->G02;
130 accum_stats->G03 += input_stats->G03;
131 accum_stats->G04 += input_stats->G04;
132 accum_stats->G05 += input_stats->G05;
133 accum_stats->G85 += input_stats->G85;
134 accum_stats->G90 += input_stats->G90;
135 accum_stats->G91 += input_stats->G91;
136 accum_stats->G93 += input_stats->G93;
137 accum_stats->G_unknown += input_stats->G_unknown;
139 accum_stats->M00 += input_stats->M00;
140 accum_stats->M01 += input_stats->M01;
141 accum_stats->M18 += input_stats->M18;
142 accum_stats->M25 += input_stats->M25;
143 accum_stats->M30 += input_stats->M30;
144 accum_stats->M31 += input_stats->M31;
145 accum_stats->M45 += input_stats->M45;
146 accum_stats->M47 += input_stats->M47;
147 accum_stats->M48 += input_stats->M48;
148 accum_stats->M71 += input_stats->M71;
149 accum_stats->M72 += input_stats->M72;
150 accum_stats->M95 += input_stats->M95;
151 accum_stats->M97 += input_stats->M97;
152 accum_stats->M98 += input_stats->M98;
153 accum_stats->M_unknown += input_stats->M_unknown;
155 accum_stats->R += input_stats->R;
158 for (drill = input_stats->drill_list;
160 drill = drill->next) {
161 dprintf(
" In gerbv_drill_stats_add_layer, adding drill_num = %d to list\n",
165 drill_stats_add_to_drill_list(accum_stats->drill_list,
171 dprintf(
" adding count %d of drills for drill %d\n",
172 drill->drill_count, drill->drill_num);
173 drill_stats_add_to_drill_counter(accum_stats->drill_list,
176 accum_stats->total_count += drill->drill_count;
180 for (error = input_stats->error_list;
182 error = error->next) {
183 if (error->error_text != NULL) {
184 drill_stats_add_error(accum_stats->error_list,
194 if (input_stats->detect) {
195 tmps2 = g_strdup_printf (_(
"Broken tool detect %s (layer %d)"), input_stats->detect, this_layer);
197 if (accum_stats->detect) {
199 tmps = g_strdup_printf (
"%s\n%s", accum_stats->detect, tmps2);
200 g_free (accum_stats->detect);
201 accum_stats->detect = NULL;
205 tmps = g_strdup_printf (
"%s", tmps2);
212 accum_stats->detect = tmps;
215 for (error = input_stats->error_list;
217 error = error->next) {
218 if (error->error_text != NULL) {
219 drill_stats_add_error(accum_stats->error_list,
227 dprintf(
"<--- .... Leaving gerbv_drill_stats_add_layer.\n");
238 for(drill = drill_list_in; drill != NULL; drill = drill->next) {
239 if (drill_num_in == drill->drill_num) {
249 gerbv_drill_stats_new_drill_list() {
257 drill_list->drill_count = 0;
258 drill_list->drill_num = -1;
259 drill_list->drill_size = 0.0;
260 drill_list->drill_unit = NULL;
261 drill_list->next = NULL;
269 int drill_num_in,
double drill_size_in,
270 char *drill_unit_in) {
276 dprintf (
"%s(%p, %d, %g, \"%s\")\n", __FUNCTION__, drill_list_in, drill_num_in,
277 drill_size_in, drill_unit_in);
279 dprintf(
" ---> Entering drill_stats_add_to_drill_list, first drill_num in list = %d ...\n",
280 drill_list_in->drill_num);
283 if (drill_list_in->drill_num == -1) {
284 dprintf(
" .... In drill_stats_add_to_drill_list, adding first drill, no %d\n",
286 drill_list_in->drill_num = drill_num_in;
287 drill_list_in->drill_size = drill_size_in;
288 drill_list_in->drill_count = 0;
289 drill_list_in->drill_unit = g_strdup_printf(
"%s", drill_unit_in);
290 drill_list_in->next = NULL;
294 for(drill = drill_list_in;
297 dprintf(
"checking this drill_num %d against that in list %d.\n",
298 drill_num_in, drill->drill_num);
299 if (drill_num_in == drill->drill_num) {
300 dprintf(
" .... In drill_stats_add_to_drill_list, drill no %d already in list\n",
309 if (drill_list_new == NULL) {
310 GERB_FATAL_ERROR(_(
"malloc format failed"));
314 dprintf(
" .... In drill_stats_add_to_drill_list, adding new drill, no %d\n",
316 drill_list_new->drill_num = drill_num_in;
317 drill_list_new->drill_size = drill_size_in;
318 drill_list_new->drill_count = 0;
319 drill_list_new->drill_unit = g_strdup_printf(
"%s", drill_unit_in);
320 drill_list_new->next = NULL;
321 drill_last->next = drill_list_new;
323 dprintf(
" <---- ... leaving drill_stats_add_to_drill_list.\n");
330 int drill_num_in,
double drill_size_in,
331 char *drill_unit_in) {
335 dprintf(
" ---> Entering drill_stats_modify_drill_list, first drill_num in list = %d ...\n",
336 drill_list_in->drill_num);
339 for(drill = drill_list_in;
342 dprintf(
"checking this drill_num %d against that in list %d.\n",
343 drill_num_in, drill->drill_num);
344 if (drill_num_in == drill->drill_num) {
345 dprintf(
" .... Found it, now update it ....\n");
346 drill->drill_size = drill_size_in;
347 if (drill->drill_unit)
348 g_free(drill->drill_unit);
349 drill->drill_unit = g_strdup_printf(
"%s", drill_unit_in);
350 dprintf(
" <---- ... Modified drill. leaving drill_stats_modify_drill_list.\n");
354 dprintf(
" <---- ... Did not find drill. leaving drill_stats_modify_drill_list.\n");
363 dprintf(
" ----> Entering drill_stats_increment_drill_counter......\n");
366 for(drill = drill_list_in; drill != NULL; drill = drill->next) {
367 if (drill_num_in == drill->drill_num) {
368 drill->drill_count++;
369 dprintf(
" .... incrementing drill count. drill_num = %d, drill_count = %d.\n",
370 drill_list_in->drill_num, drill->drill_count);
371 dprintf(
" <---- .... Leaving drill_stats_increment_drill_counter after incrementing counter.\n");
375 dprintf(
" <---- .... Leaving drill_stats_increment_drill_counter without incrementing any counter.\n");
386 for(drill = drill_list_in; drill != NULL; drill = drill->next) {
387 if (drill_num_in == drill->drill_num) {
388 dprintf(
" In drill_stats_add_to_drill_counter, adding increment = %d drills to drill list\n", increment);
389 drill->drill_count += increment;
398 gerbv_drill_stats_new_error_list() {
406 error_list->layer = -1;
407 error_list->error_text = NULL;
408 error_list->next = NULL;
417 int layer,
const char *error_text,
424 dprintf(
" ----> Entering drill_stats_add_error......\n");
429 GERB_FATAL_ERROR(
"%s",error_text);
432 GERB_COMPILE_ERROR(
"%s",error_text);
435 GERB_COMPILE_WARNING(
"%s",error_text);
443 if (error_list_in->error_text == NULL) {
444 error_list_in->layer = layer;
445 error_list_in->error_text = g_strdup_printf(
"%s", error_text);
446 error_list_in->type = type;
447 error_list_in->next = NULL;
448 dprintf(
" <---- .... Leaving drill_stats_add_error after adding first error message.\n");
453 for(error = error_list_in; error != NULL; error = error->next) {
454 if ((strcmp(error->error_text, error_text) == 0) &&
455 (error->layer == layer) ) {
464 if (error_list_new == NULL) {
465 GERB_FATAL_ERROR(_(
"malloc error_list failed"));
469 error_list_new->layer = layer;
470 error_list_new->error_text = g_strdup_printf(
"%s", error_text);
471 error_list_new->type = type;
472 error_list_new->next = NULL;
473 error_last->next = error_list_new;
475 dprintf(
" <---- .... Leaving drill_stats_add_error after adding new error message.\n");