From 89d847fb62c8dec0540b6cb60f993c1f022d5cf1 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Mon, 12 Jun 2023 09:13:20 +0200 Subject: [PATCH] fix a bug in `xschem annotate_op` function not showing data if `Live annotation...` option was not set beforehand. --- src/scheduler.c | 1 + src/token.c | 30 ++++++++++-------------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/scheduler.c b/src/scheduler.c index ba45fe75..ece7095f 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -254,6 +254,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } else { my_snprintf(f, S(f), "%s/%s.raw", tclgetvar("netlist_dir"), get_cell(xctx->sch[xctx->currsch], 0)); } + tclsetboolvar("live_cursor2_backannotate", 1); tclsetvar("rawfile_loaded", "0"); free_rawfile(1); tcleval("array unset ngspice::ngspice_data"); diff --git a/src/token.c b/src/token.c index 2732e092..3ad35f89 100644 --- a/src/token.c +++ b/src/token.c @@ -3400,10 +3400,8 @@ const char *translate(int inst, const char* s) else if(strcmp(token,"@spice_get_voltage")==0 ) { int start_level; /* hierarchy level where waves were loaded */ - if(xctx->graph_annotate_p>=0 && !tclgetboolvar("live_cursor2_backannotate")) { - xctx->graph_annotate_p = -1; - } - if((start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) { + int live = tclgetboolvar("live_cursor2_backannotate"); + if(live && (start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) { int multip; int no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; if(no_of_pins == 1) { @@ -3471,11 +3469,9 @@ const char *translate(int inst, const char* s) else if(strncmp(token,"@spice_get_voltage(", 19)==0 ) { int start_level; /* hierarchy level where waves were loaded */ + int live = tclgetboolvar("live_cursor2_backannotate"); dbg(1, "--> %s\n", token); - if(xctx->graph_annotate_p>=0 && !tclgetboolvar("live_cursor2_backannotate")) { - xctx->graph_annotate_p = -1; - } - if((start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) { + if(live && (start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) { char *fqnet = NULL; const char *path = xctx->sch_path[xctx->currsch] + 1; char *net = NULL; @@ -3529,10 +3525,8 @@ const char *translate(int inst, const char* s) else if(strncmp(token,"@spice_get_current(", 19)==0 ) { int start_level; /* hierarchy level where waves were loaded */ - if(xctx->graph_annotate_p>=0 && !tclgetboolvar("live_cursor2_backannotate")) { - xctx->graph_annotate_p = -1; - } - if((start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) { + int live = tclgetboolvar("live_cursor2_backannotate"); + if(live && (start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) { char *fqdev = NULL; const char *path = xctx->sch_path[xctx->currsch] + 1; char *dev = NULL; @@ -3599,10 +3593,8 @@ const char *translate(int inst, const char* s) else if(strcmp(token,"@spice_get_diff_voltage")==0 ) { int start_level; /* hierarchy level where waves were loaded */ - if(xctx->graph_annotate_p>=0 && !tclgetboolvar("live_cursor2_backannotate")) { - xctx->graph_annotate_p = -1; - } - if((start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) { + int live = tclgetboolvar("live_cursor2_backannotate"); + if(live && (start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) { int multip; int no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; if(no_of_pins == 2) { @@ -3668,10 +3660,8 @@ const char *translate(int inst, const char* s) else if(strcmp(token,"@spice_get_current")==0 ) { int start_level; /* hierarchy level where waves were loaded */ - if(xctx->graph_annotate_p>=0 && !tclgetboolvar("live_cursor2_backannotate")) { - xctx->graph_annotate_p = -1; - } - if((start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) { + int live = tclgetboolvar("live_cursor2_backannotate"); + if(live && (start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) { char *fqdev = NULL; const char *path = xctx->sch_path[xctx->currsch] + 1; char *dev = NULL;