fix a problem in set_modify() (inconsistent prev_set_modify state after netlist of modified circuit)

This commit is contained in:
stefan schippers 2023-11-04 22:50:57 +01:00
parent cfdaebf5e1
commit 88e7f4fea4
5 changed files with 30 additions and 11 deletions

View File

@ -142,11 +142,16 @@ int set_modify(int mod)
{
int i, floaters = 0;
if(mod != -2 && mod != -1) xctx->modified = mod;
dbg(1, "set_modify(): %d\n", mod);
dbg(1, "set_modify(): %d, prev_set_modify=%d\n", mod, xctx->prev_set_modify);
if(mod == 1 || mod == -1 || mod == -2) {
/* hash instance names if there are (many) floaters and many instances for faster lookup */
/* set modify state */
if(mod == 0 || mod == 1) {
xctx->prev_set_modify = xctx->modified;
xctx->modified = mod;
}
/* clear floater caches */
if(mod == 1 || mod == -2) {
for(i = 0; i < xctx->texts; i++)
if(xctx->text[i].flags & TEXT_FLOATER) {
floaters++;
@ -154,21 +159,24 @@ int set_modify(int mod)
}
int_hash_free(&xctx->floater_inst_table);
}
if(mod != -2 && (mod == -1 || mod != xctx->prev_set_modify) ) { /* mod=-1 used to force set title */
if(mod != -1) xctx->prev_set_modify = mod;
else mod = xctx->modified;
if(has_x && strcmp(get_cell(xctx->sch[xctx->currsch],1), "systemlib/font")) {
/* force title no mod mod */
if(mod == -1 || mod == 0 || mod == 1) {
if(has_x &&
strcmp(get_cell(xctx->sch[xctx->currsch],1), "systemlib/font") &&
(xctx->prev_set_modify != xctx->modified || mod == -1)
) {
char *top_path = xctx->top_path[0] ? xctx->top_path : ".";
if(mod == 1) {
if(xctx->modified == 1) {
tclvareval("wm title ", top_path, " \"xschem - [file tail [xschem get schname]]*\"", NULL);
tclvareval("wm iconname ", top_path, " \"xschem - [file tail [xschem get schname]]*\"", NULL);
} else {
tclvareval("wm title ", top_path, " \"xschem - [file tail [xschem get schname]]\"", NULL);
tclvareval("wm iconname ", top_path, " \"xschem - [file tail [xschem get schname]]\"", NULL);
}
if(xctx->modified) tcleval("set_tab_names *");
else tcleval("set_tab_names");
}
if(xctx->modified) tcleval("set_tab_names *");
else tcleval("set_tab_names");
}
return floaters;
}
@ -481,6 +489,7 @@ int save(int confirm)
if(force || xctx->modified)
{
dbg(1, "save(): force=%d modified=%d\n", force, xctx->modified);
if(confirm) {
tcleval("ask_save_optional");
if(!strcmp(tclresult(), "") ) return -1; /* user clicks "Cancel" */

View File

@ -51,6 +51,7 @@ void hier_psprint(char **res, int what) /* netlister driver */
char *abs_path = NULL;
struct stat buf;
Str_hashtable subckt_table = {NULL, 0};
int save_prev_mod = xctx->prev_set_modify;
save = xctx->do_copy_area;
xctx->do_copy_area = 0;
@ -120,6 +121,7 @@ void hier_psprint(char **res, int what) /* netlister driver */
xctx->currsch--;
unselect_all(1);
xctx->pop_undo(4, 0);
xctx->prev_set_modify = save_prev_mod;
my_strncpy(xctx->current_name, rel_sym_path(xctx->sch[xctx->currsch]), S(xctx->current_name));
xctx->do_copy_area = save;
if(what & 1) ps_draw(4, 1); /* trailer */
@ -242,6 +244,7 @@ int global_spice_netlist(int global) /* netlister driver */
Str_hashtable subckt_table = {NULL, 0};
Str_hashentry *model_entry;
int lvs_ignore = tclgetboolvar("lvs_ignore");
int save_prev_mod = xctx->prev_set_modify;
split_f = tclgetboolvar("split_files");
dbg(1, "global_spice_netlist(): invoking push_undo()\n");
@ -436,6 +439,7 @@ int global_spice_netlist(int global) /* netlister driver */
unselect_all(1);
dbg(1, "global_spice_netlist(): invoking pop_undo(0, 0)\n");
xctx->pop_undo(4, 0);
xctx->prev_set_modify = save_prev_mod;
if(web_url) {
my_strncpy(xctx->current_dirname, current_dirname_save, S(xctx->current_dirname));
} else {

View File

@ -129,6 +129,7 @@ int global_tedax_netlist(int global) /* netlister driver */
char *abs_path = NULL;
Str_hashtable subckt_table = {NULL, 0};
int lvs_ignore = tclgetboolvar("lvs_ignore");
int save_prev_mod = xctx->prev_set_modify;
xctx->push_undo();
statusmsg("",2); /* clear infowindow */
@ -234,6 +235,7 @@ int global_tedax_netlist(int global) /* netlister driver */
xctx->currsch--;
unselect_all(1);
xctx->pop_undo(4, 0);
xctx->prev_set_modify = save_prev_mod;
if(web_url) {
my_strncpy(xctx->current_dirname, current_dirname_save, S(xctx->current_dirname));
} else {

View File

@ -96,6 +96,7 @@ int global_verilog_netlist(int global) /* netlister driver */
const char *fmt_attr = NULL;
Str_hashtable subckt_table = {NULL, 0};
int lvs_ignore = tclgetboolvar("lvs_ignore");
int save_prev_mod = xctx->prev_set_modify;
split_f = tclgetboolvar("split_files");
xctx->push_undo();
@ -361,6 +362,7 @@ int global_verilog_netlist(int global) /* netlister driver */
xctx->currsch--;
unselect_all(1);
xctx->pop_undo(4, 0);
xctx->prev_set_modify = save_prev_mod;
if(web_url) {
my_strncpy(xctx->current_dirname, current_dirname_save, S(xctx->current_dirname));
} else {

View File

@ -121,6 +121,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
int split_f;
Str_hashtable subckt_table = {NULL, 0};
int lvs_ignore = tclgetboolvar("lvs_ignore");
int save_prev_mod = xctx->prev_set_modify;
split_f = tclgetboolvar("split_files");
xctx->push_undo();
@ -450,6 +451,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
xctx->currsch--;
unselect_all(1);
xctx->pop_undo(4, 0);
xctx->prev_set_modify = save_prev_mod;
if(web_url) {
my_strncpy(xctx->current_dirname, current_dirname_save, S(xctx->current_dirname));
} else {