symbol texts: do a double translate() if symbol text `@model` resolves to `xxx@name`, so `xxxN1` will be returned. This will not happen if `@model` resolves to xxx\@name`

This commit is contained in:
stefan schippers 2024-02-10 13:59:27 +01:00
parent 8aa62f2efa
commit 81f22b8bb2
3 changed files with 11 additions and 3 deletions

View File

@ -544,6 +544,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
@ -666,8 +668,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
attribute. </pre>
<li><kbd> enable_layers</kbd></li><pre>
Enable/disable layers depending on tcl array variable enable_layer() </pre>
<li><kbd> escape_chars source</kbd></li><pre>
escape tcl special characters with backslash </pre>
<li><kbd> escape_chars source [charset]</kbd></li><pre>
escape tcl special characters with backslash
if charset is given escape characters in charset </pre>
<li><kbd> exit [closewindow] [force]</kbd></li><pre>
Exit the program, ask for confirm if current file modified.
if 'closewindow' is given close the window, otherwise leave with a blank schematic
@ -1498,6 +1501,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
</ul>

View File

@ -1893,7 +1893,7 @@ void get_additional_symbols(int what)
dbg(1, "get_additional_symbols(): schematic not existing\n");
dbg(1, "using: %s\n", symbol_base_sch);
}
if(xctx->tok_size && xctx->inst[i].ptr>= 0) { /* token exists and instance points to valid symbol */
if(xctx->tok_size && xctx->inst[i].ptr>= 0) { /* token exists and instance points to valid symbol */
int j;
char *sym = NULL;
int ignore_schematic = 0;

View File

@ -715,6 +715,8 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
}
#endif
my_strdup2(_ALLOC_ID_, &txtptr, translate(n, text.txt_ptr));
if(strchr(txtptr, '@') && !strstr(text.txt_ptr, "\\@"))
my_strdup2(_ALLOC_ID_, &txtptr, translate(n, txtptr));
dbg(1, "drawing string: str=%s prop=%s\n", txtptr, text.prop_ptr);
draw_string(textlayer, what, txtptr,
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
@ -881,6 +883,8 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
customfont = set_text_custom_font(&text);
#endif
my_strdup2(_ALLOC_ID_, &txtptr, translate(n, text.txt_ptr));
if(strchr(txtptr, '@') && !strstr(text.txt_ptr, "\\@"))
my_strdup2(_ALLOC_ID_, &txtptr, translate(n, txtptr));
if(txtptr[0]) draw_temp_string(gc, what, txtptr,
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
flip^text.flip, text.hcenter, text.vcenter, x0+x1, y0+y1, xscale, yscale);