Index: Plug.tmpasm =================================================================== --- Plug.tmpasm (revision 32393) +++ Plug.tmpasm (revision 32394) @@ -1,6 +1,9 @@ put /local/pcb/mod {ar_extern} put /local/pcb/mod/MENUFILE {ar_extern-menu.lht} put /local/pcb/mod/MENUVAR {ar_extern_menu} +put /local/pcb/mod/CONF {$(PLUGDIR)/ar_extern/ar_extern_conf.h} +put /local/pcb/mod/CONFFILE {ar_extern.conf} +put /local/pcb/mod/CONFVAR {ar_extern_conf_internal} put /local/pcb/mod/OBJS [@ $(PLUGDIR)/ar_extern/ar_extern.o @] Index: ar_extern.c =================================================================== --- ar_extern.c (revision 32393) +++ ar_extern.c (revision 32394) @@ -43,9 +43,14 @@ #include "obj_pstk_inlines.h" #include "src_plugins/lib_compat_help/pstk_compat.h" #include "src_plugins/lib_netmap/netmap.h" +#include "ar_extern_conf.h" +#define AR_EXTERN_CONF_FN "ar_extern.conf" +conf_ar_extern_t conf_ar_extern; + static const char *extern_cookie = "extern autorouter plugin"; +#include "conf_internal.c" #include "menu_internal.c" typedef enum { @@ -235,6 +240,8 @@ void pplg_uninit_ar_extern(void) { extroute_free_conf(); + rnd_conf_unreg_file(AR_EXTERN_CONF_FN, ar_extern_conf_internal); + rnd_conf_unreg_fields("plugins/ar_extern/"); rnd_remove_actions_by_cookie(extern_cookie); rnd_hid_menu_unload(rnd_gui, extern_cookie); } @@ -246,6 +253,12 @@ RND_REGISTER_ACTIONS(extern_action_list, extern_cookie) + rnd_conf_reg_file(AR_EXTERN_CONF_FN, ar_extern_conf_internal); + +#define conf_reg(field,isarray,type_name,cpath,cname,desc,flags) \ + rnd_conf_reg_field(conf_ar_extern, field,isarray,type_name,cpath,cname,desc,flags); +#include "ar_extern_conf_fields.h" + rnd_hid_menu_load(rnd_gui, NULL, extern_cookie, 100, NULL, 0, ar_extern_menu, "plugin: ar_extern"); return 0; Index: ar_extern.conf =================================================================== --- ar_extern.conf (nonexistent) +++ ar_extern.conf (revision 32394) @@ -0,0 +1,13 @@ +li:pcb-rnd-conf-v1 { + ha:overwrite { + ha:plugins { + ha:ar_extern { + ha:route_rnd { + exe = route-rnd + debug = 0 + } + } + } + } +} + Index: ar_extern_conf.h =================================================================== --- ar_extern_conf.h (nonexistent) +++ ar_extern_conf.h (revision 32394) @@ -0,0 +1,17 @@ +#ifndef PCB_VENDOR_CONF_H +#define PCB_VENDOR_CONF_H + +#include + +typedef struct { + const struct { + const struct { + const struct route_rnd { + RND_CFT_STRING exe; + RND_CFT_BOOLEAN debug; + } route_rnd; + } ar_extern; + } plugins; +} conf_ar_extern_t; + +#endif Index: e_route-rnd.c =================================================================== --- e_route-rnd.c (revision 32393) +++ e_route-rnd.c (revision 32394) @@ -27,8 +27,6 @@ */ TODO("this should be in config") -static const char *exe = "route-rnd"; -static int debug = 0; static int rtrnd_route(pcb_board_t *pcb, ext_route_scope_t scope, const char *method, int argc, fgw_arg_t *argv) { @@ -60,9 +58,9 @@ /* run the router */ if (method != NULL) - cmd = rnd_strdup_printf("%s '%s' -m '%s' -o '%s'", exe, route_req, method, route_res); + cmd = rnd_strdup_printf("%s '%s' -m '%s' -o '%s'", conf_ar_extern.plugins.ar_extern.route_rnd.exe, route_req, method, route_res); else - cmd = rnd_strdup_printf("%s '%s' -o '%s'", exe, route_req, route_res); + cmd = rnd_strdup_printf("%s '%s' -o '%s'", conf_ar_extern.plugins.ar_extern.route_rnd.exe, route_req, route_res); r = rnd_system(hl, cmd); if (r != 0) { rnd_message(RND_MSG_ERROR, "route-rnd: failed to execute the router: '%s'\n", cmd); @@ -80,7 +78,7 @@ rv = 0; /* success! */ exit:; - if (!debug) { + if (!conf_ar_extern.plugins.ar_extern.route_rnd.debug) { rnd_unlink(hl, route_req); rnd_unlink(hl, route_res); } @@ -92,7 +90,7 @@ FILE *f; char *cmd, line[1024]; - cmd = rnd_strdup_printf("%s -M", exe); + cmd = rnd_strdup_printf("%s -M", conf_ar_extern.plugins.ar_extern.route_rnd.exe); f = rnd_popen(hl, cmd, "r"); free(cmd); if (f == NULL) @@ -129,7 +127,7 @@ fgw_arg_t argv[3]; rnd_export_opt_t *rv = NULL; - cmd = rnd_strdup_printf("%s -l -m '%s' > '%s'", exe, method, route_lst); + cmd = rnd_strdup_printf("%s -l -m '%s' > '%s'", conf_ar_extern.plugins.ar_extern.route_rnd.exe, method, route_lst); r = rnd_system(hl, cmd); if (r != 0) { rnd_message(RND_MSG_ERROR, "route-rnd: failed to execute the router: '%s'\n", cmd); @@ -149,7 +147,7 @@ rv = res.val.ptr_void; /* success! */ exit:; - if (!debug) + if (!conf_ar_extern.plugins.ar_extern.route_rnd.debug) rnd_unlink(hl, route_lst); return rv; }