From 8fe82cf4ce11eac524b3990db225ce0d4f394012 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Wed, 2 Jul 2025 11:18:20 +0200 Subject: [PATCH] set netlist_dir if unset or empty before netlisting, add env(PDK) and env(PDK_ROOT) to list of tcl preserved globals in ctx switch --- src/scheduler.c | 1 + src/xschem.tcl | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/scheduler.c b/src/scheduler.c index 85751494..224fc345 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -3435,6 +3435,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} yyparse_error = 0; my_strdup(_ALLOC_ID_, &saveshow, tclgetvar("show_infowindow_after_netlist")); + set_netlist_dir(0, NULL); my_strncpy(savedir, tclgetvar("netlist_dir"), S(savedir)); for(i = 2; i < argc; i++) { diff --git a/src/xschem.tcl b/src/xschem.tcl index 281dc473..9fd93aee 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -5483,6 +5483,9 @@ proc simuldir {} { proc set_netlist_dir { what {dir {} }} { global netlist_dir env OS has_x local_netlist_dir USER_CONF_DIR + if { ![info exists netlist_dir] } { + set netlist_dir {} + } #### set local-to-schematic-dir if local_netlist_dir tcl var is set simuldir regsub {/$} $netlist_dir {} netlist_dir @@ -5490,16 +5493,15 @@ proc set_netlist_dir { what {dir {} }} { #### what == 0 if {$what == 0} { - if {$netlist_dir ne {}} { - if {![file exist $netlist_dir]} { - if {[catch {file mkdir "$netlist_dir"} err]} { - puts stderr $err - if {[info exists has_x]} { - tk_messageBox -message "$err" -icon error -parent [xschem get topwindow] -type ok - } - } + if {$netlist_dir eq {}} { set netlist_dir "$USER_CONF_DIR/simulations" } + if {![file exist $netlist_dir]} { + if {[catch {file mkdir "$netlist_dir"} err]} { + puts stderr $err + if {[info exists has_x]} { + tk_messageBox -message "$err" -icon error -parent [xschem get topwindow] -type ok + } } - } + } #### what == 1 } else { # if local_netlist_dir is set can not provide a dir, set dir to netlist_dir as set by proc simuldir @@ -8321,7 +8323,8 @@ set tctx::global_list { custom_label_prefix custom_token dark_colors dark_colorscheme dark_gui_colorscheme delay_flag dim_bg dim_value disable_unique_names do_all_inst draw_crosshair draw_grid draw_grid_axes draw_window edit_prop_pos edit_prop_size edit_symbol_prop_new_sel editprop_sympath - en_hilight_conn_inst enable_dim_bg enable_stretch enter_text_default_geometry filetmp + en_hilight_conn_inst enable_dim_bg enable_stretch env(PDK) env(PDK_ROOT) + enter_text_default_geometry filetmp fix_broken_tiled_fill flat_netlist fullscreen gaw_fd gaw_tcp_address graph_autoload graph_bus graph_change_done graph_dialog_default_geometry graph_digital graph_legend graph_linewidth_mult graph_logx graph_logy graph_private_cursor graph_rainbow graph_schname graph_sel_color