Index: trunk/doc-rnd/conf/tree/rc.html =================================================================== --- trunk/doc-rnd/conf/tree/rc.html (revision 4606) +++ trunk/doc-rnd/conf/tree/rc.html (revision 4607) @@ -5,8 +5,8 @@ node name type flags description verbose integer 0 backup_interval integer 0 time between two backups in seconds - font_command string 0 commands for file loading... - file_command string 0 + font_command string 0 file name template; if not empty, run this command and read its outout for loading the font; %f is the file name + file_command string 0 file name template; if not empty, run this command and read its outout for loading a pcb file; %f is the file name, %p is the conf setting rc.file_path file_path string 0 library_shell string 0 library_search_paths list 0 @@ -19,7 +19,7 @@ script_filename string 0 PCB Actions script to execute on startup action_string string 0 PCB Actions string to execute on startup rat_path string 0 - rat_command string 0 + rat_command string 0 file name template; if not empty, run this command and read its outout for loading a rats; %f is the file name, %p is the rc.rat_path conf setting preferred_gui list 0 if set, try GUI HIDs in this order when no GUI is explicitly selected have_regex boolean 0 whether we have regex compiled in Index: trunk/src/conf_core.h =================================================================== --- trunk/src/conf_core.h (revision 4606) +++ trunk/src/conf_core.h (revision 4607) @@ -78,8 +78,8 @@ const struct rc { CFT_INTEGER verbose; CFT_INTEGER backup_interval; /* time between two backups in seconds */ - CFT_STRING font_command; /* commands for file loading... */ - CFT_STRING file_command; + CFT_STRING font_command; /* file name template; if not empty, run this command and read its outout for loading the font; %f is the file name */ + CFT_STRING file_command; /* file name template; if not empty, run this command and read its outout for loading a pcb file; %f is the file name, %p is the conf setting rc.file_path */ CFT_STRING file_path; CFT_STRING library_shell; CFT_LIST library_search_paths; @@ -95,7 +95,7 @@ CFT_STRING script_filename; /* PCB Actions script to execute on startup */ CFT_STRING action_string; /* PCB Actions string to execute on startup */ CFT_STRING rat_path; - CFT_STRING rat_command; + CFT_STRING rat_command; /* file name template; if not empty, run this command and read its outout for loading a rats; %f is the file name, %p is the rc.rat_path conf setting */ CFT_LIST preferred_gui; /* if set, try GUI HIDs in this order when no GUI is explicitly selected */ Index: trunk/src/plug_io.c =================================================================== --- trunk/src/plug_io.c (revision 4606) +++ trunk/src/plug_io.c (revision 4607) @@ -743,11 +743,30 @@ return -1; } +int pcb_build_argfn_cb(void *ctx_, gds_t *s, const char **input) +{ + if ((**input >= 'a') && (**input <= 'z')) { + int idx = **input - 'a'; + pcb_build_argfn_t *ctx = ctx_; + if (ctx->params[idx] == NULL) + return -1; + gds_append_str(s, ctx->params[idx]); + (*input)++; + return 0; + } + return pcb_build_fn_cb(NULL, s, input); +} + static char *build_fn(const char *template) { return pcb_strdup_subst(template, pcb_build_fn_cb, NULL); } +char *pcb_build_argfn(const char *template, pcb_build_argfn_t *arg) +{ + return pcb_strdup_subst(template, pcb_build_argfn_cb, arg); +} + /* --------------------------------------------------------------------------- * creates backup file. The default is to use the pcb file name with * a "-" appended (like "foo.pcb-") and if we don't have a pcb file name Index: trunk/src/plug_io.h =================================================================== --- trunk/src/plug_io.h (revision 4606) +++ trunk/src/plug_io.h (revision 4607) @@ -168,4 +168,15 @@ */ int pcb_build_fn_cb(void *ctx, gds_t *s, const char **input); + +/* Same as above, but also replaces lower case formatting to the members of + the array if they are not NULL; use with pcb_build_argfn() */ +typedef struct { + const char *params['z' - 'a' + 1]; /* [0] for 'a' */ +} pcb_build_argfn_t; + +char *pcb_build_argfn(const char *template, pcb_build_argfn_t *arg); + +int pcb_build_argfn_cb(void *ctx, gds_t *s, const char **input); + #endif Index: trunk/src_plugins/import_netlist/import_netlist.c =================================================================== --- trunk/src_plugins/import_netlist/import_netlist.c (revision 4606) +++ trunk/src_plugins/import_netlist/import_netlist.c (revision 4607) @@ -72,8 +72,12 @@ } } else { + pcb_build_argfn_t p; used_popen = 1; - command = EvaluateFilename(conf_core.rc.rat_command, conf_core.rc.rat_path, filename); + memset(&p, 0, sizeof(p)); + p.params['p'-'a'] = conf_core.rc.rat_path; + p.params['f'-'a'] = filename; + command = pcb_build_argfn(conf_core.rc.rat_command, &p); /* open pipe to stdout of command */ if (*command == '\0' || (fp = popen(command, "r")) == NULL) { Index: trunk/src_plugins/io_pcb/parse_l.c =================================================================== --- trunk/src_plugins/io_pcb/parse_l.c (revision 4606) +++ trunk/src_plugins/io_pcb/parse_l.c (revision 4607) @@ -2392,10 +2392,12 @@ } else { + pcb_build_argfn_t p; used_popen = 1; - - command = EvaluateFilename(Executable, Path, Filename); - + memset(&p, 0, sizeof(p)); + p.params['p'-'a'] = Path; + p.params['f'-'a'] = Filename; + command = pcb_build_argfn(Executable, &p); /* open pipe to stdout of command */ if (*command == '\0' || (pcb_in = popen(command, "r")) == NULL) { Index: trunk/src_plugins/io_pcb/parse_l.l =================================================================== --- trunk/src_plugins/io_pcb/parse_l.l (revision 4606) +++ trunk/src_plugins/io_pcb/parse_l.l (revision 4607) @@ -251,10 +251,12 @@ } else { + pcb_build_argfn_t p; used_popen = 1; - - command = EvaluateFilename(Executable, Path, Filename); - + memset(&p, 0, sizeof(p)); + p.params['p'-'a'] = Path; + p.params['f'-'a'] = Filename; + command = pcb_build_argfn(Executable, &p); /* open pipe to stdout of command */ if (*command == '\0' || (yyin = popen(command, "r")) == NULL) {