From 27f41119d8b8cccdf6c26a1338dc023055354999 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Tue, 26 Mar 2024 01:21:37 +0100 Subject: [PATCH] fourth round of additions to improve auto_hilight_graph_nodes --- src/hilight.c | 16 +++++++++++++--- .../examples/test_extracted_netlist.sch | 18 +++++++++--------- xschem_library/ngspice/pv_ngspice.sch | 12 ++++++------ 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/hilight.c b/src/hilight.c index 3288bc9d..20c339c7 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -262,16 +262,26 @@ int hilight_graph_node(const char *node, int col) int current = 0; const char *path; const char *path3; + const char *path_skip; + int skip = 0; char *path2 = NULL; char *n = NULL; char *nptr, *ptr, *ptr2; Hilight_hashentry *entry; + int start_level = sch_waves_loaded(); + + path_skip = path = xctx->sch_path[xctx->currsch]; + path_skip++; /* skip initial '.' */ + /* skip path components that are above the level where raw file was loaded */ + while(*path_skip && skip < start_level) { + if(*path_skip == '.') skip++; + ++path_skip; + } - path = xctx->sch_path[xctx->currsch]; my_strdup2(_ALLOC_ID_, &n, node); nptr = n; - dbg(1, "hilight_graph_node(): %s: %d\n", node, col); + dbg(0, "hilight_graph_node(): path_skip=%s, %s: %d\n", path_skip, node, col); if(strstr(n, "i(v.")) {current = 1; nptr += 4;} else if(strstr(n, "I(V.")) {current = 1; nptr += 4;} else if(strstr(n, "i(")) {current = 1; nptr += 2;} @@ -284,7 +294,7 @@ int hilight_graph_node(const char *node, int col) *ptr2 = '\0'; path3 = nptr; nptr = ptr2 + 1; - if(!strstr(path, path3)) + if(!strstr(path_skip, path3)) my_mstrcat(_ALLOC_ID_, &path2, path, path3, ".", NULL); else my_strdup2(_ALLOC_ID_, &path2, path); diff --git a/xschem_library/examples/test_extracted_netlist.sch b/xschem_library/examples/test_extracted_netlist.sch index 40e80516..c091d164 100644 --- a/xschem_library/examples/test_extracted_netlist.sch +++ b/xschem_library/examples/test_extracted_netlist.sch @@ -1,4 +1,4 @@ -v {xschem version=3.4.4 file_version=1.2 +v {xschem version=3.4.5 file_version=1.2 * * This file is part of XSCHEM, * a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit @@ -33,21 +33,21 @@ ypos2=2 divy=5 subdivy=1 unity=1 -x1=0 -x2=0.0004 +x1=2e-05 +x2=0.00042 divx=5 subdivx=1 dataset=0 unitx=u -color="7 8 12 4 9 9" -node="out +color="7 8 12 4 9 7" +node="OUT \\"in*12; in 12 *\\" -minus -plus -vpp -vnn" +MINUS +PLUS +VPP +VNN" hilight_wave=-1} P 7 7 60 -700 60 -760 50 -760 60 -790 70 -760 60 -760 60 -700 {fill=true} T {actual value diff --git a/xschem_library/ngspice/pv_ngspice.sch b/xschem_library/ngspice/pv_ngspice.sch index 34418df4..6f5fa037 100644 --- a/xschem_library/ngspice/pv_ngspice.sch +++ b/xschem_library/ngspice/pv_ngspice.sch @@ -25,12 +25,12 @@ V {} S {} E {} B 2 920 -580 1420 -190 {flags=graph -y1 = 0 -y2 = 7 +y1 = -26 +y2 = 12 divy = 7 subdivy=1 x1=0 -x2=79.8 +x2=48 divx=8 unitx=1 @@ -38,15 +38,15 @@ divx=8 dataset=4 -color=4 +color=7 node=i(vload)} B 2 920 -820 1420 -580 {flags=graph y1 = 0 -y2 = 400 +y2 = 410 divy = 4 subdivy=1 x1=0 -x2=79.8 +x2=48 divx=8 unitx=1