allow Shift-T command (toggle spice_ignore attribute) to cycle through ignore-shorted-unset on selected elements

This commit is contained in:
stefan schippers 2025-01-20 16:48:31 +01:00
parent 0e53359ee0
commit 724c264c9d
1 changed files with 18 additions and 6 deletions

View File

@ -1909,8 +1909,10 @@ void copy_symbol(xSymbol *dest_sym, xSymbol *src_sym)
void toggle_ignore(void)
{
int i, n, first = 1, remove = 0;
int i, n, first = 1;
char *attr;
int flag = 0; /* 1: spice_ignore=true, 2: spice_ignore=short */
const char *spice_ignore_str;
if(xctx->netlist_type == CAD_VERILOG_NETLIST) attr="verilog_ignore";
else if(xctx->netlist_type == CAD_VHDL_NETLIST) attr="vhdl_ignore";
else if(xctx->netlist_type == CAD_TEDAX_NETLIST) attr="tedax_ignore";
@ -1925,12 +1927,22 @@ void toggle_ignore(void)
xctx->push_undo();
first = 0;
}
remove = 0;
if(!strboolcmp(get_tok_value(xctx->inst[i].prop_ptr, attr, 0), "true")) remove = 1;
if(remove) {
my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, NULL));
} else {
flag = 0;
spice_ignore_str = get_tok_value(xctx->inst[i].prop_ptr, attr, 0);
if(!strcmp(spice_ignore_str, "short")) flag = 2;
else if(!strboolcmp(spice_ignore_str, "true")) flag = 1;
if(flag == 0) flag = 1;
else if(flag == 1) flag = 2;
else flag = 0;
if(flag == 1) {
my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, "true"));
} else if(flag == 2) {
my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, "short"));
} else {
my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, NULL));
}
set_inst_flags(&xctx->inst[i]);
set_modify(1);