fix regresions in get_sym_name() and get_sch_from_sym(), use catch {...} in proc edit_prop for xschem getprop symbol ... command if symbol not found

This commit is contained in:
stefan schippers 2025-10-14 00:31:47 +02:00
parent 8b7b444f13
commit b072701cbd
2 changed files with 11 additions and 9 deletions

View File

@ -1898,9 +1898,11 @@ const char *get_sym_name(int inst, int ndir, int ext, int abs_path)
/* resolve schematic=generator.tcl( @n ) where n=11 is defined in instance attrs */
my_strdup2(_ALLOC_ID_, &sch, get_tok_value(xctx->inst[inst].prop_ptr,"schematic", 6));
schematic_token_found = xctx->tok_size;
my_strdup2(_ALLOC_ID_, &sch, translate3(sch, 1, xctx->inst[inst].prop_ptr, NULL, NULL, NULL));
my_strdup2(_ALLOC_ID_, &sch, tcl_hook2(
str_replace(sch, "@symname", get_cell(xctx->inst[inst].name, 0), '\\', -1)));
if(sch[0])
my_strdup2(_ALLOC_ID_, &sch, translate3(sch, 1, xctx->inst[inst].prop_ptr, NULL, NULL, NULL));
if(sch[0])
my_strdup2(_ALLOC_ID_, &sch, tcl_hook2(
str_replace(sch, "@symname", get_cell(xctx->inst[inst].name, 0), '\\', -1)));
/*
* sch = tcl_hook2(str_replace(get_tok_value(xctx->inst[inst].prop_ptr,"schematic", 6), "@symname",
@ -2255,16 +2257,14 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback)
/* instance based symbol selection */
/* resolve schematic=generator.tcl( @n ) where n=11 is defined in instance attrs */
my_strdup2(_ALLOC_ID_, &str_tmp, get_tok_value(xctx->inst[inst].prop_ptr,"schematic", 6));
my_strdup2(_ALLOC_ID_, &str_tmp, translate3(str_tmp, 1, xctx->inst[inst].prop_ptr, NULL, NULL, NULL));
my_strdup2(_ALLOC_ID_, &str_tmp, tcl_hook2(
str_replace(str_tmp, "@symname", get_cell(xctx->inst[inst].name, 0), '\\', -1)));
if(str_tmp[0])
my_strdup2(_ALLOC_ID_, &str_tmp, translate3(str_tmp, 1, xctx->inst[inst].prop_ptr, NULL, NULL, NULL));
/*
* my_strdup(_ALLOC_ID_, &str_tmp, translate3(get_tok_value(xctx->inst[inst].prop_ptr,"schematic", 6),
* 1, xctx->inst[inst].prop_ptr, NULL, NULL, NULL));
*/
}
if(!str_tmp) my_strdup2(_ALLOC_ID_, &str_tmp, get_tok_value(sym->prop_ptr, "schematic", 6));
if(!str_tmp[0]) my_strdup2(_ALLOC_ID_, &str_tmp, get_tok_value(sym->prop_ptr, "schematic", 6));
if(str_tmp[0]) { /* schematic attribute in symbol or instance was given */
/* @symname in schematic attribute will be replaced with symbol name */
my_strdup2(_ALLOC_ID_, &sch, tcl_hook2(str_replace(str_tmp, "@symname",

View File

@ -7084,7 +7084,9 @@ proc edit_prop {txtlabel} {
set sym_sel_attr [xschem get_tok $tctx::retval select] ;# get from instance
if {$sym_sel_attr eq {}} {
set sym_sel_attr [xschem getprop symbol $symbol select] ;# not found in instance, get from symbol
if {[catch {xschem getprop symbol $symbol select} sym_sel_attr]} {
set sym_sel_attr {}
}
}
if {$sym_sel_attr eq {*}} {
.dialog.symprop tag add sel 1.0 {end - 1 chars}