fix selection of merged instances done b4 calculating bbox (uninit. values)

This commit is contained in:
Stefan Frederik 2022-01-19 02:05:05 +01:00
parent 1fb23208bc
commit 881b32a689
4 changed files with 25 additions and 8 deletions

View File

@ -1048,7 +1048,6 @@ void link_symbols_to_instances(int from) /* from >= 0 : linking symbols from pas
xctx->inst[i].ptr = match_symbol(xctx->inst[i].name);
}
for(i = from; i < xctx->instances; i++) {
if(merge) select_element(i,SELECTED,1, 0); /* leave elements selected if a paste/copy from windows is done */
type=xctx->sym[xctx->inst[i].ptr].type;
cond= !type || !IS_LABEL_SH_OR_PIN(type);
if(cond) xctx->inst[i].flags|=2; /* ordinary symbol */
@ -1061,6 +1060,7 @@ void link_symbols_to_instances(int from) /* from >= 0 : linking symbols from pas
* needs .lab field set above, so this must be done last */
for(i = from; i < xctx->instances; i++) {
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2);
if(merge) select_element(i,SELECTED,1, 0); /* leave elements selected if a paste/copy from windows is done */
}
}

View File

@ -102,12 +102,17 @@ void check_symbol_storage(void)
}
#undef ZERO_REALLOC
void check_inst_storage(void)
{
if(xctx->instances >= xctx->maxi)
{
xctx->maxi=(1 + xctx->instances / ELEMINST) * ELEMINST;
my_realloc(402, &xctx->inst, sizeof(xInstance)*xctx->maxi);
#ifdef ZERO_REALLOC
memset(xctx->inst + xctx->instances, 0, sizeof(xInstance) * (xctx->maxi - xctx->instances));
#endif
}
}
@ -117,6 +122,9 @@ void check_arc_storage(int c)
{
xctx->maxa[c]=(1 + xctx->arcs[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
my_realloc(403, &xctx->arc[c], sizeof(xArc)*xctx->maxa[c]);
#ifdef ZERO_REALLOC
memset(xctx->arc[c] + xctx->arcs[c], 0, sizeof(xArc) * (xctx->maxa[c] - xctx->arcs[c]));
#endif
}
}
@ -126,6 +134,9 @@ void check_box_storage(int c)
{
xctx->maxr[c]=(1 + xctx->rects[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
my_realloc(404, &xctx->rect[c], sizeof(xRect)*xctx->maxr[c]);
#ifdef ZERO_REALLOC
memset(xctx->rect[c] + xctx->rects[c], 0, sizeof(xRect) * (xctx->maxr[c] - xctx->rects[c]));
#endif
}
}
@ -135,6 +146,9 @@ void check_line_storage(int c)
{
xctx->maxl[c]=(1 + xctx->lines[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
my_realloc(405, &xctx->line[c], sizeof(xLine)*xctx->maxl[c]);
#ifdef ZERO_REALLOC
memset(xctx->line[c] + xctx->lines[c], 0, sizeof(xLine) * (xctx->maxl[c] - xctx->lines[c]));
#endif
}
}
@ -144,6 +158,9 @@ void check_polygon_storage(int c)
{
xctx->maxp[c]=(1 + xctx->polygons[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
my_realloc(406, &xctx->poly[c], sizeof(xPoly)*xctx->maxp[c]);
#ifdef ZERO_REALLOC
memset(xctx->poly[c] + xctx->polygons[c], 0, sizeof(xPoly) * (xctx->maxp[c] - xctx->polygons[c]));
#endif
}
}

View File

@ -142,12 +142,12 @@ extern char win_temp_dir[PATH_MAX];
#define CADHALFDOTSIZE 4
#define CADNULLNODE -1 /* no valid node number */
#define CADWIREMINDIST 8.0
#define CADMAXWIRES 4096
#define CADMAXTEXT 2048
#define CADMAXOBJECTS 512 /* (initial) max # of lines, rects (for each layer!!) */
#define MAXGROUP 300 /* (initial) max # of objects that can be drawn while moving */
#define ELEMINST 4096 /* (initial) max # of placed elements, was 600 20102004 */
#define ELEMDEF 256 /* (initial) max # of defined elements */
#define CADMAXWIRES 200
#define CADMAXTEXT 100
#define CADMAXOBJECTS 100 /* (initial) max # of lines, rects (for each layer!!) */
#define MAXGROUP 100 /* (initial) max # of objects that can be drawn while moving */
#define ELEMINST 100 /* (initial) max # of placed elements, was 600 20102004 */
#define ELEMDEF 50 /* (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

View File

@ -186,7 +186,7 @@ proc test_xschem_simulation {{f simulate_ff.sch}} {
proc netlist_test {} {
global netlist_dir
foreach {f t h} {
rom8k.sch spice 2880502233
rom8k.sch spice 2289841821
greycnt.sch verilog 3391559642
autozero_comp.sch spice 2011673313
loading.sch vhdl 2601437773