From b0a88325e741fe943fe9b595a27c8e1ff922478e Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Tue, 1 Nov 2022 12:54:43 +0100 Subject: [PATCH] "@path" will be expanded in symbols with the hierarchy path, so a fully qualified instance name is obtained with @path@name --- src/token.c | 24 +++++++++++++++++++++++ xschem_library/devices/nmos4.sym | 5 +++-- xschem_library/devices/pmos4.sym | 5 +++-- xschem_library/examples/LCC_instances.sch | 3 +++ xschem_library/rom8k/n.sym | 8 +++++--- xschem_library/rom8k/nlv.sym | 5 +++-- xschem_library/rom8k/p.sym | 8 +++++--- xschem_library/rom8k/plv.sym | 8 +++++--- xschem_library/rom8k/rom8k.sch | 5 +++++ 9 files changed, 56 insertions(+), 15 deletions(-) diff --git a/src/token.c b/src/token.c index 95f92558..4107e4e2 100644 --- a/src/token.c +++ b/src/token.c @@ -2844,6 +2844,12 @@ const char *translate(int inst, const char* s) STR_ALLOC(&result, tmp + result_pos, &size); memcpy(result+result_pos,tmp_sym_name, tmp+1); result_pos+=tmp; + } else if(strcmp(token,"@path")==0) { + const char *path = xctx->sch_path[xctx->currsch] + 1; + tmp=strlen(path); + STR_ALLOC(&result, tmp + result_pos, &size); + memcpy(result+result_pos, path, tmp+1); + result_pos+=tmp; } else if(strcmp(token,"@symname_ext")==0) { tmp_sym_name=xctx->inst[inst].name ? get_cell_w_ext(xctx->inst[inst].name, 0) : ""; tmp=strlen(tmp_sym_name); @@ -3472,6 +3478,24 @@ const char *translate2(Lcc *lcc, int level, char* s) memcpy(result + result_pos, token, tmp + 1); result_pos += tmp; } + else if(strcmp(token,"@path")==0) { + char *path = NULL; + my_strdup2(1617, &path, "@path@name\\."); + if(level > 1) { /* add parent LCC instance names (X1, Xinv etc) */ + int i; + for(i = 1; i