Index: trunk/src/board.c =================================================================== --- trunk/src/board.c (revision 25226) +++ trunk/src/board.c (revision 25227) @@ -122,7 +122,7 @@ const char *tmp_fn = ".pcb-rnd.default.pcb"; /* We can parse from file only, make a temp file */ - f = pcb_fopen_fn(tmp_fn, "wb", &efn); + f = pcb_fopen_fn(NULL, tmp_fn, "wb", &efn); if (f != NULL) { fwrite(default_pcb_internal, strlen(default_pcb_internal), 1, f); fclose(f); @@ -131,7 +131,7 @@ pcb_message(PCB_MSG_WARNING, "Couldn't find default.pcb - using the embedded fallback\n"); else pcb_message(PCB_MSG_ERROR, "Couldn't find default.pcb and failed to load the embedded fallback\n"); - pcb_remove(efn); + pcb_remove(NULL, efn); free(efn); } } Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 25226) +++ trunk/src/buffer.c (revision 25227) @@ -876,7 +876,7 @@ { FILE *exist; - if ((!force) && ((exist = pcb_fopen(name, "r")))) { + if ((!force) && ((exist = pcb_fopen(&PCB->hidlib, name, "r")))) { fclose(exist); if (pcb_hid_message_box("warning", "Buffer: overwrite file", "File exists! Ok to overwrite?", "cancel", 0, "yes", 1, NULL) == 1) pcb_save_buffer_elements(name, fmt); Index: trunk/src/compat_fs.c =================================================================== --- trunk/src/compat_fs.c (revision 25226) +++ trunk/src/compat_fs.c (revision 25227) @@ -89,7 +89,7 @@ int pcb_file_readable(const char *path) { FILE *f; - f = pcb_fopen(path, "r"); + f = pcb_fopen(NULL, path, "r"); if (f != NULL) { fclose(f); return 1; Index: trunk/src/conf.c =================================================================== --- trunk/src/conf.c (revision 25226) +++ trunk/src/conf.c (revision 25227) @@ -136,7 +136,7 @@ ifn = ""; } else { - d = pcb_hid_cfg_load_lht(fn); + d = pcb_hid_cfg_load_lht(NULL, fn); ifn = fn; } @@ -178,7 +178,7 @@ ifn = ""; } else { - d = pcb_hid_cfg_load_lht(fn); + d = pcb_hid_cfg_load_lht(NULL, fn); ifn = fn; } @@ -186,7 +186,7 @@ FILE *f; char *efn; - f = pcb_fopen_fn(fn, "r", &efn); + f = pcb_fopen_fn(NULL, fn, "r", &efn); if (f != NULL) { /* warn only if the file is there - missing file is normal */ pcb_message(PCB_MSG_ERROR, "error: failed to load lht config: %s (%s)\n", fn, efn); fclose(f); @@ -470,7 +470,7 @@ check:; *try = res; - f = pcb_fopen_fn(res, "r", &efn); + f = pcb_fopen_fn(NULL, res, "r", &efn); if (f != NULL) { fclose(f); strncpy(res, efn, sizeof(res)-1); @@ -1789,7 +1789,7 @@ if (r != NULL) { FILE *f; - f = pcb_fopen_fn(fn, "w", &efn); + f = pcb_fopen_fn(hidlib, fn, "w", &efn); if ((f == NULL) && (role == CFR_USER)) { /* create the directory and try again */ char *path = NULL, *end; @@ -1808,10 +1808,10 @@ end = strrchr(path, '/'); if (end != NULL) { *end = '\0'; - if (pcb_mkdir(path, 0755) == 0) { + if (pcb_mkdir(NULL, path, 0755) == 0) { pcb_message(PCB_MSG_INFO, "Created directory %s for saving %s\n", path, fn); *end = '/'; - f = pcb_fopen(path, "w"); + f = pcb_fopen(hidlib, path, "w"); } else pcb_message(PCB_MSG_ERROR, "Error: failed to create directory %s for saving %s\n", path, efn); @@ -1834,7 +1834,7 @@ return fail; } -int conf_export_to_file(const char *fn, conf_role_t role, const char *conf_path) +int conf_export_to_file(pcb_hidlib_t *hidlib, const char *fn, conf_role_t role, const char *conf_path) { lht_node_t *at = conf_lht_get_at(role, conf_path, 0); lht_err_t r; @@ -1843,7 +1843,7 @@ if (at == NULL) return -1; - f = pcb_fopen(fn, "w"); + f = pcb_fopen(hidlib, fn, "w"); if (f == NULL) return -1; Index: trunk/src/conf.h =================================================================== --- trunk/src/conf.h (revision 25226) +++ trunk/src/conf.h (revision 25227) @@ -368,7 +368,7 @@ lht_node_t *conf_lht_get_at(conf_role_t target, const char *path, int create); /* Write an existing conf subtree to a file */ -int conf_export_to_file(const char *fn, conf_role_t role, const char *conf_path); +int conf_export_to_file(pcb_hidlib_t *hidlib, const char *fn, conf_role_t role, const char *conf_path); /* Determine the policy and priority of a config lihata node; returns 0 on success but may not fill in both values, caller is Index: trunk/src/error.c =================================================================== --- trunk/src/error.c (revision 25226) +++ trunk/src/error.c (revision 25227) @@ -163,12 +163,12 @@ -int pcb_log_export(const char *fn, int fmt_lihata) +int pcb_log_export(pcb_hidlib_t *hidlib, const char *fn, int fmt_lihata) { FILE *f; pcb_logline_t *n; - f = pcb_fopen(fn, "w"); + f = pcb_fopen(hidlib, fn, "w"); if (f == NULL) return -1; @@ -233,7 +233,7 @@ wfmt = PCB_DAD_CURRENT(fmtsub.dlg); fn = pcb_gui->fileselect("Export log", NULL, "log.txt", NULL, NULL, "log", PCB_HID_FSD_MAY_NOT_EXIST, &fmtsub); if (fn != NULL) { - ret = pcb_log_export(fn, (fmtsub.dlg[wfmt].default_val.int_value == 1)); + ret = pcb_log_export(NULL, fn, (fmtsub.dlg[wfmt].default_val.int_value == 1)); if (ret != 0) pcb_message(PCB_MSG_ERROR, "Failed to export log to '%s'\n", fn); free(fn); Index: trunk/src/error.h =================================================================== --- trunk/src/error.h (revision 25226) +++ trunk/src/error.h (revision 25227) @@ -30,6 +30,7 @@ #define PCB_ERROR_H #include +#include "global_typedefs.h" /* pcb_printf()-like call to print temporary trace messages to stderr; disabled in non-debug compilation */ @@ -84,7 +85,7 @@ void pcb_log_del_range(unsigned long from, unsigned long to); /* Export the whole log list to a file, in lihata or plain text */ -int pcb_log_export(const char *fn, int fmt_lihata); +int pcb_log_export(pcb_hidlib_t *hidlib, const char *fn, int fmt_lihata); /* Free all memory and reset the log system */ void pcb_log_uninit(void); Index: trunk/src/file_act.c =================================================================== --- trunk/src/file_act.c (revision 25226) +++ trunk/src/file_act.c (revision 25227) @@ -102,7 +102,7 @@ pcb_netlist_init(&(PCB->netlist[i])); } } - if (!pcb_import_netlist(PCB->Netlistname)) + if (!pcb_import_netlist(&PCB->hidlib, PCB->Netlistname)) pcb_netlist_changed(1); break; Index: trunk/src/hid_cfg.c =================================================================== --- trunk/src/hid_cfg.c (revision 25226) +++ trunk/src/hid_cfg.c (revision 25227) @@ -52,13 +52,13 @@ return 1; } -lht_doc_t *pcb_hid_cfg_load_lht(const char *filename) +lht_doc_t *pcb_hid_cfg_load_lht(pcb_hidlib_t *hidlib, const char *filename) { FILE *f; lht_doc_t *doc; int error = 0; - f = pcb_fopen(filename, "r"); + f = pcb_fopen(hidlib, filename, "r"); if (f == NULL) return NULL; @@ -151,7 +151,7 @@ if (doc == NULL) { char *end = *p + strlen(*p); sprintf(end, "pcb-menu-%s.lht", fn); - doc = pcb_hid_cfg_load_lht(*p); + doc = pcb_hid_cfg_load_lht(hidlib, *p); if (doc != NULL) pcb_file_loaded_set_at("menu", "HID main", *p, "main menu system"); } @@ -160,7 +160,7 @@ free(paths); } else - doc = pcb_hid_cfg_load_lht(fn); + doc = pcb_hid_cfg_load_lht(hidlib, fn); if (doc == NULL) { doc = pcb_hid_cfg_load_str(embedded_fallback); Index: trunk/src/hid_cfg.h =================================================================== --- trunk/src/hid_cfg.h (revision 25226) +++ trunk/src/hid_cfg.h (revision 25227) @@ -43,7 +43,7 @@ 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); +lht_doc_t *pcb_hid_cfg_load_lht(pcb_hidlib_t *hidlib, const char *filename); lht_doc_t *pcb_hid_cfg_load_str(const char *text); /* Generic, low level lihata text value fetch */ Index: trunk/src/main_act.c =================================================================== --- trunk/src/main_act.c (revision 25226) +++ trunk/src/main_act.c (revision 25227) @@ -359,7 +359,7 @@ pcb_snprintf(tmp, sizeof(tmp), "%mm", pcb_crosshair.Y); pcb_setenv("PCB_RND_CROSSHAIR_Y_MM", tmp, 1); pcb_setenv("PCB_RND_CURRENT_LAYER_NAME", CURRENT->name, 1); - PCB_ACT_IRES(pcb_system(cmd)); + PCB_ACT_IRES(pcb_system(&PCB->hidlib, cmd)); return 0; } @@ -376,7 +376,7 @@ PCB_ACT_CONVARG(1, FGW_STR, ExecuteFile, fname = argv[1].val.str); - if ((fp = pcb_fopen(fname, "r")) == NULL) { + if ((fp = pcb_fopen(&PCB->hidlib, fname, "r")) == NULL) { fprintf(stderr, "Could not open actions file \"%s\".\n", fname); return 1; } Index: trunk/src/paths.h =================================================================== --- trunk/src/paths.h (revision 25226) +++ trunk/src/paths.h (revision 25227) @@ -72,7 +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_hidlib_t *hidlib; /* if NULL, some of the substitutions (e.g. %B, %D, %N) won't be performed */ } pcb_build_argfn_t; char *pcb_build_argfn(const char *template, pcb_build_argfn_t *arg); Index: trunk/src/plug_import.c =================================================================== --- trunk/src/plug_import.c (revision 25226) +++ trunk/src/plug_import.c (revision 25227) @@ -89,7 +89,7 @@ } -int pcb_import(char *filename, unsigned int aspect) +int pcb_import(pcb_hidlib_t *hidlib, char *filename, unsigned int aspect) { pcb_plug_import_t *plug; FILE *fp; @@ -98,7 +98,7 @@ pcb_message(PCB_MSG_ERROR, "Error: need a file name for pcb_import_netlist()\n"); return 1; /* nothing to do */ } - fp = pcb_fopen(filename, "r"); + fp = pcb_fopen(hidlib, filename, "r"); plug = find_importer(aspect, fp, filename); if (plug == NULL) { @@ -117,9 +117,9 @@ return plug->import(plug, aspect, filename); } -int pcb_import_netlist(char *filename) +int pcb_import_netlist(pcb_hidlib_t *hidlib, char *filename) { - return pcb_import(filename, IMPORT_ASPECT_NETLIST); + return pcb_import(hidlib, filename, IMPORT_ASPECT_NETLIST); } void pcb_import_uninit(void) Index: trunk/src/plug_import.h =================================================================== --- trunk/src/plug_import.h (revision 25226) +++ trunk/src/plug_import.h (revision 25227) @@ -59,8 +59,8 @@ void pcb_import_uninit(void); /********** hook wrappers **********/ -int pcb_import(char *filename, unsigned int aspect); -int pcb_import_netlist(char *); +int pcb_import(pcb_hidlib_t *hidlib, char *filename, unsigned int aspect); +int pcb_import_netlist(pcb_hidlib_t *, char *); #endif Index: trunk/src/plug_io.c =================================================================== --- trunk/src/plug_io.c (revision 25226) +++ trunk/src/plug_io.c (revision 25227) @@ -77,7 +77,7 @@ pcb_view_list_t pcb_io_incompat_lst; static pcb_bool pcb_io_incompat_lst_enable = pcb_false; -static void plug_io_err(int res, const char *what, const char *filename) +static void plug_io_err(pcb_hidlib_t *hidlib, int res, const char *what, const char *filename) { if (pcb_io_err_inhibit) return; @@ -91,7 +91,7 @@ else { FILE *f; reason = "none of io plugins could successfully read file"; - f = pcb_fopen(filename, "r"); + f = pcb_fopen(hidlib, filename, "r"); if (f != NULL) { fclose(f); comment = "(unknown/invalid file format?)"; @@ -205,7 +205,7 @@ int accept_total = 0; FILE *ft; - ft = pcb_fopen(Filename, "r"); + ft = pcb_fopen(&Ptr->hidlib, Filename, "r"); len = pcb_test_parse_all(ft, Filename, fmt, PCB_IOT_PCB, available, accepts, &accept_total, sizeof(available)/sizeof(available[0]), ignore_missing, load_settings); if (ft != NULL) fclose(ft); @@ -237,7 +237,7 @@ pcb_event(&PCB->hidlib, PCB_EVENT_ROUTE_STYLES_CHANGED, NULL); conf_set(CFR_DESIGN, "design/text_font_id", 0, "0", POL_OVERWRITE); /* we have only one font now, make sure it is selected */ - plug_io_err(res, "load pcb", Filename); + plug_io_err(&Ptr->hidlib, res, "load pcb", Filename); return res; } @@ -277,7 +277,7 @@ if (res == 0) pcb_data_flag_change(Ptr, PCB_OBJ_CLASS_REAL, PCB_CHGFLG_CLEAR, PCB_FLAG_FOUND | PCB_FLAG_SELECTED); - plug_io_err(res, "load footprint", Filename); + plug_io_err(&PCB->hidlib, res, "load footprint", Filename); return res; } @@ -286,7 +286,7 @@ int res = -1; PCB_HOOK_CALL(pcb_plug_io_t, pcb_plug_io_chain, parse_font, res, == 0, (self, Ptr, Filename)); - plug_io_err(res, "load font", Filename); + plug_io_err(&PCB->hidlib, res, "load font", Filename); return res; } @@ -387,7 +387,7 @@ /* if ((res == 0) && (newfmt)) PCB->Data->loader = p;*/ - plug_io_err(res, "write buffer", NULL); + plug_io_err(&PCB->hidlib, res, "write buffer", NULL); return res; } @@ -407,7 +407,7 @@ if ((res == 0) && (newfmt)) e->loader = p; - plug_io_err(res, "write element", NULL); + plug_io_err(&PCB->hidlib, res, "write element", NULL); return res; } @@ -426,7 +426,7 @@ /* if ((res == 0) && (newfmt)) PCB->Data->loader = p;*/ - plug_io_err(res, "write font", NULL); + plug_io_err(&PCB->hidlib, res, "write font", NULL); return res; } @@ -459,7 +459,7 @@ if (res == 0) pcb_set_design_dir(new_filename); - plug_io_err(res, "write pcb", NULL); + plug_io_err(&PCB->hidlib, res, "write pcb", NULL); return res; } @@ -790,7 +790,7 @@ fn_tmp = malloc(len+8); memcpy(fn_tmp, Filename, len); strcpy(fn_tmp+len, ".old"); - if (pcb_rename(Filename, fn_tmp) != 0) { + if (pcb_rename(NULL, Filename, fn_tmp) != 0) { if (emergency) { /* Try an alternative emergency file */ strcpy(fn_tmp+len, ".emr"); @@ -803,7 +803,7 @@ } } - if ((fp = pcb_fopen(Filename, "w")) == NULL) { + if ((fp = pcb_fopen(&PCB->hidlib, Filename, "w")) == NULL) { pcb_open_error_message(Filename); return (-1); } @@ -813,7 +813,7 @@ fclose(fp); if (fn_tmp != NULL) { if ((result == 0) && (!conf_core.rc.keep_save_backups)) - pcb_unlink(fn_tmp); + pcb_unlink(&PCB->hidlib, fn_tmp); free(fn_tmp); } return result; @@ -848,7 +848,7 @@ } } printf("write to pipe \"%s\"\n", command.array); - if ((fp = pcb_popen(command.array, "w")) == NULL) { + if ((fp = pcb_popen(&PCB->hidlib, command.array, "w")) == NULL) { pcb_popen_error_message(command.array); return (-1); } Index: trunk/src/rats_patch.c =================================================================== --- trunk/src/rats_patch.c (revision 25226) +++ trunk/src/rats_patch.c (revision 25227) @@ -513,7 +513,7 @@ free(default_file); } - f = pcb_fopen(fn, "w"); + f = pcb_fopen(&PCB->hidlib, fn, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Can't open netlist patch file %s for writing\n", fn); PCB_ACT_IRES(-1); Index: trunk/src/safe_fs.c =================================================================== --- trunk/src/safe_fs.c (revision 25226) +++ trunk/src/safe_fs.c (revision 25227) @@ -27,9 +27,6 @@ /* 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" @@ -63,7 +60,7 @@ } \ } while(0) -FILE *pcb_fopen_fn(const char *path, const char *mode, char **fn_out) +FILE *pcb_fopen_fn(pcb_hidlib_t *hidlib, const char *path, const char *mode, char **fn_out) { FILE *f; char *path_exp; @@ -75,7 +72,7 @@ return NULL; } - path_exp = pcb_build_fn(TODO_hidlib, path); + path_exp = pcb_build_fn(hidlib, path); CHECK("fopen", "access", path_exp, mode, goto err); CHECK("fopen", "fopen", path_exp, mode, goto err); @@ -98,14 +95,14 @@ return NULL; } -FILE *pcb_fopen(const char *path, const char *mode) +FILE *pcb_fopen(pcb_hidlib_t *hidlib, const char *path, const char *mode) { - return pcb_fopen_fn(path, mode, NULL); + return pcb_fopen_fn(hidlib, path, mode, NULL); } -char *pcb_fopen_check(const char *path, const char *mode) +char *pcb_fopen_check(pcb_hidlib_t *hidlib, const char *path, const char *mode) { - char *path_exp = pcb_build_fn(TODO_hidlib, path); + char *path_exp = pcb_build_fn(hidlib, path); CHECK("fopen", "access", path_exp, mode, goto err); CHECK("fopen", "fopen", path_exp, mode, goto err); @@ -116,10 +113,10 @@ return NULL; } -FILE *pcb_popen(const char *cmd, const char *mode) +FILE *pcb_popen(pcb_hidlib_t *hidlib, const char *cmd, const char *mode) { FILE *f = NULL; - char *cmd_exp = pcb_build_fn(TODO_hidlib, cmd); + char *cmd_exp = pcb_build_fn(hidlib, cmd); CHECK("popen", "access", cmd_exp, mode, goto err); CHECK("popen", "exec", cmd_exp, NULL, goto err); @@ -138,10 +135,10 @@ } -int pcb_system(const char *cmd) +int pcb_system(pcb_hidlib_t *hidlib, const char *cmd) { int res = -1; - char *cmd_exp = pcb_build_fn(TODO_hidlib, cmd); + char *cmd_exp = pcb_build_fn(hidlib, cmd); CHECK("access", "access", cmd_exp, "r", goto err); CHECK("access", "exec", cmd_exp, NULL, goto err); @@ -154,10 +151,10 @@ return res; } -int pcb_remove(const char *path) +int pcb_remove(pcb_hidlib_t *hidlib, const char *path) { int res = -1; - char *path_exp = pcb_build_fn(TODO_hidlib, path); + char *path_exp = pcb_build_fn(hidlib, path); CHECK("remove", "access", path_exp, "w", goto err); CHECK("remove", "remove", path_exp, NULL, goto err); @@ -169,11 +166,11 @@ return res; } -int pcb_rename(const char *old_path, const char *new_path) +int pcb_rename(pcb_hidlib_t *hidlib, const char *old_path, const char *new_path) { int res = -1; - char *old_path_exp = pcb_build_fn(TODO_hidlib, old_path); - char *new_path_exp = pcb_build_fn(TODO_hidlib, new_path); + char *old_path_exp = pcb_build_fn(hidlib, old_path); + char *new_path_exp = pcb_build_fn(hidlib, new_path); CHECK("rename", "access", old_path_exp, "w", goto err); CHECK("rename", "access", new_path_exp, "w", goto err); @@ -187,10 +184,10 @@ return res; } -int pcb_unlink(const char *path) +int pcb_unlink(pcb_hidlib_t *hidlib, const char *path) { int res; - char *path_exp = pcb_build_fn(TODO_hidlib, path); + char *path_exp = pcb_build_fn(hidlib, path); res = unlink(path_exp); free(path_exp); return res; @@ -197,10 +194,10 @@ } -DIR *pcb_opendir(const char *name) +DIR *pcb_opendir(pcb_hidlib_t *hidlib, const char *name) { DIR *d; - char *path_exp = pcb_build_fn(TODO_hidlib, name); + char *path_exp = pcb_build_fn(hidlib, name); d = opendir(path_exp); free(path_exp); return d; @@ -217,7 +214,7 @@ } -static FILE *pcb_fopen_at_(const char *from, const char *fn, const char *mode, char **full_path, int recursive) +static FILE *pcb_fopen_at_(pcb_hidlib_t *hidlib, const char *from, const char *fn, const char *mode, char **full_path, int recursive) { char tmp[PCB_PATH_MAX]; DIR *d; @@ -226,7 +223,7 @@ /* try the trivial: directly under this dir */ pcb_snprintf(tmp, sizeof(tmp), "%s%c%s", from, PCB_DIR_SEPARATOR_C, fn); - res = pcb_fopen(tmp, mode); + res = pcb_fopen(hidlib, tmp, mode); if (res != NULL) { if (full_path != NULL) @@ -238,7 +235,7 @@ if (!recursive) return NULL; - d = pcb_opendir(from); + d = pcb_opendir(hidlib, from); if (d == NULL) return NULL; @@ -253,7 +250,7 @@ continue; /* dir: recurse */ - res = pcb_fopen_at_(tmp, fn, mode, full_path, recursive); + res = pcb_fopen_at_(hidlib, tmp, fn, mode, full_path, recursive); if (res != NULL) { closedir(d); return res; @@ -263,18 +260,18 @@ return NULL; } -FILE *pcb_fopen_at(const char *dir, const char *fn, const char *mode, char **full_path, int recursive) +FILE *pcb_fopen_at(pcb_hidlib_t *hidlib, const char *dir, const char *fn, const char *mode, char **full_path, int recursive) { if (full_path != NULL) *full_path = NULL; - return pcb_fopen_at_(dir, fn, mode, full_path, recursive); + return pcb_fopen_at_(hidlib, dir, fn, mode, full_path, recursive); } -FILE *pcb_fopen_first(const conflist_t *paths, const char *fn, const char *mode, char **full_path, int recursive) +FILE *pcb_fopen_first(pcb_hidlib_t *hidlib, const conflist_t *paths, const char *fn, const char *mode, char **full_path, int recursive) { FILE *res; - char *real_fn = pcb_build_fn(TODO_hidlib, fn); + char *real_fn = pcb_build_fn(hidlib, fn); conf_listitem_t *ci; if (full_path != NULL) @@ -284,7 +281,7 @@ return NULL; if (pcb_is_path_abs(fn)) { - res = pcb_fopen(real_fn, mode); + res = pcb_fopen(hidlib, real_fn, mode); if ((res != NULL) && (full_path != NULL)) *full_path = real_fn; else @@ -305,12 +302,12 @@ p++; /* resolve the path from the list, truncate trailing '/' */ - real_p = pcb_build_fn(TODO_hidlib, p); + real_p = pcb_build_fn(hidlib, p); pl = strlen(real_p); if ((pl > 0) && (real_p[pl-1] == '/')) real_p[pl-1] = '\0'; - res = pcb_fopen_at(real_p, real_fn, mode, full_path, recursive); + res = pcb_fopen_at(hidlib, real_p, real_fn, mode, full_path, recursive); free(real_p); if (res != NULL) { @@ -324,7 +321,7 @@ } extern int pcb_mkdir_(const char *path, int mode); -int pcb_mkdir(const char *path, int mode) +int pcb_mkdir(pcb_hidlib_t *hidlib, const char *path, int mode) { CHECK("mkdir", "access", path, NULL, return -1); CHECK("mkdir", "mkdir", path, NULL, return -1); @@ -334,7 +331,7 @@ extern long pcb_file_size_(const char *path); -long pcb_file_size(const char *path) +long pcb_file_size(pcb_hidlib_t *hidlib, const char *path) { CHECK("file_size", "access", path, NULL, return -1); CHECK("file_size", "stat", path, NULL, return -1); @@ -342,7 +339,7 @@ } extern int pcb_is_dir_(const char *path); -int pcb_is_dir(const char *path) +int pcb_is_dir(pcb_hidlib_t *hidlib, const char *path) { CHECK("is_dir", "access", path, NULL, return -1); CHECK("is_dir", "stat", path, NULL, return -1); @@ -350,7 +347,7 @@ } extern double pcb_file_mtime_(const char *path); -double pcb_file_mtime(const char *path) +double pcb_file_mtime(pcb_hidlib_t *hidlib, const char *path) { CHECK("file_mtime", "access", path, NULL, return -1); CHECK("file_mtime", "stat", path, NULL, return -1); Index: trunk/src/safe_fs.h =================================================================== --- trunk/src/safe_fs.h (revision 25226) +++ trunk/src/safe_fs.h (revision 25227) @@ -25,45 +25,50 @@ */ /* Wrap standard file system calls, giving the user a chance to control - where pcb-rnd may go on the file system */ + where pcb-rnd may go on the file system. Where hidlib is NULL, some + of the % substitutions will not be performed (the ones that depend on + design (file) name) */ #ifndef PCB_SAFE_FS_H #define PCB_SAFE_FS_H #include +#include "global_typedefs.h" +/* file name templating wrappers around file system calls; later they + will also execute checks to avoid unsafe access */ -FILE *pcb_fopen(const char *path, const char *mode); -FILE *pcb_popen(const char *cmd, const char *mode); +FILE *pcb_fopen(pcb_hidlib_t *hidlib, const char *path, const char *mode); +FILE *pcb_popen(pcb_hidlib_t *hidlib, const char *cmd, const char *mode); int pcb_pclose(FILE *f); -int pcb_system(const char *cmd); -int pcb_remove(const char *path); -int pcb_rename(const char *old_path, const char *new_path); -int pcb_mkdir(const char *path, int mode); -int pcb_unlink(const char *path); +int pcb_system(pcb_hidlib_t *hidlib, const char *cmd); +int pcb_remove(pcb_hidlib_t *hidlib, const char *path); +int pcb_rename(pcb_hidlib_t *hidlib, const char *old_path, const char *new_path); +int pcb_mkdir(pcb_hidlib_t *hidlib, const char *path, int mode); +int pcb_unlink(pcb_hidlib_t *hidlib, const char *path); /* Return the size of non-large files; on error or for large files (size larger than the value long can hold) return -1 */ -long pcb_file_size(const char *path); +long pcb_file_size(pcb_hidlib_t *hidlib, const char *path); /* Return -1 on error or the last modification time (in sec from epoch) */ -double pcb_file_mtime(const char *path); +double pcb_file_mtime(pcb_hidlib_t *hidlib, const char *path); /* Return non-zero if path is a directory */ -int pcb_is_dir(const char *path); +int pcb_is_dir(pcb_hidlib_t *hidlib, const char *path); /* Check if path could be open with mode; if yes, return the substituted/expanded file name, if no, return NULL */ -char *pcb_fopen_check(const char *path, const char *mode); +char *pcb_fopen_check(pcb_hidlib_t *hidlib, const char *path, const char *mode); /* Same as pcb_fopen(), but on success load fn_out() with the malloc()'d file name as it looked after the substitution */ -FILE *pcb_fopen_fn(const char *path, const char *mode, char **fn_out); +FILE *pcb_fopen_fn(pcb_hidlib_t *hidlib, const char *path, const char *mode, char **fn_out); /* Open a file given as a basename fn, under the directory dir, optionally doing a recusrive search in the directory tree. If full_path is not NULL, and the call succeeds, load it with the full path of the file opened. */ -FILE *pcb_fopen_at(const char *dir, const char *fn, const char *mode, char **full_path, int recursive); +FILE *pcb_fopen_at(pcb_hidlib_t *hidlib, const char *dir, const char *fn, const char *mode, char **full_path, int recursive); #include "conf.h" @@ -75,6 +80,6 @@ (or NULL on failure); the caller needs to call free() on it. If recursive is set, all subcirectories under each path is also searched for the file. */ -FILE *pcb_fopen_first(const conflist_t *paths, const char *fn, const char *mode, char **full_path, int recursive); +FILE *pcb_fopen_first(pcb_hidlib_t *hidlib, const conflist_t *paths, const char *fn, const char *mode, char **full_path, int recursive); #endif Index: trunk/src_plugins/ar_cpcb/ar_cpcb.c =================================================================== --- trunk/src_plugins/ar_cpcb/ar_cpcb.c (revision 25226) +++ trunk/src_plugins/ar_cpcb/ar_cpcb.c (revision 25227) @@ -293,7 +293,7 @@ PCB_ACT_CONVARG(1, FGW_STR, import_cpcb, fn = argv[1].val.str); - f = pcb_fopen(fn, "r"); + f = pcb_fopen(&PCB->hidlib, fn, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Can not open %s for read\n", fn); PCB_ACT_IRES(-1); @@ -320,7 +320,7 @@ PCB_ACT_CONVARG(1, FGW_STR, export_cpcb, fn = argv[1].val.str); - f = pcb_fopen(fn, "w"); + f = pcb_fopen(&PCB->hidlib, fn, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Can not open %s for write\n", fn); PCB_ACT_IRES(-1); @@ -363,7 +363,7 @@ return 0; } - f = pcb_fopen(tmpfn, "w"); + f = pcb_fopen(&PCB->hidlib, tmpfn, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Can not open temp file %s for write\n", tmpfn); PCB_ACT_IRES(-1); @@ -382,7 +382,7 @@ fclose(f); cmdline = pcb_strdup_printf("%s < %s", cmd, tmpfn); - f = pcb_popen(cmdline, "r"); + f = pcb_popen(&PCB->hidlib, cmdline, "r"); if (f != NULL) { cpcb_load(PCB, f, &stk, NULL); pclose(f); @@ -394,7 +394,7 @@ return 0; } -/* pcb_remove(tmpfn);*/ +/* pcb_remove(&PCB->hidlib, tmpfn);*/ free(cmdline); cpcb_free_nets(&nmap); return 0; Index: trunk/src_plugins/cam/cam_compile.c =================================================================== --- trunk/src_plugins/cam/cam_compile.c (revision 25226) +++ trunk/src_plugins/cam/cam_compile.c (revision 25227) @@ -55,7 +55,7 @@ next = strrchr(curr, PCB_DIR_SEPARATOR_C); if (next != NULL) *next = '\0'; - pcb_mkdir(arg, 0755); + pcb_mkdir(&PCB->hidlib, arg, 0755); if (next != NULL) { *next = PCB_DIR_SEPARATOR_C; next++; Index: trunk/src_plugins/dialogs/dlg_view.c =================================================================== --- trunk/src_plugins/dialogs/dlg_view.c (revision 25226) +++ trunk/src_plugins/dialogs/dlg_view.c (revision 25227) @@ -443,7 +443,7 @@ if (fn == NULL) return; - f = pcb_fopen(fn, "w"); + f = pcb_fopen(&PCB->hidlib, fn, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Can't open %s for write\n", fn); return; @@ -472,7 +472,7 @@ if (fn == NULL) return; - f = pcb_fopen(fn, "r"); + f = pcb_fopen(&PCB->hidlib, fn, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Can't open %s for read\n", fn); return; Index: trunk/src_plugins/export_bom/bom.c =================================================================== --- trunk/src_plugins/export_bom/bom.c (revision 25226) +++ trunk/src_plugins/export_bom/bom.c (revision 25227) @@ -239,7 +239,7 @@ } PCB_END_LOOP; - fp = pcb_fopen(bom_filename, "w"); + fp = pcb_fopen(&PCB->hidlib, bom_filename, "w"); if (!fp) { pcb_message(PCB_MSG_ERROR, "Cannot open file %s for writing\n", bom_filename); print_and_free(NULL, bom); Index: trunk/src_plugins/export_dsn/dsn.c =================================================================== --- trunk/src_plugins/export_dsn/dsn.c (revision 25226) +++ trunk/src_plugins/export_dsn/dsn.c (revision 25227) @@ -506,7 +506,7 @@ { FILE *fp; /* Print out the dsn .dsn file. */ - fp = pcb_fopen(dsn_filename, "w"); + fp = pcb_fopen(&PCB->hidlib, dsn_filename, "w"); if (!fp) { pcb_message(PCB_MSG_WARNING, "Cannot open file %s for writing\n", dsn_filename); return 1; Index: trunk/src_plugins/export_dxf/dxf.c =================================================================== --- trunk/src_plugins/export_dxf/dxf.c (revision 25226) +++ trunk/src_plugins/export_dxf/dxf.c (revision 25227) @@ -290,7 +290,7 @@ filename = "pcb.dxf"; if (dxf_cam.fn_template == NULL) { - dxf_ctx.f = pcb_fopen(dxf_cam.active ? dxf_cam.fn : filename, "wb"); + dxf_ctx.f = pcb_fopen(&PCB->hidlib, dxf_cam.active ? dxf_cam.fn : filename, "wb"); if (!dxf_ctx.f) { perror(filename); return; @@ -307,7 +307,7 @@ else { char *real_fn; dxf_ctx.temp = NULL; - real_fn = pcb_fopen_check(fn, "r"); + real_fn = pcb_fopen_check(&PCB->hidlib, fn, "r"); if (real_fn != NULL) dxf_ctx.temp = lht_dom_load(real_fn, &errmsg); free(real_fn); @@ -363,7 +363,7 @@ fclose(dxf_ctx.f); } - dxf_ctx.f = pcb_fopen(dxf_cam.fn, "wb"); + dxf_ctx.f = pcb_fopen(&PCB->hidlib, dxf_cam.fn, "wb"); if (!dxf_ctx.f) { perror(dxf_cam.fn); return 0; Index: trunk/src_plugins/export_excellon/excellon.c =================================================================== --- trunk/src_plugins/export_excellon/excellon.c (revision 25226) +++ trunk/src_plugins/export_excellon/excellon.c (revision 25227) @@ -107,7 +107,7 @@ void pcb_drill_export_excellon(pcb_board_t *pcb, pcb_drill_ctx_t *ctx, int force_g85, int coord_fmt_idx, const char *fn) { - FILE *f = pcb_fopen(fn, "wb"); /* Binary needed to force CR-LF */ + FILE *f = pcb_fopen(&PCB->hidlib, fn, "wb"); /* Binary needed to force CR-LF */ coord_format_t *cfmt; if (f == NULL) { Index: trunk/src_plugins/export_fidocadj/fidocadj.c =================================================================== --- trunk/src_plugins/export_fidocadj/fidocadj.c (revision 25226) +++ trunk/src_plugins/export_fidocadj/fidocadj.c (revision 25227) @@ -102,7 +102,7 @@ { FILE *f; char line[1024]; - f = pcb_fopen(fn, "r"); + f = pcb_fopen(&PCB->hidlib, fn, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Can't open fidocadj PCB library file '%s' for read\n", fn); return -1; @@ -193,7 +193,7 @@ if (!filename) filename = "pcb-rnd-default.fcd"; - f = pcb_fopen(filename, "w"); + f = pcb_fopen(&PCB->hidlib, filename, "w"); if (!f) { perror(filename); return; Index: trunk/src_plugins/export_gcode/gcode.c =================================================================== --- trunk/src_plugins/export_gcode/gcode.c (revision 25226) +++ trunk/src_plugins/export_gcode/gcode.c (revision 25227) @@ -317,7 +317,7 @@ /* Nelma only works with true color images */ gcode_im = gdImageCreate(w, h); - gcode_f = pcb_fopen(buf, "wb"); + gcode_f = pcb_fopen(&PCB->hidlib, buf, "wb"); gcode_alloc_colors(); @@ -452,7 +452,7 @@ BM_PUT(bm, r, c, p); } } - gcode_f2 = pcb_fopen(filename, "wb"); + gcode_f2 = pcb_fopen(&PCB->hidlib, filename, "wb"); if (!gcode_f2) { perror(filename); gds_uninit(&tmp_ln); @@ -500,7 +500,7 @@ d = 0; drill = sort_drill(drill, n_drill); sprintf(filename, "%s.drill.cnc", gcode_basename); - gcode_f2 = pcb_fopen(filename, "wb"); + gcode_f2 = pcb_fopen(&PCB->hidlib, filename, "wb"); if (!gcode_f2) { perror(filename); gds_uninit(&tmp_ln); Index: trunk/src_plugins/export_gerber/gerber.c =================================================================== --- trunk/src_plugins/export_gerber/gerber.c (revision 25226) +++ trunk/src_plugins/export_gerber/gerber.c (revision 25227) @@ -775,7 +775,7 @@ pagecount++; assign_file_suffix(filesuff, group, layer, flags, purpose, purpi, 0, NULL); if (f == NULL) { /* open a new file if we closed the previous (cam mode: only one file) */ - f = pcb_fopen(gerber_cam.active ? gerber_cam.fn : filename, "wb"); /* Binary needed to force CR-LF */ + f = pcb_fopen(&PCB->hidlib, gerber_cam.active ? gerber_cam.fn : filename, "wb"); /* Binary needed to force CR-LF */ if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Error: Could not open %s for writing.\n", filename); return 1; Index: trunk/src_plugins/export_ipcd356/ipcd356.c =================================================================== --- trunk/src_plugins/export_ipcd356/ipcd356.c (revision 25226) +++ trunk/src_plugins/export_ipcd356/ipcd356.c (revision 25227) @@ -451,7 +451,7 @@ if (fn == NULL) fn = "pcb-rnd-out.net"; - f = pcb_fopen(fn, "w"); + f = pcb_fopen(&PCB->hidlib, fn, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Can't open %s for write\n", fn); return; Index: trunk/src_plugins/export_lpr/lpr.c =================================================================== --- trunk/src_plugins/export_lpr/lpr.c (revision 25226) +++ trunk/src_plugins/export_lpr/lpr.c (revision 25227) @@ -82,7 +82,7 @@ filename = options[HA_lprcommand].str_value; printf("LPR: open %s\n", filename); - f = pcb_popen(filename, "w"); + f = pcb_popen(NULL, filename, "w"); if (!f) { perror(filename); return; Index: trunk/src_plugins/export_oldconn/oldconn.c =================================================================== --- trunk/src_plugins/export_oldconn/oldconn.c (revision 25226) +++ trunk/src_plugins/export_oldconn/oldconn.c (revision 25227) @@ -249,7 +249,7 @@ if (response != 1) return NULL; } - if ((fp = pcb_fopen(Filename, "w")) == NULL) + if ((fp = pcb_fopen(&PCB->hidlib, Filename, "w")) == NULL) pcb_open_error_message(Filename); } return fp; Index: trunk/src_plugins/export_openems/export_openems.c =================================================================== --- trunk/src_plugins/export_openems/export_openems.c (revision 25226) +++ trunk/src_plugins/export_openems/export_openems.c (revision 25227) @@ -650,7 +650,7 @@ if (!filename) filename = "pcb.m"; - f = pcb_fopen(filename, "wb"); + f = pcb_fopen(&PCB->hidlib, filename, "wb"); if (!f) { perror(filename); return; @@ -664,7 +664,7 @@ if (strcmp(end, ".m") != 0) end = runfn + len; strcpy(end, ".sim.m"); - fsim = pcb_fopen(runfn, "wb"); + fsim = pcb_fopen(&PCB->hidlib, runfn, "wb"); if (fsim == NULL) { perror(runfn); return; Index: trunk/src_plugins/export_openems/mesh.c =================================================================== --- trunk/src_plugins/export_openems/mesh.c (revision 25226) +++ trunk/src_plugins/export_openems/mesh.c (revision 25227) @@ -966,7 +966,7 @@ default_file = pcb_strdup(fname); } - f = pcb_fopen(fname, "w"); + f = pcb_fopen(&PCB->hidlib, fname, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Can not open '%s' for write\n", fname); return; @@ -998,7 +998,7 @@ default_file = pcb_strdup(fname); } - f = pcb_fopen(fname, "r"); + f = pcb_fopen(&PCB->hidlib, fname, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Can not open '%s' for read\n", fname); return; Index: trunk/src_plugins/export_openscad/export_openscad.c =================================================================== --- trunk/src_plugins/export_openscad/export_openscad.c (revision 25226) +++ trunk/src_plugins/export_openscad/export_openscad.c (revision 25227) @@ -310,7 +310,7 @@ if (!filename) filename = "pcb.openscad"; - f = pcb_fopen(filename, "wb"); + f = pcb_fopen(&PCB->hidlib, filename, "wb"); if (!f) { perror(filename); return; @@ -602,7 +602,7 @@ PCB_ACT_CONVARG(1, FGW_STR, scad_export_poly, name = argv[1].val.str); - f = pcb_fopen(name, "w"); + f = pcb_fopen(&PCB->hidlib, name, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Failed to open %s for writing\n", name); PCB_ACT_IRES(-1); Index: trunk/src_plugins/export_openscad/scad_models.c =================================================================== --- trunk/src_plugins/export_openscad/scad_models.c (revision 25226) +++ trunk/src_plugins/export_openscad/scad_models.c (revision 25227) @@ -33,7 +33,7 @@ if (!htsp_has(models, name)) { char buff[1024], *full_path; - fin = pcb_fopen_first(&conf_core.rc.library_search_paths, name, "r", &full_path, pcb_true); + fin = pcb_fopen_first(&PCB->hidlib, &conf_core.rc.library_search_paths, name, "r", &full_path, pcb_true); if (fin != NULL) { char *s, *safe_name = pcb_strdup(name); Index: trunk/src_plugins/export_png/png.c =================================================================== --- trunk/src_plugins/export_png/png.c (revision 25226) +++ trunk/src_plugins/export_png/png.c (revision 25227) @@ -1147,7 +1147,7 @@ } if (!png_cam.fn_template) { - f = pcb_fopen(png_cam.active ? png_cam.fn : filename, "wb"); + f = pcb_fopen(&PCB->hidlib, png_cam.active ? png_cam.fn : filename, "wb"); if (!f) { perror(filename); return; @@ -1314,7 +1314,7 @@ png_foot(); fclose(f); } - f = pcb_fopen(png_cam.fn, "wb"); + f = pcb_fopen(&PCB->hidlib, png_cam.fn, "wb"); if (!f) { perror(filename); return 0; Index: trunk/src_plugins/export_ps/eps.c =================================================================== --- trunk/src_plugins/export_ps/eps.c (revision 25226) +++ trunk/src_plugins/export_ps/eps.c (revision 25227) @@ -352,7 +352,7 @@ filename = "pcb-out.eps"; if (eps_cam.fn_template == NULL) { - f = pcb_fopen(eps_cam.active ? eps_cam.fn : filename, "w"); + f = pcb_fopen(&PCB->hidlib, eps_cam.active ? eps_cam.fn : filename, "w"); if (!f) { perror(filename); return; @@ -398,7 +398,7 @@ eps_print_footer(f); fclose(f); } - f = pcb_fopen(eps_cam.fn, "w"); + f = pcb_fopen(&PCB->hidlib, eps_cam.fn, "w"); eps_print_header(f, eps_cam.fn); } Index: trunk/src_plugins/export_ps/ps.c =================================================================== --- trunk/src_plugins/export_ps/ps.c (revision 25226) +++ trunk/src_plugins/export_ps/ps.c (revision 25227) @@ -502,7 +502,7 @@ return NULL; if (!global.multi_file) - return pcb_fopen(base, "w"); + return pcb_fopen(&PCB->hidlib, base, "w"); buf = (char *) malloc(strlen(base) + strlen(which) + 5); @@ -515,7 +515,7 @@ else { sprintf(buf, "%s.%s.ps", base, which); } - ps_open_file = pcb_fopen(buf, "w"); + ps_open_file = pcb_fopen(&PCB->hidlib, buf, "w"); free(buf); return ps_open_file; } @@ -1399,11 +1399,11 @@ const char *cmd = vals[0].str_value; while (*cmd == ' ' || *cmd == '|') cmd++; - ps_cal_file = pcb_popen(cmd, "w"); + ps_cal_file = pcb_popen(&PCB->hidlib, cmd, "w"); used_popen = 1; } else - ps_cal_file = pcb_fopen(vals[0].str_value, "w"); + ps_cal_file = pcb_fopen(&PCB->hidlib, vals[0].str_value, "w"); for (c = 0; calib_lines[c]; c++) fputs(calib_lines[c], ps_cal_file); Index: trunk/src_plugins/export_stat/stat.c =================================================================== --- trunk/src_plugins/export_stat/stat.c (revision 25226) +++ trunk/src_plugins/export_stat/stat.c (revision 25227) @@ -154,7 +154,7 @@ if (!filename) filename = "pcb.stat.lht"; - f = pcb_fopen(filename, "w"); + f = pcb_fopen(&PCB->hidlib, filename, "w"); if (!f) { perror(filename); return; Index: trunk/src_plugins/export_svg/svg.c =================================================================== --- trunk/src_plugins/export_svg/svg.c (revision 25226) +++ trunk/src_plugins/export_svg/svg.c (revision 25227) @@ -334,7 +334,7 @@ if (!filename) filename = "pcb.svg"; - f = pcb_fopen(svg_cam.active ? svg_cam.fn : filename, "wb"); + f = pcb_fopen(&PCB->hidlib, svg_cam.active ? svg_cam.fn : filename, "wb"); if (!f) { perror(filename); return; @@ -384,7 +384,7 @@ fclose(f); } - f = pcb_fopen(svg_cam.fn, "wb"); + f = pcb_fopen(&PCB->hidlib, svg_cam.fn, "wb"); if (f == NULL) { perror(svg_cam.fn); return 0; Index: trunk/src_plugins/export_xy/xy.c =================================================================== --- trunk/src_plugins/export_xy/xy.c (revision 25226) +++ trunk/src_plugins/export_xy/xy.c (revision 25227) @@ -652,7 +652,7 @@ FILE *fp; subst_ctx_t ctx; - fp = pcb_fopen(xy_filename, "w"); + fp = pcb_fopen(&PCB->hidlib, xy_filename, "w"); if (!fp) { pcb_message(PCB_MSG_ERROR, "Cannot open file %s for writing\n", xy_filename); return 1; Index: trunk/src_plugins/extedit/extedit.c =================================================================== --- trunk/src_plugins/extedit/extedit.c (revision 25226) +++ trunk/src_plugins/extedit/extedit.c (revision 25227) @@ -120,7 +120,7 @@ /* Don't use pcb_system() because that blocks the current process and the GUI toolkit won't have a chance to handle expose events */ - fc = pcb_popen(cmd, "r"); + fc = pcb_popen(&PCB->hidlib, cmd, "r"); if (pcb_gui != NULL) { int fd = pcb_fileno(fc); @@ -261,7 +261,7 @@ switch(mth->fmt) { case EEF_LIHATA: { - f = pcb_fopen(tmp_fn, "w"); + f = pcb_fopen(&PCB->hidlib, tmp_fn, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Failed to open temporary file\n"); goto quit1; Index: trunk/src_plugins/fp_fs/fp_fs.c =================================================================== --- trunk/src_plugins/fp_fs/fp_fs.c (revision 25226) +++ trunk/src_plugins/fp_fs/fp_fs.c (revision 25227) @@ -228,7 +228,7 @@ 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))) { + if ((is_root) && (!pcb_is_dir(&PCB->hidlib, working))) { free(working); return -1; } @@ -373,7 +373,7 @@ if (tags != NULL) *tags = NULL; - f = pcb_fopen(fn, "r"); + f = pcb_fopen(&PCB->hidlib, fn, "r"); if (f == NULL) return PCB_FP_INVALID; @@ -516,11 +516,11 @@ sprintf(cmd, "%s%s%s %s", libshell, sep, fullname, params); /*fprintf(stderr, " cmd=%s\n", cmd);*/ fctx->field[F_TMPNAME].p = pcb_tempfile_name_new("pcb-rnd-pfp"); - f = pcb_fopen((char *)fctx->field[F_TMPNAME].p, "w+"); + f = pcb_fopen(&PCB->hidlib, (char *)fctx->field[F_TMPNAME].p, "w+"); if (f != NULL) { char buff[4096]; int len; - fp = pcb_popen(cmd, "r"); + fp = pcb_popen(&PCB->hidlib, cmd, "r"); while((len = fread(buff, 1, sizeof(buff), fp)) > 0) fwrite(buff, 1, len, f); pcb_pclose(fp); @@ -529,7 +529,7 @@ free(cmd); } else - f = pcb_fopen(fullname, "r"); + f = pcb_fopen(&PCB->hidlib, fullname, "r"); free(fullname); } Index: trunk/src_plugins/fp_wget/edakrill.c =================================================================== --- trunk/src_plugins/fp_wget/edakrill.c (revision 25226) +++ trunk/src_plugins/fp_wget/edakrill.c (revision 25227) @@ -170,7 +170,7 @@ if (md5_new == NULL) goto err; - f = pcb_fopen(last_sum_fn, "r"); + f = pcb_fopen(NULL, last_sum_fn, "r"); md5_last = load_md5_sum(f); if (f != NULL) fclose(f); @@ -186,7 +186,7 @@ if (fp_wget_open(url_idx_list, conf_fp_wget.plugins.fp_wget.cache_dir, &f, &fctx, mode) != 0) { pcb_message(PCB_MSG_ERROR, "edakrill: failed to download the new list\n"); - pcb_remove(last_sum_fn); /* make sure it is downloaded next time */ + pcb_remove(NULL, last_sum_fn); /* make sure it is downloaded next time */ goto err; } Index: trunk/src_plugins/fp_wget/gedasymbols.c =================================================================== --- trunk/src_plugins/fp_wget/gedasymbols.c (revision 25226) +++ trunk/src_plugins/fp_wget/gedasymbols.c (revision 25227) @@ -91,7 +91,7 @@ if (md5_new == NULL) goto err; - f = pcb_fopen(last_sum_fn, "r"); + f = pcb_fopen(NULL, last_sum_fn, "r"); md5_last = load_md5_sum(f); if (f != NULL) fclose(f); @@ -107,7 +107,7 @@ if (fp_wget_open(url_idx_list, conf_fp_wget.plugins.fp_wget.cache_dir, &f, &fctx, mode) != 0) { pcb_message(PCB_MSG_ERROR, "gedasymbols: failed to download the new list\n"); - pcb_remove(last_sum_fn); /* make sure it is downloaded next time */ + pcb_remove(NULL, last_sum_fn); /* make sure it is downloaded next time */ goto err; } Index: trunk/src_plugins/fp_wget/wget_common.c =================================================================== --- trunk/src_plugins/fp_wget/wget_common.c (revision 25226) +++ trunk/src_plugins/fp_wget/wget_common.c (revision 25227) @@ -47,7 +47,7 @@ /* TODO */ char buff[8192]; sprintf(buff, "mkdir -p '%s'", dir); - return pcb_system(buff); + return pcb_system(NULL, buff); } int fp_wget_open(const char *url, const char *cache_path, FILE **f, int *fctx, fp_get_mode mode) @@ -69,7 +69,7 @@ if (f == NULL) goto error; if (!fp_wget_offline) - *f = pcb_popen(cmd, "r"); + *f = pcb_popen(NULL, cmd, "r"); if (*f == NULL) goto error; *fctx = FCTX_POPEN; @@ -96,17 +96,17 @@ if ((!fp_wget_offline) && !(mode & FP_WGET_OFFLINE)) { int res; sprintf(cmd, "%s -O '%s/%s' %s '%s'", wget_cmd, cache_path, cdir, upds, url); - res = pcb_system(cmd); + res = pcb_system(NULL, cmd); /* pcb_trace("------res=%d\n", res); */ if ((res != 0) && (res != 768)) { /* some versions of wget will return error on -c if the file doesn't need update; try to guess whether it's really an error */ /* when wget fails, a 0-long file might be left there - remove it so it won't block new downloads */ sprintf(cmd, "%s/%s", cache_path, cdir); - pcb_remove(cmd); + pcb_remove(NULL, cmd); } } if (f != NULL) { sprintf(cmd, "%s/%s", cache_path, cdir); - *f = pcb_fopen(cmd, "r"); + *f = pcb_fopen(NULL, cmd, "r"); if (*f == NULL) goto error; *fctx = FCTX_FOPEN; @@ -175,7 +175,7 @@ if ((md5_last == NULL) || (strcmp(md5_last, md5_new) != 0)) { FILE *f; - f = pcb_fopen(last_fn, "w"); + f = pcb_fopen(NULL, last_fn, "w"); fputs(md5_new, f); fclose(f); changed = 1; Index: trunk/src_plugins/hid_lesstif/main.c =================================================================== --- trunk/src_plugins/hid_lesstif/main.c (revision 25226) +++ trunk/src_plugins/hid_lesstif/main.c (revision 25227) @@ -675,7 +675,7 @@ void LoadBackgroundImage(char *filename) { - FILE *f = pcb_fopen(filename, "rb"); + FILE *f = pcb_fopen(ltf_hidlib, filename, "rb"); if (!f) { if (PCB_NSTRCMP(filename, "pcb-background.ppm")) perror(filename); Index: trunk/src_plugins/import_calay/calay.c =================================================================== --- trunk/src_plugins/import_calay/calay.c (revision 25226) +++ trunk/src_plugins/import_calay/calay.c (revision 25227) @@ -171,7 +171,7 @@ FILE *f; int ret = 0; - f = pcb_fopen(fname_net, "r"); + f = pcb_fopen(&PCB->hidlib, fname_net, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "can't open calay netlist file '%s' for read\n", fname_net); return -1; @@ -179,7 +179,7 @@ ret = calay_parse_net(f); fclose(f); - f = pcb_fopen(fname_cmp, "r"); + f = pcb_fopen(&PCB->hidlib, fname_cmp, "r"); if (f == NULL) pcb_message(PCB_MSG_ERROR, "can't open calay component file '%s' for read\n(non-fatal, but footprints will not be placed)\n", fname_cmp); Index: trunk/src_plugins/import_dsn/dsn.c =================================================================== --- trunk/src_plugins/import_dsn/dsn.c (revision 25226) +++ trunk/src_plugins/import_dsn/dsn.c (revision 25227) @@ -229,7 +229,7 @@ } /* load and parse the file into a dom tree */ - f = pcb_fopen(fname, "r"); + f = pcb_fopen(&PCB->hidlib, fname, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "import_dsn: can't open %s for read\n", fname); return 1; Index: trunk/src_plugins/import_edif/edif.c =================================================================== --- trunk/src_plugins/import_edif/edif.c (revision 25226) +++ trunk/src_plugins/import_edif/edif.c (revision 25227) @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.3.2. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,11 +41,14 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.2" +#define YYBISON_VERSION "3.3.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -69,8 +73,8 @@ #define yylval ediflval #define yychar edifchar -/* Copy the first part of user declarations. */ -#line 1 "edif.y" /* yacc.c:339 */ +/* First part of user prologue. */ +#line 1 "edif.y" /* yacc.c:337 */ /* * PCB Edif parser based heavily on: @@ -263,13 +267,16 @@ static void yyerror(const char *); static void PopC(void); -#line 267 "edif.c" /* yacc.c:339 */ - +#line 271 "edif.c" /* yacc.c:337 */ # ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif # else -# define YY_NULLPTR 0 +# define YY_NULLPTR ((void*)0) # endif # endif @@ -595,17 +602,19 @@ /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; + union YYSTYPE { -#line 196 "edif.y" /* yacc.c:355 */ +#line 196 "edif.y" /* yacc.c:352 */ char* s; pair_list* pl; str_pair* ps; -#line 608 "edif.c" /* yacc.c:355 */ +#line 615 "edif.c" /* yacc.c:352 */ }; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif @@ -617,9 +626,7 @@ #endif /* !YY_EDIF_EDIF_H_INCLUDED */ -/* Copy the second part of user declarations. */ -#line 623 "edif.c" /* yacc.c:358 */ #ifdef short # undef short @@ -640,13 +647,13 @@ #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else -typedef unsigned short int yytype_uint16; +typedef unsigned short yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else -typedef short int yytype_int16; +typedef short yytype_int16; #endif #ifndef YYSIZE_T @@ -658,7 +665,7 @@ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif @@ -694,15 +701,6 @@ # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) #endif -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) -# endif -#endif - /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) @@ -710,7 +708,7 @@ # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ @@ -872,16 +870,16 @@ /* YYNSTATES -- Number of states. */ #define YYNSTATES 1626 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 549 +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ + as returned by yylex. */ static const yytype_uint16 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -2704,22 +2702,22 @@ #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) /* Error token number */ #define YYTERROR 1 @@ -2759,37 +2757,37 @@ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { - FILE *yyo = yyoutput; - YYUSE (yyo); + FILE *yyoutput = yyo; + YYUSE (yyoutput); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { - YYFPRINTF (yyoutput, "%s %s (", + YYFPRINTF (yyo, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); + yy_symbol_value_print (yyo, yytype, yyvaluep); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -2823,7 +2821,7 @@ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { - unsigned long int yylno = yyrline[yyrule]; + unsigned long yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", @@ -2834,7 +2832,7 @@ YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) + &yyvsp[(yyi + 1) - (yynrhs)] ); YYFPRINTF (stderr, "\n"); } @@ -2938,7 +2936,10 @@ case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - /* Fall through. */ + else + goto append; + + append: default: if (yyres) yyres[yyn] = *yyp; @@ -2956,7 +2957,7 @@ if (! yyres) return yystrlen (yystr); - return yystpcpy (yyres, yystr) - yyres; + return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); } # endif @@ -3034,10 +3035,10 @@ yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } } } @@ -3049,6 +3050,7 @@ case N: \ yyformat = S; \ break + default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); @@ -3060,9 +3062,10 @@ { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } if (*yymsg_alloc < yysize) @@ -3188,23 +3191,31 @@ yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; +/*--------------------------------------------------------------------. +| yynewstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + *yyssp = (yytype_int16) yystate; + if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); -#ifdef yyoverflow +# if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into @@ -3220,14 +3231,10 @@ &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); - yyss = yyss1; yyvs = yyvs1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -3243,22 +3250,22 @@ goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -3267,11 +3274,11 @@ goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -3344,7 +3351,7 @@ /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -3365,541 +3372,541 @@ switch (yyn) { case 2: -#line 508 "edif.y" /* yacc.c:1646 */ +#line 508 "edif.y" /* yacc.c:1652 */ { PopC(); } -#line 3371 "edif.c" /* yacc.c:1646 */ +#line 3378 "edif.c" /* yacc.c:1652 */ break; case 11: -#line 523 "edif.y" /* yacc.c:1646 */ +#line 523 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3377 "edif.c" /* yacc.c:1646 */ +#line 3384 "edif.c" /* yacc.c:1652 */ break; case 12: -#line 526 "edif.y" /* yacc.c:1646 */ +#line 526 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-1].s)); } -#line 3383 "edif.c" /* yacc.c:1646 */ +#line 3390 "edif.c" /* yacc.c:1652 */ break; case 13: -#line 530 "edif.y" /* yacc.c:1646 */ +#line 530 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-3].s)); free((yyvsp[-2].s)); free((yyvsp[-1].s)); } -#line 3389 "edif.c" /* yacc.c:1646 */ +#line 3396 "edif.c" /* yacc.c:1652 */ break; case 25: -#line 554 "edif.y" /* yacc.c:1646 */ +#line 554 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3395 "edif.c" /* yacc.c:1646 */ +#line 3402 "edif.c" /* yacc.c:1652 */ break; case 34: -#line 571 "edif.y" /* yacc.c:1646 */ +#line 571 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[-3].ps)); free((yyvsp[-2].s)); } -#line 3401 "edif.c" /* yacc.c:1646 */ +#line 3408 "edif.c" /* yacc.c:1652 */ break; case 36: -#line 575 "edif.y" /* yacc.c:1646 */ +#line 575 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3407 "edif.c" /* yacc.c:1646 */ +#line 3414 "edif.c" /* yacc.c:1652 */ break; case 47: -#line 600 "edif.y" /* yacc.c:1646 */ +#line 600 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-1].s)); } -#line 3413 "edif.c" /* yacc.c:1646 */ +#line 3420 "edif.c" /* yacc.c:1652 */ break; case 69: -#line 648 "edif.y" /* yacc.c:1646 */ +#line 648 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-3].s)); free((yyvsp[-2].s)); } -#line 3419 "edif.c" /* yacc.c:1646 */ +#line 3426 "edif.c" /* yacc.c:1652 */ break; case 70: -#line 651 "edif.y" /* yacc.c:1646 */ +#line 651 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-1].s)); } -#line 3425 "edif.c" /* yacc.c:1646 */ +#line 3432 "edif.c" /* yacc.c:1652 */ break; case 80: -#line 669 "edif.y" /* yacc.c:1646 */ +#line 669 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3431 "edif.c" /* yacc.c:1646 */ +#line 3438 "edif.c" /* yacc.c:1652 */ break; case 84: -#line 679 "edif.y" /* yacc.c:1646 */ +#line 679 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3437 "edif.c" /* yacc.c:1646 */ +#line 3444 "edif.c" /* yacc.c:1652 */ break; case 91: -#line 694 "edif.y" /* yacc.c:1646 */ +#line 694 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3443 "edif.c" /* yacc.c:1646 */ +#line 3450 "edif.c" /* yacc.c:1652 */ break; case 102: -#line 717 "edif.y" /* yacc.c:1646 */ +#line 717 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3449 "edif.c" /* yacc.c:1646 */ +#line 3456 "edif.c" /* yacc.c:1652 */ break; case 140: -#line 777 "edif.y" /* yacc.c:1646 */ +#line 777 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3455 "edif.c" /* yacc.c:1646 */ +#line 3462 "edif.c" /* yacc.c:1652 */ break; case 147: -#line 792 "edif.y" /* yacc.c:1646 */ +#line 792 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-2].s)); } -#line 3461 "edif.c" /* yacc.c:1646 */ +#line 3468 "edif.c" /* yacc.c:1652 */ break; case 150: -#line 799 "edif.y" /* yacc.c:1646 */ +#line 799 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-2].s)); } -#line 3467 "edif.c" /* yacc.c:1646 */ +#line 3474 "edif.c" /* yacc.c:1652 */ break; case 182: -#line 869 "edif.y" /* yacc.c:1646 */ +#line 869 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3473 "edif.c" /* yacc.c:1646 */ +#line 3480 "edif.c" /* yacc.c:1652 */ break; case 184: -#line 873 "edif.y" /* yacc.c:1646 */ +#line 873 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3479 "edif.c" /* yacc.c:1646 */ +#line 3486 "edif.c" /* yacc.c:1652 */ break; case 240: -#line 977 "edif.y" /* yacc.c:1646 */ +#line 977 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3485 "edif.c" /* yacc.c:1646 */ +#line 3492 "edif.c" /* yacc.c:1652 */ break; case 247: -#line 990 "edif.y" /* yacc.c:1646 */ +#line 990 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3491 "edif.c" /* yacc.c:1646 */ +#line 3498 "edif.c" /* yacc.c:1652 */ break; case 278: -#line 1037 "edif.y" /* yacc.c:1646 */ +#line 1037 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3497 "edif.c" /* yacc.c:1646 */ +#line 3504 "edif.c" /* yacc.c:1652 */ break; case 279: -#line 1040 "edif.y" /* yacc.c:1646 */ +#line 1040 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3503 "edif.c" /* yacc.c:1646 */ +#line 3510 "edif.c" /* yacc.c:1652 */ break; case 333: -#line 1126 "edif.y" /* yacc.c:1646 */ +#line 1126 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-3].s)); free((yyvsp[-2].s)); } -#line 3509 "edif.c" /* yacc.c:1646 */ +#line 3516 "edif.c" /* yacc.c:1652 */ break; case 336: -#line 1133 "edif.y" /* yacc.c:1646 */ +#line 1133 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3515 "edif.c" /* yacc.c:1646 */ +#line 3522 "edif.c" /* yacc.c:1652 */ break; case 337: -#line 1136 "edif.y" /* yacc.c:1646 */ +#line 1136 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3521 "edif.c" /* yacc.c:1646 */ +#line 3528 "edif.c" /* yacc.c:1652 */ break; case 344: -#line 1149 "edif.y" /* yacc.c:1646 */ +#line 1149 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-2].s)); } -#line 3527 "edif.c" /* yacc.c:1646 */ +#line 3534 "edif.c" /* yacc.c:1652 */ break; case 346: -#line 1153 "edif.y" /* yacc.c:1646 */ +#line 1153 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3533 "edif.c" /* yacc.c:1646 */ +#line 3540 "edif.c" /* yacc.c:1652 */ break; case 347: -#line 1154 "edif.y" /* yacc.c:1646 */ +#line 1154 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3539 "edif.c" /* yacc.c:1646 */ +#line 3546 "edif.c" /* yacc.c:1652 */ break; case 348: -#line 1155 "edif.y" /* yacc.c:1646 */ +#line 1155 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3545 "edif.c" /* yacc.c:1646 */ +#line 3552 "edif.c" /* yacc.c:1652 */ break; case 369: -#line 1196 "edif.y" /* yacc.c:1646 */ +#line 1196 "edif.y" /* yacc.c:1652 */ { (yyval.s)=(yyvsp[-2].s); } -#line 3551 "edif.c" /* yacc.c:1646 */ +#line 3558 "edif.c" /* yacc.c:1652 */ break; case 371: -#line 1200 "edif.y" /* yacc.c:1646 */ +#line 1200 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3557 "edif.c" /* yacc.c:1646 */ +#line 3564 "edif.c" /* yacc.c:1652 */ break; case 374: -#line 1207 "edif.y" /* yacc.c:1646 */ +#line 1207 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3563 "edif.c" /* yacc.c:1646 */ +#line 3570 "edif.c" /* yacc.c:1652 */ break; case 381: -#line 1218 "edif.y" /* yacc.c:1646 */ +#line 1218 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3569 "edif.c" /* yacc.c:1646 */ +#line 3576 "edif.c" /* yacc.c:1652 */ break; case 384: -#line 1225 "edif.y" /* yacc.c:1646 */ +#line 1225 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3575 "edif.c" /* yacc.c:1646 */ +#line 3582 "edif.c" /* yacc.c:1652 */ break; case 388: -#line 1231 "edif.y" /* yacc.c:1646 */ +#line 1231 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3581 "edif.c" /* yacc.c:1646 */ +#line 3588 "edif.c" /* yacc.c:1652 */ break; case 390: -#line 1235 "edif.y" /* yacc.c:1646 */ +#line 1235 "edif.y" /* yacc.c:1652 */ { (yyval.s)=(yyvsp[0].s); } -#line 3587 "edif.c" /* yacc.c:1646 */ +#line 3594 "edif.c" /* yacc.c:1652 */ break; case 393: -#line 1242 "edif.y" /* yacc.c:1646 */ +#line 1242 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3593 "edif.c" /* yacc.c:1646 */ +#line 3600 "edif.c" /* yacc.c:1652 */ break; case 397: -#line 1250 "edif.y" /* yacc.c:1646 */ +#line 1250 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3599 "edif.c" /* yacc.c:1646 */ +#line 3606 "edif.c" /* yacc.c:1652 */ break; case 408: -#line 1265 "edif.y" /* yacc.c:1646 */ +#line 1265 "edif.y" /* yacc.c:1652 */ { pair_list_free((yyvsp[0].pl)); } -#line 3605 "edif.c" /* yacc.c:1646 */ +#line 3612 "edif.c" /* yacc.c:1652 */ break; case 437: -#line 1315 "edif.y" /* yacc.c:1646 */ +#line 1315 "edif.y" /* yacc.c:1652 */ { (yyval.pl) = new_pair_list((yyvsp[-1].ps)); } -#line 3611 "edif.c" /* yacc.c:1646 */ +#line 3618 "edif.c" /* yacc.c:1652 */ break; case 438: -#line 1318 "edif.y" /* yacc.c:1646 */ +#line 1318 "edif.y" /* yacc.c:1652 */ { (yyval.ps)=NULL; } -#line 3617 "edif.c" /* yacc.c:1646 */ +#line 3624 "edif.c" /* yacc.c:1652 */ break; case 439: -#line 1319 "edif.y" /* yacc.c:1646 */ +#line 1319 "edif.y" /* yacc.c:1652 */ { (yyvsp[0].ps)->next = (yyvsp[-1].ps); (yyval.ps) = (yyvsp[0].ps); } -#line 3623 "edif.c" /* yacc.c:1646 */ +#line 3630 "edif.c" /* yacc.c:1652 */ break; case 455: -#line 1345 "edif.y" /* yacc.c:1646 */ +#line 1345 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-1].s)); } -#line 3629 "edif.c" /* yacc.c:1646 */ +#line 3636 "edif.c" /* yacc.c:1652 */ break; case 459: -#line 1355 "edif.y" /* yacc.c:1646 */ +#line 1355 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3635 "edif.c" /* yacc.c:1646 */ +#line 3642 "edif.c" /* yacc.c:1652 */ break; case 460: -#line 1358 "edif.y" /* yacc.c:1646 */ +#line 1358 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3641 "edif.c" /* yacc.c:1646 */ +#line 3648 "edif.c" /* yacc.c:1652 */ break; case 462: -#line 1364 "edif.y" /* yacc.c:1646 */ +#line 1364 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3647 "edif.c" /* yacc.c:1646 */ +#line 3654 "edif.c" /* yacc.c:1652 */ break; case 463: -#line 1367 "edif.y" /* yacc.c:1646 */ +#line 1367 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3653 "edif.c" /* yacc.c:1646 */ +#line 3660 "edif.c" /* yacc.c:1652 */ break; case 483: -#line 1409 "edif.y" /* yacc.c:1646 */ +#line 1409 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3659 "edif.c" /* yacc.c:1646 */ +#line 3666 "edif.c" /* yacc.c:1652 */ break; case 484: -#line 1412 "edif.y" /* yacc.c:1646 */ +#line 1412 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3665 "edif.c" /* yacc.c:1646 */ +#line 3672 "edif.c" /* yacc.c:1652 */ break; case 492: -#line 1426 "edif.y" /* yacc.c:1646 */ +#line 1426 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3671 "edif.c" /* yacc.c:1646 */ +#line 3678 "edif.c" /* yacc.c:1652 */ break; case 506: -#line 1454 "edif.y" /* yacc.c:1646 */ +#line 1454 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3677 "edif.c" /* yacc.c:1646 */ +#line 3684 "edif.c" /* yacc.c:1652 */ break; case 507: -#line 1457 "edif.y" /* yacc.c:1646 */ +#line 1457 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3683 "edif.c" /* yacc.c:1646 */ +#line 3690 "edif.c" /* yacc.c:1652 */ break; case 514: -#line 1472 "edif.y" /* yacc.c:1646 */ +#line 1472 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3689 "edif.c" /* yacc.c:1646 */ +#line 3696 "edif.c" /* yacc.c:1652 */ break; case 549: -#line 1527 "edif.y" /* yacc.c:1646 */ +#line 1527 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3695 "edif.c" /* yacc.c:1646 */ +#line 3702 "edif.c" /* yacc.c:1652 */ break; case 555: -#line 1539 "edif.y" /* yacc.c:1646 */ +#line 1539 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3701 "edif.c" /* yacc.c:1646 */ +#line 3708 "edif.c" /* yacc.c:1652 */ break; case 560: -#line 1548 "edif.y" /* yacc.c:1646 */ +#line 1548 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-2].s)); } -#line 3707 "edif.c" /* yacc.c:1646 */ +#line 3714 "edif.c" /* yacc.c:1652 */ break; case 561: -#line 1551 "edif.y" /* yacc.c:1646 */ +#line 1551 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3713 "edif.c" /* yacc.c:1646 */ +#line 3720 "edif.c" /* yacc.c:1652 */ break; case 562: -#line 1552 "edif.y" /* yacc.c:1646 */ +#line 1552 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3719 "edif.c" /* yacc.c:1646 */ +#line 3726 "edif.c" /* yacc.c:1652 */ break; case 582: -#line 1594 "edif.y" /* yacc.c:1646 */ +#line 1594 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3725 "edif.c" /* yacc.c:1646 */ +#line 3732 "edif.c" /* yacc.c:1652 */ break; case 585: -#line 1597 "edif.y" /* yacc.c:1646 */ +#line 1597 "edif.y" /* yacc.c:1652 */ { pair_list_free((yyvsp[0].pl)); } -#line 3731 "edif.c" /* yacc.c:1646 */ +#line 3738 "edif.c" /* yacc.c:1652 */ break; case 586: -#line 1600 "edif.y" /* yacc.c:1646 */ +#line 1600 "edif.y" /* yacc.c:1652 */ { (yyval.s)=(yyvsp[-1].s); } -#line 3737 "edif.c" /* yacc.c:1646 */ +#line 3744 "edif.c" /* yacc.c:1652 */ break; case 587: -#line 1603 "edif.y" /* yacc.c:1646 */ +#line 1603 "edif.y" /* yacc.c:1652 */ { (yyval.s)=(yyvsp[0].s); } -#line 3743 "edif.c" /* yacc.c:1646 */ +#line 3750 "edif.c" /* yacc.c:1652 */ break; case 589: -#line 1607 "edif.y" /* yacc.c:1646 */ +#line 1607 "edif.y" /* yacc.c:1652 */ { (yyval.ps) = new_str_pair((yyvsp[0].s),NULL); } -#line 3749 "edif.c" /* yacc.c:1646 */ +#line 3756 "edif.c" /* yacc.c:1652 */ break; case 590: -#line 1608 "edif.y" /* yacc.c:1646 */ +#line 1608 "edif.y" /* yacc.c:1652 */ { (yyval.ps) = new_str_pair((yyvsp[0].s),NULL); } -#line 3755 "edif.c" /* yacc.c:1646 */ +#line 3762 "edif.c" /* yacc.c:1652 */ break; case 591: -#line 1609 "edif.y" /* yacc.c:1646 */ +#line 1609 "edif.y" /* yacc.c:1652 */ { (yyval.ps)=(yyvsp[0].ps); } -#line 3761 "edif.c" /* yacc.c:1646 */ +#line 3768 "edif.c" /* yacc.c:1652 */ break; case 592: -#line 1612 "edif.y" /* yacc.c:1646 */ +#line 1612 "edif.y" /* yacc.c:1652 */ { (yyval.s)=(yyvsp[0].s); } -#line 3767 "edif.c" /* yacc.c:1646 */ +#line 3774 "edif.c" /* yacc.c:1652 */ break; case 593: -#line 1613 "edif.y" /* yacc.c:1646 */ +#line 1613 "edif.y" /* yacc.c:1652 */ { (yyval.s)=(yyvsp[0].s); } -#line 3773 "edif.c" /* yacc.c:1646 */ +#line 3780 "edif.c" /* yacc.c:1652 */ break; case 594: -#line 1616 "edif.y" /* yacc.c:1646 */ +#line 1616 "edif.y" /* yacc.c:1652 */ { define_pcb_net((yyvsp[-2].ps), (yyvsp[-1].pl)); } -#line 3779 "edif.c" /* yacc.c:1646 */ +#line 3786 "edif.c" /* yacc.c:1652 */ break; case 595: -#line 1619 "edif.y" /* yacc.c:1646 */ +#line 1619 "edif.y" /* yacc.c:1652 */ { (yyval.pl)=(yyvsp[0].pl); } -#line 3785 "edif.c" /* yacc.c:1646 */ +#line 3792 "edif.c" /* yacc.c:1652 */ break; case 611: -#line 1641 "edif.y" /* yacc.c:1646 */ +#line 1641 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[-2].ps)); } -#line 3791 "edif.c" /* yacc.c:1646 */ +#line 3798 "edif.c" /* yacc.c:1652 */ break; case 632: -#line 1678 "edif.y" /* yacc.c:1646 */ +#line 1678 "edif.y" /* yacc.c:1652 */ { (yyval.ps)=(yyvsp[0].ps); } -#line 3797 "edif.c" /* yacc.c:1646 */ +#line 3804 "edif.c" /* yacc.c:1652 */ break; case 633: -#line 1679 "edif.y" /* yacc.c:1646 */ +#line 1679 "edif.y" /* yacc.c:1652 */ { (yyval.ps)=NULL; } -#line 3803 "edif.c" /* yacc.c:1646 */ +#line 3810 "edif.c" /* yacc.c:1652 */ break; case 634: -#line 1683 "edif.y" /* yacc.c:1646 */ +#line 1683 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3809 "edif.c" /* yacc.c:1646 */ +#line 3816 "edif.c" /* yacc.c:1652 */ break; case 639: -#line 1692 "edif.y" /* yacc.c:1646 */ +#line 1692 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3815 "edif.c" /* yacc.c:1646 */ +#line 3822 "edif.c" /* yacc.c:1652 */ break; case 644: -#line 1703 "edif.y" /* yacc.c:1646 */ +#line 1703 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3821 "edif.c" /* yacc.c:1646 */ +#line 3828 "edif.c" /* yacc.c:1652 */ break; case 698: -#line 1805 "edif.y" /* yacc.c:1646 */ +#line 1805 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-3].s)); } -#line 3827 "edif.c" /* yacc.c:1646 */ +#line 3834 "edif.c" /* yacc.c:1652 */ break; case 701: -#line 1812 "edif.y" /* yacc.c:1646 */ +#line 1812 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-1].s)); } -#line 3833 "edif.c" /* yacc.c:1646 */ +#line 3840 "edif.c" /* yacc.c:1652 */ break; case 727: -#line 1864 "edif.y" /* yacc.c:1646 */ +#line 1864 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-1].s)); } -#line 3839 "edif.c" /* yacc.c:1646 */ +#line 3846 "edif.c" /* yacc.c:1652 */ break; case 730: -#line 1871 "edif.y" /* yacc.c:1646 */ +#line 1871 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3845 "edif.c" /* yacc.c:1646 */ +#line 3852 "edif.c" /* yacc.c:1652 */ break; case 747: -#line 1906 "edif.y" /* yacc.c:1646 */ +#line 1906 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-2].s)); free((yyvsp[-1].s)); } -#line 3851 "edif.c" /* yacc.c:1646 */ +#line 3858 "edif.c" /* yacc.c:1652 */ break; case 766: -#line 1937 "edif.y" /* yacc.c:1646 */ +#line 1937 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3857 "edif.c" /* yacc.c:1646 */ +#line 3864 "edif.c" /* yacc.c:1652 */ break; case 789: -#line 1972 "edif.y" /* yacc.c:1646 */ +#line 1972 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3863 "edif.c" /* yacc.c:1646 */ +#line 3870 "edif.c" /* yacc.c:1652 */ break; case 791: -#line 1978 "edif.y" /* yacc.c:1646 */ +#line 1978 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3869 "edif.c" /* yacc.c:1646 */ +#line 3876 "edif.c" /* yacc.c:1652 */ break; case 803: -#line 1994 "edif.y" /* yacc.c:1646 */ +#line 1994 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3875 "edif.c" /* yacc.c:1646 */ +#line 3882 "edif.c" /* yacc.c:1652 */ break; case 818: -#line 2013 "edif.y" /* yacc.c:1646 */ +#line 2013 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3881 "edif.c" /* yacc.c:1646 */ +#line 3888 "edif.c" /* yacc.c:1652 */ break; case 823: -#line 2024 "edif.y" /* yacc.c:1646 */ +#line 2024 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3887 "edif.c" /* yacc.c:1646 */ +#line 3894 "edif.c" /* yacc.c:1652 */ break; case 827: -#line 2030 "edif.y" /* yacc.c:1646 */ +#line 2030 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3893 "edif.c" /* yacc.c:1646 */ +#line 3900 "edif.c" /* yacc.c:1652 */ break; case 829: -#line 2034 "edif.y" /* yacc.c:1646 */ +#line 2034 "edif.y" /* yacc.c:1652 */ { (yyval.s)=(yyvsp[0].s); } -#line 3899 "edif.c" /* yacc.c:1646 */ +#line 3906 "edif.c" /* yacc.c:1652 */ break; case 831: -#line 2039 "edif.y" /* yacc.c:1646 */ +#line 2039 "edif.y" /* yacc.c:1652 */ { if ((yyvsp[-1].ps)) { @@ -3912,251 +3919,251 @@ (yyval.ps) = new_str_pair(NULL,(yyvsp[-2].s)); } } -#line 3916 "edif.c" /* yacc.c:1646 */ +#line 3923 "edif.c" /* yacc.c:1652 */ break; case 832: -#line 2053 "edif.y" /* yacc.c:1646 */ +#line 2053 "edif.y" /* yacc.c:1652 */ { (yyval.ps)=NULL; } -#line 3922 "edif.c" /* yacc.c:1646 */ +#line 3929 "edif.c" /* yacc.c:1652 */ break; case 833: -#line 2054 "edif.y" /* yacc.c:1646 */ +#line 2054 "edif.y" /* yacc.c:1652 */ { (yyval.ps)=(yyvsp[0].ps); } -#line 3928 "edif.c" /* yacc.c:1646 */ +#line 3935 "edif.c" /* yacc.c:1652 */ break; case 834: -#line 2055 "edif.y" /* yacc.c:1646 */ +#line 2055 "edif.y" /* yacc.c:1652 */ { (yyval.ps) = new_str_pair((yyvsp[0].s),NULL); } -#line 3934 "edif.c" /* yacc.c:1646 */ +#line 3941 "edif.c" /* yacc.c:1652 */ break; case 835: -#line 2056 "edif.y" /* yacc.c:1646 */ +#line 2056 "edif.y" /* yacc.c:1652 */ { (yyval.ps)=NULL; } -#line 3940 "edif.c" /* yacc.c:1646 */ +#line 3947 "edif.c" /* yacc.c:1652 */ break; case 848: -#line 2083 "edif.y" /* yacc.c:1646 */ +#line 2083 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3946 "edif.c" /* yacc.c:1646 */ +#line 3953 "edif.c" /* yacc.c:1652 */ break; case 849: -#line 2086 "edif.y" /* yacc.c:1646 */ +#line 2086 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3952 "edif.c" /* yacc.c:1646 */ +#line 3959 "edif.c" /* yacc.c:1652 */ break; case 881: -#line 2139 "edif.y" /* yacc.c:1646 */ +#line 2139 "edif.y" /* yacc.c:1652 */ { (yyval.ps) = new_str_pair((yyvsp[-2].s),(yyvsp[-1].s)); } -#line 3958 "edif.c" /* yacc.c:1646 */ +#line 3965 "edif.c" /* yacc.c:1652 */ break; case 882: -#line 2142 "edif.y" /* yacc.c:1646 */ +#line 2142 "edif.y" /* yacc.c:1652 */ { (yyval.s)=(yyvsp[0].s); } -#line 3964 "edif.c" /* yacc.c:1646 */ +#line 3971 "edif.c" /* yacc.c:1652 */ break; case 883: -#line 2143 "edif.y" /* yacc.c:1646 */ +#line 2143 "edif.y" /* yacc.c:1652 */ { (yyval.s)=(yyvsp[0].s); } -#line 3970 "edif.c" /* yacc.c:1646 */ +#line 3977 "edif.c" /* yacc.c:1652 */ break; case 884: -#line 2146 "edif.y" /* yacc.c:1646 */ +#line 2146 "edif.y" /* yacc.c:1652 */ { (yyval.s)=(yyvsp[0].s); } -#line 3976 "edif.c" /* yacc.c:1646 */ +#line 3983 "edif.c" /* yacc.c:1652 */ break; case 885: -#line 2147 "edif.y" /* yacc.c:1646 */ +#line 2147 "edif.y" /* yacc.c:1652 */ { (yyval.s)=NULL; } -#line 3982 "edif.c" /* yacc.c:1646 */ +#line 3989 "edif.c" /* yacc.c:1652 */ break; case 889: -#line 2157 "edif.y" /* yacc.c:1646 */ +#line 2157 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 3988 "edif.c" /* yacc.c:1646 */ +#line 3995 "edif.c" /* yacc.c:1652 */ break; case 891: -#line 2163 "edif.y" /* yacc.c:1646 */ +#line 2163 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 3994 "edif.c" /* yacc.c:1646 */ +#line 4001 "edif.c" /* yacc.c:1652 */ break; case 892: -#line 2164 "edif.y" /* yacc.c:1646 */ +#line 2164 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-2].s)); free((yyvsp[-1].s)); } -#line 4000 "edif.c" /* yacc.c:1646 */ +#line 4007 "edif.c" /* yacc.c:1652 */ break; case 893: -#line 2167 "edif.y" /* yacc.c:1646 */ +#line 2167 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-2].s)); free((yyvsp[-1].s)); } -#line 4006 "edif.c" /* yacc.c:1646 */ +#line 4013 "edif.c" /* yacc.c:1652 */ break; case 894: -#line 2170 "edif.y" /* yacc.c:1646 */ +#line 2170 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-2].s)); free((yyvsp[-1].s)); } -#line 4012 "edif.c" /* yacc.c:1646 */ +#line 4019 "edif.c" /* yacc.c:1652 */ break; case 896: -#line 2176 "edif.y" /* yacc.c:1646 */ +#line 2176 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 4018 "edif.c" /* yacc.c:1646 */ +#line 4025 "edif.c" /* yacc.c:1652 */ break; case 898: -#line 2178 "edif.y" /* yacc.c:1646 */ +#line 2178 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 4024 "edif.c" /* yacc.c:1646 */ +#line 4031 "edif.c" /* yacc.c:1652 */ break; case 903: -#line 2189 "edif.y" /* yacc.c:1646 */ +#line 2189 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 4030 "edif.c" /* yacc.c:1646 */ +#line 4037 "edif.c" /* yacc.c:1652 */ break; case 935: -#line 2253 "edif.y" /* yacc.c:1646 */ +#line 2253 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 4036 "edif.c" /* yacc.c:1646 */ +#line 4043 "edif.c" /* yacc.c:1652 */ break; case 943: -#line 2269 "edif.y" /* yacc.c:1646 */ +#line 2269 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 4042 "edif.c" /* yacc.c:1646 */ +#line 4049 "edif.c" /* yacc.c:1652 */ break; case 946: -#line 2274 "edif.y" /* yacc.c:1646 */ +#line 2274 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 4048 "edif.c" /* yacc.c:1646 */ +#line 4055 "edif.c" /* yacc.c:1652 */ break; case 973: -#line 2319 "edif.y" /* yacc.c:1646 */ +#line 2319 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 4054 "edif.c" /* yacc.c:1646 */ +#line 4061 "edif.c" /* yacc.c:1652 */ break; case 987: -#line 2341 "edif.y" /* yacc.c:1646 */ +#line 2341 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-1].s)); } -#line 4060 "edif.c" /* yacc.c:1646 */ +#line 4067 "edif.c" /* yacc.c:1652 */ break; case 994: -#line 2357 "edif.y" /* yacc.c:1646 */ +#line 2357 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-6].s)); free((yyvsp[-5].s)); free((yyvsp[-4].s)); free((yyvsp[-3].s)); free((yyvsp[-2].s)); free((yyvsp[-1].s)); } -#line 4066 "edif.c" /* yacc.c:1646 */ +#line 4073 "edif.c" /* yacc.c:1652 */ break; case 1054: -#line 2464 "edif.y" /* yacc.c:1646 */ +#line 2464 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 4072 "edif.c" /* yacc.c:1646 */ +#line 4079 "edif.c" /* yacc.c:1652 */ break; case 1055: -#line 2465 "edif.y" /* yacc.c:1646 */ +#line 2465 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 4078 "edif.c" /* yacc.c:1646 */ +#line 4085 "edif.c" /* yacc.c:1652 */ break; case 1056: -#line 2466 "edif.y" /* yacc.c:1646 */ +#line 2466 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 4084 "edif.c" /* yacc.c:1646 */ +#line 4091 "edif.c" /* yacc.c:1652 */ break; case 1057: -#line 2467 "edif.y" /* yacc.c:1646 */ +#line 2467 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 4090 "edif.c" /* yacc.c:1646 */ +#line 4097 "edif.c" /* yacc.c:1652 */ break; case 1059: -#line 2471 "edif.y" /* yacc.c:1646 */ +#line 2471 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 4096 "edif.c" /* yacc.c:1646 */ +#line 4103 "edif.c" /* yacc.c:1652 */ break; case 1061: -#line 2475 "edif.y" /* yacc.c:1646 */ +#line 2475 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 4102 "edif.c" /* yacc.c:1646 */ +#line 4109 "edif.c" /* yacc.c:1652 */ break; case 1063: -#line 2479 "edif.y" /* yacc.c:1646 */ +#line 2479 "edif.y" /* yacc.c:1652 */ { free((yyvsp[-1].s)); } -#line 4108 "edif.c" /* yacc.c:1646 */ +#line 4115 "edif.c" /* yacc.c:1652 */ break; case 1085: -#line 2515 "edif.y" /* yacc.c:1646 */ +#line 2515 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 4114 "edif.c" /* yacc.c:1646 */ +#line 4121 "edif.c" /* yacc.c:1652 */ break; case 1086: -#line 2518 "edif.y" /* yacc.c:1646 */ +#line 2518 "edif.y" /* yacc.c:1652 */ { free((yyvsp[0].s)); } -#line 4120 "edif.c" /* yacc.c:1646 */ +#line 4127 "edif.c" /* yacc.c:1652 */ break; case 1107: -#line 2559 "edif.y" /* yacc.c:1646 */ +#line 2559 "edif.y" /* yacc.c:1652 */ { str_pair_free((yyvsp[0].ps)); } -#line 4126 "edif.c" /* yacc.c:1646 */ +#line 4133 "edif.c" /* yacc.c:1652 */ break; case 1109: -#line 2561 "edif.y" /* yacc.c:1646 */ +#line 2561 "edif.y" /* yacc.c:1652 */ { pair_list_free((yyvsp[0].pl)); } -#line 4132 "edif.c" /* yacc.c:1646 */ +#line 4139 "edif.c" /* yacc.c:1652 */ break; case 1126: -#line 2588 "edif.y" /* yacc.c:1646 */ +#line 2588 "edif.y" /* yacc.c:1652 */ { (yyval.s)=(yyvsp[0].s); } -#line 4138 "edif.c" /* yacc.c:1646 */ +#line 4145 "edif.c" /* yacc.c:1652 */ break; case 1127: -#line 2591 "edif.y" /* yacc.c:1646 */ +#line 2591 "edif.y" /* yacc.c:1652 */ { (yyval.s)=(yyvsp[0].s); } -#line 4144 "edif.c" /* yacc.c:1646 */ +#line 4151 "edif.c" /* yacc.c:1652 */ break; case 1128: -#line 2594 "edif.y" /* yacc.c:1646 */ +#line 2594 "edif.y" /* yacc.c:1652 */ { (yyval.s)=(yyvsp[0].s); } -#line 4150 "edif.c" /* yacc.c:1646 */ +#line 4157 "edif.c" /* yacc.c:1652 */ break; case 1129: -#line 2597 "edif.y" /* yacc.c:1646 */ +#line 2597 "edif.y" /* yacc.c:1652 */ { (yyval.s)=(yyvsp[0].s); } -#line 4156 "edif.c" /* yacc.c:1646 */ +#line 4163 "edif.c" /* yacc.c:1652 */ break; -#line 4160 "edif.c" /* yacc.c:1646 */ +#line 4167 "edif.c" /* yacc.c:1652 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -4181,15 +4188,14 @@ /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - goto yynewstate; @@ -4271,13 +4277,11 @@ | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); @@ -4338,6 +4342,7 @@ yyresult = 0; goto yyreturn; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -4345,6 +4350,7 @@ yyresult = 1; goto yyreturn; + #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | @@ -4355,6 +4361,10 @@ /* Fall through. */ #endif + +/*-----------------------------------------------------. +| yyreturn -- parsing is finished, return the result. | +`-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { @@ -4384,7 +4394,7 @@ #endif return yyresult; } -#line 2600 "edif.y" /* yacc.c:1906 */ +#line 2600 "edif.y" /* yacc.c:1918 */ /* * xmalloc: @@ -5863,7 +5873,7 @@ * Set up the file state to something useful. */ InFile = filename; - Input = pcb_fopen(filename, "r"); + Input = pcb_fopen(&PCB->hidlib, filename, "r"); Error = err; LineNumber = 1; /* Index: trunk/src_plugins/import_edif/edif.h =================================================================== --- trunk/src_plugins/import_edif/edif.h (revision 25226) +++ trunk/src_plugins/import_edif/edif.h (revision 25227) @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.3.2. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +31,9 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + #ifndef YY_EDIF_EDIF_H_INCLUDED # define YY_EDIF_EDIF_H_INCLUDED /* Debug traces. */ @@ -342,17 +346,19 @@ /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; + union YYSTYPE { -#line 196 "edif.y" /* yacc.c:1909 */ +#line 196 "edif.y" /* yacc.c:1921 */ char* s; pair_list* pl; str_pair* ps; -#line 355 "edif.h" /* yacc.c:1909 */ +#line 359 "edif.h" /* yacc.c:1921 */ }; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif Index: trunk/src_plugins/import_edif/edif.y =================================================================== --- trunk/src_plugins/import_edif/edif.y (revision 25226) +++ trunk/src_plugins/import_edif/edif.y (revision 25227) @@ -4075,7 +4075,7 @@ * Set up the file state to something useful. */ InFile = filename; - Input = pcb_fopen(filename, "r"); + Input = pcb_fopen(&PCB->hidlib, filename, "r"); Error = err; LineNumber = 1; /* Index: trunk/src_plugins/import_fpcb_nl/fpcb_nl.c =================================================================== --- trunk/src_plugins/import_fpcb_nl/fpcb_nl.c (revision 25226) +++ trunk/src_plugins/import_fpcb_nl/fpcb_nl.c (revision 25227) @@ -64,7 +64,7 @@ enum { MODE_NONE, MODE_PART, MODE_NET, MODE_SIGNAL } mode = MODE_NONE; int anon = 0; - f = pcb_fopen(fn, "r"); + f = pcb_fopen(&PCB->hidlib, fn, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Can't open %s for read\n", fn); return -1; Index: trunk/src_plugins/import_hpgl/hpgl.c =================================================================== --- trunk/src_plugins/import_hpgl/hpgl.c (revision 25226) +++ trunk/src_plugins/import_hpgl/hpgl.c (revision 25227) @@ -120,7 +120,7 @@ ctx.conf.arc = load_arc; ctx.conf.poly = load_poly; - f = pcb_fopen(fname, "r"); + f = pcb_fopen(&PCB->hidlib, fname, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Error opening HP-GL %s for read\n", fname); return 1; Index: trunk/src_plugins/import_ipcd356/ipcd356.c =================================================================== --- trunk/src_plugins/import_ipcd356/ipcd356.c (revision 25226) +++ trunk/src_plugins/import_ipcd356/ipcd356.c (revision 25227) @@ -379,7 +379,7 @@ } } - f = pcb_fopen(fname, "r"); + f = pcb_fopen(&PCB->hidlib, fname, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Can't open %s for read\n", fname); PCB_ACT_IRES(1); Index: trunk/src_plugins/import_ltspice/ltspice.c =================================================================== --- trunk/src_plugins/import_ltspice/ltspice.c (revision 25226) +++ trunk/src_plugins/import_ltspice/ltspice.c (revision 25227) @@ -232,12 +232,12 @@ FILE *fn, *fa; int ret = 0; - fn = pcb_fopen(fname_net, "r"); + fn = pcb_fopen(&PCB->hidlib, fname_net, "r"); if (fn == NULL) { pcb_message(PCB_MSG_ERROR, "can't open file '%s' for read\n", fname_net); return -1; } - fa = pcb_fopen(fname_asc, "r"); + fa = pcb_fopen(&PCB->hidlib, fname_asc, "r"); if (fa == NULL) { pcb_message(PCB_MSG_ERROR, "can't open file '%s' for read\n", fname_asc); fclose(fn); Index: trunk/src_plugins/import_mentor_sch/mentor_sch.c =================================================================== --- trunk/src_plugins/import_mentor_sch/mentor_sch.c (revision 25226) +++ trunk/src_plugins/import_mentor_sch/mentor_sch.c (revision 25227) @@ -221,7 +221,7 @@ int c, ret = 0; gsx_parse_res_t res; - fn = pcb_fopen(fname_net, "r"); + fn = pcb_fopen(NULL, fname_net, "r"); if (fn == NULL) { pcb_message(PCB_MSG_ERROR, "can't open file '%s' for read\n", fname_net); return -1; Index: trunk/src_plugins/import_mentor_sch/netlist_helper.c =================================================================== --- trunk/src_plugins/import_mentor_sch/netlist_helper.c (revision 25226) +++ trunk/src_plugins/import_mentor_sch/netlist_helper.c (revision 25227) @@ -163,7 +163,7 @@ int cnt, argc, lineno; char line[1024], *argv[8]; - f = pcb_fopen(fn, "r"); + f = pcb_fopen(NULL, fn, "r"); if (f == NULL) return -1; Index: trunk/src_plugins/import_mucs/mucs.c =================================================================== --- trunk/src_plugins/import_mucs/mucs.c (revision 25226) +++ trunk/src_plugins/import_mucs/mucs.c (revision 25227) @@ -90,7 +90,7 @@ default_file = pcb_strdup(fname); } - fi = pcb_fopen(fname, "r"); + fi = pcb_fopen(&PCB->hidlib, fname, "r"); if (!fi) { pcb_message(PCB_MSG_ERROR, "Can't load mucs unixplot file %s for read\n", fname); PCB_ACT_IRES(1); Index: trunk/src_plugins/import_netlist/import_netlist.c =================================================================== --- trunk/src_plugins/import_netlist/import_netlist.c (revision 25226) +++ trunk/src_plugins/import_netlist/import_netlist.c (revision 25227) @@ -72,7 +72,7 @@ ratcmd = conf_core.rc.rat_command; if (PCB_EMPTY_STRING_P(ratcmd)) { - fp = pcb_fopen(filename, "r"); + fp = pcb_fopen(&PCB->hidlib, filename, "r"); if (!fp) { pcb_message(PCB_MSG_ERROR, "Cannot open %s for reading", filename); return 1; @@ -88,7 +88,7 @@ command = pcb_build_argfn(conf_core.rc.rat_command, &p); /* open pipe to stdout of command */ - if (*command == '\0' || (fp = pcb_popen(command, "r")) == NULL) { + if (*command == '\0' || (fp = pcb_popen(&PCB->hidlib, command, "r")) == NULL) { pcb_popen_error_message(command); free(command); return 1; Index: trunk/src_plugins/import_sch/import_sch.c =================================================================== --- trunk/src_plugins/import_sch/import_sch.c (revision 25226) +++ trunk/src_plugins/import_sch/import_sch.c (revision 25227) @@ -263,7 +263,7 @@ if (pcb_spawnvp(cmd)) { for(i = 0; i < nsources; i++) free((char *) cmd[8 + i]); - pcb_unlink(tmpfile); + pcb_unlink(&PCB->hidlib, tmpfile); PCB_ACT_IRES(1); return 0; } @@ -340,7 +340,7 @@ if (pcb_spawnvp(cmd)) { if (must_free_tmpfile) - pcb_unlink(tmpfile); + pcb_unlink(&PCB->hidlib, tmpfile); free((char*)cmd[2]); free((char*)cmd[3]); free((char*)cmd[4]); Index: trunk/src_plugins/import_tinycad/tinycad.c =================================================================== --- trunk/src_plugins/import_tinycad/tinycad.c (revision 25226) +++ trunk/src_plugins/import_tinycad/tinycad.c (revision 25227) @@ -157,7 +157,7 @@ FILE *fn; int ret = 0; - fn = pcb_fopen(fname_net, "r"); + fn = pcb_fopen(&PCB->hidlib, fname_net, "r"); if (fn == NULL) { pcb_message(PCB_MSG_ERROR, "can't open file '%s' for read\n", fname_net); return -1; Index: trunk/src_plugins/io_autotrax/read.c =================================================================== --- trunk/src_plugins/io_autotrax/read.c (revision 25226) +++ trunk/src_plugins/io_autotrax/read.c (revision 25227) @@ -1086,7 +1086,7 @@ char line[1024]; char *s; - FP = pcb_fopen(Filename, "r"); + FP = pcb_fopen(&Ptr->hidlib, Filename, "r"); if (FP == NULL) return -1; Index: trunk/src_plugins/io_dsn/read.c =================================================================== --- trunk/src_plugins/io_dsn/read.c (revision 25226) +++ trunk/src_plugins/io_dsn/read.c (revision 25227) @@ -1780,7 +1780,7 @@ long q_offs = -1, offs; - f = pcb_fopen(fn, "r"); + f = pcb_fopen(&PCB->hidlib, fn, "r"); if (f == NULL) return -1; Index: trunk/src_plugins/io_eagle/read_dru.c =================================================================== --- trunk/src_plugins/io_eagle/read_dru.c (revision 25226) +++ trunk/src_plugins/io_eagle/read_dru.c (revision 25227) @@ -167,7 +167,7 @@ static const char prefix[] = "io_eagle::dru::"; char tmp[256]; - f = pcb_fopen_fn(Filename, "r", &efn); + f = pcb_fopen_fn(&PCB->hidlib, Filename, "r", &efn); if (f == NULL) return -1; Index: trunk/src_plugins/io_eagle/trparse_bin.c =================================================================== --- trunk/src_plugins/io_eagle/trparse_bin.c (revision 25226) +++ trunk/src_plugins/io_eagle/trparse_bin.c (revision 25227) @@ -45,7 +45,7 @@ FILE *f; int res; - f = pcb_fopen(fn, "rb"); + f = pcb_fopen(NULL, fn, "rb"); if (f == NULL) return -1; Index: trunk/src_plugins/io_eagle/trparse_xml.c =================================================================== --- trunk/src_plugins/io_eagle/trparse_xml.c (revision 25226) +++ trunk/src_plugins/io_eagle/trparse_xml.c (revision 25227) @@ -45,7 +45,7 @@ FILE *f; char *efn; - f = pcb_fopen_fn(fn, "r", &efn); + f = pcb_fopen_fn(NULL, fn, "r", &efn); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "can't open '%s'\n", fn); return -1; Index: trunk/src_plugins/io_hyp/parser.c =================================================================== --- trunk/src_plugins/io_hyp/parser.c (revision 25226) +++ trunk/src_plugins/io_hyp/parser.c (revision 25227) @@ -330,7 +330,7 @@ hyyset_lineno(1); /* parse hyperlynx file */ - hyyin = pcb_fopen(fname, "r"); + hyyin = pcb_fopen(&PCB->hidlib, fname, "r"); if (hyyin == NULL) return 1; retval = hyyparse(); Index: trunk/src_plugins/io_kicad/read.c =================================================================== --- trunk/src_plugins/io_kicad/read.c (revision 25226) +++ trunk/src_plugins/io_kicad/read.c (revision 25227) @@ -2366,7 +2366,7 @@ gsx_parse_res_t res; FILE *FP; - FP = pcb_fopen(Filename, "r"); + FP = pcb_fopen(&PCB->hidlib, Filename, "r"); if (FP == NULL) return -1; Index: trunk/src_plugins/io_kicad/read_net.c =================================================================== --- trunk/src_plugins/io_kicad/read_net.c (revision 25226) +++ trunk/src_plugins/io_kicad/read_net.c (revision 25227) @@ -183,7 +183,7 @@ int c, ret = 0; gsx_parse_res_t res; - fn = pcb_fopen(fname_net, "r"); + fn = pcb_fopen(&PCB->hidlib, fname_net, "r"); if (fn == NULL) { pcb_message(PCB_MSG_ERROR, "can't open file '%s' for read\n", fname_net); return -1; Index: trunk/src_plugins/io_lihata/read.c =================================================================== --- trunk/src_plugins/io_lihata/read.c (revision 25226) +++ trunk/src_plugins/io_lihata/read.c (revision 25227) @@ -2341,7 +2341,7 @@ char *errmsg = NULL, *realfn; lht_doc_t *doc = NULL; - realfn = pcb_fopen_check(Filename, "r"); + realfn = pcb_fopen_check(NULL, Filename, "r"); if (realfn != NULL) doc = lht_dom_load(realfn, &errmsg); free(realfn); @@ -2440,7 +2440,7 @@ char *errmsg = NULL, *realfn; lht_doc_t *doc = NULL; - realfn = pcb_fopen_check(Filename, "r"); + realfn = pcb_fopen_check(&PCB->hidlib, Filename, "r"); if (realfn != NULL) doc = lht_dom_load(realfn, &errmsg); free(realfn); Index: trunk/src_plugins/io_lihata/write.c =================================================================== --- trunk/src_plugins/io_lihata/write.c (revision 25226) +++ trunk/src_plugins/io_lihata/write.c (revision 25227) @@ -1542,7 +1542,7 @@ lhtpers_ev_t events; if (old_filename != NULL) - inf = pcb_fopen(old_filename, "r"); + inf = pcb_fopen(&PCB->hidlib, old_filename, "r"); memset(&events, 0, sizeof(events)); events.text = check_text; @@ -1559,7 +1559,7 @@ if (res != 0) { FILE *fe; char *fe_name = pcb_concat(old_filename, ".mem.lht", NULL); - fe = pcb_fopen(fe_name, "w"); + fe = pcb_fopen(&PCB->hidlib, fe_name, "w"); if (fe != NULL) { clean_invalid(brd->root); /* remove invalid nodes placed for persistency */ res = lht_dom_export(brd->root, fe, ""); @@ -1614,7 +1614,7 @@ lht_doc_t *doc; - f = pcb_fopen(Filename, "w"); + f = pcb_fopen(&PCB->hidlib, Filename, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Failed to open font file %s for write\n", Filename); return -1; Index: trunk/src_plugins/io_mentor_cell/read.c =================================================================== --- trunk/src_plugins/io_mentor_cell/read.c (revision 25226) +++ trunk/src_plugins/io_mentor_cell/read.c (revision 25227) @@ -381,7 +381,7 @@ int level; - f = pcb_fopen(fn, "r"); + f = pcb_fopen(&PCB->hidlib, fn, "r"); if (f == NULL) goto err; Index: trunk/src_plugins/io_pcb/parse_l.c =================================================================== --- trunk/src_plugins/io_pcb/parse_l.c (revision 25226) +++ trunk/src_plugins/io_pcb/parse_l.c (revision 25227) @@ -2383,7 +2383,7 @@ else sprintf(tmps, "%s", Filename); - pcb_in = pcb_fopen(tmps, "r"); + pcb_in = pcb_fopen(NULL, tmps, "r"); if (!pcb_in) { free(tmps); return (1); @@ -2399,7 +2399,7 @@ 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) { + if (*command == '\0' || (pcb_in = pcb_popen(NULL, command, "r")) == NULL) { pcb_popen_error_message(command); free(command); return (1); Index: trunk/src_plugins/io_pcb/parse_l.l =================================================================== --- trunk/src_plugins/io_pcb/parse_l.l (revision 25226) +++ trunk/src_plugins/io_pcb/parse_l.l (revision 25227) @@ -240,7 +240,7 @@ else sprintf(tmps, "%s", Filename); - yyin = pcb_fopen(tmps, "r"); + yyin = pcb_fopen(NULL, tmps, "r"); if (!yyin) { free(tmps); return (1); @@ -256,7 +256,7 @@ 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) { + if (*command == '\0' || (yyin = pcb_popen(NULL, command, "r")) == NULL) { pcb_popen_error_message(command); free(command); return (1); Index: trunk/src_plugins/io_tedax/footprint.c =================================================================== --- trunk/src_plugins/io_tedax/footprint.c (revision 25226) +++ trunk/src_plugins/io_tedax/footprint.c (revision 25227) @@ -306,7 +306,7 @@ int res; FILE *f; - f = pcb_fopen(fn, "w"); + f = pcb_fopen(&PCB->hidlib, fn, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "tedax_fp_save(): can't open %s for writing\n", fn); return -1; @@ -635,7 +635,7 @@ FILE *f; int ret = 0; - f = pcb_fopen(fn, "r"); + f = pcb_fopen(&PCB->hidlib, fn, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "can't open file '%s' for read\n", fn); return -1; Index: trunk/src_plugins/io_tedax/stackup.c =================================================================== --- trunk/src_plugins/io_tedax/stackup.c (revision 25226) +++ trunk/src_plugins/io_tedax/stackup.c (revision 25227) @@ -333,7 +333,7 @@ FILE *f; tedax_stackup_t ctx; - f = pcb_fopen(fn, "w"); + f = pcb_fopen(&PCB->hidlib, fn, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "tedax_stackup_save(): can't open %s for writing\n", fn); return -1; @@ -416,7 +416,7 @@ FILE *f; tedax_stackup_t ctx; - f = pcb_fopen(fn, "r"); + f = pcb_fopen(&PCB->hidlib, fn, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "tedax_stackup_load(): can't open %s for reading\n", fn); return -1; Index: trunk/src_plugins/io_tedax/tboard.c =================================================================== --- trunk/src_plugins/io_tedax/tboard.c (revision 25226) +++ trunk/src_plugins/io_tedax/tboard.c (revision 25227) @@ -256,7 +256,7 @@ int res; FILE *f; - f = pcb_fopen(fn, "w"); + f = pcb_fopen(&PCB->hidlib, fn, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "tedax_board_save(): can't open %s for writing\n", fn); return -1; @@ -543,7 +543,7 @@ int res; FILE *f; - f = pcb_fopen(fn, "r"); + f = pcb_fopen(&PCB->hidlib, fn, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "tedax_board_load(): can't open %s for reading\n", fn); return -1; Index: trunk/src_plugins/io_tedax/tdrc.c =================================================================== --- trunk/src_plugins/io_tedax/tdrc.c (revision 25226) +++ trunk/src_plugins/io_tedax/tdrc.c (revision 25227) @@ -77,7 +77,7 @@ int res; FILE *f; - f = pcb_fopen(fn, "w"); + f = pcb_fopen(&PCB->hidlib, fn, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "tedax_drc_save(): can't open %s for writing\n", fn); return -1; @@ -133,7 +133,7 @@ int res; FILE *f; - f = pcb_fopen(fn, "r"); + f = pcb_fopen(&PCB->hidlib, fn, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "tedax_drc_load(): can't open %s for reading\n", fn); return -1; Index: trunk/src_plugins/io_tedax/tlayer.c =================================================================== --- trunk/src_plugins/io_tedax/tlayer.c (revision 25226) +++ trunk/src_plugins/io_tedax/tlayer.c (revision 25227) @@ -129,7 +129,7 @@ int res; FILE *f; - f = pcb_fopen(fn, "w"); + f = pcb_fopen(&PCB->hidlib, fn, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "tedax_layer_save(): can't open %s for writing\n", fn); return -1; @@ -365,7 +365,7 @@ int res; FILE *f; - f = pcb_fopen(fn, "r"); + f = pcb_fopen(&PCB->hidlib, fn, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "tedax_layers_load(): can't open %s for reading\n", fn); return -1; Index: trunk/src_plugins/io_tedax/tnetlist.c =================================================================== --- trunk/src_plugins/io_tedax/tnetlist.c (revision 25226) +++ trunk/src_plugins/io_tedax/tnetlist.c (revision 25227) @@ -129,7 +129,7 @@ FILE *fn; int ret = 0; - fn = pcb_fopen(fname_net, "r"); + fn = pcb_fopen(&PCB->hidlib, fname_net, "r"); if (fn == NULL) { pcb_message(PCB_MSG_ERROR, "can't open file '%s' for read\n", fname_net); return -1; @@ -205,7 +205,7 @@ int res; FILE *f; - f = pcb_fopen(fn, "w"); + f = pcb_fopen(&PCB->hidlib, fn, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "tedax_net_save(): can't open %s for writing\n", fn); return -1; Index: trunk/src_plugins/lib_gtk_common/dlg_fileselect.c =================================================================== --- trunk/src_plugins/lib_gtk_common/dlg_fileselect.c (revision 25226) +++ trunk/src_plugins/lib_gtk_common/dlg_fileselect.c (revision 25227) @@ -136,7 +136,7 @@ } if ((default_file != NULL) && (*default_file != '\0')) { - if (pcb_is_dir(default_file)) { + if (pcb_is_dir(com->hidlib, default_file)) { path = g_strdup(default_file); base = NULL; } Index: trunk/src_plugins/lib_gtk_common/dlg_library_param.c =================================================================== --- trunk/src_plugins/lib_gtk_common/dlg_library_param.c (revision 25226) +++ trunk/src_plugins/lib_gtk_common/dlg_library_param.c (revision 25227) @@ -371,7 +371,7 @@ ctx.first_optional = -1; cmd = pcb_strdup_printf("%s --help", entry->data.fp.loc_info); - f = pcb_popen(cmd, "r"); + f = pcb_popen(NULL, cmd, "r"); free(cmd); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "Can not execute parametric footprint %s\n", entry->data.fp.loc_info); Index: trunk/src_plugins/lib_hid_common/cli_history.c =================================================================== --- trunk/src_plugins/lib_hid_common/cli_history.c (revision 25226) +++ trunk/src_plugins/lib_hid_common/cli_history.c (revision 25227) @@ -184,7 +184,7 @@ 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"); + f = pcb_fopen(NULL, real_fn, "r"); free(real_fn); if (f == NULL) return; @@ -212,7 +212,7 @@ 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"); + f = pcb_fopen(NULL, real_fn, "w"); free(real_fn); if (f == NULL) return; Index: trunk/src_plugins/lib_hid_common/place.c =================================================================== --- trunk/src_plugins/lib_hid_common/place.c (revision 25226) +++ trunk/src_plugins/lib_hid_common/place.c (revision 25227) @@ -253,12 +253,12 @@ place_maybe_save(hidlib, role, 1); } -int pcb_wplc_save_to_file(const char *fn) +int pcb_wplc_save_to_file(pcb_hidlib_t *hidlib, const char *fn) { htsw_entry_t *e; FILE *f; - f = pcb_fopen(fn, "w"); + f = pcb_fopen(hidlib, fn, "w"); if (f == NULL) return -1; Index: trunk/src_plugins/lib_hid_pcbui/infobar.c =================================================================== --- trunk/src_plugins/lib_hid_pcbui/infobar.c (revision 25226) +++ trunk/src_plugins/lib_hid_pcbui/infobar.c (revision 25227) @@ -39,8 +39,8 @@ static void pcb_infobar_brdchg_ev(pcb_hidlib_t *hidlib, void *user_data, int argc, pcb_event_arg_t argv[]) { pcb_actionl("InfoBarFileChanged", "close"); - if ((PCB != NULL) && (PCB->hidlib.filename != NULL)) - last_date = pcb_file_mtime(PCB->hidlib.filename); + if ((hidlib != NULL) && (hidlib->filename != NULL)) + last_date = pcb_file_mtime(NULL, PCB->hidlib.filename); else last_date = -1; } @@ -58,7 +58,7 @@ if (infobar_timer_active) { /* check for file change */ if ((PCB != NULL) && (PCB->hidlib.filename != NULL)) { - double last_chg = pcb_file_mtime(PCB->hidlib.filename); + double last_chg = pcb_file_mtime(NULL, PCB->hidlib.filename); if (last_chg > last_date) { last_date = last_chg; pcb_actionl("InfoBarFileChanged", "open"); Index: trunk/src_plugins/lib_legacy_func/lib_legacy_func.c =================================================================== --- trunk/src_plugins/lib_legacy_func/lib_legacy_func.c (revision 25226) +++ trunk/src_plugins/lib_legacy_func/lib_legacy_func.c (revision 25227) @@ -62,7 +62,7 @@ } /* execute it with shell */ - if ((pipe = pcb_popen(command, "r")) != NULL) { + if ((pipe = pcb_popen(&PCB->hidlib, command, "r")) != NULL) { /* discard all but the first returned line */ for (;;) { if ((c = fgetc(pipe)) == EOF || c == '\n' || c == '\r') Index: trunk/src_plugins/mincut/pcb-mincut/graph.c =================================================================== --- trunk/src_plugins/mincut/pcb-mincut/graph.c (revision 25226) +++ trunk/src_plugins/mincut/pcb-mincut/graph.c (revision 25227) @@ -97,7 +97,7 @@ cmd = malloc(strlen(type)*2 + strlen(name) + 64); sprintf(cmd, "dot -T%s -o %s.%s", type, name, type); - f = pcb_popen(cmd, "w"); + f = pcb_popen(NULL, cmd, "w"); if (f == NULL) return -1; Index: trunk/src_plugins/renumber/renumber.c =================================================================== --- trunk/src_plugins/renumber/renumber.c (revision 25226) +++ trunk/src_plugins/renumber/renumber.c (revision 25227) @@ -106,7 +106,7 @@ default_file = pcb_strdup(name); } - if ((out = pcb_fopen(name, "r"))) { + if ((out = pcb_fopen(&PCB->hidlib, name, "r"))) { fclose(out); if (pcb_hid_message_box("warning", "Renumber: overwrite", "File exists! Ok to overwrite?", "cancel", 0, "overwrite", 1, NULL) != 1) { if (free_name && name) @@ -116,7 +116,7 @@ } } - if ((out = pcb_fopen(name, "w")) == NULL) { + if ((out = pcb_fopen(&PCB->hidlib, name, "w")) == NULL) { pcb_message(PCB_MSG_ERROR, "Could not open %s\n", name); if (free_name && name) free((char*)name); Index: trunk/src_plugins/script/live_script.c =================================================================== --- trunk/src_plugins/script/live_script.c (revision 25226) +++ trunk/src_plugins/script/live_script.c (revision 25227) @@ -126,7 +126,7 @@ strcpy(fn_end, de->d_name); - f = pcb_fopen(fn, "r"); + f = pcb_fopen(&PCB->hidlib, fn, "r"); if (f == NULL) continue; while((s = fgets(line, sizeof(line), f)) != NULL) { @@ -265,7 +265,7 @@ long numu; fn = pcb_tempfile_name_new("live_script"); - f = pcb_fopen(fn, "w"); + f = pcb_fopen(&PCB->hidlib, fn, "w"); if (f == NULL) { pcb_tempfile_unlink(fn); pcb_message(PCB_MSG_ERROR, "live_script: can't open temp file for write\n"); @@ -341,7 +341,7 @@ return 0; } - f = pcb_fopen(fn, "r"); + f = pcb_fopen(&PCB->hidlib, fn, "r"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "live_script: failed to open '%s' for read\n", fn); return -1; @@ -387,7 +387,7 @@ return 0; } - f = pcb_fopen(fn, "w"); + f = pcb_fopen(&PCB->hidlib, fn, "w"); if (f == NULL) { pcb_message(PCB_MSG_ERROR, "live_script: failed to open '%s' for write\n", fn); return -1; Index: trunk/src_plugins/script/script.c =================================================================== --- trunk/src_plugins/script/script.c (revision 25226) +++ trunk/src_plugins/script/script.c (revision 25227) @@ -81,16 +81,16 @@ gds_append_str(&fn, pcbhl_conf.rc.path.home); gds_append(&fn, PCB_DIR_SEPARATOR_C); gds_append_str(&fn, DOT_PCB_RND); - pcb_mkdir(fn.array, 0755); + pcb_mkdir(NULL, fn.array, 0755); gds_append(&fn, PCB_DIR_SEPARATOR_C); gds_append_str(&fn, SCRIPT_PERS); - pcb_mkdir(fn.array, 0750); + pcb_mkdir(NULL, fn.array, 0750); gds_append(&fn, PCB_DIR_SEPARATOR_C); gds_append_str(&fn, s->obj->name); - f = pcb_fopen(fn.array, "w"); + f = pcb_fopen(NULL, fn.array, "w"); if (f != NULL) { gds_uninit(&fn); fputs(data, f); @@ -167,13 +167,13 @@ fn = pcb_concat(pcbhl_conf.rc.path.home, PCB_DIR_SEPARATOR_S, DOT_PCB_RND, PCB_DIR_SEPARATOR_S, SCRIPT_PERS, PCB_DIR_SEPARATOR_S, script_persistency_id, NULL); if (strcmp(cmd, "remove") == 0) { - PCB_ACT_IRES(pcb_remove(fn)); + PCB_ACT_IRES(pcb_remove(NULL, fn)); goto succ; } if (strcmp(cmd, "read") == 0) { FILE *f; - long fsize = pcb_file_size(fn); + long fsize = pcb_file_size(NULL, fn); char *data; if ((fsize < 0) || (fsize > PERS_MAX_SIZE)) @@ -183,7 +183,7 @@ if (data == NULL) goto err; - f = pcb_fopen(fn, "r"); + f = pcb_fopen(NULL, fn, "r"); if (f == NULL) { free(data); goto err; @@ -354,7 +354,7 @@ int res = 0; fn = pcb_tempfile_name_new("oneliner"); - f = pcb_fopen(fn, "w"); + f = pcb_fopen(NULL, fn, "w"); if (f == NULL) { pcb_tempfile_unlink(fn); pcb_message(PCB_MSG_ERROR, "script oneliner: can't open temp file for write\n"); Index: trunk/src_plugins/vendordrill/vendor.c =================================================================== --- trunk/src_plugins/vendordrill/vendor.c (revision 25226) +++ trunk/src_plugins/vendordrill/vendor.c (revision 25227) @@ -166,7 +166,7 @@ vendor_free_all(); /* load the resource file */ - doc = pcb_hid_cfg_load_lht(fname); + doc = pcb_hid_cfg_load_lht(&PCB->hidlib, fname); if (doc == NULL) { pcb_message(PCB_MSG_ERROR, "Could not load vendor resource file \"%s\"\n", fname); PCB_ACT_IRES(1);