const ScfEline* el0 = *(const ScfEline**)v0;
const ScfEline* el1 = *(const ScfEline**)v1;
+ if (SCF_EDA_PIN_POS == el0->flags)
+ return -1;
+ if (SCF_EDA_PIN_NEG == el0->flags)
+ return 1;
+
+ if (SCF_EDA_PIN_POS == el1->flags)
+ return 1;
+ if (SCF_EDA_PIN_NEG == el1->flags)
+ return -1;
+
if (el0->n_conns < el1->n_conns)
return 1;
else {
if (scf_eline__add_pin(el, p->cid, p->id) < 0)
return -ENOMEM;
- p->lid = el->id;
-
+ p ->lid = el->id;
+
+ if (SCF_EDA_Battery == c->type) {
+ if (SCF_EDA_Battery_POS == p->id)
+ el->flags = SCF_EDA_PIN_POS;
+ else
+ el->flags = SCF_EDA_PIN_NEG;
+ }
goto next;
}
}
if (scf_eline__add_pin(el, p->cid, p->id) < 0)
return -ENOMEM;
- p->lid = el->id;
+ p ->lid = el->id;
+
+ if (SCF_EDA_Battery == c->type) {
+ if (SCF_EDA_Battery_POS == p->id)
+ el->flags = SCF_EDA_PIN_POS;
+ else
+ el->flags = SCF_EDA_PIN_NEG;
+ }
next:
p = NULL;
}
for (i = 0; i < f->n_elines; i++) {
el = f->elines[i];
- scf_logw("line i: %ld, %p\n", i, el);
+ scf_logw("line i: %ld, %p, el->flags: %#lx\n", i, el, el->flags);
for (j = 0; j + 1 < el->n_pins; j += 2)
for (i = 0; i < f->n_elines; i++) {
el0 = f->elines[i];
- scf_loge("i: %ld, el0: %ld, n_conns: %ld, n_pins: %ld\n", i, el0->id, el0->n_conns, el0->n_pins);
+ scf_loge("i: %ld, el0: %ld, n_conns: %ld, n_pins: %ld, flags: %#lx\n", i, el0->id, el0->n_conns, el0->n_pins, el0->flags);
for (j = 0; j < el0->n_conns; j++) {
ec = el0->conns[j];
if (!l)
return -ENOMEM;
- l->x0 = bx;
+ if (SCF_EDA_PIN_NEG == el->flags || SCF_EDA_PIN_POS == el->flags)
+ l->x0 = bx;
+ else
+ l->x0 = bx + d;
+
l->y0 = by + (n + j) * d;
l->y1 = l->y0;
if (el2->id == ec->lid && 0 == el2->n_lines) {
- int diff = 10 + rand() % 20;
-
- bx += diff;
- bw -= diff;
-
ret = __ses_layout_function(f, el2, pn, d, bx, by, bw, bh);
if (ret < 0)
return ret;
int ret = __ses_layout_function(f, el, &n, d, bx, by, bw, bh);
if (ret < 0)
return ret;
-
- int diff = 10 + rand() % 20;
-
- bx += diff;
- bw -= diff;
}
}
scf_logi("f->x: %d, f->y: %d, f->w: %d, f->h: %d\n", f->x, f->y, f->w, f->h);