From: yu.dongliang <18588496441@163.com> Date: Sun, 9 Jul 2023 16:45:56 +0000 (+0800) Subject: tmp X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=2d17faeb09d1f0637a261e62aaa6ee882257beb9;p=ses.git tmp --- diff --git a/ses_layout.c b/ses_layout.c index ee54a77..e46bba4 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -238,6 +238,7 @@ int ses_layout_function(ScfEfunction* f, uint32_t d, uint32_t bx, uint32_t by, u ScfEline* el2; ScfEconn* ec; ScfLine* l; + ScfLine* l2; uint32_t w; uint32_t h; @@ -297,6 +298,50 @@ int ses_layout_function(ScfEfunction* f, uint32_t d, uint32_t bx, uint32_t by, u n += m; } + scf_logi("f->x: %d, f->y: %d, f->w: %d, f->h: %d\n", f->x, f->y, f->w, f->h); + + for (i = 0; i < f->n_elines; i++) { + el = f->elines[i]; + + uint32_t sum = 0; + + for (j = 0; j < el->n_conns; j++) { + ec = el->conns[j]; + + el2 = NULL; + for (k = 0; k < f->n_elines; k++) { + el2 = f->elines[k]; + + if (el2->id == ec->lid) + break; + } + + assert(k < f->n_elines); + uint32_t dis = UINT_MAX; + + for (k = 0; k < el->n_lines; k++) { + l = el->lines[k]; + + for (m = 0; m < el2->n_lines; m++) { + l2 = el2->lines[m]; + + uint32_t dis2; + + if (l->y0 < l2->y0) + dis2 = l2->y0 - l->y0; + else + dis2 = l->y0 - l2->y0; + + if (dis > dis2) + dis = dis2; + } + } + + sum += dis; + } + + scf_logi("el->id: %ld, sum: %d\n", el->id, sum); + } return 0; }