{
ScfEcomponent* c;
ScfEline* el;
+ ScfEline* el2;
ScfEpin* p;
ScfEpin* p2;
p ->c_lid = el->id;
el->flags |= p->flags;
next:
+ for (n = 0; n + 1 < p->n_tos; n += 2) {
+
+ p2 = f->components[p->tos[n]]->pins[p->tos[n + 1]];
+
+ if (p2->cid > p->cid || p2->id > p->id)
+ break;
+
+ el2 = f->elines[p2->lid];
+
+ if (el2 == el)
+ continue;
+
+ if (el2->id < el->id)
+ SCF_XCHG(el2, el);
+
+ for (m = 0; m + 1 < el2->n_pins; m += 2) {
+ p2 = f->components[el2->pins[m]]->pins[el2->pins[m + 1]];
+
+ if (scf_eline__add_pin(el, p2->cid, p2->id) < 0)
+ return -ENOMEM;
+
+ p2->lid = el->id;
+ p2->c_lid = el->id;
+ el->flags |= p2->flags;
+ }
+
+ qsort(el->pins, el->n_pins / 2, sizeof(uint64_t) * 2, epin_cmp);
+
+ el2->n_pins = 0;
+ }
p = NULL;
}
}
- for (i = 0; i < f->n_elines; i++) {
+ for (i = 0; i < f->n_elines; ) {
el = f->elines[i];
+ if (0 == el->n_pins) {
+ scf_efunction__del_eline(f, el);
+ scf_eline__free(el);
+ continue;
+ }
+
el->c_pins = el->n_pins;
-#if 1
+ el->id = i;
+
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 (j = 0; j + 1 < el->n_pins; j += 2) {
+
+ c = f->components[el->pins[j]];
+ p = c->pins [el->pins[j + 1]];
- scf_logi("pin j: %ld, cid: %ld, pid: %ld\n", j, el->pins[j], el->pins[j + 1]);
+ p->lid = i;
+ p->c_lid = i;
+ scf_logi("pin j: %ld, c%ldp%ld\n", j, el->pins[j], el->pins[j + 1]);
+ }
printf("\n");
-#endif
+
+ i++;
}
return 0;
int y1 = p0->y < p1->y ? p1->y : p0->y;
for (m = i + 1; m < f->n_components; m++) {
- c1 = f->components[m];
+ c1 = f->components[m];
for (n = 0; n < c1->n_pins - 1; n++) {
p2 = c1->pins[n];
return ret;
}
- ses_steps_analyse(f, 5, 1);
+// ses_steps_analyse(f, 5, 1);
x = f->x;
y = f->y;
B->pins[SCF_EDA_Battery_NEG]->flags = SCF_EDA_PIN_NEG;
B->pins[SCF_EDA_Battery_POS]->flags = SCF_EDA_PIN_POS;
- EDA_INST_ADD_COMPONENT(f, D0, SCF_EDA_Diode);
- EDA_INST_ADD_COMPONENT(f, T0, SCF_EDA_Transistor);
- EDA_INST_ADD_COMPONENT(f, R0, SCF_EDA_Resistor);
- EDA_INST_ADD_COMPONENT(f, R1, SCF_EDA_Resistor);
- EDA_INST_ADD_COMPONENT(f, R2, SCF_EDA_Resistor);
+ EDA_INST_ADD_COMPONENT(f, D0, SCF_EDA_Diode); // 1
+ EDA_INST_ADD_COMPONENT(f, T0, SCF_EDA_Transistor); // 2
+ EDA_INST_ADD_COMPONENT(f, R0, SCF_EDA_Resistor); // 3
+ EDA_INST_ADD_COMPONENT(f, R1, SCF_EDA_Resistor); // 4
+ EDA_INST_ADD_COMPONENT(f, R2, SCF_EDA_Resistor); // 5
EDA_PIN_ADD_PIN(B, SCF_EDA_Battery_POS, D0, SCF_EDA_Diode_POS);
EDA_PIN_ADD_PIN(D0, SCF_EDA_Diode_NEG, R0, 1);
EDA_PIN_ADD_PIN(R0, 0, R1, 1);
EDA_PIN_ADD_PIN(R1, 0, B, SCF_EDA_Battery_NEG);
-// EDA_PIN_ADD_PIN(T0, SCF_EDA_Transistor_B, R1, 1);
+ EDA_PIN_ADD_PIN(T0, SCF_EDA_Transistor_B, R1, 1);
EDA_PIN_ADD_PIN(B, SCF_EDA_Battery_POS, R2, 1);
EDA_PIN_ADD_PIN(R2, 0, T0, SCF_EDA_Transistor_C);