From 81f22b8bb262038e941f1f737dd0cc39c53145d5 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 10 Feb 2024 13:59:27 +0100 Subject: [PATCH] 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` --- doc/xschem_man/developer_info.html | 8 ++++++-- src/actions.c | 2 +- src/draw.c | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index 87010d37..c91ebebe 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -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.
  • enable_layers
  •     Enable/disable layers depending on tcl array variable enable_layer() 
    -
  • escape_chars source
  • -   escape tcl special characters with backslash 
    +
  • escape_chars source [charset]
  • +   escape tcl special characters with backslash
    +   if charset is given escape characters in charset 
  • exit [closewindow] [force]
  •     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"
     
     
     
    +
     
     
      
    diff --git a/src/actions.c b/src/actions.c
    index 796fc87f..cdbc2757 100644
    --- a/src/actions.c
    +++ b/src/actions.c
    @@ -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;
    diff --git a/src/draw.c b/src/draw.c
    index 28c69d08..8cbfed47 100644
    --- a/src/draw.c
    +++ b/src/draw.c
    @@ -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);