From 4379a68a1970e97fa8ee31645b8650ba53fc6b83 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Sun, 16 Jan 2022 14:49:59 +0100 Subject: [PATCH] HILIGHT_CONN macro --- src/actions.c | 3 ++- src/editprop.c | 4 ++-- src/hilight.c | 8 ++++---- src/paste.c | 3 ++- src/save.c | 13 ++++++++----- src/xschem.h | 1 + 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/actions.c b/src/actions.c index 7eaec5fa..1789a936 100644 --- a/src/actions.c +++ b/src/actions.c @@ -930,7 +930,8 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot } dbg(1, "place_symbol(): done set_inst_prop()\n"); /* 03-02-2000 */ - if(!strcmp(get_tok_value(xctx->inst[n].prop_ptr,"highlight",0), "true")) xctx->inst[n].flags |= 4; + if(!strcmp(get_tok_value(xctx->inst[n].prop_ptr,"highlight",0), "true")) + xctx->inst[n].flags |= HILIGHT_CONN; type = xctx->sym[xctx->inst[n].ptr].type; cond= !type || !IS_LABEL_SH_OR_PIN(type); if(cond) xctx->inst[n].flags|=2; diff --git a/src/editprop.c b/src/editprop.c index 625c0496..704688a1 100644 --- a/src/editprop.c +++ b/src/editprop.c @@ -1069,8 +1069,8 @@ void update_symbol(const char *result, int x) get_tok_value(xctx->inst[*ii].prop_ptr, "lab",0)); } if(!strcmp(get_tok_value(xctx->inst[*ii].prop_ptr,"highlight",0), "true")) - xctx->inst[*ii].flags |= 4; - else xctx->inst[*ii].flags &= ~4; + xctx->inst[*ii].flags |= HILIGHT_CONN; + else xctx->inst[*ii].flags &= ~HILIGHT_CONN; } /* end for(k=0;klastsel;k++) */ /* new symbol bbox after prop changes (may change due to text length) */ if(xctx->modified) { diff --git a/src/hilight.c b/src/hilight.c index 61c24e47..4d6b9c25 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -779,7 +779,7 @@ void drill_hilight(int mode) npin = symbol->rects[PINLAYER]; rct=symbol->rect[PINLAYER]; hilight_connected_inst = en_hi && - ( (xctx->inst[i].flags & 4) || ((xctx->inst[i].ptr+ xctx->sym)->flags & 4) ); + ((xctx->inst[i].flags & HILIGHT_CONN) || ((xctx->inst[i].ptr+ xctx->sym)->flags & HILIGHT_CONN)); for(j=0; jinst[i].ptr+ xctx->sym)->type; hilight_connected_inst = en_hi && - ( (xctx->inst[i].flags & 4) || ((xctx->inst[i].ptr+ xctx->sym)->flags & 4) ); + ((xctx->inst[i].flags & HILIGHT_CONN) || ((xctx->inst[i].ptr+ xctx->sym)->flags & HILIGHT_CONN)); /* hilight/clear instances with hilight=true attr set and en_hilight_conn_inst option is set ... */ if(hilight_connected_inst && type && !IS_LABEL_SH_OR_PIN(type)) { int rects, j, nohilight_pins; @@ -1668,9 +1668,9 @@ void select_hilight_net(void) type = (xctx->inst[i].ptr+ xctx->sym)->type; hilight_connected_inst = en_hi && - ( (xctx->inst[i].flags & 4) || ((xctx->inst[i].ptr+ xctx->sym)->flags & 4) ); + ((xctx->inst[i].flags & HILIGHT_CONN) || ((xctx->inst[i].ptr+ xctx->sym)->flags & HILIGHT_CONN)); if( xctx->inst[i].color != -10000) { - dbg(1, "select_hilight_net(): instance %d flags &4 true\n", i); + dbg(1, "select_hilight_net(): instance %d flags & HILIGHT_CONN true\n", i); xctx->inst[i].sel = SELECTED; } else if(hilight_connected_inst) { diff --git a/src/paste.c b/src/paste.c index e17d805c..1efe6739 100644 --- a/src/paste.c +++ b/src/paste.c @@ -310,7 +310,8 @@ void merge_inst(int k,FILE *fd) new_prop_string(i, prop_ptr, k, tclgetboolvar("disable_unique_names")); /* the final tmp argument is zero for the 1st call and used in */ /* new_prop_string() for cleaning some internal caches. */ - if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr,"highlight",0), "true")) xctx->inst[i].flags |= 4; + if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr,"highlight",0), "true")) + xctx->inst[i].flags |= HILIGHT_CONN; my_free(871, &prop_ptr); xctx->instances++; diff --git a/src/save.c b/src/save.c index fdd468d8..7c2f6728 100644 --- a/src/save.c +++ b/src/save.c @@ -571,7 +571,8 @@ static void load_inst(int k, FILE *fd) load_ascii_string(&prop_ptr,fd); my_strdup(319, &xctx->inst[i].prop_ptr, prop_ptr); my_strdup2(320, &xctx->inst[i].instname, get_tok_value(xctx->inst[i].prop_ptr, "name", 0)); - if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr,"highlight",0), "true")) xctx->inst[i].flags |= 4; + if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr,"highlight",0), "true")) + xctx->inst[i].flags |= HILIGHT_CONN; dbg(2, "load_inst(): n=%d name=%s prop=%s\n", i, xctx->inst[i].name? xctx->inst[i].name:"", xctx->inst[i].prop_ptr? xctx->inst[i].prop_ptr:""); @@ -1784,8 +1785,9 @@ int load_sym_def(const char *name, FILE *embed_fd) get_tok_value(symbol[symbols].prop_ptr, "template", 0)); my_strdup2(515, &symbol[symbols].type, get_tok_value(symbol[symbols].prop_ptr, "type",0)); - if(!strcmp(get_tok_value(symbol[symbols].prop_ptr,"highlight",0), "true")) symbol[symbols].flags |= 4; - else symbol[symbols].flags &= ~4; + if(!strcmp(get_tok_value(symbol[symbols].prop_ptr,"highlight",0), "true")) + symbol[symbols].flags |= HILIGHT_CONN; + else symbol[symbols].flags &= ~HILIGHT_CONN; } else { @@ -1800,8 +1802,9 @@ int load_sym_def(const char *name, FILE *embed_fd) get_tok_value(symbol[symbols].prop_ptr, "template", 0)); my_strdup2(342, &symbol[symbols].type, get_tok_value(symbol[symbols].prop_ptr, "type",0)); - if(!strcmp(get_tok_value(symbol[symbols].prop_ptr,"highlight",0), "true")) symbol[symbols].flags |= 4; - else symbol[symbols].flags &= ~4; + if(!strcmp(get_tok_value(symbol[symbols].prop_ptr,"highlight",0), "true")) + symbol[symbols].flags |= HILIGHT_CONN; + else symbol[symbols].flags &= ~HILIGHT_CONN; } else { load_ascii_string(&aux_ptr, lcc[level].fd); diff --git a/src/xschem.h b/src/xschem.h index d573da98..1bfd1d0b 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -161,6 +161,7 @@ extern char win_temp_dir[PATH_MAX]; #define ELEMINST 4096 /* (initial) max # of placed elements, was 600 20102004 */ #define ELEMDEF 256 /* (initial) max # of defined elements */ #define EMBEDDED 1 /* used for embedded symbols marking in Symbol.flags */ +#define HILIGHT_CONN 4 /* used to hilight instances if connected wire is hilighted */ #define CADMAXGRIDPOINTS 512 #define CADMAXHIER 80 #define CADCHUNKALLOC 512 /* was 256 20102004 */