Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 25130) +++ trunk/scconfig/Rev.h (revision 25131) @@ -1 +1 @@ -static const int myrev = 25098; +static const int myrev = 25131; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 25130) +++ trunk/scconfig/Rev.tab (revision 25131) @@ -1,4 +1,4 @@ -25098 configure hidlib: indirect conf lookups to cut conf_core dependency +25131 configure hidlib: indirect conf lookups to cut conf_core dependency 25036 configure hidlib: centralize GUI actions to remove code dup among gtk/lesstif and free up HIDs from PCB 25016 configure move the status bar and readouts out from gtk/lesstif to plugin lib_hid_pcbui 24987 configure move the toolbar out from gtk to plugin lib_hid_pcbui Index: trunk/src/Makefile.in =================================================================== --- trunk/src/Makefile.in (revision 25130) +++ trunk/src/Makefile.in (revision 25131) @@ -38,7 +38,7 @@ end # These files are to be generated before make dep is run -put /local/pcb/DEPDEPS { conf_core_fields.h conf_internal.c generated_lists.h defpcb_internal.c buildin.c pcb_menu_default.c } +put /local/pcb/DEPDEPS { hidlib_conf_fields.h conf_core_fields.h conf_internal.c generated_lists.h defpcb_internal.c buildin.c pcb_menu_default.c } include {../scconfig/template/debug.tmpasm} @@ -448,6 +448,9 @@ conf_core_fields.h: conf_core.h AWK=@/host/fstools/awk@ $(ROOT)/scconfig/gen_conf.sh $(ROOT)/doc/conf/tree < conf_core.h > conf_core_fields.h +hidlib_conf_fields.h: hidlib_conf.h + AWK=@/host/fstools/awk@ $(ROOT)/scconfig/gen_conf.sh $(ROOT)/doc/conf/tree_hidlib < hidlib_conf.h > hidlib_conf_fields.h + conf_internal.c: pcb-conf.lht $(CQUOTE) $(CQUOTE) -n conf_internal < pcb-conf.lht > conf_internal.c @@ -463,7 +466,7 @@ FORCE: -DISTCLEANFILES = Makefile.depgen core_lists.h buildin.c compat_inc.h conf_core_fields.h conf_internal.c generated_lists.h defpcb_internal.c pcb_menu_default.c ../src_plugins/.builtin.pups @/local/pcb/DISTCLEANFILES@ +DISTCLEANFILES = Makefile.depgen core_lists.h buildin.c compat_inc.h hidlib_conf_fields.h conf_core_fields.h conf_internal.c generated_lists.h defpcb_internal.c pcb_menu_default.c ../src_plugins/.builtin.pups @/local/pcb/DISTCLEANFILES@ clean: $(CLEANRULES) $(SCCBOX) rm -f -q pcb-rnd $(OBJS) $(OBJS_C99) $(CLEANFILES) Index: trunk/src/actions.c =================================================================== --- trunk/src/actions.c (revision 25130) +++ trunk/src/actions.c (revision 25131) @@ -269,7 +269,7 @@ const pcb_action_t *old_action; hid_cookie_action_t *ca = f->reg_data; - if (*pcbhlc_rc_verbose) { + if (pcbhl_conf.rc.verbose) { fprintf(stderr, "Action: \033[34m%s(", f->name); for (i = 0; i < argc; i++) fprintf(stderr, "%s%s", i ? "," : "", (argv[i].type & FGW_STR) == FGW_STR ? argv[i].val.str : ""); Index: trunk/src/conf_act.c =================================================================== --- trunk/src/conf_act.c (revision 25130) +++ trunk/src/conf_act.c (revision 25131) @@ -28,6 +28,7 @@ #include "board.h" #include "actions.h" #include "conf_core.h" +#include "hidlib_conf.h" #include "funchash_core.h" #include "route_style.h" #include "error.h" @@ -155,7 +156,7 @@ n = conf_get_field(a1); if (n == NULL) { - if (conf_core.rc.verbose) + if (pcbhl_conf.rc.verbose) pcb_message(PCB_MSG_ERROR, "Invalid conf field '%s' in iseq: no such path\n", path); return FGW_ERR_ARG_CONV; } Index: trunk/src/conf_core.h =================================================================== --- trunk/src/conf_core.h (revision 25130) +++ trunk/src/conf_core.h (revision 25131) @@ -98,8 +98,6 @@ } editor; const struct { /* rc */ - CFT_INTEGER verbose; - CFT_INTEGER quiet; /* print only errors on stderr */ CFT_BOOLEAN dup_log_to_stderr; /* copy log messages to stderr even if there is a HID that can show them */ CFT_INTEGER backup_interval; /* time between two backups in seconds; 0 means disabled (no backups) */ CFT_BOOLEAN hid_fallback; /* if there is no explicitly specified HID (--gui) and the preferred GUI fails, automatically fall back on other HIDs, eventually running in batch mode */ Index: trunk/src/drc.c =================================================================== --- trunk/src/drc.c (revision 25130) +++ trunk/src/drc.c (revision 25131) @@ -29,6 +29,7 @@ #include "actions.h" #include "drc.h" +#include "hidlib_conf.h" #include "conf_core.h" #include "compat_misc.h" #include "event.h" @@ -160,7 +161,7 @@ PCB_ACT_MAY_CONVARG(2, FGW_STR, IOIncompatList, aauto = argv[2].val.str); if ((aauto != NULL) && (strcmp(aauto, "auto") == 0)) { - if (conf_core.rc.quiet && !PCB_HAVE_GUI_ATTR_DLG) { + if (pcbhl_conf.rc.quiet && !PCB_HAVE_GUI_ATTR_DLG) { /* if not explicitly asked for a listing style and we are on CLI and quiet is set, don't print anything */ PCB_ACT_IRES(0); return 0; Index: trunk/src/error.c =================================================================== --- trunk/src/error.c (revision 25130) +++ trunk/src/error.c (revision 25131) @@ -60,10 +60,10 @@ pcb_logline_t *line; if ((pcb_gui == NULL) || (pcbhlc_rc_dup_log_to_stderr == NULL) || (*pcbhlc_rc_dup_log_to_stderr)) { - if (*pcbhlc_rc_quiet) + if (pcbhl_conf.rc.quiet) min_level = PCB_MSG_ERROR; - if ((level >= min_level) || (pcbhlc_rc_verbose == NULL) || (*pcbhlc_rc_verbose)) { + if ((level >= min_level) || (pcbhl_conf.rc.verbose)) { va_start(args, Format); pcb_vfprintf(stderr, Format, args); va_end(args); Index: trunk/src/hid_nogui.c =================================================================== --- trunk/src/hid_nogui.c (revision 25130) +++ trunk/src/hid_nogui.c (revision 25131) @@ -267,7 +267,7 @@ PCB_ACT_MAY_CONVARG(2, FGW_STR, cli_PromptFor, default_str = argv[2].val.str); PCB_ACT_MAY_CONVARG(3, FGW_STR, cli_PromptFor, title = argv[3].val.str); - if (!*pcbhlc_rc_quiet) { + if (!pcbhl_conf.rc.quiet) { char *tmp; if (title != NULL) printf("*** %s ***\n", title); @@ -298,7 +298,7 @@ int n, ret; res->type = FGW_INT; - if (*pcbhlc_rc_quiet) { + if (pcbhl_conf.rc.quiet) { cancel:; res->val.nat_int = -1; return 0; @@ -340,7 +340,7 @@ { char *answer; - if (*pcbhlc_rc_quiet) + if (pcbhl_conf.rc.quiet) return pcb_strdup(""); if (default_file) @@ -387,15 +387,15 @@ static double nextt; double now; - if (*pcbhlc_rc_quiet) + if (pcbhl_conf.rc.quiet) return 0; if (message == NULL) { - if ((on) && (*pcbhlc_rc_verbose >= PCB_MSG_INFO)) + if ((on) && (pcbhl_conf.rc.verbose >= PCB_MSG_INFO)) fprintf(stderr, "progress: finished\n"); on = 0; } else { - if ((*pcbhlc_rc_verbose >= PCB_MSG_INFO) || (pcb_gui != &nogui_hid)) { + if ((pcbhl_conf.rc.verbose >= PCB_MSG_INFO) || (pcb_gui != &nogui_hid)) { now = pcb_dtime(); if (now >= nextt) { fprintf(stderr, "progress: %ld/%ld %s\n", so_far, total, message); Index: trunk/src/hidlib_conf.c =================================================================== --- trunk/src/hidlib_conf.c (revision 25130) +++ trunk/src/hidlib_conf.c (revision 25131) @@ -32,8 +32,9 @@ #include "hidlib_conf.h" -CFT_INTEGER *pcbhlc_rc_verbose; -CFT_INTEGER *pcbhlc_rc_quiet; +pcbhl_conf_t pcbhl_conf; + + CFT_BOOLEAN *pcbhlc_rc_dup_log_to_stderr; CFT_STRING *pcbhlc_rc_cli_prompt; CFT_STRING *pcbhlc_rc_cli_backend; @@ -93,8 +94,10 @@ { int cnt = 0; - SCALAR(rc_verbose, "rc/verbose", CFN_INTEGER, integer); - SCALAR(rc_quiet, "rc/quiet", CFN_INTEGER, integer); +#define conf_reg(field,isarray,type_name,cpath,cname,desc,flags) \ + conf_reg_field(pcbhl_conf, field,isarray,type_name,cpath,cname,desc,flags); +#include "hidlib_conf_fields.h" + SCALAR(rc_dup_log_to_stderr, "rc/dup_log_to_stderr", CFN_BOOLEAN, boolean); SCALAR(rc_cli_prompt, "rc/cli_prompt", CFN_STRING, string); Index: trunk/src/hidlib_conf.h =================================================================== --- trunk/src/hidlib_conf.h (revision 25130) +++ trunk/src/hidlib_conf.h (revision 25131) @@ -29,8 +29,15 @@ #include "conf.h" -extern CFT_INTEGER *pcbhlc_rc_verbose; -extern CFT_INTEGER *pcbhlc_rc_quiet; +typedef struct { + const struct { /* rc */ + CFT_INTEGER verbose; + CFT_INTEGER quiet; /* print only errors on stderr */ + } rc; +} pcbhl_conf_t; + +extern pcbhl_conf_t pcbhl_conf; + extern CFT_BOOLEAN *pcbhlc_rc_dup_log_to_stderr; extern CFT_STRING *pcbhlc_rc_cli_prompt; extern CFT_STRING *pcbhlc_rc_cli_backend; Index: trunk/src/main.c =================================================================== --- trunk/src/main.c (revision 25130) +++ trunk/src/main.c (revision 25131) @@ -62,6 +62,7 @@ #include "funchash.h" #include "conf.h" #include "conf_core.h" +#include "hidlib_conf.h" #include #include "layer_vis.h" #include "layer_ui.h" @@ -253,7 +254,7 @@ int printed = 0; for(n = from; n != NULL; n = n->next) { - if ((n->level >= PCB_MSG_INFO) || conf_core.rc.verbose) { + if ((n->level >= PCB_MSG_INFO) || pcbhl_conf.rc.verbose) { if (!printed) fprintf(stderr, "*** %s:\n", title); fprintf(stderr, "%s", n->str); Index: trunk/src/object_act.c =================================================================== --- trunk/src/object_act.c (revision 25130) +++ trunk/src/object_act.c (revision 25131) @@ -32,7 +32,9 @@ * */ #include "config.h" + #include "conf_core.h" +#include "hidlib_conf.h" #include "data.h" #include "board.h" @@ -444,7 +446,7 @@ } } PCB_END_LOOP; - if ((number_of_footprints_not_found > 0) && (!conf_core.rc.quiet)) + if ((number_of_footprints_not_found > 0) && (!pcbhl_conf.rc.quiet)) pcb_message(PCB_MSG_ERROR, "Footprint import: not all requested footprints were found.\nSee the message log above for details\n"); return 0; } Index: trunk/src_plugins/dialogs/dlg_loadsave.c =================================================================== --- trunk/src_plugins/dialogs/dlg_loadsave.c (revision 25130) +++ trunk/src_plugins/dialogs/dlg_loadsave.c (revision 25131) @@ -34,6 +34,7 @@ #include "hid_dad.h" #include "compat_fs.h" #include "conf_core.h" +#include "hidlib_conf.h" #include "plug_io.h" #include "dlg_loadsave.h" @@ -81,7 +82,7 @@ } if (name != NULL) { - if (conf_core.rc.verbose) + if (pcbhl_conf.rc.verbose) fprintf(stderr, "Load: Calling LoadFrom(%s, %s)\n", function, name); pcb_actionl("LoadFrom", function, name, NULL); free(name); @@ -284,7 +285,7 @@ return 0; } - if (conf_core.rc.verbose) + if (pcbhl_conf.rc.verbose) fprintf(stderr, "Save: Calling SaveTo(%s, %s)\n", function, final_name); if (pcb_strcasecmp(function, "PasteBuffer") == 0) { Index: trunk/src_plugins/export_gerber/gerber.c =================================================================== --- trunk/src_plugins/export_gerber/gerber.c (revision 25130) +++ trunk/src_plugins/export_gerber/gerber.c (revision 25131) @@ -35,6 +35,7 @@ #include "hid_attrib.h" #include "hid_inlines.h" #include "conf_core.h" +#include "hidlib_conf.h" #include "../src_plugins/export_excellon/aperture.h" #include "../src_plugins/export_excellon/excellon.h" @@ -576,7 +577,7 @@ if (!fnbase) fnbase = "pcb-out"; - verbose = options[HA_verbose].int_value || conf_core.rc.verbose; + verbose = options[HA_verbose].int_value || pcbhl_conf.rc.verbose; all_layers = options[HA_all_layers].int_value; copy_outline_mode = options[HA_copy_outline].int_value; Index: trunk/src_plugins/hid_batch/batch.c =================================================================== --- trunk/src_plugins/hid_batch/batch.c (revision 25130) +++ trunk/src_plugins/hid_batch/batch.c (revision 25131) @@ -14,6 +14,7 @@ #include "compat_misc.h" #include "event.h" #include "conf_core.h" +#include "hidlib_conf.h" #include "hid_draw_helpers.h" #include "hid_nogui.h" @@ -82,7 +83,7 @@ static void log_append(pcb_logline_t *line) { - if ((line->level < PCB_MSG_INFO) && !conf_core.rc.verbose) + if ((line->level < PCB_MSG_INFO) && !pcbhl_conf.rc.verbose) return; if ((line->prev == NULL) || (line->prev->str[line->prev->len-1] == '\n')) { @@ -164,7 +165,7 @@ log_import(); - if ((interactive) && (!conf_core.rc.quiet)) { + if ((interactive) && (!pcbhl_conf.rc.quiet)) { printf("Entering %s version %s batch mode.\n", PCB_PACKAGE, PCB_VERSION); printf("See http://repo.hu/projects/pcb-rnd for project information\n"); } @@ -171,7 +172,7 @@ batch_stay = 1; while (batch_stay) { - if ((interactive) && (!conf_core.rc.quiet)) { + if ((interactive) && (!pcbhl_conf.rc.quiet)) { printf("%s:%s> ", prompt, pcb_cli_prompt(NULL)); fflush(stdout); }