Index: trunk/src_plugins/export_bom2/bom2.c =================================================================== --- trunk/src_plugins/export_bom2/bom2.c (revision 38013) +++ trunk/src_plugins/export_bom2/bom2.c (revision 38014) @@ -59,17 +59,17 @@ const char *val = bom2_values[HA_bom2file].str; /* load all formats from the config */ - fmt_names.used = 0; - fmt_ids.used = 0; + bom_fmt_names.used = 0; + bom_fmt_ids.used = 0; - build_fmts(&conf_bom2.plugins.export_bom2.templates); + bom_build_fmts(&conf_bom2.plugins.export_bom2.templates); - if (fmt_names.used == 0) { + if (bom_fmt_names.used == 0) { rnd_message(RND_MSG_ERROR, "export_bom2: can not set up export options: no template available\n"); return NULL; } - bom2_options[HA_format].enumerations = (const char **)fmt_names.array; + bom2_options[HA_format].enumerations = (const char **)bom_fmt_names.array; /* set default filename */ if ((dsg != NULL) && ((val == NULL) || (*val == '\0'))) @@ -80,7 +80,7 @@ return bom2_options; } -static const char *subst_user(subst_ctx_t *ctx, const char *key) +static const char *subst_user(bom_subst_ctx_t *ctx, const char *key) { if (strcmp(key, "author") == 0) return pcb_author(); if (strcmp(key, "title") == 0) return RND_UNKNOWN(PCB->hidlib.name); @@ -105,10 +105,10 @@ return NULL; } -static int print_bom(const template_t *templ) +static int print_bom(const bom_template_t *templ) { FILE *f; - subst_ctx_t ctx = {0}; + bom_subst_ctx_t ctx = {0}; f = rnd_fopen_askovr(&PCB->hidlib, bom2_filename, "w", NULL); if (f == NULL) { @@ -135,11 +135,11 @@ static void bom2_do_export(rnd_hid_t *hid, rnd_design_t *design, rnd_hid_attr_val_t *options, void *appspec) { - template_t templ = {0}; + bom_template_t templ = {0}; char **tid; pcb_cam_t cam; - gather_templates(); + bom_gather_templates(); if (!options) { bom2_get_export_options(hid, 0, design, appspec); @@ -152,7 +152,7 @@ pcb_cam_begin_nolayer(PCB, &cam, NULL, options[HA_cam].str, &bom2_filename); - tid = vts0_get(&fmt_ids, options[HA_format].lng, 0); + tid = vts0_get(&bom_fmt_ids, options[HA_format].lng, 0); if ((tid == NULL) || (*tid == NULL)) { rnd_message(RND_MSG_ERROR, "export_bom2: invalid template selected\n"); return; @@ -195,9 +195,9 @@ rnd_export_remove_opts_by_cookie(bom2_cookie); rnd_conf_unreg_file(CONF_FN, export_bom2_conf_internal); rnd_conf_unreg_fields("plugins/export_bom2/"); - free_fmts(); - vts0_uninit(&fmt_names); - vts0_uninit(&fmt_ids); + bom_free_fmts(); + vts0_uninit(&bom_fmt_names); + vts0_uninit(&bom_fmt_ids); rnd_hid_remove_hid(&bom2_hid); } @@ -230,7 +230,7 @@ rnd_hid_register_hid(&bom2_hid); rnd_hid_load_defaults(&bom2_hid, bom2_options, NUM_OPTIONS); - vts0_init(&fmt_names); - vts0_init(&fmt_ids); + vts0_init(&bom_fmt_names); + vts0_init(&bom_fmt_ids); return 0; } Index: trunk/src_plugins/export_bom2/lib_bom.c =================================================================== --- trunk/src_plugins/export_bom2/lib_bom.c (revision 38013) +++ trunk/src_plugins/export_bom2/lib_bom.c (revision 38014) @@ -1,21 +1,21 @@ /*** formats ***/ -static void free_fmts(void) +static void bom_free_fmts(void) { int n; - for(n = 0; n < fmt_ids.used; n++) { - free(fmt_ids.array[n]); - fmt_ids.array[n] = NULL; + for(n = 0; n < bom_fmt_ids.used; n++) { + free(bom_fmt_ids.array[n]); + bom_fmt_ids.array[n] = NULL; } } -static void build_fmts(const rnd_conflist_t *templates) +static void bom_build_fmts(const rnd_conflist_t *templates) { rnd_conf_listitem_t *li; int idx; - free_fmts(); + bom_free_fmts(); rnd_conf_loop_list(templates, li, idx) { char id[MAX_TEMP_NAME_LEN]; @@ -35,12 +35,12 @@ } memcpy(id, li->name, len); id[len] = '\0'; - vts0_append(&fmt_names, (char *)li->payload); - vts0_append(&fmt_ids, rnd_strdup(id)); + vts0_append(&bom_fmt_names, (char *)li->payload); + vts0_append(&bom_fmt_ids, rnd_strdup(id)); } } -static void gather_templates(void) +static void bom_gather_templates(void) { rnd_conf_listitem_t *i; int n; @@ -77,7 +77,7 @@ return NULL; } -static void bom_init_template(template_t *templ, const char *tid) +static void bom_init_template(bom_template_t *templ, const char *tid) { templ->header = get_templ(tid, "header"); templ->item = get_templ(tid, "item"); @@ -96,7 +96,7 @@ long cnt; } bom_item_t; -static void append_clean(subst_ctx_t *ctx, int escape, gds_t *dst, const char *text) +static void append_clean(bom_subst_ctx_t *ctx, int escape, gds_t *dst, const char *text) { const char *s; @@ -138,7 +138,7 @@ static int subst_cb(void *ctx_, gds_t *s, const char **input) { - subst_ctx_t *ctx = ctx_; + bom_subst_ctx_t *ctx = ctx_; int escape = 0, ternary = 0; char aname[1024], unk_buf[1024], *nope = NULL; char tmp[32]; @@ -228,7 +228,7 @@ return 0; } -static void fprintf_templ(FILE *f, subst_ctx_t *ctx, const char *templ) +static void fprintf_templ(FILE *f, bom_subst_ctx_t *ctx, const char *templ) { if (templ != NULL) { char *tmp = rnd_strdup_subst(templ, subst_cb, ctx, RND_SUBST_PERCENT); @@ -237,7 +237,7 @@ } } -static char *render_templ(subst_ctx_t *ctx, const char *templ) +static char *render_templ(bom_subst_ctx_t *ctx, const char *templ) { if (templ != NULL) return rnd_strdup_subst(templ, subst_cb, ctx, RND_SUBST_PERCENT); @@ -251,7 +251,7 @@ return strcmp((*i1)->id, (*i2)->id); } -static void bom_print_begin(subst_ctx_t *ctx, FILE *f, const template_t *templ) +static void bom_print_begin(bom_subst_ctx_t *ctx, FILE *f, const bom_template_t *templ) { gds_init(&ctx->tmp); @@ -268,7 +268,7 @@ ctx->f = f; } -static void bom_print_add(subst_ctx_t *ctx, pcb_subc_t *subc, const char *name) +static void bom_print_add(bom_subst_ctx_t *ctx, pcb_subc_t *subc, const char *name) { char *id, *freeme; bom_item_t *i; @@ -300,7 +300,7 @@ free(freeme); } -static void bom_print_all(subst_ctx_t *ctx) +static void bom_print_all(bom_subst_ctx_t *ctx) { long n; @@ -318,7 +318,7 @@ } } -static void bom_print_end(subst_ctx_t *ctx) +static void bom_print_end(bom_subst_ctx_t *ctx) { fprintf_templ(ctx->f, ctx, ctx->templ->footer); Index: trunk/src_plugins/export_bom2/lib_bom.h =================================================================== --- trunk/src_plugins/export_bom2/lib_bom.h (revision 38013) +++ trunk/src_plugins/export_bom2/lib_bom.h (revision 38014) @@ -10,20 +10,20 @@ #include /*** formats & templates ***/ -typedef struct { +typedef struct bom_template_s { const char *header, *item, *footer, *sort_id; const char *needs_escape; /* list of characters that need escaping */ const char *escape; /* escape character */ -} template_t; +} bom_template_t; -static vts0_t fmt_names; /* array of const char * long name of each format, pointing into the conf database */ -static vts0_t fmt_ids; /* array of strdup'd short name (ID) of each format */ +static vts0_t bom_fmt_names; /* array of const char * long name of each format, pointing into the conf database */ +static vts0_t bom_fmt_ids; /* array of strdup'd short name (ID) of each format */ -static void build_fmts(const rnd_conflist_t *templates); +static void bom_build_fmts(const rnd_conflist_t *templates); -static void free_fmts(void); -static void gather_templates(void); -static void bom_init_template(template_t *templ, const char *tid); +static void bom_free_fmts(void); +static void bom_gather_templates(void); +static void bom_init_template(bom_template_t *templ, const char *tid); @@ -40,13 +40,13 @@ /* print/sort state */ htsp_t tbl; vtp0_t arr; - const template_t *templ; + const bom_template_t *templ; FILE *f; -} subst_ctx_t; +} bom_subst_ctx_t; /* Export a file; call begin, then loop over all items and call _add, then call _all and _end. */ -static void bom_print_begin(subst_ctx_t *ctx, FILE *f, const template_t *templ); /* init ctx, print header */ -static void bom_print_add(subst_ctx_t *ctx, pcb_subc_t *subc, const char *name); /* add an app_item */ -static void bom_print_all(subst_ctx_t *ctx); /* sort and print all items */ -static void bom_print_end(subst_ctx_t *ctx); /* print footer and uninit ctx */ +static void bom_print_begin(bom_subst_ctx_t *ctx, FILE *f, const bom_template_t *templ); /* init ctx, print header */ +static void bom_print_add(bom_subst_ctx_t *ctx, pcb_subc_t *subc, const char *name); /* add an app_item */ +static void bom_print_all(bom_subst_ctx_t *ctx); /* sort and print all items */ +static void bom_print_end(bom_subst_ctx_t *ctx); /* print footer and uninit ctx */