diff --git a/src/save.c b/src/save.c index 325b2d2b..8997e868 100644 --- a/src/save.c +++ b/src/save.c @@ -2604,6 +2604,7 @@ int save_schematic(const char *schname) /* 20171020 added return value */ struct stat buf; xRect *rect; int rects; + char msg[PATH_MAX + 100]; if(!schname || !strcmp(schname, "")) return 0; @@ -2644,6 +2645,8 @@ int save_schematic(const char *schname) /* 20171020 added return value */ xctx->time_last_modify = buf.st_mtime; } my_strncpy(xctx->current_name, rel_sym_path(schname), S(xctx->current_name)); + my_snprintf(msg, S(msg), "get_directory {%s}", schname); + my_strncpy(xctx->current_dirname, tcleval(msg), S(xctx->current_dirname)); /* why clear all these? */ /* * xctx->prep_hi_structs=0; @@ -2657,6 +2660,7 @@ int save_schematic(const char *schname) /* 20171020 added return value */ tclvareval(xctx->top_path, ".menubar.simulate configure -bg $simulate_bg", NULL); tclvareval("set tctx::", xctx->current_win_path, "_simulate $simulate_bg", NULL); tclvareval("catch {unset tctx::", xctx->current_win_path, "_simulate_id}", NULL); + tcleval("simuldir"); /* set local simulation directory if local_netlist_dir -s set*/ return 1; } @@ -2845,6 +2849,7 @@ void load_schematic(int load_symbols, const char *fname, int reset_undo, int ale } /* warning if two symbols perfectly overlapped */ /* warning_overlapped_symbols(0); */ /* do this when netlisting */ + tcleval("simuldir"); /* set local simulation directory if local_netlist_dir -s set*/ } void clear_undo(void) diff --git a/src/scheduler.c b/src/scheduler.c index e89b2c03..c0250947 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -2660,13 +2660,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg char *saveshow = NULL; int err = 0; int messages = 0; - char save[PATH_MAX]; const char *fname = NULL; const char *path; 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")); - my_strncpy(save, tclgetvar("netlist_dir"), S(save)); if(argc <= 2 || (argc > 2 && strcmp(argv[2], "-erc"))) { /* xschem netlist NOT invoked from GUI */ tclsetvar("show_infowindow_after_netlist", "never"); } @@ -2700,7 +2698,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg "-message {Please Set netlisting mode (Options menu)}"); if(argc > 2) { my_strncpy(xctx->netlist_name, "", S(xctx->netlist_name)); - set_netlist_dir(1, save); } if(messages) { Tcl_SetResult(interp, xctx->infowindow_text, TCL_VOLATILE); diff --git a/src/xschem.tcl b/src/xschem.tcl index cde8399b..8933bcd5 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -634,7 +634,6 @@ proc netlist {source_file show netlist_file} { global XSCHEM_SHAREDIR flat_netlist netlist_dir global verilog_2001 debug_var OS verilog_bitblast - simuldir set netlist_type [xschem get netlist_type] if {$debug_var <= -1} { puts "netlist: source_file=$source_file, netlist_type=$netlist_type" } set dest $netlist_dir/$netlist_file @@ -1751,7 +1750,6 @@ proc simulate {{callback {}}} { global netlist_dir terminal sim env global execute XSCHEM_SHAREDIR has_x OS - simuldir set_sim_defaults set netlist_type [xschem get netlist_type] if { [set_netlist_dir 0] ne {}} { @@ -1828,7 +1826,9 @@ proc simulate {{callback {}}} { puts "Simulation started: execution ID: $id" if {$fg eq {execute_wait}} { - vwait execute(pipe,$id) + if {$id >= 0} { + vwait execute(pipe,$id) + } xschem set semaphore [expr {[xschem get semaphore] -1}] } } @@ -1857,7 +1857,6 @@ proc setup_tcp_gaw {} { global gaw_fd gaw_tcp_address netlist_dir has_x if { [info exists gaw_fd] } { return 1; } - simuldir set custom_netlist_file [xschem get netlist_name] if {$custom_netlist_file ne {}} { set s [file rootname $custom_netlist_file] @@ -1885,7 +1884,6 @@ proc setup_tcp_gaw {} { proc gaw_cmd {cmd} { global gaw_fd gaw_tcp_address netlist_dir has_x - simuldir if { ![info exists gaw_fd] && [catch {eval socket $gaw_tcp_address} gaw_fd] } { puts "Problems opening socket to gaw on address $gaw_tcp_address" unset gaw_fd @@ -1927,9 +1925,8 @@ proc waves {} { ## $d : netlist directory global netlist_dir terminal sim XSCHEM_SHAREDIR has_x - global bespice_listen_port env simulate_bg + global bespice_listen_port env simulate_bg execute - simuldir set netlist_type [xschem get netlist_type] set_sim_defaults if { [set_netlist_dir 0] ne {}} { @@ -1963,7 +1960,9 @@ proc waves {} { } else { set fg {execute} } - set save [pwd] + + if {$fg eq {execute_wait}} {xschem set semaphore [expr {[xschem get semaphore] +1}]} + if {$def eq {0}} { if { [xschem raw_query loaded] != -1} { xschem raw_clear @@ -1971,10 +1970,21 @@ proc waves {} { load_raw } } else { - cd $netlist_dir set cmd [subst -nobackslashes $sim($tool,$def,cmd)] - eval $fg $st $cmd + + set save [pwd] + cd $netlist_dir + set id [eval execute $st $cmd] cd $save + + if {$fg eq {execute_wait}} { + if {$id >= 0} { + vwait execute(pipe,$id) + } + xschem set semaphore [expr {[xschem get semaphore] -1}] + } + + } } } @@ -2844,7 +2854,6 @@ proc edit_netlist {netlist } { global netlist_dir debug_var global editor terminal OS - simuldir set netlist_type [xschem get netlist_type] if { [regexp vim $editor] } { set ftype "-c \":set filetype=$netlist_type\"" } else { set ftype {} } @@ -3786,6 +3795,7 @@ proc simuldir {} { proc set_netlist_dir { force {dir {} }} { global netlist_dir env OS has_x + simuldir if { ( $force == 0 ) && ( $netlist_dir ne {} ) } { if {![file exist $netlist_dir]} { if {[catch {file mkdir "$netlist_dir"} err]} { @@ -3794,7 +3804,6 @@ proc set_netlist_dir { force {dir {} }} { tk_messageBox -message "$err" -icon error -parent [xschem get topwindow] -type ok } } - } regsub {^~/} $netlist_dir ${env(HOME)}/ netlist_dir return $netlist_dir @@ -7167,7 +7176,7 @@ proc build_widgets { {topwin {} } } { -variable netlist_show -accelerator {Shift+A} $topwin.menubar.simulation.menu add checkbutton -label "Use 'simulation' dir under current schematic dir" \ -variable local_netlist_dir \ - -command { if {$local_netlist_dir == 0 } { set_netlist_dir 1 } else { simuldir} } + -command {set_netlist_dir 1 } $topwin.menubar.simulation.menu add command -label {Configure simulators and tools} -command {simconf} if {$OS == {Windows}} { $topwin.menubar.simulation.menu add command -label {List running sub-processes} -state disabled @@ -7183,16 +7192,14 @@ proc build_widgets { {topwin {} } } { viewdata $execute(error,last) } $topwin.menubar.simulation.menu add command -label {Utile Stimuli Editor (GUI)} -command { - simuldir inutile [xschem get current_dirname]/stimuli.[file rootname [file tail [xschem get schname]]] } $topwin.menubar.simulation.menu add command -label {Utile Stimuli Translate} -command { - simuldir inutile_translate [xschem get current_dirname]/stimuli.[file rootname [file tail [xschem get schname]]] } $topwin.menubar.simulation.menu add command -label {Shell [simulation path]} -command { if { [set_netlist_dir 0] ne "" } { - simuldir; get_shell $netlist_dir + get_shell $netlist_dir } } $topwin.menubar.simulation.menu add command -label {Edit Netlist} \ @@ -7523,7 +7530,6 @@ set env(LC_ALL) C set_ne add_all_windows_drives 1 set_paths print_help_and_exit - set_ne text_replace_selection 1 if {$text_replace_selection && $OS != "Windows"} { # deletes selected text when pasting in text widgets, courtesy Wolf-Dieter Busch