From f3334cea27fb4c2de949ea7189480ee47ee0e501 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Tue, 23 Sep 2025 22:19:19 +0200 Subject: [PATCH 1/3] evaluate xschemrc "postinit_commands" before loading schematics given on cmdline --- src/xinit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/xinit.c b/src/xinit.c index 934189bf..a0d4bcd8 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -3079,6 +3079,11 @@ int Tcl_AppInit(Tcl_Interp *inter) /* */ tcleval("source_user_tcl_files"); + /* */ + /* Execute tcl commands given in tcl variable postinit_commands if existing */ + /* */ + tcleval("eval_postinit_commands"); + if(cli_opt_filename[0]) { char f[PATH_MAX]; int file_loaded = 1; @@ -3230,9 +3235,6 @@ int Tcl_AppInit(Tcl_Interp *inter) tcleval(cli_opt_tcl_post_command); } - /* Execute tcl commands given in tcl variable postinit_commands if existing */ - tcleval("eval_postinit_commands"); - if(cli_opt_quit) { char s[40]; my_snprintf(s, S(s), "exit %d", exit_code); From 49bed53ba15f741b6d5d94ddca1006bcfbabe9c6 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Tue, 23 Sep 2025 22:40:05 +0200 Subject: [PATCH 2/3] tcl_files: do a tcl "subst" on tcl_files before sourcing file items, so xschem commands (like abs_sym_path) can be used --- src/xschem.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xschem.tcl b/src/xschem.tcl index 0eeb5520..1b57f98e 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -9869,7 +9869,7 @@ proc set_replace_key_binding { {win_path {.drw}}} { proc source_user_tcl_files {} { global tcl_files - foreach i $tcl_files { + foreach i [subst $tcl_files] { uplevel #0 [list source $i] } } From 6a522a853bf316803d80aa424ca95605555f5817 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Tue, 23 Sep 2025 23:36:44 +0200 Subject: [PATCH 3/3] better source_user_tcl_files (do the [subst $tcl_files] at global scope so variables like pathlist can be used) --- src/xschem.tcl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/xschem.tcl b/src/xschem.tcl index 1b57f98e..d5b2aaf0 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -9868,9 +9868,11 @@ proc set_replace_key_binding { {win_path {.drw}}} { } proc source_user_tcl_files {} { - global tcl_files - foreach i [subst $tcl_files] { - uplevel #0 [list source $i] + set subst_tcl_files [uplevel #0 {subst $tcl_files}] + foreach i $subst_tcl_files { + if {[catch "uplevel #0 {[list source $i]}" retval]} { + puts $retval + } } }