Index: trunk/src/hid_cam.c =================================================================== --- trunk/src/hid_cam.c (revision 27426) +++ trunk/src/hid_cam.c (revision 27427) @@ -476,8 +476,10 @@ return dst->exported_grps; } -void pcb_cam_nolayer(pcb_board_t *pcb, const char *src, const char **fn_out) +void pcb_cam_begin_nolayer(pcb_board_t *pcb, pcb_cam_t *dst, const char *src, const char **fn_out) { + memset(dst, 0, sizeof(pcb_cam_t)); + dst->pcb = pcb; if (src != NULL) { if (strchr(src, '=') != NULL) pcb_message(PCB_MSG_ERROR, "global exporter --cam doesn't take '=' and layers, only a file name\n"); Index: trunk/src/hid_cam.h =================================================================== --- trunk/src/hid_cam.h (revision 27426) +++ trunk/src/hid_cam.h (revision 27427) @@ -36,7 +36,7 @@ /* load *fn_out with the cam-requested output file name in cam mode; useful for non layer based exporters */ -void pcb_cam_nolayer(pcb_board_t *pcb, const char *src, const char **fn_out); +void pcb_cam_begin_nolayer(pcb_board_t *pcb, pcb_cam_t *dst, const char *src, const char **fn_out); /* Shall be the first rule in a cam capable exporter's set_layer_group() Index: trunk/src_plugins/export_bom/bom.c =================================================================== --- trunk/src_plugins/export_bom/bom.c (revision 27426) +++ trunk/src_plugins/export_bom/bom.c (revision 27427) @@ -263,6 +263,7 @@ static void bom_do_export(pcb_hid_t *hid, pcb_hid_attr_val_t *options) { int i; + pcb_cam_t cam; if (!options) { bom_get_export_options(hid, 0); @@ -275,9 +276,10 @@ if (!bom_filename) bom_filename = "pcb-out.bom"; - pcb_cam_nolayer(PCB, options[HA_cam].str, &bom_filename); + pcb_cam_begin_nolayer(PCB, &cam, options[HA_cam].str, &bom_filename); PrintBOM(); + pcb_cam_end(&cam); } static int bom_usage(pcb_hid_t *hid, const char *topic) Index: trunk/src_plugins/export_dsn/dsn.c =================================================================== --- trunk/src_plugins/export_dsn/dsn.c (revision 27426) +++ trunk/src_plugins/export_dsn/dsn.c (revision 27427) @@ -575,6 +575,8 @@ static void dsn_do_export(pcb_hid_t *hid, pcb_hid_attr_val_t *options) { int i; + pcb_cam_t cam; + if (!options) { dsn_get_export_options(hid, 0); for (i = 0; i < NUM_OPTIONS; i++) @@ -585,7 +587,7 @@ if (!dsn_filename) dsn_filename = "pcb-out.dsn"; - pcb_cam_nolayer(PCB, options[HA_cam].str, &dsn_filename); + pcb_cam_begin_nolayer(PCB, &cam, options[HA_cam].str, &dsn_filename); trackwidth = options[HA_trackwidth].crd; clearance = options[HA_clearance].crd; @@ -592,6 +594,7 @@ viawidth = options[HA_viawidth].crd; viadrill = options[HA_viadrill].crd; PrintSPECCTRA(); + pcb_cam_end(&cam); } static int dsn_parse_arguments(pcb_hid_t *hid, int *argc, char ***argv) Index: trunk/src_plugins/export_ipcd356/ipcd356.c =================================================================== --- trunk/src_plugins/export_ipcd356/ipcd356.c (revision 27426) +++ trunk/src_plugins/export_ipcd356/ipcd356.c (revision 27427) @@ -442,6 +442,7 @@ int n; const char *fn; FILE *f; + pcb_cam_t cam; if (!options) { ipcd356_get_export_options(hid, 0); @@ -456,7 +457,7 @@ if (fn == NULL) fn = "pcb-rnd-out.net"; - pcb_cam_nolayer(PCB, options[HA_cam].str, &fn); + pcb_cam_begin_nolayer(PCB, &cam, options[HA_cam].str, &fn); f = pcb_fopen_askovr(&PCB->hidlib, fn, "w", NULL); if (f == NULL) { @@ -465,6 +466,7 @@ } ipcd356_write(PCB, f); fclose(f); + pcb_cam_end(&cam); } static pcb_hid_t ipcd356_hid; Index: trunk/src_plugins/export_openscad/export_openscad.c =================================================================== --- trunk/src_plugins/export_openscad/export_openscad.c (revision 27426) +++ trunk/src_plugins/export_openscad/export_openscad.c (revision 27427) @@ -301,6 +301,7 @@ const char *filename; int save_ons[PCB_MAX_LAYER]; int i; + pcb_cam_t cam; if (!options) { openscad_get_export_options(hid, 0); @@ -313,7 +314,7 @@ if (!filename) filename = "pcb.openscad"; - pcb_cam_nolayer(PCB, options[HA_cam].str, &filename); + pcb_cam_begin_nolayer(PCB, &cam, options[HA_cam].str, &filename); f = pcb_fopen_askovr(&PCB->hidlib, filename, "wb", NULL); if (!f) { @@ -352,6 +353,7 @@ fclose(f); f = NULL; + pcb_cam_end(&cam); } static int openscad_parse_arguments(pcb_hid_t *hid, int *argc, char ***argv) Index: trunk/src_plugins/export_stat/stat.c =================================================================== --- trunk/src_plugins/export_stat/stat.c (revision 27426) +++ trunk/src_plugins/export_stat/stat.c (revision 27427) @@ -141,6 +141,7 @@ int nl, phg, hp, hup, group_not_empty[PCB_MAX_LAYERGRP]; pcb_cardinal_t num_etop = 0, num_ebottom = 0, num_esmd = 0, num_epads = 0, num_epins = 0, num_terms = 0, num_slots = 0; pcb_coord_t width, height; + pcb_cam_t cam; memset(lgss, 0, sizeof(lgss)); memset(group_not_empty, 0, sizeof(group_not_empty)); @@ -156,7 +157,7 @@ if (!filename) filename = "pcb.stat.lht"; - pcb_cam_nolayer(PCB, options[HA_cam].str, &filename); + pcb_cam_begin_nolayer(PCB, &cam, options[HA_cam].str, &filename); f = pcb_fopen_askovr(&PCB->hidlib, filename, "w", NULL); if (!f) { @@ -369,6 +370,7 @@ fprintf(f, "}\n"); fclose(f); + pcb_cam_end(&cam); } static int stat_parse_arguments(pcb_hid_t *hid, int *argc, char ***argv) Index: trunk/src_plugins/export_xy/xy.c =================================================================== --- trunk/src_plugins/export_xy/xy.c (revision 27426) +++ trunk/src_plugins/export_xy/xy.c (revision 27427) @@ -793,6 +793,7 @@ int i; template_t templ; char **tid; + pcb_cam_t cam; memset(&templ, 0, sizeof(templ)); @@ -810,7 +811,7 @@ if (!xy_filename) xy_filename = "pcb-out.xy"; - pcb_cam_nolayer(PCB, options[HA_cam].str, &xy_filename); + pcb_cam_begin_nolayer(PCB, &cam, options[HA_cam].str, &xy_filename); if (options[HA_unit].lng == -1) xy_unit = get_unit_struct("mil"); @@ -827,6 +828,7 @@ templ.term = get_templ(*tid, "term"); PrintXY(&templ, options[HA_format].str); + pcb_cam_end(&cam); } static int xy_usage(pcb_hid_t *hid, const char *topic)