From 32f85ac4f416922354620ed4fe67fe435432a629 Mon Sep 17 00:00:00 2001 From: Stefan Schippers Date: Sun, 11 Oct 2020 13:08:32 +0200 Subject: [PATCH] do not force a full hash_wires() on every net insertion; code formatting --- src/actions.c | 10 +++------- src/callback.c | 8 ++++---- src/editprop.c | 7 ++++--- src/netlist.c | 6 ++++++ src/parselabel.l | 6 +++--- src/scheduler.c | 2 +- src/token.c | 29 ++++++++++++++--------------- src/vhdl_netlist.c | 3 ++- 8 files changed, 37 insertions(+), 34 deletions(-) diff --git a/src/actions.c b/src/actions.c index 86d09d37..e6fc25a8 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1626,12 +1626,6 @@ void new_wire(int what, double mx_snap, double my_snap) if( (what & PLACE) ) { if( (ui_state & STARTWIRE) && (x1!=x2 || y1!=y2) ) { - /* - prepared_netlist_structs = 0; - prepared_hash_wires = 0; - prepared_hilight_structs = 0; - prepare_netlist_structs(0); - */ push_undo(); if(manhattan_lines==1) { if(xx2!=xx1) { @@ -1669,7 +1663,8 @@ void new_wire(int what, double mx_snap, double my_snap) printf("xschem wire %g %g %g %g %d\n", xx1, yy1, xx2, yy2, -1); fflush(stdout); } - prepared_hash_wires = 0; + hash_wire(XINSERT, lastwire-1); + /* prepared_hash_wires = 0; */ prepared_hilight_structs = 0; update_conn_cues(1,1); if(show_pin_net_names) { @@ -1681,6 +1676,7 @@ void new_wire(int what, double mx_snap, double my_snap) draw(); bbox(END , 0.0 , 0.0 , 0.0 , 0.0); } + draw_hilight_net(1);/* for updating connection bubbles on hilight nets */ } if(! (what &END)) { x1=mx_snap; diff --git a/src/callback.c b/src/callback.c index 9c6bec07..1c866bd6 100644 --- a/src/callback.c +++ b/src/callback.c @@ -145,7 +145,7 @@ int callback(int event, int mx, int my, KeySym key, switch(event) { case EnterNotify: - if(!sel_or_clip[0]) my_snprintf(sel_or_clip, S(sel_or_clip), "%s/%s", user_conf_dir, ".selection.sch"); /* 20181002 */ + if(!sel_or_clip[0]) my_snprintf(sel_or_clip, S(sel_or_clip), "%s/%s", user_conf_dir, ".selection.sch"); /* xschem window *sending* selected objects when the pointer comes back in abort copy operation since it has been done @@ -252,7 +252,7 @@ int callback(int event, int mx, int my, KeySym key, new_polygon(RUBBER); /* 20171115 */ } if(!(ui_state & STARTPOLYGON) && (state&Button1Mask) && !(ui_state & STARTWIRE) && !(ui_state & STARTPAN2) && - !(state & Mod1Mask) && !(state & ShiftMask) && !(ui_state & PLACE_SYMBOL)) /* start of a mouse area selection */ + !(state & Mod1Mask) && !(state & ShiftMask) && !(ui_state & PLACE_SYMBOL)) /* start of a mouse area select */ { static int onetime=0; if(mx != mx_save || my != my_save) { @@ -260,7 +260,7 @@ int callback(int event, int mx, int my, KeySym key, select_rect(BEGIN,1); onetime=1; } - if(abs(mx-mx_save) > 8 || abs(my-my_save) > 8 ) { /* 20121123 set some reasonable threshold before unselecting */ + if(abs(mx-mx_save) > 8 || abs(my-my_save) > 8 ) { /* set some reasonable threshold before unselecting */ if(onetime) { unselect_all(); /* 20171026 avoid multiple calls of unselect_all() */ onetime=0; @@ -281,7 +281,7 @@ int callback(int event, int mx, int my, KeySym key, if( !(ui_state & STARTSELECT)) { select_rect(BEGIN,1); } - if(abs(mx-mx_save) > 8 || abs(my-my_save) > 8 ) { /* 20121130 set some reasonable threshold before unselecting */ + if(abs(mx-mx_save) > 8 || abs(my-my_save) > 8 ) { /* set some reasonable threshold before unselecting */ select_object(X_TO_XSCHEM(mx_save), Y_TO_XSCHEM(my_save), 0, 0); /* 20121130 remove near object if dragging */ rebuild_selected_array(); } diff --git a/src/editprop.c b/src/editprop.c index 8b28d7bf..570a4740 100644 --- a/src/editprop.c +++ b/src/editprop.c @@ -524,9 +524,10 @@ void edit_wire_property(void) int oldbus=0; int k = selectedgroup[i].n; if(selectedgroup[i].type != WIRE) continue; - prepared_hash_wires=0; /* 20181025 */ - prepared_netlist_structs=0; - prepared_hilight_structs=0; + /* does not seem to be necessary */ + /* prepared_hash_wires=0; + * prepared_netlist_structs=0; + * prepared_hilight_structs=0; */ oldbus = wire[k].bus; if(preserve == 1) { set_different_token(&wire[k].prop_ptr, diff --git a/src/netlist.c b/src/netlist.c index 34d96dec..c3d021a5 100644 --- a/src/netlist.c +++ b/src/netlist.c @@ -315,6 +315,7 @@ void hash_wire(int what, int n) double tmpd; double x1, y1, x2, y2; int x1a, x2a, y1a, y2a; + struct wireentry *wptr; /* 20190606 */ /* wire[n].node=NULL; */ @@ -351,6 +352,11 @@ void hash_wire(int what, int n) /* insert wire[n] in region [tmpi, tmpj] */ if(what==XINSERT) wireinsert(n, tmpi, tmpj); else wiredelete(n, tmpi, tmpj); + + /* reset ends of all wires that *could* touch wire[n] */ + for(wptr = wiretable[tmpi][tmpj] ; wptr ; wptr = wptr->next) { + wire[wptr->n].end1 = wire[wptr->n].end2 = -1; + } } } } diff --git a/src/parselabel.l b/src/parselabel.l index 4481ff44..d7e6dbff 100644 --- a/src/parselabel.l +++ b/src/parselabel.l @@ -156,7 +156,7 @@ ID_EXT_PARENTHESIS [-#+/=_a-zA-Z][-#@\\/:.=_+a-zA-Z0-9]*\([-#@\\/:.=_+a-zA-Z0-9] ^\*.* { /* a comment, return as LINE token */ yylval.ptr.str=NULL; /*19102004 */ if(dbg_var >= 3) fprintf(errfp, "yylex(): B_LINE: %s\n",yytext); - my_strdup(299, &yylval.ptr.str, yytext); /* these things are freed after use in expandlabel.y */ + my_strdup(299, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */ return B_LINE; }