int y0 = INT_MAX;
int y1 = INT_MIN;
+ int m = (c0->color - 1) % 2;
+
for (k = 0; k < c0->n_pins; k++) {
p = c0->pins[k];
for (j = i + 1; j < f->n_components; j++) {
c1 = f->components[j];
- if ((c0->x < 0 && c1->x > 0) || (c0->x > 0 && c1->x < 0))
+ if (c0->color != c1->color)
continue;
int y2 = INT_MAX;
if ((y0 <= y2 && y3 < y1) || (y0 < y2 && y3 <= y1)) {
- if ((c0->x < 0 && c0->x > c1->x) || (c0->x > 0 && c0->x < c1->x))
+ if ((0 == m && c0->x > c1->x) || (1 == m && c0->x < c1->x))
__ses_xchg_cx2(c0, c1);
} else if ((y2 <= y0 && y1 < y3) || (y2 < y0 && y1 <= y3)) {
- if ((c0->x < 0 && c0->x < c1->x) || (c0->x > 0 && c0->x > c1->x))
+ if ((0 == m && c0->x < c1->x) || (1 == m && c0->x > c1->x))
__ses_xchg_cx2(c0, c1);
}
}
ScfEpin* pc;
size_t i;
+ size_t j;
for (i = 0; i < f->n_components; i++) {
c = f->components[i];
if (SCF_EDA_NPN != c->type)
continue;
+ j = (c->color - 1) % 2;
+
pb = c->pins[SCF_EDA_NPN_B];
pc = c->pins[SCF_EDA_NPN_C];
pe = c->pins[SCF_EDA_NPN_E];
if (pc->y > pb->y) {
- if ((c->x < 0 && pc->x < pe->x) || (c->x > 0 && pc->x > pe->x))
+ if ((0 == j && pc->x < pe->x) || (1 == j && pc->x > pe->x))
SCF_XCHG(pc->x, pe->x);
} else if (pe->y < pb->y) {
- if ((c->x < 0 && pc->x > pe->x) || (c->x > 0 && pc->x < pe->x))
+ if ((0 == j && pc->x > pe->x) || (1 == j && pc->x < pe->x))
SCF_XCHG(pc->x, pe->x);
} else if (pc->y < pb->y) {
- if ((c->x > 0 && pc->x < pb->x) || (c->x < 0 && pc->x > pb->x)) {
+ if ((0 == j && pc->x > pb->x) || (1 == j && pc->x < pb->x))
SCF_XCHG(pc->x, pe->x);
- }
}
}
}
return ret;
__ses_setc_xy(f, d);
-// __ses_xchg_cx(f, d);
-// __ses_xchg_ce(f, d);
+ __ses_xchg_cx(f, d);
+ __ses_xchg_ce(f, d);
// __ses_mov_pos(f, d);
__ses_layout_cx(f, d);