Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 25225) +++ trunk/scconfig/Rev.h (revision 25226) @@ -1 +1 @@ -static const int myrev = 25221; +static const int myrev = 25226; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 25225) +++ trunk/scconfig/Rev.tab (revision 25226) @@ -1,4 +1,4 @@ -25221 configure hidlib: core-independent mouse cursor vs. tool handling +25226 configure hidlib: core-independent mouse cursor vs. tool handling 25187 configure hidlib: further split core code to hidlib and non-hidlib to reduce hidlib size 25180 configure rewrite PCB-file-changed-on-disk detection to common code, instead of gtk-specific 25154 configure hidlib: split lib_hid_common into a PCB-related and a PCB-unrelated plugin Index: trunk/src/Makefile.in =================================================================== --- trunk/src/Makefile.in (revision 25225) +++ trunk/src/Makefile.in (revision 25226) @@ -82,6 +82,7 @@ hid_dad_spin.o hid_init.o hid_nogui.o + hidlib.o hidlib_conf.o list_conf.o misc_util.o @@ -237,11 +238,6 @@ ../src_3rd/libuundo/uundo_debug.o @] -# linked only in the hidlib, dummy/bridge code -append /local/pcb/OBJS_HIDLIB_ONLY [@ - hidlib.o -@] - put /local/pcb/LIBS_3RD [@ ../src_3rd/puplug/libpuplug.a ../src_3rd/libminuid/libminuid.a @@ -308,7 +304,6 @@ uniq /local/pcb/OBJS_C99_HIDLIB uniq /local/pcb/OBJS_HIDLIB_PLG uniq /local/pcb/OBJS_C99_HIDLIB_PLG -uniq /local/pcb/OBJS_HIDLIB_ONLY uniq /local/pcb/OBJS_UTIL uniq /local/pcb/CFLAGS uniq /local/pcb/LDFLAGS @@ -324,7 +319,6 @@ put /local/pcb/SRCS /local/pcb/OBJS append /local/pcb/SRCS ?/local/pcb/OBJS_C99 append /local/pcb/SRCS ?/local/pcb/OBJS_HIDLIB -append /local/pcb/SRCS ?/local/pcb/OBJS_HIDLIB_ONLY gsub /local/pcb/SRCS {.o } {.c } # Makefile, static @@ -351,7 +345,6 @@ OBJS_C99_HIDLIB=@/local/pcb/OBJS_C99_HIDLIB@ OBJS_HIDLIB_PLG=@/local/pcb/OBJS_HIDLIB_PLG@ OBJS_C99_HIDLIB_PLG=@/local/pcb/OBJS_C99_HIDLIB_PLG@ -OBJS_HIDLIB_ONLY=@/local/pcb/OBJS_HIDLIB_ONLY@ OBJS_UTIL=@/local/pcb/OBJS_UTIL@ SRCS=@/local/pcb/SRCS@ CFLAGS=@?cc/argstd/std_c99@ @/local/pcb/CFLAGS@ @@ -388,8 +381,8 @@ $(CC) $(OBJS) $(OBJS_C99) -o pcb-rnd$(EXE) $(LIBS_PRE) $(LDFLAGS) $(LIBS) # temporary, for testig -hidlib$(EXE): $(OBJS_HIDLIB) $(OBJS_C99_HIDLIB) $(OBJS_HIDLIB_PLG) $(OBJS_C99_HIDLIB_PLG) $(OBJS_HIDLIB_ONLY) $(EXEDEPS) $(LIBS_3RD) - $(CC) $(OBJS_HIDLIB_PLG) $(OBJS_C99_HIDLIB_PLG) $(OBJS_HIDLIB) $(OBJS_C99_HIDLIB) $(OBJS_HIDLIB_ONLY) -o hidlib$(EXE) $(LIBS_PRE) $(LDFLAGS) $(LIBS) $(LIBS_3RD) +hidlib$(EXE): $(OBJS_HIDLIB) $(OBJS_C99_HIDLIB) $(OBJS_HIDLIB_PLG) $(OBJS_C99_HIDLIB_PLG) $(EXEDEPS) $(LIBS_3RD) + $(CC) $(OBJS_HIDLIB_PLG) $(OBJS_C99_HIDLIB_PLG) $(OBJS_HIDLIB) $(OBJS_C99_HIDLIB) -o hidlib$(EXE) $(LIBS_PRE) $(LDFLAGS) $(LIBS) $(LIBS_3RD) $(SPHASH_PATH)/sphash: $(SPHASH_PATH)/sphash.c Index: trunk/src/board.c =================================================================== --- trunk/src/board.c (revision 25225) +++ trunk/src/board.c (revision 25226) @@ -113,7 +113,7 @@ dpcb = -1; pcb_io_err_inhibit_inc(); - conf_list_foreach_path_first(dpcb, &conf_core.rc.default_pcb_file, pcb_load_pcb(__path__, NULL, pcb_false, 1 | 0x10 | inh)); + conf_list_foreach_path_first(NULL, dpcb, &conf_core.rc.default_pcb_file, pcb_load_pcb(__path__, NULL, pcb_false, 1 | 0x10 | inh)); pcb_io_err_inhibit_dec(); if (dpcb != 0) { /* no default PCB in file, use embedded version */ Index: trunk/src/brave.c =================================================================== --- trunk/src/brave.c (revision 25225) +++ trunk/src/brave.c (revision 25226) @@ -31,6 +31,7 @@ #include +#include "board.h" #include "brave.h" #include "actions.h" #include "conf_core.h" @@ -185,7 +186,7 @@ { conf_set(CFR_USER, "rc/brave", 0, conf_core.rc.brave, POL_OVERWRITE); if (conf_isdirty(CFR_USER)) - conf_save_file(NULL, NULL, CFR_USER, NULL); + conf_save_file(&PCB->hidlib, NULL, NULL, CFR_USER, NULL); } static int brave_interact(void) Index: trunk/src/conf.c =================================================================== --- trunk/src/conf.c (revision 25225) +++ trunk/src/conf.c (revision 25226) @@ -1759,7 +1759,7 @@ } -int conf_save_file(const char *project_fn, const char *pcb_fn, conf_role_t role, const char *fn) +int conf_save_file(pcb_hidlib_t *hidlib, const char *project_fn, const char *pcb_fn, conf_role_t role, const char *fn) { int fail = 1; lht_node_t *r = conf_lht_get_first(role, 0); @@ -1797,7 +1797,7 @@ if (efn != NULL) path = pcb_strdup(efn); else - path = pcb_build_fn(fn); + path = pcb_build_fn(hidlib, fn); if (path == NULL) { pcb_message(PCB_MSG_ERROR, "Error: failed to calculate the project file name (board file name or allocation error)\n"); Index: trunk/src/conf.h =================================================================== --- trunk/src/conf.h (revision 25225) +++ trunk/src/conf.h (revision 25226) @@ -252,7 +252,7 @@ void conf_reset(conf_role_t target, const char *source_fn); /* Save an in-memory lihata representation to the disk */ -int conf_save_file(const char *project_fn, const char *pcb_fn, conf_role_t role, const char *fn); +int conf_save_file(pcb_hidlib_t *hidlib, const char *project_fn, const char *pcb_fn, conf_role_t role, const char *fn); /* Returns whether a given lihata tree is locked */ int conf_islocked(conf_role_t target); @@ -284,7 +284,7 @@ void conf_setf(conf_role_t role, const char *path, int idx, const char *fmt, ...); -#define conf_list_foreach_path_first(res, conf_list, call) \ +#define conf_list_foreach_path_first(hidlib, res, conf_list, call) \ do { \ conf_listitem_t *__n__; \ const conflist_t *__lst1__ = (conf_list); \ @@ -295,7 +295,7 @@ const char **__in__ = __n__->val.string; \ if (__in__ == NULL) \ continue; \ - pcb_path_resolve(*__in__, &__path__, 0, pcb_false); \ + pcb_path_resolve(hidlib, *__in__, &__path__, 0, pcb_false); \ res = call; \ free(__path__); \ if (res == 0) \ Index: trunk/src/font.c =================================================================== --- trunk/src/font.c (revision 25225) +++ trunk/src/font.c (revision 25226) @@ -100,7 +100,7 @@ { int res = -1; pcb_io_err_inhibit_inc(); - conf_list_foreach_path_first(res, &conf_core.rc.default_font_file, pcb_parse_font_default(&pcb->fontkit.dflt, __path__)); + conf_list_foreach_path_first(&pcb->hidlib, res, &conf_core.rc.default_font_file, pcb_parse_font_default(&pcb->fontkit.dflt, __path__)); pcb_io_err_inhibit_dec(); if (res != 0) { Index: trunk/src/hid_cfg.c =================================================================== --- trunk/src/hid_cfg.c (revision 25225) +++ trunk/src/hid_cfg.c (revision 25226) @@ -128,7 +128,7 @@ return n->data.text.value; } -pcb_hid_cfg_t *pcb_hid_cfg_load(const char *fn, int exact_fn, const char *embedded_fallback) +pcb_hid_cfg_t *pcb_hid_cfg_load(pcb_hidlib_t *hidlib, const char *fn, int exact_fn, const char *embedded_fallback) { lht_doc_t *doc; pcb_hid_cfg_t *hr; @@ -146,7 +146,7 @@ int fn_len = strlen(fn); doc = NULL; - pcb_paths_resolve_all(hid_cfg_paths_in, paths, fn_len+32, pcb_false); + pcb_paths_resolve_all(hidlib, hid_cfg_paths_in, paths, fn_len+32, pcb_false); for(p = paths; *p != NULL; p++) { if (doc == NULL) { char *end = *p + strlen(*p); Index: trunk/src/hid_cfg.h =================================================================== --- trunk/src/hid_cfg.h (revision 25225) +++ trunk/src/hid_cfg.h (revision 25226) @@ -40,7 +40,7 @@ /* Search and load the menu res for hidname; if not found, and embedded_fallback is not NULL, parse that string instead. Returns NULL on error */ -pcb_hid_cfg_t *pcb_hid_cfg_load(const char *fn, int exact_fn, const char *embedded_fallback); +pcb_hid_cfg_t *pcb_hid_cfg_load(pcb_hidlib_t *hidlib, const char *fn, int exact_fn, const char *embedded_fallback); /* Generic, low level lihata loader */ lht_doc_t *pcb_hid_cfg_load_lht(const char *filename); Index: trunk/src/hid_init.c =================================================================== --- trunk/src/hid_init.c (revision 25225) +++ trunk/src/hid_init.c (revision 25226) @@ -304,7 +304,7 @@ pcb_hid_dlg_uninit(); if (conf_isdirty(CFR_USER)) - conf_save_file(NULL, NULL, CFR_USER, NULL); + conf_save_file(NULL, NULL, NULL, CFR_USER, NULL); pcb_hid_uninit(); pcb_events_uninit(); Index: trunk/src/hidlib.c =================================================================== --- trunk/src/hidlib.c (revision 25225) +++ trunk/src/hidlib.c (revision 25226) @@ -26,21 +26,3 @@ #include "config.h" -#include - -const char *(*pcb_hidlib_get_filename)(void); -const char *(*pcb_hidlib_get_name)(void); - -const char *pcb_board_get_filename(void) -{ - if (pcb_hidlib_get_filename != NULL) - return pcb_hidlib_get_filename(); - return NULL; -} - -const char *pcb_board_get_name(void) -{ - if (pcb_hidlib_get_name != NULL) - return pcb_hidlib_get_name(); - return NULL; -} Index: trunk/src/hidlib.h =================================================================== --- trunk/src/hidlib.h (revision 25225) +++ trunk/src/hidlib.h (revision 25226) @@ -35,9 +35,4 @@ char *filename; /* name of the file (from load) */ }; -/* optional: if non-NULL, called back to determine the file name or project - name of the current design */ -const char *(*pcb_hidlib_get_filename)(void); -const char *(*pcb_hidlib_get_name)(void); - #endif Index: trunk/src/paths.c =================================================================== --- trunk/src/paths.c (revision 25225) +++ trunk/src/paths.c (revision 25226) @@ -31,18 +31,16 @@ #include "config.h" #include "paths.h" #include "error.h" +#include "hidlib.h" #include "hidlib_conf.h" -/* don't include board.h or compat_misc.h because of gsch2pcb-rnd */ -const char *pcb_board_get_filename(void); -const char *pcb_board_get_name(void); int pcb_getpid(void); - int pcb_build_fn_cb(void *ctx, gds_t *s, const char **input) { + pcb_hidlib_t *hidlib = ctx; char buff[20]; - const char *name; + const char *name = NULL; switch(**input) { case 'P': @@ -51,12 +49,14 @@ (*input)++; return 0; case 'F': - name = pcb_board_get_filename(); - gds_append_str(s, (name != NULL) ? name : "PCB-anon"); + if (hidlib != NULL) + name = hidlib->filename; + gds_append_str(s, (name != NULL) ? name : "no_filename"); (*input)++; return 0; case 'B': - name = pcb_board_get_filename(); + if (hidlib != NULL) + name = hidlib->filename; if (name != NULL) { const char *bn = strrchr(name, '/'); if (bn != NULL) @@ -70,7 +70,8 @@ (*input)++; return 0; case 'D': - name = pcb_board_get_filename(); + if (hidlib != NULL) + name = hidlib->filename; if (name != NULL) { char *bn = strrchr(name, '/'); if (bn != NULL) @@ -83,7 +84,8 @@ (*input)++; return 0; case 'N': - name = pcb_board_get_name(); + if (hidlib != NULL) + name = hidlib->name; gds_append_str(s, (name != NULL) ? name : "no_name"); (*input)++; return 0; @@ -98,9 +100,9 @@ int pcb_build_argfn_cb(void *ctx_, gds_t *s, const char **input) { + pcb_build_argfn_t *ctx = ctx_; if ((**input >= 'a') && (**input <= 'z')) { int idx = **input - 'a'; - pcb_build_argfn_t *ctx = ctx_; if (ctx->params[idx] == NULL) return -1; gds_append_str(s, ctx->params[idx]); @@ -107,12 +109,12 @@ (*input)++; return 0; } - return pcb_build_fn_cb(NULL, s, input); + return pcb_build_fn_cb(ctx->hidlib, s, input); } -char *pcb_build_fn(const char *template) +char *pcb_build_fn(pcb_hidlib_t *hidlib, const char *template) { - return pcb_strdup_subst(template, pcb_build_fn_cb, NULL, PCB_SUBST_ALL); + return pcb_strdup_subst(template, pcb_build_fn_cb, hidlib, PCB_SUBST_ALL); } char *pcb_build_argfn(const char *template, pcb_build_argfn_t *arg) @@ -280,24 +282,24 @@ return pcb_strdup_subst_(template, cb, ctx, flags, 0); } -void pcb_paths_resolve(const char **in, char **out, int numpaths, unsigned int extra_room, int quiet) +void pcb_paths_resolve(pcb_hidlib_t *hidlib, const char **in, char **out, int numpaths, unsigned int extra_room, int quiet) { pcb_strdup_subst_t flags = PCB_SUBST_ALL; if (quiet) flags |= PCB_SUBST_QUIET; for (; numpaths > 0; numpaths--, in++, out++) - *out = pcb_strdup_subst_(*in, pcb_build_fn_cb, NULL, flags, extra_room); + *out = pcb_strdup_subst_(*in, pcb_build_fn_cb, hidlib, flags, extra_room); } -void pcb_path_resolve(const char *in, char **out, unsigned int extra_room, int quiet) +void pcb_path_resolve(pcb_hidlib_t *hidlib, const char *in, char **out, unsigned int extra_room, int quiet) { - pcb_paths_resolve(&in, out, 1, extra_room, quiet); + pcb_paths_resolve(hidlib, &in, out, 1, extra_room, quiet); } -char *pcb_path_resolve_inplace(char *in, unsigned int extra_room, int quiet) +char *pcb_path_resolve_inplace(pcb_hidlib_t *hidlib, char *in, unsigned int extra_room, int quiet) { char *out; - pcb_path_resolve(in, &out, extra_room, quiet); + pcb_path_resolve(hidlib, in, &out, extra_room, quiet); free(in); return out; } Index: trunk/src/paths.h =================================================================== --- trunk/src/paths.h (revision 25225) +++ trunk/src/paths.h (revision 25226) @@ -27,28 +27,29 @@ /* Resolve paths, build paths using template */ #include "genvector/gds_char.h" +#include "global_typedefs.h" /* Allocate *out and copy the path from in to out, replacing ~ with conf_core.rc.path.home If extra_room is non-zero, allocate this many bytes extra for each slot; this leaves some room to append a file name. If quiet is non-zero, suppress error messages. */ -void pcb_path_resolve(const char *in, char **out, unsigned int extra_room, int quiet); +void pcb_path_resolve(pcb_hidlib_t *hidlib, const char *in, char **out, unsigned int extra_room, int quiet); /* Same as resolve_path, but it returns the pointer to the new path and calls free() on in */ -char *pcb_path_resolve_inplace(char *in, unsigned int extra_room, int quiet); +char *pcb_path_resolve_inplace(pcb_hidlib_t *hidlib, char *in, unsigned int extra_room, int quiet); /* Resolve all paths from a in[] into out[](should be large enough) */ -void pcb_paths_resolve(const char **in, char **out, int numpaths, unsigned int extra_room, int quiet); +void pcb_paths_resolve(pcb_hidlib_t *hidlib, const char **in, char **out, int numpaths, unsigned int extra_room, int quiet); /* Resolve all paths from a char *in[] into a freshly allocated char **out */ -#define pcb_paths_resolve_all(in, out, extra_room, quiet) \ +#define pcb_paths_resolve_all(hidlib, in, out, extra_room, quiet) \ do { \ int __numpath__ = sizeof(in) / sizeof(char *); \ if (__numpath__ > 0) { \ out = malloc(sizeof(char *) * __numpath__); \ - pcb_paths_resolve(in, out, __numpath__, extra_room, quiet); \ + pcb_paths_resolve(hidlib, in, out, __numpath__, extra_room, quiet); \ } \ } while(0) @@ -60,10 +61,11 @@ %D dirname (load-time file path of the current pcb, without file name, with trailing slash, might be ./) %N name of the current pcb %T wall time (Epoch) + ctx must be the current (pcb_hidlib_t *) */ int pcb_build_fn_cb(void *ctx, gds_t *s, const char **input); -char *pcb_build_fn(const char *template); +char *pcb_build_fn(pcb_hidlib_t *hidlib, const char *template); /* Same as above, but also replaces lower case formatting to the members of @@ -70,6 +72,7 @@ the array if they are not NULL; use with pcb_build_argfn() */ typedef struct { const char *params['z' - 'a' + 1]; /* [0] for 'a' */ + pcb_hidlib_t *hidlib; } pcb_build_argfn_t; char *pcb_build_argfn(const char *template, pcb_build_argfn_t *arg); Index: trunk/src/plug_io.c =================================================================== --- trunk/src/plug_io.c (revision 25225) +++ trunk/src/plug_io.c (revision 25226) @@ -480,7 +480,7 @@ start = clock(); #endif - pcb_path_resolve(Filename, &new_filename, 0, pcb_false); + pcb_path_resolve(&PCB->hidlib, Filename, &new_filename, 0, pcb_false); oldPCB = PCB; PCB = newPCB; @@ -751,7 +751,7 @@ const char *fmt = NULL; pcb_plug_io_t *orig; - filename = pcb_build_fn(conf_core.rc.backup_name); + filename = pcb_build_fn(&PCB->hidlib, conf_core.rc.backup_name); if (filename == NULL) { fprintf(stderr, "pcb_backup(): can't build file name for a backup\n"); exit(1); Index: trunk/src/safe_fs.c =================================================================== --- trunk/src/safe_fs.c (revision 25225) +++ trunk/src/safe_fs.c (revision 25226) @@ -27,6 +27,9 @@ /* permit direct access to the libc calls (turn off config.h masking) */ #define PCB_SAFE_FS +/* temporary */ +#define TODO_hidlib NULL + /* opendir, readdir */ #include "compat_inc.h" @@ -72,7 +75,7 @@ return NULL; } - path_exp = pcb_build_fn(path); + path_exp = pcb_build_fn(TODO_hidlib, path); CHECK("fopen", "access", path_exp, mode, goto err); CHECK("fopen", "fopen", path_exp, mode, goto err); @@ -102,7 +105,7 @@ char *pcb_fopen_check(const char *path, const char *mode) { - char *path_exp = pcb_build_fn(path); + char *path_exp = pcb_build_fn(TODO_hidlib, path); CHECK("fopen", "access", path_exp, mode, goto err); CHECK("fopen", "fopen", path_exp, mode, goto err); @@ -116,7 +119,7 @@ FILE *pcb_popen(const char *cmd, const char *mode) { FILE *f = NULL; - char *cmd_exp = pcb_build_fn(cmd); + char *cmd_exp = pcb_build_fn(TODO_hidlib, cmd); CHECK("popen", "access", cmd_exp, mode, goto err); CHECK("popen", "exec", cmd_exp, NULL, goto err); @@ -138,7 +141,7 @@ int pcb_system(const char *cmd) { int res = -1; - char *cmd_exp = pcb_build_fn(cmd); + char *cmd_exp = pcb_build_fn(TODO_hidlib, cmd); CHECK("access", "access", cmd_exp, "r", goto err); CHECK("access", "exec", cmd_exp, NULL, goto err); @@ -154,7 +157,7 @@ int pcb_remove(const char *path) { int res = -1; - char *path_exp = pcb_build_fn(path); + char *path_exp = pcb_build_fn(TODO_hidlib, path); CHECK("remove", "access", path_exp, "w", goto err); CHECK("remove", "remove", path_exp, NULL, goto err); @@ -169,8 +172,8 @@ int pcb_rename(const char *old_path, const char *new_path) { int res = -1; - char *old_path_exp = pcb_build_fn(old_path); - char *new_path_exp = pcb_build_fn(new_path); + char *old_path_exp = pcb_build_fn(TODO_hidlib, old_path); + char *new_path_exp = pcb_build_fn(TODO_hidlib, new_path); CHECK("rename", "access", old_path_exp, "w", goto err); CHECK("rename", "access", new_path_exp, "w", goto err); @@ -187,7 +190,7 @@ int pcb_unlink(const char *path) { int res; - char *path_exp = pcb_build_fn(path); + char *path_exp = pcb_build_fn(TODO_hidlib, path); res = unlink(path_exp); free(path_exp); return res; @@ -197,7 +200,7 @@ DIR *pcb_opendir(const char *name) { DIR *d; - char *path_exp = pcb_build_fn(name); + char *path_exp = pcb_build_fn(TODO_hidlib, name); d = opendir(path_exp); free(path_exp); return d; @@ -271,7 +274,7 @@ FILE *pcb_fopen_first(const conflist_t *paths, const char *fn, const char *mode, char **full_path, int recursive) { FILE *res; - char *real_fn = pcb_build_fn(fn); + char *real_fn = pcb_build_fn(TODO_hidlib, fn); conf_listitem_t *ci; if (full_path != NULL) @@ -302,7 +305,7 @@ p++; /* resolve the path from the list, truncate trailing '/' */ - real_p = pcb_build_fn(p); + real_p = pcb_build_fn(TODO_hidlib, p); pl = strlen(real_p); if ((pl > 0) && (real_p[pl-1] == '/')) real_p[pl-1] = '\0'; Index: trunk/src_plugins/dialogs/dlg_pref_confedit.c =================================================================== --- trunk/src_plugins/dialogs/dlg_pref_confedit.c (revision 25225) +++ trunk/src_plugins/dialogs/dlg_pref_confedit.c (revision 25226) @@ -174,7 +174,7 @@ conf_set(ctx->role, ctx->nat->hash_path, ctx->idx, val, POL_OVERWRITE); if ((ctx->role == CFR_USER) || (ctx->role == CFR_PROJECT)) - conf_save_file(NULL, (PCB == NULL ? NULL : PCB->hidlib.filename), ctx->role, NULL); + conf_save_file(&PCB->hidlib, NULL, (PCB == NULL ? NULL : PCB->hidlib.filename), ctx->role, NULL); else if (ctx->role == CFR_DESIGN) pcb_board_set_changed_flag(1); Index: trunk/src_plugins/dialogs/dlg_pref_lib.c =================================================================== --- trunk/src_plugins/dialogs/dlg_pref_lib.c (revision 25225) +++ trunk/src_plugins/dialogs/dlg_pref_lib.c (revision 25226) @@ -90,7 +90,7 @@ conf_loop_list_str(&conf_core.rc.library_search_paths, i, s, idx) { char *tmp; cell[0] = pcb_strdup(i->payload); - pcb_path_resolve(cell[0], &tmp, 0, pcb_false); + pcb_path_resolve(&PCB->hidlib, cell[0], &tmp, 0, pcb_false); cell[1] = pcb_strdup(tmp == NULL ? "" : tmp); cell[2] = pcb_strdup((i->prop.src->file_name == NULL ? SRC_BRD : i->prop.src->file_name)); cell[3] = NULL; @@ -231,7 +231,7 @@ cell_edit_ctx_t *ctx = caller_data; char *tmp; - pcb_path_resolve(ctx->dlg[ctx->wpath].default_val.str_value, &tmp, 0, pcb_true); + pcb_path_resolve(&PCB->hidlib, ctx->dlg[ctx->wpath].default_val.str_value, &tmp, 0, pcb_true); if (tmp != NULL) PCB_DAD_SET_VALUE(hid_ctx, ctx->wexp, str_value, tmp); } Index: trunk/src_plugins/extedit/extedit.c =================================================================== --- trunk/src_plugins/extedit/extedit.c (revision 25225) +++ trunk/src_plugins/extedit/extedit.c (revision 25226) @@ -115,6 +115,7 @@ memset(&subs, 0, sizeof(subs)); subs.params['f' - 'a'] = fn; + subs.hidlib = &PCB->hidlib; cmd = pcb_build_argfn(mth->command, &subs); /* Don't use pcb_system() because that blocks the current process and the Index: trunk/src_plugins/fp_fs/fp_fs.c =================================================================== --- trunk/src_plugins/fp_fs/fp_fs.c (revision 25225) +++ trunk/src_plugins/fp_fs/fp_fs.c (revision 25226) @@ -34,6 +34,7 @@ #include "compat_inc.h" +#include "board.h" #include "data.h" #include "paths.h" #include "plugins.h" @@ -224,7 +225,7 @@ sprintf(working_, "%s%c%s", toppath, PCB_DIR_SEPARATOR_C, subdir); - pcb_path_resolve(working_, &working, 0, pcb_false); + pcb_path_resolve(&PCB->hidlib, working_, &working, 0, pcb_false); /* Return error if the root is not a directory, to give other fp_ plugins a chance */ if ((is_root) && (!pcb_is_dir(working))) { @@ -324,7 +325,7 @@ else strcpy(path, p); - pcb_path_resolve(path, &fpath, 0, pcb_false); + pcb_path_resolve(&PCB->hidlib, path, &fpath, 0, pcb_false); /* fprintf(stderr, " in '%s'\n", fpath);*/ fp_fs_list(&pcb_library, fpath, 1, fp_search_cb, &ctx, 1, 0); Index: trunk/src_plugins/hid_lesstif/menu.c =================================================================== --- trunk/src_plugins/hid_lesstif/menu.c (revision 25225) +++ trunk/src_plugins/hid_lesstif/menu.c (revision 25226) @@ -30,6 +30,8 @@ #include "../src_plugins/lib_hid_common/menu_helper.h" +extern pcb_hidlib_t *ltf_hidlib; + Widget lesstif_menubar; pcb_hid_cfg_t *lesstif_cfg; conf_hid_id_t lesstif_menuconf_id = -1; @@ -551,7 +553,7 @@ screen = DefaultScreen(display); cmap = DefaultColormap(display, screen); - lesstif_cfg = pcb_hid_cfg_load("lesstif", 0, pcb_menu_default); + lesstif_cfg = pcb_hid_cfg_load(ltf_hidlib, "lesstif", 0, pcb_menu_default); lesstif_hid.hid_cfg = lesstif_cfg; if (lesstif_cfg == NULL) { pcb_message(PCB_MSG_ERROR, "FATAL: can't load the lesstif menu res either from file or from hardwired default."); Index: trunk/src_plugins/import_mentor_sch/mentor_sch.c =================================================================== --- trunk/src_plugins/import_mentor_sch/mentor_sch.c (revision 25225) +++ trunk/src_plugins/import_mentor_sch/mentor_sch.c (revision 25226) @@ -141,7 +141,7 @@ conf_loop_list_str(&conf_mentor.plugins.import_mentor_sch.map_search_paths, item, item_str, idx) { char *p; - pcb_path_resolve(item_str, &p, 0, pcb_false); + pcb_path_resolve(&PCB->hidlib, item_str, &p, 0, pcb_false); if (p != NULL) { cnt += nethlp_load_part_map(&nhctx, p); free(p); Index: trunk/src_plugins/import_netlist/import_netlist.c =================================================================== --- trunk/src_plugins/import_netlist/import_netlist.c (revision 25225) +++ trunk/src_plugins/import_netlist/import_netlist.c (revision 25226) @@ -84,6 +84,7 @@ memset(&p, 0, sizeof(p)); p.params['p'-'a'] = conf_core.rc.rat_path; p.params['f'-'a'] = filename; + p.hidlib = &PCB->hidlib; command = pcb_build_argfn(conf_core.rc.rat_command, &p); /* open pipe to stdout of command */ Index: trunk/src_plugins/import_sch/import_sch.c =================================================================== --- trunk/src_plugins/import_sch/import_sch.c (revision 25225) +++ trunk/src_plugins/import_sch/import_sch.c (revision 25226) @@ -250,7 +250,7 @@ cmd[6] = tmpfile; cmd[7] = "--"; for (i = 0; i < nsources; i++) - cmd[8 + i] = pcb_build_fn(sources[i]); + cmd[8 + i] = pcb_build_fn(&PCB->hidlib, sources[i]); cmd[8 + nsources] = NULL; if (conf_import_sch.plugins.import_sch.verbose) { Index: trunk/src_plugins/io_lihata/write.c =================================================================== --- trunk/src_plugins/io_lihata/write.c (revision 25225) +++ trunk/src_plugins/io_lihata/write.c (revision 25226) @@ -1510,7 +1510,7 @@ Thus this feature should be disabled */ if ((fnpat != NULL) && (*fnpat != '\0')) { char *orig_fn, *end; - char *pcb_fn = pcb_strdup_subst(fnpat, pcb_build_fn_cb, NULL, PCB_SUBST_ALL); + char *pcb_fn = pcb_strdup_subst(fnpat, pcb_build_fn_cb, &PCB->hidlib, PCB_SUBST_ALL); orig_fn = PCB->hidlib.filename; PCB->hidlib.filename = NULL; Index: trunk/src_plugins/io_pcb/file.c =================================================================== --- trunk/src_plugins/io_pcb/file.c (revision 25225) +++ trunk/src_plugins/io_pcb/file.c (revision 25226) @@ -1167,7 +1167,7 @@ * the program.*/ void pcb_tmp_data_save(void) { - char *fn = pcb_build_fn(conf_core.rc.emergency_name); + char *fn = pcb_build_fn(&PCB->hidlib, conf_core.rc.emergency_name); pcb_write_pcb_file(fn, pcb_true, NULL, pcb_true, pcb_false); if (TMPFilename != NULL) free(TMPFilename); Index: trunk/src_plugins/io_pcb/parse_l.c =================================================================== --- trunk/src_plugins/io_pcb/parse_l.c (revision 25225) +++ trunk/src_plugins/io_pcb/parse_l.c (revision 25226) @@ -2396,6 +2396,7 @@ memset(&p, 0, sizeof(p)); p.params['p' - 'a'] = Path; p.params['f' - 'a'] = Filename; + p.hidlib = &PCB->hidlib; command = pcb_build_argfn(Executable, &p); /* open pipe to stdout of command */ if (*command == '\0' || (pcb_in = pcb_popen(command, "r")) == NULL) { Index: trunk/src_plugins/io_pcb/parse_l.l =================================================================== --- trunk/src_plugins/io_pcb/parse_l.l (revision 25225) +++ trunk/src_plugins/io_pcb/parse_l.l (revision 25226) @@ -253,6 +253,7 @@ memset(&p, 0, sizeof(p)); p.params['p' - 'a'] = Path; p.params['f' - 'a'] = Filename; + p.hidlib = &PCB->hidlib; command = pcb_build_argfn(Executable, &p); /* open pipe to stdout of command */ if (*command == '\0' || (yyin = pcb_popen(command, "r")) == NULL) { Index: trunk/src_plugins/lib_gtk_common/bu_menu.c =================================================================== --- trunk/src_plugins/lib_gtk_common/bu_menu.c (revision 25225) +++ trunk/src_plugins/lib_gtk_common/bu_menu.c (revision 25226) @@ -448,7 +448,7 @@ menu->hidlib = hidlib; - *cfg_out = pcb_hid_cfg_load("gtk", 0, pcb_menu_default); + *cfg_out = pcb_hid_cfg_load(menu->hidlib, "gtk", 0, pcb_menu_default); if (*cfg_out == NULL) { pcb_message(PCB_MSG_ERROR, "FATAL: can't load the gtk menu res either from file or from hardwired default."); abort(); Index: trunk/src_plugins/lib_gtk_hid/glue_event.c =================================================================== --- trunk/src_plugins/lib_gtk_hid/glue_event.c (revision 25225) +++ trunk/src_plugins/lib_gtk_hid/glue_event.c (revision 25226) @@ -19,7 +19,8 @@ { /* Sync gui status display with pcb state */ pcb_tool_adjust_attached_objects(); - ghid_invalidate_all(hidlib); + if (gport->drawing_area != NULL) + ghid_invalidate_all(hidlib); ghidgui->common.window_set_name_label(ghidgui->common.hidlib->name); /* Sync menu checkboxes */ Index: trunk/src_plugins/lib_hid_common/cli_history.c =================================================================== --- trunk/src_plugins/lib_hid_common/cli_history.c (revision 25225) +++ trunk/src_plugins/lib_hid_common/cli_history.c (revision 25226) @@ -181,7 +181,7 @@ if ((CFG.file == NULL) || (CFG.slots < 1)) return; - real_fn = pcb_build_fn(CFG.file); + real_fn = pcb_build_fn(NULL, CFG.file); /* no hidlib: we are loading from the user dir */ if (real_fn == NULL) return; f = pcb_fopen(real_fn, "r"); @@ -209,7 +209,7 @@ if ((CFG.file == NULL) || (CFG.slots < 1) || (!loaded)) return; - real_fn = pcb_build_fn(CFG.file); + real_fn = pcb_build_fn(NULL, CFG.file); /* no hidlib: we are saving in user dir */ if (real_fn == NULL) return; f = pcb_fopen(real_fn, "w"); Index: trunk/src_plugins/lib_hid_common/place.c =================================================================== --- trunk/src_plugins/lib_hid_common/place.c (revision 25225) +++ trunk/src_plugins/lib_hid_common/place.c (revision 25226) @@ -227,7 +227,7 @@ if (role != CFR_DESIGN) { - int r = conf_save_file(NULL, (hidlib == NULL ? NULL : hidlib->filename), role, NULL); + int r = conf_save_file(hidlib, NULL, (hidlib == NULL ? NULL : hidlib->filename), role, NULL); if (r != 0) pcb_message(PCB_MSG_ERROR, "Failed to save window geometry in %s\n", conf_role_name(role)); }